3254194295 4 月之前
父节点
当前提交
d3fedad774

+ 22 - 1
platform-service/src/main/java/com/platform/service/check/impl/CheckStandardServiceImpl.java

@@ -171,6 +171,7 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
         if(model.getEnable() == null){
             model.setEnable(1);
         }
+
         // 设置编码
         Weekend<CheckStandard> weekend = new Weekend<>(CheckStandard.class);
         weekend.weekendCriteria().andIsNotNull(CheckStandard::getId);
@@ -183,7 +184,16 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
             String str1 = String.format("%05d", count);
             model.setNo(str1);
         }
-
+        if (model.getCheckUserType()==3){
+            if (model.getSbId()!=null) {
+                SbInfo sbInfo = sbInfoMapper.selectByPrimaryKey(model.getSbId());
+                if (sbInfo!=null) {
+                    model.setCheckUserId(sbInfo.getRepairUser());
+                }else {
+                    throw new BusinessException("所选设备已不存在!");
+                }
+            }
+        }
         CheckStandard checkStandard = super.saveModelByDTO(model);
         this.saveFile(model);
         this.saveImage(model);
@@ -217,6 +227,17 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
     @Override
     public void modModelByDTO(CheckStandardDTO model) {
 
+        if (model.getCheckUserType()==3){
+            if (model.getSbId()!=null) {
+                SbInfo sbInfo = sbInfoMapper.selectByPrimaryKey(model.getSbId());
+                if (sbInfo!=null) {
+                    model.setCheckUserId(sbInfo.getRepairUser());
+                }else {
+                    throw new BusinessException("所选设备已不存在!");
+                }
+            }
+        }
+
         super.modModelByDTO(model);
 
         // 先删后插,前端删除的不存在与ids里面,说明被删掉了,需要删除