From 1190a0881c6dcd0cbb9117d4d7c0f3a57d99bf23 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期六, 03 八月 2019 09:54:19 +0800
Subject: [PATCH] 热销去掉super、拼多多商品详情bug
---
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java | 97 +++++++++---------------------------------------
1 files changed, 18 insertions(+), 79 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
index 4e78043..5b8f48c 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -609,7 +609,7 @@
@Transactional
@Override
- public void useGoodsCoupon(Long uid, Long id, Long goodId) throws UserSystemCouponException, Exception {
+ public void useGoodsCoupon(Long uid, Long id, Long goodId, Integer sourceType) throws UserSystemCouponException, Exception {
if (uid == null) {
throw new UserSystemCouponException(1, "鐢ㄦ埛鏈櫥褰�");
}
@@ -660,7 +660,7 @@
// 鎻掑叆浣跨敤鍒歌褰�
UserSystemCouponRecord couponRecord = new UserSystemCouponRecord();
couponRecord.setGoodId(goodId);
- couponRecord.setGoodSource(Constant.SOURCE_TYPE_TAOBAO); // 榛樿娣樺疂
+ couponRecord.setGoodSource(sourceType); // 榛樿娣樺疂
couponRecord.setState(UserSystemCouponRecord.STATE_WAIT); // 姝e湪鍖归厤
couponRecord.setUserSystemCoupon(userSystemCoupon);
couponRecord.setCouponType(baseCoupon.getType().name());
@@ -684,12 +684,16 @@
@Transactional
@Override
- public void useOrderCoupon(Long uid, Long id, String orderNo) throws UserSystemCouponException, Exception {
+ public void useOrderCoupon(Long uid, Long id, String orderNo, Integer sourceType) throws UserSystemCouponException, Exception {
if (id == null) {
throw new UserSystemCouponException(1, "鍒竔d涓嶅瓨鍦�");
}
-
+
+ if (sourceType == null) {
+ sourceType = Constant.SOURCE_TYPE_TAOBAO;
+ }
+
// 鐢ㄦ埛鍒�
UserSystemCoupon userSystemCoupon = selectByPrimaryKey(id);
if (userSystemCoupon == null) {
@@ -724,7 +728,7 @@
}
// 璁㈠崟
- CommonOrderVO orderVO = commonOrderService.getCommonOrderByOrderNo(uid, orderNo, CommonOrder.STATE_JS);
+ CommonOrderVO orderVO = commonOrderService.getCommonOrderByOrderNo(uid, orderNo, CommonOrder.STATE_JS, sourceType);
if (orderVO == null) {
throw new UserSystemCouponException(1, "璁㈠崟淇℃伅鑾峰彇澶辫触");
}
@@ -738,7 +742,7 @@
// 鏉′欢: A:蹇呴』鏄繑鍒╄鍗� 銆丅:蹇呴』宸茬粡澶勪簬宸插埌璐︾姸鎬�
if (HongBaoV2.TYPE_ZIGOU == hongBaoType && HongBaoV2.STATE_YILINGQU == hongBaoState || hongBao != null) {
- Order order = orderService.findOrderByOrderIdAndType(orderNo, Order.ORDER_TYPE_TAOBAO);
+ Order order = orderService.findOrderByOrderIdAndType(orderNo, sourceType);
if (order == null)
return;
@@ -760,19 +764,20 @@
hongBaoV2.setUserInfo(new UserInfo(uid));
hongBaoV2.setPreGetTime(new Date());
hongBaoV2.setGetTime(new Date());
+
hongBaoV2Service.insertSelective(hongBaoV2);
// 2.鎻掑叆鍏宠仈
orderHongBaoMapService.addOrderHongBaoMap(hongBaoV2, order);
// 3.鎻掑叆璧勯噾鏄庣粏,鐢ㄦ埛浣欓
- UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createOrderReward(orderNo, money,
+ UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createOrderReward(orderNo, sourceType, money,
new UserInfo(uid));
userMoneyDetailService.addUserMoneyDetail(userMoneyDetail);
userInfoService.addMoney(new UserInfo(uid), money);
// 鎻掑叆璧勯噾閫氱煡
- userMoneyMsgNotificationService.orderReward(uid, orderNo, money,
+ userMoneyMsgNotificationService.orderReward(uid, orderNo, sourceType, money,
userInfoService.selectByPKey(uid).getMyHongBao());
/* 鐢ㄦ埛鍒镐俊鎭姸鎬佸強璁板綍澶勭悊 */
@@ -787,6 +792,7 @@
// 鎻掑叆浣跨敤鍒歌褰�
UserSystemCouponRecord couponRecord = new UserSystemCouponRecord();
couponRecord.setState(UserSystemCouponRecord.STATE_SUCCESS);
+ couponRecord.setGoodSource(sourceType);
couponRecord.setOrderNo(orderNo);
couponRecord.setUserSystemCoupon(userSystemCoupon);
couponRecord.setCouponType(systemCoupon.getType().name());
@@ -805,7 +811,7 @@
}
@Override
- public UserSystemCouponRecordVO getRewardCouponRecord(String orderNo) throws UserSystemCouponException, Exception {
+ public UserSystemCouponRecordVO getRewardCouponRecord(String orderNo, Integer sourceType) throws UserSystemCouponException, Exception {
if (orderNo == null || orderNo.trim().length() == 0) {
throw new UserSystemCouponException(1, "璁㈠崟鍙蜂笉瀛樺湪");
@@ -841,7 +847,7 @@
Long uid = userSystemCoupon.getUid();
CommonOrderVO commonOrderVO = commonOrderService.getCommonOrderByOrderNo(userSystemCoupon.getUid(), orderNo,
- CommonOrder.STATE_JS);
+ CommonOrder.STATE_JS, sourceType);
if (commonOrderVO == null) {
throw new UserSystemCouponException(1, "璁㈠崟淇℃伅鑾峰彇澶辫触");
@@ -883,7 +889,7 @@
}
@Override
- public UserSystemCouponRecordVO getFreeCouponRecord(String orderNo) throws UserSystemCouponException, Exception {
+ public UserSystemCouponRecordVO getFreeCouponRecord(String orderNo, Integer sourceType) throws UserSystemCouponException, Exception {
if (orderNo == null || orderNo.trim().length() == 0) {
throw new UserSystemCouponException(1, "璁㈠崟鍙蜂笉瀛樺湪");
@@ -911,7 +917,7 @@
}
// 璁㈠崟
- CommonOrderVO orderVO = commonOrderService.getCommonOrderByOrderNo(userSystemCoupon.getUid(), orderNo, null);
+ CommonOrderVO orderVO = commonOrderService.getCommonOrderByOrderNo(userSystemCoupon.getUid(), orderNo, null, sourceType);
if (orderVO == null) {
throw new UserSystemCouponException(1, "璁㈠崟淇℃伅鑾峰彇澶辫触");
}
@@ -1504,73 +1510,6 @@
}
userInfoExtraService.saveUserInfoExtra(userInfoExtra);
- }
-
-
-
- @Transactional
- public void randomRewardCouponForPush(Integer amount, Long uid) throws Exception {
- int coupon = 0;
-
- for (int i = 0; i < amount; i++) {
- // 绯荤粺闅忔満
- BigDecimal percent = new BigDecimal(randomNum());
-
- // 鏌ヨ濂栧姳鍒�
- SystemCoupon systemCoupon = systemCouponService.getCouponByTypeAndPercent(
- CouponTypeEnum.rebatePercentCoupon.name(),percent);
-
- if (systemCoupon == null) {
- return;
- }
-
- // 缁撴潫鏃ユ湡
- // 浠婂ぉ鍦ㄥ唴 鍑忓幓涓�澶�
- String endDay = DateUtil.plusDay(systemCoupon.getExpiryDay() - 1, new Date());
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
- Date endTime = format.parse(endDay);
-
- UserSystemCoupon userCoupon = new UserSystemCoupon();
- userCoupon.setUid(uid);
- userCoupon.setSource(UserSystemCoupon.SOURCE_SYSTEM_PUSH);
- userCoupon.setSystemCoupon(systemCoupon);
- userCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
- userCoupon.setStateActivated(1);
- userCoupon.setStartTime(new Date());
- userCoupon.setEndTime(endTime);
- userCoupon.setCreateTime(new Date());
- userCoupon.setUpdateTime(new Date());
- // 鎻掑叆鏁版嵁搴�
- insertSelective(userCoupon);
-
- // 鍒告暟閲�
- coupon ++;
-
- // 娑堟伅鎺ㄩ��
- try {
- userOtherMsgNotificationService.rewardCouponGet(userCoupon,systemCoupon.getPercent().intValue());
- } catch(Exception e) {
- try {
- LogHelper.errorDetailInfo(e);
- } catch (Exception e1) {
- e1.printStackTrace();
- }
- }
- }
-
- // 鑾峰彇棰濆淇℃伅
- UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
- if (userInfoExtra == null) {
- return;
- }
-
- Integer couponNews = userInfoExtra.getCouponNews();
- if (couponNews == null) {
- userInfoExtra.setCouponNews(coupon);
- } else {
- userInfoExtra.setCouponNews(couponNews + coupon);
- }
- userInfoExtraService.saveUserInfoExtra(userInfoExtra);
}
--
Gitblit v1.8.0