Browse Source

Merge remote-tracking branch 'origin/dev_question_naire' into dev_question_naire

master
yinzuomei 4 years ago
parent
commit
e920917b8f
  1. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/CustomerStaffInfoCacheResult.java
  2. 9
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  3. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoCache.java
  4. 10
      epmet-gateway/pom.xml
  5. 4
      epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java
  6. 11
      epmet-gateway/src/main/resources/bootstrap.yml
  7. 17
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/TDuckConstant.java
  8. 7
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/form/TDuckListFormDTO.java
  9. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/CustomerStaffResultDTO.java
  10. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetTDuckController.java
  11. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrUserProjectDao.java
  12. 62
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java
  13. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  14. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrUserProjectDao.xml
  15. 12
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  16. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  17. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java
  18. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  19. 28
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  20. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  21. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
  22. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java
  23. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/CustomerStaffInfoCacheResult.java

@ -22,6 +22,11 @@ public class CustomerStaffInfoCacheResult implements Serializable {
*/ */
private String agencyId; private String agencyId;
/**
* 工作人员所属组织ID的pids
*/
private String agencyPIds;
/** /**
* 工作人员所属组织名称 * 工作人员所属组织名称
*/ */

9
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -212,6 +212,15 @@ public class RedisKeys {
return rootPrefix.concat("gov:agency:").concat(agencyId); return rootPrefix.concat("gov:agency:").concat(agencyId);
} }
/**
* 网格信息key
* @param gridId
* @return
*/
public static String getGridByIdKey(String gridId) {
return rootPrefix.concat("gov:grid:").concat(gridId);
}
/** /**
* 客户标签排行 缓存Key * 客户标签排行 缓存Key
* @param customerId * @param customerId

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoCache.java

@ -22,6 +22,11 @@ public class CustomerStaffInfoCache implements Serializable {
*/ */
private String agencyId; private String agencyId;
/**
* 工作人员所属组织ID的pids
*/
private String agencyPIds;
/** /**
* 工作人员所属组织名称 * 工作人员所属组织名称
*/ */

10
epmet-gateway/pom.xml

@ -233,6 +233,9 @@
<!--宣传服务--> <!--宣传服务-->
<gateway.routes.epmet-openapi-adv-server.url>lb://epmet-openapi-adv-server</gateway.routes.epmet-openapi-adv-server.url> <gateway.routes.epmet-openapi-adv-server.url>lb://epmet-openapi-adv-server</gateway.routes.epmet-openapi-adv-server.url>
<!--<gateway.routes.epmet-ext-server.url>lb://127.0.0.1:8115</gateway.routes.epmet-ext-server.url>--> <!--<gateway.routes.epmet-ext-server.url>lb://127.0.0.1:8115</gateway.routes.epmet-ext-server.url>-->
<!--问卷服务-->
<gateway.routes.tduck-api.url>lb://tduck-api</gateway.routes.tduck-api.url>
<!--<gateway.routes.tduck-api.url>http://localhost:8116</gateway.routes.tduck-api.url>-->
<!--钉钉 机器人地址--> <!--钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook> <dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook>
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret> <dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
@ -364,6 +367,9 @@
<!--宣传服务--> <!--宣传服务-->
<gateway.routes.epmet-openapi-adv-server.url>lb://epmet-openapi-adv-server</gateway.routes.epmet-openapi-adv-server.url> <gateway.routes.epmet-openapi-adv-server.url>lb://epmet-openapi-adv-server</gateway.routes.epmet-openapi-adv-server.url>
<!--<gateway.routes.epmet-openapi-adv-server.url>http://localhost:8115</gateway.routes.epmet-openapi-adv-server.url>--> <!--<gateway.routes.epmet-openapi-adv-server.url>http://localhost:8115</gateway.routes.epmet-openapi-adv-server.url>-->
<!--问卷服务-->
<gateway.routes.tduck-api.url>lb://tduck-api</gateway.routes.tduck-api.url>
<!--<gateway.routes.tduck-api.url>http://localhost:8116</gateway.routes.tduck-api.url>-->
<!--钉钉 机器人地址--> <!--钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook> <dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook>
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret> <dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
@ -461,6 +467,8 @@
<gateway.routes.epmet-ext-server.url>lb://epmet-ext-server</gateway.routes.epmet-ext-server.url> <gateway.routes.epmet-ext-server.url>lb://epmet-ext-server</gateway.routes.epmet-ext-server.url>
<!-- 35、多数据源服务 --> <!-- 35、多数据源服务 -->
<gateway.routes.data-aggregator-server.url>lb://data-aggregator-server</gateway.routes.data-aggregator-server.url> <gateway.routes.data-aggregator-server.url>lb://data-aggregator-server</gateway.routes.data-aggregator-server.url>
<!--问卷服务-->
<gateway.routes.tduck-api.url>lb://tduck-api</gateway.routes.tduck-api.url>
<!--宣传服务--> <!--宣传服务-->
<gateway.routes.epmet-openapi-adv-server.url>lb://epmet-openapi-adv-server</gateway.routes.epmet-openapi-adv-server.url> <gateway.routes.epmet-openapi-adv-server.url>lb://epmet-openapi-adv-server</gateway.routes.epmet-openapi-adv-server.url>
@ -561,6 +569,8 @@
<!--宣传服务--> <!--宣传服务-->
<gateway.routes.epmet-openapi-adv-server.url>lb://epmet-openapi-adv-server</gateway.routes.epmet-openapi-adv-server.url> <gateway.routes.epmet-openapi-adv-server.url>lb://epmet-openapi-adv-server</gateway.routes.epmet-openapi-adv-server.url>
<!--问卷服务-->
<gateway.routes.tduck-api.url>lb://tduck-api</gateway.routes.tduck-api.url>
<!--生产钉钉 机器人地址--> <!--生产钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c</dingTalk.robot.webHook> <dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1</dingTalk.robot.secret> <dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1</dingTalk.robot.secret>

