Browse Source

Merge branch 'dev' into dev_temp

master
zhaoqifeng 5 years ago
parent
commit
e0f6741883
  1. 36
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CommonCustomerIdAndSrcFormDTO.java
  2. 27
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CommonCustomerIdFormDTO.java
  3. 26
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthAccessTokenClientResultDTO.java
  4. 41
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerTokensResultDTO.java
  5. 2
      epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml
  6. 2
      epmet-module/epmet-third/epmet-third-server/pom.xml
  7. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java
  8. 30
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java
  9. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java
  10. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java
  11. 18
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java
  12. 20
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java
  13. 56
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java
  14. 12
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml
  15. 11
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentAccessTokenDao.xml
  16. 50
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml
  17. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java
  18. 12
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  19. 2
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml

36
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CommonCustomerIdAndSrcFormDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 公众号客户删除入参DTO
* @NEI https://nei.netease.com/interface/detail/?pid=52285&id=323482
* @ClassName CommonCustomerIdAndSrcFormDTO
* @Auth wangc
* @Date 2020-08-25 11:02
*/
@Data
public class CommonCustomerIdAndSrcFormDTO implements Serializable {
private static final long serialVersionUID = -2945388338786885295L;
public interface CustomerAndSrcGroup extends CustomerClientShowGroup{}
/**
* 客户Id
* */
@NotBlank(message = "客户Id不能为空",groups = CustomerAndSrcGroup.class)
private String customerId;
/**
* 数据来源(dev:开发 test:体验 prod:生产)
* */
@NotBlank(message = "数据来源不能为空",groups = CustomerAndSrcGroup.class)
private String source;
@NotBlank(message = "用户Id不能为空",groups = CustomerAndSrcGroup.class)
private String userId;
}

27
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CommonCustomerIdFormDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 获取客户第三方token 入参DTO
* @NEI https://nei.netease.com/interface/detail/?pid=52285&id=323480
* @ClassName CommonCustomerIdFormDTO
* @Auth wangc
* @Date 2020-08-25 10:57
*/
@Data
public class CommonCustomerIdFormDTO implements Serializable {
private static final long serialVersionUID = 3160741101286756024L;
public interface PaCustomerIdGroup extends CustomerClientShowGroup{}
/**
* 客户Id
* */
@NotBlank(message = "客户Id不能为空" , groups = PaCustomerIdGroup.class)
private String customerId;
}

26
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthAccessTokenClientResultDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 授权accessToken和app端的查询返参
* @ClassName AuthAccessTokenClientResultDTO
* @Auth wangc
* @Date 2020-08-25 13:41
*/
@Data
public class AuthAccessTokenClientResultDTO implements Serializable {
private static final long serialVersionUID = -642465145534993509L;
/**
* 客户端类型
* */
private String clientType;
/**
* 调用令牌
* */
private String accessToken;
}

41
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerTokensResultDTO.java

@ -0,0 +1,41 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @ClassName CustomerTokensResultDTO
* @Auth wangc
* @Date 2020-08-25 11:16
*/
@Data
public class CustomerTokensResultDTO implements Serializable {
private static final long serialVersionUID = -6811282503588315365L;
/**
* 客户Id
* */
private String customerId = "";
/**
* 客户名称
* */
private String customerName = "";
/**
* 第三方token
* */
private String componentAccessToken = "";
/**
* 授权方居民端token
* */
private String resiAuthorizerToken = "";
/**
* 授权方工作端token
* */
private String workAuthorizerToken = "";
}

2
epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-third-server:
container_name: epmet-third-server-prod
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-third-server:0.0.131
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-third-server:0.0.135
ports:
- "8110:8110"
network_mode: host # 使用现有网络

2
epmet-module/epmet-third/epmet-third-server/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.0.134</version>
<version>0.0.135</version>
<parent>
<groupId>com.epmet</groupId>

4
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java

@ -116,5 +116,9 @@ public interface ModuleConstant {
int EIGHTY_NINE_THOUSAND_AND_THREE = 89003;
int EIGHTY_NINE_THOUSAND_AND_FOUR = 89004;
/**
* 数据来源 生产环境
* */
String SRC_PROD = "prod";
}

