From c9fdff7d45ae118eac10397d8f34661e9f2e968a Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 12 一月 2022 10:28:18 +0800
Subject: [PATCH] 礼金bug修复

---
 service-lijin/src/main/java/com/ks/lijin/service/manager/LiJinProviderTaoKeAccountManager.java |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/service-lijin/src/main/java/com/ks/lijin/service/manager/LiJinProviderTaoKeAccountManager.java b/service-lijin/src/main/java/com/ks/lijin/service/manager/LiJinProviderTaoKeAccountManager.java
index dfd0b80..a7610d4 100644
--- a/service-lijin/src/main/java/com/ks/lijin/service/manager/LiJinProviderTaoKeAccountManager.java
+++ b/service-lijin/src/main/java/com/ks/lijin/service/manager/LiJinProviderTaoKeAccountManager.java
@@ -6,6 +6,8 @@
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 import org.yeshi.utils.TimeUtil;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPool;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
@@ -20,6 +22,9 @@
 
     @Resource
     private RedisTemplate redisTemplate;
+
+    @Resource
+    private JedisPool jedisPool;
 
 
     /**
@@ -42,7 +47,16 @@
         //鑾峰彇璐﹀彿褰撴棩鐨勫晢鍝佹暟閲�
         long goodsNum = redisTemplate.opsForSet().size(goodsKey);
         //鑾峰彇璐﹀彿褰撴棩鐨勮祫閲戞秷鑰�
-        Long todayMoney = Long.parseLong(redisTemplate.opsForValue().get(accountMoneyKey) + "");
+
+        Long todayMoney = null;
+        Jedis jedis = jedisPool.getResource();
+        try {
+            todayMoney = Long.parseLong(jedis.get(accountMoneyKey) + "");
+        } catch (NumberFormatException e) {
+            jedis.set(accountMoneyKey, money.multiply(new BigDecimal(100)).intValue() + "");
+        } finally {
+            jedis.close();
+        }
 
         //鍚屾鍒版暟鎹簱
         LiJinProviderTaoKeAccount account = liJinProviderAccountMapper.selectByPrimaryKeyForUpdate(accountId);
@@ -71,7 +85,7 @@
     public void deleteInfoInRedis(Date date) {
         String day = TimeUtil.getGernalTime(date.getTime(), "yyyyMMdd");
         String goodsKey = String.format("lijingoodsnum-%s-*", day);
-        String accountMoneyKey = String.format("lijinaccountmoney-%s-%s", day);
+        String accountMoneyKey = String.format("lijinaccountmoney-%s-*", day);
         redisTemplate.delete(goodsKey);
         redisTemplate.delete(accountMoneyKey);
     }

--
Gitblit v1.8.0