Authored by caoyan

质检优化

@@ -7,6 +7,7 @@ import java.util.Collections; @@ -7,6 +7,7 @@ import java.util.Collections;
7 import java.util.HashSet; 7 import java.util.HashSet;
8 import java.util.List; 8 import java.util.List;
9 import java.util.Map; 9 import java.util.Map;
  10 +import java.util.Map.Entry;
10 import java.util.Objects; 11 import java.util.Objects;
11 import java.util.Optional; 12 import java.util.Optional;
12 import java.util.Set; 13 import java.util.Set;
@@ -1219,13 +1220,22 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -1219,13 +1220,22 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
1219 1220
1220 //检验收货仓库和实际签收鉴定室是否一致, 如不一致给出提示 1221 //检验收货仓库和实际签收鉴定室是否一致, 如不一致给出提示
1221 StringBuilder warnTip = new StringBuilder(); 1222 StringBuilder warnTip = new StringBuilder();
  1223 + List<ExpressRecord> differList = Lists.newArrayList();
1222 for(ExpressRecord record : expressList) { 1224 for(ExpressRecord record : expressList) {
1223 Integer expressDepotNo = record.getDepotNum(); 1225 Integer expressDepotNo = record.getDepotNum();
1224 if(null != expressDepotNo && !expressDepotNo.equals(depotNo)) { 1226 if(null != expressDepotNo && !expressDepotNo.equals(depotNo)) {
1225 - warnTip.append("订单号:"+record.getOrderCode() +"的收货地址应为"+convertDepotNoStr(expressDepotNo)+","); 1227 + differList.add(record);
1226 } 1228 }
1227 } 1229 }
1228 1230
  1231 + if(CollectionUtils.isNotEmpty(differList)){
  1232 + Map<Integer, List<ExpressRecord>> recordMap = differList.stream().collect(Collectors.groupingBy(ExpressRecord::getDepotNum));
  1233 + for(Entry<Integer, List<ExpressRecord>> entry : recordMap.entrySet()){
  1234 + List<String> orderCodeList = entry.getValue().stream().map(ExpressRecord::getOrderCode).collect(Collectors.toList());
  1235 + warnTip.append("订单号:"+StringUtils.join(orderCodeList, ",") +"的收货地址应为"+convertDepotNoStr(entry.getKey())+",");
  1236 + }
  1237 + }
  1238 +
1229 if(StringUtils.isNotEmpty(warnTip.toString())){ 1239 if(StringUtils.isNotEmpty(warnTip.toString())){
1230 throw new ServiceException(406, warnTip +"当前收货仓库为"+convertDepotNoStr(depotNo)+",是否继续?"); 1240 throw new ServiceException(406, warnTip +"当前收货仓库为"+convertDepotNoStr(depotNo)+",是否继续?");
1231 } 1241 }