Bläddra i källkod

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

ggooalice 2 år sedan
förälder
incheckning
36e358c67c

+ 2 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ProjectMapper.java

@@ -99,9 +99,9 @@ public interface ProjectMapper extends BaseMapper<Project> {
 
     long findCountWithUser(String userId, Integer companyId, String startDate, String endDate, Integer projectId, Integer start,Integer size,Integer departmentId,List<Integer> deptIds);
 
-    List<Map<String, Object>> getWaitingReviewList(Integer stateKey,Integer companyId, String userId,Integer start,Integer size,String startDate,String endDate,Integer departmentId);
+    List<Map<String, Object>> getWaitingReviewList(Integer stateKey,Integer companyId, String userId,Integer start,Integer size,String startDate,String endDate,Integer departmentId,List<Integer> deptIds);
 
-    long findCount(Integer stateKey,Integer companyId, String userId, Integer start, Integer size,String startDate,String endDate,Integer departmentId);
+    long findCount(Integer stateKey,Integer companyId, String userId, Integer start, Integer size,String startDate,String endDate,Integer departmentId,List<Integer> deptIds);
 
     @Update("update project set status=4 where id=#{id}")
     void suspendProject(Integer id);

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

@@ -5313,6 +5313,21 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     public HttpRespMsg getWaitingReviewList(HttpServletRequest request, Integer stateKey, String userId,Integer pageIndex,Integer pageSize,String startDate,String endDate,Integer departmentId) {
         HttpRespMsg msg=new HttpRespMsg();
         User user = userMapper.selectById(request.getHeader("token"));
+        List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", user.getId()));
+        List<DepartmentOtherManager> otherManagers = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", user.getId()));
+        //获取全部子部门
+        List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
+        List<Integer> collect = departmentList.stream().distinct().map(Department::getDepartmentId).collect(Collectors.toList());
+        List<Integer> collect1 = otherManagers.stream().distinct().map(DepartmentOtherManager::getDepartmentId).collect(Collectors.toList());
+        List<Integer> deptIds=new ArrayList<>();
+        for (Integer dpId : collect) {
+            List<Integer> ids = departmentService.getDeptIncludeSubDeptIds(dpId, allDeptList);
+            deptIds.addAll(ids);
+        }
+        for (Integer dpId : collect1) {
+            List<Integer> ids = departmentService.getDeptIncludeSubDeptIds(dpId, allDeptList);
+            deptIds.addAll(ids);
+        }
         Integer size;
         Integer start;
         if(pageIndex!=null&&pageSize!=null){
@@ -5322,8 +5337,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             size=null;
             start=null;
         }
-        List<Map<String,Object>>  list=projectMapper.getWaitingReviewList(stateKey,user.getCompanyId(),userId,start,size,startDate,endDate,departmentId);
-        long total=projectMapper.findCount(stateKey,user.getCompanyId(),userId,null,null,startDate,endDate,departmentId);
+        List<Map<String,Object>>  list=projectMapper.getWaitingReviewList(stateKey,user.getCompanyId(),userId,start,size,startDate,endDate,departmentId,deptIds);
+        long total=projectMapper.findCount(stateKey,user.getCompanyId(),userId,null,null,startDate,endDate,departmentId,deptIds);
         HashMap map=new HashMap();
         map.put("total",total);
         map.put("result",list);

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

@@ -821,29 +821,75 @@
     <select id="getWaitingReviewList" resultType="java.util.Map">
         <choose>
             <when test="stateKey==0">
-                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.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
+                SELECT 	dept_manager.name as userName,department.department_name as departmentName,COUNT(1) as num
+                FROM report AS a
+                left join user on user.id = a.creator_id
+                JOIN project AS b ON a.project_id=b.id
+                left join sub_project as d on d.id = a.sub_project_id
+                left join task on task.id = a.task_id
+                left join report_extra_degree on report_extra_degree.id = a.degree_id
+                left join department on department.department_id = a.audit_deptid
+                left join user dept_manager on dept_manager.id = a.audit_dept_managerid
+                left join department dept on dept.department_id = a.dept_id
+                left join task_group on task_group.id = a.group_id
+                left join user u on u.id = a.project_auditor_id
+                WHERE a.company_id =#{companyId}
+                and a.state = 0
+                <if test="startDate!=null and endDate!=null">
+                    AND a.create_date between #{startDate} and #{endDate}
+                </if>
+                AND a.is_dept_audit=1
+                <if test="userId!=null">
+                    and dept_manager.id=#{userId}
+                </if>
+                <if test="departmentId!=null">
+                    and dept_manager.department_id=#{departmentId}
+                </if>
+                <if test="deptIds!=null and deptIds.size()>0">
+                    and dept_manager.department_id in
+                    <foreach collection="deptIds" open="(" separator="," close=")" item="item">
+                        #{item}
+                    </foreach>
+                </if>
+                group by a.audit_dept_managerid
+                ORDER BY a.create_date desc, a.creator_id asc
             </when>
             <otherwise>
-                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=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
+                SELECT 	u.name as userName,dp.department_name as departmentName,COUNT(1) as num
+                FROM report AS a
+                left join user on user.id = a.creator_id
+                JOIN project AS b ON a.project_id=b.id
+                left join sub_project as d on d.id = a.sub_project_id
+                left join task on task.id = a.task_id
+                left join report_extra_degree on report_extra_degree.id = a.degree_id
+                left join department on department.department_id = a.audit_deptid
+                left join user dept_manager on dept_manager.id = a.audit_dept_managerid
+                left join department dept on dept.department_id = a.dept_id
+                left join task_group on task_group.id = a.group_id
+                left join user u on u.id = a.project_auditor_id
+                left join department dp on u.department_id=dp.department_id
+                WHERE a.company_id =#{companyId}
+                and a.state = 0
+                <if test="startDate!=null and endDate!=null">
+                    AND a.create_date between #{startDate} and #{endDate}
+                </if>
+                AND a.is_dept_audit=0  and a.project_audit_state = 0
+                <if test="userId!=null">
+                    and u.id=#{userId}
+                </if>
+                <if test="departmentId!=null">
+                    and u.department_id=#{departmentId}
+                </if>
+                <if test="deptIds!=null and deptIds.size()>0">
+                    and u.department_id in
+                    <foreach collection="deptIds" open="(" separator="," close=")" item="item">
+                        #{item}
+                    </foreach>
+                </if>
+                group by a.project_auditor_id
+                ORDER BY a.create_date desc, a.creator_id asc
             </otherwise>
         </choose>
-        where us.company_id=#{companyId} and us.is_active=1
-        <if test="userId!=null">
-            and us.id=#{userId}
-        </if>
-        <if test="departmentId!=null">
-            and us.department_id=#{departmentId}
-        </if>
-        group by us.id
-        order by us.department_id
         <if test="start!=null and size!=null">
             limit #{start},#{size}
         </if>
@@ -853,29 +899,75 @@
         select  count(1)
         from (<choose>
         <when test="stateKey==0">
-            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 department dp2 on dp2.department_id=dp.department_id
+            SELECT 	dept_manager.name as userName,department.department_name as departmentName,COUNT(1) as num
+            FROM report AS a
+            left join user on user.id = a.creator_id
+            JOIN project AS b ON a.project_id=b.id
+            left join sub_project as d on d.id = a.sub_project_id
+            left join task on task.id = a.task_id
+            left join report_extra_degree on report_extra_degree.id = a.degree_id
+            left join department on department.department_id = a.audit_deptid
+            left join user dept_manager on dept_manager.id = a.audit_dept_managerid
+            left join department dept on dept.department_id = a.dept_id
+            left join task_group on task_group.id = a.group_id
+            left join user u on u.id = a.project_auditor_id
+            WHERE a.company_id =#{companyId}
+            and a.state = 0
+            <if test="startDate!=null and endDate!=null">
+                AND a.create_date between #{startDate} and #{endDate}
+            </if>
+            AND a.is_dept_audit=1
+            <if test="userId!=null">
+                and dept_manager.id=#{userId}
+            </if>
+            <if test="departmentId!=null">
+                and dept_manager.department_id=#{departmentId}
+            </if>
+            <if test="deptIds!=null and deptIds.size()>0">
+                and dept_manager.department_id in
+                <foreach collection="deptIds" open="(" separator="," close=")" item="item">
+                    #{item}
+                </foreach>
+            </if>
+            group by a.audit_dept_managerid
+            ORDER BY a.create_date desc, a.creator_id asc
         </when>
         <otherwise>
-            select us.name as userName,dp.department_name as departmentName,COUNT(rp.project_audit_state=0 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 department dp on dp.department_id=us.department_id
+            SELECT 	u.name as userName,dp.department_name as departmentName,COUNT(1) as num
+            FROM report AS a
+            left join user on user.id = a.creator_id
+            JOIN project AS b ON a.project_id=b.id
+            left join sub_project as d on d.id = a.sub_project_id
+            left join task on task.id = a.task_id
+            left join report_extra_degree on report_extra_degree.id = a.degree_id
+            left join department on department.department_id = a.audit_deptid
+            left join user dept_manager on dept_manager.id = a.audit_dept_managerid
+            left join department dept on dept.department_id = a.dept_id
+            left join task_group on task_group.id = a.group_id
+            left join user u on u.id = a.project_auditor_id
+            left join department dp on u.department_id=dp.department_id
+            WHERE a.company_id =#{companyId}
+            and a.state = 0
+            <if test="startDate!=null and endDate!=null">
+                AND a.create_date between #{startDate} and #{endDate}
+            </if>
+            AND a.is_dept_audit=0  and a.project_audit_state = 0
+            <if test="userId!=null">
+                and u.id=#{userId}
+            </if>
+            <if test="departmentId!=null">
+                and u.department_id=#{departmentId}
+            </if>
+            <if test="deptIds!=null and deptIds.size()>0">
+                and u.department_id in
+                <foreach collection="deptIds" open="(" separator="," close=")" item="item">
+                    #{item}
+                </foreach>
+            </if>
+            group by a.project_auditor_id
+            ORDER BY a.create_date desc, a.creator_id asc
         </otherwise>
     </choose>
-        where us.company_id=#{companyId} and us.is_active=1
-        <if test="userId!=null">
-            and us.id=#{userId}
-        </if>
-        <if test="departmentId!=null">
-            and us.department_id=#{departmentId}
-        </if>
-        group by us.id
-        order by us.department_id
         <if test="start!=null and size!=null">
             limit #{start},#{size}
         </if>) total

+ 3 - 3
fhKeeper/formulahousekeeper/timesheet_h5/src/utils/request.js

@@ -28,7 +28,7 @@ service.interceptors.request.use(
         return config;
     },
     error => {
-        Promise.reject(error);
+        return Promise.reject(error);
     }
 );
 
@@ -39,7 +39,7 @@ service.interceptors.response.use(
             const res = response.data;
             return res;
         } else {
-            Promise.reject("网络异常");
+            return Promise.reject("网络异常");
         }
         
         // if (res.code == "666") {
@@ -53,7 +53,7 @@ service.interceptors.response.use(
         // }
     },
     error => {
-        Promise.reject("网络异常");
+        return Promise.reject("网络异常");
     }
 );
 export default service;