From f7949069f3f6001ead4709376e95c0ae1056843e Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期一, 28 十月 2024 18:46:09 +0800
Subject: [PATCH] fix: 钱包供应商财务

---
 src/main/java/com/mzl/flower/dto/request/wallet/QueryWalletWithdrawDTO.java           |    2 
 src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java |    1 
 src/main/resources/mapper/wallet/WalletBillRecordMapper.xml                           |   46 +++++++----------------
 src/main/java/com/mzl/flower/dto/response/wallet/WalletBillRecordVO.java              |    2 
 src/main/java/com/mzl/flower/service/impl/wallet/WalletBillRecordServiceImpl.java     |    3 +
 src/main/resources/mapper/wallet/WalletWithdrawRecordMapper.xml                       |   18 ++------
 6 files changed, 24 insertions(+), 48 deletions(-)

diff --git a/src/main/java/com/mzl/flower/dto/request/wallet/QueryWalletWithdrawDTO.java b/src/main/java/com/mzl/flower/dto/request/wallet/QueryWalletWithdrawDTO.java
index edc24a1..0116ae1 100644
--- a/src/main/java/com/mzl/flower/dto/request/wallet/QueryWalletWithdrawDTO.java
+++ b/src/main/java/com/mzl/flower/dto/request/wallet/QueryWalletWithdrawDTO.java
@@ -37,6 +37,6 @@
     private LocalDate approveEndDate;
 
     @ApiModelProperty(value = "提现状态")
-    private String withdrawState;
+    private String approveState;
 
 }
diff --git a/src/main/java/com/mzl/flower/dto/response/wallet/WalletBillRecordVO.java b/src/main/java/com/mzl/flower/dto/response/wallet/WalletBillRecordVO.java
index 5ed86d7..cf9cc2a 100644
--- a/src/main/java/com/mzl/flower/dto/response/wallet/WalletBillRecordVO.java
+++ b/src/main/java/com/mzl/flower/dto/response/wallet/WalletBillRecordVO.java
@@ -10,7 +10,7 @@
 
 @Data
 public class WalletBillRecordVO extends AbstractTransDTO {
-    private Long id;
+    private String id;
 
     @ApiModelProperty(value = "供应商Id")
     private Long supplierId;
diff --git a/src/main/java/com/mzl/flower/service/impl/wallet/WalletBillRecordServiceImpl.java b/src/main/java/com/mzl/flower/service/impl/wallet/WalletBillRecordServiceImpl.java
index 455e4c9..902a138 100644
--- a/src/main/java/com/mzl/flower/service/impl/wallet/WalletBillRecordServiceImpl.java
+++ b/src/main/java/com/mzl/flower/service/impl/wallet/WalletBillRecordServiceImpl.java
@@ -26,7 +26,6 @@
 import com.mzl.flower.utils.ExcelExportUtil;
 import org.redisson.api.RLock;
 import org.redisson.api.RedissonClient;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
@@ -121,6 +120,7 @@
                 if (StringUtils.isEmpty(walletBillRecordDO.getWithdrawRecordId())) {
                     WalletWithdrawRecordDO withdrawRecordDO = walletWithdrawRecordMapper.selectById(walletBillRecordDO.getWithdrawRecordId());
                     withdrawRecordDO.setWithdrawState(Constants.WALLET_WITHDRAW_STATE.SUCCESS.name());
+                    walletBillRecordDO.setRemark("账户资金提现完成");
                     walletWithdrawRecordMapper.updateById(withdrawRecordDO);
                 }
 
@@ -151,6 +151,7 @@
                 if (StringUtils.isEmpty(walletBillRecordDO.getWithdrawRecordId())) {
                     WalletWithdrawRecordDO withdrawRecordDO = walletWithdrawRecordMapper.selectById(walletBillRecordDO.getWithdrawRecordId());
                     withdrawRecordDO.setWithdrawState(Constants.WALLET_WITHDRAW_STATE.FAILURE.name());
+                    walletBillRecordDO.setRemark("账户资金提现失败");
                     walletWithdrawRecordMapper.updateById(withdrawRecordDO);
                 }
             }
diff --git a/src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java b/src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java
index 3d02608..95332d8 100644
--- a/src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java
+++ b/src/main/java/com/mzl/flower/service/impl/wallet/WalletWithdrawRecordServiceImpl.java
@@ -244,6 +244,7 @@
             }
 
             //记录转账状态,定时任务定时获取状态并更新钱包交易记录表信息
+            walletBillRecordDO.setRemark("账户资金提现中");
             walletBillRecordMapper.insert(walletBillRecordDO);
             //不需要更新结算单了,此时提现的金额和计算单上的金额不一致
         }
diff --git a/src/main/resources/mapper/wallet/WalletBillRecordMapper.xml b/src/main/resources/mapper/wallet/WalletBillRecordMapper.xml
index 88825d4..ea5b876 100644
--- a/src/main/resources/mapper/wallet/WalletBillRecordMapper.xml
+++ b/src/main/resources/mapper/wallet/WalletBillRecordMapper.xml
@@ -38,7 +38,7 @@
 
     </select>
     <select id="queryPage" resultType="com.mzl.flower.dto.response.wallet.WalletBillRecordVO">
-        select t.* ,s.name supplierName from t_wallet_bill_record t
+        select t.* ,s.name supplierName ,w.approve_time as approveTime  from t_wallet_bill_record t
         left join t_supplier_info s on t.supplier_id = s.id
         left join t_wallet_withdraw_record w on t.withdraw_record_id = w.id
         where t.deleted= 0
@@ -49,37 +49,28 @@
             and t.supplier_id = #{dto.supplierId}
         </if>
         <if test="dto.type != null and dto.type != ''">
