Преглед на файлове

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

Lijy преди 2 години
родител
ревизия
0ec32c98de

+ 22 - 8
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectRequirementController.java

@@ -2,10 +2,7 @@ package com.management.platform.controller;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.management.platform.entity.Project;
-import com.management.platform.entity.ProjectRequirement;
-import com.management.platform.entity.Task;
-import com.management.platform.entity.TaskGroup;
+import com.management.platform.entity.*;
 import com.management.platform.mapper.*;
 import com.management.platform.service.ProjectRequirementService;
 import com.management.platform.util.ExcelUtil;
@@ -59,7 +56,8 @@ public class ProjectRequirementController {
     private TaskGroupMapper taskGroupMapper;
     @Resource
     private TaskMapper taskMapper;
-
+    @Resource
+    private GroupParticipatorMapper groupParticipatorMapper;
     @RequestMapping("/addOrMod")
     public HttpRespMsg addOrMod(ProjectRequirement record) {
         HttpRespMsg msg = new HttpRespMsg();
@@ -82,13 +80,18 @@ public class ProjectRequirementController {
         now = now.minusDays(7);
         String startDate = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(now);
         List<Integer> projectIds = new ArrayList<>();
+        List<String> taskGroupUserIds=new ArrayList<>();
         if (!StringUtils.isEmpty(groupName)) {
             List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
             List<Integer> collect = projectList.stream().map(Project::getId).collect(Collectors.toList());
             List<TaskGroup> taskGroups = taskGroupMapper.selectList(new QueryWrapper<TaskGroup>().eq("name", groupName).in("project_id", collect));
             projectIds = taskGroups.stream().map(TaskGroup::getProjectId).collect(Collectors.toList());
+            //获取分组 负责人id集合
+            List<GroupParticipator> groupParticipatorList = groupParticipatorMapper.selectList(new QueryWrapper<GroupParticipator>().in("group_id", taskGroups.stream().map(TaskGroup::getId).collect(Collectors.toList())));
+            taskGroupUserIds=groupParticipatorList.stream().map(GroupParticipator::getUserId).collect(Collectors.toList());
+            taskGroupUserIds.add("-1");
         }
-        List<ProjectRequirement> projectRequirements = projectRequirementMapper.customSelect(companyId, startDate, projectId, projectIds.size()==0?null:projectIds, startIndex, pageSize,reStartDate,reEndDate);
+        List<ProjectRequirement> projectRequirements = projectRequirementMapper.customSelect(companyId, startDate, projectId, projectIds.size()==0?null:projectIds, startIndex, pageSize,reStartDate,reEndDate,taskGroupUserIds.size()==0?null:taskGroupUserIds);
         List<Integer> ids = projectRequirements.stream().map(pr -> pr.getProjectId()).collect(Collectors.toList());
         List<Task> milepostList=taskMapper.selectMilepost(ids.size()==0?null:ids);
         projectRequirements.forEach(pr->{
@@ -107,14 +110,25 @@ public class ProjectRequirementController {
         return msg;
     }
     @RequestMapping("/exportData")
-    public HttpRespMsg exportData(){
+    public HttpRespMsg exportData(Integer projectId,String groupName){
         SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
         HttpRespMsg httpRespMsg=new HttpRespMsg();
         Integer companyId = userMapper.selectById(request.getHeader("TOKEN")).getCompanyId();
         LocalDate now = LocalDate.now();
         now = now.minusDays(7);
         String startDate = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(now);
-        List<ProjectRequirement> projectRequirementList = projectRequirementMapper.customSelect(companyId,startDate, null, null, null, null,null,null);
+        List<Integer> projectIds = new ArrayList<>();
+        List<String> taskGroupUserIds=new ArrayList<>();
+        if (!StringUtils.isEmpty(groupName)) {
+            List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
+            List<Integer> collect = projectList.stream().map(Project::getId).collect(Collectors.toList());
+            List<TaskGroup> taskGroups = taskGroupMapper.selectList(new QueryWrapper<TaskGroup>().eq("name", groupName).in("project_id", collect));
+            projectIds = taskGroups.stream().map(TaskGroup::getProjectId).collect(Collectors.toList());
+            List<GroupParticipator> groupParticipatorList = groupParticipatorMapper.selectList(new QueryWrapper<GroupParticipator>().in("group_id", taskGroups.stream().map(TaskGroup::getId).collect(Collectors.toList())));
+            taskGroupUserIds=groupParticipatorList.stream().map(GroupParticipator::getUserId).collect(Collectors.toList());
+            taskGroupUserIds.add("-1");
+        }
+        List<ProjectRequirement> projectRequirementList = projectRequirementMapper.customSelect(companyId,startDate, projectId,  projectIds.size()==0?null:projectIds, null, null,null,null,taskGroupUserIds.size()==0?null:taskGroupUserIds);
         List<Integer> collect = projectRequirementList.stream().map(pr -> pr.getProjectId()).collect(Collectors.toList());
         List<Task> milepostList=taskMapper.selectMilepost(collect);
         projectRequirementList.forEach(pr->{

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

@@ -16,7 +16,7 @@ import com.management.platform.service.UserService;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.WorkDayCalculateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
@@ -1182,7 +1182,7 @@ public class ReportController {
         return reportService.getlastWeekFillTime(userId);
     }
 
-    @GetMapping("/getReportListByToken")
+    @PostMapping("/getReportListByToken")
     public HttpRespMsg getReportListByToken(@RequestParam String token, @RequestParam String startDate, @RequestParam String endDate){
         return reportService.getReportListByToken(token,startDate,endDate);
     }

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ProjectRequirementMapper.java

@@ -15,7 +15,7 @@ import java.util.List;
  */
 public interface ProjectRequirementMapper extends BaseMapper<ProjectRequirement> {
 
-    public List<ProjectRequirement> customSelect(Integer companyId, String startDate, Integer projectId, List<Integer> refProjectIdList, Integer startIndex, Integer pageSize,String reStartDate,String reEndDate);
+    public List<ProjectRequirement> customSelect(Integer companyId, String startDate, Integer projectId, List<Integer> refProjectIdList, Integer startIndex, Integer pageSize,String reStartDate,String reEndDate,List<String> refTaskGroupUserIdList);
 
     long selectCountByDate(Integer companyId, String startDate, Integer projectId, List<Integer> refProjectIdList, int startIndex, Integer pageSize, String reStartDate, String reEndDate);
 }

+ 7 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectRequirementMapper.xml

@@ -31,7 +31,13 @@
 
     <select id="customSelect" resultMap="RichMap">
         SELECT project_requirement.id, project.id AS project_id, project.`project_name`, project.`project_code`, project_requirement.`memb_req`, project_requirement.`task_req`,project_requirement.contract_req,project_requirement.department_speed,project_requirement.start_date,project_requirement.end_date,
-        (SELECT GROUP_CONCAT(DISTINCT user.`name`) FROM report LEFT JOIN `user` ON user.`id` = report.`creator_id` WHERE report.company_id=#{companyId} AND report.create_time >= #{startDate} AND report.`project_id` = project.id) AS active_users
+        (SELECT GROUP_CONCAT(DISTINCT user.`name`) FROM report LEFT JOIN `user` ON user.`id` = report.`creator_id` WHERE report.company_id=#{companyId} AND report.create_time >= #{startDate} AND report.`project_id` = project.id
+        <if test="refTaskGroupUserIdList!=null">
+        and user.`id` in
+        <foreach collection="refTaskGroupUserIdList" open="(" close=")" separator="," item="item">
+        #{item}
+        </foreach>
+         </if> ) AS active_users
         FROM project LEFT JOIN project_requirement ON project.id = project_requirement.`project_id`
         WHERE project.`company_id` = #{companyId}
          <if test="projectId != null">