Browse Source

灵山项目:修改工作人员查询,可以通过人名、电话、工作方式检索;

master
luyan 3 years ago
parent
commit
172caad068
  1. 21
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffsByOrgAndRolesFormDTO.java
  2. 38
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffsByOrgAndRoleRstDTO.java
  3. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  4. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java
  5. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/UserService.java
  6. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  7. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  8. 26
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/UserServiceImpl.java
  9. 39
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml
  10. 88
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java

21
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/StaffsByOrgAndRolesFormDTO.java

@ -16,6 +16,27 @@ public class StaffsByOrgAndRolesFormDTO {
*/ */
@NotBlank(message = "组织类型为必填项") @NotBlank(message = "组织类型为必填项")
private String orgType; private String orgType;
/**
* 工作人员姓名
*/
private String name;
/**
* 工作人员电话
*/
private String mobile;
/**
* 工作人员角色 网格员grid_member网格长grid_manager
*/
private String roleType;
/**
* 工作类型专职fulltime 兼职parttime
*/
private String workType;
private int pageNo = 1; private int pageNo = 1;
private int pageSize = 10; private int pageSize = 10;

38
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/StaffsByOrgAndRoleRstDTO.java

@ -14,10 +14,48 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
public class StaffsByOrgAndRoleRstDTO { public class StaffsByOrgAndRoleRstDTO {
/**
* 工作人员姓名
*/
private String staffName; private String staffName;
/**
* 工作人员ID
*/
private String staffId; private String staffId;
/**
* 电话
*/
private String mobile; private String mobile;
/**
* 性别 0.未知1男2.
*/
private String gender;
/**
* 文化程度灵山-红色待办0小学及文盲,1初中,2高中,3大专,4本科,5硕士,6博士,7中专
*/
private String culture;
/**
* 生日
*/
private String birthday;
/**
* 地址
*/
private String address;
/**
* 网格员类型专职fulltime 兼职parttime
*/
private String workType;
/**
* 头像
*/
private String headPhoto;
/**
* 身份证号码
*/
private String idCard;
} }

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -314,7 +314,7 @@ public class EpmetUserController {
ValidatorUtils.validateEntity(form); ValidatorUtils.validateEntity(form);
PageData<StaffsByOrgAndRoleRstDTO> pd = userService.listStaffByOrgAndRole(form.getOrgId(), form.getOrgType(), form.getPageNo(), form.getPageSize(), form.getRoleKeys()); PageData<StaffsByOrgAndRoleRstDTO> pd = userService.listStaffByOrgAndRole(form);
return new Result<PageData<StaffsByOrgAndRoleRstDTO>>().ok(pd); return new Result<PageData<StaffsByOrgAndRoleRstDTO>>().ok(pd);
} }

6
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java

@ -114,5 +114,9 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
Integer countStaffQtyByStaffIdsAndRole(@Param("staffIds") Set<String> staffIds, @Param("roleId") String roleId); Integer countStaffQtyByStaffIdsAndRole(@Param("staffIds") Set<String> staffIds, @Param("roleId") String roleId);
// 给定的staffId种,具备某些角色的staffId列表 // 给定的staffId种,具备某些角色的staffId列表
List<StaffsByOrgAndRoleRstDTO> staffsInRolesFromGivenStaffIds(@Param("staffIds") List<String> staffIds, @Param("roleKeys") List<String> roleKeys); List<StaffsByOrgAndRoleRstDTO> staffsInRolesFromGivenStaffIds(@Param("staffIds") List<String> staffIds,
@Param("roleKeys") List<String> roleKeys,
@Param("name") String name,
@Param("mobile") String mobile,
@Param("workType") String workType);
} }

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/UserService.java

@ -1,10 +1,9 @@
package com.epmet.dataaggre.service; package com.epmet.dataaggre.service;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.dataaggre.dto.epmetuser.form.StaffsByOrgAndRolesFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.StaffsByOrgAndRoleRstDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffsByOrgAndRoleRstDTO;
import java.util.List;
public interface UserService { public interface UserService {
PageData<StaffsByOrgAndRoleRstDTO> listStaffByOrgAndRole(String orgId, String orgType, Integer pageNo, Integer pageSize, List<String> roleKeys); PageData<StaffsByOrgAndRoleRstDTO> listStaffByOrgAndRole(StaffsByOrgAndRolesFormDTO form);
} }

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java