4
epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java

@ -105,10 +105,10 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory<CpA
break; break;
} }
} catch (RenException e) { } catch (RenException e) {
logger.error("CpAuthGatewayFilterFactory认证出错,错误信息:{}", ExceptionUtils.getErrorStackTrace(e)); logger.error("CpAuthGatewayFilterFactory认证出错RenException,错误信息:{}", ExceptionUtils.getErrorStackTrace(e));
return response(exchange, new Result<>().error(e.getCode(), e.getMessage())); return response(exchange, new Result<>().error(e.getCode(), e.getMessage()));
} catch (Exception e) { } catch (Exception e) {
logger.error("CpAuthGatewayFilterFactory认证出错,错误信息:{}", ExceptionUtils.getErrorStackTrace(e)); logger.error("CpAuthGatewayFilterFactory认证出错Exception,错误信息:{}", ExceptionUtils.getErrorStackTrace(e));
return response(exchange, new Result<>().error(e.getMessage())); return response(exchange, new Result<>().error(e.getMessage()));
} }

11
epmet-gateway/src/main/resources/bootstrap.yml

@ -336,12 +336,20 @@ spring:
# 宣传服务 # 宣传服务
- id: epmet-openapi-adv-server - id: epmet-openapi-adv-server
uri: @gateway.routes.epmet-openapi-adv-server.url@ uri: @gateway.routes.epmet-openapi-adv-server.url@
order: 35 order: 36
predicates: predicates:
- Path=${server.servlet.context-path}/adv/** - Path=${server.servlet.context-path}/adv/**
filters: filters:
- StripPrefix=1 - StripPrefix=1
- CpAuth=true - CpAuth=true
- id: tduck-api
uri: @gateway.routes.tduck-api.url@
order: 37
predicates:
- Path=${server.servlet.context-path}/tduck-api/**
filters:
- StripPrefix=1
- CpAuth=true
nacos: nacos:
discovery: discovery:
server-addr: @nacos.server-addr@ server-addr: @nacos.server-addr@
@ -472,6 +480,7 @@ epmet:
- /epmetuser/customerstaff/customerlist - /epmetuser/customerstaff/customerlist
- /gov/project/project/platformcallback - /gov/project/project/platformcallback
- /oper/customize/customerstartpage/homestartpage - /oper/customize/customerstartpage/homestartpage
- /tduck-api/**
# 外部应用认证,使用AccessToken等头进行认证 # 外部应用认证,使用AccessToken等头进行认证
externalOpenUrls: externalOpenUrls:

17
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/TDuckConstant.java

@ -0,0 +1,17 @@
package com.epmet.dataaggre.constant;
/**
* @Author zxc
* @DateTime 2021/9/23 4:06 下午
* @DESC
*/
public interface TDuckConstant {
String CLIENT_GOV = "gov";
String CLIENT_RESI = "resi";
String ORG_TYPE_AGENCY = "agency";
String ORG_TYPE_GRID = "grid";
String ORG_TYPE_DEPT = "dept";
}

7
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/form/TDuckListFormDTO.java

