|
|
|
|
@ -56,7 +56,6 @@ public class WarningController {
|
|
|
|
|
public Result<Page<EntryWindowVo>> getPage(@RequestBody WarningQueryParam queryParam){ |
|
|
|
|
UserAuth user = UserContextHolder.getCurrentUser(); |
|
|
|
|
QueryWrapper<ReportProject> wrapper= new QueryWrapper<ReportProject>() |
|
|
|
|
.eq(StrUtil.isNotBlank(queryParam.getProjectUnitId()),"p.project_unit_id",queryParam.getProjectUnitId()) |
|
|
|
|
.eq(StrUtil.isNotBlank(queryParam.getAuditUnitId()),"p.audit_unit_id",queryParam.getAuditUnitId()) |
|
|
|
|
.eq(StrUtil.isNotBlank(queryParam.getReportName()),"p.report_name",queryParam.getReportName()) |
|
|
|
|
.eq("f.report_link","end") |
|
|
|
|
@ -64,37 +63,45 @@ public class WarningController {
|
|
|
|
|
.eq(StrUtil.isNotBlank(queryParam.getWarningState()),"p.warning_state",queryParam.getWarningState()) |
|
|
|
|
.eq("p.node",FlowStateEnum.End.getLabel()) |
|
|
|
|
.eq("p.delete_flag", DeleteStatusEnum.NO.getCode()); |
|
|
|
|
if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && !user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode())) { |
|
|
|
|
List<String> orgIds =new ArrayList<>(); |
|
|
|
|
if(!user.getAuthDepartIds().isEmpty()){ |
|
|
|
|
orgIds = departService.getAllNodeIds(user.getAuthDepartIds()); |
|
|
|
|
wrapper.in("p.project_unit_id", orgIds); |
|
|
|
|
}else{ |
|
|
|
|
orgIds = departService.getAllNodeIds(user.getDepartId()); |
|
|
|
|
wrapper.in("p.project_unit_id", orgIds); |
|
|
|
|
} |
|
|
|
|
// List<String> orgIds = departService.getAllNodeIds(user.getAuthDepartIds());
|
|
|
|
|
// wrapper.in("p.project_unit_id", orgIds);
|
|
|
|
|
} |
|
|
|
|
if(CollectionUtil.isNotEmpty(queryParam.getPublicationDate())){ |
|
|
|
|
wrapper.between(CollectionUtil.isNotEmpty(queryParam.getPublicationDate()),"p.publication_date",queryParam.getPublicationDate().get(0),queryParam.getPublicationDate().get(1)); |
|
|
|
|
} |
|
|
|
|
if(CollectionUtil.isNotEmpty(queryParam.getEndDate())){ |
|
|
|
|
wrapper.between(CollectionUtil.isNotEmpty(queryParam.getEndDate()),"p.archiving",queryParam.getEndDate().get(0),queryParam.getEndDate().get(1)); |
|
|
|
|
} |
|
|
|
|
wrapper.orderByAsc("p.warning_state"); |
|
|
|
|
wrapper.groupBy("p.id"); |
|
|
|
|
if (StrUtil.isNotBlank(queryParam.getAuditUnitId())) { |
|
|
|
|
// 获取选择的审计单位及其所有子部门的ID
|
|
|
|
|
wrapper.in("p.audit_unit_id", departService.getAllNodeIds(queryParam.getAuditUnitId())); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotBlank(queryParam.getProjectUnitId())){ |
|
|
|
|
wrapper.in("p.project_unit_id", departService.getAllNodeIds(queryParam.getProjectUnitId())); |
|
|
|
|
} |
|
|
|
|
if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && !user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode())) { |
|
|
|
|
List<String> orgIds =new ArrayList<>(); |
|
|
|
|
if(!user.getAuthDepartIds().isEmpty()){ |
|
|
|
|
orgIds = departService.getAllNodeIds(user.getAuthDepartIds()); |
|
|
|
|
wrapper.in("p.project_unit_id", orgIds); |
|
|
|
|
}else{ |
|
|
|
|
orgIds = departService.getAllNodeIds(user.getDepartId()); |
|
|
|
|
wrapper.in("p.project_unit_id", orgIds); |
|
|
|
|
} |
|
|
|
|
// List<String> orgIds = departService.getAllNodeIds(user.getAuthDepartIds());
|
|
|
|
|
// wrapper.in("p.project_unit_id", orgIds);
|
|
|
|
|
} |
|
|
|
|
if(CollectionUtil.isNotEmpty(queryParam.getPublicationDate())){ |
|
|
|
|
wrapper.between(CollectionUtil.isNotEmpty(queryParam.getPublicationDate()),"p.publication_date",queryParam.getPublicationDate().get(0),queryParam.getPublicationDate().get(1)); |
|
|
|
|
} |
|
|
|
|
if(CollectionUtil.isNotEmpty(queryParam.getEndDate())){ |
|
|
|
|
wrapper.between(CollectionUtil.isNotEmpty(queryParam.getEndDate()),"p.archiving",queryParam.getEndDate().get(0),queryParam.getEndDate().get(1)); |
|
|
|
|
} |
|
|
|
|
wrapper.orderByAsc("p.warning_state"); |
|
|
|
|
wrapper.groupBy("p.id"); |
|
|
|
|
Page<EntryWindowVo> page= reportProjectService.getPageWarning(new Page<>(queryParam.getCurrent(),queryParam.getSize()),wrapper,queryParam.getWarningState()); |
|
|
|
|
List<EntryWindowVo> entryWindowVos = page.getRecords(); |
|
|
|
|
entryWindowVos.forEach(s->{ |
|
|
|
|
List<WarningRecord> list = recordService.list(new LambdaQueryWrapper<WarningRecord>().eq(WarningRecord::getReportId,s.getId())); |
|
|
|
|
if(CollectionUtil.isNotEmpty(list)) { |
|
|
|
|
//0的代表已下发问题
|
|
|
|
|
List<WarningRecord> records= list.stream().filter(x-> "0".equals(x.getFlowState())).toList(); |
|
|
|
|
//为空表示已提交审核
|
|
|
|
|
List<WarningRecord> auditNumber= list.stream().filter(x-> StrUtil.isEmpty(x.getFlowState())).toList(); |
|
|
|
|
//1的代表已下发问题
|
|
|
|
|
List<WarningRecord> records= list.stream().filter(x-> "1".equals(x.getFlowState())).toList(); |
|
|
|
|
// 为空表示已提交审核
|
|
|
|
|
// List<WarningRecord> auditNumber= list.stream().filter(x-> StrUtil.isEmpty(x.getFlowState())).toList();
|
|
|
|
|
//1 为 已下发问题 ,2 为已提交审核,0为常规
|
|
|
|
|
String stateData = CollectionUtil.isNotEmpty(records)?"1":(CollectionUtil.isNotEmpty(auditNumber)?"2":"0"); |
|
|
|
|
// String stateData = CollectionUtil.isNotEmpty(records)?"1":(CollectionUtil.isNotEmpty(auditNumber)?"2":"0");
|
|
|
|
|
String stateData = !records.isEmpty()? "1": "0"; |
|
|
|
|
s.setStateData(stateData); |
|
|
|
|
List<String> ids = list.stream().map(x -> x.getId()).toList(); |
|
|
|
|
long counts = contentService.count(new LambdaQueryWrapper<WarningContent>().in(WarningContent::getWarningId, ids) |
|
|
|
|
@ -102,7 +109,6 @@ public class WarningController {
|
|
|
|
|
s.setWarningContent(counts); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
entryWindowVos.sort(Comparator.comparingInt(e -> Integer.parseInt(e.getStateData()))); |
|
|
|
|
page.setRecords(entryWindowVos); |
|
|
|
|
return Result.success(page); |
|
|
|
|
|
|
|
|
|
|