|
@@ -61,13 +61,28 @@ public class FillGatherTaskServiceImpl extends BaseServiceImpl<FillGatherTaskMap
|
|
|
private final FillUpdateRecordMapper fillUpdateRecordMapper;
|
|
|
private final SysRoleMapper sysRoleMapper;
|
|
|
|
|
|
- private void deleteDetails(List<String> detailIds){
|
|
|
+ private void deleteDetails(List<String> detailIds,String taskId){
|
|
|
+ StringBuilder ids = new StringBuilder();
|
|
|
for(int i=0;i<detailIds.size();i++){
|
|
|
FillGatherTaskDetail detail = new FillGatherTaskDetail();
|
|
|
detail.setId(detailIds.get(i));
|
|
|
+ ids.append(detail.getId()).append("&");
|
|
|
fillGatherTaskDetailMapper.deleteByPrimaryKey(detail);
|
|
|
}
|
|
|
-
|
|
|
+ // 将redis缓存中的集合进行一个删除
|
|
|
+ String idString = ids.toString();
|
|
|
+ List<FillGatherTaskDetailVO> list = RedisUtils.getList(taskId,0,-1);
|
|
|
+ List<FillGatherTaskDetailVO> updateList = ListUtils.newArrayList();
|
|
|
+ if(list != null && list.size() > 0){
|
|
|
+ for(FillGatherTaskDetailVO vo : updateList){
|
|
|
+ if(idString.contains(vo.getId())){ // 过滤已经删除的任务明细
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ updateList.add(vo);
|
|
|
+ }
|
|
|
+ RedisUtils.del(taskId);
|
|
|
+ RedisUtils.setList(taskId,updateList,24*60*60);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -153,10 +168,10 @@ public class FillGatherTaskServiceImpl extends BaseServiceImpl<FillGatherTaskMap
|
|
|
}
|
|
|
}
|
|
|
if (userInfo.getSuperAdmin()==1||flag) {
|
|
|
- if (dto.getIsAdd() == 0) {
|
|
|
+ if (dto.getIsAdd() == 0) { // 删除巡检明细
|
|
|
task.setTotalNum(task1.getTotalNum() - dto.getDetailIds().size());
|
|
|
task.setWaitNum(task1.getTotalNum() - dto.getDetailIds().size());
|
|
|
- deleteDetails(dto.getDetailIds());
|
|
|
+ deleteDetails(dto.getDetailIds(),dto.getId());
|
|
|
} else if (dto.getIsAdd() == 1) {
|
|
|
List<FillGatherTaskDetailVO> detailVOS = fillGatherTaskDetailMapper.selectVOByTaskId(task1.getId());
|
|
|
StringBuffer sb = new StringBuffer();
|
|
@@ -523,6 +538,24 @@ public class FillGatherTaskServiceImpl extends BaseServiceImpl<FillGatherTaskMap
|
|
|
mapper.updateByPrimaryKeySelective(updTask);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void getDetailBySbId(String sbId) {
|
|
|
+ FillGatherTaskDetailDTO query = new FillGatherTaskDetailDTO();
|
|
|
+ query.setSbId(sbId);
|
|
|
+ query.setGenerateNum(0);
|
|
|
+ FillGatherTaskDetail detail = fillGatherTaskDetailMapper.selectSpecial(query);
|
|
|
+ // 调用删除接口
|
|
|
+ if(detail != null){
|
|
|
+ FillGatherTaskDTO up = new FillGatherTaskDTO();
|
|
|
+ up.setId(detail.getId());
|
|
|
+ List<String> ids = ListUtils.newArrayList();
|
|
|
+ ids.add(detail.getId());
|
|
|
+ up.setDetailIds(ids);
|
|
|
+ up.setIsAdd(0);
|
|
|
+ this.updateDetails(up);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 给巡检人发送消息
|
|
@@ -622,22 +655,14 @@ public class FillGatherTaskServiceImpl extends BaseServiceImpl<FillGatherTaskMap
|
|
|
detail.setTaskId(taskId);
|
|
|
detail.setId(IdGeneratorUtils.getObjectId());
|
|
|
detail.setStatus(0);
|
|
|
-
|
|
|
details.add(detail);
|
|
|
}
|
|
|
-// for(String sbId : sbIds){
|
|
|
-// FillGatherTaskDetail detail = new FillGatherTaskDetail();
|
|
|
-// detail.setContent(content);
|
|
|
-// detail.setCreatedTime(LocalDateTime.now());
|
|
|
-// detail.setCreatedUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
-// detail.setCreatedUserName(SecurityUtils.getUserInfo().getUsername());
|
|
|
-// detail.setSbId(sbId);
|
|
|
-// detail.setTaskId(taskId);
|
|
|
-// detail.setId(IdGeneratorUtils.getObjectId());
|
|
|
-// detail.setStatus(0);
|
|
|
-// detail.setSortNum(100);
|
|
|
-// details.add(detail);
|
|
|
-// }
|
|
|
fillGatherTaskDetailMapper.insertListforComplex(details);
|
|
|
+ // 获取最新的任务明细
|
|
|
+ List<FillGatherTaskDetailVO> list = fillGatherTaskDetailMapper.selectList(new FillGatherTaskDetailDTO().setTaskId(taskId));
|
|
|
+ if(list != null && list.size() > 0){
|
|
|
+ RedisUtils.del(taskId);
|
|
|
+ RedisUtils.setList(taskId,list,24*60*60);
|
|
|
+ }
|
|
|
}
|
|
|
}
|