@ -276,5 +276,5 @@ public interface EpmetUserService {
*/ */
PageData<IcResiUserResultDTO> listIcResiUserByHouseId(Integer pageNo,Integer pageSize,List<String> houseIds); PageData<IcResiUserResultDTO> listIcResiUserByHouseId(Integer pageNo,Integer pageSize,List<String> houseIds);
PageData<StaffsByOrgAndRoleRstDTO> staffsInRolesFromGivenStaffIds(List<String> staffIdsUnderAgency, List<String> roleKeys, Integer pageNo, Integer pageSize); PageData<StaffsByOrgAndRoleRstDTO> staffsInRolesFromGivenStaffIds(List<String> staffIdsUnderAgency, StaffsByOrgAndRolesFormDTO form);
} }

6
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -1227,10 +1227,10 @@ public class EpmetUserServiceImpl implements EpmetUserService, ResultDataResolve
} }
@Override @Override
public PageData<StaffsByOrgAndRoleRstDTO> staffsInRolesFromGivenStaffIds(List<String> staffIdsUnderAgency, List<String> roleKeys, Integer pageNo, Integer pageSize) { public PageData<StaffsByOrgAndRoleRstDTO> staffsInRolesFromGivenStaffIds(List<String> staffIdsUnderAgency, StaffsByOrgAndRolesFormDTO form) {
PageHelper.startPage(pageNo, pageSize); PageHelper.startPage(form.getPageNo(), form.getPageSize());
List<StaffsByOrgAndRoleRstDTO> sl = customerStaffDao.staffsInRolesFromGivenStaffIds(staffIdsUnderAgency, roleKeys); List<StaffsByOrgAndRoleRstDTO> sl = customerStaffDao.staffsInRolesFromGivenStaffIds(staffIdsUnderAgency, form.getRoleKeys(),form.getName(),form.getMobile(),form.getWorkType());
return new PageData<>(sl, new PageInfo<>(sl).getTotal()); return new PageData<>(sl, new PageInfo<>(sl).getTotal());
} }

26
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/UserServiceImpl.java

@ -5,6 +5,7 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.utils.PidUtils; import com.epmet.commons.tools.utils.PidUtils;
import com.epmet.constant.OrgInfoConstant; import com.epmet.constant.OrgInfoConstant;
import com.epmet.dataaggre.dto.epmetuser.form.StaffsByOrgAndRolesFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.StaffsByOrgAndRoleRstDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffsByOrgAndRoleRstDTO;
import com.epmet.dataaggre.service.UserService; import com.epmet.dataaggre.service.UserService;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
@ -15,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Service @Service
@ -30,20 +32,20 @@ public class UserServiceImpl implements UserService {
private EpmetUserRemoteService epmetUserRemoteService; private EpmetUserRemoteService epmetUserRemoteService;
@Override @Override
public PageData<StaffsByOrgAndRoleRstDTO> listStaffByOrgAndRole(String orgId, String orgType, Integer pageNo, Integer pageSize, List<String> roleKeys) { public PageData<StaffsByOrgAndRoleRstDTO> listStaffByOrgAndRole(StaffsByOrgAndRolesFormDTO form) {
String orgIdPath; String orgIdPath;
if (StringUtils.isAnyBlank(orgType, orgType)) { if (StringUtils.isAnyBlank(form.getOrgId(), form.getOrgType())) {
// 这俩有一个不传,就用当前用户所属的 // 这俩有一个不传,就用当前用户所属的
LoginUserDetailsResultDTO loginUserDetails = epmetUserRemoteService.getLoginUserDetails(); LoginUserDetailsResultDTO loginUserDetails = epmetUserRemoteService.getLoginUserDetails();
orgIdPath = loginUserDetails.getOrgIdPath(); orgIdPath = loginUserDetails.getOrgIdPath();
orgId = loginUserDetails.getAgencyId(); form.setOrgId(loginUserDetails.getAgencyId());
orgType = OrgInfoConstant.AGENCY; form.setOrgType(OrgInfoConstant.AGENCY);
} else { } else {
// 取用户传递的 // 取用户传递的
if (OrgInfoConstant.AGENCY.equals(orgType)) { if (OrgInfoConstant.AGENCY.equals(form.getOrgType())) {
// 行政组织 // 行政组织
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(form.getOrgId());
orgIdPath = PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids()); orgIdPath = PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids());
} else { } else {
return null; return null;
@ -51,9 +53,17 @@ public class UserServiceImpl implements UserService {
} }
// 先通过org库查询出工作人员的id列表 // 先通过org库查询出工作人员的id列表
List<String> staffIdsUnderAgency = govOrgService.listStaffIdsUnderAgency(orgIdPath, orgId); List<String> staffIdsUnderAgency = govOrgService.listStaffIdsUnderAgency(orgIdPath, form.getOrgId());
//多处调用,判断是否传参
if (null == form.getRoleKeys() && form.getRoleKeys().size() == 0) {
//如果roleKeys是空,则无传参,判断roleType,如果不为空,添加查询参数
if (StringUtils.isNotEmpty(form.getRoleType())) {
List<String> roleKeys = new ArrayList<>();
roleKeys.add(form.getRoleType());
}
}
// 再通过这些id列表,去过滤角色,并且查出详细信息 // 再通过这些id列表,去过滤角色,并且查出详细信息
return epmetUserService.staffsInRolesFromGivenStaffIds(staffIdsUnderAgency, roleKeys, pageNo, pageSize); return epmetUserService.staffsInRolesFromGivenStaffIds(staffIdsUnderAgency, form);
} }
} }