@ -30,11 +30,14 @@ public class TDuckListFormDTO implements Serializable {
@NotNull(message = "pageSize不能为空",groups = TDuckListForm.class) @NotNull(message = "pageSize不能为空",groups = TDuckListForm.class)
private Integer pageSize; private Integer pageSize;
@NotBlank(message = "orgIds不能为空",groups = TDuckListForm.class) private String orgId;
private String orgIds;
private String orgType;
@NotBlank(message = "client不能为空",groups = TDuckListForm.class) @NotBlank(message = "client不能为空",groups = TDuckListForm.class)
private String client; private String client;
private String userId; private String userId;
private String customerId;
} }

5
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/CustomerStaffResultDTO.java

@ -21,6 +21,11 @@ public class CustomerStaffResultDTO implements Serializable {
*/ */
private String agencyId; private String agencyId;
/**
* 工作人员所属组织ID的pids
*/
private String agencyPIds;
/** /**
* 工作人员所属组织名称 * 工作人员所属组织名称
*/ */

1
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetTDuckController.java

@ -81,6 +81,7 @@ public class EpmetTDuckController {
public Result<List<TDuckListResultDTO>> queryProjectList(@RequestBody TDuckListFormDTO formDTO,@LoginUser TokenDto tokenDto){ public Result<List<TDuckListResultDTO>> queryProjectList(@RequestBody TDuckListFormDTO formDTO,@LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO,TDuckListFormDTO.TDuckListForm.class); ValidatorUtils.validateEntity(formDTO,TDuckListFormDTO.TDuckListForm.class);
formDTO.setUserId(tokenDto.getUserId()); formDTO.setUserId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<List<TDuckListResultDTO>>().ok(prUserProjectService.queryProjectList(formDTO)); return new Result<List<TDuckListResultDTO>>().ok(prUserProjectService.queryProjectList(formDTO));
} }

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrUserProjectDao.java

@ -55,7 +55,7 @@ public interface PrUserProjectDao extends BaseDao<PrUserProjectEntity> {
* @author zxc * @author zxc
* @date 2021/9/17 2:16 下午 * @date 2021/9/17 2:16 下午
*/ */
List<String> selectProjectKey(@Param("orgIds")String orgIds); List<String> selectProjectKey(@Param("orgIds")List<String> orgIds);
/** /**
* @Description 根据keys查询project * @Description 根据keys查询project

62
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java

@ -27,10 +27,16 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.IdAndNameDTO;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.constant.TDuckConstant;
import com.epmet.dataaggre.dao.epmettduck.PrUserProjectDao; import com.epmet.dataaggre.dao.epmettduck.PrUserProjectDao;
import com.epmet.dataaggre.dao.epmettduck.PrVistRecordDao; import com.epmet.dataaggre.dao.epmettduck.PrVistRecordDao;
import com.epmet.dataaggre.dto.epmettduck.PrPublishRangeDTO; import com.epmet.dataaggre.dto.epmettduck.PrPublishRangeDTO;
@ -49,6 +55,9 @@ import com.epmet.dataaggre.service.epmettduck.PrPublishRangeService;
import com.epmet.dataaggre.service.epmettduck.PrUserProjectService; import com.epmet.dataaggre.service.epmettduck.PrUserProjectService;
import com.epmet.dataaggre.service.epmettduck.PrVistRecordService; import com.epmet.dataaggre.service.epmettduck.PrVistRecordService;
import com.epmet.dataaggre.service.govorg.GovOrgService; import com.epmet.dataaggre.service.govorg.GovOrgService;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -83,6 +92,8 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
private GovOrgService govOrgService; private GovOrgService govOrgService;
@Resource @Resource
private PrVistRecordService prVistRecordService; private PrVistRecordService prVistRecordService;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override @Override
public PageData<PrUserProjectDTO> page(Map<String, Object> params) { public PageData<PrUserProjectDTO> page(Map<String, Object> params) {
@ -157,7 +168,39 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
*/ */
@Override @Override
public List<TDuckListResultDTO> queryProjectList(TDuckListFormDTO formDTO) { public List<TDuckListResultDTO> queryProjectList(TDuckListFormDTO formDTO) {
List<String> projectKeys = baseDao.selectProjectKey(formDTO.getOrgIds()); List<String> orgIds = new ArrayList<>();
if (formDTO.getClient().equals(TDuckConstant.CLIENT_GOV)){
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
String pids = staffInfo.getAgencyPIds();
String agencyId = staffInfo.getAgencyId();
if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_DEPT)){
List<IdAndNameDTO> deptList = staffInfo.getDeptList();
if (CollectionUtils.isEmpty(deptList)){
return new ArrayList<>();
}
orgIds = joint(pids,agencyId,deptList);
}else if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_GRID)){
List<IdAndNameDTO> gridList = staffInfo.getGridList();
if (CollectionUtils.isEmpty(gridList)){
return new ArrayList<>();
}
orgIds = joint(pids,agencyId,gridList);
}else {
String selfOrg = pids + ":" + agencyId;
orgIds.add(selfOrg);
}
}else {
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO();
customerGridFormDTO.setGridId(formDTO.getOrgId());
Result<CustomerGridDTO> gridResult = govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO);
if (!gridResult.success()){
throw new RenException("查询网格信息失败了...");
}
CustomerGridDTO data = gridResult.getData();
String oneOrg = data.getPids() + ":" + data.getId();
orgIds.add(oneOrg);
}
List<String> projectKeys = baseDao.selectProjectKey(orgIds);
if (CollectionUtils.isEmpty(projectKeys)){ if (CollectionUtils.isEmpty(projectKeys)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -177,6 +220,23 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
return result; return result;
} }
/**
* @Description orgIds拼接
* @Param pids
* @Param agencyId
* @Param list
* @author zxc
* @date 2021/9/23 4:48 下午
*/
public List<String> joint(String pids, String agencyId, List<IdAndNameDTO> list){
List<String> orgIds = new ArrayList<>();
list.forEach(l -> {
String oneOrg = pids + ":" + agencyId + ":" + l.getId();
orgIds.add(oneOrg);
});
return orgIds;
}
/** /**
* 分析报告 * 分析报告
* *

1
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -600,6 +600,7 @@ public class EpmetUserServiceImpl implements EpmetUserService {
} }
result.setAgencyId(agencyDTO.getId()); result.setAgencyId(agencyDTO.getId());
result.setAgencyName(agencyDTO.getOrganizationName()); result.setAgencyName(agencyDTO.getOrganizationName());
result.setAgencyPIds(agencyDTO.getPids());
StaffOrgRelationResultDTO fromOrgTypeDto = govOrgService.getStaffFromOrgType(staffId); StaffOrgRelationResultDTO fromOrgTypeDto = govOrgService.getStaffFromOrgType(staffId);
String fromOrgType = OrgTypeEnum.AGENCY.getCode(); String fromOrgType = OrgTypeEnum.AGENCY.getCode();
if (fromOrgTypeDto != null){ if (fromOrgTypeDto != null){

6
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrUserProjectDao.xml

@ -73,7 +73,11 @@
DISTINCT project_key DISTINCT project_key
FROM pr_publish_range FROM pr_publish_range
WHERE del_flag = 0 WHERE del_flag = 0
AND #{orgIds} LIKE CONCAT(org_ids,'%') AND (
<foreach collection="orgIds" item="orgId" separator=" OR ">
#{orgId} LIKE CONCAT(org_ids,'%')
</foreach>
)
</select> </select>
<!-- 根据keys查询project --> <!-- 根据keys查询project -->

12
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -427,4 +427,16 @@ public interface GovOrgOpenFeignClient {
*/ */
@PostMapping("/gov/org/customeragency/getAgencyInfo") @PostMapping("/gov/org/customeragency/getAgencyInfo")
Result<OrgResultDTO> getAgencyInfo(@RequestBody OrgFormDTO formDTO); Result<OrgResultDTO> getAgencyInfo(@RequestBody OrgFormDTO formDTO);
/**
* desc: 获取网格基础数据
*
* @param customerGridFormDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.CustomerGridDTO>
* @author LiuJanJun
* @date 2021/4/19 11:19 上午
*/
@PostMapping("/gov/org/grid/getbaseinfo")
Result<CustomerGridDTO> getGridBaseInfoByGridId(CustomerGridFormDTO customerGridFormDTO);
} }

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java

