Kaynağa Gözat

Merge remote-tracking branch 'origin/dev' into dev

sptkw 2 yıl önce
ebeveyn
işleme
2cc2fb10a0

+ 1 - 1
sckw-modules-api/sckw-manage-api/src/main/java/com/sckw/manage/api/RemoteManageService.java

@@ -23,7 +23,7 @@ public interface RemoteManageService {
     Map<Long, List<EntAddressResDto>> queryEntAddressByEntIdList(List<Long> idList);
 
     /**
-     * @param entId 当前企业id  targetEntId对方企业id  cooperateType合作关系
+     * @param entId 当前企业id  targetEntId对方企业id  cooperateType合作关系[CooperateTypeEnum]
      * @return  FindEntCooperateResVo
      * @desc: 查询合作信息
      * @author: czh

+ 2 - 2
sckw-modules/sckw-product/src/main/java/com/sckw/product/controller/KwpGoodsController.java

@@ -235,7 +235,7 @@ public class KwpGoodsController {
      */
     @Log(description = "商品名称判重")
     @GetMapping("/nameDuplicationJudgment")
-    public HttpResult nameDuplicationJudgment(@RequestParam String name) {
-        return HttpResult.ok("商品名称判重成功", kwpGoodsService.nameDuplicationJudgment(name, null));
+    public HttpResult nameDuplicationJudgment(@RequestParam String name, @RequestParam Long supplyEntId) {
+        return HttpResult.ok("商品名称判重成功", kwpGoodsService.nameDuplicationJudgment(name, supplyEntId, null));
     }
 }

+ 2 - 0
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/req/AddGoodsDraftParam.java

@@ -2,6 +2,7 @@ package com.sckw.product.model.vo.req;
 
 import jakarta.validation.Valid;
 import jakarta.validation.constraints.DecimalMin;
+import jakarta.validation.constraints.NotNull;
 import jakarta.validation.constraints.Size;
 import lombok.Getter;
 import lombok.Setter;
@@ -84,6 +85,7 @@ public class AddGoodsDraftParam {
     /**
      * 供应企业
      */
+    @NotNull(message = "供应企业不能为空")
     private Long supplyEntId;
 
     /**

+ 2 - 1
sckw-modules/sckw-product/src/main/java/com/sckw/product/model/vo/req/UpdateGoodsParam.java

@@ -34,7 +34,7 @@ public class UpdateGoodsParam {
      * 商品名称
      */
     @Length(max = 50, message = "商品名称最多支持50字")
-    @NotBlank(message= "商品名称不能为空")
+    @NotBlank(message = "商品名称不能为空")
     private String name;
 
     /**
@@ -92,6 +92,7 @@ public class UpdateGoodsParam {
     /**
      * 供应企业
      */
+    @NotNull(message = "供应企业不能为空")
     private Long supplyEntId;
 
     /**

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

@@ -82,7 +82,7 @@ public class KwpGoodsService {
      */
     @Transactional(rollbackFor = Exception.class)
     public void addDraft(AddGoodsDraftParam param) {
-        if (nameDuplicationJudgment(param.getName(), null)) {
+        if (nameDuplicationJudgment(param.getName(), param.getSupplyEntId(), null)) {
             throw new BusinessException("已存在相同商品名称!");
         }
         //添加商品信息
@@ -109,7 +109,7 @@ public class KwpGoodsService {
         if (Objects.equals(param.getPrepaidLimit(), 1) && Objects.isNull(param.getAdvancePrice())) {
             throw new BusinessException("设置预付限额时,预付款最低限额不能为空!");
         }
-        if (nameDuplicationJudgment(param.getName(), null)) {
+        if (nameDuplicationJudgment(param.getName(), param.getSupplyEntId(), null)) {
             throw new BusinessException("已存在相同商品名称!");
         }
         //添加商品信息
@@ -264,7 +264,7 @@ public class KwpGoodsService {
      */
     @Transactional(rollbackFor = Exception.class)
     public void update(UpdateGoodsParam param) {
-        if (nameDuplicationJudgment(param.getName(), param.getId())) {
+        if (nameDuplicationJudgment(param.getName(), param.getSupplyEntId(), param.getId())) {
             throw new BusinessException("已存在相同商品名称!");
         }
         KwpGoods goods = getGoodsById(param.getId());
@@ -983,12 +983,13 @@ public class KwpGoodsService {
      * @author: yzc
      * @date: 2023-08-16 15:24
      * @Param name:
+     * @Param supplyEntId:
      * @Param id:
      * @return: java.lang.Boolean
      */
-    public Boolean nameDuplicationJudgment(String name, Long id) {
+    public Boolean nameDuplicationJudgment(String name, Long supplyEntId, Long id) {
         LambdaQueryWrapper<KwpGoods> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(KwpGoods::getSupplyEntId, LoginUserHolder.getEntId())
+        wrapper.eq(KwpGoods::getSupplyEntId, supplyEntId)
                 .eq(KwpGoods::getName, name).eq(KwpGoods::getDelFlag, Global.NO);
         if (Objects.nonNull(id)) {
             wrapper.ne(KwpGoods::getId, id);

+ 9 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/AcceptCarriageOrderService.java

@@ -12,6 +12,7 @@ import com.sckw.core.common.enums.StringConstant;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.enums.CarWaybillEnum;
+import com.sckw.core.model.enums.CooperateTypeEnum;
 import com.sckw.core.model.enums.LogisticsOrderEnum;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.CollectionUtils;
@@ -25,6 +26,7 @@ import com.sckw.excel.utils.ValidUtil;
 import com.sckw.fleet.api.RemoteFleetService;
 import com.sckw.fleet.api.model.vo.RTruckVo;
 import com.sckw.manage.api.RemoteManageService;
+import com.sckw.manage.api.model.dto.res.FindEntCooperateResVo;
 import com.sckw.mongo.enums.BusinessTypeEnum;
 import com.sckw.mongo.model.SckwLogisticsOrder;
 import com.sckw.mongo.model.SckwWaybillOrder;
@@ -1495,6 +1497,13 @@ public class AcceptCarriageOrderService {
             return HttpResult.error(httpResult.getMsg());
         }
         checkAddOrderParam(orderDTO);
+        /**2023-08-16 新增校验承运企业与托运企业是否存在合作关系*/
+        String consignCompanyId = orderDTO.getConsignCompanyId();
+        String acceptCompanyId = orderDTO.getAcceptCompanyId();
+        List<FindEntCooperateResVo> entCooperate = remoteManageService.findEntCooperate(Long.parseLong(acceptCompanyId), Long.parseLong(consignCompanyId), CooperateTypeEnum.CONSIGN.getCode());
+        if (entCooperate == null) {
+            return HttpResult.error("该托运企业与我方并无合作关系!");
+        }
         /**保存新建数据*/
         Long lOrderId = new IdWorker(NumberConstant.ONE).nextId();
         /**生成订单编号*/

+ 11 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/ConsignOrderService.java

@@ -9,6 +9,7 @@ import com.sckw.contract.api.model.dto.res.ContractCommonInfoResDto;
 import com.sckw.core.common.enums.NumberConstant;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.enums.CarWaybillEnum;
+import com.sckw.core.model.enums.CooperateTypeEnum;
 import com.sckw.core.model.enums.LogisticsOrderEnum;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.CollectionUtils;
@@ -21,11 +22,12 @@ import com.sckw.excel.utils.DateUtil;
 import com.sckw.excel.utils.ValidUtil;
 import com.sckw.fleet.api.RemoteFleetService;
 import com.sckw.fleet.api.model.vo.RTruckVo;
+import com.sckw.manage.api.RemoteManageService;
+import com.sckw.manage.api.model.dto.res.FindEntCooperateResVo;
 import com.sckw.mongo.enums.BusinessTypeEnum;
 import com.sckw.mongo.model.SckwLogisticsOrder;
 import com.sckw.order.api.dubbo.TradeOrderInfoService;
 import com.sckw.order.api.model.CompleteLogisticsOrderParam;
-import com.sckw.product.api.dubbo.GoodsInfoService;
 import com.sckw.stream.model.SckwBusSum;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.AreaTreeFrontResDto;
@@ -68,7 +70,7 @@ public class ConsignOrderService {
     RemoteContractService remoteContractService;
 
     @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 8000)
-    GoodsInfoService goodsInfoService;
+    RemoteManageService remoteManageService;
 
     @DubboReference(version = "1.0.0", group = "design", check = false)
     RemoteFleetService remoteFleetService;
@@ -935,6 +937,13 @@ public class ConsignOrderService {
             return HttpResult.error(httpResult.getMsg());
         }
         checkAddOrderParam(addOrderDTO);
+        /**2023-08-16 新增校验承运企业与托运企业是否存在合作关系*/
+        String consignCompanyId = addOrderDTO.getConsignCompanyId();
+        String acceptCompanyId = addOrderDTO.getAcceptCompanyId();
+        List<FindEntCooperateResVo> entCooperate = remoteManageService.findEntCooperate(Long.parseLong(consignCompanyId), Long.parseLong(acceptCompanyId), CooperateTypeEnum.CARRIAGE.getCode());
+        if (entCooperate == null) {
+            return HttpResult.error("该承运企业与我方企业并无合作关系!");
+        }
         /**保存新建数据*/
         Long lOrderId = new IdWorker(NumberConstant.ONE).nextId();
         /**生成订单编号*/

+ 6 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/LogisticsConsignmentService.java

@@ -942,7 +942,9 @@ public class LogisticsConsignmentService {
                             .set(KwtLogisticsOrder::getUpdateBy, LoginUserHolder.getUserId())
                             .set(KwtLogisticsOrder::getUpdateTime, new Date()));
                     KwtLogisticsOrderTrack orderTrack = kwtLogisticsOrderTrackMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderTrack>()
-                            .eq(KwtLogisticsOrderTrack::getLOrderId, s));
+                            .eq(KwtLogisticsOrderTrack::getLOrderId, s)
+                            .eq(KwtLogisticsOrderTrack::getStatus,LogisticsOrderEnum.CANCEL_ORDER.getCode())
+                    );
                     if (orderTrack == null) {
                         KwtLogisticsOrderTrack track = new KwtLogisticsOrderTrack();
                         track.setId(new IdWorker(NumberConstant.ONE).nextId());
@@ -1025,7 +1027,9 @@ public class LogisticsConsignmentService {
                             .set(KwtLogisticsOrder::getUpdateBy, LoginUserHolder.getUserId())
                             .set(KwtLogisticsOrder::getUpdateTime, new Date()));
                     KwtLogisticsOrderTrack orderTrack = kwtLogisticsOrderTrackMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderTrack>()
-                            .eq(KwtLogisticsOrderTrack::getLOrderId, s));
+                            .eq(KwtLogisticsOrderTrack::getLOrderId, s)
+                            .eq(KwtLogisticsOrderTrack::getStatus,LogisticsOrderEnum.CANCEL_ORDER.getCode())
+                    );
                     if (orderTrack == null) {
                         KwtLogisticsOrderTrack track = new KwtLogisticsOrderTrack();
                         track.setId(new IdWorker(NumberConstant.ONE).nextId());

+ 3 - 3
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/TransportCommonService.java

@@ -311,15 +311,15 @@ public class TransportCommonService {
             logisticsOrder1.setStatus(LogisticsOrderEnum.CANCEL_ORDER.getStatus());
             logisticsOrder1.setUpdateTime(new Date());
             logisticsOrder1.setUpdateByName(LoginUserHolder.getUserName());
-            sckwLogisticsOrder.setUpdateBy(LoginUserHolder.getUserId());
+            logisticsOrder1.setUpdateBy(LoginUserHolder.getUserId());
             SckwBusSum busSum1 = new SckwBusSum();
             //业务汇总类型
             busSum1.setBusSumType(BusinessTypeEnum.LOGISTICS_ORDER_TYPE.getName());
             //操作对象(1新增/2修改)
             busSum1.setMethod(NumberConstant.TWO);
             //业务汇总数据对象
-            busSum1.setObject(logisticsOrder);
-            streamBridge.send("sckw-busSum", JSON.toJSONString(busSum));
+            busSum1.setObject(logisticsOrder1);
+            streamBridge.send("sckw-busSum", JSON.toJSONString(busSum1));
         }
         return result;
     }