|
|
@ -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); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|