-            and t.type = #{type}
+            and t.type = #{dto.type}
         </if>
         <if test="dto.orderNo != null and dto.orderNo != ''">
-            and torder_no = like concat('%', #{orderNo}, '%')
+            and t.order_no  like concat('%', #{dto.orderNo}, '%')
         </if>
         <if test="dto.createStartDate!=null ">
-            <![CDATA[.
-               AND w.create_time &gt;= #{dto.createStartDate}
-            ]]>
+            AND DATE_FORMAT(w.create_time, '%Y-%m-%d') &gt;= #{dto.createStartDate}
         </if>
         <if test="dto.endEndDate!=null ">
-            <![CDATA[
-               AND w.create_time &lt;= #{dto.endEndDate}
-            ]]>
+            AND DATE_FORMAT(w.create_time, '%Y-%m-%d') &lt;= #{dto.endEndDate}
         </if>
         <if test="dto.approveStartDate!=null ">
-            <![CDATA[
-               AND w.approve_time &gt;= #{dto.approveStartDate}
-            ]]>
+            AND DATE_FORMAT(w.approve_time, '%Y-%m-%d') &gt;= #{dto.approveStartDate}
         </if>
         <if test="dto.approveEndDate!=null ">
-            <![CDATA[
-               AND w.approve_time &lt;= #{dto.approveStartDate}
-            ]]>
+            AND DATE_FORMAT(w.approve_time, '%Y-%m-%d') &lt;= #{dto.approveEndDate}
         </if>
-
         order by t.create_time
     </select>
 
     <select id="queryWalletBillRecordList" resultType="com.mzl.flower.dto.response.wallet.WalletBillRecordVO">
-        select t.* ,s.name supplierName from t_wallet_bill_record t
+        select t.* , s.name supplierName, w.approve_time as approveTime from t_wallet_bill_record t
         left join t_supplier_info s on t.supplier_id = s.id
         left join t_wallet_withdraw_record w on t.withdraw_record_id = w.id
         where t.deleted= 0
@@ -90,32 +81,23 @@
             and t.supplier_id = #{dto.supplierId}
         </if>
         <if test="dto.type != null and dto.type != ''">
-            and t.type = #{type}
+            and t.type = #{dto.type}
         </if>
         <if test="dto.orderNo != null and dto.orderNo != ''">
-            and t.order_no = like concat('%', #{orderNo}, '%')
+            and t.order_no  like concat('%', #{dto.orderNo}, '%')
         </if>
         <if test="dto.createStartDate!=null ">
-            <![CDATA[
-               AND w.create_time &gt;= #{dto.createStartDate}
-            ]]>
+            AND DATE_FORMAT(w.create_time, '%Y-%m-%d') &gt;= #{dto.createStartDate}
         </if>
         <if test="dto.endEndDate!=null ">
-            <![CDATA[
-               AND w.create_time &lt;= #{dto.endEndDate}
-            ]]>
+            AND DATE_FORMAT(w.create_time, '%Y-%m-%d') &lt;= #{dto.endEndDate}
         </if>
         <if test="dto.approveStartDate!=null ">
-            <![CDATA[
-               AND w.approve_time &gt;= #{dto.approveStartDate}
-            ]]>
+            AND DATE_FORMAT(w.approve_time, '%Y-%m-%d') &gt;= #{dto.approveStartDate}
         </if>
         <if test="dto.approveEndDate!=null ">
-            <![CDATA[
-               AND w.approve_time &lt;= #{dto.approveStartDate}
-            ]]>
+            AND DATE_FORMAT(w.approve_time, '%Y-%m-%d') &lt;= #{dto.approveEndDate}
         </if>
-
         order by t.create_time
     </select>
 </mapper>
diff --git a/src/main/resources/mapper/wallet/WalletWithdrawRecordMapper.xml b/src/main/resources/mapper/wallet/WalletWithdrawRecordMapper.xml
index 8bb732b..f840ba2 100644
--- a/src/main/resources/mapper/wallet/WalletWithdrawRecordMapper.xml
+++ b/src/main/resources/mapper/wallet/WalletWithdrawRecordMapper.xml
@@ -30,31 +30,23 @@
         <if test="dto.supplierId != null and dto.supplierId != ''">
             and t.supplier_id = #{dto.supplierId}
         </if>
-        <if test="dto.withdrawState != null and dto.withdrawState != ''">
-            and t.withdraw_state = #{dto.withdrawState}
+        <if test="dto.approveState != null and dto.approveState != ''">
+            and t.approve_state = #{dto.approveState}
         </if>
         <if test="dto.createStartDate!=null ">
-            <![CDATA[
                AND DATE_FORMAT(t.create_time, '%Y-%m-%d') &gt;= #{dto.createStartDate}
-            ]]>
         </if>
         <if test="dto.endEndDate!=null ">
-            <![CDATA[
                AND DATE_FORMAT(t.create_time, '%Y-%m-%d') &lt;= #{dto.endEndDate}
-            ]]>
         </if>
         <if test="dto.approveStartDate!=null ">
-            <![CDATA[
-               AND t.approve_time &gt;= #{dto.approveStartDate}
-            ]]>
+            AND DATE_FORMAT(t.approve_time, '%Y-%m-%d') &gt;= #{dto.approveStartDate}
         </if>
         <if test="dto.approveEndDate!=null ">
-            <![CDATA[
-               AND t.approve_time &lt;= #{dto.approveStartDate}
-            ]]>
+            AND DATE_FORMAT(t.approve_time, '%Y-%m-%d') &lt;= #{dto.approveEndDate}
         </if>
 
-        order by t.create_time
+        order by t.create_time desc
     </select>
 
 </mapper>

--
Gitblit v1.9.3