Browse Source

测试修改mld

yusm 1 ngày trước cách đây
mục cha
commit
a460d241bc

+ 7 - 7
fhKeeper/formulahousekeeper/management-platform-mld/src/main/java/com/management/platform/controller/TaskController.java

@@ -62,13 +62,13 @@ import static com.management.platform.controller.TaskDailyAllocateController.isT
 @Slf4j
 public class TaskController {
     //任务状态,0-进行中 1-已完成 2-已撤销 3-待第一审核人审核 4-待第二审核人审核 5-第一审校人驳回 6-第二审校人驳回
-    public static final Integer STATUS_DOING = 0;
-    public static final Integer STATUS_FINISH = 1;
-    public static final Integer STATUS_CANCEL = 2;
-    public static final Integer STATUS_FIRST_CHECK = 3;
-    public static final Integer STATUS_SECOND_CHECK = 4;
-    public static final Integer STATUS_FIRST_REJECT = 5;
-    public static final Integer STATUS_SECOND_REJECT = 6;
+    public static final int STATUS_DOING = 0;
+    public static final int STATUS_FINISH = 1;
+    public static final int STATUS_CANCEL = 2;
+    public static final int STATUS_FIRST_CHECK = 3;
+    public static final int STATUS_SECOND_CHECK = 4;
+    public static final int STATUS_FIRST_REJECT = 5;
+    public static final int STATUS_SECOND_REJECT = 6;
 
     @Resource
     private HttpServletRequest request;

+ 28 - 17
fhKeeper/formulahousekeeper/management-platform-mld/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -13632,15 +13632,23 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         User targetUser = userMapper.selectById(request.getHeader("token"));
         List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "全部部门FTE计划报表");
         List<SysRichFunction> functionDeptList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "负责部门FTE计划报表");
