Browse Source

20260305创建钱包明细记录

huangqizheng/feature-20260309142559-钱包退款
wangguorui 1 month ago
parent
commit
f46c08a643
  1. 10
      src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java
  2. 14
      src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java
  3. 10
      src/main/resources/cashMapper/CashCollectionMapper.xml

10
src/main/java/com/example/demo/mapper/cash/CashCollectionMapper.java

@ -2,10 +2,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.CashRecord;
import com.example.demo.domain.entity.GOrder;
import com.example.demo.domain.entity.RechargeActivity;
import com.example.demo.domain.entity.UserRegionWallet;
import com.example.demo.domain.entity.*;
import com.example.demo.domain.vo.cash.CashCollection; import com.example.demo.domain.vo.cash.CashCollection;
import com.example.demo.domain.vo.cash.PerformanceVO; import com.example.demo.domain.vo.cash.PerformanceVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -32,7 +29,7 @@ public interface CashCollectionMapper {
String getMarketByJwcode(@Param("jwcode") Integer jwcode); String getMarketByJwcode(@Param("jwcode") Integer jwcode);
//新增收款订单 //新增收款订单
void add(CashRecord cashRecord); void add(CashRecord cashRecord);
//根据订单号获取订单id状态
//根据订单号获取订单id状态钱包id永久金币数量精网号和备注
CashRecord selectByOrderCode(@Param("orderCode") String orderCode); CashRecord selectByOrderCode(@Param("orderCode") String orderCode);
//更新订单状态 //更新订单状态
int updateStatus(@Param("orderCode") String orderCode, int updateStatus(@Param("orderCode") String orderCode,
@ -110,4 +107,7 @@ public interface CashCollectionMapper {
// 插入或更新用户钱包记录 // 插入或更新用户钱包记录
void insertUserWallet(UserRegionWallet userRegionWallet); void insertUserWallet(UserRegionWallet userRegionWallet);
// 插入用户钱包明细记录
void insertUserWalletRecord(UserWalletRecord userWalletRecord);
} }

14
src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java

@ -123,8 +123,6 @@ public class CashCollectionServiceImpl implements CashCollectionService {
cashRecord.setPermanentGold(cashCollection.getPermanentGold()); //永久金币 cashRecord.setPermanentGold(cashCollection.getPermanentGold()); //永久金币
cashRecord.setFreeGold(cashCollection.getFreeGold()); //免费金币 cashRecord.setFreeGold(cashCollection.getFreeGold()); //免费金币
cashRecord.setWalletId(cashCollection.getWalletId()); // 钱包 ID cashRecord.setWalletId(cashCollection.getWalletId()); // 钱包 ID
// 打印钱包 ID
log.info("钱包ID:{}", cashRecord.getWalletId());
cashRecord.setPaymentCurrency(cashCollection.getPaymentCurrency()); //付款币种 cashRecord.setPaymentCurrency(cashCollection.getPaymentCurrency()); //付款币种
cashRecord.setPaymentAmount(cashCollection.getPaymentAmount()); //付款金额 cashRecord.setPaymentAmount(cashCollection.getPaymentAmount()); //付款金额
cashRecord.setReceivedMarket(cashCollection.getReceivedMarket()); //到账地区 cashRecord.setReceivedMarket(cashCollection.getReceivedMarket()); //到账地区
@ -425,6 +423,18 @@ public class CashCollectionServiceImpl implements CashCollectionService {
log.info("充值成功:jwcode={}, walletId={}, 增加金币={}", log.info("充值成功:jwcode={}, walletId={}, 增加金币={}",
jwcode, walletId, permanentGold); jwcode, walletId, permanentGold);
} }
// 创建钱包明细记录
UserWalletRecord walletRecord = new UserWalletRecord();
walletRecord.setJwcode(jwcode);
walletRecord.setWalletId(walletId);
walletRecord.setType(0); // 0=充值
walletRecord.setAmount(permanentGold);
walletRecord.setOrderCode(cashRecord.getOrderCode());
walletRecord.setDescription(dbRecord.getRemark() != null ? dbRecord.getRemark() : "金币充值");
walletRecord.setStatus(0); // 0=正常
cashCollectionMapper.insertUserWalletRecord(walletRecord);
} catch (Exception e) { } catch (Exception e) {
log.error("充值钱包失败:jwcode={}, walletId={}, error={}", log.error("充值钱包失败:jwcode={}, walletId={}, error={}",
jwcode, walletId, e.getMessage(), e); jwcode, walletId, e.getMessage(), e);

10
src/main/resources/cashMapper/CashCollectionMapper.xml

@ -119,9 +119,9 @@
<select id="getMarketByJwcode" resultType="java.lang.String"> <select id="getMarketByJwcode" resultType="java.lang.String">
select market from user where jwcode=#{jwcode} select market from user where jwcode=#{jwcode}
</select> </select>
<!--根据订单号获取订单id、状态、钱包id、永久金币数量和精网号-->
<!--根据订单号获取订单id、状态、钱包id、永久金币数量、精网号和备注-->
<select id="selectByOrderCode" resultType="com.example.demo.domain.entity.CashRecord"> <select id="selectByOrderCode" resultType="com.example.demo.domain.entity.CashRecord">
select id ,status, wallet_id, permanent_gold, jwcode
select id ,status, wallet_id, permanent_gold, jwcode, remark
from cash_record_collection from cash_record_collection
where order_code=#{orderCode} where order_code=#{orderCode}
</select> </select>
@ -414,6 +414,12 @@
update_time = NOW() update_time = NOW()
</insert> </insert>
<!-- 插入用户钱包明细记录 -->
<insert id="insertUserWalletRecord" parameterType="com.example.demo.domain.entity.UserWalletRecord">
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>
<!--根据OrderCode订单号更新收款订单--> <!--根据OrderCode订单号更新收款订单-->
<update id="updateByGoldCoinOrderCodeByPayment"> <update id="updateByGoldCoinOrderCodeByPayment">
update cash_record_collection update cash_record_collection

Loading…
Cancel
Save