Переглянути джерело

待审核数量统计修改 项目状态操作日志
日志显示倒叙

yurk 2 роки тому
батько
коміт
21455f71e1

+ 22 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java

@@ -4,6 +4,7 @@ package com.management.platform.controller;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.*;
 import com.management.platform.mapper.*;
+import com.management.platform.service.OperationRecordService;
 import com.management.platform.service.ProjectService;
 import com.management.platform.util.HttpRespMsg;
 import org.apache.poi.hssf.usermodel.*;
@@ -22,6 +23,7 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -58,6 +60,10 @@ public class ProjectController {
     private ProjectKeyNodesMapper projectKeyNodesMapper;
     @Resource
     private ProjectKeyNodesSettingMapper projectKeyNodesSettingMapper;
+    @Resource
+    private UserMapper userMapper;
+    @Resource
+    private OperationRecordService operationRecordService;
 
     /**
      * 获取我参与的全部项目的负责人列表
@@ -306,6 +312,14 @@ public class ProjectController {
         project.setStatus(2);
         project.setFinishDate(LocalDate.now());
         projectService.updateById(project);
+        User user = userMapper.selectById(request.getHeader("token"));
+        OperationRecord operationRecord=new OperationRecord();
+        operationRecord.setProjectName(project.getProjectName());
+        operationRecord.setOperationTime(LocalDateTime.now());
+        operationRecord.setContent("完成了项目");
+        operationRecord.setOperatorName(user.getName());
+        operationRecord.setCompanyId(user.getCompanyId());
+        operationRecordService.save(operationRecord);
         return new HttpRespMsg();
     }
 
@@ -320,6 +334,14 @@ public class ProjectController {
             project.setId(id);
             project.setStatus(3);
             projectService.updateById(project);
+            User user = userMapper.selectById(request.getHeader("token"));
+            OperationRecord operationRecord=new OperationRecord();
+            operationRecord.setProjectName(project.getProjectName());
+            operationRecord.setOperationTime(LocalDateTime.now());
+            operationRecord.setContent("撤销了项目");
+            operationRecord.setOperatorName(user.getName());
+            operationRecord.setCompanyId(user.getCompanyId());
+            operationRecordService.save(operationRecord);
         }
 
         return msg;

+ 20 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -62,6 +62,8 @@ import java.util.stream.Collectors;
 public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements ProjectService {
     String pathPrefix = "/upload/";
     @Resource
+    private HttpServletRequest request;
+    @Resource
     private ProjectNotifyUserService projectNotifyUserService;
     @Resource
     private GroupParticipatorMapper groupParticipatorMapper;
@@ -1438,7 +1440,16 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
 
     @Override
     public HttpRespMsg restartProject(Integer id) {
+        User user = userMapper.selectById(request.getHeader("token"));
         projectMapper.restartProject(id);
+        Project project = getById(id);
+        OperationRecord operationRecord=new OperationRecord();
+        operationRecord.setProjectName(project.getProjectName());
+        operationRecord.setOperationTime(LocalDateTime.now());
+        operationRecord.setContent("重启了项目");
+        operationRecord.setOperatorName(user.getName());
+        operationRecord.setCompanyId(user.getCompanyId());
+        operationRecordService.save(operationRecord);
         return new HttpRespMsg();
     }
 
@@ -5330,7 +5341,16 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
 
     @Override
     public HttpRespMsg suspendProject(Integer id) {
+        User user = userMapper.selectById(request.getHeader("token"));
         projectMapper.suspendProject(id);
+        Project project = getById(id);
+        OperationRecord operationRecord=new OperationRecord();
+        operationRecord.setProjectName(project.getProjectName());
+        operationRecord.setOperationTime(LocalDateTime.now());
+        operationRecord.setContent("暂停了项目");
+        operationRecord.setOperatorName(user.getName());
+        operationRecord.setCompanyId(user.getCompanyId());
+        operationRecordService.save(operationRecord);
         return new HttpRespMsg();
     }
 

+ 3 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml

@@ -824,14 +824,14 @@
                 select us.name as userName,dp2.department_name as departmentName,COUNT(rp.state=0 or null) as num
                 from department dp
                 left join user us on dp.manager_id=us.id
-                left join report rp on rp.audit_deptid=us.manage_dept_id and rp.create_date between #{startDate} and #{endDate} and rp.audit_deptid !=0 and rp.is_dept_audit=1
+                left join report rp on rp.dept_id=dp.department_id and rp.create_date between #{startDate} and #{endDate} and rp.audit_deptid !=0 and rp.is_dept_audit=1
                 left join department dp2 on dp2.department_id=dp.department_id
             </when>
             <otherwise>
-                select us.name as userName,dp.department_name as departmentName,COUNT(rp.project_audit_state=0 or null) as num
+                select us.name as userName,dp.department_name as departmentName,COUNT((rp.project_audit_state=0 and rp.state!=2 and rp.state!=3) or null) as num
                 from project_auditor pa
                 left join user us on pa.auditor_id=us.id
-                left join report rp on rp.project_auditor_id=us.id and pa.project_id=rp.project_id and rp.create_date between #{startDate} and #{endDate} and rp.is_dept_audit=0
+                left join report rp on rp.project_auditor_id=pa.auditor_id and pa.project_id=rp.project_id and rp.create_date between #{startDate} and #{endDate} and rp.is_dept_audit=0
                 left join department dp on dp.department_id=us.department_id
             </otherwise>
         </choose>

+ 1 - 0
fhKeeper/formulahousekeeper/ops-platform/src/main/java/com/management/platform/controller/OperationRecordController.java

@@ -54,6 +54,7 @@ public class OperationRecordController {
             queryWrapper.ge("operation_time",start);
             queryWrapper.le("operation_time",end);
         }
+        queryWrapper.orderByDesc("operation_time");
         IPage<OperationRecord> operationRecordIPage = operationRecordMapper.selectPage(new Page<>(pageIndex, pageSize), queryWrapper);
         List<OperationRecord> list = operationRecordIPage.getRecords();
         for (OperationRecord operationRecord : list) {