@ -261,6 +261,11 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyInfo", formDTO); return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyInfo", formDTO);
} }
@Override
public Result<CustomerGridDTO> getGridBaseInfoByGridId(CustomerGridFormDTO customerGridFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridBaseInfoByGridId", customerGridFormDTO);
}
@Override @Override
public Result<String> selectPidsByGridId(String gridId) { public Result<String> selectPidsByGridId(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectPidsByGridId", gridId); return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectPidsByGridId", gridId);

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java

@ -179,6 +179,7 @@ public class GridController {
*/ */
@PostMapping("getbaseinfo") @PostMapping("getbaseinfo")
public Result<CustomerGridDTO> getBaseInfo(@RequestBody CustomerGridFormDTO customerGridFormDTO) { public Result<CustomerGridDTO> getBaseInfo(@RequestBody CustomerGridFormDTO customerGridFormDTO) {
return customerGridService.getBaseInfo(customerGridFormDTO); CustomerGridDTO gridInfo = customerGridService.getBaseInfo(customerGridFormDTO);
return new Result<CustomerGridDTO>().ok(gridInfo);
} }
} }

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java

@ -286,7 +286,7 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @author LiuJanJun * @author LiuJanJun
* @date 2021/4/19 11:53 上午 * @date 2021/4/19 11:53 上午
*/ */
Result<CustomerGridDTO> getBaseInfo(CustomerGridFormDTO customerGridFormDTO); CustomerGridDTO getBaseInfo(CustomerGridFormDTO customerGridFormDTO);
/** /**
* @Description 根据网格ID查询pids * @Description 根据网格ID查询pids

28
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -26,6 +27,8 @@ import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
@ -77,6 +80,9 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
@Autowired @Autowired
private CustomerGridDao customerGridDao; private CustomerGridDao customerGridDao;
@Autowired
private RedisUtils redisUtils;
@Override @Override
public PageData<CustomerGridDTO> page(Map<String, Object> params) { public PageData<CustomerGridDTO> page(Map<String, Object> params) {
IPage<CustomerGridEntity> page = baseDao.selectPage( IPage<CustomerGridEntity> page = baseDao.selectPage(
@ -712,13 +718,23 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
} }
@Override @Override
public Result<CustomerGridDTO> getBaseInfo(CustomerGridFormDTO customerGridFormDTO) { public CustomerGridDTO getBaseInfo(CustomerGridFormDTO customerGridFormDTO) {
CustomerGridDTO restltDTO = ConvertUtils.sourceToTarget(baseDao.selectById(customerGridFormDTO.getGridId()), CustomerGridDTO.class); String redisKey = RedisKeys.getGridByIdKey(customerGridFormDTO.getGridId());
if (null != restltDTO) { Map<String, Object> gridCache = redisUtils.hGetAll(redisKey);
CustomerAgencyEntity entity = customerAgencyService.selectById(restltDTO.getPid()); if (gridCache != null && gridCache.size() > 0) {
restltDTO.setAgencyName(null != entity ? entity.getOrganizationName() : ""); // 直接取缓存中的
CustomerGridDTO gridInfo = BeanUtil.mapToBean(gridCache, CustomerGridDTO.class, true);
return gridInfo;
} }
return new Result<CustomerGridDTO>().ok(restltDTO);
CustomerGridDTO gridInfo = ConvertUtils.sourceToTarget(baseDao.selectById(customerGridFormDTO.getGridId()), CustomerGridDTO.class);
if (null != gridInfo) {
CustomerAgencyEntity entity = customerAgencyService.selectById(gridInfo.getPid());
gridInfo.setAgencyName(null != entity ? entity.getOrganizationName() : "");
}
redisUtils.hMSet(redisKey, BeanUtil.beanToMap(gridInfo));
return gridInfo;
} }
/** /**

4
epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java

@ -47,7 +47,7 @@ public interface GovOrgFeignClient {
* @author LiuJanJun * @author LiuJanJun
* @date 2021/4/19 11:19 上午 * @date 2021/4/19 11:19 上午
*/ */
@PostMapping("/gov/org/grid/getbaseinfo") //@PostMapping("/gov/org/grid/getbaseinfo")
Result<CustomerGridDTO> getGridBaseInfoByGridId(CustomerGridFormDTO customerGridFormDTO); //Result<CustomerGridDTO> getGridBaseInfoByGridId(CustomerGridFormDTO customerGridFormDTO);
} }

