| | |
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | |
|
| | |
|
| | | @Override
|
| | | public void insertSelective(TokenRecord record) {
|
| | | record.setCreateTime(new Date());
|
| | | record.setUpdateTime(new Date());
|
| | | tokenRecordMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public void updateByPrimaryKeySelective(TokenRecord record) {
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public TokenVO discernToken(String token, Long uid, AcceptData acceptData) throws TokenRecordException {
|
| | | public TokenVO discernToken(String token, Long uid, String platform, String version) throws TokenRecordException {
|
| | | // 解析口令
|
| | | String parseToken = TokenUtil.parseToken(token);
|
| | | if (StringUtil.isNullOrEmpty(parseToken))
|
| | |
| | | Date now = new Date();
|
| | | Date endTimeToken = rokenRecord.getEndTime();
|
| | | Integer stateTtoken = rokenRecord.getState();
|
| | | if (endTimeToken != null && endTimeToken.getTime() < now.getTime()
|
| | | || (stateTtoken != null && stateTtoken == 1) || StringUtil.isNullOrEmpty(rokenRecord.getIdentify())) |
| | | if (endTimeToken != null && endTimeToken.getTime() < now.getTime() || (stateTtoken != null && stateTtoken == 1)
|
| | | || StringUtil.isNullOrEmpty(rokenRecord.getIdentify()))
|
| | | throw new TokenRecordException(1, "口令已失效");
|
| | |
|
| | |
|
| | | Integer num = 0;
|
| | | Integer type = 0;
|
| | |
| | | if (userCoupon == null || userCoupon.getGive() == null || !userCoupon.getGive())
|
| | | throw new TokenRecordException(1, "券不存在或非赠送状态");
|
| | |
|
| | | if (userCoupon.getState() == UserSystemCoupon.STATE_OVERDUE || (endTime != null && endTime.getTime() < now.getTime())) {
|
| | | if (userCoupon.getState() == UserSystemCoupon.STATE_OVERDUE
|
| | | || (endTime != null && endTime.getTime() < now.getTime())) {
|
| | | tips.add("哎呀,这张免单券已失效了!");
|
| | | } else if (userCoupon.getState() == UserSystemCoupon.STATE_END_USE) {
|
| | | tips.add("哎呀,这张免单券已被领取了!");
|
| | |
| | | if (userCoupon == null || userCoupon.getGive() == null || !userCoupon.getGive())
|
| | | throw new TokenRecordException(1, "券不存在或非赠送状态");
|
| | |
|
| | | |
| | | if (userCoupon.getState() == UserSystemCoupon.STATE_OVERDUE|| (endTime != null && endTime.getTime() < now.getTime())) {
|
| | | if (userCoupon.getState() == UserSystemCoupon.STATE_OVERDUE
|
| | | || (endTime != null && endTime.getTime() < now.getTime())) {
|
| | | tips.add("哎呀,这张返利奖励券已失效了!");
|
| | | } else if (userCoupon.getState() == UserSystemCoupon.STATE_END_USE) {
|
| | | tips.add("哎呀,这张返利奖励券已被领取了!");
|
| | |
| | | throw new TokenRecordException(1, "口令已失效");
|
| | | }
|
| | | } else if (tokenType == TokenTypeEnum.redPack) {
|
| | | if(!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | if (!VersionUtil.greaterThan_2_0_5(platform, version))
|
| | | throw new TokenRecordException(1, "请升级到最新版");
|
| | | |
| | |
|
| | | type = 13;
|
| | | RedPackGiveRecord giveRecord = redPackGiveRecordService.selectByPrimaryKey(Long.parseLong(identify));
|
| | |
| | | tokenVO.setType(type);
|
| | | return tokenVO;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public String receiveToken(String token, Long uid, AcceptData acceptData) throws TokenRecordException {
|
| | |
| | |
|
| | | UserSystemCoupon userSystemCoupon= null;
|
| | | try {
|
| | | userSystemCoupon = userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_GIVE, systemCoupon.getPercent(),true);
|
| | | userSystemCoupon = userSystemCouponService.insertUserCoupon(uid,
|
| | | CouponTypeEnum.rebatePercentCoupon.name(), UserSystemCoupon.SOURCE_GIVE,
|
| | | systemCoupon.getPercent(), true);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | throw new TokenRecordException(1, "领取失败");
|
| | |
| | | msg = "领取成功[返利奖励券]成功,请到[我的-福利中心]中查看";
|
| | | // 消息 + 队员
|
| | | executor.execute(new Runnable() {
|
| | |
|
| | | @Override
|
| | | public void run() {
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | |
| | | try {
|
| | | msg = "领取红包成功,请到[我的-红包]中查看";
|
| | | // 领取红包、更新记录
|
| | | RedPackGiveRecord giveRecord = redPackGiveRecordService.receiveFriendsGive(uid, Long.parseLong(identify));
|
| | | RedPackGiveRecord giveRecord = redPackGiveRecordService.receiveFriendsGive(uid,
|
| | | Long.parseLong(identify));
|
| | | // 消息 + 队员
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | |
| | | dto.setUserInfo("昵称:" + giveUserName + " ID:" + giveUid);
|
| | | dto.setTime(sd.format(giveRecord.getGiveTime()));
|
| | | dto.setMoney("¥" + giveRecord.getAmount().setScale(2));
|
| | | userMoneyMsgNotificationService.redPackMsg(uid, MsgTypeMoneyTypeEnum.redPackReceiveOff, new Gson().toJson(dto), beiZhu);
|
| | | userMoneyMsgNotificationService.redPackMsg(uid, MsgTypeMoneyTypeEnum.redPackReceiveOff,
|
| | | new Gson().toJson(dto), beiZhu);
|
| | |
|
| | | // 赠送人消息
|
| | | String userName = "无";
|
| | |
| | | givedto.setUserInfo("昵称:" + userName + " ID:" + uid);
|
| | | givedto.setTime(sd.format(new Date()));
|
| | | givedto.setMoney("¥" + giveRecord.getAmount().setScale(2));
|
| | | userMoneyMsgNotificationService.redPackMsg(giveUid, MsgTypeMoneyTypeEnum.redPackGiveOff, new Gson().toJson(givedto), giveBeiZhu);
|
| | | userMoneyMsgNotificationService.redPackMsg(giveUid, MsgTypeMoneyTypeEnum.redPackGiveOff,
|
| | | new Gson().toJson(givedto), giveBeiZhu);
|
| | | }
|
| | | });
|
| | | } catch (RedPackGiveRecordException e) {
|
| | |
| | | return invite;
|
| | | }
|
| | |
|
| | | |
| | | private void addInviteMsg(Long uid, Long giveUid, String giftName) {
|
| | | try {
|
| | | UserInfo user = userInfoService.selectByPKey(giveUid);
|
| | |
| | | return tokenRecordMapper.overdueList(count);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void overdue(List<TokenRecord> list) {
|
| | | if (list == null || list.size() == 0)
|
| | |
| | | tokenRecordMapper.updateByPrimaryKeySelective(tokenRecord);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void invalidByRedPack(Long id) {
|