Browse Source

third接口 1、查询客户的tokenList 2、清除客户信息

dev_shibei_match
wangchao 5 years ago
parent
commit
6cca1a5cf8
  1. 3
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CommonCustomerIdAndSrcFormDTO.java
  2. 16
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java
  3. 18
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java
  4. 3
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java
  5. 13
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java
  6. 2
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml
  7. 13
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml

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

@ -30,4 +30,7 @@ public class CommonCustomerIdAndSrcFormDTO implements Serializable {
* */
@NotBlank(message = "数据来源不能为空",groups = CustomerAndSrcGroup.class)
private String source;
@NotBlank(message = "用户Id不能为空",groups = CustomerAndSrcGroup.class)
private String userId;
}

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

@ -206,5 +206,21 @@ public class PaCustomerController {
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();
}
}

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

@ -102,6 +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);
}

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

@ -227,11 +227,10 @@ public interface PaCustomerService extends BaseService<PaCustomerEntity> {
/**
* @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
**/
void deletePublicCustomer(TokenDto token,CommonCustomerIdAndSrcFormDTO param);
void clearPublicCustomer(CommonCustomerIdAndSrcFormDTO param);
}

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

@ -677,17 +677,24 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
/**
* @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
**/
@Override
public void deletePublicCustomer(TokenDto token , CommonCustomerIdAndSrcFormDTO param) {
@Transactional(rollbackFor = Exception.class)
public void clearPublicCustomer(CommonCustomerIdAndSrcFormDTO param) {
if(StringUtils.equals(ModuleConstant.SRC_PROD,param.getSource())){
logger.warn("有人试图删除用户生产数据,试图删除的客户Id:{},操作者Id:{}",param.getCustomerId(),token.getUserId());
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());
}
}

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

@ -125,7 +125,7 @@
<select id="selectClientToken" resultType="com.epmet.dto.result.AuthAccessTokenClientResultDTO">
SELECT
CLIENT_TYPE,
AUTHORIZER_ACCESS_TOKEN
AUTHORIZER_ACCESS_TOKEN AS accessToken
FROM
authorization_info
WHERE

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

@ -181,6 +181,19 @@
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>
Loading…
Cancel
Save