Ver código fonte

代填不直接通过

QuYueTing 7 meses atrás
pai
commit
bd9ad2bfe0

+ 3 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -1007,7 +1007,7 @@ public class ReportController {
                                         .setDegreeId(degreeId.length > 0?degreeId[i]:null)
                                         .setCustomData(customData[i])
                                         .setStage(stage[i])
-                                        .setState(1)//代填,直接是审核通过状态
+                                        .setState(0)//代填,现在改成不直接通过了,还是需要相关的人员去审核
                                         .setCompanyId(user.getCompanyId())
                                         .setPicAdd(pics!=null?pics[i]:null)
                                         .setPicStr(picStr!=null?picStr[i]:null)
@@ -1153,10 +1153,10 @@ public class ReportController {
                             } else {
                                 //并非并行审核模式下的代填,需要设置审核状态
                                 if (auditWorkflowList.size() == 0) {
-                                    //没有自定义审核流,直接代填的,就算审核通过
+                                    //没有自定义审核流,直接代填的,还是走正常的审核流程
                                     report.setIsDeptAudit(0);
                                     report.setIsFinalAudit(1);
-                                    report.setState(1);
+                                    report.setState(0);
                                 } else {
                                     //有审核流程的,取项目经理后面的流程节点
                                     int projectLeaderNodeIndex = 0;

+ 16 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -30,6 +30,7 @@ import org.apache.poi.ss.usermodel.*;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.task.AsyncTaskExecutor;
 import org.springframework.http.*;
 import org.springframework.http.client.ClientHttpResponse;
 import org.springframework.stereotype.Service;
@@ -4201,7 +4202,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         ReportAuditLog log = new ReportAuditLog();
         log.setAuditChannel(channel);//导入审核
         log.setCompanyId(company.getId());
-        log.setResult("批量驳回,原因:" + (StringUtils.isEmpty(reason)?"无":reason));
+        final String reasonStr = "批量驳回,原因:" + (StringUtils.isEmpty(reason)?"无":reason);
+        log.setResult(reasonStr);
         log.setUserId(user.getId());
         log.setUserName(user.getName());
         log.setProjectName(s);
@@ -4209,6 +4211,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             s = s.substring(0, 2000);
         }
         reportAuditLogMapper.insert(log);
+
         List<Report> allReports = reportMapper.selectList(new QueryWrapper<Report>().in("id", ids));
         saveDenyReportLog(allReports, user.getId(), user.getName(), reason);
         List<User> allUsers = userMapper.selectList(new QueryWrapper<User>().select("id, name").eq("company_id", company.getId()));
@@ -4238,10 +4241,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
 
         reportMapper.update(new Report().setState(2),
                 new QueryWrapper<Report>().in("id", ListUtil.convertIdsArrayToList(reportIds)));
+
+        //TODO: 处理消息通知
 //        asyncTaskExecutor.execute(new Runnable() {
 //            @Override
 //            public void run() {
-//
+//                informationMapper.insert(new Information().setType(0).setContent(date).setUserId(fillUserId).setMsg(str));
 //                //开启线程任务进行发送驳回提醒
 //                //发送驳回通知消息
 //                User reporter = userMapper.selectById(fillUserId);
@@ -8299,6 +8304,15 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         List<User> auditorList = new ArrayList<>();
         //加载这段时间内已填报过的项目
         List<Project> projectList = new ArrayList<>();
+        if (collect.size() > 0) {
+            //只算当前可填报的项目
+            if (!sysFunctionService.hasPriviledge(user.getRoleId(), "可填报全部项目")) {
+                //只能看本人参与的项目
+                List<Map<String, Object>> mapList = projectMapper.getOnlyJoinProjects(user.getId(), user.getCompanyId());
+                //从collect中去掉不在参与项目中的数据, mapList中的id是Integer类型
+                collect = collect.stream().filter(mapList.stream().map(m->(Integer)m.get("id")).collect(Collectors.toList())::contains).collect(Collectors.toList());
+            }
+        }
         if (collect.size() > 0) {
             projectList = projectMapper.selectList(new QueryWrapper<Project>().in("id", collect));
 			auditorList = userMapper.selectList(new QueryWrapper<User>().in("id", reportList.stream().map(Report::getProjectAuditorId).collect(Collectors.toList())));