30
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java

@ -192,5 +192,35 @@ public class PaCustomerController {
return new Result<PageData>().ok(pageData);
}
/**
* @Description 获取客户第三方token
* @NEI https://nei.netease.com/interface/detail/req/?pid=52285&id=323480
* @param param CommonCustomerIdFormDTO.class
* @return Result<CustomerTokensResultDTO>
* @author wangc
* @date 2020.08.25 15:39
**/
@PostMapping("tokenlist")
public Result<CustomerTokensResultDTO> tokenList(@RequestBody CommonCustomerIdFormDTO param){
ValidatorUtils.validateEntity(param, CustomerUserFormDTO.CustomerIdGroup.class);
return new Result<CustomerTokensResultDTO>().ok(paCustomerService.tokenList(param));
}
/**
* @Description 公众号客户删除
* @NEI https://nei.netease.com/interface/detail/?pid=52285&id=323482
* @param token
* @param param
* @return
* @author wangc
* @date 2020.08.25 15:46
**/
@PostMapping("deletepubliccustomer")
public Result deletePublicCustomer(@LoginUser TokenDto token , @RequestBody CommonCustomerIdAndSrcFormDTO param){
param.setUserId(token.getUserId());
ValidatorUtils.validateEntity(param, CommonCustomerIdAndSrcFormDTO.CustomerAndSrcGroup.class);
paCustomerService.clearPublicCustomer(param);
return new Result();
}
}

9
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java

@ -22,6 +22,7 @@ import com.epmet.dto.AuthorizationInfoDTO;
import com.epmet.dto.form.AuthorizationInfoFormDTO;
import com.epmet.dto.form.AuthorizerAccessTokenFormDTO;
import com.epmet.dto.form.CustomerAccessTokenInfoFormDTO;
import com.epmet.dto.result.AuthAccessTokenClientResultDTO;
import com.epmet.dto.result.AuthCodeResultDTO;
import com.epmet.dto.result.CustomerAccessTokenInfoResultDTO;
import com.epmet.dto.result.WillOverDueResultDTO;
@ -109,4 +110,12 @@ public interface AuthorizationInfoDao extends BaseDao<AuthorizationInfoEntity> {
*/
List<CustomerAccessTokenInfoResultDTO> getCustomerAccessTokenInfo(CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO);
/**
* @Description 查询来源端对应的accessToken
* @param customerId
* @return List<AuthAccessTokenClientResultDTO>
* @author wangc
* @date 2020.08.25 15:24
**/
List<AuthAccessTokenClientResultDTO> selectClientToken(@Param("customerId") String customerId);
}

9
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java

@ -69,4 +69,13 @@ public interface ComponentAccessTokenDao extends BaseDao<ComponentAccessTokenEnt
*/
String getComponentAccessToken();
/**
* @Description 查询ComponentAccessToken唯一
* @param
* @return String
* @author wangc
* @date 2020.08.25 15:14
**/
String selectComponentAccessToken();
}

18
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java

@ -102,4 +102,22 @@ public interface PaCustomerDao extends BaseDao<PaCustomerEntity> {
* @Description 查询客户及管理员信息
*/
CustomerAndUserResultDTO selectCustomerAndUser(@Param("customerId") String customerId);
/**
* @Description 清除第三方库中客户的信息
* @param customerId
* @return
* @author wangc
* @date 2020.08.26 10:44
**/
void clearCustomerInfo(@Param("customerId") String customerId);
/**
* @Description 根据客户Id查询当前客户的来源
* @param customerId
* @return
* @author wangc
* @date 2020.08.26 10:59
**/
String selectSourceById(@Param("customerId") String customerId,@Param("source") String source);
}

20
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java

