Browse Source

河南郸城调度计划修改详情接口bug修复

1037015548@qq.com 11 months ago
parent
commit
9e78ccbda5

+ 25 - 40
src/main/java/com/shkpr/service/aimodelpower/dbdao/services/WODispatchPlanDBServiceImpl.java

@@ -222,25 +222,13 @@ public class WODispatchPlanDBServiceImpl implements WODispatchPlanDBService,WODi
             for (JPDispatchPlanInfoRuleSave jp : rulesList) {
                 Map<String, Object> map = FastJsonUtil.obj2Map(jp, true);
                 map.put("update_time", TimeTool.getCurMsUTC());
-                if(StringUtils.isEmpty(jp.getPlanId())) {
-                    map.put(WODispatchPlanRulsTable.W_INFO.PRIMARY_KEY, model.getPlanId());
-                    woDispatchPlanRulsMapper.inserts(map);
-                }else{
-                    HashMap<String,Object> rulsMapUpWhere = new HashMap<>();
-                    rulsMapUpWhere.put("plan_id",jp.getPlanId());
-                    woDispatchPlanRulsMapper.updateWiths(map,rulsMapUpWhere,new HashMap<>(),"");
-                }
+                map.put(WODispatchPlanRulsTable.W_INFO.PRIMARY_KEY, model.getPlanId());
+                woDispatchPlanRulsMapper.inserts(map);
             }
             for (JPDispatchPlanInfoTagsSave jp : tagsList) {
                 Map<String, Object> map = FastJsonUtil.obj2Map(jp, true);
-                if(StringUtils.isEmpty(jp.getPlanId())) {
-                    map.put(WODispatchPlanTagsTable.W_INFO.PRIMARY_KEY, model.getPlanId());
-                    woDispatchPlanTagsMapper.inserts(map);
-                }else{
-                    HashMap<String,Object> rulsMapUpWhere = new HashMap<>();
-                    rulsMapUpWhere.put("plan_id",jp.getPlanId());
-                    woDispatchPlanTagsMapper.updateWiths(map,rulsMapUpWhere,new HashMap<>(),"");
-                }
+                map.put(WODispatchPlanTagsTable.W_INFO.PRIMARY_KEY, model.getPlanId());
+                woDispatchPlanTagsMapper.inserts(map);
             }
         }
         for (JPDispatchCmdBatchItem jp:itemsList){
@@ -255,13 +243,7 @@ public class WODispatchPlanDBServiceImpl implements WODispatchPlanDBService,WODi
                 mapDispoal.put("key",StringUtils.isEmpty(dispoal.getKey())?CommTool.genPlanItemDispoalId():dispoal.getKey());
                 mapDispoal.put("create_time",TimeTool.getCurMsUTC());
                 mapDispoal.put(WODispatchCmdPatchDisposalTable.W_INFO.BATCH_ITEM_ID,map.get(WODispatchCmdPatchItemTable.W_INFO.PRIMARY_KEY));
-                if(StringUtils.isEmpty(dispoal.getKey())){
-                    woDispatchCmdPatchDisposalMapper.inserts(mapDispoal);
-                }else{
-                    Map<String,Object> andWhereUpDis = new HashMap<>();
-                    andWhereUpDis.put("key",dispoal.getKey());
-                    woDispatchCmdPatchDisposalMapper.updateWiths(mapDispoal,andWhereUpDis,new HashMap<>(),"");
-                }
+                woDispatchCmdPatchDisposalMapper.inserts(mapDispoal);
             }
             woDispatchCmdPatchItemMapper.inserts(map);
         }
