diff --git a/epmet-module/gov-grid/gov-grid-server/docker-compose.yml b/epmet-module/gov-grid/gov-grid-server/docker-compose.yml index 77d9b3d06b..83fde4e92b 100644 --- a/epmet-module/gov-grid/gov-grid-server/docker-compose.yml +++ b/epmet-module/gov-grid/gov-grid-server/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-grid-server: container_name: gov-grid-server-dev - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/gov-grid-server:0.3.9 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/gov-grid-server:0.3.10 ports: - "8097:8097" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-grid/gov-grid-server/pom.xml b/epmet-module/gov-grid/gov-grid-server/pom.xml index 8eb4863cb0..60f67b62a8 100644 --- a/epmet-module/gov-grid/gov-grid-server/pom.xml +++ b/epmet-module/gov-grid/gov-grid-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.9 + 0.3.10 com.epmet gov-grid diff --git a/epmet-module/gov-mine/gov-mine-server/docker-compose.yml b/epmet-module/gov-mine/gov-mine-server/docker-compose.yml index e1a9cfb9fb..d6909ad07f 100644 --- a/epmet-module/gov-mine/gov-mine-server/docker-compose.yml +++ b/epmet-module/gov-mine/gov-mine-server/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-mine-server: container_name: gov-mine-server-dev - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/gov-mine-server:0.3.6 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/gov-mine-server:0.3.7 ports: - "8098:8098" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index 5e0da7bf23..5f48b69c93 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.6 + 0.3.7 com.epmet gov-mine diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java index 263405df0c..a4787ffcef 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java @@ -2,12 +2,14 @@ package com.epmet.dto; import lombok.Data; +import java.io.Serializable; + /** * @Auther zxc * @Create 2020-04-23 10:38 */ @Data -public class StaffGridListDTO { +public class StaffGridListDTO implements Serializable { private static final long serialVersionUID = 1L; diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllGridsByUserIdResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllGridsByUserIdResultDTO.java new file mode 100644 index 0000000000..551e3302e5 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllGridsByUserIdResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Auther sun + * 获取用户访问过的所有网格列表-接口返参 + */ +@Data +public class AllGridsByUserIdResultDTO implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 网格Id + */ + private String gridId; + + /** + * 网格名称 + */ + private String gridName; + +} diff --git a/epmet-module/gov-org/gov-org-server/docker-compose.yml b/epmet-module/gov-org/gov-org-server/docker-compose.yml index 691fb62d7e..8c86af7e94 100644 --- a/epmet-module/gov-org/gov-org-server/docker-compose.yml +++ b/epmet-module/gov-org/gov-org-server/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-dev - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/gov-org-server:0.3.24 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/gov-org-server:0.3.26 ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index e35314fb3f..d51e8e368b 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.24 + 0.3.26 com.epmet gov-org 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 834aa9bd1c..5e092efda6 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 @@ -171,4 +171,15 @@ public class CustomerGridController { return customerGridService.getAgencyAndStaffsBygridId(gridId); } + /** + * @param gridIdList + * @return + * @Description 根据网格Id集合获取网格列表信息 + * @Author sun + */ + @PostMapping("getgridlistbygridids") + public Result> getGridListByGridIds(@RequestBody List gridIdList) { + return customerGridService.getGridListByGridIds(gridIdList); + } + } 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 a8c6aeb6d0..70f4361032 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 @@ -18,17 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.UserIdAndPidDTO; +import com.epmet.dto.*; import com.epmet.dto.form.ListCustomerGridFormDTO; import com.epmet.dto.form.SelectGridNameByGridIdFormDTO; import com.epmet.dto.result.*; -import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerGridDTO; -import com.epmet.dto.CustomerStaffGridDTO; -import com.epmet.dto.UserIdDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.DeleteGridFormDTO; -import com.epmet.dto.form.ListCustomerGridFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.entity.CustomerGridEntity; import org.apache.ibatis.annotations.Mapper; @@ -38,7 +33,7 @@ import java.util.List; import java.util.Map; /** - * 客户网格表 + * 客户网格表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-16 @@ -46,32 +41,28 @@ import java.util.Map; @Mapper public interface CustomerGridDao extends BaseDao { - - /** + * @return CustomerGridForStrangerResultDTO * @Description 查整个城市的网格 * @Param areaCode - * @return CustomerGridForStrangerResultDTO * @Author wangc * @Date 2020.03.19 15:53 **/ List selectGridByCityLike(ListCustomerGridFormDTO listCustomerGridFormDTO); - /** + * @return CustomerGridForStrangerResultDTO * @Description 指定区时查询当前城市下除该区之外其余的网格 * @Param areaCode * @Param cityCode - * @return CustomerGridForStrangerResultDTO * @Author wangc * @Date 2020.03.19 15:53 **/ - List selectRestGridWithoutGivenAreaCode(Map paramsMap); + List selectRestGridWithoutGivenAreaCode(Map paramsMap); CustomerGridDTO getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO); /** - * * @Description 根据网格id查询网格名称 * @Author zxc * @CreatedTime 2020/4/27 9:22 @@ -88,6 +79,7 @@ public interface CustomerGridDao extends BaseDao { /** * 根据gridId获取网格详情 + * * @param customerGridFormDTO * @return */ @@ -95,6 +87,7 @@ public interface CustomerGridDao extends BaseDao { /** * 根据gridId查询uerId和pid + * * @param customerGridFormDTO * @return */ @@ -102,6 +95,7 @@ public interface CustomerGridDao extends BaseDao { /** * 根据userId查询customerId + * * @param userId * @return */ @@ -109,57 +103,66 @@ public interface CustomerGridDao extends BaseDao { /** * 根据pid查询pids + * * @param pid * @return */ - String selectPidsByPid(@Param("pid")String pid); + String selectPidsByPid(@Param("pid") String pid); /** * 根据gridName查询gridId + * * @param gridName * @return */ - String selectGridIdByGridName(@Param("gridName")String gridName,@Param("agencyId")String pid,@Param("gridId")String gridId); + AddGridResultDTO selectGridIdByGridName(@Param("gridName") String gridName, @Param("agencyId") String pid, @Param("gridId") String gridId); /** * 编辑网格信息 + * * @param customerGridDTO */ void editGrid(CustomerGridDTO customerGridDTO); /** * 删除网格 + * * @param deleteGridFormDTO */ void deleteGrid(DeleteGridFormDTO deleteGridFormDTO); /** - * * @Description 根据gridId查询userId * @Author zxc * @CreatedTime 2020/4/26 10:08 */ - List selectUserIdByGrid(@Param("gridId")String gridId); - - + List selectUserIdByGrid(@Param("gridId") String gridId); /** + * @return int * @Description 得到当前机构的网格总数 * @Param agencyId(String) 对应CUSTOMER_GRID中的PID字段 - * @return int * @Author wangc * @Date 2020.04.23 15:05 **/ int selectGridCountByAgencyId(@Param("agencyId") String agencyId); /** + * @return List -> GridBaseInfoResultDTO :: getGridId :: getGridName :: getTotalUser * @Description 得到当前机构的网格详情列表 * @Param agencyId(String) 对应CUSTOMER_GRID中的PID字段 - * @return List -> GridBaseInfoResultDTO :: getGridId :: getGridName :: getTotalUser * @Author wangc * @Date 2020.04.23 15:30 **/ - List selectGridListByAgencyId(@Param("agencyId")String agencyId,@Param("pageSize")Integer pageSize); + List selectGridListByAgencyId(@Param("agencyId") String agencyId, @Param("pageSize") Integer pageSize); List listGridsbystaffid(@Param("staffId") String staffId); + + /** + * @param gridIdList + * @return + * @Description 根据网格Id集合获取网格列表信息 + * @Author sun + */ + List selectGridByIds(@Param("gridIdList") List gridIdList); } \ 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 477780c4bd..0553e60758 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 @@ -219,4 +219,13 @@ public interface CustomerGridService extends BaseService { Result getAgencyAndStaffsBygridId(String gridId); List listGridsbystaffid(String staffId); + + /** + * @param gridIdList + * @return + * @Description 根据网格Id集合获取网格列表信息 + * @Author sun + */ + Result> getGridListByGridIds(List gridIdList); + } \ 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 8f5a6d850d..7004e084cf 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 @@ -45,6 +45,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -200,19 +201,17 @@ public class CustomerGridServiceImpl extends BaseServiceImpl addGrid(TokenDto tokenDto, AddGridFormDTO addGridFormDTO) { //查询是否重名 - String checkGridName = baseDao.selectGridIdByGridName(addGridFormDTO.getGridName(),addGridFormDTO.getAgencyId(),null); - if (checkGridName!=null){ + AddGridResultDTO gridResult = baseDao.selectGridIdByGridName(addGridFormDTO.getGridName(), addGridFormDTO.getAgencyId(), null); + if (gridResult!=null){ return new Result().error(EpmetErrorCode.NOT_ADD_GRID.getCode()); } - //查询地区编码 - String areaCode = customerAgencyDao.selectAreaCodeByAgencyId(addGridFormDTO.getAgencyId()); - CustomerGridEntity customerGridEntity = new CustomerGridEntity(); - customerGridEntity.setAreaCode(areaCode); CustomerAgencyDTO customerAgencyDTO=customerAgencyService.get(addGridFormDTO.getAgencyId()); - customerGridEntity.setCustomerId(customerAgencyDTO.getCustomerId());//查询customerId - customerGridEntity.setGridName(addGridFormDTO.getGridName()); - customerGridEntity.setManageDistrict(addGridFormDTO.getManageDistrict()); + CustomerGridEntity customerGridEntity = new CustomerGridEntity(); + BeanUtils.copyProperties(addGridFormDTO,customerGridEntity); + customerGridEntity.setAreaCode(customerAgencyDTO.getAreaCode()); + customerGridEntity.setCustomerId(customerAgencyDTO.getCustomerId()); customerGridEntity.setPid(addGridFormDTO.getAgencyId()); + //所有上级机构id,必须包括当前机构id (放在所有上级机构id后) if(StringUtils.isBlank(customerAgencyDTO.getPids())){ customerGridEntity.setPids(addGridFormDTO.getAgencyId()); }else{ @@ -222,12 +221,9 @@ public class CustomerGridServiceImpl extends BaseServiceImpl().ok(addGridResultDTO); } @@ -239,8 +235,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl listGridsbystaffid(String staffId) { return baseDao.listGridsbystaffid(staffId); } + + /** + * @param gridIdList + * @return + * @Description 根据网格Id集合获取网格列表信息 + * @Author sun + */ + @Override + public Result> getGridListByGridIds(List gridIdList) { + Result> result = new Result>(); + List list = baseDao.selectGridByIds(gridIdList); + return result.ok(list); + } } 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 8b2962f518..335ff75f55 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 @@ -176,7 +176,7 @@ - SELECT id AS gridId FROM @@ -263,4 +263,18 @@ AND sg.USER_ID = #{staffId} + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/docker-compose.yml b/epmet-module/resi-group/resi-group-server/docker-compose.yml index c0d5075e65..eb3bd4926b 100644 --- a/epmet-module/resi-group/resi-group-server/docker-compose.yml +++ b/epmet-module/resi-group/resi-group-server/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-group-server: container_name: resi-group-server-dev - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/resi-group-server:0.3.7 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/resi-group-server:0.3.10 ports: - "8095:8095" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-group/resi-group-server/pom.xml b/epmet-module/resi-group/resi-group-server/pom.xml index 18d40accf5..13cc13e781 100644 --- a/epmet-module/resi-group/resi-group-server/pom.xml +++ b/epmet-module/resi-group/resi-group-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.7 + 0.3.10 com.epmet resi-group diff --git a/epmet-module/resi-mine/resi-mine-server/docker-compose.yml b/epmet-module/resi-mine/resi-mine-server/docker-compose.yml index 7ca19acf2e..a8d5079c22 100644 --- a/epmet-module/resi-mine/resi-mine-server/docker-compose.yml +++ b/epmet-module/resi-mine/resi-mine-server/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-mine-server: container_name: resi-mine-server-dev - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/resi-mine-server:0.3.4 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/resi-mine-server:0.3.5 ports: - "8094:8094" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-mine/resi-mine-server/pom.xml b/epmet-module/resi-mine/resi-mine-server/pom.xml index 7b8a38f01c..f24b5d71c5 100644 --- a/epmet-module/resi-mine/resi-mine-server/pom.xml +++ b/epmet-module/resi-mine/resi-mine-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.4 + 0.3.5 com.epmet resi-mine @@ -77,6 +77,12 @@ 2.0.0 compile + + com.epmet + gov-org-client + 2.0.0 + compile + diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java index 74f33cbbea..d2b2dab8b2 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java @@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import java.util.List; + /** * @Description 居民端陌生人导览 调用epmet-user服务 * @Author sun @@ -51,4 +53,13 @@ public interface EpmetUserFeignClient { **/ @PostMapping(value = "epmetuser/userresiinfo/getverificationcode") Result getVerificationCode(VerificationCodeFormDTO formDTO); + + /** + * @return + * @param userId + * @Description 根据用户Id查询用户访问过的网格列表Id集合 + * @Author sun + **/ + @PostMapping(value = "epmetuser/gridlatest/getgridsbyuserid/{userId}") + Result> getGridsByUserId(@PathVariable("userId") String userId); } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java new file mode 100644 index 0000000000..f5cc29b95c --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java @@ -0,0 +1,28 @@ +package com.epmet.modules.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.AllGridsByUserIdResultDTO; +import com.epmet.modules.feign.fallback.GovOrgFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +/** + * @Description gov-org服务 + * @Author sun + */ +@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class) +public interface GovOrgFeignClient { + + /** + * @param gridIdList + * @return + * @Description 根据网格Id集合获取网格列表信息 + * @Author sun + */ + @PostMapping("/gov/org/customergrid/getgridlistbygridids") + Result> getGridListByGridIds(List gridIdList); + +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java index 79d432f019..1753af5ba0 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java @@ -11,6 +11,8 @@ import com.epmet.dto.result.ResiRegisterResultDTO; import com.epmet.modules.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * @Description 居民端-陌生人导览 调用epmet-user服务 * @Author sun @@ -61,5 +63,14 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getVerificationCode", formDTO); } - + /** + * @return + * @param userId + * @Description 根据用户Id查询用户访问过的网格列表Id集合 + * @Author sun + **/ + @Override + public Result> getGridsByUserId(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getGridsByUserId", userId); + } } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java new file mode 100644 index 0000000000..6541274329 --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java @@ -0,0 +1,23 @@ +package com.epmet.modules.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.AllGridsByUserIdResultDTO; +import com.epmet.modules.feign.GovOrgFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @Description gov-org服务 + * @Author sun + */ +@Component +public class GovOrgFeignClientFallBack implements GovOrgFeignClient { + + @Override + public Result> getGridListByGridIds(List gridIdList) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridListByGridIds", gridIdList); + } +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java index 626f78bfd4..9a1d262509 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java @@ -3,13 +3,17 @@ package com.epmet.modules.grid.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.AllGridsByUserIdResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO; import com.epmet.modules.grid.service.ResiMineGridService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; +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; + /** * @Description 居民端用户网格信息相关接口入口 * @Author yinzuomei @@ -32,4 +36,15 @@ public class ResiMineGridController { public Result getLatestGridInfo(@LoginUser TokenDto tokenDto){ return resiMineGridService.getLatestGridInfo(tokenDto); } + + /** + * @return + * @param tokenDto + * @Description 获取用户访问过的所有网格列表 + * @Author sun + **/ + @PostMapping("allgrids") + public Result> allGrids(@LoginUser TokenDto tokenDto){ + return resiMineGridService.allGrids(tokenDto.getUserId()); + } } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/ResiMineGridService.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/ResiMineGridService.java index 29597c8e87..73a98ad7a4 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/ResiMineGridService.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/ResiMineGridService.java @@ -2,8 +2,11 @@ package com.epmet.modules.grid.service; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.AllGridsByUserIdResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO; +import java.util.List; + /** * @Description 居民端用户网格信息service * @Author yinzuomei @@ -18,4 +21,12 @@ public interface ResiMineGridService { * @return com.epmet.commons.tools.utils.Result */ Result getLatestGridInfo(TokenDto tokenDto); + + /** + * @return + * @param userId + * @Description 获取用户访问过的所有网格列表 + * @Author sun + **/ + Result> allGrids(String userId); } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java index a0925b8f13..2207f5c491 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java @@ -1,11 +1,14 @@ package com.epmet.modules.grid.service.impl; import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.AllGridsByUserIdResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO; import com.epmet.modules.feign.EpmetUserFeignClient; +import com.epmet.modules.feign.GovOrgFeignClient; import com.epmet.modules.grid.service.ResiMineGridService; import com.epmet.modules.utils.ModuleConstant; import org.apache.commons.lang3.StringUtils; @@ -14,6 +17,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; + /** * @Description 居民端用户网格信息service * @Author yinzuomei @@ -24,6 +30,8 @@ public class ResiMineGridServiceImpl implements ResiMineGridService { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private EpmetUserFeignClient epmetUserFeignClient; + @Autowired + private GovOrgFeignClient govOrgFeignClient; /** * @param tokenDto @@ -44,4 +52,33 @@ public class ResiMineGridServiceImpl implements ResiMineGridService { } return epmetUserFeignClient.getLatestGridInfoByUserId(tokenDto.getUserId()); } + + /** + * @return + * @param userId + * @Description 获取用户访问过的所有网格列表 + * @Author sun + **/ + @Override + public Result> allGrids(String userId) { + Result> result = new Result>(); + //1:调用epmet-user服务,根据用户Id查询用户访问过的网格列表Id集合 + Result> resultGridIds = epmetUserFeignClient.getGridsByUserId(userId); + if (!resultGridIds.success()) { + throw new RenException(ModuleConstant.SELECT_EXCEPTION); + } + if (null == resultGridIds.getData() || resultGridIds.getData().size() < NumConstant.ONE) { + return result.ok(new ArrayList()); + } + List gridIdList = resultGridIds.getData(); + //2:调用gov-org服务,根据网格Id集合获取网格列表信息 + Result> resultGrids = govOrgFeignClient.getGridListByGridIds(gridIdList); + if (!resultGrids.success()) { + throw new RenException(ModuleConstant.SELECT_EXCEPTION); + } + if (null == resultGrids.getData() || resultGrids.getData().size() < NumConstant.ONE) { + return result.ok(new ArrayList()); + } + return result.ok(resultGrids.getData()); + } } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java index 9fb0533b25..0d9d91c424 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java @@ -28,4 +28,9 @@ public interface ModuleConstant extends Constant { */ String FOR_RESI_CALL="当前接口只限居民端调用"; + /** + * 调用epmet-user服务,查询用户访问过的网格列表失败 + */ + String SELECT_EXCEPTION = "获取用户访问过的网格列表失败"; + } diff --git a/epmet-module/resi-partymember/resi-partymember-server/docker-compose.yml b/epmet-module/resi-partymember/resi-partymember-server/docker-compose.yml index eaff328c77..c62dfd9f51 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/docker-compose.yml +++ b/epmet-module/resi-partymember/resi-partymember-server/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-partymember-server: container_name: resi-partymember-server-dev - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/resi-partymember-server:0.3.9 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/resi-partymember-server:0.3.10 ports: - "8096:8096" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-partymember/resi-partymember-server/pom.xml b/epmet-module/resi-partymember/resi-partymember-server/pom.xml index d087c173b4..5f6dc57fca 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/pom.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.9 + 0.3.10 com.epmet resi-partymember diff --git a/epmet-user/epmet-user-server/docker-compose.yml b/epmet-user/epmet-user-server/docker-compose.yml index 73c69d21de..86efa9857e 100644 --- a/epmet-user/epmet-user-server/docker-compose.yml +++ b/epmet-user/epmet-user-server/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-dev - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/epmet-user-server:0.3.18 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/epmet-user-server:0.3.19 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 1c871f8a2a..e24d852884 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.18 + 0.3.19 com.epmet epmet-user diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java index 6ef6cdab25..6d0344839d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java @@ -103,4 +103,16 @@ public class GridLatestController { public Result getLatestGridInfoByUserId(@PathVariable("userId") String userId){ return gridLatestService.getLatestGridInfoByUserId(userId); } + + /** + * @return + * @param userId + * @Description 根据用户Id查询用户访问过的网格列表Id集合 + * @Author sun + **/ + @PostMapping("getgridsbyuserid/{userId}") + public Result> getGridsByUserId(@PathVariable("userId") String userId){ + return gridLatestService.getGridsByUserId(userId); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java index 86437e3d25..735be62827 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java @@ -22,6 +22,9 @@ import com.epmet.dto.GridLatestDTO; import com.epmet.dto.result.LatestGridInfoResultDTO; import com.epmet.entity.GridLatestEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 @@ -36,8 +39,6 @@ public interface GridLatestDao extends BaseDao { int updateByLatestId(GridLatestDTO dto); - GridLatestEntity getGridLatestByIds(GridLatestDTO formDTO); - /** * @return com.epmet.dto.result.LatestGridInfoResultDTO * @param userId @@ -46,4 +47,12 @@ public interface GridLatestDao extends BaseDao { * @Date 2020/3/24 13:17 **/ LatestGridInfoResultDTO selectLatestGridInfoByUserId(String userId); + + /** + * @return + * @param userId + * @Description 根据用户Id查询用户访问过的网格列表Id集合 + * @Author sun + **/ + List selectAllGridsByUserId(@Param("userId") String userId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java index fc41f0c32d..1833106279 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java @@ -112,4 +112,12 @@ public interface GridLatestService extends BaseService { **/ Result getLatestGridInfoByUserId(String userId); + /** + * @return + * @param userId + * @Description 根据用户Id查询用户访问过的网格列表Id集合 + * @Author sun + **/ + Result> getGridsByUserId(String userId); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java index 345c06e670..a14a1b002c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java @@ -21,10 +21,10 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.GridVisitedConstant; import com.epmet.dao.GridLatestDao; @@ -160,4 +160,16 @@ public class GridLatestServiceImpl extends BaseServiceImpl().ok(latestGridInfoResultDTO); } + /** + * @return + * @param userId + * @Description 根据用户Id查询用户访问过的网格列表Id集合 + * @Author sun + **/ + @Override + public Result> getGridsByUserId(String userId) { + List gridList = baseDao.selectAllGridsByUserId(userId); + return new Result>().ok(gridList); + } + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml index 893ae7819b..b274779697 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml @@ -71,4 +71,14 @@ gl.LATEST_TIME DESC LIMIT 1 + +