فهرست منبع

质控类型提示语返回

chengyao 4 سال پیش
والد
کامیت
db052b7b44

+ 1 - 1
common/src/main/java/com/diagbot/exception/CommonErrorCode.java

@@ -14,7 +14,7 @@ public enum CommonErrorCode implements ErrorCode {
     RPC_ERROR("00000002", "远程调度失败"),
     CANCEL_SUCCESSFUL("00000003","解绑成功"),
     CHECK_CONNECTION("00000005","是否解除绑定"),
-    CHECKMAIN_CONNECTION("00000006","是否解除绑定"),
+    CHECKMAIN_CONNECTION("00000006","解绑成功"),
     SAVE_SUCCESSFUL("00000007","添加成功"),
     ALTER_SUCCESSFUL("00000009","修改成功"),
     PARAM_ERROR("00029999", "%s"), //参数错误

+ 17 - 23
mrman-service/src/main/java/com/diagbot/facade/QcTypeFacade.java

@@ -22,6 +22,7 @@ import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.*;
@@ -68,28 +69,21 @@ public class QcTypeFacade extends QcTypeServiceImpl {
             parTypelist.forEach(qcType -> {
                 parTypeIdSet.add(qcType.getParentTypeId());
             });
-            //修改
-        if(null != qcTypeVO.getId()){
-                list = this.list(new QueryWrapper<QcType>()
-                        .eq("hospital_id", qcTypeVO.getHospitalId())
-                        .eq("is_deleted", IsDeleteEnum.N.getKey())
-                        .notIn("id",parTypeIdSet)
-                        .ne("id",qcTypeVO.getId())
-                        .isNull("parent_type_id")
-                        .orderByAsc("name"));
-        }else{
-            //新增操作
-            //未质控的质控id包含了父类
+        };
 
-                list = this.list(new QueryWrapper<QcType>()
-                        .eq("hospital_id", qcTypeVO.getHospitalId())
-                        .eq("is_deleted", IsDeleteEnum.N.getKey())
-                        .notIn("id",parTypeIdSet)
-                        .isNull("parent_type_id")
-                        .orderByAsc("name"));
+            QueryWrapper<QcType> qcTypeQueryWrapper = new QueryWrapper<>();
+            qcTypeQueryWrapper.eq("hospital_id", qcTypeVO.getHospitalId());
+            qcTypeQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+            if(!CollectionUtils.isEmpty(parTypeIdSet)){
+                qcTypeQueryWrapper.notIn("id",parTypeIdSet);
             }
+            qcTypeQueryWrapper.isNull("parent_type_id");
+        //修改 非此判断为新增
+        if(null != qcTypeVO.getId()) {
+            qcTypeQueryWrapper.ne("id", qcTypeVO.getId());
         }
-
+            qcTypeQueryWrapper.orderByAsc("name");
+            list = this.list(qcTypeQueryWrapper);
         return RespDTO.onSuc(list);
     }
     /**
@@ -118,13 +112,13 @@ public class QcTypeFacade extends QcTypeServiceImpl {
                         .eq("id", qcType.getParentTypeId()));
                 RespDTO respDTO = new RespDTO();
                 respDTO.code = "00000005";
-                respDTO.msg = "该类型已被" + "\"" + qcTypeMain.getName() + "\"" + "类型绑定,确定需要解绑?";
+                respDTO.msg = "该质控类型已被" + "\"" + qcTypeMain.getName() + "\"" + "类型绑定,需先将其解绑";
                return respDTO;
                //父类存在关联  一对多给出提示
             }else if(ListUtil.isNotEmpty(parentList)){
                 RespDTO respDTO = new RespDTO();
-                respDTO.code = "00000006";
-                respDTO.msg = "该质控类型已被关联,删除将解绑其关联类型,是否删除?";
+                respDTO.code = "00000005";
+                respDTO.msg = "该质控类型存在绑定的子类型,需先将其解绑";
                 return respDTO;
             }
         //如果父类关联子类,同样提示
@@ -149,7 +143,7 @@ public class QcTypeFacade extends QcTypeServiceImpl {
                 );
             }
             RespDTO respDTO = new RespDTO();
-            respDTO.code = "00000005";
+            respDTO.code = "00000006";
             respDTO.msg = "解绑成功";
             return respDTO;