39
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml

@ -217,25 +217,48 @@
<!--给定的staffId种,具备某些角色的staffId列表--> <!--给定的staffId种,具备某些角色的staffId列表-->
<select id="staffsInRolesFromGivenStaffIds" <select id="staffsInRolesFromGivenStaffIds"
resultType="com.epmet.dataaggre.dto.epmetuser.result.StaffsByOrgAndRoleRstDTO"> resultType="com.epmet.dataaggre.dto.epmetuser.result.StaffsByOrgAndRoleRstDTO">
select sr.STAFF_ID, cs.REAL_NAME as staffName, cs.MOBILE SELECT
from ( select distinct srr.STAFF_ID sr.STAFF_ID,
from staff_role srr cs.REAL_NAME AS staffName,
inner join gov_staff_role gsr on (srr.ROLE_ID = gsr.ID) cs.MOBILE,
where cs.GENDER,
cs.CULTURE,
cs.BIRTHDAY,
cs.ADDRESS,
cs.WORK_TYPE AS workType,
cs.HEAD_PHOTO AS headPhoto
cs.ID_CARD AS idCard
FROM (
SELECT DISTINCT srr.STAFF_ID
FROM staff_role srr
INNER JOIN gov_staff_role gsr ON (srr.ROLE_ID = gsr.ID)
<where>
srr.DEL_FLAG = 0 srr.DEL_FLAG = 0
<if test="staffIds != null and staffIds.size() > 0"> <if test="staffIds != null and staffIds.size() > 0">
and srr.STAFF_ID in AND srr.STAFF_ID IN
<foreach collection="staffIds" item="staffId" separator="," open="(" close=")"> <foreach collection="staffIds" item="staffId" separator="," open="(" close=")">
#{staffId} #{staffId}
</foreach> </foreach>
</if> </if>
<if test="roleKeys != null and roleKeys.size() > 0"> <if test="roleKeys != null and roleKeys.size() > 0">
and gsr.ROLE_KEY in AND gsr.ROLE_KEY IN
<foreach collection="roleKeys" item="roleKey" separator="," open="(" close=")"> <foreach collection="roleKeys" item="roleKey" separator="," open="(" close=")">
#{roleKey} #{roleKey}
</foreach> </foreach>
</if> </if>
</where>
) sr ) sr
inner join customer_staff cs on (cs.USER_ID = sr.STAFF_ID and cs.DEL_FLAG = 0) INNER JOIN customer_staff cs ON (
cs.USER_ID = sr.STAFF_ID AND cs.DEL_FLAG = 0
<if test="null != name and name != ''">
AND cs.REAL_NAME LIKE CONCAT('%',#{name},'%')
</if>
<if test="null != mobile and mobile != ''">
AND cs.MOBILE LIKE CONCAT('%',#{mobile},'%')
</if>
<if test="null != workType and workType != ''">
AND cs.WORK_TYPE = #{workType}
</if>
)
</select> </select>
</mapper> </mapper>

88
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java

@ -1,7 +1,6 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
@ -13,7 +12,9 @@ import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.*; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.FileUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.OrgInfoConstant; import com.epmet.constant.OrgInfoConstant;
import com.epmet.constants.ImportTaskConstants; import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.CustomerStaffAgencyDao; import com.epmet.dao.CustomerStaffAgencyDao;
@ -151,13 +152,14 @@ public class StaffServiceImpl implements StaffService {
/** /**
* 人员添加页面初始化 * 人员添加页面初始化
* 备注2022.10.18运营端-统一认证也会调用此接口入参会给customerId * 备注2022.10.18运营端-统一认证也会调用此接口入参会给customerId
*
* @param fromDTO 参数 * @param fromDTO 参数
* @return * @return
*/ */
@Override @Override
public Result<List<RoleInfoResultDTO>> addStaffInit(StaffInfoFromDTO fromDTO) { public Result<List<RoleInfoResultDTO>> addStaffInit(StaffInfoFromDTO fromDTO) {
if(StringUtils.isBlank(fromDTO.getCustomerId())){ if (StringUtils.isBlank(fromDTO.getCustomerId())) {
if(StringUtils.isNotBlank(fromDTO.getAgencyId())){ if (StringUtils.isNotBlank(fromDTO.getAgencyId())) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); fromDTO.setCustomerId(customerAgencyEntity.getCustomerId());
} }
@ -168,19 +170,19 @@ public class StaffServiceImpl implements StaffService {
@Override @Override
public Result<StaffInitResultDTO> editStaffInit(StaffInfoFromDTO fromDTO) { public Result<StaffInitResultDTO> editStaffInit(StaffInfoFromDTO fromDTO) {
//运营端-统一认证调用此接口时,客户id传值了。 //运营端-统一认证调用此接口时,客户id传值了。
if(StringUtils.isBlank(fromDTO.getCustomerId())){ if (StringUtils.isBlank(fromDTO.getCustomerId())) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); fromDTO.setCustomerId(customerAgencyEntity.getCustomerId());
} }
CustomerStaffAgencyDTO customerStaffAgencyDTO=customerStaffAgencyService.getInfoByUserId(fromDTO.getStaffId()); CustomerStaffAgencyDTO customerStaffAgencyDTO = customerStaffAgencyService.getInfoByUserId(fromDTO.getStaffId());
if (null == customerStaffAgencyDTO) { if (null == customerStaffAgencyDTO) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "customer_staff_agency is null user_id :" + fromDTO.getStaffId(), "查询用户所属组织为空"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "customer_staff_agency is null user_id :" + fromDTO.getStaffId(), "查询用户所属组织为空");
} }
//运营端-统一认证那调用的时候, agencyId为空,这里重新赋值下 //运营端-统一认证那调用的时候, agencyId为空,这里重新赋值下
if(StringUtils.isBlank(fromDTO.getAgencyId())){ if (StringUtils.isBlank(fromDTO.getAgencyId())) {
fromDTO.setAgencyId(customerStaffAgencyDTO.getAgencyId()); fromDTO.setAgencyId(customerStaffAgencyDTO.getAgencyId());
} }
Result<StaffInitResultDTO> res=epmetUserFeignClient.editStaffInit(fromDTO); Result<StaffInitResultDTO> res = epmetUserFeignClient.editStaffInit(fromDTO);
if (res.success() && null != res.getData()) { if (res.success() && null != res.getData()) {
res.getData().setAgencyId(customerStaffAgencyDTO.getAgencyId()); res.getData().setAgencyId(customerStaffAgencyDTO.getAgencyId());
res.getData().setAgencyName(customerAgencyService.getAgencyName(customerStaffAgencyDTO.getAgencyId())); res.getData().setAgencyName(customerAgencyService.getAgencyName(customerStaffAgencyDTO.getAgencyId()));
@ -227,14 +229,13 @@ public class StaffServiceImpl implements StaffService {
} }
/** /**
*
* @param tokenDto TokenDto tokenDto, * @param tokenDto TokenDto tokenDto,
* @param fromDTO * @param fromDTO
* @return * @return
*/ */
@Override @Override
public Result editStaff(StaffSubmitFromDTO fromDTO) { public Result editStaff(StaffSubmitFromDTO fromDTO) {
if(StringUtils.isBlank(fromDTO.getCustomerId())){ if (StringUtils.isBlank(fromDTO.getCustomerId())) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); fromDTO.setCustomerId(customerAgencyEntity.getCustomerId());
} }
@ -243,12 +244,12 @@ public class StaffServiceImpl implements StaffService {
// fromDTO.setClient(tokenDto.getClient()); // fromDTO.setClient(tokenDto.getClient());
Result result = epmetUserFeignClient.editStaff(fromDTO); Result result = epmetUserFeignClient.editStaff(fromDTO);
if (!result.success()) { if (!result.success()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),result.getInternalMsg(),result.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), result.getInternalMsg(), result.getMsg());
} }
// if (tokenDto.getClient().equals("web")){ // if (tokenDto.getClient().equals("web")){
if(CollectionUtils.isNotEmpty(fromDTO.getNewRoles())){ if (CollectionUtils.isNotEmpty(fromDTO.getNewRoles())) {
Result roleUserAccess = govAccessFeignClient.roleUser(new RoleUserFormDTO(fromDTO.getNewRoles(), fromDTO.getStaffId(),fromDTO.getCustomerId())); Result roleUserAccess = govAccessFeignClient.roleUser(new RoleUserFormDTO(fromDTO.getNewRoles(), fromDTO.getStaffId(), fromDTO.getCustomerId()));
if (!roleUserAccess.success()){ if (!roleUserAccess.success()) {
throw new EpmetException("save data to gov-role-user failure"); throw new EpmetException("save data to gov-role-user failure");
} }
} }
@ -310,8 +311,8 @@ public class StaffServiceImpl implements StaffService {
result.setAgencyName(agencyName); result.setAgencyName(agencyName);
//新增返参: 用户所属机关id //新增返参: 用户所属机关id
result.setAgencyId(customerStaffAgency.getAgencyId()); result.setAgencyId(customerStaffAgency.getAgencyId());
CustomerAgencyDTO customerAgencyDTO=customerAgencyService.get(customerStaffAgency.getAgencyId()); CustomerAgencyDTO customerAgencyDTO = customerAgencyService.get(customerStaffAgency.getAgencyId());
if(null!=customerAgencyDTO){ if (null != customerAgencyDTO) {
//用户所属机关名称 //用户所属机关名称
result.setMyAgencyName(customerAgencyDTO.getOrganizationName()); result.setMyAgencyName(customerAgencyDTO.getOrganizationName());
} }
@ -332,8 +333,8 @@ public class StaffServiceImpl implements StaffService {
List<String> staffIdList = new ArrayList<>(); List<String> staffIdList = new ArrayList<>();
staffIdList.add(result.getStaffId()); staffIdList.add(result.getStaffId());
List<StaffOrgNameResultDTO> list = staffOrgRelationDao.selelctStaffOrg(staffIdList); List<StaffOrgNameResultDTO> list = staffOrgRelationDao.selelctStaffOrg(staffIdList);
list.forEach(l->{ list.forEach(l -> {
if(l.getStaffId().equals(result.getStaffId())){ if (l.getStaffId().equals(result.getStaffId())) {
result.setOrgId(l.getOrgId()); result.setOrgId(l.getOrgId());
result.setOrgName(l.getOrgName()); result.setOrgName(l.getOrgName());
result.setOrgType(l.getOrgType()); result.setOrgType(l.getOrgType());
@ -555,6 +556,7 @@ public class StaffServiceImpl implements StaffService {
/** /**
* 根据staffId查询用户基本信息 * 根据staffId查询用户基本信息
*
* @author sun * @author sun
*/ */
@Override @Override
@ -572,13 +574,13 @@ public class StaffServiceImpl implements StaffService {
public String staffName(String userId) { public String staffName(String userId) {
// 查询所属组织名字 // 查询所属组织名字
String agencyName = customerStaffAgencyDao.selectStaffBelongAgency(userId); String agencyName = customerStaffAgencyDao.selectStaffBelongAgency(userId);
if (StringUtils.isEmpty(agencyName)){ if (StringUtils.isEmpty(agencyName)) {
throw new RenException("查询工作人员所属组织名称为空"); throw new RenException("查询工作人员所属组织名称为空");
} }
StaffBasicInfoFromDTO formDTO = new StaffBasicInfoFromDTO(); StaffBasicInfoFromDTO formDTO = new StaffBasicInfoFromDTO();
formDTO.setStaffId(userId); formDTO.setStaffId(userId);
Result<BasicInfoResultDTO> staffBasicInfo = epmetUserOpenFeignClient.getStaffBasicInfo(formDTO); Result<BasicInfoResultDTO> staffBasicInfo = epmetUserOpenFeignClient.getStaffBasicInfo(formDTO);
if (!staffBasicInfo.success()){ if (!staffBasicInfo.success()) {
throw new RenException("查询工作人员姓名失败"); throw new RenException("查询工作人员姓名失败");
} }
String result = agencyName.concat(staffBasicInfo.getData().getRealName()); String result = agencyName.concat(staffBasicInfo.getData().getRealName());
@ -587,6 +589,7 @@ public class StaffServiceImpl implements StaffService {
/** /**
* 通讯录人员添加v2 * 通讯录人员添加v2
*
* @author sun * @author sun
*/ */
@Override @Override
@ -596,7 +599,7 @@ public class StaffServiceImpl implements StaffService {
OrgResultDTO orgDTO = customerAgencyDao.selectAgencyDetail(fromDTO.getOrgId(), fromDTO.getOrgType()); OrgResultDTO orgDTO = customerAgencyDao.selectAgencyDetail(fromDTO.getOrgId(), fromDTO.getOrgType());
if (null == orgDTO) { if (null == orgDTO) {
logger.warn(String.format("工作人员新增,根据新增人员组织类型未查询到相关组织信息,orgId->%s,orgType->%s", fromDTO.getOrgId(), fromDTO.getOrgType())); logger.warn(String.format("工作人员新增,根据新增人员组织类型未查询到相关组织信息,orgId->%s,orgType->%s", fromDTO.getOrgId(), fromDTO.getOrgType()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"根据新增人员组织类型未查询到相关组织信息","组织不存在"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "根据新增人员组织类型未查询到相关组织信息", "组织不存在");
} }
//2.调用user服务,新增用户信息 //2.调用user服务,新增用户信息
@ -604,7 +607,7 @@ public class StaffServiceImpl implements StaffService {
submitDTO.setAgencyId(orgDTO.getAgencyId()); submitDTO.setAgencyId(orgDTO.getAgencyId());
Result<CustomerStaffDTO> result = epmetUserFeignClient.addStaff(submitDTO); Result<CustomerStaffDTO> result = epmetUserFeignClient.addStaff(submitDTO);
if (!result.success()) { if (!result.success()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),result.getInternalMsg(),result.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), result.getInternalMsg(), result.getMsg());
} }
//3.人员机关表总人数加一、关系表新增关系数据 //3.人员机关表总人数加一、关系表新增关系数据
@ -647,9 +650,9 @@ public class StaffServiceImpl implements StaffService {
//5.工作人员注册组织关系表新增数据 //5.工作人员注册组织关系表新增数据
StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity(); StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity();
staffOrgRelationEntity.setCustomerId(fromDTO.getCustomerId()); staffOrgRelationEntity.setCustomerId(fromDTO.getCustomerId());
if("agency".equals(fromDTO.getOrgType())){ if ("agency".equals(fromDTO.getOrgType())) {
staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids())); staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids()));
}else { } else {
staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids() + ":") + orgDTO.getAgencyId()); staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids() + ":") + orgDTO.getAgencyId());
} }
staffOrgRelationEntity.setStaffId(result.getData().getUserId()); staffOrgRelationEntity.setStaffId(result.getData().getUserId());
@ -657,9 +660,9 @@ public class StaffServiceImpl implements StaffService {
staffOrgRelationEntity.setOrgType(fromDTO.getOrgType()); staffOrgRelationEntity.setOrgType(fromDTO.getOrgType());
staffOrgRelationService.insert(staffOrgRelationEntity); staffOrgRelationService.insert(staffOrgRelationEntity);
if (CollectionUtils.isNotEmpty(fromDTO.getNewRoles())){ if (CollectionUtils.isNotEmpty(fromDTO.getNewRoles())) {
Result roleUserAccess = govAccessFeignClient.roleUser(new RoleUserFormDTO(fromDTO.getNewRoles(), customerStaffAgencyEntity.getUserId(),fromDTO.getCustomerId())); Result roleUserAccess = govAccessFeignClient.roleUser(new RoleUserFormDTO(fromDTO.getNewRoles(), customerStaffAgencyEntity.getUserId(), fromDTO.getCustomerId()));
if (!roleUserAccess.success()){ if (!roleUserAccess.success()) {
throw new EpmetException("save data to gov-role-user failure"); throw new EpmetException("save data to gov-role-user failure");
} }
} }
@ -670,13 +673,13 @@ public class StaffServiceImpl implements StaffService {
if ("1535072605621841922".equals(fromDTO.getCustomerId()) if ("1535072605621841922".equals(fromDTO.getCustomerId())
|| "45687aa479955f9d06204d415238f7cc".equals(fromDTO.getCustomerId()) || "45687aa479955f9d06204d415238f7cc".equals(fromDTO.getCustomerId())
|| "0c41b272ee9ee95ac6f184ad548a30eb".equals(fromDTO.getCustomerId())) { || "0c41b272ee9ee95ac6f184ad548a30eb".equals(fromDTO.getCustomerId())) {
YtSyncStaffIdFormDTO ytSyncStaffIdFormDTO = ConvertUtils.sourceToTarget(fromDTO,YtSyncStaffIdFormDTO.class); YtSyncStaffIdFormDTO ytSyncStaffIdFormDTO = ConvertUtils.sourceToTarget(fromDTO, YtSyncStaffIdFormDTO.class);
ytSyncStaffIdFormDTO.setStaffId(result.getData().getUserId()); ytSyncStaffIdFormDTO.setStaffId(result.getData().getUserId());
ytSyncStaffIdFormDTO.setOperUserId(fromDTO.getCurrentUserId()); ytSyncStaffIdFormDTO.setOperUserId(fromDTO.getCurrentUserId());
epmetThirdOpenFeignClient.dataSyncUpdateStaff(ytSyncStaffIdFormDTO); epmetThirdOpenFeignClient.dataSyncUpdateStaff(ytSyncStaffIdFormDTO);
} }
//2022.10.18加个返参,借用下StaffDetailResultDTO不再新建dto了 //2022.10.18加个返参,借用下StaffDetailResultDTO不再新建dto了
StaffDetailResultDTO resultDTO=new StaffDetailResultDTO(); StaffDetailResultDTO resultDTO = new StaffDetailResultDTO();
resultDTO.setStaffId(result.getData().getUserId()); resultDTO.setStaffId(result.getData().getUserId());
return new Result<StaffDetailResultDTO>().ok(resultDTO); return new Result<StaffDetailResultDTO>().ok(resultDTO);
} }
@ -743,7 +746,7 @@ public class StaffServiceImpl implements StaffService {
agency.setOrgType(OrgInfoConstant.AGENCY); agency.setOrgType(OrgInfoConstant.AGENCY);
list.add(agency); list.add(agency);
//工作人员所在部门 //工作人员所在部门
if(CollectionUtils.isNotEmpty(staffInfoCache.getDeptList())) { if (CollectionUtils.isNotEmpty(staffInfoCache.getDeptList())) {
List<StaffOrgListResultDTO> deptList = staffInfoCache.getDeptList().stream().map(item -> { List<StaffOrgListResultDTO> deptList = staffInfoCache.getDeptList().stream().map(item -> {
StaffOrgListResultDTO dto = new StaffOrgListResultDTO(); StaffOrgListResultDTO dto = new StaffOrgListResultDTO();
dto.setOrgId(item.getId()); dto.setOrgId(item.getId());
@ -754,7 +757,7 @@ public class StaffServiceImpl implements StaffService {
list.addAll(deptList); list.addAll(deptList);
} }
//工作人员所在网格 //工作人员所在网格
if(CollectionUtils.isNotEmpty(staffInfoCache.getGridList())) { if (CollectionUtils.isNotEmpty(staffInfoCache.getGridList())) {
List<StaffOrgListResultDTO> gridList = staffInfoCache.getGridList().stream().map(item -> { List<StaffOrgListResultDTO> gridList = staffInfoCache.getGridList().stream().map(item -> {
StaffOrgListResultDTO dto = new StaffOrgListResultDTO(); StaffOrgListResultDTO dto = new StaffOrgListResultDTO();
dto.setOrgId(item.getId()); dto.setOrgId(item.getId());
@ -768,11 +771,11 @@ public class StaffServiceImpl implements StaffService {
} }
@Override @Override
public void execAsyncExcelImport(Path filePath, String importTaskId,String orgType, String orgId) { public void execAsyncExcelImport(Path filePath, String importTaskId, String orgType, String orgId) {
try { try {
CustomerStaffImportListener listener = new CustomerStaffImportListener(userRemoteService.getLoginUserDetails().getUserId(), userRemoteService.getLoginUserDetails().getCustomerId(), orgType,orgId,this); CustomerStaffImportListener listener = new CustomerStaffImportListener(userRemoteService.getLoginUserDetails().getUserId(), userRemoteService.getLoginUserDetails().getCustomerId(), orgType, orgId, this);
EasyExcel.read(filePath.toFile(), CustomerStaffImportExcelData.class, listener).headRowNumber(1).sheet(0).doRead(); EasyExcel.read(filePath.toFile(), CustomerStaffImportExcelData.class, listener).headRowNumber(1).sheet(0).doRead();
@ -811,7 +814,7 @@ public class StaffServiceImpl implements StaffService {
IOUtils.closeQuietly(os); IOUtils.closeQuietly(os);
try { try {
fileItem.delete(); fileItem.delete();
} catch (Exception e){ } catch (Exception e) {
log.error("【客户信息导入】删除临时描述文件失败:{}", ExceptionUtils.getErrorStackTrace(e)); log.error("【客户信息导入】删除临时描述文件失败:{}", ExceptionUtils.getErrorStackTrace(e));
} }
} }
@ -849,6 +852,7 @@ public class StaffServiceImpl implements StaffService {
/** /**
* 批量持久化 * 批量持久化
*
* @param addStaffV2FromDTOList * @param addStaffV2FromDTOList
*/ */
public void exportAdd(List<AddStaffV2FromDTO> addStaffV2FromDTOList, CustomerStaffImportListener listener) { public void exportAdd(List<AddStaffV2FromDTO> addStaffV2FromDTOList, CustomerStaffImportListener listener) {
@ -859,7 +863,7 @@ public class StaffServiceImpl implements StaffService {
OrgResultDTO orgDTO = customerAgencyDao.selectAgencyDetail(fromDTO.getOrgId(), fromDTO.getOrgType()); OrgResultDTO orgDTO = customerAgencyDao.selectAgencyDetail(fromDTO.getOrgId(), fromDTO.getOrgType());
if (null == orgDTO) { if (null == orgDTO) {
logger.warn(String.format("工作人员新增,根据新增人员组织类型未查询到相关组织信息,orgId->%s,orgType->%s", fromDTO.getOrgId(), fromDTO.getOrgType())); logger.warn(String.format("工作人员新增,根据新增人员组织类型未查询到相关组织信息,orgId->%s,orgType->%s", fromDTO.getOrgId(), fromDTO.getOrgType()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"根据新增人员组织类型未查询到相关组织信息","组织不存在"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "根据新增人员组织类型未查询到相关组织信息", "组织不存在");
} }
//2.调用user服务,新增用户信息 //2.调用user服务,新增用户信息
@ -867,7 +871,7 @@ public class StaffServiceImpl implements StaffService {
submitDTO.setAgencyId(orgDTO.getAgencyId()); submitDTO.setAgencyId(orgDTO.getAgencyId());
Result<CustomerStaffDTO> result = epmetUserFeignClient.addStaff(submitDTO); Result<CustomerStaffDTO> result = epmetUserFeignClient.addStaff(submitDTO);
if (!result.success()) { if (!result.success()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),result.getInternalMsg(),result.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), result.getInternalMsg(), result.getMsg());
} }
//3.人员机关表总人数加一、关系表新增关系数据 //3.人员机关表总人数加一、关系表新增关系数据
@ -910,9 +914,9 @@ public class StaffServiceImpl implements StaffService {
//5.工作人员注册组织关系表新增数据 //5.工作人员注册组织关系表新增数据
StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity(); StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity();
staffOrgRelationEntity.setCustomerId(fromDTO.getCustomerId()); staffOrgRelationEntity.setCustomerId(fromDTO.getCustomerId());
if("agency".equals(fromDTO.getOrgType())){ if ("agency".equals(fromDTO.getOrgType())) {
staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids())); staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids()));
}else { } else {
staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids() + ":") + orgDTO.getAgencyId()); staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids() + ":") + orgDTO.getAgencyId());
} }
staffOrgRelationEntity.setStaffId(result.getData().getUserId()); staffOrgRelationEntity.setStaffId(result.getData().getUserId());
@ -920,9 +924,9 @@ public class StaffServiceImpl implements StaffService {
staffOrgRelationEntity.setOrgType(fromDTO.getOrgType()); staffOrgRelationEntity.setOrgType(fromDTO.getOrgType());
staffOrgRelationService.insert(staffOrgRelationEntity); staffOrgRelationService.insert(staffOrgRelationEntity);
if (CollectionUtils.isNotEmpty(fromDTO.getNewRoles())){ if (CollectionUtils.isNotEmpty(fromDTO.getNewRoles())) {
Result roleUserAccess = govAccessFeignClient.roleUser(new RoleUserFormDTO(fromDTO.getNewRoles(), customerStaffAgencyEntity.getUserId(),fromDTO.getCustomerId())); Result roleUserAccess = govAccessFeignClient.roleUser(new RoleUserFormDTO(fromDTO.getNewRoles(), customerStaffAgencyEntity.getUserId(), fromDTO.getCustomerId()));
if (!roleUserAccess.success()){ if (!roleUserAccess.success()) {
throw new EpmetException("save data to gov-role-user failure"); throw new EpmetException("save data to gov-role-user failure");
} }
} }
@ -933,7 +937,7 @@ public class StaffServiceImpl implements StaffService {
if ("1535072605621841922".equals(fromDTO.getCustomerId()) if ("1535072605621841922".equals(fromDTO.getCustomerId())
|| "45687aa479955f9d06204d415238f7cc".equals(fromDTO.getCustomerId()) || "45687aa479955f9d06204d415238f7cc".equals(fromDTO.getCustomerId())
|| "0c41b272ee9ee95ac6f184ad548a30eb".equals(fromDTO.getCustomerId())) { || "0c41b272ee9ee95ac6f184ad548a30eb".equals(fromDTO.getCustomerId())) {
YtSyncStaffIdFormDTO ytSyncStaffIdFormDTO = ConvertUtils.sourceToTarget(fromDTO,YtSyncStaffIdFormDTO.class); YtSyncStaffIdFormDTO ytSyncStaffIdFormDTO = ConvertUtils.sourceToTarget(fromDTO, YtSyncStaffIdFormDTO.class);
ytSyncStaffIdFormDTO.setStaffId(result.getData().getUserId()); ytSyncStaffIdFormDTO.setStaffId(result.getData().getUserId());
ytSyncStaffIdFormDTO.setOperUserId(fromDTO.getCurrentUserId()); ytSyncStaffIdFormDTO.setOperUserId(fromDTO.getCurrentUserId());
epmetThirdOpenFeignClient.dataSyncUpdateStaff(ytSyncStaffIdFormDTO); epmetThirdOpenFeignClient.dataSyncUpdateStaff(ytSyncStaffIdFormDTO);

Loading…
Cancel
Save