| | |
| | | package com.yeshi.fanli.service.impl.user.integral;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.text.ParseException;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | |
| | |
|
| | | import com.aliyun.openservices.ons.api.Producer;
|
| | | import com.yeshi.fanli.dao.mybatis.integral.IntegralTaskRecordMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherRewardIntegralDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.integral.IntegralDetail;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTask;
|
| | |
| | | import com.yeshi.fanli.entity.integral.IntegralTaskClass;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskClass.UniqueKeyEnum;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | if (uid == null || originUid == null)
|
| | | return;
|
| | |
|
| | | String reward = configService.get("first_order_reward_boss");
|
| | | String reward = configService.get(ConfigKeyEnum.firstOrderRewardBoss.getKey());
|
| | | if (StringUtil.isNullOrEmpty(reward))
|
| | | return;
|
| | | firstOrderReward(uid, originUid, Integer.parseInt(reward), "一", beizu);
|
| | |
| | | if (uid == null || originUid == null)
|
| | | return;
|
| | |
|
| | | String reward = configService.get("first_order_reward_boss_super");
|
| | | String reward = configService.get(ConfigKeyEnum.firstOrderRewardBossSuper.getKey());
|
| | | if (StringUtil.isNullOrEmpty(reward))
|
| | | return;
|
| | | firstOrderReward(uid, originUid, Integer.parseInt(reward), "二", beizu);
|
| | |
| | | if (uid == null)
|
| | | return;
|
| | |
|
| | | String reward = configService.get("first_share_order_reward");
|
| | | String reward = configService.get(ConfigKeyEnum.firstShareOrderReward.getKey());
|
| | | if (StringUtil.isNullOrEmpty(reward))
|
| | | return;
|
| | | firstOrderReward(uid, null, Integer.parseInt(reward), null, beizu);
|
| | | //firstOrderReward(uid, null, Integer.parseInt(reward), null, beizu);
|
| | | }
|
| | |
|
| | | @Async()
|
| | |
| | | if (uid == null || originUid == null)
|
| | | return;
|
| | |
|
| | | String reward = configService.get("first_share_order_reward_boss");
|
| | | String reward = configService.get(ConfigKeyEnum.firstShareOrderRewardBoss.getKey());
|
| | | if (StringUtil.isNullOrEmpty(reward))
|
| | | return;
|
| | | firstOrderReward(uid, originUid, Integer.parseInt(reward), "一", beizu);
|
| | |
| | | integralDetailService.insertSelective(detail);
|
| | |
|
| | | // 消息
|
| | | MsgOtherRewardIntegralDTO msgOther = new MsgOtherRewardIntegralDTO();
|
| | | msgOther.setTitle("金币奖励");
|
| | | msgOther.setNum(addGoldCoin + "金币");
|
| | | msgOther.setTotal(totalGoldCoin + "金币");
|
| | | if (StringUtil.isNullOrEmpty(level)) {
|
| | | msgOther.setSource("首笔分享订单,系统奖励金币 ");
|
| | | msgOther.setExplain("首笔分享订单得到的奖金不足0.01元时奖励 ");
|
| | | if (level.equalsIgnoreCase("一") || level.equalsIgnoreCase("1")) {
|
| | | // 直接粉丝
|
| | | userOtherMsgNotificationService.goldCoinOrderSubsidyMsg(originUid, addGoldCoin, totalGoldCoin, true);
|
| | | } else {
|
| | | if (level.equalsIgnoreCase("一") || level.equalsIgnoreCase("1"))
|
| | | msgOther.setSource("直接粉丝首次下单,系统奖励金币 ");
|
| | | else
|
| | | msgOther.setSource("间接粉丝首次下单,系统奖励金币 ");
|
| | | msgOther.setExplain("仅新邀请粉丝首下单你得到的奖金不足0.01元时奖励 ");
|
| | | // 间接粉丝
|
| | | userOtherMsgNotificationService.goldCoinOrderSubsidyMsg(originUid, addGoldCoin, totalGoldCoin, false);
|
| | | }
|
| | | userOtherMsgNotificationService.firstOrderRewardMsg(uid, null, msgOther);
|
| | | |
| | | }
|
| | |
|
| | | /**
|
| | | * 推广红包折算金币
|
| | | * |
| | | * @param uid
|
| | | * @param addGoldCoin
|
| | | * @param tlj
|
| | | */
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void taoLiJinExchange(Long uid, Integer addGoldCoin, BigDecimal tlj) {
|
| | | String uniqueKey = "taoLiJinExchange-" + uid.toString();
|
| | | IntegralDetail detailRecord = integralDetailService.getDetailByUniqueKey(uniqueKey);
|
| | | if (detailRecord != null)
|
| | | return;
|
| | |
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getByUidForUpdate(uid);
|
| | | if (userInfoExtra == null)
|
| | | return;
|
| | |
|
| | | Integer goldCoin = userInfoExtra.getGoldCoin();
|
| | | if (goldCoin == null)
|
| | | goldCoin = 0;
|
| | | goldCoin = goldCoin + addGoldCoin;
|
| | |
|
| | | try {
|
| | | UserInfoExtra extra = new UserInfoExtra();
|
| | | extra.setId(userInfoExtra.getId());
|
| | | extra.setGoldCoin(goldCoin);
|
| | | userInfoExtraService.saveUserInfoExtra(extra);
|
| | | } catch (UserInfoExtraException e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | return;
|
| | | }
|
| | |
|
| | | // 金币详情
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | detail.setTitle("推广红包下线-系统折算成金币");
|
| | | detail.setUid(uid);
|
| | | detail.setMoney(addGoldCoin);
|
| | | detail.setUniqueKey(uniqueKey);
|
| | | detail.setCreateTime(new Date());
|
| | | integralDetailService.insertSelective(detail);
|
| | |
|
| | | // 消息
|
| | | MsgOtherRewardIntegralDTO msgOther = new MsgOtherRewardIntegralDTO();
|
| | | msgOther.setTitle("推广红包");
|
| | | msgOther.setTotal("推广红包¥" + tlj.setScale(2));
|
| | | msgOther.setNum(addGoldCoin + "枚");
|
| | | msgOther.setSource("已进入到可用金币中");
|
| | | msgOther.setExplain("原推广红包功能下线,剩余推广红包按照10:1折算为金币 ");
|
| | | userOtherMsgNotificationService.taoLiJinExchangeMsg(uid, "本折算有且仅有一次", msgOther);
|
| | | }
|
| | | |
| | | }
|