Browse Source

根据userId查询网格列表

dev
sunyuchao 5 years ago
parent
commit
56980799b5
  1. 18
      epmet-module/gov-mine/gov-mine-server/pom.xml
  2. 33
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  3. 55
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java
  4. 14
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  5. 10
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
  6. 2
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/StaffAgencyRedis.java
  7. 16
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java
  8. 25
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java
  9. 30
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridByUserIdResultDTO.java
  10. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  11. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  12. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  13. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  14. 16
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

18
epmet-module/gov-mine/gov-mine-server/pom.xml

@ -55,6 +55,24 @@
<artifactId>feign-httpclient</artifactId>
<version>10.3.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>gov-org-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>gov-org-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>gov-org-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

33
epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -1,33 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
/**
* 机关单位信息表
*
* @author generator generator@elink-cn.com
*/
@RestController
@RequestMapping("agency")
public class CustomerAgencyController {
@Autowired
private CustomerAgencyService customerAgencyService;
}

55
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<List<CustomerGridByUserIdResultDTO>> getMyGrids(@LoginUser TokenDto tokenDTO) {
return staffAgencyService.getMyGrids(tokenDTO);
}
}

14
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<List<CustomerGridByUserIdResultDTO>> getMyGrids(@PathVariable("userId") String userId);
}

10
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<List<CustomerGridByUserIdResultDTO>> getMyGrids(String userId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getMyGrids", userId);
}
}

2
epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/CustomerAgencyRedis.java → 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;

16
epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java → 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<CustomerAgencyEntity> {
public interface StaffAgencyService {
/**
* @param tokenDTO
* @return
* @Description 根据userId查询该用户涉及的所有网格列表
* @Author sun
*/
Result<List<CustomerGridByUserIdResultDTO>> getMyGrids(TokenDto tokenDTO);
}

25
epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java → 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<CustomerAgencyDao, CustomerAgencyEntity> 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<List<CustomerGridByUserIdResultDTO>> getMyGrids(TokenDto tokenDTO) {
return govOrgFeignClient.getMyGrids(tokenDTO.getUserId());
}
}

30
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;
}

11
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<CustomerGridDTO>().ok(data);
}
/**
* @param userId
* @return
* @Description 根据userId查询该用户涉及的所有网格列表
* @Author sun
*/
@PostMapping("getmygrids/{userId}")
public Result<List<CustomerGridByUserIdResultDTO>> getMyGrids(@PathVariable("userId") String userId) {
return customerGridService.getMyGrids(userId);
}
}

8
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<CustomerGridEntity> {
CustomerGridDTO getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO);
/**
* @param userId
* @return
* @Description 根据userId查询该用户涉及的所有网格列表
* @Author sun
*/
List<CustomerGridByUserIdResultDTO> getMyGrids(String userId);
}

8
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<CustomerGridEntity> {
*/
Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO);
/**
* @param userId
* @return
* @Description 根据userId查询该用户涉及的所有网格列表
* @Author sun
*/
Result<List<CustomerGridByUserIdResultDTO>> getMyGrids(String userId);
}

12
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<CustomerGridDao, Cu
return new Result<CustomerGridDTO>().ok(baseDao.getCustomerGridByGridId(customerGridFormDTO));
}
/**
* @param userId
* @return
* @Description 根据userId查询该用户涉及的所有网格列表
* @Author sun
*/
@Override
public Result<List<CustomerGridByUserIdResultDTO>> getMyGrids(String userId) {
return new Result<List<CustomerGridByUserIdResultDTO>>().ok(baseDao.getMyGrids(userId));
}
}

16
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -93,4 +93,20 @@
</select>
<select id="getMyGrids" resultType="com.epmet.dto.result.CustomerGridByUserIdResultDTO">
SELECT
cg.id AS 'gridId',
cg.grid_name AS 'gridName',
cg.pid AS 'agencyId'
FROM
customer_grid cg
INNER JOIN customer_staff_grid csg ON cg.id = csg.grid_id
WHERE
cg.del_flag = '0'
AND csg.del_flag = '0'
AND csg.user_id = #{userId}
ORDER BY
cg.created_time DESC
</select>
</mapper>
Loading…
Cancel
Save