Hentua
2023-06-12 2f34848f649b7d29f7697f8fe13b5e93c543c19a
增加每日提现次数
4 files modified
41 ■■■■■ changed files
src/main/java/cc/mrbird/febs/mall/dto/CashOutSettingDto.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/CashOutSettingVo.java 3 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/system/cashOutSetting.html 10 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/dto/CashOutSettingDto.java
@@ -22,4 +22,6 @@
    private Integer workingDays;
    //互转手续费率
    private Integer insideFee;
    private Integer dailyWithdrawlCnt;
}
src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
@@ -16,10 +16,13 @@
import cc.mrbird.febs.mall.service.IMallMemberWithdrawService;
import cc.mrbird.febs.mall.service.MallMemberService;
import cc.mrbird.febs.mall.vo.CashOutSettingVo;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -27,6 +30,8 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
 * @author wzy
@@ -64,6 +69,13 @@
            cashOutSettingVo = JSONObject.parseObject(dic.getValue(), CashOutSettingVo.class);
        }
        if (cashOutSettingVo.getWorkingDays() != 2) {
            int i = DateUtil.dayOfWeek(new Date());
            if (i == 1 || i == 7) {
                throw new FebsException("仅工作日可提现");
            }
        }
        if (withdrawalDto.getAmount().compareTo(cashOutSettingVo.getMinCashOut()) < 0) {
            throw new FebsException("最小提现金额为"+cashOutSettingVo.getMinCashOut().setScale(2,BigDecimal.ROUND_DOWN));
        }
@@ -79,6 +91,20 @@
            throw new FebsException("请填写所属支行");
        }
        LambdaQueryWrapper<MallMemberWithdraw> query = new LambdaQueryWrapper<>();
        query.ge(MallMemberWithdraw::getCreatedTime, DateUtil.beginOfDay(new Date()))
                .le(MallMemberWithdraw::getCreatedTime, DateUtil.endOfDay(new Date()))
                .eq(MallMemberWithdraw::getMemberId, memberId);
        List<MallMemberWithdraw> hasWithdraw = this.baseMapper.selectList(query);
        if (CollUtil.isNotEmpty(hasWithdraw) && hasWithdraw.size() >= cashOutSettingVo.getDailyWithdrawlCnt()) {
            throw new FebsException("达到最大提现次数");
        }
        double totalAmount = hasWithdraw.stream().mapToDouble(item -> item.getAmount().doubleValue()).sum();
        if (cashOutSettingVo.getAllCashOut().subtract(withdrawalDto.getAmount()).doubleValue() < totalAmount) {
            throw new FebsException("达到当日最大提现金额");
        }
        MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(memberId);
        BigDecimal serviceFeePercent = cashOutSettingVo.getServiceFee().multiply(BigDecimal.valueOf(0.01));
src/main/java/cc/mrbird/febs/mall/vo/CashOutSettingVo.java
@@ -29,4 +29,7 @@
    @ApiModelProperty(value = "余额提现需要绿色凭证比例")
    private BigDecimal voucherPercent;
    @ApiModelProperty(value = "每日提现次数")
    private Integer dailyWithdrawlCnt;
}
src/main/resources/templates/febs/views/modules/system/cashOutSetting.html
@@ -19,6 +19,13 @@
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label  febs-form-item-require">每日提现次数:</label>
                        <div class="layui-input-block">
                            <input type="text" name="dailyWithdrawlCnt" data-th-id="${cashout.dailyWithdrawlCnt}"
                                   lay-verify="required|integer" autocomplete="off" class="layui-input" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label  febs-form-item-require">每次提现手续费:</label>
                        <div class="layui-input-block">
                            <input type="text" name="serviceFee" data-th-id="${cashout.serviceFee}"
@@ -92,7 +99,8 @@
                "allCashOut": cashout.allCashOut,
                "serviceFee": cashout.serviceFee,
                "insideFee": cashout.insideFee,
                "workingDays": cashout.workingDays
                "workingDays": cashout.workingDays,
                "dailyWithdrawlCnt": cashout.dailyWithdrawlCnt
            });
        }