| | |
| | | import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgRedPackGiveContentDTO;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.TokenRecord;
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TokenUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.vo.msg.TokenVO;
|
| | |
|
| | | @Service
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public TokenVO discernToken(String token, Long uid) throws TokenRecordException {
|
| | | public TokenVO discernToken(String token, Long uid, AcceptData acceptData) throws TokenRecordException {
|
| | | // 解析口令
|
| | | String parseToken = TokenUtil.parseToken(token);
|
| | | if (StringUtil.isNullOrEmpty(parseToken))
|
| | |
| | | throw new TokenRecordException(1, "口令已失效");
|
| | | }
|
| | | } else if (tokenType == TokenTypeEnum.redPack) {
|
| | | if(!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | throw new TokenRecordException(1, "请升级到最新版");
|
| | | |
| | | |
| | | type = 13;
|
| | | RedPackGiveRecord giveRecord = redPackGiveRecordService.selectByPrimaryKey(Long.parseLong(identify));
|
| | | if (giveRecord == null)
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | public String receiveToken(String token, Long uid) throws TokenRecordException {
|
| | | public String receiveToken(String token, Long uid, AcceptData acceptData) throws TokenRecordException {
|
| | | if (uid == null || uid <= 0)
|
| | | throw new TokenRecordException(1, "用户未登录");
|
| | |
|
| | |
| | | }
|
| | | });
|
| | | } else if (tokenType == TokenTypeEnum.redPack) {
|
| | | if(!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | throw new TokenRecordException(1, "请升级到最新版");
|
| | | |
| | | try {
|
| | | msg = "领取红包成功,请到[我的-红包]中查看";
|
| | | // 领取红包、更新记录
|
| | |
| | | if (user != null && !StringUtil.isNullOrEmpty(user.getNickName()))
|
| | | userName = user.getNickName();
|
| | | MsgRedPackGiveContentDTO givedto = new MsgRedPackGiveContentDTO();
|
| | | givedto.setTitle("红包领取");
|
| | | givedto.setTitle("红包赠送");
|
| | | givedto.setUserInfo("昵称:" + userName + " ID:" + uid);
|
| | | givedto.setTime(sd.format(new Date()));
|
| | | givedto.setMoney("¥" + giveRecord.getAmount().setScale(2));
|
| | |
| | | try {
|
| | | UserInfo user = userInfoService.selectByPKey(giveUid);
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | |
| | | String inviteCode = null;
|
| | | if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCodeVip())) {
|
| | | inviteCode = userInfoExtra.getInviteCodeVip();
|
| | | } else {
|
| | | inviteCode = userInfoExtra.getInviteCode();
|
| | | }
|
| | | |
| | | MsgInviteContentDTO msgInvite = new MsgInviteContentDTO();
|
| | | msgInvite.setTitle("邀请消息");
|
| | | msgInvite.setState("成功激活邀请");
|
| | | msgInvite.setCode("你的邀请码:" + userInfoExtra.getInviteCode());
|
| | | msgInvite.setCode("你的邀请码:" + inviteCode);
|
| | | msgInvite.setInviter("昵称:"+user.getNickName());
|
| | | msgInvite.setMode("成功领取邀请人的" + giftName);
|
| | | userInviteMsgNotificationService.receiveGift(uid, "邀请关系一旦确立无法更改 ", msgInvite);
|
| | |
| | | return;
|
| | | Date date = new Date();
|
| | | for (TokenRecord tokenRecord: list) {
|
| | | Integer state = tokenRecord.getState();
|
| | | if (state != null && state == 0) |
| | | continue;
|
| | | |
| | | tokenRecord.setState(1);
|
| | | tokenRecord.setUpdateTime(date);
|
| | | tokenRecordMapper.updateByPrimaryKeySelective(tokenRecord);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void invalidByRedPack(Long id) {
|
| | | if (id == null)
|
| | | return;
|
| | | |
| | | List<String> list = new ArrayList<String>();
|
| | | list.add(TokenTypeEnum.redPack.name());
|
| | | tokenRecordMapper.invalidByTypeAndIdentify(list, id.toString());
|
| | | }
|
| | | |
| | | @Override
|
| | | public void invalidByCoupon(Long id) {
|
| | | if (id == null)
|
| | | return;
|
| | | |
| | | List<String> list = new ArrayList<String>();
|
| | | list.add(TokenTypeEnum.freeCoupon.name());
|
| | | list.add(TokenTypeEnum.rebatePercentCoupon.name());
|
| | | tokenRecordMapper.invalidByTypeAndIdentify(list, id.toString());
|
| | | }
|
| | | }
|