diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CommonCustomerIdAndSrcFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CommonCustomerIdAndSrcFormDTO.java new file mode 100644 index 0000000000..56b920d911 --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CommonCustomerIdFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CommonCustomerIdFormDTO.java new file mode 100644 index 0000000000..43860b8d8c --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthAccessTokenClientResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthAccessTokenClientResultDTO.java new file mode 100644 index 0000000000..69b1c4abb1 --- /dev/null +++ b/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; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerTokensResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerTokensResultDTO.java new file mode 100644 index 0000000000..212114a4cc --- /dev/null +++ b/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 = ""; +} diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml index d10eea3729..a2a223a704 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml +++ b/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 # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index c1fe6fbd85..c351dcd734 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.134 + 0.0.135 com.epmet diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java index 544e4da23e..4c1cec0015 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java +++ b/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"; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java index 13ad00fc9d..de5cc61d7a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java +++ b/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().ok(pageData); } + /** + * @Description 获取客户第三方token + * @NEI https://nei.netease.com/interface/detail/req/?pid=52285&id=323480 + * @param param CommonCustomerIdFormDTO.class + * @return Result + * @author wangc + * @date 2020.08.25 15:39 + **/ + @PostMapping("tokenlist") + public Result tokenList(@RequestBody CommonCustomerIdFormDTO param){ + ValidatorUtils.validateEntity(param, CustomerUserFormDTO.CustomerIdGroup.class); + return new Result().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(); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java index b5c24edf2f..882a091b1b 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java +++ b/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 { */ List getCustomerAccessTokenInfo(CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO); + /** + * @Description 查询来源端对应的accessToken + * @param customerId + * @return List + * @author wangc + * @date 2020.08.25 15:24 + **/ + List selectClientToken(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java index 10a5710c6e..85a5bac687 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java @@ -69,4 +69,13 @@ public interface ComponentAccessTokenDao extends BaseDao { * @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); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java index b9c77f90f3..a1b30bd255 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java @@ -213,4 +213,24 @@ public interface PaCustomerService extends BaseService { * @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); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java index c77f86e336..5b683027b5 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java +++ b/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 page(Map params) { @@ -641,4 +645,56 @@ public class PaCustomerServiceImpl extends BaseServiceImpl(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 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()); + } + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml index 61f441b6b8..77e38472e8 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml @@ -121,4 +121,16 @@ + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentAccessTokenDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentAccessTokenDao.xml index 3642c1d768..98d52d60b8 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentAccessTokenDao.xml +++ b/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())) 900 + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml index 40d5efbc3a..11d1b50262 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml @@ -146,4 +146,54 @@ AND id = #{oldCustomerId} + + + 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}; + + + + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java index 8ad21b2082..7f309667f0 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java +++ b/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; /** * 当前跟进部门 */ diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index ddacb38fed..0fc60dcbb5 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/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 created = projectStaffService.getCreatedProcess(projectStaffDTO); - if (null != created && created.size() > NumConstant.ZERO) { - resultDTO.setIsCreated(true); + ReturnListFromDTO returnListFromDTO = new ReturnListFromDTO(); + returnListFromDTO.setProjectId(fromDTO.getProjectId()); + List returnableList = projectProcessService.getReturnableList(returnListFromDTO); + if (null != returnableList && returnableList.size() > NumConstant.ZERO) { + resultDTO.setReturnable(true); } else { - resultDTO.setIsCreated(false); + resultDTO.setReturnable(false); } } diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml index 0b8cbe9bc6..b2fc15543a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectStaffDao.xml +++ b/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'