Forráskód Böngészése

batchSetParticipation修改

zhouyy 1 hónapja
szülő
commit
7727f9143d

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

@@ -743,8 +743,8 @@ public class ProjectController {
         return projectService.exportWaitingReviewList(request,stateKey,userId,startDate,endDate);
     }
     @RequestMapping("/batchSetParticipation")
-    public HttpRespMsg batchSetParticipation(HttpServletRequest request,String projectIdArray,String userIds){
-        return projectService.batchSetParticipation(request,projectIdArray,userIds);
+    public HttpRespMsg batchSetParticipation(HttpServletRequest request,String projectIdArray,String userIds,String deptIds){
+        return projectService.batchSetParticipation(request,projectIdArray,userIds,deptIds);
     }
     @RequestMapping("/changeCurrentStage")
     public HttpRespMsg changeCurrentStage(Integer projectId,Integer currentStageId,String currentStageName){

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

@@ -8,4 +8,6 @@ import java.util.List;
 
 public interface ProjectDeptRelateMapper  extends BaseMapper<ProjectDeptRelate> {
     void insertBatch(@Param("projectId") Integer projectId,@Param("deptList") List<String> deptList);
+
+    void insertBatchList(@Param("toAddList") List<ProjectDeptRelate> toAddList);
 }

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

@@ -176,7 +176,7 @@ public interface ProjectService extends IService<Project> {
 
     HttpRespMsg exportWaitingReviewList(HttpServletRequest request, Integer stateKey, String userId,String startDate,String endDate);
 
-    HttpRespMsg batchSetParticipation(HttpServletRequest request,String projectIdArray , String userIds);
+    HttpRespMsg batchSetParticipation(HttpServletRequest request,String projectIdArray , String userIds,String deptIds);
 
     HttpRespMsg suspendProject(Integer id);
 

+ 16 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -10234,11 +10234,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     }
 
     @Override
-    public HttpRespMsg batchSetParticipation(HttpServletRequest request,String  projectIdArray,String userIds) {
+    public HttpRespMsg batchSetParticipation(HttpServletRequest request,String  projectIdArray,String userIds,String deptIds) {
         HttpRespMsg msg=new HttpRespMsg();
         User user = userMapper.selectById(request.getHeader("token"));
         List<Integer> array = JSONArray.parseArray(projectIdArray, Integer.class);
         List<String> userIdList = JSONArray.parseArray(userIds, String.class);
+        List<Integer> deptArray = JSONArray.parseArray(deptIds, Integer.class);
+        List<ProjectDeptRelate> toAddList = new ArrayList<>();
+
         List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", user.getCompanyId()).in("id",array));
         List<Participation> list=new ArrayList<>();
         for (Project project : projectList) {
@@ -10261,6 +10264,18 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     .setOperationTime(LocalDateTime.now())
                     .setContent("批量添加项目参与人");
             operationRecordService.save(operationRecord);
+            if(CollectionUtils.isNotEmpty(deptArray)){
+                for (Integer deptId : deptArray) {
+                    ProjectDeptRelate tmpRelate = new ProjectDeptRelate();
+                    tmpRelate.setProjectId(project.getId());
+                    tmpRelate.setDepartmentId(deptId);
+                    toAddList.add(tmpRelate);
+                }
+            }
+
+        }
+        if(CollectionUtils.isNotEmpty(toAddList)){
+            projectDeptRelateMapper.insertBatchList(toAddList);
         }
         participationService.saveBatch(list);
         return msg;

+ 6 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectDeptRelateMapper.xml

@@ -9,4 +9,10 @@
             (#{projectId},#{deptId})
         </foreach>
     </insert>
+    <insert id="insertBatchList">
+        insert into project_dept_relate(project_id, department_id) VALUES
+        <foreach collection="toAddList" item="item" separator=",">
+            (#{item.projectId},#{item.departmentId})
+        </foreach>
+    </insert>
 </mapper>