|
@@ -4055,48 +4055,93 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg fixIssue() {
|
|
public HttpRespMsg fixIssue() {
|
|
- //
|
|
|
|
-
|
|
|
|
//处理被误操作为自动审核的数据,
|
|
//处理被误操作为自动审核的数据,
|
|
List<AuditWorkflowTimeSetting> settings = auditWorkflowTimeSettingMapper.selectList(new QueryWrapper<AuditWorkflowTimeSetting>().select("distinct company_id"));
|
|
List<AuditWorkflowTimeSetting> settings = auditWorkflowTimeSettingMapper.selectList(new QueryWrapper<AuditWorkflowTimeSetting>().select("distinct company_id"));
|
|
System.out.println("有审批流的公司size="+settings.size());
|
|
System.out.println("有审批流的公司size="+settings.size());
|
|
|
|
|
|
List<Report> reportList = reportMapper.selectList(
|
|
List<Report> reportList = reportMapper.selectList(
|
|
- new QueryWrapper<Report>().select("company_id, id, state, project_auditor_id")
|
|
|
|
- .eq("report_auto_approve", 1).ne("company_id", 767));
|
|
|
|
|
|
+ new QueryWrapper<Report>().select("company_id, id, state, project_auditor_id, creator_id, create_date")
|
|
|
|
+ .eq("report_auto_approve", 1));
|
|
|
|
+ reportList = reportList.stream().filter(r->r.getCompanyId() != 767).collect(Collectors.toList());
|
|
System.out.println("查询到数据=="+reportList.size());
|
|
System.out.println("查询到数据=="+reportList.size());
|
|
int dealCnt = 0;
|
|
int dealCnt = 0;
|
|
List<Report> auditWorkflowReportList = new ArrayList<>();
|
|
List<Report> auditWorkflowReportList = new ArrayList<>();
|
|
|
|
+ List<Report> noWorkflowReportList = new ArrayList<>();
|
|
for (Report report : reportList) {
|
|
for (Report report : reportList) {
|
|
if (!settings.stream().anyMatch(s->s.getCompanyId().equals(report.getCompanyId()))) {
|
|
if (!settings.stream().anyMatch(s->s.getCompanyId().equals(report.getCompanyId()))) {
|
|
//无审批流的公司,直接通过
|
|
//无审批流的公司,直接通过
|
|
- report.setReportAutoApprove(0);
|
|
|
|
- report.setProjectAuditState(0);
|
|
|
|
- report.setState(0);
|
|
|
|
|
|
+ Report r = new Report();
|
|
|
|
+ r.setId(report.getId());
|
|
|
|
+ r.setReportAutoApprove(0);
|
|
|
|
+ r.setProjectAuditState(0);
|
|
|
|
+ r.setState(0);
|
|
|
|
+ noWorkflowReportList.add(r);
|
|
dealCnt++;
|
|
dealCnt++;
|
|
} else {
|
|
} else {
|
|
auditWorkflowReportList.add(report);
|
|
auditWorkflowReportList.add(report);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (noWorkflowReportList.size() > 0) {
|
|
|
|
+ updateBatchById(noWorkflowReportList);
|
|
|
|
+ }
|
|
|
|
+
|
|
System.out.println("已处理无审批流的日报size="+dealCnt);
|
|
System.out.println("已处理无审批流的日报size="+dealCnt);
|
|
System.out.println("有审批流的日报size="+auditWorkflowReportList.size());
|
|
System.out.println("有审批流的日报size="+auditWorkflowReportList.size());
|
|
//检查哪些是项目没审核的
|
|
//检查哪些是项目没审核的
|
|
int projectAuditManulPassCnt = 0;
|
|
int projectAuditManulPassCnt = 0;
|
|
|
|
+ int blurFind = 0;
|
|
|
|
+ List<Report> updateList = new ArrayList<>();
|
|
for (Report report : auditWorkflowReportList) {
|
|
for (Report report : auditWorkflowReportList) {
|
|
int count = reportLogMapper.selectCount(new QueryWrapper<ReportLog>()
|
|
int count = reportLogMapper.selectCount(new QueryWrapper<ReportLog>()
|
|
.like("msg", "审核通过了日报").eq("operator_id", report.getProjectAuditorId())
|
|
.like("msg", "审核通过了日报").eq("operator_id", report.getProjectAuditorId())
|
|
.eq("report_ids", report.getId()));
|
|
.eq("report_ids", report.getId()));
|
|
|
|
+ boolean findLog = false;
|
|
|
|
+
|
|
if (count == 0) {
|
|
if (count == 0) {
|
|
//模糊匹配一下
|
|
//模糊匹配一下
|
|
- reportLogMapper.selectList(new QueryWrapper<ReportLog>()
|
|
|
|
|
|
+ List<ReportLog> reportLogs = reportLogMapper.selectList(new QueryWrapper<ReportLog>().select("id, report_ids")
|
|
.like("msg", "审核通过了日报").eq("operator_id", report.getProjectAuditorId())
|
|
.like("msg", "审核通过了日报").eq("operator_id", report.getProjectAuditorId())
|
|
- .like("report_ids", report.getId()));
|
|
|
|
|
|
+ .eq("company_id", report.getCompanyId())
|
|
|
|
+ .eq("creator_id", report.getCreatorId())
|
|
|
|
+ .eq("create_date", report.getCreateDate()));
|
|
|
|
+ if (reportLogs.size() > 0) {
|
|
|
|
+ //找到匹配的记录
|
|
|
|
+ System.out.println("开始匹配模糊===reportLog Size=="+reportLogs.size());
|
|
|
|
+ for (ReportLog log : reportLogs) {
|
|
|
|
+ String[] arr = log.getReportIds().split(",");
|
|
|
|
+ for (String s : arr) {
|
|
|
|
+ System.out.println("比对=logId="+log.getId()+", "+s+" , "+report.getId());
|
|
|
|
+ if (s.equals(report.getId().toString())) {
|
|
|
|
+ findLog = true;
|
|
|
|
+ blurFind++;
|
|
|
|
+ System.out.println("模糊匹配到了====="+blurFind);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
|
|
+ findLog = true;
|
|
|
|
+ }
|
|
|
|
+ Report r = new Report();
|
|
|
|
+ r.setId(report.getId());
|
|
|
|
+ r.setReportAutoApprove(0);
|
|
|
|
+ r.setState(0);
|
|
|
|
+ if (findLog) {
|
|
projectAuditManulPassCnt++;
|
|
projectAuditManulPassCnt++;
|
|
|
|
+ //已经是手动审核通过的,不需要撤回projectAuditState了
|
|
|
|
+ } else {
|
|
|
|
+ //没有项目审核通过的,需要撤回为0状态
|
|
|
|
+ r.setProjectAuditState(0);
|
|
}
|
|
}
|
|
|
|
+ updateList.add(r);
|
|
}
|
|
}
|
|
- System.out.println("手动审核过的日报size="+projectAuditManulPassCnt);
|
|
|
|
|
|
|
|
|
|
+ System.out.println("手动审核过的日报size="+projectAuditManulPassCnt+", 其中模糊匹配到的size=" +blurFind);
|
|
|
|
+ if (updateList.size() > 0) {
|
|
|
|
+ updateBatchById(updateList);
|
|
|
|
+ }
|
|
|
|
+ System.out.println("===无审批流的日报size="+noWorkflowReportList.size()+", 有审批流的日报size="+updateList.size());
|
|
return new HttpRespMsg();
|
|
return new HttpRespMsg();
|
|
}
|
|
}
|
|
|
|
|