Min 10 mēneši atpakaļ
vecāks
revīzija
88aa7b851b

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

@@ -1483,6 +1483,12 @@ public class ProjectController {
         return projectService.groupExpendProcessListForChart(startDate,endDate,projectIds,groupNames);
     }
 
+    //依斯倍定制 分组耗用表针对部门人员
+    @RequestMapping("/groupExpendProcessListForUser")
+    public HttpRespMsg groupExpendProcessListForUser(String startDate,String endDate,String projectIds,String groupNames,String deptIdStr){
+        return projectService.groupExpendProcessListForUser(startDate,endDate,projectIds,groupNames,deptIdStr);
+    }
+
     //依斯倍定制 导出分组耗用进度表
     @RequestMapping("/exportGroupExpendProcessList")
     public HttpRespMsg exportGroupExpendProcessList(String startDate,String endDate,Integer projectId){

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

@@ -186,4 +186,6 @@ public interface ProjectMapper extends BaseMapper<Project> {
     void removeReviwer(Integer id);
 
     List<Map<String, Object>> groupExpendProcessListForChart(String userId, Integer companyId, String startDate, String endDate,@Param("list") List<Integer> deptIds,@Param("listSecond") List<Integer> regularDeptIds,@Param("listThird") List<Integer> projectIdList,@Param("listFour") List<String> groupNameList);
+
+    List<Map<String, Object>> groupExpendProcessListForUser(Object o, Integer companyId, String startDate, String endDate,@Param("list") List<Integer> deptIds,@Param("listSecond") List<Integer> regularDeptIds, @Param("listThird")List<Integer> projectIdList,@Param("listFour") List<String> groupNameList,@Param("listFive") List<Integer> deptIdList);
 }

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ProjectService.java

@@ -300,4 +300,6 @@ public interface ProjectService extends IService<Project> {
     HttpRespMsg batchSetProjectTaskExecutor(String projectIds, String userIds);
 
     HttpRespMsg groupExpendProcessListForChart(String startDate, String endDate, String projectIds, String groupNames);
+
+    HttpRespMsg groupExpendProcessListForUser(String startDate, String endDate, String projectIds, String groupNames, String deptIdStr);
 }

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

@@ -14407,4 +14407,74 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         msg.setData(resultList);
         return msg;
     }
+
+    @Override
+    public HttpRespMsg groupExpendProcessListForUser(String startDate, String endDate, String projectIds, String groupNames, String deptIdStr) {
+        HttpRespMsg msg=new HttpRespMsg();
+        User user = userMapper.selectById(request.getHeader("token"));
+        List<Department> departments = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, user.getCompanyId()));
+        NumberFormat percentFormat = NumberFormat.getPercentInstance();
+        percentFormat.setMaximumFractionDigits(2);
+        Integer companyId = user.getCompanyId();
+        List<String> groupNameList=new ArrayList<>();
+        List<Integer> projectIdList=new ArrayList<>();
+        List<Integer> deptIdList=new ArrayList<>();
+        if(!StringUtils.isEmpty(groupNames)){
+            groupNameList = Arrays.asList(groupNames.split(","));
+        }
+        if(!StringUtils.isEmpty(projectIds)){
+            projectIdList=Arrays.asList(projectIds.split(",")).stream().map(i->Integer.valueOf(i)).collect(Collectors.toList());
+        }
+        if(!StringUtils.isEmpty(deptIdStr)){
+            deptIdList=Arrays.asList(deptIdStr.split(",")).stream().map(i->Integer.valueOf(i)).collect(Collectors.toList());
+        }
+        boolean viewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "全部分组耗用进度表");
+        boolean incharger = sysFunctionService.hasPriviledge(user.getRoleId(), "负责部门分组耗用进度表");
+        List<Department> allDeptList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
+        List<Map<String,Object>> resultList;
+        //是否具有查看全部数据的权限
+        //针对依斯呗 指定部门
+        List<Integer> regularDeptIds=new ArrayList<>();
+        if(user.getCompanyId()==3092){
+            List<String> nameString=new ArrayList<>();
+            nameString.add("4");
+            nameString.add("46");
+            nameString.add("45");
+            List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, user.getCompanyId()).in(Department::getDepartmentName, nameString));
+            List<Integer> theCollect = departmentList.stream().map(dm -> dm.getDepartmentId()).distinct().collect(Collectors.toList());
+            theCollect.add(-1);
+            for (Integer integer : theCollect) {
+                List<Integer> branchDepartment = getBranchDepartment(integer, allDeptList);
+                regularDeptIds.addAll(branchDepartment);
+            }
+        }
+        if(!viewAll){
+            if(!incharger){
+                //只能查看本人的数据
+                resultList=projectMapper.groupExpendProcessListForUser(user.getId(),companyId,startDate,endDate,null,null,projectIdList,groupNameList,deptIdList);
+            }else {
+                List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().select(Department::getDepartmentId).eq(Department::getManagerId, user.getId()));
+                List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", user.getId()));
+                List<Integer> deptIds=new ArrayList<>();
+                List<Integer> theCollect = departmentList.stream().map(dm -> dm.getDepartmentId()).distinct().collect(Collectors.toList());
+                theCollect.add(-1);
+                List<Integer> otherCollect = departmentOtherManagerList.stream().map(dom -> dom.getDepartmentId()).distinct().collect(Collectors.toList());
+                otherCollect.add(-1);
+                theCollect.addAll(otherCollect);
+                for (Integer integer : theCollect) {
+                    List<Integer> branchDepartment = getBranchDepartment(integer, allDeptList);
+                    deptIds.addAll(branchDepartment);
+                }
+                resultList=projectMapper.groupExpendProcessListForUser(null,companyId,startDate,endDate,deptIdList,regularDeptIds,projectIdList,groupNameList,deptIdList);
+            }
+        }else {
+            resultList=projectMapper.groupExpendProcessListForUser(null,companyId,startDate,endDate,null,regularDeptIds,projectIdList,groupNameList,deptIdList);
+        }
+        resultList.forEach(r->{
+            Optional<Department> department = departments.stream().filter(d -> d.getDepartmentId().equals(Integer.valueOf(String.valueOf(r.get("departmentId"))))).findFirst();
+            r.put("departmentName",departmentService.getSupDepartment(department.get(),departments));
+        });
+        msg.setData(resultList);
+        return msg;
+    }
 }

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

