|
|
@ -34,16 +34,14 @@ import com.epmet.dao.CustomerAgencyDao; |
|
|
|
import com.epmet.dao.CustomerDepartmentDao; |
|
|
|
import com.epmet.dao.CustomerStaffDepartmentDao; |
|
|
|
import com.epmet.dao.StaffOrgRelationDao; |
|
|
|
import com.epmet.dto.CustomerDepartmentDTO; |
|
|
|
import com.epmet.dto.CustomerIdDTO; |
|
|
|
import com.epmet.dto.CustomerStaffDTO; |
|
|
|
import com.epmet.dto.CustomerStaffDepartmentDTO; |
|
|
|
import com.epmet.dto.*; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.*; |
|
|
|
import com.epmet.feign.EpmetHeartOpenFeignClient; |
|
|
|
import com.epmet.feign.EpmetUserFeignClient; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovProjectOpenFeignClient; |
|
|
|
import com.epmet.service.*; |
|
|
|
import com.epmet.util.ModuleConstant; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -56,6 +54,7 @@ import org.springframework.util.CollectionUtils; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -93,6 +92,8 @@ public class DepartmentServiceImpl implements DepartmentService { |
|
|
|
private StaffOrgRelationService staffOrgRelationService; |
|
|
|
@Autowired |
|
|
|
private EpmetHeartOpenFeignClient epmetHeartOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private GovProjectOpenFeignClient govProjectOpenFeignClient; |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
@ -364,7 +365,8 @@ public class DepartmentServiceImpl implements DepartmentService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public CheckStaffInfoResultDTO addOrEditDeptOrStaff(CheckStaffInfoFormDTO formDTO) { |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public CheckStaffInfoResultDTO syncDept(CheckStaffInfoFormDTO formDTO) { |
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
if (null == staffInfo) { |
|
|
|
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); |
|
|
@ -438,9 +440,11 @@ public class DepartmentServiceImpl implements DepartmentService { |
|
|
|
if(("agency".equals(resultDTO.getOrgType()))){ |
|
|
|
//一、更新人员基础数据[姓名 手机号信息]
|
|
|
|
CustomerStaffDTO staffDTO = new CustomerStaffDTO(); |
|
|
|
staffDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
staffDTO.setUserId(resultDTO.getStaffId()); |
|
|
|
staffDTO.setRealName(formDTO.getPersonName()); |
|
|
|
staffDTO.setMobile(formDTO.getMobile()); |
|
|
|
staffDTO.setUpdatedTime(new Date()); |
|
|
|
staffDTO.setUpdatedBy(resultDTO.getUserId()); |
|
|
|
Result result = epmetUserOpenFeignClient.editToStaff(staffDTO); |
|
|
|
if (!result.success()) { |
|
|
@ -474,5 +478,59 @@ public class DepartmentServiceImpl implements DepartmentService { |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public CheckStaffInfoResultDTO notSyncDept(CheckStaffInfoFormDTO formDTO) { |
|
|
|
CheckStaffInfoResultDTO resultDTO = new CheckStaffInfoResultDTO(); |
|
|
|
//1.校验当前部门下工作人员是否有代办项目
|
|
|
|
ProjectListFromDTO project = new ProjectListFromDTO(); |
|
|
|
project.setUserId(formDTO.getDeptStaffId()); |
|
|
|
Result<List<ProjectDTO>> projectResult = govProjectOpenFeignClient.staffPendingProject(project); |
|
|
|
if (!projectResult.success()) { |
|
|
|
throw new RenException("获取工作人员代办项目数据失败" + projectResult.getMsg()); |
|
|
|
} |
|
|
|
if(projectResult.getData().size()>NumConstant.ZERO){ |
|
|
|
String msg = String.format("当前%s下负责人存在未办结的项目,请先将待处理项目办结后再操作",("party_unit".equals(formDTO.getDeptType())?"联建单位":"社会自组织")); |
|
|
|
resultDTO.setMsg(msg); |
|
|
|
} |
|
|
|
//2.无代办项目的则删除部门、工作人员信息、修改联建单位/社会自组织业务数据
|
|
|
|
//2-1.删除部门
|
|
|
|
customerDepartmentDao.deleteById(formDTO.getId()); |
|
|
|
//2-2.删除部门人员关系数据
|
|
|
|
LambdaQueryWrapper<CustomerStaffDepartmentEntity> query = new LambdaQueryWrapper<>(); |
|
|
|
query.eq(CustomerStaffDepartmentEntity::getDepartmentId, formDTO.getDeptId()); |
|
|
|
query.eq(CustomerStaffDepartmentEntity::getUserId, formDTO.getDeptStaffId()); |
|
|
|
customerStaffDepartmentDao.delete(query); |
|
|
|
//2-3.删除人员注册关系数据
|
|
|
|
LambdaQueryWrapper<StaffOrgRelationEntity> StaffOrgRelation = new LambdaQueryWrapper<>(); |
|
|
|
StaffOrgRelation.eq(StaffOrgRelationEntity::getOrgId, formDTO.getDeptId()); |
|
|
|
StaffOrgRelation.eq(StaffOrgRelationEntity::getStaffId, formDTO.getDeptStaffId()); |
|
|
|
staffOrgRelationDao.delete(StaffOrgRelation); |
|
|
|
//2-4.删除工作人员数据
|
|
|
|
CustomerStaffDTO staffDTO = new CustomerStaffDTO(); |
|
|
|
staffDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
staffDTO.setUserId(formDTO.getDeptStaffId()); |
|
|
|
staffDTO.setDelFlag(1); |
|
|
|
staffDTO.setUpdatedTime(new Date()); |
|
|
|
staffDTO.setUpdatedBy(formDTO.getUserId()); |
|
|
|
Result result = epmetUserOpenFeignClient.editToStaff(staffDTO); |
|
|
|
if (!result.success()) { |
|
|
|
throw new RenException("更新工作人员基础信息失败" + result.getMsg()); |
|
|
|
} |
|
|
|
//2-5.修改联建单位/社会自组织业务数据
|
|
|
|
resultDTO.setId(formDTO.getId()); |
|
|
|
resultDTO.setDeptId(formDTO.getDeptId()); |
|
|
|
resultDTO.setDeptType(formDTO.getDeptType()); |
|
|
|
resultDTO.setDeptStaffId(formDTO.getDeptStaffId()); |
|
|
|
resultDTO.setSyncType("not_sync"); |
|
|
|
Result heartResult = epmetHeartOpenFeignClient.editPartyOrCommunity(resultDTO); |
|
|
|
if (!heartResult.success()) { |
|
|
|
throw new RenException("修改联建单位/社会自组织业务数据失败" + heartResult.getMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
resultDTO.setType(true); |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |