From e1dcef9d29c8de98c603cd4880f6b272c23f1cc0 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期四, 29 八月 2019 11:53:04 +0800 Subject: [PATCH] 券退回 --- 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