From 3672aec5bf6c2c6da4cb7ab4a8b5f314a22c5831 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期一, 19 八月 2019 17:32:00 +0800 Subject: [PATCH] 退回淘礼金 --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java | 32 ++++++++++++++++++++++++-------- 1 files changed, 24 insertions(+), 8 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 4f358ad..46b9769 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 @@ -1894,12 +1894,16 @@ long num = 10000 + (long) (Math.random() * 10000); token = UserUtil.getInviteCode(num); + String endDay = DateUtil.plusDay(Constant.TOKEN_DAYS - 1,nowDate); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + Date endTime = format.parse(endDay); + TokenRecord tokenRecord = new TokenRecord(); tokenRecord.setUid(uid); tokenRecord.setIdentify(id+""); tokenRecord.setType(tokenTypeEnum); tokenRecord.setStartTime(nowDate); - tokenRecord.setEndTime(DateUtil.plusDayDate(3, nowDate)); + tokenRecord.setEndTime(endTime); tokenRecord.setToken(token); tokenRecord.setState(0); tokenRecordService.insertSelective(tokenRecord); @@ -1917,16 +1921,30 @@ throw new UserSystemCouponException(1, "鍙d护鐢熸垚澶辫触"); // 鎻掑叆璧犻�佽褰� - UserSystemCouponGiveRecord giveRecord = new UserSystemCouponGiveRecord(); - giveRecord.setCouponId(id); - giveRecord.setGiveUid(uid); - giveRecord.setGiveTime(nowDate); - userSystemCouponGiveRecordService.insertSelective(giveRecord); + try { + String endDay = DateUtil.plusDay(Constant.GIVE_DAYS - 1, new Date()); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + Date endTime = format.parse(endDay); + + UserSystemCouponGiveRecord giveRecord = new UserSystemCouponGiveRecord(); + giveRecord.setCouponId(id); + giveRecord.setGiveUid(uid); + giveRecord.setGiveTime(nowDate); + giveRecord.setEndTime(endTime); + userSystemCouponGiveRecordService.insertSelective(giveRecord); + } catch (Exception e) { + LogHelper.errorDetailInfo(e); + throw new UserSystemCouponException(1, "璧犻�佽褰曞垱寤哄け璐�"); + } } if(StringUtil.isNullOrEmpty(token)) throw new UserSystemCouponException(1, "鍙d护鐢熸垚澶辫触"); + userSystemCoupon.setState(UserSystemCoupon.STATE_IN_USE); + userSystemCoupon.setGive(true); + userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon); + String tips = "閫佺粰浣犱竴寮犺繑鍒╁鍔卞埜蹇幓棰嗗彇鍚э紝澶嶅埗鏈潯娑堟伅[&%s&]锛屾墦寮�[杩斿埄鍒竇App棰嗗彇锛屼娇鐢ㄥ悗鍙杩斿埄鍔犲�嶃�俓r\n" +"----------------------------\r\n" + "涓嬭浇[杩斿埄鍒竇App閾炬帴:%s\r\n" @@ -1957,8 +1975,6 @@ couponRecord.setCreateTime(date); couponRecord.setUpdateTime(date); userSystemCouponRecordService.insertSelective(couponRecord); - - // TODO 璧犻�佹秷鎭� } -- Gitblit v1.8.0