From bf79a36667124868583fcbf47af0e709e088b5e9 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期六, 12 十月 2024 09:09:32 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/dmvisit

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformServiceImpl.java |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformServiceImpl.java
index 44a60e9..168b829 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformServiceImpl.java
@@ -9,10 +9,7 @@
 import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.DateUtil;
 import com.doumee.core.utils.Utils;
-import com.doumee.dao.business.DeviceMapper;
-import com.doumee.dao.business.PlatformDeviceMapper;
-import com.doumee.dao.business.PlatformJobMapper;
-import com.doumee.dao.business.PlatformMapper;
+import com.doumee.dao.business.*;
 import com.doumee.dao.business.join.PlatformJobJoinMapper;
 import com.doumee.dao.business.join.PlatformJoinMapper;
 import com.doumee.dao.business.model.*;
@@ -46,6 +43,8 @@
 
     @Autowired
     private PlatformMapper platformMapper;
+    @Autowired
+    private PlatformGroupMapper platformGroupMapper;
     @Autowired
     private PlatformJoinMapper platformJoinMapper;
     @Autowired
@@ -135,6 +134,28 @@
     public void updateById(Platform platform) {
         platform.setEditor(platform.getLoginUserInfo().getId());
         platform.setEditDate(new Date());
+        Platform model = platformMapper.selectById(platform.getId());
+        if(model ==null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(model.getGroupId()!= null && platform.getGroupId()!=null && !Constants.equalsInteger(platform.getGroupId(),model.getGroupId())){
+            PlatformGroup group = platformGroupMapper.selectById(platform.getGroupId());
+            if(group ==null || Constants.equalsInteger(group.getIsdeleted(),Constants.ONE)){
+                throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝鏈堝彴缁勪俊鎭笉姝g‘锛�");
+            }
+            //濡傛灉鏈堝彴鍒嗙粍鍙戠敓鍙樺寲
+            Long count =  platformJobJoinMapper.selectCount(  new QueryWrapper<PlatformJob>().lambda()
+                    .eq(PlatformJob::getIsdeleted,Constants.ZERO)
+                    .notIn(PlatformJob::getStatus,Constants.PlatformJobStatus.WART_SIGN_IN.getKey()
+                            ,Constants.PlatformJobStatus.WAIT_CONFIRM.getKey()
+                            ,Constants.PlatformJobStatus.DONE.getKey()
+                            ,Constants.PlatformJobStatus.LEAVED.getKey()
+                            ,Constants.PlatformJobStatus.CANCEL.getKey()
+                    ));
+            if(count!=null && count>0){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝褰撳墠鏈堝彴鏈夋鍦ㄤ綔涓氱殑浠诲姟锛屼笉鑳借繘琛屾湀鍙扮粍鍒囨崲鎿嶄綔锛�");
+            }
+        }
         //鍒犻櫎LED/骞挎挱鏁版嵁
         platformDeviceMapper.delete(new QueryWrapper<PlatformDevice>().lambda()
                 .eq(PlatformDevice::getPlatformId,platform.getId())

--
Gitblit v1.9.3