+        String startDate = null;
+        String endDate = null;
+        LocalDate timeStart = LocalDate.parse(monthStart, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+        LocalDate timeEnd = LocalDate.parse(monthEnd, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+        startDate = timeStart.with(TemporalAdjusters.firstDayOfMonth()).toString();
+        endDate = timeEnd.with(TemporalAdjusters.lastDayOfMonth()).toString();
+        int days = WorkDayCalculateUtils.getWorkDaysListInRange(startDate, endDate, 0).size();
+        TimeType allDay = timeTypeMapper.selectOne(new QueryWrapper<TimeType>().eq("company_id", targetUser.getCompanyId()));
+        Float monthTime = days * allDay.getAllday();
         List<Integer> deptIds=null;
         List<Department> allDepartmentList=departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id",targetUser.getCompanyId()));
         List<Department> userDepartmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", targetUser.getId()).eq("company_id",targetUser.getCompanyId()));
         List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", targetUser.getId()));
         //判断查看权限
-        if(functionAllList.size()==0){
+        if(functionAllList.isEmpty()){
             deptIds=new ArrayList<>();
-            deptIds.add(-1);
-            if(functionDeptList.size()>0){
+            if(!functionDeptList.isEmpty()){
                 List<Integer> collect = userDepartmentList.stream().map(dm -> dm.getDepartmentId()).distinct().collect(Collectors.toList());
                 List<Integer> otherCollect = departmentOtherManagerList.stream().map(dom -> dom.getDepartmentId()).distinct().collect(Collectors.toList());
                 collect.addAll(otherCollect);
@@ -13649,24 +13657,27 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     List<Integer> branchDepartment = getBranchDepartment(integer, allDepartmentList);
                     deptIds.addAll(branchDepartment);
                 }
+                if (deptIds.isEmpty()){
+                    HashMap<String, Object> map = new HashMap<>();
+                    map.put("resultList", new ArrayList<Object>());
+                    map.put("total",0);
+                    map.put("monthTime",monthTime);
+                    httpRespMsg.data = map;
+                    return httpRespMsg;
+                }
+            }
+
+        }else {
+            if(departmentId!=null){
+                deptIds=new ArrayList<>();
+                List<Integer> branchDepartment = getBranchDepartment(departmentId, allDepartmentList);
+                deptIds.addAll(branchDepartment);
             }
         }
-        if(departmentId!=null){
-            deptIds=new ArrayList<>();
-            List<Integer> branchDepartment = getBranchDepartment(departmentId, allDepartmentList);
-            deptIds.addAll(branchDepartment);
-        }
+
+
         long total  = 0;
         List<Map<String,Object>> resultList = null;
-        String startDate = null;
-        String endDate = null;
-        LocalDate timeStart = LocalDate.parse(monthStart, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-        LocalDate timeEnd = LocalDate.parse(monthEnd, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-        startDate = timeStart.with(TemporalAdjusters.firstDayOfMonth()).toString();
-        endDate = timeEnd.with(TemporalAdjusters.lastDayOfMonth()).toString();
-        int days = WorkDayCalculateUtils.getWorkDaysListInRange(startDate, endDate, 0).size();
-        TimeType allDay = timeTypeMapper.selectOne(new QueryWrapper<TimeType>().eq("company_id", targetUser.getCompanyId()));
-        Float monthTime = days * allDay.getAllday();
         if(pageIndex!=null&&pageSize!=null){
             Integer size=pageSize;
             Integer start=(pageIndex-1)*size;

+ 14 - 9
fhKeeper/formulahousekeeper/management-platform-mld/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java

@@ -98,6 +98,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
     @Resource
     private SysFunctionService sysFunctionService;
     @Resource
+    private SysRoleFunctionService sysRoleFunctionService;
+    @Resource
     private DepartmentService departmentService;
     @Resource
     private DepartmentOtherManagerMapper departmentOtherManagerMapper;
@@ -1650,25 +1652,28 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
     public HttpRespMsg taskPlanPassOrReject(Integer taskId,boolean type, String reason, HttpServletRequest request) {
         HttpRespMsg msg = new HttpRespMsg();
         String userId = request.getHeader("Token");
+        User user = userMapper.selectById(userId);
         Task task = taskMapper.selectById(taskId);
         Project project = projectMapper.selectById(task.getProjectId());
-        List<TaskExecutor> executorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", task.getId()));;
+        List<TaskExecutor> executorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", task.getId()));
+        SysRoleFunction roleFunction = sysRoleFunctionService.getOne(new QueryWrapper<SysRoleFunction>().eq("role_id", user.getRoleId()).eq("function_id", 120));
         if (task.getTaskStatus() == TaskController.STATUS_FIRST_CHECK || task.getTaskStatus() == TaskController.STATUS_SECOND_CHECK){
             if (task.getTaskStatus() == TaskController.STATUS_FIRST_CHECK){
                 //校验第一审核人
-                if (!userId.equals(project.getInchargerId())){
-                    msg.setError("当前人员不是第一审核人,不能审核");
+                if (!userId.equals(project.getInchargerId())&&roleFunction==null){
+                    msg.setError("当前人员不是第一审核人也无审核计划权限,不能审核");
                     return msg;
                 }
-            } else if (task.getTaskStatus() == TaskController.STATUS_SECOND_CHECK){
+            }
+            else if (task.getTaskStatus() == TaskController.STATUS_SECOND_CHECK){
                 //校验第二审核人
                 executorList.forEach(e->{
-                    if (userId.equals(e.getSecondAuditorId())){
+                    if (userId.equals(e.getSecondAuditorId())||roleFunction!=null){
                         e.setSecAuditor(true);
                     }
                 });
-                if (executorList.stream().noneMatch(e->e.isSecAuditor())) {
-                    msg.setError("当前人员不是第二审核人,不能审核");
+                if (executorList.stream().noneMatch(e->e.isSecAuditor())&&roleFunction==null) {
+                    msg.setError("当前人员不是第二审核人也无审核计划权限,不能审核");
                     return msg;
                 }
             }
@@ -1778,7 +1783,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
 
                 String infoMsg = project.getProjectName() + "项目的FTE计划审批任务" +
                         (executorNames.isEmpty() ? "" : ",执行人有:" + executorNames) +
-                        ",工作计划被一级审核人驳回";
+                        ",工作计划在待一级审核人审核时被"+user.getName()+"驳回";
                 information.setMsg(infoMsg);
                 information.setType(11);
                 information.setJumpType(2);
@@ -1808,7 +1813,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
 
                 String infoMsg = project.getProjectName() + "项目的FTE计划审批任务" +
                         (executorNames.isEmpty() ? "" : ",执行人有:" + executorNames) +
-                        ",工作计划被二级审核人驳回";
+                        ",工作计划在待二级审核人审核时被"+user.getName()+"驳回";
                 information.setMsg(infoMsg);
                 information.setType(11);
                 information.setJumpType(2);