|
@@ -332,7 +332,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<Map<String, Object>> puserNames = reportMapper.getReportNameByDate(date, user.getCompanyId(), leaderId);
|
|
|
List<Map<String, Object>> inchargeReportList= reportMapper.getInchargeReportByDate(date, leaderId, null);
|
|
|
TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
|
- if (timeType.getReportAuditType() == 5 && timeType.getReportCc() == 1) {
|
|
|
+ if ((timeType.getReportAuditType() == 5 || timeType.getReportAuditType() == 6)&& timeType.getReportCc() == 1) {
|
|
|
//存在抄送人的设置,需要把抄送人的项目相关日报也加上
|
|
|
List<Map<String, Object>> viewUserNames = reportMapper.getCcReportNameByDate(date, user.getCompanyId(),leaderId);
|
|
|
for (Map<String, Object> viewItem : viewUserNames) {
|
|
@@ -639,15 +639,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
int reportAuditType = timeTypeMapper.selectById(companyId).getReportAuditType();
|
|
|
//分组
|
|
|
if (company.getPackageProject() == 1) {
|
|
|
- if (reportAuditType == 0) {
|
|
|
- r.setTaskGroups(taskGroups.stream().filter(tg->tg.getProjectId().equals(r.getProjectId())).collect(Collectors.toList()));
|
|
|
- if (r.getGroupId() != null && r.getGroupId() != 0) {
|
|
|
- Optional<TaskGroup> optinal = taskGroups.stream().filter(tg->tg.getId().equals(r.getGroupId())).findFirst();
|
|
|
- if (optinal.isPresent()) {
|
|
|
- r.setGroupName(optinal.get().getName());
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (reportAuditType == 1 || reportAuditType == 2){
|
|
|
+ //如果是按照任务分组负责人审核,取参与的分组
|
|
|
+ if (reportAuditType == 1 || reportAuditType == 2){
|
|
|
List<GroupParticipator> groupParticipatorList = groupParticipatorMapper.selectList(new QueryWrapper<GroupParticipator>());
|
|
|
if (groupParticipatorList.size() > 0) {
|
|
|
List<Integer> groupIds = groupParticipatorList.stream().map(GroupParticipator::getGroupId).collect(Collectors.toList());
|
|
@@ -660,6 +653,15 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //取该项目下的全部分组数据
|
|
|
+ r.setTaskGroups(taskGroups.stream().filter(tg->tg.getProjectId().equals(r.getProjectId())).collect(Collectors.toList()));
|
|
|
+ if (r.getGroupId() != null && r.getGroupId() != 0) {
|
|
|
+ Optional<TaskGroup> optinal = taskGroups.stream().filter(tg->tg.getId().equals(r.getGroupId())).findFirst();
|
|
|
+ if (optinal.isPresent()) {
|
|
|
+ r.setGroupName(optinal.get().getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//项目的审核人
|
|
@@ -1740,7 +1742,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
if (updateReportList.size() > 0) {
|
|
|
updateBatchById(updateReportList);
|
|
|
}
|
|
|
- }else if(timeType.getReportAuditType() == 5){
|
|
|
+ }else if(timeType.getReportAuditType() == 5 || timeType.getReportAuditType() == 6){
|
|
|
List<Report> updateReportList = new ArrayList<>();
|
|
|
//人员所属部门负责人审核或者直属领导审核
|
|
|
boolean hasAuditAllPri = sysFunctionService.hasPriviledge(user.getRoleId(), "审核全员日报");
|
|
@@ -1749,16 +1751,52 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
//直属领导审核或者部门负责人审核
|
|
|
Report newReport = new Report();
|
|
|
newReport.setId(r.getId());
|
|
|
- if(hasAuditAllPri || ((r.getIsDeptAudit() == 0 && user.getId().equals(r.getProjectAuditorId()))
|
|
|
- || (r.getIsDeptAudit() == 1 && user.getId().equals(r.getAuditDeptManagerid())))){
|
|
|
- newReport.setState(1);
|
|
|
- newReport.setDepartmentAuditState(1);
|
|
|
- newReport.setProjectAuditState(1);
|
|
|
- newReport.setProjectAuditTime(LocalDateTime.now());
|
|
|
- }else {
|
|
|
- httpRespMsg.setError("您无权审核该日报");
|
|
|
- return httpRespMsg;
|
|
|
+ if (timeType.getReportAuditType() == 5) {
|
|
|
+ if(hasAuditAllPri || ((r.getIsDeptAudit() == 0 && user.getId().equals(r.getProjectAuditorId()))
|
|
|
+ || (r.getIsDeptAudit() == 1 && user.getId().equals(r.getAuditDeptManagerid())))){
|
|
|
+ newReport.setState(1);
|
|
|
+ newReport.setDepartmentAuditState(1);
|
|
|
+ newReport.setProjectAuditState(1);
|
|
|
+ newReport.setProjectAuditTime(LocalDateTime.now());
|
|
|
+ }else {
|
|
|
+ httpRespMsg.setError("您无权审核该日报");
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ } else if (timeType.getReportAuditType() == 6) {
|
|
|
+ //先部门或直属审核人审核,然后项目日报审核人审核
|
|
|
+ if (r.getDepartmentAuditState() == 0) {
|
|
|
+ if(hasAuditAllPri || ((r.getIsDeptAudit() == 0 && user.getId().equals(r.getProjectAuditorId()))
|
|
|
+ || (r.getIsDeptAudit() == 1 && user.getId().equals(r.getAuditDeptManagerid())))){
|
|
|
+ //进入下一个节点,日报审核人审核
|
|
|
+ newReport.setDepartmentAuditState(1);
|
|
|
+ newReport.setProjectAuditState(0);
|
|
|
+ newReport.setIsDeptAudit(0);
|
|
|
+ ProjectAuditor auditor = projectAuditorMapper.selectOne(new QueryWrapper<ProjectAuditor>().eq("project_id", r.getProjectId()).last("limit 1"));
|
|
|
+ if (auditor == null) {
|
|
|
+ httpRespMsg.setError("项目尚未设置日报审核人");
|
|
|
+ return httpRespMsg;
|
|
|
+ } else {
|
|
|
+ newReport.setProjectAuditorId(auditor.getAuditorId());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ httpRespMsg.setError("您无权审核该日报");
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //第二步,日报审核人审核
|
|
|
+ if (r.getProjectAuditState() == null || r.getProjectAuditState() == 0) {
|
|
|
+ if (user.getId().equals(r.getProjectAuditorId())) {
|
|
|
+ newReport.setState(1);
|
|
|
+ newReport.setProjectAuditState(1);
|
|
|
+ newReport.setProjectAuditTime(LocalDateTime.now());
|
|
|
+ } else {
|
|
|
+ httpRespMsg.setError("您无权审核该日报");
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
updateReportList.add(newReport);
|
|
|
}
|
|
|
if (updateReportList.size() > 0) {
|
|
@@ -2221,20 +2259,20 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- //直接进行项目经理审核驳回
|
|
|
+ //直接进行审核驳回
|
|
|
Report upReport = new Report().setState(2)
|
|
|
.setRejectReason(reason).setRejectUserid(user.getId()).setRejectUsername(user.getName());
|
|
|
+
|
|
|
reportMapper.update(upReport,
|
|
|
new QueryWrapper<Report>().in("id", ListUtil.convertIdsArrayToList(reportIds)));
|
|
|
List<Report> rList = reportMapper.selectList(new QueryWrapper<Report>().select("id, group_id, project_id, creator_id, create_date, company_id").in("id", ListUtil.convertIdsArrayToList(reportIds)));
|
|
|
- if (timeTypeMapper.selectById(company.getId()).getReportAuditType() == 2) {
|
|
|
+ if (timeType.getReportAuditType() == 2) {
|
|
|
//退回任务分组审核状态
|
|
|
List<Report> newList = new ArrayList<>();
|
|
|
for (Report r : rList) {
|
|
|
Report upR = new Report();
|
|
|
upR.setId(r.getId());
|
|
|
upR.setGroupAuditState(0);
|
|
|
- System.out.println("groupId=="+r.getGroupId());
|
|
|
if (r.getGroupId() != 0) {
|
|
|
TaskGroup oldGroup = taskGroupMapper.selectById(r.getGroupId());
|
|
|
if (oldGroup != null) {
|
|
@@ -2807,7 +2845,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
if (updateReportList.size() > 0) {
|
|
|
updateBatchById(updateReportList);
|
|
|
}
|
|
|
- } else if(timeType.getReportAuditType() == 5){
|
|
|
+ } else if(timeType.getReportAuditType() == 5 || timeType.getReportAuditType() == 6){
|
|
|
allUsers = userMapper.selectList(new QueryWrapper<User>().select("id, name, department_id").eq("company_id", company.getId()));
|
|
|
List<Report> updateReportList = new ArrayList<>();
|
|
|
//人员所属部门负责人审核或者直属领导审核
|
|
@@ -2818,20 +2856,55 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
//直属领导审核或者部门负责人审核
|
|
|
Report newReport = new Report();
|
|
|
newReport.setId(r.getId());
|
|
|
- if(hasAuditAllPri || ((r.getIsDeptAudit() == 0 && user.getId().equals(r.getProjectAuditorId()))
|
|
|
- || (r.getIsDeptAudit() == 1 && user.getId().equals(r.getAuditDeptManagerid())))){
|
|
|
- r.setState(1);
|
|
|
- r.setDepartmentAuditState(1);
|
|
|
- r.setProjectAuditState(1);
|
|
|
- r.setProjectAuditTime(LocalDateTime.now());
|
|
|
- newReport.setState(1);
|
|
|
- newReport.setDepartmentAuditState(1);
|
|
|
- newReport.setProjectAuditState(1);
|
|
|
- newReport.setProjectAuditTime(LocalDateTime.now());
|
|
|
- } else {
|
|
|
- httpRespMsg.setError("您无权审核该日报");
|
|
|
- return httpRespMsg;
|
|
|
+ if (timeType.getReportAuditType() == 5) {
|
|
|
+ if(hasAuditAllPri || ((r.getIsDeptAudit() == 0 && user.getId().equals(r.getProjectAuditorId()))
|
|
|
+ || (r.getIsDeptAudit() == 1 && user.getId().equals(r.getAuditDeptManagerid())))){
|
|
|
+ r.setState(1);
|
|
|
+ r.setDepartmentAuditState(1);
|
|
|
+ r.setProjectAuditState(1);
|
|
|
+ r.setProjectAuditTime(LocalDateTime.now());
|
|
|
+ newReport.setState(1);
|
|
|
+ newReport.setDepartmentAuditState(1);
|
|
|
+ newReport.setProjectAuditState(1);
|
|
|
+ newReport.setProjectAuditTime(LocalDateTime.now());
|
|
|
+ } else {
|
|
|
+ httpRespMsg.setError("您无权审核该日报");
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ } else if (timeType.getReportAuditType() == 6) {
|
|
|
+ //先部门或直属审核人审核,然后项目日报审核人审核
|
|
|
+ if (r.getDepartmentAuditState() == 0) {
|
|
|
+ if(hasAuditAllPri || ((r.getIsDeptAudit() == 0 && user.getId().equals(r.getProjectAuditorId()))
|
|
|
+ || (r.getIsDeptAudit() == 1 && user.getId().equals(r.getAuditDeptManagerid())))){
|
|
|
+ //进入下一个节点,日报审核人审核
|
|
|
+ newReport.setDepartmentAuditState(1);
|
|
|
+ newReport.setProjectAuditState(0);
|
|
|
+ ProjectAuditor auditor = projectAuditorMapper.selectOne(new QueryWrapper<ProjectAuditor>().eq("project_id", r.getProjectId()).last("limit 1"));
|
|
|
+ if (auditor == null) {
|
|
|
+ httpRespMsg.setError("项目尚未设置日报审核人");
|
|
|
+ return httpRespMsg;
|
|
|
+ } else {
|
|
|
+ newReport.setProjectAuditorId(auditor.getAuditorId());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ httpRespMsg.setError("您无权审核该日报");
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //第二步,日报审核人审核
|
|
|
+ if (r.getProjectAuditState() == null || r.getProjectAuditState() == 0) {
|
|
|
+ if (user.getId().equals(r.getProjectAuditorId())) {
|
|
|
+ newReport.setState(1);
|
|
|
+ newReport.setProjectAuditState(1);
|
|
|
+ newReport.setProjectAuditTime(LocalDateTime.now());
|
|
|
+ } else {
|
|
|
+ httpRespMsg.setError("您无权审核该日报");
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
updateReportList.add(newReport);
|
|
|
}
|
|
|
if (updateReportList.size() > 0) {
|