@ -213,4 +213,24 @@ public interface PaCustomerService extends BaseService<PaCustomerEntity> {
* @return com.epmet.commons.tools.page.PageData
*/
PageData getCustomerList(UploadListFormDTO formDTO);
/**
* @Description 获取客户第三方token
* @NEI https://nei.netease.com/interface/detail/res/?pid=52285&id=323480
* @param param
* @return
* @author wangc
* @date 2020.08.25 14:51
**/
CustomerTokensResultDTO tokenList(CommonCustomerIdFormDTO param);
/**
* @Description 公众号客户删除
* @NEI https://nei.netease.com/interface/detail/?pid=52285&id=323482
* @param param
* @return
* @author wangc
* @date 2020.08.25 15:46
**/
void clearPublicCustomer(CommonCustomerIdAndSrcFormDTO param);
}

56
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java

@ -31,6 +31,8 @@ import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.constant.CodeConstant;
import com.epmet.constant.ModuleConstant;
import com.epmet.constant.PaConstant;
import com.epmet.dao.*;
import com.epmet.dto.*;
@ -102,6 +104,8 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
private WxMaCodeService wxMaCodeService;
@Autowired
private AuthorizationInfoDao authorizationInfoDao;
@Autowired
private ComponentAccessTokenDao componentAccessTokenDao;
@Override
public PageData<PaCustomerDTO> page(Map<String, Object> params) {
@ -641,4 +645,56 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
return new PageData<>(list, pageInfo.getTotal());
}
/**
* @Description 获取客户第三方token
* @NEI https://nei.netease.com/interface/detail/res/?pid=52285&id=323480
* @param param
* @return
* @author wangc
* @date 2020.08.25 14:51
**/
@Override
public CustomerTokensResultDTO tokenList(CommonCustomerIdFormDTO param) {
CustomerTokensResultDTO result = new CustomerTokensResultDTO();
String customerName = baseDao.selectCustomerName(param.getCustomerId());
String componentAccessToken = componentAccessTokenDao.selectComponentAccessToken();
List<AuthAccessTokenClientResultDTO> clientList = authorizationInfoDao.selectClientToken(param.getCustomerId());
result.setCustomerId(param.getCustomerId());
result.setComponentAccessToken(StringUtils.isBlank(componentAccessToken) ? "" : componentAccessToken);
result.setCustomerName(StringUtils.isBlank(customerName) ? "" : customerName);
if(null != clientList || !clientList.isEmpty()){
clientList.forEach(client -> {
if(StringUtils.equals(CodeConstant.WORK,client.getClientType())){
result.setWorkAuthorizerToken(client.getAccessToken());
}else if(StringUtils.equals(CodeConstant.RESI,client.getClientType())){
result.setResiAuthorizerToken(client.getAccessToken());
}
});
}
return result;
}
/**
* @Description 公众号客户删除
* @NEI https://nei.netease.com/interface/detail/?pid=52285&id=323482
* @param param
* @return
* @author wangc
* @date 2020.08.25 15:46
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void clearPublicCustomer(CommonCustomerIdAndSrcFormDTO param) {
if(StringUtils.equals(ModuleConstant.SRC_PROD,param.getSource())){
logger.warn("有人试图删除用户的生产数据,试图删除的客户Id:{},操作者Id:{}",param.getCustomerId(),param.getUserId());
throw new RenException("禁止对生产环境数据进行删除操作!");
}
String check = baseDao.selectSourceById(param.getCustomerId(),param.getSource());
if (!StringUtils.equals(check,param.getCustomerId())) {
logger.warn("com.epmet.service.impl.PaCustomerServiceImpl.clearPublicCustomer,客户来源信息不匹配,客户Id:{},来源:{}",param.getCustomerId(),param.getSource());
return ;
}
baseDao.clearCustomerInfo(param.getCustomerId());
}
}

12
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml

@ -121,4 +121,16 @@
</if>
</select>
<!-- 查询来源端对应的accessToken -->
<select id="selectClientToken" resultType="com.epmet.dto.result.AuthAccessTokenClientResultDTO">
SELECT
CLIENT_TYPE,
AUTHORIZER_ACCESS_TOKEN AS accessToken
FROM
authorization_info
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
</select>
</mapper>

11
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentAccessTokenDao.xml

@ -48,4 +48,15 @@
AND (UNIX_TIMESTAMP(expires_in_time) - UNIX_TIMESTAMP(NOW())) <![CDATA[ <= ]]> 900
</select>
<!-- 查询ComponentAccessToken【唯一】 -->
<select id="selectComponentAccessToken" resultType="java.lang.String">
SELECT
COMPONENT_ACCESS_TOKEN
FROM
component_access_token
WHERE
DEL_FLAG = '0'
ORDER BY UPDATED_TIME DESC
LIMIT 1
</select>
</mapper>

50
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml

@ -146,4 +146,54 @@
AND id = #{oldCustomerId}
</update>
<!-- 清除用户信息 -->
<delete id="clearCustomerInfo">
DELETE FROM auth_code WHERE CUSTOMER_ID = #{customerId};
DELETE FROM auth_result_record WHERE CUSTOMER_ID = #{customerId};
DELETE FROM authorization_info WHERE CUSTOMER_ID = #{customerId};
DELETE FROM binding_account WHERE CUSTOMER_ID = #{customerId};
DELETE FROM business_info WHERE CUSTOMER_ID = #{customerId};
DELETE FROM code_audit_record WHERE CUSTOMER_ID = #{customerId};
DELETE FROM code_audit_result WHERE CUSTOMER_ID = #{customerId};
DELETE FROM code_customer WHERE CUSTOMER_ID = #{customerId};
DELETE FROM code_operation_history WHERE CUSTOMER_ID = #{customerId};
DELETE FROM customer_mp WHERE CUSTOMER_ID = #{customerId};
DELETE FROM func_info WHERE CUSTOMER_ID = #{customerId};
DELETE FROM mini_category_info WHERE CUSTOMER_ID = #{customerId};
DELETE FROM mini_info WHERE CUSTOMER_ID = #{customerId};
DELETE FROM mini_network_info WHERE CUSTOMER_ID = #{customerId};
DELETE FROM open_platform_account WHERE CUSTOMER_ID = #{customerId};
DELETE FROM pa_customer_agency WHERE CUSTOMER_ID = #{customerId};
DELETE FROM pa_customer_user_agency WHERE CUSTOMER_ID = #{customerId};
DELETE FROM pa_customer WHERE ID = #{customerId};
</delete>
<!-- 根据客户Id查询当前客户的来源 -->
<select id="selectSourceById" resultType="java.lang.String">
SELECT
ID
FROM
PA_CUSTOMER
WHERE
ID = #{customerId}
AND
SOURCE = #{source}
</select>
</mapper>

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java

@ -51,7 +51,7 @@ public class ProjectDetailResultDTO implements Serializable {
/**
* 是否是转项目节点
*/
private Boolean isCreated;
private Boolean returnable;
/**
* 当前跟进部门
*/

