From bda6cfcefe85e5782864dc9e84b412efe19e68f9 Mon Sep 17 00:00:00 2001
From: chenjiahe <763432473@qq.com>
Date: 星期二, 30 一月 2024 17:16:27 +0800
Subject: [PATCH] Merge branch 'master-prod-new' into chenjiahe-再生俱乐部

---
 phi_platform_user/src/main/java/com/hx/phip/service/impl/UserValueAddedFundRecordServiceImpl.java |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/impl/UserValueAddedFundRecordServiceImpl.java b/phi_platform_user/src/main/java/com/hx/phip/service/impl/UserValueAddedFundRecordServiceImpl.java
index 3d8791e..2626648 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/service/impl/UserValueAddedFundRecordServiceImpl.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/service/impl/UserValueAddedFundRecordServiceImpl.java
@@ -206,12 +206,12 @@
                     // 鍒ゆ柇浣跨敤鐨勯噾棰濇槸鍚﹀ぇ浜庤褰曞彲浠ヤ娇鐢ㄥ鍊奸噾閲戦
                     if (opNumber.compareTo(userValueAddedFundRecord.getNotUsedAmount()) >= 0) {
                         // 鎿嶄綔鍑忔墸澧炲�奸噾鏁伴噺
-                        operatorUserValueAddedFundRecord(userValueAddedFundRecord, userValueAddedFundRecord.getNotUsedAmount().negate(), userMoneyUnclaimed);
+                        operatorUserValueAddedFundRecord(userValueAddedFundRecord, userValueAddedFundRecord.getNotUsedAmount().negate(), userMoneyUnclaimed, BaseEntity.NO);
                         // 鎿嶄綔浣跨敤澧炲�奸噾
                         opNumber = opNumber.subtract(userValueAddedFundRecord.getNotUsedAmount());
                     } else {
                         // 鎿嶄綔鍑忔墸澧炲�奸噾鏁伴噺
-                        operatorUserValueAddedFundRecord(userValueAddedFundRecord, opNumber.negate(), userMoneyUnclaimed);
+                        operatorUserValueAddedFundRecord(userValueAddedFundRecord, opNumber.negate(), userMoneyUnclaimed, BaseEntity.NO);
                         // 鎿嶄綔浣跨敤澧炲�奸噾
                         opNumber = BigDecimal.ZERO;
                     }
@@ -305,14 +305,14 @@
                     // 鍒ゆ柇鍦ㄦ湁鏁堟湡鐨勬搷浣滈�昏緫 鍦ㄦ湁鏁堟湡涓嶇敤澧炲姞鏂扮殑澧炲�奸噾璁板綍
                     if (userValueAddedFundRecord.getLimitStartTime().getTime() <= nowDate.getTime() && userValueAddedFundRecord.getLimitEndTime().getTime() > nowDate.getTime()) {
                         // 鎿嶄綔鍥為��澧炲�奸噾鏁伴噺 涓嶉渶瑕佸啀娣诲姞璁板綍鐨�
-                        operatorUserValueAddedFundRecord(userValueAddedFundRecord, residueNumber, userMoneyUnclaimed);
+                        operatorUserValueAddedFundRecord(userValueAddedFundRecord, residueNumber, userMoneyUnclaimed, BaseEntity.NO);
                         // 鏁伴噺绱 涓嶉渶瑕佸啀娣诲姞璁板綍鐨�
                         noRecordNumber = noRecordNumber.add(residueNumber);
                     }
                     // 涓嶅湪鏈夋晥鏈熺殑鍥為��閫昏緫
                     else if (userValueAddedFundRecord.getLimitEndTime().getTime() <= nowDate.getTime()) {
                         // 鎿嶄綔鍥為��澧炲�奸噾鏁伴噺 涓嶅湪鏈夋晥鏈熶笉鐢ㄥ鍔犳柊鐨勫鍊奸噾璁板綍 鐩存帴璁╁鍊奸噾杩囨湡浜�
-                        operatorUserValueAddedFundRecord(userValueAddedFundRecord, residueNumber, userMoneyUnclaimed);
+                        operatorUserValueAddedFundRecord(userValueAddedFundRecord, residueNumber, userMoneyUnclaimed, BaseEntity.YES);
                         // 鏁伴噺绱 杩囨湡澧炲�奸噾鐩存帴娓呴櫎鐨�
                         noBackNumber = noBackNumber.add(residueNumber);
                     }
@@ -381,8 +381,9 @@
      * @param userValueAddedFundRecord 鐢ㄦ埛澧炲�奸噾璁板綍
      * @param opNumber 鎿嶄綔閲戦
      * @param userMoneyUnclaimed 寰呴鍙栬祫浜у垪琛�
+     * @param isExpire 鏄惁杩囨湡 0 鍚� 1 鏄�
      */
-    private void operatorUserValueAddedFundRecord(UserValueAddedFundRecord userValueAddedFundRecord, BigDecimal opNumber, UserMoneyUnclaimed userMoneyUnclaimed) {
+    private void operatorUserValueAddedFundRecord(UserValueAddedFundRecord userValueAddedFundRecord, BigDecimal opNumber, UserMoneyUnclaimed userMoneyUnclaimed, int isExpire) {
         SqlSentence sqlSentence = new SqlSentence();
         Map<String, Object> sqlValue = new HashMap<>();
         sqlValue.put("isDel", BaseEntity.NO);
@@ -394,6 +395,10 @@
         BigDecimal opAfterNumber = userValueAddedFundRecord.getNotUsedAmount().subtract(opNumber.negate());
         // 鍒ゆ柇鏄噺鎵h繕鏄洖閫� 姝f暟鏄洖閫� 璐熸暟鏄娇鐢�
         sql.append(" notUsedAmount=notUsedAmount+#{m.opNumber},usedAmount = usedAmount-#{m.opNumber} ");
+        // 杩囨湡澶勭悊涓嬭繃鏈熸椂闂�
+        if (BaseEntity.YES.equals(isExpire)){
+            sql.append(" ,expirationTime = NOW() ");
+        }
         sql.append(" WHERE isDel = #{m.isDel} AND id = #{m.id} AND userId = #{m.userId}");
         sqlSentence.sqlSentence(sql.toString(), sqlValue);
         int count = commonService.updateWhere(UserValueAddedFundRecordMapper.class, sqlSentence);

--
Gitblit v1.8.0