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::getMonitorState,dictData.getId())
.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()));
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();
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<Dept> deptTem = deptList.stream().filter(it->monitorList.contains(it.getCode())).collect(Collectors.toList());
return deptTem;
return deptList.stream().filter(it->monitorList.contains(it.getCode())).collect(Collectors.toList());
}

View File

@@ -159,8 +159,8 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
Date date = new Date();
thsSupervise.setCreateTime(date);
thsSupervise.setCreateUser(RequestUtil.getUsername());
thsSupervise.setModifyUser(RequestUtil.getUsername());
thsSupervise.setModifyTime(date);
//thsSupervise.setModifyUser(RequestUtil.getUsername());
//thsSupervise.setModifyTime(date);
thsSupervise.setSupIndex(IdUtil.simpleUUID());
this.buildSuperviseName(thsSupervise, superviceRunLogVo.getOverRunLog(), dept);
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
public Page<SuperviseVo> querySuperviseList(SuperviseDto superviseDto) {
Integer pageNum = PageFactory.getPageNum(superviseDto);
@@ -222,27 +247,6 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
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
@Transactional(rollbackFor = Exception.class)
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 thsSuperObj = thsSuperviseMapper.selectById(supIndex);
List<ThsOverRunLog> thsOverRunLogList = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex,supIndex));
if (files != null && files.length == 1) {
ThsOverRunLog thsOverRunLog = thsOverRunLogService.getById(id);
thsOverRunLog.setId(id);
String path = fileStorageUtil.uploadMultipart(files[0], OssPath.ELECTRICITY_QUALITY);
this.updateSuperviesData(path, thsOverRunLog, ticketType, thsSupervise);
this.updateProcess(thsSupervise, ticketType, thsSuperObj.getType());
}
if (files != null && files.length > 1) {
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
this.batchUploadFile(thsSupervise, thsOverRunLogs, files, ticketType);
this.updateProcess(thsSupervise, ticketType, thsSuperObj.getType());
if(files.length!=thsOverRunLogList.size()){
throw new BusinessException("批量上传需保证报告数量与测点数量一致");
}
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 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);
if (ticketTypeEnum == null) {
throw new BusinessException("上传单据参数类型错误!");
}
long count = 0;
switch (ticketTypeEnum) {
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;
case TEST_REPORT:
if (AlarmTypeEnum.EARLY_WARN.getCode().equals(type)) {
@@ -305,6 +308,19 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
thsSupervise.setProgress(ProgressEnum.END.getCode());
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());
thsSuperviseMapper.update(thsSupervise, new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, thsSupervise.getSupIndex()));
}
@@ -680,6 +696,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
}
} else {
superviceRunLogVo.setOverRunLog(allThsLogPO);
superviceRunLogVo.setThsSupervise(thsSuperviseListPO.get(0));
return superviceRunLogVo;
}