@@ -1969,6 +1969,52 @@
          GROUP BY t.groupName
     </select>
 
+    <select id="groupExpendProcessListForUser" resultType="java.util.Map">
+        SELECT departmentId, departmentName,jobNumber,userName ,groupName,IFNULL(SUM(workTime),0) as workTime FROM (
+        SELECT d.`department_id` AS departmentId,d.`department_name` AS departmentName,u.`job_number` AS jobNumber,u.`name` AS userName ,tg.name AS groupName,rr.realHour AS workTime,u.id
+        FROM task_executor te
+        LEFT JOIN task t ON t.id=te.task_id
+        LEFT JOIN `user` u ON te.executor_id=u.id
+        LEFT JOIN task_group tg ON tg.id=t.group_id
+        LEFT JOIN project p ON p.id=tg.project_id
+        LEFT JOIN department d ON d.department_id=u.department_id
+        LEFT JOIN (
+        SELECT r.creator_id AS creatorId,SUM(r.working_time) AS realHour,tg.id AS groupId
+        FROM report r
+        LEFT JOIN task_group tg ON r.group_id=tg.`id`
+        WHERE state=1
+        <if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
+            AND r.create_date BETWEEN #{startDate} AND #{endDate}
+        </if>
+        AND r.project_id IS NOT NULL AND r.company_id=#{companyId}
+        GROUP BY r.creator_id,tg.id ) rr ON rr.groupId=tg.`id` AND rr.creatorId=u.id
+        WHERE u.company_id=#{companyId}
+        <if test="listThird!=null and listThird.size()>0">
+            AND tg.project_id in
+            <foreach collection="listThird" separator="," open="(" close=")" item="item">
+                #{item}
+            </foreach>
+        </if>
+        <if test="listFive!=null and listFive.size()>0">
+            AND  d.id in
+            <foreach collection="listFive" separator="," open="(" close=")" item="item">
+                #{item}
+            </foreach>
+        </if>
+        AND tg.name IN ('研发部','生产部','工程部','生产部电气','生产部车间','工程部现场安装施工','工程部配合调试','研发部工艺设计','研发部结构设计','研发部BIM设计','研发部电气设计','研发部工艺调试验收','研发部电气调试验收')
+        GROUP BY u.`id`,tg.id
+        ) AS t
+        <where>
+            <if test="listFour!=null and listFour.size()>0">
+                t.groupName in
+                <foreach collection="listFour" close=")" open="(" separator="," item="item">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+        GROUP BY t.id,t.groupName
+    </select>
+
     <select id="projectExpendProcessList" resultType="java.util.Map">
         select p.id AS projectId,p.project_name as projectName,DATE_FORMAT(p.`plan_start_date`,'%Y-%m-%d') AS planStartDate,DATE_FORMAT(p.`plan_end_date`,'%Y-%m-%d') AS planEndDate,pc.name as categoryName,p.project_code as projectCode,IFNULL(SUM(te.plan_hours),0) as planHour,
         IFNULL((select SUM(working_time) from report where project_id=p.id and create_date BETWEEN #{startDate} AND #{endDate} and state=1),0) as realHour, IFNULL((select SUM(cost) from report where project_id=p.id and create_date BETWEEN #{startDate} AND #{endDate} and state=1),0) as realCost,

+ 1 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/ReportMapper.xml

@@ -255,7 +255,7 @@
         LEFT JOIN prod_procedure pp ON ppt.prod_procedure_id=pp.id
         LEFT JOIN product p ON p.id=plan.product_id
         WHERE ppt2.company_id=#{companyId}
-        AND r.sumReport &lt; ppt2.work_time
+        AND r.sumReport &lt; ppt2.work_time AND ppt.total_progress &lt; 100
         <if test="date!=null and date!=''">
             and ppt2.distribute_date=#{date}
         </if>