diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/remote/EpmetUserRemoteService.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/remote/EpmetUserRemoteService.java new file mode 100644 index 0000000000..29758a6edf --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/remote/EpmetUserRemoteService.java @@ -0,0 +1,35 @@ +package com.epmet.remote; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.feign.ResultDataResolver; +import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.dto.form.LoginUserDetailsFormDTO; +import com.epmet.dto.result.LoginUserDetailsResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * epmet用户远程服务工具 + */ +@Component +public class EpmetUserRemoteService implements ResultDataResolver { + + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + + /** + * 查询当前登录用户信息 + * @return + */ + public LoginUserDetailsResultDTO getLoginUserDetails() { + // 不传组织id,则基于当前组织查询 + LoginUserDetailsFormDTO loinUserForm = new LoginUserDetailsFormDTO(); + loinUserForm.setApp(EpmetRequestHolder.getLoginUserApp()); + loinUserForm.setClient(EpmetRequestHolder.getLoginUserClient()); + loinUserForm.setUserId(EpmetRequestHolder.getLoginUserId()); + LoginUserDetailsResultDTO loginUserDetailsResultDTO = getResultDataOrThrowsException(epmetUserOpenFeignClient.getLoginUserDetails(loinUserForm), ServiceConstant.GOV_ORG_SERVER, + null, null, "查询当前工作人员所属组织信息失败"); + return loginUserDetailsResultDTO; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java index c907a727c3..1f3c3a6b83 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java @@ -42,6 +42,7 @@ import com.epmet.exceptions.ReadExcelHeaderOnlyException; import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.OssFeignClient; +import com.epmet.remote.EpmetUserRemoteService; import com.epmet.service.LingShanSpecialCrowdService; import com.epmet.utils.ImportTaskUtils; import com.github.pagehelper.PageHelper; @@ -107,6 +108,9 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ @Autowired private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Autowired + private EpmetUserRemoteService epmetUserRemoteService; + @Override public String importSpecialCrowd(String crowdCategory, String fileSavePath, String originFilename) { Class excelDataClass; @@ -607,6 +611,8 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ String orgIdPath = null; if (StringUtils.isNotBlank(orgId)) { orgIdPath = CustomerOrgRedis.getOrgIdPath(orgId, orgType); + } else { + orgIdPath = epmetUserRemoteService.getLoginUserDetails().getOrgIdPath(); } PageHelper.startPage(pageNo, pageSize); List l = icSpecialDao.listSpecialCrowd(orgIdPath, orgType, specialType, name, mobile, idCard); @@ -623,7 +629,10 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ if (StringUtils.isNotBlank(specialTypesStr)) { String[] types = specialTypesStr.split(","); for (String type : types) { - typesDisplay.add(LingShanSpecialCrowdTypeEnums.getByType(type).getName()); + LingShanSpecialCrowdTypeEnums crowdType = LingShanSpecialCrowdTypeEnums.getByType(type); + if (crowdType != null) { + typesDisplay.add(crowdType.getName()); + } } } i.setSpecialTypeDisplay(String.join(",", typesDisplay));