demand: 组树规则重构,虚拟单增加香港-缅甸快递逻辑。
committer: heyu
This commit is contained in:
parent
e2e6b78e5c
commit
ed5eea160e
@ -2844,7 +2844,7 @@ public class EmisBaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("002".equals(waybill.getTransLineType()) && StringUtil.isNotBlank(waybill.getVirtualRemark())) {
|
if (("078".equals(waybill.getTransLineType()) || "002".equals(waybill.getTransLineType())) && StringUtil.isNotBlank(waybill.getVirtualRemark())) {
|
||||||
Date sendDate = waybill.getSendDate();
|
Date sendDate = waybill.getSendDate();
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
Date limitDate = null;
|
Date limitDate = null;
|
||||||
@ -4026,9 +4026,47 @@ public class EmisBaseService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 按productType分组
|
// 按productType分组(支持productType和productTypeName为逗号分隔的多个类型,且一一对应,且每个rule只保留一个type和typeName)
|
||||||
Map<String, List<EmisTransPlanRule>> groupByProductType = lineRules.stream()
|
Map<String, List<EmisTransPlanRule>> groupByProductType = new HashMap<>();
|
||||||
.collect(Collectors.groupingBy(EmisTransPlanRule::getProductType));
|
for (EmisTransPlanRule rule : lineRules) {
|
||||||
|
if (rule.getProductType() != null) {
|
||||||
|
String[] types = rule.getProductType().split(",");
|
||||||
|
String[] typeNames = rule.getProductTypeName() != null ? rule.getProductTypeName().split(",") : new String[0];
|
||||||
|
for (int i = 0; i < types.length; i++) {
|
||||||
|
String type = types[i].trim();
|
||||||
|
if (!type.isEmpty()) {
|
||||||
|
EmisTransPlanRule newRule = new EmisTransPlanRule();
|
||||||
|
BeanUtils.copyProperties(rule, newRule);
|
||||||
|
newRule.setProductType(type);
|
||||||
|
if (i < typeNames.length) {
|
||||||
|
newRule.setProductTypeName(typeNames[i].trim());
|
||||||
|
} else {
|
||||||
|
newRule.setProductTypeName(null);
|
||||||
|
}
|
||||||
|
groupByProductType.computeIfAbsent(type, k -> new ArrayList<>()).add(newRule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 分组内去重(lineCode、productType、startSiteCode、nextSiteCode、supplierCode、startDate、endDate都相同只保留一条)
|
||||||
|
for (Map.Entry<String, List<EmisTransPlanRule>> entry : groupByProductType.entrySet()) {
|
||||||
|
List<EmisTransPlanRule> rules = entry.getValue();
|
||||||
|
Set<String> uniqueKeys = new HashSet<>();
|
||||||
|
List<EmisTransPlanRule> deduped = new ArrayList<>();
|
||||||
|
for (EmisTransPlanRule rule : rules) {
|
||||||
|
String key = (rule.getLineCode() == null ? "" : rule.getLineCode()) + "|"
|
||||||
|
+ (rule.getProductType() == null ? "" : rule.getProductType()) + "|"
|
||||||
|
+ (rule.getStartSiteCode() == null ? "" : rule.getStartSiteCode()) + "|"
|
||||||
|
+ (rule.getNextSiteCode() == null ? "" : rule.getNextSiteCode()) + "|"
|
||||||
|
+ (rule.getSupplierCode() == null ? "" : rule.getSupplierCode()) + "|"
|
||||||
|
+ (rule.getStartDate() == null ? "" : rule.getStartDate().toString()) + "|"
|
||||||
|
+ (rule.getEndDate() == null ? "" : rule.getEndDate().toString());
|
||||||
|
if (uniqueKeys.add(key)) {
|
||||||
|
deduped.add(rule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
entry.setValue(deduped);
|
||||||
|
}
|
||||||
|
|
||||||
// 处理每个productType分组
|
// 处理每个productType分组
|
||||||
for (Map.Entry<String, List<EmisTransPlanRule>> productEntry : groupByProductType.entrySet()) {
|
for (Map.Entry<String, List<EmisTransPlanRule>> productEntry : groupByProductType.entrySet()) {
|
||||||
@ -4840,7 +4878,7 @@ public class EmisBaseService {
|
|||||||
|
|
||||||
Map<String, Object> scanDatePromItem = new HashMap<>();
|
Map<String, Object> scanDatePromItem = new HashMap<>();
|
||||||
scanDatePromItem.put("billCode", emisWaybillSave.getBillCode());
|
scanDatePromItem.put("billCode", emisWaybillSave.getBillCode());
|
||||||
if ("002".equals(emisWaybillSave.getTransLineType())) {
|
if ("078".equals(emisWaybillSave.getTransLineType()) || "002".equals(emisWaybillSave.getTransLineType())) {
|
||||||
scanDatePromItem.put("problemType", "173");
|
scanDatePromItem.put("problemType", "173");
|
||||||
scanDatePromItem.put("remark", "出口虚拟面单");
|
scanDatePromItem.put("remark", "出口虚拟面单");
|
||||||
} else {
|
} else {
|
||||||
@ -4891,7 +4929,7 @@ public class EmisBaseService {
|
|||||||
if (emisWaybillSave.getMasterBillCode().equals(emisWaybillSave.getBillCode())) {
|
if (emisWaybillSave.getMasterBillCode().equals(emisWaybillSave.getBillCode())) {
|
||||||
throw new EmisBizError(EmisBizErrorType.FAIL, "运单号主单号不能相同");
|
throw new EmisBizError(EmisBizErrorType.FAIL, "运单号主单号不能相同");
|
||||||
}
|
}
|
||||||
if (!"002".equals(emisWaybillSave.getTransLineType()) && !"012".equals(emisWaybillSave.getTransLineType())
|
if (!"078".equals(emisWaybillSave.getTransLineType()) && !"002".equals(emisWaybillSave.getTransLineType()) && !"012".equals(emisWaybillSave.getTransLineType())
|
||||||
&& !"014".equals(emisWaybillSave.getTransLineType())) {
|
&& !"014".equals(emisWaybillSave.getTransLineType())) {
|
||||||
throw new EmisBizError(EmisBizErrorType.FAIL, "虚拟单只支持线路为缅甸快递/缅甸快递进口/柬埔寨快递进口");
|
throw new EmisBizError(EmisBizErrorType.FAIL, "虚拟单只支持线路为缅甸快递/缅甸快递进口/柬埔寨快递进口");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -150,7 +150,7 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
|
|||||||
emisTransPlanRule.setProductType(emisWaybill.getProductType());
|
emisTransPlanRule.setProductType(emisWaybill.getProductType());
|
||||||
List<EmisTransPlanRule> list = emisTransPlanRuleMapper.checkTransPlanRule(emisTransPlanRule);
|
List<EmisTransPlanRule> list = emisTransPlanRuleMapper.checkTransPlanRule(emisTransPlanRule);
|
||||||
if (CollectionUtil.isEmpty(list)) {
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
throw new EmisBizError(EmisBizErrorType.FAIL, "组批次起始网点、下一网点、供应商与规则不匹配");
|
throw new EmisBizError(EmisBizErrorType.FAIL, emisWaybill.getBillCode()+"组批次起始网点、下一网点、供应商与规则不匹配");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user