From b47abee8e59cfb2a5af241d34b397e41eed0155a Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 29 八月 2019 12:01:38 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java index b7aa3f6..19456c6 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java @@ -331,11 +331,10 @@ if (userCoupon == null || userCoupon.getGive() == null || !userCoupon.getGive() || userCoupon.getState() != UserSystemCoupon.STATE_IN_USE) throw new TokenRecordException(1, "璇ュ埜涓嶅瓨鍦ㄦ垨闈炶禒閫�"); - - + UserSystemCoupon userSystemCoupon= null; try { - userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCoupon.name(), + userSystemCoupon = userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCoupon.name(), UserSystemCoupon.SOURCE_GIVE, null); } catch (Exception e) { LogHelper.errorDetailInfo(e); @@ -362,9 +361,13 @@ // 鏇存柊璧犻�佽褰� UserSystemCouponGiveRecord updateGiveRecord = new UserSystemCouponGiveRecord(); + updateGiveRecord.setId(giveRecord.getId()); updateGiveRecord.setReceiveUid(uid); updateGiveRecord.setReceiveTime(new Date()); updateGiveRecord.setState(UserSystemCouponGiveRecord.STATE_RECEIVE); + if (userSystemCoupon != null) { + updateGiveRecord.setReceiveId(userSystemCoupon.getId()); + } userSystemCouponGiveRecordService.updateByPrimaryKeySelective(updateGiveRecord); integralGetService.addGiveFreeCoupon(giveUid); @@ -419,8 +422,9 @@ if (systemCoupon == null) throw new TokenRecordException(1, "璇ュ埜涓嶅瓨鍦�"); + UserSystemCoupon userSystemCoupon= null; try { - userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(), + userSystemCoupon = userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(), UserSystemCoupon.SOURCE_GIVE, systemCoupon.getPercent()); } catch (Exception e) { LogHelper.errorDetailInfo(e); @@ -447,9 +451,13 @@ // 鏇存柊璧犻�佽褰� UserSystemCouponGiveRecord updateGiveRecord = new UserSystemCouponGiveRecord(); + updateGiveRecord.setId(giveRecord.getId()); updateGiveRecord.setReceiveUid(uid); updateGiveRecord.setReceiveTime(new Date()); updateGiveRecord.setState(UserSystemCouponGiveRecord.STATE_RECEIVE); + if (userSystemCoupon != null) { + updateGiveRecord.setReceiveId(userSystemCoupon.getId()); + } userSystemCouponGiveRecordService.updateByPrimaryKeySelective(updateGiveRecord); integralGetService.addGiveRebateCoupon(giveUid); -- Gitblit v1.8.0