Skip to content

Commit dfbacbc

Browse files
committed
微信支付demo
1 parent d0558d2 commit dfbacbc

60 files changed

Lines changed: 3119 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ java后端项目练手:kissing_closed_eyes:
44
- [x] shiro验证demo
55
- [x] 简单的手写aop
66
- [x] 简单的手写线程池
7+
- [x] 微信支付demo
78

spring-aop-2020/src/main/java/com/example/springaop/service/SpaPrincessA.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ public void aromaOilMassage(String customer) {
2828
}
2929
System.out.println(customer + "享受完精油按摩服务");
3030
}
31+
3132
}

wechat-pay/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# 微信支付Demo
2+
3+
> 来源于尚硅谷教学视频,视频网址https://www.bilibili.com/video/BV1US4y1D77m
4+
5+
## 商户证书
6+
7+
尚硅谷的微信支付证书,如需换成自己的需要自行去微信支付官网申请
8+
9+
## payment-demo
10+
11+
后端项目,sql脚本文件已存在,用IDEA打开运行即可
12+
13+
## payment-demo-front
14+
15+
前端vue项目,需要`npm install`,完成依赖安装后运行`npm run serve`
16+

wechat-pay/payment-demo-front

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 3ab38cc04b88f3c08fafb2d54a8abae22d23844f
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-----BEGIN PRIVATE KEY-----
2+
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDnSAKI8sea8p+d
3+
OBVPWlZmxqJfPbdhzZxdI5Kx1j5SJNZwXWtr43/giw38pwzSlBI+bubBcYlkFTI0
4+
guigMZO/yueb1mZChaY/JG1vsT02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leE2M3qIR1l9LaHaSFhZqH79WmigkIaYJ+V9zwm4hm7
21+
eaun3TsIbXjIHmRGbiLiSIiHEgFl0/x1IHiU2fnXZCFLBNzg06ssAVCCCQECgYA1
22+
4BfxTONkOlxZgAr33BBcySPLWuS0EK0xvjTIVtaBIbWFDJqYEUPyQ/NsFwMa7B6k
23+
bf/HrqW71ZjYz7Np8k/mR5kIJVIsR71Lhw1O6AC4yBW9dDsmEtYkrLkjuWj5cAxP
24+
6PvDaqtf/4tYt5l8D+Ezwem+R7l7RcxfNNIfTf4mJQKBgE57dnRx+Ijx7VHjJvjl
25+
X2jB/VSVGpK5OADykmmZ/wvHPlQcyzd+5kAIoJhSuY48CFeI1DOogR2p01LEFQEL
26+
j4AI5FqOOQwRJvNmfoKcKwO36tSxSEGSM8POKOsa21PG/gvDpJjVFo2hn5QcMHWn
27+
z5SjsgA/1YbXejubdLxT/3pl
28+
-----END PRIVATE KEY-----
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
USE `payment_demo`;
2+
3+
/*Table structure for table `t_order_info` */
4+
5+
CREATE TABLE `t_order_info` (
6+
`id` bigint(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单id',
7+
`title` varchar(256) DEFAULT NULL COMMENT '订单标题',
8+
`order_no` varchar(50) DEFAULT NULL COMMENT '商户订单编号',
9+
`user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
10+
`product_id` bigint(20) DEFAULT NULL COMMENT '支付产品id',
11+
`total_fee` int(11) DEFAULT NULL COMMENT '订单金额(分)',
12+
`code_url` varchar(50) DEFAULT NULL COMMENT '订单二维码连接',
13+
`order_status` varchar(10) DEFAULT NULL COMMENT '订单状态',
14+
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
15+
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
16+
PRIMARY KEY (`id`)
17+
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
18+
19+
20+
/*Table structure for table `t_payment_info` */
21+
22+
CREATE TABLE `t_payment_info` (
23+
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '支付记录id',
24+
`order_no` varchar(50) DEFAULT NULL COMMENT '商户订单编号',
25+
`transaction_id` varchar(50) DEFAULT NULL COMMENT '支付系统交易编号',
26+
`payment_type` varchar(20) DEFAULT NULL COMMENT '支付类型',
27+
`trade_type` varchar(20) DEFAULT NULL COMMENT '交易类型',
28+
`trade_state` varchar(50) DEFAULT NULL COMMENT '交易状态',
29+
`payer_total` int(11) DEFAULT NULL COMMENT '支付金额(分)',
30+
`content` text COMMENT '通知参数',
31+
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
32+
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
33+
PRIMARY KEY (`id`)
34+
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
35+
36+
37+
/*Table structure for table `t_product` */
38+
39+
CREATE TABLE `t_product` (
40+
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '商品id',
41+
`title` varchar(20) DEFAULT NULL COMMENT '商品名称',
42+
`price` int(11) DEFAULT NULL COMMENT '价格(分)',
43+
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
44+
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
45+
PRIMARY KEY (`id`)
46+
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
47+
48+
/*Data for the table `t_product` */
49+
50+
insert into `t_product`(`title`,`price`) values ('Java课程',1);
51+
insert into `t_product`(`title`,`price`) values ('大数据课程',1);
52+
insert into `t_product`(`title`,`price`) values ('前端课程',1);
53+
insert into `t_product`(`title`,`price`) values ('UI课程',1);
54+
55+
/*Table structure for table `t_refund_info` */
56+
57+
CREATE TABLE `t_refund_info` (
58+
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '退款单id',
59+
`order_no` varchar(50) DEFAULT NULL COMMENT '商户订单编号',
60+
`refund_no` varchar(50) DEFAULT NULL COMMENT '商户退款单编号',
61+
`refund_id` varchar(50) DEFAULT NULL COMMENT '支付系统退款单号',
62+
`total_fee` int(11) DEFAULT NULL COMMENT '原订单金额(分)',
63+
`refund` int(11) DEFAULT NULL COMMENT '退款金额(分)',
64+
`reason` varchar(50) DEFAULT NULL COMMENT '退款原因',
65+
`refund_status` varchar(10) DEFAULT NULL COMMENT '退款状态',
66+
`content_return` text COMMENT '申请退款返回参数',
67+
`content_notify` text COMMENT '退款结果通知参数',
68+
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
69+
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
70+
PRIMARY KEY (`id`)
71+
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;

wechat-pay/payment-demo/pom.xml

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.atguigu</groupId>
6+
<artifactId>payment-demo</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<name>payment-demo</name>
9+
<description>Demo project for Spring Boot</description>
10+
11+
<properties>
12+
<java.version>1.8</java.version>
13+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
15+
<spring-boot.version>2.3.7.RELEASE</spring-boot.version>
16+
</properties>
17+
18+
<dependencies>
19+
<!--web-->
20+
<dependency>
21+
<groupId>org.springframework.boot</groupId>
22+
<artifactId>spring-boot-starter-web</artifactId>
23+
</dependency>
24+
25+
<!--Swagger-->
26+
<dependency>
27+
<groupId>io.springfox</groupId>
28+
<artifactId>springfox-swagger2</artifactId>
29+
<version>2.7.0</version>
30+
</dependency>
31+
<!--Swagger ui-->
32+
<dependency>
33+
<groupId>io.springfox</groupId>
34+
<artifactId>springfox-swagger-ui</artifactId>
35+
<version>2.7.0</version>
36+
</dependency>
37+
38+
<!--lombok-->
39+
<dependency>
40+
<groupId>org.projectlombok</groupId>
41+
<artifactId>lombok</artifactId>
42+
</dependency>
43+
44+
<!--mysql 驱动-->
45+
<dependency>
46+
<groupId>mysql</groupId>
47+
<artifactId>mysql-connector-java</artifactId>
48+
</dependency>
49+
50+
<!--MyBatis-Plus:是MyBatis的增强-->
51+
<dependency>
52+
<groupId>com.baomidou</groupId>
53+
<artifactId>mybatis-plus-boot-starter</artifactId>
54+
<version>3.3.1</version>
55+
</dependency>
56+
57+
<!-- 生成自定义配置的元数据信息 -->
58+
<dependency>
59+
<groupId>org.springframework.boot</groupId>
60+
<artifactId>spring-boot-configuration-processor</artifactId>
61+
<optional>true</optional>
62+
</dependency>
63+
64+
<!--微信支付SDK-->
65+
<dependency>
66+
<groupId>com.github.wechatpay-apiv3</groupId>
67+
<artifactId>wechatpay-apache-httpclient</artifactId>
68+
<version>0.3.0</version>
69+
</dependency>
70+
71+
<!--json处理器-->
72+
<dependency>
73+
<groupId>com.google.code.gson</groupId>
74+
<artifactId>gson</artifactId>
75+
</dependency>
76+
77+
<!--微信支付 APIv2 SDK-->
78+
<dependency>
79+
<groupId>com.github.wxpay</groupId>
80+
<artifactId>wxpay-sdk</artifactId>
81+
<version>0.0.3</version>
82+
</dependency>
83+
84+
<dependency>
85+
<groupId>org.springframework.boot</groupId>
86+
<artifactId>spring-boot-starter-test</artifactId>
87+
<scope>test</scope>
88+
<exclusions>
89+
<exclusion>
90+
<groupId>org.junit.vintage</groupId>
91+
<artifactId>junit-vintage-engine</artifactId>
92+
</exclusion>
93+
</exclusions>
94+
</dependency>
95+
</dependencies>
96+
97+
<dependencyManagement>
98+
<dependencies>
99+
<dependency>
100+
<groupId>org.springframework.boot</groupId>
101+
<artifactId>spring-boot-dependencies</artifactId>
102+
<version>${spring-boot.version}</version>
103+
<type>pom</type>
104+
<scope>import</scope>
105+
</dependency>
106+
</dependencies>
107+
</dependencyManagement>
108+
109+
<build>
110+
<!-- 项目打包时会将java目录中的*.xml文件也进行打包 -->
111+
<resources>
112+
<resource>
113+
<directory>src/main/java</directory>
114+
<includes>
115+
<include>**/*.xml</include>
116+
</includes>
117+
<filtering>false</filtering>
118+
</resource>
119+
</resources>
120+
121+
<plugins>
122+
<plugin>
123+
<groupId>org.apache.maven.plugins</groupId>
124+
<artifactId>maven-compiler-plugin</artifactId>
125+
<version>3.8.1</version>
126+
<configuration>
127+
<source>1.8</source>
128+
<target>1.8</target>
129+
<encoding>UTF-8</encoding>
130+
</configuration>
131+
</plugin>
132+
<plugin>
133+
<groupId>org.springframework.boot</groupId>
134+
<artifactId>spring-boot-maven-plugin</artifactId>
135+
<version>2.3.7.RELEASE</version>
136+
<configuration>
137+
<mainClass>com.atguigu.paymentdemo.PaymentDemoApplication</mainClass>
138+
</configuration>
139+
<executions>
140+
<execution>
141+
<id>repackage</id>
142+
<goals>
143+
<goal>repackage</goal>
144+
</goals>
145+
</execution>
146+
</executions>
147+
</plugin>
148+
</plugins>
149+
</build>
150+
151+
</project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.atguigu.paymentdemo;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.scheduling.annotation.EnableScheduling;
6+
7+
@SpringBootApplication
8+
//引入Spring Task
9+
@EnableScheduling
10+
public class PaymentDemoApplication {
11+
12+
public static void main(String[] args) {
13+
SpringApplication.run(PaymentDemoApplication.class, args);
14+
}
15+
16+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.atguigu.paymentdemo.config;
2+
3+
import org.mybatis.spring.annotation.MapperScan;
4+
import org.springframework.context.annotation.Configuration;
5+
import org.springframework.transaction.annotation.EnableTransactionManagement;
6+
7+
@Configuration
8+
@MapperScan("com.atguigu.paymentdemo.mapper")
9+
@EnableTransactionManagement //启用事务管理
10+
public class MyBatisPlusConfig {
11+
12+
13+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.atguigu.paymentdemo.config;
2+
3+
import org.springframework.context.annotation.Bean;
4+
import org.springframework.context.annotation.Configuration;
5+
import springfox.documentation.builders.ApiInfoBuilder;
6+
import springfox.documentation.spi.DocumentationType;
7+
import springfox.documentation.spring.web.plugins.Docket;
8+
import springfox.documentation.swagger2.annotations.EnableSwagger2;
9+
10+
@Configuration
11+
@EnableSwagger2
12+
public class Swagger2Config {
13+
14+
@Bean
15+
public Docket docket(){
16+
17+
return new Docket(DocumentationType.SWAGGER_2)
18+
.apiInfo(new ApiInfoBuilder().title("微信支付案例接口文档").build());
19+
}
20+
}

0 commit comments

Comments
 (0)