|
|
@ -6,6 +6,7 @@ import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
|
import com.epmet.commons.tools.utils.PidUtils; |
|
|
|
import com.epmet.constant.OrgInfoConstant; |
|
|
@ -20,6 +21,7 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
@Service |
|
|
@ -37,7 +39,8 @@ public class UserServiceImpl implements UserService { |
|
|
|
@Override |
|
|
|
public PageData<StaffsByOrgAndRoleRstDTO> listStaffByOrgAndRole(StaffsByOrgAndRolesFormDTO form) { |
|
|
|
String orgIdPath; |
|
|
|
|
|
|
|
List<String> staffIdsUnderAgency = new ArrayList<>(); |
|
|
|
List<String> staffIdsUnderGrid = new ArrayList<>(); |
|
|
|
if (StringUtils.isAnyBlank(form.getOrgId(), form.getOrgType())) { |
|
|
|
// 这俩有一个不传,就用当前用户所属的
|
|
|
|
LoginUserDetailsResultDTO loginUserDetails = epmetUserRemoteService.getLoginUserDetails(); |
|
|
@ -46,27 +49,30 @@ public class UserServiceImpl implements UserService { |
|
|
|
form.setOrgType(OrgInfoConstant.AGENCY); |
|
|
|
} else { |
|
|
|
// 取用户传递的
|
|
|
|
// 先通过org库查询出工作人员的id列表
|
|
|
|
if (OrgInfoConstant.AGENCY.equals(form.getOrgType())) { |
|
|
|
// 行政组织
|
|
|
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(form.getOrgId()); |
|
|
|
orgIdPath = PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids()); |
|
|
|
staffIdsUnderAgency = govOrgService.listStaffIdsUnderAgency(orgIdPath, form.getOrgId()); |
|
|
|
} else { |
|
|
|
return null; |
|
|
|
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(form.getOrgId()); |
|
|
|
orgIdPath = PidUtils.convertPid2OrgIdPath(gridInfoCache.getId(), gridInfoCache.getPids()); |
|
|
|
staffIdsUnderGrid = govOrgService.listStaffIdsUnderGrid(orgIdPath, form.getOrgId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 先通过org库查询出工作人员的id列表
|
|
|
|
List<String> staffIdsUnderAgency = govOrgService.listStaffIdsUnderAgency(orgIdPath, form.getOrgId()); |
|
|
|
// 再通过这些id列表,去过滤角色,并且查出详细信息
|
|
|
|
|
|
|
|
PageData<StaffsByOrgAndRoleRstDTO> pageData = epmetUserService.staffsInRolesFromGivenStaffIds(staffIdsUnderAgency, form); |
|
|
|
PageData<StaffsByOrgAndRoleRstDTO> pageData = epmetUserService.staffsInRolesFromGivenStaffIds( |
|
|
|
staffIdsUnderAgency.size() > 0 ? staffIdsUnderAgency : staffIdsUnderGrid, form); |
|
|
|
pageData.getList().forEach(staff -> { |
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), staff.getStaffId()); |
|
|
|
List<IdAndNameDTO> gridList = staffInfo.getGridList(); |
|
|
|
staff.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
if (null != staffInfo.getGridList() && staffInfo.getGridList().size() > 0) { |
|
|
|
staff.setGridName(staffInfo.getAgencyName() + "-" + gridList.get(0).getName()); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
staff.setGridName(staffInfo.getAgencyName()); |
|
|
|
} |
|
|
|
}); |
|
|
|