fix:支持规则与参数不一致的情况

yun-zuoyi
汪云昊 5 years ago
parent 737c2d2d53
commit 19a7256cb6

@ -47,17 +47,15 @@ public final class BarcodeParseUtil {
String[] barcodeKey = barcodeRule.getBarcodeRule().split(barcodeRule.getBarcodeSeparator());
String[] barcodeValue = barcode.split(barcodeRule.getBarcodeSeparator());
// 避免出现长度不相等
int size = barcodeKey.length;
if (barcodeKey.length != barcodeValue.length) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("条码与规则不匹配!")
.build();
size = Math.min(barcodeKey.length,barcodeValue.length);
}
// 匹配条码数据
HashMap<String, String> barcodeMap = new HashMap<>();
for (int i = 0; i < barcodeKey.length; i++) {
for (int i = 0; i < size; i++) {
barcodeMap.put(barcodeKey[i], barcodeValue[i]);
}
return barcodeMap;

Loading…
Cancel
Save