Browse Source

Merge remote-tracking branch 'origin/dev_issue_project' into dev_issue_project

master
yinzuomei 5 years ago
parent
commit
f97e1fb041
  1. 51
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyDeptGridFormDTO.java
  2. 52
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyDeptGridResultDTO.java
  3. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  4. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  5. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java
  6. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  7. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  8. 22
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  9. 11
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  10. 11
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml
  11. 11
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  12. 35
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java
  13. 36
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TransferFormDTO.java
  14. 12
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java
  15. 14
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java
  16. 11
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  17. 7
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
  18. 9
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectProcessService.java
  19. 93
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java

51
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyDeptGridFormDTO.java

@ -0,0 +1,51 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* 根据组织Id集合部门Id集合网格Id集合查询对应详细信息-入参
*
* @author sun
*/
@Data
public class AgencyDeptGridFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 组织Id集合
*/
private List<String> agencyIdList;
/**
* 部门Id集合
*/
private List<String> deptIdList;
/**
* 网格Id集合
*/
private List<String> gridIdList;
}

52
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyDeptGridResultDTO.java

@ -0,0 +1,52 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerDepartmentDTO;
import com.epmet.dto.CustomerGridDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 根据组织Id集合部门Id集合网格Id集合查询对应详细信息--返参
*
* @author sun
*/
@Data
public class AgencyDeptGridResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 组织信息集合
*/
private List<CustomerAgencyDTO> agencyList;
/**
* 部门信息集合
*/
private List<CustomerDepartmentDTO> deptList;
/**
* 网格信息集合
*/
private List<CustomerGridDTO> gridList;
}

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -26,7 +26,9 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.AgencyDeptGridFormDTO;
import com.epmet.dto.form.StaffOrgFormDTO;
import com.epmet.dto.result.AgencyDeptGridResultDTO;
import com.epmet.dto.result.AgencyGridResultDTO;
import com.epmet.dto.result.DepartmentStaffListResultDTO;
import com.epmet.dto.result.StaffOrgsResultDTO;
@ -129,4 +131,15 @@ public class CustomerAgencyController {
return new Result<DepartmentStaffListResultDTO>().ok(customerAgencyService.departmentStaffList(agencyId));
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 根据组织Id集合部门Id集合网格Id集合查询各自对应详细信息
**/
@PostMapping("getagencydeptgridlist")
public Result<AgencyDeptGridResultDTO> getAgencyDeptGridList(AgencyDeptGridFormDTO formDTO) {
return new Result<AgencyDeptGridResultDTO>().ok(customerAgencyService.getAgencyDeptGridList(formDTO));
}
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -87,4 +87,12 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @date 2020/4/28 15:50
*/
String selectAreaCodeByAgencyId(@Param("agencyId") String agencyId);
/**
* @param agencyIdList
* @return
* @Author sun
* @Description 批量查询组织信息
**/
List<CustomerAgencyDTO> selectAgencyListByIds(@Param("agencyIdList") List<String> agencyIdList);
}

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java

@ -18,6 +18,8 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerDepartmentDTO;
import com.epmet.dto.CustomerIdDTO;
import com.epmet.dto.result.DepartmentListResultDTO;
import com.epmet.dto.result.SubListResultDTO;
@ -65,4 +67,12 @@ public interface CustomerDepartmentDao extends BaseDao<CustomerDepartmentEntity>
* @date 2020/4/28 12:26
*/
CustomerIdDTO selectCustomerIdByDepartmentId(@Param("departmentId") String departmentId);
/**
* @param deptIdList
* @return
* @Author sun
* @Description 批量查询部门信息
**/
List<CustomerDepartmentDTO> selectDeptListByIds(@Param("deptIdList") List<String> deptIdList);
}

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.UserIdAndPidDTO;
import com.epmet.dto.UserIdDTO;
@ -167,4 +168,12 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @author sun
*/
List<GridListResultDTO> selectGridList(@Param("agencyId") String agencyId);
/**
* @param gridIdList
* @return
* @Author sun
* @Description 批量查询网格信息
**/
List<CustomerGridDTO> selectGridListByIds(@Param("gridIdList") List<String> gridIdList);
}

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -21,7 +21,9 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.AgencyDeptGridFormDTO;
import com.epmet.dto.form.StaffOrgFormDTO;
import com.epmet.dto.result.AgencyDeptGridResultDTO;
import com.epmet.dto.result.AgencyGridResultDTO;
import com.epmet.dto.result.DepartmentStaffListResultDTO;
import com.epmet.dto.result.StaffOrgsResultDTO;
@ -122,4 +124,12 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @Description 查询组织下人员,组织下部门人员,组织下网格人员列表信息
**/
DepartmentStaffListResultDTO departmentStaffList(String agencyId);
/**
* @param formDTO
* @return
* @Author sun
* @Description 根据组织Id集合部门Id集合网格Id集合查询各自对应详细信息
**/
AgencyDeptGridResultDTO getAgencyDeptGridList(AgencyDeptGridFormDTO formDTO);
}

