Browse Source

微信第三方平台

dev
zxc 5 years ago
parent
commit
2ed8aad0f1
  1. 2
      epmet-gateway/pom.xml
  2. 17
      epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/constant/ThirdPlatformConstant.java
  3. 35
      epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/ComponentVerifyTicketFormDTO.java
  4. 25
      epmet-module/epmet-third-platform/epmet-third-platform-client/src/main/java/com/epmet/dto/form/WeChatPlatformAuthCodeFormDTO.java
  5. 12
      epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml
  6. 24
      epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/constant/ModuleConstant.java
  7. 44
      epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java
  8. 45
      epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/redis/RedisThird.java
  9. 46
      epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java
  10. 24
      epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/DbyWechatExtService.java
  11. 144
      epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java
  12. 59
      epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java
  13. 17
      epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/bootstrap.yml

2
epmet-gateway/pom.xml

@ -187,7 +187,7 @@
<!-- <gateway.routes.epmet-openapi-scan.uri>http://localhost:8107</gateway.routes.epmet-openapi-scan.uri>--> <!-- <gateway.routes.epmet-openapi-scan.uri>http://localhost:8107</gateway.routes.epmet-openapi-scan.uri>-->
<!-- 31、微信第三方平台 --> <!-- 31、微信第三方平台 -->
<!-- <gateway.routes.epmet-third-platform-server.uri>lb://epmet-third-platform-server</gateway.routes.epmet-third-platform-server.uri>--> <!-- <gateway.routes.epmet-third-platform-server.uri>lb://epmet-third-platform-server</gateway.routes.epmet-third-platform-server.uri>-->
<gateway.routes.epmet-third-platform-server.uri>http://localhost:8109</gateway.routes.epmet-third-platform-server.uri> <gateway.routes.epmet-third-platform-server.uri>http://localhost:8110</gateway.routes.epmet-third-platform-server.uri>
</properties> </properties>
</profile> </profile>

17
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 PLATFORM_COMPONENT_TOKEN = "****************";
/**
*
*/
String API_COMPONENT_TOKEN_URl = "**************";
/**
*
*/
String API_CREATE_PREAUTHCODE_URL = "***************";
/**
*
*/
String API_QUERY_AUTH_URL = "**********";
} }

35
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;
}

25
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;
}

12
epmet-module/epmet-third-platform/epmet-third-platform-server/pom.xml

@ -93,6 +93,14 @@
<!--<version>5.1.1</version>--> <!--<version>5.1.1</version>-->
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.3.1</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
@ -148,7 +156,7 @@
<activeByDefault>true</activeByDefault> <activeByDefault>true</activeByDefault>
</activation> </activation>
<properties> <properties>
<server.port>8109</server.port> <server.port>8110</server.port>
<spring.profiles.active>dev</spring.profiles.active> <spring.profiles.active>dev</spring.profiles.active>
<!-- 数据库配置--> <!-- 数据库配置-->
@ -180,7 +188,7 @@
<activeByDefault>true</activeByDefault> <activeByDefault>true</activeByDefault>
</activation>--> </activation>-->
<properties> <properties>
<server.port>8109</server.port> <server.port>8110</server.port>
<spring.profiles.active>test</spring.profiles.active> <spring.profiles.active>test</spring.profiles.active>
<!-- 数据库配置--> <!-- 数据库配置-->

