From d0755aef892f7dfbd1998914d591882a1fd6298b Mon Sep 17 00:00:00 2001 From: lijianlin Date: Thu, 2 Apr 2026 18:08:43 +0800 Subject: [PATCH] =?UTF-8?q?04-02=20=E6=96=B0=E5=A2=9E=E6=B5=81=E6=B0=B4?= =?UTF-8?q?=E2=80=94=E2=80=94=E5=85=B6=E4=BB=96=E6=94=B6=E5=85=A5=E9=AA=A8?= =?UTF-8?q?=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/cash/CashCollectionController.java | 15 ++++++++++ .../com/example/demo/domain/DTO/AddFundsDTO.java | 34 ++++++++++++++++++++++ .../demo/domain/vo/cash/CashCollection.java | 2 ++ .../demo/mapper/cash/CashCollectionMapper.java | 7 ++--- .../demo/service/cash/CashCollectionService.java | 8 ++--- .../cash/CashCollectionServiceImpl.java | 26 +++++++++++++++++ .../serviceImpl/cash/CashRefundServiceImpl.java | 1 + .../resources/cashMapper/CashCollectionMapper.xml | 5 ++++ 8 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/example/demo/domain/DTO/AddFundsDTO.java diff --git a/src/main/java/com/example/demo/controller/cash/CashCollectionController.java b/src/main/java/com/example/demo/controller/cash/CashCollectionController.java index 8555932..92879d0 100644 --- a/src/main/java/com/example/demo/controller/cash/CashCollectionController.java +++ b/src/main/java/com/example/demo/controller/cash/CashCollectionController.java @@ -3,6 +3,7 @@ package com.example.demo.controller.cash; import com.example.demo.Util.JWTUtil; import com.example.demo.Util.LanguageTranslationUtil; import com.example.demo.config.interfac.Log; +import com.example.demo.domain.DTO.AddFundsDTO; import com.example.demo.domain.DTO.PerformanceDTO; import com.example.demo.domain.entity.*; import com.example.demo.domain.vo.cash.*; @@ -432,6 +433,20 @@ public class CashCollectionController { return Result.error("查询失败" + ": " + e.getMessage()); } } + /** + *新增流水-其他收入 + */ + + @PostMapping("/addExFund") + public Result addExFund(@RequestBody CashCollection addFundsDTO, @RequestHeader(defaultValue = "zh_CN") String lang) { + try { + String result = cashCollectionService.addExFund(addFundsDTO); + return Result.success(result); + } catch (Exception e) { + String errorMsg = languageTranslationUtil.translate(e.getMessage(), lang); + return Result.error(errorMsg); + } + } /** * 查询所有钱包类型 diff --git a/src/main/java/com/example/demo/domain/DTO/AddFundsDTO.java b/src/main/java/com/example/demo/domain/DTO/AddFundsDTO.java new file mode 100644 index 0000000..507e4a0 --- /dev/null +++ b/src/main/java/com/example/demo/domain/DTO/AddFundsDTO.java @@ -0,0 +1,34 @@ +package com.example.demo.domain.DTO; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @program: gold-java + * @ClassName addFundsDTO + * @description: + * @author: Ethan + * @create: 2026−04-02 16:56 + * @Version 1.0 + **/ +@Data +@NoArgsConstructor +public class AddFundsDTO { + private String performanceMarket; //业绩归属地区 + private String incomeType; //收入类别 + private Integer goodNum; //商品数量 + private String payType; //付款方式 + private Integer paymentCurrency; //付款币种 + private BigDecimal paymentAmount; //付款金额 + @ExcelIgnore + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") + private Date payTime; //付款时间 + private BigDecimal handlingCharge; //手续费 + private String remark; //备注 + +} diff --git a/src/main/java/com/example/demo/domain/vo/cash/CashCollection.java b/src/main/java/com/example/demo/domain/vo/cash/CashCollection.java index aeeb220..6bc1d09 100644 --- a/src/main/java/com/example/demo/domain/vo/cash/CashCollection.java +++ b/src/main/java/com/example/demo/domain/vo/cash/CashCollection.java @@ -34,6 +34,8 @@ public class CashCollection implements Serializable { private Integer orderType; // 订单类型:1-收款,2-退款 private Integer jwcode; // 精网号 private String name; // 姓名 + private String performanceMarket; //业绩归属地区 + private String incomeType; //收入类别 @ExcelIgnore private String market; // 所属地区 private String marketName; // 所属地区名称 diff --git a/src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java b/src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java index 7756c78..d6bfdc7 100644 --- a/src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java +++ b/src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java @@ -3,10 +3,7 @@ package com.example.demo.mapper.cash; //import com.example.demo.domain.DTO.PaymentDTO; import com.example.demo.domain.DTO.*; import com.example.demo.domain.entity.*; -import com.example.demo.domain.vo.cash.CashCollection; -import com.example.demo.domain.vo.cash.PerformanceVO; -import com.example.demo.domain.vo.cash.UserWalletRecordVO; -import com.example.demo.domain.vo.cash.UserWalletVO; +import com.example.demo.domain.vo.cash.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -125,4 +122,6 @@ public interface CashCollectionMapper { // 根据精网号列表查询用户的所有钱包信息 List selectUserWalletsByJwcodes(@Param("jwcodeList") List jwcodeList, @Param("market") String market); + // 添加流水--其他收入 + void addExFund(@Param("addFundsDTO") CashCollection addFundsDTO); } diff --git a/src/main/java/com/example/demo/service/cash/CashCollectionService.java b/src/main/java/com/example/demo/service/cash/CashCollectionService.java index d7d1694..bc742a0 100644 --- a/src/main/java/com/example/demo/service/cash/CashCollectionService.java +++ b/src/main/java/com/example/demo/service/cash/CashCollectionService.java @@ -1,13 +1,11 @@ package com.example.demo.service.cash; +import com.example.demo.domain.DTO.AddFundsDTO; import com.example.demo.domain.DTO.PerformanceDTO; import com.example.demo.domain.entity.CashRecord; import com.example.demo.domain.entity.GOrder; import com.example.demo.domain.entity.RechargeActivity; -import com.example.demo.domain.vo.cash.CashCollection; -import com.example.demo.domain.vo.cash.PerformanceVO; -import com.example.demo.domain.vo.cash.UserWalletRecordVO; -import com.example.demo.domain.vo.cash.UserWalletVO; +import com.example.demo.domain.vo.cash.*; import com.example.demo.domain.vo.coin.Result; import com.github.pagehelper.PageInfo; @@ -56,4 +54,6 @@ public interface CashCollectionService { // 根据精网号和地区查询用户的所有钱包 ID 和金币数量(包含用户名和地区)(分页) PageInfo selectUserWallets(Integer jwcode, String market, Integer pageNum, Integer pageSize); + // 添加流水--其他收入 + String addExFund(CashCollection addFundsDTO); } diff --git a/src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java b/src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java index 730c2a7..ef935a9 100644 --- a/src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java +++ b/src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java @@ -3,6 +3,7 @@ package com.example.demo.serviceImpl.cash; import com.example.demo.Util.JWTUtil; import com.example.demo.Util.LanguageTranslationUtil; import com.example.demo.config.RabbitMQConfig; +import com.example.demo.domain.DTO.AddFundsDTO; import com.example.demo.domain.DTO.PerformanceDTO; import com.example.demo.domain.entity.*; import com.example.demo.domain.vo.cash.*; @@ -682,6 +683,31 @@ public class CashCollectionServiceImpl implements CashCollectionService { return resultPageInfo; } + //新增流水--其他收入 + @Override + public String addExFund(CashCollection addFundsDTO) { + if (addFundsDTO.getPerformanceMarket() == null|| addFundsDTO.getPerformanceMarket().isEmpty()) + throw new IllegalArgumentException("业绩归属地区不能为空"); + if (addFundsDTO.getIncomeType() == null|| addFundsDTO.getIncomeType().isEmpty()) + throw new IllegalArgumentException("收入类别不能为空"); + if (addFundsDTO.getPayType() == null|| addFundsDTO.getPayType().isEmpty()) + throw new IllegalArgumentException("付款方式不能为空"); + if (addFundsDTO.getPaymentCurrency() == null) + throw new IllegalArgumentException("币种不能为空"); + if (addFundsDTO.getPaymentAmount() == null) + throw new IllegalArgumentException("付款金额不能为空"); + //生成订单号后半部分 + String orderNumber = UUID.randomUUID().toString().replaceAll("-", ""); + //构建订单信息 + addFundsDTO.setOrderCode("QT_" + orderNumber); //订单号 + addFundsDTO.setOrderType(1); + addFundsDTO.setReceivedMarket(addFundsDTO.getPerformanceMarket()); + addFundsDTO.setReceivedAmount(addFundsDTO.getPaymentAmount()); + + cashCollectionMapper.addExFund(addFundsDTO); + return "添加成功"; + } + /** * 校验钱包 ID 和到账地区的对应关系 * @param walletId 钱包 ID diff --git a/src/main/java/com/example/demo/serviceImpl/cash/CashRefundServiceImpl.java b/src/main/java/com/example/demo/serviceImpl/cash/CashRefundServiceImpl.java index fed4005..31b010f 100644 --- a/src/main/java/com/example/demo/serviceImpl/cash/CashRefundServiceImpl.java +++ b/src/main/java/com/example/demo/serviceImpl/cash/CashRefundServiceImpl.java @@ -999,6 +999,7 @@ public class CashRefundServiceImpl implements RefundService { return new PageInfo<>(list); } + /** * 复制 FundsDTO 对象(浅拷贝) */ diff --git a/src/main/resources/cashMapper/CashCollectionMapper.xml b/src/main/resources/cashMapper/CashCollectionMapper.xml index 59c5371..8b1f67a 100644 --- a/src/main/resources/cashMapper/CashCollectionMapper.xml +++ b/src/main/resources/cashMapper/CashCollectionMapper.xml @@ -421,6 +421,11 @@ INSERT INTO user_wallet_record (jwcode, wallet_id, type, amount, order_code, description, status, create_time) VALUES (#{jwcode}, #{walletId}, #{type}, #{amount}, #{orderCode}, #{description}, #{status}, NOW()) + + + insert into cash_record_collection + +