From 9a78d406f8b821117c78a1bc717fe4b5813656b1 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 06 八月 2019 09:57:51 +0800
Subject: [PATCH] 首页底部推荐,详情页猜你喜欢异常保护
---
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java | 32 ++++++++++++++++++--------------
1 files changed, 18 insertions(+), 14 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 5a1c589..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, Integer goodsType) 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, goodsType);
+ Order order = orderService.findOrderByOrderIdAndType(orderNo, sourceType);
if (order == null)
return;
@@ -766,14 +770,14 @@
// 2.鎻掑叆鍏宠仈
orderHongBaoMapService.addOrderHongBaoMap(hongBaoV2, order);
- // 3.鎻掑叆璧勯噾鏄庣粏,鐢ㄦ埛浣欓 // TODO
- UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createOrderReward(orderNo, money,
+ // 3.鎻掑叆璧勯噾鏄庣粏,鐢ㄦ埛浣欓
+ UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createOrderReward(orderNo, sourceType, money,
new UserInfo(uid));
userMoneyDetailService.addUserMoneyDetail(userMoneyDetail);
userInfoService.addMoney(new UserInfo(uid), money);
// 鎻掑叆璧勯噾閫氱煡
- userMoneyMsgNotificationService.orderReward(uid, orderNo,goodsType, money,
+ userMoneyMsgNotificationService.orderReward(uid, orderNo, sourceType, money,
userInfoService.selectByPKey(uid).getMyHongBao());
/* 鐢ㄦ埛鍒镐俊鎭姸鎬佸強璁板綍澶勭悊 */
@@ -788,7 +792,7 @@
// 鎻掑叆浣跨敤鍒歌褰�
UserSystemCouponRecord couponRecord = new UserSystemCouponRecord();
couponRecord.setState(UserSystemCouponRecord.STATE_SUCCESS);
- couponRecord.setGoodSource(goodsType);
+ couponRecord.setGoodSource(sourceType);
couponRecord.setOrderNo(orderNo);
couponRecord.setUserSystemCoupon(userSystemCoupon);
couponRecord.setCouponType(systemCoupon.getType().name());
@@ -807,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, "璁㈠崟鍙蜂笉瀛樺湪");
@@ -843,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, "璁㈠崟淇℃伅鑾峰彇澶辫触");
@@ -885,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, "璁㈠崟鍙蜂笉瀛樺湪");
@@ -913,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, "璁㈠崟淇℃伅鑾峰彇澶辫触");
}
--
Gitblit v1.8.0