From eec7e789a87863c25d92c10ad5dfc22ad80c448d Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 14 七月 2020 12:36:48 +0800
Subject: [PATCH] 系统区分BUG修复

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralExchangeServiceImpl.java |   45 +++++++++++++++++++--------------------------
 1 files changed, 19 insertions(+), 26 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralExchangeServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralExchangeServiceImpl.java
index a54f30b..1edbcd5 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralExchangeServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralExchangeServiceImpl.java
@@ -6,6 +6,7 @@
 
 import javax.annotation.Resource;
 
+import com.yeshi.fanli.entity.SystemEnum;
 import org.springframework.core.task.TaskExecutor;
 import org.springframework.stereotype.Service;
 
@@ -234,6 +235,8 @@
 			throw new IntegralExchangeException(1, "褰撳墠璐︽埛涓彲鐢ㄩ噾甯佷笉瓒筹紝鏃犳硶鍏戞崲璇ュ鍝侊紒");
 		}
 
+	SystemEnum system= userInfoService.getUserSystem(uid);
+
 		String thing = "";
 		String thingNum = "";
 		int couponNews = 0;
@@ -247,22 +250,24 @@
 
 				thing = "鑷喘鍏嶅崟鍒�";
 				thingNum = "1寮�";
-				userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.freeCouponBuy.name(),
-						UserSystemCoupon.SOURCE_EXCHANGE, null);
+				userSystemCouponService.freeCouponWin(uid, CouponTypeEnum.freeCouponBuy, UserSystemCoupon.SOURCE_EXCHANGE,
+						1, true);
+				
 				once = true;
 				couponNews = 1;
 			} else if (ExchangeTypeEnum.freeCouponGive == type) {
 				thing = "璧犻�佸厤鍗曞埜";
 				thingNum = "1寮�";
-				userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.freeCouponGive.name(),
-						UserSystemCoupon.SOURCE_EXCHANGE, null);
+				userSystemCouponService.freeCouponWin(uid, CouponTypeEnum.freeCouponGive, UserSystemCoupon.SOURCE_EXCHANGE,
+						1, true);
+				
 				couponNews = 1;
 			} else if (ExchangeTypeEnum.rebatePercentCoupon == type) {
 				thing = "杩斿埄濂栧姳鍒�";
 				thingNum = "1寮�";
-				String percent = configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey());
-				userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
-						UserSystemCoupon.SOURCE_EXCHANGE, new BigDecimal(percent));
+				String percent = configService.getValue(ConfigKeyEnum.exchangeRebatePercent.getKey(),system);
+				userSystemCouponService.rewardCouponWin(uid, UserSystemCoupon.SOURCE_EXCHANGE, 1, 
+						true, new BigDecimal(percent));
 				couponNews = 1;
 			} else if (ExchangeTypeEnum.inviteCodePublish == type) {
 				thing = "閭�璇风爜鍙戝竷鍗�";
@@ -335,15 +340,15 @@
 
 			// 娑堟伅
 			final String things = thing;
+			final String exNum = thingNum;
 			executor.execute(new Runnable() {
 				@Override
 				public void run() {
-					MsgOtherExchangeContentDTO msgOther = new MsgOtherExchangeContentDTO();
-					msgOther.setState("閲戝竵鍏戞崲鎴愬姛");
-					msgOther.setExpend(goldCoin + "閲戝竵");
-					msgOther.setTotalGold(surplus + "閲戝竵");
-					msgOther.setThing(things);
-					userOtherMsgNotificationService.exchangeMsg(uid, "", msgOther);
+					if (ExchangeTypeEnum.inviteCodePublish == type) {
+						userOtherMsgNotificationService.goldCoinExChangeMsg(uid, goldCoin, surplus, things, "1寮�");
+					} else {
+						userOtherMsgNotificationService.goldCoinExChangeMsg(uid, goldCoin, surplus, things, exNum);
+					}
 				}
 			});
 
@@ -458,19 +463,7 @@
 			executor.execute(new Runnable() {
 				@Override
 				public void run() {
-					UserInfo userInfo = userInfoService.selectByPKey(record.getUid());
-					if (userInfo == null)
-						return;
-
-					String beizu = "閭�璇蜂汉锛�" + userInfo.getNickName() + "锛岄個璇风爜锛�" + inviteCode;
-
-					MsgOtherExchangeContentDTO msgOther = new MsgOtherExchangeContentDTO();
-					msgOther.setState("閲戝竵鍏戞崲鎴愬姛");
-					msgOther.setExpend(goldCoin + "閲戝竵");
-					msgOther.setTotalGold(surplus + "閲戝竵");
-					msgOther.setThing("閭�璇风爜婵�娲诲崱");
-
-					userOtherMsgNotificationService.exchangeMsg(uid, beizu, msgOther);
+					userOtherMsgNotificationService.goldCoinExChangeMsg(uid, goldCoin, surplus, "閭�璇风爜婵�娲诲崱", "1寮�");
 				}
 			});
 

--
Gitblit v1.8.0