22
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -29,6 +29,7 @@ import com.epmet.constant.CustomerAgencyConstant;
import com.epmet.constant.CustomerGridConstant;
import com.epmet.dao.*;
import com.epmet.dto.*;
import com.epmet.dto.form.AgencyDeptGridFormDTO;
import com.epmet.dto.form.CustomerFormDTO;
import com.epmet.dto.form.StaffOrgFormDTO;
import com.epmet.dto.result.*;
@ -298,4 +299,25 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return resultDTO;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 根据组织Id集合部门Id集合网格Id集合查询各自对应详细信息
**/
@Override
public AgencyDeptGridResultDTO getAgencyDeptGridList(AgencyDeptGridFormDTO formDTO) {
AgencyDeptGridResultDTO agencyDeptGrid = new AgencyDeptGridResultDTO();
//1:跟踪组织Id批量查询组织信息
List<CustomerAgencyDTO> agencyList = baseDao.selectAgencyListByIds(formDTO.getAgencyIdList());
//2:根据部门Id批量查询部门信息
List<CustomerDepartmentDTO> deptList = customerDepartmentDao.selectDeptListByIds(formDTO.getDeptIdList());
//3:根据网格Id批量查询网格信息
List<CustomerGridDTO> gridList = customerGridDao.selectGridListByIds(formDTO.getGridIdList());
agencyDeptGrid.setAgencyList(agencyList);
agencyDeptGrid.setDeptList(deptList);
agencyDeptGrid.setGridList(gridList);
return agencyDeptGrid;
}
}

11
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -108,4 +108,15 @@
INNER JOIN customer_agency ca ON (csa.AGENCY_ID = ca.ID)
WHERE csa.USER_ID = #{staffId}
</select>
<select id="selectAgencyListByIds" resultType="com.epmet.dto.CustomerAgencyDTO">
SELECT
<include refid="sql"></include>
FROM customer_agency ca
WHERE ca.del_flag = '0'
AND
<foreach item="agencyId" collection="agencyIdList" open="(" separator="or" close=")" index="">
ca.id = #{agencyId}
</foreach>
</select>
</mapper>

11
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml

@ -44,4 +44,15 @@
id = #{departmentId}
AND del_flag = 0
</select>
<select id="selectDeptListByIds" resultType="com.epmet.dto.CustomerDepartmentDTO">
SELECT
*
FROM customer_department
WHERE del_flag = '0'
AND
<foreach item="departmentId" collection="deptIdList" open="(" separator="or" close=")" index="">
id = #{departmentId}
</foreach>
</select>
</mapper>

11
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -295,4 +295,15 @@
ORDER BY created_time DESC
</select>
<select id="selectGridListByIds" resultType="com.epmet.dto.CustomerGridDTO">
SELECT
*
FROM customer_grid
WHERE del_flag = '0'
AND
<foreach item="gridId" collection="gridIdList" open="(" separator="or" close=")" index="">
id = #{gridId}
</foreach>
</select>
</mapper>

35
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java

@ -0,0 +1,35 @@
package com.epmet.dto.form;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @Description 项目跟踪-转其他部门-勾选的人员信息-接口入参
* @Author sun
*/
@Data
public class TickStaffFormDTO implements Serializable {
private static final long serialVersionUID = 4859779755214502427L;
@NotBlank(message = "机关Id不能为空")
private String agencyId;
/**
* 部门Id(为空表示勾选的人不是部门下的可能是组织下的也可能是网格下的)
*/
private String departmentId;
/**
* 网格Id(为空表示勾选的人不是网格下的可能是组织下的也可能是部门下的)
*/
private String gridId;
@NotBlank(message = "内部备注不能为空")
private String staffId;
}

36
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TransferFormDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.form;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @Description 项目跟踪-转其他部门-接口入参
* @Author sun
*/
@Data
public class TransferFormDTO implements Serializable {
private static final long serialVersionUID = 4859779755214502427L;
@NotBlank(message = "项目Id不能为空")
private String projectId;
@NotBlank(message = "项目人员关联Id不能为空")
private String projectStaffId;
@Length(max=1000,message = "公开答复内容不能超过1000位")
private String publicReply;
@NotBlank(message = "内部备注不能为空")
@Length(max=1000,message = "内部备注不能超过1000位")
private String internalRemark;
@Valid
private List<TickStaffFormDTO> staffList;
}

