forked from rongchao/epmet-cloud-rizhao
14 changed files with 270 additions and 7 deletions
@ -0,0 +1,34 @@ |
|||
package com.epmet.feign; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.StaffRoleFormDTO; |
|||
import com.epmet.dto.result.GovStaffRoleResultDTO; |
|||
import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class, url = "localhost:8087") |
|||
public interface EpmetUserFeignClient { |
|||
|
|||
/** |
|||
* 根据机构Id查询机构下是网格长角色的用户 |
|||
* @param staffRoleFormDTO |
|||
* @return |
|||
* @Author sun |
|||
*/ |
|||
@PostMapping("/epmetuser/staffrole/staffsinrole") |
|||
Result<List<GovStaffRoleResultDTO>> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO); |
|||
|
|||
/** |
|||
* 一次性查询多个机构下,指定角色的用户列表 |
|||
* @param staffRoleFormDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping("/epmetuser/staffrole/staffsinroleoforgs") |
|||
Result<Map<String, List<GovStaffRoleResultDTO>>> getStaffsInRoleOfOrgs(@RequestBody StaffRoleFormDTO staffRoleFormDTO); |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
package com.epmet.feign; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.CustomerAgencyDTO; |
|||
import com.epmet.feign.fallback.GovOrgFeignClientFallBack; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class, url = "localhost:8092") |
|||
public interface GovOrgFeignClient { |
|||
|
|||
/** |
|||
* 批量查询客户根级组织 |
|||
* @param customerIds |
|||
* @return |
|||
*/ |
|||
@PostMapping("/gov/org/agency/customerrootagencybatch") |
|||
Result<Map<String, CustomerAgencyDTO>> getCustomerRootAgencyBatch(List<String> customerIds); |
|||
|
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
package com.epmet.feign.fallback; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.ModuleUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.StaffRoleFormDTO; |
|||
import com.epmet.dto.result.GovStaffRoleResultDTO; |
|||
import com.epmet.feign.EpmetUserFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Component |
|||
public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { |
|||
@Override |
|||
public Result<List<GovStaffRoleResultDTO>> getStaffsInRole(StaffRoleFormDTO staffRoleFormDTO) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffsInRole", staffRoleFormDTO); |
|||
} |
|||
|
|||
@Override |
|||
public Result<Map<String, List<GovStaffRoleResultDTO>>> getStaffsInRoleOfOrgs(StaffRoleFormDTO staffRoleFormDTO) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffsInRoleOfOrgs", staffRoleFormDTO); |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
package com.epmet.feign.fallback; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.ModuleUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.CustomerAgencyDTO; |
|||
import com.epmet.feign.GovOrgFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Component |
|||
public class GovOrgFeignClientFallBack implements GovOrgFeignClient { |
|||
|
|||
@Override |
|||
public Result<Map<String, CustomerAgencyDTO>> getCustomerRootAgencyBatch(List<String> customerIds) { |
|||
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCustomerRootAgencyBatch", customerIds); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue