From 6d3d1f4e6af4a206485ef4336c919c8ff888fb86 Mon Sep 17 00:00:00 2001 From: wangchao Date: Wed, 19 Aug 2020 17:36:50 +0800 Subject: [PATCH] ext-plugin --- .../epmet/controller/OpenUpController.java | 48 ++++++++++++++++--- .../epmet/feign/GovOrgOpenFeignClient.java | 14 +++++- .../GovOrgOpenFeignClientFallback.java | 5 ++ .../resources/mapper/CustomerAgencyDao.xml | 2 +- .../EpmetUserOpenFeignClientFallback.java | 5 ++ .../controller/CustomerStaffController.java | 2 +- 6 files changed, 65 insertions(+), 11 deletions(-) diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java index 1f29c98390..c79e8f4c19 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java @@ -1,17 +1,17 @@ package com.epmet.controller; +import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.*; -import com.epmet.dto.result.StaffSinAgencyResultDTO; -import com.epmet.dto.result.StaffSinDeptResultDTO; -import com.epmet.dto.result.StaffSinGridResultDTO; +import com.epmet.dto.result.*; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.OpenUpService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -26,6 +26,10 @@ public class OpenUpController { @Autowired private OpenUpService openUpService; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; /** * @Description 网格工作人员 被禁用的、未激活的不显示 @@ -63,4 +67,34 @@ public class OpenUpController { return new Result>().ok(openUpService.staffSinAgency(formDTO)); } + /** + * @Description 查找工作人员的信息 + * @param + * @return + * @author wangc + * @date 2020.08.17 10:30 + **/ + //@ExternalAppRequestAuth + @PostMapping("staffinfo") + public Result staffInfo(@LoginUser TokenDto token){ + CommonStaffIdFormDTO commonStaffIdFormDTO = new CommonStaffIdFormDTO(); + commonStaffIdFormDTO.setStaffId(token.getUserId()); + ValidatorUtils.validateEntity(commonStaffIdFormDTO, CommonStaffIdFormDTO.StaffIdGroup.class); + return epmetUserOpenFeignClient.extStaffInfo(commonStaffIdFormDTO); + } + + /** + * @Description 根据staffId,查询当前这个用户的数据权限 + * @param + * @return + * @author wangc + * @date 2020.08.17 17:30 + **/ + //@ExternalAppRequestAuth + @PostMapping("permission") + Result staffPermissionExt(@RequestBody CommonStaffIdFormDTO commonStaffIdFormDTO){ + ValidatorUtils.validateEntity(commonStaffIdFormDTO, CommonStaffIdFormDTO.StaffIdGroup.class); + return govOrgOpenFeignClient.staffPermissionExt(commonStaffIdFormDTO.getStaffId()); + } + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 2311670af0..09d38dca5f 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -19,8 +19,8 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:37 */ -//@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class, url = "localhost:8092") -@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class) +@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class, url = "localhost:8092") +//@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class) public interface GovOrgOpenFeignClient { /** @@ -230,4 +230,14 @@ public interface GovOrgOpenFeignClient { **/ @PostMapping("/gov/org/customeragency/staffinfoext") Result staffInfoExt(@RequestBody ExtStaffInfoResultDTO result); + + /** + * @Description 根据staffId,查询当前这个用户的数据权限,对外接口 + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 17:30 + **/ + @PostMapping("/gov/org/customeragency/permissionext/{staffId}") + Result staffPermissionExt(@PathVariable(value = "staffId") String staffId); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index c845039399..15ea830edb 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -136,4 +136,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result staffInfoExt(ExtStaffInfoResultDTO result) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "staffInfoExt", result); } + + @Override + public Result staffPermissionExt(String staffId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "staffPermissionExt", staffId); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 93136b2e1a..c2fb090e3f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -175,7 +175,7 @@ gridd.GRID_NAME, agency.ID AS agencyId, agency.ORGANIZATION_NAME AS agencyName, - agency.PID AS agencyIdPath, + agency.PIDS AS agencyIdPath, agency.ALL_PARENT_NAME AS agencyNamePath, agency.CUSTOMER_ID AS customerId FROM diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 55856e42ea..66aede9450 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -198,4 +198,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result updateRootManage(UpdateRootManageFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "updateRootManage", formDTO); } + + @Override + public Result extStaffInfo(CommonStaffIdFormDTO staffParam) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "extStaffInfo", staffParam); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index a752e8b884..08ed13c97a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -342,7 +342,7 @@ public class CustomerStaffController { * @date 2020.08.17 10:30 **/ @PostMapping("extstaffinfo") - public Result extStaffInfo(CommonStaffIdFormDTO staffParam){ + public Result extStaffInfo(@RequestBody CommonStaffIdFormDTO staffParam){ ValidatorUtils.validateEntity(staffParam, CommonStaffIdFormDTO.StaffIdGroup.class); return new Result().ok(customerStaffService.extStaffInfo(staffParam)); }