|
@@ -71,6 +71,8 @@ public class ReportController {
|
|
|
private ProjectMapper projectMapper;
|
|
|
@Resource
|
|
|
private SysFunctionMapper sysFunctionMapper;
|
|
|
+ @Resource
|
|
|
+ private UserCorpwxTimeMapper userCorpwxTimeMapper;
|
|
|
|
|
|
|
|
|
|
|
@@ -273,47 +275,47 @@ public class ReportController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- //检查项目是否可填报
|
|
|
+ //检查项目是否可填报; 修改为不校验项目,前端加载的项目已经过滤掉了完成和撤销的
|
|
|
List<Integer> integers = Arrays.asList(projectId);
|
|
|
List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().in("id", integers));
|
|
|
- for (int i=0;i<projectId.length; i++) {
|
|
|
- int pid = projectId[i];
|
|
|
- Optional<Project> findP = projectList.stream().filter(p->p.getId().equals(pid)).findFirst();
|
|
|
- if (findP.isPresent()) {
|
|
|
- Project curP = findP.get();
|
|
|
- if (!createDate[i].contains("@")) {
|
|
|
- if (curP.getStatus() == 2) {
|
|
|
- HttpRespMsg msg = new HttpRespMsg();
|
|
|
- //msg.setError("项目["+curP.getProjectName()+"]已完成。");
|
|
|
- msg.setError(MessageUtils.message("project.complete",curP.getProjectName()));
|
|
|
- return msg;
|
|
|
- }
|
|
|
- if (curP.getStatus() == 3) {
|
|
|
- HttpRespMsg msg = new HttpRespMsg();
|
|
|
- //msg.setError("项目["+curP.getProjectName()+"]已撤销。");
|
|
|
- msg.setError(MessageUtils.message("project.revoke",curP.getProjectName()));
|
|
|
- return msg;
|
|
|
- }
|
|
|
- } else {
|
|
|
- //批量填报(含代填)
|
|
|
- String[] dateArr = createDate[i].split("@");
|
|
|
- for (String curDate : dateArr) {
|
|
|
- if (curP.getStatus() == 2) {
|
|
|
- HttpRespMsg msg = new HttpRespMsg();
|
|
|
- //msg.setError("项目["+curP.getProjectName()+"]已完成。");
|
|
|
- msg.setError(MessageUtils.message("project.complete",curP.getProjectName()));
|
|
|
- return msg;
|
|
|
- }
|
|
|
- if (curP.getStatus() == 3) {
|
|
|
- HttpRespMsg msg = new HttpRespMsg();
|
|
|
- //msg.setError("项目["+curP.getProjectName()+"]已撤销。");
|
|
|
- msg.setError(MessageUtils.message("project.revoke",curP.getProjectName()));
|
|
|
- return msg;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// for (int i=0;i<projectId.length; i++) {
|
|
|
+// int pid = projectId[i];
|
|
|
+// Optional<Project> findP = projectList.stream().filter(p->p.getId().equals(pid)).findFirst();
|
|
|
+// if (findP.isPresent()) {
|
|
|
+// Project curP = findP.get();
|
|
|
+// if (!createDate[i].contains("@")) {
|
|
|
+// if (curP.getStatus() == 2) {
|
|
|
+// HttpRespMsg msg = new HttpRespMsg();
|
|
|
+// //msg.setError("项目["+curP.getProjectName()+"]已完成。");
|
|
|
+// msg.setError(MessageUtils.message("project.complete",curP.getProjectName()));
|
|
|
+// return msg;
|
|
|
+// }
|
|
|
+// if (curP.getStatus() == 3) {
|
|
|
+// HttpRespMsg msg = new HttpRespMsg();
|
|
|
+// //msg.setError("项目["+curP.getProjectName()+"]已撤销。");
|
|
|
+// msg.setError(MessageUtils.message("project.revoke",curP.getProjectName()));
|
|
|
+// return msg;
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// //批量填报(含代填)
|
|
|
+// String[] dateArr = createDate[i].split("@");
|
|
|
+// for (String curDate : dateArr) {
|
|
|
+// if (curP.getStatus() == 2) {
|
|
|
+// HttpRespMsg msg = new HttpRespMsg();
|
|
|
+// //msg.setError("项目["+curP.getProjectName()+"]已完成。");
|
|
|
+// msg.setError(MessageUtils.message("project.complete",curP.getProjectName()));
|
|
|
+// return msg;
|
|
|
+// }
|
|
|
+// if (curP.getStatus() == 3) {
|
|
|
+// HttpRespMsg msg = new HttpRespMsg();
|
|
|
+// //msg.setError("项目["+curP.getProjectName()+"]已撤销。");
|
|
|
+// msg.setError(MessageUtils.message("project.revoke",curP.getProjectName()));
|
|
|
+// return msg;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
TimeType comTimeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
|
List<ReportAuditorSetting> auditorSettingList = null;
|
|
|
if (comTimeType.getReportAuditType() == 3) {
|
|
@@ -1015,28 +1017,54 @@ public class ReportController {
|
|
|
return msg;
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- //按周填报时不校验已填的工时日报了
|
|
|
-// List<LocalDate> collect = oldReportList.stream().map(Report::getCreateDate).collect(Collectors.toList());
|
|
|
-// for (Report report : reportList) {
|
|
|
-// if (report.getId() == null) {
|
|
|
-// if (collect.stream().anyMatch(oldDate->oldDate.isEqual(report.getCreateDate()))) {
|
|
|
-// sb.append(mdFormatter.format(report.getCreateDate())).append(",");
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// String s = sb.toString();
|
|
|
-// if (s.length() > 0) {
|
|
|
-// s = s.substring(0, s.length() -1);
|
|
|
-// HttpRespMsg msg = new HttpRespMsg();
|
|
|
-// msg.setError("已存在填写日报: " + s+", 请先删除后再填报。");
|
|
|
-// return msg;
|
|
|
-// }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (createDate[0].contains("@") && targetUserList == null) {
|
|
|
+ //个人批量填报,判断是否需要考勤校验
|
|
|
+ if (comTimeType.getSyncCorpwxTime() == 1) {
|
|
|
+ String[] dateArr = createDate[0].split("@");
|
|
|
+ List<UserCorpwxTime> cardTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("corpwx_userid", user.getCorpwxUserid()).between("create_date", dateArr[0], dateArr[1]));
|
|
|
+ //考勤记录不能为空或时长为0
|
|
|
+ if (comTimeType.getNotAllowedNoAttendance() == 1) {
|
|
|
+ String str = "";
|
|
|
+ for (Report r : reportList) {
|
|
|
+ Optional<UserCorpwxTime> first = cardTimeList.stream().filter(card -> card.getCreateDate().isEqual(r.getCreateDate())).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ if (first.get().getWorkHours() == 0) {
|
|
|
+ str += dtf.format(r.getCreateDate()) + ",";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ str += dtf.format(r.getCreateDate()) + ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //有无考勤的日期
|
|
|
+ if (str.length() > 0) {
|
|
|
+ str = str.substring(0, str.length()-1);
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ msg.setError(MessageUtils.message("report.lackCardTime", str));
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String str = "";
|
|
|
+ for (Report r : reportList) {
|
|
|
+ Optional<UserCorpwxTime> first = cardTimeList.stream().filter(card -> card.getCreateDate().isEqual(r.getCreateDate())).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ double cardTime = first.get().getWorkHours();
|
|
|
+ if (r.getWorkingTime() > cardTime) {
|
|
|
+ str += dtf.format(r.getCreateDate()) + ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (str.length() > 0) {
|
|
|
+ str = str.substring(0, str.length()-1);
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ msg.setError(MessageUtils.message("report.lackCardTime", str));
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return reportService.editReport(reportList, createDate.length > 0 ? createDate[0] : null, targetUserList, hourCost, user.getCompanyId());
|
|
|
}
|
|
|
|