Browse Source

04-02 新增流水——其他收入骨架

lijianlin/feature-20260401-现金管理四期
lijianlin 7 days ago
parent
commit
d0755aef89
  1. 15
      src/main/java/com/example/demo/controller/cash/CashCollectionController.java
  2. 34
      src/main/java/com/example/demo/domain/DTO/AddFundsDTO.java
  3. 2
      src/main/java/com/example/demo/domain/vo/cash/CashCollection.java
  4. 7
      src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java
  5. 8
      src/main/java/com/example/demo/service/cash/CashCollectionService.java
  6. 26
      src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java
  7. 1
      src/main/java/com/example/demo/serviceImpl/cash/CashRefundServiceImpl.java
  8. 5
      src/main/resources/cashMapper/CashCollectionMapper.xml

15
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.JWTUtil;
import com.example.demo.Util.LanguageTranslationUtil; import com.example.demo.Util.LanguageTranslationUtil;
import com.example.demo.config.interfac.Log; 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.DTO.PerformanceDTO;
import com.example.demo.domain.entity.*; import com.example.demo.domain.entity.*;
import com.example.demo.domain.vo.cash.*; import com.example.demo.domain.vo.cash.*;
@ -432,6 +433,20 @@ public class CashCollectionController {
return Result.error("查询失败" + ": " + e.getMessage()); 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);
}
}
/** /**
* 查询所有钱包类型 * 查询所有钱包类型

34
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: 202604-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; //备注
}

2
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 orderType; // 订单类型1-收款2-退款
private Integer jwcode; // 精网号 private Integer jwcode; // 精网号
private String name; // 姓名 private String name; // 姓名
private String performanceMarket; //业绩归属地区
private String incomeType; //收入类别
@ExcelIgnore @ExcelIgnore
private String market; // 所属地区 private String market; // 所属地区
private String marketName; // 所属地区名称 private String marketName; // 所属地区名称

7
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.PaymentDTO;
import com.example.demo.domain.DTO.*; import com.example.demo.domain.DTO.*;
import com.example.demo.domain.entity.*; 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.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -125,4 +122,6 @@ public interface CashCollectionMapper {
// 根据精网号列表查询用户的所有钱包信息 // 根据精网号列表查询用户的所有钱包信息
List<UserWalletVO> selectUserWalletsByJwcodes(@Param("jwcodeList") List<Integer> jwcodeList, List<UserWalletVO> selectUserWalletsByJwcodes(@Param("jwcodeList") List<Integer> jwcodeList,
@Param("market") String market); @Param("market") String market);
// 添加流水--其他收入
void addExFund(@Param("addFundsDTO") CashCollection addFundsDTO);
} }

8
src/main/java/com/example/demo/service/cash/CashCollectionService.java

@ -1,13 +1,11 @@
package com.example.demo.service.cash; 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.DTO.PerformanceDTO;
import com.example.demo.domain.entity.CashRecord; import com.example.demo.domain.entity.CashRecord;
import com.example.demo.domain.entity.GOrder; import com.example.demo.domain.entity.GOrder;
import com.example.demo.domain.entity.RechargeActivity; 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.example.demo.domain.vo.coin.Result;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -56,4 +54,6 @@ public interface CashCollectionService {
// 根据精网号和地区查询用户的所有钱包 ID 和金币数量包含用户名和地区分页 // 根据精网号和地区查询用户的所有钱包 ID 和金币数量包含用户名和地区分页
PageInfo<UserWalletVO> selectUserWallets(Integer jwcode, String market, Integer pageNum, Integer pageSize); PageInfo<UserWalletVO> selectUserWallets(Integer jwcode, String market, Integer pageNum, Integer pageSize);
// 添加流水--其他收入
String addExFund(CashCollection addFundsDTO);
} }

26
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.JWTUtil;
import com.example.demo.Util.LanguageTranslationUtil; import com.example.demo.Util.LanguageTranslationUtil;
import com.example.demo.config.RabbitMQConfig; 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.DTO.PerformanceDTO;
import com.example.demo.domain.entity.*; import com.example.demo.domain.entity.*;
import com.example.demo.domain.vo.cash.*; import com.example.demo.domain.vo.cash.*;
@ -682,6 +683,31 @@ public class CashCollectionServiceImpl implements CashCollectionService {
return resultPageInfo; 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 和到账地区的对应关系 * 校验钱包 ID 和到账地区的对应关系
* @param walletId 钱包 ID * @param walletId 钱包 ID

1
src/main/java/com/example/demo/serviceImpl/cash/CashRefundServiceImpl.java

@ -999,6 +999,7 @@ public class CashRefundServiceImpl implements RefundService {
return new PageInfo<>(list); return new PageInfo<>(list);
} }
/** /**
* 复制 FundsDTO 对象浅拷贝 * 复制 FundsDTO 对象浅拷贝
*/ */

5
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) 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()) VALUES (#{jwcode}, #{walletId}, #{type}, #{amount}, #{orderCode}, #{description}, #{status}, NOW())
</insert> </insert>
<!--新增流水——其他收入-->
<insert id="addExFund">
insert into cash_record_collection
</insert>
<!-- 根据精网号和钱包 ID 查询用户钱包明细列表 --> <!-- 根据精网号和钱包 ID 查询用户钱包明细列表 -->
<select id="selectWalletRecordsByJwcodeAndWalletId" resultType="com.example.demo.domain.vo.cash.UserWalletRecordVO"> <select id="selectWalletRecordsByJwcodeAndWalletId" resultType="com.example.demo.domain.vo.cash.UserWalletRecordVO">

Loading…
Cancel
Save