13 changed files with 199 additions and 1 deletions
@ -0,0 +1,24 @@ |
|||
package com.epmet.dataaggre.dto.epmetuser.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class StaffsByOrgAndRolesFormDTO { |
|||
|
|||
@NotBlank(message = "组织ID为必填项") |
|||
private String orgId; |
|||
|
|||
/** |
|||
* agency,grid |
|||
*/ |
|||
@NotBlank(message = "组织类型为必填项") |
|||
private String orgType; |
|||
private int pageNo = 1; |
|||
private int pageSize = 10; |
|||
|
|||
private List<String> roleKeys; |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dataaggre.dto.epmetuser.result; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
/** |
|||
* @Description 工作人员列表(按照角色和组织查询) |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/31 3:54 PM |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class StaffsByOrgAndRoleRstDTO { |
|||
|
|||
private String staffName; |
|||
|
|||
private String staffId; |
|||
|
|||
private String mobile; |
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.epmet.dataaggre.service; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dataaggre.dto.epmetuser.result.StaffsByOrgAndRoleRstDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface UserService { |
|||
PageData<StaffsByOrgAndRoleRstDTO> listStaffByOrgAndRole(String orgId, String orgType, Integer pageNo, Integer pageSize, List<String> roleKeys); |
|||
} |
@ -0,0 +1,59 @@ |
|||
package com.epmet.dataaggre.service.impl; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|||
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|||
import com.epmet.commons.tools.utils.PidUtils; |
|||
import com.epmet.constant.OrgInfoConstant; |
|||
import com.epmet.dataaggre.dto.epmetuser.result.StaffsByOrgAndRoleRstDTO; |
|||
import com.epmet.dataaggre.service.UserService; |
|||
import com.epmet.dataaggre.service.epmetuser.EpmetUserService; |
|||
import com.epmet.dataaggre.service.govorg.GovOrgService; |
|||
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
|||
import com.epmet.remote.EpmetUserRemoteService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class UserServiceImpl implements UserService { |
|||
|
|||
@Autowired |
|||
private GovOrgService govOrgService; |
|||
|
|||
@Autowired |
|||
private EpmetUserService epmetUserService; |
|||
|
|||
@Autowired |
|||
private EpmetUserRemoteService epmetUserRemoteService; |
|||
|
|||
@Override |
|||
public PageData<StaffsByOrgAndRoleRstDTO> listStaffByOrgAndRole(String orgId, String orgType, Integer pageNo, Integer pageSize, List<String> roleKeys) { |
|||
String orgIdPath; |
|||
|
|||
if (StringUtils.isAnyBlank(orgType, orgType)) { |
|||
// 这俩有一个不传,就用当前用户所属的
|
|||
LoginUserDetailsResultDTO loginUserDetails = epmetUserRemoteService.getLoginUserDetails(); |
|||
orgIdPath = loginUserDetails.getOrgIdPath(); |
|||
orgId = loginUserDetails.getAgencyId(); |
|||
orgType = OrgInfoConstant.AGENCY; |
|||
} else { |
|||
// 取用户传递的
|
|||
if (OrgInfoConstant.AGENCY.equals(orgType)) { |
|||
// 行政组织
|
|||
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); |
|||
orgIdPath = PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids()); |
|||
} else { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
// 先通过org库查询出工作人员的id列表
|
|||
List<String> staffIdsUnderAgency = govOrgService.listStaffIdsUnderAgency(orgIdPath, orgId); |
|||
|
|||
// 再通过这些id列表,去过滤角色,并且查出详细信息
|
|||
return epmetUserService.staffsInRolesFromGivenStaffIds(staffIdsUnderAgency, roleKeys, pageNo, pageSize); |
|||
} |
|||
} |
Loading…
Reference in new issue