24
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 { public interface ModuleConstant {
String START_RECEIVE = "==============================开始授权事件接收URL=================================";
String TICKET_KEY = "ComponentVerifyTicket"; String TICKET_KEY = "ComponentVerifyTicket";
String TICKET_UNDERLINE_KEY = "component_verify_ticket"; 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 AUTH_TICKET = "====================授权票据【ComponentVerifyTicket】:【%s】====================";
String ERROR_TICKET = "微信开放平台,第三方平台获取【验证票据】失败"; String ERROR_TICKET = "微信开放平台,第三方平台获取【验证票据】失败";
String END_TICKET = "==============================结束授权事件接收URL================================="; String END_TICKET = "==============================结束授权事件接收URL=================================";
String SUCCESS = "success"; String START_RECEIVE = "==============================开始授权事件接收URL=================================";
String URL_TICKET = "授权事件接收URL,验证票据"; String URL_TICKET = "授权事件接收URL,验证票据";
@ -26,4 +36,12 @@ public interface ModuleConstant {
String ERROR_URL_TICKET = "第三方平台授权事件接收URL,验证票据异常"; String ERROR_URL_TICKET = "第三方平台授权事件接收URL,验证票据异常";
String SUCCESS_ACCESS_TOKEN = "====================结束执行定时任务获取令牌【component_access_token】====================";
String FAILURE_ACCESS_TOKEN = "微信开放平台,第三方平台获取【令牌】失败";
String TICKET_REDIS_KEY = "epmet:wechartthird:componentverifyticket";
} }

44
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; 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.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.ThirdPlatformEventFormDTO; import com.epmet.dto.form.ThirdPlatformEventFormDTO;
import com.epmet.dto.form.WeChatPlatformAuthCodeFormDTO;
import com.epmet.dto.result.ResultBean; import com.epmet.dto.result.ResultBean;
import com.epmet.service.DbyWechatExtService; import com.epmet.service.ComponentVerifyTicketService;
import com.epmet.constant.ModuleConstant;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -23,16 +24,37 @@ import org.springframework.web.bind.annotation.RestController;
public class ComponentVerifyTicketController { public class ComponentVerifyTicketController {
@Autowired @Autowired
private DbyWechatExtService dbyWechatExtService; private ComponentVerifyTicketService componentVerifyTicketService;
@PostMapping(value = "/event") @PostMapping(value = "/event")
public Result<ResultBean> wechatPlatformEvent(@RequestBody ThirdPlatformEventFormDTO formDTO) { public Result weChatPlatformEvent(@RequestBody ThirdPlatformEventFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ThirdPlatformEventFormDTO.ThirdPlatForm.class); ValidatorUtils.validateEntity(formDTO, ThirdPlatformEventFormDTO.ThirdPlatForm.class);
ResultBean resultBean = new ResultBean(); componentVerifyTicketService.parseRequest(formDTO);
log.info(ModuleConstant.URL_TICKET); return new Result();
resultBean.setData(dbyWechatExtService.parseRequest(formDTO)); }
log.info(ModuleConstant.SUCCESS_TICKET);
return new Result<ResultBean>().ok(resultBean); @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();
} }

45
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);
}
}

46
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);
}

24
epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/DbyWechatExtService.java

@ -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);
}

144
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<String, String> 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<String, String> 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<String, String> 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<String, String> 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");
}
}

59
epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/DbyWechatExtServiceImpl.java

@ -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<String, String> 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;
}
}

17
epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/resources/bootstrap.yml

@ -8,7 +8,7 @@ spring:
allow-bean-definition-overriding: true allow-bean-definition-overriding: true
application: application:
name: epmet-third-platform-server name: epmet-third-platform-server
#环境 dev|test|prod # dev|test|prod
profiles: profiles:
active: dev active: dev
jackson: jackson:
@ -31,9 +31,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: @nacos.server-addr@ server-addr: @nacos.server-addr@
#nacos的命名空间ID,默认是public
namespace: @nacos.discovery.namespace@ namespace: @nacos.discovery.namespace@
#不把自己注册到注册中心的地址
register-enabled: @nacos.register-enabled@ register-enabled: @nacos.register-enabled@
ip: @nacos.ip@ ip: @nacos.ip@
config: config:
@ -42,7 +40,6 @@ spring:
namespace: @nacos.config.namespace@ namespace: @nacos.config.namespace@
group: @nacos.config.group@ group: @nacos.config.group@
file-extension: yaml file-extension: yaml
# 数据迁移工具flyway
flyway: flyway:
enabled: @spring.flyway.enabled@ enabled: @spring.flyway.enabled@
locations: classpath:db/migration locations: classpath:db/migration
@ -62,19 +59,14 @@ management:
mybatis-plus: mybatis-plus:
mapper-locations: classpath:/mapper/**/*.xml mapper-locations: classpath:/mapper/**/*.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.epmet.entity typeAliasesPackage: com.epmet.entity
global-config: global-config:
#数据库相关配置
db-config: db-config:
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
id-type: ID_WORKER id-type: ID_WORKER
#字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
field-strategy: NOT_NULL field-strategy: NOT_NULL
#驼峰下划线转换
column-underline: true column-underline: true
banner: false banner: false
#原生配置
configuration: configuration:
map-underscore-to-camel-case: true map-underscore-to-camel-case: true
cache-enabled: false cache-enabled: false
@ -97,13 +89,12 @@ hystrix:
execution: execution:
isolation: isolation:
thread: thread:
timeoutInMilliseconds: 60000 #缺省为1000 timeoutInMilliseconds: 60000
ribbon: ribbon:
ReadTimeout: 300000 ReadTimeout: 300000
ConnectTimeout: 300000 ConnectTimeout: 300000
#pageHelper分页插件
pagehelper: pagehelper:
helper-dialect: mysql helper-dialect: mysql
reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 reasonable: false
Loading…
Cancel
Save