@@ -317,20 +299,23 @@ public class WODispatchPlanDBServiceImpl implements WODispatchPlanDBService,WODi
                     map.put(WODispatchPlanRulsTable.W_INFO.PRIMARY_KEY, model.getPlanId());
                     woDispatchPlanRulsMapper.inserts(map);
                 }else{
-                    HashMap<String,Object> rulsMapUpWhere = new HashMap<>();
-                    rulsMapUpWhere.put("plan_id",jp.getPlanId());
-                    woDispatchPlanRulsMapper.updateWiths(map,rulsMapUpWhere,new HashMap<>(),"");
+                    Map<String,Object> andWheresWith = new HashMap<>();
+                    andWheresWith.put(WODispatchPlanRulsTable.W_INFO.PRIMARY_KEY,jp.getPlanId());
+                    woDispatchPlanRulsMapper.updateWiths(map,andWheresWith,new HashMap<>(),"");
                 }
             }
             for (JPDispatchPlanInfoTagsSave jp : tagsList) {
                 Map<String, Object> map = FastJsonUtil.obj2Map(jp, true);
-                if(StringUtils.isEmpty(jp.getPlanId())) {
-                    map.put(WODispatchPlanTagsTable.W_INFO.PRIMARY_KEY, model.getPlanId());
-                    woDispatchPlanTagsMapper.inserts(map);
-                }else{
-                    HashMap<String,Object> rulsMapUpWhere = new HashMap<>();
-                    rulsMapUpWhere.put("plan_id",jp.getPlanId());
-                    woDispatchPlanTagsMapper.updateWiths(map,rulsMapUpWhere,new HashMap<>(),"");
+                if(!StringUtils.isEmpty(jp.getKey())) {
+                    if (StringUtils.isEmpty(jp.getPlanId())) {
+                        map.put(WODispatchPlanTagsTable.W_INFO.PRIMARY_KEY, model.getPlanId());
+                        woDispatchPlanTagsMapper.inserts(map);
+                    } else {
+                        Map<String, Object> andWheresWith = new HashMap<>();
+                        andWheresWith.put(WODispatchPlanTagsTable.W_INFO.PRIMARY_KEY, jp.getPlanId());
+                        andWheresWith.put("key", jp.getPlanId());
+                        woDispatchPlanTagsMapper.updateWiths(map, andWheresWith, new HashMap<>(), "");
+                    }
                 }
             }
         }
@@ -343,24 +328,24 @@ public class WODispatchPlanDBServiceImpl implements WODispatchPlanDBService,WODi
                 //添加相应的处置建议
                 for (JPDispatchCmdBatchDispoal dispoal : jp.getDispoalList()) {
                     Map<String, Object> mapDispoal = FastJsonUtil.obj2Map(dispoal, true);
-                    mapDispoal.put("key", StringUtils.isEmpty(dispoal.getKey())?CommTool.genPlanItemDispoalId():dispoal.getKey());
                     mapDispoal.put("create_time", TimeTool.getCurMsUTC());
                     mapDispoal.put(WODispatchCmdPatchDisposalTable.W_INFO.BATCH_ITEM_ID, map.get(WODispatchCmdPatchItemTable.W_INFO.PRIMARY_KEY));
                     if(StringUtils.isEmpty(dispoal.getKey())){
+                        mapDispoal.put("key", CommTool.genPlanItemDispoalId());
                         woDispatchCmdPatchDisposalMapper.inserts(mapDispoal);
                     }else{
-                        Map<String,Object> andWhereUpDis = new HashMap<>();
-                        andWhereUpDis.put("key",dispoal.getKey());
-                        woDispatchCmdPatchDisposalMapper.updateWiths(mapDispoal,andWhereUpDis,new HashMap<>(),"");
+                        Map<String, Object> andWheresWith = new HashMap<>();
+                        andWheresWith.put(WODispatchCmdPatchDisposalTable.W_INFO.PRIMARY_KEY, dispoal.getKey());
+                        woDispatchCmdPatchDisposalMapper.updateWiths(mapDispoal,andWheresWith,new HashMap<>(),"");
                     }
                 }
                 if(StringUtils.isEmpty(jp.getBatchItemId())) {
                     map.put(WODispatchCmdPatchItemTable.W_INFO.PRIMARY_KEY, CommTool.genPlanItemId());
                     woDispatchCmdPatchItemMapper.inserts(map);
                 }else{
-                    Map<String,Object> andWhereUpItem = new HashMap<>();
-                    andWhereUpItem.put("batch_item_id",jp.getBatchItemId());
-                    woDispatchCmdPatchItemMapper.updateWiths(map,andWhereUpItem,new HashMap<>(),"");
+                    Map<String, Object> andWheresWith = new HashMap<>();
+                    andWheresWith.put(WODispatchCmdPatchItemTable.W_INFO.PRIMARY_KEY, jp.getBatchItemId());
+                    woDispatchCmdPatchItemMapper.updateWiths(map,andWheresWith,new HashMap<>(),"");
                 }
             }
         }