From d72144356fc64bdd7700fb9ed191fed9f24342eb Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期三, 31 七月 2019 14:25:52 +0800
Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
---
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 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 9fe5b0c..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, "璁㈠崟淇℃伅鑾峰彇澶辫触");
}
--
Gitblit v1.8.0