Browse Source

Merge branch 'dev_question_naire' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_question_naire

dev_shibei_match
wxz 4 years ago
parent
commit
3f6aa8546a
  1. 10
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/CustomerStaffInfoCacheResult.java
  2. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoCache.java
  3. 10
      epmet-gateway/pom.xml
  4. 4
      epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java
  5. 11
      epmet-gateway/src/main/resources/bootstrap.yml
  6. 17
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/TDuckConstant.java
  7. 7
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/form/TDuckListFormDTO.java
  8. 1
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/result/CascaderDTO.java
  9. 8
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/result/TDuckListResultDTO.java
  10. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/CustomerStaffResultDTO.java
  11. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetTDuckController.java
  12. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmettduck/PrUserProjectDao.java
  13. 89
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmettduck/impl/PrUserProjectServiceImpl.java
  14. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  15. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmettduck/PrUserProjectDao.xml
  16. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

10
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;
/**
* 工作人员所属组织ID的pids
*/
private String agencyPIds;
/**
* 工作人员所属组织名称
*/
@ -57,6 +62,11 @@ public class CustomerStaffInfoCacheResult implements Serializable {
*/
private String headPhoto;
/**
* 工作人员是从哪中组织添加的 组织Id
*/
private String fromOrgId;
/**
* 工作人员是从哪中组织类型添加的 3个值agencygriddept
* @see com.epmet.commons.tools.enums.OrgTypeEnum

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;
/**
* 工作人员所属组织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-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.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>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.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>
<!-- 35、多数据源服务 -->
<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>
@ -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.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.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;
}
} 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()));
} catch (Exception e) {
logger.error("CpAuthGatewayFilterFactory认证出错,错误信息:{}", ExceptionUtils.getErrorStackTrace(e));
logger.error("CpAuthGatewayFilterFactory认证出错Exception,错误信息:{}", ExceptionUtils.getErrorStackTrace(e));
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
uri: @gateway.routes.epmet-openapi-adv-server.url@
order: 35
order: 36
predicates:
- Path=${server.servlet.context-path}/adv/**
filters:
- StripPrefix=1
- 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:
discovery:
server-addr: @nacos.server-addr@
@ -472,6 +480,7 @@ epmet:
- /epmetuser/customerstaff/customerlist
- /gov/project/project/platformcallback
- /oper/customize/customerstartpage/homestartpage
- /tduck-api/**
# 外部应用认证,使用AccessToken等头进行认证
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)
private Integer pageSize;
@NotBlank(message = "orgIds不能为空",groups = TDuckListForm.class)
private String orgIds;
private String orgId;
private String orgType;
@NotBlank(message = "client不能为空",groups = TDuckListForm.class)
private String client;
private String userId;
private String customerId;
}

1
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/result/CascaderDTO.java

@ -35,5 +35,6 @@ public class CascaderDTO implements Serializable {
* 全路径名字
*/
private List<String> labels;
public String pathName;
}

8
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmettduck/result/TDuckListResultDTO.java

@ -79,6 +79,13 @@ public class TDuckListResultDTO implements Serializable {
*/
private Integer recycled;
/**
* 组织名
*/
private String orgName;
private String createdBy;
public TDuckListResultDTO() {
this.customerId = "";
this.key = "";
@ -92,5 +99,6 @@ public class TDuckListResultDTO implements Serializable {
this.client = "";
this.createdTime = "";
this.fillStatus = false;
this.orgName = "";
}
}

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;
/**
* 工作人员所属组织ID的pids
*/
private String agencyPIds;
/**
* 工作人员所属组织名称
*/

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

@ -88,6 +88,7 @@ public class EpmetTDuckController {
public Result<List<TDuckListResultDTO>> queryProjectList(@RequestBody TDuckListFormDTO formDTO,@LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO,TDuckListFormDTO.TDuckListForm.class);
formDTO.setUserId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
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
* @date 2021/9/17 2:16 下午
*/
List<String> selectProjectKey(@Param("orgIds")String orgIds);
List<String> selectProjectKey(@Param("orgIds")List<String> orgIds);
/**
* @Description 根据keys查询project

89
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.NumConstant;
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.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
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.TDuckConstant;
import com.epmet.dataaggre.dao.epmettduck.PrUserProjectDao;
import com.epmet.dataaggre.dao.epmettduck.PrVistRecordDao;
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.PrVistRecordService;
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.PageInfo;
import lombok.extern.slf4j.Slf4j;
@ -83,6 +92,8 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
private GovOrgService govOrgService;
@Resource
private PrVistRecordService prVistRecordService;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override
public PageData<PrUserProjectDTO> page(Map<String, Object> params) {
@ -157,7 +168,39 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
*/
@Override
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)){
return new ArrayList<>();
}
@ -174,9 +217,50 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
}
}
}
result.forEach(r -> {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), r.getCreatedBy());
String orgName = "";
if (null != staffInfo){
if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_AGENCY)){
orgName = staffInfo.getAgencyName();
}else if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_GRID)){
for (IdAndNameDTO g : staffInfo.getGridList()) {
if (g.getId().equals(staffInfo.getFromOrgId())){
orgName = g.getName();
continue;
}
}
}else if (staffInfo.getFromOrgType().equals(TDuckConstant.ORG_TYPE_DEPT)){
for (IdAndNameDTO d : staffInfo.getDeptList()) {
if (d.getId().equals(staffInfo.getFromOrgId())){
orgName = d.getName();
continue;
}
}
}
}
r.setOrgName(orgName);
});
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;
}
/**
* 分析报告
*
@ -385,7 +469,8 @@ public class PrUserProjectServiceImpl extends BaseServiceImpl<PrUserProjectDao,
int totalCount = 0;
Map<String, Integer> resMap = new HashMap<>();
for (PrUserProjectResultEntity res : resultList) {
JSONObject originalData = JSON.parseObject(res.getOriginalData());
//级联组件,用processdata特殊处理下
JSONObject originalData = JSON.parseObject(res.getProcessData());
if(originalData.containsKey(key)){
List<CascaderDTO> dtoList = JSON.parseArray(originalData.get(key).toString(), CascaderDTO.class);
if(CollectionUtils.isEmpty(dtoList)){

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.setAgencyName(agencyDTO.getOrganizationName());
result.setAgencyPIds(agencyDTO.getPids());
StaffOrgRelationResultDTO fromOrgTypeDto = govOrgService.getStaffFromOrgType(staffId);
String fromOrgType = OrgTypeEnum.AGENCY.getCode();
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
FROM pr_publish_range
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>
<!-- 根据keys查询project -->

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

@ -297,6 +297,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
@Override
@Transactional(rollbackFor = Exception.class)
public Result deleteGrid(TokenDto tokenDto,DeleteGridFormDTO deleteGridFormDTO) {
redisUtils.delete(RedisKeys.getGridInfoKey(deleteGridFormDTO.getGridId()))
List<UserIdDTO> userIdDTOS = baseDao.selectUserIdByGrid(deleteGridFormDTO.getGridId());
deleteGridFormDTO.setUserId(tokenDto.getUserId());
if (userIdDTOS.size()==0){

Loading…
Cancel
Save