12
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java

@ -73,4 +73,16 @@ public interface ProjectConstant {
* 调用epmet-user服务查询数据失败
*/
String SELECT_USERINFO_EXCEPTION = "获取用户昵称、头像失败";
/**
* 查询项目人员关联表数据失败
*/
String SELECT_PROJECTSTAFF_EXCEPTION = "获取项目人员关联表数据失败";
/**
* 更新项目人员关联表数据失败
*/
String UPDATE_PROJECTSTAFF_EXCEPTION = "更新项目人员关联表数据失败";
/**
* 更新项目人员关联表数据失败
*/
String DATe_EXCEPTION = "未勾选流转人员";
}

14
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java

@ -183,5 +183,19 @@ public class ProjectTraceController {
ValidatorUtils.validateEntity(formDTO);
return new Result<DepartmentStaffListResultDTO>().ok(projectStaffService.departmentStaffList(formDTO));
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 项目跟踪-转其他部门
**/
@PostMapping("transfer")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_TRANSFER)
public Result transfer(@LoginUser TokenDto tokenDTO, @RequestBody TransferFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
projectProcessService.transfer(formDTO);
return new Result();
}
}

11
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java

@ -5,6 +5,8 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.AgencyDeptGridFormDTO;
import com.epmet.dto.result.AgencyDeptGridResultDTO;
import com.epmet.dto.result.DepartmentStaffListResultDTO;
import com.epmet.feign.fallback.GovOrgFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
@ -35,4 +37,13 @@ public interface GovOrgFeignClient {
@PostMapping(value = "/gov/org/customeragency/departmentstafflist/{agencyId}")
Result<DepartmentStaffListResultDTO> departmentStaffList(@PathVariable("agencyId") String agencyId);
/**
* @param formDTO
* @return
* @Author sun
* @Description 根据组织Id集合部门Id集合网格Id集合查询各自对应详细信息
**/
@PostMapping(value = "/gov/org/customeragency/getagencydeptgridlist")
Result<AgencyDeptGridResultDTO> getAgencyDeptGridList(AgencyDeptGridFormDTO formDTO);
}

7
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java

@ -7,6 +7,8 @@ import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.AgencyDeptGridFormDTO;
import com.epmet.dto.result.AgencyDeptGridResultDTO;
import com.epmet.dto.result.DepartmentStaffListResultDTO;
import com.epmet.feign.GovOrgFeignClient;
import org.springframework.stereotype.Component;
@ -26,4 +28,9 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
public Result<DepartmentStaffListResultDTO> departmentStaffList(String agencyId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "departmentStaffList", agencyId);
}
@Override
public Result<AgencyDeptGridResultDTO> getAgencyDeptGridList(AgencyDeptGridFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyDeptGridList", formDTO);
}
}

9
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectProcessService.java

@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.ProjectProcessDTO;
import com.epmet.dto.form.ProcessListFormDTO;
import com.epmet.dto.form.ReturnListFromDTO;
import com.epmet.dto.form.TransferFormDTO;
import com.epmet.dto.result.ProcesslistResultDTO;
import com.epmet.dto.result.ReturnListResultDTO;
import com.epmet.entity.ProjectProcessEntity;
@ -113,4 +114,12 @@ public interface ProjectProcessService extends BaseService<ProjectProcessEntity>
* @return java.util.List<com.epmet.dto.result.ReturnListResultDTO>
*/
List<ReturnListResultDTO> getReturnableList(ReturnListFromDTO fromDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 项目跟踪-转其他部门
**/
void transfer(TransferFormDTO formDTO);
}

93
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java

