浏览代码

App工业列表查询带字典项
前端新增工程名称不能重复

wangzhe 10 月之前
父节点
当前提交
80b4ebb1b1

+ 10 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zdsz/ZEngineeringGYController.java

@@ -43,6 +43,16 @@ public class ZEngineeringGYController extends BaseController {
     private final IZEngineeringGYService iZEngineeringIndustryService;
 
 
+
+    /**
+     * 查询工业工程名称唯一性
+     */
+//    @SaCheckPermission("zdsz:engineeringIndustry:list")
+    @GetMapping("/testEnginNameUnique")
+    public R list(ZEngineeringIndustryGYBo bo) {
+        return R.ok(iZEngineeringIndustryService.testEnginNameUnique(bo));
+    }
+
     /**
      * 查询工业工程
      */

+ 1 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/IZEngineeringGYService.java

@@ -61,6 +61,7 @@ public interface IZEngineeringGYService {
 
     List<?> queryGYforApp(ZEngineeringIndustryGYBo bo);
     List<?> queryByTypeforApp(ZEngineeringIndustryGYBo bo);
+    Boolean testEnginNameUnique(ZEngineeringIndustryGYBo bo);
     /**
      * 查询工业工程 详情 根据三个条件 定位ID 获取详情
      */

+ 98 - 3
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringGYServiceImpl.java

@@ -11,6 +11,7 @@ import com.ruoyi.common.helper.LoginHelper;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.redis.RedisUtils;
 import com.ruoyi.framework.handler.MonthTableNameHandler;
+import com.ruoyi.system.service.ISysDictTypeService;
 import com.ruoyi.zdsz.domain.ZEngiineeringPhoto;
 import com.ruoyi.zdsz.domain.ZEngineeringGY;
 import com.ruoyi.zdsz.domain.ZEngineeringIndustry;
@@ -64,6 +65,9 @@ public class ZEngineeringGYServiceImpl implements IZEngineeringGYService {
     @Resource
     private IZEngiineeringPhotoService photoService;
 
+    @Resource
+    private final ISysDictTypeService dictTypeService;
+
 
     /**
      * 查询工业工程
@@ -461,6 +465,18 @@ public class ZEngineeringGYServiceImpl implements IZEngineeringGYService {
     }
 
     @Override
+    public Boolean testEnginNameUnique(ZEngineeringIndustryGYBo bo) {
+            List<?> list = queryByTypeforApp(new ZEngineeringIndustryGYBo());
+            for (int i = 0; i < list.size(); i++) {
+                Map map = (Map)list.get(i);
+                if(map.get("name").equals(bo.getEnginName())){
+                    return false; // 当前工程名称已存在 不可用
+                }
+            }
+            return true; // 当前工程名称可用
+        }
+
+    @Override
     public List<?> queryByTypeforApp(ZEngineeringIndustryGYBo bo) {
         LambdaQueryWrapper<ZEngineeringGY> zEngineeringIndustryBoLambdaQueryWrapper = buildListByType(bo);
         List<ZEngineeringGY> zEngineeringIndustryVos = baseMapper.selectList(zEngineeringIndustryBoLambdaQueryWrapper);
@@ -470,7 +486,9 @@ public class ZEngineeringGYServiceImpl implements IZEngineeringGYService {
 //                map.put("id", vo.getId());
                 map.put("name", vo.getEnginName());
                 map.put("enginType", vo.getEnginType()); // 小微商服
-//                map.put("enginClassification", vo.getEnginClassification()); // 室内管线 室外管线 调压柜 室内管线
+                List enginClassification = new ArrayList();
+                enginClassification.add(vo.getEnginClassification());
+                map.put("enginClassification", enginClassification); // 室内管线 室外管线 调压柜 室内管线
                 return map;
             })
             .collect(Collectors.toList());
@@ -478,16 +496,93 @@ public class ZEngineeringGYServiceImpl implements IZEngineeringGYService {
         for (Map map : result) {
             boolean isExist = false;
             for (Map gyVo : list) {
-                if(map.get("name").equals(gyVo.get("name")) && map.get("name").equals(gyVo.get("name"))){
+                if(map.get("name").equals(gyVo.get("name")) && map.get("enginType").equals(gyVo.get("enginType"))){
                     isExist = true;
                     break;
                 }
             }
             if(!isExist){
                 list.add(map);
+            }else { // 生成新字典项数组 而不是直接查询字典项
+                for (Map<String, Object> gyVo:list) {
+                    if(map.get("name").equals(gyVo.get("name")) && map.get("enginType").equals(gyVo.get("enginType"))){
+                        ((List)gyVo.get("enginClassification")).add(((List)map.get("enginClassification")).get(0)); // .getEnginClassification()
+                    }
+                }
             }
         }
-        return list;
+        /**
+         * App 弘瑞要再封装一层返回去 加个key
+         */
+        List hongRuiList = new ArrayList();
+        String dictType = "engin_classification";
+        List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
+        for(int k = 0; k < list.size(); k++){
+            Map map = list.get(k);
+            Map hongRuiMap = new HashMap<>();
+            hongRuiMap.put("name", map.get("name"));
+            hongRuiMap.put("enginType", map.get("enginType"));
+            List hongRuiEnginClassificationList = new ArrayList();
+            List<String> enginClassifications = (List)map.get("enginClassification");
+            for(int j = 0; j < enginClassifications.size(); j++){
+                for(int i = 0; i < data.size(); i++){
+                    SysDictData dictData = data.get(i);
+                    if(dictData.getDictLabel().equals(enginClassifications.get(j))){
+                        String enginClassification = dictData.getDictLabel();
+                        String dictChild;
+                        switch (enginClassification){
+                            case "调压柜":{
+                                dictChild = "gy_tyg";
+                                break;
+                            }
+                            case "室内管线":{
+                                dictChild = "gy_inner";
+                                break;
+                            }
+                            case "庭院":{
+                                dictChild = "gy_out";
+                                break;
+                            }
+                            case "架空管线":{
+                                dictChild = "gy_jkgx";
+                                break;
+                            }
+                            default:{
+                                dictChild = null;
+                            }
+                        }
+//                        dictData.setDictType(dictChild);
+                        Map dictMap = new HashMap();
+                        dictMap.put("dictLabel", dictData.getDictLabel());
+                        dictMap.put("dictValue", dictData.getDictValue());
+                        dictMap.put("dictType", dictChild);
+//                        hongRuiEnginClassificationList.add(dictData);
+                        hongRuiEnginClassificationList.add(dictMap);
+                        break;
+                    }
+                }
+            }
+            hongRuiMap.put("enginClassification", hongRuiEnginClassificationList);
+            hongRuiList.add(hongRuiMap);
+        }
+
+//        String dictType = "engin_classification";
+//        List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
+//        for(int k = 0; k < list.size(); k++){
+//            Map map = list.get(k);
+//            for(int j = 0; j < data.size(); j++){
+//                SysDictData dictData = data.get(j);
+//                List<String> enginClassifications = (List)map.get("enginClassification");
+//                for(int i = 0; i < enginClassifications.size(); i++){
+//                    if(dictData.getDictLabel().equals(enginClassifications.get(i))){
+//                        list.get(k).put("enginClassification", dictData);
+//                        break;
+//                    }
+//                }
+//            }
+//        }
+//        return list;
+        return hongRuiList;
     }
 
     /**

+ 5 - 2
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringNodeServiceImpl.java

@@ -1005,8 +1005,11 @@ public class ZEngineeringNodeServiceImpl implements IZEngineeringNodeService {
             if (item.getEnginClassification().equals("庭院")){
                 flag = "gy_out";
             }
-            if (item.getEnginClassification().equals("调压柜")){
-                flag = "gy_tyg";
+            if (item.getEnginClassification().equals("架空管线")){
+                flag = "gy_jkgx";
+            }
+            if (item.getEnginClassification().equals("每日施工日志")){
+                flag = "gy_log_every_day";
             }
             List stateList=new ArrayList();
             sysDictMap.get(flag).stream().forEach(item3 -> {

+ 10 - 2
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringWasteMaterialServiceImpl.java

@@ -114,10 +114,14 @@ public class ZEngineeringWasteMaterialServiceImpl implements IZEngineeringWasteM
         String enginClassification = zEngineeringGYVo.getEnginClassification();
         String dictType;
         switch (enginClassification){
-            case "调压柜":{
-                dictType = "gy_tyg";
+            case "每日施工日志":{
+                dictType = "gy_log_every_day";
                 break;
             }
+//            case "调压柜":{
+//                dictType = "gy_tyg";
+//                break;
+//            }
             case "室内管线":{
                 dictType = "gy_inner";
                 break;
@@ -126,6 +130,10 @@ public class ZEngineeringWasteMaterialServiceImpl implements IZEngineeringWasteM
                 dictType = "gy_out";
                 break;
             }
+            case "架空管线":{
+                dictType = "gy_jkgx";
+                break;
+            }
             default:{
                 dictType = null;
             }