我的钱包业务逻辑实现

This commit is contained in:
2025-02-21 11:26:10 +08:00
parent 13374f4249
commit 873360a300
5 changed files with 47 additions and 22 deletions

View File

@@ -5,6 +5,9 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import cn.hutool.core.date.DateUtil;
import com.buy507.mall.mapper.UmsMemberAccountTransactionMapper;
import com.buy507.mall.model.*;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
@@ -24,10 +27,6 @@ import com.buy507.mall.dto.MemberWithdrawApplyResult;
import com.buy507.mall.mapper.DmsMemberTradeRecordMapper;
import com.buy507.mall.mapper.DmsMemberWithdrawApplyMapper;
import com.buy507.mall.mapper.UmsMemberMapper;
import com.buy507.mall.model.DmsMemberTradeRecord;
import com.buy507.mall.model.DmsMemberWithdrawApply;
import com.buy507.mall.model.ItemType;
import com.buy507.mall.model.UmsMember;
import com.buy507.mall.service.DmsMemberWithdrawApplyService;
import com.github.pagehelper.PageHelper;
@@ -48,6 +47,9 @@ public class DmsMemberWithdrawApplyServiceImpl implements DmsMemberWithdrawApply
@Autowired
private RedisLock redisLock;
@Autowired
private UmsMemberAccountTransactionMapper accountTransactionMapper;
@Override
@@ -88,6 +90,15 @@ public class DmsMemberWithdrawApplyServiceImpl implements DmsMemberWithdrawApply
member = memberMapper.selectByPrimaryKey(member.getId());
member.setFreeze(member.getFreeze().subtract(withdrawApply.getValue())); //修改冻结值
memberMapper.updateByPrimaryKey(member);
// 写入会员流水记录表
UmsMemberAccountTransaction memberTransaction = new UmsMemberAccountTransaction();
memberTransaction.setMemberId(member.getId());
memberTransaction.setRevenueAmount(withdrawApply.getValue()); // 提现金额
memberTransaction.setRemarks("提现"); // 备注
memberTransaction.setCreateTime(DateUtil.date()); // 提现时间
accountTransactionMapper.insert(memberTransaction); // 保存流水记录
redisLock.unlock(String.valueOf(member.getId()), String.valueOf(time));
break;
}
@@ -95,7 +106,7 @@ public class DmsMemberWithdrawApplyServiceImpl implements DmsMemberWithdrawApply
}
}
}
@Override