From 5723081b2da05257b254196d440e3f1f6d7a654b Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 03 Apr 2023 13:41:15 +0800
Subject: [PATCH] 设定时区,这样创建的时间就不会出现问题

---
 src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
index 9ac3bc0..c3b1d89 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
@@ -60,17 +60,23 @@
         if (dic != null) {
             cashOutSettingVo = JSONObject.parseObject(dic.getValue(), CashOutSettingVo.class);
         }
-
-        if (withdrawalDto.getAmount().compareTo(cashOutSettingVo.getMinCashOut()) < 0) {
-            throw new FebsException("最小提现金额为"+cashOutSettingVo.getMinCashOut().setScale(2,BigDecimal.ROUND_DOWN));
+        BigDecimal minCashOut = cashOutSettingVo.getMinCashOut();
+        if(withdrawalDto.getAmount().compareTo(minCashOut) < 0){
+            throw new FebsException("提现金额最小为"+minCashOut);
         }
 
-        MallMemberBank mallMemberBank = mallMemberBankMapper.selectById(withdrawalDto.getBankId());
-        if(ObjectUtil.isEmpty(mallMemberBank)){
-            throw new FebsException("未找到地址信息");
+        if (withdrawalDto.getAmount().compareTo(BigDecimal.ZERO) <= 0) {
+            throw new FebsException("请输入正确的提现金额");
         }
 
-        BigDecimal serviceFee = cashOutSettingVo.getServiceFee().multiply(BigDecimal.valueOf(0.01));
+        if (withdrawalDto.getAmount().compareTo(BigDecimal.ZERO) <= 0) {
+            throw new FebsException("请输入正确的提现金额");
+        }
+        if(ObjectUtil.isEmpty(withdrawalDto.getBankNo())){
+            throw new FebsException("请输入地址");
+        }
+
+        BigDecimal serviceFee = cashOutSettingVo.getServiceFee();
         String orderNo = MallUtils.getOrderNum("W");
         //减少用户余额
         memberWalletService.reduce(withdrawalDto.getAmount(), memberId, "balance");
@@ -80,14 +86,15 @@
         withdraw.setMemberId(memberId);
         withdraw.setAmount(withdrawalDto.getAmount());
         withdraw.setStatus(1);
-        withdraw.setAmountFee(serviceFee.multiply(withdrawalDto.getAmount()));
-        withdraw.setWtihdrawTypeId(mallMemberBank.getId());
+        withdraw.setAmountFee(serviceFee);
+        withdraw.setRemark(withdrawalDto.getBankNo());
+//        withdraw.setWtihdrawTypeId(mallMemberBank.getId());
         this.baseMapper.insert(withdraw);
         //生成提现流水记录
         Long subsidyAmountFlowId = mallMoneyFlowService.addMoneyFlow(
                 memberId,
                 orderNo,
-                withdrawalDto.getAmount(),
+                withdrawalDto.getAmount().negate(),
                 MallMoneyFlowTypeEnum.WITHDRAW.getCode(),
                 MallMoneyFlow.STATUS_ING,
                 MallMoneyFlow.IS_RETURN_Y,

--
Gitblit v1.9.1