|
@@ -4880,4 +4880,60 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Object fixSteelNumData() {
|
|
|
|
+ List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>());
|
|
|
|
+ int dealCount = 0;
|
|
|
|
+ for (int t=0;t<reportList.size(); t++) {
|
|
|
|
+ Report report = reportList.get(t);
|
|
|
|
+ String creatorId = report.getCreatorId();
|
|
|
|
+ LocalDate date = report.getCreateDate();
|
|
|
|
+ Integer userProcedureTeamId = report.getUserProcedureTeamId();
|
|
|
|
+ String steelNum = report.getSteelNumArray();
|
|
|
|
+ List<String> reportSteelNumArray1 = JSONArray.parseArray(steelNum, String.class);
|
|
|
|
+ if (!StringUtils.isEmpty(steelNum)) {
|
|
|
|
+ //检查该钢印号在其他的日报中当前员工是否也有填报的
|
|
|
|
+ for (int i=t+1;i<reportList.size(); i++) {
|
|
|
|
+ Report iReport = reportList.get(i);
|
|
|
|
+ if (iReport.getCreatorId().equals(creatorId) && iReport.getUserProcedureTeamId().equals(userProcedureTeamId) && !iReport.getCreateDate().isEqual(date)) {
|
|
|
|
+ String steelNumArray = iReport.getSteelNumArray();
|
|
|
|
+ if (!StringUtils.isEmpty(steelNumArray)) {
|
|
|
|
+ List<String> reportSteelNumArray2 = JSONArray.parseArray(steelNumArray, String.class);
|
|
|
|
+ JSONArray updateSteelNum = new JSONArray();
|
|
|
|
+ boolean hasChange = false;
|
|
|
|
+ for (int m=0;m<reportSteelNumArray2.size(); m++) {
|
|
|
|
+ String s = reportSteelNumArray2.get(m);
|
|
|
|
+ //之前已经报过了该钢印号
|
|
|
|
+ if (reportSteelNumArray1.contains(s)) {
|
|
|
|
+ hasChange = true;
|
|
|
|
+ } else {
|
|
|
|
+ updateSteelNum.add(s);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (hasChange) {
|
|
|
|
+ //日报中的钢印号需要修正
|
|
|
|
+ Report updateR = new Report();
|
|
|
|
+ updateR.setId(iReport.getId());
|
|
|
|
+ updateR.setSteelNumArray(updateSteelNum.toString());
|
|
|
|
+ dealCount++;
|
|
|
|
+ System.out.println("检测:"+steelNum+", 更新日报: id="+iReport.getId()+", 原始 steelArrayNum==" + steelNumArray + " ,更新为: "+updateSteelNum.toString());
|
|
|
|
+ reportMapper.updateById(updateR);
|
|
|
|
+ reportSteelNumMapper.delete(new QueryWrapper<ReportSteelNum>().eq("report_id", iReport.getId()));
|
|
|
|
+ for (int q=0;q<updateSteelNum.size(); q++) {
|
|
|
|
+ ReportSteelNum num = new ReportSteelNum();
|
|
|
|
+ num.setReportId(updateR.getId());
|
|
|
|
+ num.setSteelNum(updateSteelNum.getString(q));
|
|
|
|
+ reportSteelNumMapper.insert(num);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ System.out.println("共更新:"+dealCount);
|
|
|
|
+ return dealCount;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|