@ -21,32 +21,37 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.ProjectConstant;
import com.epmet.dao.ProjectProcessDao;
import com.epmet.dao.ProjectStaffDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.ProjectProcessDTO;
import com.epmet.dto.form.ProcessListFormDTO;
import com.epmet.dto.form.ReturnListFromDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.AgencyDeptGridResultDTO;
import com.epmet.dto.result.ProcesslistResultDTO;
import com.epmet.dto.result.ReturnListResultDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.entity.ProjectEntity;
import com.epmet.entity.ProjectProcessEntity;
import com.epmet.entity.ProjectStaffEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.redis.ProjectProcessRedis;
import com.epmet.service.ProjectProcessService;
import com.epmet.service.ProjectService;
import com.epmet.service.ProjectStaffService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
@ -68,6 +73,10 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl<ProjectProcessDao
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private ProjectService projectService;
@Autowired
private ProjectProcessDao projectProcessDao;
@Autowired
private ProjectStaffService projectStaffService;
@Override
public PageData<ProjectProcessDTO> page(Map<String, Object> params) {
@ -158,4 +167,82 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl<ProjectProcessDao
return resultList;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 项目跟踪-转其他部门
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void transfer(TransferFormDTO formDTO) {
//1:更新项目人员关联表数据状态为已处理
ProjectStaffEntity staffEntity = projectStaffDao.selectById(formDTO.getProjectStaffId());
if (null == staffEntity) {
throw new RenException(ProjectConstant.SELECT_PROJECTSTAFF_EXCEPTION);
}
staffEntity.setId(formDTO.getProjectStaffId());
staffEntity.setIsHandle(ProjectConstant.HANDLE);
if (projectStaffDao.updateById(staffEntity) < NumConstant.ONE) {
throw new RenException(ProjectConstant.UPDATE_PROJECTSTAFF_EXCEPTION);
}
//2:项目处理进展列表新增数据
ProjectProcessEntity processEntity = ConvertUtils.sourceToTarget(formDTO, ProjectProcessEntity.class);
processEntity.setDepartmentName(staffEntity.getDepartmentName());
processEntity.setStaffId(staffEntity.getStaffId());
processEntity.setOperation(ProjectConstant.OPERATION_TRANSFER);
processEntity.setOperationName(ProjectConstant.OPERATION_TRANSFER_NAME);
projectProcessDao.insert(processEntity);
//3:项目人员关联表新增部门流转数据
List<TickStaffFormDTO> staffList = formDTO.getStaffList();
if (null == staffList || staffList.size() < NumConstant.ONE) {
throw new RenException(ProjectConstant.DATe_EXCEPTION);
}
//3.1:调用gov-org服务,获取所有勾选人员对应的组织信息、部门信息、网格信息用于对处理部门和ORG_ID_PATH字段的赋值
List<String> agencyIdList = staffList.stream().map(TickStaffFormDTO::getAgencyId).collect(Collectors.toList());
agencyIdList = new ArrayList<String>(new LinkedHashSet<>(agencyIdList));
List<String> deptIdList = staffList.stream().map(TickStaffFormDTO::getDepartmentId).collect(Collectors.toList());
deptIdList = new ArrayList<String>(new LinkedHashSet<>(deptIdList));
List<String> gridIdList = staffList.stream().map(TickStaffFormDTO::getGridId).collect(Collectors.toList());
gridIdList = new ArrayList<String>(new LinkedHashSet<>(gridIdList));
AgencyDeptGridFormDTO agencyDeptGridFormDTO = new AgencyDeptGridFormDTO();
agencyDeptGridFormDTO.setAgencyIdList(agencyIdList);
agencyDeptGridFormDTO.setDeptIdList(deptIdList);
agencyDeptGridFormDTO.setGridIdList(gridIdList);
Result<AgencyDeptGridResultDTO> resultDTO = govOrgFeignClient.getAgencyDeptGridList(agencyDeptGridFormDTO);
AgencyDeptGridResultDTO agencyDeptGrid = resultDTO.getData();
//3.2:批量新增项目人员关联表数据
List<ProjectStaffEntity> entityList = new ArrayList<>();
staffList.forEach(ts->{
ProjectStaffEntity entity = ConvertUtils.sourceToTarget(ts, ProjectStaffEntity.class);
entity.setOrgId(ts.getAgencyId());
entity.setProjectId(formDTO.getProjectId());
entity.setProcessId(processEntity.getId());
entity.setIsHandle(ProjectConstant.UNHANDLED);
agencyDeptGrid.getAgencyList().forEach(agency->{
if (ts.getAgencyId().equals(agency.getId())) {
entity.setCustomerId(agency.getCustomerId());
entity.setOrgIdPath(agency.getPids()+":"+agency.getId());
entity.setDepartmentName(agency.getOrganizationName());
}
});
if (StringUtils.isNotBlank(ts.getDepartmentId())) {
agencyDeptGrid.getDeptList().forEach(dept -> {
if (ts.getDepartmentId().equals(dept.getId())) {
entity.setDepartmentName(entity.getDepartmentName() + "-" + dept.getDepartmentName());
}
});
}
if (StringUtils.isNotBlank(ts.getGridId())) {
agencyDeptGrid.getGridList().forEach(grid -> {
if (ts.getGridId().equals(grid.getId())) {
entity.setDepartmentName(entity.getDepartmentName() + "-" + grid.getGridName());
}
});
}
entityList.add(entity);
});
projectStaffService.insertBatch(entityList);
}
}
Loading…
Cancel
Save