diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index 69ec7833d8..a6077f5fa3 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -55,6 +55,24 @@ feign-httpclient 10.3.0 + + com.epmet + gov-org-client + 2.0.0 + compile + + + com.epmet + gov-org-client + 2.0.0 + compile + + + com.epmet + gov-org-client + 2.0.0 + compile + diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/CustomerAgencyController.java deleted file mode 100644 index ae25f3a97f..0000000000 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

- * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.controller; - -/** - * 机关单位信息表 - * - * @author generator generator@elink-cn.com - */ -@RestController -@RequestMapping("agency") -public class CustomerAgencyController { - - @Autowired - private CustomerAgencyService customerAgencyService; - - -} \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java new file mode 100644 index 0000000000..4ba21fb7be --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java @@ -0,0 +1,55 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +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.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.service.StaffAgencyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 机关单位信息表 + * + * @author generator generator@elink-cn.com + */ +@RestController +@RequestMapping("agency") +public class StaffAgencyController { + + @Autowired + private StaffAgencyService staffAgencyService; + + /** + * @param tokenDTO + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + @PostMapping("getmygrids") + public Result> getMyGrids(@LoginUser TokenDto tokenDTO) { + return staffAgencyService.getMyGrids(tokenDTO); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index fd2853340f..6866e03ecd 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -1,8 +1,14 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.feign.fallback.GovOrgFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; + +import java.util.List; /** * @Description @@ -11,4 +17,12 @@ import org.springframework.cloud.openfeign.FeignClient; @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class) public interface GovOrgFeignClient { + /** + * @param userId + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + @GetMapping(value = "/gov/org/customergrid/getmygrids/{userId}") + Result> getMyGrids(@PathVariable("userId") String userId); } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index 80ab9be7be..7e7b838d38 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -1,8 +1,14 @@ 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.result.CustomerGridByUserIdResultDTO; import com.epmet.feign.GovOrgFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * @Description * @Author sun @@ -10,4 +16,8 @@ import org.springframework.stereotype.Component; @Component public class GovOrgFeignClientFallBack implements GovOrgFeignClient { + @Override + public Result> getMyGrids(String userId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getMyGrids", userId); + } } \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/CustomerAgencyRedis.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/StaffAgencyRedis.java similarity index 97% rename from epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/CustomerAgencyRedis.java rename to epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/StaffAgencyRedis.java index 3b8e96c9a2..73608057c8 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/CustomerAgencyRedis.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/StaffAgencyRedis.java @@ -28,7 +28,7 @@ import org.springframework.stereotype.Component; * @since v1.0.0 2020-04-20 */ @Component -public class CustomerAgencyRedis { +public class StaffAgencyRedis { @Autowired private RedisUtils redisUtils; diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java similarity index 65% rename from epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java rename to epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java index 85de6deeaf..ae1329232c 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java @@ -17,14 +17,24 @@ package com.epmet.service; -import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.entity.CustomerAgencyEntity; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; + +import java.util.List; /** * 机关单位信息表 * * @author generator generator@elink-cn.com */ -public interface CustomerAgencyService extends BaseService { +public interface StaffAgencyService { + /** + * @param tokenDTO + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + Result> getMyGrids(TokenDto tokenDTO); } \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java similarity index 57% rename from epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java rename to epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index 1f89cc5bd7..c65f231671 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java @@ -17,24 +17,39 @@ package com.epmet.service.impl; -import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.dao.CustomerAgencyDao; -import com.epmet.entity.CustomerAgencyEntity; -import com.epmet.service.CustomerAgencyService; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.GovOrgFeignClient; +import com.epmet.service.StaffAgencyService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** * 机关单位信息表 * * @author generator generator@elink-cn.com */ @Service -public class CustomerAgencyServiceImpl extends BaseServiceImpl implements CustomerAgencyService { +public class StaffAgencyServiceImpl implements StaffAgencyService { @Autowired private GovOrgFeignClient govOrgFeignClient; @Autowired private EpmetUserFeignClient epmetUserFeignClient; + /** + * @param tokenDTO + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + @Override + public Result> getMyGrids(TokenDto tokenDTO) { + return govOrgFeignClient.getMyGrids(tokenDTO.getUserId()); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridByUserIdResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridByUserIdResultDTO.java new file mode 100644 index 0000000000..b0b04da974 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridByUserIdResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 根据userId查询该用户涉及的所有网格返回结果 + * @ClassName CustomerGridByUserIdResultDTO + * @Author sun + */ +@Data +public class CustomerGridByUserIdResultDTO implements Serializable { + private static final long serialVersionUID = -1L; + + /** + * 网格直属组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格名称 + */ + private String gridName; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java index 2599fa67e3..1e565d5b76 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java @@ -28,6 +28,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.excel.CustomerGridExcel; import com.epmet.service.CustomerGridService; @@ -125,4 +126,14 @@ public class CustomerGridController { return new Result().ok(data); } + /** + * @param userId + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + @PostMapping("getmygrids/{userId}") + public Result> getMyGrids(@PathVariable("userId") String userId) { + return customerGridService.getMyGrids(userId); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index a8113682c4..edf49d86d1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.entity.CustomerGridEntity; import org.apache.ibatis.annotations.Mapper; @@ -61,4 +62,11 @@ public interface CustomerGridDao extends BaseDao { CustomerGridDTO getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO); + /** + * @param userId + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + List getMyGrids(String userId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java index cf24460d88..44b206c7c5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java @@ -23,6 +23,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.entity.CustomerGridEntity; @@ -114,4 +115,11 @@ public interface CustomerGridService extends BaseService { */ Result getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO); + /** + * @param userId + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + Result> getMyGrids(String userId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index 86cb83f0c2..f11352265f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -28,6 +28,7 @@ import com.epmet.dao.CustomerGridDao; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.entity.CustomerGridEntity; import com.epmet.redis.CustomerGridRedis; @@ -151,4 +152,15 @@ public class CustomerGridServiceImpl extends BaseServiceImpl().ok(baseDao.getCustomerGridByGridId(customerGridFormDTO)); } + /** + * @param userId + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + @Override + public Result> getMyGrids(String userId) { + return new Result>().ok(baseDao.getMyGrids(userId)); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index a2421ac708..343558b7d7 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -93,4 +93,20 @@ + + \ No newline at end of file