Merge remote-tracking branch 'origin/main-zhb'

This commit is contained in:
2025-02-21 11:27:34 +08:00
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

View File

@@ -1,14 +1,14 @@
package com.buy507.mall.portal.controller;
import com.buy507.mall.common.api.CommonResult;
import com.buy507.mall.portal.domain.WithdrawApplyParam;
import com.buy507.mall.portal.service.MyWalletService;
import com.buy507.mall.portal.service.UmsMemberService;
import com.buy507.mall.portal.vo.WalletCashVo;
import com.buy507.mall.portal.vo.WalletPointsVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/wallet")
@@ -17,25 +17,28 @@ public class MyWalletController {
@Autowired
private MyWalletService myWalletService;
/**
* 获取现金余额和流水
* @param userId
* @return
*/
@Autowired
private UmsMemberService memberService;
@ApiOperation("获取现金余额和流水")
@GetMapping("/balance")
public CommonResult<WalletCashVo> getBalance(@RequestParam Long userId){
WalletCashVo walletCashVo = myWalletService.getBalanceAndCashFlow(userId);
return CommonResult.success(walletCashVo);
}
/**
* 获取积分余额和流水
* @param userId
* @return
*/
@ApiOperation("获取积分余额和流水")
@GetMapping("/points")
public CommonResult<WalletPointsVo> getIntegration(@RequestParam Long userId){
WalletPointsVo walletPointsVo = myWalletService.getIntegrationAndPointsFlow(userId);
return CommonResult.success(walletPointsVo);
}
@ApiOperation("会员提现申请")
@PostMapping(value = "/withdraw")
public CommonResult withdrawApply(@RequestBody WithdrawApplyParam applyParam) {
return memberService.withdrawApply(applyParam);
}
}

View File

@@ -13,7 +13,7 @@ public interface PortalCommonService {
/**
* 获取会员的折扣
* @param member
* @param memberId
* @return
*/
BigDecimal getDiscount(Long memberId);

View File

@@ -55,7 +55,7 @@ public class PortalCommonServiceImpl implements PortalCommonService {
/**
* 获取会员的折扣
* @param member
* @param memberId
* @return
*/
@Override

View File

@@ -862,6 +862,12 @@ public class UmsMemberServiceImpl implements UmsMemberService {
return list;
}
/**
* 获取提现申请列表
* @param pageSize
* @param pageNum
* @return
*/
@Override
public List<MemberWithdrawApplyResult> getWithdrawApply(Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
@@ -870,6 +876,11 @@ public class UmsMemberServiceImpl implements UmsMemberService {
return list;
}
/**
* 会员提现申请
* @param applyParam
* @return
*/
@Override
public CommonResult withdrawApply(WithdrawApplyParam applyParam) {
@@ -911,7 +922,7 @@ public class UmsMemberServiceImpl implements UmsMemberService {
}
if(applyParam.getValue() <= 0) {
return CommonResult.validateFailed("提现积分无效");
return CommonResult.validateFailed("提现无效");
}
String withdrawMultipleStr = commonService.getDictionaryValue(Constants.D_WITHDRAW_MULTIPLE);