From 2723b71882f6b34d7c443019d1bb5674250c1893 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 01 Jul 2021 16:50:05 +0800
Subject: [PATCH] fix

---
 gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java b/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java
index 34fe401..b803ccc 100644
--- a/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java
+++ b/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java
@@ -3,6 +3,7 @@
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.StrUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.xzx.gc.common.exception.RestException;
@@ -118,7 +119,7 @@
         List<AccountInfo> accountInfos = accountMapper.selectByExample(exampleAccount);
         if(CollUtil.isNotEmpty(accountInfos)){
             AccountInfo accountInfo = accountInfos.get(0);
-            Integer collectScore = Integer.parseInt(accountInfo.getCollectScore());
+            String collectScore = StrUtil.isEmpty(accountInfo.getCollectScore())?"0":accountInfo.getCollectScore();
 //            collectScore = collectScore + model.getScore();
             accountInfo.setCollectScore(model.getScore().toString());
             accountMapper.updateByPrimaryKey(accountInfo);
@@ -126,9 +127,9 @@
             ScoreDetails scoreDetailsRet = new ScoreDetails();
             scoreDetailsRet.setUserId(model.getUserId());
             scoreDetailsRet.setType(ScoreDetails.SCORE_TYPE_ADMIN_RECHARGE);
-            scoreDetailsRet.setOriginalScore(new BigDecimal(collectScore));
-            scoreDetailsRet.setCurrentScore(new BigDecimal(model.getScore()));
-            scoreDetailsRet.setChangeScore(new BigDecimal(model.getScore()));
+            scoreDetailsRet.setOriginalScore(new BigDecimal(collectScore).setScale( 0, BigDecimal.ROUND_DOWN ));
+            scoreDetailsRet.setCurrentScore(new BigDecimal(model.getScore()).setScale( 0, BigDecimal.ROUND_DOWN ));
+            scoreDetailsRet.setChangeScore(new BigDecimal(model.getScore()).setScale( 0, BigDecimal.ROUND_DOWN ));
             scoreDetailsRet.setCreatedTime(new Date());
             accountMapper.insertScoreDetailsRet(scoreDetailsRet);
         }
@@ -142,8 +143,7 @@
         List<AccountInfo> accountInfos = accountMapper.selectByExample(exampleAccount);
         if(CollUtil.isNotEmpty(accountInfos)){
             AccountInfo accountInfo = accountInfos.get(0);
-            Integer collectScore = Integer.parseInt(accountInfo.getCollectScore());
-            getScoreNumVo.setScore(new BigDecimal(collectScore));
+            getScoreNumVo.setScore(new BigDecimal(StrUtil.isEmpty(accountInfo.getCollectScore())?"0":accountInfo.getCollectScore()).setScale( 0, BigDecimal.ROUND_DOWN ));
         }
         return getScoreNumVo;
     }

--
Gitblit v1.9.1