From 54b0dd1b6f8230799b0b4490f8b39afdd53a4e4c Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期三, 21 八月 2019 09:30:57 +0800 Subject: [PATCH] 积分明细 --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java | 65 +++++++++++--------------------- 1 files changed, 22 insertions(+), 43 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 5db76ad..1d3dad9 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 @@ -62,7 +62,7 @@ import com.yeshi.fanli.util.MoneyBigDecimalUtil; import com.yeshi.fanli.util.RedisManager; import com.yeshi.fanli.util.StringUtil; -import com.yeshi.fanli.util.account.UserUtil; +import com.yeshi.fanli.util.TokenUtil; import com.yeshi.fanli.util.factory.UserMoneyDetailFactory; import com.yeshi.fanli.util.taobao.TaoBaoUtil; import com.yeshi.fanli.vo.msg.ClientTextStyleVO; @@ -1926,52 +1926,31 @@ } - Long giveRecordId = null; Date nowDate = new Date(); - // 鎻掑叆璧犻�佽褰� - try { - UserSystemCouponGiveRecord giveRecord = new UserSystemCouponGiveRecord(); - giveRecord.setCouponId(id); - giveRecord.setGiveUid(uid); - giveRecord.setGiveTime(nowDate); - giveRecord.setEndTime(DateUtil.plusDayDate(Constant.GIVE_DAYS, nowDate)); - userSystemCouponGiveRecordService.insertSelective(giveRecord); - giveRecordId = giveRecord.getId(); - } catch (Exception e) { - LogHelper.errorDetailInfo(e); - throw new UserSystemCouponException(1, "璧犻�佽褰曞垱寤哄け璐�"); - } + UserSystemCouponGiveRecord giveRecord = new UserSystemCouponGiveRecord(); + giveRecord.setCouponId(id); + giveRecord.setGiveUid(uid); + giveRecord.setGiveTime(nowDate); + giveRecord.setEndTime(DateUtil.plusDayDate(Constant.GIVE_DAYS, nowDate)); + userSystemCouponGiveRecordService.insertSelective(giveRecord); - String token = null; - for (int i = 0; i < 5; i++) { - try { - // TODO 鍙d护鐢熸垚瑙勫垯寰呭畾 - long num = 10000 + (long) (Math.random() * 10000); - token = UserUtil.getInviteCode(num); - - TokenRecord tokenRecord = new TokenRecord(); - tokenRecord.setUid(uid); - tokenRecord.setIdentify(giveRecordId+""); - tokenRecord.setType(tokenTypeEnum); - tokenRecord.setStartTime(nowDate); - tokenRecord.setEndTime(DateUtil.plusDayDate(Constant.TOKEN_DAYS, nowDate)); - tokenRecord.setToken(token); - tokenRecord.setState(0); - tokenRecordService.insertSelective(tokenRecord); - } catch (Exception e) { - LogHelper.errorDetailInfo(e); - token = null; - } + // 鍒涘缓璁板綍 + TokenRecord tokenRecord = new TokenRecord(); + tokenRecord.setUid(uid); + tokenRecord.setIdentify(giveRecord.getId()+""); + tokenRecord.setType(tokenTypeEnum); + tokenRecord.setStartTime(nowDate); + tokenRecord.setEndTime(DateUtil.plusDayDate(Constant.TOKEN_DAYS, nowDate)); + tokenRecord.setState(0); + tokenRecordService.insertSelective(tokenRecord); + + // 鍒涘缓鍙d护 + String token = TokenUtil.createToken(tokenRecord.getId()); + tokenRecord.setToken(token); + tokenRecordService.updateByPrimaryKeySelective(tokenRecord); - if(!StringUtil.isNullOrEmpty(token)) { - break; - } - } - - if(StringUtil.isNullOrEmpty(token)) - throw new UserSystemCouponException(1, "鍙d护鐢熸垚澶辫触"); - + // 鍒哥姸鎬� userSystemCoupon.setState(UserSystemCoupon.STATE_IN_USE); userSystemCoupon.setGive(true); userSystemCoupon.setUpdateTime(nowDate); -- Gitblit v1.8.0