|
@@ -111,6 +111,8 @@ public class ReportController {
|
|
private UserFvTimeMapper userFvTimeMapper;
|
|
private UserFvTimeMapper userFvTimeMapper;
|
|
@Resource
|
|
@Resource
|
|
private UserCustomMapper userCustomMapper;
|
|
private UserCustomMapper userCustomMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private UserGroupMapper userGroupMapper;
|
|
|
|
|
|
//获取任务相关的日报列表
|
|
//获取任务相关的日报列表
|
|
@RequestMapping("/getTaskReportList")
|
|
@RequestMapping("/getTaskReportList")
|
|
@@ -1304,6 +1306,28 @@ public class ReportController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //校验非项目工时占比
|
|
|
|
+ User reportOwner = userMapper.selectById(reportList.get(0).getCreatorId());
|
|
|
|
+ if (reportOwner.getUserGroupId() != null) {
|
|
|
|
+ //获取非项目列表
|
|
|
|
+ List<Project> nonProjectList = projectMapper.selectList(new QueryWrapper<Project>().select("id").eq("is_public", 1).eq("company_id", reportOwner.getCompanyId()));
|
|
|
|
+ List<Integer> collect = nonProjectList.stream().map(Project::getId).collect(Collectors.toList());
|
|
|
|
+ List<Report> oldRelatedReportList = reportMapper.selectList(new QueryWrapper<Report>().select("id,project_id,working_time").eq("creator_id", reportOwner.getId()).and(wrapper->wrapper.eq("state",0).or().eq("state",1).or().eq("state",3)));
|
|
|
|
+ //剔除掉当前日报中的
|
|
|
|
+ oldRelatedReportList = oldRelatedReportList.stream().filter(old->!reportList.stream().map(Report::getId).collect(Collectors.toList()).contains(old.getId())).collect(Collectors.toList());
|
|
|
|
+ oldRelatedReportList.addAll(reportList);
|
|
|
|
+ double totalWorkingTime = oldRelatedReportList.stream().mapToDouble(Report::getWorkingTime).sum();
|
|
|
|
+ double nonProjectWorkingTime = oldRelatedReportList.stream().filter(old->collect.contains(old.getProjectId())).mapToDouble(Report::getWorkingTime).sum();
|
|
|
|
+ double percent = 100*nonProjectWorkingTime/totalWorkingTime;
|
|
|
|
+
|
|
|
|
+ int maxPercent = userGroupMapper.selectById(reportOwner.getUserGroupId()).getNoProjectPercent();
|
|
|
|
+ if(percent > maxPercent){
|
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
|
+ httpRespMsg.setError("非项目工时占比不得超过"+maxPercent+"%");
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//如果锁定工作时长上限的话,需要校验每日的合计工作时长
|
|
//如果锁定工作时长上限的话,需要校验每日的合计工作时长
|
|
for (Report report : reportList) {
|
|
for (Report report : reportList) {
|
|
String creatorId = report.getCreatorId();
|
|
String creatorId = report.getCreatorId();
|
|
@@ -1430,7 +1454,6 @@ public class ReportController {
|
|
for (Report report : reportList) {
|
|
for (Report report : reportList) {
|
|
report.setDepartmentAuditState(0);
|
|
report.setDepartmentAuditState(0);
|
|
//优先按照当前日报填写人的直属审核人审核
|
|
//优先按照当前日报填写人的直属审核人审核
|
|
- User reportOwner = creatorList.stream().filter(c->c.getId().equals(report.getCreatorId())).findFirst().get();
|
|
|
|
if (!StringUtils.isEmpty(reportOwner.getSuperiorId())) {
|
|
if (!StringUtils.isEmpty(reportOwner.getSuperiorId())) {
|
|
User auditor = tempAuditorUserList.stream().filter(t -> t.getId().equals(reportOwner.getSuperiorId())).findFirst().get();
|
|
User auditor = tempAuditorUserList.stream().filter(t -> t.getId().equals(reportOwner.getSuperiorId())).findFirst().get();
|
|
report.setProjectAuditorId(auditor.getId());
|
|
report.setProjectAuditorId(auditor.getId());
|