|
@@ -221,14 +221,26 @@ public class WODispatchPlanDBServiceImpl implements WODispatchPlanDBService,WODi
|
|
|
if(model.getChufaRulsFlag()==1) {
|
|
|
for (JPDispatchPlanInfoRuleSave jp : rulesList) {
|
|
|
Map<String, Object> map = FastJsonUtil.obj2Map(jp, true);
|
|
|
- map.put(WODispatchPlanRulsTable.W_INFO.PRIMARY_KEY, model.getPlanId());
|
|
|
map.put("update_time", TimeTool.getCurMsUTC());
|
|
|
- woDispatchPlanRulsMapper.inserts(map);
|
|
|
+ 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<>(),"");
|
|
|
+ }
|
|
|
}
|
|
|
for (JPDispatchPlanInfoTagsSave jp : tagsList) {
|
|
|
Map<String, Object> map = FastJsonUtil.obj2Map(jp, true);
|
|
|
- map.put(WODispatchPlanTagsTable.W_INFO.PRIMARY_KEY, model.getPlanId());
|
|
|
- woDispatchPlanTagsMapper.inserts(map);
|
|
|
+ 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<>(),"");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
for (JPDispatchCmdBatchItem jp:itemsList){
|
|
@@ -274,45 +286,57 @@ public class WODispatchPlanDBServiceImpl implements WODispatchPlanDBService,WODi
|
|
|
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<>(),"");
|
|
|
- }
|
|
|
- }
|
|
|
+// 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<>(),"");
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
if(model.getChufaRulsFlag()==1) {
|
|
|
for (JPDispatchPlanInfoRuleSave jp : rulesList) {
|
|
|
+ //先判断是否修改
|
|
|
Map<String, Object> map = FastJsonUtil.obj2Map(jp, true);
|
|
|
- map.put(WODispatchPlanRulsTable.W_INFO.PRIMARY_KEY, model.getPlanId());
|
|
|
map.put("update_time", TimeTool.getCurMsUTC());
|
|
|
- woDispatchPlanRulsMapper.inserts(map);
|
|
|
+ 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<>(),"");
|
|
|
+ }
|
|
|
}
|
|
|
for (JPDispatchPlanInfoTagsSave jp : tagsList) {
|
|
|
Map<String, Object> map = FastJsonUtil.obj2Map(jp, true);
|
|
|
- map.put(WODispatchPlanTagsTable.W_INFO.PRIMARY_KEY, model.getPlanId());
|
|
|
- woDispatchPlanTagsMapper.inserts(map);
|
|
|
+ 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(itemsList!=null) {
|
|
|
for (JPDispatchCmdBatchItem jp : itemsList) {
|
|
|
Map<String, Object> map = FastJsonUtil.obj2Map(jp, true);
|
|
|
- map.put(WODispatchCmdPatchItemTable.W_INFO.PRIMARY_KEY, CommTool.genPlanItemId());
|
|
|
map.put(WODispatchCmdPatchItemTable.W_INFO.PLAN_ID, model.getPlanId());
|
|
|
map.put(WODispatchCmdPatchItemTable.W_INFO.CREATE_TIME, TimeTool.getCurMsUTC());
|
|
|
map.remove("dispoal_list");
|
|
@@ -330,7 +354,14 @@ public class WODispatchPlanDBServiceImpl implements WODispatchPlanDBService,WODi
|
|
|
woDispatchCmdPatchDisposalMapper.updateWiths(mapDispoal,andWhereUpDis,new HashMap<>(),"");
|
|
|
}
|
|
|
}
|
|
|
- woDispatchCmdPatchItemMapper.inserts(map);
|
|
|
+ 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<>(),"");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return ResponseCode.RESULT_NORMAL;
|