dev-v2 #3

Merged
bunny merged 122 commits from dev-v2 into master-v2 2024-03-30 23:40:58 +08:00
19 changed files with 325 additions and 2 deletions
Showing only changes of commit 90d6f3200d - Show all commits

View File

@ -13,6 +13,7 @@
<module name="service-user-client" /> <module name="service-user-client" />
<module name="common-log" /> <module name="common-log" />
<module name="service-order" /> <module name="service-order" />
<module name="service-pay" />
<module name="spzx-model" /> <module name="spzx-model" />
<module name="spzx-server-gateway" /> <module name="spzx-server-gateway" />
<module name="service-product" /> <module name="service-product" />
@ -35,6 +36,7 @@
<module name="service-cart" options="-parameters" /> <module name="service-cart" options="-parameters" />
<module name="service-cart-client" options="-parameters" /> <module name="service-cart-client" options="-parameters" />
<module name="service-order" options="-parameters" /> <module name="service-order" options="-parameters" />
<module name="service-pay" options="-parameters" />
<module name="service-product" options="-parameters" /> <module name="service-product" options="-parameters" />
<module name="service-product-client" options="-parameters" /> <module name="service-product-client" options="-parameters" />
<module name="service-user" options="-parameters" /> <module name="service-user" options="-parameters" />

View File

@ -18,6 +18,7 @@
<file url="file://$PROJECT_DIR$/spzx-service-client/untitled/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/spzx-service-client/untitled/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-service/service-cart/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/spzx-service/service-cart/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-service/service-order/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/spzx-service/service-order/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-service/service-pay/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-service/service-product/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/spzx-service/service-product/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-service/service-user/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/spzx-service/service-user/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/spzx-service/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/spzx-service/src/main/java" charset="UTF-8" />

View File

@ -51,6 +51,10 @@ spring:
uri: lb://service-order uri: lb://service-order
predicates: predicates:
- Path=/*/order/*/** - Path=/*/order/*/**
- id: service-pay
uri: lb://service-pay
predicates:
- Path=/*/*/alipay/**
data: data:
redis: redis:
host: ${bunny.redis.host} host: ${bunny.redis.host}

View File

@ -16,6 +16,7 @@
<module>service-user</module> <module>service-user</module>
<module>service-order</module> <module>service-order</module>
<module>service-cart</module> <module>service-cart</module>
<module>service-pay</module>
</modules> </modules>
<properties> <properties>

View File

@ -41,7 +41,7 @@ logging:
mybatis: mybatis:
type-aliases-package: com.atguigu.spzx.model type-aliases-package: com.atguigu.spzx.model
mapper-locations: classpath:/mapper/*/*.xml mapper-locations: classpath:/mapper/*.xml
configuration: configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true map-underscore-to-camel-case: true

View File

@ -0,0 +1,26 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.atguigu</groupId>
<artifactId>spzx-service</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>service-pay</artifactId>
<packaging>jar</packaging>
<name>service-pay</name>
<url>https://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.alipay.sdk</groupId>
<artifactId>alipay-sdk-java</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,16 @@
package com.atguigu.pay;
import com.atguigu.pay.properties.AlipayProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@SpringBootApplication
@EnableConfigurationProperties(value = {AlipayProperties.class})
@Slf4j
public class PayApplication {
public static void main(String[] args) {
SpringApplication.run(PayApplication.class, args);
}
}

View File

@ -0,0 +1,25 @@
package com.atguigu.pay.configuration;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.atguigu.pay.properties.AlipayProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class AlipayConfiguration {
@Autowired
private AlipayProperties alipayProperties;
@Bean
public AlipayClient alipayClient() {
return new DefaultAlipayClient(alipayProperties.getAlipayUrl(),
alipayProperties.getAppId(),
alipayProperties.getAppPrivateKey(),
AlipayProperties.format,
AlipayProperties.charset,
alipayProperties.getAlipayPublicKey(),
AlipayProperties.sign_type);
}
}

View File

@ -0,0 +1,25 @@
package com.atguigu.pay.controller;
import com.atguigu.pay.service.AlipayService;
import com.atguigu.spzx.model.vo.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@Tag(name = "支付宝接口")
@RequestMapping("/api/order/alipay")
public class AlipayController {
@Autowired
private AlipayService alipayService;
@Operation(summary = "支付宝下单")
@GetMapping("submitAlipay/{orderNo}")
@ResponseBody
public Result<String> submitAlipay(@Parameter(name = "orderNo", description = "订单号", required = true) @PathVariable(value = "orderNo") String orderNo) {
String form = alipayService.submitAlipay(orderNo);
return Result.success(form);
}
}

View File

@ -0,0 +1,7 @@
package com.atguigu.pay.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PaymentInfoMapper {
}

View File

@ -0,0 +1,20 @@
package com.atguigu.pay.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Data
@Configuration
@ConfigurationProperties(prefix = "alipay")
public class AlipayProperties {
public final static String format = "json";
public final static String charset = "utf-8";
public final static String sign_type = "RSA2";
public String alipayPublicKey;
public String returnPaymentUrl;
public String notifyPaymentUrl;
private String alipayUrl;
private String appPrivateKey;
private String appId;
}

View File

@ -0,0 +1,11 @@
package com.atguigu.pay.service;
public interface AlipayService {
/**
* 提交支付
*
* @param orderNo 订单提交
* @return 支付表单
*/
String submitAlipay(String orderNo);
}

