1.台账接口bug解决

2.技术监督bug解决
This commit is contained in:
cdf
2024-03-15 08:49:16 +08:00
parent ec8c4e27ce
commit 4b3b1ffcce
3 changed files with 59 additions and 44 deletions

View File

@@ -807,7 +807,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
.eq(Monitor::getStatus,DataStateEnum.ENABLE.getCode()).in(Monitor::getOrgId,deptList.stream().map(Dept::getCode).collect(Collectors.toList())) .eq(Monitor::getStatus,DataStateEnum.ENABLE.getCode()).in(Monitor::getOrgId,deptList.stream().map(Dept::getCode).collect(Collectors.toList()))
.eq(Monitor::getMonitorState,dictData.getId()) .eq(Monitor::getMonitorState,dictData.getId())
.in(Monitor::getMonitorTag,tagList) .in(Monitor::getMonitorTag,tagList)
.or(item->item.in(Monitor::getId,monitorIds))); .or(CollectionUtil.isNotEmpty(monitorIds),item->item.in(CollectionUtil.isNotEmpty(monitorIds),Monitor::getId,monitorIds)));
monitorList.forEach(item->result.add(CommMonitorInfoDTO.builder().id(item.getId()).name(item.getName()).powerStationName(item.getPowerrName()).build())); monitorList.forEach(item->result.add(CommMonitorInfoDTO.builder().id(item.getId()).name(item.getName()).powerStationName(item.getPowerrName()).build()));
return result; return result;
} }

View File

@@ -609,9 +609,7 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.LINE_STATE.getName(), DicDataEnum.RUN.getName()).getData(); DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.LINE_STATE.getName(), DicDataEnum.RUN.getName()).getData();
List<Dept> deptList = deptFeignClient.getAllDept().getData(); List<Dept> deptList = deptFeignClient.getAllDept().getData();
List<String> monitorList = this.lambdaQuery().select(Monitor::getOrgId).eq(Monitor::getMonitorState,dictData.getId()).list().stream().map(Monitor::getOrgId).distinct().collect(Collectors.toList()); List<String> monitorList = this.lambdaQuery().select(Monitor::getOrgId).eq(Monitor::getMonitorState,dictData.getId()).list().stream().map(Monitor::getOrgId).distinct().collect(Collectors.toList());
List<Dept> deptTem = deptList.stream().filter(it->monitorList.contains(it.getCode())).collect(Collectors.toList()); return deptList.stream().filter(it->monitorList.contains(it.getCode())).collect(Collectors.toList());
return deptTem;
} }

View File

