Browse Source

fixed bug-625

15928045575 2 years ago
parent
commit
85d6b2c157

+ 1 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java

@@ -181,5 +181,6 @@ public class HttpStatus {
     public static final String MSG_028 = "合同未签约,不能手动完结!";
     public static final String MSG_029 = "合同编号超长!";
     public static final String MSG_030 = "合同名称超长!";
+    public static final String MSG_031 = "您与所选企业存在未完结业务,当前无法删除!";
 
 }

+ 12 - 0
sckw-modules/sckw-manage/pom.xml

@@ -68,6 +68,18 @@
             <version>1.0.0</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-order-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-transport-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-payment-api</artifactId>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 37 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmCooperateManageService.java

@@ -29,7 +29,11 @@ import com.sckw.manage.model.vo.req.CooperateManageQueryReqVo;
 import com.sckw.manage.model.vo.req.FindCooperateByEntReqVo;
 import com.sckw.manage.model.vo.req.FindEntCooperateReqVo;
 import com.sckw.manage.model.vo.res.*;
+import com.sckw.payment.api.model.constant.OrderEnum;
 import com.sckw.system.api.RemoteSystemService;
+import com.sckw.order.api.dubbo.TradeOrderInfoService;
+import com.sckw.transport.api.dubbo.TransportDubboService;
+import com.sckw.payment.api.dubbo.PaymentDubboService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
@@ -61,6 +65,15 @@ public class KwmCooperateManageService {
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
 
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private TradeOrderInfoService tradeOrderInfoService;
+
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private TransportDubboService transportDubboService;
+
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private PaymentDubboService paymentDubboService;
+
 
     /**
      * @param reqVo 分页入参
@@ -171,6 +184,7 @@ public class KwmCooperateManageService {
     @Transactional(rollbackFor = {})
     public void dissolve(String ids, Integer type) {
         //todo 判断是否可以解除(若和所选企业有未完结的业务单据(销售订单/采购订单、托运订单/承运订单、对账单、结算单),不支持解除合作)
+
         //提示:您与所选企业存在未完结业务,当前无法删除!
         List<KwmCooperate> kwmCooperates = kwmCooperateMapper.selectBatchIds(Arrays.asList(ids.split(Global.COMMA)));
         if (CollectionUtils.isEmpty(kwmCooperates)) {
@@ -178,6 +192,29 @@ public class KwmCooperateManageService {
         }
         Long userId = LoginUserHolder.getUserId();
         Date date = new Date();
+        //判断是否可以解除-销售订单
+        Boolean order = tradeOrderInfoService.associateEnt(kwmCooperates.get(0).getEntId());
+        if (!order)
+        {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_031);
+        }
+
+        //判断是否可以解除-托运和承运
+        Boolean sport = transportDubboService.checkLogisticsOrderFinishByEntId(kwmCooperates.get(0).getEntId());
+        if (!sport)
+        {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_031);
+        }
+        Map<OrderEnum, List<String>> ledgerMap = paymentDubboService.checkLedger(kwmCooperates.get(0).getEntId());
+        if (!ledgerMap.isEmpty())
+        {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_031);
+        }
+        Map<OrderEnum,List<String>> settlementMap= paymentDubboService.checkSettlement(kwmCooperates.get(0).getEntId());
+        if (!settlementMap.isEmpty())
+        {
+            throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_031);
+        }
         kwmCooperates.forEach(item -> {
             //运营端可以操作任意状态,企业端只能操作合作中的数据
             if (SystemTypeEnum.MANAGE.getCode().equals(LoginUserHolder.getSystemType())) {