初始化
commit
0263e0a060
|
@ -0,0 +1,35 @@
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-rule</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-rule-client</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<!-- 规则公共模块-->
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-rule-common</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.muyu;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hello world!");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-rule</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-rule-common</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-core</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,39 @@
|
||||||
|
package pay.domain;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName Rule
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/8/20 11:40
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class Rule extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 规则ID
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 规则名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 规则类型
|
||||||
|
*/
|
||||||
|
private String ruleType;
|
||||||
|
/**
|
||||||
|
* 是否激活
|
||||||
|
*/
|
||||||
|
private String isActivate;
|
||||||
|
/**
|
||||||
|
* 规则描述
|
||||||
|
*/
|
||||||
|
private String ruleDesc;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-rule</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-rule-remote</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-rule-common</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.muyu;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hello world!");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,126 @@
|
||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-rule</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-rule-server</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataSource -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-datasource</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataScope -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-datascope</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common Log -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 接口模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- XllJob定时任务 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-xxl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- rabbit 公共依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-rabbit</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- <!– 支付公共依赖–>-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>com.muyu</groupId>-->
|
||||||
|
<!-- <artifactId>cloud-pay-common</artifactId>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<!-- 规则-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-rule-common</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>muyu-rule</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -0,0 +1,29 @@
|
||||||
|
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
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/7/29 20:30
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@EnableCustomConfig
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
public class MuYuRuleApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ConfigurableApplicationContext applicationContext = SpringApplication.run(MuYuRuleApplication.class, args);
|
||||||
|
// String[] beanDefinitionNames = applicationContext.getBeanFactory().getBeanDefinitionNames();
|
||||||
|
// for (String beanDefinitionName : beanDefinitionNames) {
|
||||||
|
// log.info("beanDefinitionName:{}",beanDefinitionName);
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,150 @@
|
||||||
|
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,15 @@
|
||||||
|
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> {
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
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,52 @@
|
||||||
|
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);
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
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,180 @@
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
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,29 @@
|
||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-server-parent</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>muyu-rule</artifactId>
|
||||||
|
<version>3.6.5</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<modules>
|
||||||
|
<module>muyu-rule-common</module>
|
||||||
|
<module>muyu-rule-client</module>
|
||||||
|
<module>muyu-rule-remote</module>
|
||||||
|
<module>muyu-rule-server</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
Loading…
Reference in New Issue