8
epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java

@ -29,8 +29,8 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridStaffs", gridIdFormDTO); return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridStaffs", gridIdFormDTO);
} }
@Override //@Override
public Result<CustomerGridDTO> getGridBaseInfoByGridId(CustomerGridFormDTO customerGridFormDTO) { //public Result<CustomerGridDTO> getGridBaseInfoByGridId(CustomerGridFormDTO customerGridFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridBaseInfoByGridId", customerGridFormDTO); // return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridBaseInfoByGridId", customerGridFormDTO);
} //}
} }

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java

@ -40,6 +40,7 @@ import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.entity.RegisterRelationEntity; import com.epmet.entity.RegisterRelationEntity;
import com.epmet.entity.UserCustomerEntity; import com.epmet.entity.UserCustomerEntity;
import com.epmet.feign.GovOrgFeignClient; import com.epmet.feign.GovOrgFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.GridVisitedService; import com.epmet.service.GridVisitedService;
import com.epmet.service.RegisterRelationService; import com.epmet.service.RegisterRelationService;
import com.epmet.util.ModuleConstant; import com.epmet.util.ModuleConstant;
@ -72,6 +73,9 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl<RegisterRelatio
@Autowired @Autowired
private GovOrgFeignClient govOrgFeignClient; private GovOrgFeignClient govOrgFeignClient;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired @Autowired
private UserCustomerDao userCustomerDao; private UserCustomerDao userCustomerDao;
@ -299,7 +303,7 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl<RegisterRelatio
private boolean setGridName(UserInfoOnEnterGridResultDTO resultObj, String gridId) { private boolean setGridName(UserInfoOnEnterGridResultDTO resultObj, String gridId) {
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO();
customerGridFormDTO.setGridId(gridId); customerGridFormDTO.setGridId(gridId);
Result<CustomerGridDTO> gridDTOResult = govOrgFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); Result<CustomerGridDTO> gridDTOResult = govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO);
if(gridDTOResult.success() && null != gridDTOResult.getData()){ if(gridDTOResult.success() && null != gridDTOResult.getData()){
resultObj.setCurrentGridName(gridDTOResult.getData().getGridName()); resultObj.setCurrentGridName(gridDTOResult.getData().getGridName());
resultObj.setOrgId(resultObj.getCurrentGridId()); resultObj.setOrgId(resultObj.getCurrentGridId());

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java

@ -24,6 +24,7 @@ import com.epmet.entity.StaffPatrolDetailEntity;
import com.epmet.entity.StaffPatrolRecordEntity; import com.epmet.entity.StaffPatrolRecordEntity;
import com.epmet.entity.StatsStaffPatrolRecordDailyEntity; import com.epmet.entity.StatsStaffPatrolRecordDailyEntity;
import com.epmet.feign.GovOrgFeignClient; import com.epmet.feign.GovOrgFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.GovProjectOpenFeignClient; import com.epmet.feign.GovProjectOpenFeignClient;
import com.epmet.service.StaffPatrolDetailService; import com.epmet.service.StaffPatrolDetailService;
import com.epmet.service.StaffPatrolRecordService; import com.epmet.service.StaffPatrolRecordService;
@ -56,6 +57,9 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec
private StaffPatrolDetailService staffPatrolDetailService; private StaffPatrolDetailService staffPatrolDetailService;
@Resource @Resource
private GovOrgFeignClient govOrgFeignClient; private GovOrgFeignClient govOrgFeignClient;
// 这是是来自org-client的,以后都用这个就好了
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired @Autowired
private CustomerStaffDao customerStaffDao; private CustomerStaffDao customerStaffDao;
@ -106,7 +110,7 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec
if (PatrolConstant.PATROLLING.equals(entity.getStatus())) { if (PatrolConstant.PATROLLING.equals(entity.getStatus())) {
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO();
customerGridFormDTO.setGridId(entity.getGrid()); customerGridFormDTO.setGridId(entity.getGrid());
Result<CustomerGridDTO> gridResult = govOrgFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); Result<CustomerGridDTO> gridResult = govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO);
if (!gridResult.success() || null == gridResult.getData()) { if (!gridResult.success() || null == gridResult.getData()) {
//查询网格名称失败 //查询网格名称失败
log.error(String.format("查找网格信息失败,网格Id:【%s】", entity.getGrid())); log.error(String.format("查找网格信息失败,网格Id:【%s】", entity.getGrid()));
@ -141,7 +145,7 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl<StaffPatrolRec
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO();
customerGridFormDTO.setGridId(formDTO.getGridId()); customerGridFormDTO.setGridId(formDTO.getGridId());
Result<CustomerGridDTO> gridResult = govOrgFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); Result<CustomerGridDTO> gridResult = govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO);
if (!gridResult.success() || null == gridResult.getData()) { if (!gridResult.success() || null == gridResult.getData()) {
//查询网格名称失败 //查询网格名称失败
log.error(String.format("查找网格信息失败,网格Id:【%s】", formDTO.getGridId())); log.error(String.format("查找网格信息失败,网格Id:【%s】", formDTO.getGridId()));

Loading…
Cancel
Save