12
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java

@ -266,7 +266,7 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
ProjectDetailResultDTO resultDTO = baseDao.selectProjectDetail(fromDTO.getProjectId());
if (ProjectConstant.CLOSED.equals(resultDTO.getProjectStatus())) {
resultDTO.setProcessable(false);
resultDTO.setIsCreated(false);
resultDTO.setReturnable(false);
} else {
//获取我未处理的部门
ProjectStaffDTO projectStaffDTO = new ProjectStaffDTO();
@ -278,11 +278,13 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
} else {
resultDTO.setProcessable(false);
}
List<String> created = projectStaffService.getCreatedProcess(projectStaffDTO);
if (null != created && created.size() > NumConstant.ZERO) {
resultDTO.setIsCreated(true);
ReturnListFromDTO returnListFromDTO = new ReturnListFromDTO();
returnListFromDTO.setProjectId(fromDTO.getProjectId());
List<ReturnListResultDTO> returnableList = projectProcessService.getReturnableList(returnListFromDTO);
if (null != returnableList && returnableList.size() > NumConstant.ZERO) {
resultDTO.setReturnable(true);
} else {
resultDTO.setIsCreated(false);
resultDTO.setReturnable(false);
}
}

2
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml

@ -62,7 +62,7 @@
WHERE
ps.DEL_FLAG = '0'
AND ps.PROJECT_ID = #{projectId}
AND STAFF_ID = #{staffId}
AND ps.STAFF_ID = #{staffId}
AND IS_HANDLE = 'unhandled'
</select>

Loading…
Cancel
Save