View File

@ -0,0 +1,4 @@
package com.atguigu.pay.service;
public interface PaymentInfoService {
}

View File

@ -0,0 +1,33 @@
package com.atguigu.pay.service.impl;
import com.alipay.api.AlipayClient;
import com.atguigu.pay.properties.AlipayProperties;
import com.atguigu.pay.service.AlipayService;
import com.atguigu.pay.service.PaymentInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class AlipayServiceImpl implements AlipayService {
@Autowired
private AlipayClient alipayClient;
@Autowired
private PaymentInfoService paymentInfoService;
@Autowired
private AlipayProperties alipayProperties;
/**
* 提交支付
*
* @param orderNo 订单提交
* @return 支付表单
*/
@Override
public String submitAlipay(String orderNo) {
return null;
}
}

View File

@ -0,0 +1,8 @@
package com.atguigu.pay.service.impl;
import com.atguigu.pay.service.PaymentInfoService;
import org.springframework.stereotype.Service;
@Service
public class PaymentInfoServiceImpl implements PaymentInfoService {
}

View File

@ -0,0 +1,26 @@
bunny:
nacos:
server-addr: z-bunny.cn:8848
discovery:
namespace: spzx
datasource:
host: 106.15.251.123
port: 3305
sqlData: db_spzx
username: root
password: "02120212"
redis:
host: 47.120.65.66
port: 6379
database: 2
password: "02120212"
alipay:
alipay_url: https://openapi.alipaydev.com/gateway.do
app_id: 2021000122609658
app_private_key: MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCXHXwKl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1BN27xa4sTqrLT0/OaxV5mI7RMC/itGMkAet4jxqDT8GUYU3Sy8faWdJ2yhZPrGA7faIyrk9w9mQClMupHLqBmCyVj2LNPkEol7JG4t5s0baPyuztq38UNCt1xWEky61ZZQOw+dlAoGAQdEhD0bEwlpCPZhQBn8jRlWaOun94jJjfreQRJgDiAXkYcu9aXnrHIPogrUOZJ3DXcSyBv2/FU5HlbVT6/nl/cLMqNUWj2O7grb5jyzmvJJnzXLaxK7bWjZQt/ssNt4mYFJNNG2cMgofzDsW0lYhMdh+CCy5Wv9nl3e3IUtNq/8CgYASPcPdaCBLzCSGlTV9HMhQwRhOpWLOzQNKprebQf0fubNFGd6+yfM6DdejHXf6KH4IgV9l8OPe5ro85tmrBkvMlbh7KHbpYJ/V9cdMKd+kbxoJTkRKCnoZhY5QSuEMoC8OB1qhzJeuoqUvmpi0q569IBXrxZguD29ZqwGxoa1KNg==
alipay_public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk41ooyX7utKM9B7jNcc4EzmyVU0Qfs18KFVFwyhl7YQMw/PB2YVQreVSvvb1rS/2YVxcjLK/9ehD//79b8aoxhFlEGqA7fGu0C2UR6pl+PhmRLcHeyN+DOG87Fhqb1t4JXmXQc1LXUfelJoh+r5XnMPWDAlY5JJtH3GZIU+AoBt9PuEtfhh03LL6WtnJMwOnqH94T8qHymLDftEGOWme1iAlenB692cUId20BmLJal621EAN+xpmkeJZEpx1wQ2fGhyTo7pm4v8LVLuqzOXkraffITvfbPl5IU0kjjs/QECwItAI0IBbNsDutezw/a0JobijjoF28uo4gtwmncBoQwIDAQAB
return_payment_url: http://192.168.136.142/#/pages/money/paySuccess
notify_payment_url: http://127.0.0.1:8500/api/order/alipay/callback/notify

