初始化
parent
0263e0a060
commit
07d610f581
|
@ -1,39 +1,46 @@
|
|||
package pay.domain;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @ClassName Rule
|
||||
* @Description 描述
|
||||
* @Description 规则表
|
||||
* @Author Chen
|
||||
* @Date 2024/8/20 11:40
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "规则")
|
||||
public class Rule extends BaseEntity {
|
||||
/**
|
||||
* 规则ID
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 规则名称
|
||||
*/
|
||||
|
||||
private String name;
|
||||
/**
|
||||
* 规则类型
|
||||
*/
|
||||
|
||||
private String ruleType;
|
||||
/**
|
||||
* 是否激活
|
||||
*/
|
||||
|
||||
private String isActivate;
|
||||
/**
|
||||
* 规则描述
|
||||
*/
|
||||
|
||||
private String ruleDesc;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,150 +0,0 @@
|
|||
package com.muyu.pay.controller;
|
||||
|
||||
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.req.OrderCustomerAddReq;
|
||||
import com.muyu.cloud.pay.domain.req.OrderCustomerUpdReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
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.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 支付客户控制层
|
||||
* @Author Chen
|
||||
* @Date 2024/8/5 21:22
|
||||
*/
|
||||
@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()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加客户
|
||||
*
|
||||
* @param orderCustomerAddReq 客户信息
|
||||
* @return 添加结果
|
||||
*/
|
||||
@PostMapping
|
||||
@Operation(summary = "客户信息添加", description = "添加支付平台客户信息,添加成功才可以使用支付类的产品")
|
||||
public Result<String> save(@Validated @RequestBody OrderCustomerAddReq orderCustomerAddReq) {
|
||||
orderPayCustomerService.save(OrderPayCustomer.addBuild(orderCustomerAddReq));
|
||||
return Result.success(null, "操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户
|
||||
*
|
||||
* @param orderCustomerUpdReq 修改客户请求信息
|
||||
* @return 修改结果
|
||||
*/
|
||||
@PutMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "客户信息修改", description = "通过ID修改客户信息")
|
||||
public Result<String> update(
|
||||
@Schema(title = "客户ID", type = "Long", defaultValue = "1", description = "修改客户信息需要依据的唯一条件")
|
||||
@PathVariable("orderCustomerId") Long orderCustomerId,
|
||||
@RequestBody @Validated OrderCustomerUpdReq orderCustomerUpdReq) {
|
||||
orderPayCustomerService.updateById(OrderPayCustomer.updBuild(orderCustomerUpdReq, () -> orderCustomerId));
|
||||
return Result.success(null, "操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户
|
||||
*
|
||||
* @param orderCustomerId 删除客户请求信息
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "客户信息删除", description = "通过ID删除客户信息")
|
||||
public Result<String> delete(@PathVariable("orderCustomerId") Long orderCustomerId) {
|
||||
orderPayCustomerService.removeById(orderCustomerId);
|
||||
return Result.success(null, "操作成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过ID获取客户
|
||||
*
|
||||
* @param orderCustomerId ID
|
||||
* @return 客户信息
|
||||
*/
|
||||
@GetMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "通过ID获取客户信息", description = "通过ID获取客户信息")
|
||||
public Result<OrderPayCustomer> findById(@PathVariable("orderCustomerId") Long orderCustomerId) {
|
||||
return Result.success(orderPayCustomerService.getById(orderCustomerId), "操作成功");
|
||||
}
|
||||
/**
|
||||
* 通过ID禁用客户
|
||||
*
|
||||
* @param orderCustomerId ID
|
||||
* @return 客户信息
|
||||
*/
|
||||
@GetMapping("/disable/{orderCustomerId}")
|
||||
@Operation(summary = "通过ID禁用", description = "通过ID禁用客户,禁用之后禁止调用支付相关接口")
|
||||
public Result<String> disable(@PathVariable("orderCustomerId") Long orderCustomerId) {
|
||||
this.orderPayCustomerService.disable(orderCustomerId);
|
||||
return Result.success(null, "操作成功");
|
||||
}
|
||||
/**
|
||||
* 通过ID启用客户
|
||||
*
|
||||
* @param orderCustomerId ID
|
||||
* @return 客户信息
|
||||
*/
|
||||
@GetMapping("/enable/{orderCustomerId}")
|
||||
@Operation(summary = "通过ID启用客户", description = "通过ID启用客户,启用之后禁止调用支付相关接口")
|
||||
public Result<String> enable(@PathVariable("orderCustomerId") Long orderCustomerId) {
|
||||
this.orderPayCustomerService.enable(orderCustomerId);
|
||||
return Result.success(null, "操作成功");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.pay.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @ClassName RuleController
|
||||
* @Description 规则控制层
|
||||
* @Author Chen
|
||||
* @Date 2024/8/20 14:22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rule")
|
||||
public class RuleController {
|
||||
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package com.muyu.pay.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @ClassName OrderPayCustomerMapper
|
||||
* @Description 支付服务/客户持久层
|
||||
* @Author Chen
|
||||
* @Date 2024/8/5 21:12
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderPayCustomerMapper extends BaseMapper<OrderPayCustomer> {
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package com.muyu.pay.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
/**
|
||||
* @ClassName OrderPayCustomerMapper
|
||||
* @Description 订单支付持久层
|
||||
* @Author Chen
|
||||
* @Date 2024/8/5 21:12
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderPayMapper extends BaseMapper<OrderPayInfo> {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.pay.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface RuleMapper {
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package com.muyu.pay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName OrderPayCustomerService
|
||||
* @Description 支付客户业务层
|
||||
* @Author Chen
|
||||
* @Date 2024/7/29 20:30
|
||||
*/
|
||||
public interface OrderPayCustomerService extends IService<OrderPayCustomer> {
|
||||
/**
|
||||
* 查询客户集合
|
||||
*
|
||||
* @param customerListReq
|
||||
* @return客户集合
|
||||
*/
|
||||
public List<CustomerResp> selectList(CustomerListReq customerListReq);
|
||||
|
||||
/**
|
||||
* 获取所有的客户
|
||||
*
|
||||
* @return 客户集合
|
||||
*/
|
||||
List<String> getCustomerAllList();
|
||||
|
||||
/**
|
||||
* 禁用客户
|
||||
*
|
||||
* @param orderCustomerId 客户ID
|
||||
*/
|
||||
void disable(Long orderCustomerId);
|
||||
|
||||
/**
|
||||
* 启用用户
|
||||
*
|
||||
* @param orderCustomerId 客户Id
|
||||
*/
|
||||
void enable(Long orderCustomerId);
|
||||
|
||||
/**
|
||||
* 通过客户ID设置客户状态
|
||||
* @param orderCustomerId id
|
||||
* @param status 状态 SysIsYesNo
|
||||
*/
|
||||
void settingStatus(Long orderCustomerId, String status);
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package com.muyu.pay.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName OrderPayCustomerMapper
|
||||
* @Description 订单支付业务层
|
||||
* @Author Chen
|
||||
* @Date 2024/8/5 21:12
|
||||
*/
|
||||
public interface OrderPayService extends IService<OrderPayInfo> {
|
||||
/**
|
||||
* 根客户code和分页限制,查询结果
|
||||
* @param appCode 客户code
|
||||
* @param limit 分页限制
|
||||
* @return 支付订单记录
|
||||
*/
|
||||
List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int limit);
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.muyu.pay.service;
|
||||
|
||||
public interface RuleService {
|
||||
}
|
|
@ -1,180 +0,0 @@
|
|||
package com.muyu.pay.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.OrderPayInfo;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||
import com.muyu.cloud.pay.mapper.OrderPayCustomerMapper;
|
||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||
import com.muyu.cloud.pay.service.OrderPayService;
|
||||
import com.muyu.common.core.enums.SystemYesNo;
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.nacos.service.NacosServerService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName OrderPayCustomerServiceImpl
|
||||
* @Description 支付客户业务层实现类
|
||||
* @Author Chen
|
||||
* @Date 2024/8/5 21:18
|
||||
*/
|
||||
@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.isNotEmpty(customerListReq.getAppName()),
|
||||
OrderPayCustomer::getAppName, customerListReq.getAppName()
|
||||
);
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotEmpty(customerListReq.getAppCode()),
|
||||
OrderPayCustomer::getAppCode, customerListReq.getAppCode()
|
||||
);
|
||||
queryWrapper.eq(
|
||||
StringUtils.isNotEmpty(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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeById(Serializable id) {
|
||||
OrderPayCustomer orderPayCustomer = this.getById(id);
|
||||
if (orderPayCustomer==null){
|
||||
throw new ServiceException("客户不存在");
|
||||
}
|
||||
LambdaQueryWrapper<OrderPayInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OrderPayInfo::getAppCode,orderPayCustomer.getAppCode());
|
||||
queryWrapper.gt(OrderPayInfo::getCreateTime, DateUtils.addDays(new Date(),-7));
|
||||
long count = orderPayService.count();
|
||||
if (count>0){
|
||||
throw new RuntimeException(
|
||||
StringUtils.format("客户:[{}],近七天还在使用,不可删除",orderPayCustomer.getAppName())
|
||||
);
|
||||
}
|
||||
return super.removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用客户
|
||||
*
|
||||
* @param orderCustomerId 客户ID
|
||||
*/
|
||||
@Override
|
||||
public void disable(Long orderCustomerId) {
|
||||
this.settingStatus(orderCustomerId, SystemYesNo.NO.getCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用客户
|
||||
*
|
||||
* @param orderCustomerId 客户Id
|
||||
*/
|
||||
@Override
|
||||
public void enable(Long orderCustomerId) {
|
||||
this.settingStatus(orderCustomerId, SystemYesNo.YES.getCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过客户ID设置客户状态
|
||||
* @param orderCustomerId id
|
||||
* @param status 状态 SysIsYesNo
|
||||
*/
|
||||
public void settingStatus(Long orderCustomerId, String status) {
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OrderPayCustomer::getId, orderCustomerId);
|
||||
boolean isExists = this.exists(queryWrapper);
|
||||
if (!isExists) {
|
||||
throw new ServiceException("操作客户不存在");
|
||||
}
|
||||
|
||||
if (!SystemYesNo.isCode(status)){
|
||||
throw new ServiceException("设置状态值违法");
|
||||
}
|
||||
LambdaUpdateWrapper<OrderPayCustomer> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(OrderPayCustomer::getId,orderCustomerId);
|
||||
updateWrapper.set(OrderPayCustomer::getStatus,status);
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的客户
|
||||
*
|
||||
* @return客户集合
|
||||
*/
|
||||
@Override
|
||||
public boolean save(OrderPayCustomer orderPayCustomer) {
|
||||
String appCode = orderPayCustomer.getAppCode();
|
||||
List<String> nacosServerAllList = nacosServerService.nacosServerAllList();
|
||||
log.info("进行服务合法性判断:[{}->{}]", appCode, nacosServerAllList);
|
||||
if (!nacosServerAllList.contains(appCode)) {
|
||||
throw new ServiceException("客户编码违法");
|
||||
}
|
||||
LambdaQueryWrapper<OrderPayCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OrderPayCustomer::getAppCode, appCode);
|
||||
long isAppCodeOnly = this.count(queryWrapper);
|
||||
log.info("进行服务code唯一性校验:[{}--{}]", appCode, isAppCodeOnly);
|
||||
if (isAppCodeOnly > 0) {
|
||||
throw new ServiceException("客户编码重复");
|
||||
}
|
||||
return super.save(orderPayCustomer);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
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.cloud.pay.domain.OrderPayInfo;
|
||||
import com.muyu.cloud.pay.mapper.OrderPayMapper;
|
||||
import com.muyu.cloud.pay.service.OrderPayService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName OrderPayServiceImpl
|
||||
* @Description 描述
|
||||
* @Author Chen
|
||||
* @Date 2024/8/7 22:24
|
||||
*/
|
||||
@Service
|
||||
public class OrderPayServiceImpl extends ServiceImpl<OrderPayMapper, OrderPayInfo> implements OrderPayService {
|
||||
|
||||
@Override
|
||||
public List<OrderPayInfo> selectOrderPayByAppCodeAndLimit(String appCode, int limit) {
|
||||
LambdaQueryWrapper<OrderPayInfo> orderPayInfoWrapper = new LambdaQueryWrapper<>();
|
||||
orderPayInfoWrapper.eq(OrderPayInfo::getAppCode,appCode);
|
||||
orderPayInfoWrapper.orderBy(true,false,OrderPayInfo::getCreateTime);
|
||||
orderPayInfoWrapper.last("limit "+limit);
|
||||
|
||||
return this.list(orderPayInfoWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.pay.service.impl;
|
||||
|
||||
import com.muyu.pay.service.RuleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @ClassName RuleServiceImpl
|
||||
* @Description 描述
|
||||
* @Author Chen
|
||||
* @Date 2024/8/20 14:19
|
||||
*/
|
||||
@Service
|
||||
public class RuleServiceImpl implements RuleService {
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,54 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9701
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 21.12.2.1:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: cloud-2112
|
||||
|
||||
# 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/muyu-rule"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<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/muyu-rule"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<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/muyu-rule"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<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>
|
Loading…
Reference in New Issue