15 changed files with 422 additions and 54 deletions
@ -1,54 +0,0 @@ |
|||||
//package com.bnyer.img.handler;
|
|
||||
//
|
|
||||
//import com.bnyer.common.core.annotation.TokenCheck;
|
|
||||
//import com.bnyer.common.core.exception.ServiceException;
|
|
||||
//import com.bnyer.common.redis.service.RedisService;
|
|
||||
//import com.bnyer.img.constants.RedisKeyConstant;
|
|
||||
//import org.apache.commons.lang3.StringUtils;
|
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
|
||||
//import org.springframework.stereotype.Component;
|
|
||||
//import org.springframework.web.method.HandlerMethod;
|
|
||||
//import org.springframework.web.servlet.HandlerInterceptor;
|
|
||||
//
|
|
||||
//import javax.servlet.http.HttpServletRequest;
|
|
||||
//import javax.servlet.http.HttpServletResponse;
|
|
||||
//
|
|
||||
///**
|
|
||||
// * @author chengkun
|
|
||||
// * @date 2022/4/22 15:04
|
|
||||
// */
|
|
||||
//@Component
|
|
||||
//public class TokenCheckHandler implements HandlerInterceptor {
|
|
||||
//
|
|
||||
// String tokenKey = RedisKeyConstant.TIKTOK_USER_LOGIN_KEY;
|
|
||||
//
|
|
||||
// @Autowired
|
|
||||
// private RedisService redisService;
|
|
||||
//
|
|
||||
// @Override
|
|
||||
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
|
||||
//
|
|
||||
// // 判断访问的方法上是否有注解
|
|
||||
// HandlerMethod handlerMethod = (HandlerMethod) handler;
|
|
||||
// boolean tokenCheck = handlerMethod.hasMethodAnnotation(TokenCheck.class);
|
|
||||
//
|
|
||||
// // 尝试从请求头从获取token值
|
|
||||
// String token = request.getHeader("token");
|
|
||||
// if(StringUtils.isEmpty(token)){
|
|
||||
// if(tokenCheck){
|
|
||||
// throw new ServiceException("token为空,无权访问!");
|
|
||||
// }
|
|
||||
// }
|
|
||||
// String[] split = token.split("#");
|
|
||||
// //从token中获取openId
|
|
||||
// String openId = split[1];
|
|
||||
// //组装redisKey
|
|
||||
// String redisKey = tokenKey+openId;
|
|
||||
// //判断redis中是否存在该key,存在则放行,不存在则过期
|
|
||||
// if(redisService.hasKey(redisKey)){
|
|
||||
// return true;
|
|
||||
// }else{
|
|
||||
// throw new ServiceException("token失效,请重新授权!");
|
|
||||
// }
|
|
||||
// }
|
|
||||
//}
|
|
||||
@ -0,0 +1,131 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<parent> |
||||
|
<artifactId>bnyer-services</artifactId> |
||||
|
<groupId>com.dimensionalnode</groupId> |
||||
|
<version>1.0.0</version> |
||||
|
</parent> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<artifactId>bnyer-order</artifactId> |
||||
|
|
||||
|
<description> |
||||
|
bnyer-order订单服务 |
||||
|
</description> |
||||
|
|
||||
|
<dependencies> |
||||
|
<!-- SpringCloud Alibaba Nacos --> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba.cloud</groupId> |
||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- SpringCloud Alibaba Nacos Config --> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba.cloud</groupId> |
||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- SpringCloud Alibaba Sentinel --> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba.cloud</groupId> |
||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- SpringBoot Actuator --> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-actuator</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- Swagger UI --> |
||||
|
<dependency> |
||||
|
<groupId>io.springfox</groupId> |
||||
|
<artifactId>springfox-swagger-ui</artifactId> |
||||
|
<version>${swagger.fox.version}</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- Mysql Connector --> |
||||
|
<dependency> |
||||
|
<groupId>mysql</groupId> |
||||
|
<artifactId>mysql-connector-java</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- bnyer Common DataSource --> |
||||
|
<dependency> |
||||
|
<groupId>com.dimensionalnode</groupId> |
||||
|
<artifactId>bnyer-common-datasource</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- bnyer Common DataScope --> |
||||
|
<dependency> |
||||
|
<groupId>com.dimensionalnode</groupId> |
||||
|
<artifactId>bnyer-common-datascope</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- bnyer Common Log --> |
||||
|
<dependency> |
||||
|
<groupId>com.dimensionalnode</groupId> |
||||
|
<artifactId>bnyer-common-log</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- bnyer Common core --> |
||||
|
<dependency> |
||||
|
<groupId>com.dimensionalnode</groupId> |
||||
|
<artifactId>bnyer-common-core</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- bnyer Common Swagger --> |
||||
|
<dependency> |
||||
|
<groupId>com.dimensionalnode</groupId> |
||||
|
<artifactId>bnyer-common-swagger</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- mybatis-plus --> |
||||
|
<dependency> |
||||
|
<groupId>com.baomidou</groupId> |
||||
|
<artifactId>mybatis-plus-boot-starter</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!--任务调度中心--> |
||||
|
<!-- <dependency>--> |
||||
|
<!-- <groupId>com.xuxueli</groupId>--> |
||||
|
<!-- <artifactId>xxl-job-core</artifactId>--> |
||||
|
<!-- <version>2.3.1</version>--> |
||||
|
<!-- </dependency>--> |
||||
|
|
||||
|
<!--微信支付工具包--> |
||||
|
<!-- <dependency>--> |
||||
|
<!-- <groupId>com.github.binarywang</groupId>--> |
||||
|
<!-- <artifactId>weixin-java-pay</artifactId>--> |
||||
|
<!-- </dependency>--> |
||||
|
|
||||
|
<!-- 阿里支付工具包--> |
||||
|
<!-- <dependency>--> |
||||
|
<!-- <groupId>com.alipay.sdk</groupId>--> |
||||
|
<!-- <artifactId>alipay-sdk-java</artifactId>--> |
||||
|
<!-- </dependency>--> |
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<finalName>${project.artifactId}</finalName> |
||||
|
<plugins> |
||||
|
<plugin> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
|
<version>2.6.2</version> |
||||
|
<executions> |
||||
|
<execution> |
||||
|
<goals> |
||||
|
<goal>repackage</goal> |
||||
|
</goals> |
||||
|
</execution> |
||||
|
</executions> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
</build> |
||||
|
|
||||
|
|
||||
|
</project> |
||||
@ -0,0 +1,33 @@ |
|||||
|
package com.bnyer.order; |
||||
|
|
||||
|
import com.bnyer.common.security.annotation.EnableCustomConfig; |
||||
|
import com.bnyer.common.security.annotation.EnableRyFeignClients; |
||||
|
import com.bnyer.common.swagger.annotation.EnableCustomSwagger2; |
||||
|
import org.springframework.boot.SpringApplication; |
||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
import org.springframework.scheduling.annotation.EnableAsync; |
||||
|
|
||||
|
/** |
||||
|
* 订单模块 |
||||
|
* |
||||
|
* @author penny |
||||
|
*/ |
||||
|
@EnableCustomConfig |
||||
|
@EnableCustomSwagger2 |
||||
|
@EnableRyFeignClients |
||||
|
@SpringBootApplication |
||||
|
@EnableAsync |
||||
|
public class BnyerOrderApplication |
||||
|
{ |
||||
|
public static void main(String[] args) |
||||
|
{ |
||||
|
SpringApplication.run(BnyerOrderApplication.class, args); |
||||
|
System.out.println("(♥◠‿◠)ノ゙ bnyer订单服务启动成功 ლ(´ڡ`ლ)゙ \n" + |
||||
|
"__________ \n" + |
||||
|
"\\______ \\ ____ ___.__. ___________ \n" + |
||||
|
" | | _// < | |/ __ \\_ __ \\\n" + |
||||
|
" | | \\ | \\___ \\ ___/| | \\/\n" + |
||||
|
" |______ /___| / ____|\\___ >__| \n" + |
||||
|
" \\/ \\/\\/ \\/ \n"); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
package com.bnyer.order.config; |
||||
|
|
||||
|
|
||||
|
import lombok.Getter; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
import org.springframework.cloud.context.config.annotation.RefreshScope; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
|
||||
|
/** |
||||
|
* @author chengkun |
||||
|
* @date 2022/4/21 17:43 |
||||
|
*/ |
||||
|
@Configuration |
||||
|
@ConfigurationProperties(prefix = "alipay") |
||||
|
@Getter |
||||
|
@RefreshScope |
||||
|
public class AlipayConfig { |
||||
|
|
||||
|
@Value("${alipay.gatewayUrl}") |
||||
|
private String gatewayUrl; |
||||
|
|
||||
|
@Value("${alipay.appId}") |
||||
|
private String appId; |
||||
|
|
||||
|
@Value("${alipay.privateKey}") |
||||
|
private String privateKey; |
||||
|
|
||||
|
@Value("${alipay.publicKey}") |
||||
|
private String publicKey; |
||||
|
|
||||
|
@Value("${alipay.certPath}") |
||||
|
private String certPath; |
||||
|
|
||||
|
@Value("${alipay.alipayPublicCertPath}") |
||||
|
private String alipayPublicCertPath; |
||||
|
|
||||
|
@Value("${alipay.rootPath}") |
||||
|
private String rootPath; |
||||
|
|
||||
|
@Value("${alipay.notifyUrl}") |
||||
|
private String notifyUrl; |
||||
|
|
||||
|
@Value("${alipay.returnUrl}") |
||||
|
private String returnUrl; |
||||
|
|
||||
|
@Value("${alipay.signType}") |
||||
|
private String signType; |
||||
|
|
||||
|
@Value("${alipay.charset}") |
||||
|
private String charset; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,4 @@ |
|||||
|
package com.bnyer.order.controller; |
||||
|
|
||||
|
public class testController { |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
package com.bnyer.order.mapper; |
||||
|
|
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
@Mapper |
||||
|
public class TestMapper { |
||||
|
} |
||||
@ -0,0 +1,4 @@ |
|||||
|
package com.bnyer.order.service; |
||||
|
|
||||
|
public interface TestService { |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
package com.bnyer.order.service.impl; |
||||
|
|
||||
|
import com.bnyer.order.service.TestService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
@Service |
||||
|
public class TestServiceImpl implements TestService { |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
spring: |
||||
|
cloud: |
||||
|
nacos: |
||||
|
discovery: |
||||
|
# 服务注册地址 |
||||
|
server-addr: http://117.50.61.7:8848 |
||||
|
# 命名空间地址 |
||||
|
namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0 |
||||
|
# 命名空间分组 |
||||
|
group: dev |
||||
|
config: |
||||
|
# 配置中心地址 |
||||
|
server-addr: http://117.50.61.7:8848 |
||||
|
# 配置文件格式 |
||||
|
file-extension: yml |
||||
|
# 命名空间地址 |
||||
|
namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0 |
||||
|
# 命名空间分组 |
||||
|
group: dev |
||||
|
# 共享配置 |
||||
|
shared-configs: |
||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
||||
@ -0,0 +1,26 @@ |
|||||
|
spring: |
||||
|
cloud: |
||||
|
nacos: |
||||
|
discovery: |
||||
|
# 解决部署在不同服务器访问不到的问题,需暴露外网ip |
||||
|
ip: 81.69.47.31 |
||||
|
# 部署在不同服务器上的指定端口 |
||||
|
port: 9103 |
||||
|
# 服务注册地址 |
||||
|
server-addr: http://175.24.122.142:8848 |
||||
|
# 命名空间地址 |
||||
|
namespace: abfe8ee6-161b-4f8f-b61f-51663bbfa4f9 |
||||
|
# 命名空间分组 |
||||
|
group: grey |
||||
|
config: |
||||
|
# 配置中心地址 |
||||
|
server-addr: http://175.24.122.142:8848 |
||||
|
# 配置文件格式 |
||||
|
file-extension: yml |
||||
|
# 命名空间地址 |
||||
|
namespace: abfe8ee6-161b-4f8f-b61f-51663bbfa4f9 |
||||
|
# 命名空间分组 |
||||
|
group: grey |
||||
|
# 共享配置 |
||||
|
shared-configs: |
||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
||||
@ -0,0 +1,22 @@ |
|||||
|
spring: |
||||
|
cloud: |
||||
|
nacos: |
||||
|
discovery: |
||||
|
# 服务注册地址 |
||||
|
server-addr: http://192.168.3.100:6001 |
||||
|
# 命名空间地址 |
||||
|
namespace: b133c9e5-9f8d-4ed4-9ebd-95557802889f |
||||
|
# 命名空间分组 |
||||
|
group: prod |
||||
|
config: |
||||
|
# 配置中心地址 |
||||
|
server-addr: http://192.168.3.100:6001 |
||||
|
# 配置文件格式 |
||||
|
file-extension: yml |
||||
|
# 命名空间地址 |
||||
|
namespace: b133c9e5-9f8d-4ed4-9ebd-95557802889f |
||||
|
# 命名空间分组 |
||||
|
group: prod |
||||
|
# 共享配置 |
||||
|
shared-configs: |
||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
||||
@ -0,0 +1,22 @@ |
|||||
|
spring: |
||||
|
cloud: |
||||
|
nacos: |
||||
|
discovery: |
||||
|
# 服务注册地址 |
||||
|
server-addr: http://117.50.61.7:8848 |
||||
|
# 命名空间地址 |
||||
|
namespace: 1bf94455-a046-41e3-b7e4-c12fd11c3690 |
||||
|
# 命名空间分组 |
||||
|
group: test |
||||
|
config: |
||||
|
# 配置中心地址 |
||||
|
server-addr: http://117.50.61.7:8848 |
||||
|
# 配置文件格式 |
||||
|
file-extension: yml |
||||
|
# 命名空间地址 |
||||
|
namespace: 1bf94455-a046-41e3-b7e4-c12fd11c3690 |
||||
|
# 命名空间分组 |
||||
|
group: test |
||||
|
# 共享配置 |
||||
|
shared-configs: |
||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
||||
@ -0,0 +1,15 @@ |
|||||
|
# Tomcat |
||||
|
server: |
||||
|
port: 9103 |
||||
|
|
||||
|
# Spring |
||||
|
spring: |
||||
|
main: |
||||
|
#解决循环依赖问题 |
||||
|
allow-circular-references: true |
||||
|
application: |
||||
|
# 应用名称 |
||||
|
name: bnyer-order |
||||
|
profiles: |
||||
|
# 环境配置 |
||||
|
active: dev |
||||
@ -0,0 +1,74 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false"> |
||||
|
<!-- 日志存放路径 --> |
||||
|
<property name="log.path" value="logs/bnyer-order" /> |
||||
|
<!-- 日志输出格式 --> |
||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> |
||||
|
|
||||
|
<!-- 控制台输出 --> |
||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
||||
|
<encoder> |
||||
|
<pattern>${log.pattern}</pattern> |
||||
|
</encoder> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 系统日志输出 --> |
||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<file>${log.path}/info.log</file> |
||||
|
<!-- 循环政策:基于时间创建日志文件 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<!-- 日志文件名格式 --> |
||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern> |
||||
|
<!-- 日志最大的历史 60天 --> |
||||
|
<maxHistory>20</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<encoder> |
||||
|
<pattern>${log.pattern}</pattern> |
||||
|
</encoder> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<!-- 过滤的级别 --> |
||||
|
<level>INFO</level> |
||||
|
<!-- 匹配时的操作:接收(记录) --> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<!-- 不匹配时的操作:拒绝(不记录) --> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<file>${log.path}/error.log</file> |
||||
|
<!-- 循环政策:基于时间创建日志文件 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<!-- 日志文件名格式 --> |
||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern> |
||||
|
<!-- 日志最大的历史 60天 --> |
||||
|
<maxHistory>20</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<encoder> |
||||
|
<pattern>${log.pattern}</pattern> |
||||
|
</encoder> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<!-- 过滤的级别 --> |
||||
|
<level>ERROR</level> |
||||
|
<!-- 匹配时的操作:接收(记录) --> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<!-- 不匹配时的操作:拒绝(不记录) --> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 系统模块日志级别控制 --> |
||||
|
<logger name="com.bnyer" level="info" /> |
||||
|
<!-- Spring日志级别控制 --> |
||||
|
<logger name="org.springframework" level="warn" /> |
||||
|
|
||||
|
<root level="info"> |
||||
|
<appender-ref ref="console" /> |
||||
|
</root> |
||||
|
|
||||
|
<!--系统操作日志--> |
||||
|
<root level="info"> |
||||
|
<appender-ref ref="file_info" /> |
||||
|
<appender-ref ref="file_error" /> |
||||
|
</root> |
||||
|
</configuration> |
||||
Loading…
Reference in new issue