Merge branch 'master' of http://git.xdadan.loc/tanex/emis-service
This commit is contained in:
commit
8afce5fdaf
@ -4501,7 +4501,7 @@ public class EmisBaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public EmisBaseService.ProcessResult processWaybillBatch(List<EmisWaybill> waybills,
|
public EmisBaseService.ProcessResult processWaybillBatch(List<EmisWaybill> waybills,
|
||||||
Map<String, List<EmisTransPlanRule>> transPlanRulesByLineCode) {
|
Map<String, List<EmisTransPlanRule>> transPlanRulesByLineCode) {
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
int failCount = 0;
|
int failCount = 0;
|
||||||
List<String> failedBillCodes = new ArrayList<>();
|
List<String> failedBillCodes = new ArrayList<>();
|
||||||
@ -4585,13 +4585,29 @@ public class EmisBaseService {
|
|||||||
String key = batch.getStartSiteCode() + "_" + batch.getNextSiteCode();
|
String key = batch.getStartSiteCode() + "_" + batch.getNextSiteCode();
|
||||||
if (mergedBatches.containsKey(key)) {
|
if (mergedBatches.containsKey(key)) {
|
||||||
EmisTmsSiteBatch existingBatch = mergedBatches.get(key);
|
EmisTmsSiteBatch existingBatch = mergedBatches.get(key);
|
||||||
String existingSupplier = existingBatch.getSupplierCode();
|
// 合并supplierCode,去重、排序
|
||||||
String newSupplier = batch.getSupplierCode();
|
Set<String> supplierSet = new TreeSet<>();
|
||||||
if (!existingSupplier.equals(newSupplier)) {
|
if (StringUtils.isNotBlank(existingBatch.getSupplierCode())) {
|
||||||
existingBatch.setSupplierCode(existingSupplier + "," + newSupplier);
|
supplierSet.addAll(Arrays.asList(existingBatch.getSupplierCode().split(",")));
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(batch.getSupplierCode())) {
|
||||||
|
supplierSet.addAll(Arrays.asList(batch.getSupplierCode().split(",")));
|
||||||
|
}
|
||||||
|
// 新建一个新的Batch对象,复制属性,保证线程安全
|
||||||
|
EmisTmsSiteBatch newBatch = new EmisTmsSiteBatch();
|
||||||
|
BeanUtils.copyProperties(existingBatch, newBatch);
|
||||||
|
newBatch.setSupplierCode(String.join(",", supplierSet));
|
||||||
|
mergedBatches.put(key, newBatch);
|
||||||
} else {
|
} else {
|
||||||
mergedBatches.put(key, batch);
|
// 新建对象,避免外部引用被修改
|
||||||
|
EmisTmsSiteBatch newBatch = new EmisTmsSiteBatch();
|
||||||
|
BeanUtils.copyProperties(batch, newBatch);
|
||||||
|
Set<String> supplierSet = new TreeSet<>();
|
||||||
|
if (StringUtils.isNotBlank(batch.getSupplierCode())) {
|
||||||
|
supplierSet.addAll(Arrays.asList(batch.getSupplierCode().split(",")));
|
||||||
|
}
|
||||||
|
newBatch.setSupplierCode(String.join(",", supplierSet));
|
||||||
|
mergedBatches.put(key, newBatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
waybillBatches = new ArrayList<>(mergedBatches.values());
|
waybillBatches = new ArrayList<>(mergedBatches.values());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user