现金提现

This commit is contained in:
zt
2025-02-11 17:45:34 +08:00
parent 7732751e52
commit 2b5fad6b5f
2 changed files with 31 additions and 8 deletions

View File

@ -73,6 +73,7 @@ public interface ErrorCodeConstants {
ErrorCode DEVICE_WARN_NOT_EXISTS = new ErrorCode(1_004_013_011, "订单明细不存在");
ErrorCode DISH_STATISTICS_NOT_EXISTS = new ErrorCode(1_004_013_012, "订单明细不存在");
ErrorCode CASH_AMOUNT_NOT_ENOUGH = new ErrorCode(1_004_013_002, "现金充值余额不足");
ErrorCode CASH_AMOUNT_NOT_ALLOW = new ErrorCode(1_004_013_003, "不允许提现");
ErrorCode DINING_PLATES_NOT_EXISTS = new ErrorCode(1_004_099_000, "餐盘不存在");

View File

@ -30,6 +30,7 @@ import java.time.LocalDateTime;
import java.util.*;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.CASH_AMOUNT_NOT_ALLOW;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.CASH_AMOUNT_NOT_ENOUGH;
import static cn.iocoder.yudao.module.member.service.amount.LockManager.getUserLock;
@ -210,6 +211,10 @@ public class DeductionServiceImpl implements DeductionService {
BigDecimal newMoney;
String name;
if(judgeDraw(userId)){
throw exception(CASH_AMOUNT_NOT_ALLOW);
}
synchronized (getUserLock(userId)) {
MemberUserDO user = userService.getUser(userId);
if (user.getCashAmount().compareTo(BigDecimal.ZERO) < 1
@ -638,7 +643,9 @@ public class DeductionServiceImpl implements DeductionService {
}
//判断食堂扣款顺序(true - 微信false - 现金)
/**
* 判断食堂扣款顺序(true - 微信false - 现金)
*/
public boolean judge(Long userId) {
//获取用户所在组分类
List<Integer> types = memberGroupService.getGroupTypeListByUserId(userId);
@ -647,7 +654,9 @@ public class DeductionServiceImpl implements DeductionService {
return isHoliday && (types.contains(GroupTypeEnum.ADMINISTRATIVE.getCode()) || types.contains(GroupTypeEnum.DISTRICT.getCode()));
}
//判断食堂扣款顺序(true - 微信false - 现金)
/**
* 判断食堂扣款顺序(true - 微信false - 现金)
*/
public boolean judge(Long userId, String time) {
//获取用户所在组分类
List<Integer> types = memberGroupService.getGroupTypeListByUserId(userId);
@ -656,7 +665,9 @@ public class DeductionServiceImpl implements DeductionService {
return isHoliday && (types.contains(GroupTypeEnum.ADMINISTRATIVE.getCode()) || types.contains(GroupTypeEnum.DISTRICT.getCode()));
}
//判断购物付款顺序(true - 微信false - 现金)
/**
* 判断购物付款顺序(true - 微信false - 现金)
*/
public boolean judgeShopping(Long userId) {
//获取用户所在组分类
List<Integer> types = memberGroupService.getGroupTypeListByUserId(userId);
@ -664,7 +675,9 @@ public class DeductionServiceImpl implements DeductionService {
}
//判断太空舱付款顺序(true - 微信false - 现金)
/**
* 判断太空舱付款顺序(true - 微信false - 现金)
*/
public boolean judgeSpace(Long userId) {
//获取用户所在组分类
List<Integer> types = memberGroupService.getGroupTypeListByUserId(userId);
@ -675,10 +688,19 @@ public class DeductionServiceImpl implements DeductionService {
return true;
}
//行政服务中心只允许工作日
if (isHoliday && types.contains(GroupTypeEnum.ADMINISTRATIVE.getCode())) {
return true;
return isHoliday && types.contains(GroupTypeEnum.ADMINISTRATIVE.getCode());
}
return false;
/**
* 判断是否能提现(true - 不能false - 能)
*/
public boolean judgeDraw(Long userId) {
//获取用户所在组分类
List<Integer> types = memberGroupService.getGroupTypeListByUserId(userId);
return types.contains(GroupTypeEnum.YCLH.getCode()) || types.contains(GroupTypeEnum.DISTRICT.getCode())
|| types.contains(GroupTypeEnum.ADMINISTRATIVE.getCode()) || types.contains(GroupTypeEnum.OTHER.getCode());
}
}