5 changed files with 262 additions and 0 deletions
-
36src/main/java/com/example/demo/controller/cash/CashCollectionController.java
-
78src/main/java/com/example/demo/domain/entity/CashRecord.java
-
58src/main/java/com/example/demo/domain/vo/cash/CashCollection.java
-
18src/main/java/com/example/demo/service/cash/CashCollectionService.java
-
72src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java
@ -0,0 +1,36 @@ |
|||||
|
package com.example.demo.controller.cash; |
||||
|
|
||||
|
import com.example.demo.domain.vo.cash.CashCollection; |
||||
|
import com.example.demo.domain.vo.coin.Result; |
||||
|
import com.example.demo.service.cash.CashCollectionService; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* @program: gold-java |
||||
|
* @ClassName CashCollectionController |
||||
|
* @description: |
||||
|
* @author: Ethan |
||||
|
* @create: 2025−09-26 10:22 |
||||
|
* @Version 1.0 |
||||
|
**/ |
||||
|
@RestController |
||||
|
@RequestMapping("/cashCollection") |
||||
|
@RequiredArgsConstructor |
||||
|
@Slf4j |
||||
|
@CrossOrigin |
||||
|
public class CashCollectionController { |
||||
|
@Autowired |
||||
|
private CashCollectionService cashCollectionService; |
||||
|
|
||||
|
@PostMapping("/add") |
||||
|
public Result add(@RequestBody CashCollection cashCollection) { |
||||
|
try { |
||||
|
return cashCollectionService.add(cashCollection); |
||||
|
} catch (Exception e) { |
||||
|
return Result.error("请检查数据的格式"); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,78 @@ |
|||||
|
package com.example.demo.domain.entity; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
/** |
||||
|
* @program: gold-java |
||||
|
* @ClassName CashRecord |
||||
|
* @description: |
||||
|
* @author: Ethan |
||||
|
* @create: 2025−09-26 14:21 |
||||
|
* @Version 1.0 |
||||
|
**/ |
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class CashRecord implements Serializable { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private Integer id; // 序号 |
||||
|
|
||||
|
// 订单信息 |
||||
|
private Integer orderType; // 订单类型:1-收款,2-退款 |
||||
|
private Integer jwcode; // 精网号 |
||||
|
private String name; // 姓名 |
||||
|
private String market; // 所属地区 |
||||
|
private String activity; // 活动名称 |
||||
|
private String orderCode; // 金币订单号 |
||||
|
private String bankCode; // 银行流水订单号 |
||||
|
private String goodsName; // 商品名称 |
||||
|
private Integer goodNum; // 产品数量 |
||||
|
|
||||
|
// 金额信息 |
||||
|
private String paymentCurrency; // 付款币种 |
||||
|
private BigDecimal paymentAmount; // 付款金额 |
||||
|
private String receivedCurrency; // 到账币种 |
||||
|
private BigDecimal receivedAmount; // 到账金额 |
||||
|
private BigDecimal handlingCharge; // 手续费 |
||||
|
private String receivedMarket; // 到账地区 |
||||
|
|
||||
|
// 支付信息 |
||||
|
private String payType; // 支付方式 |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
||||
|
private LocalDateTime payTime; // 付款日期(到秒) |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
||||
|
private LocalDateTime receivedTime; // 到账日期(到秒) |
||||
|
|
||||
|
// 状态 & 操作人 |
||||
|
private Integer status; // 订单状态 |
||||
|
private Integer submitterId; // 提交人 id |
||||
|
private String voucher; // 转账凭证 |
||||
|
private String remark; // 备注 |
||||
|
private String rejectReason; // 驳回理由 |
||||
|
|
||||
|
// 退款专用字段 |
||||
|
private String refundReason; // 退款备注(客服填写) |
||||
|
private Integer refundModel; // 退款方式:0-全额,1-部分 |
||||
|
private Integer executor; // 退款执行人 OA 号 |
||||
|
private String refundChannels; // 退款途径 |
||||
|
private String refundCurrency; // 退款币种 |
||||
|
private BigDecimal refundAmount; // 退款金额 |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai") |
||||
|
private LocalDateTime refundTime; // 退款日期(到天) |
||||
|
private String refundRemark; // 退款备注(执行人填写) |
||||
|
private String refundVoucher; // 退款截图 |
||||
|
|
||||
|
// 系统字段 |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
||||
|
private LocalDateTime createTime; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
||||
|
private LocalDateTime updateTime; |
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
package com.example.demo.domain.vo.cash; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
/** |
||||
|
* @program: gold-java |
||||
|
* @ClassName CashCollection |
||||
|
* @description: |
||||
|
* @author: Ethan |
||||
|
* @create: 2025−09-25 11:25 |
||||
|
* @Version 1.0 |
||||
|
**/ |
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class CashCollection implements Serializable { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private Integer id; |
||||
|
//订单信息 |
||||
|
private Integer orderType; // 订单类型:1-收款,2-退款 |
||||
|
private Integer jwcode; // 精网号 |
||||
|
private String name; // 姓名 |
||||
|
private String market; // 所属地区 |
||||
|
private String activity; // 活动名称 |
||||
|
private String orderCode; // 金币订单号 |
||||
|
private String bankCode; // 银行流水订单号 |
||||
|
private String goodsName; // 商品名称 |
||||
|
private String goodsNum; // 商品数量 |
||||
|
//金额信息 |
||||
|
private String paymentCurrency; // 付款币种 |
||||
|
private BigDecimal paymentAmount; // 付款金额 |
||||
|
private String receivedCurrency; // 到账币种 |
||||
|
private BigDecimal receivedAmount; // 到账金额 |
||||
|
private BigDecimal handlingCharge; // 手续费 |
||||
|
private String receivedMarket; //到账地区 |
||||
|
// 支付信息 |
||||
|
private String payType; // 支付方式 |
||||
|
private LocalDateTime payTime; // 付款日期(秒级) |
||||
|
private LocalDateTime receivedTime; // 到账日期(秒级) |
||||
|
//状态 操作人 |
||||
|
private Integer status; // 订单状态 |
||||
|
private Integer submitterId; // 提交人 id |
||||
|
private String voucher; // 转账凭证 |
||||
|
private String remark; // 备注 |
||||
|
private String rejectReason; // 驳回理由 |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
||||
|
private LocalDateTime createTime; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
||||
|
private LocalDateTime updateTime; |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package com.example.demo.service.cash; |
||||
|
|
||||
|
import com.example.demo.domain.vo.cash.CashCollection; |
||||
|
import com.example.demo.domain.vo.coin.Result; |
||||
|
|
||||
|
/** |
||||
|
* @program: gold-java |
||||
|
* @ClassName cashCollectionService |
||||
|
* @description: |
||||
|
* @author: Ethan |
||||
|
* @create: 2025−09-26 11:23 |
||||
|
* @Version 1.0 |
||||
|
**/ |
||||
|
|
||||
|
public interface CashCollectionService { |
||||
|
|
||||
|
Result add(CashCollection cashCollection); |
||||
|
} |
@ -0,0 +1,72 @@ |
|||||
|
package com.example.demo.serviceImpl.cash; |
||||
|
|
||||
|
import com.example.demo.domain.entity.CashRecord; |
||||
|
import com.example.demo.domain.vo.cash.CashCollection; |
||||
|
import com.example.demo.domain.vo.coin.Result; |
||||
|
import com.example.demo.service.cash.CashCollectionService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.UUID; |
||||
|
|
||||
|
/** |
||||
|
* @program: gold-java |
||||
|
* @ClassName cashCollectionServiceImpl |
||||
|
* @description: |
||||
|
* @author: Ethan |
||||
|
* @create: 2025−09-26 11:23 |
||||
|
* @Version 1.0 |
||||
|
**/ |
||||
|
@Service |
||||
|
public class CashCollectionServiceImpl implements CashCollectionService { |
||||
|
|
||||
|
@Autowired |
||||
|
|
||||
|
@Override |
||||
|
public Result add(CashCollection cashCollection) { |
||||
|
if (cashCollection.getJwcode()==null){ |
||||
|
return Result.error("精网号不能为空"); |
||||
|
} |
||||
|
if(cashCollection.getJwcode()<10000000||cashCollection.getJwcode()>99999999){ |
||||
|
return Result.error("精网号必须为8位"); |
||||
|
} |
||||
|
if(cashCollection.getName()== null){ |
||||
|
return Result.error("客户姓名不能为空"); |
||||
|
} |
||||
|
if(cashCollection.getActivity()== null){ |
||||
|
return Result.error("活动不能为空"); |
||||
|
} |
||||
|
if(cashCollection.getGoodsName()== null){ |
||||
|
return Result.error("商品名不能为空"); |
||||
|
} |
||||
|
if(cashCollection.getGoodsNum()== null){ |
||||
|
return Result.error("商品数量不能为空"); |
||||
|
} |
||||
|
if(cashCollection.getPaymentCurrency()== null){ |
||||
|
return Result.error("支付币种不能为空"); |
||||
|
} |
||||
|
if(cashCollection.getPaymentAmount()== null){ |
||||
|
return Result.error("支付金额不能为空"); |
||||
|
} |
||||
|
if (cashCollection.getPayType()== null){ |
||||
|
return Result.error("支付方式不能为空"); |
||||
|
} |
||||
|
if (cashCollection.getReceivedMarket()== null){ |
||||
|
return Result.error("到账地区不能为空"); |
||||
|
} |
||||
|
if(cashCollection.getPayTime()== null){ |
||||
|
return Result.error("付款时间不能为空"); |
||||
|
} |
||||
|
if (cashCollection.getVoucher()== null){ |
||||
|
return Result.error("转账凭证不能为空"); |
||||
|
} |
||||
|
if (cashCollection.getRemark()==null){ |
||||
|
return Result.error("备注不能为空"); |
||||
|
} |
||||
|
//生成订单号后半部分 |
||||
|
String orderNumber = UUID.randomUUID().toString().replaceAll("-", ""); |
||||
|
CashRecord cashRecord = new CashRecord(); |
||||
|
cashRecord.setOrderCode("XJ_" + orderNumber); |
||||
|
return Result.success("添加成功",cashRecord); |
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue