From b141df9bf9764db8567efebed48006e12ab1f657 Mon Sep 17 00:00:00 2001
From: wzy <wzy19931122ai@163.com>
Date: Sun, 14 Aug 2022 15:52:45 +0800
Subject: [PATCH] fix:jhy 停止下单

---
 gc-order/src/main/java/com/xzx/gc/order/service/DistribService.java |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gc-order/src/main/java/com/xzx/gc/order/service/DistribService.java b/gc-order/src/main/java/com/xzx/gc/order/service/DistribService.java
index 65b15db..b9e8a1f 100644
--- a/gc-order/src/main/java/com/xzx/gc/order/service/DistribService.java
+++ b/gc-order/src/main/java/com/xzx/gc/order/service/DistribService.java
@@ -5,6 +5,7 @@
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import com.xzx.gc.common.constant.CommonEnum;
+import com.xzx.gc.common.constant.Constants;
 import com.xzx.gc.entity.*;
 import com.xzx.gc.order.mapper.*;
 import lombok.extern.slf4j.Slf4j;
@@ -67,7 +68,7 @@
         }
 
         Integer count = userHeadDetailsMapper.selectDetailsCount(userId);
-//        UserInfo userInfo = userMapper.selectByPrimaryKey(userId);
+        UserInfo userInfo = userMapper.selectByPrimaryKey(userId);
         AccountInfo accountInfo = accountMapper.selectAccountInfoByUserId(userHeadRelate.getHeadUserId());
 
         if (AccountInfo.IS_PROHIBIT_Y.equals(accountInfo.getIsProhibit())) {
@@ -109,7 +110,7 @@
                     // 根据订单总积分, 1:40比例,换算成环保币,返对应百分比
                     if (StrUtil.isNotBlank(coinStr) && !"0".equals(coinStr)) {
                         BigDecimal coinRatio = new BigDecimal(coinStr).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_DOWN);
-                        BigDecimal totalCoin = totalScore.divide(new BigDecimal(50), 2, BigDecimal.ROUND_DOWN);
+                        BigDecimal totalCoin = totalScore.divide(new BigDecimal(Constants.PRICE_SCORE_EXCHANGE), 2, BigDecimal.ROUND_DOWN);
 
                         BigDecimal returnCoin = totalCoin.multiply(coinRatio).setScale(2, BigDecimal.ROUND_DOWN);
                         totalReturnCoin = totalReturnCoin.add(returnCoin);
@@ -126,6 +127,10 @@
                     }
                 }
             }
+        }
+
+        if (totalReturnCoin.intValue() == 0 && totalReturnScore.intValue() == 0) {
+            return;
         }
 
         UserHeadDetails userHeadDetails = new UserHeadDetails();
@@ -165,7 +170,7 @@
         sysMessage.setUserId(userHeadRelate.getHeadUserId());
         sysMessage.setMessageType("4");
         sysMessage.setMessageSubTypeName("返利消息");
-        sysMessage.setMessage("收到用户:" + accountInfo.getAccountName().replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2") + "的订单返利, 积分:" + totalReturnScore +", 环保币:" + totalReturnCoin);
+        sysMessage.setMessage("收到用户:" + userInfo.getMobilePhone().replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2") + "的订单返利, 积分:" + totalReturnScore +", 环保币:" + totalReturnCoin);
         sysMessage.setFlag("2");
         sysMessageMapper.insert(sysMessage);
     }

--
Gitblit v1.9.1