|
@@ -267,68 +267,39 @@ public class WODispatchPlanDBServiceImpl implements WODispatchPlanDBService,WODi
|
|
|
upMap.remove("items_list");
|
|
|
woDispatchPlanMapper.updateWiths(upMap,andWhereUp,new HashMap<>(),"");
|
|
|
|
|
|
- //TODO 先删除所有关联再添加
|
|
|
-// if(model.getChufaRulsFlag()!=-1) {
|
|
|
-// Map<String, Object> andWhereRuls = new HashMap<>();
|
|
|
-// andWhereRuls.put("plan_id", model.getPlanId());
|
|
|
-// woDispatchPlanRulsMapper.deleteWiths(andWhereRuls, new HashMap<>(), "");
|
|
|
-// Map<String, Object> andWherePlanTags = new HashMap<>();
|
|
|
-// andWherePlanTags.put("plan_id", model.getPlanId());
|
|
|
-// woDispatchPlanTagsMapper.deleteWiths(andWherePlanTags, new HashMap<>(), "");
|
|
|
-// }
|
|
|
-// //删除排班
|
|
|
-// Map<String,Object> andWheresItems = new HashMap<>();
|
|
|
-// andWheresItems.put("plan_id",model.getPlanId());
|
|
|
-// List<DispatchCmdBatchItemModel> woMap = woDispatchCmdBatchItemDBService.listAllWithsExByDispoal("","",andWheresItems,new HashMap<>(),"handle_start_time","");
|
|
|
-// if(!CollectionUtils.isEmpty(woMap)){
|
|
|
-// for (DispatchCmdBatchItemModel item:woMap){
|
|
|
-// woDispatchCmdPatchItemMapper.deleteWiths(andWheresItems,new HashMap<>(),"");
|
|
|
-// //删除对应的处置建议
|
|
|
-// Map<String,Object> andWheresItemDisposals = new HashMap<>();
|
|
|
-// andWheresItemDisposals.put("batch_item_id",model.getPlanId());
|
|
|
-// woDispatchCmdPatchDisposalMapper.deleteWiths(andWheresItemDisposals,new HashMap<>(),"");
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
+ //TODO 删除所有规则, 作全量更新
|
|
|
+ Map<String, Object> andWherePlanTags = new HashMap<>();
|
|
|
+ andWherePlanTags.put("plan_id", model.getPlanId());
|
|
|
+ woDispatchPlanTagsMapper.deleteWiths(andWherePlanTags, new HashMap<>(), "");
|
|
|
+ Map<String, Object> andWhereRuls = new HashMap<>();
|
|
|
+ andWhereRuls.put("plan_id", model.getPlanId());
|
|
|
+ //TODO 删除排班
|
|
|
+ Map<String,Object> andWheresItems = new HashMap<>();
|
|
|
+ andWheresItems.put("plan_id",model.getPlanId());
|
|
|
+ List<DispatchCmdBatchItemModel> woMap = woDispatchCmdBatchItemDBService.listAllWithsExByDispoal("","",andWheresItems,new HashMap<>(),"handle_start_time","");
|
|
|
+ if(!CollectionUtils.isEmpty(woMap)){
|
|
|
+ for (DispatchCmdBatchItemModel item:woMap){
|
|
|
+ woDispatchCmdPatchItemMapper.deleteWiths(andWheresItems,new HashMap<>(),"");
|
|
|
+ //删除对应的处置建议
|
|
|
+ Map<String,Object> andWheresItemDisposals = new HashMap<>();
|
|
|
+ andWheresItemDisposals.put("batch_item_id",item.getBatchItemId());
|
|
|
+ woDispatchCmdPatchDisposalMapper.deleteWiths(andWheresItemDisposals,new HashMap<>(),"");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ woDispatchPlanRulsMapper.deleteWiths(andWhereRuls, new HashMap<>(), "");
|
|
|
if(model.getChufaRulsFlag()==1) {
|
|
|
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{
|
|
|
- Map<String,Object> andWheresWith = new HashMap<>();
|
|
|
- andWheresWith.put(WODispatchPlanRulsTable.W_INFO.PRIMARY_KEY,jp.getPlanId());
|
|
|
- woDispatchPlanRulsMapper.updateWiths(map,andWheresWith,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.getKey())) {
|
|
|
- if (StringUtils.isEmpty(jp.getPlanId())) {
|
|
|
- map.put(WODispatchPlanTagsTable.W_INFO.PRIMARY_KEY, model.getPlanId());
|
|
|
- //TODO 查询该计划和key的数据是否存在, 如果存在就修改, 不存在就新增
|
|
|
- Map<String,Object> planQuery = new HashMap<>();
|
|
|
- planQuery.put("plan_id",model.getPlanId());
|
|
|
- planQuery.put("key",jp.getKey());
|
|
|
- List<Map<String,Object>> planTags = woDispatchPlanTagsMapper.batchQueryWiths("","",
|
|
|
- planQuery,new HashMap<>(),"","");
|
|
|
- if(!CollectionUtils.isEmpty(planTags)){
|
|
|
- Map<String,Object> andWheresWith = new HashMap<>();
|
|
|
- andWheresWith.put(WODispatchPlanTagsTable.W_INFO.PRIMARY_KEY,model.getPlanId());
|
|
|
- andWheresWith.put("key",jp.getKey());
|
|
|
- woDispatchPlanTagsMapper.updateWiths(map,andWheresWith,new HashMap<>(),"");
|
|
|
- }else {
|
|
|
- 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<>(), "");
|
|
|
- }
|
|
|
+ map.put(WODispatchPlanTagsTable.W_INFO.PRIMARY_KEY, model.getPlanId());
|
|
|
+ woDispatchPlanTagsMapper.inserts(map);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -338,27 +309,19 @@ public class WODispatchPlanDBServiceImpl implements WODispatchPlanDBService,WODi
|
|
|
map.put(WODispatchCmdPatchItemTable.W_INFO.PLAN_ID, model.getPlanId());
|
|
|
map.put(WODispatchCmdPatchItemTable.W_INFO.CREATE_TIME, TimeTool.getCurMsUTC());
|
|
|
map.remove("dispoal_list");
|
|
|
+ map.put(WODispatchCmdPatchItemTable.W_INFO.PRIMARY_KEY,StringUtils.isEmpty(jp.getBatchItemId())?
|
|
|
+ CommTool.genPlanItemId():jp.getBatchItemId());
|
|
|
+ woDispatchCmdPatchItemMapper.inserts(map);
|
|
|
//添加相应的处置建议
|
|
|
for (JPDispatchCmdBatchDispoal dispoal : jp.getDispoalList()) {
|
|
|
Map<String, Object> mapDispoal = FastJsonUtil.obj2Map(dispoal, true);
|
|
|
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> 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> andWheresWith = new HashMap<>();
|
|
|
- andWheresWith.put(WODispatchCmdPatchItemTable.W_INFO.PRIMARY_KEY, jp.getBatchItemId());
|
|
|
- woDispatchCmdPatchItemMapper.updateWiths(map,andWheresWith,new HashMap<>(),"");
|
|
|
+ mapDispoal.put(WODispatchCmdPatchDisposalTable.W_INFO.BATCH_ITEM_ID,
|
|
|
+ map.get(WODispatchCmdPatchItemTable.W_INFO.PRIMARY_KEY));
|
|
|
+ mapDispoal.put(WODispatchCmdPatchDisposalTable.W_INFO.PRIMARY_KEY,
|
|
|
+ StringUtils.isEmpty(dispoal.getKey())?
|
|
|
+ CommTool.genPlanItemDispoalId():dispoal.getKey());
|
|
|
+ woDispatchCmdPatchDisposalMapper.inserts(mapDispoal);
|
|
|
}
|
|
|
}
|
|
|
}
|