fix(): 大量修复项目代码
parent
b84c2c6456
commit
4db9a5732a
|
@ -10,6 +10,7 @@
|
|||
</parent>
|
||||
|
||||
<artifactId>cloud-pay-common</artifactId>
|
||||
|
||||
<version>1.0.0</version>
|
||||
|
||||
<properties>
|
||||
|
@ -19,10 +20,22 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- 公共核心 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- <!– 接口模块 –>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-api-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!– 核心注解依赖 –>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||
</dependency>-->
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,13 +0,0 @@
|
|||
package com.muyu;
|
||||
|
||||
/**
|
||||
* @Classname ${NAME}
|
||||
* @Description TODO
|
||||
* @Date 2024/8/4 上午11:21
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.muyu.pay.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Classname OrderPayCustomer
|
||||
* @Description TODO
|
||||
* @Date 2024/8/8 下午4:05
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "order_pay_customer", autoResultMap = true)
|
||||
public class OrderPayCustomer extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 服务/客户名称
|
||||
*/
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 服务/客户编码
|
||||
*/
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 服务/客户描述
|
||||
*/
|
||||
private String appDesc;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package com.muyu.pay.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.enums.SysPayType;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.pay.domain.resp.CustomerOrderPaySimpleResp;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Classname OrderPayInfo
|
||||
* @Description TODO
|
||||
* @Date 2024/8/8 下午4:08
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "order_pay_info", autoResultMap = true)
|
||||
public class OrderPayInfo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 客户编号
|
||||
*/
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 客户单号
|
||||
*/
|
||||
private String cusOrderNumber;
|
||||
|
||||
/**
|
||||
* 支付单号
|
||||
*/
|
||||
private String payOrderNumber;
|
||||
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 渠道商类型
|
||||
*/
|
||||
private String channelType;
|
||||
|
||||
/**
|
||||
* 渠道商单号
|
||||
*/
|
||||
private String channelOrderNumber;
|
||||
|
||||
/**
|
||||
* 支付单状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
public CustomerOrderPaySimpleResp buildCustomerOrderPaySimpleResp() {
|
||||
return CustomerOrderPaySimpleResp.builder()
|
||||
.cusOrderNumber(this.cusOrderNumber)
|
||||
.channelTypeName(SysPayType.getInfoByCode(this.channelType))
|
||||
.price(this.price)
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.muyu.pay.domain.req;
|
||||
|
||||
import com.muyu.common.core.validation.custom.IsSystemYesNo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Classname OrderPayCustomer
|
||||
* @Description TODO
|
||||
* @Date 2024/8/8 下午4:17
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
@Tag(name = "客户列表请求对象")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CustomerListReq {
|
||||
|
||||
/**
|
||||
* 服务/客户名称
|
||||
*/
|
||||
@Schema(type = "String", defaultValue = "客户名称1", description = "客户名称,为微服务中文名称")
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 服务/客户编码
|
||||
*/
|
||||
@Schema(defaultValue = "customer_code", type = "String", description = "客户名称,为微服务名称")
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 状态 - sys_yes_no
|
||||
*/
|
||||
@Schema(type = "String", defaultValue = "Y", description = "客户状态,Y是开启,N关闭")
|
||||
@IsSystemYesNo
|
||||
private String status;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.muyu.pay.domain.resp;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: zi run
|
||||
* @Date 2024/8/5 1:07
|
||||
* @Description 客户支付单简略返回实体
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "客户支付单", description = "客户支付单简略信息")
|
||||
public class CustomerOrderPaySimpleResp {
|
||||
|
||||
/**
|
||||
* 客户单号
|
||||
*/
|
||||
@Schema(name = "客户单号", type = "String", defaultValue = "ORDER1A2B3C4D5E6F", description = "客户传入的支付信息")
|
||||
private String cusOrderNumber;
|
||||
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
@Schema(name = "支付金额", type = "BigDecimal", defaultValue = "27.56", description = "客户传入的支付金额")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 渠道商类型
|
||||
*/
|
||||
@Schema(name = "支付渠道商", type = "String", defaultValue = "支付宝", description = "用户支付的时候选择的渠道商")
|
||||
private String channelTypeName;
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.muyu.pay.domain.resp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.pay.domain.OrderPayCustomer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @Author: zi run
|
||||
* @Date 2024/8/4 16:27
|
||||
* @Description 客户集合返回值
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Tag(name = "客户信息响应对象", description = "负责客户信息查询的响应结果")
|
||||
public class CustomerResp {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "客户ID", defaultValue = "1", type = "Long")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 服务/客户名称
|
||||
*/
|
||||
@Schema(description = "客户名称", defaultValue = "商品服务", type = "String")
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 服务/客户编码
|
||||
*/
|
||||
@Schema(description = "客户编码", defaultValue = "cloud_order", type = "String")
|
||||
private String appCode;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Schema(description = "客户状态,同数据字典-系统是否", defaultValue = "Y", type = "String")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "创建人", defaultValue = "muyu", type = "String")
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建时间", defaultValue = "2024-08-04 19:11:14", type = "Date")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 客户最近5条支付单
|
||||
*/
|
||||
private List<CustomerOrderPaySimpleResp> orderPaySimpleRespList;
|
||||
|
||||
/**
|
||||
* 数据库对象构建为返回结果对象
|
||||
* @param orderPayCustomer 数据对象
|
||||
* @return 视图对象
|
||||
*/
|
||||
public static CustomerResp customerBuild(OrderPayCustomer orderPayCustomer, Supplier<List<CustomerOrderPaySimpleResp>> function) {
|
||||
return CustomerResp.builder()
|
||||
.id(orderPayCustomer.getId())
|
||||
.appName(orderPayCustomer.getAppName())
|
||||
.appCode(orderPayCustomer.getAppCode())
|
||||
.status(orderPayCustomer.getStatus())
|
||||
.createBy(orderPayCustomer.getCreateBy())
|
||||
.createTime(orderPayCustomer.getCreateTime())
|
||||
.orderPaySimpleRespList(function.get())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,53 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9701
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 114.55.172.217:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: muyu-cloud
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
application:
|
||||
# 应用名称
|
||||
name: cloud-pay
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos.addr}
|
||||
# nacos用户名
|
||||
username: ${nacos.user-name}
|
||||
# nacos密码
|
||||
password: ${nacos.password}
|
||||
# 命名空间
|
||||
namespace: ${nacos.namespace}
|
||||
config:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos.addr}
|
||||
# nacos用户名
|
||||
username: ${nacos.user-name}
|
||||
# nacos密码
|
||||
password: ${nacos.password}
|
||||
# 命名空间
|
||||
namespace: ${nacos.namespace}
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
# 系统共享配置
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# 系统环境Config共享配置
|
||||
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# xxl-job 配置文件
|
||||
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# rabbit 配置文件
|
||||
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
@ -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/cloud-pay"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<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>60</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>60</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.muyu" 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>
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/cloud-pay"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.sky.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>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<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>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<Pattern>${log.sky.pattern}</Pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="GRPC_LOG"/>
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/cloud-test"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.sky.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>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<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>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<Pattern>${log.sky.pattern}</Pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="GRPC_LOG"/>
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-pay</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.1</version>
|
||||
</parent>
|
||||
|
||||
|
||||
|
@ -87,6 +87,16 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-rabbit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-pay-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Nacos公共远程依赖-->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-nacos-remote</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
package com.muyu.cloud.pay.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @Classname TestController
|
||||
* @Description TODO
|
||||
* @Date 2024/8/5 下午8:37
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
@RequestMapping("/test")
|
||||
@RestController
|
||||
public class TestController {
|
||||
@PostMapping
|
||||
public Result<String> post(){
|
||||
return Result.success("测试Post成功");
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public Result<String> get(){
|
||||
return Result.success("测试Get成功");
|
||||
}
|
||||
}
|
|
@ -1,22 +1,24 @@
|
|||
package com.muyu.cloud.pay;
|
||||
package com.muyu.pay;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
/**
|
||||
* @Classname MuYuPayApplication
|
||||
* @Classname CloudPayApplication
|
||||
* @Description TODO
|
||||
* @Date 2024/8/5 下午8:33
|
||||
* @Date 2024/8/8 下午1:11
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
@Log4j2
|
||||
@EnableCustomConfig
|
||||
//@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MuYuPayApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(MuYuPayApplication.class, args);
|
||||
public class CloudPayApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CloudPayApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.muyu.pay;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.boot.ConfigurableBootstrapContext;
|
||||
import org.springframework.boot.SpringApplicationRunListener;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import java.time.Duration;
|
||||
|
||||
|
||||
/**
|
||||
* @Classname MySpringApplicationRunListener
|
||||
* @Description TODO
|
||||
* @Date 2024/8/8 下午2:02
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
@Log4j2
|
||||
public class MySpringApplicationRunListener implements SpringApplicationRunListener {
|
||||
|
||||
public MySpringApplicationRunListener() {
|
||||
log.info("MySpringApplicationRunListener");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void starting(ConfigurableBootstrapContext bootstrapContext) {
|
||||
log.info("执行:{}", "starting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void environmentPrepared(ConfigurableBootstrapContext bootstrapContext, ConfigurableEnvironment environment) {
|
||||
log.info("执行:{}", "environmentPrepared");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contextPrepared(ConfigurableApplicationContext context) {
|
||||
log.info("执行:{}", "contextPrepared");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contextLoaded(ConfigurableApplicationContext context) {
|
||||
log.info("执行:{}", "contextLoaded");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void started(ConfigurableApplicationContext context, Duration timeTaken) {
|
||||
log.info("执行:{}", "started");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ready(ConfigurableApplicationContext context, Duration timeTaken) {
|
||||
log.info("执行:{}", "ready");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(ConfigurableApplicationContext context, Throwable exception) {
|
||||
log.info("执行:{}", "failed");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.muyu.pay.controller;
|
||||
|
||||
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.pay.domain.resp.CustomerResp;
|
||||
import com.muyu.pay.service.OrderPayCustomerService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Classname OrderPayCustomerController
|
||||
* @Description TODO
|
||||
* @Date 2024/8/8 下午8:00
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/customer")
|
||||
@Tag(name = "客户控制层", description = "进行客户管理、查看等相关操作")
|
||||
public class OrderPayCustomerController {
|
||||
|
||||
public OrderPayCustomerController() {
|
||||
log.info("forest扫描路径:{}", ForestScannerRegister.getBasePackages());
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户业务层
|
||||
*/
|
||||
@Autowired
|
||||
private OrderPayCustomerService orderPayCustomerService;
|
||||
|
||||
/**
|
||||
* 查询所有的客户
|
||||
* @param customerListReq 客户列表请求参数
|
||||
* @return 客户列表
|
||||
*/
|
||||
@RequestMapping(path = "/list", method = RequestMethod.POST)
|
||||
@Operation(summary = "查看客户", description = "根据客户的名称、编码、是否开启等可以进行客户的筛选")
|
||||
public Result<List<CustomerResp>> selectList(
|
||||
@Validated @RequestBody CustomerListReq customerListReq) {
|
||||
return Result.success(
|
||||
orderPayCustomerService.selectList(customerListReq)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有客户的列表
|
||||
* @return 客户集合
|
||||
*/
|
||||
@GetMapping("/all")
|
||||
@Operation(summary = "获取未接入的客户", description = "调用nacosAPI获取所有的微服务名称,作为支付中台的客户")
|
||||
@Schema(description = "获取未接入的客户", defaultValue = "[\"客户1\", \"客户2\"]", type = "List")
|
||||
public Result<List<String>> getCustomerAllList() {
|
||||
return Result.success(
|
||||
orderPayCustomerService.getCustomerAllList()
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.pay.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.pay.domain.OrderPayCustomer;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Classname OrderPayCustomerMapper
|
||||
* @Description TODO
|
||||
* @Date 2024/8/8 下午8:06
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderPayCustomerMapper extends BaseMapper<OrderPayCustomer> {
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.pay.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.pay.domain.OrderPayInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Classname OrderPayMapper
|
||||
* @Description TODO
|
||||
* @Date 2024/8/8 下午8:17
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderPayMapper extends BaseMapper<OrderPayInfo> {
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.muyu.pay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.pay.domain.resp.CustomerResp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Classname OrderPayCustomerService
|
||||
* @Description TODO
|
||||
* @Date 2024/8/8 下午9:09
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
||||
|
||||
/**
|
||||
* 查询客户集合
|
||||
* @param customerListReq 请求参数
|
||||
* @return 客户集合
|
||||
*/
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq);
|
||||
|
||||
/**
|
||||
* 获取所有的客户
|
||||
* @return 客户集合
|
||||
*/
|
||||
List<String> getCustomerAllList();
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.pay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.pay.domain.OrderPayInfo;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Classname OrderPayService
|
||||
* @Description TODO
|
||||
* @Date 2024/8/8 下午9:20
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
public interface OrderPayService extends IService<OrderPayInfo> {
|
||||
|
||||
/**
|
||||
* 根据客户code和分页限制查询结果
|
||||
* @param appCode 客户code
|
||||
* @param limit 分页限制
|
||||
* @return 支付订单记录
|
||||
*/
|
||||
List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int limit);
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.muyu.pay.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.nacos.service.NacosServerService;
|
||||
import com.muyu.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.pay.domain.OrderPayInfo;
|
||||
import com.muyu.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.pay.domain.resp.CustomerResp;
|
||||
import com.muyu.pay.mapper.OrderPayCustomerMapper;
|
||||
import com.muyu.pay.service.OrderPayCustomerService;
|
||||
import com.muyu.pay.service.OrderPayService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Classname OrderPayCustomerServiceImpl
|
||||
* @Description TODO
|
||||
* @Date 2024/8/9 上午9:09
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
@Log4j2
|
||||
@Service
|
||||
public class OrderPayCustomerServiceImpl
|
||||
extends ServiceImpl<OrderPayCustomerMapper, OrderPayCustomer>
|
||||
implements OrderPayCustomerService {
|
||||
|
||||
@Autowired
|
||||
private OrderPayService orderPayService;
|
||||
|
||||
@Autowired
|
||||
private NacosServerService nacosServerService;
|
||||
|
||||
/**
|
||||
* 查询客户集合
|
||||
* @param customerListReq 请求参数
|
||||
* @return 客户集合
|
||||
*/
|
||||
@Override
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq) {
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(
|
||||
StringUtils.isEmpty(customerListReq.getAppName()),
|
||||
OrderPayCustomer::getAppName, customerListReq.getAppName()
|
||||
);
|
||||
queryWrapper.like(
|
||||
StringUtils.isEmpty(customerListReq.getAppCode()),
|
||||
OrderPayCustomer::getAppCode, customerListReq.getAppCode()
|
||||
);
|
||||
queryWrapper.eq(
|
||||
StringUtils.isEmpty(customerListReq.getStatus()),
|
||||
OrderPayCustomer::getStatus, customerListReq.getStatus()
|
||||
);
|
||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||
return orderPayCustomerList.stream()
|
||||
.map(orderPayCustomer -> CustomerResp.customerBuild(
|
||||
orderPayCustomer,
|
||||
() -> orderPayService.selectOrderPayByAppCodeAndLimit(orderPayCustomer.getAppCode(), 5)
|
||||
.stream()
|
||||
.map(OrderPayInfo::buildCustomerOrderPaySimpleResp)
|
||||
.toList()
|
||||
)
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的客户
|
||||
* @return 客户集合
|
||||
*/
|
||||
@Override
|
||||
public List<String> getCustomerAllList() {
|
||||
List<String> nacosServerAllList = nacosServerService.nacosServerAllList();
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(OrderPayCustomer::getAppCode);
|
||||
List<OrderPayCustomer> orderPayCustomerList = this.list(queryWrapper);
|
||||
Set<String> customerSet
|
||||
= orderPayCustomerList.stream().map(OrderPayCustomer::getAppCode).collect(Collectors.toSet());
|
||||
|
||||
return nacosServerAllList.stream()
|
||||
.filter(nacosServer -> ! customerSet.contains(nacosServer))
|
||||
.toList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.pay.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.pay.domain.OrderPayInfo;
|
||||
import com.muyu.pay.mapper.OrderPayMapper;
|
||||
import com.muyu.pay.service.OrderPayService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Classname OrderPayServiceImpl
|
||||
* @Description TODO
|
||||
* @Date 2024/8/9 下午9:09
|
||||
* @Created by 杨旭飞
|
||||
*/
|
||||
@Service
|
||||
public class OrderPayServiceImpl extends ServiceImpl<OrderPayMapper, OrderPayInfo> implements OrderPayService {
|
||||
|
||||
/**
|
||||
* 根据客户code和分页限制查询结果
|
||||
* @param appCode 客户code
|
||||
* @param limit 分页限制
|
||||
* @return 支付订单记录
|
||||
*/
|
||||
@Override
|
||||
public List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int limit) {
|
||||
LambdaQueryWrapper<OrderPayInfo> orderPayInfoQueryWrapper = new LambdaQueryWrapper<>();
|
||||
orderPayInfoQueryWrapper.eq(OrderPayInfo::getAppCode, appCode);
|
||||
orderPayInfoQueryWrapper.orderBy(true, false, OrderPayInfo::getCreateTime);
|
||||
orderPayInfoQueryWrapper.last("limit " + limit);
|
||||
List<OrderPayInfo> orderPayInfoList = this.list(orderPayInfoQueryWrapper);
|
||||
return this.list(orderPayInfoQueryWrapper);
|
||||
}
|
||||
}
|
|
@ -4,10 +4,10 @@ server:
|
|||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 10.28.29.211:8848
|
||||
addr: 114.55.172.217:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: cloud
|
||||
namespace: muyu-cloud
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
@ -51,4 +51,3 @@ spring:
|
|||
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# rabbit 配置文件
|
||||
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
|
||||
|
|
7
pom.xml
7
pom.xml
|
@ -13,11 +13,12 @@
|
|||
<artifactId>cloud-pay</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>cloud-pay-client</module>
|
||||
<module>cloud-pay-common</module>
|
||||
<module>cloud-pay-remote</module>
|
||||
<module>cloud-pay-server</module>
|
||||
<module>cloud-pay-client</module>
|
||||
<module>cloud-pay-remote</module>
|
||||
<module>cloud-pay-common</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
Loading…
Reference in New Issue