@@ -159,8 +159,8 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
Date date = new Date(); Date date = new Date();
thsSupervise.setCreateTime(date); thsSupervise.setCreateTime(date);
thsSupervise.setCreateUser(RequestUtil.getUsername()); thsSupervise.setCreateUser(RequestUtil.getUsername());
thsSupervise.setModifyUser(RequestUtil.getUsername()); //thsSupervise.setModifyUser(RequestUtil.getUsername());
thsSupervise.setModifyTime(date); //thsSupervise.setModifyTime(date);
thsSupervise.setSupIndex(IdUtil.simpleUUID()); thsSupervise.setSupIndex(IdUtil.simpleUUID());
this.buildSuperviseName(thsSupervise, superviceRunLogVo.getOverRunLog(), dept); this.buildSuperviseName(thsSupervise, superviceRunLogVo.getOverRunLog(), dept);
this.save(thsSupervise); this.save(thsSupervise);
@@ -183,6 +183,31 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
} }
} }
@Override
@Transactional(rollbackFor = Exception.class)
public HttpResult deleteSupervise(SuperviseDto superviseDto) {
if (CollectionUtil.isNotEmpty(superviseDto.getDeleteIds())) {
superviseDto.getDeleteIds().forEach(id -> {
thsOverRunLogService.remove(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, id));
thsSuperviseMapper.delete(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, id));
//删除同时删除工作流程
FlowableAss flowableAss = flowableAssMapper.selectById(id);
if (Objects.nonNull(flowableAss)) {
iFlowDefinitionService.deleteInstance(flowableAss.getExecIndex(), "");
flowableAssMapper.deleteById(id);
}
});
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, "删除技术监督");
}
@Override @Override
public Page<SuperviseVo> querySuperviseList(SuperviseDto superviseDto) { public Page<SuperviseVo> querySuperviseList(SuperviseDto superviseDto) {
Integer pageNum = PageFactory.getPageNum(superviseDto); Integer pageNum = PageFactory.getPageNum(superviseDto);
@@ -222,27 +247,6 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
return page; return page;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public HttpResult deleteSupervise(SuperviseDto superviseDto) {
if (CollectionUtil.isNotEmpty(superviseDto.getDeleteIds())) {
superviseDto.getDeleteIds().forEach(id -> {
thsOverRunLogService.remove(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, id));
thsSuperviseMapper.delete(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, id));
//删除同时删除工作流程
FlowableAss flowableAss = flowableAssMapper.selectById(id);
if (Objects.nonNull(flowableAss)) {
iFlowDefinitionService.deleteInstance(flowableAss.getExecIndex(), "");
flowableAssMapper.deleteById(id);
}
});
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, "删除技术监督");
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void uploadSuperviseTicket(String id, String supIndex, Integer ticketType, MultipartFile[] files, HttpServletResponse response) { public void uploadSuperviseTicket(String id, String supIndex, Integer ticketType, MultipartFile[] files, HttpServletResponse response) {
@@ -250,32 +254,25 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
thsSupervise.setSupIndex(supIndex); thsSupervise.setSupIndex(supIndex);
ThsSupervise thsSuperObj = thsSuperviseMapper.selectById(supIndex); ThsSupervise thsSuperObj = thsSuperviseMapper.selectById(supIndex);
List<ThsOverRunLog> thsOverRunLogList = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex,supIndex));
if (files != null && files.length == 1) { if (files != null && files.length == 1) {
ThsOverRunLog thsOverRunLog = thsOverRunLogService.getById(id); ThsOverRunLog thsOverRunLog = thsOverRunLogService.getById(id);
thsOverRunLog.setId(id); thsOverRunLog.setId(id);
String path = fileStorageUtil.uploadMultipart(files[0], OssPath.ELECTRICITY_QUALITY); String path = fileStorageUtil.uploadMultipart(files[0], OssPath.ELECTRICITY_QUALITY);
this.updateSuperviesData(path, thsOverRunLog, ticketType, thsSupervise); this.updateSuperviesData(path, thsOverRunLog, ticketType, thsSupervise);
this.updateProcess(thsSupervise, ticketType, thsSuperObj.getType());
} }
if (files != null && files.length > 1) { if (files != null && files.length > 1) {
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex)); if(files.length!=thsOverRunLogList.size()){
this.batchUploadFile(thsSupervise, thsOverRunLogs, files, ticketType); throw new BusinessException("批量上传需保证报告数量与测点数量一致");
this.updateProcess(thsSupervise, ticketType, thsSuperObj.getType()); }
this.batchUploadFile(thsSupervise, thsOverRunLogList, files, ticketType);
} }
this.updateProcess(thsSupervise, ticketType, thsSuperObj.getType(),thsOverRunLogList,files.length);
//判断当监督单下面的监测点报告都被上传则认为流程完成
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
List<String> fileNames = thsOverRunLogs.stream().filter(item -> StrUtil.isNotBlank(item.getFeedback())).map(ThsOverRunLog::getFileName).distinct().collect(Collectors.toList());
if (fileNames.size() == thsOverRunLogs.size()) {
FlowableAss flowableAss = flowableAssMapper.selectById(supIndex);
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
FlowTaskVo flowTaskVo = new FlowTaskVo();
flowTaskVo.setAssignee(RequestUtil.getUserIndex());
flowTaskVo.setTaskId(task.getId());
iFlowTaskService.complete(flowTaskVo);
}
} }
/** /**
@@ -285,14 +282,20 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
* @param ticketType * @param ticketType
* @param type * @param type
*/ */
private void updateProcess(ThsSupervise thsSupervise, Integer ticketType, Integer type) { private void updateProcess(ThsSupervise thsSupervise, Integer ticketType, Integer type,List<ThsOverRunLog> thsOverRunLogList,Integer uploadCount) {
TicketTypeEnum ticketTypeEnum = TicketTypeEnum.getTicketTypeEnumByCode(ticketType); TicketTypeEnum ticketTypeEnum = TicketTypeEnum.getTicketTypeEnumByCode(ticketType);
if (ticketTypeEnum == null) { if (ticketTypeEnum == null) {
throw new BusinessException("上传单据参数类型错误!"); throw new BusinessException("上传单据参数类型错误!");
} }
long count = 0;
switch (ticketTypeEnum) { switch (ticketTypeEnum) {
case FEEDBACK: case FEEDBACK:
thsSupervise.setProgress(ProgressEnum.TEST_REPORT.getCode()); count = thsOverRunLogList.stream().filter(item->Objects.isNull(item.getFeedback())).count();
if(uploadCount == count){
thsSupervise.setProgress(ProgressEnum.TEST_REPORT.getCode());
}
break; break;
case TEST_REPORT: case TEST_REPORT:
if (AlarmTypeEnum.EARLY_WARN.getCode().equals(type)) { if (AlarmTypeEnum.EARLY_WARN.getCode().equals(type)) {
@@ -305,6 +308,19 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
thsSupervise.setProgress(ProgressEnum.END.getCode()); thsSupervise.setProgress(ProgressEnum.END.getCode());
break; break;
} }
if(uploadCount == count){
//默认上传报告后当前流程结束
FlowableAss flowableAss = flowableAssMapper.selectById(thsSupervise.getSupIndex());
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
FlowTaskVo flowTaskVo = new FlowTaskVo();
flowTaskVo.setAssignee(RequestUtil.getUserIndex());
flowTaskVo.setTaskId(task.getId());
iFlowTaskService.complete(flowTaskVo);
}
thsSupervise.setModifyTime(new Date()); thsSupervise.setModifyTime(new Date());
thsSuperviseMapper.update(thsSupervise, new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, thsSupervise.getSupIndex())); thsSuperviseMapper.update(thsSupervise, new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, thsSupervise.getSupIndex()));
} }
@@ -680,6 +696,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
} }
} else { } else {
superviceRunLogVo.setOverRunLog(allThsLogPO); superviceRunLogVo.setOverRunLog(allThsLogPO);
superviceRunLogVo.setThsSupervise(thsSuperviseListPO.get(0));
return superviceRunLogVo; return superviceRunLogVo;
} }