From 5aae9b63189cb007ee6eaf23cfd1bed50a720e1a Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Mon, 6 Jul 2020 10:24:18 +0800 Subject: [PATCH 01/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/constant/ServiceConstant.java | 5 + epmet-gateway/pom.xml | 6 + .../src/main/resources/bootstrap.yml | 12 +- .../epmet-third-platform-client.iml | 148 +++++++++++ .../epmet-third-platform-client/pom.xml | 37 +++ .../epmet/constant/ThirdPlatformConstant.java | 29 +++ .../dto/form/ThirdPlatformEventFormDTO.java | 36 +++ .../java/com/epmet/dto/result/ResultBean.java | 24 ++ .../feign/EpmetThirdPlatformFeignClient.java | 16 ++ ...EpmetThirdPlatformFeignClientFallback.java | 12 + .../epmet-third-platform-server/.gitignore | 31 +++ .../deploy/docker-compose-dev.yml | 17 ++ .../deploy/docker-compose-test.yml | 17 ++ .../epmet-third-platform-server.iml | 240 +++++++++++++++++ .../epmet-third-platform-server/pom.xml | 211 +++++++++++++++ .../epmet/EpmetThirdPlatformApplication.java | 17 ++ .../com/epmet/aspect/RequestLogAspect.java | 40 +++ .../com/epmet/config/ModuleConfigImpl.java | 26 ++ .../ComponentVerifyTicketController.java | 45 ++++ .../com/epmet/exception/AesException.java | 65 +++++ .../epmet/service/DbyWechatExtService.java | 24 ++ .../service/impl/DbyWechatExtServiceImpl.java | 59 +++++ .../java/com/epmet/util/ModuleConstant.java | 23 ++ .../java/com/epmet/util/WXBizMsgCrypt.java | 246 ++++++++++++++++++ .../java/com/epmet/util/WXXmlToMapUtil.java | 230 ++++++++++++++++ .../src/main/resources/bootstrap.yml | 109 ++++++++ .../src/main/resources/logback-spring.xml | 164 ++++++++++++ .../epmet-third-platform.iml | 51 ++++ epmet-module/epmet-third-platform/pom.xml | 21 ++ 29 files changed, 1960 insertions(+), 1 deletion(-) create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-client/epmet-third-platform-client.iml create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-client/pom.xml create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/constant/ThirdPlatformConstant.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ThirdPlatformEventFormDTO.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/result/ResultBean.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/EpmetThirdPlatformFeignClient.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/fallback/EpmetThirdPlatformFeignClientFallback.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/.gitignore create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-dev.yml create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-test.yml create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/epmet-third-platform-server.iml create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/EpmetThirdPlatformApplication.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/aspect/RequestLogAspect.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/config/ModuleConfigImpl.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/exception/AesException.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/DbyWechatExtService.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/ModuleConstant.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/WXBizMsgCrypt.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/bootstrap.yml create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/logback-spring.xml create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform.iml create mode 100644 epmet-module/epmet-third-platform/pom.xml diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index 0b1295ab88..6857591ab3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -118,4 +118,9 @@ public interface ServiceConstant { * 数据统计 */ String DATA_STATISTICAL_SERVER = "data-statistical-server"; + + /** + * 微信第三方平台 + */ + String EPMET_THIRD_PLATFORM_SERVER = "epmet-third-platform-server"; } diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 94cd5f1f1f..387ded533e 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -185,6 +185,10 @@ lb://epmet-openapi-scan + + + http://localhost:8109 + @@ -346,6 +350,8 @@ lb://data-statistical-server lb://epmet-openapi-scan + + lb://epmet-third-platform-server diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 4d910e0f02..b7c816c002 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -280,12 +280,21 @@ spring: #内容审核服务 - id: epmet-openapi-scan uri: @gateway.routes.epmet-openapi-scan.uri@ - order: 29 + order: 30 predicates: - Path=${server.servlet.context-path}/epmetscan/** filters: - StripPrefix=1 - CpAuth=true + #微信第三方平台 + - id: epmet-third-platform-server + uri: @gateway.routes.epmet-third-platform-server.uri@ + order: 31 + predicates: + - Path=${server.servlet.context-path}/epmet/third/platform/** + filters: + - StripPrefix=1 + - CpAuth=true nacos: discovery: server-addr: @nacos.server-addr@ @@ -400,6 +409,7 @@ epmet: - /gov/issue/** - /gov/project/** - /resi/home/** + - /epmet/third/platform/** swaggerUrls: jwt: diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/epmet-third-platform-client.iml b/epmet-module/epmet-third-platform/epmet-third-platform-client/epmet-third-platform-client.iml new file mode 100644 index 0000000000..157930f00d --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-client/epmet-third-platform-client.iml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/pom.xml b/epmet-module/epmet-third-platform/epmet-third-platform-client/pom.xml new file mode 100644 index 0000000000..f17f962919 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-client/pom.xml @@ -0,0 +1,37 @@ + + + 4.0.0 + + + epmet-third-platform + com.epmet + 2.0.0 + + + + epmet-third-platform-client + jar + + + + com.epmet + epmet-commons-tools + 2.0.0 + + + io.springfox + springfox-swagger2 + + + io.springfox + springfox-swagger-ui + + + + + ${project.artifactId} + + + \ No newline at end of file diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/constant/ThirdPlatformConstant.java b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/constant/ThirdPlatformConstant.java new file mode 100644 index 0000000000..09f8af7681 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/constant/ThirdPlatformConstant.java @@ -0,0 +1,29 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @CreateTime 2020/7/6 9:48 + */ +public interface ThirdPlatformConstant { + + /** + * 第三方平台appId + */ + String PLATFORM_APP_ID = "****************"; + + /** + * 第三方平台 secret + */ + String PLATFORM_APP_SECRET = "****************"; + + /** + * 第三方平台 消息加解密Key + */ + String PLATFORM_AES_KEY = "****************"; + + /** + * 第三方平台 消息校验Token + */ + String PLATFORM_COMPONENT_TOKEN = "****************"; + +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ThirdPlatformEventFormDTO.java b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ThirdPlatformEventFormDTO.java new file mode 100644 index 0000000000..a81ca6033a --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ThirdPlatformEventFormDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/6 9:57 + */ +@Data +public class ThirdPlatformEventFormDTO implements Serializable { + + private static final long serialVersionUID = -8855993636150332559L; + + /** + * 时间戳 + */ + private String timeStamp; + + /** + * 随机数 + */ + private String nonce; + + /** + * 消息体签名 + */ + private String msgSignature; + + /** + * 消息体 + */ + private String postData; + +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/result/ResultBean.java b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/result/ResultBean.java new file mode 100644 index 0000000000..5248dc8cb2 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/result/ResultBean.java @@ -0,0 +1,24 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/6 9:08 + */ +@Data +public class ResultBean implements Serializable { + + private static final long serialVersionUID = -1528288965079007980L; + + private Object data; + + private String msg; + + private String errorMsg; + + private Integer code; + +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/EpmetThirdPlatformFeignClient.java b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/EpmetThirdPlatformFeignClient.java new file mode 100644 index 0000000000..f325488ebf --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/EpmetThirdPlatformFeignClient.java @@ -0,0 +1,16 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.feign.fallback.EpmetThirdPlatformFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 本服务对外开放的API,其他服务通过引用此client调用该服务 + * + * @Author zxc + * @CreateTime 2020/7/5 14:45 + */ +@FeignClient(name = ServiceConstant.EPMET_THIRD_PLATFORM_SERVER, fallback = EpmetThirdPlatformFeignClientFallback.class) + +public interface EpmetThirdPlatformFeignClient { +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/fallback/EpmetThirdPlatformFeignClientFallback.java b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/fallback/EpmetThirdPlatformFeignClientFallback.java new file mode 100644 index 0000000000..c8826df8d6 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/fallback/EpmetThirdPlatformFeignClientFallback.java @@ -0,0 +1,12 @@ +package com.epmet.feign.fallback; + +import com.epmet.feign.EpmetThirdPlatformFeignClient; +import org.springframework.stereotype.Component; + +/** + * @Author zxc + * @CreateTime 2020/7/5 14:46 + */ +@Component +public class EpmetThirdPlatformFeignClientFallback implements EpmetThirdPlatformFeignClient { +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/.gitignore b/epmet-module/epmet-third-platform/epmet-third-platform-server/.gitignore new file mode 100644 index 0000000000..a2a3040aa8 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/.gitignore @@ -0,0 +1,31 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/** +!**/src/test/** + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ + +### VS Code ### +.vscode/ diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-dev.yml new file mode 100644 index 0000000000..61a96bd804 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-dev.yml @@ -0,0 +1,17 @@ +version: "3.7" +services: + epmet-third-platform-server: + container_name: epmet-third-platform-server-dev + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-platform-server:0.0.1 + ports: + - "8109:8109" + network_mode: host # 使用现有网络 + volumes: + - "/opt/epmet-cloud-logs/dev:/logs" + environment: + RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" + deploy: + resources: + limits: + cpus: '0.1' + memory: 250M \ No newline at end of file diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-test.yml b/epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-test.yml new file mode 100644 index 0000000000..e3190c180c --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-test.yml @@ -0,0 +1,17 @@ +version: "3.7" +services: + epmet-third-platform-server: + container_name: epmet-third-platform-server-test + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-platform-server:0.0.1 + ports: + - "8109:8109" + network_mode: host # 使用现有网络 + volumes: + - "/opt/epmet-cloud-logs/test:/logs" + environment: + RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" + deploy: + resources: + limits: + cpus: '0.1' + memory: 250M \ No newline at end of file diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/epmet-third-platform-server.iml b/epmet-module/epmet-third-platform/epmet-third-platform-server/epmet-third-platform-server.iml new file mode 100644 index 0000000000..f42456d14c --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/epmet-third-platform-server.iml @@ -0,0 +1,240 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml b/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml new file mode 100644 index 0000000000..ecda6c12df --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml @@ -0,0 +1,211 @@ + + + 4.0.0 + 0.0.1 + + + com.epmet + epmet-third-platform + 2.0.0 + + + epmet-third-platform-server + jar + + + 3.2.2 + 1.1.0 + 1.0.5 + 2.3.28 + + + + + com.epmet + epmet-third-platform-client + 2.0.0 + + + com.epmet + epmet-commons-tools + 2.0.0 + + + com.epmet + epmet-commons-mybatis + 2.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context-support + + + org.springframework.boot + spring-boot-starter-actuator + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + com.aliyun + aliyun-java-sdk-core + ${aliyun.core.version} + + + com.aliyun + aliyun-java-sdk-dysmsapi + ${aliyun.dysmsapi.version} + + + com.github.qcloudsms + qcloudsms + ${qcloud.qcloudsms.version} + + + com.sun.mail + javax.mail + + + org.freemarker + freemarker + ${freemarker.version} + + + + io.github.openfeign + feign-httpclient + 10.3.0 + + + + org.flywaydb + flyway-core + + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + org.dom4j + dom4j + 2.1.3 + compile + + + com.github.binarywang + weixin-java-common + 3.6.0 + compile + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + ${project.basedir}/src/main/java + + + true + ${basedir}/src/main/resources + + + + + + dev + + true + + + 8109 + dev + + + + + + epmet_message_user + EpmEt-db-UsEr + + 0 + 192.168.1.130 + 6379 + 123456 + + false + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b + + + false + + + false + + + + test + + + 8109 + test + + + + + + epmet + elink@833066 + + 0 + r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com + 6379 + EpmEtrEdIs!q@w + + true + 192.168.10.150:8848 + 67e3c350-533e-4d7c-9f8f-faf1b4aa82ae + + + false + + + true + + + + + diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/EpmetThirdPlatformApplication.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/EpmetThirdPlatformApplication.java new file mode 100644 index 0000000000..5989404eff --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/EpmetThirdPlatformApplication.java @@ -0,0 +1,17 @@ +package com.epmet; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; + +@SpringBootApplication +@EnableDiscoveryClient +@EnableFeignClients +public class EpmetThirdPlatformApplication { + + public static void main(String[] args) { + SpringApplication.run(EpmetThirdPlatformApplication.class, args); + } + +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/aspect/RequestLogAspect.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/aspect/RequestLogAspect.java new file mode 100644 index 0000000000..49581cf63c --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/aspect/RequestLogAspect.java @@ -0,0 +1,40 @@ +package com.epmet.aspect; + +import com.epmet.commons.tools.aspect.BaseRequestLogAspect; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +/** + * 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 + */ +@Aspect +@Component +@Order(0) +public class RequestLogAspect extends BaseRequestLogAspect { + + @Override + @Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") + public Object proceed(ProceedingJoinPoint point) throws Throwable { + return super.proceed(point, getRequest()); + } + + /** + * 获取Request对象 + * + * @return + */ + private HttpServletRequest getRequest() { + RequestAttributes ra = RequestContextHolder.getRequestAttributes(); + ServletRequestAttributes sra = (ServletRequestAttributes) ra; + return sra.getRequest(); + } + +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/config/ModuleConfigImpl.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/config/ModuleConfigImpl.java new file mode 100644 index 0000000000..2ea4a0b4c8 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/config/ModuleConfigImpl.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.config; + +import com.epmet.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * 模块配置信息 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "epmetthirdplatform"; + } +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java new file mode 100644 index 0000000000..001b78d1e4 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java @@ -0,0 +1,45 @@ +package com.epmet.controller; + +import com.epmet.dto.form.ThirdPlatformEventFormDTO; +import com.epmet.dto.result.ResultBean; +import com.epmet.service.DbyWechatExtService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author zxc + * @CreateTime 2020/7/6 9:07 + */ +@Slf4j +@RestController +public class ComponentVerifyTicketController { + + private DbyWechatExtService dbyWechatExtService; + + @PostMapping(value = "/event") + public ResponseEntity wechatPlatformEvent(@RequestBody ThirdPlatformEventFormDTO formDTO) { + ResultBean resultBean = new ResultBean(); + ResponseEntity responseEntity; + log.info("授权事件接收URL,验证票据"); + try { + resultBean.setData(dbyWechatExtService.parseRequest(formDTO)); + responseEntity = new ResponseEntity(resultBean, HttpStatus.OK); + log.info("第三方平台授权事件接收URL,验证票据成功"); + } catch (Exception e) { + log.error("第三方平台授权事件接收URL,验证票据异常", e.getMessage(), e); + ResultBean errorResultBean = new ResultBean(); + errorResultBean.setMsg("第三方平台授权事件接收URL,验证票据异常"); + errorResultBean.setErrorMsg(e.getMessage()); + errorResultBean.setCode(422); + responseEntity = new ResponseEntity(errorResultBean, HttpStatus.UNPROCESSABLE_ENTITY); + } + return responseEntity; + } + + +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/exception/AesException.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/exception/AesException.java new file mode 100644 index 0000000000..6b03534378 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/exception/AesException.java @@ -0,0 +1,65 @@ +package com.epmet.exception; + +/** + * @Author zxc + * @CreateTime 2020/7/6 10:03 + */ +@SuppressWarnings("serial") +public class AesException extends Exception { + + public final static int OK = 0; + public final static int ValidateSignatureError = -40001; + public final static int ParseXmlError = -40002; + public final static int ComputeSignatureError = -40003; + public final static int IllegalAesKey = -40004; + public final static int ValidateCorpidError = -40005; + public final static int EncryptAESError = -40006; + public final static int DecryptAESError = -40007; + public final static int IllegalBuffer = -40008; + public final static int EncodeBase64Error = -40009; + public final static int DecodeBase64Error = -40010; + public final static int GenReturnXmlError = -40011; + + private int code; + + private static String getMessage(int code) { + switch (code) { + case ValidateSignatureError: + return "签名验证错误"; + case ParseXmlError: + return "xml解析失败"; + case ComputeSignatureError: + return "sha加密生成签名失败"; + case IllegalAesKey: + return "SymmetricKey非法"; + case ValidateCorpidError: + return "corpid校验失败"; + case EncryptAESError: + return "aes加密失败"; + case DecryptAESError: + return "aes解密失败"; + case IllegalBuffer: + return "解密后得到的buffer非法"; + case EncodeBase64Error: + return "base64加密错误"; + case DecodeBase64Error: + return "base64解密错误"; + case GenReturnXmlError: + return "xml生成失败"; + default: + return null; // cannot be + } + } + + public int getCode() { + return code; + } + + public AesException(int code) { + super(getMessage(code)); + this.code = code; + } + +} + + diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/DbyWechatExtService.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/DbyWechatExtService.java new file mode 100644 index 0000000000..d8cdef3e1c --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/DbyWechatExtService.java @@ -0,0 +1,24 @@ +package com.epmet.service; + +import com.epmet.dto.form.ThirdPlatformEventFormDTO; + +/** + * @Author zxc + * @CreateTime 2020/7/6 9:12 + */ +public interface DbyWechatExtService { + + /** + * 获得授权事件的票据 + * + * @param timestamp 时间戳 + * @param nonce 随机数 + * @param msgSignature 消息体签名 + * @param postData 消息体 + * @return 如果获得只需要返回 SUCCESS + * @Author zxc + */ + String parseRequest(ThirdPlatformEventFormDTO formDTO); + + +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java new file mode 100644 index 0000000000..fab5f0137d --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java @@ -0,0 +1,59 @@ +package com.epmet.service.impl; + +import com.epmet.constant.ThirdPlatformConstant; +import com.epmet.dto.form.ThirdPlatformEventFormDTO; +import com.epmet.exception.AesException; +import com.epmet.service.DbyWechatExtService; +import com.epmet.util.ModuleConstant; +import com.epmet.util.WXBizMsgCrypt; +import com.epmet.util.WXXmlToMapUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * @Author zxc + * @CreateTime 2020/7/6 9:13 + */ +@Slf4j +@Service +public class DbyWechatExtServiceImpl implements DbyWechatExtService { + + @Autowired + private RedisTemplate redisTemplate; + + @Override + public String parseRequest(ThirdPlatformEventFormDTO formDTO) { + String msgSignature = formDTO.getMsgSignature(); + String nonce = formDTO.getNonce(); + String postData = formDTO.getPostData(); + String timeStamp = formDTO.getTimeStamp(); + log.info(ModuleConstant.START_RECEIVE); + try { + //这个类是微信官网提供的解密类,需要用到消息校验Token 消息加密Key和服务平台appid + WXBizMsgCrypt pc = new WXBizMsgCrypt(ThirdPlatformConstant.PLATFORM_COMPONENT_TOKEN, ThirdPlatformConstant.PLATFORM_AES_KEY, ThirdPlatformConstant.PLATFORM_APP_ID); + String xml = pc.decryptMsg(msgSignature, timeStamp, nonce, postData); + // 将xml转为map + Map result = WXXmlToMapUtil.xmlToMap(xml); + String componentVerifyTicket = MapUtils.getString(result,ModuleConstant.TICKET_KEY); + if (StringUtils.isNotEmpty(componentVerifyTicket)) { + // 存储平台授权票据,保存ticket + redisTemplate.opsForValue().set(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket, 60 * 10, TimeUnit.SECONDS); + String verifyTicket = redisTemplate.opsForValue().get(ModuleConstant.TICKET_UNDERLINE_KEY).toString(); + log.info(String.format(ModuleConstant.AUTH_TICKET,verifyTicket)); + } else { + throw new RuntimeException(ModuleConstant.ERROR_TICKET); + } + } catch (AesException e) { + e.printStackTrace(); + } + log.info(ModuleConstant.SUCCESS_TICKET); + return ModuleConstant.SUCCESS; + } +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/ModuleConstant.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/ModuleConstant.java new file mode 100644 index 0000000000..0706f08250 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/ModuleConstant.java @@ -0,0 +1,23 @@ +package com.epmet.util; + +/** + * @Description + * @author zxc + */ +public interface ModuleConstant { + + String START_RECEIVE = "==============================开始授权事件接收URL================================="; + + String TICKET_KEY = "ComponentVerifyTicket"; + + String TICKET_UNDERLINE_KEY = "component_verify_ticket"; + + String AUTH_TICKET = "====================授权票据【ComponentVerifyTicket】:【%s】===================="; + + String ERROR_TICKET = "微信开放平台,第三方平台获取【验证票据】失败"; + + String SUCCESS_TICKET = "==============================结束授权事件接收URL================================="; + + String SUCCESS = "success"; + +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/WXBizMsgCrypt.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/WXBizMsgCrypt.java new file mode 100644 index 0000000000..332e363eaa --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/WXBizMsgCrypt.java @@ -0,0 +1,246 @@ +package com.epmet.util; + +import com.epmet.exception.AesException; +import me.chanjar.weixin.common.util.crypto.PKCS7Encoder; +import org.apache.commons.codec.binary.Base64; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +import java.io.StringReader; +import java.nio.charset.Charset; +import java.security.MessageDigest; +import java.util.Arrays; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +/** + * 提供接收和推送给公众平台消息的加解密接口(UTF8编码的字符串). + *
    *
  1. 第三方回复加密消息给公众平台
  2. *
  3. 第三方收到公众平台发送的消息,验证消息的安全性,并对消息进行解密。
  4. + *
+ * 说明:异常java.security.InvalidKeyException:illegal Key Size的解决方案 + *
    + *
  1. 在官方网站下载JCE无限制权限策略文件(JDK7的下载地址: * + * http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
  2. + *
  3. 下载后解压,可以看到local_policy.jar和US_export_policy.jar以及readme.txt
  4. + *
  5. 如果安装了JRE,将两个jar文件放到%JRE_HOME%\lib\security目录下覆盖原来的文件
  6. + *
  7. 如果安装了JDK,将两个jar文件放到%JDK_HOME%\jre\lib\security目录下覆盖原来文件
  8. + * + *
+ */ + +/** + * @Author zxc + * @CreateTime 2020/7/6 9:51 + */ +public class WXBizMsgCrypt { + static Charset CHARSET = Charset.forName("utf-8"); + Base64 base64 = new Base64(); + byte[] aesKey; + String token; + String appId; + + /** + * 构造函数 + * @param token 公众平台上,开发者设置的token + * @param encodingAesKey 公众平台上,开发者设置的EncodingAESKey + * @param appId 公众平台appid + * + * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 + */ + public WXBizMsgCrypt(String token, String encodingAesKey, String appId) throws AesException { + if (encodingAesKey.length() != 43) { + throw new AesException(AesException.IllegalAesKey); + } + + this.token = token; + this.appId = appId; + aesKey = Base64.decodeBase64(encodingAesKey + "="); + } + + // 还原4个字节的网络字节序 + int recoverNetworkBytesOrder(byte[] orderBytes) { + int sourceNumber = 0; + for (int i = 0; i < 4; i++) { + sourceNumber <<= 8; + sourceNumber |= orderBytes[i] & 0xff; + } + return sourceNumber; + } + + /** + * 对密文进行解密. + * @param text 需要解密的密文 + * @return 解密得到的明文 + * @throws AesException aes解密失败 + */ + String decrypt(String text) throws AesException { + byte[] original; + try { + // 设置解密模式为AES的CBC模式 + Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); + SecretKeySpec key_spec = new SecretKeySpec(aesKey, "AES"); + IvParameterSpec iv = new IvParameterSpec(Arrays.copyOfRange(aesKey, 0, 16)); + cipher.init(Cipher.DECRYPT_MODE, key_spec, iv); + + // 使用BASE64对密文进行解码 + byte[] encrypted = Base64.decodeBase64(text); + + // 解密 + original = cipher.doFinal(encrypted); + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.DecryptAESError); + } + + String xmlContent, from_appid; + try { + // 去除补位字符 + byte[] bytes = PKCS7Encoder.decode(original); + + // 分离16位随机字符串,网络字节序和AppId + byte[] networkOrder = Arrays.copyOfRange(bytes, 16, 20); + + int xmlLength = recoverNetworkBytesOrder(networkOrder); + + xmlContent = new String(Arrays.copyOfRange(bytes, 20, 20 + xmlLength), CHARSET); + from_appid = + new String(Arrays.copyOfRange(bytes, 20 + xmlLength, bytes.length), CHARSET); + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.IllegalBuffer); + } + + // appid不相同的情况 + if (!from_appid.equals(appId)) { + throw new AesException(AesException.ValidateSignatureError); + } + return xmlContent; + + } + + /** + * * 检验消息的真实性,并且获取解密后的明文. + *
    + *
  1. 利用收到的密文生成安全签名,进行签名验证
  2. + *
  3. 若验证通过,则提取xml中的加密消息
  4. + *
  5. 对消息进行解密
  6. + *
+ * + * @param msgSignature 签名串,对应URL参数的msg_signature + * @param timeStamp 时间戳,对应URL参数的timestamp + * @param nonce 随机串,对应URL参数的nonce + * @param postData 密文,对应POST请求的数据 + * @return 解密后的原文 + * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 + */ + public String decryptMsg(String msgSignature, String timeStamp, String nonce, String postData) + throws AesException { + + // 密钥,公众账号的app secret + // 提取密文 + Object[] encrypt = extract(postData); + + // 验证安全签名 + String signature = getSHA1(token, timeStamp, nonce, encrypt[1].toString()); + + // 和URL中的签名比较是否相等 + // System.out.println("第三方收到URL中的签名:" + msg_sign); + // System.out.println("第三方校验签名:" + signature); + if (!signature.equals(msgSignature)) { + throw new AesException(AesException.ValidateSignatureError); + } + + // 解密 + String result = decrypt(encrypt[1].toString()); + return result; + } + + /** + * 提取出xml数据包中的加密消息 + * @param xmltext 待提取的xml字符串 + * @return 提取出的加密消息字符串 + * @throws AesException + */ + public static Object[] extract(String xmltext) throws AesException { + Object[] result = new Object[3]; + try { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); + dbf.setFeature("http://xml.org/sax/features/external-general-entities", false); + dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); + dbf.setXIncludeAware(false); + dbf.setExpandEntityReferences(false); + DocumentBuilder db = dbf.newDocumentBuilder(); + StringReader sr = new StringReader(xmltext); + InputSource is = new InputSource(sr); + Document document = db.parse(is); + + Element root = document.getDocumentElement(); + NodeList nodelist1 = root.getElementsByTagName("Encrypt"); + NodeList nodelist2 = root.getElementsByTagName("ToUserName"); + result[0] = 0; + result[1] = nodelist1.item(0).getTextContent(); + + //注意这里,获取ticket中的xml里面没有ToUserName这个元素,官网原示例代码在这里会报空 + //空指针,所以需要处理一下 + if (nodelist2 != null) { + if (nodelist2.item(0) != null) { + result[2] = nodelist2.item(0).getTextContent(); + } + } + return result; + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.ParseXmlError); + } + } + + /** + * 用SHA1算法生成安全签名 + * @param token 票据 + * @param timestamp 时间戳 + * @param nonce 随机字符串 + * @param encrypt 密文 + * @return 安全签名 + * @throws + * AesException + */ + public static String getSHA1(String token, String timestamp, String nonce, String encrypt) + throws AesException { + try { + String[] array = new String[]{token, timestamp, nonce, encrypt}; + StringBuffer sb = new StringBuffer(); + // 字符串排序 + Arrays.sort(array); + for (int i = 0; i < 4; i++) { + sb.append(array[i]); + } + String str = sb.toString(); + // SHA1签名生成 + MessageDigest md = MessageDigest.getInstance("SHA-1"); + md.update(str.getBytes()); + byte[] digest = md.digest(); + + StringBuffer hexstr = new StringBuffer(); + String shaHex = ""; + for (int i = 0; i < digest.length; i++) { + shaHex = Integer.toHexString(digest[i] & 0xFF); + if (shaHex.length() < 2) { + hexstr.append(0); + } + hexstr.append(shaHex); + } + return hexstr.toString(); + } catch (Exception e) { + e.printStackTrace(); + throw new AesException(AesException.ComputeSignatureError); + } + } +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java new file mode 100644 index 0000000000..856e2da291 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java @@ -0,0 +1,230 @@ +package com.epmet.util; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.dom4j.io.OutputFormat; +import org.dom4j.io.SAXReader; +import org.dom4j.io.XMLWriter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.StringReader; +import java.io.StringWriter; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +/** + * @Author zxc + * @CreateTime 2020/7/6 9:51 + */ +public class WXXmlToMapUtil { + + private static final Logger logger = LoggerFactory.getLogger(WXXmlToMapUtil.class); + + /** + * XML格式字符串转换为Map + * + * @param xml XML字符串 + * @return XML数据转换后的Map + */ + public static Map xmlToMap(String xml) { + try { + Map data = new HashMap<>(); + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + InputStream stream = new ByteArrayInputStream(xml.getBytes("UTF-8")); + org.w3c.dom.Document doc = documentBuilder.parse(stream); + doc.getDocumentElement().normalize(); + NodeList nodeList = doc.getDocumentElement().getChildNodes(); + for (int idx = 0; idx < nodeList.getLength(); ++idx) { + Node node = nodeList.item(idx); + if (node.getNodeType() == Node.ELEMENT_NODE) { + org.w3c.dom.Element element = (org.w3c.dom.Element) node; + data.put(element.getNodeName(), element.getTextContent()); + } + } + stream.close(); + return data; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 将Map转换为XML格式的字符串 + * + * @param data Map类型数据 + * @return XML格式的字符串 + */ + public static String mapToXml(Map data) throws Exception { + try { + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + org.w3c.dom.Document document = documentBuilder.newDocument(); + org.w3c.dom.Element root = document.createElement("xml"); + document.appendChild(root); + for (String key : data.keySet()) { + String value = data.get(key); + if (value == null) { + value = ""; + } + value = value.trim(); + org.w3c.dom.Element filed = document.createElement(key); + filed.appendChild(document.createTextNode(value)); + root.appendChild(filed); + } + TransformerFactory tf = TransformerFactory.newInstance(); + Transformer transformer = tf.newTransformer(); + DOMSource source = new DOMSource(document); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + StringWriter writer = new StringWriter(); + StreamResult result = new StreamResult(writer); + transformer.transform(source, result); + String output = writer.getBuffer().toString(); //.replaceAll("\n|\r", ""); + writer.close(); + return output; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * (多层)xml格式字符串转换为map + * + * @param xml xml字符串 + * @return 第一个为Root节点,Root节点之后为Root的元素,如果为多层,可以通过key获取下一层Map + */ + public static Map multilayerXmlToMap(String xml) { + Document doc = null; + try { + doc = DocumentHelper.parseText(xml); + } catch (DocumentException e) { + logger.error("xml字符串解析,失败 --> {}", e); + } + Map map = new HashMap<>(); + if (null == doc) { + return map; + } + // 获取根元素 + Element rootElement = doc.getRootElement(); + recursionXmlToMap(rootElement, map); + return map; + } + + /** + * multilayerXmlToMap核心方法,递归调用 + * + * @param element 节点元素 + * @param outmap 用于存储xml数据的map + */ + private static void recursionXmlToMap(Element element, Map outmap) { + // 得到根元素下的子元素列表 + List list = element.elements(); + int size = list.size(); + if (size == 0) { + // 如果没有子元素,则将其存储进map中 + outmap.put(element.getName(), element.getTextTrim()); + } else { + // innermap用于存储子元素的属性名和属性值 + Map innermap = new HashMap<>(); + // 遍历子元素 + list.forEach(childElement -> recursionXmlToMap(childElement, innermap)); + outmap.put(element.getName(), innermap); + } + } + + /** + * (多层)map转换为xml格式字符串 + * + * @param map 需要转换为xml的map + * @param isCDATA 是否加入CDATA标识符 true:加入 false:不加入 + * @return xml字符串 + */ + public static String multilayerMapToXml(Map map, boolean isCDATA) { + String parentName = "xml"; + Document doc = DocumentHelper.createDocument(); + doc.addElement(parentName); + String xml = recursionMapToXml(doc.getRootElement(), parentName, map, isCDATA); + return formatXML(xml); + } + + /** + * multilayerMapToXml核心方法,递归调用 + * + * @param element 节点元素 + * @param parentName 根元素属性名 + * @param map 需要转换为xml的map + * @param isCDATA 是否加入CDATA标识符 true:加入 false:不加入 + * @return xml字符串 + */ + private static String recursionMapToXml(Element element, String parentName, Map map, boolean isCDATA) { + Element xmlElement = element.addElement(parentName); + map.keySet().forEach(key -> { + Object obj = map.get(key); + if (obj instanceof Map) { + recursionMapToXml(xmlElement, key, (Map) obj, isCDATA); + } else { + String value = obj == null ? "" : obj.toString(); + if (isCDATA) { + xmlElement.addElement(key).addCDATA(value); + } else { + xmlElement.addElement(key).addText(value); + } + } + }); + return xmlElement.asXML(); + } + + /** + * 格式化xml,显示为容易看的XML格式 + * + * @param xml 需要格式化的xml字符串 + */ + public static String formatXML(String xml) { + String requestXML = null; + try { + // 拿取解析器 + SAXReader reader = new SAXReader(); + Document document = reader.read(new StringReader(xml)); + if (null != document) { + StringWriter stringWriter = new StringWriter(); + // 格式化,每一级前的空格 + OutputFormat format = new OutputFormat(" ", true); + // xml声明与内容是否添加空行 + format.setNewLineAfterDeclaration(false); + // 是否设置xml声明头部 + format.setSuppressDeclaration(false); + // 是否分行 + format.setNewlines(true); + XMLWriter writer = new XMLWriter(stringWriter, format); + writer.write(document); + writer.flush(); + writer.close(); + requestXML = stringWriter.getBuffer().toString(); + } + return requestXML; + } catch (Exception e) { + logger.error("格式化xml,失败 --> {}", e); + return null; + } + } +} + diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/bootstrap.yml new file mode 100644 index 0000000000..6c385f79f8 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/bootstrap.yml @@ -0,0 +1,109 @@ +server: + port: @server.port@ + servlet: + context-path: /epmet/third/platform + +spring: + main: + allow-bean-definition-overriding: true + application: + name: epmet-third-platform-server + # dev|test|prod + profiles: + active: dev + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + redis: + database: @spring.redis.index@ + host: @spring.redis.host@ + port: @spring.redis.port@ + password: @spring.redis.password@ + timeout: 30s + datasource: + druid: + #MySQL + driver-class-name: com.mysql.cj.jdbc.Driver + url: @spring.datasource.druid.url@ + username: @spring.datasource.druid.username@ + password: @spring.datasource.druid.password@ + cloud: + nacos: + discovery: + server-addr: @nacos.server-addr@ + #nacosռIDĬpublic + namespace: @nacos.discovery.namespace@ + #Լעᵽעĵĵַ + register-enabled: @nacos.register-enabled@ + ip: @nacos.ip@ + config: + enabled: @nacos.config-enabled@ + server-addr: @nacos.server-addr@ + namespace: @nacos.config.namespace@ + group: @nacos.config.group@ + file-extension: yaml + # Ǩƹflyway + flyway: + enabled: @spring.flyway.enabled@ + locations: classpath:db/migration + url: @spring.datasource.druid.url@ + user: @spring.datasource.druid.username@ + password: @spring.datasource.druid.password@ + baseline-on-migrate: true + baseline-version: 0 +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: ALWAYS + +mybatis-plus: + mapper-locations: classpath:/mapper/**/*.xml + #ʵɨ裬packageöŻ߷ֺŷָ + typeAliasesPackage: com.epmet.entity + global-config: + #ݿ + db-config: + # AUTO:"ݿID", INPUT:"ûID", ID_WORKER:"ȫΨһID (ΨһID)", UUID:"ȫΨһID UUID"; + id-type: ID_WORKER + #ֶβ IGNORED:"ж",NOT_NULL:" NULL ж"),NOT_EMPTY:"ǿж" + field-strategy: NOT_NULL + #շ»ת + column-underline: true + banner: false + #ԭ + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' + +feign: + hystrix: + enabled: true + client: + config: + default: + loggerLevel: BASIC + httpclient: + enabled: true + +hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 60000 #ȱʡΪ1000 + +ribbon: + ReadTimeout: 300000 + ConnectTimeout: 300000 + +#pageHelperҳ +pagehelper: + helper-dialect: mysql + reasonable: false #ҳãҳΪ-1ԶתΪСҳ1 \ No newline at end of file diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/logback-spring.xml b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..7ead25dd02 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/logback-spring.xml @@ -0,0 +1,164 @@ + + + + + + + + + + ${appname} + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + ${log.path}/debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + ${log.path}/error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/epmet-third-platform/epmet-third-platform.iml b/epmet-module/epmet-third-platform/epmet-third-platform.iml new file mode 100644 index 0000000000..0d9345ff78 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform.iml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third-platform/pom.xml b/epmet-module/epmet-third-platform/pom.xml new file mode 100644 index 0000000000..5a5fcef140 --- /dev/null +++ b/epmet-module/epmet-third-platform/pom.xml @@ -0,0 +1,21 @@ + + + + epmet-module + com.epmet + 2.0.0 + + 4.0.0 + + epmet-third-platform + pom + + + epmet-third-platform-client + epmet-third-platform-server + + + + \ No newline at end of file From 44257c3e7b69905b03a13ddefb13a025401e8822 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Mon, 6 Jul 2020 10:28:34 +0800 Subject: [PATCH 02/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/pom.xml b/epmet-module/pom.xml index aa37ab3129..854ba00003 100644 --- a/epmet-module/pom.xml +++ b/epmet-module/pom.xml @@ -39,6 +39,7 @@ resi-voice data-statistical data-report + epmet-third-platform From 43aeb693beea084193b95e7fd759995ffc779ada Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Mon, 6 Jul 2020 10:42:59 +0800 Subject: [PATCH 03/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-platform-client.iml | 148 ----------- .../epmet-third-platform-server.iml | 240 ------------------ .../ComponentVerifyTicketController.java | 18 +- .../service/impl/DbyWechatExtServiceImpl.java | 2 +- .../java/com/epmet/util/ModuleConstant.java | 8 +- .../epmet-third-platform.iml | 51 ---- 6 files changed, 15 insertions(+), 452 deletions(-) delete mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-client/epmet-third-platform-client.iml delete mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/epmet-third-platform-server.iml delete mode 100644 epmet-module/epmet-third-platform/epmet-third-platform.iml diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/epmet-third-platform-client.iml b/epmet-module/epmet-third-platform/epmet-third-platform-client/epmet-third-platform-client.iml deleted file mode 100644 index 157930f00d..0000000000 --- a/epmet-module/epmet-third-platform/epmet-third-platform-client/epmet-third-platform-client.iml +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/epmet-third-platform-server.iml b/epmet-module/epmet-third-platform/epmet-third-platform-server/epmet-third-platform-server.iml deleted file mode 100644 index f42456d14c..0000000000 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/epmet-third-platform-server.iml +++ /dev/null @@ -1,240 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java index 001b78d1e4..42ee066a70 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java @@ -1,14 +1,15 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.ThirdPlatformEventFormDTO; import com.epmet.dto.result.ResultBean; import com.epmet.service.DbyWechatExtService; +import com.epmet.util.ModuleConstant; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; /** @@ -22,23 +23,18 @@ public class ComponentVerifyTicketController { private DbyWechatExtService dbyWechatExtService; @PostMapping(value = "/event") - public ResponseEntity wechatPlatformEvent(@RequestBody ThirdPlatformEventFormDTO formDTO) { + public Result wechatPlatformEvent(@RequestBody ThirdPlatformEventFormDTO formDTO) { ResultBean resultBean = new ResultBean(); ResponseEntity responseEntity; - log.info("授权事件接收URL,验证票据"); + log.info(ModuleConstant.URL_TICKET); try { resultBean.setData(dbyWechatExtService.parseRequest(formDTO)); responseEntity = new ResponseEntity(resultBean, HttpStatus.OK); - log.info("第三方平台授权事件接收URL,验证票据成功"); + log.info(ModuleConstant.SUCCESS_TICKET); } catch (Exception e) { - log.error("第三方平台授权事件接收URL,验证票据异常", e.getMessage(), e); - ResultBean errorResultBean = new ResultBean(); - errorResultBean.setMsg("第三方平台授权事件接收URL,验证票据异常"); - errorResultBean.setErrorMsg(e.getMessage()); - errorResultBean.setCode(422); - responseEntity = new ResponseEntity(errorResultBean, HttpStatus.UNPROCESSABLE_ENTITY); + log.error(ModuleConstant.ERROR_URL_TICKET, e.getMessage(), e); } - return responseEntity; + return new Result(); } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java index fab5f0137d..df02a38ada 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java @@ -53,7 +53,7 @@ public class DbyWechatExtServiceImpl implements DbyWechatExtService { } catch (AesException e) { e.printStackTrace(); } - log.info(ModuleConstant.SUCCESS_TICKET); + log.info(ModuleConstant.END_TICKET); return ModuleConstant.SUCCESS; } } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/ModuleConstant.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/ModuleConstant.java index 0706f08250..98dd15baa5 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/ModuleConstant.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/ModuleConstant.java @@ -16,8 +16,14 @@ public interface ModuleConstant { String ERROR_TICKET = "微信开放平台,第三方平台获取【验证票据】失败"; - String SUCCESS_TICKET = "==============================结束授权事件接收URL================================="; + String END_TICKET = "==============================结束授权事件接收URL================================="; String SUCCESS = "success"; + String URL_TICKET = "授权事件接收URL,验证票据"; + + String SUCCESS_TICKET = "第三方平台授权事件接收URL,验证票据成功"; + + String ERROR_URL_TICKET = "第三方平台授权事件接收URL,验证票据异常"; + } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform.iml b/epmet-module/epmet-third-platform/epmet-third-platform.iml deleted file mode 100644 index 0d9345ff78..0000000000 --- a/epmet-module/epmet-third-platform/epmet-third-platform.iml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 6d4770a6d9ff85b48cc0bf58ff6c07a3e4eb3cd3 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Mon, 6 Jul 2020 11:10:27 +0800 Subject: [PATCH 04/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/ThirdPlatformEventFormDTO.java | 10 ++- .../{util => constant}/ModuleConstant.java | 2 +- .../ComponentVerifyTicketController.java | 20 +++--- .../service/impl/DbyWechatExtServiceImpl.java | 2 +- .../java/com/epmet/util/PKCS7EncoderUtil.java | 63 +++++++++++++++++++ 5 files changed, 83 insertions(+), 14 deletions(-) rename epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/{util => constant}/ModuleConstant.java (97%) create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/PKCS7EncoderUtil.java diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ThirdPlatformEventFormDTO.java b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ThirdPlatformEventFormDTO.java index a81ca6033a..bb1c6f2bb1 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ThirdPlatformEventFormDTO.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ThirdPlatformEventFormDTO.java @@ -1,7 +1,9 @@ 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; /** @@ -13,24 +15,30 @@ public class ThirdPlatformEventFormDTO implements Serializable { private static final long serialVersionUID = -8855993636150332559L; + public interface ThirdPlatForm extends CustomerClientShowGroup{} + /** * 时间戳 */ + @NotBlank(message = "timeStamp不能为空",groups = {ThirdPlatForm.class}) private String timeStamp; /** * 随机数 */ + @NotBlank(message = "nonce不能为空",groups = {ThirdPlatForm.class}) private String nonce; /** * 消息体签名 - */ + */@NotBlank(message = "msgSignature不能为空",groups = {ThirdPlatForm.class}) + private String msgSignature; /** * 消息体 */ + @NotBlank(message = "postData不能为空",groups = {ThirdPlatForm.class}) private String postData; } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/ModuleConstant.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/constant/ModuleConstant.java similarity index 97% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/ModuleConstant.java rename to epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/constant/ModuleConstant.java index 98dd15baa5..79582996cf 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/ModuleConstant.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/constant/ModuleConstant.java @@ -1,4 +1,4 @@ -package com.epmet.util; +package com.epmet.constant; /** * @Description diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java index 42ee066a70..290e7a1489 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java @@ -1,11 +1,13 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.ThirdPlatformEventFormDTO; import com.epmet.dto.result.ResultBean; import com.epmet.service.DbyWechatExtService; -import com.epmet.util.ModuleConstant; +import com.epmet.constant.ModuleConstant; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; @@ -20,21 +22,17 @@ import org.springframework.web.bind.annotation.RestController; @RestController public class ComponentVerifyTicketController { + @Autowired private DbyWechatExtService dbyWechatExtService; @PostMapping(value = "/event") - public Result wechatPlatformEvent(@RequestBody ThirdPlatformEventFormDTO formDTO) { + public Result wechatPlatformEvent(@RequestBody ThirdPlatformEventFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ThirdPlatformEventFormDTO.ThirdPlatForm.class); ResultBean resultBean = new ResultBean(); - ResponseEntity responseEntity; log.info(ModuleConstant.URL_TICKET); - try { - resultBean.setData(dbyWechatExtService.parseRequest(formDTO)); - responseEntity = new ResponseEntity(resultBean, HttpStatus.OK); - log.info(ModuleConstant.SUCCESS_TICKET); - } catch (Exception e) { - log.error(ModuleConstant.ERROR_URL_TICKET, e.getMessage(), e); - } - return new Result(); + resultBean.setData(dbyWechatExtService.parseRequest(formDTO)); + log.info(ModuleConstant.SUCCESS_TICKET); + return new Result().ok(resultBean); } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java index df02a38ada..3a6b4c17dc 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java @@ -4,7 +4,7 @@ import com.epmet.constant.ThirdPlatformConstant; import com.epmet.dto.form.ThirdPlatformEventFormDTO; import com.epmet.exception.AesException; import com.epmet.service.DbyWechatExtService; -import com.epmet.util.ModuleConstant; +import com.epmet.constant.ModuleConstant; import com.epmet.util.WXBizMsgCrypt; import com.epmet.util.WXXmlToMapUtil; import lombok.extern.slf4j.Slf4j; diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/PKCS7EncoderUtil.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/PKCS7EncoderUtil.java new file mode 100644 index 0000000000..1cfac333af --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/PKCS7EncoderUtil.java @@ -0,0 +1,63 @@ +package com.epmet.util; + +import com.epmet.commons.tools.constant.NumConstant; + +import java.nio.charset.Charset; +import java.util.Arrays; + +/** + * @Author zxc + * @CreateTime 2020/7/6 10:45 + */ +public class PKCS7EncoderUtil { + + static Charset CHARSET = Charset.forName("utf-8"); + static int BLOCK_SIZE = 32; + + /** + * 获得对明文进行补位填充的字节. + * + * @param count 需要进行填充补位操作的明文字节个数 + * @return 补齐用的字节数组 + */ + static byte[] encode(int count) { + // 计算需要填充的位数 + int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE); + if (amountToPad == NumConstant.ZERO) { + amountToPad = BLOCK_SIZE; + } + // 获得补位所用的字符 + char padChr = chr(amountToPad); + String tmp = new String(); + for (int index = NumConstant.ZERO; index < amountToPad; index++) { + tmp += padChr; + } + return tmp.getBytes(CHARSET); + } + + /** + * 删除解密后明文的补位字符 + * + * @param decrypted 解密后的明文 + * @return 删除补位字符后的明文 + */ + static byte[] decode(byte[] decrypted) { + int pad = (int) decrypted[decrypted.length - 1]; + if (pad < NumConstant.ONE || pad > 32) { + pad = NumConstant.ZERO; + } + return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad); + } + + /** + * 将数字转化成ASCII码对应的字符,用于对明文进行补码 + * + * @param a 需要转化的数字 + * @return 转化得到的字符 + */ + static char chr(int a) { + byte target = (byte) (a & 0xFF); + return (char) target; + } + +} From 4849cc50b3e91fabf4147d378953211fd22f8289 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 7 Jul 2020 10:26:14 +0800 Subject: [PATCH 05/90] =?UTF-8?q?=E4=BD=93=E9=AA=8C=E7=89=88=EF=BC=9Aresim?= =?UTF-8?q?ine=E3=80=81govvoice+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-voice/gov-voice-server/deploy/docker-compose-test.yml | 2 +- .../resi-mine/resi-mine-server/deploy/docker-compose-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-test.yml b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-test.yml index 64a93fed78..534a815584 100644 --- a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-test.yml +++ b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-voice-server: container_name: gov-voice-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-voice-server:0.3.58 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-voice-server:0.3.59 ports: - "8105:8105" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-test.yml b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-test.yml index 7c0df9fcde..d373324986 100644 --- a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-test.yml +++ b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-mine-server: container_name: resi-mine-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-mine-server:0.3.28 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-mine-server:0.3.29 ports: - "8094:8094" network_mode: host # 使用现有网络 From a65ee54d5e90e12623a186087afe80dac313fb5a Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 7 Jul 2020 10:38:32 +0800 Subject: [PATCH 06/90] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E9=9C=80=E5=8F=91=E5=B8=83=EF=BC=9Aresimine=E3=80=81govvoice?= =?UTF-8?q?=E3=80=81resigroup,=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-voice/gov-voice-server/deploy/docker-compose-prod.yml | 2 +- .../resi-mine/resi-mine-server/deploy/docker-compose-prod.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml index a91f4e4c9a..36d357c786 100644 --- a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-voice-server: container_name: gov-voice-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-voice-server:0.3.58 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-voice-server:0.3.59 ports: - "8105:8105" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-prod.yml b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-prod.yml index ed98c25963..2b0c7460a7 100644 --- a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-prod.yml +++ b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-mine-server: container_name: resi-mine-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-mine-server:0.3.28 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-mine-server:0.3.29 ports: - "8094:8094" network_mode: host # 使用现有网络 From 3b37988b4c8063cfcd1b0b96257744f39e7a148a Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 7 Jul 2020 12:47:16 +0800 Subject: [PATCH 07/90] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E9=9C=80=E5=8F=91=E5=B8=83=EF=BC=9Agovvoice0.3.60?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-voice/gov-voice-server/deploy/docker-compose-prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml index 36d357c786..8fcad365f2 100644 --- a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-voice-server: container_name: gov-voice-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-voice-server:0.3.59 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-voice-server:0.3.60 ports: - "8105:8105" network_mode: host # 使用现有网络 From 8e4226cd440d154d2a85c48756b50384ee0b31b5 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 7 Jul 2020 13:27:58 +0800 Subject: [PATCH 08/90] =?UTF-8?q?=E9=83=A8=E7=BD=B2gateway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/deploy/docker-compose-prod.yml | 2 +- epmet-gateway/deploy/docker-compose-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-gateway/deploy/docker-compose-prod.yml b/epmet-gateway/deploy/docker-compose-prod.yml index 5bdf5fda68..bf31e2a0ca 100644 --- a/epmet-gateway/deploy/docker-compose-prod.yml +++ b/epmet-gateway/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.22 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.23 ports: - "8080:8080" network_mode: host # 使用现有网络 diff --git a/epmet-gateway/deploy/docker-compose-test.yml b/epmet-gateway/deploy/docker-compose-test.yml index 44bcb9c5dd..1d72f6bc4b 100644 --- a/epmet-gateway/deploy/docker-compose-test.yml +++ b/epmet-gateway/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-gateway:0.3.22 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-gateway:0.3.23 ports: - "8080:8080" network_mode: host # 使用现有网络 From 309f737972c4422a0ace964b4099e3bc4a23fa4b Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 7 Jul 2020 13:44:34 +0800 Subject: [PATCH 09/90] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E4=B8=AAip=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/commons/tools/utils/IpUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java index 86d279f3b6..b100daac7a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java @@ -54,7 +54,7 @@ public class IpUtils { ip = request.getRemoteAddr(); } //对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 - if (ip != null && ip.length() > 15) { //"***.***.***.***".length() = 15 + if (ip != null) { //"***.***.***.***".length() = 15 if (ip.indexOf(",") > 0) { ip = ip.substring(0, ip.indexOf(",")); } From c6673c479f238a4736f5d5edcf1da13273cbe242 Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 7 Jul 2020 13:56:46 +0800 Subject: [PATCH 10/90] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E6=9F=A5=E8=AF=A2=E4=B8=8A=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E7=99=BB=E9=99=86=E7=9A=84=E7=BD=91=E6=A0=BC=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=BA=A7=E5=88=AB=E4=B8=BAlog=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E8=AF=A5=E5=B7=A5=E4=BD=9C=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E4=B8=8D=E9=9A=B6=E5=B1=9E=E4=BA=8E=E7=BD=91=E6=A0=BC=E8=80=8C?= =?UTF-8?q?=E7=9B=B4=E5=B1=9E=E4=B8=8E=E9=83=A8=E9=97=A8=E6=88=96=E8=80=85?= =?UTF-8?q?=E6=9C=BA=E5=85=B3=EF=BC=8C=E5=B7=A5=E4=BD=9C=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E7=BD=91=E6=A0=BC=E8=AE=BF=E9=97=AE=E8=AE=B0=E5=BD=95=E4=B8=AD?= =?UTF-8?q?=E5=B0=86=E6=B2=A1=E6=9C=89=E6=AD=A4=E4=BA=BA=E7=9A=84=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/impl/StaffAgencyServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index ec96daa291..de87b9eea4 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java @@ -223,7 +223,7 @@ public class StaffAgencyServiceImpl implements StaffAgencyService { return staffGridResult; } } - logger.error(String.format("客户id%s,staffId%s查询最后一次登录网格为空",latestGridFormDTO.getCustomerId(),latestGridFormDTO.getStaffId())); + logger.info(String.format("客户id%s,staffId%s查询最后一次登录网格为空",latestGridFormDTO.getCustomerId(),latestGridFormDTO.getStaffId())); //.error(StaffAgencyConstant.QUERY_LATEST_GRID_INFO_FAILED) return new Result<>(); } From 2ed8aad0f1707a167d544d9238ce00d8b5aca4f3 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Tue, 7 Jul 2020 14:55:04 +0800 Subject: [PATCH 11/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/pom.xml | 2 +- .../epmet/constant/ThirdPlatformConstant.java | 17 +++ .../form/ComponentVerifyTicketFormDTO.java | 35 +++++ .../form/WeChatPlatformAuthCodeFormDTO.java | 25 +++ .../epmet-third-platform-server/pom.xml | 12 +- .../com/epmet/constant/ModuleConstant.java | 24 ++- .../ComponentVerifyTicketController.java | 44 ++++-- .../main/java/com/epmet/redis/RedisThird.java | 45 ++++++ .../service/ComponentVerifyTicketService.java | 46 ++++++ .../epmet/service/DbyWechatExtService.java | 24 --- .../ComponentVerifyTicketServiceImpl.java | 144 ++++++++++++++++++ .../service/impl/DbyWechatExtServiceImpl.java | 59 ------- .../src/main/resources/bootstrap.yml | 17 +-- 13 files changed, 381 insertions(+), 113 deletions(-) create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/WeChatPlatformAuthCodeFormDTO.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/redis/RedisThird.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java delete mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/DbyWechatExtService.java create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java delete mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 387ded533e..eec27085ba 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -187,7 +187,7 @@ - http://localhost:8109 + http://localhost:8110 diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/constant/ThirdPlatformConstant.java b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/constant/ThirdPlatformConstant.java index 09f8af7681..e047538a40 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/constant/ThirdPlatformConstant.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/constant/ThirdPlatformConstant.java @@ -26,4 +26,21 @@ public interface ThirdPlatformConstant { */ String PLATFORM_COMPONENT_TOKEN = "****************"; + /** + * + */ + String API_COMPONENT_TOKEN_URl = "**************"; + + /** + * + */ + String API_CREATE_PREAUTHCODE_URL = "***************"; + + /** + * + */ + String API_QUERY_AUTH_URL = "**********"; + + + } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java new file mode 100644 index 0000000000..6093755bea --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/7 11:12 + */ +@Data +public class ComponentVerifyTicketFormDTO implements Serializable { + + private static final long serialVersionUID = -6547893374373422628L; + + /** + * 第三方平台 appid + */ + private String appId; + + /** + * 时间戳,单位:s + */ + private Integer CreateTime; + + /** + * 固定为:"component_verify_ticket" + */ + private String InfoType = "component_verify_ticket"; + + /** + * Ticket 内容 + */ + private String componentVerifyTicket; +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/WeChatPlatformAuthCodeFormDTO.java b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/WeChatPlatformAuthCodeFormDTO.java new file mode 100644 index 0000000000..1cd006b004 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/WeChatPlatformAuthCodeFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/7 10:28 + */ +@Data +public class WeChatPlatformAuthCodeFormDTO implements Serializable { + + private static final long serialVersionUID = -9047434066325122697L; + + /** + * 预授权码 + */ + private String authCode; + + /** + * 有效期,单位:秒 + */ + private Integer expiresIn; +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml b/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml index ecda6c12df..2ca9cbae36 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml @@ -93,6 +93,14 @@ + + + com.squareup.okhttp3 + okhttp + 4.3.1 + + + org.springframework.boot spring-boot-starter-test @@ -148,7 +156,7 @@ true - 8109 + 8110 dev @@ -180,7 +188,7 @@ true --> - 8109 + 8110 test diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/constant/ModuleConstant.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/constant/ModuleConstant.java index 79582996cf..4e220ae7d7 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/constant/ModuleConstant.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/constant/ModuleConstant.java @@ -6,19 +6,29 @@ package com.epmet.constant; */ public interface ModuleConstant { - String START_RECEIVE = "==============================开始授权事件接收URL================================="; - String TICKET_KEY = "ComponentVerifyTicket"; String TICKET_UNDERLINE_KEY = "component_verify_ticket"; + String SUCCESS = "success"; + + String COMPONENT_APPID = "component_appid"; + + String COMPONENT_APPSECRET = "component_appsecret"; + + String COMPONENT_ACCESS_TOKEN = "component_access_token"; + + String PRE_AUTH_CODE = "pre_auth_code"; + + String AUTHORIZATION_CODE = "authorization_code"; + String AUTH_TICKET = "====================授权票据【ComponentVerifyTicket】:【%s】===================="; String ERROR_TICKET = "微信开放平台,第三方平台获取【验证票据】失败"; String END_TICKET = "==============================结束授权事件接收URL================================="; - String SUCCESS = "success"; + String START_RECEIVE = "==============================开始授权事件接收URL================================="; String URL_TICKET = "授权事件接收URL,验证票据"; @@ -26,4 +36,12 @@ public interface ModuleConstant { String ERROR_URL_TICKET = "第三方平台授权事件接收URL,验证票据异常"; + String SUCCESS_ACCESS_TOKEN = "====================结束执行定时任务获取令牌【component_access_token】===================="; + + String FAILURE_ACCESS_TOKEN = "微信开放平台,第三方平台获取【令牌】失败"; + + String TICKET_REDIS_KEY = "epmet:wechartthird:componentverifyticket"; + + + } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java index 290e7a1489..3de7de9d66 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java @@ -1,15 +1,16 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.ThirdPlatformEventFormDTO; +import com.epmet.dto.form.WeChatPlatformAuthCodeFormDTO; import com.epmet.dto.result.ResultBean; -import com.epmet.service.DbyWechatExtService; -import com.epmet.constant.ModuleConstant; +import com.epmet.service.ComponentVerifyTicketService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @@ -23,16 +24,37 @@ import org.springframework.web.bind.annotation.RestController; public class ComponentVerifyTicketController { @Autowired - private DbyWechatExtService dbyWechatExtService; + private ComponentVerifyTicketService componentVerifyTicketService; @PostMapping(value = "/event") - public Result wechatPlatformEvent(@RequestBody ThirdPlatformEventFormDTO formDTO) { + public Result weChatPlatformEvent(@RequestBody ThirdPlatformEventFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, ThirdPlatformEventFormDTO.ThirdPlatForm.class); - ResultBean resultBean = new ResultBean(); - log.info(ModuleConstant.URL_TICKET); - resultBean.setData(dbyWechatExtService.parseRequest(formDTO)); - log.info(ModuleConstant.SUCCESS_TICKET); - return new Result().ok(resultBean); + componentVerifyTicketService.parseRequest(formDTO); + return new Result(); + } + + @PostMapping("ticketjob") + public Result ticketJob() { + componentVerifyTicketService.ticketJob(); + return new Result(); + } + + @PostMapping("preauthcode") + public Result preAuthCode(){ + componentVerifyTicketService.preAuthCode(); + return new Result(); + } + + /** + * @Description + * @param formDTO + * @author zxc + */ + @PostMapping(value = "/authcode") + public Result weChatPlatformAuthCode(@RequestBody WeChatPlatformAuthCodeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + componentVerifyTicketService.weChatPlatformAuthCode(formDTO); + return new Result(); } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/redis/RedisThird.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/redis/RedisThird.java new file mode 100644 index 0000000000..9ba6820911 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/redis/RedisThird.java @@ -0,0 +1,45 @@ +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.constant.ModuleConstant; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; + +import java.util.concurrent.TimeUnit; + +/** + * @Author zxc + * @CreateTime 2020/7/7 9:33 + */ +@Slf4j +@Component +public class RedisThird { + + @Autowired + private RedisUtils redisUtils; + @Autowired + private RedisTemplate redisTemplate; + + public void setComponentAccessToken (String accessToken){ + redisTemplate.opsForValue().set(ModuleConstant.COMPONENT_ACCESS_TOKEN, accessToken, 60 * 60 * 2, TimeUnit.SECONDS); + } + + public String getComponentAccessToken(String key){ + return redisTemplate.opsForValue().get(key).toString(); + } + + public String getComponentVerifyTicket(String key){ + return redisTemplate.opsForValue().get(key).toString(); + } + + public void setComponentVerifyTicket(String verifyTicket){ + redisTemplate.opsForValue().set(ModuleConstant.TICKET_REDIS_KEY+ModuleConstant.TICKET_UNDERLINE_KEY, verifyTicket, 60 * 10, TimeUnit.SECONDS); + } + + public void setPreAuthCode(String authCode){ + redisTemplate.opsForValue().set(ModuleConstant.PRE_AUTH_CODE, authCode, 60 * 10, TimeUnit.SECONDS); + } + +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java new file mode 100644 index 0000000000..b1bbb6fb4d --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java @@ -0,0 +1,46 @@ +package com.epmet.service; + +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.form.ThirdPlatformEventFormDTO; +import com.epmet.dto.form.WeChatPlatformAuthCodeFormDTO; +import com.epmet.dto.result.ResultBean; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * @Author zxc + * @CreateTime 2020/7/6 11:19 + */ +public interface ComponentVerifyTicketService { + + /** + * 获得授权事件的票据 + * + * @param timestamp 时间戳 + * @param nonce 随机数 + * @param msgSignature 消息体签名 + * @param postData 消息体 + * @return 如果获得只需要返回 SUCCESS + * @Author zxc + */ + void parseRequest(ThirdPlatformEventFormDTO formDTO); + + /** + * @Description 定时获取 ticket + * @author zxc + */ + void ticketJob(); + + /** + * @Description 每个预授权码有效期为 10 分钟。需要先获取令牌才能调用 获取预授权码 + * @author zxc + */ + void preAuthCode(); + + /** + * @Description + * @param formDTO + * @author zxc + */ + void weChatPlatformAuthCode(WeChatPlatformAuthCodeFormDTO formDTO); + +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/DbyWechatExtService.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/DbyWechatExtService.java deleted file mode 100644 index d8cdef3e1c..0000000000 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/DbyWechatExtService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.epmet.service; - -import com.epmet.dto.form.ThirdPlatformEventFormDTO; - -/** - * @Author zxc - * @CreateTime 2020/7/6 9:12 - */ -public interface DbyWechatExtService { - - /** - * 获得授权事件的票据 - * - * @param timestamp 时间戳 - * @param nonce 随机数 - * @param msgSignature 消息体签名 - * @param postData 消息体 - * @return 如果获得只需要返回 SUCCESS - * @Author zxc - */ - String parseRequest(ThirdPlatformEventFormDTO formDTO); - - -} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java new file mode 100644 index 0000000000..62ef4bef35 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -0,0 +1,144 @@ +package com.epmet.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.constant.ModuleConstant; +import com.epmet.constant.ThirdPlatformConstant; +import com.epmet.dto.form.ThirdPlatformEventFormDTO; +import com.epmet.dto.form.WeChatPlatformAuthCodeFormDTO; +import com.epmet.exception.AesException; +import com.epmet.redis.RedisThird; +import com.epmet.service.ComponentVerifyTicketService; +import com.epmet.util.WXBizMsgCrypt; +import com.epmet.util.WXXmlToMapUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +import static com.epmet.constant.ThirdPlatformConstant.*; + +/** + * @Author zxc + * @CreateTime 2020/7/6 11:21 + */ +@Slf4j +@Service +public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketService { + + @Autowired + private RedisThird redisThird; + + /** + * @Description 获得授权事件的票据 + * @param formDTO + * @author zxc + */ + @Override + public void parseRequest(ThirdPlatformEventFormDTO formDTO) { + String msgSignature = formDTO.getMsgSignature(); + String nonce = formDTO.getNonce(); + String postData = formDTO.getPostData(); + String timeStamp = formDTO.getTimeStamp(); + log.info(ModuleConstant.START_RECEIVE); + try { + //这个类是微信官网提供的解密类,需要用到消息校验Token 消息加密Key和服务平台appid + WXBizMsgCrypt pc = new WXBizMsgCrypt(ThirdPlatformConstant.PLATFORM_COMPONENT_TOKEN, ThirdPlatformConstant.PLATFORM_AES_KEY, ThirdPlatformConstant.PLATFORM_APP_ID); + String xml = pc.decryptMsg(msgSignature, timeStamp, nonce, postData); + // 将xml转为map + Map result = WXXmlToMapUtil.xmlToMap(xml); + String componentVerifyTicket = MapUtils.getString(result,ModuleConstant.TICKET_KEY); + if (StringUtils.isNotEmpty(componentVerifyTicket)) { + // 存储平台授权票据,保存ticket + redisThird.setComponentVerifyTicket(componentVerifyTicket); + } else { + throw new RuntimeException(ModuleConstant.ERROR_TICKET); + } + } catch (AesException e) { + e.printStackTrace(); + } + log.info(ModuleConstant.END_TICKET); + } + + /** + * @Description 定时获取票据 + * @param + * @author zxc + */ + @Override + public void ticketJob() { + log.info("====================开始执行定时任务获取令牌【component_access_token】===================="); + Map reMap; + try { + // 核心定时器,每一个小时执行一次 + String componentVerifyTicket = redisThird.getComponentVerifyTicket(ModuleConstant.TICKET_UNDERLINE_KEY); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); + jsonObject.put(ModuleConstant.COMPONENT_APPSECRET, PLATFORM_APP_SECRET); + jsonObject.put(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket); +// String post = OkHttpHelper.post(API_COMPONENT_TOKEN_URl, JSON.toJSONString(jsonObject)); + String post = null; + log.info("====================返回post结果:" + post); + HashMap hashMap = JSON.parseObject(post, HashMap.class); + String componentAccessToken = hashMap.get(ModuleConstant.COMPONENT_ACCESS_TOKEN); + if (StringUtils.isNotEmpty(componentAccessToken)) { + redisThird.setComponentAccessToken(componentAccessToken); + } else { + throw new RuntimeException(ModuleConstant.FAILURE_ACCESS_TOKEN); + } + } catch (Exception e) { + e.printStackTrace(); + } + log.info(ModuleConstant.SUCCESS_ACCESS_TOKEN); + } + + /** + * @Description 定时获取预授权码 + * @param + * @author zxc + */ + @Override + public void preAuthCode() { + log.info("====================开始执行定时任务获取预授权码【pre_auth_code】===================="); + try { +// String accessToken = redisTemplate.opsForValue().get(ModuleConstant.COMPONENT_ACCESS_TOKEN).toString(); + String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); +// String post = OkHttpHelper.post(API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)); + String post = null; + log.info("====================返回post结果:" + post); + HashMap hashMap = JSON.parseObject(post, HashMap.class); + String authCode = hashMap.get("pre_auth_code"); + if (StringUtils.isNotEmpty(authCode)) { + redisThird.setPreAuthCode(authCode); +// redisTemplate.opsForValue().set("pre_auth_code", authCode, 60 * 10, TimeUnit.SECONDS); + } else { + throw new RuntimeException("微信开放平台,第三方平台获取【预授权码】失败"); + } + } catch (Exception e) { + e.printStackTrace(); + } + log.info("====================结束执行定时任务获取预授权码【pre_auth_code】===================="); + } + + @Override + public void weChatPlatformAuthCode(WeChatPlatformAuthCodeFormDTO formDTO) { + String authCode = formDTO.getAuthCode(); + Integer expiresIn = formDTO.getExpiresIn(); + // 获取令牌【component_access_token】 + String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN); + // 使用授权码获取授权信息 + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); + jsonObject.put(ModuleConstant.AUTHORIZATION_CODE, authCode); +// String post = OkHttpHelper.post(API_QUERY_AUTH_URL + accessToken, JSON.toJSONString(jsonObject)); + // 重定向地址 +// response.sendRedirect("/wechat/authcode"); + } +} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java deleted file mode 100644 index 3a6b4c17dc..0000000000 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.epmet.service.impl; - -import com.epmet.constant.ThirdPlatformConstant; -import com.epmet.dto.form.ThirdPlatformEventFormDTO; -import com.epmet.exception.AesException; -import com.epmet.service.DbyWechatExtService; -import com.epmet.constant.ModuleConstant; -import com.epmet.util.WXBizMsgCrypt; -import com.epmet.util.WXXmlToMapUtil; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.MapUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; - -import java.util.Map; -import java.util.concurrent.TimeUnit; - -/** - * @Author zxc - * @CreateTime 2020/7/6 9:13 - */ -@Slf4j -@Service -public class DbyWechatExtServiceImpl implements DbyWechatExtService { - - @Autowired - private RedisTemplate redisTemplate; - - @Override - public String parseRequest(ThirdPlatformEventFormDTO formDTO) { - String msgSignature = formDTO.getMsgSignature(); - String nonce = formDTO.getNonce(); - String postData = formDTO.getPostData(); - String timeStamp = formDTO.getTimeStamp(); - log.info(ModuleConstant.START_RECEIVE); - try { - //这个类是微信官网提供的解密类,需要用到消息校验Token 消息加密Key和服务平台appid - WXBizMsgCrypt pc = new WXBizMsgCrypt(ThirdPlatformConstant.PLATFORM_COMPONENT_TOKEN, ThirdPlatformConstant.PLATFORM_AES_KEY, ThirdPlatformConstant.PLATFORM_APP_ID); - String xml = pc.decryptMsg(msgSignature, timeStamp, nonce, postData); - // 将xml转为map - Map result = WXXmlToMapUtil.xmlToMap(xml); - String componentVerifyTicket = MapUtils.getString(result,ModuleConstant.TICKET_KEY); - if (StringUtils.isNotEmpty(componentVerifyTicket)) { - // 存储平台授权票据,保存ticket - redisTemplate.opsForValue().set(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket, 60 * 10, TimeUnit.SECONDS); - String verifyTicket = redisTemplate.opsForValue().get(ModuleConstant.TICKET_UNDERLINE_KEY).toString(); - log.info(String.format(ModuleConstant.AUTH_TICKET,verifyTicket)); - } else { - throw new RuntimeException(ModuleConstant.ERROR_TICKET); - } - } catch (AesException e) { - e.printStackTrace(); - } - log.info(ModuleConstant.END_TICKET); - return ModuleConstant.SUCCESS; - } -} diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/bootstrap.yml index 6c385f79f8..5e2f47ba4a 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/bootstrap.yml @@ -8,7 +8,7 @@ spring: allow-bean-definition-overriding: true application: name: epmet-third-platform-server - # dev|test|prod + # dev|test|prod profiles: active: dev jackson: @@ -31,9 +31,7 @@ spring: nacos: discovery: server-addr: @nacos.server-addr@ - #nacosռIDĬpublic namespace: @nacos.discovery.namespace@ - #Լעᵽעĵĵַ register-enabled: @nacos.register-enabled@ ip: @nacos.ip@ config: @@ -42,7 +40,6 @@ spring: namespace: @nacos.config.namespace@ group: @nacos.config.group@ file-extension: yaml - # Ǩƹflyway flyway: enabled: @spring.flyway.enabled@ locations: classpath:db/migration @@ -62,19 +59,14 @@ management: mybatis-plus: mapper-locations: classpath:/mapper/**/*.xml - #ʵɨ裬packageöŻ߷ֺŷָ typeAliasesPackage: com.epmet.entity global-config: - #ݿ db-config: - # AUTO:"ݿID", INPUT:"ûID", ID_WORKER:"ȫΨһID (ΨһID)", UUID:"ȫΨһID UUID"; id-type: ID_WORKER - #ֶβ IGNORED:"ж",NOT_NULL:" NULL ж"),NOT_EMPTY:"ǿж" field-strategy: NOT_NULL - #շ»ת column-underline: true banner: false - #ԭ + configuration: map-underscore-to-camel-case: true cache-enabled: false @@ -97,13 +89,12 @@ hystrix: execution: isolation: thread: - timeoutInMilliseconds: 60000 #ȱʡΪ1000 + timeoutInMilliseconds: 60000 ribbon: ReadTimeout: 300000 ConnectTimeout: 300000 -#pageHelperҳ pagehelper: helper-dialect: mysql - reasonable: false #ҳãҳΪ-1ԶתΪСҳ1 \ No newline at end of file + reasonable: false \ No newline at end of file From 67fe5173cf0d7edca876e4532c0df572d6c4a706 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 7 Jul 2020 15:36:29 +0800 Subject: [PATCH 12/90] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=EF=BC=9Aresigoup+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resi-group/resi-group-server/deploy/docker-compose-dev.yml | 2 +- .../resi-group/resi-group-server/deploy/docker-compose-prod.yml | 2 +- .../resi-group/resi-group-server/deploy/docker-compose-test.yml | 2 +- epmet-module/resi-group/resi-group-server/pom.xml | 2 +- .../invitation/service/impl/GroupInvitationServiceImpl.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml index 281ea59d07..e260e52f61 100644 --- a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-group-server: container_name: resi-group-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-group-server:0.3.61 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-group-server:0.3.62 ports: - "8095:8095" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-prod.yml b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-prod.yml index 5a39890745..ed45553393 100644 --- a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-prod.yml +++ b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-group-server: container_name: resi-group-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-group-server:0.3.61 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-group-server:0.3.62 ports: - "8095:8095" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-test.yml b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-test.yml index 6d5b2048fa..8ba5a78e5e 100644 --- a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-test.yml +++ b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-group-server: container_name: resi-group-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-group-server:0.3.61 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-group-server:0.3.62 ports: - "8095:8095" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-group/resi-group-server/pom.xml b/epmet-module/resi-group/resi-group-server/pom.xml index 0b734ec6b3..f5a85b9ff7 100644 --- a/epmet-module/resi-group/resi-group-server/pom.xml +++ b/epmet-module/resi-group/resi-group-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.61 + 0.3.62 com.epmet resi-group diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java index 120e09d831..30c1ee44ba 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java @@ -199,7 +199,7 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl Date: Tue, 7 Jul 2020 17:17:17 +0800 Subject: [PATCH 13/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ComponentVerifyTicketController.java | 21 +++++++------------ .../service/ComponentVerifyTicketService.java | 2 +- .../ComponentVerifyTicketServiceImpl.java | 8 ++----- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java index 3de7de9d66..a6c7300c68 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java @@ -1,35 +1,30 @@ package com.epmet.controller; -import com.epmet.commons.tools.annotation.LoginUser; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.ThirdPlatformEventFormDTO; import com.epmet.dto.form.WeChatPlatformAuthCodeFormDTO; -import com.epmet.dto.result.ResultBean; import com.epmet.service.ComponentVerifyTicketService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * @Author zxc * @CreateTime 2020/7/6 9:07 */ @Slf4j -@RestController +@RestController("third") public class ComponentVerifyTicketController { @Autowired private ComponentVerifyTicketService componentVerifyTicketService; - @PostMapping(value = "/event") - public Result weChatPlatformEvent(@RequestBody ThirdPlatformEventFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, ThirdPlatformEventFormDTO.ThirdPlatForm.class); - componentVerifyTicketService.parseRequest(formDTO); + @PostMapping(value = "/ticket") + public Result weChatPlatformEvent(@RequestParam("timestamp") String timestamp, + @RequestParam("nonce") String nonce, + @RequestParam("msg_signature") String msgSignature, + @RequestBody String postData) { + componentVerifyTicketService.parseRequest(timestamp,nonce,msgSignature,postData); return new Result(); } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java index b1bbb6fb4d..3caf0c3703 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java @@ -22,7 +22,7 @@ public interface ComponentVerifyTicketService { * @return 如果获得只需要返回 SUCCESS * @Author zxc */ - void parseRequest(ThirdPlatformEventFormDTO formDTO); + void parseRequest(String timestamp,String nonce,String msgSignature,String postData); /** * @Description 定时获取 ticket diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 62ef4bef35..782fabfac7 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -36,15 +36,11 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe /** * @Description 获得授权事件的票据 - * @param formDTO + * @param * @author zxc */ @Override - public void parseRequest(ThirdPlatformEventFormDTO formDTO) { - String msgSignature = formDTO.getMsgSignature(); - String nonce = formDTO.getNonce(); - String postData = formDTO.getPostData(); - String timeStamp = formDTO.getTimeStamp(); + public void parseRequest(String timeStamp,String nonce,String msgSignature,String postData) { log.info(ModuleConstant.START_RECEIVE); try { //这个类是微信官网提供的解密类,需要用到消息校验Token 消息加密Key和服务平台appid From 98c3767a77fe9b0fa6350adfab2a7e0abac5261d Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Tue, 7 Jul 2020 18:28:04 +0800 Subject: [PATCH 14/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-platform-server/pom.xml | 1 - .../com/epmet/constant/ModuleConstant.java | 4 +++ .../main/java/com/epmet/redis/RedisThird.java | 35 +++++++++++++++---- .../ComponentVerifyTicketServiceImpl.java | 22 ++++++------ .../java/com/epmet/util/OkHttpHelper.java | 30 ++++++++++++++++ 5 files changed, 75 insertions(+), 17 deletions(-) create mode 100644 epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/OkHttpHelper.java diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml b/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml index 2ca9cbae36..aa7bc1f05f 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml @@ -100,7 +100,6 @@ 4.3.1 - org.springframework.boot spring-boot-starter-test diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/constant/ModuleConstant.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/constant/ModuleConstant.java index 4e220ae7d7..8758c9a05a 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/constant/ModuleConstant.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/constant/ModuleConstant.java @@ -42,6 +42,10 @@ public interface ModuleConstant { String TICKET_REDIS_KEY = "epmet:wechartthird:componentverifyticket"; + String PRE_AUTH_CODE_REDIS_KEY = "epmet:wechartthird:preauthcode"; + + String ACCESS_TOKEN_REDIS_KEY = "epmet:wechartthird:preauthcode"; + } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/redis/RedisThird.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/redis/RedisThird.java index 9ba6820911..678d86f1d0 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/redis/RedisThird.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/redis/RedisThird.java @@ -17,29 +17,52 @@ import java.util.concurrent.TimeUnit; @Component public class RedisThird { - @Autowired - private RedisUtils redisUtils; @Autowired private RedisTemplate redisTemplate; + /** + * @Description 缓存 component_access_token 有效期:2H + * @param accessToken + * @author zxc + */ public void setComponentAccessToken (String accessToken){ - redisTemplate.opsForValue().set(ModuleConstant.COMPONENT_ACCESS_TOKEN, accessToken, 60 * 60 * 2, TimeUnit.SECONDS); + redisTemplate.opsForValue().set(ModuleConstant.ACCESS_TOKEN_REDIS_KEY+ModuleConstant.COMPONENT_ACCESS_TOKEN, accessToken, 60 * 60 * 2, TimeUnit.SECONDS); } + /** + * @Description 获取 component_access_token + * @param key + * @author zxc + */ public String getComponentAccessToken(String key){ - return redisTemplate.opsForValue().get(key).toString(); + return redisTemplate.opsForValue().get(ModuleConstant.ACCESS_TOKEN_REDIS_KEY+key).toString(); } + /** + * @Description 获取 component_verify_ticket + * @param key + * @author zxc + */ public String getComponentVerifyTicket(String key){ - return redisTemplate.opsForValue().get(key).toString(); + return redisTemplate.opsForValue().get(ModuleConstant.TICKET_REDIS_KEY+ModuleConstant.TICKET_REDIS_KEY+key).toString(); } + /** + * @Description 缓存 component_verify_ticket 有效期:10min + * @param verifyTicket + * @author zxc + */ public void setComponentVerifyTicket(String verifyTicket){ redisTemplate.opsForValue().set(ModuleConstant.TICKET_REDIS_KEY+ModuleConstant.TICKET_UNDERLINE_KEY, verifyTicket, 60 * 10, TimeUnit.SECONDS); } + /** + * @Description 缓存 pre_auth_code 有效期:10min + * @param authCode + * @author zxc + */ public void setPreAuthCode(String authCode){ - redisTemplate.opsForValue().set(ModuleConstant.PRE_AUTH_CODE, authCode, 60 * 10, TimeUnit.SECONDS); + redisTemplate.opsForValue().set(ModuleConstant.PRE_AUTH_CODE_REDIS_KEY+ModuleConstant.PRE_AUTH_CODE, authCode, 60 * 10, TimeUnit.SECONDS); } } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 782fabfac7..7637c4af1c 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -2,14 +2,13 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.constant.ModuleConstant; import com.epmet.constant.ThirdPlatformConstant; -import com.epmet.dto.form.ThirdPlatformEventFormDTO; import com.epmet.dto.form.WeChatPlatformAuthCodeFormDTO; import com.epmet.exception.AesException; import com.epmet.redis.RedisThird; import com.epmet.service.ComponentVerifyTicketService; +import com.epmet.util.OkHttpHelper; import com.epmet.util.WXBizMsgCrypt; import com.epmet.util.WXXmlToMapUtil; import lombok.extern.slf4j.Slf4j; @@ -18,6 +17,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -33,6 +33,8 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe @Autowired private RedisThird redisThird; + @Autowired + private OkHttpHelper okHttpHelper; /** * @Description 获得授权事件的票据 @@ -77,9 +79,8 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); jsonObject.put(ModuleConstant.COMPONENT_APPSECRET, PLATFORM_APP_SECRET); jsonObject.put(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket); -// String post = OkHttpHelper.post(API_COMPONENT_TOKEN_URl, JSON.toJSONString(jsonObject)); - String post = null; - log.info("====================返回post结果:" + post); + // todo OkHttpHelper 无法引入 + String post = okHttpHelper.post(API_COMPONENT_TOKEN_URl, JSON.toJSONString(jsonObject)); HashMap hashMap = JSON.parseObject(post, HashMap.class); String componentAccessToken = hashMap.get(ModuleConstant.COMPONENT_ACCESS_TOKEN); if (StringUtils.isNotEmpty(componentAccessToken)) { @@ -102,18 +103,15 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe public void preAuthCode() { log.info("====================开始执行定时任务获取预授权码【pre_auth_code】===================="); try { -// String accessToken = redisTemplate.opsForValue().get(ModuleConstant.COMPONENT_ACCESS_TOKEN).toString(); String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN); JSONObject jsonObject = new JSONObject(); jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); -// String post = OkHttpHelper.post(API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)); - String post = null; + String post = okHttpHelper.post(API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)); log.info("====================返回post结果:" + post); HashMap hashMap = JSON.parseObject(post, HashMap.class); String authCode = hashMap.get("pre_auth_code"); if (StringUtils.isNotEmpty(authCode)) { redisThird.setPreAuthCode(authCode); -// redisTemplate.opsForValue().set("pre_auth_code", authCode, 60 * 10, TimeUnit.SECONDS); } else { throw new RuntimeException("微信开放平台,第三方平台获取【预授权码】失败"); } @@ -133,7 +131,11 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe JSONObject jsonObject = new JSONObject(); jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); jsonObject.put(ModuleConstant.AUTHORIZATION_CODE, authCode); -// String post = OkHttpHelper.post(API_QUERY_AUTH_URL + accessToken, JSON.toJSONString(jsonObject)); + try { + String post = okHttpHelper.post(API_QUERY_AUTH_URL + accessToken, JSON.toJSONString(jsonObject)); + } catch (IOException e) { + e.printStackTrace(); + } // 重定向地址 // response.sendRedirect("/wechat/authcode"); } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/OkHttpHelper.java b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/OkHttpHelper.java new file mode 100644 index 0000000000..0c11244db8 --- /dev/null +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/OkHttpHelper.java @@ -0,0 +1,30 @@ +package com.epmet.util; + +import okhttp3.*; +import org.springframework.stereotype.Component; + +import java.io.IOException; + +/** + * @Author zxc + * @CreateTime 2020/7/7 17:39 + */ +@Component +public class OkHttpHelper { + + public static final MediaType JSON = MediaType.get("application/json; charset=utf-8"); + + OkHttpClient client = new OkHttpClient(); + + public String post(String url, String json) throws IOException { + RequestBody body = RequestBody.create(JSON, json); + Request request = new Request.Builder() + .url(url) + .post(body) + .build(); + try (Response response = client.newCall(request).execute()) { + return response.body().string(); + } + } + +} From 7c21be81876b967aba8f4bb11c78a5a001281a91 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Tue, 7 Jul 2020 19:52:02 +0800 Subject: [PATCH 15/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-platform-server/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml b/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml index aa7bc1f05f..35bf9c1864 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml +++ b/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml @@ -160,9 +160,9 @@ - + - epmet_message_user + epmet_third_user EpmEt-db-UsEr 0 @@ -192,7 +192,7 @@ - + epmet elink@833066 From fe63708456ea0c25d6f2b0f97ada18ad66ac0a22 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Wed, 8 Jul 2020 10:19:25 +0800 Subject: [PATCH 16/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/constant/ServiceConstant.java | 2 +- epmet-gateway/pom.xml | 8 ++-- .../src/main/resources/bootstrap.yml | 8 ++-- .../epmet-third-client}/pom.xml | 12 +---- .../form/ComponentVerifyTicketFormDTO.java | 0 .../dto/form/ThirdPlatformEventFormDTO.java | 0 .../form/WeChatPlatformAuthCodeFormDTO.java | 0 .../java/com/epmet/dto/result/ResultBean.java | 0 .../epmet/feign/EpmetThirdFeignClient.java} | 6 +-- .../EpmetThirdFeignClientFallback.java} | 4 +- .../epmet-third-server}/.gitignore | 0 .../deploy/docker-compose-dev.yml | 8 ++-- .../deploy/docker-compose-test.yml | 8 ++-- .../epmet-third-server}/pom.xml | 8 ++-- .../com/epmet/EpmetThirdApplication.java} | 4 +- .../com/epmet/aspect/RequestLogAspect.java | 0 .../com/epmet/config/ModuleConfigImpl.java | 2 +- .../com/epmet/constant/ModuleConstant.java | 8 ++++ .../epmet/constant/ThirdPlatformConstant.java | 8 ++-- .../ComponentVerifyTicketController.java | 46 ++++++++++++++++--- .../com/epmet/exception/AesException.java | 0 .../main/java/com/epmet/redis/RedisThird.java | 21 ++++++++- .../service/ComponentVerifyTicketService.java | 19 +++++--- .../ComponentVerifyTicketServiceImpl.java | 33 ++++++++++--- .../java/com/epmet/util/OkHttpHelper.java | 0 .../java/com/epmet/util/PKCS7EncoderUtil.java | 0 .../java/com/epmet/util/WXBizMsgCrypt.java | 0 .../java/com/epmet/util/WXXmlToMapUtil.java | 0 .../src/main/resources/bootstrap.yml | 4 +- .../src/main/resources/logback-spring.xml | 0 .../pom.xml | 6 +-- epmet-module/pom.xml | 2 +- 32 files changed, 147 insertions(+), 70 deletions(-) rename epmet-module/{epmet-third-platform/epmet-third-platform-client => epmet-third/epmet-third-client}/pom.xml (64%) rename epmet-module/{epmet-third-platform/epmet-third-platform-client => epmet-third/epmet-third-client}/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java (100%) rename epmet-module/{epmet-third-platform/epmet-third-platform-client => epmet-third/epmet-third-client}/src/main/java/com/epmet/dto/form/ThirdPlatformEventFormDTO.java (100%) rename epmet-module/{epmet-third-platform/epmet-third-platform-client => epmet-third/epmet-third-client}/src/main/java/com/epmet/dto/form/WeChatPlatformAuthCodeFormDTO.java (100%) rename epmet-module/{epmet-third-platform/epmet-third-platform-client => epmet-third/epmet-third-client}/src/main/java/com/epmet/dto/result/ResultBean.java (100%) rename epmet-module/{epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/EpmetThirdPlatformFeignClient.java => epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java} (53%) rename epmet-module/{epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/fallback/EpmetThirdPlatformFeignClientFallback.java => epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java} (50%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/.gitignore (100%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/deploy/docker-compose-dev.yml (57%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/deploy/docker-compose-test.yml (67%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/pom.xml (97%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/EpmetThirdPlatformApplication.java => epmet-third/epmet-third-server/src/main/java/com/epmet/EpmetThirdApplication.java} (76%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/java/com/epmet/aspect/RequestLogAspect.java (100%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/java/com/epmet/config/ModuleConfigImpl.java (92%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/java/com/epmet/constant/ModuleConstant.java (86%) rename epmet-module/{epmet-third-platform/epmet-third-platform-client => epmet-third/epmet-third-server}/src/main/java/com/epmet/constant/ThirdPlatformConstant.java (54%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java (53%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/java/com/epmet/exception/AesException.java (100%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/java/com/epmet/redis/RedisThird.java (69%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/java/com/epmet/service/ComponentVerifyTicketService.java (69%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java (82%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/java/com/epmet/util/OkHttpHelper.java (100%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/java/com/epmet/util/PKCS7EncoderUtil.java (100%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/java/com/epmet/util/WXBizMsgCrypt.java (100%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/java/com/epmet/util/WXXmlToMapUtil.java (100%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/resources/bootstrap.yml (95%) rename epmet-module/{epmet-third-platform/epmet-third-platform-server => epmet-third/epmet-third-server}/src/main/resources/logback-spring.xml (100%) rename epmet-module/{epmet-third-platform => epmet-third}/pom.xml (75%) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index 6857591ab3..58f699d87a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -122,5 +122,5 @@ public interface ServiceConstant { /** * 微信第三方平台 */ - String EPMET_THIRD_PLATFORM_SERVER = "epmet-third-platform-server"; + String EPMET_THIRD_SERVER = "epmet-third-server"; } diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 0d52af65a3..6f5f2e57aa 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -186,8 +186,8 @@ lb://epmet-openapi-scan - - http://localhost:8110 + lb://epmet-third-platform-server + @@ -271,6 +271,8 @@ lb://data-statistical-server lb://epmet-openapi-scan + + lb://epmet-third-server @@ -351,7 +353,7 @@ lb://epmet-openapi-scan - lb://epmet-third-platform-server + lb://epmet-third-server diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index b7c816c002..a926c88fb3 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -287,11 +287,11 @@ spring: - StripPrefix=1 - CpAuth=true #微信第三方平台 - - id: epmet-third-platform-server - uri: @gateway.routes.epmet-third-platform-server.uri@ + - id: epmet-third-server + uri: @gateway.routes.epmet-third-server.uri@ order: 31 predicates: - - Path=${server.servlet.context-path}/epmet/third/platform/** + - Path=${server.servlet.context-path}/third/** filters: - StripPrefix=1 - CpAuth=true @@ -409,7 +409,7 @@ epmet: - /gov/issue/** - /gov/project/** - /resi/home/** - - /epmet/third/platform/** + - /third/** swaggerUrls: jwt: diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/pom.xml b/epmet-module/epmet-third/epmet-third-client/pom.xml similarity index 64% rename from epmet-module/epmet-third-platform/epmet-third-platform-client/pom.xml rename to epmet-module/epmet-third/epmet-third-client/pom.xml index f17f962919..f9e61c9c99 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-client/pom.xml +++ b/epmet-module/epmet-third/epmet-third-client/pom.xml @@ -5,13 +5,13 @@ 4.0.0 - epmet-third-platform + epmet-third com.epmet 2.0.0 - epmet-third-platform-client + epmet-third-client jar @@ -20,14 +20,6 @@ epmet-commons-tools 2.0.0 - - io.springfox - springfox-swagger2 - - - io.springfox - springfox-swagger-ui - diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java similarity index 100% rename from epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java rename to epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ThirdPlatformEventFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformEventFormDTO.java similarity index 100% rename from epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ThirdPlatformEventFormDTO.java rename to epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformEventFormDTO.java diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/WeChatPlatformAuthCodeFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/WeChatPlatformAuthCodeFormDTO.java similarity index 100% rename from epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/WeChatPlatformAuthCodeFormDTO.java rename to epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/WeChatPlatformAuthCodeFormDTO.java diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/result/ResultBean.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ResultBean.java similarity index 100% rename from epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/result/ResultBean.java rename to epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ResultBean.java diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/EpmetThirdPlatformFeignClient.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java similarity index 53% rename from epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/EpmetThirdPlatformFeignClient.java rename to epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java index f325488ebf..db762abafa 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/EpmetThirdPlatformFeignClient.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java @@ -1,7 +1,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.feign.fallback.EpmetThirdPlatformFeignClientFallback; +import com.epmet.feign.fallback.EpmetThirdFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; /** @@ -10,7 +10,7 @@ import org.springframework.cloud.openfeign.FeignClient; * @Author zxc * @CreateTime 2020/7/5 14:45 */ -@FeignClient(name = ServiceConstant.EPMET_THIRD_PLATFORM_SERVER, fallback = EpmetThirdPlatformFeignClientFallback.class) +@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = EpmetThirdFeignClientFallback.class) -public interface EpmetThirdPlatformFeignClient { +public interface EpmetThirdFeignClient { } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/fallback/EpmetThirdPlatformFeignClientFallback.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java similarity index 50% rename from epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/fallback/EpmetThirdPlatformFeignClientFallback.java rename to epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java index c8826df8d6..7e58be23e7 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/feign/fallback/EpmetThirdPlatformFeignClientFallback.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java @@ -1,6 +1,6 @@ package com.epmet.feign.fallback; -import com.epmet.feign.EpmetThirdPlatformFeignClient; +import com.epmet.feign.EpmetThirdFeignClient; import org.springframework.stereotype.Component; /** @@ -8,5 +8,5 @@ import org.springframework.stereotype.Component; * @CreateTime 2020/7/5 14:46 */ @Component -public class EpmetThirdPlatformFeignClientFallback implements EpmetThirdPlatformFeignClient { +public class EpmetThirdFeignClientFallback implements EpmetThirdFeignClient { } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/.gitignore b/epmet-module/epmet-third/epmet-third-server/.gitignore similarity index 100% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/.gitignore rename to epmet-module/epmet-third/epmet-third-server/.gitignore diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml similarity index 57% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-dev.yml rename to epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 61a96bd804..3d0b9404ef 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -1,10 +1,10 @@ version: "3.7" services: - epmet-third-platform-server: - container_name: epmet-third-platform-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-platform-server:0.0.1 + epmet-third-server: + container_name: epmet-third-server-dev + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.1 ports: - - "8109:8109" + - "8110:8110" network_mode: host # 使用现有网络 volumes: - "/opt/epmet-cloud-logs/dev:/logs" diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-test.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml similarity index 67% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-test.yml rename to epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml index e3190c180c..6c17cf45fc 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/deploy/docker-compose-test.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml @@ -1,10 +1,10 @@ version: "3.7" services: - epmet-third-platform-server: - container_name: epmet-third-platform-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-platform-server:0.0.1 + epmet-third-server: + container_name: epmet-third-server-test + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.1 ports: - - "8109:8109" + - "8110:8110" network_mode: host # 使用现有网络 volumes: - "/opt/epmet-cloud-logs/test:/logs" diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml similarity index 97% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml rename to epmet-module/epmet-third/epmet-third-server/pom.xml index 35bf9c1864..b74743ebc9 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -6,11 +6,11 @@ com.epmet - epmet-third-platform + epmet-third 2.0.0 - epmet-third-platform-server + epmet-third-server jar @@ -23,7 +23,7 @@ com.epmet - epmet-third-platform-client + epmet-third-client 2.0.0 @@ -97,7 +97,7 @@ com.squareup.okhttp3 okhttp - 4.3.1 + 4.0.0 diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/EpmetThirdPlatformApplication.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/EpmetThirdApplication.java similarity index 76% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/EpmetThirdPlatformApplication.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/EpmetThirdApplication.java index 5989404eff..2aba843b3f 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/EpmetThirdPlatformApplication.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/EpmetThirdApplication.java @@ -8,10 +8,10 @@ import org.springframework.cloud.openfeign.EnableFeignClients; @SpringBootApplication @EnableDiscoveryClient @EnableFeignClients -public class EpmetThirdPlatformApplication { +public class EpmetThirdApplication { public static void main(String[] args) { - SpringApplication.run(EpmetThirdPlatformApplication.class, args); + SpringApplication.run(EpmetThirdApplication.class, args); } } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/aspect/RequestLogAspect.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/aspect/RequestLogAspect.java similarity index 100% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/aspect/RequestLogAspect.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/aspect/RequestLogAspect.java diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/config/ModuleConfigImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/config/ModuleConfigImpl.java similarity index 92% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/config/ModuleConfigImpl.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/config/ModuleConfigImpl.java index 2ea4a0b4c8..fc8136796e 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/config/ModuleConfigImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/config/ModuleConfigImpl.java @@ -21,6 +21,6 @@ import org.springframework.stereotype.Service; public class ModuleConfigImpl implements ModuleConfig { @Override public String getName() { - return "epmetthirdplatform"; + return "epmetthird"; } } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-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 similarity index 86% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/constant/ModuleConstant.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java index 8758c9a05a..4c744b6c5b 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-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 @@ -22,6 +22,12 @@ public interface ModuleConstant { String AUTHORIZATION_CODE = "authorization_code"; + String AUTHORIZER_APPID = "authorizer_appid"; + + String AUTHORIZATION_INFO = "authorization_info"; + + String AUTHORIZER_REFRESH_TOKEN = "authorizer_refresh_token"; + String AUTH_TICKET = "====================授权票据【ComponentVerifyTicket】:【%s】===================="; String ERROR_TICKET = "微信开放平台,第三方平台获取【验证票据】失败"; @@ -46,6 +52,8 @@ public interface ModuleConstant { String ACCESS_TOKEN_REDIS_KEY = "epmet:wechartthird:preauthcode"; + String AUTHORIZER_REFRESH_TOKEN_REDIS_KEY = "epmet:wechartthird:authorizerrefreshtoken"; + } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/constant/ThirdPlatformConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java similarity index 54% rename from epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/constant/ThirdPlatformConstant.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java index e047538a40..9976e22d35 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/constant/ThirdPlatformConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java @@ -29,17 +29,17 @@ public interface ThirdPlatformConstant { /** * */ - String API_COMPONENT_TOKEN_URl = "**************"; + String API_COMPONENT_TOKEN_URl = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=COMPONENT_ACCESS_TOKEN"; /** * */ - String API_CREATE_PREAUTHCODE_URL = "***************"; + String API_CREATE_PREAUTHCODE_URL = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=COMPONENT_ACCESS_TOKEN"; /** - * + * 使用授权码获取授权信息请求地址 */ - String API_QUERY_AUTH_URL = "**********"; + String API_QUERY_AUTH_URL = "https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token=COMPONENT_ACCESS_TOKEN"; diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java similarity index 53% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java index a6c7300c68..10b6b587c7 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java @@ -1,24 +1,32 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.WeChatPlatformAuthCodeFormDTO; import com.epmet.service.ComponentVerifyTicketService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; + /** * @Author zxc * @CreateTime 2020/7/6 9:07 */ @Slf4j -@RestController("third") +@RestController("wechatthird") public class ComponentVerifyTicketController { @Autowired private ComponentVerifyTicketService componentVerifyTicketService; + /** + * @Description 获取验证票据 + * @param timestamp + * @param nonce + * @param msgSignature + * @param postData + * @author zxc + */ @PostMapping(value = "/ticket") public Result weChatPlatformEvent(@RequestParam("timestamp") String timestamp, @RequestParam("nonce") String nonce, @@ -28,12 +36,22 @@ public class ComponentVerifyTicketController { return new Result(); } + /** + * @Description 获取预授权码 + * @param + * @author zxc + */ @PostMapping("ticketjob") public Result ticketJob() { componentVerifyTicketService.ticketJob(); return new Result(); } + /** + * @Description 获取预授权码 + * @param + * @author zxc + */ @PostMapping("preauthcode") public Result preAuthCode(){ componentVerifyTicketService.preAuthCode(); @@ -42,13 +60,27 @@ public class ComponentVerifyTicketController { /** * @Description - * @param formDTO + * @param response + * @param authCode + * @param expiresIn * @author zxc */ @PostMapping(value = "/authcode") - public Result weChatPlatformAuthCode(@RequestBody WeChatPlatformAuthCodeFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO); - componentVerifyTicketService.weChatPlatformAuthCode(formDTO); + public Result weChatPlatformAuthCode(HttpServletResponse response, + @RequestParam("auth_code") String authCode, + @RequestParam("expires_in") String expiresIn) { + componentVerifyTicketService.weChatPlatformAuthCode(response,authCode,expiresIn); + return new Result(); + } + + /** + * @Description 获取/刷新接口调用令牌 + * @param authorizerAppId 授权方AppId + * @author zxc + */ + @PostMapping("refreshtoken") + public Result refreshToken(@RequestParam("authorizer_appid") String authorizerAppId){ + componentVerifyTicketService.refreshToken(authorizerAppId); return new Result(); } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/exception/AesException.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/exception/AesException.java similarity index 100% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/exception/AesException.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/exception/AesException.java diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/redis/RedisThird.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java similarity index 69% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/redis/RedisThird.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java index 678d86f1d0..576e6a1794 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/redis/RedisThird.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java @@ -1,6 +1,5 @@ package com.epmet.redis; -import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.constant.ModuleConstant; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -65,4 +64,24 @@ public class RedisThird { redisTemplate.opsForValue().set(ModuleConstant.PRE_AUTH_CODE_REDIS_KEY+ModuleConstant.PRE_AUTH_CODE, authCode, 60 * 10, TimeUnit.SECONDS); } + /** + * @Description 缓存 刷新令牌 + * (在授权的公众号具备API权限时,才有此返回值),刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token。 + * 一旦丢失,只能让用户重新授权,才能再次拿到新的刷新令牌。用户重新授权后,之前的刷新令牌会失效 + * @param authorizerRefreshToken + * @author zxc + */ + public void setAuthorizerRefreshToken(String authorizerRefreshToken){ + redisTemplate.opsForValue().set(ModuleConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY+authorizerRefreshToken,authorizerRefreshToken); + } + + /** + * @Description 获取刷新 + * @param key + * @author zxc + */ + public String getAuthorizerRefreshToken(String key){ + return redisTemplate.opsForValue().get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY+key).toString(); + } + } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java similarity index 69% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java index 3caf0c3703..cd7e167667 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java @@ -1,10 +1,6 @@ package com.epmet.service; -import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.dto.form.ThirdPlatformEventFormDTO; -import com.epmet.dto.form.WeChatPlatformAuthCodeFormDTO; -import com.epmet.dto.result.ResultBean; -import org.springframework.web.bind.annotation.RequestBody; +import javax.servlet.http.HttpServletResponse; /** * @Author zxc @@ -38,9 +34,18 @@ public interface ComponentVerifyTicketService { /** * @Description - * @param formDTO + * @param response + * @param authCode + * @param expiresIn * @author zxc */ - void weChatPlatformAuthCode(WeChatPlatformAuthCodeFormDTO formDTO); + void weChatPlatformAuthCode(HttpServletResponse response,String authCode,String expiresIn); + + /** + * @Description 获取/刷新接口调用令牌 + * @param + * @author zxc + */ + void refreshToken(String authorizerAppId); } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java similarity index 82% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 7637c4af1c..c226125580 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.epmet.constant.ModuleConstant; import com.epmet.constant.ThirdPlatformConstant; -import com.epmet.dto.form.WeChatPlatformAuthCodeFormDTO; import com.epmet.exception.AesException; import com.epmet.redis.RedisThird; import com.epmet.service.ComponentVerifyTicketService; @@ -17,6 +16,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -50,7 +50,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String xml = pc.decryptMsg(msgSignature, timeStamp, nonce, postData); // 将xml转为map Map result = WXXmlToMapUtil.xmlToMap(xml); - String componentVerifyTicket = MapUtils.getString(result,ModuleConstant.TICKET_KEY); + String componentVerifyTicket = MapUtils.getString(result, ModuleConstant.TICKET_KEY); if (StringUtils.isNotEmpty(componentVerifyTicket)) { // 存储平台授权票据,保存ticket redisThird.setComponentVerifyTicket(componentVerifyTicket); @@ -79,7 +79,6 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); jsonObject.put(ModuleConstant.COMPONENT_APPSECRET, PLATFORM_APP_SECRET); jsonObject.put(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket); - // todo OkHttpHelper 无法引入 String post = okHttpHelper.post(API_COMPONENT_TOKEN_URl, JSON.toJSONString(jsonObject)); HashMap hashMap = JSON.parseObject(post, HashMap.class); String componentAccessToken = hashMap.get(ModuleConstant.COMPONENT_ACCESS_TOKEN); @@ -122,21 +121,41 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe } @Override - public void weChatPlatformAuthCode(WeChatPlatformAuthCodeFormDTO formDTO) { - String authCode = formDTO.getAuthCode(); - Integer expiresIn = formDTO.getExpiresIn(); + public void weChatPlatformAuthCode(HttpServletResponse response, String authCode, String expiresIn) { // 获取令牌【component_access_token】 String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN); // 使用授权码获取授权信息 JSONObject jsonObject = new JSONObject(); jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); jsonObject.put(ModuleConstant.AUTHORIZATION_CODE, authCode); + String post; try { - String post = okHttpHelper.post(API_QUERY_AUTH_URL + accessToken, JSON.toJSONString(jsonObject)); + post = okHttpHelper.post(API_QUERY_AUTH_URL + accessToken, JSON.toJSONString(jsonObject)); + HashMap hashMap = JSON.parseObject(post, HashMap.class); + Map map = hashMap.get(ModuleConstant.AUTHORIZATION_INFO); + String authorizerRefreshToken = map.get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN).toString(); + redisThird.setAuthorizerRefreshToken(authorizerRefreshToken); } catch (IOException e) { e.printStackTrace(); } + // 重定向地址 // response.sendRedirect("/wechat/authcode"); } + + /** + * @Description 获取/刷新接口调用令牌 + * @param + * @author zxc + */ + @Override + public void refreshToken(String authorizerAppId) { + JSONObject jsonObject = new JSONObject(); + //todo 授权方appid从哪来,每个用户的刷新token + //授权方AppId +// jsonObject.put(ModuleConstant.AUTHORIZER_APPID,authorizerAppId); + //第三方平台AppId + jsonObject.put(ModuleConstant.COMPONENT_APPID,PLATFORM_APP_ID); + jsonObject.put("",redisThird.getAuthorizerRefreshToken("")); + } } diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/OkHttpHelper.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/OkHttpHelper.java similarity index 100% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/OkHttpHelper.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/OkHttpHelper.java diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/PKCS7EncoderUtil.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/PKCS7EncoderUtil.java similarity index 100% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/PKCS7EncoderUtil.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/PKCS7EncoderUtil.java diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/WXBizMsgCrypt.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/WXBizMsgCrypt.java similarity index 100% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/WXBizMsgCrypt.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/WXBizMsgCrypt.java diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java similarity index 100% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml similarity index 95% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/bootstrap.yml rename to epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml index 5e2f47ba4a..7867f1f3da 100644 --- a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml @@ -1,13 +1,13 @@ server: port: @server.port@ servlet: - context-path: /epmet/third/platform + context-path: /third spring: main: allow-bean-definition-overriding: true application: - name: epmet-third-platform-server + name: epmet-third-server # dev|test|prod profiles: active: dev diff --git a/epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/logback-spring.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml similarity index 100% rename from epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/logback-spring.xml rename to epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml diff --git a/epmet-module/epmet-third-platform/pom.xml b/epmet-module/epmet-third/pom.xml similarity index 75% rename from epmet-module/epmet-third-platform/pom.xml rename to epmet-module/epmet-third/pom.xml index 5a5fcef140..883b02ddb7 100644 --- a/epmet-module/epmet-third-platform/pom.xml +++ b/epmet-module/epmet-third/pom.xml @@ -9,12 +9,12 @@ 4.0.0 - epmet-third-platform + epmet-third pom - epmet-third-platform-client - epmet-third-platform-server + epmet-third-client + epmet-third-server diff --git a/epmet-module/pom.xml b/epmet-module/pom.xml index 854ba00003..dfa242462a 100644 --- a/epmet-module/pom.xml +++ b/epmet-module/pom.xml @@ -39,7 +39,7 @@ resi-voice data-statistical data-report - epmet-third-platform + epmet-third From 6b20c55d1f93a5a69148cdc632890e0902d6105d Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 8 Jul 2020 14:46:32 +0800 Subject: [PATCH 17/90] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E5=9B=9E=E8=B0=83=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?customerservice/callback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OfficialAccountCallBackController.java | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/officialaccount/OfficialAccountCallBackController.java diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/officialaccount/OfficialAccountCallBackController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/officialaccount/OfficialAccountCallBackController.java new file mode 100644 index 0000000000..aff2d6c4bd --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/officialaccount/OfficialAccountCallBackController.java @@ -0,0 +1,61 @@ +package com.epmet.controller.officialaccount; + +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.Collections; + +/** + * 党群e事通公众号(客服号) + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/8 12:43 + */ +@RestController +@RequestMapping("customerservice") +public class OfficialAccountCallBackController { + private Logger logger = LogManager.getLogger(); + /** + * @param signature 微信加密签名,signature结合了开发者填写的token参数和请求中的timestamp参数、nonce参数。 + * @param timestamp 时间戳 + * @param nonce 随机数 + * @param echostr 随机字符串 + * @return java.lang.String + * @author yinzuomei + * @description 确认此次GET请求来自微信服务器,请原样返回echostr参数内容,则接入生效,成为开发者成功,否则接入失败 + * @Date 2020/7/8 12:47 + **/ + @GetMapping(value = "/callback") + public String wxServerValdation(@RequestParam("signature") String signature, + @RequestParam("timestamp") String timestamp, + @RequestParam("nonce") String nonce, + @RequestParam("echostr") String echostr) { + if (StringUtils.isEmpty(signature) || StringUtils.isEmpty(timestamp) || StringUtils.isEmpty(nonce) || StringUtils.isEmpty(echostr)) { + logger.warn("入参错误"); + return ""; + } + ArrayList list = new ArrayList(); + list.add(nonce); + list.add(timestamp); + //这是第5步中你设置的Token + list.add("12345678Yzm"); + Collections.sort(list); + String sha1Singnature = DigestUtils.sha1Hex(list.get(0) + list.get(1) + list.get(2)); + if (sha1Singnature.equals(signature)) { + logger.info("校验成功"); + return echostr; + } else { + logger.warn("校验失败"); + return ""; + } + } + + +} From e8bcc8c0a6a8a5f4cec2d5c3e34313aeca367326 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Wed, 8 Jul 2020 15:12:38 +0800 Subject: [PATCH 18/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/constant/NumConstant.java | 1 + .../epmet/dto/ComponentVerifyTicketDTO.java | 81 ++++++++++++++++ .../form/ComponentVerifyTicketFormDTO.java | 30 ++++-- .../result/AuthorizationInfoResultDTO.java | 44 +++++++++ .../com/epmet/constant/ModuleConstant.java | 15 +++ .../epmet/constant/ThirdPlatformConstant.java | 7 +- .../ComponentVerifyTicketController.java | 63 ++----------- .../controller/WeChatNotifyController.java | 78 ++++++++++++++++ .../epmet/dao/ComponentVerifyTicketDao.java | 36 ++++++++ .../entity/ComponentVerifyTicketEntity.java | 56 +++++++++++ .../main/java/com/epmet/redis/RedisThird.java | 35 +++++-- .../service/ComponentVerifyTicketService.java | 13 ++- .../ComponentVerifyTicketServiceImpl.java | 92 +++++++++++++++---- .../mapper/ComponentVerifyTicketDao.xml | 35 +++++++ 14 files changed, 490 insertions(+), 96 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentVerifyTicketDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthorizationInfoResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentVerifyTicketDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentVerifyTicketEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 00c957c680..8529ad013b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -31,6 +31,7 @@ public interface NumConstant { int THIRTY = 30; int FORTY = 40; int FIFTY = 50; + int SIXTY = 60; int ONE_HUNDRED = 100; int ONE_THOUSAND = 1000; int MAX = 99999999; diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentVerifyTicketDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentVerifyTicketDTO.java new file mode 100644 index 0000000000..39f78fd2fc --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentVerifyTicketDTO.java @@ -0,0 +1,81 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 微信发送的ticket表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-08 + */ +@Data +public class ComponentVerifyTicketDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 第三方平台ID + */ + private String appid; + + /** + * component_verify_ticket + */ + private String typeInfo; + + /** + * 票据内容 + */ + private String componentVerifyTicket; + + /** + * 删除标识 0-否,1-是 + */ + private String delFlag; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java index 6093755bea..308b69b4fd 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.form; import lombok.Data; import java.io.Serializable; +import java.util.Date; /** * @Author zxc @@ -14,22 +15,37 @@ public class ComponentVerifyTicketFormDTO implements Serializable { private static final long serialVersionUID = -6547893374373422628L; /** - * 第三方平台 appid + * 主键 */ - private String appId; + private String id; /** - * 时间戳,单位:s + * 第三方平台ID */ - private Integer CreateTime; + private String appid; /** - * 固定为:"component_verify_ticket" + * component_verify_ticket */ - private String InfoType = "component_verify_ticket"; + private String typeInfo = "component_verify_ticket"; /** - * Ticket 内容 + * 票据内容 */ private String componentVerifyTicket; + + /** + * 删除标识 0-否,1-是 + */ + private String delFlag = "0"; + + /** + * 创建人 + */ + private String createdBy = "APP_USER"; + + /** + * 更新人 + */ + private String updatedBy = "APP_USER"; } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthorizationInfoResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthorizationInfoResultDTO.java new file mode 100644 index 0000000000..ce31106941 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthorizationInfoResultDTO.java @@ -0,0 +1,44 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * 权限集列表 + * @Author zxc + * @CreateTime 2020/7/8 13:39 + */ +@Data +public class AuthorizationInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 3253989119352850315L; + + /** + * 授权方 appid + */ + private String authorizer_appid; + + /** + * 接口调用令牌(在授权的公众号/小程序具备 API 权限时,才有此返回值) + */ + private String authorizer_access_token; + + /** + * authorizer_access_token 的有效期(在授权的公众号/小程序具备API权限时,才有此返回值),单位:秒 + */ + private Integer expires_in; + + /** + * 刷新令牌(在授权的公众号具备API权限时,才有此返回值),刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token。 + * 一旦丢失,只能让用户重新授权,才能再次拿到新的刷新令牌。用户重新授权后,之前的刷新令牌会失效 + */ + private String authorizer_refresh_token; + + /** + * 授权给开发者的权限集列表 + */ + private List func_info; +} 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 4c744b6c5b..6b8df00640 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 @@ -12,12 +12,23 @@ public interface ModuleConstant { String SUCCESS = "success"; + /** + * 第三方平台 AppId + */ String COMPONENT_APPID = "component_appid"; String COMPONENT_APPSECRET = "component_appsecret"; + /** + * 第三方平台 access_token + */ String COMPONENT_ACCESS_TOKEN = "component_access_token"; + /** + * 有效期 + */ + String EXPIRES_IN = "expires_in"; + String PRE_AUTH_CODE = "pre_auth_code"; String AUTHORIZATION_CODE = "authorization_code"; @@ -54,6 +65,10 @@ public interface ModuleConstant { String AUTHORIZER_REFRESH_TOKEN_REDIS_KEY = "epmet:wechartthird:authorizerrefreshtoken"; + String AUTHORIZATION_CODE_REDIS_KEY = "epmet:wechartthird:authorizationcode"; + + String AUTH_INFO_REDIS_KEY = "epmet:wechartthird:authinfo"; + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java index 9976e22d35..618d62010f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java @@ -29,7 +29,7 @@ public interface ThirdPlatformConstant { /** * */ - String API_COMPONENT_TOKEN_URl = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=COMPONENT_ACCESS_TOKEN"; + String API_CREATE_PREAUTHCODE_URl = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=COMPONENT_ACCESS_TOKEN"; /** * @@ -41,6 +41,9 @@ public interface ThirdPlatformConstant { */ String API_QUERY_AUTH_URL = "https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token=COMPONENT_ACCESS_TOKEN"; - + /** + * 获取令牌请求地址 + */ + String API_COMPONENT_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/component/api_component_token"; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java index 10b6b587c7..5736be20c0 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java @@ -1,19 +1,18 @@ package com.epmet.controller; -import com.epmet.commons.tools.utils.Result; import com.epmet.service.ComponentVerifyTicketService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import javax.servlet.http.HttpServletResponse; /** * @Author zxc * @CreateTime 2020/7/6 9:07 */ @Slf4j -@RestController("wechatthird") +@RestController +@RequestMapping("thirdplatform") public class ComponentVerifyTicketController { @Autowired @@ -27,62 +26,12 @@ public class ComponentVerifyTicketController { * @param postData * @author zxc */ - @PostMapping(value = "/ticket") - public Result weChatPlatformEvent(@RequestParam("timestamp") String timestamp, + @PostMapping(value = "/componentverifyticket") + public String componentVerifyTicket(@RequestParam("timestamp") String timestamp, @RequestParam("nonce") String nonce, @RequestParam("msg_signature") String msgSignature, @RequestBody String postData) { - componentVerifyTicketService.parseRequest(timestamp,nonce,msgSignature,postData); - return new Result(); + componentVerifyTicketService.componentVerifyTicket(timestamp,nonce,msgSignature,postData); + return "success"; } - - /** - * @Description 获取预授权码 - * @param - * @author zxc - */ - @PostMapping("ticketjob") - public Result ticketJob() { - componentVerifyTicketService.ticketJob(); - return new Result(); - } - - /** - * @Description 获取预授权码 - * @param - * @author zxc - */ - @PostMapping("preauthcode") - public Result preAuthCode(){ - componentVerifyTicketService.preAuthCode(); - return new Result(); - } - - /** - * @Description - * @param response - * @param authCode - * @param expiresIn - * @author zxc - */ - @PostMapping(value = "/authcode") - public Result weChatPlatformAuthCode(HttpServletResponse response, - @RequestParam("auth_code") String authCode, - @RequestParam("expires_in") String expiresIn) { - componentVerifyTicketService.weChatPlatformAuthCode(response,authCode,expiresIn); - return new Result(); - } - - /** - * @Description 获取/刷新接口调用令牌 - * @param authorizerAppId 授权方AppId - * @author zxc - */ - @PostMapping("refreshtoken") - public Result refreshToken(@RequestParam("authorizer_appid") String authorizerAppId){ - componentVerifyTicketService.refreshToken(authorizerAppId); - return new Result(); - } - - } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java new file mode 100644 index 0000000000..721794c247 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java @@ -0,0 +1,78 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.ComponentVerifyTicketService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; + +/** + * @Author zxc + * @CreateTime 2020/7/8 15:06 + */ +@RestController +@RequestMapping("wechatthird") +public class WeChatNotifyController { + + @Autowired + private ComponentVerifyTicketService componentVerifyTicketService; + + /** + * @Description 定时获取 (令牌,component_access_token) + * 令牌(component_access_token)是第三方平台接口的调用凭据。令牌的获取是有限制的,每个令牌的有效期为 2 小时 + * @param + * @author zxc + */ + @PostMapping("componentaccesstoken") + public Result getComponentAccessToken() { + componentVerifyTicketService.getComponentAccessToken(); + return new Result(); + } + + /** + * @Description 获取预授权码 + * @param + * @author zxc + */ + @PostMapping("preauthcode") + public Result preAuthCode(){ + componentVerifyTicketService.preAuthCode(); + return new Result(); + } + + /** + * @Description 使用授权码获取授权信息 + * @param response + * @param authCode + * @param expiresIn + * @author zxc + */ + @PostMapping(value = "/authinfobyauthcode") + public Result authInfoByAuthCode(HttpServletResponse response, + @RequestParam("auth_code") String authCode, + @RequestParam("expires_in") String expiresIn) { + componentVerifyTicketService.authInfoByAuthCode(response,authCode,expiresIn); + return new Result(); + } + + /** + * @Description 获取/刷新接口调用令牌 + * @param authorizerAppId 授权方AppId + * @author zxc + */ + @PostMapping("refreshtoken") + public Result refreshToken(@RequestParam("authorizer_appid") String authorizerAppId){ + componentVerifyTicketService.refreshToken(authorizerAppId); + return new Result(); + } + + @PostMapping("redirecturi") + public Result redirectUri(){ + componentVerifyTicketService.redirectUri(); + return new Result(); + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentVerifyTicketDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentVerifyTicketDao.java new file mode 100644 index 0000000000..2ebdb26ed3 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentVerifyTicketDao.java @@ -0,0 +1,36 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.ComponentVerifyTicketFormDTO; +import com.epmet.entity.ComponentVerifyTicketEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 微信发送的ticket表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-08 + */ +@Mapper +public interface ComponentVerifyTicketDao extends BaseDao { + + void insertComponentVerifyTicket(ComponentVerifyTicketFormDTO formDTO); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentVerifyTicketEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentVerifyTicketEntity.java new file mode 100644 index 0000000000..dd39c42496 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentVerifyTicketEntity.java @@ -0,0 +1,56 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 微信发送的ticket表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("component_verify_ticket") +public class ComponentVerifyTicketEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 第三方平台ID + */ + private String appid; + + /** + * component_verify_ticket + */ + private String typeInfo; + + /** + * 票据内容 + */ + private String componentVerifyTicket; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java index 576e6a1794..3deac90425 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java @@ -1,6 +1,8 @@ package com.epmet.redis; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.constant.ModuleConstant; +import com.epmet.dto.result.AuthorizationInfoResultDTO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; @@ -18,14 +20,16 @@ public class RedisThird { @Autowired private RedisTemplate redisTemplate; + @Autowired + private RedisUtils redisUtils; /** - * @Description 缓存 component_access_token 有效期:2H + * @Description 缓存 component_access_token 有效期:1小时59分钟 (官网有效期:2H) * @param accessToken * @author zxc */ public void setComponentAccessToken (String accessToken){ - redisTemplate.opsForValue().set(ModuleConstant.ACCESS_TOKEN_REDIS_KEY+ModuleConstant.COMPONENT_ACCESS_TOKEN, accessToken, 60 * 60 * 2, TimeUnit.SECONDS); + redisTemplate.opsForValue().set(ModuleConstant.ACCESS_TOKEN_REDIS_KEY+ModuleConstant.COMPONENT_ACCESS_TOKEN, accessToken, 60 * 60 * 2 - 60, TimeUnit.SECONDS); } /** @@ -47,21 +51,22 @@ public class RedisThird { } /** - * @Description 缓存 component_verify_ticket 有效期:10min + * @Description 缓存 component_verify_ticket 有效期:9min (官方有效期 10分钟) * @param verifyTicket * @author zxc */ public void setComponentVerifyTicket(String verifyTicket){ - redisTemplate.opsForValue().set(ModuleConstant.TICKET_REDIS_KEY+ModuleConstant.TICKET_UNDERLINE_KEY, verifyTicket, 60 * 10, TimeUnit.SECONDS); + redisTemplate.opsForValue().set(ModuleConstant.TICKET_REDIS_KEY+ModuleConstant.TICKET_UNDERLINE_KEY, verifyTicket, 60 * 9, TimeUnit.SECONDS); } /** - * @Description 缓存 pre_auth_code 有效期:10min - * @param authCode + * @Description 缓存 pre_auth_code 有效期:9min (官方有效期 10分钟) + * @param authCode pre_auth_code 预授权码 + * @param expiresIn expires_in 有效期 * @author zxc */ - public void setPreAuthCode(String authCode){ - redisTemplate.opsForValue().set(ModuleConstant.PRE_AUTH_CODE_REDIS_KEY+ModuleConstant.PRE_AUTH_CODE, authCode, 60 * 10, TimeUnit.SECONDS); + public void setPreAuthCode(String authCode,Integer expiresIn){ + redisTemplate.opsForValue().set(ModuleConstant.PRE_AUTH_CODE_REDIS_KEY+ModuleConstant.PRE_AUTH_CODE, authCode,expiresIn, TimeUnit.SECONDS); } /** @@ -84,4 +89,18 @@ public class RedisThird { return redisTemplate.opsForValue().get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY+key).toString(); } + /** + * @Description 获取授权码 + * 授权码, 会在授权成功时(回调url)返回给第三方平台【code、expiresIn】 + * @param key + * @author zxc + */ + public String getAuthorizationCode(String key){ + return redisTemplate.opsForValue().get(ModuleConstant.AUTHORIZATION_CODE_REDIS_KEY+key).toString(); + } + + public void setAuthInfo(AuthorizationInfoResultDTO authInfo){ + redisUtils.set(ModuleConstant.AUTH_INFO_REDIS_KEY,authInfo,-1); + } + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java index cd7e167667..0a46086c1f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java @@ -18,13 +18,14 @@ public interface ComponentVerifyTicketService { * @return 如果获得只需要返回 SUCCESS * @Author zxc */ - void parseRequest(String timestamp,String nonce,String msgSignature,String postData); + void componentVerifyTicket(String timestamp,String nonce,String msgSignature,String postData); /** - * @Description 定时获取 ticket + * @Description 定时获取 (令牌,component_access_token) + * 令牌(component_access_token)是第三方平台接口的调用凭据。令牌的获取是有限制的,每个令牌的有效期为 2 小时 * @author zxc */ - void ticketJob(); + void getComponentAccessToken(); /** * @Description 每个预授权码有效期为 10 分钟。需要先获取令牌才能调用 获取预授权码 @@ -33,13 +34,13 @@ public interface ComponentVerifyTicketService { void preAuthCode(); /** - * @Description + * @Description 使用授权码获取授权信息 * @param response * @param authCode * @param expiresIn * @author zxc */ - void weChatPlatformAuthCode(HttpServletResponse response,String authCode,String expiresIn); + void authInfoByAuthCode(HttpServletResponse response,String authCode,String expiresIn); /** * @Description 获取/刷新接口调用令牌 @@ -48,4 +49,6 @@ public interface ComponentVerifyTicketService { */ void refreshToken(String authorizerAppId); + void redirectUri(); + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index c226125580..5ec14b22bd 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -2,12 +2,16 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.constant.ModuleConstant; import com.epmet.constant.ThirdPlatformConstant; +import com.epmet.dao.ComponentVerifyTicketDao; +import com.epmet.dto.form.ComponentVerifyTicketFormDTO; +import com.epmet.dto.result.AuthorizationInfoResultDTO; import com.epmet.exception.AesException; import com.epmet.redis.RedisThird; import com.epmet.service.ComponentVerifyTicketService; -import com.epmet.util.OkHttpHelper; import com.epmet.util.WXBizMsgCrypt; import com.epmet.util.WXXmlToMapUtil; import lombok.extern.slf4j.Slf4j; @@ -15,9 +19,10 @@ import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; +import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; @@ -34,15 +39,16 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe @Autowired private RedisThird redisThird; @Autowired - private OkHttpHelper okHttpHelper; + private ComponentVerifyTicketDao ticketDao; /** * @Description 获得授权事件的票据 * @param * @author zxc */ + @Transactional(rollbackFor = Exception.class) @Override - public void parseRequest(String timeStamp,String nonce,String msgSignature,String postData) { + public void componentVerifyTicket(String timeStamp,String nonce,String msgSignature,String postData) { log.info(ModuleConstant.START_RECEIVE); try { //这个类是微信官网提供的解密类,需要用到消息校验Token 消息加密Key和服务平台appid @@ -52,9 +58,15 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe Map result = WXXmlToMapUtil.xmlToMap(xml); String componentVerifyTicket = MapUtils.getString(result, ModuleConstant.TICKET_KEY); if (StringUtils.isNotEmpty(componentVerifyTicket)) { - // 存储平台授权票据,保存ticket + // 缓存 ticket redisThird.setComponentVerifyTicket(componentVerifyTicket); + // 存数据库 + ComponentVerifyTicketFormDTO ticketFormDTO = new ComponentVerifyTicketFormDTO(); + ticketFormDTO.setAppid(PLATFORM_APP_ID); + ticketFormDTO.setComponentVerifyTicket(componentVerifyTicket); + ticketDao.insertComponentVerifyTicket(ticketFormDTO); } else { + log.error(ModuleConstant.ERROR_TICKET); throw new RuntimeException(ModuleConstant.ERROR_TICKET); } } catch (AesException e) { @@ -64,22 +76,22 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe } /** - * @Description 定时获取票据 + * @Description 定时获取 (令牌,component_access_token) * @param * @author zxc */ @Override - public void ticketJob() { + public void getComponentAccessToken() { log.info("====================开始执行定时任务获取令牌【component_access_token】===================="); Map reMap; try { - // 核心定时器,每一个小时执行一次 + // 核心定时器 String componentVerifyTicket = redisThird.getComponentVerifyTicket(ModuleConstant.TICKET_UNDERLINE_KEY); JSONObject jsonObject = new JSONObject(); jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); jsonObject.put(ModuleConstant.COMPONENT_APPSECRET, PLATFORM_APP_SECRET); jsonObject.put(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket); - String post = okHttpHelper.post(API_COMPONENT_TOKEN_URl, JSON.toJSONString(jsonObject)); + String post = HttpClientManager.getInstance().sendPostByJSON(API_CREATE_PREAUTHCODE_URL, JSON.toJSONString(jsonObject)).getData(); HashMap hashMap = JSON.parseObject(post, HashMap.class); String componentAccessToken = hashMap.get(ModuleConstant.COMPONENT_ACCESS_TOKEN); if (StringUtils.isNotEmpty(componentAccessToken)) { @@ -105,12 +117,14 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN); JSONObject jsonObject = new JSONObject(); jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); - String post = okHttpHelper.post(API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)); + String post = HttpClientManager.getInstance().sendPostByJSON(API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); log.info("====================返回post结果:" + post); HashMap hashMap = JSON.parseObject(post, HashMap.class); - String authCode = hashMap.get("pre_auth_code"); + String authCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE); + String expiresIn = hashMap.get(ModuleConstant.EXPIRES_IN); + int ex = Integer.valueOf(expiresIn) - NumConstant.SIXTY; if (StringUtils.isNotEmpty(authCode)) { - redisThird.setPreAuthCode(authCode); + redisThird.setPreAuthCode(authCode,ex); } else { throw new RuntimeException("微信开放平台,第三方平台获取【预授权码】失败"); } @@ -120,22 +134,31 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe log.info("====================结束执行定时任务获取预授权码【pre_auth_code】===================="); } + /** + * @Description 使用授权码获取授权信息 + * @param response + * @param authCode + * @param expiresIn + * @author zxc + */ @Override - public void weChatPlatformAuthCode(HttpServletResponse response, String authCode, String expiresIn) { + public void authInfoByAuthCode(HttpServletResponse response, String authCode, String expiresIn) { // 获取令牌【component_access_token】 String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN); // 使用授权码获取授权信息 JSONObject jsonObject = new JSONObject(); jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); jsonObject.put(ModuleConstant.AUTHORIZATION_CODE, authCode); - String post; + String authInfo; try { - post = okHttpHelper.post(API_QUERY_AUTH_URL + accessToken, JSON.toJSONString(jsonObject)); - HashMap hashMap = JSON.parseObject(post, HashMap.class); + authInfo = HttpClientManager.getInstance().sendPostByJSON(API_QUERY_AUTH_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); + HashMap hashMap = JSON.parseObject(authInfo, HashMap.class); Map map = hashMap.get(ModuleConstant.AUTHORIZATION_INFO); + AuthorizationInfoResultDTO authorizationInfoResultDTO = mapToEntity(map, AuthorizationInfoResultDTO.class); + redisThird.setAuthInfo(authorizationInfoResultDTO); String authorizerRefreshToken = map.get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN).toString(); redisThird.setAuthorizerRefreshToken(authorizerRefreshToken); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } @@ -158,4 +181,39 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe jsonObject.put(ModuleConstant.COMPONENT_APPID,PLATFORM_APP_ID); jsonObject.put("",redisThird.getAuthorizerRefreshToken("")); } + + @Override + public void redirectUri() { + + } + + /** + * @Description map 转 Entity + * @param map + * @param entity + * @author zxc + */ + public T mapToEntity(Map map, Class entity) { + T t = null; + try { + t = entity.newInstance(); + for(Field field : entity.getDeclaredFields()) { + if (map.containsKey(field.getName())) { + boolean flag = field.isAccessible(); + field.setAccessible(true); + Object object = map.get(field.getName()); + if (object!= null && field.getType().isAssignableFrom(object.getClass())) { + field.set(t, object); + } + field.setAccessible(flag); + } + } + return t; + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return t; + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml new file mode 100644 index 0000000000..a6a0e15ffb --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + INSERT INTO component_verify_ticket ( ID, APPID, TYPE_INFO, COMPONENT_VERIFY_TICKET, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + ( + REPLACE ( UUID(), '-', '' ), + #{appid}, + #{typeInfo}, + #{componentVerifyTicket}, + #{delFlag}, + #{createdBy}, + NOW(), + #{updatedBy}, + NOW() + ) + + + + \ No newline at end of file From 25c0a2f8d9d90e957207198df1f778f4f2daa081 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Wed, 8 Jul 2020 15:16:05 +0800 Subject: [PATCH 19/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/ComponentVerifyTicketController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java index 5736be20c0..6f73d5422c 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java @@ -1,5 +1,6 @@ package com.epmet.controller; +import com.epmet.constant.ModuleConstant; import com.epmet.service.ComponentVerifyTicketService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -26,11 +27,12 @@ public class ComponentVerifyTicketController { * @param postData * @author zxc */ - @PostMapping(value = "/componentverifyticket") + @PostMapping(value = "/callback") public String componentVerifyTicket(@RequestParam("timestamp") String timestamp, @RequestParam("nonce") String nonce, @RequestParam("msg_signature") String msgSignature, @RequestBody String postData) { + log.info("timestamp = "+timestamp,"nonce = "+nonce,"msgSignature = "+msgSignature,"postData = "+postData); componentVerifyTicketService.componentVerifyTicket(timestamp,nonce,msgSignature,postData); return "success"; } From 4d63e6f4bfd7f9b4263bffe29f042ed83b512356 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 8 Jul 2020 15:24:54 +0800 Subject: [PATCH 20/90] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/epmet-third/epmet-third-server/pom.xml | 4 ++-- .../officialaccount/OfficialAccountCallBackController.java | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index b74743ebc9..a8bba9e38c 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -170,7 +170,7 @@ 6379 123456 - false + true 122.152.200.70:8848 fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b @@ -192,7 +192,7 @@ - + epmet elink@833066 diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/officialaccount/OfficialAccountCallBackController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/officialaccount/OfficialAccountCallBackController.java index aff2d6c4bd..376f4c9940 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/officialaccount/OfficialAccountCallBackController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/officialaccount/OfficialAccountCallBackController.java @@ -1,5 +1,6 @@ package com.epmet.controller.officialaccount; +import com.epmet.commons.tools.utils.Result; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; @@ -57,5 +58,9 @@ public class OfficialAccountCallBackController { } } + @GetMapping(value = "test") + public Result test(){ + return new Result<>().ok("test"); + } } From 6ce0c9e2052236ea53ee53c91d24426ffb4bdea7 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 8 Jul 2020 16:02:24 +0800 Subject: [PATCH 21/90] =?UTF-8?q?=E5=8F=91=E5=B8=83epmetthird?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/deploy/docker-compose-dev.yml | 2 +- epmet-gateway/pom.xml | 4 ++-- epmet-gateway/src/main/resources/bootstrap.yml | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/epmet-gateway/deploy/docker-compose-dev.yml b/epmet-gateway/deploy/docker-compose-dev.yml index 757bce4583..e20275eb38 100644 --- a/epmet-gateway/deploy/docker-compose-dev.yml +++ b/epmet-gateway/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.23 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.24 ports: - "8080:8080" network_mode: host # 使用现有网络 diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 6f5f2e57aa..c2cd3bb1ae 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.23 + 0.3.24 com.epmet epmet-cloud @@ -186,7 +186,7 @@ lb://epmet-openapi-scan - lb://epmet-third-platform-server + lb://epmet-third-server diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index a926c88fb3..aa1e84eb28 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -294,7 +294,7 @@ spring: - Path=${server.servlet.context-path}/third/** filters: - StripPrefix=1 - - CpAuth=true + - CpAuth=false nacos: discovery: server-addr: @nacos.server-addr@ @@ -409,7 +409,6 @@ epmet: - /gov/issue/** - /gov/project/** - /resi/home/** - - /third/** swaggerUrls: jwt: From 6c5f1a01b5051c2123d2767593465a1d0c4d0716 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Wed, 8 Jul 2020 16:33:39 +0800 Subject: [PATCH 22/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ComponentVerifyTicketController.java | 19 +- .../service/ComponentVerifyTicketService.java | 8 +- .../ComponentVerifyTicketServiceImpl.java | 79 +++++--- .../src/main/java/com/epmet/util/XmlUtil.java | 172 ++++++++++++++++++ 4 files changed, 237 insertions(+), 41 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/XmlUtil.java diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java index 6f73d5422c..7a19d3a8e6 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java @@ -1,11 +1,13 @@ package com.epmet.controller; -import com.epmet.constant.ModuleConstant; import com.epmet.service.ComponentVerifyTicketService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + /** * @Author zxc @@ -20,20 +22,11 @@ public class ComponentVerifyTicketController { private ComponentVerifyTicketService componentVerifyTicketService; /** - * @Description 获取验证票据 - * @param timestamp - * @param nonce - * @param msgSignature - * @param postData + * @Description 获取验证票据3 * @author zxc */ @PostMapping(value = "/callback") - public String componentVerifyTicket(@RequestParam("timestamp") String timestamp, - @RequestParam("nonce") String nonce, - @RequestParam("msg_signature") String msgSignature, - @RequestBody String postData) { - log.info("timestamp = "+timestamp,"nonce = "+nonce,"msgSignature = "+msgSignature,"postData = "+postData); - componentVerifyTicketService.componentVerifyTicket(timestamp,nonce,msgSignature,postData); - return "success"; + public String componentVerifyTicket(HttpServletRequest request, HttpServletResponse response) { + return componentVerifyTicketService.componentVerifyTicket(request,response); } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java index 0a46086c1f..6178dd929d 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java @@ -1,5 +1,6 @@ package com.epmet.service; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** @@ -10,15 +11,10 @@ public interface ComponentVerifyTicketService { /** * 获得授权事件的票据 - * - * @param timestamp 时间戳 - * @param nonce 随机数 - * @param msgSignature 消息体签名 - * @param postData 消息体 * @return 如果获得只需要返回 SUCCESS * @Author zxc */ - void componentVerifyTicket(String timestamp,String nonce,String msgSignature,String postData); + String componentVerifyTicket(HttpServletRequest request, HttpServletResponse response); /** * @Description 定时获取 (令牌,component_access_token) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 5ec14b22bd..604ccd06f5 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -2,26 +2,28 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.nacos.client.config.utils.IOUtils; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.constant.ModuleConstant; -import com.epmet.constant.ThirdPlatformConstant; import com.epmet.dao.ComponentVerifyTicketDao; import com.epmet.dto.form.ComponentVerifyTicketFormDTO; import com.epmet.dto.result.AuthorizationInfoResultDTO; -import com.epmet.exception.AesException; import com.epmet.redis.RedisThird; import com.epmet.service.ComponentVerifyTicketService; import com.epmet.util.WXBizMsgCrypt; import com.epmet.util.WXXmlToMapUtil; +import com.epmet.util.XmlUtil; +import com.github.pagehelper.util.StringUtil; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; @@ -48,31 +50,64 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe */ @Transactional(rollbackFor = Exception.class) @Override - public void componentVerifyTicket(String timeStamp,String nonce,String msgSignature,String postData) { + public String componentVerifyTicket(HttpServletRequest request, HttpServletResponse response) { log.info(ModuleConstant.START_RECEIVE); try { - //这个类是微信官网提供的解密类,需要用到消息校验Token 消息加密Key和服务平台appid - WXBizMsgCrypt pc = new WXBizMsgCrypt(ThirdPlatformConstant.PLATFORM_COMPONENT_TOKEN, ThirdPlatformConstant.PLATFORM_AES_KEY, ThirdPlatformConstant.PLATFORM_APP_ID); - String xml = pc.decryptMsg(msgSignature, timeStamp, nonce, postData); - // 将xml转为map - Map result = WXXmlToMapUtil.xmlToMap(xml); - String componentVerifyTicket = MapUtils.getString(result, ModuleConstant.TICKET_KEY); - if (StringUtils.isNotEmpty(componentVerifyTicket)) { - // 缓存 ticket - redisThird.setComponentVerifyTicket(componentVerifyTicket); - // 存数据库 - ComponentVerifyTicketFormDTO ticketFormDTO = new ComponentVerifyTicketFormDTO(); - ticketFormDTO.setAppid(PLATFORM_APP_ID); - ticketFormDTO.setComponentVerifyTicket(componentVerifyTicket); - ticketDao.insertComponentVerifyTicket(ticketFormDTO); + request.setCharacterEncoding("UTF-8"); + response.setCharacterEncoding("UTF-8"); + // 微信加密签名 + String msgSignature = request.getParameter("msg_signature"); + // 时间戳 + String timeStamp = request.getParameter("timestamp"); + // 随机数 + String nonce = request.getParameter("nonce"); + // 从请求中读取整个post数据 + InputStream inputStream; + String postData = null; + inputStream = request.getInputStream(); + postData= IOUtils.toString(inputStream, "UTF-8"); + //从XML中获取标签内的密文文本 + String encrypt = XmlUtil.toXml(postData); + log.info("Encrypt:"+encrypt); + //格式化密文文本,否则没有标签,会解密失败,参考官方的加解密代码JAVA版本 + String format = ""; + String fromXML = String.format(format, encrypt); + + String msg = ""; //解密后的明文 + WXBizMsgCrypt wxcpt; + if(StringUtil.isEmpty(encrypt)) { + msg = fromXML; } else { - log.error(ModuleConstant.ERROR_TICKET); - throw new RuntimeException(ModuleConstant.ERROR_TICKET); + wxcpt = new WXBizMsgCrypt(PLATFORM_COMPONENT_TOKEN,PLATFORM_AES_KEY, PLATFORM_APP_ID); + // 解密消息 + msg = wxcpt.decryptMsg(msgSignature, timeStamp, nonce, fromXML); } - } catch (AesException e) { - e.printStackTrace(); + log.info("msg:"+msg); + // 将xml转为map + Map result = WXXmlToMapUtil.xmlToMap(msg); + String infotype = result.get("InfoType"); //获取infotype,注:微信开放平台文档中标明固定为:"component_verify_ticket",但参考其他代码,还包含authorized??? + log.info(infotype); + switch (infotype){ + case "component_verify_ticket": //验证票据 + String ComponentVerifyTicket = result.get("ComponentVerifyTicket"); + // 缓存 ticket + redisThird.setComponentVerifyTicket(ComponentVerifyTicket); + // 存数据库 + ComponentVerifyTicketFormDTO ticketFormDTO = new ComponentVerifyTicketFormDTO(); + ticketFormDTO.setAppid(PLATFORM_APP_ID); + ticketFormDTO.setComponentVerifyTicket(ComponentVerifyTicket); + ticketDao.insertComponentVerifyTicket(ticketFormDTO); + log.info("component_verify_ticket:"+ComponentVerifyTicket); + break; + case "unauthorized"://用户取消授权 + return ""; + } + } catch (Exception e) { + log.error(e.getMessage()); + return ""; } log.info(ModuleConstant.END_TICKET); + return "success"; } /** diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/XmlUtil.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/XmlUtil.java new file mode 100644 index 0000000000..1fdc3d0307 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/XmlUtil.java @@ -0,0 +1,172 @@ +package com.epmet.util; +import com.google.common.collect.Lists; +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.core.util.QuickWriter; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import com.thoughtworks.xstream.io.naming.NoNameCoder; +import com.thoughtworks.xstream.io.xml.CompactWriter; +import com.thoughtworks.xstream.io.xml.DomDriver; +import com.thoughtworks.xstream.io.xml.PrettyPrintWriter; +import com.thoughtworks.xstream.io.xml.XppDriver; + +import java.io.StringWriter; +import java.io.Writer; +import java.nio.charset.StandardCharsets; +import java.util.List; + +public class XmlUtil { + + /** + * 转换不带CDDATA的XML + * + * @return + * @ + */ + private static XStream getXStream() { + // 实例化XStream基本对象 + XStream xstream = new XStream(new DomDriver(StandardCharsets.UTF_8.name(), new NoNameCoder() { + // 不对特殊字符进行转换,避免出现重命名字段时的“双下划线” + @Override + public String encodeNode(String name) { + return name; + } + })); + // 忽视XML与JAVABEAN转换时,XML中的字段在JAVABEAN中不存在的部分 + xstream.ignoreUnknownElements(); + return xstream; + } + + + + /** + * 转换带CDDATA的XML + * + * @return + * @ + */ + private static XStream getXStreamWithCData(List ignoreCDATA) { + // 实例化XStream扩展对象 + XStream xstream = new XStream(new XppDriver() { + // 扩展xstream,使其支持CDATA块 + @Override + public HierarchicalStreamWriter createWriter(Writer out) { + return new PrettyPrintWriter(out) { + boolean cdata = true; + // 不对特殊字符进行转换,避免出现重命名字段时的“双下划线” + @Override + public String encodeNode(String name) { + if(!ignoreCDATA.isEmpty()){ + for(String str:ignoreCDATA){ + if(str.equals(name)){ + cdata=false; + return name; + } + } + } + cdata=true; + return name; + } + // 对xml节点的转换都增加CDATA标记 + @Override + protected void writeText(QuickWriter writer, String text) { + if (cdata) { + writer.write(""); + } else { + writer.write(text); + } + } + + + }; + } + }); + // 忽视XML与JAVABEAN转换时,XML中的字段在JAVABEAN中不存在的部分 + xstream.ignoreUnknownElements(); + return xstream; + } + + /** + * 以压缩的方式输出XML + * + * @param obj + * @return + */ + public static String toCompressXml(Object obj) { + XStream xstream = getXStream(); + StringWriter sw = new StringWriter(); + // 识别obj类中的注解 + xstream.processAnnotations(obj.getClass()); + // 设置JavaBean的类别名 + xstream.aliasType("xml", obj.getClass()); + xstream.marshal(obj, new CompactWriter(sw)); + return sw.toString(); + } + + /** + * 以格式化的方式输出XML + * + * @param obj + * @return + */ + public static String toXml(Object obj) { + XStream xstream = getXStream(); + // 识别obj类中的注解 + xstream.processAnnotations(obj.getClass()); + // 设置JavaBean的类别名 + xstream.aliasType("xml", obj.getClass()); + return xstream.toXML(obj); + } + + /** + * 转换成JavaBean + * + * @param xmlStr + * @param cls + * @return + */ + @SuppressWarnings("unchecked") + public static T toBean(String xmlStr, Class cls) { + XStream xstream = getXStream(); + // 识别cls类中的注解 + xstream.processAnnotations(cls); + // 设置JavaBean的类别名 + xstream.aliasType("xml", cls); + T t = (T) xstream.fromXML(xmlStr); + return t; + } + + /** + * 以格式化的方式输出XML + * + * @param obj + * @return + */ + public static String toXmlWithCData(Object obj,List ignoreCDAA) { + XStream xstream = getXStreamWithCData(ignoreCDAA); + // 识别obj类中的注解 + xstream.processAnnotations(obj.getClass()); + // 设置JavaBean的类别名 + xstream.aliasType("xml", obj.getClass()); + return xstream.toXML(obj); + } + + /** + * 转换成JavaBean + * + * @param xmlStr + * @param cls + * @return + */ + @SuppressWarnings("unchecked") + public static T toBeanWithCData(String xmlStr, Class cls) { + XStream xstream = getXStreamWithCData(null); + // 识别cls类中的注解 + xstream.processAnnotations(cls); + // 设置JavaBean的类别名 + xstream.alias("xml", cls); + T t = (T) xstream.fromXML(xmlStr); + return t; + } +} From 8cf6cff7b37319340e7ed69891250f73745f9e93 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 8 Jul 2020 18:08:28 +0800 Subject: [PATCH 23/90] =?UTF-8?q?=E5=8F=91=E5=B8=83epmetthird?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/controller/pa/PaCustomerController.java | 15 +++++++++++++++ .../PublicAccountCallBackController.java} | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/pa/PaCustomerController.java rename epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/{officialaccount/OfficialAccountCallBackController.java => pa/PublicAccountCallBackController.java} (94%) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/pa/PaCustomerController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/pa/PaCustomerController.java new file mode 100644 index 0000000000..92f8adcac7 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/pa/PaCustomerController.java @@ -0,0 +1,15 @@ +package com.epmet.controller.pa; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 公众号用户的注册、客户创建、跟组织创建 ,查询我的详情等等...api写在这 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/8 17:18 + */ +@RestController +@RequestMapping("pacustomer") +public class PaCustomerController { +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/officialaccount/OfficialAccountCallBackController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/pa/PublicAccountCallBackController.java similarity index 94% rename from epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/officialaccount/OfficialAccountCallBackController.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/pa/PublicAccountCallBackController.java index 376f4c9940..c6ff436339 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/officialaccount/OfficialAccountCallBackController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/pa/PublicAccountCallBackController.java @@ -1,4 +1,4 @@ -package com.epmet.controller.officialaccount; +package com.epmet.controller.pa; import com.epmet.commons.tools.utils.Result; import org.apache.commons.codec.digest.DigestUtils; @@ -20,8 +20,8 @@ import java.util.Collections; * @date 2020/7/8 12:43 */ @RestController -@RequestMapping("customerservice") -public class OfficialAccountCallBackController { +@RequestMapping("pa") +public class PublicAccountCallBackController { private Logger logger = LogManager.getLogger(); /** * @param signature 微信加密签名,signature结合了开发者填写的token参数和请求中的timestamp参数、nonce参数。 From 0a1c99df883554bccb8aa1def33b858bec982510 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 8 Jul 2020 18:15:49 +0800 Subject: [PATCH 24/90] =?UTF-8?q?=E5=A2=9E=E5=8A=A0dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third/epmet-third-server/Dockerfile | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 epmet-module/epmet-third/epmet-third-server/Dockerfile diff --git a/epmet-module/epmet-third/epmet-third-server/Dockerfile b/epmet-module/epmet-third/epmet-third-server/Dockerfile new file mode 100644 index 0000000000..d0fef3d421 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/Dockerfile @@ -0,0 +1,11 @@ +FROM java:8 + +RUN export LANG="zh_CN.UTF-8" +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +RUN echo 'Asia/Shanghai' > /etc/timezone + +COPY ./target/*.jar ./app.jar + +EXPOSE 8110 + +ENTRYPOINT ["sh", "-c", "$RUN_INSTRUCT"] \ No newline at end of file From 0c9c7def62dec5f99608f99f632d7bfad7c822e4 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 9 Jul 2020 10:55:53 +0800 Subject: [PATCH 25/90] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/pom.xml | 18 ++++--- .../controller/PaUserLoginController.java | 34 +++++++++++++ .../com/epmet/dto/form/PaWxCodeFormDTO.java | 23 +++++++++ .../com/epmet/service/PaUserLoginService.java | 14 ++++++ .../service/impl/PaUserLoginServiceImpl.java | 49 +++++++++++++++++++ 5 files changed, 132 insertions(+), 6 deletions(-) create mode 100644 epmet-auth/src/main/java/com/epmet/controller/PaUserLoginController.java create mode 100644 epmet-auth/src/main/java/com/epmet/dto/form/PaWxCodeFormDTO.java create mode 100644 epmet-auth/src/main/java/com/epmet/service/PaUserLoginService.java create mode 100644 epmet-auth/src/main/java/com/epmet/service/impl/PaUserLoginServiceImpl.java diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index e0f97c1757..59775a1316 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -104,6 +104,12 @@ 2.0.0 compile + + com.github.binarywang + weixin-java-mp + 3.6.0 + compile + @@ -154,8 +160,8 @@ - wx67fdf7da3fee1890 - ae15094f485af9e5c6b5a8a55945332a + wxe73d1ecd13b5e9fb + 87c9f99e2ea5b695c79e8f5388789959 111 111 @@ -191,8 +197,8 @@ - wx67fdf7da3fee1890 - ae15094f485af9e5c6b5a8a55945332a + wxe73d1ecd13b5e9fb + 87c9f99e2ea5b695c79e8f5388789959 111 111 @@ -228,8 +234,8 @@ - wx67fdf7da3fee1890 - ae15094f485af9e5c6b5a8a55945332a + wxe73d1ecd13b5e9fb + 87c9f99e2ea5b695c79e8f5388789959 111 111 diff --git a/epmet-auth/src/main/java/com/epmet/controller/PaUserLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/PaUserLoginController.java new file mode 100644 index 0000000000..de8922bc18 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/controller/PaUserLoginController.java @@ -0,0 +1,34 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.PaWxCodeFormDTO; +import com.epmet.dto.result.UserTokenResultDTO; +import com.epmet.service.PaUserLoginService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/8 18:29 + */ +@RestController +@RequestMapping("pa") +public class PaUserLoginController { + + @Autowired + private PaUserLoginService paUserLoginService; + + @PostMapping(value = "/loginbywxcode") + public Result loginByWxCode(@RequestBody PaWxCodeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, PaWxCodeFormDTO.AddUserInternalGroup.class); + UserTokenResultDTO userTokenResultDTO=paUserLoginService.loginByWxCode(formDTO); + return new Result().ok(userTokenResultDTO); + } + +} diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/PaWxCodeFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/PaWxCodeFormDTO.java new file mode 100644 index 0000000000..33161e90c9 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/PaWxCodeFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/8 18:32 + */ +@Data +public class PaWxCodeFormDTO implements Serializable { + private static final long serialVersionUID = -207861963128774742L; + public interface AddUserInternalGroup {} + /** + * wxCode + */ + @NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class}) + private String wxCode; +} diff --git a/epmet-auth/src/main/java/com/epmet/service/PaUserLoginService.java b/epmet-auth/src/main/java/com/epmet/service/PaUserLoginService.java new file mode 100644 index 0000000000..bf64bbcb27 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/service/PaUserLoginService.java @@ -0,0 +1,14 @@ +package com.epmet.service; + +import com.epmet.dto.form.PaWxCodeFormDTO; +import com.epmet.dto.result.UserTokenResultDTO; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/8 18:31 + */ +public interface PaUserLoginService { + UserTokenResultDTO loginByWxCode(PaWxCodeFormDTO formDTO); +} diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PaUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PaUserLoginServiceImpl.java new file mode 100644 index 0000000000..4f24e8ea82 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PaUserLoginServiceImpl.java @@ -0,0 +1,49 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.exception.RenException; +import com.epmet.dto.form.PaWxCodeFormDTO; +import com.epmet.dto.result.UserTokenResultDTO; +import com.epmet.service.PaUserLoginService; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken; +import me.chanjar.weixin.mp.bean.result.WxMpUser; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/8 18:31 + */ +@Service +public class PaUserLoginServiceImpl implements PaUserLoginService { + private static final Logger logger = LoggerFactory.getLogger(PaUserLoginServiceImpl.class); + @Autowired + private WxMpService wxMpService; + + + @Override + public UserTokenResultDTO loginByWxCode(PaWxCodeFormDTO formDTO) { + WxMpUser wxMpUser=this.getWxMpUser(formDTO.getWxCode()); + return null; + } + + private WxMpUser getWxMpUser(String wxCode) { + WxMpUser wxMpUser = null; + try { + WxMpOAuth2AccessToken wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(wxCode); + wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, null); + } catch (WxErrorException e) { + logger.error("->[getWxMpUser]::error[{}]", "解析微信用户信息失败"); + } + if (null == wxMpUser || StringUtils.isBlank(wxMpUser.getUnionId())) { + throw new RenException("解析微信用户信息失败"); + } + return wxMpUser; + } +} From 167acb1b592ea8a4c910b37ed70ed40aca2760a4 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 9 Jul 2020 12:42:38 +0800 Subject: [PATCH 26/90] =?UTF-8?q?=E4=BF=AE=E6=94=B9logback=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=85=8D=E7=BD=AE=EF=BC=8C=E7=89=88=E6=9C=AC=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- .../epmet-third-server/src/main/resources/logback-spring.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 3d0b9404ef..df5a05f326 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.1 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.2 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 a8bba9e38c..b021557bc1 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.1 + 0.0.2 com.epmet diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml index 7ead25dd02..fc91993807 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml @@ -2,7 +2,7 @@ - + From 4b104d9715b14166cf3736bc60058e6ed8200a6a Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 9 Jul 2020 15:44:26 +0800 Subject: [PATCH 27/90] =?UTF-8?q?controller=E8=BF=81=E7=A7=BB=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/{pa => }/PaCustomerController.java | 2 +- .../controller/{pa => }/PublicAccountCallBackController.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/{pa => }/PaCustomerController.java (92%) rename epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/{pa => }/PublicAccountCallBackController.java (98%) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/pa/PaCustomerController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java similarity index 92% rename from epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/pa/PaCustomerController.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java index 92f8adcac7..7cc03af30e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/pa/PaCustomerController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java @@ -1,4 +1,4 @@ -package com.epmet.controller.pa; +package com.epmet.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/pa/PublicAccountCallBackController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PublicAccountCallBackController.java similarity index 98% rename from epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/pa/PublicAccountCallBackController.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PublicAccountCallBackController.java index c6ff436339..e1a47748a7 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/pa/PublicAccountCallBackController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PublicAccountCallBackController.java @@ -1,4 +1,4 @@ -package com.epmet.controller.pa; +package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import org.apache.commons.codec.digest.DigestUtils; From 6d377f18569cc097002613da5ef2066cc3aed412 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 9 Jul 2020 15:58:29 +0800 Subject: [PATCH 28/90] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E6=8E=88=E6=9D=83=E7=9B=B8=E5=BA=94=E8=A1=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/CustomerMpDTO.java | 96 +++++++++++++ .../com/epmet/dto/PaCustomerAgencyDTO.java | 111 +++++++++++++++ .../java/com/epmet/dto/PaCustomerDTO.java | 76 ++++++++++ .../epmet/dto/PaCustomerUserAgencyDTO.java | 81 +++++++++++ .../main/java/com/epmet/dto/PaUserDTO.java | 131 ++++++++++++++++++ .../controller/CustomerMpController.java | 94 +++++++++++++ .../PaCustomerAgencyController.java | 94 +++++++++++++ .../PaCustomerUserAgencyController.java | 94 +++++++++++++ .../epmet/controller/PaUserController.java | 94 +++++++++++++ .../java/com/epmet/dao/CustomerMpDao.java | 33 +++++ .../com/epmet/dao/PaCustomerAgencyDao.java | 33 +++++ .../java/com/epmet/dao/PaCustomerDao.java | 33 +++++ .../epmet/dao/PaCustomerUserAgencyDao.java | 33 +++++ .../main/java/com/epmet/dao/PaUserDao.java | 33 +++++ .../com/epmet/entity/CustomerMpEntity.java | 66 +++++++++ .../epmet/entity/PaCustomerAgencyEntity.java | 81 +++++++++++ .../com/epmet/entity/PaCustomerEntity.java | 46 ++++++ .../entity/PaCustomerUserAgencyEntity.java | 51 +++++++ .../java/com/epmet/entity/PaUserEntity.java | 101 ++++++++++++++ .../java/com/epmet/excel/CustomerMpExcel.java | 71 ++++++++++ .../epmet/excel/PaCustomerAgencyExcel.java | 80 +++++++++++ .../java/com/epmet/excel/PaCustomerExcel.java | 59 ++++++++ .../excel/PaCustomerUserAgencyExcel.java | 62 +++++++++ .../java/com/epmet/excel/PaUserExcel.java | 92 ++++++++++++ .../java/com/epmet/redis/CustomerMpRedis.java | 47 +++++++ .../epmet/redis/PaCustomerAgencyRedis.java | 47 +++++++ .../java/com/epmet/redis/PaCustomerRedis.java | 47 +++++++ .../redis/PaCustomerUserAgencyRedis.java | 47 +++++++ .../java/com/epmet/redis/PaUserRedis.java | 47 +++++++ .../com/epmet/service/CustomerMpService.java | 95 +++++++++++++ .../service/PaCustomerAgencyService.java | 95 +++++++++++++ .../com/epmet/service/PaCustomerService.java | 95 +++++++++++++ .../service/PaCustomerUserAgencyService.java | 95 +++++++++++++ .../java/com/epmet/service/PaUserService.java | 95 +++++++++++++ .../service/impl/CustomerMpServiceImpl.java | 104 ++++++++++++++ .../impl/PaCustomerAgencyServiceImpl.java | 104 ++++++++++++++ .../service/impl/PaCustomerServiceImpl.java | 104 ++++++++++++++ .../impl/PaCustomerUserAgencyServiceImpl.java | 104 ++++++++++++++ .../epmet/service/impl/PaUserServiceImpl.java | 104 ++++++++++++++ .../main/resources/mapper/CustomerMpDao.xml | 7 + .../resources/mapper/PaCustomerAgencyDao.xml | 7 + .../main/resources/mapper/PaCustomerDao.xml | 7 + .../mapper/PaCustomerUserAgencyDao.xml | 7 + .../src/main/resources/mapper/PaUserDao.xml | 7 + 44 files changed, 3010 insertions(+) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerAgencyDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerUserAgencyDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CustomerMpController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerAgencyController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerUserAgencyController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerUserAgencyDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerAgencyEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerUserAgencyEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerAgencyExcel.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerExcel.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerUserAgencyExcel.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserExcel.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CustomerMpRedis.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaCustomerAgencyRedis.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaCustomerRedis.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaCustomerUserAgencyRedis.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaUserRedis.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CustomerMpService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerAgencyService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerUserAgencyService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerMpServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerAgencyServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerUserAgencyServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerUserAgencyDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserDao.xml diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java new file mode 100644 index 0000000000..fd7db9bb2d --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 客户小程序关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class CustomerMpDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * pa_customer的id + */ + private String customerId; + + /** + * resi,work + */ + private String client; + + /** + * 小程序的appId + */ + private Integer appId; + + /** + * 是否已经授权 + */ + private Integer authorizationFlag; + + /** + * 公众账号信息id + */ + private String authorizerInfoId; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerAgencyDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerAgencyDTO.java new file mode 100644 index 0000000000..e659efc669 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerAgencyDTO.java @@ -0,0 +1,111 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 客户根组织信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class PaCustomerAgencyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id,来源于customer.id + */ + private String customerId; + + /** + * 根组织名称 + */ + private String agencyName; + + /** + * 级别 + */ + private String level; + + /** + * 地区编码 + */ + private String areaCode; + + /** + * 省 + */ + private String province; + + /** + * 市 + */ + private String city; + + /** + * 区 + */ + private String district; + + /** + * 党支部数量 + */ + private Integer partybranchnum; + + /** + * 删除标识 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java new file mode 100644 index 0000000000..2fed14154e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java @@ -0,0 +1,76 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 客户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class PaCustomerDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户id,本主键和oper_crm.customer.id一致 + */ + private String id; + + /** + * 客户名称,默认是根组织名称 + */ + private String customerName; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerUserAgencyDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerUserAgencyDTO.java new file mode 100644 index 0000000000..6dbd9c3175 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerUserAgencyDTO.java @@ -0,0 +1,81 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 用户组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class PaCustomerUserAgencyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * pa_customer_agency.id + */ + private String agencyId; + + /** + * pa_user.id + */ + private String userId; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java new file mode 100644 index 0000000000..58b36e6d35 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java @@ -0,0 +1,131 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class PaUserDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 本主键会用作customer_staff里的user_id,user表的id + */ + private Integer id; + + /** + * 微信openId + */ + private String wxOpenId; + + /** + * + */ + private String unionId; + + /** + * 手机号 + */ + private String phone; + + /** + * 姓 + */ + private String realName; + + /** + * 1男2女0未知 + */ + private String gender; + + /** + * 昵称 + */ + private String nickname; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * 国家 + */ + private String country; + + /** + * 省份 + */ + private String province; + + /** + * 城市 + */ + private String city; + + /** + * 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) + */ + private String privilege; + + /** + * 语言 + */ + private String language; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CustomerMpController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CustomerMpController.java new file mode 100644 index 0000000000..fc1cfafafb --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CustomerMpController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.CustomerMpDTO; +import com.epmet.excel.CustomerMpExcel; +import com.epmet.service.CustomerMpService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 客户小程序关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@RestController +@RequestMapping("customermp") +public class CustomerMpController { + + @Autowired + private CustomerMpService customerMpService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = customerMpService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + CustomerMpDTO data = customerMpService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody CustomerMpDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + customerMpService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody CustomerMpDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + customerMpService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + customerMpService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = customerMpService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, CustomerMpExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerAgencyController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerAgencyController.java new file mode 100644 index 0000000000..f459d78524 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerAgencyController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.PaCustomerAgencyDTO; +import com.epmet.excel.PaCustomerAgencyExcel; +import com.epmet.service.PaCustomerAgencyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 客户根组织信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@RestController +@RequestMapping("pacustomeragency") +public class PaCustomerAgencyController { + + @Autowired + private PaCustomerAgencyService paCustomerAgencyService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = paCustomerAgencyService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PaCustomerAgencyDTO data = paCustomerAgencyService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody PaCustomerAgencyDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + paCustomerAgencyService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody PaCustomerAgencyDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + paCustomerAgencyService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + paCustomerAgencyService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = paCustomerAgencyService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PaCustomerAgencyExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerUserAgencyController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerUserAgencyController.java new file mode 100644 index 0000000000..9906427507 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerUserAgencyController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.PaCustomerUserAgencyDTO; +import com.epmet.excel.PaCustomerUserAgencyExcel; +import com.epmet.service.PaCustomerUserAgencyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 用户组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@RestController +@RequestMapping("pacustomeruseragency") +public class PaCustomerUserAgencyController { + + @Autowired + private PaCustomerUserAgencyService paCustomerUserAgencyService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = paCustomerUserAgencyService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PaCustomerUserAgencyDTO data = paCustomerUserAgencyService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody PaCustomerUserAgencyDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + paCustomerUserAgencyService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody PaCustomerUserAgencyDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + paCustomerUserAgencyService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + paCustomerUserAgencyService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = paCustomerUserAgencyService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PaCustomerUserAgencyExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserController.java new file mode 100644 index 0000000000..8f447b191e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.PaUserDTO; +import com.epmet.excel.PaUserExcel; +import com.epmet.service.PaUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@RestController +@RequestMapping("pauser") +public class PaUserController { + + @Autowired + private PaUserService paUserService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = paUserService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PaUserDTO data = paUserService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody PaUserDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + paUserService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody PaUserDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + paUserService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + paUserService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = paUserService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PaUserExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java new file mode 100644 index 0000000000..2c7d386261 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.CustomerMpEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户小程序关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Mapper +public interface CustomerMpDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java new file mode 100644 index 0000000000..cec7dcc514 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.PaCustomerAgencyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户根组织信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Mapper +public interface PaCustomerAgencyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java new file mode 100644 index 0000000000..7dc41a284b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.PaCustomerEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Mapper +public interface PaCustomerDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerUserAgencyDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerUserAgencyDao.java new file mode 100644 index 0000000000..388091463d --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerUserAgencyDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.PaCustomerUserAgencyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 用户组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Mapper +public interface PaCustomerUserAgencyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserDao.java new file mode 100644 index 0000000000..858ac17cb2 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.PaUserEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Mapper +public interface PaUserDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java new file mode 100644 index 0000000000..f5773ca85f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 客户小程序关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_mp") +public class CustomerMpEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * pa_customer的id + */ + private String customerId; + + /** + * resi,work + */ + private String client; + + /** + * 小程序的appId + */ + private Integer appId; + + /** + * 是否已经授权 + */ + private Integer authorizationFlag; + + /** + * 公众账号信息id + */ + private String authorizerInfoId; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerAgencyEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerAgencyEntity.java new file mode 100644 index 0000000000..7b52b8ec2b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerAgencyEntity.java @@ -0,0 +1,81 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 客户根组织信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pa_customer_agency") +public class PaCustomerAgencyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id,来源于customer.id + */ + private String customerId; + + /** + * 根组织名称 + */ + private String agencyName; + + /** + * 级别 + */ + private String level; + + /** + * 地区编码 + */ + private String areaCode; + + /** + * 省 + */ + private String province; + + /** + * 市 + */ + private String city; + + /** + * 区 + */ + private String district; + + /** + * 党支部数量 + */ + private Integer partybranchnum; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java new file mode 100644 index 0000000000..09c41932ca --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 客户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pa_customer") +public class PaCustomerEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户名称,默认是根组织名称 + */ + private String customerName; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerUserAgencyEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerUserAgencyEntity.java new file mode 100644 index 0000000000..20eaecd4f9 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerUserAgencyEntity.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 用户组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pa_customer_user_agency") +public class PaCustomerUserAgencyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * pa_customer_agency.id + */ + private String agencyId; + + /** + * pa_user.id + */ + private String userId; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserEntity.java new file mode 100644 index 0000000000..f0ee68023a --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserEntity.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pa_user") +public class PaUserEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 微信openId + */ + private String wxOpenId; + + /** + * + */ + private String unionId; + + /** + * 手机号 + */ + private String phone; + + /** + * 姓 + */ + private String realName; + + /** + * 1男2女0未知 + */ + private String gender; + + /** + * 昵称 + */ + private String nickname; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * 国家 + */ + private String country; + + /** + * 省份 + */ + private String province; + + /** + * 城市 + */ + private String city; + + /** + * 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) + */ + private String privilege; + + /** + * 语言 + */ + private String language; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java new file mode 100644 index 0000000000..b4f62eb57f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 客户小程序关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class CustomerMpExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "pa_customer的id") + private String customerId; + + @Excel(name = "resi,work") + private String client; + + @Excel(name = "小程序的appId") + private Integer appId; + + @Excel(name = "是否已经授权") + private Integer authorizationFlag; + + @Excel(name = "公众账号信息id") + private String authorizerInfoId; + + @Excel(name = "删除标识:0.未删除 1.已删除") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerAgencyExcel.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerAgencyExcel.java new file mode 100644 index 0000000000..065b2203db --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerAgencyExcel.java @@ -0,0 +1,80 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 客户根组织信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class PaCustomerAgencyExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户id,来源于customer.id") + private String customerId; + + @Excel(name = "根组织名称") + private String agencyName; + + @Excel(name = "级别") + private String level; + + @Excel(name = "地区编码") + private String areaCode; + + @Excel(name = "省") + private String province; + + @Excel(name = "市") + private String city; + + @Excel(name = "区") + private String district; + + @Excel(name = "党支部数量") + private Integer partybranchnum; + + @Excel(name = "删除标识") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerExcel.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerExcel.java new file mode 100644 index 0000000000..b30999fe95 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerExcel.java @@ -0,0 +1,59 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 客户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class PaCustomerExcel { + + @Excel(name = "客户id,本主键和oper_crm.customer.id一致") + private String id; + + @Excel(name = "客户名称,默认是根组织名称") + private String customerName; + + @Excel(name = "删除标识:0.未删除 1.已删除") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerUserAgencyExcel.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerUserAgencyExcel.java new file mode 100644 index 0000000000..08fd132e83 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerUserAgencyExcel.java @@ -0,0 +1,62 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 用户组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class PaCustomerUserAgencyExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "pa_customer_agency.id") + private String agencyId; + + @Excel(name = "pa_user.id") + private String userId; + + @Excel(name = "删除标识") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserExcel.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserExcel.java new file mode 100644 index 0000000000..02d2b81d36 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserExcel.java @@ -0,0 +1,92 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class PaUserExcel { + + @Excel(name = "本主键会用作customer_staff里的user_id,user表的id") + private Integer id; + + @Excel(name = "微信openId") + private String wxOpenId; + + @Excel(name = "") + private String unionId; + + @Excel(name = "手机号") + private String phone; + + @Excel(name = "姓") + private String realName; + + @Excel(name = "1男2女0未知") + private String gender; + + @Excel(name = "昵称") + private String nickname; + + @Excel(name = "头像") + private String headImgUrl; + + @Excel(name = "国家") + private String country; + + @Excel(name = "省份") + private String province; + + @Excel(name = "城市") + private String city; + + @Excel(name = "用户特权信息,json 数组,如微信沃卡用户为(chinaunicom)") + private String privilege; + + @Excel(name = "语言") + private String language; + + @Excel(name = "删除标识") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CustomerMpRedis.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CustomerMpRedis.java new file mode 100644 index 0000000000..0695487db2 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CustomerMpRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 客户小程序关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Component +public class CustomerMpRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaCustomerAgencyRedis.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaCustomerAgencyRedis.java new file mode 100644 index 0000000000..b343ca7eae --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaCustomerAgencyRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 客户根组织信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Component +public class PaCustomerAgencyRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaCustomerRedis.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaCustomerRedis.java new file mode 100644 index 0000000000..f0169f57de --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaCustomerRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 客户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Component +public class PaCustomerRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaCustomerUserAgencyRedis.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaCustomerUserAgencyRedis.java new file mode 100644 index 0000000000..074051791e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaCustomerUserAgencyRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 用户组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Component +public class PaCustomerUserAgencyRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaUserRedis.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaUserRedis.java new file mode 100644 index 0000000000..d66da0300f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaUserRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Component +public class PaUserRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CustomerMpService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CustomerMpService.java new file mode 100644 index 0000000000..ba98b8b295 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CustomerMpService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.CustomerMpDTO; +import com.epmet.entity.CustomerMpEntity; + +import java.util.List; +import java.util.Map; + +/** + * 客户小程序关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +public interface CustomerMpService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-09 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-09 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CustomerMpDTO + * @author generator + * @date 2020-07-09 + */ + CustomerMpDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void save(CustomerMpDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void update(CustomerMpDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-07-09 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerAgencyService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerAgencyService.java new file mode 100644 index 0000000000..75d9445b5c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerAgencyService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.PaCustomerAgencyDTO; +import com.epmet.entity.PaCustomerAgencyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 客户根组织信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +public interface PaCustomerAgencyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-09 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-09 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PaCustomerAgencyDTO + * @author generator + * @date 2020-07-09 + */ + PaCustomerAgencyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void save(PaCustomerAgencyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void update(PaCustomerAgencyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-07-09 + */ + void delete(String[] ids); +} \ 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 new file mode 100644 index 0000000000..65586defbf --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.PaCustomerDTO; +import com.epmet.entity.PaCustomerEntity; + +import java.util.List; +import java.util.Map; + +/** + * 客户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +public interface PaCustomerService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-09 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-09 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PaCustomerDTO + * @author generator + * @date 2020-07-09 + */ + PaCustomerDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void save(PaCustomerDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void update(PaCustomerDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-07-09 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerUserAgencyService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerUserAgencyService.java new file mode 100644 index 0000000000..279c16a5ce --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerUserAgencyService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.PaCustomerUserAgencyDTO; +import com.epmet.entity.PaCustomerUserAgencyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 用户组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +public interface PaCustomerUserAgencyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-09 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-09 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PaCustomerUserAgencyDTO + * @author generator + * @date 2020-07-09 + */ + PaCustomerUserAgencyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void save(PaCustomerUserAgencyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void update(PaCustomerUserAgencyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-07-09 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserService.java new file mode 100644 index 0000000000..b55098f052 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.PaUserDTO; +import com.epmet.entity.PaUserEntity; + +import java.util.List; +import java.util.Map; + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +public interface PaUserService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-09 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-09 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PaUserDTO + * @author generator + * @date 2020-07-09 + */ + PaUserDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void save(PaUserDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void update(PaUserDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-07-09 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerMpServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerMpServiceImpl.java new file mode 100644 index 0000000000..5bb85272a0 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerMpServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.CustomerMpDao; +import com.epmet.dto.CustomerMpDTO; +import com.epmet.entity.CustomerMpEntity; +import com.epmet.redis.CustomerMpRedis; +import com.epmet.service.CustomerMpService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 客户小程序关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Service +public class CustomerMpServiceImpl extends BaseServiceImpl implements CustomerMpService { + + @Autowired + private CustomerMpRedis customerMpRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CustomerMpDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CustomerMpDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public CustomerMpDTO get(String id) { + CustomerMpEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CustomerMpDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CustomerMpDTO dto) { + CustomerMpEntity entity = ConvertUtils.sourceToTarget(dto, CustomerMpEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CustomerMpDTO dto) { + CustomerMpEntity entity = ConvertUtils.sourceToTarget(dto, CustomerMpEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerAgencyServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerAgencyServiceImpl.java new file mode 100644 index 0000000000..f3301377d0 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerAgencyServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.PaCustomerAgencyDao; +import com.epmet.dto.PaCustomerAgencyDTO; +import com.epmet.entity.PaCustomerAgencyEntity; +import com.epmet.redis.PaCustomerAgencyRedis; +import com.epmet.service.PaCustomerAgencyService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 客户根组织信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Service +public class PaCustomerAgencyServiceImpl extends BaseServiceImpl implements PaCustomerAgencyService { + + @Autowired + private PaCustomerAgencyRedis paCustomerAgencyRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PaCustomerAgencyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PaCustomerAgencyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public PaCustomerAgencyDTO get(String id) { + PaCustomerAgencyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PaCustomerAgencyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PaCustomerAgencyDTO dto) { + PaCustomerAgencyEntity entity = ConvertUtils.sourceToTarget(dto, PaCustomerAgencyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PaCustomerAgencyDTO dto) { + PaCustomerAgencyEntity entity = ConvertUtils.sourceToTarget(dto, PaCustomerAgencyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ 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 new file mode 100644 index 0000000000..c1dc9b68f5 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.PaCustomerDao; +import com.epmet.dto.PaCustomerDTO; +import com.epmet.entity.PaCustomerEntity; +import com.epmet.redis.PaCustomerRedis; +import com.epmet.service.PaCustomerService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 客户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Service +public class PaCustomerServiceImpl extends BaseServiceImpl implements PaCustomerService { + + @Autowired + private PaCustomerRedis paCustomerRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PaCustomerDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PaCustomerDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public PaCustomerDTO get(String id) { + PaCustomerEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PaCustomerDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PaCustomerDTO dto) { + PaCustomerEntity entity = ConvertUtils.sourceToTarget(dto, PaCustomerEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PaCustomerDTO dto) { + PaCustomerEntity entity = ConvertUtils.sourceToTarget(dto, PaCustomerEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerUserAgencyServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerUserAgencyServiceImpl.java new file mode 100644 index 0000000000..3ddecf4123 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerUserAgencyServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.PaCustomerUserAgencyDao; +import com.epmet.dto.PaCustomerUserAgencyDTO; +import com.epmet.entity.PaCustomerUserAgencyEntity; +import com.epmet.redis.PaCustomerUserAgencyRedis; +import com.epmet.service.PaCustomerUserAgencyService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 用户组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Service +public class PaCustomerUserAgencyServiceImpl extends BaseServiceImpl implements PaCustomerUserAgencyService { + + @Autowired + private PaCustomerUserAgencyRedis paCustomerUserAgencyRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PaCustomerUserAgencyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PaCustomerUserAgencyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public PaCustomerUserAgencyDTO get(String id) { + PaCustomerUserAgencyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PaCustomerUserAgencyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PaCustomerUserAgencyDTO dto) { + PaCustomerUserAgencyEntity entity = ConvertUtils.sourceToTarget(dto, PaCustomerUserAgencyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PaCustomerUserAgencyDTO dto) { + PaCustomerUserAgencyEntity entity = ConvertUtils.sourceToTarget(dto, PaCustomerUserAgencyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java new file mode 100644 index 0000000000..d902604396 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.PaUserDao; +import com.epmet.dto.PaUserDTO; +import com.epmet.entity.PaUserEntity; +import com.epmet.redis.PaUserRedis; +import com.epmet.service.PaUserService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Service +public class PaUserServiceImpl extends BaseServiceImpl implements PaUserService { + + @Autowired + private PaUserRedis paUserRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PaUserDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PaUserDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public PaUserDTO get(String id) { + PaUserEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PaUserDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PaUserDTO dto) { + PaUserEntity entity = ConvertUtils.sourceToTarget(dto, PaUserEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PaUserDTO dto) { + PaUserEntity entity = ConvertUtils.sourceToTarget(dto, PaUserEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml new file mode 100644 index 0000000000..a348e795ed --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml new file mode 100644 index 0000000000..5867f5a86c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ 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 new file mode 100644 index 0000000000..9358d53ab5 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerUserAgencyDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerUserAgencyDao.xml new file mode 100644 index 0000000000..9efe156b41 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerUserAgencyDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserDao.xml new file mode 100644 index 0000000000..505b33576c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file From c502ec14b27812dcb87a2fa768402b6c44d3787f Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 9 Jul 2020 16:56:28 +0800 Subject: [PATCH 29/90] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/PaCustomerUserAgencyDTO.java | 5 + .../main/java/com/epmet/dto/PaUserDTO.java | 45 ------ .../java/com/epmet/dto/PaUserVisitedDTO.java | 91 ++++++++++++ .../java/com/epmet/dto/PaUserWechatDTO.java | 131 ++++++++++++++++++ .../controller/PaUserVisitedController.java | 94 +++++++++++++ .../controller/PaUserWechatController.java | 94 +++++++++++++ .../java/com/epmet/dao/PaUserVisitedDao.java | 33 +++++ .../java/com/epmet/dao/PaUserWechatDao.java | 33 +++++ .../entity/PaCustomerUserAgencyEntity.java | 5 + .../java/com/epmet/entity/PaUserEntity.java | 45 ------ .../com/epmet/entity/PaUserVisitedEntity.java | 61 ++++++++ .../com/epmet/entity/PaUserWechatEntity.java | 101 ++++++++++++++ .../excel/PaCustomerUserAgencyExcel.java | 3 + .../java/com/epmet/excel/PaUserExcel.java | 27 ---- .../com/epmet/excel/PaUserVisitedExcel.java | 68 +++++++++ .../com/epmet/excel/PaUserWechatExcel.java | 92 ++++++++++++ .../com/epmet/redis/PaUserVisitedRedis.java | 47 +++++++ .../com/epmet/redis/PaUserWechatRedis.java | 47 +++++++ .../epmet/service/PaUserVisitedService.java | 95 +++++++++++++ .../epmet/service/PaUserWechatService.java | 95 +++++++++++++ .../impl/PaUserVisitedServiceImpl.java | 104 ++++++++++++++ .../service/impl/PaUserWechatServiceImpl.java | 104 ++++++++++++++ .../resources/mapper/PaUserVisitedDao.xml | 7 + .../main/resources/mapper/PaUserWechatDao.xml | 7 + 24 files changed, 1317 insertions(+), 117 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserVisitedDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserWechatDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserVisitedController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserWechatController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserVisitedDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserVisitedEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserWechatEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserVisitedExcel.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserWechatExcel.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaUserVisitedRedis.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaUserWechatRedis.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserVisitedService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserVisitedServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserWechatServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserVisitedDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerUserAgencyDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerUserAgencyDTO.java index 6dbd9c3175..5bec4b8aa1 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerUserAgencyDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerUserAgencyDTO.java @@ -38,6 +38,11 @@ public class PaCustomerUserAgencyDTO implements Serializable { */ private String id; + /** + * 客户id,来源于pa_customer.id + */ + private String customerId; + /** * pa_customer_agency.id */ diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java index 58b36e6d35..1491066d85 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java @@ -38,16 +38,6 @@ public class PaUserDTO implements Serializable { */ private Integer id; - /** - * 微信openId - */ - private String wxOpenId; - - /** - * - */ - private String unionId; - /** * 手机号 */ @@ -63,41 +53,6 @@ public class PaUserDTO implements Serializable { */ private String gender; - /** - * 昵称 - */ - private String nickname; - - /** - * 头像 - */ - private String headImgUrl; - - /** - * 国家 - */ - private String country; - - /** - * 省份 - */ - private String province; - - /** - * 城市 - */ - private String city; - - /** - * 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) - */ - private String privilege; - - /** - * 语言 - */ - private String language; - /** * 删除标识 */ diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserVisitedDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserVisitedDTO.java new file mode 100644 index 0000000000..7755dc1182 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserVisitedDTO.java @@ -0,0 +1,91 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 公众号登陆记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class PaUserVisitedDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 本主键会用作customer_staff里的user_id,user表的id + */ + private Integer id; + + /** + * 用户Id pa_user.id + */ + private String userId; + + /** + * 登陆手机号对应的openId【pa_user_wechat表手机号对应的openId】 + */ + private String wxOpenId; + + /** + * 登陆用户的openId + */ + private String openId; + + /** + * 登陆用户使用的登陆手机号 + */ + private String phone; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserWechatDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserWechatDTO.java new file mode 100644 index 0000000000..9f11eab524 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserWechatDTO.java @@ -0,0 +1,131 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class PaUserWechatDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 本主键会用作customer_staff里的user_id,user表的id + */ + private Integer id; + + /** + * 用户Id user.id + */ + private String userId; + + /** + * 注册用户的微信openId + */ + private String wxOpenId; + + /** + * + */ + private String unionId; + + /** + * 手机号 + */ + private String phone; + + /** + * 1男2女0未知 + */ + private String gender; + + /** + * 昵称 + */ + private String nickname; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * 国家 + */ + private String country; + + /** + * 省份 + */ + private String province; + + /** + * 城市 + */ + private String city; + + /** + * 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) + */ + private String privilege; + + /** + * 语言 + */ + private String language; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserVisitedController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserVisitedController.java new file mode 100644 index 0000000000..c89fee64a4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserVisitedController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.PaUserVisitedDTO; +import com.epmet.excel.PaUserVisitedExcel; +import com.epmet.service.PaUserVisitedService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 公众号登陆记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@RestController +@RequestMapping("pauservisited") +public class PaUserVisitedController { + + @Autowired + private PaUserVisitedService paUserVisitedService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = paUserVisitedService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PaUserVisitedDTO data = paUserVisitedService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody PaUserVisitedDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + paUserVisitedService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody PaUserVisitedDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + paUserVisitedService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + paUserVisitedService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = paUserVisitedService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PaUserVisitedExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserWechatController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserWechatController.java new file mode 100644 index 0000000000..6a44a17cf7 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserWechatController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.PaUserWechatDTO; +import com.epmet.excel.PaUserWechatExcel; +import com.epmet.service.PaUserWechatService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@RestController +@RequestMapping("pauserwechat") +public class PaUserWechatController { + + @Autowired + private PaUserWechatService paUserWechatService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = paUserWechatService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PaUserWechatDTO data = paUserWechatService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody PaUserWechatDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + paUserWechatService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody PaUserWechatDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + paUserWechatService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + paUserWechatService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = paUserWechatService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PaUserWechatExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserVisitedDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserVisitedDao.java new file mode 100644 index 0000000000..d1910601c7 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserVisitedDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.PaUserVisitedEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 公众号登陆记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Mapper +public interface PaUserVisitedDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java new file mode 100644 index 0000000000..29e11cb876 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.PaUserWechatEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Mapper +public interface PaUserWechatDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerUserAgencyEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerUserAgencyEntity.java index 20eaecd4f9..4f0c90ddfe 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerUserAgencyEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerUserAgencyEntity.java @@ -38,6 +38,11 @@ public class PaCustomerUserAgencyEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; + /** + * 客户id,来源于customer.id + */ + private String customerId; + /** * pa_customer_agency.id */ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserEntity.java index f0ee68023a..21565600a6 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserEntity.java @@ -38,16 +38,6 @@ public class PaUserEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; - /** - * 微信openId - */ - private String wxOpenId; - - /** - * - */ - private String unionId; - /** * 手机号 */ @@ -63,39 +53,4 @@ public class PaUserEntity extends BaseEpmetEntity { */ private String gender; - /** - * 昵称 - */ - private String nickname; - - /** - * 头像 - */ - private String headImgUrl; - - /** - * 国家 - */ - private String country; - - /** - * 省份 - */ - private String province; - - /** - * 城市 - */ - private String city; - - /** - * 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) - */ - private String privilege; - - /** - * 语言 - */ - private String language; - } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserVisitedEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserVisitedEntity.java new file mode 100644 index 0000000000..4eb51375ba --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserVisitedEntity.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 公众号登陆记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pa_user_visited") +public class PaUserVisitedEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 用户Id pa_user.id + */ + private String userId; + + /** + * 登陆手机号对应的openId【pa_user_wechat表手机号对应的openId】 + */ + private String wxOpenId; + + /** + * 登陆用户的openId + */ + private String openId; + + /** + * 登陆用户使用的登陆手机号 + */ + private String phone; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserWechatEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserWechatEntity.java new file mode 100644 index 0000000000..61cb92e0b8 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserWechatEntity.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pa_user_wechat") +public class PaUserWechatEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 用户Id user.id + */ + private String userId; + + /** + * 注册用户的微信openId + */ + private String wxOpenId; + + /** + * + */ + private String unionId; + + /** + * 手机号 + */ + private String phone; + + /** + * 1男2女0未知 + */ + private String gender; + + /** + * 昵称 + */ + private String nickname; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * 国家 + */ + private String country; + + /** + * 省份 + */ + private String province; + + /** + * 城市 + */ + private String city; + + /** + * 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) + */ + private String privilege; + + /** + * 语言 + */ + private String language; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerUserAgencyExcel.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerUserAgencyExcel.java index 08fd132e83..889be75cb9 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerUserAgencyExcel.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerUserAgencyExcel.java @@ -34,6 +34,9 @@ public class PaCustomerUserAgencyExcel { @Excel(name = "主键") private String id; + @Excel(name = "客户id,来源于customer.id") + private String customerId; + @Excel(name = "pa_customer_agency.id") private String agencyId; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserExcel.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserExcel.java index 02d2b81d36..96c7263c1e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserExcel.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserExcel.java @@ -34,12 +34,6 @@ public class PaUserExcel { @Excel(name = "本主键会用作customer_staff里的user_id,user表的id") private Integer id; - @Excel(name = "微信openId") - private String wxOpenId; - - @Excel(name = "") - private String unionId; - @Excel(name = "手机号") private String phone; @@ -49,27 +43,6 @@ public class PaUserExcel { @Excel(name = "1男2女0未知") private String gender; - @Excel(name = "昵称") - private String nickname; - - @Excel(name = "头像") - private String headImgUrl; - - @Excel(name = "国家") - private String country; - - @Excel(name = "省份") - private String province; - - @Excel(name = "城市") - private String city; - - @Excel(name = "用户特权信息,json 数组,如微信沃卡用户为(chinaunicom)") - private String privilege; - - @Excel(name = "语言") - private String language; - @Excel(name = "删除标识") private String delFlag; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserVisitedExcel.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserVisitedExcel.java new file mode 100644 index 0000000000..03a908a88d --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserVisitedExcel.java @@ -0,0 +1,68 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 公众号登陆记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class PaUserVisitedExcel { + + @Excel(name = "本主键会用作customer_staff里的user_id,user表的id") + private Integer id; + + @Excel(name = "用户Id pa_user.id") + private String userId; + + @Excel(name = "登陆手机号对应的openId【pa_user_wechat表手机号对应的openId】") + private String wxOpenId; + + @Excel(name = "登陆用户的openId") + private String openId; + + @Excel(name = "登陆用户使用的登陆手机号") + private String phone; + + @Excel(name = "删除标识") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserWechatExcel.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserWechatExcel.java new file mode 100644 index 0000000000..2e7b5ba12d --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserWechatExcel.java @@ -0,0 +1,92 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class PaUserWechatExcel { + + @Excel(name = "本主键会用作customer_staff里的user_id,user表的id") + private Integer id; + + @Excel(name = "用户Id user.id") + private String userId; + + @Excel(name = "注册用户的微信openId") + private String wxOpenId; + + @Excel(name = "") + private String unionId; + + @Excel(name = "手机号") + private String phone; + + @Excel(name = "1男2女0未知") + private String gender; + + @Excel(name = "昵称") + private String nickname; + + @Excel(name = "头像") + private String headImgUrl; + + @Excel(name = "国家") + private String country; + + @Excel(name = "省份") + private String province; + + @Excel(name = "城市") + private String city; + + @Excel(name = "用户特权信息,json 数组,如微信沃卡用户为(chinaunicom)") + private String privilege; + + @Excel(name = "语言") + private String language; + + @Excel(name = "删除标识") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaUserVisitedRedis.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaUserVisitedRedis.java new file mode 100644 index 0000000000..d74d8663aa --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaUserVisitedRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 公众号登陆记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Component +public class PaUserVisitedRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaUserWechatRedis.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaUserWechatRedis.java new file mode 100644 index 0000000000..171a852f3b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/PaUserWechatRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Component +public class PaUserWechatRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserVisitedService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserVisitedService.java new file mode 100644 index 0000000000..130e9d693c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserVisitedService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.PaUserVisitedDTO; +import com.epmet.entity.PaUserVisitedEntity; + +import java.util.List; +import java.util.Map; + +/** + * 公众号登陆记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +public interface PaUserVisitedService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-09 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-09 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PaUserVisitedDTO + * @author generator + * @date 2020-07-09 + */ + PaUserVisitedDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void save(PaUserVisitedDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void update(PaUserVisitedDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-07-09 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java new file mode 100644 index 0000000000..1a613c796d --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.PaUserWechatDTO; +import com.epmet.entity.PaUserWechatEntity; + +import java.util.List; +import java.util.Map; + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +public interface PaUserWechatService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-09 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-09 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PaUserWechatDTO + * @author generator + * @date 2020-07-09 + */ + PaUserWechatDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void save(PaUserWechatDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void update(PaUserWechatDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-07-09 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserVisitedServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserVisitedServiceImpl.java new file mode 100644 index 0000000000..fd00039467 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserVisitedServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.PaUserVisitedDao; +import com.epmet.dto.PaUserVisitedDTO; +import com.epmet.entity.PaUserVisitedEntity; +import com.epmet.redis.PaUserVisitedRedis; +import com.epmet.service.PaUserVisitedService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 公众号登陆记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Service +public class PaUserVisitedServiceImpl extends BaseServiceImpl implements PaUserVisitedService { + + @Autowired + private PaUserVisitedRedis paUserVisitedRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PaUserVisitedDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PaUserVisitedDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public PaUserVisitedDTO get(String id) { + PaUserVisitedEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PaUserVisitedDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PaUserVisitedDTO dto) { + PaUserVisitedEntity entity = ConvertUtils.sourceToTarget(dto, PaUserVisitedEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PaUserVisitedDTO dto) { + PaUserVisitedEntity entity = ConvertUtils.sourceToTarget(dto, PaUserVisitedEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserWechatServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserWechatServiceImpl.java new file mode 100644 index 0000000000..e5a4746faa --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserWechatServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.PaUserWechatDao; +import com.epmet.dto.PaUserWechatDTO; +import com.epmet.entity.PaUserWechatEntity; +import com.epmet.redis.PaUserWechatRedis; +import com.epmet.service.PaUserWechatService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 公众号用户信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Service +public class PaUserWechatServiceImpl extends BaseServiceImpl implements PaUserWechatService { + + @Autowired + private PaUserWechatRedis paUserWechatRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, PaUserWechatDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PaUserWechatDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public PaUserWechatDTO get(String id) { + PaUserWechatEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PaUserWechatDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PaUserWechatDTO dto) { + PaUserWechatEntity entity = ConvertUtils.sourceToTarget(dto, PaUserWechatEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PaUserWechatDTO dto) { + PaUserWechatEntity entity = ConvertUtils.sourceToTarget(dto, PaUserWechatEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserVisitedDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserVisitedDao.xml new file mode 100644 index 0000000000..9023e43184 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserVisitedDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml new file mode 100644 index 0000000000..a6e8b4ce94 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file From bcbb1dc02c3358a94ea27ce4b6a706cfffd46c20 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 9 Jul 2020 17:13:18 +0800 Subject: [PATCH 30/90] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B5=8B=E8=AF=95testw?= =?UTF-8?q?xcode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/pom.xml | 30 +++++++++++-------- ...er.java => PublicUserLoginController.java} | 26 ++++++++++------ ...rvice.java => PublicUserLoginService.java} | 7 +++-- ...l.java => PublicUserLoginServiceImpl.java} | 16 ++++++---- 4 files changed, 49 insertions(+), 30 deletions(-) rename epmet-auth/src/main/java/com/epmet/controller/{PaUserLoginController.java => PublicUserLoginController.java} (53%) rename epmet-auth/src/main/java/com/epmet/service/{PaUserLoginService.java => PublicUserLoginService.java} (51%) rename epmet-auth/src/main/java/com/epmet/service/impl/{PaUserLoginServiceImpl.java => PublicUserLoginServiceImpl.java} (80%) diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 59775a1316..de5d22524a 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -80,6 +80,12 @@ 1.0.0 compile + + com.epmet + epmet-commons-tools-wx-mp + 1.0.0 + compile + com.epmet epmet-user-client @@ -160,10 +166,10 @@ - wxe73d1ecd13b5e9fb - 87c9f99e2ea5b695c79e8f5388789959 - 111 - 111 + wxcb6ce2ed0c5ae54c + c7f74941ee97fa9b2e1065772d34c397 + 12345678Yzm + jiKrJoPQsUIP9ayAwmuJQeAVPBjFOh5D1JxFDd7ZSU3 wx07674c23af51b521 a2fd0d29b007cbbcf8c8dda8c693d99b @@ -197,10 +203,10 @@ - wxe73d1ecd13b5e9fb - 87c9f99e2ea5b695c79e8f5388789959 - 111 - 111 + wxcb6ce2ed0c5ae54c + c7f74941ee97fa9b2e1065772d34c397 + 12345678Yzm + jiKrJoPQsUIP9ayAwmuJQeAVPBjFOh5D1JxFDd7ZSU3 wx07674c23af51b521 a2fd0d29b007cbbcf8c8dda8c693d99b @@ -234,10 +240,10 @@ - wxe73d1ecd13b5e9fb - 87c9f99e2ea5b695c79e8f5388789959 - 111 - 111 + wxcb6ce2ed0c5ae54c + c7f74941ee97fa9b2e1065772d34c397 + 12345678Yzm + jiKrJoPQsUIP9ayAwmuJQeAVPBjFOh5D1JxFDd7ZSU3 wx07674c23af51b521 a2fd0d29b007cbbcf8c8dda8c693d99b diff --git a/epmet-auth/src/main/java/com/epmet/controller/PaUserLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java similarity index 53% rename from epmet-auth/src/main/java/com/epmet/controller/PaUserLoginController.java rename to epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java index de8922bc18..9a48be046c 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/PaUserLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java @@ -3,14 +3,15 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.PaWxCodeFormDTO; -import com.epmet.dto.result.UserTokenResultDTO; -import com.epmet.service.PaUserLoginService; +import com.epmet.service.PublicUserLoginService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.Map; + /** * 描述一下 * @@ -18,17 +19,24 @@ import org.springframework.web.bind.annotation.RestController; * @date 2020/7/8 18:29 */ @RestController -@RequestMapping("pa") -public class PaUserLoginController { +@RequestMapping("publicuser") +public class PublicUserLoginController { @Autowired - private PaUserLoginService paUserLoginService; + private PublicUserLoginService publicUserLoginService; - @PostMapping(value = "/loginbywxcode") - public Result loginByWxCode(@RequestBody PaWxCodeFormDTO formDTO) { + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 测试是否能正常解析wxcode + * @Date 2020/7/9 17:00 + **/ + @PostMapping(value = "/testwxcode") + public Result loginByWxCode(@RequestBody PaWxCodeFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, PaWxCodeFormDTO.AddUserInternalGroup.class); - UserTokenResultDTO userTokenResultDTO=paUserLoginService.loginByWxCode(formDTO); - return new Result().ok(userTokenResultDTO); + Map map = publicUserLoginService.loginByWxCode(formDTO); + return new Result().ok(map); } } diff --git a/epmet-auth/src/main/java/com/epmet/service/PaUserLoginService.java b/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java similarity index 51% rename from epmet-auth/src/main/java/com/epmet/service/PaUserLoginService.java rename to epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java index bf64bbcb27..20091381c0 100644 --- a/epmet-auth/src/main/java/com/epmet/service/PaUserLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java @@ -1,7 +1,8 @@ package com.epmet.service; import com.epmet.dto.form.PaWxCodeFormDTO; -import com.epmet.dto.result.UserTokenResultDTO; + +import java.util.Map; /** * 描述一下 @@ -9,6 +10,6 @@ import com.epmet.dto.result.UserTokenResultDTO; * @author yinzuomei@elink-cn.com * @date 2020/7/8 18:31 */ -public interface PaUserLoginService { - UserTokenResultDTO loginByWxCode(PaWxCodeFormDTO formDTO); +public interface PublicUserLoginService { + Map loginByWxCode(PaWxCodeFormDTO formDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PaUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java similarity index 80% rename from epmet-auth/src/main/java/com/epmet/service/impl/PaUserLoginServiceImpl.java rename to epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java index 4f24e8ea82..580e582888 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/PaUserLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java @@ -2,8 +2,7 @@ package com.epmet.service.impl; import com.epmet.commons.tools.exception.RenException; import com.epmet.dto.form.PaWxCodeFormDTO; -import com.epmet.dto.result.UserTokenResultDTO; -import com.epmet.service.PaUserLoginService; +import com.epmet.service.PublicUserLoginService; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken; @@ -14,6 +13,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.HashMap; +import java.util.Map; + /** * 描述一下 * @@ -21,16 +23,18 @@ import org.springframework.stereotype.Service; * @date 2020/7/8 18:31 */ @Service -public class PaUserLoginServiceImpl implements PaUserLoginService { - private static final Logger logger = LoggerFactory.getLogger(PaUserLoginServiceImpl.class); +public class PublicUserLoginServiceImpl implements PublicUserLoginService { + private static final Logger logger = LoggerFactory.getLogger(PublicUserLoginServiceImpl.class); @Autowired private WxMpService wxMpService; @Override - public UserTokenResultDTO loginByWxCode(PaWxCodeFormDTO formDTO) { + public Map loginByWxCode(PaWxCodeFormDTO formDTO) { WxMpUser wxMpUser=this.getWxMpUser(formDTO.getWxCode()); - return null; + Map map =new HashMap(); + map.put("微信用户信息",wxMpUser); + return map; } private WxMpUser getWxMpUser(String wxCode) { From 6b3bb4334d436216512fec802552da5c452b3503 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 9 Jul 2020 17:16:31 +0800 Subject: [PATCH 31/90] =?UTF-8?q?auth+1:=E6=96=B0=E5=A2=9E=E6=B5=8B?= =?UTF-8?q?=E8=AF=95testwxcode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index 8498362d05..6b58dcdce2 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.36 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.37 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index de5d22524a..0d65cb72e1 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.36 + 0.3.37 com.epmet epmet-cloud From 86bd85a3dd89c5280adf7150e6e0b274c46443b0 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 9 Jul 2020 18:18:13 +0800 Subject: [PATCH 32/90] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B5=8B=E8=AF=95testw?= =?UTF-8?q?xcodev1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/PublicUserLoginServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java index 580e582888..3a3481a7a8 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java @@ -43,7 +43,8 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { WxMpOAuth2AccessToken wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(wxCode); wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, null); } catch (WxErrorException e) { - logger.error("->[getWxMpUser]::error[{}]", "解析微信用户信息失败"); + e.printStackTrace(); + logger.error("->[getWxMpUser]::error[{}]", "解析微信用户信息失败",e.getMessage()); } if (null == wxMpUser || StringUtils.isBlank(wxMpUser.getUnionId())) { throw new RenException("解析微信用户信息失败"); From cdb040ae40c91ce53bfcdd4e075da67f0176fed0 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Thu, 9 Jul 2020 18:26:31 +0800 Subject: [PATCH 33/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/AuthCodeDTO.java | 86 ++++++++ .../com/epmet/dto/AuthorizationInfoDTO.java | 91 +++++++++ .../epmet/dto/AuthorizerRefreshTokenDTO.java | 76 +++++++ .../epmet/dto/ComponentAccessTokenDTO.java | 76 +++++++ .../main/java/com/epmet/dto/FuncInfoDTO.java | 86 ++++++++ .../java/com/epmet/dto/PreAuthTokenDTO.java | 76 +++++++ .../dto/RefreshAuthorizerAccessTokenDTO.java | 91 +++++++++ .../com/epmet/dto/form/AuthCodeFormDTO.java | 50 +++++ .../dto/form/AuthorizationInfoFormDTO.java | 49 +++++ .../form/AuthorizerAccessTokenFormDTO.java | 47 +++++ .../dto/form/ComponentAccessTokenFormDTO.java | 40 ++++ .../com/epmet/dto/form/FuncInfoFormDTO.java | 41 ++++ .../epmet/dto/form/PreAuthTokenFormDTO.java | 41 ++++ .../dto/result/WillOverDueResultDTO.java | 37 ++++ .../com/epmet/constant/ModuleConstant.java | 14 +- .../com/epmet/constant/ThirdApiConstant.java | 26 +++ .../epmet/constant/ThirdPlatformConstant.java | 20 -- .../epmet/constant/ThirdRedisKeyConstant.java | 45 +++++ .../controller/WeChatNotifyController.java | 41 ++-- .../main/java/com/epmet/dao/AuthCodeDao.java | 36 ++++ .../com/epmet/dao/AuthorizationInfoDao.java | 41 ++++ .../epmet/dao/AuthorizerRefreshTokenDao.java | 33 +++ .../epmet/dao/ComponentAccessTokenDao.java | 41 ++++ .../main/java/com/epmet/dao/FuncInfoDao.java | 39 ++++ .../com/epmet/dao/PaCustomerAgencyDao.java | 12 +- .../java/com/epmet/dao/PreAuthTokenDao.java | 41 ++++ .../dao/RefreshAuthorizerAccessTokenDao.java | 47 +++++ .../java/com/epmet/entity/AuthCodeEntity.java | 61 ++++++ .../epmet/entity/AuthorizationInfoEntity.java | 66 ++++++ .../entity/AuthorizerRefreshTokenEntity.java | 51 +++++ .../entity/ComponentAccessTokenEntity.java | 51 +++++ .../java/com/epmet/entity/FuncInfoEntity.java | 61 ++++++ .../com/epmet/entity/PreAuthTokenEntity.java | 51 +++++ .../RefreshAuthorizerAccessTokenEntity.java | 66 ++++++ .../main/java/com/epmet/redis/RedisThird.java | 68 ++++--- .../service/ComponentVerifyTicketService.java | 16 +- .../ComponentVerifyTicketServiceImpl.java | 190 ++++++++++++++---- .../src/main/resources/mapper/AuthCodeDao.xml | 36 ++++ .../resources/mapper/AuthorizationInfoDao.xml | 39 ++++ .../mapper/AuthorizerRefreshTokenDao.xml | 18 ++ .../mapper/ComponentAccessTokenDao.xml | 33 +++ .../src/main/resources/mapper/FuncInfoDao.xml | 38 ++++ .../resources/mapper/PaCustomerAgencyDao.xml | 11 + .../main/resources/mapper/PreAuthTokenDao.xml | 32 +++ .../RefreshAuthorizerAccessTokenDao.xml | 52 +++++ 45 files changed, 2143 insertions(+), 120 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthCodeDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizationInfoDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizerRefreshTokenDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentAccessTokenDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/FuncInfoDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PreAuthTokenDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/RefreshAuthorizerAccessTokenDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthCodeFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentAccessTokenFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/FuncInfoFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PreAuthTokenFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/WillOverDueResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdApiConstant.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthCodeDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizerRefreshTokenDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/FuncInfoDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PreAuthTokenDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/RefreshAuthorizerAccessTokenDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthCodeEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizationInfoEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizerRefreshTokenEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentAccessTokenEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/FuncInfoEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PreAuthTokenEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/RefreshAuthorizerAccessTokenEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthCodeDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizerRefreshTokenDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentAccessTokenDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/FuncInfoDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PreAuthTokenDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/RefreshAuthorizerAccessTokenDao.xml diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthCodeDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthCodeDTO.java new file mode 100644 index 0000000000..59dce8901d --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthCodeDTO.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 授权回调url反参表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class AuthCodeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 授权方APPID + */ + private String authAppid; + + /** + * 授权码 + */ + private String authCode; + + /** + * 有效期 10min + */ + private Integer expiresIn; + + /** + * + */ + private Integer delFlag; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String updatedBy; + + /** + * + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizationInfoDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizationInfoDTO.java new file mode 100644 index 0000000000..ebdc051c24 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizationInfoDTO.java @@ -0,0 +1,91 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 授权信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class AuthorizationInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 授权方 appid + */ + private String authorizerAppid; + + /** + * 接口调用令牌(在授权的公众号/小程序具备 API 权限时,才有此返回值) + */ + private String authorizerAccessToken; + + /** + * authorizer_access_token 的有效期(在授权的公众号/小程序具备API权限时,才有此返回值),单位:秒 + */ + private Integer expiresIn; + + /** + * 刷新令牌(在授权的公众号具备API权限时,才有此返回值),刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token。一旦丢失,只能让用户重新授权,才能再次拿到新的刷新令牌。用户重新授权后,之前的刷新令牌会失效 + */ + private String authorizerRefreshToken; + + /** + * + */ + private Integer delFlag; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String updatedBy; + + /** + * + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizerRefreshTokenDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizerRefreshTokenDTO.java new file mode 100644 index 0000000000..32b509fe6f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizerRefreshTokenDTO.java @@ -0,0 +1,76 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 授权方的刷新令牌表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class AuthorizerRefreshTokenDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 授权方的刷新令牌 + */ + private String authorizerRefreshToken; + + /** + * 授权方appid + */ + private String authorizerAppid; + + /** + * 删除标识 0-否,1-是 + */ + private String delFlag; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentAccessTokenDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentAccessTokenDTO.java new file mode 100644 index 0000000000..630898d5db --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentAccessTokenDTO.java @@ -0,0 +1,76 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 第三方平台调用凭证 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class ComponentAccessTokenDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 令牌 【第三方平台接口的调用凭据】 + */ + private String componentAccessToken; + + /** + * 令牌有效期 单位:s 最长 60*60*2 + */ + private Integer expiresIn; + + /** + * 删除状态 0:正常 1:删除 + */ + private Integer delFlag; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/FuncInfoDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/FuncInfoDTO.java new file mode 100644 index 0000000000..482e71f206 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/FuncInfoDTO.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 授权给开发者的权限集列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class FuncInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 权限类别 + */ + private String funcscopeCategory; + + /** + * 权限ID + */ + private String funcscopeId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 授权方APPID + */ + private String authorizationInfoAppid; + + /** + * + */ + private Integer delFlag; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String updatedBy; + + /** + * + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PreAuthTokenDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PreAuthTokenDTO.java new file mode 100644 index 0000000000..e0caf8be1c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PreAuthTokenDTO.java @@ -0,0 +1,76 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 预授权码历史记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class PreAuthTokenDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 预授权码 【第三方平台方实现授权托管的必备信息,每个预授权码有效期为 10 分钟。需要先获取令牌才能调用】 + */ + private String preAuthToken; + + /** + * 预授权码有效期 单位:s 最长 60*60*2 + */ + private Integer expiresIn; + + /** + * 删除状态 0:正常 1:删除 + */ + private Integer delFlag; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/RefreshAuthorizerAccessTokenDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/RefreshAuthorizerAccessTokenDTO.java new file mode 100644 index 0000000000..aed9b812f7 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/RefreshAuthorizerAccessTokenDTO.java @@ -0,0 +1,91 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 获取/刷新接口调用令牌记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class RefreshAuthorizerAccessTokenDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 授权方令牌 + */ + private String authorizerAccessToken; + + /** + * 有效期,单位:秒 + */ + private Integer expiresIn; + + /** + * 刷新令牌 + */ + private String authorizerRefreshToken; + + /** + * 授权方APPID + */ + private String authAppid; + + /** + * 客户ID + */ + private String customerId; + + /** + * + */ + private Integer delFlag; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String updatedBy; + + /** + * + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthCodeFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthCodeFormDTO.java new file mode 100644 index 0000000000..71e5d419fd --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthCodeFormDTO.java @@ -0,0 +1,50 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/8 17:53 + */ +@Data +public class AuthCodeFormDTO implements Serializable { + + private static final long serialVersionUID = -6163303184086480522L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 授权方AppId + */ + private String authAppId; + + /** + * 授权码 + */ + private String authCode; + + /** + * 有效期 10min + */ + private Integer expiresIn; + + /** + * 删除状态 0:正常 1:已删除 + */ + private Integer delFlag = 0; + + /** + * 创建者 + */ + private String createdBy = "APP_USER"; + + /** + * 更新者 + */ + private String updatedBy = "APP_USER"; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java new file mode 100644 index 0000000000..f1001e0b4b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java @@ -0,0 +1,49 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/9 10:30 + */ +@Data +public class AuthorizationInfoFormDTO implements Serializable { + + private static final long serialVersionUID = -1117036477221128930L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 授权方 appid + */ + private String authorizerAppid; + + /** + * 接口调用令牌(在授权的公众号/小程序具备 API 权限时,才有此返回值) + */ + private String authorizerAccessToken; + + /** + * authorizer_access_token 的有效期(在授权的公众号/小程序具备API权限时,才有此返回值),单位:秒 + */ + private Integer expiresIn; + + /** + * 刷新令牌(在授权的公众号具备API权限时,才有此返回值),刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token。一旦丢失,只能让用户重新授权,才能再次拿到新的刷新令牌。用户重新授权后,之前的刷新令牌会失效 + */ + private String authorizerRefreshToken; + + /** + * + */ + private Integer delFlag = 0; + + private String createdBy = "APP_USER"; + + private String updatedBy = "APP_USER"; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java new file mode 100644 index 0000000000..7d0fa419cf --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @CreateTime 2020/7/9 17:29 + */ +@Data +public class AuthorizerAccessTokenFormDTO implements Serializable { + + private static final long serialVersionUID = 268927093061495006L; + + /** + * 授权方令牌 + */ + private String authorizerAccessToken; + + /** + * 有效期,单位:秒 + */ + private Integer expiresIn; + + /** + * 刷新令牌 + */ + private String authorizerRefreshToken; + + /** + * 授权方APPID + */ + private String authAppid; + + /** + * 客户ID + */ + private String customerId; + + private Integer delFlag = 0; + + private String createdBy = "APP_USER"; + + private String updatedBy = "APP_USER"; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentAccessTokenFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentAccessTokenFormDTO.java new file mode 100644 index 0000000000..61e2f5063e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentAccessTokenFormDTO.java @@ -0,0 +1,40 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/9 8:54 + */ +@Data +public class ComponentAccessTokenFormDTO implements Serializable { + + private static final long serialVersionUID = -2860559047843944065L; + + /** + * 令牌 【第三方平台接口的调用凭据】 + */ + private String componentAccessToken; + + /** + * 令牌有效期 单位:s 最长 60*60*2 + */ + private Integer expiresIn; + + /** + * 删除状态 0:正常 1:删除 + */ + private Integer delFlag = 0; + + /** + * 创建人 + */ + private String createdBy = "APP_USER"; + + /** + * 更新人 + */ + private String updatedBy = "APP_USER"; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/FuncInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/FuncInfoFormDTO.java new file mode 100644 index 0000000000..e8b0c182bb --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/FuncInfoFormDTO.java @@ -0,0 +1,41 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/9 10:43 + */ +@Data +public class FuncInfoFormDTO implements Serializable { + + private static final long serialVersionUID = 5468844633023377254L; + + /** + * 权限类别 + */ + private String funcscopeCategory; + + /** + * 权限ID + */ + private String funcscopeId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 授权方APPID + */ + private String authorizationInfoAppid; + + private Integer delFlag = 0; + + private String createdBy = "APP_USER"; + + private String updatedBy = "APP_USER"; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PreAuthTokenFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PreAuthTokenFormDTO.java new file mode 100644 index 0000000000..0f07ee3528 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PreAuthTokenFormDTO.java @@ -0,0 +1,41 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/9 9:15 + */ +@Data +public class PreAuthTokenFormDTO implements Serializable { + + private static final long serialVersionUID = 2970040842154724385L; + + /** + * 预授权码 【第三方平台方实现授权托管的必备信息,每个预授权码有效期为 10 分钟。需要先获取令牌才能调用】 + */ + private String preAuthToken; + + /** + * 预授权码有效期 单位:s 最长 60*60*2 + */ + private Integer expiresIn; + + /** + * 删除状态 0:正常 1:删除 + */ + private Integer delFlag = 0; + + /** + * 创建人 + */ + private String createdBy = "APP_USER"; + + /** + * 更新人 + */ + private String updatedBy = "APP_USER"; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/WillOverDueResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/WillOverDueResultDTO.java new file mode 100644 index 0000000000..b89826abda --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/WillOverDueResultDTO.java @@ -0,0 +1,37 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/9 17:01 + */ +@Data +public class WillOverDueResultDTO implements Serializable { + + private static final long serialVersionUID = -9073227815312384742L; + + /** + * 授权方令牌 + */ + private String authorizerAccessToken; + + /** + * 刷新令牌 + */ + private String authorizerRefreshToken; + + /** + * 授权方AppId + */ + private String authAppId; + + /** + * 客户Id + */ + private String customerId; + + +} 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 6b8df00640..bbda7a670b 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 @@ -24,6 +24,8 @@ public interface ModuleConstant { */ String COMPONENT_ACCESS_TOKEN = "component_access_token"; + String FUNC_INFO = "func_info"; + /** * 有效期 */ @@ -39,6 +41,8 @@ public interface ModuleConstant { String AUTHORIZER_REFRESH_TOKEN = "authorizer_refresh_token"; + String AUTHORIZER_ACCESS_TOKEN = "authorizer_access_token"; + String AUTH_TICKET = "====================授权票据【ComponentVerifyTicket】:【%s】===================="; String ERROR_TICKET = "微信开放平台,第三方平台获取【验证票据】失败"; @@ -57,17 +61,7 @@ public interface ModuleConstant { String FAILURE_ACCESS_TOKEN = "微信开放平台,第三方平台获取【令牌】失败"; - String TICKET_REDIS_KEY = "epmet:wechartthird:componentverifyticket"; - - String PRE_AUTH_CODE_REDIS_KEY = "epmet:wechartthird:preauthcode"; - - String ACCESS_TOKEN_REDIS_KEY = "epmet:wechartthird:preauthcode"; - - String AUTHORIZER_REFRESH_TOKEN_REDIS_KEY = "epmet:wechartthird:authorizerrefreshtoken"; - - String AUTHORIZATION_CODE_REDIS_KEY = "epmet:wechartthird:authorizationcode"; - String AUTH_INFO_REDIS_KEY = "epmet:wechartthird:authinfo"; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdApiConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdApiConstant.java new file mode 100644 index 0000000000..96c69002f3 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdApiConstant.java @@ -0,0 +1,26 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @CreateTime 2020/7/8 17:59 + */ +public interface ThirdApiConstant { + + /** + * + */ + String API_CREATE_PREAUTHCODE_URL = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode"; + + /** + * 使用授权码获取授权信息请求地址 + */ + String API_QUERY_AUTH_URL = "https://api.weixin.qq.com/cgi-bin/component/api_query_auth"; + + /** + * 获取令牌请求地址 + */ + String API_COMPONENT_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/component/api_component_token"; + + String API_AUTHORIZER_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/component/api_authorizer_token"; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java index 618d62010f..09f8af7681 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java @@ -26,24 +26,4 @@ public interface ThirdPlatformConstant { */ String PLATFORM_COMPONENT_TOKEN = "****************"; - /** - * - */ - String API_CREATE_PREAUTHCODE_URl = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=COMPONENT_ACCESS_TOKEN"; - - /** - * - */ - String API_CREATE_PREAUTHCODE_URL = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=COMPONENT_ACCESS_TOKEN"; - - /** - * 使用授权码获取授权信息请求地址 - */ - String API_QUERY_AUTH_URL = "https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token=COMPONENT_ACCESS_TOKEN"; - - /** - * 获取令牌请求地址 - */ - String API_COMPONENT_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/component/api_component_token"; - } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java new file mode 100644 index 0000000000..c4aab903d5 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java @@ -0,0 +1,45 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @CreateTime 2020/7/8 18:16 + */ +public interface ThirdRedisKeyConstant { + + /** + * : + */ + String COLON = ":"; + + /** + * component_verify_ticket 【令牌】目录 + */ + String TICKET_REDIS_KEY = "epmet:wechartthird:componentverifyticket"; + + /** + * pre_auth_code 预授权码 + */ + String PRE_AUTH_CODE_REDIS_KEY = "epmet:wechartthird:preauthcode"; + + /** + * component_access_token + */ + String ACCESS_TOKEN_REDIS_KEY = "epmet:wechartthird:componentaccesstoken"; + + /** + * authorizer_refresh_token 刷新令牌,获取授权信息时得到 + */ + String AUTHORIZER_REFRESH_TOKEN_REDIS_KEY = "epmet:wechartthird:authorizerrefreshtoken"; + + /** + * auth_code 授权码 + */ + String AUTH_CODE_REDIS_KEY = "epmet:wechartthird:authcode"; + + /** + * authorization_info 授权信息 + */ + String AUTH_INFO_REDIS_KEY = "epmet:wechartthird:authinfo"; + + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java index 721794c247..f9e98d5114 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java @@ -1,13 +1,13 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.service.ComponentVerifyTicketService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** @@ -46,33 +46,38 @@ public class WeChatNotifyController { /** * @Description 使用授权码获取授权信息 - * @param response - * @param authCode - * @param expiresIn * @author zxc */ - @PostMapping(value = "/authinfobyauthcode") - public Result authInfoByAuthCode(HttpServletResponse response, - @RequestParam("auth_code") String authCode, - @RequestParam("expires_in") String expiresIn) { - componentVerifyTicketService.authInfoByAuthCode(response,authCode,expiresIn); + /*@PostMapping(value = "/authinfobyauthcode") + public Result authInfoByAuthCode() { + componentVerifyTicketService.authInfoByAuthCode(); return new Result(); - } + }*/ /** * @Description 获取/刷新接口调用令牌 - * @param authorizerAppId 授权方AppId * @author zxc */ @PostMapping("refreshtoken") - public Result refreshToken(@RequestParam("authorizer_appid") String authorizerAppId){ - componentVerifyTicketService.refreshToken(authorizerAppId); + public Result refreshToken(){ + componentVerifyTicketService.refreshToken(); return new Result(); } + /** + * @Description 授权回调URL + * @param + * @author zxc + */ @PostMapping("redirecturi") - public Result redirectUri(){ - componentVerifyTicketService.redirectUri(); + public Result redirectUri(HttpServletRequest request, HttpServletResponse response, @LoginUser TokenDto tokenDto, @PathVariable String authAppId){ + componentVerifyTicketService.redirectUri(request,response,tokenDto,authAppId); + return new Result(); + } + + @PostMapping("merge") + public Result merge(){ + return new Result(); } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthCodeDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthCodeDao.java new file mode 100644 index 0000000000..9ff232bbb4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthCodeDao.java @@ -0,0 +1,36 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.AuthCodeFormDTO; +import com.epmet.entity.AuthCodeEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 授权回调url反参表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-08 + */ +@Mapper +public interface AuthCodeDao extends BaseDao { + + void insertRedirectAuthCode(AuthCodeFormDTO formDTO); + +} \ No newline at end of file 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 new file mode 100644 index 0000000000..908d924afb --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.AuthorizationInfoFormDTO; +import com.epmet.entity.AuthorizationInfoEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 授权信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-08 + */ +@Mapper +public interface AuthorizationInfoDao extends BaseDao { + + /** + * @Description 插入 授权信息 + * @param formDTO + * @author zxc + */ + void insertAuthorizationInfo(AuthorizationInfoFormDTO formDTO); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizerRefreshTokenDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizerRefreshTokenDao.java new file mode 100644 index 0000000000..087e781c1a --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizerRefreshTokenDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.AuthorizerRefreshTokenEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 授权方的刷新令牌表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-08 + */ +@Mapper +public interface AuthorizerRefreshTokenDao extends BaseDao { + +} \ 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 new file mode 100644 index 0000000000..12666b9f01 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.ComponentAccessTokenFormDTO; +import com.epmet.entity.ComponentAccessTokenEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 第三方平台调用凭证 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-08 + */ +@Mapper +public interface ComponentAccessTokenDao extends BaseDao { + + /** + * @Description 插入component_access_token信息 + * @param formDTO + * @author zxc + */ + void insertComponentAccessToken(ComponentAccessTokenFormDTO formDTO); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/FuncInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/FuncInfoDao.java new file mode 100644 index 0000000000..fb54341e90 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/FuncInfoDao.java @@ -0,0 +1,39 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.FuncInfoFormDTO; +import com.epmet.entity.FuncInfoEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 授权给开发者的权限集列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-08 + */ +@Mapper +public interface FuncInfoDao extends BaseDao { + + void insertFuncInfo(@Param("funcInfoList") List funcInfoList); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java index cec7dcc514..179a27459d 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java @@ -20,14 +20,22 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.PaCustomerAgencyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 客户根组织信息 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-08 */ @Mapper public interface PaCustomerAgencyDao extends BaseDao { - + + /** + * @Description 根据userId查询客户Id + * @param userId + * @author zxc + */ + String getCustomerIdByUserId(@Param("userId")String userId); + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PreAuthTokenDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PreAuthTokenDao.java new file mode 100644 index 0000000000..36e0dce88b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PreAuthTokenDao.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.PreAuthTokenFormDTO; +import com.epmet.entity.PreAuthTokenEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 预授权码历史记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-08 + */ +@Mapper +public interface PreAuthTokenDao extends BaseDao { + + /** + * @Description 插入 预授权码 + * @param formDTO + * @author zxc + */ + void insertPreAuthToken(PreAuthTokenFormDTO formDTO); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/RefreshAuthorizerAccessTokenDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/RefreshAuthorizerAccessTokenDao.java new file mode 100644 index 0000000000..c6293fbd37 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/RefreshAuthorizerAccessTokenDao.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.AuthorizerAccessTokenFormDTO; +import com.epmet.dto.result.WillOverDueResultDTO; +import com.epmet.entity.RefreshAuthorizerAccessTokenEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 获取/刷新接口调用令牌记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-08 + */ +@Mapper +public interface RefreshAuthorizerAccessTokenDao extends BaseDao { + + /** + * @Description 查询即将过期的 authorizer_access_token + * @param + * @author zxc + */ + List checkWillOverDue(); + + void insertAuthorizerAccessToken(AuthorizerAccessTokenFormDTO refreshAccessToken); + + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthCodeEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthCodeEntity.java new file mode 100644 index 0000000000..fd9d829d2c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthCodeEntity.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 授权回调url反参表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("auth_code") +public class AuthCodeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 授权方APPID + */ + private String authAppid; + + /** + * 授权码 + */ + private String authCode; + + /** + * 有效期 10min + */ + private Integer expiresIn; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizationInfoEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizationInfoEntity.java new file mode 100644 index 0000000000..f774abb2cf --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizationInfoEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 授权信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("authorization_info") +public class AuthorizationInfoEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 授权方 appid + */ + private String authorizerAppid; + + /** + * 接口调用令牌(在授权的公众号/小程序具备 API 权限时,才有此返回值) + */ + private String authorizerAccessToken; + + /** + * authorizer_access_token 的有效期(在授权的公众号/小程序具备API权限时,才有此返回值),单位:秒 + */ + private Integer expiresIn; + + /** + * 刷新令牌(在授权的公众号具备API权限时,才有此返回值),刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token。一旦丢失,只能让用户重新授权,才能再次拿到新的刷新令牌。用户重新授权后,之前的刷新令牌会失效 + */ + private String authorizerRefreshToken; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizerRefreshTokenEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizerRefreshTokenEntity.java new file mode 100644 index 0000000000..1f6d7127d4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizerRefreshTokenEntity.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 授权方的刷新令牌表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("authorizer_refresh_token") +public class AuthorizerRefreshTokenEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 授权方的刷新令牌 + */ + private String authorizerRefreshToken; + + /** + * 授权方appid + */ + private String authorizerAppid; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentAccessTokenEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentAccessTokenEntity.java new file mode 100644 index 0000000000..47ed337383 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentAccessTokenEntity.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 第三方平台调用凭证 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("component_access_token") +public class ComponentAccessTokenEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 令牌 【第三方平台接口的调用凭据】 + */ + private String componentAccessToken; + + /** + * 令牌有效期 单位:s 最长 60*60*2 + */ + private Integer expiresIn; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/FuncInfoEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/FuncInfoEntity.java new file mode 100644 index 0000000000..fd32f8067f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/FuncInfoEntity.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 授权给开发者的权限集列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("func_info") +public class FuncInfoEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 权限类别 + */ + private String funcscopeCategory; + + /** + * 权限ID + */ + private String funcscopeId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 授权方APPID + */ + private String authorizationInfoAppid; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PreAuthTokenEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PreAuthTokenEntity.java new file mode 100644 index 0000000000..9ccb82efe1 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PreAuthTokenEntity.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 预授权码历史记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pre_auth_token") +public class PreAuthTokenEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 预授权码 【第三方平台方实现授权托管的必备信息,每个预授权码有效期为 10 分钟。需要先获取令牌才能调用】 + */ + private String preAuthToken; + + /** + * 预授权码有效期 单位:s 最长 60*60*2 + */ + private Integer expiresIn; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/RefreshAuthorizerAccessTokenEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/RefreshAuthorizerAccessTokenEntity.java new file mode 100644 index 0000000000..0a5c9ddfe2 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/RefreshAuthorizerAccessTokenEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 获取/刷新接口调用令牌记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("refresh_authorizer_access_token") +public class RefreshAuthorizerAccessTokenEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 授权方令牌 + */ + private String authorizerAccessToken; + + /** + * 有效期,单位:秒 + */ + private Integer expiresIn; + + /** + * 刷新令牌 + */ + private String authorizerRefreshToken; + + /** + * 授权方APPID + */ + private String authAppid; + + /** + * 客户ID + */ + private String customerId; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java index 3deac90425..07324228de 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java @@ -2,6 +2,9 @@ package com.epmet.redis; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.constant.ModuleConstant; +import com.epmet.constant.ThirdRedisKeyConstant; +import com.epmet.dto.form.AuthCodeFormDTO; +import com.epmet.dto.form.AuthorizerAccessTokenFormDTO; import com.epmet.dto.result.AuthorizationInfoResultDTO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -24,60 +27,62 @@ public class RedisThird { private RedisUtils redisUtils; /** - * @Description 缓存 component_access_token 有效期:1小时59分钟 (官网有效期:2H) - * @param accessToken + * @Description 缓存 component_verify_ticket 有效期:9min (官方有效期 10分钟) + * @param verifyTicket * @author zxc */ - public void setComponentAccessToken (String accessToken){ - redisTemplate.opsForValue().set(ModuleConstant.ACCESS_TOKEN_REDIS_KEY+ModuleConstant.COMPONENT_ACCESS_TOKEN, accessToken, 60 * 60 * 2 - 60, TimeUnit.SECONDS); + public void setComponentVerifyTicket(String verifyTicket){ + redisUtils.set(ThirdRedisKeyConstant.TICKET_REDIS_KEY,verifyTicket,-1); } /** - * @Description 获取 component_access_token + * @Description 获取 component_verify_ticket * @param key * @author zxc */ - public String getComponentAccessToken(String key){ - return redisTemplate.opsForValue().get(ModuleConstant.ACCESS_TOKEN_REDIS_KEY+key).toString(); + public String getComponentVerifyTicket(String key){ + return redisTemplate.opsForValue().get(ThirdRedisKeyConstant.TICKET_REDIS_KEY).toString(); } /** - * @Description 获取 component_verify_ticket - * @param key + * @Description 缓存 component_access_token 有效期:1小时59分钟 (官网有效期:2H) + * @param accessToken * @author zxc */ - public String getComponentVerifyTicket(String key){ - return redisTemplate.opsForValue().get(ModuleConstant.TICKET_REDIS_KEY+ModuleConstant.TICKET_REDIS_KEY+key).toString(); + public void setComponentAccessToken (String accessToken){ + String key = ThirdRedisKeyConstant.ACCESS_TOKEN_REDIS_KEY; + redisUtils.set(key,accessToken,-1); } /** - * @Description 缓存 component_verify_ticket 有效期:9min (官方有效期 10分钟) - * @param verifyTicket + * @Description 获取 component_access_token + * @param key * @author zxc */ - public void setComponentVerifyTicket(String verifyTicket){ - redisTemplate.opsForValue().set(ModuleConstant.TICKET_REDIS_KEY+ModuleConstant.TICKET_UNDERLINE_KEY, verifyTicket, 60 * 9, TimeUnit.SECONDS); + public String getComponentAccessToken(String key){ + return redisTemplate.opsForValue().get(ThirdRedisKeyConstant.ACCESS_TOKEN_REDIS_KEY+key).toString(); } /** - * @Description 缓存 pre_auth_code 有效期:9min (官方有效期 10分钟) + * @Description 缓存 pre_auth_code 有效期: (官方有效期 10分钟) * @param authCode pre_auth_code 预授权码 * @param expiresIn expires_in 有效期 * @author zxc */ public void setPreAuthCode(String authCode,Integer expiresIn){ - redisTemplate.opsForValue().set(ModuleConstant.PRE_AUTH_CODE_REDIS_KEY+ModuleConstant.PRE_AUTH_CODE, authCode,expiresIn, TimeUnit.SECONDS); + redisUtils.set(ThirdRedisKeyConstant.PRE_AUTH_CODE_REDIS_KEY+ModuleConstant.PRE_AUTH_CODE,authCode,-1); } /** * @Description 缓存 刷新令牌 * (在授权的公众号具备API权限时,才有此返回值),刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token。 * 一旦丢失,只能让用户重新授权,才能再次拿到新的刷新令牌。用户重新授权后,之前的刷新令牌会失效 - * @param authorizerRefreshToken + * @param refreshAccessToken * @author zxc */ - public void setAuthorizerRefreshToken(String authorizerRefreshToken){ - redisTemplate.opsForValue().set(ModuleConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY+authorizerRefreshToken,authorizerRefreshToken); + public void setAuthorizerRefreshToken(AuthorizerAccessTokenFormDTO refreshAccessToken){ + String key = ThirdRedisKeyConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY + ThirdRedisKeyConstant.COLON + refreshAccessToken.getCustomerId()+ThirdRedisKeyConstant.COLON+refreshAccessToken.getAuthAppid(); + redisUtils.set(key,refreshAccessToken,-1); } /** @@ -86,7 +91,17 @@ public class RedisThird { * @author zxc */ public String getAuthorizerRefreshToken(String key){ - return redisTemplate.opsForValue().get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY+key).toString(); + return redisTemplate.opsForValue().get(ThirdRedisKeyConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY+key).toString(); + } + + /** + * @Description 缓存授权码 auth_Code + * @param + * @author zxc + */ + public void setAuthCode(AuthCodeFormDTO formDTO){ + String key = ThirdRedisKeyConstant.AUTH_CODE_REDIS_KEY+ThirdRedisKeyConstant.COLON+formDTO.getCustomerId(); + redisUtils.set(key,formDTO,-1); } /** @@ -95,12 +110,17 @@ public class RedisThird { * @param key * @author zxc */ - public String getAuthorizationCode(String key){ - return redisTemplate.opsForValue().get(ModuleConstant.AUTHORIZATION_CODE_REDIS_KEY+key).toString(); + public String getAuthCode(String key){ + return redisTemplate.opsForValue().get(ThirdRedisKeyConstant.AUTH_CODE_REDIS_KEY+key).toString(); } + /** + * @Description 缓存授权信息 + * @param authInfo + * @author zxc + */ public void setAuthInfo(AuthorizationInfoResultDTO authInfo){ - redisUtils.set(ModuleConstant.AUTH_INFO_REDIS_KEY,authInfo,-1); + redisUtils.set(ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY,authInfo,-1); } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java index 6178dd929d..d12d7cce9a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java @@ -1,5 +1,7 @@ package com.epmet.service; +import com.epmet.commons.tools.security.dto.TokenDto; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -31,20 +33,22 @@ public interface ComponentVerifyTicketService { /** * @Description 使用授权码获取授权信息 - * @param response - * @param authCode - * @param expiresIn * @author zxc */ - void authInfoByAuthCode(HttpServletResponse response,String authCode,String expiresIn); +// void authInfoByAuthCode(); /** * @Description 获取/刷新接口调用令牌 * @param * @author zxc */ - void refreshToken(String authorizerAppId); + void refreshToken(); - void redirectUri(); + /** + * @Description 授权回调URL + * @param + * @author zxc + */ + void redirectUri(HttpServletRequest request, HttpServletResponse response, TokenDto tokenDto,String authAppId); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 604ccd06f5..c223823929 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -4,19 +4,25 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.nacos.client.config.utils.IOUtils; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.constant.ModuleConstant; -import com.epmet.dao.ComponentVerifyTicketDao; -import com.epmet.dto.form.ComponentVerifyTicketFormDTO; +import com.epmet.constant.ThirdApiConstant; +import com.epmet.dao.*; +import com.epmet.dto.form.*; import com.epmet.dto.result.AuthorizationInfoResultDTO; +import com.epmet.dto.result.WillOverDueResultDTO; import com.epmet.redis.RedisThird; import com.epmet.service.ComponentVerifyTicketService; import com.epmet.util.WXBizMsgCrypt; import com.epmet.util.WXXmlToMapUtil; import com.epmet.util.XmlUtil; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.github.pagehelper.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -24,9 +30,9 @@ import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.InputStream; +import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; +import java.util.*; import static com.epmet.constant.ThirdPlatformConstant.*; @@ -42,6 +48,20 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe private RedisThird redisThird; @Autowired private ComponentVerifyTicketDao ticketDao; + @Autowired + private AuthCodeDao authCodeDao; + @Autowired + private ComponentAccessTokenDao componentAccessTokenDao; + @Autowired + private PreAuthTokenDao preAuthTokenDao; + @Autowired + private AuthorizationInfoDao authorizationInfoDao; + @Autowired + private FuncInfoDao funcInfoDao; + @Autowired + private PaCustomerAgencyDao paCustomerAgencyDao; + @Autowired + private RefreshAuthorizerAccessTokenDao refreshAuthorizerAccessTokenDao; /** * @Description 获得授权事件的票据 @@ -115,6 +135,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe * @param * @author zxc */ + @Transactional(rollbackFor = Exception.class) @Override public void getComponentAccessToken() { log.info("====================开始执行定时任务获取令牌【component_access_token】===================="); @@ -126,13 +147,20 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); jsonObject.put(ModuleConstant.COMPONENT_APPSECRET, PLATFORM_APP_SECRET); jsonObject.put(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket); - String post = HttpClientManager.getInstance().sendPostByJSON(API_CREATE_PREAUTHCODE_URL, JSON.toJSONString(jsonObject)).getData(); + String post = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_COMPONENT_TOKEN_URL, JSON.toJSONString(jsonObject)).getData(); HashMap hashMap = JSON.parseObject(post, HashMap.class); String componentAccessToken = hashMap.get(ModuleConstant.COMPONENT_ACCESS_TOKEN); + String expiresIn = hashMap.get(ModuleConstant.EXPIRES_IN); if (StringUtils.isNotEmpty(componentAccessToken)) { + //令牌信息存DB + ComponentAccessTokenFormDTO formDTO = new ComponentAccessTokenFormDTO(); + formDTO.setComponentAccessToken(componentAccessToken); + formDTO.setExpiresIn(Integer.valueOf(expiresIn)); + componentAccessTokenDao.insertComponentAccessToken(formDTO); + //存缓存 redisThird.setComponentAccessToken(componentAccessToken); } else { - throw new RuntimeException(ModuleConstant.FAILURE_ACCESS_TOKEN); + throw new RenException(ModuleConstant.FAILURE_ACCESS_TOKEN); } } catch (Exception e) { e.printStackTrace(); @@ -141,10 +169,11 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe } /** - * @Description 定时获取预授权码 + * @Description 获取预授权码 * @param * @author zxc */ + @Transactional(rollbackFor = Exception.class) @Override public void preAuthCode() { log.info("====================开始执行定时任务获取预授权码【pre_auth_code】===================="); @@ -152,14 +181,20 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN); JSONObject jsonObject = new JSONObject(); jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); - String post = HttpClientManager.getInstance().sendPostByJSON(API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); + String post = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); log.info("====================返回post结果:" + post); HashMap hashMap = JSON.parseObject(post, HashMap.class); - String authCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE); + String preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE); String expiresIn = hashMap.get(ModuleConstant.EXPIRES_IN); int ex = Integer.valueOf(expiresIn) - NumConstant.SIXTY; - if (StringUtils.isNotEmpty(authCode)) { - redisThird.setPreAuthCode(authCode,ex); + if (StringUtils.isNotEmpty(preAuthCode)) { + //预授权码 存DB + PreAuthTokenFormDTO formDTO = new PreAuthTokenFormDTO(); + formDTO.setPreAuthToken(preAuthCode); + formDTO.setExpiresIn(ex); + preAuthTokenDao.insertPreAuthToken(formDTO); + //预授权码 放入缓存 + redisThird.setPreAuthCode(preAuthCode,ex); } else { throw new RuntimeException("微信开放平台,第三方平台获取【预授权码】失败"); } @@ -170,35 +205,60 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe } /** - * @Description 使用授权码获取授权信息 - * @param response - * @param authCode - * @param expiresIn + * @Description 使用授权码获取授权信息 请求参数:【component_access_token、component_appid、authorization_code】 * @author zxc */ - @Override - public void authInfoByAuthCode(HttpServletResponse response, String authCode, String expiresIn) { + @Transactional(rollbackFor = Exception.class) + public AuthorizationInfoResultDTO authInfoByAuthCode(String authCode,String authAppId,String customerId) { + AuthorizationInfoResultDTO authorizationInfoResultDTO = new AuthorizationInfoResultDTO(); // 获取令牌【component_access_token】 String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN); // 使用授权码获取授权信息 JSONObject jsonObject = new JSONObject(); jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); jsonObject.put(ModuleConstant.AUTHORIZATION_CODE, authCode); - String authInfo; - try { - authInfo = HttpClientManager.getInstance().sendPostByJSON(API_QUERY_AUTH_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); - HashMap hashMap = JSON.parseObject(authInfo, HashMap.class); - Map map = hashMap.get(ModuleConstant.AUTHORIZATION_INFO); - AuthorizationInfoResultDTO authorizationInfoResultDTO = mapToEntity(map, AuthorizationInfoResultDTO.class); - redisThird.setAuthInfo(authorizationInfoResultDTO); - String authorizerRefreshToken = map.get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN).toString(); - redisThird.setAuthorizerRefreshToken(authorizerRefreshToken); - } catch (Exception e) { - e.printStackTrace(); + String authInfo = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_QUERY_AUTH_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); + HashMap hashMap = JSON.parseObject(authInfo, HashMap.class); + Map map = hashMap.get(ModuleConstant.AUTHORIZATION_INFO); + authorizationInfoResultDTO = mapToEntity(map, AuthorizationInfoResultDTO.class); + //授权信息分为两张表,基础信息authorization_info,授权列表func_info + // 1. 基础信息 + AuthorizationInfoFormDTO authInfoDTO = new AuthorizationInfoFormDTO(); + authInfoDTO.setAuthorizerAppid(authorizationInfoResultDTO.getAuthorizer_appid()); + authInfoDTO.setAuthorizerAccessToken(authorizationInfoResultDTO.getAuthorizer_access_token()); + authInfoDTO.setAuthorizerRefreshToken(authorizationInfoResultDTO.getAuthorizer_refresh_token()); + authInfoDTO.setExpiresIn(Integer.valueOf(authorizationInfoResultDTO.getExpires_in())); + authInfoDTO.setCustomerId(customerId); + authorizationInfoDao.insertAuthorizationInfo(authInfoDTO); + // 获取/刷新接口调用令牌记录表 插入 + AuthorizerAccessTokenFormDTO refreshAccessToken = new AuthorizerAccessTokenFormDTO(); + refreshAccessToken.setAuthAppid(authAppId); + refreshAccessToken.setCustomerId(customerId); + refreshAccessToken.setAuthorizerAccessToken(authorizationInfoResultDTO.getAuthorizer_access_token()); + refreshAccessToken.setAuthorizerRefreshToken(authorizationInfoResultDTO.getAuthorizer_refresh_token()); + refreshAccessToken.setExpiresIn(Integer.valueOf(authorizationInfoResultDTO.getExpires_in())); + refreshAuthorizerAccessTokenDao.insertAuthorizerAccessToken(refreshAccessToken); + // 2. 权限列表 + List funcInfos = new ArrayList<>(); + List func_info = authorizationInfoResultDTO.getFunc_info(); + for (Map map1 : func_info) { + List key = (List)map1.keySet(); + FuncInfoFormDTO fu = new FuncInfoFormDTO(); + String funcscopeCategory = key.get(NumConstant.ZERO).toString(); + fu.setFuncscopeCategory(funcscopeCategory); + Map funcscope = (Map) map1.get(funcscopeCategory); + String funcscopeId = funcscope.get("id").toString(); + fu.setFuncscopeId(funcscopeId); + fu.setAuthorizationInfoAppid(authorizationInfoResultDTO.getAuthorizer_appid()); + fu.setCustomerId(customerId); + funcInfos.add(fu); } - - // 重定向地址 -// response.sendRedirect("/wechat/authcode"); + funcInfoDao.insertFuncInfo(funcInfos); + // 授权信息放入缓存 + redisThird.setAuthInfo(authorizationInfoResultDTO); + //authorizer_refresh_token 放入缓存 + redisThird.setAuthorizerRefreshToken(refreshAccessToken); + return authorizationInfoResultDTO; } /** @@ -206,19 +266,69 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe * @param * @author zxc */ + @Transactional(rollbackFor = Exception.class) @Override - public void refreshToken(String authorizerAppId) { - JSONObject jsonObject = new JSONObject(); - //todo 授权方appid从哪来,每个用户的刷新token - //授权方AppId -// jsonObject.put(ModuleConstant.AUTHORIZER_APPID,authorizerAppId); - //第三方平台AppId - jsonObject.put(ModuleConstant.COMPONENT_APPID,PLATFORM_APP_ID); - jsonObject.put("",redisThird.getAuthorizerRefreshToken("")); + public void refreshToken() { + List willOverDueResultDTOS = refreshAuthorizerAccessTokenDao.checkWillOverDue(); + if (willOverDueResultDTOS.size() != NumConstant.ZERO && null != willOverDueResultDTOS){ + willOverDueResultDTOS.forEach(willOverDueDTO -> { + JSONObject jsonObject = new JSONObject(); + //授权方AppId + jsonObject.put(ModuleConstant.AUTHORIZER_APPID,willOverDueDTO.getAuthAppId()); + //第三方平台AppId + jsonObject.put(ModuleConstant.COMPONENT_APPID,PLATFORM_APP_ID); + jsonObject.put(ModuleConstant.AUTHORIZER_REFRESH_TOKEN,willOverDueDTO.getAuthorizerRefreshToken()); + String data = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_AUTHORIZER_TOKEN_URL, JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, HashMap.class); + //authorizer_access_token + String authorizerAccessToken = map.get(ModuleConstant.AUTHORIZER_ACCESS_TOKEN).toString(); + String expiresIn = map.get(ModuleConstant.EXPIRES_IN).toString(); + String authorizerRefreshToken = map.get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN).toString(); + //更新DB + AuthorizerAccessTokenFormDTO formDTO = new AuthorizerAccessTokenFormDTO(); + formDTO.setAuthorizerAccessToken(authorizerAccessToken); + formDTO.setAuthorizerRefreshToken(authorizerRefreshToken); + formDTO.setExpiresIn(Integer.valueOf(expiresIn)); + formDTO.setCustomerId(willOverDueDTO.getCustomerId()); + formDTO.setAuthAppid(willOverDueDTO.getAuthAppId()); + refreshAuthorizerAccessTokenDao.insertAuthorizerAccessToken(formDTO); + + //缓存 refreshAuthorizerAccessToken + redisThird.setAuthorizerRefreshToken(formDTO); + }); + } + } + /** + * @Description 授权回调URL + * @param + * @author zxc + */ + @Transactional(rollbackFor = Exception.class) @Override - public void redirectUri() { + public void redirectUri(HttpServletRequest request, HttpServletResponse response, TokenDto tokenDto,String authAppId) { + String userId = tokenDto.getUserId(); + String customerId = paCustomerAgencyDao.getCustomerIdByUserId(userId); + try { + request.setCharacterEncoding("UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + response.setCharacterEncoding("UTF-8"); + String authCode = request.getParameter("auth_code"); + String expiresIn = request.getParameter("expires_in"); + //authCode存数据库 + AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); + formDTO.setAuthCode(authCode); + formDTO.setExpiresIn(Integer.valueOf(expiresIn)); + formDTO.setAuthAppId(authAppId); + formDTO.setCustomerId(customerId); + authCodeDao.insertRedirectAuthCode(formDTO); + //authCode存缓存 + redisThird.setAuthCode(formDTO); + // 获取授权信息 + AuthorizationInfoResultDTO authorizationInfoResultDTO = this.authInfoByAuthCode(authCode, authAppId, customerId); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthCodeDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthCodeDao.xml new file mode 100644 index 0000000000..5fcd3c0db1 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthCodeDao.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + INSERT INTO auth_code ( ID, CUSTOMER_ID, AUTH_APPID, AUTH_CODE, EXPIRES_IN, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + ( + REPLACE ( UUID(), '-', '' ), + #{customerId}, + #{authAppId}, + #{authCode}, + #{expiresIn}, + #{delFlag}, + #{createdBy}, + NOW(), + #{updatedBy}, + NOW() + ) + + + \ 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 new file mode 100644 index 0000000000..88c9cb5b5a --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + INSERT INTO authorization_info ( ID, CUSTOMER_ID, AUTHORIZER_APPID, AUTHORIZER_ACCESS_TOKEN, EXPIRES_IN, AUTHORIZER_REFRESH_TOKEN, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + ( + REPLACE ( UUID(), '-', '' ), + #{customerId}, + #{authorizerAppid}, + #{authorizerAccessToken}, + #{expiresIn}, + #{authorizerRefreshToken}, + #{delFlag}, + #{createdBy}, + NOW(), + #{updatedBy}, + NOW() + ) + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizerRefreshTokenDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizerRefreshTokenDao.xml new file mode 100644 index 0000000000..6cfa1d6b86 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizerRefreshTokenDao.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ 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 new file mode 100644 index 0000000000..bf76c092c8 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentAccessTokenDao.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + INSERT INTO component_access_token ( ID, COMPONENT_ACCESS_TOKEN, EXPIRES_IN, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + ( + REPLACE ( UUID(), '-', '' ), + #{componentAccessToken}, + #{expiresIn}, + #{delFlag}, + #{createdBy}, + NOW(), + #{updatedBy}, + NOW() + ) + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/FuncInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/FuncInfoDao.xml new file mode 100644 index 0000000000..332b2e672f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/FuncInfoDao.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + INSERT INTO func_info ( ID, FUNCSCOPE_CATEGORY, FUNCSCOPE_ID, CUSTOMER_ID, AUTHORIZATION_INFO_APPID, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + ( + REPLACE ( UUID(), '-', '' ), + #{func.funcscopeCategory}, + #{func.funcscopeId}, + #{func.customerId} + #{func.authorizationInfoAppid}, + #{func.delFlag}, + #{func.createdBy}, + NOW(), + #{func.updatedBy}, + NOW() + ) + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml index 5867f5a86c..420dfac6ad 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml @@ -3,5 +3,16 @@ + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PreAuthTokenDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PreAuthTokenDao.xml new file mode 100644 index 0000000000..e0eeb08e23 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PreAuthTokenDao.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + INSERT INTO pre_auth_token ( ID, PRE_AUTH_TOKEN, EXPIRES_IN, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + ( + REPLACE ( UUID(), '-', '' ), + #{preAuthToken}, + #{expiresIn}, + #{delFlag}, + #{createdBy}, + NOW(), + #{updatedBy}, + NOW() + ) + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/RefreshAuthorizerAccessTokenDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/RefreshAuthorizerAccessTokenDao.xml new file mode 100644 index 0000000000..9670ff2e90 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/RefreshAuthorizerAccessTokenDao.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO refresh_authorizer_access_token ( ID, AUTHORIZER_ACCESS_TOKEN, EXPIRES_IN, AUTHORIZER_REFRESH_TOKEN, AUTH_APPID, CUSTOMER_ID, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + ( + REPLACE ( UUID(), '-', '' ), + #{authorizerAccessToken}, + #{expiresIn}, + #{authorizerRefreshToken}, + #{authAppid}, + #{customerId}, + #{delFlag}, + #{createdBy}, + NOW(), + #{updatedBy}, + NOW() + ) + + + \ No newline at end of file From e2a8e343243dc10db83fbafaa336b8360b544b71 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 10 Jul 2020 09:22:01 +0800 Subject: [PATCH 34/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AuthRedirectController.java | 37 +++++++++++++++++++ .../controller/WeChatNotifyController.java | 31 ---------------- .../com/epmet/dao/AuthorizationInfoDao.java | 8 ++++ .../epmet/dao/ComponentAccessTokenDao.java | 2 + .../main/java/com/epmet/dao/FuncInfoDao.java | 12 ++++++ .../java/com/epmet/dao/PreAuthTokenDao.java | 7 ++++ .../dao/RefreshAuthorizerAccessTokenDao.java | 12 ++++++ .../service/ComponentVerifyTicketService.java | 6 --- .../ComponentVerifyTicketServiceImpl.java | 12 ++++++ .../resources/mapper/AuthorizationInfoDao.xml | 5 +++ .../mapper/ComponentAccessTokenDao.xml | 4 ++ .../src/main/resources/mapper/FuncInfoDao.xml | 6 +++ .../main/resources/mapper/PreAuthTokenDao.xml | 6 +++ .../RefreshAuthorizerAccessTokenDao.xml | 5 +++ 14 files changed, 116 insertions(+), 37 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java new file mode 100644 index 0000000000..cb38cf1014 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java @@ -0,0 +1,37 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.ComponentVerifyTicketService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @Author zxc + * @CreateTime 2020/7/10 9:04 + */ +@RestController +@RequestMapping("mpweb") +public class AuthRedirectController { + + @Autowired + private ComponentVerifyTicketService componentVerifyTicketService; + + /** + * @Description 授权回调URL + * @param + * @author zxc + */ + public Result redirectUri(HttpServletRequest request, HttpServletResponse response, @LoginUser TokenDto tokenDto, @RequestParam("authAppId")String authAppId){ + componentVerifyTicketService.redirectUri(request,response,tokenDto,authAppId); + return new Result(); + } + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java index f9e98d5114..a63583e38c 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java @@ -1,15 +1,10 @@ package com.epmet.controller; -import com.epmet.commons.tools.annotation.LoginUser; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.service.ComponentVerifyTicketService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - /** * @Author zxc * @CreateTime 2020/7/8 15:06 @@ -44,16 +39,6 @@ public class WeChatNotifyController { return new Result(); } - /** - * @Description 使用授权码获取授权信息 - * @author zxc - */ - /*@PostMapping(value = "/authinfobyauthcode") - public Result authInfoByAuthCode() { - componentVerifyTicketService.authInfoByAuthCode(); - return new Result(); - }*/ - /** * @Description 获取/刷新接口调用令牌 * @author zxc @@ -64,20 +49,4 @@ public class WeChatNotifyController { return new Result(); } - /** - * @Description 授权回调URL - * @param - * @author zxc - */ - @PostMapping("redirecturi") - public Result redirectUri(HttpServletRequest request, HttpServletResponse response, @LoginUser TokenDto tokenDto, @PathVariable String authAppId){ - componentVerifyTicketService.redirectUri(request,response,tokenDto,authAppId); - return new Result(); - } - - @PostMapping("merge") - public Result merge(){ - - 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 908d924afb..02539669af 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 @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.AuthorizationInfoFormDTO; import com.epmet.entity.AuthorizationInfoEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 授权信息表 @@ -37,5 +38,12 @@ public interface AuthorizationInfoDao extends BaseDao { * @author zxc */ void insertAuthorizationInfo(AuthorizationInfoFormDTO formDTO); + + /** + * @Description 逻辑删除授权信息 + * @param customerId + * @author zxc + */ + void updateOldAuthorizationInfo(@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 12666b9f01..4615c22728 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 @@ -37,5 +37,7 @@ public interface ComponentAccessTokenDao extends BaseDao { + /** + * @Description 插入授权列表信息 + * @param funcInfoList + * @author zxc + */ void insertFuncInfo(@Param("funcInfoList") List funcInfoList); + + /** + * @Description 逻辑删除 权限列表 + * @param customerId + * @author zxc + */ + void updateOldFuncInfo(@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/PreAuthTokenDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PreAuthTokenDao.java index 36e0dce88b..defe7f5bb0 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PreAuthTokenDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PreAuthTokenDao.java @@ -37,5 +37,12 @@ public interface PreAuthTokenDao extends BaseDao { * @author zxc */ void insertPreAuthToken(PreAuthTokenFormDTO formDTO); + + /** + * @Description 逻辑删 pre_auth_code + * @param + * @author zxc + */ + void updateOldPreAuthCode(); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/RefreshAuthorizerAccessTokenDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/RefreshAuthorizerAccessTokenDao.java index c6293fbd37..ecd62336d5 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/RefreshAuthorizerAccessTokenDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/RefreshAuthorizerAccessTokenDao.java @@ -22,6 +22,7 @@ import com.epmet.dto.form.AuthorizerAccessTokenFormDTO; import com.epmet.dto.result.WillOverDueResultDTO; import com.epmet.entity.RefreshAuthorizerAccessTokenEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -41,7 +42,18 @@ public interface RefreshAuthorizerAccessTokenDao extends BaseDao checkWillOverDue(); + /** + * @Description 插入 authorizer_access_token + * @param refreshAccessToken + * @author zxc + */ void insertAuthorizerAccessToken(AuthorizerAccessTokenFormDTO refreshAccessToken); + /** + * @Description 逻辑删除 授权方的authorizer_access_token + * @param customerId + * @author zxc + */ + void updateOldAuthorizerAccessToken(@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/service/ComponentVerifyTicketService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java index d12d7cce9a..a20ff2d1f4 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java @@ -31,12 +31,6 @@ public interface ComponentVerifyTicketService { */ void preAuthCode(); - /** - * @Description 使用授权码获取授权信息 - * @author zxc - */ -// void authInfoByAuthCode(); - /** * @Description 获取/刷新接口调用令牌 * @param diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index c223823929..f66db43c0e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -156,6 +156,8 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe ComponentAccessTokenFormDTO formDTO = new ComponentAccessTokenFormDTO(); formDTO.setComponentAccessToken(componentAccessToken); formDTO.setExpiresIn(Integer.valueOf(expiresIn)); + //先逻辑删,在插入 + componentAccessTokenDao.updateOldComponentAccessToken(); componentAccessTokenDao.insertComponentAccessToken(formDTO); //存缓存 redisThird.setComponentAccessToken(componentAccessToken); @@ -192,6 +194,8 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe PreAuthTokenFormDTO formDTO = new PreAuthTokenFormDTO(); formDTO.setPreAuthToken(preAuthCode); formDTO.setExpiresIn(ex); + //先逻辑删除,在插入DB + preAuthTokenDao.updateOldPreAuthCode(); preAuthTokenDao.insertPreAuthToken(formDTO); //预授权码 放入缓存 redisThird.setPreAuthCode(preAuthCode,ex); @@ -229,6 +233,8 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe authInfoDTO.setAuthorizerRefreshToken(authorizationInfoResultDTO.getAuthorizer_refresh_token()); authInfoDTO.setExpiresIn(Integer.valueOf(authorizationInfoResultDTO.getExpires_in())); authInfoDTO.setCustomerId(customerId); + //先逻辑删除,在插入 + authorizationInfoDao.updateOldAuthorizationInfo(customerId); authorizationInfoDao.insertAuthorizationInfo(authInfoDTO); // 获取/刷新接口调用令牌记录表 插入 AuthorizerAccessTokenFormDTO refreshAccessToken = new AuthorizerAccessTokenFormDTO(); @@ -237,6 +243,8 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe refreshAccessToken.setAuthorizerAccessToken(authorizationInfoResultDTO.getAuthorizer_access_token()); refreshAccessToken.setAuthorizerRefreshToken(authorizationInfoResultDTO.getAuthorizer_refresh_token()); refreshAccessToken.setExpiresIn(Integer.valueOf(authorizationInfoResultDTO.getExpires_in())); + //先逻辑删除,再插入 + refreshAuthorizerAccessTokenDao.updateOldAuthorizerAccessToken(customerId); refreshAuthorizerAccessTokenDao.insertAuthorizerAccessToken(refreshAccessToken); // 2. 权限列表 List funcInfos = new ArrayList<>(); @@ -253,6 +261,8 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe fu.setCustomerId(customerId); funcInfos.add(fu); } + //先逻辑删除,在插入 + funcInfoDao.updateOldFuncInfo(customerId); funcInfoDao.insertFuncInfo(funcInfos); // 授权信息放入缓存 redisThird.setAuthInfo(authorizationInfoResultDTO); @@ -291,6 +301,8 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe formDTO.setExpiresIn(Integer.valueOf(expiresIn)); formDTO.setCustomerId(willOverDueDTO.getCustomerId()); formDTO.setAuthAppid(willOverDueDTO.getAuthAppId()); + //先逻辑删除,在插入 + refreshAuthorizerAccessTokenDao.updateOldAuthorizerAccessToken(willOverDueDTO.getCustomerId()); refreshAuthorizerAccessTokenDao.insertAuthorizerAccessToken(formDTO); //缓存 refreshAuthorizerAccessToken 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 88c9cb5b5a..97929fa2d6 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 @@ -36,4 +36,9 @@ ) + + + update authorization_info set del_flag = 0 where customer_id = #{customerId} + + \ 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 bf76c092c8..7e294a150a 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 @@ -30,4 +30,8 @@ ) + + update component_access_token set del_flag = 1 + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/FuncInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/FuncInfoDao.xml index 332b2e672f..0982fcefd6 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/FuncInfoDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/FuncInfoDao.xml @@ -16,6 +16,7 @@ + INSERT INTO func_info ( ID, FUNCSCOPE_CATEGORY, FUNCSCOPE_ID, CUSTOMER_ID, AUTHORIZATION_INFO_APPID, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) @@ -35,4 +36,9 @@ + + + update func_info set del_flag = 0 where customer_id = #{customerId} + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PreAuthTokenDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PreAuthTokenDao.xml index e0eeb08e23..bac47ff2f3 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PreAuthTokenDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PreAuthTokenDao.xml @@ -14,6 +14,7 @@ + INSERT INTO pre_auth_token ( ID, PRE_AUTH_TOKEN, EXPIRES_IN, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) VALUES @@ -29,4 +30,9 @@ ) + + + update pre_auth_token set del_flag = 0 + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/RefreshAuthorizerAccessTokenDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/RefreshAuthorizerAccessTokenDao.xml index 9670ff2e90..fbc94fa431 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/RefreshAuthorizerAccessTokenDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/RefreshAuthorizerAccessTokenDao.xml @@ -49,4 +49,9 @@ ) + + + update refresh_authorizer_access_token set del_flag = 0 where customer_id = #{customerId} + + \ No newline at end of file From 713d3e408eed4e491d488cabbd188fc7a528cc1d Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 10 Jul 2020 09:58:53 +0800 Subject: [PATCH 35/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/constant/ModuleConstant.java | 57 +++++----------- .../constant/ThirdRunTimeInfoConstant.java | 49 ++++++++++++++ .../controller/AuthRedirectController.java | 1 - .../ComponentVerifyTicketServiceImpl.java | 66 ++++++++++--------- 4 files changed, 101 insertions(+), 72 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java 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 bbda7a670b..77bfbe8263 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 @@ -6,63 +6,40 @@ package com.epmet.constant; */ public interface ModuleConstant { - String TICKET_KEY = "ComponentVerifyTicket"; + String FUNC_INFO = "func_info"; + //获得授权事件的票据 如下 + String UTF8 = "UTF-8"; + String MSG_SIGNATURE = "msg_signature"; + String TIMESTAMP = "timestamp"; + String NONCE = "nonce"; + String INFO_TYPE = "InfoType"; String TICKET_UNDERLINE_KEY = "component_verify_ticket"; - + String TICKET_KEY = "ComponentVerifyTicket"; + String UNAUTHORIZED = "unauthorized"; + String NULL_CHAR = ""; String SUCCESS = "success"; - /** - * 第三方平台 AppId - */ + // 获取 component_access_token 如下 String COMPONENT_APPID = "component_appid"; - String COMPONENT_APPSECRET = "component_appsecret"; - - /** - * 第三方平台 access_token - */ String COMPONENT_ACCESS_TOKEN = "component_access_token"; - - String FUNC_INFO = "func_info"; - - /** - * 有效期 - */ String EXPIRES_IN = "expires_in"; + //获取预授权码 如下 String PRE_AUTH_CODE = "pre_auth_code"; + //使用授权码获取授权信息 如下 String AUTHORIZATION_CODE = "authorization_code"; - - String AUTHORIZER_APPID = "authorizer_appid"; - String AUTHORIZATION_INFO = "authorization_info"; + //获取/刷新接口调用令牌 如下 + String AUTHORIZER_APPID = "authorizer_appid"; String AUTHORIZER_REFRESH_TOKEN = "authorizer_refresh_token"; - String AUTHORIZER_ACCESS_TOKEN = "authorizer_access_token"; - String AUTH_TICKET = "====================授权票据【ComponentVerifyTicket】:【%s】===================="; - - String ERROR_TICKET = "微信开放平台,第三方平台获取【验证票据】失败"; - - String END_TICKET = "==============================结束授权事件接收URL================================="; - - String START_RECEIVE = "==============================开始授权事件接收URL================================="; - - String URL_TICKET = "授权事件接收URL,验证票据"; - - String SUCCESS_TICKET = "第三方平台授权事件接收URL,验证票据成功"; - - String ERROR_URL_TICKET = "第三方平台授权事件接收URL,验证票据异常"; - - String SUCCESS_ACCESS_TOKEN = "====================结束执行定时任务获取令牌【component_access_token】===================="; - - String FAILURE_ACCESS_TOKEN = "微信开放平台,第三方平台获取【令牌】失败"; - - - + //授权回调URL 如下 + String AUTH_CODE = "auth_code"; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java new file mode 100644 index 0000000000..6ff00a3e80 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java @@ -0,0 +1,49 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @CreateTime 2020/7/10 9:27 + */ +public interface ThirdRunTimeInfoConstant { + + String AUTH_TICKET = "====================授权票据【ComponentVerifyTicket】:【%s】===================="; + + String ERROR_TICKET = "微信开放平台,第三方平台获取【验证票据】失败"; + + String END_TICKET = "==============================结束授权事件接收URL================================="; + + String START_RECEIVE = "==============================开始授权事件接收URL================================="; + + String URL_TICKET = "授权事件接收URL,验证票据"; + + String SUCCESS_TICKET = "第三方平台授权事件接收URL,验证票据成功"; + + String ERROR_URL_TICKET = "第三方平台授权事件接收URL,验证票据异常"; + + String SUCCESS_ACCESS_TOKEN = "====================结束执行定时任务获取令牌【component_access_token】===================="; + + String FAILURE_ACCESS_TOKEN = "微信开放平台,第三方平台获取【令牌】失败"; + + String ENCRYPT = "Encrypt:%s"; + + String MSG = "msg:%s"; + + String START_GET_COMPONENT_ACCESS_TOKEN = "====================开始执行定时任务获取令牌【component_access_token】===================="; + + String START_DELETE_COMPONENT_ACCESS_TOKEN = "====================开始逻辑删除【component_access_token】===================="; + + String START_GET_PRE_AUTH_CODE = "====================开始执行定时任务获取预授权码【pre_auth_code】===================="; + + String POST_RESULT = "====================返回post结果:%s"; + + String FAILURE_GET_PRE_AUTH_CODE = "微信开放平台,第三方平台获取【预授权码】失败"; + + String END_GET_PRE_AUTH_CODE = "====================结束获取预授权码【pre_auth_code】===================="; + + String START_GET_AUTH_INFO = "=====================开始获取【authorization_info】====================="; + + String START_INSERT_FUNC_INFO = "================================开始插入【func_info】===================================="; + + String END_GET_AUTH_INFO = "=====================结束获取【authorization_info】====================="; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java index cb38cf1014..4e4166f0b0 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java @@ -5,7 +5,6 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.service.ComponentVerifyTicketService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index f66db43c0e..cb13287289 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -9,6 +9,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.constant.ModuleConstant; import com.epmet.constant.ThirdApiConstant; +import com.epmet.constant.ThirdRunTimeInfoConstant; import com.epmet.dao.*; import com.epmet.dto.form.*; import com.epmet.dto.result.AuthorizationInfoResultDTO; @@ -18,11 +19,9 @@ import com.epmet.service.ComponentVerifyTicketService; import com.epmet.util.WXBizMsgCrypt; import com.epmet.util.WXXmlToMapUtil; import com.epmet.util.XmlUtil; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.github.pagehelper.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -35,6 +34,7 @@ import java.lang.reflect.Field; import java.util.*; import static com.epmet.constant.ThirdPlatformConstant.*; +import static com.epmet.constant.ThirdRunTimeInfoConstant.*; /** * @Author zxc @@ -71,24 +71,24 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe @Transactional(rollbackFor = Exception.class) @Override public String componentVerifyTicket(HttpServletRequest request, HttpServletResponse response) { - log.info(ModuleConstant.START_RECEIVE); + log.info(ThirdRunTimeInfoConstant.START_RECEIVE); try { - request.setCharacterEncoding("UTF-8"); - response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding(ModuleConstant.UTF8); + response.setCharacterEncoding(ModuleConstant.UTF8); // 微信加密签名 - String msgSignature = request.getParameter("msg_signature"); + String msgSignature = request.getParameter(ModuleConstant.MSG_SIGNATURE); // 时间戳 - String timeStamp = request.getParameter("timestamp"); + String timeStamp = request.getParameter(ModuleConstant.TIMESTAMP); // 随机数 - String nonce = request.getParameter("nonce"); + String nonce = request.getParameter(ModuleConstant.NONCE); // 从请求中读取整个post数据 InputStream inputStream; String postData = null; inputStream = request.getInputStream(); - postData= IOUtils.toString(inputStream, "UTF-8"); + postData= IOUtils.toString(inputStream,ModuleConstant.UTF8); //从XML中获取标签内的密文文本 String encrypt = XmlUtil.toXml(postData); - log.info("Encrypt:"+encrypt); + log.info(String.format(ThirdRunTimeInfoConstant.ENCRYPT,encrypt)); //格式化密文文本,否则没有标签,会解密失败,参考官方的加解密代码JAVA版本 String format = ""; String fromXML = String.format(format, encrypt); @@ -102,14 +102,14 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe // 解密消息 msg = wxcpt.decryptMsg(msgSignature, timeStamp, nonce, fromXML); } - log.info("msg:"+msg); + log.info(String.format(ThirdRunTimeInfoConstant.MSG,msg)); // 将xml转为map Map result = WXXmlToMapUtil.xmlToMap(msg); - String infotype = result.get("InfoType"); //获取infotype,注:微信开放平台文档中标明固定为:"component_verify_ticket",但参考其他代码,还包含authorized??? + String infotype = result.get(ModuleConstant.INFO_TYPE); //获取infotype,注:微信开放平台文档中标明固定为:"component_verify_ticket",但参考其他代码,还包含authorized??? log.info(infotype); switch (infotype){ - case "component_verify_ticket": //验证票据 - String ComponentVerifyTicket = result.get("ComponentVerifyTicket"); + case ModuleConstant.TICKET_UNDERLINE_KEY: //验证票据 + String ComponentVerifyTicket = result.get(ModuleConstant.TICKET_KEY); // 缓存 ticket redisThird.setComponentVerifyTicket(ComponentVerifyTicket); // 存数据库 @@ -117,17 +117,17 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe ticketFormDTO.setAppid(PLATFORM_APP_ID); ticketFormDTO.setComponentVerifyTicket(ComponentVerifyTicket); ticketDao.insertComponentVerifyTicket(ticketFormDTO); - log.info("component_verify_ticket:"+ComponentVerifyTicket); + log.info(ModuleConstant.TICKET_UNDERLINE_KEY+":"+ComponentVerifyTicket); break; - case "unauthorized"://用户取消授权 - return ""; + case ModuleConstant.UNAUTHORIZED://用户取消授权 + return ModuleConstant.NULL_CHAR; } } catch (Exception e) { log.error(e.getMessage()); - return ""; + return ModuleConstant.NULL_CHAR; } - log.info(ModuleConstant.END_TICKET); - return "success"; + log.info(ThirdRunTimeInfoConstant.END_TICKET); + return ModuleConstant.SUCCESS; } /** @@ -138,7 +138,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe @Transactional(rollbackFor = Exception.class) @Override public void getComponentAccessToken() { - log.info("====================开始执行定时任务获取令牌【component_access_token】===================="); + log.info(ThirdRunTimeInfoConstant.START_GET_COMPONENT_ACCESS_TOKEN); Map reMap; try { // 核心定时器 @@ -157,17 +157,18 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe formDTO.setComponentAccessToken(componentAccessToken); formDTO.setExpiresIn(Integer.valueOf(expiresIn)); //先逻辑删,在插入 + log.info(ThirdRunTimeInfoConstant.START_DELETE_COMPONENT_ACCESS_TOKEN); componentAccessTokenDao.updateOldComponentAccessToken(); componentAccessTokenDao.insertComponentAccessToken(formDTO); //存缓存 redisThird.setComponentAccessToken(componentAccessToken); } else { - throw new RenException(ModuleConstant.FAILURE_ACCESS_TOKEN); + throw new RenException(ThirdRunTimeInfoConstant.FAILURE_ACCESS_TOKEN); } } catch (Exception e) { e.printStackTrace(); } - log.info(ModuleConstant.SUCCESS_ACCESS_TOKEN); + log.info(ThirdRunTimeInfoConstant.SUCCESS_ACCESS_TOKEN); } /** @@ -178,13 +179,13 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe @Transactional(rollbackFor = Exception.class) @Override public void preAuthCode() { - log.info("====================开始执行定时任务获取预授权码【pre_auth_code】===================="); + log.info(START_GET_PRE_AUTH_CODE); try { String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN); JSONObject jsonObject = new JSONObject(); jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); String post = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); - log.info("====================返回post结果:" + post); + log.info(String.format(POST_RESULT,post)); HashMap hashMap = JSON.parseObject(post, HashMap.class); String preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE); String expiresIn = hashMap.get(ModuleConstant.EXPIRES_IN); @@ -200,12 +201,12 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe //预授权码 放入缓存 redisThird.setPreAuthCode(preAuthCode,ex); } else { - throw new RuntimeException("微信开放平台,第三方平台获取【预授权码】失败"); + throw new RuntimeException(FAILURE_GET_PRE_AUTH_CODE); } } catch (Exception e) { e.printStackTrace(); } - log.info("====================结束执行定时任务获取预授权码【pre_auth_code】===================="); + log.info(END_GET_PRE_AUTH_CODE); } /** @@ -214,6 +215,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe */ @Transactional(rollbackFor = Exception.class) public AuthorizationInfoResultDTO authInfoByAuthCode(String authCode,String authAppId,String customerId) { + log.info(START_GET_AUTH_INFO); AuthorizationInfoResultDTO authorizationInfoResultDTO = new AuthorizationInfoResultDTO(); // 获取令牌【component_access_token】 String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN); @@ -247,6 +249,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe refreshAuthorizerAccessTokenDao.updateOldAuthorizerAccessToken(customerId); refreshAuthorizerAccessTokenDao.insertAuthorizerAccessToken(refreshAccessToken); // 2. 权限列表 + log.info(START_INSERT_FUNC_INFO); List funcInfos = new ArrayList<>(); List func_info = authorizationInfoResultDTO.getFunc_info(); for (Map map1 : func_info) { @@ -268,6 +271,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe redisThird.setAuthInfo(authorizationInfoResultDTO); //authorizer_refresh_token 放入缓存 redisThird.setAuthorizerRefreshToken(refreshAccessToken); + log.info(END_GET_AUTH_INFO); return authorizationInfoResultDTO; } @@ -323,13 +327,13 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String userId = tokenDto.getUserId(); String customerId = paCustomerAgencyDao.getCustomerIdByUserId(userId); try { - request.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding(ModuleConstant.UTF8); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } - response.setCharacterEncoding("UTF-8"); - String authCode = request.getParameter("auth_code"); - String expiresIn = request.getParameter("expires_in"); + response.setCharacterEncoding(ModuleConstant.UTF8); + String authCode = request.getParameter(ModuleConstant.AUTH_CODE); + String expiresIn = request.getParameter(ModuleConstant.EXPIRES_IN); //authCode存数据库 AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); formDTO.setAuthCode(authCode); From b3a5bff1e95bd6e75d9654ac1134df8bf27b6716 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 10 Jul 2020 10:21:22 +0800 Subject: [PATCH 36/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/controller/AuthRedirectController.java | 2 +- .../com/epmet/controller/ComponentVerifyTicketController.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java index 4e4166f0b0..dd462b2245 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java @@ -17,7 +17,7 @@ import javax.servlet.http.HttpServletResponse; * @CreateTime 2020/7/10 9:04 */ @RestController -@RequestMapping("mpweb") +@RequestMapping("redirectauthcode") public class AuthRedirectController { @Autowired diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java index 7a19d3a8e6..4a2a6791f5 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java @@ -15,7 +15,7 @@ import javax.servlet.http.HttpServletResponse; */ @Slf4j @RestController -@RequestMapping("thirdplatform") +@RequestMapping("verifyticket") public class ComponentVerifyTicketController { @Autowired From d68f6f0c977c82ad480d278087bf430e05144bda Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 10 Jul 2020 11:12:52 +0800 Subject: [PATCH 37/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/controller/WarrantController.java | 39 ++++++++++++++ .../com/epmet/service/WarrantService.java | 19 +++++++ .../service/impl/WarrantServiceImpl.java | 51 +++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/WarrantService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java new file mode 100644 index 0000000000..b28c047c8e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java @@ -0,0 +1,39 @@ +package com.epmet.controller; + +import com.epmet.exception.AesException; +import com.epmet.service.WarrantService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.BufferedReader; +import java.io.IOException; + +/** + * @Author zxc + * @CreateTime 2020/7/10 10:41 + */ +@Slf4j +@RestController +@RequestMapping("warrant") +public class WarrantController { + + @Autowired + private WarrantService warrantService; + + @RequestMapping(value ="/{AppId}/callback") + public void acceptMessageAndEvent(HttpServletRequest request, @PathVariable("APPID") String appid, + HttpServletResponse response)throws IOException, DocumentException, AesException { + warrantService.acceptMessageAndEvent(request, appid, response); + } + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/WarrantService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/WarrantService.java new file mode 100644 index 0000000000..8475322c5b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/WarrantService.java @@ -0,0 +1,19 @@ +package com.epmet.service; + +import com.epmet.exception.AesException; +import org.dom4j.DocumentException; +import org.springframework.web.bind.annotation.PathVariable; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @Author zxc + * @CreateTime 2020/7/10 11:03 + */ +public interface WarrantService { + + void acceptMessageAndEvent(HttpServletRequest request,String appid,HttpServletResponse response)throws IOException, DocumentException, AesException; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java new file mode 100644 index 0000000000..1f9306de89 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java @@ -0,0 +1,51 @@ +package com.epmet.service.impl; + +import com.epmet.exception.AesException; +import com.epmet.service.WarrantService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.BufferedReader; +import java.io.IOException; + +/** + * @Author zxc + * @CreateTime 2020/7/10 11:03 + */ +@Slf4j +@Service +public class WarrantServiceImpl implements WarrantService { + @Override + public void acceptMessageAndEvent(HttpServletRequest request, String appid, HttpServletResponse response)throws IOException, DocumentException, AesException { + String msgSignature = request.getParameter("msg_signature"); + log.info("第三方平台全网发布-------------{appid}/callback-----------验证开始。。。。msg_signature=" + msgSignature); + if (!StringUtils.isNotBlank(msgSignature)) { + return;// 微信推送给第三方开放平台的消息一定是加过密的,无消息加密无法解密消息 + } + StringBuilder sb =new StringBuilder(); + BufferedReader in = request.getReader(); + String line; + while ((line = in.readLine()) !=null) { + sb.append(line); + } + in.close(); + + String xml = sb.toString(); + Document doc = DocumentHelper.parseText(xml); + Element rootElt = doc.getRootElement(); + String toUserName = rootElt.elementText("ToUserName"); + + //微信全网测试账号 +// if (StringUtils.equalsIgnoreCase(toUserName, APPID)) { + log.info("全网发布接入检测消息反馈开始---------------APPID=" + appid +"------------------------toUserName=" + toUserName); +// checkWeixinAllNetworkCheck(request, response, xml); +// } + } +} From c79e7f4bbd27c35a2f0e56d5182f6b35ccc57746 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 10 Jul 2020 13:25:15 +0800 Subject: [PATCH 38/90] =?UTF-8?q?epmet-third=E6=9C=8D=E5=8A=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index df5a05f326..ca82f80241 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.2 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.3 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 b021557bc1..fc0b908150 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.2 + 0.0.3 com.epmet From 08b3e877081f294a08d506f40fdf417755878155 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 10 Jul 2020 13:38:25 +0800 Subject: [PATCH 39/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/controller/WarrantController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java index b28c047c8e..dfd324ccee 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java @@ -30,7 +30,7 @@ public class WarrantController { @Autowired private WarrantService warrantService; - @RequestMapping(value ="/{AppId}/callback") + @RequestMapping(value ="/{APPID}/callback") public void acceptMessageAndEvent(HttpServletRequest request, @PathVariable("APPID") String appid, HttpServletResponse response)throws IOException, DocumentException, AesException { warrantService.acceptMessageAndEvent(request, appid, response); From b4050b68674793a1c58a6ff14b0f81bc8c22a45c Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 10 Jul 2020 13:39:46 +0800 Subject: [PATCH 40/90] =?UTF-8?q?epmet-third=E6=9C=8D=E5=8A=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index ca82f80241..59e4a6ee9b 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.3 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.4 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 fc0b908150..1ef253373d 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.3 + 0.0.4 com.epmet From 48302e1cf7d90ff977e459cc5a6c0054953b9f9e Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 10 Jul 2020 13:44:11 +0800 Subject: [PATCH 41/90] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BB=A3=E7=A0=81eg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wxapi/constant/WxMaCodeConstant.java | 74 +++ .../epmet/wxapi/enums/WxMaErrorMsgEnum.java | 482 ++++++++++++++++++ .../epmet/wxapi/param/WxMaCodeCommitReq.java | 34 ++ .../wxapi/param/WxMaCodeExtConfigReq.java | 203 ++++++++ .../java/com/epmet/wxapi/result/WxResult.java | 43 ++ .../epmet/wxapi/service/WxMaCodeService.java | 22 + .../service/impl/WxMaCodeServiceImpl.java | 22 + 7 files changed, 880 insertions(+) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeCommitReq.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeExtConfigReq.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxResult.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java new file mode 100644 index 0000000000..2aae2d8234 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java @@ -0,0 +1,74 @@ +package com.epmet.wxapi.constant; + +/** + * 代码管理api url + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/10 12:57 + */ +public class WxMaCodeConstant { + /** + * 为授权的小程序帐号上传小程序代码. + */ + String COMMIT_URL = "https://api.weixin.qq.com/wxa/commit"; + + /** + * 获取体验版二维码 + */ + String GET_QRCODE_URL = "https://api.weixin.qq.com/wxa/get_qrcode"; + + /** + * + */ + String GET_CATEGORY_URL = "https://api.weixin.qq.com/wxa/get_category"; + + /** + * 获取已上传的代码的页面列表 + */ + String GET_PAGE_URL = "https://api.weixin.qq.com/wxa/get_page"; + + /** + * 提交审核 + */ + String SUBMIT_AUDIT_URL = "https://api.weixin.qq.com/wxa/submit_audit"; + + /** + * 查询指定发布审核单的审核状态 + */ + String GET_AUDIT_STATUS_URL = "https://api.weixin.qq.com/wxa/get_auditstatus"; + + /** + * 查询最新一次提交的审核状态 + */ + String GET_LATEST_AUDIT_STATUS_URL = "https://api.weixin.qq.com/wxa/get_latest_auditstatus"; + + /** + * 发布已通过审核的小程序 + */ + String RELEASE_URL = "https://api.weixin.qq.com/wxa/release"; + + /** + * 修改小程序线上代码的可见状态(仅供第三方代小程序调用) + */ + String CHANGE_VISIT_STATUS_URL = "https://api.weixin.qq.com/wxa/change_visitstatus"; + + /** + * 版本回退 调用本接口可以将小程序的线上版本进行回退 + */ + String REVERT_CODE_RELEASE_URL = "https://api.weixin.qq.com/wxa/revertcoderelease"; + + /** + * 查询当前设置的最低基础库版本及各版本用户占比 + */ + String GET_SUPPORT_VERSION_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/getweappsupportversion"; + + /** + * 设置最低基础库版本 + */ + String SET_SUPPORT_VERSION_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/setweappsupportversion"; + + /** + * 小程序审核撤回 + */ + String UNDO_CODE_AUDIT_URL = "https://api.weixin.qq.com/wxa/undocodeaudit"; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java new file mode 100644 index 0000000000..7e21cdf51c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java @@ -0,0 +1,482 @@ +package com.epmet.wxapi.enums; + +import lombok.Getter; + +/** + * 微信小程序错误码 + * + * @author biggates + */ +@Getter +public enum WxMaErrorMsgEnum { + /** + * 请求成功. + */ + CODE_0(0, "请求成功"), + + /** + *

+     * 获取 access_token 时 AppSecret 错误,
+     * 或者 access_token 无效。请开发者认真比对 AppSecret 的正确性,或查看是否正在为恰当的小程序调用接口
+     * 对应操作:sendCustomerMessage
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/customer-message/sendCustomerMessage.html
+     * 
+ */ + CODE_40001(40001, "access_token 无效或 AppSecret 错误"), + /** + *
+     * 不合法的凭证类型
+     * 对应操作:sendCustomerMessage
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/customer-message/sendCustomerMessage.html
+     * 
+ */ + CODE_40002(40002, "不合法的凭证类型"), + /** + *
+     * touser不是正确的openid.
+     * 对应操作:sendCustomerMessage, sendUniformMessage
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
+     * POST https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/customer-message/sendCustomerMessage.html
+     * https://developers.weixin.qq.com/miniprogram/dev/api/open-api/uniform-message/sendUniformMessage.html
+     * 
+ */ + CODE_40003(40003, "openid 不正确"), + /** + *
+     * 无效媒体文件类型
+     * 对应操作:uploadTempMedia
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/customer-message/uploadTempMedia.html
+     * 
+ */ + CODE_40004(40004, "无效媒体文件类型"), + /** + *
+     * 无效媒体文件 ID.
+     * 对应操作:getTempMedia
+     * 对应地址:
+     * GET https://api.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id=MEDIA_ID
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/customer-message/getTempMedia.html
+     * 
+ */ + CODE_40007(40007, "无效媒体文件 ID"), + /** + *
+     * appid不正确,或者不符合绑定关系要求.
+     * 对应操作:sendUniformMessage
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/uniform-message/sendUniformMessage.html
+     * 
+ */ + CODE_40013(40013, "appid不正确,或者不符合绑定关系要求"), + /** + *
+     * template_id 不正确.
+     * 对应操作:sendUniformMessage, sendTemplateMessage
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=ACCESS_TOKEN
+     * POST https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/uniform-message/sendUniformMessage.html
+     * https://developers.weixin.qq.com/miniprogram/dev/api/open-api/template-message/sendTemplateMessage.html
+     * 
+ */ + CODE_40037(40037, "template_id 不正确"), + /** + *
+     * form_id不正确,或者过期.
+     * 对应操作:sendUniformMessage, sendTemplateMessage
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=ACCESS_TOKEN
+     * POST https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/uniform-message/sendUniformMessage.html
+     * https://developers.weixin.qq.com/miniprogram/dev/api/open-api/template-message/sendTemplateMessage.html
+     * 
+ */ + CODE_41028(41028, "form_id 不正确,或者过期"), + /** + *
+     * code 或 template_id 不正确.
+     * 对应操作:code2Session, sendUniformMessage, sendTemplateMessage
+     * 对应地址:
+     * GET https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code
+     * POST https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=ACCESS_TOKEN
+     * POST https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/code2Session.html
+     * https://developers.weixin.qq.com/miniprogram/dev/api/open-api/uniform-message/sendUniformMessage.html
+     * https://developers.weixin.qq.com/miniprogram/dev/api/open-api/template-message/sendTemplateMessage.html
+     * 
+ */ + CODE_41029(41029, "请求的参数不正确"), + /** + *
+     * form_id 已被使用,或者所传page页面不存在,或者小程序没有发布
+     * 对应操作:sendUniformMessage, getWXACodeUnlimit
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=ACCESS_TOKEN
+     * POST https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/uniform-message/sendUniformMessage.html
+     *  https://developers.weixin.qq.com/miniprogram/dev/api/open-api/qr-code/getWXACodeUnlimit.html
+     * 
+ */ + CODE_41030(41030, "请求的参数不正确"), + /** + *
+     * 调用分钟频率受限.
+     * 对应操作:getWXACodeUnlimit, sendUniformMessage, sendTemplateMessage
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=ACCESS_TOKEN
+     * POST https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=ACCESS_TOKEN
+     * POST https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/uniform-message/sendUniformMessage.html
+     * https://developers.weixin.qq.com/miniprogram/dev/api/open-api/qr-code/getWXACodeUnlimit.html
+     * 
+ */ + CODE_45009(45009, "调用分钟频率受限"), + /** + *
+     * 频率限制,每个用户每分钟100次.
+     * 对应操作:code2Session
+     * 对应地址:
+     * GET https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/code2Session.html
+     * 
+ */ + CODE_45011(45011, "频率限制,每个用户每分钟100次"), + /** + *
+     * 回复时间超过限制.
+     * 对应操作:sendCustomerMessage
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/customer-message/sendCustomerMessage.html
+     * 
+ */ + CODE_45015(45015, "回复时间超过限制"), + /** + *
+     * 接口调用超过限额, 或生成码个数总和到达最大个数限制.
+     * 对应操作:createWXAQRCode, sendTemplateMessage
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=ACCESS_TOKEN
+     * POST https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/qr-code/getWXACode.html
+     * https://developers.weixin.qq.com/miniprogram/dev/api/open-api/template-message/sendTemplateMessage.html
+     * 
+ */ + CODE_45029(45029, "接口调用超过限额"), + /** + *
+     * 客服接口下行条数超过上限.
+     * 对应操作:sendCustomerMessage
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/customer-message/sendCustomerMessage.html
+     * 
+ */ + CODE_45047(45047, "客服接口下行条数超过上限"), + /** + *
+     * command字段取值不对
+     * 对应操作:customerTyping
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/custom/typing?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/customer-message/customerTyping.html
+     * 
+ */ + CODE_45072(45072, "command字段取值不对"), + /** + *
+     * 下发输入状态,需要之前30秒内跟用户有过消息交互.
+     * 对应操作:customerTyping
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/custom/typing?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/customer-message/customerTyping.html
+     */
+    CODE_45080(45080, "下发输入状态,需要之前30秒内跟用户有过消息交互"),
+    /**
+     * 
+     * 已经在输入状态,不可重复下发.
+     * 对应操作:customerTyping
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/custom/typing?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/customer-message/customerTyping.html
+     * 
+ */ + CODE_45081(45081, "已经在输入状态,不可重复下发"), + /** + *
+     * API 功能未授权,请确认小程序已获得该接口.
+     * 对应操作:sendCustomerMessage
+     * 对应地址:
+     * POST https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/customer-message/sendCustomerMessage.html
+     * 
+ */ + CODE_48001(48001, "API 功能未授权"), + /** + *
+     * 内容含有违法违规内容.
+     * 对应操作:imgSecCheck, msgSecCheck
+     * 对应地址:
+     * POST https://api.weixin.qq.com/wxa/img_sec_check?access_token=ACCESS_TOKEN
+     * POST https://api.weixin.qq.com/wxa/msg_sec_check?access_token=ACCESS_TOKEN
+     * 参考文档地址: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sec-check/imgSecCheck.html
+     * https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sec-check/msgSecCheck.html
+     * 
+ */ + CODE_87014(87014, "内容含有违法违规内容"), + /** + * 系统繁忙,此时请开发者稍候再试. + */ + CODE_MINUS_1(-1, "系统繁忙,此时请开发者稍候再试"), + /** + * code 无效. + */ + CODE_40029(40029, "code 无效"), + /** + * access_token 过期. + */ + CODE_42001(42001, "access_token 过期"), + /** + * post 数据为空. + */ + CODE_44002(44002, "post 数据为空"), + /** + * post 数据中参数缺失. + */ + CODE_47001(47001, "post 数据中参数缺失"), + /** + * 参数 activity_id 错误. + */ + CODE_47501(47501, "参数 activity_id 错误"), + /** + * 参数 target_state 错误. + */ + CODE_47502(47502, "参数 target_state 错误"), + /** + * 参数 version_type 错误. + */ + CODE_47503(47503, "参数 version_type 错误"), + /** + * activity_id 过期. + */ + CODE_47504(47504, "activity_id 过期"), + /** + * 没有绑定开放平台帐号. + */ + CODE_89002(89002, "没有绑定开放平台帐号"), + /** + * 订单无效. + */ + CODE_89300(89300, "订单无效"), + + /** + * 代小程序实现业务的错误码,部分和小程序业务一致 + * https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Mini_Programs/Intro.html + */ + CODE_85060(85060, "无效的taskid"), + + CODE_85027(85027, "身份证绑定管理员名额达到上限"), + + CODE_85061(85061, "手机号绑定管理员名额达到上限"), + + CODE_85026(85026, "微信号绑定管理员名额达到上限"), + + CODE_85063(85063, "身份证黑名单"), + + CODE_85062(85062, "手机号黑名单"), + + CODE_85016(85016, "域名数量超过限制"), + + CODE_85017(85017, "没有新增域名,请确认小程序已经添加了域名或该域名是否没有在第三方平台添加"), + + CODE_85018(85018, "域名没有在第三方平台设置"), + + CODE_89019(89019, "业务域名无更改,无需重复设置"), + + CODE_89020(89020, "尚未设置小程序业务域名,请先在第三方平台中设置小程序业务域名后在调用本接口"), + + CODE_89021(89021, "请求保存的域名不是第三方平台中已设置的小程序业务域名或子域名"), + + CODE_89029(89029, "业务域名数量超过限制"), + + CODE_89231(89231, "个人小程序不支持调用 setwebviewdomain 接口"), + + CODE_91001(91001, "不是公众号快速创建的小程序"), + + CODE_91002(91002, "小程序发布后不可改名"), + + CODE_91003(91003, "改名状态不合法"), + + CODE_91004(91004, "昵称不合法"), + + CODE_91005(91005, "昵称 15 天主体保护"), + + CODE_91006(91006, "昵称命中微信号"), + + CODE_91007(91007, "昵称已被占用"), + + CODE_91008(91008, "昵称命中 7 天侵权保护期"), + + CODE_91009(91009, "需要提交材料"), + + CODE_91010(91010, "其他错误"), + + CODE_91011(91011, "查不到昵称修改审核单信息"), + + CODE_91012(91012, "其他错误"), + + CODE_91013(91013, "占用名字过多"), + + CODE_91014(91014, "+号规则 同一类型关联名主体不一致"), + + CODE_91015(91015, "原始名不同类型主体不一致"), + + CODE_91016(91016, "名称占用者 ≥2"), + + CODE_91017(91017, "+号规则 不同类型关联名主体不一致"), + + CODE_40097(40097, "参数错误"), + + CODE_41006(41006, "media_id 不能为空"), + + CODE_46001(46001, "media_id 不存在"), + + CODE_40009(40009, "图片尺寸太大"), + + CODE_53202(53202, "本月头像修改次数已用完"), + + CODE_53200(53200, "本月功能介绍修改次数已用完"), + + CODE_53201(53201, "功能介绍内容命中黑名单关键字"), + + CODE_85083(85083, "搜索标记位被封禁,无法修改"), + + CODE_85084(85084, "非法的 status 值,只能填 0 或者 1"), + + CODE_85013(85013, "无效的自定义配置"), + + CODE_85014(85014, "无效的模版编号"), + + CODE_85043(85043, "模版错误"), + + CODE_85044(85044, "代码包超过大小限制"), + + CODE_85045(85045, "ext_json 有不存在的路径"), + + CODE_85046(85046, "tabBar 中缺少 path"), + + CODE_85047(85047, "pages 字段为空"), + + CODE_85048(85048, "ext_json 解析失败"), + + CODE_80082(80082, "没有权限使用该插件"), + + CODE_80067(80067, "找不到使用的插件"), + + CODE_80066(80066, "非法的插件版本"), + + CODE_86000(86000, "不是由第三方代小程序进行调用"), + + CODE_86001(86001, "不存在第三方的已经提交的代码"), + + CODE_85006(85006, "标签格式错误"), + + CODE_85007(85007, "页面路径错误"), + + CODE_85008(85008, "类目填写错误"), + + CODE_85009(85009, "已经有正在审核的版本"), + + CODE_85010(85010, "item_list 有项目为空"), + + CODE_85011(85011, "标题填写错误"), + + CODE_85023(85023, "审核列表填写的项目数不在 1-5 以内"), + + CODE_85077(85077, "小程序类目信息失效(类目中含有官方下架的类目,请重新选择类目)"), + + CODE_86002(86002, "小程序还未设置昵称、头像、简介。请先设置完后再重新提交"), + + CODE_85085(85085, "近 7 天提交审核的小程序数量过多,请耐心等待审核完毕后再次提交"), + + CODE_85086(85086, "提交代码审核之前需提前上传代码"), + + CODE_85087(85087, "小程序已使用 api navigateToMiniProgram,请声明跳转 appid 列表后再次提交"), + + CODE_85012(85012, "无效的审核 id"), + + CODE_87013(87013, "撤回次数达到上限(每天一次,每个月 10 次)"), + + CODE_85019(85019, "没有审核版本"), + + CODE_85020(85020, "审核状态未满足发布"), + + CODE_87011(87011, "现网已经在灰度发布,不能进行版本回退"), + + CODE_87012(87012, "该版本不能回退,可能的原因:1:无上一个线上版用于回退 2:此版本为已回退版本,不能回退 3:此版本为回退功能上线之前的版本,不能回退"), + + CODE_85079(85079, "小程序没有线上版本,不能进行灰度"), + + CODE_85080(85080, "小程序提交的审核未审核通过"), + + CODE_85081(85081, "无效的发布比例"), + + CODE_85082(85082, "当前的发布比例需要比之前设置的高"), + + CODE_85021(85021, "状态不可变"), + + CODE_85022(85022, "action 非法"), + + CODE_89401(89401, "系统不稳定,请稍后再试,如多次失败请通过社区反馈"), + + CODE_89402(89402, "该审核单不在待审核队列,请检查是否已提交审核或已审完"), + + CODE_89403(89403, "本单属于平台不支持加急种类,请等待正常审核流程"), + + CODE_89404(89404, "本单已加速成功,请勿重复提交"), + + CODE_89405(89405, "本月加急额度不足,请提升提审质量以获取更多额度"), + + CODE_85064(85064, "找不到模版/草稿"), + + CODE_85065(85065, "模版库已满"), + + /** + * 小程序订阅消息错误码 + * https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.send.html + */ + CODE_43101(43101, "用户拒绝接受消息,如果用户之前曾经订阅过,则表示用户取消了订阅关系"), + + CODE_47003(47003, "模板参数不准确,可能为空或者不满足规则,errmsg会提示具体是哪个字段出错"), + ; + + private int code; + private String msg; + + WxMaErrorMsgEnum(int code, String msg) { + this.code = code; + this.msg = msg; + } + + /** + * 通过错误代码查找其中文含义. + */ + public static String findMsgByCode(int code) { + for (WxMaErrorMsgEnum value : WxMaErrorMsgEnum.values()) { + if (value.code == code) { + return value.msg; + } + } + + return null; + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeCommitReq.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeCommitReq.java new file mode 100644 index 0000000000..3054446c7f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeCommitReq.java @@ -0,0 +1,34 @@ +package com.epmet.wxapi.param; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/10 11:14 + */ +@Data +public class WxMaCodeCommitReq implements Serializable { + private static final long serialVersionUID = 9084356213189926999L; + + /** + * 代码库中的代码模版ID + */ + private Long templateId; + /** + * 第三方自定义的配置 + */ + private WxMaCodeExtConfigReq extConfig; + /** + * 代码版本号,开发者可自定义 + */ + private String userVersion; + /** + * 代码描述,开发者可自定义 + */ + private String userDesc; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeExtConfigReq.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeExtConfigReq.java new file mode 100644 index 0000000000..5296862502 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeExtConfigReq.java @@ -0,0 +1,203 @@ +package com.epmet.wxapi.param; + +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/10 11:19 + */ +@Data +public class WxMaCodeExtConfigReq implements Serializable { + private static final long serialVersionUID = 130934305232989991L; + /** + * 配置 ext.json 是否生效. + * 必填:是 + */ + private boolean extEnable; + /** + * 配置 extAppid. + * 必填:是 + */ + private String extAppid; + /** + * 开发自定义的数据字段. + * 必填:否 + */ + private Object ext; + /** + * 单独设置每个页面的 json. + * 必填:否 + * key: page 名称,如 pages/logs/logs + * value: page 配置 + */ + private Map extPages; + /** + * 是否直接提交到待审核列表. + * 必填:否 + */ + private Boolean directCommit; + /** + * 设置页面路径(同 app.json 相同的字段,填写会覆盖 app.json). + * 必填:否 + */ + private List pages; + /** + * 设置默认页面的窗口表现(同 app.json 相同的字段,填写会覆盖 app.json) + * 必填:否 + */ + private PageConfig window; + /** + * 设置各种网络请求的超时时间(同 app.json 相同的字段,填写会覆盖 app.json) + * 必填:否 + */ + private NetworkTimeout networkTimeout; + /** + * 设置是否开启 debug 模式(同 app.json 相同的字段,填写会覆盖 app.json) + * 必填:否 + */ + private Boolean debug; + /** + * 底部 tab 栏的表现. + * 必填:否 + */ + private TabBar tabBar; + + /** + * page.json 配置,页面配置 + * 文档:https://mp.weixin.qq.com/debug/wxadoc/dev/framework/config.html + */ + @Data + @Builder + public static class PageConfig { + /** + * 导航栏背景颜色,如"#000000" HexColor. + * 默认:#000000 + */ + private String navigationBarBackgroundColor; + /** + * 导航栏标题颜色,仅支持 black/white. + * 默认:white + */ + private String navigationBarTextStyle; + /** + * 导航栏标题文字内容. + */ + private String navigationBarTitleText; + /** + * 窗口的背景色 HexColor. + * 默认:#ffffff + */ + private String backgroundColor; + /** + * 下拉背景字体、loading 图的样式,仅支持 dark/light. + * 默认:dark + */ + private String backgroundTextStyle; + /** + * 是否开启下拉刷新,详见页面相关事件处理函数. + * 默认:false + */ + private String enablePullDownRefresh; + /** + * 设置为 true 则页面整体不能上下滚动;只在 page.json 中有效,无法在 app.json 中设置该项. + * 默认:false + */ + private Boolean disableScroll; + /** + * 页面上拉触底事件触发时距页面底部距离,单位为px. + * 默认:50 + */ + private Integer onReachBottomDistance; + } + + /** + * tabBar 配置. + */ + @Data + @Builder + public static class TabBar { + /** + * HexColor, tab 上的文字默认颜色. + */ + private String color; + /** + * HexColor, tab 上的文字选中时的颜色. + */ + private String selectedColor; + /** + * HexColor, tab 的背景色. + */ + private String backgroundColor; + /** + * tabbar 上边框的颜色,仅支持 black/white. + */ + private String borderStyle; + /** + * tab 的列表,最少2个、最多5个 tab. + */ + private List list; + /** + * 可选值 bottom、top. + */ + private String position; + + /** + * list item. + */ + @Data + @Builder + public static class Item { + /** + * 页面路径,必须在 pages 中先定义. + */ + private String pagePath; + /** + * tab 上按钮文字. + */ + private String text; + /** + * 图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,当 postion 为 top 时,此参数无效,不支持网络图片. + */ + private String iconPath; + /** + * 选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px ,当 postion 为 top 时,此参数无效. + */ + private String selectedIconPath; + } + } + + /** + * 各种网络请求的超时时间. + */ + @Data + @Builder + public static class NetworkTimeout { + /** + * wx.request的超时时间,单位毫秒,默认为:60000. + * 必填:否 + */ + private Integer request; + /** + * wx.connectSocket的超时时间,单位毫秒,默认为:60000. + * 必填:否 + */ + private Integer connectSocket; + /** + * wx.uploadFile的超时时间,单位毫秒,默认为:60000. + * 必填:否 + */ + private Integer uploadFile; + /** + * wx.downloadFile的超时时间,单位毫秒,默认为:60000. + * 必填:否 + */ + private Integer downloadFile; + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxResult.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxResult.java new file mode 100644 index 0000000000..5672f47a5e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxResult.java @@ -0,0 +1,43 @@ +package com.epmet.wxapi.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 微信统一返参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/10 13:22 + */ +@Data +public class WxResult implements Serializable { + /** + * 微信错误代码. + */ + private int errorCode=0; + + /** + * 微信错误信息. + */ + private String errorMsg="success"; + + /** + * 微信接口返回的错误原始信息(英文). json串 + */ + private String errorMsgEn; + + /** + * 响应数据 + */ + private T data; + + public WxResult ok(T data) { + this.setData(data); + return this; + } + + public boolean success(){ + return errorCode == 0 ? true : false; + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java new file mode 100644 index 0000000000..f34511cfec --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java @@ -0,0 +1,22 @@ +package com.epmet.wxapi.service; + +import com.epmet.wxapi.param.WxMaCodeCommitReq; +import com.epmet.wxapi.result.WxResult; +import me.chanjar.weixin.common.error.WxErrorException; + +/** + * 小程序代码管理相关 API(大部分只能是第三方平台调用) + * 文档:https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1489140610_Uavc4&token=&lang=zh_CN + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/10 11:21 + */ +public interface WxMaCodeService { + /** + * 为授权的小程序帐号上传小程序代码(仅仅支持第三方开放平台). + * + * @param commitRequest 参数 + * @throws WxErrorException 上传失败时抛出,具体错误码请看类注释文档 + */ + WxResult commit(String access_token, WxMaCodeCommitReq commitRequest) throws WxErrorException; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java new file mode 100644 index 0000000000..99860706eb --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java @@ -0,0 +1,22 @@ +package com.epmet.wxapi.service.impl; + +import com.epmet.wxapi.param.WxMaCodeCommitReq; +import com.epmet.wxapi.result.WxResult; +import com.epmet.wxapi.service.WxMaCodeService; +import me.chanjar.weixin.common.error.WxErrorException; +import org.springframework.stereotype.Service; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/10 11:23 + */ +@Service +public class WxMaCodeServiceImpl implements WxMaCodeService { + @Override + public WxResult commit(String access_token, WxMaCodeCommitReq commitRequest) throws WxErrorException { + + return null; + } +} From 3306612a921752c946ba2ab5e3283f8dd337e306 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 10 Jul 2020 13:51:29 +0800 Subject: [PATCH 42/90] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/PublicUserLoginServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java index 580e582888..e6386e757b 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java @@ -43,7 +43,9 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { WxMpOAuth2AccessToken wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(wxCode); wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, null); } catch (WxErrorException e) { - logger.error("->[getWxMpUser]::error[{}]", "解析微信用户信息失败"); + logger.error("->[getWxMpUser]::error[{}]", "解析微信用户信息失败",e.getMessage()); + e.printStackTrace(); + throw new RenException("解析微信用户信息失败"+e.getMessage()); } if (null == wxMpUser || StringUtils.isBlank(wxMpUser.getUnionId())) { throw new RenException("解析微信用户信息失败"); From 13b316c232c10f8c439439ce751eee7cb4a93eda Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 10 Jul 2020 13:56:16 +0800 Subject: [PATCH 43/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/controller/WarrantController.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java index dfd324ccee..1acb7a60ab 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java @@ -3,11 +3,7 @@ package com.epmet.controller; import com.epmet.exception.AesException; import com.epmet.service.WarrantService; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.dom4j.Document; import org.dom4j.DocumentException; -import org.dom4j.DocumentHelper; -import org.dom4j.Element; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -15,7 +11,6 @@ import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.BufferedReader; import java.io.IOException; /** From 523504028e9508de0568de1ac2fb9fa412e316dc Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 10 Jul 2020 14:11:03 +0800 Subject: [PATCH 44/90] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index 6b58dcdce2..ad3dd6d4aa 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.37 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.38 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 0d65cb72e1..a816d16575 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.37 + 0.3.38 com.epmet epmet-cloud diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 59e4a6ee9b..3243df2770 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.4 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.5 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 1ef253373d..227cae80bc 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.4 + 0.0.5 com.epmet From 295f86b52b7c4197650279f7d4c68dc04bdcbb35 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 10 Jul 2020 14:43:56 +0800 Subject: [PATCH 45/90] ceshi --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- .../epmet/service/impl/PublicUserLoginServiceImpl.java | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index ad3dd6d4aa..e8077fda32 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.38 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.39 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index a816d16575..e5b8e313fa 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.38 + 0.3.39 com.epmet epmet-cloud diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java index e6386e757b..b4c7092507 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java @@ -47,8 +47,13 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { e.printStackTrace(); throw new RenException("解析微信用户信息失败"+e.getMessage()); } - if (null == wxMpUser || StringUtils.isBlank(wxMpUser.getUnionId())) { - throw new RenException("解析微信用户信息失败"); + if (null == wxMpUser ) { + logger.error("wxMpUser is null"); + throw new RenException("解析微信用户信息失败 wxMpUser is null"); + } + if(StringUtils.isBlank(wxMpUser.getUnionId())){ + logger.error("wxMpUser.getUnionId() is null"); +// throw new RenException("解析微信用户信息失败"); } return wxMpUser; } From ff42246de768d551105478befaab6b9aed387703 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 13 Jul 2020 16:47:04 +0800 Subject: [PATCH 46/90] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3=E9=A6=96=E6=AC=A1?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/pom.xml | 6 + .../constant/PublicUserLoginConstant.java | 30 +++ .../controller/PublicUserLoginController.java | 50 ++++- .../epmet/dto/form/LoginByPhoneFormDTO.java | 38 ++++ .../dto/form/PublicSendSmsCodeFormDTO.java | 28 +++ .../java/com/epmet/redis/CaptchaRedis.java | 25 +++ .../epmet/service/PublicUserLoginService.java | 32 ++- .../impl/PublicUserLoginServiceImpl.java | 193 +++++++++++++++++- .../common/token/constant/LoginConstant.java | 10 + .../epmet-third/epmet-third-client/pom.xml | 6 + .../java/com/epmet/dto/CustomerMpDTO.java | 7 +- .../main/java/com/epmet/dto/PaUserDTO.java | 4 +- .../java/com/epmet/dto/PaUserVisitedDTO.java | 4 +- .../java/com/epmet/dto/PaUserWechatDTO.java | 14 +- .../epmet/dto/form/CreateAgencyFormDTO.java | 56 +++++ .../com/epmet/dto/form/RegisterFormDTO.java | 54 +++++ .../dto/form/SaveUserVisitedFormDTO.java | 34 +++ .../dto/result/CreateAgencyResultDTO.java | 23 +++ .../dto/result/CustomerUserResultDTO.java | 25 +++ .../epmet/dto/result/SaveUserResultDTO.java | 21 ++ .../epmet/feign/EpmetThirdFeignClient.java | 36 ++++ .../EpmetThirdFeignClientFallback.java | 22 ++ .../epmet-third/epmet-third-server/pom.xml | 6 + .../java/com/epmet/constant/PaConstant.java | 19 ++ .../controller/PaCustomerController.java | 63 ++++++ .../epmet/controller/PaUserController.java | 37 +++- .../controller/PaUserVisitedController.java | 15 +- .../java/com/epmet/dao/PaCustomerDao.java | 13 +- .../main/java/com/epmet/dao/PaUserDao.java | 13 +- .../java/com/epmet/dao/PaUserWechatDao.java | 19 +- .../com/epmet/entity/CustomerMpEntity.java | 7 +- .../com/epmet/entity/PaUserWechatEntity.java | 10 - .../java/com/epmet/excel/CustomerMpExcel.java | 5 +- .../com/epmet/excel/PaUserWechatExcel.java | 6 - .../com/epmet/service/PaCustomerService.java | 29 +++ .../java/com/epmet/service/PaUserService.java | 19 ++ .../epmet/service/PaUserVisitedService.java | 9 + .../epmet/service/PaUserWechatService.java | 8 + .../service/impl/PaCustomerServiceImpl.java | 109 +++++++++- .../epmet/service/impl/PaUserServiceImpl.java | 89 ++++++++ .../impl/PaUserVisitedServiceImpl.java | 39 +++- .../service/impl/PaUserWechatServiceImpl.java | 11 + .../main/resources/mapper/PaCustomerDao.xml | 12 ++ .../src/main/resources/mapper/PaUserDao.xml | 12 ++ .../main/resources/mapper/PaUserWechatDao.xml | 43 ++++ 45 files changed, 1231 insertions(+), 80 deletions(-) create mode 100644 epmet-auth/src/main/java/com/epmet/constant/PublicUserLoginConstant.java create mode 100644 epmet-auth/src/main/java/com/epmet/dto/form/LoginByPhoneFormDTO.java create mode 100644 epmet-auth/src/main/java/com/epmet/dto/form/PublicSendSmsCodeFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateAgencyFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SaveUserVisitedFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateAgencyResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerUserResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/SaveUserResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index de5d22524a..6794c2a2b4 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -116,6 +116,12 @@ 3.6.0 compile + + com.epmet + epmet-third-client + 2.0.0 + compile + diff --git a/epmet-auth/src/main/java/com/epmet/constant/PublicUserLoginConstant.java b/epmet-auth/src/main/java/com/epmet/constant/PublicUserLoginConstant.java new file mode 100644 index 0000000000..f2a2462e6a --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/constant/PublicUserLoginConstant.java @@ -0,0 +1,30 @@ +package com.epmet.constant; + +/** + * @author sun + * @dscription + */ +public interface PublicUserLoginConstant { + + /** + * 初始化用户信息失败 + */ + String SAVE_USER_EXCEPTION = "初始化用户信息失败"; + /** + * 是否登陆(true false) + */ + String PARAMETER_EXCEPTION = "是否登陆值错误"; + /** + * 登陆验证 + */ + String LOGON_EXCEPTION = "该手机号未注册"; + /** + * 注册验证 + */ + String ZHU_CE_EXCEPTION = "该手机号已注册"; + /** + * 用户登陆 新增访问记录 + */ + String SAVE_VISITED_EXCEPTION = "用户登陆,新增访问记录失败"; + +} diff --git a/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java index 9a48be046c..d083b2a26b 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java @@ -1,8 +1,15 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constant.PublicUserLoginConstant; +import com.epmet.dto.form.LoginByPhoneFormDTO; import com.epmet.dto.form.PaWxCodeFormDTO; +import com.epmet.dto.form.PublicSendSmsCodeFormDTO; +import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.PublicUserLoginService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -10,8 +17,6 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.util.Map; - /** * 描述一下 * @@ -28,15 +33,42 @@ public class PublicUserLoginController { /** * @return com.epmet.commons.tools.utils.Result * @param formDTO - * @author yinzuomei - * @description 测试是否能正常解析wxcode - * @Date 2020/7/9 17:00 + * @author sun + * @description 解析wxcode获取用户信息并生成token **/ - @PostMapping(value = "/testwxcode") - public Result loginByWxCode(@RequestBody PaWxCodeFormDTO formDTO) { + @PostMapping(value = "/wxcodetotoken") + public Result wxCodeToToken(@RequestBody PaWxCodeFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, PaWxCodeFormDTO.AddUserInternalGroup.class); - Map map = publicUserLoginService.loginByWxCode(formDTO); - return new Result().ok(map); + return new Result().ok(publicUserLoginService.wxCodeToToken(formDTO)); } + /** + * @param formDTO 手机号 + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 公众号登录-发送验证码 + **/ + @PostMapping(value = "/sendsmscode") + public Result sendSmsCode(@RequestBody PublicSendSmsCodeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO,PublicSendSmsCodeFormDTO.AddUserShowGroup.class); + if(formDTO.getIsLogon()!=true&&formDTO.getIsLogon()!=false){ + throw new RenException(PublicUserLoginConstant.PARAMETER_EXCEPTION); + } + publicUserLoginService.sendSmsCode(formDTO); + return new Result(); + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 公众号-手机验证码登陆 + **/ + @PostMapping(value = "/loginbyphone") + public Result loginByPhone(@LoginUser TokenDto tokenDTO, @RequestBody LoginByPhoneFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, LoginByPhoneFormDTO.AddUserShowGroup.class, LoginByPhoneFormDTO.LoginByPhone.class); + return new Result().ok(publicUserLoginService.loginByPhone(tokenDTO, formDTO)); + } + + } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/LoginByPhoneFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/LoginByPhoneFormDTO.java new file mode 100644 index 0000000000..8b09d458d9 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/LoginByPhoneFormDTO.java @@ -0,0 +1,38 @@ +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 手机验证码登陆接口入参 + * @Author sun + */ +@Data +public class LoginByPhoneFormDTO implements Serializable { + private static final long serialVersionUID = 4193133227120225342L; + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + public interface LoginByPhone extends CustomerClientShowGroup{} + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空", groups = {AddUserShowGroup.class}) + private String phone; + + /** + * 验证码 + */ + @NotBlank(message="验证码不能为空", groups = {LoginByPhone.class}) + private String smsCode; + +} + diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/PublicSendSmsCodeFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/PublicSendSmsCodeFormDTO.java new file mode 100644 index 0000000000..b3e9558600 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/PublicSendSmsCodeFormDTO.java @@ -0,0 +1,28 @@ +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 公众号手机号+验证码登录接口入参 + * @Author sun + */ +@Data +public class PublicSendSmsCodeFormDTO implements Serializable { + private static final long serialVersionUID = -1852541457359282018L; + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "手机号不能为空", groups = {AddUserShowGroup.class}) + private String phone; + @NotBlank(message = "是否登陆不能为空", groups = {AddUserShowGroup.class}) + private Boolean isLogon; +} diff --git a/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java b/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java index acdd85f490..50433bdaf0 100644 --- a/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java +++ b/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java @@ -11,6 +11,7 @@ package com.epmet.redis; import com.epmet.common.token.constant.LoginConstant; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.dto.form.PublicSendSmsCodeFormDTO; import com.epmet.dto.form.SendSmsCodeFormDTO; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -82,4 +83,28 @@ public class CaptchaRedis { String smsCode = (String) redisUtils.get(smsCodeKey); return smsCode; } + + /** + * @param sendSmsCodeFormDTO app、client、phone + * @param smsCode 验证码 + * @return void + * @Author sun + * @Description 公众号-短信验证码存入redis + **/ + public void savePublicSmsCode(PublicSendSmsCodeFormDTO sendSmsCodeFormDTO, String smsCode) { + String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_PUBLIC, LoginConstant.CLIENT_MP, sendSmsCodeFormDTO.getPhone()); + logger.info(String.format("短信验证码key=%s", smsCodeKey)); + redisUtils.set(smsCodeKey, smsCode, MINUTE_THIRTY_EXPIRE); + } + /** + * @param phone + * @return java.lang.String + * @Author sun + * @Description 公众号-获取登录时发送的验证码 + **/ + public String getPublicSmsCode(String phone) { + String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_PUBLIC, LoginConstant.CLIENT_MP, phone); + String smsCode = (String) redisUtils.get(smsCodeKey); + return smsCode; + } } diff --git a/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java b/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java index 20091381c0..0ee6449c90 100644 --- a/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java @@ -1,8 +1,10 @@ package com.epmet.service; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.form.LoginByPhoneFormDTO; import com.epmet.dto.form.PaWxCodeFormDTO; - -import java.util.Map; +import com.epmet.dto.form.PublicSendSmsCodeFormDTO; +import com.epmet.dto.result.UserTokenResultDTO; /** * 描述一下 @@ -11,5 +13,29 @@ import java.util.Map; * @date 2020/7/8 18:31 */ public interface PublicUserLoginService { - Map loginByWxCode(PaWxCodeFormDTO formDTO); + + /** + * @return + * @param formDTO + * @author sun + * @description 解析wxcode获取用户信息并生成token + **/ + UserTokenResultDTO wxCodeToToken(PaWxCodeFormDTO formDTO); + + /** + * @param formDTO 手机号 + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 公众号登录-发送验证码 + **/ + void sendSmsCode(PublicSendSmsCodeFormDTO formDTO); + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 公众号-手机验证码登陆 + **/ + UserTokenResultDTO loginByPhone(TokenDto tokenDTO, LoginByPhoneFormDTO formDTO); + } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java index e6386e757b..a5e0a48d3f 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java @@ -1,7 +1,27 @@ package com.epmet.service.impl; +import com.epmet.common.token.constant.LoginConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; -import com.epmet.dto.form.PaWxCodeFormDTO; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.CpUserDetailRedis; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.PhoneValidatorUtils; +import com.epmet.constant.PublicUserLoginConstant; +import com.epmet.constant.SmsTemplateConstant; +import com.epmet.dto.PaCustomerDTO; +import com.epmet.dto.PaUserDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CustomerUserResultDTO; +import com.epmet.dto.result.SaveUserResultDTO; +import com.epmet.dto.result.SendVerificationCodeResultDTO; +import com.epmet.dto.result.UserTokenResultDTO; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.feign.EpmetThirdFeignClient; +import com.epmet.jwt.JwtTokenProperties; +import com.epmet.jwt.JwtTokenUtils; +import com.epmet.redis.CaptchaRedis; import com.epmet.service.PublicUserLoginService; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.mp.api.WxMpService; @@ -25,16 +45,42 @@ import java.util.Map; @Service public class PublicUserLoginServiceImpl implements PublicUserLoginService { private static final Logger logger = LoggerFactory.getLogger(PublicUserLoginServiceImpl.class); + private static final String SEND_SMS_CODE_ERROR = "发送短信验证码异常,手机号[%s],code[%s],msg[%s]"; @Autowired private WxMpService wxMpService; + @Autowired + private EpmetThirdFeignClient epmetThirdFeignClient; + @Autowired + private JwtTokenUtils jwtTokenUtils; + @Autowired + private JwtTokenProperties jwtTokenProperties; + @Autowired + private CpUserDetailRedis cpUserDetailRedis; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private CaptchaRedis captchaRedis; @Override - public Map loginByWxCode(PaWxCodeFormDTO formDTO) { - WxMpUser wxMpUser=this.getWxMpUser(formDTO.getWxCode()); - Map map =new HashMap(); - map.put("微信用户信息",wxMpUser); - return map; + public UserTokenResultDTO wxCodeToToken(PaWxCodeFormDTO formDTO) { + //1.通过微信code获取用户基本信息 + WxMpUser wxMpUser = this.getWxMpUser(formDTO.getWxCode()); + + //2.将获取的用户基本信息初始化到数据库 + Result result = epmetThirdFeignClient.saveUser(wxMpUser); + if (!result.success()) { + throw new RenException(PublicUserLoginConstant.SAVE_USER_EXCEPTION); + } + SaveUserResultDTO resultDTO = result.getData(); + + //3.获取用户token + String token = this.generateGovWxmpToken(resultDTO.getUserId()); + //4.保存到redis + this.saveLatestGovTokenDto(resultDTO, wxMpUser, token); + UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setToken(token); + return userTokenResultDTO; } private WxMpUser getWxMpUser(String wxCode) { @@ -43,13 +89,144 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { WxMpOAuth2AccessToken wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(wxCode); wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, null); } catch (WxErrorException e) { - logger.error("->[getWxMpUser]::error[{}]", "解析微信用户信息失败",e.getMessage()); + logger.error("->[getWxMpUser]::error[{}]", "解析微信用户信息失败", e.getMessage()); e.printStackTrace(); - throw new RenException("解析微信用户信息失败"+e.getMessage()); + throw new RenException("解析微信用户信息失败" + e.getMessage()); } if (null == wxMpUser || StringUtils.isBlank(wxMpUser.getUnionId())) { throw new RenException("解析微信用户信息失败"); } return wxMpUser; } + + /** + * @Description 生成token + **/ + private String generateGovWxmpToken(String userId) { + Map map = new HashMap<>(); + map.put("app", LoginConstant.APP_PUBLIC); + map.put("client", LoginConstant.CLIENT_MP); + map.put("userId", userId); + String token = jwtTokenUtils.createToken(map); + logger.info("app:" + LoginConstant.APP_PUBLIC + ";client:" + LoginConstant.CLIENT_MP + ";userId:" + userId + ";生成token[" + token + "]"); + return token; + } + + //保存tokenDto到redis + private void saveLatestGovTokenDto(SaveUserResultDTO resultDTO, WxMpUser wxMpUser, String token) { + TokenDto tokenDTO = new TokenDto(); + int expire = jwtTokenProperties.getExpire(); + tokenDTO.setOpenId(wxMpUser.getOpenId()); + tokenDTO.setUnionId(wxMpUser.getUnionId()); + tokenDTO.setToken(token); + //首次初始化时还没有客户 + tokenDTO.setCustomerId(""); + tokenDTO.setUserId(resultDTO.getUserId()); + tokenDTO.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); + tokenDTO.setUpdateTime(System.currentTimeMillis()); + cpUserDetailRedis.set(tokenDTO, expire); + logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); + } + + /** + * @param formDTO 手机号 + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 公众号登录-发送验证码 + **/ + @Override + public void sendSmsCode(PublicSendSmsCodeFormDTO formDTO) { + //1、校验手机号是否符合规范 + if (!PhoneValidatorUtils.isMobile(formDTO.getPhone())) { + logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getPhone(), EpmetErrorCode.ERROR_PHONE.getCode(), EpmetErrorCode.ERROR_PHONE.getMsg())); + throw new RenException(EpmetErrorCode.ERROR_PHONE.getCode()); + } + //2、根据手机号校验用户是否存在 + Result Result = epmetThirdFeignClient.checkPaUser(formDTO.getPhone()); + if (!Result.success()) { + logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getPhone(), Result.getCode(), Result.getMsg())); + throw new RenException(Result.getCode()); + } + CustomerUserResultDTO ResultDTO = Result.getData(); + //登陆 + if (formDTO.getIsLogon() && null == ResultDTO.getPaUserResult()) { + throw new RenException(PublicUserLoginConstant.LOGON_EXCEPTION); + } + //注册 + if (!formDTO.getIsLogon() && null != ResultDTO.getPaUserResult()) { + throw new RenException(PublicUserLoginConstant.ZHU_CE_EXCEPTION); + } + //3、发送短信验证码 + SendVerificationCodeFormDTO sendVerificationCodeFormDTO = new SendVerificationCodeFormDTO(); + sendVerificationCodeFormDTO.setMobile(formDTO.getPhone()); + //登陆或注册对应的短息模板 + sendVerificationCodeFormDTO.setAliyunTemplateCode(formDTO.getIsLogon() ? SmsTemplateConstant.LGOIN_CONFIRM : SmsTemplateConstant.USER_REGISTER); + Result smsCodeResult = epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO); + if (!smsCodeResult.success()) { + logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getPhone(), smsCodeResult.getCode(), smsCodeResult.getMsg())); + throw new RenException(smsCodeResult.getCode()); + } + //4、保存短信验证码(删除现有短信验证码、将新的短信验证码存入Redis) + captchaRedis.savePublicSmsCode(formDTO, smsCodeResult.getData().getCode()); + logger.info(String.format("发送短信验证码成功,手机号[%s]", formDTO.getPhone())); + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 公众号-手机验证码登陆 + **/ + @Override + public UserTokenResultDTO loginByPhone(TokenDto tokenDTO, LoginByPhoneFormDTO formDTO) { + //1.根据手机号查询到用户、客户信息 + Result result = epmetThirdFeignClient.checkPaUser(formDTO.getPhone()); + if (!result.success()) { + logger.error(String.format("手机验证码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getPhone(), result.getCode(), result.getMsg())); + throw new RenException(result.getCode()); + } + CustomerUserResultDTO resultDTO = result.getData(); + + //2.用户不存在时不允许登陆 + PaUserDTO userDTO = resultDTO.getPaUserResult(); + if (null == resultDTO || StringUtils.isBlank(userDTO.getId())) { + throw new RenException(PublicUserLoginConstant.LOGON_EXCEPTION); + } + + //3.校验验证码是否正确 + String rightSmsCode = captchaRedis.getPublicSmsCode(formDTO.getPhone()); + if (!formDTO.getSmsCode().equals(rightSmsCode)) { + logger.error(String.format("验证码错误code[%s],msg[%s]", EpmetErrorCode.MOBILE_CODE_ERROR.getCode(), EpmetErrorCode.MOBILE_CODE_ERROR.getMsg())); + throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); + } + //获取缓存中的token + TokenDto redisTokenDTO = cpUserDetailRedis.get(LoginConstant.APP_PUBLIC, LoginConstant.CLIENT_MP, userDTO.getId(), TokenDto.class); + if (redisTokenDTO == null) { + return null; + } + + //4.判断是否存在客户信息,是否需要生成新的token + PaCustomerDTO customerDTO = resultDTO.getPaCustomerResult(); + if (null != customerDTO && !StringUtils.isBlank(customerDTO.getId())) { + redisTokenDTO.setCustomerId(customerDTO.getId()); + int expire = jwtTokenProperties.getExpire(); + cpUserDetailRedis.set(redisTokenDTO, expire); + } + + //5.登陆成功,访问记录表新增访问记录(访问记录新增失败不应影响用户登陆) + SaveUserVisitedFormDTO visited = new SaveUserVisitedFormDTO(); + visited.setUserId(userDTO.getId()); + visited.setLogonUserId(tokenDTO.getUserId()); + visited.setPhone(formDTO.getPhone()); + Result visitedResult = epmetThirdFeignClient.saveUserVisited(visited); + if(!visitedResult.success()){ + logger.error(PublicUserLoginConstant.SAVE_VISITED_EXCEPTION); + } + + //6.返回token + UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setToken(redisTokenDTO.getToken()); + return userTokenResultDTO; + } + } diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/constant/LoginConstant.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/constant/LoginConstant.java index b546108bc8..17cb456a1a 100644 --- a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/constant/LoginConstant.java +++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/constant/LoginConstant.java @@ -21,6 +21,11 @@ public interface LoginConstant { */ String APP_OPER = "oper"; + /** + * 公众号 + */ + String APP_PUBLIC = "public"; + /** * web */ @@ -30,4 +35,9 @@ public interface LoginConstant { * 微信小程序 */ String CLIENT_WXMP = "wxmp"; + + /** + * E事通服务号 + */ + String CLIENT_MP = "mp"; } diff --git a/epmet-module/epmet-third/epmet-third-client/pom.xml b/epmet-module/epmet-third/epmet-third-client/pom.xml index f9e61c9c99..3a2173aa25 100644 --- a/epmet-module/epmet-third/epmet-third-client/pom.xml +++ b/epmet-module/epmet-third/epmet-third-client/pom.xml @@ -20,6 +20,12 @@ epmet-commons-tools 2.0.0 + + com.github.binarywang + weixin-java-mp + 3.6.0 + compile + diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java index fd7db9bb2d..014fbe6678 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java @@ -54,15 +54,10 @@ public class CustomerMpDTO implements Serializable { private Integer appId; /** - * 是否已经授权 + * 是否已经授权 0:未授权,1:已授权 */ private Integer authorizationFlag; - /** - * 公众账号信息id - */ - private String authorizerInfoId; - /** * 删除标识:0.未删除 1.已删除 */ diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java index 1491066d85..1a61724055 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java @@ -34,9 +34,9 @@ public class PaUserDTO implements Serializable { private static final long serialVersionUID = 1L; /** - * 本主键会用作customer_staff里的user_id,user表的id + * user表的id */ - private Integer id; + private String id; /** * 手机号 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserVisitedDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserVisitedDTO.java index 7755dc1182..84f9601199 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserVisitedDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserVisitedDTO.java @@ -34,9 +34,9 @@ public class PaUserVisitedDTO implements Serializable { private static final long serialVersionUID = 1L; /** - * 本主键会用作customer_staff里的user_id,user表的id + * user表的id */ - private Integer id; + private String id; /** * 用户Id pa_user.id diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserWechatDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserWechatDTO.java index 9f11eab524..29106ab239 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserWechatDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserWechatDTO.java @@ -34,9 +34,9 @@ public class PaUserWechatDTO implements Serializable { private static final long serialVersionUID = 1L; /** - * 本主键会用作customer_staff里的user_id,user表的id + * user表的id */ - private Integer id; + private String id; /** * 用户Id user.id @@ -53,11 +53,6 @@ public class PaUserWechatDTO implements Serializable { */ private String unionId; - /** - * 手机号 - */ - private String phone; - /** * 1男2女0未知 */ @@ -88,11 +83,6 @@ public class PaUserWechatDTO implements Serializable { */ private String city; - /** - * 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) - */ - private String privilege; - /** * 语言 */ diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateAgencyFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateAgencyFormDTO.java new file mode 100644 index 0000000000..dec52622c8 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateAgencyFormDTO.java @@ -0,0 +1,56 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author sun + * @Description 公众号-创建组织-接口入参 + */ +@Data +public class CreateAgencyFormDTO implements Serializable { + + private static final long serialVersionUID = -6547893374373422628L; + + public interface AddUserInternalGroup {} + + /** + * 根组织名称 + */ + @NotBlank(message = "组织名称不能为空") + private String agencyName; + + /** + * 级别 + */ + @NotBlank(message = "组织级别不能为空") + private String level; + + /** + * 地区编码 + */ + @NotBlank(message = "地区编码不能为空") + private String areaCode; + + /** + * 省(中国字) + */ + private String province; + + /** + * 市(中国字) + */ + private String city; + + /** + * 区(中国字) + */ + private String district; + + /** + * 党支部数量 + */ + private Integer partyBranchNum = 0; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterFormDTO.java new file mode 100644 index 0000000000..fe16eaab4c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterFormDTO.java @@ -0,0 +1,54 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @Author sun + * @Description 公众号-手机号注册-接口入参 + */ +@Data +public class RegisterFormDTO implements Serializable { + + private static final long serialVersionUID = -6547893374373422628L; + + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class}) + private String phone; + + /** + * 手机短信验证码 + */ + @NotBlank(message = "验证码不能为空", groups = {AddUserShowGroup.class}) + private String smsCode; + + /** + * 姓氏 + */ + @NotBlank(message = "姓氏不能为空", groups = {AddUserShowGroup.class}) + private String surName; + + /** + * 性别 1男2女0未知 + */ + @NotNull(message = "用户性别不能为空", groups = {AddUserShowGroup.class}) + private Integer gender; + + /** + * token中userId + */ + private String userId; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SaveUserVisitedFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SaveUserVisitedFormDTO.java new file mode 100644 index 0000000000..eecf8da6d0 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SaveUserVisitedFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author sun + * @Description 公众号-用户登陆新增访问记录-接口入参 + */ +@Data +public class SaveUserVisitedFormDTO implements Serializable { + + private static final long serialVersionUID = -6547893374373422628L; + + public interface AddUserInternalGroup {} + + /** + * 登陆手机号对应的userId + */ + private String userId; + + /** + * 登陆人userId + */ + private String logonUserId; + + /** + * 登陆手机号 + */ + private String phone; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateAgencyResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateAgencyResultDTO.java new file mode 100644 index 0000000000..f344e5c062 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateAgencyResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * @Author sun + * @Description 公众号-创建组织-接口返参 + */ +@Data +public class CreateAgencyResultDTO implements Serializable { + + private static final long serialVersionUID = 3253989119352850315L; + + /** + * 新增客户Id + */ + private String customerId; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerUserResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerUserResultDTO.java new file mode 100644 index 0000000000..3b8d20f9e9 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerUserResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.result; + +import com.epmet.dto.PaCustomerDTO; +import com.epmet.dto.PaUserDTO; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 根据手机号查询用户信息、客户信息-接口返参 + * @Author sun + */ +@Data +public class CustomerUserResultDTO implements Serializable { + private static final long serialVersionUID = 5214475907074876716L; + + /** + * 用户信息 + */ + private PaUserDTO paUserResult; + /** + * 用户对应的客户信息 + */ + private PaCustomerDTO paCustomerResult; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/SaveUserResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/SaveUserResultDTO.java new file mode 100644 index 0000000000..bd2ce393a4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/SaveUserResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author sun + * @Description 授权用户信息时新增或更新用户信息-接口返参 + */ +@Data +public class SaveUserResultDTO implements Serializable { + + private static final long serialVersionUID = 3253989119352850315L; + + /** + * 新增或已有用户的Id + */ + private String userId; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java index db762abafa..4b038324ac 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java @@ -1,8 +1,17 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.SaveUserVisitedFormDTO; +import com.epmet.dto.result.CustomerUserResultDTO; +import com.epmet.dto.result.SaveUserResultDTO; import com.epmet.feign.fallback.EpmetThirdFeignClientFallback; +import me.chanjar.weixin.mp.bean.result.WxMpUser; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -13,4 +22,31 @@ import org.springframework.cloud.openfeign.FeignClient; @FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = EpmetThirdFeignClientFallback.class) public interface EpmetThirdFeignClient { + + /** + * @param wxMpUser + * @return + * @Author sun + * @Description 根据openId新增或更新用户信息 + **/ + @PostMapping(value = "third/pauser/saveuser", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result saveUser(@RequestBody WxMpUser wxMpUser); + + /** + * @param phone + * @return + * @Author sun + * @Description 根据手机号查询公众号用户基本信息,校验用户是否存在 + **/ + @PostMapping(value = "third/pauser/checkpauser/{phone}") + Result checkPaUser(@PathVariable("phone") String phone); + + /** + * @param visited + * @return + * @Author sun + * @Description 用户登陆,新增访问记录数据 + **/ + @PostMapping(value = "third/pauservisited/saveuservisited") + Result saveUserVisited(@RequestBody SaveUserVisitedFormDTO visited); } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java index 7e58be23e7..b1965cad5a 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java @@ -1,6 +1,13 @@ package com.epmet.feign.fallback; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.SaveUserVisitedFormDTO; +import com.epmet.dto.result.CustomerUserResultDTO; +import com.epmet.dto.result.SaveUserResultDTO; import com.epmet.feign.EpmetThirdFeignClient; +import me.chanjar.weixin.mp.bean.result.WxMpUser; import org.springframework.stereotype.Component; /** @@ -9,4 +16,19 @@ import org.springframework.stereotype.Component; */ @Component public class EpmetThirdFeignClientFallback implements EpmetThirdFeignClient { + + @Override + public Result saveUser(WxMpUser wxMpUser) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "saveUser", wxMpUser); + } + + @Override + public Result checkPaUser(String phone) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "checkPaUser", phone); + } + + @Override + public Result saveUserVisited(SaveUserVisitedFormDTO visited) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "saveUserVisited", visited); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index a8bba9e38c..438272e2c6 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -123,6 +123,12 @@ 3.6.0 compile + + com.epmet + epmet-common-clienttoken + 2.0.0 + compile + diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java new file mode 100644 index 0000000000..ee15ddf636 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java @@ -0,0 +1,19 @@ +package com.epmet.constant; + +/** + * @Description 公众号-常量 + * @author sun + */ +public interface PaConstant { + + /** + * 手机号注册 + */ + String PHONE_EXCEPTION = "手机号已存在,不允许再次注册"; + /** + * 根据userId查询pa_user_wechat表失败 + */ + String SELECT_WECHAT_EXCEPTION = "获取用户微信信息失败"; + + +} 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 7cc03af30e..5f8f9f5660 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 @@ -1,5 +1,17 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.form.CreateAgencyFormDTO; +import com.epmet.dto.form.RegisterFormDTO; +import com.epmet.dto.result.CreateAgencyResultDTO; +import com.epmet.service.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -12,4 +24,55 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("pacustomer") public class PaCustomerController { + + @Autowired + private PaUserService paUserService; + @Autowired + private PaCustomerService paCustomerService; + @Autowired + private PaCustomerAgencyService paCustomerAgencyService; + @Autowired + private PaCustomerUserAgencyService paCustomerUserAgencyService; + @Autowired + private CustomerMpService customerMpService; + + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-手机号注册 + **/ + @PostMapping("register") + public Result register(@LoginUser TokenDto tokenDTO, @RequestBody RegisterFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, RegisterFormDTO.AddUserInternalGroup.class, RegisterFormDTO.AddUserShowGroup.class); + formDTO.setUserId(tokenDTO.getUserId()); + paCustomerService.register(formDTO); + return new Result(); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-创建组织 + **/ + @PostMapping("createagency") + public Result createAgency(@LoginUser TokenDto tokenDTO, @RequestBody CreateAgencyFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, DefaultGroup.class); + return new Result().ok(paCustomerService.createAgency(tokenDTO, formDTO)); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-查询我的信息 + **/ + @PostMapping("myinfo") + public Result myInfo(@LoginUser TokenDto tokenDTO, @RequestBody CreateAgencyFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, DefaultGroup.class); + return new Result().ok(paCustomerService.myInfo(formDTO)); + } + + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserController.java index 8f447b191e..d7c07bc506 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserController.java @@ -26,8 +26,11 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.PaUserDTO; +import com.epmet.dto.result.CustomerUserResultDTO; +import com.epmet.dto.result.SaveUserResultDTO; import com.epmet.excel.PaUserExcel; import com.epmet.service.PaUserService; +import me.chanjar.weixin.mp.bean.result.WxMpUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -45,24 +48,24 @@ import java.util.Map; @RestController @RequestMapping("pauser") public class PaUserController { - + @Autowired private PaUserService paUserService; @GetMapping("page") - public Result> page(@RequestParam Map params){ + public Result> page(@RequestParam Map params) { PageData page = paUserService.page(params); return new Result>().ok(page); } @GetMapping("{id}") - public Result get(@PathVariable("id") String id){ + public Result get(@PathVariable("id") String id) { PaUserDTO data = paUserService.get(id); return new Result().ok(data); } @PostMapping - public Result save(@RequestBody PaUserDTO dto){ + public Result save(@RequestBody PaUserDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); paUserService.save(dto); @@ -70,7 +73,7 @@ public class PaUserController { } @PutMapping - public Result update(@RequestBody PaUserDTO dto){ + public Result update(@RequestBody PaUserDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); paUserService.update(dto); @@ -78,7 +81,7 @@ public class PaUserController { } @DeleteMapping - public Result delete(@RequestBody String[] ids){ + public Result delete(@RequestBody String[] ids) { //效验数据 AssertUtils.isArrayEmpty(ids, "id"); paUserService.delete(ids); @@ -91,4 +94,26 @@ public class PaUserController { ExcelUtils.exportExcelToTarget(response, null, list, PaUserExcel.class); } + /** + * @param wxMpUser + * @return + * @Author sun + * @Description 根据openId新增或更新用户信息 + **/ + @PostMapping(value = "/saveuser") + public Result saveUser(@RequestBody WxMpUser wxMpUser) { + return new Result().ok(paUserService.saveUser(wxMpUser)); + } + + /** + * @param phone + * @return + * @Author sun + * @Description 根据手机号查询公众号用户基本信息,校验用户是否存在 + **/ + @PostMapping(value = "/checkpauser/{phone}") + public Result checkPaUser(@PathVariable("phone") String phone) { + return new Result().ok(paUserService.checkPaUser(phone)); + } + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserVisitedController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserVisitedController.java index c89fee64a4..16f5caab3a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserVisitedController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserVisitedController.java @@ -23,9 +23,10 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.PaUserVisitedDTO; +import com.epmet.dto.form.SaveUserVisitedFormDTO; import com.epmet.excel.PaUserVisitedExcel; import com.epmet.service.PaUserVisitedService; import org.springframework.beans.factory.annotation.Autowired; @@ -91,4 +92,16 @@ public class PaUserVisitedController { ExcelUtils.exportExcelToTarget(response, null, list, PaUserVisitedExcel.class); } + /** + * @param visited + * @return + * @Author sun + * @Description 用户登陆,新增访问记录数据 + **/ + @PostMapping(value = "/saveuservisited") + public Result saveUserVisited(@RequestBody SaveUserVisitedFormDTO visited) { + paUserVisitedService.saveUserVisited(visited); + return new Result(); + } + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java index 7dc41a284b..ac4f9cd20f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.PaCustomerDTO; import com.epmet.entity.PaCustomerEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 客户信息 @@ -29,5 +33,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface PaCustomerDao extends BaseDao { - + + /** + * @param userId + * @return + * @Author sun + * @Description 公众号-根据userId查询用户对应的客户信息 + **/ + List selectCustomerByUserId(@Param("userId") String userId); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserDao.java index 858ac17cb2..2ced9f5760 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserDao.java @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.PaUserDTO; import com.epmet.entity.PaUserEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 公众号用户信息 @@ -29,5 +33,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface PaUserDao extends BaseDao { - + + /** + * @param phone + * @return + * @Author sun + * @Description 根据手机号查询公众号用户基本信息,校验用户是否存在 + **/ + List selectUserByPhone(@Param("phone") String phone); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java index 29e11cb876..8d3f6a6351 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java @@ -18,8 +18,10 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.PaUserWechatDTO; import com.epmet.entity.PaUserWechatEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 公众号用户信息 @@ -29,5 +31,20 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface PaUserWechatDao extends BaseDao { - + + /** + * @param openId + * @return + * @Author sun + * @Description 根据openId查询user_wechat表信息 + **/ + PaUserWechatDTO selectWechatByOpenId(@Param("openId") String openId); + + /** + * @param dto + * @return + * @Author sun + * @Description 根据userId查询user_wechat表信息 + **/ + PaUserWechatEntity selectWechatByUserId(PaUserWechatDTO dto); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java index f5773ca85f..30ba4b4b15 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java @@ -54,13 +54,8 @@ public class CustomerMpEntity extends BaseEpmetEntity { private Integer appId; /** - * 是否已经授权 + * 是否已经授权 0:未授权,1:已授权 */ private Integer authorizationFlag; - /** - * 公众账号信息id - */ - private String authorizerInfoId; - } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserWechatEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserWechatEntity.java index 61cb92e0b8..c618051cb8 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserWechatEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserWechatEntity.java @@ -53,11 +53,6 @@ public class PaUserWechatEntity extends BaseEpmetEntity { */ private String unionId; - /** - * 手机号 - */ - private String phone; - /** * 1男2女0未知 */ @@ -88,11 +83,6 @@ public class PaUserWechatEntity extends BaseEpmetEntity { */ private String city; - /** - * 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) - */ - private String privilege; - /** * 语言 */ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java index b4f62eb57f..5c9549a265 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java @@ -43,12 +43,9 @@ public class CustomerMpExcel { @Excel(name = "小程序的appId") private Integer appId; - @Excel(name = "是否已经授权") + @Excel(name = "是否已经授权:0.未授权 1.已授权") private Integer authorizationFlag; - @Excel(name = "公众账号信息id") - private String authorizerInfoId; - @Excel(name = "删除标识:0.未删除 1.已删除") private Integer delFlag; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserWechatExcel.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserWechatExcel.java index 2e7b5ba12d..1ddb2bf024 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserWechatExcel.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserWechatExcel.java @@ -43,9 +43,6 @@ public class PaUserWechatExcel { @Excel(name = "") private String unionId; - @Excel(name = "手机号") - private String phone; - @Excel(name = "1男2女0未知") private String gender; @@ -64,9 +61,6 @@ public class PaUserWechatExcel { @Excel(name = "城市") private String city; - @Excel(name = "用户特权信息,json 数组,如微信沃卡用户为(chinaunicom)") - private String privilege; - @Excel(name = "语言") private String language; 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 65586defbf..9bb1547dcf 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 @@ -19,7 +19,11 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.PaCustomerDTO; +import com.epmet.dto.form.CreateAgencyFormDTO; +import com.epmet.dto.form.RegisterFormDTO; +import com.epmet.dto.result.CreateAgencyResultDTO; import com.epmet.entity.PaCustomerEntity; import java.util.List; @@ -92,4 +96,29 @@ public interface PaCustomerService extends BaseService { * @date 2020-07-09 */ void delete(String[] ids); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-手机号注册 + **/ + void register(RegisterFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-创建组织 + **/ + CreateAgencyResultDTO createAgency(TokenDto tokenDTO, CreateAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-查询我的信息 + **/ + CreateAgencyResultDTO myInfo(CreateAgencyFormDTO formDTO); + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserService.java index b55098f052..c9208eef81 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserService.java @@ -20,7 +20,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.PaUserDTO; +import com.epmet.dto.result.CustomerUserResultDTO; +import com.epmet.dto.result.SaveUserResultDTO; import com.epmet.entity.PaUserEntity; +import me.chanjar.weixin.mp.bean.result.WxMpUser; import java.util.List; import java.util.Map; @@ -92,4 +95,20 @@ public interface PaUserService extends BaseService { * @date 2020-07-09 */ void delete(String[] ids); + + /** + * @param wxMpUser + * @return + * @Author sun + * @Description 根据openId新增或更新用户信息 + **/ + SaveUserResultDTO saveUser(WxMpUser wxMpUser); + + /** + * @param phone + * @return + * @Author sun + * @Description 根据手机号查询公众号用户基本信息,校验用户是否存在 + **/ + CustomerUserResultDTO checkPaUser(String phone); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserVisitedService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserVisitedService.java index 130e9d693c..d67c581dea 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserVisitedService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserVisitedService.java @@ -20,6 +20,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.PaUserVisitedDTO; +import com.epmet.dto.form.SaveUserVisitedFormDTO; import com.epmet.entity.PaUserVisitedEntity; import java.util.List; @@ -92,4 +93,12 @@ public interface PaUserVisitedService extends BaseService { * @date 2020-07-09 */ void delete(String[] ids); + + /** + * @param visited + * @return + * @Author sun + * @Description 用户登陆,新增访问记录数据 + **/ + void saveUserVisited(SaveUserVisitedFormDTO visited); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java index 1a613c796d..31c520d793 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java @@ -92,4 +92,12 @@ public interface PaUserWechatService extends BaseService { * @date 2020-07-09 */ void delete(String[] ids); + + /** + * @param openId + * @return + * @Author sun + * @Description 根据openId查询user_wechat表信息 + **/ + PaUserWechatDTO getWechatByOpenId(String openId); } \ 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 c1dc9b68f5..7c51bfadc2 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 @@ -19,16 +19,37 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.common.token.constant.LoginConstant; 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.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; 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.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.constant.PaConstant; import com.epmet.dao.PaCustomerDao; +import com.epmet.dao.PaUserDao; +import com.epmet.dao.PaUserVisitedDao; +import com.epmet.dao.PaUserWechatDao; import com.epmet.dto.PaCustomerDTO; +import com.epmet.dto.PaUserDTO; +import com.epmet.dto.PaUserWechatDTO; +import com.epmet.dto.form.CreateAgencyFormDTO; +import com.epmet.dto.form.RegisterFormDTO; +import com.epmet.dto.result.CreateAgencyResultDTO; import com.epmet.entity.PaCustomerEntity; +import com.epmet.entity.PaUserEntity; +import com.epmet.entity.PaUserVisitedEntity; +import com.epmet.entity.PaUserWechatEntity; import com.epmet.redis.PaCustomerRedis; import com.epmet.service.PaCustomerService; import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -46,8 +67,17 @@ import java.util.Map; @Service public class PaCustomerServiceImpl extends BaseServiceImpl implements PaCustomerService { + private Logger logger = LogManager.getLogger(PaCustomerServiceImpl.class); @Autowired private PaCustomerRedis paCustomerRedis; + @Autowired + private PaUserDao paUserDao; + @Autowired + private PaUserWechatDao paUserWechatDao; + @Autowired + private PaUserVisitedDao paUserVisitedDao; + @Autowired + private RedisUtils redisUtils; @Override public PageData page(Map params) { @@ -101,4 +131,81 @@ public class PaCustomerServiceImpl extends BaseServiceImpl userList = paUserDao.selectUserByPhone(formDTO.getPhone()); + if (null != userList || userList.size() > NumConstant.ZERO) { + throw new RenException(PaConstant.PHONE_EXCEPTION); + } + + //2.校验验证码是否正确 + String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_PUBLIC, LoginConstant.CLIENT_MP, formDTO.getPhone()); + String rightSmsCode = (String) redisUtils.get(smsCodeKey); + if (!formDTO.getSmsCode().equals(rightSmsCode)) { + logger.error(String.format("验证码错误code[%s],msg[%s]", EpmetErrorCode.MOBILE_CODE_ERROR.getCode(), EpmetErrorCode.MOBILE_CODE_ERROR.getMsg())); + throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); + } + + //3.pa_user表更新数据 + PaUserEntity userEntity = new PaUserEntity(); + userEntity.setId(formDTO.getUserId()); + userEntity.setPhone(formDTO.getPhone()); + userEntity.setRealName(formDTO.getSurName()); + userEntity.setGender(formDTO.getGender().toString()); + paUserDao.updateById(userEntity); + + //2.访问记录表新增数据 + PaUserWechatDTO dto = new PaUserWechatDTO(); + dto.setUserId(formDTO.getUserId()); + PaUserWechatEntity wechatEntity = paUserWechatDao.selectWechatByUserId(dto); + if (null == wechatEntity) { + throw new RenException(PaConstant.SELECT_WECHAT_EXCEPTION); + } + PaUserVisitedEntity visitedEntity = new PaUserVisitedEntity(); + visitedEntity.setUserId(formDTO.getUserId()); + visitedEntity.setWxOpenId(wechatEntity.getWxOpenId()); + visitedEntity.setOpenId(wechatEntity.getWxOpenId()); + visitedEntity.setPhone(formDTO.getPhone()); + paUserVisitedDao.insert(visitedEntity); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-创建组织 + **/ + @Override + public CreateAgencyResultDTO createAgency(TokenDto tokenDTO, CreateAgencyFormDTO formDTO) { + //1.客户表初始化数据 + //2.客户组织表初始化数据 + //3. + //4. + //5. + + + return null; + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-查询我的信息 + **/ + @Override + public CreateAgencyResultDTO myInfo(CreateAgencyFormDTO formDTO) { + return null; + } + + + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java index d902604396..30cd0baed0 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java @@ -20,14 +20,23 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.PaCustomerDao; import com.epmet.dao.PaUserDao; +import com.epmet.dto.PaCustomerDTO; import com.epmet.dto.PaUserDTO; +import com.epmet.dto.PaUserWechatDTO; +import com.epmet.dto.result.CustomerUserResultDTO; +import com.epmet.dto.result.SaveUserResultDTO; import com.epmet.entity.PaUserEntity; +import com.epmet.entity.PaUserWechatEntity; import com.epmet.redis.PaUserRedis; import com.epmet.service.PaUserService; +import com.epmet.service.PaUserWechatService; +import me.chanjar.weixin.mp.bean.result.WxMpUser; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -48,6 +57,10 @@ public class PaUserServiceImpl extends BaseServiceImpl @Autowired private PaUserRedis paUserRedis; + @Autowired + private PaUserWechatService paUserWechatService; + @Autowired + private PaCustomerDao paCustomerDao; @Override public PageData page(Map params) { @@ -101,4 +114,80 @@ public class PaUserServiceImpl extends BaseServiceImpl baseDao.deleteBatchIds(Arrays.asList(ids)); } + /** + * @param wxMpUser + * @return + * @Author sun + * @Description 根据openId新增或更新用户信息 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public SaveUserResultDTO saveUser(WxMpUser wxMpUser) { + SaveUserResultDTO resultDTO = new SaveUserResultDTO(); + //1.根据openId查询user_wechat表是否存在用户信息 + PaUserWechatDTO wechatDTO = paUserWechatService.getWechatByOpenId(wxMpUser.getOpenId()); + + //2.不存在则新增用户信息,存在则更新user_wechat表信息 + if (null == wechatDTO || null == wechatDTO.getId()) { + //2.1、user表新增数据 + PaUserEntity userEntity = new PaUserEntity(); + baseDao.insert(userEntity); + //2.2、user_wechat表新增数据 + PaUserWechatEntity wechatEntity = new PaUserWechatEntity(); + wechatEntity.setUserId(userEntity.getId()); + wechatEntity.setWxOpenId(wxMpUser.getOpenId()); + wechatEntity.setUnionId(wxMpUser.getUnionId()); + wechatEntity.setGender(wxMpUser.getSex().toString()); + wechatEntity.setNickname(wxMpUser.getNickname()); + wechatEntity.setHeadImgUrl(wxMpUser.getHeadImgUrl()); + wechatEntity.setCountry(wxMpUser.getCountry()); + wechatEntity.setProvince(wxMpUser.getProvince()); + wechatEntity.setCity(wxMpUser.getCity()); + wechatEntity.setLanguage(wxMpUser.getLanguage()); + paUserWechatService.insert(wechatEntity); + + resultDTO.setUserId(userEntity.getId()); + } else { + //2.3、更新user_wechat表数据 + PaUserWechatEntity wechatEntity = ConvertUtils.sourceToTarget(wechatDTO, PaUserWechatEntity.class); + wechatEntity.setGender(wxMpUser.getSex().toString()); + wechatEntity.setNickname(wxMpUser.getNickname()); + wechatEntity.setHeadImgUrl(wxMpUser.getHeadImgUrl()); + wechatEntity.setCountry(wxMpUser.getCountry()); + wechatEntity.setProvince(wxMpUser.getProvince()); + wechatEntity.setCity(wxMpUser.getCity()); + wechatEntity.setLanguage(wxMpUser.getLanguage()); + paUserWechatService.updateById(wechatEntity); + + resultDTO.setUserId(wechatDTO.getUserId()); + } + + //3.返回userId + return resultDTO; + } + + /** + * @param phone + * @return + * @Author sun + * @Description 根据手机号查询公众号用户基本信息,校验用户是否存在 + **/ + @Override + public CustomerUserResultDTO checkPaUser(String phone) { + CustomerUserResultDTO resultDTO = new CustomerUserResultDTO(); + List userList = baseDao.selectUserByPhone(phone); + if (null == userList || userList.size() < NumConstant.ONE) { + resultDTO.setPaUserResult(new PaUserDTO()); + resultDTO.setPaCustomerResult(new PaCustomerDTO()); + return resultDTO; + } + PaUserDTO dto = userList.get(NumConstant.ZERO); + List customerList = paCustomerDao.selectCustomerByUserId(dto.getId()); + + resultDTO.setPaUserResult(dto); + resultDTO.setPaCustomerResult(customerList.size() > NumConstant.ZERO ? customerList.get(NumConstant.ZERO) : new PaCustomerDTO()); + + return resultDTO; + } + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserVisitedServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserVisitedServiceImpl.java index fd00039467..2071fde88f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserVisitedServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserVisitedServiceImpl.java @@ -20,12 +20,16 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.PaUserVisitedDao; +import com.epmet.dao.PaUserWechatDao; import com.epmet.dto.PaUserVisitedDTO; +import com.epmet.dto.PaUserWechatDTO; +import com.epmet.dto.form.SaveUserVisitedFormDTO; import com.epmet.entity.PaUserVisitedEntity; +import com.epmet.entity.PaUserWechatEntity; import com.epmet.redis.PaUserVisitedRedis; import com.epmet.service.PaUserVisitedService; import org.apache.commons.lang3.StringUtils; @@ -48,6 +52,8 @@ public class PaUserVisitedServiceImpl extends BaseServiceImpl page(Map params) { @@ -101,4 +107,35 @@ public class PaUserVisitedServiceImpl extends BaseServiceImpl + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserDao.xml index 505b33576c..56db230fa9 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserDao.xml @@ -3,5 +3,17 @@ + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml index a6e8b4ce94..8f77d5598e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml @@ -3,5 +3,48 @@ + + + \ No newline at end of file From 1314f96d17f92d1f11e7d54f1a3b4c1f0ed7235c Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 14 Jul 2020 13:36:53 +0800 Subject: [PATCH 47/90] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1-=E5=88=9B=E5=BB=BA=E7=BB=84=E7=BB=87=E3=80=81?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BB=84=E7=BB=87=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/CreateAgencyFormDTO.java | 6 +- .../dto/result/AgencyLevelListResultDTO.java | 25 ++++ .../dto/result/CreateAgencyResultDTO.java | 4 + .../java/com/epmet/constant/PaConstant.java | 18 +++ .../controller/PaCustomerController.java | 13 +++ .../com/epmet/service/PaCustomerService.java | 7 ++ .../service/impl/PaCustomerServiceImpl.java | 108 ++++++++++++++++-- 7 files changed, 167 insertions(+), 14 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AgencyLevelListResultDTO.java diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateAgencyFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateAgencyFormDTO.java index dec52622c8..4ab159bb59 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateAgencyFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateAgencyFormDTO.java @@ -37,17 +37,17 @@ public class CreateAgencyFormDTO implements Serializable { /** * 省(中国字) */ - private String province; + private String province = ""; /** * 市(中国字) */ - private String city; + private String city = ""; /** * 区(中国字) */ - private String district; + private String district = ""; /** * 党支部数量 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AgencyLevelListResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AgencyLevelListResultDTO.java new file mode 100644 index 0000000000..6f879233f3 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AgencyLevelListResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author sun + * @Description 公众号-查询组织级别-接口返参 + */ +@Data +public class AgencyLevelListResultDTO implements Serializable { + + private static final long serialVersionUID = 3253989119352850315L; + + /** + * 机关级别(社区级:community, 乡(镇、街道)级:street, 区县级: district, 市级: city 省级:province) + */ + private String levelKey; + /** + * 级别对应的名称 + */ + private String levelName; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateAgencyResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateAgencyResultDTO.java index f344e5c062..285b662e40 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateAgencyResultDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateAgencyResultDTO.java @@ -19,5 +19,9 @@ public class CreateAgencyResultDTO implements Serializable { * 新增客户Id */ private String customerId; + /** + * 包含customerId的token + */ + private String token; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java index ee15ddf636..80ed388deb 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java @@ -10,10 +10,28 @@ public interface PaConstant { * 手机号注册 */ String PHONE_EXCEPTION = "手机号已存在,不允许再次注册"; + /** * 根据userId查询pa_user_wechat表失败 */ String SELECT_WECHAT_EXCEPTION = "获取用户微信信息失败"; + /** + * 组织级别对应的key、name + */ + String PROVINCE_KEY = "province"; + String PROVINCE_NAME = "省级"; + String CITY_KEY = "city"; + String CITY_NAME = "区县级"; + String STREET_KEY = "street"; + String STREET_NAME = "乡(镇、街道)级"; + String COMMUNITY_KEY = "community"; + String COMMUNITY_NAME = "社区级"; + + /** + * 客户小程序关系表小程序所属端 + */ + String RESI_CLIENT = "resi"; + String WORK_CLIENT = "work"; } 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 5f8f9f5660..4f0443c376 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 @@ -7,6 +7,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.form.CreateAgencyFormDTO; import com.epmet.dto.form.RegisterFormDTO; +import com.epmet.dto.result.AgencyLevelListResultDTO; import com.epmet.dto.result.CreateAgencyResultDTO; import com.epmet.service.*; import org.springframework.beans.factory.annotation.Autowired; @@ -15,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * 公众号用户的注册、客户创建、跟组织创建 ,查询我的详情等等...api写在这 * @@ -50,6 +53,16 @@ public class PaCustomerController { return new Result(); } + /** + * @return + * @Author sun + * @Description 公众号-查询组织级别 + **/ + @PostMapping("agencylevellist") + public Result> agencyLevelList() { + return new Result>().ok(paCustomerService.agencyLevelList()); + } + /** * @param formDTO * @return 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 9bb1547dcf..08d5c88373 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 @@ -23,6 +23,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.PaCustomerDTO; import com.epmet.dto.form.CreateAgencyFormDTO; import com.epmet.dto.form.RegisterFormDTO; +import com.epmet.dto.result.AgencyLevelListResultDTO; import com.epmet.dto.result.CreateAgencyResultDTO; import com.epmet.entity.PaCustomerEntity; @@ -121,4 +122,10 @@ public interface PaCustomerService extends BaseService { **/ CreateAgencyResultDTO myInfo(CreateAgencyFormDTO formDTO); + /** + * @return + * @Author sun + * @Description 公众号-查询组织级别 + **/ + List agencyLevelList(); } \ 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 7c51bfadc2..766973bc4a 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 @@ -30,6 +30,7 @@ import com.epmet.commons.tools.redis.RedisKeys; 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.PaConstant; import com.epmet.dao.PaCustomerDao; import com.epmet.dao.PaUserDao; @@ -40,13 +41,14 @@ import com.epmet.dto.PaUserDTO; import com.epmet.dto.PaUserWechatDTO; import com.epmet.dto.form.CreateAgencyFormDTO; import com.epmet.dto.form.RegisterFormDTO; +import com.epmet.dto.result.AgencyLevelListResultDTO; import com.epmet.dto.result.CreateAgencyResultDTO; -import com.epmet.entity.PaCustomerEntity; -import com.epmet.entity.PaUserEntity; -import com.epmet.entity.PaUserVisitedEntity; -import com.epmet.entity.PaUserWechatEntity; +import com.epmet.entity.*; import com.epmet.redis.PaCustomerRedis; +import com.epmet.service.CustomerMpService; +import com.epmet.service.PaCustomerAgencyService; import com.epmet.service.PaCustomerService; +import com.epmet.service.PaCustomerUserAgencyService; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -54,6 +56,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -78,6 +81,14 @@ public class PaCustomerServiceImpl extends BaseServiceImpl page(Map params) { @@ -95,8 +106,8 @@ public class PaCustomerServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -177,6 +188,33 @@ public class PaCustomerServiceImpl extends BaseServiceImpl agencyLevelList() { + List list = new ArrayList<>(); + AgencyLevelListResultDTO dto1 = new AgencyLevelListResultDTO(); + dto1.setLevelKey(PaConstant.PROVINCE_KEY); + dto1.setLevelName(PaConstant.PROVINCE_NAME); + list.add(dto1); + AgencyLevelListResultDTO dto2 = new AgencyLevelListResultDTO(); + dto2.setLevelKey(PaConstant.CITY_KEY); + dto2.setLevelName(PaConstant.CITY_NAME); + list.add(dto2); + AgencyLevelListResultDTO dto3 = new AgencyLevelListResultDTO(); + dto3.setLevelKey(PaConstant.STREET_KEY); + dto3.setLevelName(PaConstant.STREET_NAME); + list.add(dto3); + AgencyLevelListResultDTO dto4 = new AgencyLevelListResultDTO(); + dto4.setLevelKey(PaConstant.COMMUNITY_KEY); + dto4.setLevelName(PaConstant.COMMUNITY_NAME); + list.add(dto4); + return list; + } + /** * @param formDTO * @return @@ -184,15 +222,64 @@ public class PaCustomerServiceImpl extends BaseServiceImpl listEntity = new ArrayList<>(); + CustomerMpEntity mpEntity1 = new CustomerMpEntity(); + mpEntity1.setCustomerId(entity.getId()); + mpEntity1.setAuthorizationFlag(NumConstant.ZERO); + mpEntity1.setClient(PaConstant.RESI_CLIENT); + listEntity.add(mpEntity1); + CustomerMpEntity mpEntity2 = ConvertUtils.sourceToTarget(mpEntity1, CustomerMpEntity.class); + mpEntity2.setClient(PaConstant.WORK_CLIENT); + listEntity.add(mpEntity2); + customerMpService.insertBatch(listEntity); + + //5.token中添加customerId + //5-1.获取redis中的token + //获取缓存中的token + TokenDto redisTokenDTO = cpUserDetailRedis.get(LoginConstant.APP_PUBLIC, LoginConstant.CLIENT_MP, tokenDTO.getUserId(), TokenDto.class); + if (redisTokenDTO == null) { + return null; + } + //5-2.添加customerId + redisTokenDTO.setCustomerId(entity.getId()); + //获取key的剩余过期时间 + String key = RedisKeys.getCpUserKey(LoginConstant.APP_PUBLIC, LoginConstant.CLIENT_MP, tokenDTO.getUserId()); + long expire = redisUtils.getExpire(key); + cpUserDetailRedis.set(redisTokenDTO, expire); + + //6.接口返参 + CreateAgencyResultDTO resultDTO = new CreateAgencyResultDTO(); + resultDTO.setCustomerId(entity.getId()); + resultDTO.setToken(redisTokenDTO.getToken()); + + return resultDTO; } /** @@ -207,5 +294,4 @@ public class PaCustomerServiceImpl extends BaseServiceImpl Date: Tue, 14 Jul 2020 14:30:55 +0800 Subject: [PATCH 48/90] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1-=E6=9F=A5=E8=AF=A2=E6=88=91=E7=9A=84=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/MyInfoFormDTO.java | 26 +++++++++ .../com/epmet/dto/result/MyInfoResultDTO.java | 53 +++++++++++++++++++ .../java/com/epmet/constant/PaConstant.java | 15 ++++++ .../controller/PaCustomerController.java | 8 +-- .../java/com/epmet/dao/CustomerMpDao.java | 13 ++++- .../com/epmet/dao/PaCustomerAgencyDao.java | 8 +++ .../com/epmet/service/PaCustomerService.java | 17 +++--- .../service/impl/PaCustomerServiceImpl.java | 43 +++++++++++---- .../main/resources/mapper/CustomerMpDao.xml | 15 ++++++ .../resources/mapper/PaCustomerAgencyDao.xml | 18 +++++++ 10 files changed, 196 insertions(+), 20 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MyInfoFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/MyInfoResultDTO.java diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MyInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MyInfoFormDTO.java new file mode 100644 index 0000000000..78cafaa63b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MyInfoFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author sun + * @Description 公众号-查询我的信息-接口入参 + */ +@Data +public class MyInfoFormDTO implements Serializable { + + private static final long serialVersionUID = -6547893374373422628L; + + public interface AddUserInternalGroup { + } + + /** + * 客户Id + */ + @NotBlank(message = "客户Id不能为空", groups = {MyInfoFormDTO.AddUserInternalGroup.class}) + private String customerId; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/MyInfoResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/MyInfoResultDTO.java new file mode 100644 index 0000000000..3d75eaed38 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/MyInfoResultDTO.java @@ -0,0 +1,53 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author sun + * @Description 公众号-查询我的信息-接口返参 + */ +@Data +public class MyInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 3253989119352850315L; + + /** + * 客户Id + */ + private String customerId = ""; + /** + * 组织名称 + */ + private String agencyName = ""; + /** + * 新增客户Id + */ + private String level = ""; + /** + * 包含customerId的token + */ + private String province = ""; + /** + * 新增客户Id + */ + private String city = ""; + /** + * 包含customerId的token + */ + private String district = ""; + /** + * 新增客户Id + */ + private Integer partyBranchNum; + /** + * 包含customerId的token + */ + private Integer resiAuthorization; + /** + * 新增客户Id + */ + private Integer workAuthorization; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java index 80ed388deb..e523ba6fbd 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java @@ -34,4 +34,19 @@ public interface PaConstant { String RESI_CLIENT = "resi"; String WORK_CLIENT = "work"; + /** + * 查询客户组织信息失败 + */ + String SELECT_AGENCY_EXCEPTION = "获取客户组织信息失败"; + /** + * 查询客户小程序授权信息失败 + */ + String CUSTOMER_MP_EXCEPTION = "获取客户小程序授权信息失败"; + + /** + * 客户小程序所属端key值 + */ + String CLIENT_RESI = "resi"; + String CLIENT_WORK = "work"; + } 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 4f0443c376..0b32a836a7 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 @@ -6,9 +6,11 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.form.CreateAgencyFormDTO; +import com.epmet.dto.form.MyInfoFormDTO; import com.epmet.dto.form.RegisterFormDTO; import com.epmet.dto.result.AgencyLevelListResultDTO; import com.epmet.dto.result.CreateAgencyResultDTO; +import com.epmet.dto.result.MyInfoResultDTO; import com.epmet.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -82,9 +84,9 @@ public class PaCustomerController { * @Description 公众号-查询我的信息 **/ @PostMapping("myinfo") - public Result myInfo(@LoginUser TokenDto tokenDTO, @RequestBody CreateAgencyFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, DefaultGroup.class); - return new Result().ok(paCustomerService.myInfo(formDTO)); + public Result myInfo(@LoginUser TokenDto tokenDTO, @RequestBody MyInfoFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, MyInfoFormDTO.AddUserInternalGroup.class); + return new Result().ok(paCustomerService.myInfo(formDTO)); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java index 2c7d386261..e868d6c4d5 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomerMpDTO; import com.epmet.entity.CustomerMpEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 客户小程序关系表 @@ -29,5 +33,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerMpDao extends BaseDao { - + + /** + * @param customerId + * @return + * @Author sun + * @Description 查询客户小程序授权结果信息 + **/ + List selectByCustomerId(@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/PaCustomerAgencyDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java index 179a27459d..219d88fd83 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.PaCustomerAgencyDTO; import com.epmet.entity.PaCustomerAgencyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -38,4 +39,11 @@ public interface PaCustomerAgencyDao extends BaseDao { */ String getCustomerIdByUserId(@Param("userId")String userId); + /** + * @param customerId + * @return + * @Author sun + * @Description 公众号-查询客户组织信息 + **/ + PaCustomerAgencyDTO selectCustomerAgency(@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/service/PaCustomerService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java index 08d5c88373..765f4fd94d 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 @@ -22,9 +22,11 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.PaCustomerDTO; import com.epmet.dto.form.CreateAgencyFormDTO; +import com.epmet.dto.form.MyInfoFormDTO; import com.epmet.dto.form.RegisterFormDTO; import com.epmet.dto.result.AgencyLevelListResultDTO; import com.epmet.dto.result.CreateAgencyResultDTO; +import com.epmet.dto.result.MyInfoResultDTO; import com.epmet.entity.PaCustomerEntity; import java.util.List; @@ -107,25 +109,26 @@ public interface PaCustomerService extends BaseService { void register(RegisterFormDTO formDTO); /** - * @param formDTO * @return * @Author sun - * @Description 公众号-创建组织 + * @Description 公众号-查询组织级别 **/ - CreateAgencyResultDTO createAgency(TokenDto tokenDTO, CreateAgencyFormDTO formDTO); + List agencyLevelList(); /** * @param formDTO * @return * @Author sun - * @Description 公众号-查询我的信息 + * @Description 公众号-创建组织 **/ - CreateAgencyResultDTO myInfo(CreateAgencyFormDTO formDTO); + CreateAgencyResultDTO createAgency(TokenDto tokenDTO, CreateAgencyFormDTO formDTO); /** + * @param formDTO * @return * @Author sun - * @Description 公众号-查询组织级别 + * @Description 公众号-查询我的信息 **/ - List agencyLevelList(); + MyInfoResultDTO myInfo(MyInfoFormDTO formDTO); + } \ 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 766973bc4a..84b676eb78 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 @@ -32,17 +32,14 @@ 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.PaConstant; -import com.epmet.dao.PaCustomerDao; -import com.epmet.dao.PaUserDao; -import com.epmet.dao.PaUserVisitedDao; -import com.epmet.dao.PaUserWechatDao; -import com.epmet.dto.PaCustomerDTO; -import com.epmet.dto.PaUserDTO; -import com.epmet.dto.PaUserWechatDTO; +import com.epmet.dao.*; +import com.epmet.dto.*; import com.epmet.dto.form.CreateAgencyFormDTO; +import com.epmet.dto.form.MyInfoFormDTO; import com.epmet.dto.form.RegisterFormDTO; import com.epmet.dto.result.AgencyLevelListResultDTO; import com.epmet.dto.result.CreateAgencyResultDTO; +import com.epmet.dto.result.MyInfoResultDTO; import com.epmet.entity.*; import com.epmet.redis.PaCustomerRedis; import com.epmet.service.CustomerMpService; @@ -80,6 +77,10 @@ public class PaCustomerServiceImpl extends BaseServiceImpl listMpDTO = customerMpDao.selectByCustomerId(formDTO.getCustomerId()); + if (null == agencyDTO || listMpDTO.size() != NumConstant.TWO) { + throw new RenException(PaConstant.CUSTOMER_MP_EXCEPTION); + } + + //3.封装结果信息 + MyInfoResultDTO resultDTO = ConvertUtils.sourceToTarget(agencyDTO, MyInfoResultDTO.class); + for (CustomerMpDTO mp : listMpDTO) { + if (PaConstant.CLIENT_RESI.equals(mp.getClient())) { + resultDTO.setResiAuthorization(mp.getAuthorizationFlag()); + } + if (PaConstant.CLIENT_WORK.equals(mp.getClient())) { + resultDTO.setWorkAuthorization(mp.getAuthorizationFlag()); + } + } + + return resultDTO; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml index a348e795ed..14d322bee1 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml @@ -3,5 +3,20 @@ + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml index 420dfac6ad..486519d844 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml @@ -15,4 +15,22 @@ AND pcua.user_id = #{userId} + + \ No newline at end of file From 3b404b89c4e98aae0144c7f7bf94c0d16cb75cfa Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Tue, 14 Jul 2020 14:50:02 +0800 Subject: [PATCH 49/90] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/utils/HttpClientManager.java | 65 +++++++ .../com/epmet/dto/CodeAuditResultDTO.java | 96 ++++++++++ .../java/com/epmet/dto/CodeCustomerDTO.java | 121 ++++++++++++ .../main/java/com/epmet/dto/CodeMediaDTO.java | 91 +++++++++ .../dto/CustomerCodeOperationHistoryDTO.java | 96 ++++++++++ .../com/epmet/dto/form/CodeUploadFormDTO.java | 46 +++++ .../controller/CodeAuditResultController.java | 84 ++++++++ .../com/epmet/controller/CodeController.java | 30 +++ .../controller/CodeCustomerController.java | 84 ++++++++ .../epmet/controller/CodeMediaController.java | 84 ++++++++ ...ustomerCodeOperationHistoryController.java | 84 ++++++++ .../com/epmet/dao/CodeAuditResultDao.java | 33 ++++ .../java/com/epmet/dao/CodeCustomerDao.java | 33 ++++ .../main/java/com/epmet/dao/CodeMediaDao.java | 33 ++++ .../dao/CustomerCodeOperationHistoryDao.java | 33 ++++ .../epmet/entity/CodeAuditResultEntity.java | 66 +++++++ .../com/epmet/entity/CodeCustomerEntity.java | 91 +++++++++ .../com/epmet/entity/CodeMediaEntity.java | 61 ++++++ .../CustomerCodeOperationHistoryEntity.java | 66 +++++++ .../com/epmet/redis/CodeAuditResultRedis.java | 47 +++++ .../com/epmet/redis/CodeCustomerRedis.java | 47 +++++ .../java/com/epmet/redis/CodeMediaRedis.java | 47 +++++ .../CustomerCodeOperationHistoryRedis.java | 47 +++++ .../epmet/service/CodeAuditResultService.java | 95 ++++++++++ .../epmet/service/CodeCustomerService.java | 95 ++++++++++ .../com/epmet/service/CodeMediaService.java | 95 ++++++++++ .../java/com/epmet/service/CodeService.java | 12 ++ .../CustomerCodeOperationHistoryService.java | 95 ++++++++++ .../impl/CodeAuditResultServiceImpl.java | 104 ++++++++++ .../service/impl/CodeCustomerServiceImpl.java | 104 ++++++++++ .../service/impl/CodeMediaServiceImpl.java | 104 ++++++++++ .../epmet/service/impl/CodeServiceImpl.java | 17 ++ ...stomerCodeOperationHistoryServiceImpl.java | 104 ++++++++++ .../wxapi/constant/WxMaCodeConstant.java | 2 +- .../wxapi/param/WxMaCodeAuditStatus.java | 9 + .../wxapi/param/WxMaCodeAuditStatusReq.java | 18 ++ .../epmet/wxapi/param/WxMaCodeCommitReq.java | 10 +- .../param/WxMaCodeSubmitAuditRequest.java | 145 ++++++++++++++ .../wxapi/result/WxMaAuditStatusResult.java | 36 ++++ .../wxapi/result/WxMaCategoryResult.java | 52 +++++ .../wxapi/result/WxMaGetCategoryResult.java | 28 +++ .../epmet/wxapi/result/WxMaGetPageResult.java | 28 +++ .../epmet/wxapi/service/WxMaCodeService.java | 76 +++++++- .../service/impl/WxMaCodeServiceImpl.java | 179 +++++++++++++++++- .../resources/mapper/CodeAuditResultDao.xml | 22 +++ .../main/resources/mapper/CodeCustomerDao.xml | 27 +++ .../main/resources/mapper/CodeMediaDao.xml | 21 ++ .../CustomerCodeOperationHistoryDao.xml | 22 +++ 48 files changed, 2975 insertions(+), 10 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeMediaDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerCodeOperationHistoryDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeUploadFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeAuditResultController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeCustomerController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeMediaController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CustomerCodeOperationHistoryController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeMediaDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerCodeOperationHistoryDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeAuditResultEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeMediaEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerCodeOperationHistoryEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeAuditResultRedis.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeCustomerRedis.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeMediaRedis.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CustomerCodeOperationHistoryRedis.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeAuditResultService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeCustomerService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeMediaService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CustomerCodeOperationHistoryService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeAuditResultServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeMediaServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerCodeOperationHistoryServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeAuditStatus.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeAuditStatusReq.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaAuditStatusResult.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaCategoryResult.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaGetCategoryResult.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaGetPageResult.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeMediaDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerCodeOperationHistoryDao.xml diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 2cfaed7588..261153eea7 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -8,6 +8,7 @@ import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; @@ -27,7 +28,10 @@ import org.springframework.util.CollectionUtils; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; +import java.io.ByteArrayOutputStream; +import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; @@ -204,6 +208,67 @@ public class HttpClientManager { return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); } + /** + * desc: 发送get请求 + * param:url, params + * return: CallResult + * date: 2019/2/21 9:16 + * + * @author: jianjun liu + */ + public Result sendGetFile(String url, Map params) { + + try { + URIBuilder builder = new URIBuilder(url); + if (!CollectionUtils.isEmpty(params)) { + Set set = params.keySet(); + for (String key : set) { + builder.setParameter(key, params.get(key) == null ? "" : String.valueOf(params.get(key))); + } + } + HttpGet httpGet = new HttpGet(builder.build()); + httpGet.setConfig(requestConfig); + return executeToByte(httpGet); + } catch (Exception e) { + log.error("sendGet exception", e); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + } + + private Result executeToByte(HttpRequestBase httpMethod) { + CloseableHttpResponse response = null; + try { + response = httpclient.execute(httpMethod); + log.debug("http send response:{}", JSON.toJSONString(response)); + if (response != null && response.getStatusLine() != null) { + if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { + InputStream in = response.getEntity().getContent(); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + byte[] buffer = new byte[4096]; + int n = 0; + while (-1 != (n = in.read(buffer))) { + output.write(buffer, 0, n); + } + return new Result().ok(ArrayUtils.toObject(output.toByteArray())); + } else { + log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode()); + } + } + } catch (Exception e) { + log.error("execute exception", e); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + } finally { + httpMethod.releaseConnection(); + try { + if (response != null) { + response.close(); + } + } catch (IOException e) { + } + } + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + public static void main(String[] args) { String url = "http://localhost:8107/epmetscan/api/textSyncScan"; TextTaskDTO p = new TextTaskDTO(); diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditResultDTO.java new file mode 100644 index 0000000000..8068f8f07b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditResultDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 代码审核j结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class CodeAuditResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 代码ID + */ + private String codeId; + + /** + * 审核ID + */ + private String auditId; + + /** + * 审核结果 审核中:auditing,审核成功audit_success,审核被拒绝audit_failed,已撤回:withdrawn,审核延后:delay + */ + private String result; + + /** + * 原因 + */ + private String reason; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 是否删除 + */ + private String delFlag; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java new file mode 100644 index 0000000000..960b9035cb --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java @@ -0,0 +1,121 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 客户代码关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class CodeCustomerDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户名 + */ + private String customerName; + + /** + * 小程序接口调用令牌ID + */ + private String accessTokenId; + + /** + * 模板ID + */ + private String templateId; + + /** + * 小程序类型 居民端resi,工作端work + */ + private String type; + + /** + * APPID + */ + private String appId; + + /** + * 自定义配置 + */ + private String extJson; + + /** + * 代码版本号 + */ + private String userVersion; + + /** + * 代码描述 + */ + private String userDesc; + + /** + * 状态 未审核:unaudited,审核中:auditing,审核成功audit_success,审核被拒绝audit_failed,已撤回:withdrawn,审核延后:delay,发布成功release_success, 发布失败release_failed + */ + private String status; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 是否删除 + */ + private String delFlag; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeMediaDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeMediaDTO.java new file mode 100644 index 0000000000..09332ac8a3 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeMediaDTO.java @@ -0,0 +1,91 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 代码素材 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class CodeMediaDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 代码ID + */ + private String codeId; + + /** + * 素材ID + */ + private String mediaId; + + /** + * 素材名 + */ + private String mediaName; + + /** + * 素材类型 图片(image)、语音(voice)、视频(video)和缩略图(thumb) + */ + private String mediaType; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 是否删除 + */ + private String delFlag; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerCodeOperationHistoryDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerCodeOperationHistoryDTO.java new file mode 100644 index 0000000000..9d400efb40 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerCodeOperationHistoryDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 客户代码操作历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +public class CustomerCodeOperationHistoryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 代码ID + */ + private String codeId; + + /** + * 版本 + */ + private String version; + + /** + * 操作类型 操作 上传upload,审核audit,撤回undo,发布release + */ + private String operation; + + /** + * 描述 + */ + private String describe; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 是否删除 + */ + private String delFlag; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeUploadFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeUploadFormDTO.java new file mode 100644 index 0000000000..a2740c321d --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeUploadFormDTO.java @@ -0,0 +1,46 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/9 14:24 + */ +@NoArgsConstructor +@Data +public class CodeUploadFormDTO implements Serializable { + + private static final long serialVersionUID = 1295337818281424509L; + /** + * 小程序接口调用令牌ID + */ + private String accessTokenId; + /** + * 小程序类型 居民端resi, 工作段work + */ + private String type; + /** + * 客户ID + */ + private String customerId; + /** + * 代码库中的代码模板 ID + */ + private String templateId; + /** + * 第三方自定义的配置 + */ + private String extJson; + /** + * 代码版本号 + */ + private String userVersion; + /** + * 代码描述 + */ + private String userDesc; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeAuditResultController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeAuditResultController.java new file mode 100644 index 0000000000..a0524c1b48 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeAuditResultController.java @@ -0,0 +1,84 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.CodeAuditResultDTO; +import com.epmet.service.CodeAuditResultService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 代码审核j结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@RestController +@RequestMapping("codeauditresult") +public class CodeAuditResultController { + + @Autowired + private CodeAuditResultService codeAuditResultService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = codeAuditResultService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + CodeAuditResultDTO data = codeAuditResultService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody CodeAuditResultDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + codeAuditResultService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody CodeAuditResultDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + codeAuditResultService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + codeAuditResultService.delete(ids); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java new file mode 100644 index 0000000000..1e97bf9ab1 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java @@ -0,0 +1,30 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.CodeUploadFormDTO; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author zhaoqifeng + * @dscription 代码管理 + * @date 2020/7/9 11:02 + */ +@RestController +@RequestMapping("code") +public class CodeController { + + /** + * 代码上传 + * @author zhaoqifeng + * @date 2020/7/9 14:23 + * @param + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("upload") + public Result upload(@RequestBody CodeUploadFormDTO formDTO) { + return new Result<>(); + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeCustomerController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeCustomerController.java new file mode 100644 index 0000000000..d4a193821c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeCustomerController.java @@ -0,0 +1,84 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.CodeCustomerDTO; +import com.epmet.service.CodeCustomerService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 客户代码关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@RestController +@RequestMapping("codecustomer") +public class CodeCustomerController { + + @Autowired + private CodeCustomerService codeCustomerService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = codeCustomerService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + CodeCustomerDTO data = codeCustomerService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody CodeCustomerDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + codeCustomerService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody CodeCustomerDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + codeCustomerService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + codeCustomerService.delete(ids); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeMediaController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeMediaController.java new file mode 100644 index 0000000000..c8ad829979 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeMediaController.java @@ -0,0 +1,84 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.CodeMediaDTO; +import com.epmet.service.CodeMediaService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 代码素材 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@RestController +@RequestMapping("codemedia") +public class CodeMediaController { + + @Autowired + private CodeMediaService codeMediaService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = codeMediaService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + CodeMediaDTO data = codeMediaService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody CodeMediaDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + codeMediaService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody CodeMediaDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + codeMediaService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + codeMediaService.delete(ids); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CustomerCodeOperationHistoryController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CustomerCodeOperationHistoryController.java new file mode 100644 index 0000000000..a764889ed6 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CustomerCodeOperationHistoryController.java @@ -0,0 +1,84 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.CustomerCodeOperationHistoryDTO; +import com.epmet.service.CustomerCodeOperationHistoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 客户代码操作历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@RestController +@RequestMapping("customercodeoperationhistory") +public class CustomerCodeOperationHistoryController { + + @Autowired + private CustomerCodeOperationHistoryService customerCodeOperationHistoryService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = customerCodeOperationHistoryService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + CustomerCodeOperationHistoryDTO data = customerCodeOperationHistoryService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody CustomerCodeOperationHistoryDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + customerCodeOperationHistoryService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody CustomerCodeOperationHistoryDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + customerCodeOperationHistoryService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + customerCodeOperationHistoryService.delete(ids); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java new file mode 100644 index 0000000000..efbb43e81e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.CodeAuditResultEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 代码审核j结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Mapper +public interface CodeAuditResultDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java new file mode 100644 index 0000000000..fe783081fd --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.CodeCustomerEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户代码关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Mapper +public interface CodeCustomerDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeMediaDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeMediaDao.java new file mode 100644 index 0000000000..ef06035847 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeMediaDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.CodeMediaEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 代码素材 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Mapper +public interface CodeMediaDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerCodeOperationHistoryDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerCodeOperationHistoryDao.java new file mode 100644 index 0000000000..63ca70fb2b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerCodeOperationHistoryDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.CustomerCodeOperationHistoryEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户代码操作历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Mapper +public interface CustomerCodeOperationHistoryDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeAuditResultEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeAuditResultEntity.java new file mode 100644 index 0000000000..6226a7b08b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeAuditResultEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 代码审核j结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("code_audit_result") +public class CodeAuditResultEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 代码ID + */ + private String codeId; + + /** + * 审核ID + */ + private String auditId; + + /** + * 审核结果 审核中:auditing,审核成功audit_success,审核被拒绝audit_failed,已撤回:withdrawn,审核延后:delay + */ + private String result; + + /** + * 原因 + */ + private String reason; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java new file mode 100644 index 0000000000..496aeacbc5 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java @@ -0,0 +1,91 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 客户代码关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("code_customer") +public class CodeCustomerEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户名 + */ + private String customerName; + + /** + * 小程序接口调用令牌ID + */ + private String accessTokenId; + + /** + * 模板ID + */ + private String templateId; + + /** + * 小程序类型 居民端resi,工作端work + */ + private String type; + + /** + * APPID + */ + private String appId; + + /** + * 自定义配置 + */ + private String extJson; + + /** + * 代码版本号 + */ + private String userVersion; + + /** + * 代码描述 + */ + private String userDesc; + + /** + * 状态 未审核:unaudited,审核中:auditing,审核成功audit_success,审核被拒绝audit_failed,已撤回:withdrawn,审核延后:delay,发布成功release_success, 发布失败release_failed + */ + private String status; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeMediaEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeMediaEntity.java new file mode 100644 index 0000000000..51202ed323 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeMediaEntity.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 代码素材 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("code_media") +public class CodeMediaEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 代码ID + */ + private String codeId; + + /** + * 素材ID + */ + private String mediaId; + + /** + * 素材名 + */ + private String mediaName; + + /** + * 素材类型 图片(image)、语音(voice)、视频(video)和缩略图(thumb) + */ + private String mediaType; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerCodeOperationHistoryEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerCodeOperationHistoryEntity.java new file mode 100644 index 0000000000..e747bb57d4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerCodeOperationHistoryEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 客户代码操作历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_code_operation_history") +public class CustomerCodeOperationHistoryEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 代码ID + */ + private String codeId; + + /** + * 版本 + */ + private String version; + + /** + * 操作类型 操作 上传upload,审核audit,撤回undo,发布release + */ + private String operation; + + /** + * 描述 + */ + private String describe; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeAuditResultRedis.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeAuditResultRedis.java new file mode 100644 index 0000000000..0b66bbd2b3 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeAuditResultRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 代码审核j结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Component +public class CodeAuditResultRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeCustomerRedis.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeCustomerRedis.java new file mode 100644 index 0000000000..6b5901d833 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeCustomerRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 客户代码关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Component +public class CodeCustomerRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeMediaRedis.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeMediaRedis.java new file mode 100644 index 0000000000..99d1257967 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeMediaRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 代码素材 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Component +public class CodeMediaRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CustomerCodeOperationHistoryRedis.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CustomerCodeOperationHistoryRedis.java new file mode 100644 index 0000000000..247e724de9 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CustomerCodeOperationHistoryRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 客户代码操作历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Component +public class CustomerCodeOperationHistoryRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeAuditResultService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeAuditResultService.java new file mode 100644 index 0000000000..016a6e5abc --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeAuditResultService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.CodeAuditResultDTO; +import com.epmet.entity.CodeAuditResultEntity; + +import java.util.List; +import java.util.Map; + +/** + * 代码审核j结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +public interface CodeAuditResultService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-09 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-09 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CodeAuditResultDTO + * @author generator + * @date 2020-07-09 + */ + CodeAuditResultDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void save(CodeAuditResultDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void update(CodeAuditResultDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-07-09 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeCustomerService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeCustomerService.java new file mode 100644 index 0000000000..18ed92c92a --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeCustomerService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.CodeCustomerDTO; +import com.epmet.entity.CodeCustomerEntity; + +import java.util.List; +import java.util.Map; + +/** + * 客户代码关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +public interface CodeCustomerService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-09 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-09 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CodeCustomerDTO + * @author generator + * @date 2020-07-09 + */ + CodeCustomerDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void save(CodeCustomerDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void update(CodeCustomerDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-07-09 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeMediaService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeMediaService.java new file mode 100644 index 0000000000..a4caade450 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeMediaService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.CodeMediaDTO; +import com.epmet.entity.CodeMediaEntity; + +import java.util.List; +import java.util.Map; + +/** + * 代码素材 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +public interface CodeMediaService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-09 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-09 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CodeMediaDTO + * @author generator + * @date 2020-07-09 + */ + CodeMediaDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void save(CodeMediaDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void update(CodeMediaDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-07-09 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java new file mode 100644 index 0000000000..1761ecf725 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java @@ -0,0 +1,12 @@ +package com.epmet.service; + +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/10 10:27 + */ +public interface CodeService { + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CustomerCodeOperationHistoryService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CustomerCodeOperationHistoryService.java new file mode 100644 index 0000000000..986fce9c09 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CustomerCodeOperationHistoryService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.CustomerCodeOperationHistoryDTO; +import com.epmet.entity.CustomerCodeOperationHistoryEntity; + +import java.util.List; +import java.util.Map; + +/** + * 客户代码操作历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +public interface CustomerCodeOperationHistoryService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-09 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-09 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CustomerCodeOperationHistoryDTO + * @author generator + * @date 2020-07-09 + */ + CustomerCodeOperationHistoryDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void save(CustomerCodeOperationHistoryDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-09 + */ + void update(CustomerCodeOperationHistoryDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-07-09 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeAuditResultServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeAuditResultServiceImpl.java new file mode 100644 index 0000000000..7a4a7193cc --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeAuditResultServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.CodeAuditResultDao; +import com.epmet.dto.CodeAuditResultDTO; +import com.epmet.entity.CodeAuditResultEntity; +import com.epmet.redis.CodeAuditResultRedis; +import com.epmet.service.CodeAuditResultService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 代码审核j结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Service +public class CodeAuditResultServiceImpl extends BaseServiceImpl implements CodeAuditResultService { + + @Autowired + private CodeAuditResultRedis codeAuditResultRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CodeAuditResultDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CodeAuditResultDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public CodeAuditResultDTO get(String id) { + CodeAuditResultEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CodeAuditResultDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CodeAuditResultDTO dto) { + CodeAuditResultEntity entity = ConvertUtils.sourceToTarget(dto, CodeAuditResultEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CodeAuditResultDTO dto) { + CodeAuditResultEntity entity = ConvertUtils.sourceToTarget(dto, CodeAuditResultEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java new file mode 100644 index 0000000000..1ccf7d1f28 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.CodeCustomerDao; +import com.epmet.dto.CodeCustomerDTO; +import com.epmet.entity.CodeCustomerEntity; +import com.epmet.redis.CodeCustomerRedis; +import com.epmet.service.CodeCustomerService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 客户代码关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Service +public class CodeCustomerServiceImpl extends BaseServiceImpl implements CodeCustomerService { + + @Autowired + private CodeCustomerRedis codeCustomerRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CodeCustomerDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CodeCustomerDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public CodeCustomerDTO get(String id) { + CodeCustomerEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CodeCustomerDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CodeCustomerDTO dto) { + CodeCustomerEntity entity = ConvertUtils.sourceToTarget(dto, CodeCustomerEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CodeCustomerDTO dto) { + CodeCustomerEntity entity = ConvertUtils.sourceToTarget(dto, CodeCustomerEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeMediaServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeMediaServiceImpl.java new file mode 100644 index 0000000000..4447d8ed66 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeMediaServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.CodeMediaDao; +import com.epmet.dto.CodeMediaDTO; +import com.epmet.entity.CodeMediaEntity; +import com.epmet.redis.CodeMediaRedis; +import com.epmet.service.CodeMediaService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 代码素材 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Service +public class CodeMediaServiceImpl extends BaseServiceImpl implements CodeMediaService { + + @Autowired + private CodeMediaRedis codeMediaRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CodeMediaDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CodeMediaDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public CodeMediaDTO get(String id) { + CodeMediaEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CodeMediaDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CodeMediaDTO dto) { + CodeMediaEntity entity = ConvertUtils.sourceToTarget(dto, CodeMediaEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CodeMediaDTO dto) { + CodeMediaEntity entity = ConvertUtils.sourceToTarget(dto, CodeMediaEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java new file mode 100644 index 0000000000..728852e30c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java @@ -0,0 +1,17 @@ +package com.epmet.service.impl; + +import com.epmet.service.CodeService; +import me.chanjar.weixin.common.error.WxErrorException; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/10 10:27 + */ +@Service +public class CodeServiceImpl implements CodeService { + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerCodeOperationHistoryServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerCodeOperationHistoryServiceImpl.java new file mode 100644 index 0000000000..fc424619cc --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerCodeOperationHistoryServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.CustomerCodeOperationHistoryDao; +import com.epmet.dto.CustomerCodeOperationHistoryDTO; +import com.epmet.entity.CustomerCodeOperationHistoryEntity; +import com.epmet.redis.CustomerCodeOperationHistoryRedis; +import com.epmet.service.CustomerCodeOperationHistoryService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 客户代码操作历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-09 + */ +@Service +public class CustomerCodeOperationHistoryServiceImpl extends BaseServiceImpl implements CustomerCodeOperationHistoryService { + + @Autowired + private CustomerCodeOperationHistoryRedis customerCodeOperationHistoryRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CustomerCodeOperationHistoryDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CustomerCodeOperationHistoryDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public CustomerCodeOperationHistoryDTO get(String id) { + CustomerCodeOperationHistoryEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CustomerCodeOperationHistoryDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CustomerCodeOperationHistoryDTO dto) { + CustomerCodeOperationHistoryEntity entity = ConvertUtils.sourceToTarget(dto, CustomerCodeOperationHistoryEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CustomerCodeOperationHistoryDTO dto) { + CustomerCodeOperationHistoryEntity entity = ConvertUtils.sourceToTarget(dto, CustomerCodeOperationHistoryEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java index 2aae2d8234..3fe8d49f7e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java @@ -6,7 +6,7 @@ package com.epmet.wxapi.constant; * @author yinzuomei@elink-cn.com * @date 2020/7/10 12:57 */ -public class WxMaCodeConstant { +public interface WxMaCodeConstant { /** * 为授权的小程序帐号上传小程序代码. */ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeAuditStatus.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeAuditStatus.java new file mode 100644 index 0000000000..0115b8d9d2 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeAuditStatus.java @@ -0,0 +1,9 @@ +package com.epmet.wxapi.param; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/10 18:05 + */ +public class WxMaCodeAuditStatus { +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeAuditStatusReq.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeAuditStatusReq.java new file mode 100644 index 0000000000..b2fdf65fae --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeAuditStatusReq.java @@ -0,0 +1,18 @@ +package com.epmet.wxapi.param; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/13 15:49 + */ +@Data +public class WxMaCodeAuditStatusReq implements Serializable { + private static final long serialVersionUID = -504705519949598098L; + @SerializedName("auditid") + private String auditId; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeCommitReq.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeCommitReq.java index 3054446c7f..9e24a99689 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeCommitReq.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeCommitReq.java @@ -1,5 +1,6 @@ package com.epmet.wxapi.param; +import com.google.gson.annotations.SerializedName; import lombok.Data; import java.io.Serializable; @@ -17,18 +18,23 @@ public class WxMaCodeCommitReq implements Serializable { /** * 代码库中的代码模版ID */ - private Long templateId; + @SerializedName("template_id") + private String templateId; /** * 第三方自定义的配置 */ - private WxMaCodeExtConfigReq extConfig; + @SerializedName("ext_json") + private String extJson; /** * 代码版本号,开发者可自定义 */ + @SerializedName("user_version") private String userVersion; /** * 代码描述,开发者可自定义 */ + + @SerializedName("user_desc") private String userDesc; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java new file mode 100644 index 0000000000..c9fa07b8e4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java @@ -0,0 +1,145 @@ +package com.epmet.wxapi.param; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/10 18:04 + */ +@NoArgsConstructor +@Data +public class WxMaCodeSubmitAuditRequest implements Serializable { + + private static final long serialVersionUID = -3919598581372634816L; + /** + * 小程序版本说明和功能解释 + */ + @SerializedName("version_desc") + private String versionDesc; + /** + * 反馈内容,至多 200 字 + */ + @SerializedName("feedback_info") + private String feedbackInfo; + /** + * 用 | 分割的 media_id 列表,至多 5 张图片, 可以通过新增临时素材接口上传而得到 + */ + @SerializedName("feedback_stuff") + private String feedbackStuff; + /** + * 审核项列表(选填,至多填写 5 项) + */ + @SerializedName("item_list") + private List itemList; + /** + * 预览信息(小程序页面截图和操作录屏) + */ + @SerializedName("preview_info") + private List previewInfo; + /** + * 用户生成内容场景(UGC)信息安全声明 + */ + @SerializedName("ugc_declare") + private List ugcDeclare; + + @NoArgsConstructor + @Data + private static class ItemListBean { + /** + * 小程序的页面,可通过获取小程序的页面列表接口获得 + */ + @SerializedName("address") + private String address; + /** + * 小程序的标签,用空格分隔,标签至多 10 个,标签长度至多 20 + */ + @SerializedName("tag") + private String tag; + /** + * 一级类目名称 + */ + @SerializedName("first_class") + private String firstClass; + /** + * 二级类目名称 + */ + @SerializedName("second_class") + private String secondClass; + /** + * 三级类目名称 + */ + @SerializedName("third_class") + private String thirdClass; + /** + * 一级类目的 ID + */ + @SerializedName("first_id") + private String firstId; + /** + * 二级类目的 ID + */ + @SerializedName("second_id") + private String secondId; + /** + * 三级类目的 ID + */ + @SerializedName("third_id") + private String thirdId; + /** + * 小程序页面的标题,标题长度至多 32 + */ + @SerializedName("title") + private String title; + } + + @NoArgsConstructor + @Data + private static class PreviewInfoBean { + /** + * 录屏mediaid列表,可以通过提审素材上传接口获得 + */ + @SerializedName("Video_id_list") + private List videoIdList; + /** + * 截屏mediaid列表,可以通过提审素材上传接口获得 + */ + @SerializedName("pic_id_list") + private List picIdList; + } + + @NoArgsConstructor + @Data + private static class UgcDeclareBean { + /** + * UGC场景 0,不涉及用户生成内容, 1.用户资料,2.图片,3.视频,4.文本,5其他, 可多选,当scene填0时无需填写下列字段 + */ + @SerializedName("scene") + private List scene; + /** + * 当scene选其他时的说明,不超时256字 + */ + @SerializedName("other_scene_desc") + private String otherSceneDesc; + /** + * 内容安全机制 1.使用平台建议的内容安全API,2.使用其他的内容审核产品,3.通过人工审核把关,4.未做内容审核把关 + */ + @SerializedName("method") + private List method; + /** + * 是否有审核团队, 0.无,1.有,默认0 + */ + @SerializedName("has_audit_team") + private Integer hasAuditTeam; + /** + * 说明当前对UGC内容的审核机制,不超过256字 + */ + @SerializedName("audit_desc") + private String auditDesc; + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaAuditStatusResult.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaAuditStatusResult.java new file mode 100644 index 0000000000..ea39ebae7e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaAuditStatusResult.java @@ -0,0 +1,36 @@ +package com.epmet.wxapi.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/13 15:53 + */ +@Data +public class WxMaAuditStatusResult implements Serializable { + private static final long serialVersionUID = 3461409352381952089L; + /** + * 返回码 + */ + private String errcode; + /** + * 错误信息 + */ + private String errmsg; + /** + * 审核状态 + */ + private Integer status; + /** + * 当 status = 1 时,返回的拒绝原因; status = 4 时,返回的延后原因 + */ + private String reason; + /** + * 当 status = 1 时,会返回审核失败的小程序截图示例。用 | 分隔的 media_id 的列表,可通过获取永久素材接口拉取截图内容 + */ + private String screenshot; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaCategoryResult.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaCategoryResult.java new file mode 100644 index 0000000000..a8bbb25e5e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaCategoryResult.java @@ -0,0 +1,52 @@ +package com.epmet.wxapi.result; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/10 16:51 + */ +@Data +public class WxMaCategoryResult implements Serializable { + /** + * 一级类目名称 + */ + private String firstClass; + /** + * 二级类目名称 + */ + private String secondClass; + /** + * 三级类目名称 + */ + private String thirdClass; + /** + * 一级类目的ID编号 + */ + private String firstId; + /** + * 二级类目的ID编号 + */ + private String secondId; + /** + * 三级类目的ID编号 + */ + private String thirdId; + + /** + * 小程序的页面,可通过“获取小程序的第三方提交代码的页面配置”接口获得 + */ + private String address; + /** + * 小程序的标签,多个标签用空格分隔,标签不能多于10个,标签长度不超过20 + */ + private String tag; + /** + * 小程序页面的标题,标题长度不超过32 + */ + private String title; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaGetCategoryResult.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaGetCategoryResult.java new file mode 100644 index 0000000000..b120ad55df --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaGetCategoryResult.java @@ -0,0 +1,28 @@ +package com.epmet.wxapi.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/13 10:17 + */ +@Data +public class WxMaGetCategoryResult implements Serializable { + private static final long serialVersionUID = -2665257152145041516L; + /** + * 返回码 + */ + private Integer errcode; + /** + * 错误信息 + */ + private String errmsg; + /** + * 可填选的类目信息列表 + */ + private List categoryList; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaGetPageResult.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaGetPageResult.java new file mode 100644 index 0000000000..5305288c88 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaGetPageResult.java @@ -0,0 +1,28 @@ +package com.epmet.wxapi.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/13 13:38 + */ +@Data +public class WxMaGetPageResult implements Serializable { + private static final long serialVersionUID = -3057343239059623208L; + /** + * 返回码 + */ + private Integer errcode; + /** + * 错误信息 + */ + private String errmsg; + /** + * 错误信息 + */ + private List pageList; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java index f34511cfec..b329dabe14 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java @@ -1,9 +1,15 @@ package com.epmet.wxapi.service; +import com.epmet.wxapi.param.WxMaCodeAuditStatus; +import com.epmet.wxapi.param.WxMaCodeAuditStatusReq; import com.epmet.wxapi.param.WxMaCodeCommitReq; +import com.epmet.wxapi.param.WxMaCodeSubmitAuditRequest; +import com.epmet.wxapi.result.WxMaCategoryResult; import com.epmet.wxapi.result.WxResult; import me.chanjar.weixin.common.error.WxErrorException; +import java.util.List; + /** * 小程序代码管理相关 API(大部分只能是第三方平台调用) * 文档:https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1489140610_Uavc4&token=&lang=zh_CN @@ -14,9 +20,73 @@ import me.chanjar.weixin.common.error.WxErrorException; public interface WxMaCodeService { /** * 为授权的小程序帐号上传小程序代码(仅仅支持第三方开放平台). - * - * @param commitRequest 参数 + * @author zhaoqifeng + * @date 2020/7/10 14:11 + * @param accessToken 小程序接口调用令牌 + * @param commitRequest 请求参数 + * @return com.epmet.wxapi.result.WxResult * @throws WxErrorException 上传失败时抛出,具体错误码请看类注释文档 */ - WxResult commit(String access_token, WxMaCodeCommitReq commitRequest) throws WxErrorException; + WxResult commit(String accessToken, WxMaCodeCommitReq commitRequest) throws WxErrorException; + + /** + * 获取体验小程序的体验二维码. + * @author zhaoqifeng + * @date 2020/7/10 15:25 + * @param accessToken 小程序接口调用令牌 + * @param path 指定体验版二维码跳转到某个具体页面 + * @return com.epmet.wxapi.result.WxResult + * @throws WxErrorException 抛出异常 + */ + WxResult getQrCode(String accessToken, String path) throws WxErrorException; + + /** + * 获取授权小程序帐号的可选类目. + * + * @param accessToken 提交审核参数 + * @return List + */ + WxResult getCategory(String accessToken); + + /** + * 获取小程序的第三方提交代码的页面配置(仅供第三方开发者代小程序调用). + * + * @param accessToken 提交审核参数 + * @return page_list 页面配置列表 + */ + WxResult getPage(String accessToken); + + /** + * 将第三方提交的代码包提交审核(仅供第三方开发者代小程序调用). + * + * @param accessToken 提交审核参数 + * @param auditRequest 提交审核参数 + * @return 审核编号 + */ + WxResult submitAudit(String accessToken, WxMaCodeSubmitAuditRequest auditRequest); + + /** + * 查询指定版本审核状态(仅供第三方代小程序调用). + * + * @param accessToken 提交审核参数 + * @return 审核状态 + */ + WxResult getAuditStatus(String accessToken, WxMaCodeAuditStatusReq request); + + /** + * 发布已通过审核的小程序(仅供第三方代小程序调用). + * + * @param accessToken 提交审核参数 + * @return 发布结果 + */ + WxResult release(String accessToken); + + /** + * 小程序审核撤回. + * 单个帐号每天审核撤回次数最多不超过1次,一个月不超过10次 + * + * @param accessToken 提交审核参数 + * @return 撤回结果 + */ + WxResult undoCodeAudit(String accessToken); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java index 99860706eb..2ae3ff2443 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java @@ -1,11 +1,30 @@ package com.epmet.wxapi.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import com.epmet.wxapi.constant.WxMaCodeConstant; +import com.epmet.wxapi.param.WxMaCodeAuditStatus; +import com.epmet.wxapi.param.WxMaCodeAuditStatusReq; import com.epmet.wxapi.param.WxMaCodeCommitReq; -import com.epmet.wxapi.result.WxResult; +import com.epmet.wxapi.param.WxMaCodeSubmitAuditRequest; +import com.epmet.wxapi.result.*; import com.epmet.wxapi.service.WxMaCodeService; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import io.micrometer.core.instrument.util.JsonUtils; +import lombok.Data; import me.chanjar.weixin.common.error.WxErrorException; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + /** * 描述一下 * @@ -14,9 +33,161 @@ import org.springframework.stereotype.Service; */ @Service public class WxMaCodeServiceImpl implements WxMaCodeService { + private static final String ERR_CODE = "errcode"; + private static final String ERR_MSG = "errmsg"; + + @Override + public WxResult commit(String accessToken, WxMaCodeCommitReq commitRequest) throws WxErrorException { + WxResult result = new WxResult(); + String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken; + Result commitResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(commitRequest)); + if(!commitResult.success()) { + result.setErrorCode(commitResult.getCode()); + result.setErrorMsg(commitResult.getMsg()); + return result; + } + JSONObject jsonObject = JSONObject.parseObject(commitResult.getData()); + result.setErrorCode(jsonObject.getInteger(ERR_CODE)); + result.setErrorMsg(jsonObject.getString(ERR_MSG)); + return result; + } + + @Override + public WxResult getQrCode(String accessToken, String path) throws WxErrorException{ + WxResult result = new WxResult<>(); + StringBuilder url = new StringBuilder(WxMaCodeConstant.GET_QRCODE_URL).append("?access_token").append(accessToken); + if (StringUtils.isNotBlank(path)) { + try { + url.append("?path=").append(URLEncoder.encode(path, StandardCharsets.UTF_8.name())); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + Result qrCodeResult = HttpClientManager.getInstance().sendGetFile(url.toString(), null); + if(!qrCodeResult.success()) { + result.setErrorCode(qrCodeResult.getCode()); + result.setErrorMsg(qrCodeResult.getMsg()); + return result; + } + + result.setData(qrCodeResult.getData()); + + return result; + } + @Override - public WxResult commit(String access_token, WxMaCodeCommitReq commitRequest) throws WxErrorException { + public WxResult getCategory(String accessToken) { + WxResult> result = new WxResult<>(); + String url = WxMaCodeConstant.GET_CATEGORY_URL + "?" + "access_token=" + accessToken; + Result getCategoryResult = HttpClientManager.getInstance().sendGet(url, null); + if(!getCategoryResult.success()) { + result.setErrorCode(getCategoryResult.getCode()); + result.setErrorMsg(getCategoryResult.getMsg()); + return result; + } + WxMaGetCategoryResult categoryResult = JSONObject.parseObject(getCategoryResult.getData(), WxMaGetCategoryResult.class); + result.setErrorCode(categoryResult.getErrcode()); + result.setErrorMsg(categoryResult.getErrmsg()); + result.setData(categoryResult.getCategoryList()); + return result; + } + + @Override + public WxResult getPage(String accessToken) { + WxResult> result = new WxResult<>(); + String url = WxMaCodeConstant.GET_PAGE_URL + "?" + "access_token=" + accessToken; + Result getPageResult = HttpClientManager.getInstance().sendGet(url, null); + if(!getPageResult.success()) { + result.setErrorCode(getPageResult.getCode()); + result.setErrorMsg(getPageResult.getMsg()); + return result; + } + WxMaGetPageResult pageResult = JSONObject.parseObject(getPageResult.getData(), WxMaGetPageResult.class); + result.setErrorCode(pageResult.getErrcode()); + result.setErrorMsg(pageResult.getErrmsg()); + result.setData(pageResult.getPageList()); + return result; + } - return null; + @Override + public WxResult submitAudit(String accessToken, WxMaCodeSubmitAuditRequest auditRequest) { + WxResult result = new WxResult(); + String url = WxMaCodeConstant.SUBMIT_AUDIT_URL + "?" + "access_token=" + accessToken; + Result submitResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(auditRequest)); + if(!submitResult.success()) { + result.setErrorCode(submitResult.getCode()); + result.setErrorMsg(submitResult.getMsg()); + return result; + } + JSONObject jsonObject = JSONObject.parseObject(submitResult.getData()); + result.setErrorCode(jsonObject.getInteger(ERR_CODE)); + result.setErrorMsg(jsonObject.getString(ERR_MSG)); + return result; + } + + @Override + public WxResult getAuditStatus(String accessToken, WxMaCodeAuditStatusReq request) { + WxResult result = new WxResult<>(); + String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken; + Result statusResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); + if(!statusResult.success()) { + result.setErrorCode(statusResult.getCode()); + result.setErrorMsg(statusResult.getMsg()); + return result; + } + WxMaAuditStatusResult auditStatusResult = JSONObject.parseObject(statusResult.getData(), WxMaAuditStatusResult.class); + result.ok(auditStatusResult); + return result; + } + + @Override + public WxResult release(String accessToken) { + WxResult result = new WxResult(); + String url = WxMaCodeConstant.RELEASE_URL + "?" + "access_token=" + accessToken; + Result releaseResult = HttpClientManager.getInstance().sendPostByJSON(url, null); + if(!releaseResult.success()) { + result.setErrorCode(releaseResult.getCode()); + result.setErrorMsg(releaseResult.getMsg()); + return result; + } + JSONObject jsonObject = JSONObject.parseObject(releaseResult.getData()); + result.setErrorCode(jsonObject.getInteger(ERR_CODE)); + result.setErrorMsg(jsonObject.getString(ERR_MSG)); + return result; + } + + @Override + public WxResult undoCodeAudit(String accessToken) { + WxResult result = new WxResult(); + String url = WxMaCodeConstant.UNDO_CODE_AUDIT_URL + "?" + "access_token=" + accessToken; + Result undoResult = HttpClientManager.getInstance().sendGet(url, null); + if(!undoResult.success()) { + result.setErrorCode(undoResult.getCode()); + result.setErrorMsg(undoResult.getMsg()); + return result; + } + JSONObject jsonObject = JSONObject.parseObject(undoResult.getData()); + result.setErrorCode(jsonObject.getInteger(ERR_CODE)); + result.setErrorMsg(jsonObject.getString(ERR_MSG)); + return result; + } + + public static void main(String[] args) { + String url = "{\"errcode\":0,\"errmsg\":\"ok\",\"category_list\":[{\"first_class\":\"工具\",\"second_class\":\"备忘录\",\"first_id\":1,\"second_id\":2,}\n" + + "{\"first_class\":\"教育\",\"second_class\":\"学历教育\",\"third_class\":\"高等\",\"first_id\":3,\"second_id\":4,\"third_id\":5,}]}"; + WxMaGetCategoryResult video = JSONObject.parseObject(url, WxMaGetCategoryResult.class); + WxResult> result = new WxResult<>(); + result.setErrorCode(video.getErrcode()); + result.setErrorMsg(video.getErrmsg()); + result.setData(video.getCategoryList()); + System.out.println(result); + WxMaCodeSubmitAuditRequest request = new WxMaCodeSubmitAuditRequest(); + request.setVersionDesc("aasdf"); + } + private String toJson(Object object) { + GsonBuilder gsonBuilder = new GsonBuilder(); + gsonBuilder.setPrettyPrinting(); + Gson gson = gsonBuilder.create(); + return gson.toJson(object); } -} +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml new file mode 100644 index 0000000000..f393abeb44 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml new file mode 100644 index 0000000000..e6d65e78e4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeMediaDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeMediaDao.xml new file mode 100644 index 0000000000..c89b8a54d3 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeMediaDao.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerCodeOperationHistoryDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerCodeOperationHistoryDao.xml new file mode 100644 index 0000000000..09ae8b2e78 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerCodeOperationHistoryDao.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From b70f6a308291b5ecafd6f1c28005ac1fa4a3043d Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 14 Jul 2020 16:06:38 +0800 Subject: [PATCH 50/90] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E6=8E=A5=E5=8F=A3=E8=87=AA=E6=B5=8B=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/PublicSendSmsCodeFormDTO.java | 7 ++++++- .../service/impl/PublicUserLoginServiceImpl.java | 2 +- .../java/com/epmet/dto/result/MyInfoResultDTO.java | 14 +++++++------- .../main/java/com/epmet/constant/PaConstant.java | 13 ++++++++++++- .../epmet/service/impl/PaCustomerServiceImpl.java | 14 +++++++++----- .../com/epmet/service/impl/PaUserServiceImpl.java | 6 +++--- .../src/main/resources/mapper/PaUserWechatDao.xml | 2 -- 7 files changed, 38 insertions(+), 20 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/PublicSendSmsCodeFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/PublicSendSmsCodeFormDTO.java index b3e9558600..22b096ca6a 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/PublicSendSmsCodeFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/PublicSendSmsCodeFormDTO.java @@ -21,8 +21,13 @@ public class PublicSendSmsCodeFormDTO implements Serializable { public interface AddUserShowGroup extends CustomerClientShowGroup { } + /** + * 手机号 + */ @NotBlank(message = "手机号不能为空", groups = {AddUserShowGroup.class}) private String phone; - @NotBlank(message = "是否登陆不能为空", groups = {AddUserShowGroup.class}) + /** + * 是否登陆(登陆:true 注册:false) + */ private Boolean isLogon; } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java index a5e0a48d3f..c4b973b0fd 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java @@ -189,7 +189,7 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { //2.用户不存在时不允许登陆 PaUserDTO userDTO = resultDTO.getPaUserResult(); - if (null == resultDTO || StringUtils.isBlank(userDTO.getId())) { + if (null == userDTO || StringUtils.isBlank(userDTO.getId())) { throw new RenException(PublicUserLoginConstant.LOGON_EXCEPTION); } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/MyInfoResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/MyInfoResultDTO.java index 3d75eaed38..62dd3471db 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/MyInfoResultDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/MyInfoResultDTO.java @@ -22,31 +22,31 @@ public class MyInfoResultDTO implements Serializable { */ private String agencyName = ""; /** - * 新增客户Id + * 组织级别 */ private String level = ""; /** - * 包含customerId的token + * 省 */ private String province = ""; /** - * 新增客户Id + * 市 */ private String city = ""; /** - * 包含customerId的token + * 区 */ private String district = ""; /** - * 新增客户Id + * 党支部数量 */ private Integer partyBranchNum; /** - * 包含customerId的token + * 居民端授权状态(0:未授权,1:已授权) */ private Integer resiAuthorization; /** - * 新增客户Id + * 政府端授权状态(0:未授权,1:已授权) */ private Integer workAuthorization; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java index e523ba6fbd..9f43dface4 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java @@ -10,11 +10,18 @@ public interface PaConstant { * 手机号注册 */ String PHONE_EXCEPTION = "手机号已存在,不允许再次注册"; - + /** + * 更新用户信息失败 + */ + String UPDATE_USER_EXCEPTION = "更新用户信息失败"; /** * 根据userId查询pa_user_wechat表失败 */ String SELECT_WECHAT_EXCEPTION = "获取用户微信信息失败"; + /** + * 保存用户访问记录数据失败 + */ + String SAVE_VISITED_EXCEPTION = "保存用户访问记录数据失败"; /** * 组织级别对应的key、name @@ -49,4 +56,8 @@ public interface PaConstant { String CLIENT_RESI = "resi"; String CLIENT_WORK = "work"; + /** + * 获取缓存中token信息失败 + */ + String TOKEN_EXCEPTION = "token已过期"; } 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 84b676eb78..3dd016aaf8 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 @@ -154,7 +154,7 @@ public class PaCustomerServiceImpl extends BaseServiceImpl userList = paUserDao.selectUserByPhone(formDTO.getPhone()); - if (null != userList || userList.size() > NumConstant.ZERO) { + if (null != userList && userList.size() > NumConstant.ZERO) { throw new RenException(PaConstant.PHONE_EXCEPTION); } @@ -172,7 +172,9 @@ public class PaCustomerServiceImpl extends BaseServiceImpl CustomerUserResultDTO resultDTO = new CustomerUserResultDTO(); List userList = baseDao.selectUserByPhone(phone); if (null == userList || userList.size() < NumConstant.ONE) { - resultDTO.setPaUserResult(new PaUserDTO()); - resultDTO.setPaCustomerResult(new PaCustomerDTO()); + resultDTO.setPaUserResult(null); + resultDTO.setPaCustomerResult(null); return resultDTO; } PaUserDTO dto = userList.get(NumConstant.ZERO); List customerList = paCustomerDao.selectCustomerByUserId(dto.getId()); resultDTO.setPaUserResult(dto); - resultDTO.setPaCustomerResult(customerList.size() > NumConstant.ZERO ? customerList.get(NumConstant.ZERO) : new PaCustomerDTO()); + resultDTO.setPaCustomerResult(customerList.size() > NumConstant.ZERO ? customerList.get(NumConstant.ZERO) : null); return resultDTO; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml index 8f77d5598e..6afbc70806 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml @@ -31,14 +31,12 @@ user_id, wx_open_id, union_id, - phone, gender, nickname, head_img_url, country, province, city, - privilege, `language` FROM pa_user_wechat From 9a06b954618bf211427f1b01652129f27b0e25e9 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 14 Jul 2020 16:12:50 +0800 Subject: [PATCH 51/90] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index e8077fda32..487aa19241 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.39 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.40 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 83f7f5bb1d..d052f775f0 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.39 + 0.3.40 com.epmet epmet-cloud diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 3243df2770..cbb5817b0c 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.5 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.6 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 133c2be6d7..cc426b35ef 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.5 + 0.0.6 com.epmet From b5b6dd9a2ef15faeb5eebe0054f39d351572c649 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 14 Jul 2020 22:28:15 +0800 Subject: [PATCH 52/90] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=93=8D=E5=BA=94=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scan/common/enu/SysResponseEnum.java | 2 + ...ception.java => ExecuteHttpException.java} | 13 ++++-- .../scan/controller/ScanController.java | 10 ++--- .../scan/service/impl/ScanServiceImpl.java | 45 +++++++++---------- 4 files changed, 37 insertions(+), 33 deletions(-) rename epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/{ExeCuteHttpException.java => ExecuteHttpException.java} (63%) diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java index 67ee3cc9d2..a05b536f45 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java @@ -24,6 +24,8 @@ public enum SysResponseEnum { /*审核内容 业务 01*/ SCAN_TASK_LIST_PARAM_ERROR(110010001,"任务列表不能为空"), SCAN_PARAM_ERROR(110010002,"参数格式不正确"), + EXECUTE_ALI_RETURN_CODE_NOT_OK(110010003,"调用第三方检测服务响应异常"), + EXECUTE_ALI_DO_ACTION_EXCEPTION(110010004,"调用第三方检测服务异常"), ; private Integer code; diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExeCuteHttpException.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java similarity index 63% rename from epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExeCuteHttpException.java rename to epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java index 99daf84bae..1eb4f8d0e3 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExeCuteHttpException.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java @@ -8,16 +8,23 @@ import com.epmet.openapi.scan.common.enu.SysResponseEnum; * @email liujianjun@yunzongnet.com * @date 2020-06-05 10:31 **/ -public class ExeCuteHttpException extends RuntimeException { +public class ExecuteHttpException extends RuntimeException { private int code; private String msg; - public ExeCuteHttpException(String msg) { + public ExecuteHttpException(String msg) { this(SysResponseEnum.EXCEPTION.getCode(), msg); } - public ExeCuteHttpException(int code, String... params) { + public ExecuteHttpException(int code, String... params) { this.code = code; this.msg = MessageUtils.getMessage(code, params); + } + + public int getCode() { + return code; + } + public String getMsg() { + return msg; } } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java index efaae3ddd5..e32460ce44 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java @@ -24,7 +24,6 @@ public class ScanController { @Autowired private ScanService scanService; - /** * desc:图片同步检测接口 * @@ -34,8 +33,7 @@ public class ScanController { @RequestMapping("imgSyncScan") public Result ImgSyncScan(@RequestBody ImgScanParam param) { ValidatorUtils.validateEntity(param); - Result scanResultResult = scanService.sendSyncImgScan(param); - return scanResultResult; + return scanService.sendSyncImgScan(param); } /** @@ -47,13 +45,11 @@ public class ScanController { @RequestMapping("textSyncScan") public Result textSyncScan(@RequestBody TextScanParam param) { ValidatorUtils.validateEntity(param); - Result scanResultResult = scanService.sendTextScan(param); - return scanResultResult; + return scanService.sendTextScan(param); } //@RequestMapping("imgAsyncScan") public Result ImgAsyncScan(@RequestBody ImgScanParam param) { - Result scanResultResult = scanService.sendASyncImgScan(param); - return scanResultResult; + return scanService.sendASyncImgScan(param); } } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java index 58fd107bc0..1a88b5b86f 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java @@ -15,7 +15,7 @@ import com.epmet.openapi.scan.common.enu.ImgSceneEnum; import com.epmet.openapi.scan.common.enu.SuggestionEnum; import com.epmet.openapi.scan.common.enu.SysResponseEnum; import com.epmet.openapi.scan.common.enu.TextSceneEnum; -import com.epmet.openapi.scan.common.exception.ExeCuteHttpException; +import com.epmet.openapi.scan.common.exception.ExecuteHttpException; import com.epmet.openapi.scan.common.util.IAcsClientUtil; import com.epmet.openapi.scan.support.param.ImgScanParam; import com.epmet.openapi.scan.support.param.ImgTask; @@ -49,7 +49,6 @@ public class ScanServiceImpl implements ScanService { @Override public Result sendTextScan(TextScanParam textScanParam) { - //默认参数 // 鉴黄 暴恐涉政 textScanParam.setScenes(TextSceneEnum.getTextSceneList()); @@ -69,7 +68,7 @@ public class ScanServiceImpl implements ScanService { try { textScanRequest.setHttpContent(JSON.toJSONString(textScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); } catch (UnsupportedEncodingException e) { - log.error("sendTextScan exception", e.getMessage()); + log.error("sendTextScan parse param exception", e); } @@ -78,18 +77,18 @@ public class ScanServiceImpl implements ScanService { */ textScanRequest.setConnectTimeout(3000); textScanRequest.setReadTimeout(6000); + try { SyncScanResult textScanResult = executeSyncText(textScanRequest); return new Result().ok(textScanResult); - } catch (Exception e) { - log.error("sendTextScan exception", e); - throw new ExeCuteHttpException(SysResponseEnum.EXCEPTION.getCode(), SysResponseEnum.EXCEPTION.getMsg()); + } catch (ExecuteHttpException e) { + log.error("sendTextScan execute Exception", e); + return new Result().error(e.getCode(), e.getMsg()); } } @Override public Result sendSyncImgScan(ImgScanParam imgScanParam) { - ImageSyncScanRequest imageSyncScanRequest = new ImageSyncScanRequest(); imageSyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 imageSyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 @@ -109,7 +108,7 @@ public class ScanServiceImpl implements ScanService { try { imageSyncScanRequest.setHttpContent(JSON.toJSONString(imgScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); } catch (UnsupportedEncodingException e) { - log.error("sendSyncImgScan exception", e.getMessage()); + log.error("sendSyncImgScan parse param exception", e); return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); } @@ -122,9 +121,9 @@ public class ScanServiceImpl implements ScanService { try { SyncScanResult scanResult = executeSyncImg(imageSyncScanRequest); return new Result().ok(scanResult); - } catch (Exception e) { - log.error("sendImgScan execute Exception", e); - return new Result().error(SysResponseEnum.EXCEPTION.getCode(), SysResponseEnum.EXCEPTION.getMsg()); + } catch (ExecuteHttpException e) { + log.error("sendImgScan execute exception,param:{},fail msg:{}", JSON.toJSONString(imgScanParam), e.getMsg()); + return new Result().error(e.getCode(), e.getMsg()); } } @@ -149,7 +148,7 @@ public class ScanServiceImpl implements ScanService { try { imageAsyncScanRequest.setHttpContent(JSON.toJSONString(imgScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); } catch (UnsupportedEncodingException e) { - log.error("sendASyncImgScan exception", e.getMessage()); + log.error("sendASyncImgScan parse param exception", e); return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); } @@ -163,7 +162,7 @@ public class ScanServiceImpl implements ScanService { ImgAsyncScanResult scanResult = null;//executeAsyncImg(imageAsyncScanRequest); return new Result().ok(scanResult); } catch (Exception e) { - log.error("sendImgScan execute Exception", e); + //log.error("sendASyncImgScan execute exception,param:{},fail msg:{}",JSON.toJSONString(imgScanParam), e.getMsg()); return new Result().error(SysResponseEnum.EXCEPTION.getCode(), SysResponseEnum.EXCEPTION.getMsg()); } } @@ -209,15 +208,15 @@ public class ScanServiceImpl implements ScanService { return result; } else { log.warn("executeSyncText response not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); - throw new ExeCuteHttpException("executeSyncText detect not success. code:" + scrResponse.getInteger(SysConstant.CODE)); + throw new ExecuteHttpException(SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getCode(), SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getMsg() + ",status:" + httpResponse.getStatus()); } } else { - log.warn("executeSyncText response not success. status:{}", httpResponse.getStatus()); - throw new ExeCuteHttpException("response not success. status:" + httpResponse.getStatus()); + log.warn("executeSyncText response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); + throw new ExecuteHttpException(SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getCode(), SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getMsg() + ",status:" + httpResponse.getStatus()); } } catch (Exception e) { - log.warn("executeSyncText exception", e); - throw new ExeCuteHttpException(SysResponseEnum.EXCEPTION.getCode(), SysResponseEnum.EXCEPTION.getMsg()); + log.error("executeSyncText exception IAcsClientUtil do action exception", e); + throw new ExecuteHttpException(SysResponseEnum.EXECUTE_ALI_DO_ACTION_EXCEPTION.getCode(), SysResponseEnum.EXECUTE_ALI_DO_ACTION_EXCEPTION.getMsg()); } } @@ -260,15 +259,15 @@ public class ScanServiceImpl implements ScanService { return result; } else { log.warn("executeSyncImg detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); - throw new ExeCuteHttpException("detect not success. code:" + scrResponse.getInteger(SysConstant.CODE)); + throw new ExecuteHttpException(SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getCode(), SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getMsg() + ",status:" + httpResponse.getStatus()); } } else { - log.warn("executeSyncImg response not success. status:{}", httpResponse.getStatus()); - throw new ExeCuteHttpException("response not success. status:" + httpResponse.getStatus()); + log.warn("executeSyncImg response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); + throw new ExecuteHttpException(SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getCode(), SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getMsg() + ",status:" + httpResponse.getStatus()); } } catch (Exception e) { - log.warn("executeSyncImg exception", e); - throw new ExeCuteHttpException(SysResponseEnum.EXCEPTION.getCode(), SysResponseEnum.EXCEPTION.getMsg()); + log.error("executeSyncImg exception IAcsClientUtil do action exception", e); + throw new ExecuteHttpException(SysResponseEnum.EXECUTE_ALI_DO_ACTION_EXCEPTION.getCode(), SysResponseEnum.EXECUTE_ALI_DO_ACTION_EXCEPTION.getMsg()); } } } From c0c5880b411433e86780e2da9c09d3565cdb96b6 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 14 Jul 2020 22:31:32 +0800 Subject: [PATCH 53/90] =?UTF-8?q?=E9=83=A8=E7=BD=B2scan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml | 2 +- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml | 2 +- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml | 2 +- epmet-openapi/epmet-openapi-scan/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml index 7c237636d4..857fcfc1ac 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.17 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.18 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml index 6a5ef20dbc..2f31230f43 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.17 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.18 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml index 28d51afc53..29bd50213d 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.17 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.18 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml index aea6adbb59..451ba490f7 100644 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.17 + 0.3.18 epmet-openapi-scan jar From b6996fd977ccf51baff62a0680f9ce69c1e50f61 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 14 Jul 2020 22:46:07 +0800 Subject: [PATCH 54/90] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/ExecuteHttpException.java | 9 ++-- .../scan/service/impl/ScanServiceImpl.java | 42 ------------------- 2 files changed, 4 insertions(+), 47 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java index 1eb4f8d0e3..a5694da79c 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExecuteHttpException.java @@ -1,23 +1,22 @@ package com.epmet.openapi.scan.common.exception; -import com.epmet.commons.tools.utils.MessageUtils; import com.epmet.openapi.scan.common.enu.SysResponseEnum; /** * @author jianjun liu - * @email liujianjun@yunzongnet.com * @date 2020-06-05 10:31 **/ public class ExecuteHttpException extends RuntimeException { private int code; private String msg; - public ExecuteHttpException(String msg) { + public ExecuteHttpException(String msg) { this(SysResponseEnum.EXCEPTION.getCode(), msg); } - public ExecuteHttpException(int code, String... params) { + + public ExecuteHttpException(int code, String msg) { this.code = code; - this.msg = MessageUtils.getMessage(code, params); + this.msg = msg; } public int getCode() { diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java index 1a88b5b86f..95185ae703 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java @@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.aliyuncs.AcsRequest; -import com.aliyuncs.green.model.v20180509.ImageAsyncScanRequest; import com.aliyuncs.green.model.v20180509.ImageSyncScanRequest; import com.aliyuncs.green.model.v20180509.TextScanRequest; import com.aliyuncs.http.FormatType; @@ -21,7 +20,6 @@ import com.epmet.openapi.scan.support.param.ImgScanParam; import com.epmet.openapi.scan.support.param.ImgTask; import com.epmet.openapi.scan.support.param.TextScanParam; import com.epmet.openapi.scan.support.param.TextTask; -import com.epmet.openapi.scan.support.result.ImgAsyncScanResult; import com.epmet.openapi.scan.support.result.ScanTaskResult; import com.epmet.openapi.scan.support.result.SceneDetailResult; import com.epmet.openapi.scan.support.result.SyncScanResult; @@ -127,46 +125,6 @@ public class ScanServiceImpl implements ScanService { } } - @Override - public Result sendASyncImgScan(ImgScanParam imgScanParam) { - ImageAsyncScanRequest imageAsyncScanRequest = new ImageAsyncScanRequest(); - imageAsyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 - imageAsyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 - imageAsyncScanRequest.setEncoding(SysConstant.UTF8); - imageAsyncScanRequest.setRegionId(regionId); - - //默认参数 - // 鉴黄 暴恐涉政 - imgScanParam.setScenes(ImgSceneEnum.getImgSceneList()); - imgScanParam.setBizType(bizType); - - List imgTasks = imgScanParam.getTasks(); - if (CollectionUtils.isEmpty(imgTasks) || imgTasks.size() > SysConstant.MAX_IMG_TASKS) { - return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg()); - } - - try { - imageAsyncScanRequest.setHttpContent(JSON.toJSONString(imgScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); - } catch (UnsupportedEncodingException e) { - log.error("sendASyncImgScan parse param exception", e); - return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); - } - - /** - * 请务必设置超时时间 - */ - imageAsyncScanRequest.setConnectTimeout(3000); - imageAsyncScanRequest.setReadTimeout(6000); - - try { - ImgAsyncScanResult scanResult = null;//executeAsyncImg(imageAsyncScanRequest); - return new Result().ok(scanResult); - } catch (Exception e) { - //log.error("sendASyncImgScan execute exception,param:{},fail msg:{}",JSON.toJSONString(imgScanParam), e.getMsg()); - return new Result().error(SysResponseEnum.EXCEPTION.getCode(), SysResponseEnum.EXCEPTION.getMsg()); - } - } - public SyncScanResult executeSyncText(AcsRequest textScanRequest) { SyncScanResult result = new SyncScanResult(); try { From d68a2a7dde864789dfff9a4e8b23871d5ceb0057 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 14 Jul 2020 22:48:22 +0800 Subject: [PATCH 55/90] =?UTF-8?q?=E9=83=A8=E7=BD=B2scan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-openapi-scan/deploy/docker-compose-dev.yml | 2 +- .../epmet-openapi-scan/deploy/docker-compose-prod.yml | 2 +- .../epmet-openapi-scan/deploy/docker-compose-test.yml | 2 +- epmet-openapi/epmet-openapi-scan/pom.xml | 2 +- .../com/epmet/openapi/scan/controller/ScanController.java | 2 +- .../com/epmet/openapi/scan/service/impl/ScanService.java | 7 ------- 6 files changed, 5 insertions(+), 12 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml index 857fcfc1ac..8a3ac8a6e3 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.18 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.19 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml index 2f31230f43..756d145c23 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.18 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.19 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml index 29bd50213d..b4ae660ebf 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.18 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.19 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml index 451ba490f7..bb8246b825 100644 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.18 + 0.3.19 epmet-openapi-scan jar diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java index e32460ce44..8a0b268e50 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java @@ -50,6 +50,6 @@ public class ScanController { //@RequestMapping("imgAsyncScan") public Result ImgAsyncScan(@RequestBody ImgScanParam param) { - return scanService.sendASyncImgScan(param); + return null;//scanService.sendASyncImgScan(param); } } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java index 6f1959a2f8..f48937bc42 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java @@ -3,7 +3,6 @@ package com.epmet.openapi.scan.service.impl; import com.epmet.commons.tools.utils.Result; import com.epmet.openapi.scan.support.param.ImgScanParam; import com.epmet.openapi.scan.support.param.TextScanParam; -import com.epmet.openapi.scan.support.result.ImgAsyncScanResult; import com.epmet.openapi.scan.support.result.SyncScanResult; /** @@ -28,10 +27,4 @@ public interface ScanService { * @return */ public Result sendSyncImgScan(ImgScanParam imgScanParam); - /** - * desc:扫描图片内容 异步 - * @param imgScanParam - * @return - */ - public Result sendASyncImgScan(ImgScanParam imgScanParam); } From 970ad71a5d2d2766c32db9d544b656a9453a62c8 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 14 Jul 2020 22:59:53 +0800 Subject: [PATCH 56/90] =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/openapi/scan/support/param/ImgTask.java | 6 +++--- .../java/com/epmet/openapi/scan/support/param/TextTask.java | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java index 2ec15a9593..487485b7fc 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java @@ -2,7 +2,7 @@ package com.epmet.openapi.scan.support.param; import lombok.Data; -import javax.validation.constraints.NotNull; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -20,12 +20,12 @@ public class ImgTask implements Serializable { * 要检测的数据id 非必填 * * */ - @NotNull(message = "dataId不能为空") + @NotBlank(message = "dataId不能为空") private String dataId; /** * 图片url 必填 */ - @NotNull(message = "图片URL不能为空") + @NotBlank(message = "图片URL不能为空") private String url; } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java index aeb976506c..08215e3e5b 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java @@ -1,7 +1,9 @@ package com.epmet.openapi.scan.support.param; import lombok.Data; +import org.hibernate.validator.constraints.Length; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -19,10 +21,13 @@ public class TextTask implements Serializable { * 要检测的数据id 非必填 * * */ + @NotBlank(message = "dataId不能为空") private String dataId; /** * 文本内容 必填 最多不能超过10000 */ + @NotBlank(message = "待检测文本不能为空") + @Length(max = 10000,message = "待检测文本最大为10000") private String content; } From 563b02c12b3386371425cc1830ae003cfb1000dd Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 14 Jul 2020 23:06:03 +0800 Subject: [PATCH 57/90] =?UTF-8?q?=E9=83=A8=E7=BD=B2scan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml | 2 +- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml | 2 +- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml | 2 +- epmet-openapi/epmet-openapi-scan/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml index 8a3ac8a6e3..11ebf7fb9b 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.19 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.20 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml index 756d145c23..1e3a4d61a9 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.19 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.20 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml index b4ae660ebf..f2916f0343 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.19 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.20 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml index bb8246b825..bde5dd86b6 100644 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.19 + 0.3.20 epmet-openapi-scan jar From e4268df012a04443707770ff93fbea6a6299c831 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 14 Jul 2020 23:22:21 +0800 Subject: [PATCH 58/90] =?UTF-8?q?=E7=BB=86=E5=8C=96=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openapi/scan/common/enu/SysResponseEnum.java | 5 +++-- .../openapi/scan/service/impl/ScanServiceImpl.java | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java index a05b536f45..12e75346f1 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java @@ -19,13 +19,14 @@ public enum SysResponseEnum { */ /*通用枚举 */ EXCEPTION(10001,"系统异常"), + THIRD_PLATFORM_SERVER_ERROR(10002,"第三方检测服务异常,请稍候重试"), + THIRD_PLATFORM_RESP_STATUS_ERROR(10003,"第三方检测服务响应异常,请稍候重试"), + THIRD_PLATFORM_RESP_CODE_ERROR(10004,"第三方检测服务检测异常,请稍候重试"), /*审核内容 业务 01*/ SCAN_TASK_LIST_PARAM_ERROR(110010001,"任务列表不能为空"), SCAN_PARAM_ERROR(110010002,"参数格式不正确"), - EXECUTE_ALI_RETURN_CODE_NOT_OK(110010003,"调用第三方检测服务响应异常"), - EXECUTE_ALI_DO_ACTION_EXCEPTION(110010004,"调用第三方检测服务异常"), ; private Integer code; diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java index 95185ae703..3756eb1764 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java @@ -166,15 +166,15 @@ public class ScanServiceImpl implements ScanService { return result; } else { log.warn("executeSyncText response not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); - throw new ExecuteHttpException(SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getCode(), SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getMsg() + ",status:" + httpResponse.getStatus()); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); } } else { log.warn("executeSyncText response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); - throw new ExecuteHttpException(SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getCode(), SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getMsg() + ",status:" + httpResponse.getStatus()); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); } } catch (Exception e) { log.error("executeSyncText exception IAcsClientUtil do action exception", e); - throw new ExecuteHttpException(SysResponseEnum.EXECUTE_ALI_DO_ACTION_EXCEPTION.getCode(), SysResponseEnum.EXECUTE_ALI_DO_ACTION_EXCEPTION.getMsg()); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); } } @@ -217,15 +217,15 @@ public class ScanServiceImpl implements ScanService { return result; } else { log.warn("executeSyncImg detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); - throw new ExecuteHttpException(SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getCode(), SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getMsg() + ",status:" + httpResponse.getStatus()); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); } } else { log.warn("executeSyncImg response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); - throw new ExecuteHttpException(SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getCode(), SysResponseEnum.EXECUTE_ALI_RETURN_CODE_NOT_OK.getMsg() + ",status:" + httpResponse.getStatus()); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); } } catch (Exception e) { log.error("executeSyncImg exception IAcsClientUtil do action exception", e); - throw new ExecuteHttpException(SysResponseEnum.EXECUTE_ALI_DO_ACTION_EXCEPTION.getCode(), SysResponseEnum.EXECUTE_ALI_DO_ACTION_EXCEPTION.getMsg()); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); } } } From e9c4f039299ee3ff2cd17d119766413da8c4a71b Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 14 Jul 2020 23:23:51 +0800 Subject: [PATCH 59/90] =?UTF-8?q?=E7=BB=86=E5=8C=96=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java index 12e75346f1..f906186333 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java @@ -25,7 +25,7 @@ public enum SysResponseEnum { /*审核内容 业务 01*/ - SCAN_TASK_LIST_PARAM_ERROR(110010001,"任务列表不能为空"), + SCAN_TASK_LIST_PARAM_ERROR(110010001,"任务列表长度超过限制"), SCAN_PARAM_ERROR(110010002,"参数格式不正确"), ; From 744551c149c8002d167ff177a5ddbd0bea5f837d Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 15 Jul 2020 09:38:42 +0800 Subject: [PATCH 60/90] =?UTF-8?q?=E5=8D=87=E7=BA=A7ali=20sdk=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-openapi/epmet-openapi-scan/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml index bde5dd86b6..4987b636da 100644 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -43,12 +43,12 @@ com.aliyun aliyun-java-sdk-core - 3.5.0 + 4.1.1 com.aliyun aliyun-java-sdk-green - 3.5.0 + 3.5.1 From ef413c17508faf459efea7953c6a3effdf8af625 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 15 Jul 2020 09:41:01 +0800 Subject: [PATCH 61/90] =?UTF-8?q?=E9=83=A8=E7=BD=B2scan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml | 2 +- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml | 2 +- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml | 2 +- epmet-openapi/epmet-openapi-scan/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml index 11ebf7fb9b..f0026c2a18 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.20 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.21 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml index 1e3a4d61a9..811ca9f522 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.20 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.21 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml index f2916f0343..b2a0d1b59b 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.20 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.21 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml index 4987b636da..779f40f770 100644 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.20 + 0.3.21 epmet-openapi-scan jar From 38a59e5fb4aeb6ea73064088ebcd678350a57188 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 09:46:19 +0800 Subject: [PATCH 62/90] =?UTF-8?q?sql=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/PaUserWechatDao.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml index 6afbc70806..e571713767 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml @@ -9,14 +9,12 @@ user_id, wx_open_id, union_id, - phone, gender, nickname, head_img_url, country, province, city, - privilege, `language` FROM pa_user_wechat From fe30538d065ff5efc08e191980ca79198c276647 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 09:49:28 +0800 Subject: [PATCH 63/90] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index cbb5817b0c..ff0622fc1d 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.6 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.7 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 cc426b35ef..278898a6a8 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.6 + 0.0.7 com.epmet From 91501083ef9816f10ef695284c2a8000074a2d8e Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 10:05:16 +0800 Subject: [PATCH 64/90] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/PaUserServiceImpl.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java index 4f782280f9..2184893584 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java @@ -136,14 +136,14 @@ public class PaUserServiceImpl extends BaseServiceImpl PaUserWechatEntity wechatEntity = new PaUserWechatEntity(); wechatEntity.setUserId(userEntity.getId()); wechatEntity.setWxOpenId(wxMpUser.getOpenId()); - wechatEntity.setUnionId(wxMpUser.getUnionId()); + wechatEntity.setUnionId(null == wxMpUser.getUnionId() ? "" : wxMpUser.getUnionId()); wechatEntity.setGender(wxMpUser.getSex().toString()); wechatEntity.setNickname(wxMpUser.getNickname()); - wechatEntity.setHeadImgUrl(wxMpUser.getHeadImgUrl()); - wechatEntity.setCountry(wxMpUser.getCountry()); - wechatEntity.setProvince(wxMpUser.getProvince()); - wechatEntity.setCity(wxMpUser.getCity()); - wechatEntity.setLanguage(wxMpUser.getLanguage()); + wechatEntity.setHeadImgUrl(null == wxMpUser.getHeadImgUrl() ? "" : wxMpUser.getHeadImgUrl()); + wechatEntity.setCountry(null == wxMpUser.getCountry() ? "" : wxMpUser.getCountry()); + wechatEntity.setProvince(null == wxMpUser.getProvince() ? "" : wxMpUser.getProvince()); + wechatEntity.setCity(null == wxMpUser.getCity() ? "" : wxMpUser.getCity()); + wechatEntity.setLanguage(null == wxMpUser.getLanguage() ? "" : wxMpUser.getLanguage()); paUserWechatService.insert(wechatEntity); resultDTO.setUserId(userEntity.getId()); @@ -152,11 +152,11 @@ public class PaUserServiceImpl extends BaseServiceImpl PaUserWechatEntity wechatEntity = ConvertUtils.sourceToTarget(wechatDTO, PaUserWechatEntity.class); wechatEntity.setGender(wxMpUser.getSex().toString()); wechatEntity.setNickname(wxMpUser.getNickname()); - wechatEntity.setHeadImgUrl(wxMpUser.getHeadImgUrl()); - wechatEntity.setCountry(wxMpUser.getCountry()); - wechatEntity.setProvince(wxMpUser.getProvince()); - wechatEntity.setCity(wxMpUser.getCity()); - wechatEntity.setLanguage(wxMpUser.getLanguage()); + wechatEntity.setHeadImgUrl(null == wxMpUser.getHeadImgUrl() ? "" : wxMpUser.getHeadImgUrl()); + wechatEntity.setCountry(null == wxMpUser.getCountry() ? "" : wxMpUser.getCountry()); + wechatEntity.setProvince(null == wxMpUser.getProvince() ? "" : wxMpUser.getProvince()); + wechatEntity.setCity(null == wxMpUser.getCity() ? "" : wxMpUser.getCity()); + wechatEntity.setLanguage(null == wxMpUser.getLanguage() ? "" : wxMpUser.getLanguage()); paUserWechatService.updateById(wechatEntity); resultDTO.setUserId(wechatDTO.getUserId()); From 790b068c15ab64852df28f1270bbb1bb60ad4436 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 10:06:14 +0800 Subject: [PATCH 65/90] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index ff0622fc1d..f7a1ce737b 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.7 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.8 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 278898a6a8..1ac101083d 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.7 + 0.0.8 com.epmet From 6363147de4b80492b5a408c14c1f8ae53d16d742 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 12:04:52 +0800 Subject: [PATCH 66/90] =?UTF-8?q?=E8=BF=90=E8=90=A5=E7=AB=AF=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=B3=A8=E5=86=8C=E5=AE=A2=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PublicUserLoginServiceImpl.java | 6 +- .../java/com/epmet/dto/CustomerMpDTO.java | 2 +- .../java/com/epmet/dto/PaCustomerDTO.java | 5 ++ .../epmet/dto/form/RegisterInfoFormDTO.java | 32 +++++++++ .../dto/result/CustomerAgencyResultDTO.java | 65 +++++++++++++++++++ .../dto/result/RegisterInfoResultDTO.java | 26 ++++++++ .../controller/PaCustomerController.java | 14 ++++ .../java/com/epmet/dao/CustomerMpDao.java | 8 +++ .../java/com/epmet/dao/PaCustomerDao.java | 9 +++ .../com/epmet/entity/CustomerMpEntity.java | 2 +- .../com/epmet/entity/PaCustomerEntity.java | 5 ++ .../java/com/epmet/excel/CustomerMpExcel.java | 2 +- .../java/com/epmet/excel/PaCustomerExcel.java | 3 + .../com/epmet/service/PaCustomerService.java | 8 +++ .../service/impl/PaCustomerServiceImpl.java | 39 +++++++++++ .../main/resources/mapper/CustomerMpDao.xml | 15 +++++ .../main/resources/mapper/PaCustomerDao.xml | 27 +++++++- 17 files changed, 261 insertions(+), 7 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterInfoFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerAgencyResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/RegisterInfoResultDTO.java diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java index 20b8ffba8e..972d9cc831 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java @@ -97,10 +97,10 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { logger.error("wxMpUser is null"); throw new RenException("解析微信用户信息失败 wxMpUser is null"); } - if(StringUtils.isBlank(wxMpUser.getUnionId())){ + /*if(StringUtils.isBlank(wxMpUser.getUnionId())){ logger.error("wxMpUser.getUnionId() is null"); -// throw new RenException("解析微信用户信息失败"); - } + // throw new RenException("解析微信用户信息失败"); + }*/ return wxMpUser; } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java index 014fbe6678..3a106817f7 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java @@ -51,7 +51,7 @@ public class CustomerMpDTO implements Serializable { /** * 小程序的appId */ - private Integer appId; + private String appId; /** * 是否已经授权 0:未授权,1:已授权 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java index 2fed14154e..dd175f0747 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java @@ -43,6 +43,11 @@ public class PaCustomerDTO implements Serializable { */ private String customerName; + /** + * 是否已经完成客户信息初始化 0:未初始化,1:已初始化 + */ + private Integer isInitialize; + /** * 删除标识:0.未删除 1.已删除 */ diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterInfoFormDTO.java new file mode 100644 index 0000000000..7b20804835 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterInfoFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author sun + * @Description 公众号-查询公众号注册的客户列表-接口入参 + */ +@Data +public class RegisterInfoFormDTO implements Serializable { + + private static final long serialVersionUID = -6547893374373422628L; + + public interface AddUserInternalGroup { + } + + /** + * 当前页 + * */ + @Min(value = 1) + private Integer pageNo = 1; + + /** + * 每页显示数量 + * */ + private Integer pageSize = 20; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerAgencyResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerAgencyResultDTO.java new file mode 100644 index 0000000000..6b361e8c4f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerAgencyResultDTO.java @@ -0,0 +1,65 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author sun + * @Description 公众号-查询公众号注册的客户列表-接口返参 + */ +@Data +public class CustomerAgencyResultDTO implements Serializable { + + private static final long serialVersionUID = 3253989119352850315L; + + /** + * 客户Id + */ + private String customerId = ""; + /** + * 组织Id + */ + private String agencyId = ""; + /** + * 组织名称 + */ + private String agencyName = ""; + /** + * 组织级别 + */ + private String level = ""; + /** + * 省 + */ + private String province = ""; + /** + * 市 + */ + private String city = ""; + /** + * 区 + */ + private String district = ""; + /** + * 党支部数量 + */ + private Integer partybranchnum; + /** + * 居民端授权状态(0:未授权,1:已授权) + */ + private Integer resiAuth; + /** + * 政府端授权状态(0:未授权,1:已授权) + */ + private Integer workAuth; + /** + * 政府端授权状态(0:未授权,1:已授权) + */ + private Integer initState; + /** + * 注册人手机号 + */ + private String phone; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/RegisterInfoResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/RegisterInfoResultDTO.java new file mode 100644 index 0000000000..64c1f03e5e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/RegisterInfoResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author sun + * @Description 公众号-查询公众号注册的客户列表-接口返参 + */ +@Data +public class RegisterInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 3253989119352850315L; + + /** + * 总记录数 + */ + private Integer total; + /** + * 客户组织列表 + */ + private List agencyList; + +} 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 0b32a836a7..862d9fa3f1 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 @@ -1,6 +1,7 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -8,6 +9,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.form.CreateAgencyFormDTO; import com.epmet.dto.form.MyInfoFormDTO; import com.epmet.dto.form.RegisterFormDTO; +import com.epmet.dto.form.RegisterInfoFormDTO; import com.epmet.dto.result.AgencyLevelListResultDTO; import com.epmet.dto.result.CreateAgencyResultDTO; import com.epmet.dto.result.MyInfoResultDTO; @@ -89,5 +91,17 @@ public class PaCustomerController { return new Result().ok(paCustomerService.myInfo(formDTO)); } + /** + * @param formDTO + * @return + * @Author sun + * @Description 查询公众号注册的客户信息列表 + **/ + @PostMapping("registerinfo") + public Result registerInfo(@LoginUser TokenDto tokenDTO, @RequestBody RegisterInfoFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(paCustomerService.registerInfo(formDTO)); + } + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java index e868d6c4d5..7b3db18170 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java @@ -41,4 +41,12 @@ public interface CustomerMpDao extends BaseDao { * @Description 查询客户小程序授权结果信息 **/ List selectByCustomerId(@Param("customerId") String customerId); + + /** + * @param + * @return + * @Author sun + * @Description 查询所有客户小程序的授权信息 + **/ + List selectAll(); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java index ac4f9cd20f..de4111e6c6 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java @@ -19,6 +19,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.PaCustomerDTO; +import com.epmet.dto.result.CustomerAgencyResultDTO; import com.epmet.entity.PaCustomerEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -41,4 +42,12 @@ public interface PaCustomerDao extends BaseDao { * @Description 公众号-根据userId查询用户对应的客户信息 **/ List selectCustomerByUserId(@Param("userId") String userId); + + /** + * @param + * @return + * @Author sun + * @Description 查询公众号注册的客户信息列表 + **/ + List registerInfo(); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java index 30ba4b4b15..dcd1dbe613 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java @@ -51,7 +51,7 @@ public class CustomerMpEntity extends BaseEpmetEntity { /** * 小程序的appId */ - private Integer appId; + private String appId; /** * 是否已经授权 0:未授权,1:已授权 diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java index 09c41932ca..9c32baf589 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java @@ -43,4 +43,9 @@ public class PaCustomerEntity extends BaseEpmetEntity { */ private String customerName; + /** + * 是否已经完成客户信息初始化 0:未初始化,1:已初始化 + */ + private Integer isInitialize; + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java index 5c9549a265..cdfd902755 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java @@ -41,7 +41,7 @@ public class CustomerMpExcel { private String client; @Excel(name = "小程序的appId") - private Integer appId; + private String appId; @Excel(name = "是否已经授权:0.未授权 1.已授权") private Integer authorizationFlag; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerExcel.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerExcel.java index b30999fe95..eadef64de2 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerExcel.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaCustomerExcel.java @@ -37,6 +37,9 @@ public class PaCustomerExcel { @Excel(name = "客户名称,默认是根组织名称") private String customerName; + @Excel(name = "是否已经完成客户信息初始化:0.未初始化 1.已初始化") + private Integer isInitialize; + @Excel(name = "删除标识:0.未删除 1.已删除") private Integer delFlag; 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 765f4fd94d..bb8d3f2325 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 @@ -24,6 +24,7 @@ import com.epmet.dto.PaCustomerDTO; import com.epmet.dto.form.CreateAgencyFormDTO; import com.epmet.dto.form.MyInfoFormDTO; import com.epmet.dto.form.RegisterFormDTO; +import com.epmet.dto.form.RegisterInfoFormDTO; import com.epmet.dto.result.AgencyLevelListResultDTO; import com.epmet.dto.result.CreateAgencyResultDTO; import com.epmet.dto.result.MyInfoResultDTO; @@ -131,4 +132,11 @@ public interface PaCustomerService extends BaseService { **/ MyInfoResultDTO myInfo(MyInfoFormDTO formDTO); + /** + * @param formDTO + * @return + * @Author sun + * @Description 查询公众号注册的客户信息列表 + **/ + PageData registerInfo(RegisterInfoFormDTO formDTO); } \ 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 3dd016aaf8..7793bab04a 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 @@ -37,8 +37,10 @@ import com.epmet.dto.*; import com.epmet.dto.form.CreateAgencyFormDTO; import com.epmet.dto.form.MyInfoFormDTO; import com.epmet.dto.form.RegisterFormDTO; +import com.epmet.dto.form.RegisterInfoFormDTO; import com.epmet.dto.result.AgencyLevelListResultDTO; import com.epmet.dto.result.CreateAgencyResultDTO; +import com.epmet.dto.result.CustomerAgencyResultDTO; import com.epmet.dto.result.MyInfoResultDTO; import com.epmet.entity.*; import com.epmet.redis.PaCustomerRedis; @@ -46,6 +48,8 @@ import com.epmet.service.CustomerMpService; import com.epmet.service.PaCustomerAgencyService; import com.epmet.service.PaCustomerService; import com.epmet.service.PaCustomerUserAgencyService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -231,6 +235,7 @@ public class PaCustomerServiceImpl extends BaseServiceImpl list = baseDao.registerInfo(); + //2.查询客户小程序授权信息 + List mpList = customerMpDao.selectAll(); + //3.封装数据 + list.forEach(l -> { + mpList.forEach(mp -> { + if (l.getCustomerId().equals(mp.getCustomerId())) { + //居民端小程序授权情况 + if (PaConstant.CLIENT_RESI.equals(mp.getClient())) { + l.setResiAuth(mp.getAuthorizationFlag()); + } + //政府端小程序授权情况 + if (PaConstant.CLIENT_WORK.equals(mp.getClient())) { + l.setWorkAuth(mp.getAuthorizationFlag()); + } + } + }); + }); + PageInfo pageInfo = new PageInfo<>(); + return new PageData<>(list, pageInfo.getTotal()); + } + + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml index 14d322bee1..97a62f99f1 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml @@ -19,4 +19,19 @@ client ASC + + \ 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 fcd4d09bbf..609937e09f 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 @@ -6,7 +6,8 @@ + + \ No newline at end of file From d0661a128c11a3c8c4f8efe35be9fbc1ef536b40 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 12:10:43 +0800 Subject: [PATCH 67/90] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index 487aa19241..972dc80cbf 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.40 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.41 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index d052f775f0..8c6a00aa01 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.40 + 0.3.41 com.epmet epmet-cloud diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index f7a1ce737b..ce6ff5efdf 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.8 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.9 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 1ac101083d..46d80d5185 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.8 + 0.0.9 com.epmet From 995766f64acfd203230a76be021079c23a4dc800 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 13:52:17 +0800 Subject: [PATCH 68/90] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E6=8D=A2=E5=8F=96token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/PublicUserLoginServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java index 972d9cc831..a9b9703cbd 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java @@ -121,8 +121,10 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { private void saveLatestGovTokenDto(SaveUserResultDTO resultDTO, WxMpUser wxMpUser, String token) { TokenDto tokenDTO = new TokenDto(); int expire = jwtTokenProperties.getExpire(); + tokenDTO.setApp(LoginConstant.APP_PUBLIC); + tokenDTO.setClient(LoginConstant.CLIENT_MP); tokenDTO.setOpenId(wxMpUser.getOpenId()); - tokenDTO.setUnionId(wxMpUser.getUnionId()); + tokenDTO.setUnionId(null == wxMpUser.getUnionId() ? "" : wxMpUser.getUnionId()); tokenDTO.setToken(token); //首次初始化时还没有客户 tokenDTO.setCustomerId(""); From beb38284b30d531ace361a6d0aa5a0df4369db51 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 13:56:30 +0800 Subject: [PATCH 69/90] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index 972dc80cbf..bd178455fc 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.41 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.42 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 8c6a00aa01..ccf8622e18 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.41 + 0.3.42 com.epmet epmet-cloud From dc80c3c59491089424da76a41487e6d11b2bcbe4 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 14:55:26 +0800 Subject: [PATCH 70/90] =?UTF-8?q?=E5=8F=91=E9=80=81=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E6=B3=95=E7=BB=99=E5=89=8D=E5=8F=B08000=E4=BB=A5=E4=B8=8A?= =?UTF-8?q?=E7=9A=84=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/constant/PublicUserLoginConstant.java | 8 -------- .../epmet/service/impl/PublicUserLoginServiceImpl.java | 6 +++--- .../com/epmet/commons/tools/exception/EpmetErrorCode.java | 5 ++++- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/constant/PublicUserLoginConstant.java b/epmet-auth/src/main/java/com/epmet/constant/PublicUserLoginConstant.java index f2a2462e6a..e29d75ad0c 100644 --- a/epmet-auth/src/main/java/com/epmet/constant/PublicUserLoginConstant.java +++ b/epmet-auth/src/main/java/com/epmet/constant/PublicUserLoginConstant.java @@ -14,14 +14,6 @@ public interface PublicUserLoginConstant { * 是否登陆(true false) */ String PARAMETER_EXCEPTION = "是否登陆值错误"; - /** - * 登陆验证 - */ - String LOGON_EXCEPTION = "该手机号未注册"; - /** - * 注册验证 - */ - String ZHU_CE_EXCEPTION = "该手机号已注册"; /** * 用户登陆 新增访问记录 */ diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java index a9b9703cbd..21c0bc8c53 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java @@ -157,11 +157,11 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { CustomerUserResultDTO ResultDTO = Result.getData(); //登陆 if (formDTO.getIsLogon() && null == ResultDTO.getPaUserResult()) { - throw new RenException(PublicUserLoginConstant.LOGON_EXCEPTION); + throw new RenException(EpmetErrorCode.PUBLIC_NOT_EXISTS.getCode()); } //注册 if (!formDTO.getIsLogon() && null != ResultDTO.getPaUserResult()) { - throw new RenException(PublicUserLoginConstant.ZHU_CE_EXCEPTION); + throw new RenException(EpmetErrorCode.MOBILE_USED.getCode()); } //3、发送短信验证码 SendVerificationCodeFormDTO sendVerificationCodeFormDTO = new SendVerificationCodeFormDTO(); @@ -197,7 +197,7 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { //2.用户不存在时不允许登陆 PaUserDTO userDTO = resultDTO.getPaUserResult(); if (null == userDTO || StringUtils.isBlank(userDTO.getId())) { - throw new RenException(PublicUserLoginConstant.LOGON_EXCEPTION); + throw new RenException(EpmetErrorCode.PUBLIC_NOT_EXISTS.getCode()); } //3.校验验证码是否正确 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index aa7bc28867..c511a295c2 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -82,7 +82,10 @@ public enum EpmetErrorCode { DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"), ARTICLE_PUBLISH_ERROR(8801, "发布文章失败,请刷新重试"), - CUSTOMER_VALIDATE_ERROR(8999, "内部数据校验异常"); + CUSTOMER_VALIDATE_ERROR(8999, "内部数据校验异常"), + + //公众号 865..开头的码 + PUBLIC_NOT_EXISTS(8651,"手机号未注册,请先完成信息注册"),; private int code; From bf907630f008e92f195a4cff92735034756e9d47 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 15:00:21 +0800 Subject: [PATCH 71/90] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- .../java/com/epmet/commons/tools/exception/EpmetErrorCode.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index bd178455fc..b2609df0b1 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.42 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.43 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index ccf8622e18..ab11a183fc 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.42 + 0.3.43 com.epmet epmet-cloud diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index c511a295c2..36f968e3b0 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -85,7 +85,7 @@ public enum EpmetErrorCode { CUSTOMER_VALIDATE_ERROR(8999, "内部数据校验异常"), //公众号 865..开头的码 - PUBLIC_NOT_EXISTS(8651,"手机号未注册,请先完成信息注册"),; + PUBLIC_NOT_EXISTS(8651,"手机号未注册,请先完成信息注册"); private int code; From ce6b0c060689d602dfa99b79167cfa88c0b8bbfd Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 15:50:33 +0800 Subject: [PATCH 72/90] =?UTF-8?q?=E8=A7=A3=E5=86=B3third=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?token=E5=8F=82=E6=95=B0=E4=B8=8D=E8=83=BD=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/src/main/resources/bootstrap.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index aa1e84eb28..a926c88fb3 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -294,7 +294,7 @@ spring: - Path=${server.servlet.context-path}/third/** filters: - StripPrefix=1 - - CpAuth=false + - CpAuth=true nacos: discovery: server-addr: @nacos.server-addr@ @@ -409,6 +409,7 @@ epmet: - /gov/issue/** - /gov/project/** - /resi/home/** + - /third/** swaggerUrls: jwt: From fa8415794aa5c8d5aedf4c73e8eeb0ea0f1a1f94 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 15:52:50 +0800 Subject: [PATCH 73/90] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/deploy/docker-compose-dev.yml | 2 +- epmet-gateway/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-gateway/deploy/docker-compose-dev.yml b/epmet-gateway/deploy/docker-compose-dev.yml index e20275eb38..e5f9f85c52 100644 --- a/epmet-gateway/deploy/docker-compose-dev.yml +++ b/epmet-gateway/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.24 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.25 ports: - "8080:8080" network_mode: host # 使用现有网络 diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index c2cd3bb1ae..0754957980 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.24 + 0.3.25 com.epmet epmet-cloud From 20de831fb2ff47c38a7749400dadc4919e62dd43 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Wed, 15 Jul 2020 16:53:46 +0800 Subject: [PATCH 74/90] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/constant/NumConstant.java | 1 + .../main/java/com/epmet/dto/AuthCodeDTO.java | 11 +- .../com/epmet/dto/AuthResultRecordDTO.java | 116 ++++++ .../com/epmet/dto/AuthorizationInfoDTO.java | 8 +- ...ssTokenDTO.java => BindingAccountDTO.java} | 40 +- .../java/com/epmet/dto/BusinessInfoDTO.java | 96 +++++ .../com/epmet/dto/CodeAuditRecordDTO.java | 144 +++++++ .../epmet/dto/ComponentAccessTokenDTO.java | 6 +- .../epmet/dto/ComponentVerifyTicketDTO.java | 4 +- .../main/java/com/epmet/dto/FuncInfoDTO.java | 2 +- .../com/epmet/dto/MiniCategoryInfoDTO.java | 96 +++++ .../main/java/com/epmet/dto/MiniInfoDTO.java | 121 ++++++ .../com/epmet/dto/MiniNetworkInfoDTO.java | 96 +++++ ...enDTO.java => OpenPlatformAccountDTO.java} | 26 +- .../main/java/com/epmet/dto/PaInfoDTO.java | 129 ++++++ .../java/com/epmet/dto/PreAuthTokenDTO.java | 6 +- .../com/epmet/dto/form/AuthCodeFormDTO.java | 8 +- .../dto/form/AuthorizationInfoFormDTO.java | 7 +- .../form/AuthorizerAccessTokenFormDTO.java | 2 +- .../epmet/dto/form/BindingAccountFormDTO.java | 40 ++ .../epmet/dto/form/BusinessInfoFormDTO.java | 60 +++ .../dto/form/CodeAuditRecordFormDTO.java | 115 ++++++ .../dto/form/ComponentAccessTokenFormDTO.java | 3 +- .../form/ComponentVerifyTicketFormDTO.java | 2 +- .../com/epmet/dto/form/CreateOpenFormDTO.java | 48 +++ .../com/epmet/dto/form/GoToAuthFormDTO.java | 26 ++ .../dto/form/MiniCategoryInfoFormDTO.java | 60 +++ .../com/epmet/dto/form/MiniInfoFormDTO.java | 76 ++++ .../dto/form/MiniNetworkInfoFormDTO.java | 60 +++ .../com/epmet/dto/form/PaInfoFormDTO.java | 95 +++++ .../epmet/dto/form/PreAuthTokenFormDTO.java | 3 +- .../epmet/dto/result/AuthCodeResultDTO.java | 26 ++ .../result/AuthorizationInfoResultDTO.java | 2 +- .../epmet/dto/result/CreateOpenResultDTO.java | 36 ++ .../result/CustomerIdAndClientResultDTO.java | 25 ++ .../epmet/dto/result/GoToAuthResultDTO.java | 45 ++ .../dto/result/TemplateAndAppIdResultDTO.java | 26 ++ .../dto/result/WillOverDueResultDTO.java | 5 + .../epmet-third/epmet-third-server/pom.xml | 2 +- .../com/epmet/constant/ModuleConstant.java | 37 ++ .../constant/TencentAuthTypeConstant.java | 33 ++ .../com/epmet/constant/ThirdApiConstant.java | 35 +- .../epmet/constant/ThirdPlatformConstant.java | 6 +- .../epmet/constant/ThirdRedisKeyConstant.java | 7 +- .../constant/ThirdRunTimeInfoConstant.java | 34 ++ .../AppLetAuthorizationController.java | 39 ++ .../controller/AuthRedirectController.java | 9 +- .../controller/WeChatNotifyController.java | 6 + .../main/java/com/epmet/dao/AuthCodeDao.java | 23 ++ ...TokenDao.java => AuthResultRecordDao.java} | 8 +- .../com/epmet/dao/AuthorizationInfoDao.java | 27 +- .../java/com/epmet/dao/BindingAccountDao.java | 41 ++ .../java/com/epmet/dao/BusinessInfoDao.java | 44 ++ .../com/epmet/dao/CodeAuditRecordDao.java | 41 ++ .../com/epmet/dao/CodeAuditResultDao.java | 13 +- .../java/com/epmet/dao/CodeCustomerDao.java | 20 +- .../epmet/dao/ComponentAccessTokenDao.java | 21 + .../epmet/dao/ComponentVerifyTicketDao.java | 12 + .../java/com/epmet/dao/CustomerMpDao.java | 32 ++ .../com/epmet/dao/MiniCategoryInfoDao.java | 44 ++ .../main/java/com/epmet/dao/MiniInfoDao.java | 50 +++ .../com/epmet/dao/MiniNetworkInfoDao.java | 44 ++ ...enDao.java => OpenPlatformAccountDao.java} | 34 +- .../main/java/com/epmet/dao/PaInfoDao.java | 42 ++ .../java/com/epmet/entity/AuthCodeEntity.java | 11 +- .../epmet/entity/AuthResultRecordEntity.java | 86 ++++ .../epmet/entity/AuthorizationInfoEntity.java | 8 +- ...nEntity.java => BindingAccountEntity.java} | 29 +- .../com/epmet/entity/BusinessInfoEntity.java | 66 +++ .../epmet/entity/CodeAuditRecordEntity.java | 114 +++++ .../entity/ComponentAccessTokenEntity.java | 6 +- .../entity/ComponentVerifyTicketEntity.java | 2 +- .../java/com/epmet/entity/FuncInfoEntity.java | 2 +- .../epmet/entity/MiniCategoryInfoEntity.java | 66 +++ .../java/com/epmet/entity/MiniInfoEntity.java | 91 ++++ .../epmet/entity/MiniNetworkInfoEntity.java | 66 +++ ...ty.java => OpenPlatformAccountEntity.java} | 17 +- .../java/com/epmet/entity/PaInfoEntity.java | 99 +++++ .../com/epmet/entity/PreAuthTokenEntity.java | 6 +- .../main/java/com/epmet/redis/RedisThird.java | 43 +- .../service/AppLetAuthorizationService.java | 20 + .../service/ComponentVerifyTicketService.java | 6 +- .../impl/AppLetAuthorizationServiceImpl.java | 60 +++ .../ComponentVerifyTicketServiceImpl.java | 391 ++++++++++++++---- .../service/impl/WarrantServiceImpl.java | 122 +++++- .../java/com/epmet/util/WXXmlToMapUtil.java | 2 +- .../src/main/resources/bootstrap.yml | 9 +- .../src/main/resources/mapper/AuthCodeDao.xml | 41 +- .../resources/mapper/AuthResultRecordDao.xml | 6 + .../resources/mapper/AuthorizationInfoDao.xml | 62 ++- .../mapper/AuthorizerRefreshTokenDao.xml | 11 - .../resources/mapper/BindingAccountDao.xml | 24 ++ .../main/resources/mapper/BusinessInfoDao.xml | 27 ++ .../resources/mapper/CodeAuditRecordDao.xml | 35 ++ .../resources/mapper/CodeAuditResultDao.xml | 22 +- .../main/resources/mapper/CodeCustomerDao.xml | 45 +- .../mapper/ComponentAccessTokenDao.xml | 33 +- .../mapper/ComponentVerifyTicketDao.xml | 22 +- .../main/resources/mapper/CustomerMpDao.xml | 42 ++ .../src/main/resources/mapper/FuncInfoDao.xml | 13 - .../resources/mapper/MiniCategoryInfoDao.xml | 27 ++ .../src/main/resources/mapper/MiniInfoDao.xml | 55 +++ .../resources/mapper/MiniNetworkInfoDao.xml | 27 ++ .../mapper/OpenFlatformAccountDao.xml | 36 ++ .../resources/mapper/PaCustomerAgencyDao.xml | 2 +- .../src/main/resources/mapper/PaInfoDao.xml | 34 ++ .../main/resources/mapper/PreAuthTokenDao.xml | 4 +- .../RefreshAuthorizerAccessTokenDao.xml | 57 --- 108 files changed, 3889 insertions(+), 434 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthResultRecordDTO.java rename epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/{RefreshAuthorizerAccessTokenDTO.java => BindingAccountDTO.java} (70%) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/BusinessInfoDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditRecordDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniCategoryInfoDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniInfoDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniNetworkInfoDTO.java rename epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/{AuthorizerRefreshTokenDTO.java => OpenPlatformAccountDTO.java} (78%) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaInfoDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/BindingAccountFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/BusinessInfoFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeAuditRecordFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateOpenFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GoToAuthFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniCategoryInfoFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniInfoFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniNetworkInfoFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PaInfoFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthCodeResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateOpenResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerIdAndClientResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/GoToAuthResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateAndAppIdResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/TencentAuthTypeConstant.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java rename epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/{AuthorizerRefreshTokenDao.java => AuthResultRecordDao.java} (81%) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BusinessInfoDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditRecordDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniCategoryInfoDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniInfoDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniNetworkInfoDao.java rename epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/{RefreshAuthorizerAccessTokenDao.java => OpenPlatformAccountDao.java} (54%) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaInfoDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthResultRecordEntity.java rename epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/{RefreshAuthorizerAccessTokenEntity.java => BindingAccountEntity.java} (72%) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/BusinessInfoEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeAuditRecordEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniCategoryInfoEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniInfoEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniNetworkInfoEntity.java rename epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/{AuthorizerRefreshTokenEntity.java => OpenPlatformAccountEntity.java} (79%) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaInfoEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BusinessInfoDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditRecordDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/MiniCategoryInfoDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/MiniInfoDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/MiniNetworkInfoDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaInfoDao.xml delete mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/RefreshAuthorizerAccessTokenDao.xml diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 8529ad013b..c6d5234ddd 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -49,5 +49,6 @@ public interface NumConstant { String THREE_STR = "3"; String FOUR_STR = "4"; String FIVE_STR = "5"; + String POSITIVE_EIGHT_STR = "+8"; } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthCodeDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthCodeDTO.java index 59dce8901d..5f8d148691 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthCodeDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthCodeDTO.java @@ -26,7 +26,7 @@ import lombok.Data; * 授权回调url反参表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data public class AuthCodeDTO implements Serializable { @@ -43,6 +43,11 @@ public class AuthCodeDTO implements Serializable { */ private String customerId; + /** + * resi:居民端,work:工作端 + */ + private String clientType; + /** * 授权方APPID */ @@ -54,9 +59,9 @@ public class AuthCodeDTO implements Serializable { private String authCode; /** - * 有效期 10min + * 到期时间 */ - private Integer expiresIn; + private Date expiresInTime; /** * diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthResultRecordDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthResultRecordDTO.java new file mode 100644 index 0000000000..6d64c5af52 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthResultRecordDTO.java @@ -0,0 +1,116 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 授权结果记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-15 + */ +@Data +public class AuthResultRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 第三方平台AppId 第三方平台AppId + */ + private String componentAppId; + + /** + * 微信返回创建时间 微信返回创建时间 + */ + private Date wechatCreateTime; + + /** + * 通知类型 + */ + private String infoType; + + /** + * 授权方AppId + */ + private String authorizerAppId; + + /** + * 授权码(auth_code) + */ + private String authorizationCode; + + /** + * 授权码过期时间 + */ + private Date expiresInTime; + + /** + * 预授权码 + */ + private String preAuthCode; + + /** + * 删除状态 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizationInfoDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizationInfoDTO.java index ebdc051c24..394b8680bc 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizationInfoDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizationInfoDTO.java @@ -26,7 +26,7 @@ import lombok.Data; * 授权信息表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data public class AuthorizationInfoDTO implements Serializable { @@ -49,14 +49,14 @@ public class AuthorizationInfoDTO implements Serializable { private String authorizerAppid; /** - * 接口调用令牌(在授权的公众号/小程序具备 API 权限时,才有此返回值) + * 接口调用令牌(在授权的公众号/小程序具备 API 权限时,才有此返回值)【第三方和微信交互使用】 */ private String authorizerAccessToken; /** - * authorizer_access_token 的有效期(在授权的公众号/小程序具备API权限时,才有此返回值),单位:秒 + * 到期时间 */ - private Integer expiresIn; + private Date expiresInTime; /** * 刷新令牌(在授权的公众号具备API权限时,才有此返回值),刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token。一旦丢失,只能让用户重新授权,才能再次拿到新的刷新令牌。用户重新授权后,之前的刷新令牌会失效 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/RefreshAuthorizerAccessTokenDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/BindingAccountDTO.java similarity index 70% rename from epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/RefreshAuthorizerAccessTokenDTO.java rename to epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/BindingAccountDTO.java index aed9b812f7..87a4abdaac 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/RefreshAuthorizerAccessTokenDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/BindingAccountDTO.java @@ -23,68 +23,68 @@ import lombok.Data; /** - * 获取/刷新接口调用令牌记录表 + * 公众号/小程序绑定开放平台帐号表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data -public class RefreshAuthorizerAccessTokenDTO implements Serializable { +public class BindingAccountDTO implements Serializable { private static final long serialVersionUID = 1L; /** - * + * id ID */ private String id; /** - * 授权方令牌 + * 开放平台账号ID 开放平台账号ID */ - private String authorizerAccessToken; + private String openPlatformAccountId; /** - * 有效期,单位:秒 + * 公众号/小程序APPID(授权方APPID) 授权方APPID */ - private Integer expiresIn; + private String authAppId; /** - * 刷新令牌 + * 客户ID 客户ID */ - private String authorizerRefreshToken; + private String customerId; /** - * 授权方APPID + * 客户端 居民端:resi,工作端:work */ - private String authAppid; + private String clientType; /** - * 客户ID + * */ - private String customerId; + private Integer delFlag; /** - * + * 乐观锁 */ - private Integer delFlag; + private Integer revision; /** - * + * 创建人 */ private String createdBy; /** - * + * 创建时间 */ private Date createdTime; /** - * + * 更新人 */ private String updatedBy; /** - * + * 更新时间 */ private Date updatedTime; diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/BusinessInfoDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/BusinessInfoDTO.java new file mode 100644 index 0000000000..e29f749675 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/BusinessInfoDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 功能开通状况表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-14 + */ +@Data +public class BusinessInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 主表ID + */ + private String primaryId; + + /** + * 功能类型 open_store:是否开通微信门店功能 open_scan:是否开通微信扫商品功能 open_pay:是否开通微信支付功能 open_card:是否开通微信卡券功能 open_shake:是否开通微信摇一摇功能 + */ + private String funcType; + + /** + * 开通状态 0:未开通,1:已开通 + */ + private Integer openStatus; + + /** + * 删除状态 0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditRecordDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditRecordDTO.java new file mode 100644 index 0000000000..014490dad5 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditRecordDTO.java @@ -0,0 +1,144 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 代码审核记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-15 + */ +@Data +public class CodeAuditRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 模板ID + */ + private String templateId; + + /** + * 客户端类型:resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 授权方AppId + */ + private String authAppId; + + /** + * 小程序的原始 ID + */ + private String toUserName; + + /** + * 发送方帐号(一个 OpenID,此时发送方是系统帐号) + */ + private String fromUserName; + + /** + * 消息创建时间 (整型),时间戳 + */ + private Date wechatCreateTime; + + /** + * 消息类型 event + */ + private String msgType; + + /** + * 事件类型 +weapp_audit_success:审核通过, +weapp_audit_fail:审核不通过, +weapp_audit_delay:审核延后 + */ + private String event; + + /** + * 审核成功时的时间戳 + */ + private Date succTime; + + /** + * 审核不通过的时间戳 + */ + private Date failTime; + + /** + * 审核延后时的时间戳 + */ + private Date delayTime; + + /** + * 审核不通过的原因 + */ + private String reason; + + /** + * 审核不通过的截图示例。用 | 分隔的 media_id 的列表,可通过获取永久素材接口拉取截图内容 + */ + private String screenShot; + + /** + * 删除状态 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentAccessTokenDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentAccessTokenDTO.java index 630898d5db..037f39a214 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentAccessTokenDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentAccessTokenDTO.java @@ -26,7 +26,7 @@ import lombok.Data; * 第三方平台调用凭证 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data public class ComponentAccessTokenDTO implements Serializable { @@ -44,9 +44,9 @@ public class ComponentAccessTokenDTO implements Serializable { private String componentAccessToken; /** - * 令牌有效期 单位:s 最长 60*60*2 + * 令牌到期时间 */ - private Integer expiresIn; + private Date expiresInTime; /** * 删除状态 0:正常 1:删除 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentVerifyTicketDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentVerifyTicketDTO.java index 39f78fd2fc..c167790abb 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentVerifyTicketDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ComponentVerifyTicketDTO.java @@ -26,7 +26,7 @@ import lombok.Data; * 微信发送的ticket表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-08 + * @since v1.0.0 2020-07-14 */ @Data public class ComponentVerifyTicketDTO implements Serializable { @@ -41,7 +41,7 @@ public class ComponentVerifyTicketDTO implements Serializable { /** * 第三方平台ID */ - private String appid; + private String componentAppId; /** * component_verify_ticket diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/FuncInfoDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/FuncInfoDTO.java index 482e71f206..14cbcd763e 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/FuncInfoDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/FuncInfoDTO.java @@ -26,7 +26,7 @@ import lombok.Data; * 授权给开发者的权限集列表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data public class FuncInfoDTO implements Serializable { diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniCategoryInfoDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniCategoryInfoDTO.java new file mode 100644 index 0000000000..098f476306 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniCategoryInfoDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 小程序配置类目信息表 小程序配置类目信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-14 + */ +@Data +public class MiniCategoryInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 主表ID + */ + private String primaryId; + + /** + * 类目排序 first , second + */ + private String categorySort; + + /** + * 类目名称 资讯,文娱...... + */ + private String categoryName; + + /** + * 删除状态 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniInfoDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniInfoDTO.java new file mode 100644 index 0000000000..501f9437d2 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniInfoDTO.java @@ -0,0 +1,121 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 小程序信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-14 + */ +@Data +public class MiniInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImg; + + /** + * 小程序类型 默认为 0 + */ + private String serviceTypeInfo; + + /** + * 小程序认证类型 小程序认证类型 + */ + private String verifyTypeInfo; + + /** + * 原始 ID + */ + private String userName; + + /** + * 主体名称 + */ + private String principalName; + + /** + * 账号介绍 + */ + private String signature; + + /** + * 二维码图片的 URL + */ + private String qrcodeUrl; + + /** + * 删除状态 0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniNetworkInfoDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniNetworkInfoDTO.java new file mode 100644 index 0000000000..c928d9afab --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/MiniNetworkInfoDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 小程序配置合法域名信息表 小程序配置合法域名信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-14 + */ +@Data +public class MiniNetworkInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 主表ID + */ + private String primaryId; + + /** + * 类型 + */ + private String networkType; + + /** + * 域名 RequestDomain,WsRequestDomain,UploadDomain,DownloadDomain + */ + private String url; + + /** + * 删除状态 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizerRefreshTokenDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/OpenPlatformAccountDTO.java similarity index 78% rename from epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizerRefreshTokenDTO.java rename to epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/OpenPlatformAccountDTO.java index 32b509fe6f..f9dacb70ce 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizerRefreshTokenDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/OpenPlatformAccountDTO.java @@ -23,35 +23,41 @@ import lombok.Data; /** - * 授权方的刷新令牌表 + * 开放平台账号表 + * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data -public class AuthorizerRefreshTokenDTO implements Serializable { +public class OpenPlatformAccountDTO implements Serializable { private static final long serialVersionUID = 1L; /** - * 主键 + * id ID */ private String id; /** - * 授权方的刷新令牌 + * openId 所创建的开放平台帐号的 appid + */ + private String openAppId; + + /** + * 客户ID 客户ID */ - private String authorizerRefreshToken; + private String customerId; /** - * 授权方appid + * */ - private String authorizerAppid; + private Integer delFlag; /** - * 删除标识 0-否,1-是 + * 乐观锁 */ - private String delFlag; + private Integer revision; /** * 创建人 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaInfoDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaInfoDTO.java new file mode 100644 index 0000000000..8d5768aa62 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaInfoDTO.java @@ -0,0 +1,129 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 公众号信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-14 + */ +@Data +public class PaInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImg; + + /** + * 公众号类型 0:订阅号 +1:由历史老帐号升级后的订阅号 +2:服务号 + */ + private String serviceTypeInfo; + + /** + * 公众号认证类型 -1:未认证 +0:微信认证 +1:新浪微博认证 +2:腾讯微博认证 +3:已资质认证通过但还未通过名称认证 +4:已资质认证通过、还未通过名称认证,但通过了新浪微博认证 +5:已资质认证通过、还未通过名称认证,但通过了腾讯微博认证 + */ + private String verifyTypeInfo; + + /** + * 原始ID + */ + private String userName; + + /** + * 主体名称 + */ + private String principalName; + + /** + * 公众号所设置的微信号,可能为空 公众号所设置的微信号,可能为空 + */ + private String alias; + + /** + * 二维码图片的 URL + */ + private String qrcodeUrl; + + /** + * 删除状态 0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PreAuthTokenDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PreAuthTokenDTO.java index e0caf8be1c..e77f95db84 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PreAuthTokenDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PreAuthTokenDTO.java @@ -26,7 +26,7 @@ import lombok.Data; * 预授权码历史记录表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data public class PreAuthTokenDTO implements Serializable { @@ -44,9 +44,9 @@ public class PreAuthTokenDTO implements Serializable { private String preAuthToken; /** - * 预授权码有效期 单位:s 最长 60*60*2 + * 预授权码有效期 */ - private Integer expiresIn; + private Date expiresInTime; /** * 删除状态 0:正常 1:删除 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthCodeFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthCodeFormDTO.java index 71e5d419fd..390e0c7aab 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthCodeFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthCodeFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.form; import lombok.Data; import java.io.Serializable; +import java.util.Date; /** * @Author zxc @@ -18,6 +19,11 @@ public class AuthCodeFormDTO implements Serializable { */ private String customerId; + /** + * resi:居民端,work:工作端 + */ + private String clientType; + /** * 授权方AppId */ @@ -31,7 +37,7 @@ public class AuthCodeFormDTO implements Serializable { /** * 有效期 10min */ - private Integer expiresIn; + private Date expiresInTime; /** * 删除状态 0:正常 1:已删除 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java index f1001e0b4b..2004536f1c 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.form; import lombok.Data; import java.io.Serializable; +import java.util.Date; /** * @Author zxc @@ -31,7 +32,7 @@ public class AuthorizationInfoFormDTO implements Serializable { /** * authorizer_access_token 的有效期(在授权的公众号/小程序具备API权限时,才有此返回值),单位:秒 */ - private Integer expiresIn; + private Date expiresInTime; /** * 刷新令牌(在授权的公众号具备API权限时,才有此返回值),刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token。一旦丢失,只能让用户重新授权,才能再次拿到新的刷新令牌。用户重新授权后,之前的刷新令牌会失效 @@ -39,8 +40,10 @@ public class AuthorizationInfoFormDTO implements Serializable { private String authorizerRefreshToken; /** - * + * 客户端类型 resi:居民端,work:工作端 */ + private String clientType; + private Integer delFlag = 0; private String createdBy = "APP_USER"; diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java index 7d0fa419cf..2e5528ea64 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java @@ -22,7 +22,7 @@ public class AuthorizerAccessTokenFormDTO implements Serializable { /** * 有效期,单位:秒 */ - private Integer expiresIn; + private Date expiresInTime; /** * 刷新令牌 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/BindingAccountFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/BindingAccountFormDTO.java new file mode 100644 index 0000000000..9221628d6b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/BindingAccountFormDTO.java @@ -0,0 +1,40 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/13 17:58 + */ +@Data +public class BindingAccountFormDTO implements Serializable { + + private static final long serialVersionUID = 7969402941219659678L; + + /** + * 开放平台账号ID 开放平台账号ID + */ + private String openPlatformAccountId; + + /** + * 公众号/小程序APPID(授权方APPID) 授权方APPID + */ + private String authAppId; + + /** + * 客户ID 客户ID + */ + private String customerId; + + /** + * 客户端 居民端:resi,工作端:work + */ + private String clientType; + + private Integer delFlag = 0; + private Integer revision = 0; + private String createdBy = "APP_USER"; + private String updatedBy = "APP_USER"; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/BusinessInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/BusinessInfoFormDTO.java new file mode 100644 index 0000000000..7a47dd2bb3 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/BusinessInfoFormDTO.java @@ -0,0 +1,60 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/14 15:54 + */ +@Data +public class BusinessInfoFormDTO implements Serializable { + + private static final long serialVersionUID = 570372083578341740L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 主表ID + */ + private String primaryId; + + /** + * 功能类型 open_store:是否开通微信门店功能 open_scan:是否开通微信扫商品功能 open_pay:是否开通微信支付功能 open_card:是否开通微信卡券功能 open_shake:是否开通微信摇一摇功能 + */ + private String funcType; + + /** + * 开通状态 0:未开通,1:已开通 + */ + private Integer openStatus; + + /** + * 删除状态 0:正常,1:删除 + */ + private Integer delFlag = 0; + + /** + * 乐观锁 + */ + private Integer revision = 0; + + /** + * 创建人 + */ + private String createdBy = "APP_USER"; + + /** + * 更新人 + */ + private String updatedBy = "APP_USER"; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeAuditRecordFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeAuditRecordFormDTO.java new file mode 100644 index 0000000000..c0530f1bb7 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeAuditRecordFormDTO.java @@ -0,0 +1,115 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @CreateTime 2020/7/15 14:13 + */ +@Data +public class CodeAuditRecordFormDTO implements Serializable { + + private static final long serialVersionUID = 2295533266066734315L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 模板ID + */ + private String templateId; + + /** + * 客户端类型:resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 授权方AppId + */ + private String authAppId; + + /** + * 小程序的原始 ID + */ + private String toUserName; + + /** + * 发送方帐号(一个 OpenID,此时发送方是系统帐号) + */ + private String fromUserName; + + /** + * 消息创建时间 (整型),时间戳 + */ + private Date wechatCreateTime; + + /** + * 消息类型 event + */ + private String msgType; + + /** + * 事件类型 + weapp_audit_success:审核通过, + weapp_audit_fail:审核不通过, + weapp_audit_delay:审核延后 + */ + private String event; + + /** + * 审核成功时的时间戳 + */ + private Date succTime; + + /** + * 审核不通过的时间戳 + */ + private Date failTime; + + /** + * 审核延后时的时间戳 + */ + private Date delayTime; + + /** + * 审核不通过的原因 + */ + private String reason; + + /** + * 审核不通过的截图示例。用 | 分隔的 media_id 的列表,可通过获取永久素材接口拉取截图内容 + */ + private String screenShot; + + /** + * 删除状态 + */ + private Integer delFlag = 0; + + /** + * 乐观锁 + */ + private Integer revision = 0; + + /** + * 创建人 + */ + private String createdBy = "APP_USER"; + + /** + * 更新人 + */ + private String updatedBy = "APP_USER"; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentAccessTokenFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentAccessTokenFormDTO.java index 61e2f5063e..d09b6cd4fb 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentAccessTokenFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentAccessTokenFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.form; import lombok.Data; import java.io.Serializable; +import java.util.Date; /** * @Author zxc @@ -21,7 +22,7 @@ public class ComponentAccessTokenFormDTO implements Serializable { /** * 令牌有效期 单位:s 最长 60*60*2 */ - private Integer expiresIn; + private Date expiresInTime; /** * 删除状态 0:正常 1:删除 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java index 308b69b4fd..54afadfc32 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java @@ -22,7 +22,7 @@ public class ComponentVerifyTicketFormDTO implements Serializable { /** * 第三方平台ID */ - private String appid; + private String componentAppId; /** * component_verify_ticket diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateOpenFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateOpenFormDTO.java new file mode 100644 index 0000000000..fae9e3e610 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateOpenFormDTO.java @@ -0,0 +1,48 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/13 17:36 + */ +@Data +public class CreateOpenFormDTO implements Serializable { + + private static final long serialVersionUID = 7656834022953140875L; + + private String id; + + /** + * openId 所创建的开放平台帐号的 appid + */ + private String openid; + + /** + * 客户ID 客户ID + */ + private String customerId; + + /** + * 乐观锁 + */ + private Integer revision = 0; + + /** + * 创建者 + */ + private String createdBy = "APP_USER"; + + /** + * 修改者 + */ + private String updatedBy = "APP_USER"; + + /** + * 是否已删除(0-未删除,1-已删除) + */ + private String delFlag = "0"; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GoToAuthFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GoToAuthFormDTO.java new file mode 100644 index 0000000000..d9e9ae1790 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GoToAuthFormDTO.java @@ -0,0 +1,26 @@ +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; + +/** + * @Author zxc + * @CreateTime 2020/7/13 10:30 + */ +@Data +public class GoToAuthFormDTO implements Serializable { + + private static final long serialVersionUID = 4171794043794295829L; + public interface GoToAuth extends CustomerClientShowGroup{} + + /** + * 客户端类型 resi:居民端 , work:工作端 + */ + @NotBlank(message = "客户端类型不能为空",groups = {GoToAuth.class}) + private String clientType; + + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniCategoryInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniCategoryInfoFormDTO.java new file mode 100644 index 0000000000..f5fd4ab9a1 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniCategoryInfoFormDTO.java @@ -0,0 +1,60 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/14 15:53 + */ +@Data +public class MiniCategoryInfoFormDTO implements Serializable { + + private static final long serialVersionUID = 9211011906485259736L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 主表ID + */ + private String primaryId; + + /** + * 类目排序 first , second + */ + private String categorySort; + + /** + * 类目名称 资讯,文娱...... + */ + private String categoryName; + + /** + * 删除状态 + */ + private Integer delFlag = 0; + + /** + * 乐观锁 + */ + private Integer revision = 0; + + /** + * 创建人 + */ + private String createdBy = "APP_USER"; + + /** + * 更新人 + */ + private String updatedBy = "APP_USER"; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniInfoFormDTO.java new file mode 100644 index 0000000000..072877f958 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniInfoFormDTO.java @@ -0,0 +1,76 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/14 15:20 + */ +@Data +public class MiniInfoFormDTO implements Serializable { + + private static final long serialVersionUID = 2970966756786695782L; + + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImg; + + /** + * 小程序类型 默认为 0 + */ + private String serviceTypeInfo; + + /** + * 小程序认证类型 小程序认证类型 + */ + private String verifyTypeInfo; + + /** + * 原始 ID + */ + private String userName; + + /** + * 主体名称 + */ + private String principalName; + + /** + * 账号介绍 + */ + private String signature; + + /** + * 二维码图片的 URL + */ + private String qrcodeUrl; + + private Integer delFlag = 0; + + private Integer revision = 0; + + private String createdBy = "APP_USER"; + + private String updatedBy = "APP_USER"; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniNetworkInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniNetworkInfoFormDTO.java new file mode 100644 index 0000000000..91a8e4f1e4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MiniNetworkInfoFormDTO.java @@ -0,0 +1,60 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/14 15:52 + */ +@Data +public class MiniNetworkInfoFormDTO implements Serializable { + + private static final long serialVersionUID = -2171502778870475956L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 主表ID + */ + private String primaryId; + + /** + * 类型 + */ + private String networkType; + + /** + * 域名 RequestDomain,WsRequestDomain,UploadDomain,DownloadDomain + */ + private String url; + + /** + * 删除状态 + */ + private Integer delFlag = 0; + + /** + * 乐观锁 + */ + private Integer revision = 0; + + /** + * 创建人 + */ + private String createdBy = "APP_USER"; + + /** + * 更新人 + */ + private String updatedBy = "APP_USER"; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PaInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PaInfoFormDTO.java new file mode 100644 index 0000000000..d91c84cfa3 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PaInfoFormDTO.java @@ -0,0 +1,95 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/14 15:27 + */ +@Data +public class PaInfoFormDTO implements Serializable { + + private static final long serialVersionUID = 2495498009170200556L; + + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImg; + + /** + * 公众号类型 0:订阅号 + 1:由历史老帐号升级后的订阅号 + 2:服务号 + */ + private String serviceTypeInfo; + + /** + * 公众号认证类型 -1:未认证 + 0:微信认证 + 1:新浪微博认证 + 2:腾讯微博认证 + 3:已资质认证通过但还未通过名称认证 + 4:已资质认证通过、还未通过名称认证,但通过了新浪微博认证 + 5:已资质认证通过、还未通过名称认证,但通过了腾讯微博认证 + */ + private String verifyTypeInfo; + + /** + * 原始ID + */ + private String userName; + + /** + * 主体名称 + */ + private String principalName; + + /** + * 公众号所设置的微信号,可能为空 公众号所设置的微信号,可能为空 + */ + private String alias; + + /** + * 二维码图片的 URL + */ + private String qrcodeUrl; + + /** + * 删除状态 0:正常,1:删除 + */ + private Integer delFlag = 0; + + /** + * 乐观锁 + */ + private Integer revision = 0; + + /** + * 创建人 + */ + private String createdBy = "APP_USER"; + + /** + * 更新人 + */ + private String updatedBy = "APP_USER"; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PreAuthTokenFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PreAuthTokenFormDTO.java index 0f07ee3528..532936c99d 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PreAuthTokenFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PreAuthTokenFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.form; import lombok.Data; import java.io.Serializable; +import java.util.Date; /** * @Author zxc @@ -21,7 +22,7 @@ public class PreAuthTokenFormDTO implements Serializable { /** * 预授权码有效期 单位:s 最长 60*60*2 */ - private Integer expiresIn; + private Date expiresInTime; /** * 删除状态 0:正常 1:删除 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthCodeResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthCodeResultDTO.java new file mode 100644 index 0000000000..21eb773600 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthCodeResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/15 10:00 + */ +@Data +public class AuthCodeResultDTO implements Serializable { + + private static final long serialVersionUID = 4642988014737245076L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthorizationInfoResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthorizationInfoResultDTO.java index ce31106941..1d20dc3aac 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthorizationInfoResultDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AuthorizationInfoResultDTO.java @@ -29,7 +29,7 @@ public class AuthorizationInfoResultDTO implements Serializable { /** * authorizer_access_token 的有效期(在授权的公众号/小程序具备API权限时,才有此返回值),单位:秒 */ - private Integer expires_in; + private String expires_in; /** * 刷新令牌(在授权的公众号具备API权限时,才有此返回值),刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token。 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateOpenResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateOpenResultDTO.java new file mode 100644 index 0000000000..1a7d67e1f9 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateOpenResultDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/13 16:17 + */ +@Data +public class CreateOpenResultDTO implements Serializable { + + private static final long serialVersionUID = -7130231978776634403L; + + private String id; + + /** + * 所创建的开放平台帐号的 appid + */ + private String openAppId; + + /** + * 错误信息 + */ + private String errMsg; + + /** + * 返回码 + * 0:ok, + * -1:system error , 系统错误 + * 40013:invalid appid , appid 无效 + * 89000:account has bound open ,该公众号/小程序 已经绑定了开放平台帐号 + */ + private Integer errCode; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerIdAndClientResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerIdAndClientResultDTO.java new file mode 100644 index 0000000000..a802fb5de8 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerIdAndClientResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/15 15:44 + */ +@Data +public class CustomerIdAndClientResultDTO implements Serializable { + + private static final long serialVersionUID = -7427184790539679353L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 + */ + private String clientType; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/GoToAuthResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/GoToAuthResultDTO.java new file mode 100644 index 0000000000..5f2404efa8 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/GoToAuthResultDTO.java @@ -0,0 +1,45 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/10 15:55 + */ +@Data +public class GoToAuthResultDTO implements Serializable { + + private static final long serialVersionUID = -8759961913652933215L; + + /** + * 第三方AppId + */ + @JsonIgnore + private String componentAppId; + + /** + * 预授权码 + */ + @JsonIgnore + private String preAuthCode; + + /** + * 回调地址【获取 授权码和过期时间】 + */ + @JsonIgnore + private String redirectUri; + + /** + * 客户ID + */ + @JsonIgnore + private String customerId; + + /** + * 反参:拼好的url,包括回调地址 + */ + private String url; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateAndAppIdResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateAndAppIdResultDTO.java new file mode 100644 index 0000000000..96dc655981 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateAndAppIdResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/15 15:56 + */ +@Data +public class TemplateAndAppIdResultDTO implements Serializable { + + private static final long serialVersionUID = -3875904833509300177L; + + /** + * 模板ID + */ + private String templateId; + + /** + * 授权方AppId + */ + private String authAppId; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/WillOverDueResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/WillOverDueResultDTO.java index b89826abda..666c73ff15 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/WillOverDueResultDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/WillOverDueResultDTO.java @@ -33,5 +33,10 @@ public class WillOverDueResultDTO implements Serializable { */ private String customerId; + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + } diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 46d80d5185..8bef743d41 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -176,7 +176,7 @@ 6379 123456 - true + false 122.152.200.70:8848 fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b 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 77bfbe8263..39bcec97d4 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 @@ -16,7 +16,10 @@ public interface ModuleConstant { String INFO_TYPE = "InfoType"; String TICKET_UNDERLINE_KEY = "component_verify_ticket"; String TICKET_KEY = "ComponentVerifyTicket"; + String APP_ID = "AppId"; + String AUTHORIZATION_CODE_HUMP = "AuthorizationCode"; String UNAUTHORIZED = "unauthorized"; + String AUTHORIZED = "authorized"; String NULL_CHAR = ""; String SUCCESS = "success"; @@ -40,6 +43,40 @@ public interface ModuleConstant { //授权回调URL 如下 String AUTH_CODE = "auth_code"; + String ERR_CODE = "errcode"; + String ERR_MSG = "errmsg"; + String OPEN_APP_ID = "open_appid"; + String LOW_APP_ID = "appid"; + + String CUSTOMER_ID = "customerId"; + String CLIENT = "client"; + + //创建开放平台账号 + String ACCESS_TOKEN = "access_token"; + + //获取并保存授权方账号基本信息 如下 + String COMPONENT_APP_ID = "component_appid"; + String AUTHORIZER_APP_ID = "authorizer_appid"; + String AUTHORIZER_INFO = "authorizer_info"; + String MINI_PROGRAM_INFO = "miniprograminfo"; + String BUSINESS_INFO = "business_info"; + String CATEGORIES = "categories"; + String NETWORK = "network"; + + //代码审核结果推送 如下 + String EVENT = "Event"; + String WEAPP_AUDIT_SUCCESS = "weapp_audit_success"; //审核通过 + String WEAPP_AUDIT_FAIL = "weapp_audit_fail"; //审核不通过 + String WEAPP_AUDIT_DELAY = "weapp_audit_delay"; //审核延后 + String DELAY = "delay"; + String AUDIT_SUCCESS = "audit_success"; + String AUDIT_FAILED = "audit_failed"; + + int FORTY_THOUSAND_AND_THIRTEEN = 40013; + int EIGHTY_NINE_THOUSAND = 89000; + int EIGHTY_NINE_THOUSAND_AND_ONE = 89001; + int EIGHTY_NINE_THOUSAND_AND_THREE = 89003; + int EIGHTY_NINE_THOUSAND_AND_FOUR = 89004; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/TencentAuthTypeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/TencentAuthTypeConstant.java new file mode 100644 index 0000000000..080b993fae --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/TencentAuthTypeConstant.java @@ -0,0 +1,33 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @CreateTime 2020/7/13 9:08 + */ +public interface TencentAuthTypeConstant { + + /** + * 公众号认证类型 + */ + String AUTH_MINUS_ONE = "未认证"; + String AUTH_ZERO = "微信认证"; + String AUTH_ONE = "新浪微博认证"; + String AUTH_TWO = "腾讯微博认证"; + String AUTH_THREE = "已资质认证通过但还未通过名称认证"; + String AUTH_FOUR = "已资质认证通过、还未通过名称认证,但通过了新浪微博认证"; + String AUTH_FIVE = "已资质认证通过、还未通过名称认证,但通过了腾讯微博认证"; + + /** + * 公众号类型 + */ + String ZERO = "订阅号"; + String ONE = "由历史老帐号升级后的订阅号"; + String TWO = "服务号"; + + /** + * 小程序认证类型 + */ + String MINI_AUTH_MINUS_ONE = "未认证"; + String MINI_AUTH_ZERO = "微信认证"; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdApiConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdApiConstant.java index 96c69002f3..5b05154cbc 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdApiConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdApiConstant.java @@ -7,7 +7,7 @@ package com.epmet.constant; public interface ThirdApiConstant { /** - * + * 获取预授权码 */ String API_CREATE_PREAUTHCODE_URL = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode"; @@ -23,4 +23,37 @@ public interface ThirdApiConstant { String API_AUTHORIZER_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/component/api_authorizer_token"; + /** + * 授权回调url + */ + String API_REDIRECT_URL = "https://epmet-dev.elinkservice.cn/api/third/redirectauthcode"; + + /** + * 反参授权回调url + */ + String API_RETURN_REDIRECT_URL = "https://epmet-dev.elinkservice.cn/api/third/redirectauthcode?client=%s&customerId=%s"; + + /** + * 授权注册页面扫码授权 + * component_appid:第三方AppId + * pre_auth_code:预授权码 + * redirect_uri:回调url(获取授权码) + */ + String API_AUTH_REGISTER_URL = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=%s&pre_auth_code=%s&redirect_uri=%s"; + + /** + * 创建开放平台帐号并绑定公众号/小程序 + */ + String API_CREATE_OPEN = "https://api.weixin.qq.com/cgi-bin/open/create"; + + /** + * 公众号/小程序绑定到开放平台帐号下 + */ + String API_BIND_OPEN = "https://api.weixin.qq.com/cgi-bin/open/bind?"; + + /** + * 获取授权方的帐号基本信息 + */ + String API_GET_AUTHORIZER_INFO = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info"; + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java index 09f8af7681..e86eafb02d 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdPlatformConstant.java @@ -9,12 +9,12 @@ public interface ThirdPlatformConstant { /** * 第三方平台appId */ - String PLATFORM_APP_ID = "****************"; +// String PLATFORM_APP_ID = "****************"; /** * 第三方平台 secret */ - String PLATFORM_APP_SECRET = "****************"; +// String PLATFORM_APP_SECRET = "****************"; /** * 第三方平台 消息加解密Key @@ -24,6 +24,6 @@ public interface ThirdPlatformConstant { /** * 第三方平台 消息校验Token */ - String PLATFORM_COMPONENT_TOKEN = "****************"; +// String PLATFORM_COMPONENT_TOKEN = "****************"; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java index c4aab903d5..43e1e19f52 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java @@ -27,7 +27,12 @@ public interface ThirdRedisKeyConstant { String ACCESS_TOKEN_REDIS_KEY = "epmet:wechartthird:componentaccesstoken"; /** - * authorizer_refresh_token 刷新令牌,获取授权信息时得到 + * authorizer_refresh_token 刷新令牌,获取授权信息时得到 第三方和微信交互使用的 + */ + String THIRD_AUTHORIZER_REFRESH_TOKEN_REDIS_KEY = "epmet:wechartthird:thirdauthorizerrefreshtoken"; + + /** + * 第三方 和 授权方交互使用的 */ String AUTHORIZER_REFRESH_TOKEN_REDIS_KEY = "epmet:wechartthird:authorizerrefreshtoken"; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java index 6ff00a3e80..2e0448a712 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java @@ -46,4 +46,38 @@ public interface ThirdRunTimeInfoConstant { String END_GET_AUTH_INFO = "=====================结束获取【authorization_info】====================="; + String CREATE_AND_BIND_SUCCESS = "创建开放平台帐号并绑定公众号/小程序"; + + String BIND_SUCCESS = "绑定公众号/小程序到开放平台"; + + /** + * 对应错误码:-1 + */ + String SYSTEM_ERROR = "系统错误"; + + /** + * 对应错误码:40013 + */ + String INVALID_APP_ID = "appId 或 openAppId 无效"; + + /** + * 对应错误码:89000 + */ + String ACCOUNT_HAS_BOUND_OPEN = "该公众号/小程序 已经绑定了开放平台帐号"; + + /** + * 对应错误码:89001 + */ + String NOT_SAME_CONTRACTOR = "Authorizer 与开放平台帐号主体不相同"; + + /** + * 对应错误码:89003 + */ + String NOT_ALLOWED_OPERATE = "该开放平台帐号并非通过 api 创建,不允许操作"; + + /** + * 对应错误码:89004 + */ + String TO_LIMIT = "该开放平台帐号所绑定的公众号/小程序已达上限(100 个)"; + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java new file mode 100644 index 0000000000..45c8a65cb4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java @@ -0,0 +1,39 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.GoToAuthFormDTO; +import com.epmet.dto.result.GoToAuthResultDTO; +import com.epmet.service.AppLetAuthorizationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author zxc + * @CreateTime 2020/7/10 15:48 + */ +@RestController +@RequestMapping("auth") +public class AppLetAuthorizationController { + + @Autowired + private AppLetAuthorizationService appLetAuthorizationService; + + /** + * @Description 小程序点击“去授权”的时候 + * @param tokenDto + * @author zxc + */ + @PostMapping("gotoauth") + public Result goToAuth(@LoginUser TokenDto tokenDto, @RequestBody GoToAuthFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + GoToAuthResultDTO goToAuthResultDTO = appLetAuthorizationService.goToAuth(tokenDto,formDTO); + return new Result().ok(goToAuthResultDTO); + } + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java index dd462b2245..b1b89e380d 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AuthRedirectController.java @@ -1,12 +1,10 @@ package com.epmet.controller; -import com.epmet.commons.tools.annotation.LoginUser; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.service.ComponentVerifyTicketService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; @@ -28,8 +26,9 @@ public class AuthRedirectController { * @param * @author zxc */ - public Result redirectUri(HttpServletRequest request, HttpServletResponse response, @LoginUser TokenDto tokenDto, @RequestParam("authAppId")String authAppId){ - componentVerifyTicketService.redirectUri(request,response,tokenDto,authAppId); + @GetMapping("redirect") + public Result redirectUri(HttpServletRequest request, HttpServletResponse response){ + componentVerifyTicketService.redirectUri(request,response); return new Result(); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java index a63583e38c..27e1051b58 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WeChatNotifyController.java @@ -2,6 +2,7 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.service.ComponentVerifyTicketService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -9,6 +10,7 @@ import org.springframework.web.bind.annotation.*; * @Author zxc * @CreateTime 2020/7/8 15:06 */ +@Slf4j @RestController @RequestMapping("wechatthird") public class WeChatNotifyController { @@ -24,7 +26,9 @@ public class WeChatNotifyController { */ @PostMapping("componentaccesstoken") public Result getComponentAccessToken() { + log.info("开始获取【component_access_token】......"); componentVerifyTicketService.getComponentAccessToken(); + log.info("已成功获取到【component_access_token】......"); return new Result(); } @@ -45,7 +49,9 @@ public class WeChatNotifyController { */ @PostMapping("refreshtoken") public Result refreshToken(){ + log.info("开始刷新/获取接口调用令牌......"); componentVerifyTicketService.refreshToken(); + log.info("刷新/获取接口调用令牌......成功了"); return new Result(); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthCodeDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthCodeDao.java index 9ff232bbb4..53bf395ea1 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthCodeDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthCodeDao.java @@ -19,8 +19,10 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.AuthCodeFormDTO; +import com.epmet.dto.result.AuthCodeResultDTO; import com.epmet.entity.AuthCodeEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 授权回调url反参表 @@ -31,6 +33,27 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface AuthCodeDao extends BaseDao { + /** + * @Description 插入 授权码 + * @param formDTO + * @author zxc + */ void insertRedirectAuthCode(AuthCodeFormDTO formDTO); + + /** + * @Description 根据authCode查询客户ID和客户端类型 + * @param authCode + * @author zxc + */ + AuthCodeResultDTO selectCustomerIdByAuthCode(@Param("authCode")String authCode); + + /** + * @Description 回填 auth_code表 authAppId + * @param customerId + * @param clientType + * @param authAppId + * @author zxc + */ + void updateAppId(@Param("customerId")String customerId,@Param("clientType")String clientType,@Param("authAppId")String authAppId); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizerRefreshTokenDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java similarity index 81% rename from epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizerRefreshTokenDao.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java index 087e781c1a..ca98874003 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizerRefreshTokenDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java @@ -18,16 +18,16 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.entity.AuthorizerRefreshTokenEntity; +import com.epmet.entity.AuthResultRecordEntity; import org.apache.ibatis.annotations.Mapper; /** - * 授权方的刷新令牌表 + * 授权结果记录表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-08 + * @since v1.0.0 2020-07-15 */ @Mapper -public interface AuthorizerRefreshTokenDao extends BaseDao { +public interface AuthResultRecordDao extends BaseDao { } \ No newline at end of file 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 02539669af..4608b0a04a 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 @@ -19,10 +19,14 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.AuthorizationInfoFormDTO; +import com.epmet.dto.form.AuthorizerAccessTokenFormDTO; +import com.epmet.dto.result.WillOverDueResultDTO; import com.epmet.entity.AuthorizationInfoEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 授权信息表 * @@ -44,6 +48,27 @@ public interface AuthorizationInfoDao extends BaseDao { * @param customerId * @author zxc */ - void updateOldAuthorizationInfo(@Param("customerId")String customerId); + void updateOldAuthorizationInfo(@Param("customerId")String customerId,@Param("clientType")String clientType); + + /** + * @Description 查询即将过期的 authorizer_access_token + * @param + * @author zxc + */ + List checkWillOverDue(); + + /** + * @Description 插入 authorizer_access_token + * @param refreshAccessToken + * @author zxc + */ + void insertAuthorizerAccessToken(AuthorizerAccessTokenFormDTO refreshAccessToken); + + /** + * @Description 逻辑删除 授权方的authorizer_access_token + * @param customerId + * @author zxc + */ + void updateOldAuthorizerAccessToken(@Param("customerId")String customerId,@Param("clientType")String clientType); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java new file mode 100644 index 0000000000..4ea9771d2c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.BindingAccountFormDTO; +import com.epmet.entity.BindingAccountEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 公众号/小程序绑定开放平台帐号表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-13 + */ +@Mapper +public interface BindingAccountDao extends BaseDao { + + /** + * @Description 插入 公众号/小程序绑定开放平台帐号表 + * @param formDTO + * @author zxc + */ + void insertBindingAccount(BindingAccountFormDTO formDTO); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BusinessInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BusinessInfoDao.java new file mode 100644 index 0000000000..622f257d7b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BusinessInfoDao.java @@ -0,0 +1,44 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.BusinessInfoFormDTO; +import com.epmet.entity.BusinessInfoEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 功能开通状况表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-13 + */ +@Mapper +public interface BusinessInfoDao extends BaseDao { + + /** + * @Description 功能开通信息插入 + * @param businessInfoList + * @author zxc + */ + void insertBusinessInfo(@Param("businessInfoList") List businessInfoList); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditRecordDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditRecordDao.java new file mode 100644 index 0000000000..1aca1dff12 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditRecordDao.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.CodeAuditRecordFormDTO; +import com.epmet.entity.CodeAuditRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 代码审核记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-15 + */ +@Mapper +public interface CodeAuditRecordDao extends BaseDao { + + /** + * @Description 插入代码审核结果 + * @param formDTO + * @author zxc + */ + void insertCodeAuditRecord(CodeAuditRecordFormDTO formDTO); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java index efbb43e81e..b9cba62dd4 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java @@ -20,14 +20,23 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.CodeAuditResultEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** - * 代码审核j结果 + * 代码审核结果 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-07-09 */ @Mapper public interface CodeAuditResultDao extends BaseDao { - + + /** + * @Description 更新 代码审核结果中的审核状态 + * @param customerId + * @param codeCustomerId + * @author zxc + */ + void updateAuditResult(@Param("customerId")String customerId,@Param("codeCustomerId")String codeCustomerId,@Param("codeResult")String codeResult); + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java index fe783081fd..5d7f60d4ae 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java @@ -18,8 +18,11 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.CodeAuditRecordFormDTO; +import com.epmet.dto.result.TemplateAndAppIdResultDTO; import com.epmet.entity.CodeCustomerEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 客户代码关联表 @@ -29,5 +32,20 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CodeCustomerDao extends BaseDao { - + + /** + * @Description 根据客户id和客户端类型获取 代码模板ID和授权方AppId + * @param customerId + * @param clientType + * @author zxc + */ + TemplateAndAppIdResultDTO selectTemplateAndAppId(@Param("customerId")String customerId,@Param("clientType")String clientType); + + /** + * @Description 查询 code_customer 表ID + * @param codeAuditRecord + * @author zxc + */ + String selectCodeCustomerId(CodeAuditRecordFormDTO codeAuditRecord); + } \ 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 4615c22728..7548335085 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 @@ -22,6 +22,8 @@ import com.epmet.dto.form.ComponentAccessTokenFormDTO; import com.epmet.entity.ComponentAccessTokenEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 第三方平台调用凭证 * @@ -38,6 +40,25 @@ public interface ComponentAccessTokenDao extends BaseDao { + /** + * @Description 插入 票据【component_verify_ticket】 + * @param formDTO + * @author zxc + */ void insertComponentVerifyTicket(ComponentVerifyTicketFormDTO formDTO); + + /** + * @Description 逻辑删除 【component_verify_ticket】 + * @param + * @author zxc + */ + void updateOldComponentVerifyTicket(); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java index 7b3db18170..c8609064e9 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java @@ -19,11 +19,13 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerMpDTO; +import com.epmet.dto.form.AuthCodeFormDTO; import com.epmet.entity.CustomerMpEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; +import org.apache.ibatis.annotations.Param; /** * 客户小程序关系表 @@ -49,4 +51,34 @@ public interface CustomerMpDao extends BaseDao { * @Description 查询所有客户小程序的授权信息 **/ List selectAll(); + + /** + * @Description 查询授权的数量 + * @param customerId + * @author zxc + */ + Integer selectAuthCount(@Param("customerId")String customerId); + + /** + * @Description 回填customer_mp的appId + * @param formDTO + * @author zxc + */ + void updateAppIDByCustomerIdAndClient(AuthCodeFormDTO formDTO); + + /** + * @Description 修改小程序授权的状态 + * @param authAppId + * @author zxc + */ + void updateAuthorizationFlag(@Param("authAppId")String authAppId); + + /** + * @Description 根据 客户Id和授权方AppId查询clientType + * @param customerId + * @param authAppId + * @author zxc + */ + String selectClientTypeByCustomerIdAndAuthId(@Param("customerId")String customerId,@Param("authAppId")String authAppId); + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniCategoryInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniCategoryInfoDao.java new file mode 100644 index 0000000000..e233f5372b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniCategoryInfoDao.java @@ -0,0 +1,44 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.MiniCategoryInfoFormDTO; +import com.epmet.entity.MiniCategoryInfoEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 小程序配置类目信息表 小程序配置类目信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-13 + */ +@Mapper +public interface MiniCategoryInfoDao extends BaseDao { + + /** + * @Description 小程序配置的类目信息插入 + * @param miniCategoryInfoList + * @author zxc + */ + void insertCategoryInfo(@Param("miniCategoryInfoList") List miniCategoryInfoList); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniInfoDao.java new file mode 100644 index 0000000000..26e7dbf7e8 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniInfoDao.java @@ -0,0 +1,50 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.MiniInfoFormDTO; +import com.epmet.dto.result.CustomerIdAndClientResultDTO; +import com.epmet.entity.MiniInfoEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 小程序信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-13 + */ +@Mapper +public interface MiniInfoDao extends BaseDao { + + /** + * @Description 插入小程序信息 + * @param formDTO + * @author zxc + */ + void insertMiniInfo(MiniInfoFormDTO formDTO); + + /** + * @Description 根据原始ID查询 customerId 和 clientType + * @param toUserName + * @author zxc + */ + CustomerIdAndClientResultDTO selectCustomerIdAndClientByToUserName(@Param("toUserName")String toUserName); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniNetworkInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniNetworkInfoDao.java new file mode 100644 index 0000000000..361d4bb256 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/MiniNetworkInfoDao.java @@ -0,0 +1,44 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.MiniNetworkInfoFormDTO; +import com.epmet.entity.MiniNetworkInfoEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 小程序配置合法域名信息表 小程序配置合法域名信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-13 + */ +@Mapper +public interface MiniNetworkInfoDao extends BaseDao { + + /** + * @Description 小程序配置的合法域名信息插入 + * @param networkInfoList + * @author zxc + */ + void insertNetworkInfo(@Param("networkInfoList") List networkInfoList); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/RefreshAuthorizerAccessTokenDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenPlatformAccountDao.java similarity index 54% rename from epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/RefreshAuthorizerAccessTokenDao.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenPlatformAccountDao.java index ecd62336d5..2ec5ef1588 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/RefreshAuthorizerAccessTokenDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenPlatformAccountDao.java @@ -18,42 +18,34 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.form.AuthorizerAccessTokenFormDTO; -import com.epmet.dto.result.WillOverDueResultDTO; -import com.epmet.entity.RefreshAuthorizerAccessTokenEntity; +import com.epmet.dto.form.CreateOpenFormDTO; +import com.epmet.dto.result.CreateOpenResultDTO; +import com.epmet.entity.OpenPlatformAccountEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import java.util.List; - /** - * 获取/刷新接口调用令牌记录表 + * 开放平台账号表 + * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-08 + * @since v1.0.0 2020-07-13 */ @Mapper -public interface RefreshAuthorizerAccessTokenDao extends BaseDao { +public interface OpenPlatformAccountDao extends BaseDao { /** - * @Description 查询即将过期的 authorizer_access_token - * @param + * @Description 插入开放平台账号 + * @param coForm * @author zxc */ - List checkWillOverDue(); + void insertOpenPlatFormAccount(CreateOpenFormDTO coForm); /** - * @Description 插入 authorizer_access_token - * @param refreshAccessToken - * @author zxc - */ - void insertAuthorizerAccessToken(AuthorizerAccessTokenFormDTO refreshAccessToken); - - /** - * @Description 逻辑删除 授权方的authorizer_access_token + * @Description 根据客户Id查询已绑定开放平台的账号ID * @param customerId * @author zxc */ - void updateOldAuthorizerAccessToken(@Param("customerId")String customerId); - + String selectOpenAppIdByCustomerId(@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/PaInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaInfoDao.java new file mode 100644 index 0000000000..f605e6a7d3 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaInfoDao.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.PaInfoFormDTO; +import com.epmet.entity.PaInfoEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 公众号信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-13 + */ +@Mapper +public interface PaInfoDao extends BaseDao { + + /** + * @Description 公众号信息插入 + * @param formDTO + * @author zxc + */ + void insertPaInfo(PaInfoFormDTO formDTO); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthCodeEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthCodeEntity.java index fd9d829d2c..3ab4b6607d 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthCodeEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthCodeEntity.java @@ -29,7 +29,7 @@ import java.util.Date; * 授权回调url反参表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data @EqualsAndHashCode(callSuper=false) @@ -43,6 +43,11 @@ public class AuthCodeEntity extends BaseEpmetEntity { */ private String customerId; + /** + * resi:居民端,work:工作端 + */ + private String clientType; + /** * 授权方APPID */ @@ -54,8 +59,8 @@ public class AuthCodeEntity extends BaseEpmetEntity { private String authCode; /** - * 有效期 10min + * 到期时间 */ - private Integer expiresIn; + private Date expiresInTime; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthResultRecordEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthResultRecordEntity.java new file mode 100644 index 0000000000..c9fd91b40f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthResultRecordEntity.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 授权结果记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-15 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("auth_result_record") +public class AuthResultRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 第三方平台AppId 第三方平台AppId + */ + private String componentAppId; + + /** + * 微信返回创建时间 微信返回创建时间 + */ + private Date wechatCreateTime; + + /** + * 通知类型 + */ + private String infoType; + + /** + * 授权方AppId + */ + private String authorizerAppId; + + /** + * 授权码(auth_code) + */ + private String authorizationCode; + + /** + * 授权码过期时间 + */ + private Date expiresInTime; + + /** + * 预授权码 + */ + private String preAuthCode; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizationInfoEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizationInfoEntity.java index f774abb2cf..372c8265b6 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizationInfoEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizationInfoEntity.java @@ -29,7 +29,7 @@ import java.util.Date; * 授权信息表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data @EqualsAndHashCode(callSuper=false) @@ -49,14 +49,14 @@ public class AuthorizationInfoEntity extends BaseEpmetEntity { private String authorizerAppid; /** - * 接口调用令牌(在授权的公众号/小程序具备 API 权限时,才有此返回值) + * 接口调用令牌(在授权的公众号/小程序具备 API 权限时,才有此返回值)【第三方和微信交互使用】 */ private String authorizerAccessToken; /** - * authorizer_access_token 的有效期(在授权的公众号/小程序具备API权限时,才有此返回值),单位:秒 + * 到期时间 */ - private Integer expiresIn; + private Date expiresInTime; /** * 刷新令牌(在授权的公众号具备API权限时,才有此返回值),刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token。一旦丢失,只能让用户重新授权,才能再次拿到新的刷新令牌。用户重新授权后,之前的刷新令牌会失效 diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/RefreshAuthorizerAccessTokenEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/BindingAccountEntity.java similarity index 72% rename from epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/RefreshAuthorizerAccessTokenEntity.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/BindingAccountEntity.java index 0a5c9ddfe2..bf30343ad0 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/RefreshAuthorizerAccessTokenEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/BindingAccountEntity.java @@ -26,41 +26,36 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 获取/刷新接口调用令牌记录表 + * 公众号/小程序绑定开放平台帐号表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("refresh_authorizer_access_token") -public class RefreshAuthorizerAccessTokenEntity extends BaseEpmetEntity { +@TableName("binding_account") +public class BindingAccountEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; /** - * 授权方令牌 + * 开放平台账号ID 开放平台账号ID */ - private String authorizerAccessToken; + private String openPlatformAccountId; /** - * 有效期,单位:秒 + * 公众号/小程序APPID(授权方APPID) 授权方APPID */ - private Integer expiresIn; + private String authAppId; /** - * 刷新令牌 + * 客户ID 客户ID */ - private String authorizerRefreshToken; - - /** - * 授权方APPID - */ - private String authAppid; + private String customerId; /** - * 客户ID + * 客户端 居民端:resi,工作端:work */ - private String customerId; + private String clientType; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/BusinessInfoEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/BusinessInfoEntity.java new file mode 100644 index 0000000000..7f49030d68 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/BusinessInfoEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 功能开通状况表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("business_info") +public class BusinessInfoEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 主表ID 主表ID + */ + private String primaryId; + + /** + * 功能类型 open_store:是否开通微信门店功能 open_scan:是否开通微信扫商品功能 open_pay:是否开通微信支付功能 open_card:是否开通微信卡券功能 open_shake:是否开通微信摇一摇功能 + */ + private String funcType; + + /** + * 开通状态 0:未开通,1:已开通 + */ + private Integer openStatus; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeAuditRecordEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeAuditRecordEntity.java new file mode 100644 index 0000000000..2f75ae13cb --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeAuditRecordEntity.java @@ -0,0 +1,114 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 代码审核记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-15 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("code_audit_record") +public class CodeAuditRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 模板ID + */ + private String templateId; + + /** + * 客户端类型:resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 授权方AppId + */ + private String authAppId; + + /** + * 小程序的原始 ID + */ + private String toUserName; + + /** + * 发送方帐号(一个 OpenID,此时发送方是系统帐号) + */ + private String fromUserName; + + /** + * 消息创建时间 (整型),时间戳 + */ + private Date wechatCreateTime; + + /** + * 消息类型 event + */ + private String msgType; + + /** + * 事件类型 +weapp_audit_success:审核通过, +weapp_audit_fail:审核不通过, +weapp_audit_delay:审核延后 + */ + private String event; + + /** + * 审核成功时的时间戳 + */ + private Date succTime; + + /** + * 审核不通过的时间戳 + */ + private Date failTime; + + /** + * 审核延后时的时间戳 + */ + private Date delayTime; + + /** + * 审核不通过的原因 + */ + private String reason; + + /** + * 审核不通过的截图示例。用 | 分隔的 media_id 的列表,可通过获取永久素材接口拉取截图内容 + */ + private String screenShot; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentAccessTokenEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentAccessTokenEntity.java index 47ed337383..c2b35c1cd4 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentAccessTokenEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentAccessTokenEntity.java @@ -29,7 +29,7 @@ import java.util.Date; * 第三方平台调用凭证 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data @EqualsAndHashCode(callSuper=false) @@ -44,8 +44,8 @@ public class ComponentAccessTokenEntity extends BaseEpmetEntity { private String componentAccessToken; /** - * 令牌有效期 单位:s 最长 60*60*2 + * 令牌到期时间 */ - private Integer expiresIn; + private Date expiresInTime; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentVerifyTicketEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentVerifyTicketEntity.java index dd39c42496..f11ad037e9 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentVerifyTicketEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ComponentVerifyTicketEntity.java @@ -29,7 +29,7 @@ import java.util.Date; * 微信发送的ticket表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-08 + * @since v1.0.0 2020-07-14 */ @Data @EqualsAndHashCode(callSuper=false) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/FuncInfoEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/FuncInfoEntity.java index fd32f8067f..409174b938 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/FuncInfoEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/FuncInfoEntity.java @@ -29,7 +29,7 @@ import java.util.Date; * 授权给开发者的权限集列表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data @EqualsAndHashCode(callSuper=false) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniCategoryInfoEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniCategoryInfoEntity.java new file mode 100644 index 0000000000..4ba976c442 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniCategoryInfoEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 小程序配置类目信息表 小程序配置类目信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("mini_category_info") +public class MiniCategoryInfoEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 主表ID + */ + private String primaryId; + + /** + * 类目排序 first , second + */ + private String categorySort; + + /** + * 类目名称 资讯,文娱...... + */ + private String categoryName; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniInfoEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniInfoEntity.java new file mode 100644 index 0000000000..b45f524a0b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniInfoEntity.java @@ -0,0 +1,91 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 小程序信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("mini_info") +public class MiniInfoEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImg; + + /** + * 小程序类型 默认为 0 + */ + private String serviceTypeInfo; + + /** + * 小程序认证类型 小程序认证类型 + */ + private String verifyTypeInfo; + + /** + * 原始 ID + */ + private String userName; + + /** + * 主体名称 + */ + private String principalName; + + /** + * 账号介绍 + */ + private String signature; + + /** + * 二维码图片的 URL + */ + private String qrcodeUrl; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniNetworkInfoEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniNetworkInfoEntity.java new file mode 100644 index 0000000000..e873f52ecb --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/MiniNetworkInfoEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 小程序配置合法域名信息表 小程序配置合法域名信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("mini_network_info") +public class MiniNetworkInfoEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 主表ID 主表ID + */ + private String primaryId; + + /** + * 类型 + */ + private String networkType; + + /** + * 域名 RequestDomain,WsRequestDomain,UploadDomain,DownloadDomain + */ + private String url; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizerRefreshTokenEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/OpenPlatformAccountEntity.java similarity index 79% rename from epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizerRefreshTokenEntity.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/OpenPlatformAccountEntity.java index 1f6d7127d4..892de984ac 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/AuthorizerRefreshTokenEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/OpenPlatformAccountEntity.java @@ -26,26 +26,27 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 授权方的刷新令牌表 + * 开放平台账号表 + * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("authorizer_refresh_token") -public class AuthorizerRefreshTokenEntity extends BaseEpmetEntity { +@TableName("open_platform_account") +public class OpenPlatformAccountEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; /** - * 授权方的刷新令牌 + * openId 所创建的开放平台帐号的 appid */ - private String authorizerRefreshToken; + private String openAppId; /** - * 授权方appid + * 客户ID 客户ID */ - private String authorizerAppid; + private String customerId; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaInfoEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaInfoEntity.java new file mode 100644 index 0000000000..7968591b02 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaInfoEntity.java @@ -0,0 +1,99 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 公众号信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pa_info") +public class PaInfoEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户端类型 resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImg; + + /** + * 公众号类型 0:订阅号 +1:由历史老帐号升级后的订阅号 +2:服务号 + */ + private String serviceTypeInfo; + + /** + * 公众号认证类型 -1:未认证 +0:微信认证 +1:新浪微博认证 +2:腾讯微博认证 +3:已资质认证通过但还未通过名称认证 +4:已资质认证通过、还未通过名称认证,但通过了新浪微博认证 +5:已资质认证通过、还未通过名称认证,但通过了腾讯微博认证 + */ + private String verifyTypeInfo; + + /** + * 原始ID + */ + private String userName; + + /** + * 主体名称 + */ + private String principalName; + + /** + * 公众号所设置的微信号,可能为空 公众号所设置的微信号,可能为空 + */ + private String alias; + + /** + * 二维码图片的 URL + */ + private String qrcodeUrl; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PreAuthTokenEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PreAuthTokenEntity.java index 9ccb82efe1..90ee22dd33 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PreAuthTokenEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PreAuthTokenEntity.java @@ -29,7 +29,7 @@ import java.util.Date; * 预授权码历史记录表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-09 + * @since v1.0.0 2020-07-14 */ @Data @EqualsAndHashCode(callSuper=false) @@ -44,8 +44,8 @@ public class PreAuthTokenEntity extends BaseEpmetEntity { private String preAuthToken; /** - * 预授权码有效期 单位:s 最长 60*60*2 + * 预授权码有效期 */ - private Integer expiresIn; + private Date expiresInTime; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java index 07324228de..de326be7d7 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.constant.ModuleConstant; import com.epmet.constant.ThirdRedisKeyConstant; import com.epmet.dto.form.AuthCodeFormDTO; +import com.epmet.dto.form.AuthorizationInfoFormDTO; import com.epmet.dto.form.AuthorizerAccessTokenFormDTO; import com.epmet.dto.result.AuthorizationInfoResultDTO; import lombok.extern.slf4j.Slf4j; @@ -37,15 +38,14 @@ public class RedisThird { /** * @Description 获取 component_verify_ticket - * @param key * @author zxc */ - public String getComponentVerifyTicket(String key){ + public String getComponentVerifyTicket(){ return redisTemplate.opsForValue().get(ThirdRedisKeyConstant.TICKET_REDIS_KEY).toString(); } /** - * @Description 缓存 component_access_token 有效期:1小时59分钟 (官网有效期:2H) + * @Description 缓存 component_access_token 有效期: (官网有效期:2H) * @param accessToken * @author zxc */ @@ -56,38 +56,36 @@ public class RedisThird { /** * @Description 获取 component_access_token - * @param key * @author zxc */ - public String getComponentAccessToken(String key){ - return redisTemplate.opsForValue().get(ThirdRedisKeyConstant.ACCESS_TOKEN_REDIS_KEY+key).toString(); + public String getComponentAccessToken(){ + return redisTemplate.opsForValue().get(ThirdRedisKeyConstant.ACCESS_TOKEN_REDIS_KEY).toString(); } /** * @Description 缓存 pre_auth_code 有效期: (官方有效期 10分钟) * @param authCode pre_auth_code 预授权码 - * @param expiresIn expires_in 有效期 * @author zxc */ - public void setPreAuthCode(String authCode,Integer expiresIn){ - redisUtils.set(ThirdRedisKeyConstant.PRE_AUTH_CODE_REDIS_KEY+ModuleConstant.PRE_AUTH_CODE,authCode,-1); + public void setPreAuthCode(String authCode){ + redisUtils.set(ThirdRedisKeyConstant.PRE_AUTH_CODE_REDIS_KEY,authCode,-1); } /** - * @Description 缓存 刷新令牌 + * @Description 缓存 刷新令牌 【授权信息(不包括 授权给开发者的权限集列表)】 * (在授权的公众号具备API权限时,才有此返回值),刷新令牌主要用于第三方平台获取和刷新已授权用户的 authorizer_access_token。 * 一旦丢失,只能让用户重新授权,才能再次拿到新的刷新令牌。用户重新授权后,之前的刷新令牌会失效 - * @param refreshAccessToken + * @param authInfoDTO * @author zxc */ - public void setAuthorizerRefreshToken(AuthorizerAccessTokenFormDTO refreshAccessToken){ - String key = ThirdRedisKeyConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY + ThirdRedisKeyConstant.COLON + refreshAccessToken.getCustomerId()+ThirdRedisKeyConstant.COLON+refreshAccessToken.getAuthAppid(); - redisUtils.set(key,refreshAccessToken,-1); + public void setAuthorizerRefreshToken(AuthorizationInfoFormDTO authInfoDTO){ + String key = ThirdRedisKeyConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY + ThirdRedisKeyConstant.COLON + authInfoDTO.getCustomerId()+ThirdRedisKeyConstant.COLON+authInfoDTO.getClientType(); + redisUtils.set(key,authInfoDTO,-1); } /** * @Description 获取刷新 - * @param key + * @param key = epmet:wechartthird:authorizerrefreshtoken:customerId:clientType * @author zxc */ public String getAuthorizerRefreshToken(String key){ @@ -100,7 +98,7 @@ public class RedisThird { * @author zxc */ public void setAuthCode(AuthCodeFormDTO formDTO){ - String key = ThirdRedisKeyConstant.AUTH_CODE_REDIS_KEY+ThirdRedisKeyConstant.COLON+formDTO.getCustomerId(); + String key = ThirdRedisKeyConstant.AUTH_CODE_REDIS_KEY+ThirdRedisKeyConstant.COLON+formDTO.getCustomerId()+ThirdRedisKeyConstant.COLON+formDTO.getClientType(); redisUtils.set(key,formDTO,-1); } @@ -115,7 +113,7 @@ public class RedisThird { } /** - * @Description 缓存授权信息 + * @Description 缓存授权信息【完整的,包括 授权给开发者的权限集列表 】 * @param authInfo * @author zxc */ @@ -123,4 +121,15 @@ public class RedisThird { redisUtils.set(ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY,authInfo,-1); } + /** + * @Description 缓存 刷新后的 授权方令牌 【authorizer_access_token】 和 刷新令牌 【authorizer_refresh_token】 + * @param refreshAccessToken + * @param clientType + * @author zxc + */ + /*public void setAuthorizerRefreshToken(AuthorizerAccessTokenFormDTO refreshAccessToken,String clientType){ + String key = ThirdRedisKeyConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY + ThirdRedisKeyConstant.COLON + refreshAccessToken.getCustomerId()+ThirdRedisKeyConstant.COLON+clientType; + redisUtils.set(key,refreshAccessToken,-1); + }*/ + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java new file mode 100644 index 0000000000..30fa445a54 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java @@ -0,0 +1,20 @@ +package com.epmet.service; + +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.form.GoToAuthFormDTO; +import com.epmet.dto.result.GoToAuthResultDTO; + +/** + * @Author zxc + * @CreateTime 2020/7/10 15:52 + */ +public interface AppLetAuthorizationService { + + /** + * @Description 小程序点击“去授权”的时候 + * @param tokenDto + * @author zxc + */ + GoToAuthResultDTO goToAuth(TokenDto tokenDto, GoToAuthFormDTO formDTO); + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java index a20ff2d1f4..2fb00e3322 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java @@ -1,7 +1,5 @@ package com.epmet.service; -import com.epmet.commons.tools.security.dto.TokenDto; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -29,7 +27,7 @@ public interface ComponentVerifyTicketService { * @Description 每个预授权码有效期为 10 分钟。需要先获取令牌才能调用 获取预授权码 * @author zxc */ - void preAuthCode(); + String preAuthCode(); /** * @Description 获取/刷新接口调用令牌 @@ -43,6 +41,6 @@ public interface ComponentVerifyTicketService { * @param * @author zxc */ - void redirectUri(HttpServletRequest request, HttpServletResponse response, TokenDto tokenDto,String authAppId); + void redirectUri(HttpServletRequest request, HttpServletResponse response); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java new file mode 100644 index 0000000000..49d182479a --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java @@ -0,0 +1,60 @@ +package com.epmet.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.constant.ModuleConstant; +import com.epmet.constant.ThirdApiConstant; +import com.epmet.dao.ComponentAccessTokenDao; +import com.epmet.dao.PaCustomerAgencyDao; +import com.epmet.dto.form.GoToAuthFormDTO; +import com.epmet.dto.result.GoToAuthResultDTO; +import com.epmet.redis.RedisThird; +import com.epmet.service.AppLetAuthorizationService; +import com.epmet.service.ComponentVerifyTicketService; +import com.google.gson.JsonObject; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + * @Author zxc + * @CreateTime 2020/7/10 15:52 + */ +@Slf4j +@Service +public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationService { + + @Autowired + private PaCustomerAgencyDao paCustomerAgencyDao; + @Autowired + private ComponentVerifyTicketService componentVerifyTicketService; + @Autowired + private ComponentAccessTokenDao componentAccessTokenDao; + @Autowired + private RedisThird redisThird; + @Value("${third.platform.appId}") + private String componentAppId; + + /** + * @Description 小程序点击“去授权”的时候 + * @param tokenDto + * @author zxc + */ + @Override + public GoToAuthResultDTO goToAuth(TokenDto tokenDto, GoToAuthFormDTO formDTO) { + GoToAuthResultDTO result = new GoToAuthResultDTO(); + String userId = tokenDto.getUserId(); + String customerId = paCustomerAgencyDao.getCustomerIdByUserId(userId); + //获取预授权码 + String preAuthCode = componentVerifyTicketService.preAuthCode(); + String redirectUrl = String.format(ThirdApiConstant.API_RETURN_REDIRECT_URL, formDTO.getClientType(), customerId); + String authUrl = String.format(ThirdApiConstant.API_AUTH_REGISTER_URL, componentAppId, preAuthCode, redirectUrl); + result.setUrl(authUrl); + return result; + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index cb13287289..38d4a12b86 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -5,14 +5,15 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.nacos.client.config.utils.IOUtils; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.constant.ModuleConstant; import com.epmet.constant.ThirdApiConstant; import com.epmet.constant.ThirdRunTimeInfoConstant; import com.epmet.dao.*; import com.epmet.dto.form.*; +import com.epmet.dto.result.AuthCodeResultDTO; import com.epmet.dto.result.AuthorizationInfoResultDTO; +import com.epmet.dto.result.CreateOpenResultDTO; import com.epmet.dto.result.WillOverDueResultDTO; import com.epmet.redis.RedisThird; import com.epmet.service.ComponentVerifyTicketService; @@ -22,7 +23,9 @@ import com.epmet.util.XmlUtil; import com.github.pagehelper.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -31,9 +34,11 @@ import javax.servlet.http.HttpServletResponse; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneOffset; import java.util.*; -import static com.epmet.constant.ThirdPlatformConstant.*; import static com.epmet.constant.ThirdRunTimeInfoConstant.*; /** @@ -59,9 +64,30 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe @Autowired private FuncInfoDao funcInfoDao; @Autowired - private PaCustomerAgencyDao paCustomerAgencyDao; + private CustomerMpDao customerMpDao; @Autowired - private RefreshAuthorizerAccessTokenDao refreshAuthorizerAccessTokenDao; + private PaInfoDao paInfoDao; + @Autowired + private OpenPlatformAccountDao openPlatformAccountDao; + @Autowired + private BindingAccountDao bindingAccountDao; + @Autowired + private MiniInfoDao miniInfoDao; + @Autowired + private MiniNetworkInfoDao miniNetworkInfoDao; + @Autowired + private MiniCategoryInfoDao miniCategoryInfoDao; + @Autowired + private BusinessInfoDao businessInfoDao; + + @Value("${third.platform.appId}") + private String componentAppId; + @Value("${third.platform.appSecret}") + private String appSecret; + @Value("${third.platform.aesKey}") + private String aesKey; + @Value("${third.platform.token}") + private String token; /** * @Description 获得授权事件的票据 @@ -98,7 +124,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe if(StringUtil.isEmpty(encrypt)) { msg = fromXML; } else { - wxcpt = new WXBizMsgCrypt(PLATFORM_COMPONENT_TOKEN,PLATFORM_AES_KEY, PLATFORM_APP_ID); + wxcpt = new WXBizMsgCrypt(token,aesKey, componentAppId); // 解密消息 msg = wxcpt.decryptMsg(msgSignature, timeStamp, nonce, fromXML); } @@ -108,30 +134,49 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String infotype = result.get(ModuleConstant.INFO_TYPE); //获取infotype,注:微信开放平台文档中标明固定为:"component_verify_ticket",但参考其他代码,还包含authorized??? log.info(infotype); switch (infotype){ - case ModuleConstant.TICKET_UNDERLINE_KEY: //验证票据 + case ModuleConstant.TICKET_UNDERLINE_KEY: //接收票据 【component_verify_ticket】 String ComponentVerifyTicket = result.get(ModuleConstant.TICKET_KEY); // 缓存 ticket redisThird.setComponentVerifyTicket(ComponentVerifyTicket); // 存数据库 ComponentVerifyTicketFormDTO ticketFormDTO = new ComponentVerifyTicketFormDTO(); - ticketFormDTO.setAppid(PLATFORM_APP_ID); + ticketFormDTO.setComponentAppId(componentAppId); ticketFormDTO.setComponentVerifyTicket(ComponentVerifyTicket); + //先逻辑删 + ticketDao.updateOldComponentVerifyTicket(); ticketDao.insertComponentVerifyTicket(ticketFormDTO); log.info(ModuleConstant.TICKET_UNDERLINE_KEY+":"+ComponentVerifyTicket); break; + case ModuleConstant.AUTHORIZED: //授权成功 + // 更改customer_mp 授权信息,appId,并绑定 + String authAppId = result.get(ModuleConstant.APP_ID); + String authCode = result.get(ModuleConstant.AUTHORIZATION_CODE_HUMP); + AuthCodeResultDTO authCodeResultDTO = authCodeDao.selectCustomerIdByAuthCode(authCode); + String clientType = authCodeResultDTO.getClientType(); + String customerId = authCodeResultDTO.getCustomerId(); + this.updateCustomerMpAppIdAndCreateOpenPlatform(customerId,authAppId,clientType); + this.authInfoByAuthCode(authCode, customerId,clientType); + authCodeDao.updateAppId(customerId,clientType,authAppId); + this.saveAuthAccountInfo(customerId,authAppId,clientType); +// customerMpDao.updateAuthorizationFlag(authAppId); case ModuleConstant.UNAUTHORIZED://用户取消授权 - return ModuleConstant.NULL_CHAR; + return ModuleConstant.SUCCESS; } } catch (Exception e) { log.error(e.getMessage()); - return ModuleConstant.NULL_CHAR; + return ModuleConstant.SUCCESS; } log.info(ThirdRunTimeInfoConstant.END_TICKET); + Integer tokenCount = componentAccessTokenDao.selectAccessTokenCount(); + if (tokenCount == NumConstant.ZERO){ + this.getComponentAccessToken(); + } return ModuleConstant.SUCCESS; } /** - * @Description 定时获取 (令牌,component_access_token) + * @Description 定时获取 (令牌,component_access_token) 第三方与微信交互使用的component_access_token + * 每十分钟执行一次,判断是否有马上超时的(15分钟以内算马上超时) * @param * @author zxc */ @@ -140,35 +185,39 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe public void getComponentAccessToken() { log.info(ThirdRunTimeInfoConstant.START_GET_COMPONENT_ACCESS_TOKEN); Map reMap; - try { - // 核心定时器 - String componentVerifyTicket = redisThird.getComponentVerifyTicket(ModuleConstant.TICKET_UNDERLINE_KEY); - JSONObject jsonObject = new JSONObject(); - jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); - jsonObject.put(ModuleConstant.COMPONENT_APPSECRET, PLATFORM_APP_SECRET); - jsonObject.put(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket); - String post = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_COMPONENT_TOKEN_URL, JSON.toJSONString(jsonObject)).getData(); - HashMap hashMap = JSON.parseObject(post, HashMap.class); - String componentAccessToken = hashMap.get(ModuleConstant.COMPONENT_ACCESS_TOKEN); - String expiresIn = hashMap.get(ModuleConstant.EXPIRES_IN); - if (StringUtils.isNotEmpty(componentAccessToken)) { - //令牌信息存DB - ComponentAccessTokenFormDTO formDTO = new ComponentAccessTokenFormDTO(); - formDTO.setComponentAccessToken(componentAccessToken); - formDTO.setExpiresIn(Integer.valueOf(expiresIn)); - //先逻辑删,在插入 - log.info(ThirdRunTimeInfoConstant.START_DELETE_COMPONENT_ACCESS_TOKEN); - componentAccessTokenDao.updateOldComponentAccessToken(); - componentAccessTokenDao.insertComponentAccessToken(formDTO); - //存缓存 - redisThird.setComponentAccessToken(componentAccessToken); - } else { - throw new RenException(ThirdRunTimeInfoConstant.FAILURE_ACCESS_TOKEN); + //距离超时时间小于15分钟的数量 + Integer tokenCount = componentAccessTokenDao.selectWillOverTokenCount(); + if (tokenCount > NumConstant.ZERO) { + try { + String componentVerifyTicket = redisThird.getComponentVerifyTicket(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId); + jsonObject.put(ModuleConstant.COMPONENT_APPSECRET, appSecret); + jsonObject.put(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket); + String post = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_COMPONENT_TOKEN_URL, JSON.toJSONString(jsonObject)).getData(); + HashMap hashMap = JSON.parseObject(post, HashMap.class); + String componentAccessToken = hashMap.get(ModuleConstant.COMPONENT_ACCESS_TOKEN); + String expiresIn = hashMap.get(ModuleConstant.EXPIRES_IN); + Date expiresInTime = this.countExpirationTime(expiresIn); + if (StringUtils.isNotEmpty(componentAccessToken)) { + //令牌信息存DB + ComponentAccessTokenFormDTO formDTO = new ComponentAccessTokenFormDTO(); + formDTO.setComponentAccessToken(componentAccessToken); + formDTO.setExpiresInTime(expiresInTime); + //先逻辑删,在插入 + log.info(ThirdRunTimeInfoConstant.START_DELETE_COMPONENT_ACCESS_TOKEN); + componentAccessTokenDao.updateOldComponentAccessToken(); + componentAccessTokenDao.insertComponentAccessToken(formDTO); + //存缓存 + redisThird.setComponentAccessToken(componentAccessToken); + } else { + throw new RenException(ThirdRunTimeInfoConstant.FAILURE_ACCESS_TOKEN); + } + } catch (Exception e) { + e.printStackTrace(); } - } catch (Exception e) { - e.printStackTrace(); + log.info(ThirdRunTimeInfoConstant.SUCCESS_ACCESS_TOKEN); } - log.info(ThirdRunTimeInfoConstant.SUCCESS_ACCESS_TOKEN); } /** @@ -178,28 +227,29 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe */ @Transactional(rollbackFor = Exception.class) @Override - public void preAuthCode() { + public String preAuthCode() { log.info(START_GET_PRE_AUTH_CODE); + String preAuthCode = ""; try { - String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN); + String accessToken = redisThird.getComponentAccessToken(); JSONObject jsonObject = new JSONObject(); - jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); + jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId); String post = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); log.info(String.format(POST_RESULT,post)); HashMap hashMap = JSON.parseObject(post, HashMap.class); - String preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE); + preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE); String expiresIn = hashMap.get(ModuleConstant.EXPIRES_IN); - int ex = Integer.valueOf(expiresIn) - NumConstant.SIXTY; + Date expiresInTime = this.countExpirationTime(expiresIn); if (StringUtils.isNotEmpty(preAuthCode)) { //预授权码 存DB PreAuthTokenFormDTO formDTO = new PreAuthTokenFormDTO(); formDTO.setPreAuthToken(preAuthCode); - formDTO.setExpiresIn(ex); + formDTO.setExpiresInTime(expiresInTime); //先逻辑删除,在插入DB preAuthTokenDao.updateOldPreAuthCode(); preAuthTokenDao.insertPreAuthToken(formDTO); //预授权码 放入缓存 - redisThird.setPreAuthCode(preAuthCode,ex); + redisThird.setPreAuthCode(preAuthCode); } else { throw new RuntimeException(FAILURE_GET_PRE_AUTH_CODE); } @@ -207,6 +257,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe e.printStackTrace(); } log.info(END_GET_PRE_AUTH_CODE); + return preAuthCode; } /** @@ -214,40 +265,33 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe * @author zxc */ @Transactional(rollbackFor = Exception.class) - public AuthorizationInfoResultDTO authInfoByAuthCode(String authCode,String authAppId,String customerId) { + public AuthorizationInfoResultDTO authInfoByAuthCode(String authCode,String customerId,String clientType) { log.info(START_GET_AUTH_INFO); AuthorizationInfoResultDTO authorizationInfoResultDTO = new AuthorizationInfoResultDTO(); // 获取令牌【component_access_token】 - String accessToken = redisThird.getComponentAccessToken(ModuleConstant.COMPONENT_ACCESS_TOKEN); + String accessToken = redisThird.getComponentAccessToken(); // 使用授权码获取授权信息 JSONObject jsonObject = new JSONObject(); - jsonObject.put(ModuleConstant.COMPONENT_APPID, PLATFORM_APP_ID); + jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId); jsonObject.put(ModuleConstant.AUTHORIZATION_CODE, authCode); String authInfo = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_QUERY_AUTH_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); HashMap hashMap = JSON.parseObject(authInfo, HashMap.class); Map map = hashMap.get(ModuleConstant.AUTHORIZATION_INFO); authorizationInfoResultDTO = mapToEntity(map, AuthorizationInfoResultDTO.class); + String expiresIn = authorizationInfoResultDTO.getExpires_in(); + Date expiresInTime = this.countExpirationTime(expiresIn); //授权信息分为两张表,基础信息authorization_info,授权列表func_info // 1. 基础信息 AuthorizationInfoFormDTO authInfoDTO = new AuthorizationInfoFormDTO(); authInfoDTO.setAuthorizerAppid(authorizationInfoResultDTO.getAuthorizer_appid()); authInfoDTO.setAuthorizerAccessToken(authorizationInfoResultDTO.getAuthorizer_access_token()); authInfoDTO.setAuthorizerRefreshToken(authorizationInfoResultDTO.getAuthorizer_refresh_token()); - authInfoDTO.setExpiresIn(Integer.valueOf(authorizationInfoResultDTO.getExpires_in())); + authInfoDTO.setExpiresInTime(expiresInTime); authInfoDTO.setCustomerId(customerId); + authInfoDTO.setClientType(clientType); //先逻辑删除,在插入 - authorizationInfoDao.updateOldAuthorizationInfo(customerId); + authorizationInfoDao.updateOldAuthorizationInfo(customerId,clientType); authorizationInfoDao.insertAuthorizationInfo(authInfoDTO); - // 获取/刷新接口调用令牌记录表 插入 - AuthorizerAccessTokenFormDTO refreshAccessToken = new AuthorizerAccessTokenFormDTO(); - refreshAccessToken.setAuthAppid(authAppId); - refreshAccessToken.setCustomerId(customerId); - refreshAccessToken.setAuthorizerAccessToken(authorizationInfoResultDTO.getAuthorizer_access_token()); - refreshAccessToken.setAuthorizerRefreshToken(authorizationInfoResultDTO.getAuthorizer_refresh_token()); - refreshAccessToken.setExpiresIn(Integer.valueOf(authorizationInfoResultDTO.getExpires_in())); - //先逻辑删除,再插入 - refreshAuthorizerAccessTokenDao.updateOldAuthorizerAccessToken(customerId); - refreshAuthorizerAccessTokenDao.insertAuthorizerAccessToken(refreshAccessToken); // 2. 权限列表 log.info(START_INSERT_FUNC_INFO); List funcInfos = new ArrayList<>(); @@ -270,7 +314,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe // 授权信息放入缓存 redisThird.setAuthInfo(authorizationInfoResultDTO); //authorizer_refresh_token 放入缓存 - redisThird.setAuthorizerRefreshToken(refreshAccessToken); + redisThird.setAuthorizerRefreshToken(authInfoDTO); log.info(END_GET_AUTH_INFO); return authorizationInfoResultDTO; } @@ -283,14 +327,18 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe @Transactional(rollbackFor = Exception.class) @Override public void refreshToken() { - List willOverDueResultDTOS = refreshAuthorizerAccessTokenDao.checkWillOverDue(); + //查询 即将过期的 authorizer_access_token + List willOverDueResultDTOS = authorizationInfoDao.checkWillOverDue(); if (willOverDueResultDTOS.size() != NumConstant.ZERO && null != willOverDueResultDTOS){ willOverDueResultDTOS.forEach(willOverDueDTO -> { + String authAppId = willOverDueDTO.getAuthAppId(); + String customerId = willOverDueDTO.getCustomerId(); + String clientType = willOverDueDTO.getClientType(); JSONObject jsonObject = new JSONObject(); //授权方AppId - jsonObject.put(ModuleConstant.AUTHORIZER_APPID,willOverDueDTO.getAuthAppId()); + jsonObject.put(ModuleConstant.AUTHORIZER_APPID,authAppId); //第三方平台AppId - jsonObject.put(ModuleConstant.COMPONENT_APPID,PLATFORM_APP_ID); + jsonObject.put(ModuleConstant.COMPONENT_APPID,componentAppId); jsonObject.put(ModuleConstant.AUTHORIZER_REFRESH_TOKEN,willOverDueDTO.getAuthorizerRefreshToken()); String data = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_AUTHORIZER_TOKEN_URL, JSON.toJSONString(jsonObject)).getData(); Map map = JSON.parseObject(data, HashMap.class); @@ -298,56 +346,230 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String authorizerAccessToken = map.get(ModuleConstant.AUTHORIZER_ACCESS_TOKEN).toString(); String expiresIn = map.get(ModuleConstant.EXPIRES_IN).toString(); String authorizerRefreshToken = map.get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN).toString(); + Date expiresInTime = this.countExpirationTime(expiresIn); //更新DB AuthorizerAccessTokenFormDTO formDTO = new AuthorizerAccessTokenFormDTO(); + AuthorizationInfoFormDTO authorizationInfo = new AuthorizationInfoFormDTO(); + BeanUtils.copyProperties(formDTO,authorizationInfo); + authorizationInfo.setAuthorizerAppid(authAppId); formDTO.setAuthorizerAccessToken(authorizerAccessToken); formDTO.setAuthorizerRefreshToken(authorizerRefreshToken); - formDTO.setExpiresIn(Integer.valueOf(expiresIn)); - formDTO.setCustomerId(willOverDueDTO.getCustomerId()); - formDTO.setAuthAppid(willOverDueDTO.getAuthAppId()); + formDTO.setExpiresInTime(expiresInTime); + formDTO.setCustomerId(customerId); + formDTO.setAuthAppid(authAppId); //先逻辑删除,在插入 - refreshAuthorizerAccessTokenDao.updateOldAuthorizerAccessToken(willOverDueDTO.getCustomerId()); - refreshAuthorizerAccessTokenDao.insertAuthorizerAccessToken(formDTO); + authorizationInfoDao.updateOldAuthorizerAccessToken(willOverDueDTO.getCustomerId(),clientType); + authorizationInfoDao.insertAuthorizerAccessToken(formDTO); //缓存 refreshAuthorizerAccessToken - redisThird.setAuthorizerRefreshToken(formDTO); + redisThird.setAuthorizerRefreshToken(authorizationInfo); }); } } /** - * @Description 授权回调URL + * @Description 授权回调URL,回调时并获取授权信息 * @param * @author zxc */ @Transactional(rollbackFor = Exception.class) @Override - public void redirectUri(HttpServletRequest request, HttpServletResponse response, TokenDto tokenDto,String authAppId) { - String userId = tokenDto.getUserId(); - String customerId = paCustomerAgencyDao.getCustomerIdByUserId(userId); + public void redirectUri(HttpServletRequest request, HttpServletResponse response) { try { request.setCharacterEncoding(ModuleConstant.UTF8); + response.setCharacterEncoding(ModuleConstant.UTF8); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } - response.setCharacterEncoding(ModuleConstant.UTF8); + String customerId = request.getParameter(ModuleConstant.CUSTOMER_ID); + String client = request.getParameter(ModuleConstant.CLIENT); String authCode = request.getParameter(ModuleConstant.AUTH_CODE); String expiresIn = request.getParameter(ModuleConstant.EXPIRES_IN); + Date expiresInTime = this.countExpirationTime(expiresIn); +// AuthorizationInfoResultDTO authorizationInfo = this.authInfoByAuthCode(authCode, customerId,client); //authCode存数据库 AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); formDTO.setAuthCode(authCode); - formDTO.setExpiresIn(Integer.valueOf(expiresIn)); - formDTO.setAuthAppId(authAppId); + formDTO.setExpiresInTime(expiresInTime); + formDTO.setClientType(client); + //授权方AppId +// formDTO.setAuthAppId(authorizationInfo.getAuthorizer_appid()); formDTO.setCustomerId(customerId); +// this.updateCustomerMpAppIdAndCreateOpenPlatform(customerId,authorizationInfo.getAuthorizer_appid(),client); authCodeDao.insertRedirectAuthCode(formDTO); //authCode存缓存 redisThird.setAuthCode(formDTO); - // 获取授权信息 - AuthorizationInfoResultDTO authorizationInfoResultDTO = this.authInfoByAuthCode(authCode, authAppId, customerId); } + /** + * @Description 获取授权方的帐号基本信息并保存 + * @param customerId + * @param authAppId + * @author zxc + */ + @Transactional(rollbackFor = Exception.class) + public void saveAuthAccountInfo(String customerId, String authAppId,String clientType) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.COMPONENT_APP_ID,componentAppId); + jsonObject.put(ModuleConstant.AUTHORIZER_APP_ID,authAppId); + String data = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_GET_AUTHORIZER_INFO, JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + Map authorizerInfo = map.get(ModuleConstant.AUTHORIZER_INFO); + // 存在 “miniprograminfo” 字段为小程序,不存在为公众号 + boolean keyExist = authorizerInfo.containsKey(ModuleConstant.MINI_PROGRAM_INFO); + if (keyExist == true){ + MiniInfoFormDTO miniInfoFormDTO = this.mapToEntity(authorizerInfo, MiniInfoFormDTO.class); + miniInfoFormDTO.setCustomerId(customerId); + miniInfoFormDTO.setClientType(clientType); + //基础信息插入 + miniInfoDao.insertMiniInfo(miniInfoFormDTO); + String primaryId = miniInfoFormDTO.getId(); + //todo 功能的开通状况信息插入 + List businessInfoList = new ArrayList<>(); + Map businessInfo = (Map) authorizerInfo.get(ModuleConstant.BUSINESS_INFO); + businessInfo.forEach((key, value) -> { + BusinessInfoFormDTO businessInfoForm = new BusinessInfoFormDTO(); + businessInfoForm.setCustomerId(customerId); + businessInfoForm.setClientType(clientType); + businessInfoForm.setFuncType(key.toString()); + businessInfoForm.setOpenStatus(Integer.valueOf(value.toString())); + businessInfoForm.setPrimaryId(primaryId); + businessInfoList.add(businessInfoForm); + }); + businessInfoDao.insertBusinessInfo(businessInfoList); + //todo 小程序配置的合法域名信息插入 + Map miniProgramInfo = (Map) authorizerInfo.get(ModuleConstant.MINI_PROGRAM_INFO); + List networkInfoList = new ArrayList<>(); + Map networkInfo = (Map) miniProgramInfo.get(ModuleConstant.NETWORK); + networkInfo.forEach((key,value) -> { + MiniNetworkInfoFormDTO miniNetworkInfoForm = new MiniNetworkInfoFormDTO(); + miniNetworkInfoForm .setCustomerId(customerId); + miniNetworkInfoForm.setClientType(clientType); + miniNetworkInfoForm.setNetworkType(key.toString()); + miniNetworkInfoForm.setUrl(value.toString()); + miniNetworkInfoForm.setPrimaryId(primaryId); + networkInfoList.add(miniNetworkInfoForm); + }); + miniNetworkInfoDao.insertNetworkInfo(networkInfoList); + //todo 小程序配置的类目信息插入 + List categoryInfoList = new ArrayList<>(); + List categories = (List) miniProgramInfo.get(ModuleConstant.CATEGORIES); + categories.forEach(category -> { + category.forEach((key,value) -> { + MiniCategoryInfoFormDTO categoryInfo = new MiniCategoryInfoFormDTO(); + categoryInfo.setCustomerId(customerId); + categoryInfo.setClientType(clientType); + categoryInfo.setCategorySort(key.toString()); + categoryInfo.setCategoryName(value.toString()); + categoryInfo.setPrimaryId(primaryId); + categoryInfoList.add(categoryInfo); + }); + }); + miniCategoryInfoDao.insertCategoryInfo(categoryInfoList); + }else { + PaInfoFormDTO paInfoFormDTO = this.mapToEntity(authorizerInfo, PaInfoFormDTO.class); + //公众号基本信息插入 + paInfoDao.insertPaInfo(paInfoFormDTO); + String primaryId = paInfoFormDTO.getId(); + //todo 功能的开通状况信息插入 + List businessInfoList = new ArrayList<>(); + Map businessInfo = (Map) authorizerInfo.get(ModuleConstant.BUSINESS_INFO); + businessInfo.forEach((key, value) -> { + BusinessInfoFormDTO businessInfoForm = new BusinessInfoFormDTO(); + businessInfoForm.setCustomerId(customerId); + businessInfoForm.setClientType(clientType); + businessInfoForm.setFuncType(key.toString()); + businessInfoForm.setOpenStatus(Integer.valueOf(value.toString())); + businessInfoForm.setPrimaryId(primaryId); + businessInfoList.add(businessInfoForm); + }); + businessInfoDao.insertBusinessInfo(businessInfoList); + } + + + } + + /** + * @Description 1.创建开放平台账号并绑定 2.回填 customer_mp appId + * @param + * @author zxc + */ + @Transactional(rollbackFor = Exception.class) + public void updateCustomerMpAppIdAndCreateOpenPlatform(String customerId,String authAppId,String clientType){ + Integer notAuthCount = customerMpDao.selectAuthCount(customerId); + String openPlatformId = null; + if (notAuthCount==NumConstant.ZERO){ + //没有任何一个小程序/公众号授权,【先创建,再绑定】 + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.APP_ID,authAppId); + String data = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_CREATE_OPEN, JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); + createOpen.setErrCode(Integer.valueOf(map.get(ModuleConstant.ERR_CODE))); + createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG)); + createOpen.setOpenAppId(map.get(ModuleConstant.OPEN_APP_ID)); + switch (createOpen.getErrCode()){ + case NumConstant.ONE: + log.info(CREATE_AND_BIND_SUCCESS); + break; + case NumConstant.ONE_NEG: + throw new RenException(SYSTEM_ERROR); + case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: + throw new RenException(INVALID_APP_ID); + case ModuleConstant.EIGHTY_NINE_THOUSAND: + throw new RenException(ACCOUNT_HAS_BOUND_OPEN); + } + CreateOpenFormDTO coForm = new CreateOpenFormDTO(); + coForm.setOpenid(map.get(ModuleConstant.OPEN_APP_ID)); + coForm.setCustomerId(customerId); + //插入 open_platform_account 表 + openPlatformAccountDao.insertOpenPlatFormAccount(coForm); + openPlatformId = coForm.getId(); + }else if (notAuthCount>NumConstant.ZERO){ + String openAppId = openPlatformAccountDao.selectOpenAppIdByCustomerId(customerId); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.LOW_APP_ID,componentAppId); + jsonObject.put(ModuleConstant.OPEN_APP_ID,openAppId); + String data = HttpClientManager.getInstance().sendPostByJSON(ThirdApiConstant.API_BIND_OPEN, JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); + createOpen.setErrCode(Integer.valueOf(map.get(ModuleConstant.ERR_CODE))); + createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG)); + switch (createOpen.getErrCode()){ + case NumConstant.ONE: + log.info(BIND_SUCCESS); + break; + case NumConstant.ONE_NEG: + throw new RenException(SYSTEM_ERROR); + case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: + throw new RenException(INVALID_APP_ID); + case ModuleConstant.EIGHTY_NINE_THOUSAND: + throw new RenException(ACCOUNT_HAS_BOUND_OPEN); + case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_ONE: + throw new RenException(NOT_SAME_CONTRACTOR); + case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_THREE: + throw new RenException(NOT_ALLOWED_OPERATE); + case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_FOUR: + throw new RenException(TO_LIMIT); + } + } + AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); + formDTO.setClientType(clientType); + formDTO.setAuthAppId(authAppId); + formDTO.setCustomerId(customerId); + //回填customer_mp的appId 只需以上三个字段 + customerMpDao.updateAppIDByCustomerIdAndClient(formDTO); + //插入 binding_account + BindingAccountFormDTO bindingAccount = new BindingAccountFormDTO(); + bindingAccount.setOpenPlatformAccountId(openPlatformId); + bindingAccount.setAuthAppId(authAppId); + bindingAccount.setClientType(clientType); + bindingAccount.setCustomerId(customerId); + bindingAccountDao.insertBindingAccount(bindingAccount); + } + /** * @Description map 转 Entity * @param map @@ -377,4 +599,17 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe } return t; } + + /** + * @Description 转换过期时间 + * @param expiresIn + * @author zxc + */ + public Date countExpirationTime(String expiresIn){ + long now = LocalDateTime.now().toEpochSecond(ZoneOffset.of(NumConstant.POSITIVE_EIGHT_STR)); + long expiresInTime = now + Long.valueOf(expiresIn); + LocalDateTime localDateTime = Instant.ofEpochMilli(expiresInTime).atZone(ZoneOffset.ofHours(NumConstant.EIGHT)).toLocalDateTime(); + Date date = Date.from(localDateTime.atZone(ZoneOffset.ofHours(NumConstant.EIGHT)).toInstant()); + return date; + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java index 1f9306de89..1db2652bfa 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java @@ -1,19 +1,35 @@ package com.epmet.service.impl; +import com.alibaba.nacos.client.config.utils.IOUtils; +import com.epmet.constant.ModuleConstant; +import com.epmet.constant.ThirdRunTimeInfoConstant; +import com.epmet.dao.CodeAuditRecordDao; +import com.epmet.dao.CodeAuditResultDao; +import com.epmet.dao.CodeCustomerDao; +import com.epmet.dao.MiniInfoDao; +import com.epmet.dto.form.CodeAuditRecordFormDTO; +import com.epmet.dto.result.CustomerIdAndClientResultDTO; +import com.epmet.dto.result.TemplateAndAppIdResultDTO; import com.epmet.exception.AesException; import com.epmet.service.WarrantService; +import com.epmet.util.WXBizMsgCrypt; +import com.epmet.util.WXXmlToMapUtil; +import com.epmet.util.XmlUtil; +import com.github.pagehelper.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.dom4j.Document; import org.dom4j.DocumentException; -import org.dom4j.DocumentHelper; -import org.dom4j.Element; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStream; +import java.util.Map; /** * @Author zxc @@ -22,30 +38,92 @@ import java.io.IOException; @Slf4j @Service public class WarrantServiceImpl implements WarrantService { + + @Value("${third.platform.appId}") + private String componentAppId; + @Value("${third.platform.appSecret}") + private String appSecret; + @Value("${third.platform.aesKey}") + private String aesKey; + @Value("${third.platform.token}") + private String token; + @Autowired + private ComponentVerifyTicketServiceImpl componentVerifyTicketService; + @Autowired + private CodeAuditRecordDao codeAuditRecordDao; + @Autowired + private MiniInfoDao miniInfoDao; + @Autowired + private CodeCustomerDao codeCustomerDao; + @Autowired + private CodeAuditResultDao codeAuditResultDao; + + /** + * @Description 1.保存代码审核结果 2.更新代码上传结果 + * @param request + * @param appid + * @param response + * @author zxc + */ + @Transactional(rollbackFor = Exception.class) @Override public void acceptMessageAndEvent(HttpServletRequest request, String appid, HttpServletResponse response)throws IOException, DocumentException, AesException { - String msgSignature = request.getParameter("msg_signature"); - log.info("第三方平台全网发布-------------{appid}/callback-----------验证开始。。。。msg_signature=" + msgSignature); + request.setCharacterEncoding(ModuleConstant.UTF8); + String msgSignature = request.getParameter(ModuleConstant.MSG_SIGNATURE); + String timeStamp = request.getParameter(ModuleConstant.TIMESTAMP); + String nonce = request.getParameter(ModuleConstant.NONCE); if (!StringUtils.isNotBlank(msgSignature)) { return;// 微信推送给第三方开放平台的消息一定是加过密的,无消息加密无法解密消息 } - StringBuilder sb =new StringBuilder(); - BufferedReader in = request.getReader(); - String line; - while ((line = in.readLine()) !=null) { - sb.append(line); - } - in.close(); + InputStream inputStream; + String postData = null; + inputStream = request.getInputStream(); + postData= IOUtils.toString(inputStream,ModuleConstant.UTF8); + //从XML中获取标签内的密文文本 + String encrypt = XmlUtil.toXml(postData); + log.info(String.format(ThirdRunTimeInfoConstant.ENCRYPT,encrypt)); + //格式化密文文本,否则没有标签,会解密失败,参考官方的加解密代码JAVA版本 + String format = ""; + String fromXML = String.format(format, encrypt); - String xml = sb.toString(); - Document doc = DocumentHelper.parseText(xml); - Element rootElt = doc.getRootElement(); - String toUserName = rootElt.elementText("ToUserName"); - - //微信全网测试账号 -// if (StringUtils.equalsIgnoreCase(toUserName, APPID)) { - log.info("全网发布接入检测消息反馈开始---------------APPID=" + appid +"------------------------toUserName=" + toUserName); -// checkWeixinAllNetworkCheck(request, response, xml); -// } + String msg = ""; //解密后的明文 + WXBizMsgCrypt wxcpt; + if(StringUtil.isEmpty(encrypt)) { + msg = fromXML; + } else { + wxcpt = new WXBizMsgCrypt(token,aesKey, componentAppId); + // 解密消息 + msg = wxcpt.decryptMsg(msgSignature, timeStamp, nonce, fromXML); + } + log.info(String.format(ThirdRunTimeInfoConstant.MSG,msg)); + // 将xml转为map + Map result = WXXmlToMapUtil.multilayerXmlToMap(msg); + CodeAuditRecordFormDTO codeAuditRecord = componentVerifyTicketService.mapToEntity(result, CodeAuditRecordFormDTO.class); + String toUserName = codeAuditRecord.getToUserName();//小程序原始ID + CustomerIdAndClientResultDTO customerIdAndClientResultDTO = miniInfoDao.selectCustomerIdAndClientByToUserName(toUserName); + String clientType = customerIdAndClientResultDTO.getClientType(); + String customerId = customerIdAndClientResultDTO.getCustomerId(); + TemplateAndAppIdResultDTO templateAndAppId = codeCustomerDao.selectTemplateAndAppId(customerId, clientType); + String authAppId = templateAndAppId.getAuthAppId(); + String templateId = templateAndAppId.getTemplateId(); + codeAuditRecord.setClientType(clientType); + codeAuditRecord.setCustomerId(customerId); + codeAuditRecord.setAuthAppId(authAppId); + codeAuditRecord.setTemplateId(templateId); + //插入 代码审核 记录 + codeAuditRecordDao.insertCodeAuditRecord(codeAuditRecord); + // 修改 code_audit_result 中的代码审核结果 + String event = codeAuditRecord.getEvent(); + String codeResult = null; + switch (event){ + case ModuleConstant.WEAPP_AUDIT_SUCCESS: + codeResult = ModuleConstant.AUDIT_SUCCESS; + case ModuleConstant.WEAPP_AUDIT_FAIL: + codeResult = ModuleConstant.AUDIT_FAILED; + case ModuleConstant.WEAPP_AUDIT_DELAY: + codeResult = ModuleConstant.DELAY; + } + String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord); + codeAuditResultDao.updateAuditResult(customerId,codeCustomerId,codeResult); } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java index 856e2da291..e7b119ed20 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/util/WXXmlToMapUtil.java @@ -37,7 +37,7 @@ public class WXXmlToMapUtil { private static final Logger logger = LoggerFactory.getLogger(WXXmlToMapUtil.class); /** - * XML格式字符串转换为Map + * XML格式字符串转换为Map * * @param xml XML字符串 * @return XML数据转换后的Map diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml index 7867f1f3da..a280e32b0d 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml @@ -97,4 +97,11 @@ ribbon: pagehelper: helper-dialect: mysql - reasonable: false \ No newline at end of file + reasonable: false +third: + platform: + appId: wx9681884b28ed7927 + appSecret: xxx + aesKey: xxx + componentToken: xcsfdfdff + token: developerToken \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthCodeDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthCodeDao.xml index 5fcd3c0db1..4d605df059 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthCodeDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthCodeDao.xml @@ -3,28 +3,15 @@ - - - - - - - - - - - - - - INSERT INTO auth_code ( ID, CUSTOMER_ID, AUTH_APPID, AUTH_CODE, EXPIRES_IN, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + INSERT INTO auth_code ( ID, CUSTOMER_ID, CLIENT_TYPE, AUTH_CODE, EXPIRES_IN_TIME, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) VALUES ( REPLACE ( UUID(), '-', '' ), #{customerId}, - #{authAppId}, + #{clientType} #{authCode}, - #{expiresIn}, + #{expiresInTime}, #{delFlag}, #{createdBy}, NOW(), @@ -33,4 +20,26 @@ ) + + + UPDATE auth_code + SET auth_appid = #{authAppId} + WHERE + del_flag = 0 + AND customer_id = #{customerId} + AND client_type = #{clientType} + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml new file mode 100644 index 0000000000..d0c2ba2654 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml @@ -0,0 +1,6 @@ + + + + + + \ 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 97929fa2d6..707b16d9cb 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 @@ -3,31 +3,18 @@ - - - - - - - - - - - - - - - INSERT INTO authorization_info ( ID, CUSTOMER_ID, AUTHORIZER_APPID, AUTHORIZER_ACCESS_TOKEN, EXPIRES_IN, AUTHORIZER_REFRESH_TOKEN, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + INSERT INTO authorization_info ( ID, CUSTOMER_ID, AUTHORIZER_APPID, AUTHORIZER_ACCESS_TOKEN, EXPIRES_IN_TIME, AUTHORIZER_REFRESH_TOKEN, CLIENT_TYPE, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) VALUES ( REPLACE ( UUID(), '-', '' ), #{customerId}, #{authorizerAppid}, #{authorizerAccessToken}, - #{expiresIn}, + #{expiresInTime}, #{authorizerRefreshToken}, + #{clientType} #{delFlag}, #{createdBy}, NOW(), @@ -38,7 +25,48 @@ - update authorization_info set del_flag = 0 where customer_id = #{customerId} + update authorization_info set del_flag = 1 where customer_id = #{customerId} AND client_type = #{clientType} + + + + + + + + INSERT INTO authorization_info ( ID, AUTHORIZER_ACCESS_TOKEN, EXPIRES_IN_TIME, AUTHORIZER_REFRESH_TOKEN, AUTHORIZER_APPID, CUSTOMER_ID,CLIENT_TYPE, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + ( + REPLACE ( UUID(), '-', '' ), + #{authorizerAccessToken}, + #{expiresInTime}, + #{authorizerRefreshToken}, + #{authAppid}, + #{customerId}, + #{clientType}, + #{delFlag}, + #{createdBy}, + NOW(), + #{updatedBy}, + NOW() + ) + + + + + update authorization_info set del_flag = 1 where customer_id = #{customerId} AND client_type = #{clientType} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizerRefreshTokenDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizerRefreshTokenDao.xml index 6cfa1d6b86..a1a2f133d5 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizerRefreshTokenDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizerRefreshTokenDao.xml @@ -3,16 +3,5 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml new file mode 100644 index 0000000000..8547b41dcf --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml @@ -0,0 +1,24 @@ + + + + + + + + INSERT INTO binding_account ( ID, OPEN_PLATFORM_ACCOUNT_ID, AUTH_APP_ID, CUSTOMER_ID, CLIENT_TYPE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + ( + REPLACE ( UUID(), '-', '' ), + #{openPlatformAccountId}, + #{authAppId}, + #{customerId}, + #{clientType}, + #{delFlag}, + #{revision}, + #{createDBy}, + NOW(), + #{updatedBy}, + NOW() + ) + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BusinessInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BusinessInfoDao.xml new file mode 100644 index 0000000000..ec69aa585a --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BusinessInfoDao.xml @@ -0,0 +1,27 @@ + + + + + + + + INSERT INTO business_info ( ID, CUSTOMER_ID, CLIENT_TYPE, PRIMARY_ID, FUNC_TYPE, OPEN_STATUS, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + + ( + REPLACE ( UUID(), '-', '' ), + #{business.customerId}, + #{business.clientType}, + #{business.primaryId}, + #{business.funcType}, + #{business.openStatus}, + #{business.delFlag}, + #{business.revision}, + #{business.createdBy}, + NOW(), + #{business.updatedBy}, + NOW() + ) + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditRecordDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditRecordDao.xml new file mode 100644 index 0000000000..f0d102d0f4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditRecordDao.xml @@ -0,0 +1,35 @@ + + + + + + + + INSERT INTO code_audit_result ( ID, CUSTOMER_ID, TEMPLATE_ID, CLIENT_TYPE, AUTH_APP_ID, TO_USER_NAME, FROM_USER_NAME, WECHAT_CREATE_TIME, + MSG_TYPE, EVENT, SUCC_TIME, FAIL_TIME, DELAY_TIME, REASON, SCREEN_SHOT, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) + VALUES + ( + REPLACE ( UUID(), '-', '' ), + #{customerId}, + #{templateId}, + #{clientType}, + #{authAppId}, + #{toUserName}, + #{fromUserName}, + #{wechatCreateTime}, + #{msgType}, + #{event}, + IFNULL(#{succTime},NULL), + IFNULL(#{failTime},NULL), + IFNULL(#{delayTime},NULL), + IFNULL(#{reason},NULL), + IFNULL(#{screenShot},NULL), + #{delFlag}, + #{revision}, + #{createdBy}, + NOW(), + #{updatedBy}, + NOW() + ) + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml index f393abeb44..888e90c40f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml @@ -3,20 +3,14 @@ - - - - - - - - - - - - - - + + + UPDATE code_audit_result + SET result = #{codeResult} + WHERE del_flag = '0' + AND customer_id = #{customerId} + AND template_id = #{templateId} + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml index e6d65e78e4..a349160ef5 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml @@ -3,25 +3,32 @@ - - - - - - - - - - - - - - - - - - - + + + + + \ 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 7e294a150a..9a469a2073 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 @@ -3,25 +3,14 @@ - - - - - - - - - - - - INSERT INTO component_access_token ( ID, COMPONENT_ACCESS_TOKEN, EXPIRES_IN, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + INSERT INTO component_access_token ( ID, COMPONENT_ACCESS_TOKEN, EXPIRES_IN_TIME, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) VALUES ( REPLACE ( UUID(), '-', '' ), #{componentAccessToken}, - #{expiresIn}, + #{expiresInTime}, #{delFlag}, #{createdBy}, NOW(), @@ -30,8 +19,26 @@ ) + update component_access_token set del_flag = 1 + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml index a6a0e15ffb..ba33593a48 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml @@ -3,24 +3,13 @@ - - - - - - - - - - - - + - INSERT INTO component_verify_ticket ( ID, APPID, TYPE_INFO, COMPONENT_VERIFY_TICKET, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + INSERT INTO component_verify_ticket ( ID, COMPONENT_APP_ID, TYPE_INFO, COMPONENT_VERIFY_TICKET, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) VALUES ( REPLACE ( UUID(), '-', '' ), - #{appid}, + #{componentAppId}, #{typeInfo}, #{componentVerifyTicket}, #{delFlag}, @@ -31,5 +20,10 @@ ) + + + update component_verify_ticket set del_flag = 1 + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml index 97a62f99f1..6a8e5330bf 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml @@ -18,6 +18,48 @@ ORDER BY client ASC + + + + + + UPDATE customer_mp + SET app_id = #{authAppId},authorization_flag = 1 + WHERE + customer_id = #{customerId} + AND del_flag = '0' + AND client = #{client} + + + + + UPDATE customer_mp + SET authorization_flag = 1 + WHERE + app_id = #{authAppId} + + + + + SELECT + customer_id AS customerId, + client_type AS clientType + FROM + mini_info + WHERE + del_flag = 0 + AND user_name = #{toUserName} + UNION ALL + SELECT + customer_id AS customerId, + client_type AS clientType + FROM + pa_info + WHERE + del_flag = 0 + AND user_name = #{toUserName} + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/MiniNetworkInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/MiniNetworkInfoDao.xml new file mode 100644 index 0000000000..e6dcc273ce --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/MiniNetworkInfoDao.xml @@ -0,0 +1,27 @@ + + + + + + + + INSERT INTO mini_network_info ( ID, PRIMARY_ID, CUSTOMER_ID, CLIENT_TYPE, NETWORK_TYPE, URL, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + + ( + REPLACE ( UUID(), '-', '' ), + #{network.primaryId}, + #{network.customerId}, + #{network.clientType}, + #{network.networkType}, + #{network.url}, + #{network.delFlag}, + #{network.revision}, + #{network.createdBy}, + NOW(), + #{network.updatedBy}, + NOW() + ) + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml new file mode 100644 index 0000000000..efaa55adad --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml @@ -0,0 +1,36 @@ + + + + + + + + + SELECT LAST_INSERT_ID() AS id + + INSERT INTO open_platform_account ( ID, OPEN_APP_ID, CUSTOMER_ID, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + ( + REPLACE ( UUID(), '-', '' ), + #{openAppId}, + #{customerId}, + #{delFlag}, + #{revision}, + #{createdBy}, + NOW(), + #{updatedBy}, + NOW() + ) + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml index 486519d844..99181ddebe 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml @@ -6,7 +6,7 @@ - SELECT - authorizer_access_token AS authorizerAccessToken, - authorizer_refresh_token AS authorizerRefreshToken, - auth_appid AS authAppId, - customer_id AS customerId - FROM - refresh_authorizer_access_token - WHERE - ( UNIX_TIMESTAMP( CREATED_TIME ) + EXPIRES_IN ) - UNIX_TIMESTAMP(NOW()) 10 - AND ( UNIX_TIMESTAMP( CREATED_TIME ) + EXPIRES_IN ) - UNIX_TIMESTAMP( NOW()) > 0 - AND del_flag = 0 - - - - INSERT INTO refresh_authorizer_access_token ( ID, AUTHORIZER_ACCESS_TOKEN, EXPIRES_IN, AUTHORIZER_REFRESH_TOKEN, AUTH_APPID, CUSTOMER_ID, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) - VALUES - ( - REPLACE ( UUID(), '-', '' ), - #{authorizerAccessToken}, - #{expiresIn}, - #{authorizerRefreshToken}, - #{authAppid}, - #{customerId}, - #{delFlag}, - #{createdBy}, - NOW(), - #{updatedBy}, - NOW() - ) - - - - - update refresh_authorizer_access_token set del_flag = 0 where customer_id = #{customerId} - - - \ No newline at end of file From 6e85f5f78157cd6d14289de96554130e2385760a Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 16:58:26 +0800 Subject: [PATCH 75/90] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/form/MyInfoFormDTO.java | 2 +- .../epmet/controller/PaCustomerController.java | 5 +++-- .../com/epmet/dao/PaCustomerUserAgencyDao.java | 11 ++++++++++- .../java/com/epmet/service/PaCustomerService.java | 2 +- .../epmet/service/impl/PaCustomerServiceImpl.java | 15 ++++++++++++--- .../resources/mapper/PaCustomerUserAgencyDao.xml | 12 ++++++++++++ 6 files changed, 39 insertions(+), 8 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MyInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MyInfoFormDTO.java index 78cafaa63b..052133e0df 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MyInfoFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MyInfoFormDTO.java @@ -20,7 +20,7 @@ public class MyInfoFormDTO implements Serializable { /** * 客户Id */ - @NotBlank(message = "客户Id不能为空", groups = {MyInfoFormDTO.AddUserInternalGroup.class}) + //@NotBlank(message = "客户Id不能为空", groups = {MyInfoFormDTO.AddUserInternalGroup.class}) private String customerId; } 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 862d9fa3f1..60962bd6a0 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 @@ -87,8 +87,9 @@ public class PaCustomerController { **/ @PostMapping("myinfo") public Result myInfo(@LoginUser TokenDto tokenDTO, @RequestBody MyInfoFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, MyInfoFormDTO.AddUserInternalGroup.class); - return new Result().ok(paCustomerService.myInfo(formDTO)); + //ValidatorUtils.validateEntity(formDTO, MyInfoFormDTO.AddUserInternalGroup.class); + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(paCustomerService.myInfo(tokenDTO, formDTO)); } /** diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerUserAgencyDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerUserAgencyDao.java index 388091463d..123300af1a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerUserAgencyDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerUserAgencyDao.java @@ -18,8 +18,10 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.PaCustomerUserAgencyDTO; import com.epmet.entity.PaCustomerUserAgencyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 用户组织关系表 @@ -29,5 +31,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface PaCustomerUserAgencyDao extends BaseDao { - + + /** + * @param userId + * @return + * @Author sun + * @Description 根据userId查询客户信息 + **/ + PaCustomerUserAgencyDTO selectByUserId(@Param("userId") String userId); } \ 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 bb8d3f2325..e0d5da1a3e 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 @@ -130,7 +130,7 @@ public interface PaCustomerService extends BaseService { * @Author sun * @Description 公众号-查询我的信息 **/ - MyInfoResultDTO myInfo(MyInfoFormDTO formDTO); + MyInfoResultDTO myInfo(TokenDto tokenDTO, MyInfoFormDTO formDTO); /** * @param formDTO 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 7793bab04a..1c744dc9ee 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 @@ -85,6 +85,8 @@ public class PaCustomerServiceImpl extends BaseServiceImpl listMpDTO = customerMpDao.selectByCustomerId(formDTO.getCustomerId()); + List listMpDTO = customerMpDao.selectByCustomerId(customerId); if (null == agencyDTO || listMpDTO.size() != NumConstant.TWO) { throw new RenException(PaConstant.CUSTOMER_MP_EXCEPTION); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerUserAgencyDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerUserAgencyDao.xml index 9efe156b41..36465c774b 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerUserAgencyDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerUserAgencyDao.xml @@ -3,5 +3,17 @@ + \ No newline at end of file From 172ba5d50a12ded8fba643cd72b04746f85204b4 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 15 Jul 2020 17:00:55 +0800 Subject: [PATCH 76/90] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index ce6ff5efdf..3e2861fa3b 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.9 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.10 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 8bef743d41..1e3c56a7c3 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.9 + 0.0.10 com.epmet From c1de901c9a2db266d501ae844589f31ed6d45b9c Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 15 Jul 2020 17:40:29 +0800 Subject: [PATCH 77/90] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/utils/DateUtils.java | 7 + .../com/epmet/dto/CodeAuditResultDTO.java | 5 + .../java/com/epmet/dto/CodeCustomerDTO.java | 7 +- .../com/epmet/dto/form/CodeCommonFormDTO.java | 23 ++ .../com/epmet/dto/form/CodeUploadFormDTO.java | 6 +- .../epmet/dto/form/SubmitAuditFormDTO.java | 126 +++++++ .../com/epmet/dto/form/UploadListFormDTO.java | 46 +++ .../dto/result/TemplateListResultDTO.java | 34 ++ .../epmet/dto/result/UploadListResultDTO.java | 62 ++++ .../epmet-third/epmet-third-server/pom.xml | 6 + .../java/com/epmet/constant/CodeConstant.java | 49 +++ .../com/epmet/controller/CodeController.java | 57 ++- .../com/epmet/dao/AuthorizationInfoDao.java | 14 +- .../com/epmet/dao/CodeAuditResultDao.java | 9 + .../java/com/epmet/dao/CodeCustomerDao.java | 13 + .../epmet/dao/ComponentAccessTokenDao.java | 10 +- .../epmet/entity/CodeAuditResultEntity.java | 5 + .../com/epmet/entity/CodeCustomerEntity.java | 7 +- .../epmet/service/CodeAuditResultService.java | 10 + .../epmet/service/CodeCustomerService.java | 10 + .../java/com/epmet/service/CodeService.java | 53 +++ .../impl/CodeAuditResultServiceImpl.java | 5 + .../service/impl/CodeCustomerServiceImpl.java | 12 + .../epmet/service/impl/CodeServiceImpl.java | 164 ++++++++- .../wxapi/result/WxMaAuditStatusResult.java | 6 +- .../wxapi/result/WxMaTemplateListResult.java | 32 ++ .../wxapi/result/WxMaTemplateResult.java | 36 ++ .../epmet/wxapi/service/WxMaCodeService.java | 149 ++++---- .../service/impl/WxMaCodeServiceImpl.java | 345 +++++++++--------- .../resources/mapper/AuthorizationInfoDao.xml | 9 + .../resources/mapper/CodeAuditResultDao.xml | 17 + .../main/resources/mapper/CodeCustomerDao.xml | 53 +++ .../mapper/ComponentAccessTokenDao.xml | 7 + .../epmet/feign/OperCrmOpenFeignClient.java | 10 + .../OperCrmOpenFeignClientFallback.java | 8 + 35 files changed, 1160 insertions(+), 252 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeCommonFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadListFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateListResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/UploadListResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/CodeConstant.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaTemplateListResult.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaTemplateResult.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index d0c21c4d9a..f79b22ccb5 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -481,4 +481,11 @@ public class DateUtils { cale.set(Calendar.DAY_OF_MONTH, 0); return cale.getTime(); } + + public static String formatTimestamp(Long timestamp, String pattern) { + //设置格式 + SimpleDateFormat format = new SimpleDateFormat(pattern); + return format.format(timestamp); + } + } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditResultDTO.java index 8068f8f07b..880e646668 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditResultDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditResultDTO.java @@ -63,6 +63,11 @@ public class CodeAuditResultDTO implements Serializable { */ private String reason; + /** + * 当审核被拒绝时,会返回审核失败的小程序截图示例。用 | 分隔的 media_id 的列表 + */ + private String screenShot; + /** * 乐观锁 */ diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java index 960b9035cb..2a4c2227fc 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java @@ -48,11 +48,6 @@ public class CodeCustomerDTO implements Serializable { */ private String customerName; - /** - * 小程序接口调用令牌ID - */ - private String accessTokenId; - /** * 模板ID */ @@ -61,7 +56,7 @@ public class CodeCustomerDTO implements Serializable { /** * 小程序类型 居民端resi,工作端work */ - private String type; + private String clientType; /** * APPID diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeCommonFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeCommonFormDTO.java new file mode 100644 index 0000000000..083f145ba6 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeCommonFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/14 17:50 + */ +@Data +public class CodeCommonFormDTO implements Serializable { + private static final long serialVersionUID = -8923691903900141713L; + /** + * 客户ID + */ + private String customerId; + /** + * 代码ID + */ + private String codeId; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeUploadFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeUploadFormDTO.java index a2740c321d..87c717603d 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeUploadFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeUploadFormDTO.java @@ -15,14 +15,10 @@ import java.io.Serializable; public class CodeUploadFormDTO implements Serializable { private static final long serialVersionUID = 1295337818281424509L; - /** - * 小程序接口调用令牌ID - */ - private String accessTokenId; /** * 小程序类型 居民端resi, 工作段work */ - private String type; + private String clientType; /** * 客户ID */ diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java new file mode 100644 index 0000000000..e88d58e3f9 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java @@ -0,0 +1,126 @@ +package com.epmet.dto.form; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/14 16:37 + */ +@Data +public class SubmitAuditFormDTO implements Serializable { + private static final long serialVersionUID = -2136272127561529025L; + /** + * 上传代码ID + */ + private String codeId; + + /** + * 小程序版本说明和功能解释 + */ + private String versionDesc; + /** + * 反馈内容,至多 200 字 + */ + private String feedbackInfo; + /** + * 用 | 分割的 media_id 列表,至多 5 张图片, 可以通过新增临时素材接口上传而得到 + */ + private String feedbackStuff; + /** + * 审核项列表(选填,至多填写 5 项) + */ + private List itemList; + /** + * 预览信息(小程序页面截图和操作录屏) + */ + private List previewInfo; + /** + * 用户生成内容场景(UGC)信息安全声明 + */ + private List ugcDeclare; + + @NoArgsConstructor + @Data + private static class ItemListBean { + /** + * 小程序的页面,可通过获取小程序的页面列表接口获得 + */ + private String address; + /** + * 小程序的标签,用空格分隔,标签至多 10 个,标签长度至多 20 + */ + private String tag; + /** + * 一级类目名称 + */ + private String firstClass; + /** + * 二级类目名称 + */ + private String secondClass; + /** + * 三级类目名称 + */ + private String thirdClass; + /** + * 一级类目的 ID + */ + private String firstId; + /** + * 二级类目的 ID + */ + private String secondId; + /** + * 三级类目的 ID + */ + private String thirdId; + /** + * 小程序页面的标题,标题长度至多 32 + */ + private String title; + } + + @NoArgsConstructor + @Data + private static class PreviewInfoBean { + /** + * 录屏mediaid列表,可以通过提审素材上传接口获得 + */ + private List videoIdList; + /** + * 截屏mediaid列表,可以通过提审素材上传接口获得 + */ + private List picIdList; + } + + @NoArgsConstructor + @Data + private static class UgcDeclareBean { + /** + * UGC场景 0,不涉及用户生成内容, 1.用户资料,2.图片,3.视频,4.文本,5其他, 可多选,当scene填0时无需填写下列字段 + */ + private List scene; + /** + * 当scene选其他时的说明,不超时256字 + */ + private String otherSceneDesc; + /** + * 内容安全机制 1.使用平台建议的内容安全API,2.使用其他的内容审核产品,3.通过人工审核把关,4.未做内容审核把关 + */ + private List method; + /** + * 是否有审核团队, 0.无,1.有,默认0 + */ + private Integer hasAuditTeam; + /** + * 说明当前对UGC内容的审核机制,不超过256字 + */ + private String auditDesc; + } +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadListFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadListFormDTO.java new file mode 100644 index 0000000000..64f3483f55 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadListFormDTO.java @@ -0,0 +1,46 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/14 15:57 + */ +@NoArgsConstructor +@Data +public class UploadListFormDTO implements Serializable { + + private static final long serialVersionUID = 5733465036099223190L; + /** + * 客户ID + */ + private String customerId; + /** + * 小程序类型 居民端resi,工作端work + */ + private String clientType; + /** + * 状态 + */ + private String status; + /** + * 开始时间 + */ + private String startTime; + /** + * 结束时间 + */ + private String endTime; + /** + * 页数 + */ + private Integer page; + /** + * 页面条数 + */ + private Integer limit; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateListResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateListResultDTO.java new file mode 100644 index 0000000000..083ca650d9 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateListResultDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/14 15:22 + */ +@NoArgsConstructor +@Data +public class TemplateListResultDTO implements Serializable { + + private static final long serialVersionUID = -5545336708096791516L; + /** + * 模板 id + */ + private String templateId; + /** + * 模板描述 + */ + private String userDesc; + /** + * 模板版本号 + */ + private String userVersion; + /** + * 模板创建时间yyyy-mm-dd + */ + private String createTime; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/UploadListResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/UploadListResultDTO.java new file mode 100644 index 0000000000..82d88b084a --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/UploadListResultDTO.java @@ -0,0 +1,62 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/14 16:20 + */ +@NoArgsConstructor +@Data +public class UploadListResultDTO implements Serializable { + + private static final long serialVersionUID = -8110308954072076978L; + /** + * 代码ID + */ + private String id; + /** + * 客户名 + */ + private String customerId; + /** + * 客户名 + */ + private String customerName; + /** + * 居民端resi 工作端work + */ + private String clientType; + /** + * 代码描述 + */ + private String codeInfo; + /** + * 版本号 + */ + private String version; + /** + * 状态 未审核:unaudited,审核中:auditing,审核成功audit_success,审核被拒绝audit_failed,已撤回:withdrawn,审核延后:delay,发布成功release_success, 发布失败release_failed + */ + private String status; + /** + * 上传时间 + */ + private String uploadTime; + /** + * 审核ID + */ + private String auditId; + /** + * 小程序APP ID + */ + private String appId; + /** + * 提交审核时间 + */ + private String auditTime; +} diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 8bef743d41..715510f67d 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -129,6 +129,12 @@ 2.0.0 compile + + com.epmet + oper-crm-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/CodeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/CodeConstant.java new file mode 100644 index 0000000000..6089c8b936 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/CodeConstant.java @@ -0,0 +1,49 @@ +package com.epmet.constant; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/15 14:39 + */ +public interface CodeConstant { + /** + * 居民端 + */ + String RESI = "resi"; + /** + * 工作端 + */ + String WORK = "work"; + /** + * 未审核 + */ + String UNAUDITED = "unaudited"; + /** + * 审核中 + */ + String AUDITING = "auditing"; + /** + * 审核成功 + */ + String AUDIT_SUCCESS = "audit_success"; + /** + * 审核被拒绝 + */ + String AUDIT_FAILED = "audit_failed"; + /** + * 已撤回 + */ + String WITHDRAWN = "withdrawn"; + /** + * 审核延后 + */ + String DELAY = "delay"; + /** + * 发布成功 + */ + String RELEASE_SUCCESS = "release_success"; + /** + * 发布失败 + */ + String RELEASE_FAILED = "release_failed"; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java index 1e97bf9ab1..59eef94f35 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java @@ -1,12 +1,20 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.CodeCommonFormDTO; import com.epmet.dto.form.CodeUploadFormDTO; +import com.epmet.dto.form.SubmitAuditFormDTO; +import com.epmet.dto.form.UploadListFormDTO; +import com.epmet.dto.result.TemplateListResultDTO; +import com.epmet.dto.result.UploadListResultDTO; +import oracle.jdbc.proxy.annotation.Post; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * @author zhaoqifeng * @dscription 代码管理 @@ -16,15 +24,62 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping("code") public class CodeController { + /** + * 获取代码模板列表 + * @author zhaoqifeng + * @date 2020/7/14 15:10 + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("templatelist") + public Result> templateList() { + return null; + } + /** * 代码上传 * @author zhaoqifeng * @date 2020/7/9 14:23 - * @param + * @param formDTO * @return com.epmet.commons.tools.utils.Result */ @PostMapping("upload") public Result upload(@RequestBody CodeUploadFormDTO formDTO) { return new Result<>(); } + + /** + * 已上传代码列表 + * @author zhaoqifeng + * @date 2020/7/14 16:30 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + */ + @PostMapping("uploadlist") + public Result> uploadList(@RequestBody UploadListFormDTO formDTO) { + return new Result<>(); + } + + /** + * 提交审核 + * @author zhaoqifeng + * @date 2020/7/14 16:40 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("audit") + public Result submitAudit(@RequestBody SubmitAuditFormDTO formDTO) { + return new Result<>(); + } + + /** + * 审核撤回 + * @author zhaoqifeng + * @date 2020/7/14 17:52 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("undo") + public Result undo(@RequestBody CodeCommonFormDTO formDTO) { + 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 4608b0a04a..3e98b5a623 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 @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.AuthorizationInfoDTO; import com.epmet.dto.form.AuthorizationInfoFormDTO; import com.epmet.dto.form.AuthorizerAccessTokenFormDTO; import com.epmet.dto.result.WillOverDueResultDTO; @@ -48,6 +49,17 @@ public interface AuthorizationInfoDao extends BaseDao { * @param customerId * @author zxc */ + void updateOldAuthorizationInfo(@Param("customerId")String customerId); + + /** + * 根据客户ID,客户端类型获取授权信息 + * @author zhaoqifeng + * @date 2020/7/15 14:08 + * @param customerId 客户ID + * @param clientType 客户端类型 + * @return com.epmet.dto.AuthorizationInfoDTO + */ + AuthorizationInfoDTO getAuthInfoByCustomer(@Param("customerId") String customerId, @Param("clientType") String clientType); void updateOldAuthorizationInfo(@Param("customerId")String customerId,@Param("clientType")String clientType); /** @@ -70,5 +82,5 @@ public interface AuthorizationInfoDao extends BaseDao { * @author zxc */ void updateOldAuthorizerAccessToken(@Param("customerId")String customerId,@Param("clientType")String clientType); - + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java index b9cba62dd4..6ead2846d6 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CodeAuditResultDTO; import com.epmet.entity.CodeAuditResultEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -30,6 +31,14 @@ import org.apache.ibatis.annotations.Param; */ @Mapper public interface CodeAuditResultDao extends BaseDao { + /** + * 获取审核结果信息 + * @author zhaoqifeng + * @date 2020/7/15 17:10 + * @param codeId + * @return com.epmet.dto.CodeAuditResultDTO + */ + CodeAuditResultDTO selectAuditResultByCodeId(@Param("codeId") String codeId); /** * @Description 更新 代码审核结果中的审核状态 diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java index 5d7f60d4ae..7b3e60abe3 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java @@ -18,12 +18,16 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.UploadListFormDTO; +import com.epmet.dto.result.UploadListResultDTO; import com.epmet.dto.form.CodeAuditRecordFormDTO; import com.epmet.dto.result.TemplateAndAppIdResultDTO; import com.epmet.entity.CodeCustomerEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 客户代码关联表 * @@ -32,6 +36,15 @@ import org.apache.ibatis.annotations.Param; */ @Mapper public interface CodeCustomerDao extends BaseDao { + /** + * 获取上传代码列表 + * + * @param formDTO + * @return java.util.List + * @author zhaoqifeng + * @date 2020/7/15 15:22 + */ + List selectCodeList(UploadListFormDTO formDTO); /** * @Description 根据客户id和客户端类型获取 代码模板ID和授权方AppId 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 7548335085..67d38d540c 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 @@ -60,5 +60,13 @@ public interface ComponentAccessTokenDao extends BaseDao { * @date 2020-07-09 */ void delete(String[] ids); + + /** + * 获取上传代码列表 + * @author zhaoqifeng + * @date 2020/7/15 15:14 + * @param formDTO + * @return com.epmet.commons.tools.page.PageData + */ + PageData getCodeList(UploadListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java index 1761ecf725..2ba332f663 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java @@ -1,5 +1,13 @@ package com.epmet.service; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.form.CodeCommonFormDTO; +import com.epmet.dto.form.CodeUploadFormDTO; +import com.epmet.dto.form.SubmitAuditFormDTO; +import com.epmet.dto.form.UploadListFormDTO; +import com.epmet.dto.result.TemplateListResultDTO; +import com.epmet.dto.result.UploadListResultDTO; + import java.util.List; /** @@ -9,4 +17,49 @@ import java.util.List; */ public interface CodeService { + /** + * 获取代码模板列表 + * + * @return java.util.List < com.epmet.dto.result.TemplateListResultDTO> + * @author zhaoqifeng + * @date 2020/7/14 18:15 + */ + List templateList(); + + /** + * 代码上传 + * + * @param formDTO + * @author zhaoqifeng + * @date 2020/7/14 18:15 + */ + void upload(CodeUploadFormDTO formDTO); + + /** + * 已上传代码列表 + * + * @param formDTO + * @return java.util.List < com.epmet.dto.result.UploadListResultDTO> + * @author zhaoqifeng + * @date 2020/7/14 18:15 + */ + PageData uploadList(UploadListFormDTO formDTO); + + /** + * 提交审核 + * + * @param formDTO + * @author zhaoqifeng + * @date 2020/7/14 18:15 + */ + void submitAudit(SubmitAuditFormDTO formDTO); + + /** + * 审核撤回 + * + * @param formDTO + * @author zhaoqifeng + * @date 2020/7/14 18:15 + */ + void undo(CodeCommonFormDTO formDTO); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeAuditResultServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeAuditResultServiceImpl.java index 7a4a7193cc..8898ed569f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeAuditResultServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeAuditResultServiceImpl.java @@ -101,4 +101,9 @@ public class CodeAuditResultServiceImpl extends BaseServiceImpl list = baseDao.selectCodeList(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java index 728852e30c..8cf9b54571 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java @@ -1,9 +1,38 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.CodeConstant; +import com.epmet.dao.AuthorizationInfoDao; +import com.epmet.dao.ComponentAccessTokenDao; +import com.epmet.dto.AuthorizationInfoDTO; +import com.epmet.dto.CodeAuditResultDTO; +import com.epmet.dto.CodeCustomerDTO; +import com.epmet.dto.CustomerDTO; +import com.epmet.dto.form.CodeCommonFormDTO; +import com.epmet.dto.form.CodeUploadFormDTO; +import com.epmet.dto.form.SubmitAuditFormDTO; +import com.epmet.dto.form.UploadListFormDTO; +import com.epmet.dto.result.TemplateListResultDTO; +import com.epmet.feign.OperCrmOpenFeignClient; +import com.epmet.service.CodeAuditResultService; +import com.epmet.service.CodeCustomerService; import com.epmet.service.CodeService; -import me.chanjar.weixin.common.error.WxErrorException; +import com.epmet.wxapi.param.WxMaCodeAuditStatusReq; +import com.epmet.wxapi.param.WxMaCodeCommitReq; +import com.epmet.wxapi.param.WxMaCodeSubmitAuditRequest; +import com.epmet.wxapi.result.WxMaAuditStatusResult; +import com.epmet.wxapi.result.WxMaTemplateResult; +import com.epmet.wxapi.result.WxResult; +import com.epmet.wxapi.service.WxMaCodeService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; /** @@ -14,4 +43,137 @@ import java.util.List; @Service public class CodeServiceImpl implements CodeService { + @Autowired + private WxMaCodeService wxMaCodeService; + @Autowired + private ComponentAccessTokenDao componentAccessTokenDao; + @Autowired + private AuthorizationInfoDao authorizationInfoDao; + @Autowired + private CodeCustomerService codeCustomerService; + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; + @Autowired + private CodeAuditResultService codeAuditResultService; + + @Override + public List templateList() { + List resultList = new ArrayList<>(); + //获取COMPONENT_ACCESS_TOKEN + String accessToken = componentAccessTokenDao.getComponentAccessToken(); + //调用微信API获取模板列表 + WxResult> wxResult = wxMaCodeService.getTemplateList(accessToken); + if (!wxResult.success()) { + throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); + } + if (null == wxResult.getData() || wxResult.getData().size() == NumConstant.ZERO) { + return resultList; + } + wxResult.getData().forEach(temp -> { + TemplateListResultDTO dto = new TemplateListResultDTO(); + dto.setTemplateId(temp.getTemplateId()); + dto.setUserVersion(temp.getUserVersion()); + dto.setUserDesc(temp.getUserDesc()); + dto.setCreateTime(DateUtils.formatTimestamp(temp.getCreateTime(), DateUtils.DATE_PATTERN)); + resultList.add(dto); + }); + return resultList; + } + + @Override + public void upload(CodeUploadFormDTO formDTO) { + //获取小程序调用令牌 + AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); + if (null == authInfo) { + throw new RenException("未授权"); + } + //TODO 获取第三方自定义配置 + String extJson = "{}"; + + WxMaCodeCommitReq request = ConvertUtils.sourceToTarget(formDTO, WxMaCodeCommitReq.class); + request.setExtJson(extJson); + //调用微信API上传代码 + WxResult wxResult = wxMaCodeService.commit(authInfo.getAuthorizerAccessToken(), request); + //上传失败,抛出异常 + if (!wxResult.success()) { + throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); + } + //获取客户信息 + CustomerDTO customerDTO = new CustomerDTO(); + customerDTO.setId(formDTO.getCustomerId()); + Result customerInfo = operCrmOpenFeignClient.getCustomerInfo(customerDTO); + if (!customerInfo.success()) { + throw new RenException(customerInfo.getCode(), customerInfo.getMsg()); + } + //TODO 将之前上传信息删除 + + //将上传信息存入表中 + CodeCustomerDTO codeCustomerDTO = ConvertUtils.sourceToTarget(formDTO, CodeCustomerDTO.class); + codeCustomerDTO.setCustomerName(customerInfo.getData().getCustomerName()); + codeCustomerDTO.setExtJson(extJson); + codeCustomerDTO.setStatus(CodeConstant.UNAUDITED); + codeCustomerService.save(codeCustomerDTO); + } + + @Override + public PageData uploadList(UploadListFormDTO formDTO) { + //TODO 更新审核状态 + return codeCustomerService.getCodeList(formDTO); + } + + @Override + public void submitAudit(SubmitAuditFormDTO formDTO) { + //获取上传代码信息 + CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); + //获取小程序调用令牌 + AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); + //调用微信API上提交审核 + WxMaCodeSubmitAuditRequest request = ConvertUtils.sourceToTarget(formDTO, WxMaCodeSubmitAuditRequest.class); + WxResult wxResult = wxMaCodeService.submitAudit(authInfo.getAuthorizerAccessToken(), request); + if (!wxResult.success()) { + throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); + } + //将数据存入代码审核表 + CodeAuditResultDTO codeAuditResultDTO = new CodeAuditResultDTO(); + codeAuditResultDTO.setCustomerId(codeCustomerDTO.getCustomerId()); + codeAuditResultDTO.setCodeId(codeCustomerDTO.getId()); + codeAuditResultDTO.setAuditId(wxResult.getData()); + codeAuditResultDTO.setResult(CodeConstant.AUDITING); + codeAuditResultService.save(codeAuditResultDTO); + //更新代码表状态 + codeCustomerDTO.setStatus(CodeConstant.AUDITING); + codeCustomerService.update(codeCustomerDTO); + } + + @Override + public void undo(CodeCommonFormDTO formDTO) { + //获取上传代码信息 + CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); + //获取审核结果信息 + CodeAuditResultDTO codeAuditResultDTO = codeAuditResultService.getAuditResultByCodeId(formDTO.getCodeId()); + //获取小程序调用令牌 + AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); + //调用微信API获取最新审核状态 + WxMaCodeAuditStatusReq request = new WxMaCodeAuditStatusReq(); + request.setAuditId(codeAuditResultDTO.getAuditId()); + WxResult wxAuditResult = wxMaCodeService.getAuditStatus(authInfo.getAuthorizerAccessToken(), request); + if (!wxAuditResult.success() ) { + throw new RenException(wxAuditResult.getErrorCode(), wxAuditResult.getErrorMsg()); + } + if (wxAuditResult.getData().getStatus() != NumConstant.TWO) { + throw new RenException("该条记录状态已不是审核中,无法撤回"); + } + //调用微信API撤销审核 + WxResult wxResult = wxMaCodeService.undoCodeAudit(authInfo.getAuthorizerAccessToken()); + if (!wxResult.success()) { + throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); + } + //更新审核结果 + codeAuditResultDTO.setResult(CodeConstant.WITHDRAWN); + codeAuditResultService.update(codeAuditResultDTO); + //更新代码表状态 + codeCustomerDTO.setStatus(CodeConstant.WITHDRAWN); + codeCustomerService.update(codeCustomerDTO); + } + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaAuditStatusResult.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaAuditStatusResult.java index ea39ebae7e..2b13169a46 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaAuditStatusResult.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaAuditStatusResult.java @@ -15,7 +15,7 @@ public class WxMaAuditStatusResult implements Serializable { /** * 返回码 */ - private String errcode; + private Integer errcode; /** * 错误信息 */ @@ -33,4 +33,8 @@ public class WxMaAuditStatusResult implements Serializable { */ private String screenshot; + public boolean success(){ + return errcode == 0; + } + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaTemplateListResult.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaTemplateListResult.java new file mode 100644 index 0000000000..513598c1d8 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaTemplateListResult.java @@ -0,0 +1,32 @@ +package com.epmet.wxapi.result; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/15 10:22 + */ +@Data +public class WxMaTemplateListResult implements Serializable { + private static final long serialVersionUID = -331693492663419441L; + /** + * 返回码 + */ + @SerializedName("errcode") + private Integer errCode; + /** + * 错误信息 + */ + @SerializedName("errmsg") + private String errMsg; + /** + * 模板信息列表 + */ + @SerializedName("template_list") + private List templateList; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaTemplateResult.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaTemplateResult.java new file mode 100644 index 0000000000..2e5ded186b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaTemplateResult.java @@ -0,0 +1,36 @@ +package com.epmet.wxapi.result; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/15 10:24 + */ +@Data +public class WxMaTemplateResult implements Serializable { + private static final long serialVersionUID = 5770192375722597547L; + /** + * 模板 id + */ + @SerializedName("template_id") + private String templateId; + /** + * 模板版本号,开发者自定义字段 + */ + @SerializedName("user_version") + private String userVersion; + /** + * 模板描述,开发者自定义字段 + */ + @SerializedName("user_desc") + private String userDesc; + /** + * 被添加为模板的时间 + */ + @SerializedName("create_time") + private Long createTime; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java index b329dabe14..60d243f62d 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java @@ -1,12 +1,11 @@ package com.epmet.wxapi.service; -import com.epmet.wxapi.param.WxMaCodeAuditStatus; import com.epmet.wxapi.param.WxMaCodeAuditStatusReq; import com.epmet.wxapi.param.WxMaCodeCommitReq; import com.epmet.wxapi.param.WxMaCodeSubmitAuditRequest; -import com.epmet.wxapi.result.WxMaCategoryResult; +import com.epmet.wxapi.result.WxMaAuditStatusResult; +import com.epmet.wxapi.result.WxMaTemplateResult; import com.epmet.wxapi.result.WxResult; -import me.chanjar.weixin.common.error.WxErrorException; import java.util.List; @@ -18,75 +17,91 @@ import java.util.List; * @date 2020/7/10 11:21 */ public interface WxMaCodeService { - /** - * 为授权的小程序帐号上传小程序代码(仅仅支持第三方开放平台). - * @author zhaoqifeng - * @date 2020/7/10 14:11 - * @param accessToken 小程序接口调用令牌 - * @param commitRequest 请求参数 - * @return com.epmet.wxapi.result.WxResult - * @throws WxErrorException 上传失败时抛出,具体错误码请看类注释文档 - */ - WxResult commit(String accessToken, WxMaCodeCommitReq commitRequest) throws WxErrorException; - /** - * 获取体验小程序的体验二维码. - * @author zhaoqifeng - * @date 2020/7/10 15:25 - * @param accessToken 小程序接口调用令牌 - * @param path 指定体验版二维码跳转到某个具体页面 - * @return com.epmet.wxapi.result.WxResult - * @throws WxErrorException 抛出异常 - */ - WxResult getQrCode(String accessToken, String path) throws WxErrorException; + /** + * 获取代码模板列表 + * + * @param accessToken + * @return com.epmet.wxapi.result.WxResult + * @author zhaoqifeng + * @date 2020/7/15 10:20 + */ + WxResult> getTemplateList(String accessToken); - /** - * 获取授权小程序帐号的可选类目. - * - * @param accessToken 提交审核参数 - * @return List - */ - WxResult getCategory(String accessToken); + /** + * 为授权的小程序帐号上传小程序代码(仅仅支持第三方开放平台). + * + * @param accessToken 小程序接口调用令牌 + * @param commitRequest 请求参数 + * @return com.epmet.wxapi.result.WxResult + * @author zhaoqifeng + * @date 2020/7/10 14:11 + */ + WxResult commit(String accessToken, WxMaCodeCommitReq commitRequest); - /** - * 获取小程序的第三方提交代码的页面配置(仅供第三方开发者代小程序调用). - * - * @param accessToken 提交审核参数 - * @return page_list 页面配置列表 - */ - WxResult getPage(String accessToken); + /** + * 获取体验小程序的体验二维码. + * + * @param accessToken 小程序接口调用令牌 + * @param path 指定体验版二维码跳转到某个具体页面 + * @return com.epmet.wxapi.result.WxResult + * @author zhaoqifeng + * @date 2020/7/10 15:25 + */ + WxResult getQrCode(String accessToken, String path); - /** - * 将第三方提交的代码包提交审核(仅供第三方开发者代小程序调用). - * - * @param accessToken 提交审核参数 - * @param auditRequest 提交审核参数 - * @return 审核编号 - */ - WxResult submitAudit(String accessToken, WxMaCodeSubmitAuditRequest auditRequest); + /** + * 获取授权小程序帐号的可选类目. + * + * @param accessToken 提交审核参数 + * @return List + */ + WxResult getCategory(String accessToken); - /** - * 查询指定版本审核状态(仅供第三方代小程序调用). - * - * @param accessToken 提交审核参数 - * @return 审核状态 - */ - WxResult getAuditStatus(String accessToken, WxMaCodeAuditStatusReq request); + /** + * 获取小程序的第三方提交代码的页面配置(仅供第三方开发者代小程序调用). + * + * @param accessToken 提交审核参数 + * @return page_list 页面配置列表 + */ + WxResult getPage(String accessToken); - /** - * 发布已通过审核的小程序(仅供第三方代小程序调用). - * - * @param accessToken 提交审核参数 - * @return 发布结果 - */ - WxResult release(String accessToken); + /** + * 将第三方提交的代码包提交审核(仅供第三方开发者代小程序调用). + * + * @param accessToken 提交审核参数 + * @param auditRequest 提交审核参数 + * @return 审核编号 + */ + WxResult submitAudit(String accessToken, WxMaCodeSubmitAuditRequest auditRequest); - /** - * 小程序审核撤回. - * 单个帐号每天审核撤回次数最多不超过1次,一个月不超过10次 - * - * @param accessToken 提交审核参数 - * @return 撤回结果 - */ - WxResult undoCodeAudit(String accessToken); + /** + * 查询指定版本审核状态(仅供第三方代小程序调用). + * + * @param accessToken 提交审核参数 + * @param request 提交审核参数 + * @return 审核状态 + */ + WxResult getAuditStatus(String accessToken, WxMaCodeAuditStatusReq request); + + /** + * 发布已通过审核的小程序(仅供第三方代小程序调用). + * + * @param accessToken 提交审核参数 + * @return 发布结果 + */ + WxResult release(String accessToken); + + /** + * 小程序审核撤回. + * 单个帐号每天审核撤回次数最多不超过1次,一个月不超过10次 + * + * @param accessToken 提交审核参数 + * @return 撤回结果 + */ + WxResult undoCodeAudit(String accessToken); + + //TODO 设置服务器域名 + + //TODO 设置业务域名 } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java index 2ae3ff2443..41c1e17f7e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java @@ -1,11 +1,9 @@ package com.epmet.wxapi.service.impl; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; import com.epmet.wxapi.constant.WxMaCodeConstant; -import com.epmet.wxapi.param.WxMaCodeAuditStatus; import com.epmet.wxapi.param.WxMaCodeAuditStatusReq; import com.epmet.wxapi.param.WxMaCodeCommitReq; import com.epmet.wxapi.param.WxMaCodeSubmitAuditRequest; @@ -13,16 +11,12 @@ import com.epmet.wxapi.result.*; import com.epmet.wxapi.service.WxMaCodeService; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import io.micrometer.core.instrument.util.JsonUtils; -import lombok.Data; -import me.chanjar.weixin.common.error.WxErrorException; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; import java.util.List; /** @@ -33,161 +27,186 @@ import java.util.List; */ @Service public class WxMaCodeServiceImpl implements WxMaCodeService { - private static final String ERR_CODE = "errcode"; - private static final String ERR_MSG = "errmsg"; - - @Override - public WxResult commit(String accessToken, WxMaCodeCommitReq commitRequest) throws WxErrorException { - WxResult result = new WxResult(); - String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken; - Result commitResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(commitRequest)); - if(!commitResult.success()) { - result.setErrorCode(commitResult.getCode()); - result.setErrorMsg(commitResult.getMsg()); - return result; - } - JSONObject jsonObject = JSONObject.parseObject(commitResult.getData()); - result.setErrorCode(jsonObject.getInteger(ERR_CODE)); - result.setErrorMsg(jsonObject.getString(ERR_MSG)); - return result; - } - - @Override - public WxResult getQrCode(String accessToken, String path) throws WxErrorException{ - WxResult result = new WxResult<>(); - StringBuilder url = new StringBuilder(WxMaCodeConstant.GET_QRCODE_URL).append("?access_token").append(accessToken); - if (StringUtils.isNotBlank(path)) { - try { - url.append("?path=").append(URLEncoder.encode(path, StandardCharsets.UTF_8.name())); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - } - Result qrCodeResult = HttpClientManager.getInstance().sendGetFile(url.toString(), null); - if(!qrCodeResult.success()) { - result.setErrorCode(qrCodeResult.getCode()); - result.setErrorMsg(qrCodeResult.getMsg()); - return result; - } - - result.setData(qrCodeResult.getData()); - - return result; - } - - @Override - public WxResult getCategory(String accessToken) { - WxResult> result = new WxResult<>(); - String url = WxMaCodeConstant.GET_CATEGORY_URL + "?" + "access_token=" + accessToken; - Result getCategoryResult = HttpClientManager.getInstance().sendGet(url, null); - if(!getCategoryResult.success()) { - result.setErrorCode(getCategoryResult.getCode()); - result.setErrorMsg(getCategoryResult.getMsg()); - return result; - } - WxMaGetCategoryResult categoryResult = JSONObject.parseObject(getCategoryResult.getData(), WxMaGetCategoryResult.class); - result.setErrorCode(categoryResult.getErrcode()); - result.setErrorMsg(categoryResult.getErrmsg()); - result.setData(categoryResult.getCategoryList()); - return result; - } - - @Override - public WxResult getPage(String accessToken) { - WxResult> result = new WxResult<>(); - String url = WxMaCodeConstant.GET_PAGE_URL + "?" + "access_token=" + accessToken; - Result getPageResult = HttpClientManager.getInstance().sendGet(url, null); - if(!getPageResult.success()) { - result.setErrorCode(getPageResult.getCode()); - result.setErrorMsg(getPageResult.getMsg()); - return result; - } - WxMaGetPageResult pageResult = JSONObject.parseObject(getPageResult.getData(), WxMaGetPageResult.class); - result.setErrorCode(pageResult.getErrcode()); - result.setErrorMsg(pageResult.getErrmsg()); - result.setData(pageResult.getPageList()); - return result; - } - - @Override - public WxResult submitAudit(String accessToken, WxMaCodeSubmitAuditRequest auditRequest) { - WxResult result = new WxResult(); - String url = WxMaCodeConstant.SUBMIT_AUDIT_URL + "?" + "access_token=" + accessToken; - Result submitResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(auditRequest)); - if(!submitResult.success()) { - result.setErrorCode(submitResult.getCode()); - result.setErrorMsg(submitResult.getMsg()); - return result; - } - JSONObject jsonObject = JSONObject.parseObject(submitResult.getData()); - result.setErrorCode(jsonObject.getInteger(ERR_CODE)); - result.setErrorMsg(jsonObject.getString(ERR_MSG)); - return result; - } - - @Override - public WxResult getAuditStatus(String accessToken, WxMaCodeAuditStatusReq request) { - WxResult result = new WxResult<>(); - String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken; - Result statusResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); - if(!statusResult.success()) { - result.setErrorCode(statusResult.getCode()); - result.setErrorMsg(statusResult.getMsg()); - return result; - } - WxMaAuditStatusResult auditStatusResult = JSONObject.parseObject(statusResult.getData(), WxMaAuditStatusResult.class); - result.ok(auditStatusResult); - return result; - } - - @Override - public WxResult release(String accessToken) { - WxResult result = new WxResult(); - String url = WxMaCodeConstant.RELEASE_URL + "?" + "access_token=" + accessToken; - Result releaseResult = HttpClientManager.getInstance().sendPostByJSON(url, null); - if(!releaseResult.success()) { - result.setErrorCode(releaseResult.getCode()); - result.setErrorMsg(releaseResult.getMsg()); - return result; - } - JSONObject jsonObject = JSONObject.parseObject(releaseResult.getData()); - result.setErrorCode(jsonObject.getInteger(ERR_CODE)); - result.setErrorMsg(jsonObject.getString(ERR_MSG)); - return result; - } - - @Override - public WxResult undoCodeAudit(String accessToken) { - WxResult result = new WxResult(); - String url = WxMaCodeConstant.UNDO_CODE_AUDIT_URL + "?" + "access_token=" + accessToken; - Result undoResult = HttpClientManager.getInstance().sendGet(url, null); - if(!undoResult.success()) { - result.setErrorCode(undoResult.getCode()); - result.setErrorMsg(undoResult.getMsg()); - return result; - } - JSONObject jsonObject = JSONObject.parseObject(undoResult.getData()); - result.setErrorCode(jsonObject.getInteger(ERR_CODE)); - result.setErrorMsg(jsonObject.getString(ERR_MSG)); - return result; - } - - public static void main(String[] args) { - String url = "{\"errcode\":0,\"errmsg\":\"ok\",\"category_list\":[{\"first_class\":\"工具\",\"second_class\":\"备忘录\",\"first_id\":1,\"second_id\":2,}\n" + - "{\"first_class\":\"教育\",\"second_class\":\"学历教育\",\"third_class\":\"高等\",\"first_id\":3,\"second_id\":4,\"third_id\":5,}]}"; - WxMaGetCategoryResult video = JSONObject.parseObject(url, WxMaGetCategoryResult.class); - WxResult> result = new WxResult<>(); - result.setErrorCode(video.getErrcode()); - result.setErrorMsg(video.getErrmsg()); - result.setData(video.getCategoryList()); - System.out.println(result); - WxMaCodeSubmitAuditRequest request = new WxMaCodeSubmitAuditRequest(); - request.setVersionDesc("aasdf"); - } - private String toJson(Object object) { - GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.setPrettyPrinting(); - Gson gson = gsonBuilder.create(); - return gson.toJson(object); - } + private static final String ERR_CODE = "errcode"; + private static final String ERR_MSG = "errmsg"; + + @Override + public WxResult> getTemplateList(String accessToken) { + WxResult> result = new WxResult<>(); + String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken; + Result templateListResult = HttpClientManager.getInstance().sendGet(url, null); + if (!templateListResult.success()) { + result.setErrorCode(templateListResult.getCode()); + result.setErrorMsg(templateListResult.getMsg()); + return result; + } + Gson gson = new Gson(); + WxMaTemplateListResult templateList = new Gson().fromJson(templateListResult.getData(), WxMaTemplateListResult.class); + result.setErrorCode(templateList.getErrCode()); + result.setErrorMsg(templateList.getErrMsg()); + result.setData(templateList.getTemplateList()); + return result; + } + + @Override + public WxResult commit(String accessToken, WxMaCodeCommitReq commitRequest) { + WxResult result = new WxResult(); + String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken; + Result commitResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(commitRequest)); + if (!commitResult.success()) { + result.setErrorCode(commitResult.getCode()); + result.setErrorMsg(commitResult.getMsg()); + return result; + } + JSONObject jsonObject = JSONObject.parseObject(commitResult.getData()); + result.setErrorCode(jsonObject.getInteger(ERR_CODE)); + result.setErrorMsg(jsonObject.getString(ERR_MSG)); + return result; + } + + @Override + public WxResult getQrCode(String accessToken, String path) { + WxResult result = new WxResult<>(); + StringBuilder url = new StringBuilder(WxMaCodeConstant.GET_QRCODE_URL).append("?access_token").append(accessToken); + if (StringUtils.isNotBlank(path)) { + try { + url.append("?path=").append(URLEncoder.encode(path, StandardCharsets.UTF_8.name())); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + Result qrCodeResult = HttpClientManager.getInstance().sendGetFile(url.toString(), null); + if (!qrCodeResult.success()) { + result.setErrorCode(qrCodeResult.getCode()); + result.setErrorMsg(qrCodeResult.getMsg()); + return result; + } + + result.setData(qrCodeResult.getData()); + + return result; + } + + @Override + public WxResult getCategory(String accessToken) { + WxResult> result = new WxResult<>(); + String url = WxMaCodeConstant.GET_CATEGORY_URL + "?" + "access_token=" + accessToken; + Result getCategoryResult = HttpClientManager.getInstance().sendGet(url, null); + if (!getCategoryResult.success()) { + result.setErrorCode(getCategoryResult.getCode()); + result.setErrorMsg(getCategoryResult.getMsg()); + return result; + } + WxMaGetCategoryResult categoryResult = JSONObject.parseObject(getCategoryResult.getData(), WxMaGetCategoryResult.class); + result.setErrorCode(categoryResult.getErrcode()); + result.setErrorMsg(categoryResult.getErrmsg()); + result.setData(categoryResult.getCategoryList()); + return result; + } + + @Override + public WxResult getPage(String accessToken) { + WxResult> result = new WxResult<>(); + String url = WxMaCodeConstant.GET_PAGE_URL + "?" + "access_token=" + accessToken; + Result getPageResult = HttpClientManager.getInstance().sendGet(url, null); + if (!getPageResult.success()) { + result.setErrorCode(getPageResult.getCode()); + result.setErrorMsg(getPageResult.getMsg()); + return result; + } + WxMaGetPageResult pageResult = JSONObject.parseObject(getPageResult.getData(), WxMaGetPageResult.class); + result.setErrorCode(pageResult.getErrcode()); + result.setErrorMsg(pageResult.getErrmsg()); + result.setData(pageResult.getPageList()); + return result; + } + + @Override + public WxResult submitAudit(String accessToken, WxMaCodeSubmitAuditRequest auditRequest) { + WxResult result = new WxResult<>(); + String url = WxMaCodeConstant.SUBMIT_AUDIT_URL + "?" + "access_token=" + accessToken; + Result submitResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(auditRequest)); + if (!submitResult.success()) { + result.setErrorCode(submitResult.getCode()); + result.setErrorMsg(submitResult.getMsg()); + return result; + } + JSONObject jsonObject = JSONObject.parseObject(submitResult.getData()); + result.setErrorCode(jsonObject.getInteger(ERR_CODE)); + result.setErrorMsg(jsonObject.getString(ERR_MSG)); + result.setData(jsonObject.getString("auditid")); + return result; + } + + @Override + public WxResult getAuditStatus(String accessToken, WxMaCodeAuditStatusReq request) { + WxResult result = new WxResult<>(); + String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken; + Result statusResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); + if (!statusResult.success()) { + result.setErrorCode(statusResult.getCode()); + result.setErrorMsg(statusResult.getMsg()); + return result; + } + WxMaAuditStatusResult auditStatusResult = JSONObject.parseObject(statusResult.getData(), WxMaAuditStatusResult.class); + if (!auditStatusResult.success()){ + result.setErrorCode(auditStatusResult.getErrcode()); + result.setErrorMsg(auditStatusResult.getErrmsg()); + return result; + } + result.ok(auditStatusResult); + return result; + } + + @Override + public WxResult release(String accessToken) { + WxResult result = new WxResult(); + String url = WxMaCodeConstant.RELEASE_URL + "?" + "access_token=" + accessToken; + Result releaseResult = HttpClientManager.getInstance().sendPostByJSON(url, null); + if (!releaseResult.success()) { + result.setErrorCode(releaseResult.getCode()); + result.setErrorMsg(releaseResult.getMsg()); + return result; + } + JSONObject jsonObject = JSONObject.parseObject(releaseResult.getData()); + result.setErrorCode(jsonObject.getInteger(ERR_CODE)); + result.setErrorMsg(jsonObject.getString(ERR_MSG)); + return result; + } + + @Override + public WxResult undoCodeAudit(String accessToken) { + WxResult result = new WxResult(); + String url = WxMaCodeConstant.UNDO_CODE_AUDIT_URL + "?" + "access_token=" + accessToken; + Result undoResult = HttpClientManager.getInstance().sendGet(url, null); + if (!undoResult.success()) { + result.setErrorCode(undoResult.getCode()); + result.setErrorMsg(undoResult.getMsg()); + return result; + } + JSONObject jsonObject = JSONObject.parseObject(undoResult.getData()); + result.setErrorCode(jsonObject.getInteger(ERR_CODE)); + result.setErrorMsg(jsonObject.getString(ERR_MSG)); + return result; + } + + public static void main(String[] args) { + String url = "{\"errcode\":0,\"errmsg\":\"ok\",\"category_list\":[{\"first_class\":\"工具\",\"second_class\":\"备忘录\",\"first_id\":1,\"second_id\":2,}\n" + + "{\"first_class\":\"教育\",\"second_class\":\"学历教育\",\"third_class\":\"高等\",\"first_id\":3,\"second_id\":4,\"third_id\":5,}]}"; + WxMaGetCategoryResult video = JSONObject.parseObject(url, WxMaGetCategoryResult.class); + WxResult> result = new WxResult<>(); + result.setErrorCode(video.getErrcode()); + result.setErrorMsg(video.getErrmsg()); + result.setData(video.getCategoryList()); + System.out.println(result); + WxMaCodeSubmitAuditRequest request = new WxMaCodeSubmitAuditRequest(); + request.setVersionDesc("aasdf"); + } + + private String toJson(Object object) { + GsonBuilder gsonBuilder = new GsonBuilder(); + gsonBuilder.setPrettyPrinting(); + Gson gson = gsonBuilder.create(); + return gson.toJson(object); + } } \ 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 707b16d9cb..ea012b7f0a 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 @@ -68,5 +68,14 @@ update authorization_info set del_flag = 1 where customer_id = #{customerId} AND client_type = #{clientType} + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml index 888e90c40f..b880a03e60 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml @@ -3,6 +3,23 @@ + + + + + + + + + + + + + + + UPDATE code_audit_result diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml index a349160ef5..6761472660 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml @@ -3,6 +3,59 @@ + + + + + + + + + + + + + + + + + + + + SELECT + COMPONENT_ACCESS_TOKEN + FROM + component_access_token + WHERE delFlag = '0' + @@ -44,7 +43,7 @@ UPDATE customer_mp - SET authorization_flag = 1 + SET authorization_flag = 0 WHERE app_id = #{authAppId} From b1841704dd36ee294910cc0389f40fa65dc87520 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 15 Jul 2020 18:15:35 +0800 Subject: [PATCH 83/90] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=83=A8=E7=BD=B2=20go?= =?UTF-8?q?v-project=20gov-issue=20scan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-issue/gov-issue-server/deploy/docker-compose-dev.yml | 2 +- .../gov-issue/gov-issue-server/deploy/docker-compose-prod.yml | 2 +- .../gov-issue/gov-issue-server/deploy/docker-compose-test.yml | 2 +- epmet-module/gov-issue/gov-issue-server/pom.xml | 2 +- .../gov-project-server/deploy/docker-compose-dev.yml | 2 +- .../gov-project-server/deploy/docker-compose-prod.yml | 2 +- .../gov-project-server/deploy/docker-compose-test.yml | 2 +- epmet-module/gov-project/gov-project-server/pom.xml | 2 +- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml | 2 +- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml | 2 +- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml | 2 +- epmet-openapi/epmet-openapi-scan/pom.xml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml index 4b27e8212c..58a75a2195 100644 --- a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-issue-server: container_name: gov-issue-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.51 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.52 ports: - "8101:8101" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-prod.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-prod.yml index ccc53b97d9..312e064441 100644 --- a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-issue-server: container_name: gov-issue-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-issue-server:0.3.51 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-issue-server:0.3.52 ports: - "8101:8101" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-test.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-test.yml index 6d12039b0a..54760eca82 100644 --- a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-test.yml +++ b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-issue-server: container_name: gov-issue-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-issue-server:0.3.51 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-issue-server:0.3.52 ports: - "8101:8101" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index 6eeb2a35c3..9ec2c6e91d 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.51 + 0.3.52 gov-issue com.epmet diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml index f5f033e08c..042e4aeb80 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.38 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.39 ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml index f3f7157861..215ddefc6a 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-project-server:0.3.38 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-project-server:0.3.39 ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-test.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-test.yml index be230acf39..d00c633082 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-test.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-project-server:0.3.38 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-project-server:0.3.39 ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-project/gov-project-server/pom.xml b/epmet-module/gov-project/gov-project-server/pom.xml index ab5057b85d..283a6616be 100644 --- a/epmet-module/gov-project/gov-project-server/pom.xml +++ b/epmet-module/gov-project/gov-project-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.38 + 0.3.39 gov-project com.epmet diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml index f0026c2a18..5137c630ed 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.21 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.23 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml index 811ca9f522..15c4000109 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.21 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.23 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml index b2a0d1b59b..be5e1ee040 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.21 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.23 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml index 779f40f770..747107e901 100644 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.21 + 0.3.23 epmet-openapi-scan jar From 7ec81c37c56ca70da96aa2c16bca245356eefda0 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 15 Jul 2020 18:27:52 +0800 Subject: [PATCH 84/90] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../deploy/docker-compose-dev.yml | 2 +- .../deploy/docker-compose-prod.yml | 17 +++++++++++++++++ .../deploy/docker-compose-test.yml | 2 +- .../epmet-third/epmet-third-server/pom.xml | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 0ca6d3e6d4..626edd76ec 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.11 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.12 ports: - "8110:8110" network_mode: host # 使用现有网络 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 new file mode 100644 index 0000000000..1a5c997b4f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml @@ -0,0 +1,17 @@ +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.12 + ports: + - "8110:8110" + network_mode: host # 使用现有网络 + volumes: + - "/opt/epmet-cloud-logs/prod:/logs" + environment: + RUN_INSTRUCT: "java -Xms256m -Xmx512m -jar ./app.jar" + deploy: + resources: + limits: + cpus: '0.1' + memory: 600M \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml index 6c17cf45fc..80364077c3 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.1 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.12 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 076eebce7d..9937f6d4f5 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.11 + 0.0.12 com.epmet From 01f265a03bcde048c43617e48098196410b5db93 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 15 Jul 2020 18:53:24 +0800 Subject: [PATCH 85/90] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third/epmet-third-server/pom.xml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 9937f6d4f5..ac39e678f7 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -225,6 +225,39 @@ true + + + prod + + + 8110 + prod + + + + + + epmet_third_user + EpmEt-db-UsEr + + 0 + r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com + 6379 + EpmEtclOUdrEdIs!Q2w + + true + 192.168.11.180:8848 + bd205d23-e696-47be-b995-916313f86e99 + + + false + + + true + + From 3158d88c5a6482276aa0f66973d10b8fd35866c5 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 15 Jul 2020 18:53:58 +0800 Subject: [PATCH 86/90] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- .../epmet-third-server/deploy/docker-compose-prod.yml | 2 +- .../epmet-third-server/deploy/docker-compose-test.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 626edd76ec..58e0013a0e 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.12 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.13 ports: - "8110:8110" network_mode: host # 使用现有网络 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 1a5c997b4f..07c8ec9fd7 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.12 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-third-server:0.0.13 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml index 80364077c3..1b21690631 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.12 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.13 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 ac39e678f7..da4cf4cf5d 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.12 + 0.0.13 com.epmet From 2a041f887d72e91c4f2c6ad29deaf6fb3eb66a0c Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 15 Jul 2020 19:01:16 +0800 Subject: [PATCH 87/90] =?UTF-8?q?=E5=A2=9E=E5=8A=A0flyway=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=EF=BC=8C=E5=B9=B6=E4=B8=94=E5=8D=87=E7=BA=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-prod.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- .../src/main/resources/db/migration/V0.0.1__demo.sql | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.1__demo.sql 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 07c8ec9fd7..9cf4fac4ef 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.13 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-third-server:0.0.14 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 da4cf4cf5d..3312989042 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.13 + 0.0.14 com.epmet diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.1__demo.sql b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.1__demo.sql new file mode 100644 index 0000000000..7a51a3f595 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.1__demo.sql @@ -0,0 +1 @@ +select 0; \ No newline at end of file From 6b931a3195cfd31af195fc0ef266d0787cead0ca Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 15 Jul 2020 21:16:29 +0800 Subject: [PATCH 88/90] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/deploy/docker-compose-prod.yml | 2 +- epmet-gateway/deploy/docker-compose-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-gateway/deploy/docker-compose-prod.yml b/epmet-gateway/deploy/docker-compose-prod.yml index bf31e2a0ca..35a4e7e1e2 100644 --- a/epmet-gateway/deploy/docker-compose-prod.yml +++ b/epmet-gateway/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.23 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.25 ports: - "8080:8080" network_mode: host # 使用现有网络 diff --git a/epmet-gateway/deploy/docker-compose-test.yml b/epmet-gateway/deploy/docker-compose-test.yml index 1d72f6bc4b..3dfa75ed94 100644 --- a/epmet-gateway/deploy/docker-compose-test.yml +++ b/epmet-gateway/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-gateway:0.3.23 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-gateway:0.3.25 ports: - "8080:8080" network_mode: host # 使用现有网络 From 3fd888aa50e4eaa58e1172f68374d3430ce7bbd8 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 15 Jul 2020 22:58:42 +0800 Subject: [PATCH 89/90] =?UTF-8?q?=E5=8E=BB=E6=8E=89gateway=E5=AF=B9/third/?= =?UTF-8?q?*=E7=9A=84=E7=99=BB=E5=BD=95=E6=A0=A1=E9=AA=8C=EF=BC=8C?= =?UTF-8?q?=E8=AF=A5=E5=89=8D=E7=BC=80=E7=9A=84=E6=9A=82=E6=97=B6=E9=83=BD?= =?UTF-8?q?=E6=94=BE=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/src/main/resources/bootstrap.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index a926c88fb3..eb0440abb7 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -409,7 +409,6 @@ epmet: - /gov/issue/** - /gov/project/** - /resi/home/** - - /third/** swaggerUrls: jwt: From 5a04f5af798983d9e1c2cb6dc4f1c4c7c70f0002 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 15 Jul 2020 23:00:19 +0800 Subject: [PATCH 90/90] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/deploy/docker-compose-dev.yml | 2 +- epmet-gateway/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-gateway/deploy/docker-compose-dev.yml b/epmet-gateway/deploy/docker-compose-dev.yml index e5f9f85c52..451de14e3d 100644 --- a/epmet-gateway/deploy/docker-compose-dev.yml +++ b/epmet-gateway/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.25 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.26 ports: - "8080:8080" network_mode: host # 使用现有网络 diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 0754957980..646f95428e 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.25 + 0.3.26 com.epmet epmet-cloud