ソースを参照

修改商品可以重复创建、修改订单、运单的货物名称

donglang 5 ヶ月 前
コミット
35daaa7a0a

+ 3 - 3
sckw-modules/sckw-product/src/main/java/com/sckw/product/service/KwpGoodsService.java

@@ -148,9 +148,9 @@ public class KwpGoodsService {
      */
     @Transactional(rollbackFor = Exception.class)
     public void addShelves(AddGoodsParam param) {
-        if (nameDuplicationJudgment(param.getName(), param.getSupplyEntId(), null)) {
-            throw new BusinessException("已存在相同商品名称!");
-        }
+//        if (nameDuplicationJudgment(param.getName(), param.getSupplyEntId(), null)) {
+//            throw new BusinessException("已存在相同商品名称!");
+//        }
         //添加商品信息
         KwpGoods goods = BeanUtils.copyProperties(param, KwpGoods.class);
         AddressInfo address = param.getAddressInfo();

+ 14 - 23
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/app/WaybillOrderService.java

@@ -290,13 +290,8 @@ public class WaybillOrderService {
                 .collect(Collectors.toMap(OrderDetailVo::getId, Function.identity(), (x, y) -> x));
 
         //查询字典
-        List<SysDictResDto> sysDictResDtos = remoteSystemService.queryDictByType(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
-        if (CollectionUtils.isEmpty(sysDictResDtos)){
-            log.info("品名类型字典数据不存在,truckNo:{}", param.getTruckNo());
-            throw new BusinessPlatfromException(ErrorCodeEnum.DATA_NOT_EXIST, "品名类型字典数据不存在");
-        }
-        Map<String, SysDictResDto> dictValueAndDictResDtoMap = sysDictResDtos.stream()
-                .collect(Collectors.toMap(SysDictResDto::getValue, Function.identity(), (x, y) -> x));
+        Map<String, Map<String, String>> dictValueAndDictResDtoMap = remoteSystemService.queryDictByType(
+                Arrays.asList(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), DictTypeEnum.GOODS_SPEC.getType()));
 
         //组装数据
         List<LogisticsOrderResp> ordderList = logOrderList.stream()
@@ -345,7 +340,7 @@ public class WaybillOrderService {
                                                      Map<Long, OrderDetailVo> tradeIdAndOrderDetailVoMap,
                                                      Map<Long, List<KwtLogisticsOrder>> tradeIdAndLogOrderList ,
                                                      Map<Long, List<KwtWaybillOrderSubtask>> logisticsOrderIdAndSubtaskList,
-                                                     Map<String, SysDictResDto> dictValueAndDictResDtoMap) {
+                                                     Map<String, Map<String, String>> dictValueAndDictResDtoMap) {
         LogisticsOrderResp orderResp = new LogisticsOrderResp();
         orderResp.setLogisticsOrderId(Optional.ofNullable(order.getId()).map(String::valueOf).orElse(null));
         orderResp.setLogisticsOrderNo(order.getLOrderNo());
@@ -353,9 +348,10 @@ public class WaybillOrderService {
         KwtLogisticsOrderGoods orderGoods = logOrderIdAndGoodsMap.getOrDefault(order.getId(), new KwtLogisticsOrderGoods());
         KwpGoods goods = goodsIdAndGoodsMap.getOrDefault(orderGoods.getGoodsId(), new KwpGoods());
         if (Objects.nonNull(goods)){
-            SysDictResDto sysDictResDto = dictValueAndDictResDtoMap.getOrDefault(goods.getGoodsType(), new SysDictResDto());
-            orderResp.setGoodsId(String.valueOf(goods.getId()));
-            orderResp.setGoodsName(goods.getName()+ "/" +sysDictResDto.getLabel()+"/"+ goods.getSpec());
+            orderResp.setGoodsId(Optional.ofNullable(goods.getId()).map(String::valueOf).orElse(null));
+            Map<String, String> goodsTypeMap= dictValueAndDictResDtoMap.getOrDefault(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), new HashMap<>());
+            Map<String, String> goodsSpecMap= dictValueAndDictResDtoMap.getOrDefault(DictTypeEnum.GOODS_SPEC.getType(), new HashMap<>());
+            orderResp.setGoodsName(goods.getName()+"/"+goodsTypeMap.getOrDefault(goods.getGoodsType(),"")+"/"+goodsSpecMap.getOrDefault(goods.getSpec(), ""));
         }
 
         //托运企业
@@ -700,15 +696,9 @@ public class WaybillOrderService {
                 Collectors.toMap(ticket -> ticket.getWOrderId() + "-" + ticket.getType(),
                         Function.identity(), (x, y) -> x));
 
-
         //查询字典
-        List<SysDictResDto> sysDictResDtos = remoteSystemService.queryDictByType(DictTypeEnum.PRODUCT_NAME_TYPE.getType());
-        if (CollectionUtils.isEmpty(sysDictResDtos)){
-            log.info("品名类型字典数据不存在,truckNo:{}", param.getTruckNo());
-            throw new BusinessPlatfromException(ErrorCodeEnum.DATA_NOT_EXIST, "品名类型字典数据不存在");
-        }
-        Map<String, SysDictResDto> dictValueAndDictResDtoMap = sysDictResDtos.stream()
-                .collect(Collectors.toMap(SysDictResDto::getValue, Function.identity(), (x, y) -> x));
+        Map<String, Map<String, String>> dictValueAndDictResDtoMap = remoteSystemService.queryDictByType(
+                Arrays.asList(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), DictTypeEnum.GOODS_SPEC.getType()));
 
         List<WaybillOrderStatusResp> ordderList = records.stream().map(
                 billOrder -> {
@@ -738,7 +728,7 @@ public class WaybillOrderService {
                                                        Map<Long, OrderDetailVo> tradeIdAndOrderDetailVoMap,
                                                        Map<Long, List<KwtLogisticsOrder>> tradeIdAndLogOrderList ,
                                                        Map<Long, List<KwtWaybillOrderSubtask>> logisticsOrderIdAndSubtaskList,
-                                                       Map<String, SysDictResDto> dictValueAndDictResDtoMap,
+                                                       Map<String, Map<String, String>> dictValueAndDictResDtoMap,
                                                        Map<Long, KwpGoods> goodsIdAndGoodsMap) {
         WaybillOrderStatusResp wbOrderResp = new WaybillOrderStatusResp();
         wbOrderResp.setId(wbOrder.getId());
@@ -768,9 +758,10 @@ public class WaybillOrderService {
         KwtLogisticsOrderGoods orderGoods = logOrderIdAndGoodsMap.getOrDefault(wbOrder.getLOrderId(), new KwtLogisticsOrderGoods());
         KwpGoods goods = goodsIdAndGoodsMap.getOrDefault(orderGoods.getGoodsId(), new KwpGoods());
         if (Objects.nonNull(goods)){
-            SysDictResDto sysDictResDto = dictValueAndDictResDtoMap.getOrDefault(goods.getGoodsType(), new SysDictResDto());
-            wbOrderResp.setGoodsId(Optional.ofNullable(orderGoods.getId()).map(String::valueOf).orElse(null));
-            wbOrderResp.setGoodsName(goods.getName()+ "/" +sysDictResDto.getLabel()+"/"+ goods.getSpec());
+            wbOrderResp.setGoodsId(Optional.ofNullable(goods.getId()).map(String::valueOf).orElse(null));
+            Map<String, String> goodsTypeMap= dictValueAndDictResDtoMap.getOrDefault(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), new HashMap<>());
+            Map<String, String> goodsSpecMap= dictValueAndDictResDtoMap.getOrDefault(DictTypeEnum.GOODS_SPEC.getType(), new HashMap<>());
+            wbOrderResp.setGoodsName(goods.getName()+"/"+goodsTypeMap.getOrDefault(goods.getGoodsType(),"")+"/"+goodsSpecMap.getOrDefault(goods.getSpec(), ""));
         }
 
         //装货地址