新建
This commit is contained in:
145
jxy-modules/jxy-order/pom.xml
Normal file
145
jxy-modules/jxy-order/pom.xml
Normal file
@@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.jxy</groupId>
|
||||
<artifactId>jxy-modules</artifactId>
|
||||
<version>3.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jxy-order</artifactId>
|
||||
|
||||
<description>
|
||||
jxy-order订单支付服务
|
||||
</description>
|
||||
|
||||
<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>
|
||||
|
||||
<!-- FastDFS -->
|
||||
<dependency>
|
||||
<groupId>com.github.tobato</groupId>
|
||||
<artifactId>fastdfs-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Mybatis-Plus -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.baomidou</groupId>-->
|
||||
<!-- <artifactId>mybatis-plus-boot-starter</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>3.5.7</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok-maven-plugin</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.6.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JXY Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.jxy</groupId>
|
||||
<artifactId>common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JXY Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.jxy</groupId>
|
||||
<artifactId>common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- JXY Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.jxy</groupId>
|
||||
<artifactId>common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JXY Api System -->
|
||||
<dependency>
|
||||
<groupId>com.jxy</groupId>
|
||||
<artifactId>api-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JXY Common swagger -->
|
||||
<dependency>
|
||||
<groupId>com.jxy</groupId>
|
||||
<artifactId>common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JXY Common security -->
|
||||
<dependency>
|
||||
<groupId>com.jxy</groupId>
|
||||
<artifactId>common-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--导入jedis的依赖-->
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.jxy.order;
|
||||
|
||||
import com.jxy.common.security.annotation.EnableCustomConfig;
|
||||
import com.jxy.common.security.annotation.EnableJXYFeignClients;
|
||||
import com.jxy.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/4 14:31
|
||||
* @Author 杜懿
|
||||
*/
|
||||
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableJXYFeignClients
|
||||
@SpringBootApplication
|
||||
public class JXYOrderApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(JXYOrderApplication.class,args);
|
||||
System.out.println("订单支付微服务启动成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.jxy.order.controller;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.jxy.common.core.utils.StringUtils;
|
||||
import com.jxy.common.core.web.Result.AjaxResult;
|
||||
import com.jxy.common.core.web.controller.BaseController;
|
||||
import com.jxy.common.core.web.page.TableDataInfo;
|
||||
import com.jxy.common.security.annotation.RequiresLogin;
|
||||
import com.jxy.common.security.service.TokenService;
|
||||
import com.jxy.common.security.utils.SecurityUtils;
|
||||
import com.jxy.order.service.ConsumeService;
|
||||
import com.jxy.order.vo.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 顾客(用户)相关controller
|
||||
* @Date 2023/5/4 14:17
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/consume")
|
||||
public class ConsumeController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ConsumeService consumeService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
//获取各等级支付金额
|
||||
@PostMapping("/getNeedFunding")
|
||||
@RequiresLogin
|
||||
public AjaxResult getNeedFunding(){
|
||||
|
||||
return consumeService.getNeedFunding();
|
||||
|
||||
}
|
||||
|
||||
//升级会员
|
||||
@PostMapping("/levelUp")
|
||||
@RequiresLogin
|
||||
public AjaxResult levelUp(@RequestBody LevelUpVo vo){
|
||||
|
||||
return consumeService.levelUp(vo);
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/test")
|
||||
@RequiresLogin
|
||||
public AjaxResult test(){
|
||||
|
||||
return consumeService.test();
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/test2")
|
||||
@RequiresLogin
|
||||
public AjaxResult test2(){
|
||||
|
||||
return AjaxResult.success(SecurityUtils.getLoginUser());
|
||||
|
||||
}
|
||||
|
||||
//用户获取历史消费记录记录
|
||||
@PostMapping("/privateConsume")
|
||||
@RequiresLogin
|
||||
public TableDataInfo privateConsume(@RequestBody(required = false) StatusPageVo vo){
|
||||
if(StringUtils.isNull(vo)){
|
||||
vo = new StatusPageVo();
|
||||
}
|
||||
PageHelper.startPage(vo.getPageNum(),vo.getPageSize());
|
||||
return getDataTable(consumeService. privateConsume(vo));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.jxy.order.controller;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.jxy.common.core.utils.StringUtils;
|
||||
import com.jxy.common.core.web.Result.AjaxResult;
|
||||
import com.jxy.common.core.web.controller.BaseController;
|
||||
import com.jxy.common.core.web.page.TableDataInfo;
|
||||
import com.jxy.common.security.annotation.RequiresLogin;
|
||||
import com.jxy.common.security.annotation.RequiresRoles;
|
||||
import com.jxy.order.service.OrderService;
|
||||
import com.jxy.order.vo.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 交易相关controller
|
||||
* @Date 2023/5/4 14:17
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/transfer")
|
||||
public class OrderController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
//获取地址
|
||||
//@PostMapping("/getUserAddress")
|
||||
//@RequiresLogin
|
||||
//public AjaxResult getUserAddCreditAddress(){
|
||||
//
|
||||
// return orderService.getUserAddress();
|
||||
//
|
||||
//}
|
||||
|
||||
//生成充值支付单 入参:支付金额、币种、支付网络、支付地址、支付的txid、购买的业务和类型
|
||||
@PostMapping("/createOrder")
|
||||
@RequiresLogin
|
||||
public AjaxResult createAddCreditOrder(@RequestBody AddCreditOrderVo vo){
|
||||
return orderService.createAddCreditOrder(vo);
|
||||
|
||||
}
|
||||
|
||||
//用户手动确认支付后立即处理订单
|
||||
@PostMapping("/endOrder")
|
||||
@RequiresLogin
|
||||
public AjaxResult handleOrder(@RequestBody OrderChangeByTxidVo vo){
|
||||
return orderService.handleOrder(vo);
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/cancelOrder")
|
||||
@RequiresLogin
|
||||
public AjaxResult cancelOrder(@RequestBody OrderIdVo vo){
|
||||
return orderService.cancelOrder(vo);
|
||||
|
||||
}
|
||||
|
||||
//获取用户当前余额
|
||||
@PostMapping("/getUserAccount")
|
||||
@RequiresLogin
|
||||
public AjaxResult getUserAccount(){
|
||||
|
||||
return orderService.getUserAccount();
|
||||
|
||||
}
|
||||
|
||||
//通过txid查询并处理用户订单
|
||||
@PostMapping("/checkOrderByTxid")
|
||||
@RequiresLogin
|
||||
public AjaxResult createOrderByTxid(@RequestBody OrderChangeByTxidVo vo){
|
||||
return orderService.handleOrderByTxid(vo);
|
||||
}
|
||||
|
||||
@PostMapping("/lastUseTxid")
|
||||
@RequiresLogin
|
||||
public AjaxResult lastUseTxid(){
|
||||
return orderService.checkLastUseTxid();
|
||||
}
|
||||
|
||||
//@PostMapping("/getEmailCode")
|
||||
//@RequiresLogin
|
||||
//public AjaxResult getEmailCode(){
|
||||
//
|
||||
// return orderService.sendAddCreditEmail();
|
||||
//
|
||||
//}
|
||||
|
||||
//用户获取历史购买记录
|
||||
@PostMapping("/privateOrder")
|
||||
@RequiresLogin
|
||||
public TableDataInfo privateOrder(@RequestBody(required = false) StatusPageVo vo){
|
||||
if(StringUtils.isNull(vo)){
|
||||
vo = new StatusPageVo();
|
||||
}
|
||||
PageHelper.startPage(vo.getPageNum(),vo.getPageSize());
|
||||
|
||||
return getDataTable(orderService.privateOrder(vo));
|
||||
}
|
||||
|
||||
//后台获取支付历史记录ALTER TABLE chat_message_history
|
||||
//CHANGE COLUMN `read` is_read tinyint(1) NOT NULL DEFAULT '0' COMMENT '0已读 1未读';
|
||||
//
|
||||
//ALTER TABLE chat_message
|
||||
//CHANGE COLUMN `read` is_read tinyint(1) NOT NULL DEFAULT '0' COMMENT '0已读 1未读';
|
||||
@PostMapping("/allAddCreditOrder")
|
||||
@RequiresLogin
|
||||
public TableDataInfo allAddCreditOrder(@RequestBody(required = false) OrderStatusVo vo){
|
||||
if(StringUtils.isNull(vo)){
|
||||
vo = new OrderStatusVo();
|
||||
}
|
||||
PageHelper.startPage(vo.getPageNum(),vo.getPageSize());
|
||||
return getDataTable(orderService.getAddCreditOrderList(vo));
|
||||
}
|
||||
|
||||
//查看订单详情
|
||||
@PostMapping("/details/{id}")
|
||||
@RequiresRoles("accounting")
|
||||
public AjaxResult getAddCreditDetails(@PathVariable("id") long id){
|
||||
return orderService.getAddCreditOrderById(id);
|
||||
}
|
||||
|
||||
//新增地址
|
||||
@PostMapping("/addNewAddress")
|
||||
@RequiresRoles({"admin","support"})
|
||||
public AjaxResult addNewAddress(@RequestBody TotalAddressVo vo){
|
||||
return orderService.AddTotalAddresses(vo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取地址使用详情
|
||||
@PostMapping("/allAddress")
|
||||
@RequiresLogin
|
||||
@RequiresRoles({"admin","support"})
|
||||
public TableDataInfo allAddress(@RequestBody(required = false) StatusPageVo vo){
|
||||
if(StringUtils.isNull(vo)){
|
||||
vo = new StatusPageVo();
|
||||
}
|
||||
PageHelper.startPage(vo.getPageNum(),vo.getPageSize());
|
||||
return getDataTable(orderService.getAllAddress(vo));
|
||||
}
|
||||
|
||||
//后台人员确认支付信息并更改订单状态
|
||||
//@PostMapping("/handleOrder")
|
||||
//@RequiresRoles("accounting")
|
||||
//public AjaxResult handleAddCreditOrder(@RequestBody HandleAddCreditOrderVo vo){
|
||||
// return orderService.handleAddCreditOrder(vo);
|
||||
//}
|
||||
|
||||
//@PostMapping("/test")
|
||||
//@RequiresLogin
|
||||
//public TableDataInfo test(@RequestBody(required = false) StatusPageVo vo){
|
||||
//
|
||||
// startPage();
|
||||
// return getDataTable(orderService.getAllAddress(vo));
|
||||
//}
|
||||
|
||||
|
||||
//后台获取订单操作记录
|
||||
|
||||
//后台获取每日历史图表
|
||||
|
||||
//通知用户网站通知栏, Mobile App, email
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.jxy.order.controller;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.jxy.common.core.utils.StringUtils;
|
||||
import com.jxy.common.core.web.Result.AjaxResult;
|
||||
import com.jxy.common.core.web.controller.BaseController;
|
||||
import com.jxy.common.core.web.page.TableDataInfo;
|
||||
import com.jxy.common.security.annotation.Logical;
|
||||
import com.jxy.common.security.annotation.RequiresLogin;
|
||||
import com.jxy.common.security.annotation.RequiresRoles;
|
||||
import com.jxy.order.service.WithdrawService;
|
||||
import com.jxy.order.vo.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/4 14:17
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/withdraw")
|
||||
public class WithdrawController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private WithdrawService withdrawService;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
|
||||
//提现申请
|
||||
@PostMapping("/apply")
|
||||
@RequiresLogin
|
||||
public AjaxResult apply(@RequestBody WithdrawApplyVo vo){
|
||||
|
||||
return withdrawService.apply(vo);
|
||||
|
||||
}
|
||||
|
||||
//获取个人提现历史
|
||||
@PostMapping("/history/pravite")
|
||||
@RequiresLogin
|
||||
public TableDataInfo pravite(@RequestBody(required = false) OrderStatusVo vo){
|
||||
if(StringUtils.isNull(vo)){
|
||||
vo = new OrderStatusVo();
|
||||
}
|
||||
PageHelper.startPage(vo.getPageNum(),vo.getPageSize());
|
||||
return getDataTable( withdrawService.privateWithdraw(vo));
|
||||
}
|
||||
|
||||
//获取后台历史
|
||||
@PostMapping("/history/all")
|
||||
@RequiresRoles(value = {"admin", "accounting"}, logical = Logical.OR)
|
||||
public TableDataInfo allHistory(@RequestBody(required = false) OrderStatusVo vo){
|
||||
if(StringUtils.isNull(vo)){
|
||||
vo = new OrderStatusVo();
|
||||
}
|
||||
PageHelper.startPage(vo.getPageNum(),vo.getPageSize());
|
||||
return getDataTable( withdrawService.getAllWithdraw(vo));
|
||||
}
|
||||
|
||||
@PostMapping("/getDetail")
|
||||
@RequiresRoles(value = {"admin", "accounting"}, logical = Logical.OR)
|
||||
public AjaxResult handle(@RequestBody WithdrawIdVo vo){
|
||||
|
||||
if(StringUtils.isNull(vo.getId())){
|
||||
return AjaxResult.error("传参异常");
|
||||
}
|
||||
|
||||
return withdrawService.getDetail(vo.getId());
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/handle")
|
||||
@RequiresRoles(value = {"admin", "accounting"}, logical = Logical.OR)
|
||||
public AjaxResult handle(@RequestBody WithdrawHandleVo vo){
|
||||
return withdrawService.handle(vo);
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/getEmailCode")
|
||||
@RequiresLogin
|
||||
public AjaxResult getEmailCode(){
|
||||
|
||||
return withdrawService.sendAddCreditEmail();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 充值订单入库数据
|
||||
* @Date 2023/5/18 14:16
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class AddCreditOrderDto {
|
||||
|
||||
private long id;
|
||||
|
||||
private long userId;
|
||||
|
||||
private String email;
|
||||
|
||||
/** 币种 */
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
private String chain;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 收款地址 */
|
||||
private String address;
|
||||
|
||||
/** 支付的交易id由用户支付后提供 */
|
||||
private String txid;
|
||||
|
||||
/** 充值订单状态*/
|
||||
private String status;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 充值订单入库数据
|
||||
* @Date 2023/5/18 14:16
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class ConsumeDto {
|
||||
|
||||
private long id;
|
||||
|
||||
private long userId;
|
||||
|
||||
/** 币种 */
|
||||
private String content;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 充值订单状态 */
|
||||
private String status;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 充值订单入库数据
|
||||
* @Date 2023/5/18 14:16
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class OnChainMsgByAddressDto {
|
||||
|
||||
|
||||
/** 收款地址 */
|
||||
@JSONField(name = "to")
|
||||
private String address;
|
||||
|
||||
@JSONField(name = "from")
|
||||
private String from;
|
||||
|
||||
/** */
|
||||
private String txid;
|
||||
|
||||
/** 充值订单状态*/
|
||||
private BigDecimal amount;
|
||||
|
||||
|
||||
@JSONField(format = "dd/MM/yyyy HH:mm:ss",name = "timestamp")
|
||||
private Date time;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 充值订单入库数据
|
||||
* @Date 2023/5/18 14:16
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class OnChainMsgByTxidDto {
|
||||
|
||||
@JSONField(name = "from")
|
||||
private String from;
|
||||
|
||||
@JSONField(format = "dd/MM/yyyy HH:mm:ss",name = "timestamp")
|
||||
private Date time;
|
||||
|
||||
/** */
|
||||
private String txid;
|
||||
|
||||
/** 收款地址 */
|
||||
private Map<String,BigDecimal> addressAmountMap;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 充值订单入库数据
|
||||
* @Date 2023/5/18 14:16
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class OnChainQueryByTxidResultDto {
|
||||
|
||||
|
||||
/** 是否查询到 */
|
||||
private Boolean result;
|
||||
|
||||
/** 币种 */
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
private String chain;
|
||||
|
||||
/** */
|
||||
private OnChainMsgByTxidDto data;
|
||||
|
||||
private String reason;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 充值订单入库数据
|
||||
* @Date 2023/5/18 14:16
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class OnChainQueryResultDto {
|
||||
|
||||
|
||||
/** 是否查询到 */
|
||||
private Boolean result;
|
||||
|
||||
/** 币种 */
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
private String chain;
|
||||
|
||||
/** */
|
||||
private List<OnChainMsgByAddressDto> list;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/6 10:30
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class OrderDto {
|
||||
|
||||
|
||||
private long type;
|
||||
private String coin;
|
||||
private String payNet;
|
||||
private String address;
|
||||
private String txid;
|
||||
private String userName;
|
||||
private String nowLevel;
|
||||
private String targetLevel;
|
||||
private int status;
|
||||
private double amountReceivable;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/6 10:30
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class PayResultDto {
|
||||
/** 是否查询到 */
|
||||
private Boolean result;
|
||||
|
||||
/** 币种 */
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
private String chain;
|
||||
|
||||
/** */
|
||||
private List<OnChainMsgByAddressDto> list;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/6 10:30
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class PraviteOrderDto {
|
||||
/** id */
|
||||
private long id;
|
||||
/** 支付币种 */
|
||||
private String coin;
|
||||
/** 支付网络 */
|
||||
private String payNet;
|
||||
/** 收款地址 */
|
||||
private String address;
|
||||
/** 购买服务 */
|
||||
private String service;
|
||||
/** 交易id */
|
||||
private String txid;
|
||||
/** 用户名 */
|
||||
private String userName;
|
||||
/** 订单状态 */
|
||||
private String status;
|
||||
/** 应付金额 */
|
||||
private double amountReceivable;
|
||||
/** 服务状态 */
|
||||
private String serviceStatus;
|
||||
/** 订单提交时间 */
|
||||
private Date createTime;
|
||||
/** 订单修改时间 */
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import com.jxy.order.entity.UserBalance;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/6 10:30
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class ReduceResultDto {
|
||||
|
||||
/** id */
|
||||
private UserAccountDto ua;
|
||||
|
||||
private UserBalance ub;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/1/4 15:41
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class SysRoleDto {
|
||||
|
||||
private static final long serialVersionUID = 1941856464L;
|
||||
|
||||
/** 角色ID */
|
||||
private Long roleId;
|
||||
|
||||
/** 角色名称 */
|
||||
private String roleName;
|
||||
|
||||
/** 角色权限 */
|
||||
private String roleKey;
|
||||
|
||||
private Date LevelExpireDate;
|
||||
|
||||
private String level;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/6 10:30
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class UseTxidStatusDto {
|
||||
|
||||
/** 是否查询到 */
|
||||
private Boolean result;
|
||||
|
||||
private Long time;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/6 10:30
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class UserAccountDto {
|
||||
|
||||
/** id */
|
||||
private long userId;
|
||||
|
||||
private String userName;
|
||||
|
||||
/** usdc余额 */
|
||||
private BigDecimal usdc;
|
||||
|
||||
private BigDecimal usdt;
|
||||
|
||||
private BigDecimal busd;
|
||||
|
||||
private BigDecimal total;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/6 10:30
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class UserAddressDto {
|
||||
|
||||
/** id */
|
||||
private long orderId;
|
||||
|
||||
/** address */
|
||||
private String address;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/4 15:47
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class WithdrawDetailDto {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String email;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 币种 */
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
private String chain;
|
||||
|
||||
private BigDecimal balance;
|
||||
|
||||
/** 用户个人收款钱包地址 */
|
||||
private String appliedAddress;
|
||||
|
||||
/** 用户绑定的钱包地址 */
|
||||
private String userAddress;
|
||||
|
||||
private Date appliedTime;
|
||||
|
||||
private BigDecimal refund;
|
||||
|
||||
private Date refundTime;
|
||||
|
||||
private String refundTxid;
|
||||
|
||||
/** 用户绑定的钱包地址 实退地址*/
|
||||
private String refundAddress;
|
||||
|
||||
private String message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/4 15:47
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class WithdrawDto {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String email;
|
||||
|
||||
private String userAddress;
|
||||
|
||||
private BigDecimal appliedAmount;
|
||||
|
||||
/** 币种 */
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
private String chain;
|
||||
|
||||
/** 用户收款钱包地址 */
|
||||
private String appliedAddress;
|
||||
|
||||
/** 财务实退地址 */
|
||||
private String refundAddress;
|
||||
|
||||
/** 实退交易hash */
|
||||
private String refundTxid;
|
||||
|
||||
private Date appliedTime;
|
||||
|
||||
//当前余额
|
||||
private BigDecimal usdt;
|
||||
|
||||
private BigDecimal usdc;
|
||||
|
||||
private BigDecimal busd;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.jxy.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/4 15:47
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class WithdrawPraviteDto {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 币种 */
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
private String chain;
|
||||
|
||||
/** 用户收款钱包地址 */
|
||||
private String userAddress;
|
||||
|
||||
//private String fromAddress;
|
||||
|
||||
private Date appliedTime;
|
||||
|
||||
private BigDecimal refund;
|
||||
|
||||
private Date refundTime;
|
||||
|
||||
private String refundTxid;
|
||||
|
||||
private String message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.jxy.order.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 充值订单入库数据
|
||||
* @Date 2023/5/18 14:16
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class AddCreditOrder {
|
||||
|
||||
private long id;
|
||||
|
||||
private long userId;
|
||||
|
||||
/** 币种 */
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
private String chain;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 收款地址 */
|
||||
private String address;
|
||||
|
||||
/** 支付的交易id由用户支付后提供 */
|
||||
private String txid;
|
||||
|
||||
/** 充值订单状态 */
|
||||
private int status;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.jxy.order.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/6 10:30
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class AddressInfo {
|
||||
|
||||
/** id */
|
||||
private String address;
|
||||
|
||||
private String status;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.jxy.order.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 充值订单入库数据
|
||||
* @Date 2023/5/18 14:16
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class Consume {
|
||||
|
||||
private long id;
|
||||
|
||||
private long userId;
|
||||
|
||||
/** 币种 */
|
||||
private String content;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 充值订单状态 */
|
||||
private int state;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.jxy.order.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class LevelUpOrder {
|
||||
|
||||
private long id;
|
||||
private long userId;
|
||||
private String content;
|
||||
private String coin;
|
||||
private int status;
|
||||
private double amountReceivable;
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.jxy.order.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/4 15:36
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class RecevingInfo {
|
||||
|
||||
private int type;
|
||||
|
||||
/** 计算公式 */
|
||||
private String formula;
|
||||
|
||||
/** 应收金额 */
|
||||
private double value;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.jxy.order.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/6 10:30
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class UserAddress {
|
||||
|
||||
/** id */
|
||||
private long userId;
|
||||
|
||||
private String address;
|
||||
|
||||
private String addressBSC;
|
||||
|
||||
private String addressTRX;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jxy.order.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/6 10:30
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class UserBalance {
|
||||
|
||||
/** id */
|
||||
private long id;
|
||||
|
||||
/** 对应用户的id */
|
||||
private long userId;
|
||||
|
||||
private String txid;
|
||||
|
||||
/** 币种 */
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
private String chain;
|
||||
|
||||
private BigDecimal balanceUSDT = BigDecimal.valueOf(0);
|
||||
|
||||
private BigDecimal balanceUSDC= BigDecimal.valueOf(0);
|
||||
|
||||
private BigDecimal balanceBUSD= BigDecimal.valueOf(0);
|
||||
|
||||
/** 余额单记录状态 */
|
||||
private int notes;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String message;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.jxy.order.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/4 15:47
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class Withdraw {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private BigDecimal appliedAmount;
|
||||
|
||||
/** 币种 */
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
private String chain;
|
||||
|
||||
/** 用户收款钱包地址 */
|
||||
private String appliedAddress;
|
||||
|
||||
private Date appliedTime;
|
||||
|
||||
private int status;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jxy.order.enums;
|
||||
|
||||
/**
|
||||
* @Description 币价查询范围条件
|
||||
* @Date 2022/5/20 11:15
|
||||
* @Author 杜懿
|
||||
*/
|
||||
public enum BasePrice {
|
||||
|
||||
MONTHLY_USER(0,10),
|
||||
ANNUAL_USER(1,100),
|
||||
VIP_ANNUAL_USER(2,500);
|
||||
|
||||
private final int code;
|
||||
private final double price;
|
||||
|
||||
BasePrice(int code, double price)
|
||||
{
|
||||
this.code = code;
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public double getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
|
||||
public static double getPriceByCode(int code){
|
||||
for (BasePrice b : BasePrice.values()) {
|
||||
if(b.getCode()==code){
|
||||
return b.getPrice();
|
||||
}
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.jxy.order.enums;
|
||||
|
||||
/**
|
||||
* @Description 支持转账的币种 现仅支持BUSD、USDC、USDT
|
||||
* @Date 2023/6/6 15:02
|
||||
* @Author 杜懿
|
||||
*/
|
||||
|
||||
public enum Chain {
|
||||
TRX("TRX"),
|
||||
ETH("ETH"),
|
||||
BSC("BSC");
|
||||
|
||||
private final String chain;
|
||||
|
||||
Chain(String chain)
|
||||
{
|
||||
this.chain = chain;
|
||||
}
|
||||
|
||||
public String getChain()
|
||||
{
|
||||
return chain;
|
||||
}
|
||||
|
||||
public static boolean judge(String chain){
|
||||
for (Chain c : Chain.values()) {
|
||||
if(c.getChain().equals(chain.toUpperCase())){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.jxy.order.enums;
|
||||
|
||||
/**
|
||||
* @Description 支持转账的币种 现仅支持BUSD、USDC、USDT
|
||||
* @Date 2023/6/6 15:02
|
||||
* @Author 杜懿
|
||||
*/
|
||||
|
||||
public enum Coin {
|
||||
BUSD("BUSD"),
|
||||
USDT("USDT"),
|
||||
USDC("USDC");
|
||||
|
||||
private final String coin;
|
||||
|
||||
Coin(String coin)
|
||||
{
|
||||
this.coin = coin;
|
||||
}
|
||||
|
||||
public String getCoin()
|
||||
{
|
||||
return coin;
|
||||
}
|
||||
|
||||
public static boolean judge(String coin){
|
||||
for (Coin c : Coin.values()) {
|
||||
if(c.getCoin().equals(coin.toUpperCase())){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.jxy.order.enums;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
public enum ConsumeStatus {
|
||||
/**
|
||||
* 2支付待确认
|
||||
* 1支付成功
|
||||
* 0支付失败
|
||||
*/
|
||||
|
||||
PAY_OFF(2, "消费订单待确认"),
|
||||
SUCCESS(1, "成功"),
|
||||
PAY_FAIL(0, "失败");
|
||||
|
||||
private final int code;
|
||||
private final String status;
|
||||
|
||||
ConsumeStatus(int code, String status)
|
||||
{
|
||||
this.code = code;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public static String getStatusByCode(int code){
|
||||
for (ConsumeStatus u : ConsumeStatus.values()) {
|
||||
if(u.getCode()==code){
|
||||
return u.getStatus();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.jxy.order.enums;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
public enum OrderStatus {
|
||||
/**
|
||||
* 2支付待确认
|
||||
* 1支付成功
|
||||
* 0支付失败
|
||||
*/
|
||||
|
||||
PAY_OFF(2, "支付待确认"),
|
||||
SUCCESS(1, "支付成功"),
|
||||
PAY_FAIL(0, "支付失败");
|
||||
|
||||
private final int code;
|
||||
private final String status;
|
||||
|
||||
OrderStatus(int code, String status)
|
||||
{
|
||||
this.code = code;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public static String getStatusByCode(int code){
|
||||
for (OrderStatus u : OrderStatus.values()) {
|
||||
if(u.getCode()==code){
|
||||
return u.getStatus();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jxy.order.enums;
|
||||
|
||||
/**
|
||||
* @Description 币价查询范围条件
|
||||
* @Date 2022/5/20 11:15
|
||||
* @Author 杜懿
|
||||
*/
|
||||
public enum OrderType {
|
||||
|
||||
MONTHLY_USER(0,"月度L3"),
|
||||
ANNUAL_USER(1,"年度L3"),
|
||||
VIP_ANNUAL_USER(2,"年度L4");
|
||||
|
||||
private final int code;
|
||||
private final String type;
|
||||
|
||||
OrderType(int code, String type)
|
||||
{
|
||||
this.code = code;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public static String getTypeByCode(int code){
|
||||
for (OrderType o : OrderType.values()) {
|
||||
if(o.getCode()==code){
|
||||
return o.getType();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.jxy.order.enums;
|
||||
|
||||
/**
|
||||
* @Description 币价查询范围条件
|
||||
* @Date 2022/5/20 11:15
|
||||
*
|
||||
* @Author 杜懿
|
||||
*/
|
||||
public enum ReceivingAddress {
|
||||
|
||||
Address_ONE(1,"ADDRESSFIRSTADDRESSFIRSTADDRESSFIRST"),
|
||||
Address_TWO(2,"ADDRESSSECONDADDRESSSECONDADDRESSSECOND"),
|
||||
Address_THREE(3,"ADDRESSTHIRDADDRESSTHIRDADDRESSTHIRD"),
|
||||
Address_FOUR(4,"ADDRESSFOURTHADDRESSFOURTHADDRESSFOURTH"),
|
||||
Address_FIVE(5,"ADDRESSFIFTHADDRESSFIFTHADDRESSFIFTH");
|
||||
|
||||
private final int code;
|
||||
private final String address;
|
||||
|
||||
ReceivingAddress(int code, String address)
|
||||
{
|
||||
this.code = code;
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getAddress()
|
||||
{
|
||||
return address;
|
||||
}
|
||||
|
||||
public static String getAddressByCode(int code){
|
||||
for (ReceivingAddress r : ReceivingAddress.values()) {
|
||||
if(r.getCode()==code){
|
||||
return r.getAddress();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.jxy.order.enums;
|
||||
|
||||
public enum UserLevel {
|
||||
REGISTERED(2, "registered", "L2"),
|
||||
ADVANCE(3, "advance", "L3"),
|
||||
VIP(4, "vip", "L4");
|
||||
|
||||
private final long roleId;
|
||||
private final String role;
|
||||
private final String level;
|
||||
|
||||
UserLevel(long roleId, String role, String level)
|
||||
{
|
||||
this.roleId = roleId;
|
||||
this.role = role;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public long getRoleId()
|
||||
{
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public String getRole()
|
||||
{
|
||||
return role;
|
||||
}
|
||||
|
||||
public String getLevel(){return level;}
|
||||
|
||||
public static String getLevelByRoleId(long roleId){
|
||||
for (UserLevel u : UserLevel.values()) {
|
||||
if(u.getRoleId()==roleId){
|
||||
return u.getLevel();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jxy.order.enums;
|
||||
|
||||
/**
|
||||
* @Description 角色id对应等级
|
||||
* @Date 2022/5/20 11:15
|
||||
* @Author 杜懿
|
||||
*/
|
||||
public enum UserRoleLevel {
|
||||
|
||||
L1(0,10),
|
||||
L2(1,100),
|
||||
L3(2,500);
|
||||
|
||||
private final int code;
|
||||
private final double price;
|
||||
|
||||
UserRoleLevel(int code, double price)
|
||||
{
|
||||
this.code = code;
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public double getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
|
||||
public static double getPriceByCode(int code){
|
||||
for (UserRoleLevel b : UserRoleLevel.values()) {
|
||||
if(b.getCode()==code){
|
||||
return b.getPrice();
|
||||
}
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jxy.order.mapper;
|
||||
|
||||
import com.jxy.common.datasource.annotation.Master;
|
||||
import com.jxy.order.entity.AddCreditOrder;
|
||||
import com.jxy.order.entity.Consume;
|
||||
import com.jxy.order.entity.LevelUpOrder;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/31 15:27
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Master
|
||||
public interface ConsumeMapper {
|
||||
|
||||
/**
|
||||
* 根据用户id查询当前用户是否有正在处理的升级订单
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public int checkOrderIfExistByUserId(@Param("userId") Long userId);
|
||||
|
||||
public boolean insertConsume(@Param("dto") LevelUpOrder dto);
|
||||
|
||||
public boolean updateConsumeState(@Param("dto") LevelUpOrder dto);
|
||||
|
||||
/**
|
||||
*根据用户id获取用户所有消费记录
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public List<Consume> getConsumeByUserId(@Param("userId") Long userId, @Param("state") Integer state);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.jxy.order.mapper;
|
||||
|
||||
import com.jxy.common.datasource.annotation.Master;
|
||||
import com.jxy.order.dto.AddCreditOrderDto;
|
||||
import com.jxy.order.dto.UserAccountDto;
|
||||
import com.jxy.order.entity.AddCreditOrder;
|
||||
import com.jxy.order.entity.AddressInfo;
|
||||
import com.jxy.order.entity.UserAddress;
|
||||
import com.jxy.order.entity.UserBalance;
|
||||
import com.jxy.order.vo.HandleAddCreditOrderVo;
|
||||
import com.jxy.order.vo.OrderStatusVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Master
|
||||
public interface OrderMapper{
|
||||
|
||||
|
||||
public int checkTxidIfExist(@Param("txid") String txid);
|
||||
|
||||
public UserAddress getAddressByUserId(@Param("userId") long userId);
|
||||
|
||||
public Long getUserIdByEmail(@Param("email") String email);
|
||||
|
||||
|
||||
public int getAddressNoUsedCount();
|
||||
|
||||
|
||||
public int batchInsertTotalAddress(List<String> list);
|
||||
|
||||
public int batchInsertBSCTotalAddress(List<String> list);
|
||||
|
||||
public int batchInsertTRXTotalAddress(List<String> list);
|
||||
|
||||
/**
|
||||
* 用户收款地址信息入库 原则上不调用
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
public int insertAddressAndUserId(@Param("dto") UserAddress dto);
|
||||
|
||||
public String getAddressNoUse(@Param("table") String table);
|
||||
|
||||
public boolean updateAddressToUse(@Param("address") String address,@Param("table") String table);
|
||||
|
||||
/**
|
||||
* 充值订单信息记录
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
public boolean insertAddCreditOrder(@Param("dto") AddCreditOrder dto);
|
||||
|
||||
public boolean insertUserAccount(@Param("dto") UserAccountDto dto);
|
||||
|
||||
public UserAccountDto getUserAccountByUserId(@Param("userId") Long userId);
|
||||
|
||||
public boolean updateUserAccount(@Param("dto") UserAccountDto dto, @Param("usdt") BigDecimal usdt, @Param("usdc") BigDecimal usdc, @Param("busd") BigDecimal busd);
|
||||
|
||||
public boolean insertUserBalance(@Param("dto") UserBalance dto);
|
||||
|
||||
/**
|
||||
*根据状态、地址获取所有系统充值订单
|
||||
*/
|
||||
public List<AddCreditOrderDto> getAddCreditOrderByStatus(@Param("vo") OrderStatusVo vo);
|
||||
|
||||
|
||||
/**
|
||||
*获取超时未处理的充值订单列表
|
||||
*/
|
||||
public List<AddCreditOrder> getExpireNoHandleAddCreditOrder();
|
||||
|
||||
/**
|
||||
*获取所有地址
|
||||
*/
|
||||
public List<AddressInfo> getAllAddress(@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
*根据用户id获取用户所有系统充值订单
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public List<AddCreditOrder> getAddCreditOrderByUserId(@Param("userId") Long userId,@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
*根据订单id获取充值订单详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public AddCreditOrder getAddCreditOrderById(@Param("id") Long id);
|
||||
|
||||
public AddCreditOrder getAddCreditOrderByOrderIdAndUserId(@Param("orderId") Long orderId,@Param("userId") Long userId);
|
||||
|
||||
public int updateOrderStatusById(@Param("vo") HandleAddCreditOrderVo vo);
|
||||
|
||||
public int updateOrdersById(@Param("vo") HandleAddCreditOrderVo vo);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.jxy.order.mapper;
|
||||
|
||||
import com.jxy.common.datasource.annotation.Master;
|
||||
import com.jxy.order.dto.WithdrawDetailDto;
|
||||
import com.jxy.order.dto.WithdrawDto;
|
||||
import com.jxy.order.dto.WithdrawPraviteDto;
|
||||
import com.jxy.order.vo.WithdrawApplyVo;
|
||||
import com.jxy.order.vo.WithdrawHandleVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/31 15:27
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Master
|
||||
public interface WithdrawMapper {
|
||||
|
||||
public boolean insertWithdraw(@Param("vo") WithdrawApplyVo vo);
|
||||
|
||||
public List<WithdrawPraviteDto> getWithdrawByUserId(@Param("userId") Long userId,@Param("status") Integer status);
|
||||
|
||||
public WithdrawDetailDto getWithdrawDetailById(@Param("id") Long id);
|
||||
|
||||
public List<WithdrawDto> getWithdrawByStatus(@Param("status") int status,@Param("email") String email);
|
||||
|
||||
public boolean updateWithdraw(@Param("vo") WithdrawHandleVo vo);
|
||||
|
||||
/**
|
||||
*获取超时未处理的提现订单列表
|
||||
* @param date
|
||||
*/
|
||||
public List<WithdrawPraviteDto> getExpireNoHandleWithdrawOrder(@Param("date") String date);
|
||||
|
||||
/**
|
||||
*批量修改超时未处理的充值订单状态 修改为fail(status=0)
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public int batchUpdateExpireWithdraw(List<WithdrawPraviteDto> list);
|
||||
|
||||
///**
|
||||
// *批量修改超时未处理的充值订单状态 修改为fail(status=0)
|
||||
// * @param list
|
||||
// * @return
|
||||
// */
|
||||
//public int batchUpdateExpireWithdraw(List<Long> list);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.jxy.order.service;
|
||||
|
||||
import com.jxy.common.core.web.Result.AjaxResult;
|
||||
import com.jxy.order.dto.ConsumeDto;
|
||||
import com.jxy.order.vo.LevelUpVo;
|
||||
import com.jxy.order.vo.StatusPageVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description 消费服务
|
||||
* @Date 2023/5/4 14:10
|
||||
* @Author 杜懿
|
||||
*/
|
||||
public interface ConsumeService {
|
||||
|
||||
|
||||
/**
|
||||
* 获取消费订单应支付信息
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult getNeedFunding();
|
||||
|
||||
/**
|
||||
* 生成消费订单
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult levelUp(LevelUpVo vo);
|
||||
|
||||
/**
|
||||
* 查看个人历史消费记录
|
||||
* @param
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public List<ConsumeDto> privateConsume(StatusPageVo vo);
|
||||
|
||||
|
||||
public AjaxResult test();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.jxy.order.service;
|
||||
|
||||
import com.jxy.common.core.web.Result.AjaxResult;
|
||||
import com.jxy.order.dto.AddCreditOrderDto;
|
||||
import com.jxy.order.dto.UserAccountDto;
|
||||
import com.jxy.order.entity.AddressInfo;
|
||||
import com.jxy.order.vo.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/4 14:10
|
||||
* @Author 杜懿
|
||||
*/
|
||||
public interface OrderService {
|
||||
|
||||
///**
|
||||
// * 获取用户专属收款地址
|
||||
// * @return
|
||||
// */
|
||||
//public AjaxResult getUserAddress();
|
||||
|
||||
/**
|
||||
* 充值订单生成
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult createAddCreditOrder(AddCreditOrderVo vo);
|
||||
|
||||
/**
|
||||
* 用户确认之后立即处理订单
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult handleOrder(OrderChangeByTxidVo vo);
|
||||
|
||||
/**
|
||||
* 用户取消订单
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult cancelOrder(OrderIdVo vo);
|
||||
|
||||
/**
|
||||
* 根据txid处理订单
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult handleOrderByTxid(OrderChangeByTxidVo vo);
|
||||
|
||||
/**
|
||||
* 根据判断用户是否可以使用txid校验服务 4小时只能查1次
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult checkLastUseTxid();
|
||||
|
||||
/**
|
||||
* 按状态获取充值订单
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public List getAddCreditOrderList(OrderStatusVo vo);
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult getAddCreditOrderById(long id);
|
||||
|
||||
/**
|
||||
* 新增地址
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult AddTotalAddresses(TotalAddressVo vo);
|
||||
|
||||
/**
|
||||
* 处理充值订单
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult handleAddCreditOrder(HandleAddCreditOrderVo vo,Long userId);
|
||||
|
||||
|
||||
/**
|
||||
* 查看个人历史订单记录
|
||||
* @param
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public List<AddCreditOrderDto> privateOrder(StatusPageVo vo);
|
||||
|
||||
|
||||
/**
|
||||
* 查看所有地址
|
||||
* @param
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public List<AddressInfo> getAllAddress(StatusPageVo vo);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查看用户账号信息
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult getUserAccount();
|
||||
|
||||
|
||||
public UserAccountDto updateUserAccountAfterRefuseWithdraw(Long userId, String coin, BigDecimal amount);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.jxy.order.service;
|
||||
|
||||
import com.jxy.common.core.web.Result.AjaxResult;
|
||||
import com.jxy.order.dto.PraviteOrderDto;
|
||||
import com.jxy.order.dto.WithdrawDto;
|
||||
import com.jxy.order.dto.WithdrawPraviteDto;
|
||||
import com.jxy.order.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description 提现服务
|
||||
* @Date 2023/5/4 14:10
|
||||
* @Author 杜懿
|
||||
*/
|
||||
public interface WithdrawService {
|
||||
|
||||
/**
|
||||
* 申请提现订单
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult apply(WithdrawApplyVo vo);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult getDetail(Long id);
|
||||
|
||||
/**
|
||||
* 处理提现申请
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult handle(WithdrawHandleVo vo);
|
||||
|
||||
/**
|
||||
* 查看个人提现历史记录
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public List<WithdrawPraviteDto> privateWithdraw(OrderStatusVo vo);
|
||||
|
||||
/**
|
||||
* 后台查看提现历史记录
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public List<WithdrawDto> getAllWithdraw(OrderStatusVo vo);
|
||||
|
||||
/**
|
||||
* 发送邮箱验证码
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult sendAddCreditEmail();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,469 @@
|
||||
package com.jxy.order.service.impl;
|
||||
|
||||
import com.jxy.common.core.Result.R;
|
||||
import com.jxy.common.core.constant.Constants;
|
||||
import com.jxy.common.core.constant.SecurityConstants;
|
||||
import com.jxy.common.core.exception.ServiceException;
|
||||
import com.jxy.common.core.text.DoubleCalculate;
|
||||
import com.jxy.common.core.utils.DateUtils;
|
||||
import com.jxy.common.core.utils.StringUtils;
|
||||
import com.jxy.common.core.web.Result.AjaxResult;
|
||||
import com.jxy.common.security.service.TokenService;
|
||||
import com.jxy.common.security.utils.SecurityUtils;
|
||||
import com.jxy.order.dto.ConsumeDto;
|
||||
import com.jxy.order.dto.ReduceResultDto;
|
||||
import com.jxy.order.dto.SysRoleDto;
|
||||
import com.jxy.order.dto.UserAccountDto;
|
||||
import com.jxy.order.entity.*;
|
||||
import com.jxy.order.enums.BasePrice;
|
||||
import com.jxy.order.enums.ConsumeStatus;
|
||||
import com.jxy.order.enums.OrderStatus;
|
||||
import com.jxy.order.enums.UserLevel;
|
||||
import com.jxy.order.mapper.ConsumeMapper;
|
||||
import com.jxy.order.mapper.OrderMapper;
|
||||
import com.jxy.order.service.ConsumeService;
|
||||
import com.jxy.order.service.OrderService;
|
||||
import com.jxy.order.vo.LevelUpVo;
|
||||
import com.jxy.order.vo.StatusPageVo;
|
||||
import com.jxy.system.api.RemoteUserService;
|
||||
import com.jxy.system.api.entity.SysRole;
|
||||
import com.jxy.system.api.entity.SysUserLeveDate;
|
||||
import com.jxy.system.api.model.LoginUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/31 15:22
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Service
|
||||
public class ConsumeServiceImpl implements ConsumeService {
|
||||
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
@Autowired
|
||||
private ConsumeMapper consumeMapper;
|
||||
|
||||
@Autowired
|
||||
private OrderMapper orderMapper;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult getNeedFunding() {
|
||||
|
||||
List<RecevingInfo> list = new ArrayList<>();
|
||||
|
||||
RecevingInfo info1 = getInfoByRoleId(SecurityUtils.getLoginUser().getSysUser().getRoleId(),0);
|
||||
if(StringUtils.isNull(info1)){
|
||||
return AjaxResult.error("后台繁忙,拉取支付信息异常");
|
||||
}
|
||||
list.add(info1);
|
||||
|
||||
RecevingInfo info2 = getInfoByRoleId(SecurityUtils.getLoginUser().getSysUser().getRoleId(),1);
|
||||
if(StringUtils.isNull(info1)){
|
||||
return AjaxResult.error("后台繁忙,拉取支付信息异常");
|
||||
}
|
||||
list.add(info2);
|
||||
|
||||
RecevingInfo info3 = getInfoByRoleId(SecurityUtils.getLoginUser().getSysUser().getRoleId(),2);
|
||||
if(StringUtils.isNull(info1)){
|
||||
return AjaxResult.error("后台繁忙,拉取支付信息异常");
|
||||
}
|
||||
list.add(info3);
|
||||
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
//@GlobalT
|
||||
@Transactional
|
||||
public AjaxResult levelUp(LevelUpVo vo) {
|
||||
|
||||
|
||||
//判断用户是否有待处理订单 如有则取消当前订单
|
||||
int count = consumeMapper.checkOrderIfExistByUserId(SecurityUtils.getUserId());
|
||||
|
||||
if(count > 0){
|
||||
return AjaxResult.error(802,"有订单待处理,无法再次提交新订单");
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
RecevingInfo info = getInfoByRoleId(SecurityUtils.getLoginUser().getSysUser().getRoleId(),vo.getType());
|
||||
if (StringUtils.isNull(info)){
|
||||
|
||||
//todo 放入队列中后台执行
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
//生成升级订单表数据 入库
|
||||
LevelUpOrder order = new LevelUpOrder();
|
||||
BeanUtils.copyProperties(vo,order);
|
||||
order.setUserId(SecurityUtils.getUserId());
|
||||
String level = UserLevel.getLevelByRoleId(SecurityUtils.getLoginUser().getSysUser().getRoleId());
|
||||
order.setAmountReceivable(info.getValue());
|
||||
if("".equals(level)){
|
||||
return AjaxResult.error("该功能仅对L2/L3/L4用户开放");
|
||||
}
|
||||
|
||||
// 走到这里 用户角色基本确定为网站外来用户:注册用户、付费用户、VIP
|
||||
Long roleId = SecurityUtils.getLoginUser().getSysUser().getRoleId();
|
||||
|
||||
//根据用户当前roleId和购买类型进行后续处理
|
||||
//roleId==4 type仅支持2 即 L4用户只能选择购买L4服务 oper设置为1续费
|
||||
//roleId==3 type为0或者1时代表续费会员 oper设置为1续费 type为2代表升级为L4 oper设置为0
|
||||
//roleId==2 type为0、1、2 均代表升级 oper设置为0
|
||||
|
||||
int oper = 0;
|
||||
if(roleId == 4 && vo.getType() < 2){
|
||||
return AjaxResult.error("用户当前等级为L4,无需购买L4以下的服务");
|
||||
}
|
||||
|
||||
if(roleId == 4){
|
||||
//VIP 说明是需要续费年度VIP(type=2) 后续需要执行续费操作
|
||||
System.out.println("续费年度vip,设置oper为1");
|
||||
oper = 1;
|
||||
}
|
||||
|
||||
if(roleId == 3 && vo.getType() < 2){
|
||||
oper = 1;
|
||||
}
|
||||
|
||||
if(vo.getType() == 2){
|
||||
order.setContent("购买年度L4用户服务");
|
||||
roleId = 4L;
|
||||
}else if(vo.getType() == 1){
|
||||
order.setContent("购买年度L3用户服务");
|
||||
roleId = 3L;
|
||||
}else {
|
||||
order.setContent("购买月度L3用户服务");
|
||||
roleId = 3L;
|
||||
}
|
||||
|
||||
//扣款
|
||||
ReduceResultDto reduceResult = reduceBalance(SecurityUtils.getUserId(), BigDecimal.valueOf(info.getValue()));
|
||||
if(StringUtils.isNull(reduceResult)){
|
||||
order.setStatus(OrderStatus.PAY_FAIL.getCode());
|
||||
//记录失败的升级订单 标记风险用户
|
||||
if(!consumeMapper.insertConsume(order)) {
|
||||
return AjaxResult.error("服务器异常");
|
||||
}else {
|
||||
//标记风险用户
|
||||
|
||||
return AjaxResult.error("余额不足,此次升级根据公式:"+info.getFormula()+",应支付金额:"+info.getValue());
|
||||
}
|
||||
}else {
|
||||
//扣款后:升级用户和生成订单
|
||||
System.out.println("已扣款 即将执行后续操作");
|
||||
SysUserLeveDate userLeveDate = new SysUserLeveDate();
|
||||
userLeveDate.setUserId(SecurityUtils.getUserId());
|
||||
userLeveDate.setRoleId(roleId);
|
||||
userLeveDate.setLevelType(vo.getType());
|
||||
userLeveDate.setOper(oper);
|
||||
|
||||
Date date = new Date();
|
||||
userLeveDate.setStartTime(date);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
if(vo.getType() > 0){
|
||||
//年度会员/年度vip 会员有效期设置为一年
|
||||
calendar.add(Calendar.YEAR,1);
|
||||
}else {
|
||||
calendar.add(Calendar.MONTH,1);
|
||||
}
|
||||
userLeveDate.setExpireTime(calendar.getTime());
|
||||
|
||||
//用户升级
|
||||
R<Boolean> booleanR = remoteUserService.userLevelup(userLeveDate, SecurityConstants.INNER);
|
||||
if(booleanR.getCode() == 200){
|
||||
//生成订单
|
||||
System.out.println("用户升级微服务调用成功");
|
||||
order.setStatus(OrderStatus.SUCCESS.getCode());
|
||||
//记录升级订单
|
||||
if(!consumeMapper.insertConsume(order)) {
|
||||
return AjaxResult.error("系统异常,记录升级信息失败,请稍后再试");
|
||||
}else {
|
||||
//修改余额表
|
||||
UserBalance userBalance = reduceResult.getUb();
|
||||
userBalance.setCoin(vo.getCoin());
|
||||
userBalance.setChain("");
|
||||
userBalance.setUserId(SecurityUtils.getUserId());
|
||||
userBalance.setTxid("");
|
||||
userBalance.setNotes(1);
|
||||
userBalance.setMessage(order.getContent());
|
||||
if(orderMapper.insertUserBalance(userBalance)){
|
||||
//刷新token
|
||||
System.out.println("用户邮箱:"+SecurityUtils.getLoginUser().getSysUser().getEmail());
|
||||
R<LoginUser> userResult = remoteUserService.getUserInfo(SecurityUtils.getLoginUser().getSysUser().getEmail(), SecurityConstants.INNER);
|
||||
|
||||
int times=0;
|
||||
while (R.FAIL == userResult.getCode()){
|
||||
if (times > 2){
|
||||
break;
|
||||
}
|
||||
userResult = remoteUserService.getUserInfo(SecurityUtils.getLoginUser().getSysUser().getEmail(), SecurityConstants.INNER);
|
||||
times++;
|
||||
}
|
||||
|
||||
if (R.FAIL == userResult.getCode())
|
||||
{
|
||||
System.out.println(userResult);
|
||||
return AjaxResult.error("后台繁忙,用户信息微服务调用失败,请稍后再试\n"+userResult.getMsg());
|
||||
}
|
||||
|
||||
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData()))
|
||||
{
|
||||
return AjaxResult.error("后台繁忙,用户信息查询失败,请稍后再试");
|
||||
}
|
||||
System.out.println("查询到的用户信息:"+userResult.getData());
|
||||
Map<String, Object> token = tokenService.createToken(userResult.getData());
|
||||
SysRole role = userResult.getData().getSysUser().getRoles().get(0);
|
||||
SysRoleDto roleDto = new SysRoleDto();
|
||||
roleDto.setLevelExpireDate(role.getLevelExpireDate());
|
||||
roleDto.setRoleId(role.getRoleId());
|
||||
roleDto.setRoleKey(role.getRoleKey());
|
||||
roleDto.setRoleName(role.getRoleName());
|
||||
if(role.getRoleId() == 3){
|
||||
roleDto.setLevel("L3");
|
||||
if(vo.getType() == 0){
|
||||
roleDto.setRoleName("月度"+roleDto.getRoleName());
|
||||
}else if(vo.getType() == 1){
|
||||
roleDto.setRoleName("年度"+roleDto.getRoleName());
|
||||
}
|
||||
}else if(role.getRoleId() == 4){
|
||||
roleDto.setLevel("L4");
|
||||
}else {
|
||||
roleDto.setLevel(roleDto.getRoleKey());
|
||||
}
|
||||
token.put("role", roleDto);
|
||||
|
||||
System.out.println("新token"+token);
|
||||
if(StringUtils.isNotNull(token)){
|
||||
if(StringUtils.isNotNull(token.get("access_token"))){
|
||||
tokenService.delLoginUser(SecurityUtils.getToken());
|
||||
|
||||
return AjaxResult.success(token);
|
||||
}
|
||||
}
|
||||
return AjaxResult.error("后台繁忙,请稍后再试");
|
||||
}else {
|
||||
//修改失败返回null
|
||||
return AjaxResult.error("后台繁忙,请稍后再试");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
System.out.println("用户升级微服务调用失败");
|
||||
return AjaxResult.error("后台繁忙,调用升级微服务失败,请稍后再试");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConsumeDto> privateConsume(StatusPageVo vo) {
|
||||
List<Consume> list = consumeMapper.getConsumeByUserId(SecurityUtils.getUserId(), vo.getStatus());
|
||||
List<ConsumeDto> returnList = list.stream().map(e -> {
|
||||
ConsumeDto dto = new ConsumeDto();
|
||||
BeanUtils.copyProperties(e,dto);
|
||||
dto.setStatus(ConsumeStatus.getStatusByCode(e.getState()));
|
||||
return dto;
|
||||
}).collect(Collectors.toList());
|
||||
return returnList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult test() {
|
||||
R<LoginUser> userResult = remoteUserService.getUserInfo(SecurityUtils.getLoginUser().getSysUser().getEmail(), SecurityConstants.INNER);
|
||||
System.out.println("用户邮箱:"+SecurityUtils.getLoginUser().getSysUser().getEmail());
|
||||
System.out.println("用户名"+SecurityUtils.getLoginUser().getUsername());
|
||||
return AjaxResult.success(userResult);
|
||||
}
|
||||
|
||||
public RecevingInfo getInfoByRoleId(Long roleId, int type){
|
||||
System.out.println("用户roleId:"+roleId);
|
||||
RecevingInfo info = new RecevingInfo();
|
||||
info.setType(type);
|
||||
double price = BasePrice.getPriceByCode(type);
|
||||
if(roleId > 4 || roleId == 1){
|
||||
//管理员1 支持及维护人员5 审核6 财务会计人员7无需付费进行购买
|
||||
System.out.println("进入内部计算价格流程");
|
||||
info.setValue(1.0);
|
||||
info.setFormula("管理员、支持及维护人员、审核、财务会计人员无需付费进行升级(测试时设置为1)");
|
||||
}else if(roleId == 2){
|
||||
//注册用户升级 直接计算金额
|
||||
System.out.println("进入普通用户升级计算价格流程");
|
||||
info.setFormula("当前所选会员需支付金额:"+price);
|
||||
info.setValue(price);
|
||||
}else if(roleId == 4){
|
||||
if(type == 1 || type ==0){
|
||||
info.setFormula("续费年度VIP不支持降级购买其他服务");
|
||||
info.setValue(0.0);
|
||||
}else {
|
||||
//VIP续费 直接计算金额
|
||||
System.out.println("进入年度vip用户计算价格流程");
|
||||
info.setFormula("续费年度VIP所需支付金额:"+price);
|
||||
info.setValue(price);
|
||||
}
|
||||
}else if(roleId == 3){
|
||||
if(type == 0){
|
||||
info.setFormula("续费购买月度L3会员:"+price+"/月");
|
||||
info.setValue(price);
|
||||
return info;
|
||||
}else if(type == 1){
|
||||
info.setFormula("续费年度L3会员:"+price+"/年");
|
||||
info.setValue(price);
|
||||
return info;
|
||||
}
|
||||
//付费用户升级 需要根据当前用户等级以及会员时间判断差价
|
||||
//获取付费用户当前有效时间
|
||||
System.out.println("进入年度vip用户计算价格流程");
|
||||
R<SysUserLeveDate> userResult = remoteUserService.userLevel(SecurityUtils.getUserId());
|
||||
if (R.FAIL == userResult.getCode())
|
||||
{
|
||||
throw new ServiceException(userResult.getMsg());
|
||||
}
|
||||
|
||||
if (StringUtils.isNull(userResult))
|
||||
{
|
||||
throw new ServiceException("后台异常,请稍后再试");
|
||||
}
|
||||
|
||||
if (StringUtils.isNull(userResult.getData()))
|
||||
{
|
||||
//没有找到对应数据 将用户角色更改为2注册用户
|
||||
info.setFormula("升级年度VIP:"+price);
|
||||
info.setValue(price);
|
||||
return info;
|
||||
}
|
||||
//拿到数据了 根据对应数据计算剩余金额
|
||||
SysUserLeveDate userInfo = userResult.getData();
|
||||
System.out.println("userInfo:"+userInfo);
|
||||
|
||||
double basePrice = BasePrice.getPriceByCode(type);
|
||||
//todo 具体计算
|
||||
double monthAvg = DoubleCalculate.divide(BasePrice.getPriceByCode(1),12);
|
||||
//剩余月数 会员总有效期月数-已使用月数
|
||||
long month = DateUtils.getMonthDiff(userInfo.getExpireTime(),userInfo.getStartTime()) - DateUtils.getMonthDiff(userInfo.getStartTime(),new Date());
|
||||
month = month >0 ? month : 0;
|
||||
//余额
|
||||
double balance = DoubleCalculate.subtract(basePrice, (DoubleCalculate.multiply(monthAvg, month)));
|
||||
if(balance >= 0){
|
||||
System.out.println("抵扣小于500");
|
||||
info.setValue(DoubleCalculate.subtract(basePrice,(DoubleCalculate.multiply(monthAvg,month))));
|
||||
String formula = ""+basePrice+"-(原会员月均价"+monthAvg+" x 剩余会员月数"+month+")="+info.getValue();
|
||||
info.setFormula(formula);
|
||||
}else {
|
||||
//balance小于0 剩余会员月数价值>500
|
||||
System.out.println("抵扣大于500");
|
||||
info.setValue(0);
|
||||
String formula = "当前剩余会员月数:"+month+" x 月均价"+monthAvg+"="+(DoubleCalculate.multiply(monthAvg, month)+",大于升级原所需金额500,本次升级无需扣费,但剩余L3月数清零");
|
||||
info.setFormula(formula);
|
||||
}
|
||||
//info.setValue(DoubleCalculate.subtract(basePrice,(DoubleCalculate.multiply(monthAvg,month))));
|
||||
//String formula = ""+basePrice+"-(原会员月均价"+monthAvg+" x 剩余会员月数"+month+")="+info.getValue();
|
||||
//System.out.println("formula"+formula);
|
||||
//info.setFormula(formula);
|
||||
|
||||
System.out.println("info"+info);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public ReduceResultDto reduceBalance(Long userId, BigDecimal price){
|
||||
ReduceResultDto dto = new ReduceResultDto();
|
||||
//查询账户表 判断余额是否充足 充足就执行扣款、升级、修改订单状态 失败则修改订单状态并提示用户余额不足
|
||||
UserAccountDto userAccount = orderMapper.getUserAccountByUserId(userId);
|
||||
UserBalance userBalance = new UserBalance();
|
||||
if(StringUtils.isNotNull(userAccount)){
|
||||
userAccount.setTotal(userAccount.getUsdt().add(userAccount.getUsdc()).add(userAccount.getBusd()));
|
||||
}else {
|
||||
userAccount = new UserAccountDto();
|
||||
}
|
||||
|
||||
if(userAccount.getTotal().compareTo(price) >= 0){
|
||||
//余额充足
|
||||
//先扣款 扣款成功再升级用户
|
||||
UserAccountDto newAccount = new UserAccountDto();
|
||||
BeanUtils.copyProperties(userAccount,newAccount);
|
||||
if(newAccount.getUsdt().compareTo(price) >=0){
|
||||
//usdt足够支付
|
||||
newAccount.setUsdt(newAccount.getUsdt().subtract(price));
|
||||
userBalance.setBalanceUSDT(price);
|
||||
}else{
|
||||
//usdt不够支付 继续判断usdc
|
||||
price = price.subtract(newAccount.getUsdt());
|
||||
userBalance.setBalanceUSDT(newAccount.getUsdt());
|
||||
newAccount.setUsdt(BigDecimal.valueOf(0));
|
||||
if(newAccount.getUsdc().compareTo(price) >=0){
|
||||
newAccount.setUsdc(newAccount.getUsdc().subtract(price));
|
||||
userBalance.setBalanceUSDC(price);
|
||||
}else {
|
||||
price = price.subtract(newAccount.getUsdc());
|
||||
userBalance.setBalanceUSDC(newAccount.getUsdc());
|
||||
newAccount.setUsdc(BigDecimal.valueOf(0));
|
||||
if(newAccount.getBusd().compareTo(price) >=0){
|
||||
newAccount.setBusd(newAccount.getBusd().subtract(price));
|
||||
userBalance.setBalanceUSDC(price);
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//先修改用户对应的账户余额表
|
||||
if(orderMapper.updateUserAccount(newAccount,userAccount.getUsdt(),userAccount.getUsdc(),userAccount.getBusd())){
|
||||
dto.setUa(userAccount);
|
||||
dto.setUb(userBalance);
|
||||
return dto;
|
||||
}else {
|
||||
//余额不足 此情况说明有其他线程先抢占了资源 更改了数据库数据 重新获取余额再次进行判断
|
||||
//throw new RuntimeException("余额不足");
|
||||
return null;
|
||||
}
|
||||
}else {
|
||||
//余额不足 修改订单状态为失败并提示用户余额不足
|
||||
//throw new RuntimeException("余额不足");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public boolean reduce(){
|
||||
//查询用户当前账户详情
|
||||
UserAccountDto account = orderMapper.getUserAccountByUserId(SecurityUtils.getUserId());
|
||||
System.out.println(account.getUsdt());
|
||||
if(account.getUsdt().compareTo(BigDecimal.valueOf(100) ) < 0){
|
||||
throw new RuntimeException("余额不足");
|
||||
}
|
||||
UserAccountDto newAccount = new UserAccountDto();
|
||||
BeanUtils.copyProperties(account,newAccount);
|
||||
|
||||
newAccount.setUsdt(newAccount.getUsdt().subtract(BigDecimal.valueOf(100)));
|
||||
boolean result = orderMapper.updateUserAccount(newAccount, account.getUsdt(), account.getUsdc(), account.getBusd());
|
||||
if(!result){
|
||||
throw new RuntimeException("余额状态更新,请重试");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,257 @@
|
||||
package com.jxy.order.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.jxy.common.core.RedisTransKey;
|
||||
import com.jxy.common.core.Result.R;
|
||||
import com.jxy.common.core.utils.DateUtils;
|
||||
import com.jxy.common.core.utils.StringUtils;
|
||||
import com.jxy.common.core.web.Result.AjaxResult;
|
||||
import com.jxy.common.redis.service.RedisService;
|
||||
import com.jxy.common.security.utils.SecurityUtils;
|
||||
import com.jxy.order.dto.*;
|
||||
import com.jxy.order.entity.UserBalance;
|
||||
import com.jxy.order.mapper.OrderMapper;
|
||||
import com.jxy.order.mapper.WithdrawMapper;
|
||||
import com.jxy.order.service.OrderService;
|
||||
import com.jxy.order.service.WithdrawService;
|
||||
import com.jxy.order.vo.*;
|
||||
import com.jxy.system.api.RemoteMailService;
|
||||
import com.jxy.system.api.RemoteUserService;
|
||||
import com.jxy.system.api.entity.EmailCodeEntity;
|
||||
import com.jxy.system.api.entity.EmailEntity;
|
||||
import com.jxy.system.api.entity.GetEmailCodeEntity;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description 提现服务业务层
|
||||
* @Date 2023/5/31 15:22
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Service
|
||||
public class WithdrawServiceImpl implements WithdrawService {
|
||||
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
@Autowired
|
||||
private RemoteMailService remoteMailService;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private WithdrawMapper withdrawMapper;
|
||||
|
||||
@Autowired
|
||||
private OrderMapper orderMapper;
|
||||
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult apply(WithdrawApplyVo vo) {
|
||||
//先验证emailCode
|
||||
String email = SecurityUtils.getLoginUser().getSysUser().getEmail();
|
||||
if(redisService.hasKey(RedisTransKey.getAddCreditEmailKey(email))){
|
||||
Object o = redisService.getCacheObject(RedisTransKey.getAddCreditEmailKey(email));//user:emailCode:username
|
||||
|
||||
EmailCodeEntity emailCodeEntity1 = JSON.parseObject(JSON.toJSONString(o), EmailCodeEntity.class);
|
||||
System.out.println(emailCodeEntity1);
|
||||
|
||||
//JSONObject.parseObject()
|
||||
EmailCodeEntity emailCodeEntity = JSON.parseObject(JSON.toJSONString(o), EmailCodeEntity.class);
|
||||
//验证验证码
|
||||
if(!vo.getEmailCode().equals(emailCodeEntity.getEmailCode())){
|
||||
return AjaxResult.error("邮箱验证码错误");
|
||||
}
|
||||
}else {
|
||||
return AjaxResult.error("验证码未获取或已过期,请重新获取验证码");
|
||||
}
|
||||
//生成提现订单
|
||||
UserAccountDto userAccount = orderMapper.getUserAccountByUserId(SecurityUtils.getUserId());
|
||||
UserAccountDto newAccount = new UserAccountDto();
|
||||
BeanUtils.copyProperties(userAccount,newAccount);
|
||||
if("USDT".equals(vo.getCoin())){
|
||||
if(userAccount.getUsdt().compareTo(vo.getAmount()) < 0){
|
||||
//余额不足
|
||||
return AjaxResult.error("余额不足,当前USDT余额为"+userAccount.getUsdt());
|
||||
}else {
|
||||
newAccount.setUsdt(newAccount.getUsdt().subtract(vo.getAmount()));
|
||||
}
|
||||
}
|
||||
|
||||
if("USDC".equals((vo.getCoin()))){
|
||||
if(userAccount.getUsdc().compareTo(vo.getAmount()) < 0){
|
||||
//余额不足
|
||||
return AjaxResult.error("余额不足,当前USDC余额为"+userAccount.getUsdc());
|
||||
}else {
|
||||
newAccount.setUsdc(newAccount.getUsdc().subtract(vo.getAmount()));
|
||||
}
|
||||
}
|
||||
|
||||
if("BUSD".equals((vo.getCoin()))){
|
||||
if(userAccount.getBusd().compareTo(vo.getAmount()) < 0){
|
||||
return AjaxResult.error("余额不足,当前BUSD余额为"+userAccount.getBusd());
|
||||
}
|
||||
else {
|
||||
newAccount.setBusd(newAccount.getBusd().subtract(vo.getAmount()));
|
||||
}
|
||||
}
|
||||
|
||||
//余额充足 生成提现订单
|
||||
vo.setUserId(SecurityUtils.getUserId());
|
||||
if(withdrawMapper.insertWithdraw(vo)){
|
||||
//扣除余额
|
||||
if(orderMapper.updateUserAccount(newAccount,userAccount.getUsdt(),userAccount.getUsdc(),userAccount.getBusd())){
|
||||
//记录此时用户的账户余额
|
||||
return AjaxResult.success("提现申请已提交,稍后可在提现申请记录查询提现订单处理结果");
|
||||
}else {
|
||||
return AjaxResult.error("提现申请处理期间余额有变动,提现申请失败,请稍后再试。");
|
||||
}
|
||||
}else {
|
||||
return AjaxResult.error("服务器繁忙,请稍后重试");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getDetail(Long id) {
|
||||
|
||||
WithdrawDetailDto detail = withdrawMapper.getWithdrawDetailById(id);
|
||||
|
||||
if(StringUtils.isNull(detail)){
|
||||
return AjaxResult.error("未查询到对应订单,请检查传参,并稍后再试");
|
||||
}
|
||||
|
||||
detail.setAppliedTime(DateUtils.addHours(detail.getAppliedTime(),16));
|
||||
|
||||
UserAccountDto account = orderMapper.getUserAccountByUserId(detail.getUserId());
|
||||
if("USDT".equals(detail.getCoin().toUpperCase())){
|
||||
detail.setBalance(account.getUsdt());
|
||||
}else if("USDC".equals(detail.getCoin().toUpperCase())){
|
||||
detail.setBalance(account.getUsdc());
|
||||
}else if("BUSD".equals(detail.getCoin().toUpperCase())){
|
||||
detail.setBalance(account.getBusd());
|
||||
}
|
||||
|
||||
return AjaxResult.success(detail);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult handle(WithdrawHandleVo vo) {
|
||||
|
||||
WithdrawDetailDto dto = withdrawMapper.getWithdrawDetailById(vo.getId());
|
||||
|
||||
if(vo.getOper() == 1){
|
||||
//通过 需要填入实退时间、实退金额、实退txid
|
||||
if(StringUtils.isBlank(vo.getRefundTxid())){
|
||||
return AjaxResult.error("通过提现申请需要提供实退txid");
|
||||
}
|
||||
if(StringUtils.isBlank(vo.getRefundAddress())){
|
||||
return AjaxResult.error("通过提现申请需要提供退款发起地址");
|
||||
}
|
||||
if(withdrawMapper.updateWithdraw(vo)){
|
||||
//更新成功 余额表记录信息
|
||||
UserBalance ub= new UserBalance();
|
||||
ub.setCoin(dto.getCoin());
|
||||
ub.setChain(dto.getChain());
|
||||
ub.setUserId(dto.getUserId());
|
||||
ub.setTxid(dto.getRefundTxid());
|
||||
|
||||
if("USDT".equals(dto.getCoin().toUpperCase())){
|
||||
ub.setBalanceUSDT(dto.getAmount());
|
||||
}
|
||||
if("USDC".equals(dto.getCoin().toUpperCase())){
|
||||
ub.setBalanceUSDC(dto.getAmount());
|
||||
}
|
||||
if("BUSD".equals(dto.getCoin().toUpperCase())){
|
||||
ub.setBalanceBUSD(dto.getAmount());
|
||||
}
|
||||
ub.setNotes(2);
|
||||
ub.setMessage("用户提现通过,提现金额:"+dto.getAmount());
|
||||
if(orderMapper.insertUserBalance(ub)){
|
||||
////插入成功 发送邮件通知用户
|
||||
EmailEntity entity = new EmailEntity();
|
||||
entity.setEmail(SecurityUtils.getLoginUser().getSysUser().getEmail());
|
||||
entity.setSubject("账户提现结果返回");
|
||||
entity.setText("提现成功,可在网站查看提现详情!");
|
||||
remoteMailService.sendTextMail(entity);
|
||||
}else {
|
||||
//修改失败
|
||||
}
|
||||
return AjaxResult.success("提现申请已通过");
|
||||
}else{
|
||||
return AjaxResult.error("服务器忙,请稍后再试");
|
||||
}
|
||||
}else if(vo.getOper() == 0) {
|
||||
//拒绝 需要填写msg
|
||||
if(StringUtils.isBlank(vo.getMsg())){
|
||||
return AjaxResult.error("拒绝请写备注信息,后台此时未收到备注信息");
|
||||
}
|
||||
|
||||
//WithdrawDetailDto dto = withdrawMapper.getWithdrawDetailById(vo.getId());
|
||||
if(withdrawMapper.updateWithdraw(vo)){
|
||||
//todo rabbitMQ通知提现结果
|
||||
//加回用户余额
|
||||
orderService.updateUserAccountAfterRefuseWithdraw(dto.getUserId(), dto.getCoin(), dto.getAmount());
|
||||
return AjaxResult.success("提现申请已拒绝");
|
||||
}else{
|
||||
return AjaxResult.error("数据库修改失败,请稍后再试");
|
||||
}
|
||||
|
||||
}else {
|
||||
return AjaxResult.error("操作传参有误,请检查传参");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WithdrawPraviteDto> privateWithdraw(OrderStatusVo vo) {
|
||||
|
||||
List<WithdrawPraviteDto> list = withdrawMapper.getWithdrawByUserId(SecurityUtils.getUserId(),vo.getStatus());
|
||||
//list.stream().forEach(e ->{
|
||||
// e.setAppliedTime(DateUtils.addHours(e.getAppliedTime(),16));
|
||||
//});
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WithdrawDto> getAllWithdraw(OrderStatusVo vo) {
|
||||
|
||||
if(StringUtils.isNotBlank(vo.getAddress())){
|
||||
//address有传参需要格式验证
|
||||
String em = "^[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$";
|
||||
if(!vo.getAddress().matches(em)){
|
||||
//address接收到的不是邮箱 则返回空list
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
List<WithdrawDto> list = withdrawMapper.getWithdrawByStatus(vo.getStatus(),vo.getAddress());
|
||||
//list.stream().forEach(e ->{
|
||||
// e.setAppliedTime(DateUtils.addHours(e.getAppliedTime(),16));
|
||||
//});
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult sendAddCreditEmail() {
|
||||
GetEmailCodeEntity entity = new GetEmailCodeEntity();
|
||||
entity.setEmail(SecurityUtils.getLoginUser().getSysUser().getEmail());
|
||||
entity.setUserName( SecurityUtils.getUsername());
|
||||
R<?> result = remoteMailService.sendAddCreditEmailCode(entity);
|
||||
System.out.println(result);
|
||||
if (result.getCode() == 200){
|
||||
return AjaxResult.success("邮箱发送成功,有效期十分钟,请注意查收。");
|
||||
}else {
|
||||
return AjaxResult.error("邮箱发送成功,有效期十分钟,请注意查收!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
//package com.jxy.order.task;
|
||||
//
|
||||
//import com.jxy.common.core.utils.DateUtils;
|
||||
//import com.jxy.common.core.utils.StringUtils;
|
||||
//import com.jxy.common.redis.service.RedisService;
|
||||
//import com.jxy.order.dto.WithdrawPraviteDto;
|
||||
//import com.jxy.order.mapper.OrderMapper;
|
||||
//import com.jxy.order.mapper.WithdrawMapper;
|
||||
//import com.jxy.order.service.OrderService;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
//import org.springframework.scheduling.annotation.Scheduled;
|
||||
//
|
||||
//import java.util.Calendar;
|
||||
//import java.util.Date;
|
||||
//import java.util.List;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * @Description 超时订单定时任务
|
||||
// * @Date 2022/7/7 18:03
|
||||
// * @Author 杜懿
|
||||
// */
|
||||
//@Configuration
|
||||
//@EnableScheduling
|
||||
//public class ExpireOrderTask {
|
||||
//
|
||||
// @Autowired
|
||||
// private OrderService orderService;
|
||||
//
|
||||
// @Autowired
|
||||
// private OrderMapper orderMapper;
|
||||
//
|
||||
// @Autowired
|
||||
// private WithdrawMapper withdrawMapper;
|
||||
//
|
||||
//
|
||||
// /** 查询超时未处理的待处理充值订单 */
|
||||
// @Scheduled(cron = "0 22 0/4 * * ?")
|
||||
// //@Scheduled(cron = "0 0/5 * * * ?")
|
||||
// public void ExpireAddCredit(){
|
||||
//
|
||||
//
|
||||
// //orderMapper.getAddCreditOrderByStatus();
|
||||
// }
|
||||
//
|
||||
// /** 查询并处理超时未处理的待处理提现订单 */
|
||||
// //@Scheduled(cron = "0 0/5 * * * ?")
|
||||
// @Scheduled(cron = "0 0/5 * * * ?")
|
||||
// public void ExpireWithdraw(){
|
||||
// Date date = new Date();
|
||||
// Calendar calendar = Calendar.getInstance();
|
||||
// calendar.setTime(date);
|
||||
// calendar.add(Calendar.DATE,-1);
|
||||
//
|
||||
// System.out.println("扫描超时订单,时间:"+calendar.getTime());
|
||||
//
|
||||
// List<WithdrawPraviteDto> list= withdrawMapper.getExpireNoHandleWithdrawOrder(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, calendar.getTime()));
|
||||
// System.out.println("超时提现订单有:"+list);
|
||||
//
|
||||
// if(list.size()>0){
|
||||
// int count = withdrawMapper.batchUpdateExpireWithdraw(list);
|
||||
// for (int i=0; i< list.size();i++) {
|
||||
// WithdrawPraviteDto dto = list.get(i);
|
||||
// orderService.updateUserAccountAfterRefuseWithdraw(dto.getUserId(), dto.getCoin(), dto.getAmount());
|
||||
// }
|
||||
// System.out.println("处理了"+count+"条超时提现订单");
|
||||
// }
|
||||
// //orderMapper.getAddCreditOrderByStatus();
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description 充值订单请求数据
|
||||
* @Date 2023/5/4 15:47
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class AddCreditOrderVo {
|
||||
|
||||
/** 币种 */
|
||||
@NotNull
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
@NotNull
|
||||
private String chain;
|
||||
|
||||
/** 收款地址 */
|
||||
private String address;
|
||||
|
||||
/** 支付的交易id由用户支付后提供 */
|
||||
private String txid;
|
||||
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import redis.clients.jedis.JedisPubSub;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/29 15:28
|
||||
* @Author 杜懿
|
||||
*/
|
||||
public class ChannelListener extends JedisPubSub {
|
||||
public ChannelListener() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(String channel, String message) { // 收到消息会调用
|
||||
// 下面可以写你的业务处理代码
|
||||
System.out.println(String.format("收到消息成功! channel: %s, message: %s", channel, message));
|
||||
if (message.equals("close"))
|
||||
this.unsubscribe("可填,不填就全部主题关闭订阅了");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscribe(String channel, int subscribedChannels) { // 订阅频道会调用
|
||||
System.out.println(String.format("订阅频道成功! channel: %s, subscribedChannels %d", channel, subscribedChannels));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnsubscribe(String channel, int subscribedChannels) { // 取消订阅会调用
|
||||
System.out.println(String.format("取消订阅频道! channel: %s, subscribedChannels: %d", channel, subscribedChannels));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/4 15:47
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class HandleAddCreditOrderVo {
|
||||
|
||||
/** 操作 0拒绝 1通过 */
|
||||
private int oper=0;
|
||||
|
||||
/** 转账记录id 订单id */
|
||||
@NotNull
|
||||
private long transferId;
|
||||
|
||||
//由链上查询的实际转账金额
|
||||
private BigDecimal amount;
|
||||
|
||||
private String address;
|
||||
|
||||
/** */
|
||||
private String txid;
|
||||
|
||||
private String message;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Description 升级vo
|
||||
* @Date 2023/5/4 15:47
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class LevelUpVo {
|
||||
|
||||
/** 购买的会员类型 0月度付费 1年度付费 2年度VIP */
|
||||
private int type=0;
|
||||
|
||||
/** 币种 */
|
||||
//@NotNull
|
||||
private String coin;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 充值订单入库数据
|
||||
* @Date 2023/5/18 14:16
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class OrderChangeByTxidVo {
|
||||
|
||||
|
||||
/** 订单id */
|
||||
private long orderId;
|
||||
|
||||
/** 支付的交易id由用户支付后提供 */
|
||||
private String txid;
|
||||
|
||||
/** 币种 */
|
||||
@NotNull
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
@NotNull
|
||||
private String chain;
|
||||
|
||||
/** 收款地址 */
|
||||
private String address;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 充值订单入库数据
|
||||
* @Date 2023/5/18 14:16
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class OrderIdVo {
|
||||
|
||||
|
||||
/** 订单id */
|
||||
@NotNull
|
||||
private long orderId;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/4 15:47
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class OrderQueryVo {
|
||||
|
||||
/** 购买的会员类型 0月度付费 1年度付费 2年度VIP */
|
||||
private int type=0;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String amount;
|
||||
|
||||
/** 币种 */
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
private String payNet;
|
||||
|
||||
/** 收款地址 */
|
||||
private String address;
|
||||
|
||||
/** 支付的交易id由用户支付后提供 */
|
||||
private String txid;
|
||||
|
||||
private String status;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Description 状态查询订单列表请求头 分页
|
||||
* @Date 2023/5/4 15:47
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class OrderStatusVo extends PageVo{
|
||||
|
||||
private Integer status;
|
||||
|
||||
/** 邮箱验证 此处是由address查询修改为eamil 为了保持参数 暂时使用address接收email*/
|
||||
private String address;
|
||||
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description 接口请求基础信息
|
||||
* @Date 2022/5/27 10:52
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class PageVo {
|
||||
|
||||
//起始页数 默认为1
|
||||
@JsonAlias("page")
|
||||
private Integer pageNum=1;
|
||||
|
||||
//分页大小 默认50
|
||||
@JsonAlias("limit")
|
||||
private Integer pageSize=50;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/4 15:47
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class ReceivingVo {
|
||||
|
||||
/** 支付网络 */
|
||||
@NotNull
|
||||
private String payNet;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import cn.hutool.core.annotation.Alias;
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description 接口请求基础信息
|
||||
* @Date 2022/5/27 10:52
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class StatusPageVo {
|
||||
|
||||
//起始页数 默认为1
|
||||
@JsonAlias("page")
|
||||
private Integer pageNum=1;
|
||||
|
||||
//分页大小 默认50
|
||||
@JsonAlias("limit")
|
||||
private Integer pageSize=50;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import com.jxy.common.core.utils.sign.Rsa2Utils;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/30 17:21
|
||||
* @Author 杜懿
|
||||
*/
|
||||
public class TEst {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String a ="0x06e810184b1959f7665f2236dc3e6463258effd28743dd5d6f5e3ef60bfa6b20";
|
||||
//String en = "wYy5PtlRvQsAMHnO80SY5icK1VM9yVwZAEoqUaI7I0uQyFo7MlNWUbD9YO23robBWTIxBEtDkh/ueA8H9w2/CpsMSFvxaEaY9X6fXckjsU0v157+tcBt5D9E8Tk6/mKx/ogDeAFt38Clp12/ULEMyKVShfRUcv4aeVYG+I2Ou8M=";
|
||||
String test1 ="G/yQm4q1J5Gp69Su0PrS64j0NUfeWsCKIkc3+/al2Qz8p8weqIcgPFCStmxkOSvRkeg+V6jnp3hSPPmMdm28VqqOuvxP9toVXbXKuQ8j5U/j8GoPKiwfRpVuGf02GIFm+zVipRmD/IZEk9Ie1CNhMVflYXslLo2lLjmH4GOXRWM=";
|
||||
//String path1 ="D:\\JXYS\\Tools\\pk.ppk";
|
||||
//String pk1 = FileUtils.readFileToString(new File(path1), StandardCharsets.UTF_8);
|
||||
//System.out.println(pk1);
|
||||
String en = Rsa2Utils.encryptByPublicKey(Rsa2Utils.publicKey,a);
|
||||
|
||||
String en2 = "G7kHYLrFVLJ+fteY1Y02gtun9BdcZt9kBue+Yhrxxv/pfqJGCvKMTM3dJRPBKC7Igop6NRWSKDeZ9dfXbkCo2Uxv3OHE2nU/e0gLeBqyNF3jKyQvF//mb4p5ea2q5/z1i6kPDT24kgCo6F7aLHwJU0joTDJJEQjotISzKPwYDoE=";
|
||||
String en3 = "ro3ODLHyQFEjgvk+df+4ek+ArYFbkFXIBp9vW0jEsP6LDb/3S2cr0VpGkYy2biPMD12kl5QTxIsWYSANGU/GhVLQsYybxtWFD9ku94PXNeCCGe1HRy3FJF5XQnHLjmOCmDQwDgvjXkEKlW6FVcp+M0rr1JquLwEI25DEGDQNfTw=";
|
||||
|
||||
System.out.println("加密得到:"+en);
|
||||
System.out.println(en.length());
|
||||
String path ="D:\\JXYS\\Tools\\pv.pem";
|
||||
String pk = FileUtils.readFileToString(new File(path), StandardCharsets.UTF_8);
|
||||
String s ="g8z7Tg/TK0FWXdjUekabz91TERElKHvgJY479xq1TVFMSZo1FL5P6g+nLu+Z6nHPIFUmr8nWgJfAn0vRT9eBEusxdZNNsaVKWI2CvqIrTEvKuxs2yWF5HzxWJoXUpvB4JhS2s5ZO7x8bKWoNVHEf8OVvFhj1o56vPTSZzes0dTdfWRgQE/uFwSO0rUeSicsp57c6NltQ2ZkTVM1Acy+c686JTR/U+dRBuVH9PlMpmdUgzLjAWcfH8WFuNrZxEHSLDG9d6fSgMjLb0hDNktPV7ZOAmdp/s9U8u80xwnilHQ1RwIGOGmmlg/3TpU1RpINN4U8dLGO//o8i4pKhe7Dm3g==";
|
||||
String s1 = Rsa2Utils.decryptByPrivateKey(Rsa2Utils.privateKey,en);
|
||||
String s2 = Rsa2Utils.decryptByPrivateKey(Rsa2Utils.privateKey,en2);
|
||||
String s3 = Rsa2Utils.decryptByPrivateKey(Rsa2Utils.privateKey,en3);
|
||||
String s4 = Rsa2Utils.decryptByPrivateKey(Rsa2Utils.privateKey,test1);
|
||||
|
||||
System.out.println("解密结果"+s1);
|
||||
System.out.println("s2解密结果"+s2);
|
||||
System.out.println("s3解密结果"+s3);
|
||||
System.out.println(s4);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/30 17:21
|
||||
* @Author 杜懿
|
||||
*/
|
||||
public class TEst2 {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPubSub;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/29 15:24
|
||||
* @Author 杜懿
|
||||
*/
|
||||
public class TestJdis {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Jedis jr = null;
|
||||
try {
|
||||
jr = new Jedis("10.168.2.197", 6379, 0);
|
||||
//jr = new Jedis("10.168.2.125", 6379, 0);
|
||||
jr.auth("");
|
||||
|
||||
// jr客户端配置监听两个channel
|
||||
jr.subscribe(new JedisPubSub() {
|
||||
@Override
|
||||
public void onMessage(String channel, String message) {
|
||||
super.onMessage(channel, message);
|
||||
System.out.println("订阅主题:"+channel+",收到消息"+message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSubscribedChannels() {
|
||||
return super.getSubscribedChannels();
|
||||
}
|
||||
}, "kline");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (jr != null) {
|
||||
jr.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* @Description 充值订单入库数据
|
||||
* @Date 2023/5/18 14:16
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class TotalAddressVo {
|
||||
|
||||
/** 地址 */
|
||||
@NotNull
|
||||
private String[] addresses;
|
||||
|
||||
@NotNull
|
||||
private String chain;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/4 15:47
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class WithdrawApplyVo {
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 币种 */
|
||||
private String coin;
|
||||
|
||||
/** 支付网络 */
|
||||
private String chain;
|
||||
|
||||
/** 收款地址 */
|
||||
private String address;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String emailCode;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Date 2023/5/4 15:47
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class WithdrawHandleVo {
|
||||
|
||||
private Long id;
|
||||
|
||||
//handle 0拒绝 1成功
|
||||
private int oper=2;
|
||||
|
||||
//private BigDecimal refund;
|
||||
|
||||
private String refundTxid;
|
||||
|
||||
//private String refundTime;
|
||||
|
||||
private String refundAddress;
|
||||
|
||||
private String msg;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.jxy.order.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description 提现申请单id
|
||||
* @Date 2023/5/4 15:47
|
||||
* @Author 杜懿
|
||||
*/
|
||||
@Data
|
||||
public class WithdrawIdVo {
|
||||
|
||||
private long id;
|
||||
|
||||
}
|
||||
29
jxy-modules/jxy-order/src/main/resources/bootstrap.yml
Normal file
29
jxy-modules/jxy-order/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
# Tomcat
|
||||
server:
|
||||
port: 8102
|
||||
compression:
|
||||
enabled: true
|
||||
mime-types: application/json
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
||||
application:
|
||||
# 应用名称
|
||||
name: jxy-order
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址 172.16.2.5
|
||||
server-addr: 127.0.0.1:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
74
jxy-modules/jxy-order/src/main/resources/logback.xml
Normal file
74
jxy-modules/jxy-order/src/main/resources/logback.xml
Normal file
@@ -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/jxy-order" />
|
||||
<!-- 日志输出格式 -->
|
||||
<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.jxy" 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,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.jxy.order.mapper.ConsumeMapper">
|
||||
|
||||
<select id="checkOrderIfExistByUserId" resultType="java.lang.Integer">
|
||||
select count(*) from `consume` where user_id=#{userId} and state = 2
|
||||
</select>
|
||||
<select id="getConsumeByUserId" resultType="com.jxy.order.entity.Consume">
|
||||
select
|
||||
id,
|
||||
user_id userId,
|
||||
content,
|
||||
need_funding amount,
|
||||
`state`,
|
||||
create_time createTime
|
||||
from
|
||||
consume
|
||||
<where>
|
||||
user_id =#{userId}
|
||||
<if test="state != null"> and `state` = #{state}</if>
|
||||
</where>
|
||||
order by create_time
|
||||
</select>
|
||||
|
||||
<insert id="insertConsume" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into consume(user_id,content,need_funding,`state`,create_time) values (
|
||||
#{dto.userId},#{dto.content},#{dto.amountReceivable},#{dto.status},sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateConsumeState">
|
||||
update
|
||||
consume
|
||||
set
|
||||
`state` = #{dto.status}
|
||||
where id = #{dto.id}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,276 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jxy.order.mapper.OrderMapper">
|
||||
|
||||
<insert id="insertAddressAndUserId">
|
||||
replace into user_address(
|
||||
user_id
|
||||
<if test="dto.address != null and dto.address != ''">,address</if>
|
||||
<if test="dto.addressBSC != null and dto.addressBSC != ''">,address_bsc</if>
|
||||
<if test="dto.addressTRX != null and dto.addressTRX != ''">,address_trx</if>
|
||||
) values (
|
||||
#{dto.userId}
|
||||
<if test="dto.address != null and dto.address != ''">,#{dto.address}</if>
|
||||
<if test="dto.addressBSC != null and dto.addressBSC != ''">,#{dto.addressBSC}</if>
|
||||
<if test="dto.addressTRX != null and dto.addressTRX != ''">,#{dto.addressTRX}</if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertAddCreditOrder" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into transfer(user_id,txid,address,coin,`chain`,status,update_time,create_time) values (
|
||||
#{dto.userId},#{dto.txid},#{dto.address},#{dto.coin},#{dto.chain},#{dto.status},sysdate(),#{dto.createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertUserAccount">
|
||||
insert into user_account(user_id,usdt,usdc,busd) values (
|
||||
#{dto.userId},#{dto.usdt},#{dto.usdc},#{dto.busd}
|
||||
) ON duplicate key update user_id=user_id
|
||||
</insert>
|
||||
|
||||
<insert id="insertUserBalance">
|
||||
insert into user_balance(
|
||||
user_id,
|
||||
txid,
|
||||
<if test="dto.coin != null and dto.coin !=''"> coin,</if>
|
||||
<if test="dto.chain != null and dto.chain !=''">`chain`,</if>
|
||||
balance_usdt,
|
||||
balance_usdc,
|
||||
balance_busd,
|
||||
<if test="dto.message != null and dto.message !=''">message,</if>
|
||||
notes,
|
||||
update_time)
|
||||
values (
|
||||
#{dto.userId},
|
||||
#{dto.txid},
|
||||
<if test="dto.coin != null and dto.coin !=''">#{dto.coin},</if>
|
||||
<if test="dto.chain != null and dto.chain !=''">#{dto.chain},</if>
|
||||
#{dto.balanceUSDT},
|
||||
#{dto.balanceUSDC},
|
||||
#{dto.balanceBUSD},
|
||||
<if test="dto.message != null and dto.message !=''">#{dto.message}, </if>
|
||||
#{dto.notes},
|
||||
sysdate())
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertTotalAddress">
|
||||
insert into total_address(address) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item})
|
||||
</foreach>
|
||||
ON duplicate KEY UPDATE address= VALUES(address)
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertBSCTotalAddress">
|
||||
insert into total_address_bsc(address) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item})
|
||||
</foreach>
|
||||
ON duplicate KEY UPDATE address= VALUES(address)
|
||||
</insert>
|
||||
<insert id="batchInsertTRXTotalAddress">
|
||||
insert into total_address_trx(address) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item})
|
||||
</foreach>
|
||||
ON duplicate KEY UPDATE address= VALUES(address)
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="checkTxidIfExist" resultType="java.lang.Integer">
|
||||
select count(*) from transfer where txid = #{txid}
|
||||
</select>
|
||||
|
||||
<select id="getAddCreditOrderByUserId" resultType="com.jxy.order.entity.AddCreditOrder">
|
||||
select
|
||||
id,
|
||||
user_id userId,
|
||||
txid,
|
||||
address,
|
||||
coin,
|
||||
`chain`,
|
||||
amount,
|
||||
status,
|
||||
update_time updateTime,
|
||||
create_time createTime
|
||||
from
|
||||
transfer
|
||||
<where>
|
||||
user_id =#{userId}
|
||||
<if test ="status != null"> and status = #{status}</if>
|
||||
</where>
|
||||
order by update_time
|
||||
</select>
|
||||
|
||||
<select id="getAddCreditOrderById" resultType="com.jxy.order.entity.AddCreditOrder">
|
||||
select
|
||||
id,
|
||||
user_id userId,
|
||||
txid,
|
||||
address,
|
||||
coin,
|
||||
`chain`,
|
||||
status,
|
||||
update_time updateTime,
|
||||
create_time createTime
|
||||
from
|
||||
transfer
|
||||
where
|
||||
id =#{id}
|
||||
order by update_time desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="getUserAccountByUserId" resultType="com.jxy.order.dto.UserAccountDto">
|
||||
select
|
||||
user_id userId,
|
||||
usdt,
|
||||
usdc,
|
||||
busd
|
||||
from
|
||||
user_account
|
||||
where
|
||||
user_id =#{userId}
|
||||
</select>
|
||||
|
||||
<select id="getAddressByUserId" resultType="com.jxy.order.entity.UserAddress">
|
||||
select
|
||||
user_id userId,
|
||||
address,
|
||||
address_bsc as addressBSC,
|
||||
address_trx as addressTRX
|
||||
from
|
||||
user_address
|
||||
where
|
||||
user_id = #{userId} limit 1
|
||||
</select>
|
||||
|
||||
<select id="getAddressNoUse" resultType="java.lang.String">
|
||||
select address from ${table} where if_use = 0 limit 1;
|
||||
</select>
|
||||
|
||||
<select id="getAddCreditOrderByOrderIdAndUserId" resultType="com.jxy.order.entity.AddCreditOrder">
|
||||
select
|
||||
id,
|
||||
user_id userId,
|
||||
txid,
|
||||
address,
|
||||
coin,
|
||||
`chain`,
|
||||
status,
|
||||
update_time updateTime,
|
||||
create_time createTime
|
||||
from
|
||||
transfer
|
||||
where
|
||||
id =#{orderId}
|
||||
and user_id = #{userId}
|
||||
order by update_time desc limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getAddCreditOrderByStatus" resultType="com.jxy.order.dto.AddCreditOrderDto">
|
||||
select
|
||||
t.id,
|
||||
t.user_id userId,
|
||||
u.email email,
|
||||
t.txid,
|
||||
t.address,
|
||||
t.coin,
|
||||
t.`chain`,
|
||||
t.amount,
|
||||
t.status,
|
||||
t.update_time updateTime,
|
||||
t.create_time createTime
|
||||
from
|
||||
transfer t
|
||||
left join jxy_cloud.sys_user u on t.user_id = u.user_id
|
||||
<where>
|
||||
<if test="vo.userId != null and vo.userId !=0"> and t.user_id = #{vo.userId}</if>
|
||||
<if test="vo.status != null"> and t.status = #{vo.status}</if>
|
||||
</where>
|
||||
order by t.update_time
|
||||
</select>
|
||||
<select id="getExpireNoHandleAddCreditOrder" resultType="com.jxy.order.entity.AddCreditOrder">
|
||||
select
|
||||
id,
|
||||
user_id userId,
|
||||
txid,
|
||||
address,
|
||||
coin,
|
||||
`chain`,
|
||||
amount,
|
||||
status,
|
||||
update_time updateTime,
|
||||
create_time createTime
|
||||
from
|
||||
transfer
|
||||
<where>
|
||||
status = 2
|
||||
<if test="vo.userId != null and vo.userId !=0"> and user_id = #{vo.userId}</if>
|
||||
<if test="vo.address != null and vo.address !=''"> and address = #{vo.address}</if>
|
||||
</where>
|
||||
order by update_time
|
||||
</select>
|
||||
<select id="getAddressNoUsedCount" resultType="java.lang.Integer">
|
||||
select count(*) from total_address where if_use = 0;
|
||||
</select>
|
||||
|
||||
<select id="getAllAddress" resultType="com.jxy.order.entity.AddressInfo">
|
||||
select
|
||||
address,
|
||||
case if_use when 0 then '未使用' when 1 then '已使用' end status
|
||||
from
|
||||
total_address
|
||||
<where>
|
||||
<if test="status != null and status !=''">
|
||||
if_use = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getUserIdByEmail" resultType="java.lang.Long">
|
||||
select user_id from jxy_cloud.sys_user where email=#{email}
|
||||
</select>
|
||||
|
||||
<update id="updateAddressToUse">
|
||||
update
|
||||
${table}
|
||||
set
|
||||
if_use = 1
|
||||
where address = #{address} and if_use = 0
|
||||
</update>
|
||||
|
||||
<update id="updateOrderStatusById">
|
||||
update
|
||||
transfer
|
||||
set
|
||||
status = #{vo.oper},
|
||||
update_time = sysdate()
|
||||
where id = #{vo.transferId}
|
||||
</update>
|
||||
|
||||
<update id="updateUserAccount">
|
||||
update
|
||||
user_account
|
||||
set
|
||||
usdt = #{dto.usdt},
|
||||
usdc = #{dto.usdc},
|
||||
busd = #{dto.busd}
|
||||
where user_id = #{dto.userId}
|
||||
and usdt = #{usdt} and usdc =#{usdc} and busd=#{busd}
|
||||
</update>
|
||||
<update id="updateOrdersById">
|
||||
update
|
||||
transfer
|
||||
set
|
||||
txid = #{vo.txid},
|
||||
amount = #{vo.amount},
|
||||
status = #{vo.oper},
|
||||
update_time = sysdate()
|
||||
where id = #{vo.transferId}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.jxy.order.mapper.WithdrawMapper">
|
||||
<insert id="insertWithdraw">
|
||||
insert into withdraw(user_id,applied_amount,applied_coin,applied_chain,applied_address,applied_time,status) values (
|
||||
#{vo.userId},#{vo.amount},#{vo.coin},#{vo.chain},#{vo.address},sysdate(),2
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateWithdraw">
|
||||
update
|
||||
withdraw
|
||||
<set>
|
||||
<if test="vo.msg != null and vo.msg != ''">
|
||||
message = #{vo.msg},
|
||||
</if>
|
||||
<if test="vo.refundTxid != null and vo.refundTxid != ''">
|
||||
refund_txid = #{vo.refundTxid},
|
||||
</if>
|
||||
<if test="vo.refundAddress != null and vo.refundAddress != ''">
|
||||
refund_address = #{vo.refundAddress},
|
||||
</if>
|
||||
refund_time = sysdate(),
|
||||
status = #{vo.oper}
|
||||
</set>
|
||||
where id = #{vo.id}
|
||||
</update>
|
||||
|
||||
<update id="batchUpdateExpireWithdraw">
|
||||
update withdraw set status = 0 where id in
|
||||
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
and status = 2
|
||||
</update>
|
||||
|
||||
|
||||
<select id="getWithdrawByUserId" resultType="com.jxy.order.dto.WithdrawPraviteDto">
|
||||
select
|
||||
id,
|
||||
user_id userId,
|
||||
applied_amount amount,
|
||||
applied_coin coin,
|
||||
applied_chain chain,
|
||||
applied_address userAddress,
|
||||
applied_time appliedTime,
|
||||
status,
|
||||
refund,
|
||||
refund_time refundTime,
|
||||
refund_txid refundTxid,
|
||||
message
|
||||
from
|
||||
withdraw
|
||||
<where>
|
||||
user_id =#{userId}
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
</where>
|
||||
order by applied_time desc
|
||||
</select>
|
||||
|
||||
<select id="getWithdrawByStatus" resultType="com.jxy.order.dto.WithdrawDto">
|
||||
select
|
||||
w.id,
|
||||
w.user_id userId,
|
||||
u.email email,
|
||||
a.address userAddress,
|
||||
w.applied_amount appliedAmount,
|
||||
w.applied_coin coin,
|
||||
w.applied_chain chain,
|
||||
w.applied_address appliedAddress,
|
||||
w.applied_time appliedTime,
|
||||
w.refund_address refundAddress,
|
||||
w.refund_txid refundTxid,
|
||||
w.status,
|
||||
ac.usdt usdt,
|
||||
ac.usdc usdc,
|
||||
ac.busd busd
|
||||
from
|
||||
withdraw w left join user_address a on w.user_id = a.user_id
|
||||
left join jxy_cloud.sys_user u on u.user_id = w.user_id
|
||||
left join user_account ac on w.user_id = ac.user_id
|
||||
<where>
|
||||
<if test="status != null "> and w.status = #{status}</if>
|
||||
<if test="email != null "> and u.email = #{email}</if>
|
||||
</where>
|
||||
order by w.applied_time desc
|
||||
</select>
|
||||
|
||||
<select id="getWithdrawDetailById" resultType="com.jxy.order.dto.WithdrawDetailDto">
|
||||
select
|
||||
w.id,
|
||||
w.user_id userId,
|
||||
u.email email,
|
||||
w.applied_amount amount,
|
||||
w.applied_coin coin,
|
||||
w.applied_chain chain,
|
||||
a.address userAddress,
|
||||
w.applied_address appliedAddress,
|
||||
w.applied_time appliedTime,
|
||||
w.status,
|
||||
w.refund,
|
||||
w.refund_time refundTime,
|
||||
w.refund_txid refundTxid,
|
||||
w.message
|
||||
from
|
||||
withdraw w
|
||||
left join jxy_cloud.sys_user u on u.user_id = w.user_id
|
||||
left join user_address a on w.user_id = a.user_id
|
||||
where
|
||||
w.id = #{id}
|
||||
</select>
|
||||
<select id="getExpireNoHandleWithdrawOrder" resultType="com.jxy.order.dto.WithdrawPraviteDto">
|
||||
select
|
||||
id,
|
||||
user_id userId,
|
||||
applied_amount amount,
|
||||
applied_coin coin,
|
||||
applied_chain chain
|
||||
from
|
||||
withdraw
|
||||
where
|
||||
status = 2 and applied_time <= #{date}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user