View File

@ -0,0 +1,57 @@
server:
port: 8514
spring:
profiles:
active: dev
application:
name: service-pay
cloud:
sentinel:
log:
dir: logs/${spring.application.name}/sentinel
nacos:
discovery:
namespace: ${bunny.nacos.discovery.namespace}
server-addr: ${bunny.nacos.server-addr}
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
username: ${bunny.datasource.username}
password: "${bunny.datasource.password}"
data:
redis:
host: ${bunny.redis.host}
port: ${bunny.redis.port}
database: ${bunny.redis.database}
password: ${bunny.redis.password}
mybatis:
type-aliases-package: com.atguigu.spzx.model
mapper-locations: classpath:/mapper/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
auto-mapping-behavior: full
logging:
level:
com.atguigu.spzx.order.mapper: debug
com.atguigu.spzx.order.controller: info
com.atguigu.spzx.order.service: info
pattern:
dateformat: HH:mm:ss:SSS
file:
path: "logs/${spring.application.name}"
alipay:
alipay_url: ${bunny.alipay.alipay_url}
app_id: ${bunny.alipay.app_id}
app_private_key: ${bunny.alipay.app_private_key}
alipay_public_key: ${bunny.alipay.alipay_public_key}
return_payment_url: ${bunny.alipay.return_payment_url}
notify_payment_url: ${bunny.alipay.notify_payment_url}

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<contextName>logback</contextName>
<!-- 日志的输出目录 -->
<property name="log.path" value="logs//service-pay//logs"/>
<!--控制台日志格式:彩色日志-->
<!-- magenta:洋红 -->
<!-- boldMagenta:粗红-->
<!-- cyan:青色 -->
<!-- white:白色 -->
<!-- magenta:洋红 -->
<property name="CONSOLE_LOG_PATTERN"
value="%yellow(%date{yyyy-MM-dd HH:mm:ss}) %highlight([%-5level]) %green(%logger) %msg%n"/>
<!--文件日志格式-->
<property name="FILE_LOG_PATTERN" value="%date{yyyy-MM-dd HH:mm:ss} [%-5level] %thread %file:%line %logger %msg%n"/>
<!--编码-->
<property name="ENCODING" value="UTF-8"/>
<!-- 控制台日志 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!-- 临界值过滤器 -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>${ENCODING}</charset>
</encoder>
</appender>
<!-- 文件日志 -->
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${log.path}//log.log</file>
<append>true</append>
<encoder>
<pattern>%date{yyyy-MM-dd HH:mm:ss} %msg%n</pattern>
<charset>${ENCODING}</charset>
</encoder>
</appender>
<!-- 开发环境 -->
<springProfile name="dev">
<!-- com.atguigu日志记录器业务程序INFO级别 -->
<logger name="com.atguigu" level="INFO"/>
<!-- 根日志记录器INFO级别 -->
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
</springProfile>
</configuration>

View File

@ -43,7 +43,7 @@ logging:
mybatis: mybatis:
type-aliases-package: com.atguigu.spzx.model type-aliases-package: com.atguigu.spzx.model
mapper-locations: classpath:/mapper/*/*.xml mapper-locations: classpath:/mapper/*.xml
configuration: configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true map-underscore-to-camel-case: true