Browse Source

3.13 退款更新

milestone-20260224-现金钱包
huangqizhen 4 weeks ago
parent
commit
596ae1cd56
  1. 1
      src/main/java/com/example/demo/mapper/coin/WalletMapper.java
  2. 2
      src/main/java/com/example/demo/service/Wallet/WalletService.java
  3. 10
      src/main/java/com/example/demo/serviceImpl/Wallet/WalletServiceImpl.java
  4. 12
      src/main/java/com/example/demo/serviceImpl/cash/CashRefundServiceImpl.java
  5. 4
      src/main/resources/mapper/WalletMapper.xml

1
src/main/java/com/example/demo/mapper/coin/WalletMapper.java

@ -26,4 +26,5 @@ public interface WalletMapper {
// 查询所有钱包类型
List<Wallet> selectAllWallets();
void addUserWalletRecord(UserWalletRecord userWalletRecord);
}

2
src/main/java/com/example/demo/service/Wallet/WalletService.java

@ -18,7 +18,7 @@ public interface WalletService {
List<UserWalletRecord> selectUserWalletRecord(Integer jwcode, String orderCode);
void updateUserWalletRecord(Integer id);
GOrder MysqlConnection(String linkId);
void addUserWalletRecord(UserWalletRecord userWalletRecord);
// 查询所有钱包类型
List<Wallet> selectAllWallets();
}

10
src/main/java/com/example/demo/serviceImpl/Wallet/WalletServiceImpl.java

@ -29,7 +29,7 @@ public class WalletServiceImpl implements WalletService {
@Override
public void updateUserGoldRecord(UserRegionWallet userRegionWallet) {
BigDecimal currentPermanentGold = userRegionWallet.getCurrentPermanentGold();
if (currentPermanentGold == null|| currentPermanentGold.compareTo(BigDecimal.ZERO) <= 0)
if (currentPermanentGold == null)
throw new SystemException("钱包金币传参错误");
if (userRegionWallet.getJwcode()!= null|| userRegionWallet.getWalletId() != null){
UserRegionWallet wallet = walletMapper.selectWallet(userRegionWallet.getJwcode(), userRegionWallet.getWalletId());
@ -37,6 +37,9 @@ public class WalletServiceImpl implements WalletService {
throw new BusinessException("该用户钱包不存在");
}
else {
if (wallet.getCurrentPermanentGold().compareTo(currentPermanentGold) < 0){
throw new BusinessException("用户钱包金币不足");
}
userRegionWallet.setCurrentPermanentGold(wallet.getCurrentPermanentGold().add(currentPermanentGold));
walletMapper.updateWallet(userRegionWallet);
}
@ -71,4 +74,9 @@ public class WalletServiceImpl implements WalletService {
public List<Wallet> selectAllWallets() {
return walletMapper.selectAllWallets();
}
@Override
public void addUserWalletRecord(UserWalletRecord userWalletRecord) {
walletMapper.addUserWalletRecord(userWalletRecord);
}
}

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

@ -392,6 +392,7 @@ public class CashRefundServiceImpl implements RefundService {
return cashRefundMapper.updateStatus(cashRecordDone);
}
@Transactional(rollbackFor = Exception.class)
@Override
public int finalreview(CashRecordDone cashRecordDone, @RequestHeader(defaultValue = "zh_CN") String lang) {
if (cashRecordDone.getPermanentGold() == null) {
@ -459,7 +460,8 @@ public class CashRefundServiceImpl implements RefundService {
auditMapper.updateUserGold(user);
//钱包更新
List<UserWalletRecord> userWalletList = walletService.selectUserWalletRecord(userGoldRecord.getJwcode(), orderCode);
String orderCodeA = "XJ" + orderCode.substring(4);
List<UserWalletRecord> userWalletList = walletService.selectUserWalletRecord(userGoldRecord.getJwcode(), orderCodeA);
UserRegionWallet userRegionWallet = new UserRegionWallet();
for (UserWalletRecord userWalletRecord : userWalletList){
userRegionWallet.setJwcode(userWalletRecord.getJwcode());
@ -467,6 +469,14 @@ public class CashRefundServiceImpl implements RefundService {
userRegionWallet.setCurrentPermanentGold(BigDecimal.valueOf(userWalletRecord.getAmount()));
walletService.updateUserGoldRecord(userRegionWallet);
walletService.updateUserWalletRecord(userWalletRecord.getId());
UserWalletRecord userWalletRecord1 = new UserWalletRecord();
userWalletRecord1.setType(2);
userWalletRecord1.setJwcode(userWalletRecord.getJwcode());
userWalletRecord1.setWalletId(userWalletRecord.getWalletId());
userWalletRecord1.setAmount(-userWalletRecord.getAmount());
userWalletRecord1.setOrderCode("TK"+orderCodeA);
userWalletRecord1.setDescription(userWalletRecord.getDescription()+"退款");
walletService.addUserWalletRecord(userWalletRecord1);
}
GoldTistV2.addCoinNew(userGoldRecord.getJwcode().toString(), 58, //退款免费+永久金币-充值

4
src/main/resources/mapper/WalletMapper.xml

@ -1,6 +1,10 @@
<?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.example.demo.mapper.coin.WalletMapper">
<insert id="addUserWalletRecord">
insert into user_wallet_record(jwcode, wallet_id, type, amount, order_code, description, status)
values(#{jwcode}, #{walletId}, #{type}, #{amount}, #{orderCode}, #{description}, 1)
</insert>
<!-- 结果映射 -->
<resultMap id="WalletResult" type="com.example.demo.domain.entity.Wallet">

Loading…
Cancel
Save