Merge remote-tracking branch 'origin/div' into div
| | |
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | | try {
|
| | | int platformType = 0;
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equals(platform)) {
|
| | | platformType = 1;
|
| | | } else if ("ios".equals(platform)) {
|
| | | platformType = 2;
|
| | | }
|
| | | userSystemCouponService.copyLotteryPrize(uuser.getId(), platformType, acceptData.getDevice());
|
| | | // 绑定oppo,vivo推送
|
| | | DeviceActive active = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
|
| | | if (active != null) {
|
| | |
| | | homeNavbarUserService.synchroDeviceToUser(uuser.getId(), device);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
|
| | | /* 同步未登录之前设备抽奖数据 */
|
| | | try {
|
| | | int platformType = 0;
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equals(platform)) {
|
| | | platformType = 1;
|
| | | } else if ("ios".equals(platform)) {
|
| | | platformType = 2;
|
| | | }
|
| | | userSystemCouponService.copyLotteryPrize(uuser.getId(), platformType, device);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // 绑定oppo推送
|
| | |
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.user.DeviceLotteryRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserLotteryRecord;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.exception.user.UserLotteryRecordException;
|
| | | import com.yeshi.fanli.exception.user.UserSystemCouponException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemCouponService;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.DeviceLotteryRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserLotteryRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | |
| | | @Resource
|
| | | private UserLotteryRecordService userLotteryRecordService;
|
| | | |
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取抽奖次数
|
| | | * |
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | // @RequestMapping(value = "getLotteryCount")
|
| | | public void getLotteryCount(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | try {
|
| | | // 1、已登录系统
|
| | | if (uid != null) {
|
| | | JSONObject data = userLotteryRecordService.getLotteryCountNewbies(uid);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 2、未登录系统 - 记录设备
|
| | | int platformType = 0;
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equals(platform)) {
|
| | | platformType = 1;
|
| | | } else if ("ios".equals(platform)) {
|
| | | platformType = 2;
|
| | | } else {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("平台有误"));
|
| | | return;
|
| | | }
|
| | |
|
| | | String device = acceptData.getDevice();
|
| | | if (device == null || device.trim().length() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("设备不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | List<DeviceLotteryRecord> list = deviceLotteryRecordService.listByPlatformAndDevice(platformType, device);
|
| | | int count = UserLotteryRecord.COUNT_NEWBIES;
|
| | | if (list != null && list.size() > 0) {
|
| | | count = count - list.size();
|
| | | }
|
| | | // 抽奖规则
|
| | | String lotteryRule = configService.get(ConfigKeyEnum.lotteryRuleNewbies.getKey());
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("rule", lotteryRule);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (UserLotteryRecordException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取抽奖结果
|
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | // @RequestMapping(value = "getLotteryResult")
|
| | | public void getLotteryResult(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | // 1、已登录用户抽奖
|
| | | if (uid != null) {
|
| | | Map<String, Object> map = userLotteryRecordService.executeLotteryNewbies(uid);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(map));
|
| | | return;
|
| | | } |
| | | |
| | | // 2、未登录用户抽奖
|
| | | int platformType = 0;
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equals(platform)) {
|
| | | platformType = 1;
|
| | | } else if ("ios".equals(platform)) {
|
| | | platformType = 2;
|
| | | } else {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("平台有误"));
|
| | | return;
|
| | | }
|
| | | |
| | | String device = acceptData.getDevice();
|
| | | if (device == null || device.trim().length() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("设备不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | List<DeviceLotteryRecord> list = deviceLotteryRecordService.listByPlatformAndDevice(platformType, device);
|
| | | if (list != null && list.size() >= UserLotteryRecord.COUNT_NEWBIES) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "抽奖次数不足"));
|
| | | return;
|
| | | } |
| | | // 设备抽奖
|
| | | JSONObject data = getDevicePrize(list, device, platformType);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (UserLotteryRecordException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("抽奖失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 设备信息抽奖-未登录
|
| | | * @param list
|
| | | * @param device
|
| | | * @param platformType
|
| | | * @return
|
| | | */
|
| | | public JSONObject getDevicePrize(List<DeviceLotteryRecord> list, String device, int platformType) {
|
| | | int count = 0;
|
| | | int countPrize = 0;
|
| | | Long couponId = null;
|
| | | |
| | | if (list == null || list.size() == 0) { // 拥有抽奖机会
|
| | | count = UserLotteryRecord.COUNT_NEWBIES;
|
| | | } else {
|
| | | for (DeviceLotteryRecord deviceLotteryRecord : list) {
|
| | | Long systemCouponId = deviceLotteryRecord.getSystemCouponId();
|
| | | if (systemCouponId != null) {
|
| | | countPrize++;
|
| | | couponId = systemCouponId;
|
| | | }
|
| | | }
|
| | | count = UserLotteryRecord.COUNT_NEWBIES - list.size();
|
| | | }
|
| | | |
| | | |
| | | String prize = null;
|
| | | String couponType = null;
|
| | | if (countPrize == 0) {
|
| | | prize = userLotteryRecordService.getLotteryPrizeNewbies(count, countPrize, null);
|
| | | } else if (countPrize == 1) {
|
| | | if (couponId != null) {
|
| | | SystemCoupon coupon = systemCouponService.selectByPrimaryKey(couponId);
|
| | | couponType = coupon.getType().name();
|
| | | }
|
| | | |
| | | if(couponType != null && couponType.trim().length() > 0) {
|
| | | prize = userLotteryRecordService.getLotteryPrizeNewbies(count, countPrize, couponType);
|
| | | }
|
| | | }
|
| | | |
| | | Long newCouponId = null;
|
| | | if (prize == null || prize.trim().length() == 0) {
|
| | | prize = "NoPrize";
|
| | | } else if (prize.equals(couponType)) {
|
| | | // 已存在此券
|
| | | prize = "NoPrize";
|
| | | } else { |
| | | SystemCoupon coupon = systemCouponService.getCouponByType(prize);
|
| | | if (coupon != null) {
|
| | | newCouponId = coupon.getId();
|
| | | }
|
| | | }
|
| | | |
| | | count --;
|
| | | |
| | | // 插入记录
|
| | | DeviceLotteryRecord record = new DeviceLotteryRecord();
|
| | | record.setDevice(device);
|
| | | record.setPlatform(platformType);
|
| | | record.setSystemCouponId(newCouponId);
|
| | | record.setCreateTime(new Date());
|
| | | deviceLotteryRecordService.insertSelective(record);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("result", prize);
|
| | | |
| | | return data;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取抽奖次数- 天天抽奖励券
|
| | | * |
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | // @RequestMapping(value = "getDailyCount")
|
| | | public void getDailyCount(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | try {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(userLotteryRecordService.getLotteryCountDaily(uid)));
|
| | | } catch (UserLotteryRecordException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getCode(),e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("信息获取失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取抽奖结果 - 天天抽奖励券`
|
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | // @RequestMapping(value = "getDailyResult")
|
| | | public void getDailyResult(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | try {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(userLotteryRecordService.executeLotteryDaily(uid)));
|
| | | } catch (UserLotteryRecordException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getCode(),e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("抽奖失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | earnMoney = MoneyBigDecimalUtil.mul2(earnMoney, rate);
|
| | | }
|
| | |
|
| | | String school = "板栗学院";
|
| | | String platformSubsidy = "补贴返佣 ";
|
| | | String teamSubsidy = "会员专属";
|
| | | String teamReward = "超级会员专属";
|
| | | |
| | | String shareRate = "可享佣金的<label style=\"color:#E5005C;\">%s</label>";
|
| | | String fansRate = "最高佣金的<label style=\"color:#E5005C;\">%s</label>";
|
| | | String fansIndirect = "最高佣金的<label style=\"color:#E5005C;\">%s</label>";
|
| | | String teamBonus = "可享佣金的<label style=\"color:#E5005C;\">%s</label>";
|
| | | // 达人版
|
| | | JSONObject jsonrRed1 = new JSONObject();
|
| | | jsonrRed1.put("platformSubsidy", platformSubsidy + "<label style=\"color:#E5005C;\">52.5%</label>");
|
| | | jsonrRed1.put("school", school + "<label style=\"color:#E5005C;\">达人班</label>");
|
| | | jsonrRed1.put("teamSubsidy", teamSubsidy);
|
| | | jsonrRed1.put("teamReward", teamReward);
|
| | | |
| | | jsonrRed1.put("shareRate", String.format(shareRate, "152%"));
|
| | | jsonrRed1.put("fansRate", String.format(fansRate, "22.5%"));
|
| | | jsonrRed1.put("fansIndirect", String.format(fansIndirect, "5%"));
|
| | | jsonrRed1.put("teamBonus", "高级会员以上专属");
|
| | |
|
| | | JSONObject jsonrRed2 = new JSONObject();
|
| | | jsonrRed2.put("platformSubsidy", platformSubsidy + "<label style=\"color:#E5005C;\">60%</label>");
|
| | | jsonrRed2.put("school", school + "<label style=\"color:#E5005C;\">普通班</label>");
|
| | | jsonrRed2.put("teamSubsidy", teamSubsidy + "最高<label style=\"color:#E5005C;\">7.5%</label>");
|
| | | jsonrRed2.put("teamReward", teamReward);
|
| | | |
| | | jsonrRed2.put("shareRate", String.format(shareRate, "162.5%"));
|
| | | jsonrRed2.put("fansRate", String.format(fansRate, "27.5%"));
|
| | | jsonrRed2.put("fansIndirect", String.format(fansIndirect, "7.5%"));
|
| | | jsonrRed2.put("teamBonus", "高级会员以上专属");
|
| | |
|
| | | JSONObject jsonrRed3 = new JSONObject();
|
| | | jsonrRed3.put("platformSubsidy", platformSubsidy + "<label style=\"color:#E5005C;\">70%</label>");
|
| | | jsonrRed3.put("school", school + "<label style=\"color:#E5005C;\">高级班</label>");
|
| | | jsonrRed3.put("teamSubsidy", teamSubsidy + "最高<label style=\"color:#E5005C;\">15%</label>");
|
| | | jsonrRed3.put("teamReward", teamReward);
|
| | | |
| | | jsonrRed3.put("shareRate", String.format(shareRate, "170%"));
|
| | | jsonrRed3.put("fansRate", String.format(fansRate, "32.5%"));
|
| | | jsonrRed3.put("fansIndirect", String.format(fansIndirect, "10%"));
|
| | | jsonrRed3.put("teamBonus", String.format(teamBonus, "40%"));
|
| | |
|
| | | JSONObject jsonrRed4 = new JSONObject();
|
| | | jsonrRed4.put("platformSubsidy", platformSubsidy + "<label style=\"color:#E5005C;\">115%</label>");
|
| | | jsonrRed4.put("school", school + "<label style=\"color:#E5005C;\">超级班</label>");
|
| | | jsonrRed4.put("teamSubsidy", teamSubsidy + "最高<label style=\"color:#E5005C;\">22.5%</label>");
|
| | | jsonrRed4.put("teamReward", teamReward + "最高<label style=\"color:#E5005C;\">40%</label>");
|
| | | jsonrRed4.put("shareRate", String.format(shareRate, "225%"));
|
| | | jsonrRed4.put("fansRate", String.format(fansRate, "37.5%"));
|
| | | jsonrRed4.put("fansIndirect", String.format(fansIndirect, "12.5%"));
|
| | | jsonrRed4.put("teamBonus", String.format(teamBonus, "80%"));
|
| | |
|
| | |
|
| | | JSONObject json = new JSONObject();
|
| | |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.DeviceLotteryRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserLotteryRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | |
| | | @Resource
|
| | | private UserLotteryRecordService userLotteryRecordService;
|
| | | |
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | |
| | | @Table("yeshi_ec_msg_invite")
|
| | | public class MsgInviteDetail {
|
| | | public enum MsgTypeInviteTypeEnum {
|
| | | invite("邀请消息"), exchangeCode("恭喜你,邀请码兑换成功"), receiveGift("领取礼品"),inviteSucceed("邀请提醒");
|
| | | invite("邀请消息"),
|
| | | exchangeCode("恭喜你,邀请码兑换成功"),
|
| | | receiveGift("领取礼品"),
|
| | | fansUpgrade("粉丝升级"),
|
| | | fansDivorced("脱离提醒"),
|
| | | inviteSucceed("邀请提醒");
|
| | | |
| | | |
| | | private final String desc;
|
| | |
|
| | | private MsgTypeInviteTypeEnum(String desc) {
|
| | |
| | | taoLiJinExchange("推广红包兑换金币","http://img.flqapp.com/resource/msg/icon_msg_other_system_give.png"),
|
| | | give("赠送",""),
|
| | | exchange("金币兑换","http://img.flqapp.com/resource/msg/icon_msg_other_integral.png"),
|
| | | goldCoin("金币","http://img.flqapp.com/resource/msg/icon_msg_other_integral.png"),
|
| | | firstOrderReward("粉丝首单奖励邀请人金币","http://img.flqapp.com/resource/msg/icon_msg_other_integral.png"),
|
| | | systemGive("系统赠送","http://img.flqapp.com/resource/msg/icon_msg_other_system_give.png"),
|
| | | passVIPApply("超级会员","http://img.flqapp.com/resource/msg/icon_msg_vip.png"),
|
| | |
| | | private Date createTime;
|
| | | @Column(name = "mo_update_time")
|
| | | private Date updateTime;
|
| | | |
| | | private String extraInfo;
|
| | | |
| | | |
| | |
|
| | | // 券内容
|
| | | private MsgOtherCouponContentDTO coupnContent;
|
| | |
| | | public void setExchangeContent(MsgOtherExchangeContentDTO exchangeContent) {
|
| | | this.exchangeContent = exchangeContent;
|
| | | }
|
| | |
|
| | | public String getExtraInfo() {
|
| | | return extraInfo;
|
| | | }
|
| | |
|
| | | public void setExtraInfo(String extraInfo) {
|
| | | this.extraInfo = extraInfo;
|
| | | }
|
| | | }
|
| | |
| | | public final static int STATE_END_USE = 3;
|
| | | // 已过期4
|
| | | public final static int STATE_OVERDUE = 4;
|
| | | |
| | | // 使用退回 -不入库
|
| | | public final static int STATE_BACK = 5;
|
| | | |
| | |
|
| | | // 可使用、可赠送(返回前端字段)
|
| | | public final static int STATE_USE_GIVE = 10;
|
| | |
| | |
|
| | | // 券类型
|
| | | public enum CouponTypeEnum {
|
| | | freeCoupon("免单券"), welfareFreeCoupon("福利免单"), rebatePercentCoupon("返利比提成奖励券"),
|
| | | freeCoupon("自购免单券"), welfareFreeCoupon("福利免单"), rebatePercentCoupon("返利比提成奖励券"),
|
| | | freeCouponBuy("自购免单券"),freeCouponGive("赠送免单券");
|
| | | private final String desc;
|
| | |
|
| | |
| | | package com.yeshi.fanli.service.impl.money;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserMoneyExtraMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralTaskRecordService;
|
| | |
|
| | | @Service
|
| | | public class UserMoneyExtraServiceImpl implements UserMoneyExtraService {
|
| | |
| | | @Resource
|
| | | private UserMoneyExtraMapper userMoneyExtraMapper;
|
| | |
|
| | | @Resource
|
| | | private IntegralTaskRecordService integralTaskRecordService;
|
| | |
|
| | | @Override
|
| | | public UserMoneyExtra selectByPrimaryKey(Long uid) {
|
| | |
| | | public List<UserMoneyExtra> listValid(int page, int count) {
|
| | | return userMoneyExtraMapper.listValid((page-1) * count, count);
|
| | | }
|
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void taoLiJinExchange(int page, int count) {
|
| | | List<UserMoneyExtra> listValid = userMoneyExtraMapper.listValid((page-1) * count, count);
|
| | | if (listValid == null || listValid.isEmpty())
|
| | | return;
|
| | | |
| | | BigDecimal zero = new BigDecimal(0);
|
| | | for (UserMoneyExtra moneyExtra: listValid) {
|
| | | BigDecimal tlj = moneyExtra.getTlj();
|
| | | BigDecimal tljSelf = moneyExtra.getTljSelf();
|
| | | if (tlj == null || tlj.compareTo(zero) <= 0 || tljSelf == null || tljSelf.intValue() <= 0)
|
| | | continue;
|
| | | |
| | | integralTaskRecordService.taoLiJinExchange(moneyExtra.getUid(), tljSelf.intValue(), tlj);
|
| | | |
| | | moneyExtra.setTlj(zero);
|
| | | moneyExtra.setTljSelf(zero);
|
| | | userMoneyExtraMapper.updateByPrimaryKeySelective(moneyExtra);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | |
|
| | | @Override
|
| | | public void addMsgOtherDetail(MsgOtherDetail detail) throws MsgOtherDetailException {
|
| | | if (detail.getType() == MsgTypeOtherTypeEnum.couponMianDan
|
| | | || detail.getType() == MsgTypeOtherTypeEnum.couponReward
|
| | | || detail.getType() == MsgTypeOtherTypeEnum.couponWelfareMianDan) {
|
| | | if (detail.getCoupnContent() == null)
|
| | | throw new MsgOtherDetailException(1, "内容为空");
|
| | | detail.setContent(new Gson().toJson(detail.getCoupnContent()));
|
| | | if (detail.getCreateTime() == null)
|
| | | detail.setCreateTime(new Date());
|
| | | msgOtherDetailMapper.insertSelective(detail);
|
| | | userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | } else {
|
| | | msgOtherDetailMapper.insertSelective(detail);
|
| | | userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | }
|
| | | msgOtherDetailMapper.insertSelective(detail);
|
| | | userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | package com.yeshi.fanli.service.impl.msg;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherRewardIntegralDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherSystemGiveDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherVIPDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgExtra;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.exception.msg.MsgOtherDetailException;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgExtraService;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgOtherDetailService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.msg.MsgOtherCouponContentDTOFactory;
|
| | | import com.yeshi.fanli.util.factory.msg.MsgOtherDetailFactory;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
|
| | |
|
| | | @Service
|
| | | public class UserOtherMsgNotificationServiceImpl implements UserOtherMsgNotificationService {
|
| | |
|
| | | @Resource
|
| | | private MsgOtherDetailService msgOtherDetailService;
|
| | | |
| | | @Resource
|
| | | private MsgExtraService msgExtraService;
|
| | | |
| | |
|
| | | private Integer getLeftDay(UserSystemCoupon coupon) {
|
| | | if (coupon != null && coupon.getEndTime() != null) {
|
| | | int cha = TimeUtil.getDayDifferenceCount(new Date(), coupon.getEndTime());
|
| | | if (cha < 0)
|
| | | return 0;
|
| | | else
|
| | | return cha + 1;
|
| | | } else
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void welfareCouponGet(UserSystemCoupon coupon) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponGet(getLeftDay(coupon),
|
| | | coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private void saveMsgDetail(MsgOtherDetail detail) {
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "至少成功邀请1个粉丝后可激活"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void welfareCouponActive(UserSystemCoupon coupon, UserInfo worker) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponActive(getLeftDay(coupon),
|
| | | "成功邀请粉丝:" + worker.getNickName(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "可在首页-免单商品-选择商品-使用"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void welfareCouponUsing(UserSystemCoupon coupon, String orderId, BigDecimal money) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponUsing(orderId, money,
|
| | | coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "实付款-返利=0元购(免单)"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void welfareCouponUsed(UserSystemCoupon coupon, String orderId) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponUsed(orderId,
|
| | | "实付款-返利=0元购(免单)", coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "参与其他活动可获得更多免单券"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void welfareCouponWillOutOfDate(UserSystemCoupon coupon) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory
|
| | | .createWelfareCouponWillOutOfDate(getLeftDay(coupon), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "至少成功邀请1个粉丝后可激活"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void welfareCouponAlreadyOutOfDate(UserSystemCoupon coupon) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory
|
| | | .createWelfareCouponAlreadyOutOfDate(coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | MsgOtherDetail detail = MsgOtherDetailFactory.createCouponMsg(coupon.getUid(), coupon.getId(), dto,
|
| | | MsgTypeOtherTypeEnum.couponWelfareMianDan, "参与其他活动可获得更多免单券");
|
| | | detail.setCreateTime(coupon.getEndTime());
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void welfareCouponDrawBack(UserSystemCoupon coupon, String orderId) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponDrawBack(getLeftDay(coupon),
|
| | | orderId, coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "退回后依然可在有效期内使用"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void freeSheetCouponGet(UserSystemCoupon coupon) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createCouponGet(getLeftDay(coupon),
|
| | | coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponMianDan, "首页-免单-选择商品-使用"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void freeSheetCouponUsing(UserSystemCoupon coupon, String orderId, BigDecimal money) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createCouponUsing(orderId, money,
|
| | | coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponMianDan, "实付款-返利=0元购(免单)"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void freeSheetCouponUsed(UserSystemCoupon coupon, String orderId) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponUsed(orderId,
|
| | | "实付款-返利=0元购(免单)", coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponMianDan, "参与其他活动可获得更多免单券"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void freeSheetCouponWillOutOfDate(UserSystemCoupon coupon) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory
|
| | | .createWelfareCouponWillOutOfDate(getLeftDay(coupon), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponMianDan, "至少成功邀请1个粉丝后可激活"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void freeSheetCouponAlreadyOutOfDate(UserSystemCoupon coupon) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory
|
| | | .createWelfareCouponAlreadyOutOfDate(coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | MsgOtherDetail detail = MsgOtherDetailFactory.createCouponMsg(coupon.getUid(), coupon.getId(), dto,
|
| | | MsgTypeOtherTypeEnum.couponMianDan, "参与其他活动可获得更多免单券");
|
| | | detail.setCreateTime(coupon.getEndTime());
|
| | |
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void freeSheetCouponDrawBack(UserSystemCoupon coupon, String orderId) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponDrawBack(getLeftDay(coupon),
|
| | | orderId, coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponMianDan, "退回后依然可在有效期内使用"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void rewardCouponGet(UserSystemCoupon coupon, int percent) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createRewardCouponGet(getLeftDay(coupon),
|
| | | coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponReward, "返利订单已到账再返30%以上"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void rewardCouponUsed(UserSystemCoupon coupon, BigDecimal oldFanLiMoney, BigDecimal rewardMoney,
|
| | | String orderId) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createRewardCouponUsed(oldFanLiMoney,
|
| | | rewardMoney, orderId);
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponReward, "完成金币任务,兑换更多奖励券"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void rewardCouponWillOutOfDate(UserSystemCoupon coupon, int percent) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createRewardCouponWillOutOfDate(
|
| | | getLeftDay(coupon), coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponReward, "返利订单已到账再返30%以上"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void rewardCouponAlreadyOutOfDate(UserSystemCoupon coupon) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory
|
| | | .createRewardCouponAlreadyOutOfDate(coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | MsgOtherDetail detail = MsgOtherDetailFactory.createCouponMsg(coupon.getUid(), coupon.getId(), dto,
|
| | | MsgTypeOtherTypeEnum.couponReward, "完成金币任务,兑换更多奖励券");
|
| | | detail.setCreateTime(coupon.getEndTime());
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public void couponUsingFreeSheet(UserSystemCoupon coupon, String orderId, BigDecimal money, MsgTypeOtherTypeEnum type) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createCouponUsing(orderId, money,
|
| | | coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, type, "实付款-返利=0元购(免单)"));
|
| | | // 消息内容
|
| | | msgExtraService.addMsgExtra(detail.getId(), detail.getExtraInfo(), MsgExtra.MSG_TYPE_INVITE);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void couponUsedFreeSheet(UserSystemCoupon coupon, String orderId, MsgTypeOtherTypeEnum type) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponUsed(orderId,
|
| | | "实付款-返利=0元购(免单)", coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, type, "参与其他活动可获得更多免单券"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void freeCouponWinMsg(Long uid, String name, String source, int num, String stateDesc, Date startTime, Date endTime) {
|
| | | saveMsgDetail(MsgOtherDetailFactory.freeCouponMsg(uid, name, source, num, stateDesc, startTime, endTime));
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void couponDrawBack(UserSystemCoupon coupon, String orderId, MsgTypeOtherTypeEnum type) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponDrawBack(getLeftDay(coupon),
|
| | | orderId, coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, type, "退回后依然可在有效期内使用"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void freeCouponEndMsg(Long uid, String name, String source, int num, String stateDesc) {
|
| | | saveMsgDetail(MsgOtherDetailFactory.freeCouponMsg(uid, name, source, num, stateDesc, null, null));
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public void outOfDate(UserSystemCoupon coupon, MsgTypeOtherTypeEnum type) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory
|
| | | .createRewardCouponAlreadyOutOfDate(coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | MsgOtherDetail detail = MsgOtherDetailFactory.createCouponMsg(coupon.getUid(), coupon.getId(), dto,
|
| | | type, "参与活动可获取更多奖励券");
|
| | | detail.setCreateTime(coupon.getEndTime());
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void giveCouponActivateMsg(Long uid, String beiZhu, MsgOtherCouponActivateDTO content) {
|
| | | try {
|
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(content));
|
| | | detail.setType(MsgTypeOtherTypeEnum.couponActivate);
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void taoLiJinMsg(Long uid, String beiZhu, MsgOtherTaoLiJinContentDTO content) {
|
| | | try {
|
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(content));
|
| | | detail.setType(MsgTypeOtherTypeEnum.taoLiJin);
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void tokenGiveMsg(Long uid, String beiZhu, MsgOtherGiveContentDTO content) {
|
| | | try {
|
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(content));
|
| | | detail.setType(MsgTypeOtherTypeEnum.give);
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | @Override
|
| | | public void exchangeMsg(Long uid, String beiZhu, MsgOtherExchangeContentDTO content) {
|
| | | try {
|
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(content));
|
| | | detail.setType(MsgTypeOtherTypeEnum.exchange);
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void rewardCouponWinMsg(Long uid, String source, int num, String stateDesc, Date startTime, Date endTime) {
|
| | | saveMsgDetail(MsgOtherDetailFactory.rewardCouponMsg(uid, source, num, stateDesc, startTime, endTime));
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void firstOrderRewardMsg(Long uid, String beiZhu, MsgOtherRewardIntegralDTO content) {
|
| | | try {
|
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(content));
|
| | | detail.setType(MsgTypeOtherTypeEnum.firstOrderReward);
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void systemGiveRewardCoupon(Long uid, String beiZhu, MsgOtherSystemGiveDTO dto) {
|
| | | try {
|
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(dto));
|
| | | detail.setType(MsgTypeOtherTypeEnum.systemGive);
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void taoLiJinExchangeMsg(Long uid, String beiZhu, MsgOtherRewardIntegralDTO dto) {
|
| | | try {
|
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(dto));
|
| | | detail.setType(MsgTypeOtherTypeEnum.taoLiJinExchange);
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void passVIPApplyMsg(Long uid, String beiZhu, MsgOtherVIPDTO dto) {
|
| | | try {
|
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(dto));
|
| | | detail.setType(MsgTypeOtherTypeEnum.passVIPApply);
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void rejectVIPApply(Long uid, String beiZhu, MsgOtherVIPDTO dto) {
|
| | | try {
|
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(dto));
|
| | | detail.setType(MsgTypeOtherTypeEnum.rejectVIPApply);
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void rewardCouponEndMsg(Long uid, String source, int num, String stateDesc) {
|
| | | saveMsgDetail(MsgOtherDetailFactory.rewardCouponMsg(uid, source, num, stateDesc, null, null));
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void teamVIPCallBoss(Long uid, String beiZhu, MsgOtherVIPDTO dto) {
|
| | | try {
|
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(dto));
|
| | | detail.setType(MsgTypeOtherTypeEnum.teamVIPCallBoss);
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void goldCoinSystemGiveMsg(Long uid, int num, int banlce) {
|
| | | saveMsgDetail(MsgOtherDetailFactory.goldCoinSystemGiveMsg(uid, num, banlce));
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void teamSplitCallBoss(Long uid, String beiZhu, MsgOtherVIPDTO dto) {
|
| | | try {
|
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(dto));
|
| | | detail.setType(MsgTypeOtherTypeEnum.teamSplitCallBoss);
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void goldCoinRewardInviteSucceedMsg(Long uid, int num, int banlce, boolean directFans) {
|
| | | saveMsgDetail(MsgOtherDetailFactory.goldCoinRewardInviteSucceedMsg(uid, num, banlce, directFans));
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void createMsgOtherDetail(Long uid, List<CommonMsgItemVO> listMsg, MsgTypeOtherTypeEnum type) {
|
| | | try {
|
| | | if (listMsg == null || listMsg.size() == 0) {
|
| | | return;
|
| | | }
|
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setRead(false);
|
| | | detail.setType(type);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(listMsg));
|
| | | detail.setCreateTime(new Date());
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void goldCoinOrderSubsidyMsg(Long uid, int num, int banlce, boolean directFans) {
|
| | | saveMsgDetail(MsgOtherDetailFactory.goldCoinOrderSubsidyMsg(uid, num, banlce, directFans));
|
| | | }
|
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void goldCoinExChangeMsg(Long uid, int num, int banlce, String name, String exNum) {
|
| | | saveMsgDetail(MsgOtherDetailFactory.goldCoinExChangeMsg(uid, num, banlce, name, exNum));
|
| | | }
|
| | | |
| | | }
|
| | |
| | | pushCouponRecord.setCreateTime(new Date());
|
| | |
|
| | | // 插入领取记录
|
| | | pushCouponRecordService.insertSelective(pushCouponRecord);
|
| | | //pushCouponRecordService.insertSelective(pushCouponRecord);
|
| | | // 直接发送券
|
| | | userSystemCouponService.randomRewardCoupon(amount, uid, UserSystemCoupon.SOURCE_SYSTEM_PUSH);
|
| | | //userSystemCouponService.randomRewardCoupon(amount, uid, UserSystemCoupon.SOURCE_SYSTEM_PUSH);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | content.setSource(time + " 创建的分享记录");
|
| | | content.setMoney(totalMoney);
|
| | |
|
| | | userOtherMsgNotificationService.taoLiJinMsg(uid, beizhu, content);
|
| | | //userOtherMsgNotificationService.taoLiJinMsg(uid, beizhu, content);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.user.TokenRecordMapper;
|
| | | 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.entity.bus.user.TokenRecord.TokenTypeEnum;
|
| | |
| | | import com.yeshi.fanli.entity.redpack.RedPackGiveRecord;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackGiveRecordException;
|
| | | import com.yeshi.fanli.exception.user.TokenRecordException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | |
|
| | | UserSystemCoupon userSystemCoupon = null;
|
| | | try {
|
| | | userSystemCoupon = userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_GIVE, null, true);
|
| | | userSystemCoupon = userSystemCouponService.freeCouponWin(giveUid, CouponTypeEnum.freeCoupon, |
| | | UserSystemCoupon.SOURCE_GIVE, 1, true);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | throw new TokenRecordException(1, "领取失败");
|
| | |
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | boolean addTeam = addInviteTeam(uid, giveUid, userInfoExtra);
|
| | | String beiZhu = "无";
|
| | | if (addTeam)
|
| | | beiZhu = "领取人已经成为你的直接粉丝";
|
| | |
|
| | | String userName = "无";
|
| | | UserInfo user = userInfoService.selectByPKey(uid);
|
| | | if (user != null && !StringUtil.isNullOrEmpty(user.getNickName()))
|
| | | userName = user.getNickName();
|
| | |
|
| | | MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
|
| | | msgOther.setType(MsgOtherGiveContentDTO.TYEP_COUPON);
|
| | | msgOther.setTitle("赠送免单券");
|
| | | msgOther.setGiveType("你赠送的免单券被成功领取");
|
| | | msgOther.setReceiveInfo("昵称: :" + userName + " ID:" + uid);
|
| | | msgOther.setGiveTime(sd.format(giveRecord.getGiveTime()));
|
| | | msgOther.setReceiveTime(sd.format(new Date()));
|
| | | userOtherMsgNotificationService.tokenGiveMsg(giveUid, beiZhu, msgOther);
|
| | |
|
| | | // 激活邀请信息
|
| | | if (addTeam)
|
| | | addInviteMsg(uid, giveUid, "免单券");
|
| | | addInviteTeam(uid, giveUid, userInfoExtra);
|
| | | }
|
| | | });
|
| | | } else if (tokenType == TokenTypeEnum.rebatePercentCoupon) {
|
| | |
| | |
|
| | | UserSystemCoupon userSystemCoupon = null;
|
| | | try {
|
| | | userSystemCoupon = userSystemCouponService.insertUserCoupon(uid,
|
| | | CouponTypeEnum.rebatePercentCoupon.name(), UserSystemCoupon.SOURCE_GIVE,
|
| | | systemCoupon.getPercent(), true);
|
| | | userSystemCoupon = userSystemCouponService.rewardCouponWin(uid, UserSystemCoupon.SOURCE_GIVE, 1, true, |
| | | systemCoupon.getPercent());
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | throw new TokenRecordException(1, "领取失败");
|
| | |
| | |
|
| | | @Override
|
| | | public void run() {
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | boolean addTeam = addInviteTeam(uid, giveUid, userInfoExtra);
|
| | | String beiZhu = "无";
|
| | | if (addTeam)
|
| | | beiZhu = "领取人已经成为你的直接粉丝";
|
| | |
|
| | | String userName = "无";
|
| | | UserInfo user = userInfoService.selectByPKey(uid);
|
| | | if (user != null && !StringUtil.isNullOrEmpty(user.getNickName()))
|
| | | userName = user.getNickName();
|
| | |
|
| | | MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
|
| | | msgOther.setType(MsgOtherGiveContentDTO.TYEP_COUPON);
|
| | | msgOther.setTitle("赠送奖励券");
|
| | | msgOther.setGiveType("你赠送的奖励券被成功领取");
|
| | | msgOther.setReceiveInfo("昵称: " + userName + " ID:" + uid);
|
| | | msgOther.setGiveTime(sd.format(giveRecord.getGiveTime()));
|
| | | msgOther.setReceiveTime(sd.format(new Date()));
|
| | | userOtherMsgNotificationService.tokenGiveMsg(giveUid, beiZhu, msgOther);
|
| | |
|
| | | // 激活邀请信息
|
| | | if (addTeam)
|
| | | addInviteMsg(uid, giveUid, "返利奖励券");
|
| | | addInviteTeam(uid, giveUid, userInfoExtra);
|
| | | }
|
| | | });
|
| | | } else if (tokenType == TokenTypeEnum.redPack) {
|
| | | if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | throw new TokenRecordException(1, "请升级到最新版");
|
| | |
|
| | | try {
|
| | | msg = "领取红包成功,请到[我的-红包]中查看";
|
| | | // 领取红包、更新记录
|
| | | RedPackGiveRecord giveRecord = redPackGiveRecordService.receiveFriendsGive(uid,
|
| | | Long.parseLong(identify));
|
| | | // 消息 + 队员
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | boolean addTeam = addInviteTeam(uid, giveUid, userInfoExtra);
|
| | |
|
| | | String beiZhu = "无";
|
| | | String giveBeiZhu = "无";
|
| | | if (addTeam) {
|
| | | beiZhu = "你已成为赠送人的直接粉丝";
|
| | | giveBeiZhu = "领取人已成为你的直接粉丝";
|
| | | // 激活邀请信息
|
| | | addInviteMsg(uid, giveUid, giveRecord.getAmount().setScale(2) + "元红包");
|
| | | }
|
| | |
|
| | | // 领取人消息
|
| | | String giveUserName = "无";
|
| | | UserInfo giveuser = userInfoService.selectByPKey(giveUid);
|
| | | if (giveuser != null && !StringUtil.isNullOrEmpty(giveuser.getNickName()))
|
| | | giveUserName = giveuser.getNickName();
|
| | | MsgRedPackGiveContentDTO dto = new MsgRedPackGiveContentDTO();
|
| | | dto.setTitle("红包领取");
|
| | | 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);
|
| | |
|
| | | // 赠送人消息
|
| | | String userName = "无";
|
| | | UserInfo user = userInfoService.selectByPKey(uid);
|
| | | if (user != null && !StringUtil.isNullOrEmpty(user.getNickName()))
|
| | | userName = user.getNickName();
|
| | | MsgRedPackGiveContentDTO givedto = new MsgRedPackGiveContentDTO();
|
| | | givedto.setTitle("红包赠送");
|
| | | 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);
|
| | | }
|
| | | });
|
| | | } catch (RedPackGiveRecordException e) {
|
| | | throw new TokenRecordException(1, e.getMsg());
|
| | | }
|
| | | msg = "领取红包成功,请到[我的-红包]中查看";
|
| | | // 消息 + 队员
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | addInviteTeam(uid, giveUid, userInfoExtra);
|
| | | }
|
| | | });
|
| | | } else if (tokenType == TokenTypeEnum.taoLiJin) {
|
| | | throw new TokenRecordException(1, "推广红包相关功能已下线!");
|
| | | } else {
|
| | |
| | | return invite;
|
| | | }
|
| | |
|
| | | private void addInviteMsg(Long uid, Long giveUid, String giftName) {
|
| | | 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("你的邀请码:" + inviteCode);
|
| | | msgInvite.setInviter("昵称:" + user.getNickName());
|
| | | msgInvite.setMode("成功领取邀请人的" + giftName);
|
| | | userInviteMsgNotificationService.receiveGift(uid, "邀请关系一旦确立无法更改 ", msgInvite);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TokenRecord> overdueList(int count) {
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponMapper;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserSystemCouponUseMQMsg;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.TokenRecord;
|
| | |
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.util.factory.msg.MsgOtherSystemGiveDTOFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
| | | return userSystemCouponMapper.countUserCouponList(uid);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | public UserSystemCoupon insertUserCoupon(Long uid, String couponType, String source, BigDecimal percent,
|
| | | Boolean needNotify) throws UserSystemCouponException, Exception {
|
| | |
|
| | | if (couponType == null || uid == null) {
|
| | | public UserSystemCoupon freeCouponWin(Long uid, CouponTypeEnum typeEnum, String source, int num, boolean notify) throws UserSystemCouponException, Exception{
|
| | | if (typeEnum == null || uid == null || StringUtil.isNullOrEmpty(source) || num < 1) {
|
| | | throw new UserSystemCouponException(1, "参数不正确");
|
| | | }
|
| | |
|
| | | SystemCoupon coupon = null;
|
| | | if (couponType.equals(CouponTypeEnum.welfareFreeCoupon.name())
|
| | | || couponType.equals(CouponTypeEnum.freeCoupon.name())
|
| | | | couponType.equals(CouponTypeEnum.freeCouponBuy.name())) {
|
| | | // 免单券
|
| | | coupon = systemCouponService.getCouponByType(couponType);
|
| | | } else if (couponType.equals(CouponTypeEnum.rebatePercentCoupon.name())) {
|
| | | // 随机奖励券
|
| | | if (percent == null || percent.compareTo(new BigDecimal(0)) < 1) {
|
| | | randomRewardCoupon(1, uid, source);
|
| | | return null;
|
| | | } else {
|
| | | coupon = systemCouponService.getCouponByTypeAndPercent(couponType, percent);
|
| | | }
|
| | | } else if (couponType.equals(CouponTypeEnum.freeCouponGive.name())) {
|
| | | coupon = systemCouponService.getCouponByType(couponType);
|
| | | }
|
| | |
|
| | | |
| | | SystemCoupon coupon = systemCouponService.getCouponByType(typeEnum.name());
|
| | | if (coupon == null) {
|
| | | throw new UserSystemCouponException(1, "券类型不正确");
|
| | | }
|
| | |
|
| | | int stateActivated = 1;
|
| | | if (coupon.getType() == CouponTypeEnum.welfareFreeCoupon) {
|
| | | // 福利券状态
|
| | | long countSuccess = threeSaleSerivce.countSuccessFirstTeam(uid);
|
| | | // 没有下级队员 --待激活
|
| | | if (countSuccess == 0) {
|
| | | stateActivated = 0;
|
| | | }
|
| | | } else if (coupon.getType() == CouponTypeEnum.freeCoupon) {
|
| | | stateActivated = 0;
|
| | | |
| | | // 激活状态
|
| | | int stateActivated = 0;
|
| | | // 自购免单券、赠送免单券可直接使用
|
| | | if (coupon.getType() == CouponTypeEnum.freeCouponBuy || coupon.getType() == CouponTypeEnum.freeCouponGive) {
|
| | | stateActivated = 1;
|
| | | }
|
| | |
|
| | | |
| | | // 有效时长
|
| | | Integer expiryDay = null;
|
| | | if (stateActivated == 0)
|
| | | expiryDay = coupon.getActivateDay();
|
| | |
|
| | | if (expiryDay == null || expiryDay == 0)
|
| | | expiryDay = coupon.getExpiryDay();
|
| | |
|
| | | // 结束日期
|
| | | // 今天在内 减去一天
|
| | | String endDay = DateUtil.plusDay(expiryDay - 1, new Date());
|
| | | |
| | | // 计算结束日期
|
| | | Date nowTime = new Date();
|
| | | String endDay = DateUtil.plusDay(expiryDay - 1, nowTime);
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | if (endDay != null && endDay.trim().length() > 0) {
|
| | | endDay += " 23:59:59";
|
| | | }
|
| | | Date endTime = format.parse(endDay);
|
| | |
|
| | | UserSystemCoupon userCoupon = new UserSystemCoupon();
|
| | | userCoupon.setUid(uid);
|
| | | userCoupon.setSource(source);
|
| | | userCoupon.setSystemCoupon(coupon);
|
| | | userCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
|
| | | userCoupon.setStateActivated(stateActivated);
|
| | | userCoupon.setStartTime(new Date());
|
| | | userCoupon.setEndTime(endTime);
|
| | | userCoupon.setCreateTime(new Date());
|
| | | userCoupon.setUpdateTime(new Date());
|
| | | userSystemCouponMapper.insertSelective(userCoupon);
|
| | |
|
| | | if (coupon.getType() == CouponTypeEnum.freeCoupon) {
|
| | | userSystemCouponActivateService.addActivateRecord(userCoupon.getId());
|
| | | }
|
| | |
|
| | | |
| | | UserSystemCoupon userSystemCoupon = null;
|
| | | for (int i = 0; i < num; i ++) {
|
| | | UserSystemCoupon userCoupon = new UserSystemCoupon();
|
| | | userCoupon.setUid(uid);
|
| | | userCoupon.setSource(source);
|
| | | userCoupon.setSystemCoupon(coupon);
|
| | | userCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
|
| | | userCoupon.setStateActivated(stateActivated);
|
| | | userCoupon.setStartTime(nowTime);
|
| | | userCoupon.setEndTime(endTime);
|
| | | userCoupon.setCreateTime(nowTime);
|
| | | userCoupon.setUpdateTime(nowTime);
|
| | | userSystemCouponMapper.insertSelective(userCoupon);
|
| | | // 需要激活券
|
| | | if (typeEnum == CouponTypeEnum.freeCoupon) {
|
| | | userSystemCouponActivateService.addActivateRecord(userCoupon.getId());
|
| | | }
|
| | | |
| | | if (num == 1) {
|
| | | userSystemCoupon = userCoupon;
|
| | | }
|
| | | }
|
| | | |
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() { // 福利中心红点
|
| | | public void run() { |
| | | if (notify) { // 消息推送
|
| | | try {
|
| | | userOtherMsgNotificationService.freeCouponWinMsg(uid, typeEnum.getDesc(), source, |
| | | num, "成功获得", nowTime, endTime);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | // 福利中心红点
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extra != null) {
|
| | | UserInfoExtra updateExtra = new UserInfoExtra();
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | | |
| | | return userSystemCoupon;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // 消息推送
|
| | | if (needNotify) {
|
| | | try {
|
| | | if (coupon.getType() == CouponTypeEnum.welfareFreeCoupon) {
|
| | | userOtherMsgNotificationService.welfareCouponGet(userCoupon);
|
| | | } else if (coupon.getType() == CouponTypeEnum.freeCoupon) {
|
| | | userOtherMsgNotificationService.freeSheetCouponGet(userCoupon);
|
| | | } else if (coupon.getType() == CouponTypeEnum.rebatePercentCoupon) {
|
| | | userOtherMsgNotificationService.rewardCouponGet(userCoupon, coupon.getPercent().intValue());
|
| | | @Override
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | public UserSystemCoupon rewardCouponWin(Long uid, String source, int num, boolean notify, |
| | | BigDecimal percent) throws UserSystemCouponException, Exception{
|
| | | if (uid == null || percent == null|| StringUtil.isNullOrEmpty(source) || num < 1) {
|
| | | throw new UserSystemCouponException(1, "参数不正确");
|
| | | }
|
| | | |
| | | String name = CouponTypeEnum.rebatePercentCoupon.name();
|
| | | SystemCoupon coupon = systemCouponService.getCouponByTypeAndPercent(name, percent);
|
| | | if (coupon == null) {
|
| | | throw new UserSystemCouponException(1, "券类型不正确");
|
| | | }
|
| | | |
| | | // 计算结束日期
|
| | | Date nowTime = new Date();
|
| | | Integer expiryDay = coupon.getExpiryDay();
|
| | | String endDay = DateUtil.plusDay(expiryDay - 1, nowTime);
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | if (endDay != null && endDay.trim().length() > 0) {
|
| | | endDay += " 23:59:59";
|
| | | }
|
| | | Date endTime = format.parse(endDay);
|
| | | |
| | | UserSystemCoupon userSystemCoupon = null;
|
| | | for (int i = 0; i < num; i ++) {
|
| | | UserSystemCoupon userCoupon = new UserSystemCoupon();
|
| | | userCoupon.setUid(uid);
|
| | | userCoupon.setSource(source);
|
| | | userCoupon.setSystemCoupon(coupon);
|
| | | userCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
|
| | | userCoupon.setStateActivated(1);
|
| | | userCoupon.setStartTime(nowTime);
|
| | | userCoupon.setEndTime(endTime);
|
| | | userCoupon.setCreateTime(nowTime);
|
| | | userCoupon.setUpdateTime(nowTime);
|
| | | userSystemCouponMapper.insertSelective(userCoupon);
|
| | | if (num == 1) {
|
| | | userSystemCoupon = userCoupon;
|
| | | }
|
| | | }
|
| | | |
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() { |
| | | if (notify) { // 消息推送
|
| | | try {
|
| | | userOtherMsgNotificationService.rewardCouponWinMsg(uid, source, num, "成功获得", nowTime, endTime);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | |
| | | // 福利中心红点
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extra != null) {
|
| | | UserInfoExtra updateExtra = new UserInfoExtra();
|
| | | updateExtra.setId(extra.getId());
|
| | | if (extra.getCouponNews() == null) {
|
| | | updateExtra.setCouponNews(1);
|
| | | } else {
|
| | | updateExtra.setCouponNews(extra.getCouponNews() + 1);
|
| | | }
|
| | | userInfoExtraService.updateByPrimaryKeySelective(updateExtra);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return userCoupon;
|
| | | });
|
| | | |
| | | return userSystemCoupon;
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | |
| | | userInfoService.selectByPKey(uid).getMyHongBao());
|
| | | // 消息推送
|
| | | try {
|
| | | userOtherMsgNotificationService.rewardCouponUsed(userSystemCoupon, hongBao, money, order.getOrderId());
|
| | | userOtherMsgNotificationService.rewardCouponEndMsg(uid, userSystemCoupon.getSource(), 1, "使用成功");
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | | return userRecordVO;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void activatedWelfareFreeCoupon(Long uid, String fromNickName) {
|
| | |
|
| | | LogHelper.test("券激活:" + uid);
|
| | | if (uid == null) {
|
| | | return;
|
| | | }
|
| | | // 福利免单券
|
| | | String welfareFree = CouponTypeEnum.welfareFreeCoupon.name();
|
| | |
|
| | | SystemCoupon systemCoupon = systemCouponService.getCouponByType(welfareFree);
|
| | | if (systemCoupon == null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 待活福利免单券
|
| | | List<UserSystemCoupon> list = userSystemCouponMapper.getCouponByTypeAndNotActivated(uid, systemCoupon.getId());
|
| | | if (list == null || list.size() == 0) {
|
| | | return;
|
| | | }
|
| | |
|
| | | for (UserSystemCoupon userSystemCoupon : list) {
|
| | | // 激活
|
| | | UserSystemCoupon update = new UserSystemCoupon();
|
| | | update.setId(userSystemCoupon.getId());
|
| | | update.setStateActivated(1);
|
| | | update.setUpdateTime(new Date());
|
| | | userSystemCouponMapper.updateByPrimaryKeySelective(update);
|
| | |
|
| | | Integer state = userSystemCoupon.getState();
|
| | | if (UserSystemCoupon.STATE_OVERDUE == state) {
|
| | | continue; // 已失效不做消息推送
|
| | | }
|
| | |
|
| | | // 消息推送
|
| | | try {
|
| | | UserInfo userInfo = new UserInfo();
|
| | | userInfo.setId(uid);
|
| | | userInfo.setNickName(fromNickName);
|
| | |
|
| | | userOtherMsgNotificationService.welfareCouponActive(userSystemCoupon, userInfo);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | |
| | | record.setUpdateTime(new Date());
|
| | | record.setState(UserSystemCouponRecord.STATE_SUCCESS);
|
| | | userSystemCouponRecordService.updateByPrimaryKeySelective(record);
|
| | |
|
| | | // 消息推送
|
| | | if (CouponTypeEnum.welfareFreeCoupon.name().equals(record.getCouponType())) {
|
| | | userOtherMsgNotificationService.welfareCouponUsed(record.getUserSystemCoupon(), orderNo);
|
| | | } else if (CouponTypeEnum.freeCoupon.name().equals(record.getCouponType())) {
|
| | | userOtherMsgNotificationService.freeSheetCouponUsed(record.getUserSystemCoupon(), orderNo);
|
| | | } else if (CouponTypeEnum.freeCouponBuy.name().equals(record.getCouponType())) {
|
| | | userOtherMsgNotificationService.couponUsedFreeSheet(record.getUserSystemCoupon(), orderNo,
|
| | | MsgTypeOtherTypeEnum.freeCouponBuy);
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public List<UserSystemCoupon> getCounponNowInvalid(int count) {
|
| | | return userSystemCouponMapper.getCounponNowInvalid(count);
|
| | |
| | | if (couponType == null || couponType.trim().length() == 0) {
|
| | | throw new Exception("券类型未被记录");
|
| | | }
|
| | |
|
| | | if (CouponTypeEnum.welfareFreeCoupon.name().equals(couponType)) {
|
| | | userOtherMsgNotificationService.welfareCouponUsing(userSystemCoupon, orderNo, payment);
|
| | | } else if (CouponTypeEnum.freeCoupon.name().equals(couponType)) {
|
| | | userOtherMsgNotificationService.freeSheetCouponUsing(userSystemCoupon, orderNo, payment);
|
| | | } else if (CouponTypeEnum.freeCouponBuy.name().equals(couponType)) {
|
| | | userOtherMsgNotificationService.couponUsingFreeSheet(userSystemCoupon, orderNo, payment,
|
| | | MsgTypeOtherTypeEnum.freeCouponBuy);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return isfree;
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | public void copyLotteryPrize(Long uid, int platform, String device) throws Exception {
|
| | |
|
| | | return;
|
| | |
|
| | | /*
|
| | | * if (uid == null || device == null) { return; }
|
| | | * |
| | | * // 未登陆之前抽奖记录 List<DeviceLotteryRecord> list =
|
| | | * deviceLotteryRecordService.listByPlatformAndDevice(platform, device);
|
| | | * if (list == null || list.size() == 0) { return; }
|
| | | * |
| | | * // 获取额外信息 UserInfoExtra userInfoExtra =
|
| | | * userInfoExtraService.getUserInfoExtra(uid);
|
| | | * |
| | | * // 已经抽过奖的或者已经进入过抽奖页面的 if (userInfoExtra != null &&
|
| | | * userInfoExtra.getLotteryNewbies() != null) { return; }
|
| | | * |
| | | * // 是否是新用户 boolean isNewUser = userInfoExtraService.isNewUser(uid); if
|
| | | * (!isNewUser) { return; }
|
| | | * |
| | | * int coupon = 0;
|
| | | * |
| | | * for (DeviceLotteryRecord reviceLotteryRecord : list) {
|
| | | * |
| | | * // 删除记录
|
| | | * deviceLotteryRecordService.deleteByPrimaryKey(reviceLotteryRecord.
|
| | | * getId());
|
| | | * |
| | | * Long systemCouponId = reviceLotteryRecord.getSystemCouponId(); if
|
| | | * (systemCouponId == null) { continue; } SystemCoupon systemCoupon =
|
| | | * systemCouponService.selectByPrimaryKey(systemCouponId); if
|
| | | * (systemCoupon == null) { continue; }
|
| | | * |
| | | * int stateActivated = 1; if (systemCoupon.getType() ==
|
| | | * CouponTypeEnum.welfareFreeCoupon) { // 福利券状态 long countSuccess =
|
| | | * threeSaleSerivce.countSuccessFirstTeam(uid); // 没有下级队员 --待激活 if
|
| | | * (countSuccess == 0) { stateActivated = 0; } }
|
| | | * |
| | | * // 结束日期 // 今天在内 减去一天 String endDay =
|
| | | * DateUtil.plusDay(systemCoupon.getExpiryDay() - 1, new Date());
|
| | | * SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"
|
| | | * ); if (endDay != null && endDay.trim().length() > 0) { endDay +=
|
| | | * " 23:59:59"; } Date endTime = format.parse(endDay);
|
| | | * |
| | | * UserSystemCoupon userCoupon = new UserSystemCoupon();
|
| | | * userCoupon.setUid(uid);
|
| | | * userCoupon.setSource(UserSystemCoupon.SOURCE_NEWBIES);
|
| | | * userCoupon.setSystemCoupon(systemCoupon);
|
| | | * userCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
|
| | | * userCoupon.setStateActivated(stateActivated);
|
| | | * userCoupon.setStartTime(new Date()); userCoupon.setEndTime(endTime);
|
| | | * userCoupon.setCreateTime(new Date()); userCoupon.setUpdateTime(new
|
| | | * Date()); // 插入数据库 insertSelective(userCoupon);
|
| | | * |
| | | * // 券数量 coupon++;
|
| | | * |
| | | * // 消息推送 try { if (systemCoupon.getType() ==
|
| | | * CouponTypeEnum.welfareFreeCoupon) {
|
| | | * userOtherMsgNotificationService.welfareCouponGet(userCoupon); } else
|
| | | * if (systemCoupon.getType() == CouponTypeEnum.freeCoupon) {
|
| | | * userOtherMsgNotificationService.freeSheetCouponGet(userCoupon); }
|
| | | * else if (systemCoupon.getType() ==
|
| | | * CouponTypeEnum.rebatePercentCoupon) {
|
| | | * userOtherMsgNotificationService.rewardCouponGet(userCoupon,
|
| | | * systemCoupon.getPercent().intValue()); }
|
| | | * |
| | | * } catch (Exception e) { try { LogHelper.errorDetailInfo(e); } catch
|
| | | * (Exception e1) { e1.printStackTrace(); } } }
|
| | | * |
| | | * if (userInfoExtra == null) { userInfoExtra = new UserInfoExtra();
|
| | | * userInfoExtra.setUserInfo(new UserInfo(uid)); }
|
| | | * |
| | | * userInfoExtra.setLotteryNewbies(Constant.MAX_COUNT_LOTTERY_NEWBIES -
|
| | | * list.size()); Integer couponNews = userInfoExtra.getCouponNews(); if
|
| | | * (couponNews == null) { userInfoExtra.setCouponNews(coupon); } else {
|
| | | * userInfoExtra.setCouponNews(couponNews + coupon); }
|
| | | * userInfoExtraService.saveUserInfoExtra(userInfoExtra);
|
| | | */
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | public void randomRewardCoupon(int num, Long uid, String source) throws Exception {
|
| | | if (num < 1) {
|
| | | return;
|
| | | }
|
| | |
|
| | | for (int i = 0; i < num; i++) {
|
| | |
|
| | | // 返利比-随机
|
| | | BigDecimal percent = new BigDecimal(randomNum());
|
| | | // 查询奖励券
|
| | | SystemCoupon systemCoupon = systemCouponService
|
| | | .getCouponByTypeAndPercent(CouponTypeEnum.rebatePercentCoupon.name(), percent);
|
| | | if (systemCoupon == null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 结束日期 今天在内 减去一天
|
| | | String endDay = DateUtil.plusDay(systemCoupon.getExpiryDay() - 1, new Date());
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | if (endDay != null && endDay.trim().length() > 0) {
|
| | | endDay += " 23:59:59";
|
| | | }
|
| | | Date endTime = format.parse(endDay);
|
| | |
|
| | | UserSystemCoupon userCoupon = new UserSystemCoupon();
|
| | | userCoupon.setUid(uid);
|
| | | userCoupon.setSource(source);
|
| | | userCoupon.setSystemCoupon(systemCoupon);
|
| | | userCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
|
| | | userCoupon.setStateActivated(1);
|
| | | userCoupon.setStartTime(new Date());
|
| | | userCoupon.setEndTime(endTime);
|
| | | userCoupon.setCreateTime(new Date());
|
| | | userCoupon.setUpdateTime(new Date());
|
| | | // 插入数据库
|
| | | insertSelective(userCoupon);
|
| | |
|
| | | // 消息推送
|
| | | try {
|
| | | userOtherMsgNotificationService.rewardCouponGet(userCoupon, systemCoupon.getPercent().intValue());
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 福利中心红点
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra == null) {
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfoExtra extra = new UserInfoExtra();
|
| | | extra.setId(userInfoExtra.getId());
|
| | | Integer couponNews = userInfoExtra.getCouponNews();
|
| | | if (couponNews == null) {
|
| | | extra.setCouponNews(num);
|
| | | } else {
|
| | | extra.setCouponNews(couponNews + num);
|
| | | }
|
| | | userInfoExtraService.saveUserInfoExtra(extra);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void systemGiveRewardCoupon(Long uid, int num, String orderId, Integer orderType, String reason)
|
| | | throws Exception {
|
| | | // 添加奖励券
|
| | | insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(), "系统赠送",
|
| | | new BigDecimal(configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey())), false);
|
| | | // 添加奖励券消息
|
| | | userOtherMsgNotificationService.systemGiveRewardCoupon(uid, null, MsgOtherSystemGiveDTOFactory
|
| | | .createRewardCouponGive(num, "请按照返利奖励券规则使用", "返利奖励券", orderId, orderType, reason));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 随机券比例
|
| | | *
|
| | | * @return
|
| | | */
|
| | | public int randomNum() {
|
| | |
|
| | | private int randomCounponPercent() {
|
| | | int result = 1;
|
| | |
|
| | | List<RandomProportion> list = new ArrayList<RandomProportion>();
|
| | | list.add(new RandomProportion(1, 22));
|
| | | list.add(new RandomProportion(2, 22));
|
| | |
| | | int minRange = 0;
|
| | | int maxRange = 0;
|
| | | int randomNum = (int) (1 + Math.round(Math.random() * (199)));
|
| | |
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | |
|
| | | RandomProportion proportion = list.get(i);
|
| | | int probability = proportion.probability;
|
| | |
|
| | | maxRange = maxRange + probability;
|
| | | minRange = maxRange - probability;
|
| | |
|
| | | if (randomNum > minRange && randomNum <= maxRange) {
|
| | | result = proportion.num;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | return result;
|
| | | }
|
| | |
|
| | |
| | | continue;
|
| | | }
|
| | |
|
| | | // 消息推送
|
| | | try {
|
| | | if (baseCoupon.getType() == CouponTypeEnum.welfareFreeCoupon) {
|
| | | userOtherMsgNotificationService.welfareCouponAlreadyOutOfDate(userSystemCoupon);
|
| | | } else if (baseCoupon.getType() == CouponTypeEnum.freeCoupon) {
|
| | | userOtherMsgNotificationService.freeSheetCouponAlreadyOutOfDate(userSystemCoupon);
|
| | | } else if (baseCoupon.getType() == CouponTypeEnum.rebatePercentCoupon) {
|
| | | userOtherMsgNotificationService.rewardCouponAlreadyOutOfDate(userSystemCoupon);
|
| | | } else if (baseCoupon.getType() == CouponTypeEnum.freeCouponBuy) {
|
| | | userOtherMsgNotificationService.outOfDate(userSystemCoupon, MsgTypeOtherTypeEnum.freeCouponBuy);
|
| | | } else if (baseCoupon.getType() == CouponTypeEnum.freeCouponGive) {
|
| | | userOtherMsgNotificationService.outOfDate(userSystemCoupon, MsgTypeOtherTypeEnum.freeCouponGive);
|
| | | |
| | | try { // 消息推送
|
| | | Long uid = userCoupon.getUid();
|
| | | String source = userCoupon.getSource();
|
| | | if (baseCoupon.getType() == CouponTypeEnum.freeCoupon || baseCoupon.getType() == CouponTypeEnum.freeCouponBuy) {
|
| | | userOtherMsgNotificationService.freeCouponEndMsg(uid, "自购免单券", source, 1, "已过期");
|
| | | } else if (baseCoupon.getType() == CouponTypeEnum.freeCouponGive) {
|
| | | userOtherMsgNotificationService.freeCouponEndMsg(uid, "赠送免单券", source, 1, "已过期");
|
| | | } if (baseCoupon.getType() == CouponTypeEnum.rebatePercentCoupon) {
|
| | | userOtherMsgNotificationService.rewardCouponEndMsg(uid, source, 1, "已过期");
|
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | // 使用记录
|
| | | if (record != null) {
|
| | | if (CouponTypeEnum.welfareFreeCoupon.name().equals(record.getCouponType())) {
|
| | | userOtherMsgNotificationService.welfareCouponDrawBack(userSystemCoupon, record.getOrderNo());
|
| | | } else if (CouponTypeEnum.freeCoupon.name().equals(record.getCouponType())) {
|
| | | userOtherMsgNotificationService.freeSheetCouponDrawBack(userSystemCoupon, record.getOrderNo());
|
| | | } else if (CouponTypeEnum.freeCouponBuy.name().equals(record.getCouponType())) {
|
| | | userOtherMsgNotificationService.couponDrawBack(userSystemCoupon, record.getOrderNo(),
|
| | | MsgTypeOtherTypeEnum.freeCouponBuy);
|
| | | Long uid = userCoupon.getUid();
|
| | | String source = userCoupon.getSource();
|
| | | Date startTime = userCoupon.getStartTime();
|
| | | if (CouponTypeEnum.freeCoupon.name().equals(record.getCouponType()) |
| | | || CouponTypeEnum.freeCouponBuy.name().equals(record.getCouponType())) {
|
| | | userOtherMsgNotificationService.freeCouponWinMsg(uid, "自购免单券", source, 1, "使用退回", startTime, endTime);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | return;
|
| | |
|
| | | // 退回消息
|
| | | String couponName = systemCoupon.getName();
|
| | | if (CouponTypeEnum.freeCouponGive == systemCoupon.getType()) {
|
| | | couponName = "免单券";
|
| | | Long uid = userCoupon.getUid();
|
| | | String source = userCoupon.getSource();
|
| | | CouponTypeEnum type = systemCoupon.getType();
|
| | | if (CouponTypeEnum.freeCouponGive == type) {
|
| | | userOtherMsgNotificationService.freeCouponWinMsg(uid, type.getDesc(), source, 1, "使用退回", |
| | | userCoupon.getStartTime(), userCoupon.getEndTime());
|
| | | } else if (CouponTypeEnum.rebatePercentCoupon == systemCoupon.getType()) {
|
| | | couponName = "奖励券";
|
| | | userOtherMsgNotificationService.rewardCouponWinMsg(uid, source, 1, "使用退回",
|
| | | userCoupon.getStartTime(), userCoupon.getEndTime());
|
| | | }
|
| | |
|
| | | String beiZhu = "请到我的-福利中心查看";
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
|
| | | msgOther.setType(MsgOtherGiveContentDTO.TYEP_COUPON);
|
| | | msgOther.setTitle(couponName + "退回");
|
| | | msgOther.setGiveType("你赠送的" + couponName + "未被成功领取");
|
| | | msgOther.setGiveTime(sd.format(giveRecord.getGiveTime()));
|
| | | msgOther.setReturnTime(sd.format(new Date()));
|
| | | userOtherMsgNotificationService.tokenGiveMsg(giveRecord.getGiveUid(), beiZhu, msgOther);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | continue;
|
| | |
|
| | | // 退回消息
|
| | | String couponName = systemCoupon.getName();
|
| | | if (CouponTypeEnum.freeCouponGive == systemCoupon.getType()) {
|
| | | couponName = "免单券";
|
| | | Long uid = userCoupon.getUid();
|
| | | String source = userCoupon.getSource();
|
| | | CouponTypeEnum type = systemCoupon.getType();
|
| | | if (CouponTypeEnum.freeCouponGive == type) {
|
| | | userOtherMsgNotificationService.freeCouponWinMsg(uid, type.getDesc(), source, 1, "使用退回", |
| | | userCoupon.getStartTime(), userCoupon.getEndTime());
|
| | | } else if (CouponTypeEnum.rebatePercentCoupon == systemCoupon.getType()) {
|
| | | couponName = "奖励券";
|
| | | userOtherMsgNotificationService.rewardCouponWinMsg(uid, source, 1, "使用退回",
|
| | | userCoupon.getStartTime(), userCoupon.getEndTime());
|
| | | }
|
| | |
|
| | | String beiZhu = "请到我的-福利中心查看";
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
|
| | | msgOther.setType(MsgOtherGiveContentDTO.TYEP_COUPON);
|
| | | msgOther.setTitle(couponName + "退回");
|
| | | msgOther.setGiveType("你赠送的" + couponName + "未被成功领取");
|
| | | msgOther.setGiveTime(sd.format(record.getGiveTime()));
|
| | | msgOther.setReturnTime(sd.format(new Date()));
|
| | | userOtherMsgNotificationService.tokenGiveMsg(record.getGiveUid(), beiZhu, msgOther);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService
|
| | | .getByReceiveId(coupon.getId());
|
| | | if (giveRecord == null)
|
| | | return;
|
| | |
|
| | | Long giveUid = giveRecord.getGiveUid();
|
| | | UserInfo userInfo = userInfoService.selectByPKey(giveUid);
|
| | | if (userInfo == null)
|
| | | return;
|
| | |
|
| | | String beiZhu = "请到我的-福利中心中查看";
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | MsgOtherCouponActivateDTO msgOther = new MsgOtherCouponActivateDTO();
|
| | | msgOther.setTitle("免单券激活");
|
| | | msgOther.setType("免单券系统已自动激活");
|
| | | msgOther.setExplain("满足" + systemCoupon.getActivateDay() + "天内产生" + limitNum + "笔已到账返利订单");
|
| | | msgOther.setGiveUser("昵称:" + userInfo.getNickName() + " ID:" + giveUid);
|
| | | msgOther.setReceiveTime(sd.format(giveRecord.getReceiveTime()));
|
| | | msgOther.setValidityTime(expiryDay + "天");
|
| | | userOtherMsgNotificationService.giveCouponActivateMsg(coupon.getUid(), beiZhu, msgOther);
|
| | | Long uid = coupon.getUid();
|
| | | String source = coupon.getSource();
|
| | | userOtherMsgNotificationService.freeCouponWinMsg(uid, "自购免单券", source, 1,
|
| | | "激活成功", nowDate, endTime);
|
| | | }
|
| | | });
|
| | | } catch (Exception e) {
|
| | |
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | thing = "自购免单券";
|
| | | thingNum = "1张";
|
| | | userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.freeCouponBuy.name(),
|
| | | UserSystemCoupon.SOURCE_EXCHANGE, null);
|
| | | userSystemCouponService.freeCouponWin(uid, CouponTypeEnum.freeCouponBuy, UserSystemCoupon.SOURCE_EXCHANGE,
|
| | | 1, true);
|
| | | |
| | | once = true;
|
| | | couponNews = 1;
|
| | | } else if (ExchangeTypeEnum.freeCouponGive == type) {
|
| | | thing = "赠送免单券";
|
| | | thingNum = "1张";
|
| | | userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.freeCouponGive.name(),
|
| | | UserSystemCoupon.SOURCE_EXCHANGE, null);
|
| | | userSystemCouponService.freeCouponWin(uid, CouponTypeEnum.freeCouponGive, UserSystemCoupon.SOURCE_EXCHANGE,
|
| | | 1, true);
|
| | | |
| | | couponNews = 1;
|
| | | } else if (ExchangeTypeEnum.rebatePercentCoupon == type) {
|
| | | thing = "返利奖励券";
|
| | | thingNum = "1张";
|
| | | String percent = configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey());
|
| | | userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_EXCHANGE, new BigDecimal(percent));
|
| | | userSystemCouponService.rewardCouponWin(uid, UserSystemCoupon.SOURCE_EXCHANGE, 1, |
| | | true, new BigDecimal(percent));
|
| | | couponNews = 1;
|
| | | } else if (ExchangeTypeEnum.inviteCodePublish == type) {
|
| | | thing = "邀请码发布卡";
|
| | |
| | |
|
| | | // 消息
|
| | | final String things = thing;
|
| | | final String exNum = thingNum;
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | MsgOtherExchangeContentDTO msgOther = new MsgOtherExchangeContentDTO();
|
| | | msgOther.setState("金币兑换成功");
|
| | | msgOther.setExpend(goldCoin + "金币");
|
| | | msgOther.setTotalGold(surplus + "金币");
|
| | | msgOther.setThing(things);
|
| | | userOtherMsgNotificationService.exchangeMsg(uid, "", msgOther);
|
| | | if (ExchangeTypeEnum.inviteCodePublish == type) {
|
| | | userOtherMsgNotificationService.goldCoinExChangeMsg(uid, goldCoin, surplus, things, "1张");
|
| | | } else {
|
| | | userOtherMsgNotificationService.goldCoinExChangeMsg(uid, goldCoin, surplus, things, exNum);
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | |
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | UserInfo userInfo = userInfoService.selectByPKey(record.getUid());
|
| | | if (userInfo == null)
|
| | | return;
|
| | |
|
| | | String beizu = "邀请人:" + userInfo.getNickName() + ",邀请码:" + inviteCode;
|
| | |
|
| | | MsgOtherExchangeContentDTO msgOther = new MsgOtherExchangeContentDTO();
|
| | | msgOther.setState("金币兑换成功");
|
| | | msgOther.setExpend(goldCoin + "金币");
|
| | | msgOther.setTotalGold(surplus + "金币");
|
| | | msgOther.setThing("邀请码激活卡");
|
| | |
|
| | | userOtherMsgNotificationService.exchangeMsg(uid, beizu, msgOther);
|
| | | userOtherMsgNotificationService.goldCoinExChangeMsg(uid, goldCoin, surplus, "邀请码激活卡", "1张");
|
| | | }
|
| | | });
|
| | |
|
| | |
| | | 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;
|
| | |
| | | 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()
|
| | |
| | | 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);
|
| | | }
|
| | | |
| | | }
|
| | |
| | | threeSaleMapper.deleteExpireRecord(inviter.getId(), inviteeUser.getId());
|
| | | }
|
| | |
|
| | | // 创建通知
|
| | | userInviteMsgNotificationService.inviteScan(inviter.getId(), threeSale);
|
| | |
|
| | | } else {// 是已经存在的用户
|
| | | if (worker.getId().longValue() == inviter.getId())
|
| | | throw new ThreeSaleException(4, "不能绑定自己");
|
| | |
| | | threeSaleMapper.deleteExpireRecord(inviter.getId(), worker.getId());
|
| | | }
|
| | |
|
| | | userInviteMsgNotificationService.inviteScan(inviter.getId(), threeSale);
|
| | | // threeSaleSerivce.bind(invitee, inviter);
|
| | |
|
| | | } else {
|
| | | // 还存在有效的邀请,则不做处理
|
| | | }
|
| | |
| | | ts.setSucceedTime(System.currentTimeMillis());
|
| | | ts.setWorker(worker);
|
| | | threeSaleMapper.insertSelective(ts);
|
| | | inviteSuccess(inviter.getId(), worker.getId(), ts);
|
| | | } else {
|
| | | if (!list.get(0).getState() && list.get(0).getExpire() == ThreeSale.EXPIRE_NORMAL
|
| | | && list.get(0).getBoss().getId() == inviter.getId().longValue()) {// 未生效的上级和现在上级一样就生效
|
| | |
| | | update.setState(true);
|
| | | update.setSucceedTime(System.currentTimeMillis());
|
| | | threeSaleMapper.updateByPrimaryKeySelective(update);
|
| | | inviteSuccess(list.get(0).getBoss().getId(), list.get(0).getWorker().getId(), list.get(0));
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | // if (inviter != null)
|
| | | // reComputeUserRank(inviter.getId());
|
| | | // 添加到队列
|
| | | inviteSuccess(oldSale.getBoss().getId(), oldSale.getWorker().getId(), oldSale);
|
| | | inviteSuccess(oldSale.getBoss().getId(), worker);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
| | | threeSaleMapper.insertSelective(threeSale);
|
| | |
|
| | | inviteSuccess(inviter.getId(), invitee.getId(), threeSale);
|
| | | inviteSuccess(inviter.getId(), invitee);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
| | | threeSaleMapper.insertSelective(threeSale);
|
| | |
|
| | | UserInfo boss = userInfoService.selectByPKey(threeSale.getBoss().getId());
|
| | | threeSale.setBoss(boss);
|
| | | threeSale.setWorker(invitee);
|
| | |
|
| | | // 邀请成功:消息、相关处理
|
| | | inviteSuccess(boss.getId(), invitee.getId(), threeSale);
|
| | | inviteSuccess(inviterId, invitee);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请成功
|
| | | */
|
| | | @Transactional
|
| | | private void inviteSuccess(Long bossId, Long workerId, ThreeSale threeSale) {
|
| | | // 邀请消息
|
| | | UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(bossId);
|
| | | if (activeLog != null && VersionUtil.greaterThan_2_0_5(
|
| | | "appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android", activeLog.getVersionCode())) { // 2.1版本以上
|
| | | userInviteMsgNotificationService.inviteSuccess2_1(bossId, threeSale);
|
| | | } else { // 最初消息
|
| | | userInviteMsgNotificationService.inviteSuccess(threeSale.getBoss().getId(), threeSale);
|
| | | private void inviteSuccess(Long bossId, UserInfo invitee) {
|
| | | if (!Constant.IS_TEST) {
|
| | | UserInviteMQMsg msg = new UserInviteMQMsg(bossId, invitee.getId(), null, new Date(), UserInviteMQMsg.STATE_SUCCESS);
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteSuccess, msg);
|
| | | producer.send(message);
|
| | | }
|
| | |
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | // 邀请金币
|
| | | integralGetService.addInviteLevelOne(bossId, workerId);
|
| | | try {
|
| | | // 邀请金币
|
| | | integralGetService.addInviteLevelOne(bossId, invitee.getId());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | try {
|
| | | // 直接粉丝邀请成功
|
| | | userInviteMsgNotificationService.directInviteSuccess(bossId, invitee.getNickName(),
|
| | | invitee.getPortrait(), new Date());
|
| | | |
| | | // 间接粉丝邀请成功
|
| | | ThreeSale myBoss = threeSaleMapper.getMyBoss(bossId);
|
| | | if (myBoss != null) {
|
| | | UserInfo boss = userInfoService.selectByPKey(bossId);
|
| | | userInviteMsgNotificationService.indirectInviteSuccess(bossId, boss.getNickName(),
|
| | | invitee.getNickName(), invitee.getPortrait(), new Date());
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | });
|
| | | UserInviteMQMsg msg = new UserInviteMQMsg(bossId, workerId, null, new Date(), UserInviteMQMsg.STATE_SUCCESS);
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteSuccess, msg);
|
| | | if (!Constant.IS_TEST)
|
| | | producer.send(message);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
|
| | | import com.yeshi.fanli.dto.push.PushContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgExtra;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.config.push.PushMsgFactory;
|
| | | import com.yeshi.fanli.exception.msg.MsgInviteDetailException;
|
| | | import com.yeshi.fanli.exception.push.PushException;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgExtraService;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.MsgInviteDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteMsgNotificationService;
|
| | |
| | |
|
| | | @Resource
|
| | | private MsgInviteDetailService msgInviteDetailService;
|
| | | |
| | | @Resource
|
| | | private MsgExtraService msgExtraService;
|
| | |
|
| | | @Resource
|
| | | private PushService pushService;
|
| | |
|
| | | @Override
|
| | | public void inviteScan(Long uid, ThreeSale sale) {
|
| | | MsgInviteDetail detail = MsgInviteDetailFactory.createInviteScanSuccess(sale, uid, null);
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private void saveMsgDetail(MsgInviteDetail detail) {
|
| | | try {
|
| | | msgInviteDetailService.addMsgInviteDetail(detail);
|
| | | // 消息内容
|
| | | msgExtraService.addMsgExtra(detail.getId(), detail.getExtraInfo(), MsgExtra.MSG_TYPE_INVITE);
|
| | | } catch (MsgInviteDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void inviteSuccess(Long uid, ThreeSale sale) {
|
| | | MsgInviteDetail detail = MsgInviteDetailFactory.createInviteSuccess(sale, uid, null);
|
| | | try {
|
| | | msgInviteDetailService.addMsgInviteDetail(detail);
|
| | | } catch (MsgInviteDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | PushContentDTO dto = PushMsgFactory.createInviteTeamSuccess(new Date(), sale.getWorker().getNickName());
|
| | | try {
|
| | | pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null);
|
| | | } catch (NumberFormatException e) {
|
| | | e.printStackTrace();
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public void inviteSuccess2_1(Long uid, ThreeSale sale) {
|
| | | MsgInviteDetail detail = MsgInviteDetailFactory.createInviteSuccess2_1(uid, sale);
|
| | | msgInviteDetailService.insertSelective(detail);
|
| | | PushContentDTO dto = PushMsgFactory.createInviteTeamSuccess(new Date(), sale.getWorker().getNickName());
|
| | | try {
|
| | | pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null);
|
| | | } catch (NumberFormatException e) {
|
| | | e.printStackTrace();
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void directInviteSuccess(Long uid, String nickName, String portrait, Date time) {
|
| | | saveMsgDetail(MsgInviteDetailFactory.directInviteSuccess(uid, nickName, portrait, time));
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void indirectInviteSuccess(Long uid, String inviteName, String nickName, String portrait, Date time) {
|
| | | saveMsgDetail(MsgInviteDetailFactory.indirectInviteSuccess(uid, inviteName, nickName, portrait, time));
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void inviteFail(Long uid, ThreeSale sale) {
|
| | | MsgInviteDetail detail = MsgInviteDetailFactory.createInviteFail(sale, uid, null);
|
| | | try {
|
| | | msgInviteDetailService.addMsgInviteDetail(detail);
|
| | | } catch (MsgInviteDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void fansUpgrade(Long uid, String relation, String rankName, String nickName, String item, Date time) {
|
| | | saveMsgDetail(MsgInviteDetailFactory.fansUpgrade(uid, relation, rankName, nickName, item, time));
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void fansPreDivorced(Long uid, String rankName, String nickName, String item, Date time) {
|
| | | saveMsgDetail(MsgInviteDetailFactory.fansPreDivorced(uid, rankName, nickName, item, time));
|
| | | }
|
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void fansPredivorcedIndirect(Long uid, String rankName, String nickName, String fansName,
|
| | | String item, Date time) {
|
| | | saveMsgDetail(MsgInviteDetailFactory.fansPredivorcedIndirect(uid, rankName, nickName, fansName, item, time));
|
| | | }
|
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void fansDivorced(Long uid, String nickName, Date time) {
|
| | | saveMsgDetail(MsgInviteDetailFactory.fansDivorced(uid, nickName, time));
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void fansDivorcedIndirect(Long uid, String nickName, String fansName, Date time) {
|
| | | saveMsgDetail(MsgInviteDetailFactory.fansDivorcedIndirect(uid, nickName, fansName, time));
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void receiveGift(Long uid, String beizu, MsgInviteContentDTO content) {
|
| | |
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserInviteSeparateMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherVIPDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInviteSeparateService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class UserInviteSeparateServiceImpl implements UserInviteSeparateService {
|
| | |
| | |
|
| | | @Lazy
|
| | | @Resource
|
| | | private UserOtherMsgNotificationService userOtherMsgNotificationService;
|
| | | private UserInviteMsgNotificationService userInviteMsgNotificationService;
|
| | |
|
| | | @Override
|
| | | public void insertSelective(UserInviteSeparate record) {
|
| | |
| | | inviteSeparate.setCreateTime(new Date());
|
| | | inviteSeparate.setUpdateTime(new Date());
|
| | | userInviteSeparateMapper.insertSelective(inviteSeparate);
|
| | | |
| | | UserInfo userInfo = userInfoService.getUserById(workerId);
|
| | | // 消息
|
| | | MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO();
|
| | | msgboss.setContent1(userInfo.getNickName() + " " + workerId);
|
| | | msgboss.setContent2("于" + TimeUtil.formatDateDot(new Date()) + "成功升级成为会员");
|
| | | msgboss.setContent3("今日起" + limitDays + "天内,你未能成为会员将会与其脱离邀请关系 ");
|
| | | userOtherMsgNotificationService.teamVIPCallBoss(bossId, "如有疑问请联系我的-人工客服", msgboss);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | }
|
| | |
|
| | |
|
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void inviteSeparate(UserInviteSeparate record) {
|
| | |
| | |
|
| | | Long workerId = record.getWorkerId();
|
| | | Long bossId = record.getBossId();
|
| | | |
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(workerId);
|
| | | if (threeSale == null) {
|
| | | // 成功脱离 不发消息
|
| | |
| | | } else {
|
| | | // 脱离关系
|
| | | userInviteSeparateMapper.updateStateByWorkerIdAndBossId(workerId, bossId, UserInviteSeparate.STATE_SUCCESS);
|
| | |
|
| | | // 脱离邀请关系
|
| | | threeSaleSerivce.inviteSeparate(workerId, bossId);
|
| | |
|
| | | int limitDays = Integer.parseInt(userVipConfigService.getValueByKey("invite_separate_limit_days"));
|
| | |
|
| | | // 消息
|
| | | UserInfo userInfo = userInfoService.selectByPKey(workerId);
|
| | | MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO();
|
| | | msgboss.setContent1(userInfo.getNickName() + workerId + "于"+ TimeUtil.formatDateDot(record.getCreateTime()) + "成功升级成为会员 ");
|
| | | msgboss.setContent2("很遗憾,你未能在" + limitDays + "天升级为会员 ");
|
| | | msgboss.setContent3("已与其脱离邀请关系");
|
| | | userOtherMsgNotificationService.teamSplitCallBoss(bossId, "如有疑问请联系我的-人工客服", msgboss);
|
| | | UserInfo worker = userInfoService.selectByPKey(workerId);
|
| | | |
| | | // 提醒上级脱离
|
| | | userInviteMsgNotificationService.fansDivorced(bossId, worker.getNickName(), new Date());
|
| | | |
| | | // 提醒上上级脱离
|
| | | ThreeSale threeSaleSuper = threeSaleSerivce.getMyBoss(bossId);
|
| | | if (threeSaleSuper != null) { // 粉丝升级提醒
|
| | | Long bossIdSuper = threeSaleSuper.getBoss().getId();
|
| | | UserInfo boss = userInfoService.selectByPKey(workerId);
|
| | | userInviteMsgNotificationService.fansDivorcedIndirect(bossIdSuper, worker.getNickName(),
|
| | | boss.getNickName(), new Date());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | package com.yeshi.fanli.service.impl.user.vip;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | |
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPInfoMapper;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVOFactory;
|
| | |
|
| | | @Service
|
| | | public class UserVIPInfoServiceImpl implements UserVIPInfoService {
|
| | |
| | | if (userInfoExtra == null)
|
| | | throw new UserVIPInfoException(1, "用户信息不存在");
|
| | |
|
| | | Date upgradeTime = new Date();
|
| | | // 通过超级会员
|
| | | UserVIPInfo info = new UserVIPInfo();
|
| | | info.setId(userVIPInfo.getId());
|
| | | info.setSuccessTime(new Date());
|
| | | info.setSuccessTime(upgradeTime);
|
| | | info.setState(UserVIPInfo.STATE_SUCCESS);
|
| | | info.setUpdateTime(new Date());
|
| | | info.setUpdateTime(upgradeTime);
|
| | | userVIPInfoMapper.updateByPrimaryKeySelective(info);
|
| | |
|
| | | try {
|
| | |
| | | String giveCoupon = userVipConfigService.getValueByKey("vip_pre_10_gift_givefree_coupon");
|
| | | if (!StringUtil.isNullOrEmpty(giveCoupon)) {
|
| | | int num = Integer.parseInt(giveCoupon);
|
| | | for (int i = 0; i < num; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCouponGive.name(),
|
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, null, false);
|
| | | }
|
| | | |
| | | // 消息
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("状 态", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("恭喜你!成功升级为超级会员", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("奖 励", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("获得赠送免单券" + num +"张", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备 注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("详情查看,对应会员权益", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | userOtherMsgNotificationService.createMsgOtherDetail(uid, listMsg, MsgTypeOtherTypeEnum.vipUpgradeReward);
|
| | | userSystemCouponService.freeCouponWin(uid, CouponTypeEnum.freeCouponGive,
|
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, num, true);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | throw new UserVIPInfoException(1, "券赠送失败");
|
| | | }
|
| | |
|
| | | // 升级消息
|
| | | try {
|
| | | // 升级消息
|
| | | UserVIPPreInfo pre1 = userVIPPreInfoService.getVipByProcess(uid, UserVIPPreInfo.PROCESS_2);
|
| | | int days = DateUtil.daysBetween(pre1.getCreateTime(), new Date());
|
| | | userAccountMsgNotificationService.vipUpgradeSuccess(uid, days);
|
| | | |
| | | // 升级提醒上级
|
| | | userVIPPreInfoService.remindBoss(uid, "超级会员", getPassItem(uid), upgradeTime, false);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 验证是否符合VIP
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | private String getPassItem(Long uid) {
|
| | | // 自购订单
|
| | | long doneZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_ZIGOU);
|
| | | // 分享订单
|
| | | long doneShare = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_SHARE_GOODS);
|
| | | |
| | | // 有效粉丝
|
| | | int doneFirst = 0;
|
| | | int doneSecond = 0;
|
| | | UserInviteValidNum userInviteValidNum = userInviteValidNumService.selectByPrimaryKey(uid);
|
| | | if (userInviteValidNum != null) {
|
| | | doneFirst = userInviteValidNum.getNumFirst() == null ? 0 : userInviteValidNum.getNumFirst();
|
| | | doneSecond = userInviteValidNum.getNumSecond() == null ? 0 : userInviteValidNum.getNumSecond();
|
| | | }
|
| | |
|
| | | long limitZiGou = 0;
|
| | | String zigou = userVipConfigService.getValueByKey("vip_pre_10_zigou_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(zigou)) {
|
| | | limitZiGou = Long.parseLong(zigou);
|
| | | }
|
| | | |
| | | long limitShare = 0;
|
| | | String share = userVipConfigService.getValueByKey("vip_pre_10_share_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(share)) {
|
| | | limitShare = Long.parseLong(share);
|
| | | }
|
| | | |
| | | long limitFirst = 0;
|
| | | String first = userVipConfigService.getValueByKey("vip_pre_10_first_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(first)) {
|
| | | limitFirst = Long.parseLong(first);
|
| | | }
|
| | | |
| | | long limitSecond = 0;
|
| | | String second = userVipConfigService.getValueByKey("vip_pre_10_second_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(second)) {
|
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | | |
| | | String item = "";
|
| | | if (doneZiGou >= limitZiGou) {
|
| | | item = "返利订单";
|
| | | } else if (doneShare >= limitShare) {
|
| | | item = "分享订单";
|
| | | } else if (doneFirst >= limitFirst && doneSecond >= limitSecond) {
|
| | | item = "邀请粉丝";
|
| | | }
|
| | | return item;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 验证是否符合VIP
|
| | | * @param uid
|
| | |
| | | package com.yeshi.fanli.service.impl.user.vip;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | | import java.util.Date;
|
| | |
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPPreInfoMapper;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoRegister;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.entity.integral.IntegralDetail;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPPreInfoException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
|
| | | import com.yeshi.fanli.service.inter.user.msg.UserAccountMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVOFactory;
|
| | |
|
| | | @Service
|
| | | public class UserVIPPreInfoServiceImpl implements UserVIPPreInfoService {
|
| | |
| | | @Resource
|
| | | private UserInfoRegisterService userInfoRegisterService;
|
| | |
|
| | | @Resource
|
| | | private UserInviteMsgNotificationService userInviteMsgNotificationService;
|
| | |
|
| | | @Override
|
| | | public void addUserVIPPreInfo(UserVIPPreInfo info) throws UserVIPPreInfoException {
|
| | |
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | |
|
| | | String item = "";
|
| | | Integer type = null;
|
| | | long targetNum1 = 0L;
|
| | | Long targetNum2 = 0L;
|
| | |
| | | process = true;
|
| | | type = Constant.TYPE_REBATE;
|
| | | targetNum1 = limitZiGou;
|
| | | item = "返利订单";
|
| | | } else if (countShare >= limitShare) {
|
| | | process = true;
|
| | | type = Constant.TYPE_SHAER;
|
| | | targetNum1 = limitShare;
|
| | | item = "分享订单";
|
| | | } else if (firstTeam >= limitFirst && secondTeam >= limitSecond) {
|
| | | process = true;
|
| | | targetNum1 = limitFirst;
|
| | | targetNum2 = limitSecond;
|
| | | item = "邀请粉丝";
|
| | | }
|
| | |
|
| | | if (process) {
|
| | | try {
|
| | | Date upgradeTime = new Date();
|
| | | UserVIPPreInfo info = new UserVIPPreInfo();
|
| | | info.setUid(uid);
|
| | | info.setProcess(UserVIPPreInfo.PROCESS_1);
|
| | | info.setCreateTime(new Date());
|
| | | info.setUpdateTime(new Date());
|
| | | info.setCreateTime(upgradeTime);
|
| | | info.setUpdateTime(upgradeTime);
|
| | | addUserVIPPreInfo(info);
|
| | |
|
| | | // 升级消息
|
| | |
| | | detail.setTitle("升级VIP福利");
|
| | | detail.setUid(uid);
|
| | | detail.setMoney(Integer.parseInt(goldcoin));
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setCreateTime(upgradeTime);
|
| | | detail.setUniqueKey("VIP-3-" + uid);
|
| | | integralDetailService.insertSelective(detail);
|
| | |
|
| | |
| | | userInfoExtraService.addGoldCoinByUid(uid, Integer.parseInt(goldcoin));
|
| | |
|
| | | // 消息
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("状 态", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("恭喜你!成功升级为普通会员", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("奖 励", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("获得金币" + goldcoinNum+"枚", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备 注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("详情查看,对应会员权益", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | userOtherMsgNotificationService.createMsgOtherDetail(uid, listMsg, MsgTypeOtherTypeEnum.vipUpgradeReward);
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | userOtherMsgNotificationService.goldCoinSystemGiveMsg(uid, goldcoinNum, userInfoExtra.getGoldCoin());
|
| | | }
|
| | | |
| | | // 是否存在下级脱离期限 -更新不脱离
|
| | | userInviteSeparateService.updateInvalidByBossId(uid);
|
| | |
|
| | | // 上级脱离关系
|
| | | remindBoss(uid);
|
| | | // 提醒上级
|
| | | remindBoss(uid, "普通会员", item, upgradeTime, true);
|
| | |
|
| | | } catch (UserVIPPreInfoException e) {
|
| | | e.printStackTrace();
|
| | |
| | | }
|
| | | return process;
|
| | | }
|
| | |
|
| | | |
| | | private void remindBoss(Long uid) {
|
| | | // 是否存在上级
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
|
| | | if (threeSale == null)
|
| | | return;
|
| | | |
| | | // 验证上级是否正常
|
| | | Long bossId = threeSale.getBoss().getId();
|
| | | UserInfo userInfo = userInfoService.getUserById(bossId);
|
| | | if (userInfo == null || userInfo.getState() != UserInfo.STATE_NORMAL) {
|
| | | return;
|
| | | }
|
| | | |
| | | // 验证上级是否已是会员
|
| | | UserVIPPreInfo oldInfo = userVIPPreInfoMapper.selectByUidAndProcess(bossId, UserVIPPreInfo.PROCESS_1);
|
| | | if (oldInfo != null) {
|
| | | return;
|
| | | }
|
| | | |
| | | // 添加脱离关系倒计时
|
| | | userInviteSeparateService.addPreSeparateRecord(uid, bossId);
|
| | | }
|
| | | |
| | |
|
| | |
|
| | | /**
|
| | |
| | | Integer type = null;
|
| | | long targetNum1 = 0L;
|
| | | Long targetNum2 = 0L;
|
| | | String item = "";
|
| | | boolean process = false;
|
| | | if (countZiGou >= limitZiGou) {
|
| | | process = true;
|
| | | targetNum1 = limitZiGou;
|
| | | type = Constant.TYPE_REBATE;
|
| | | item = "返利订单";
|
| | | } else if (countShare >= limitShare) {
|
| | | process = true;
|
| | | targetNum1 = limitShare;
|
| | | type = Constant.TYPE_SHAER;
|
| | | item = "分享订单";
|
| | | } else if (firstTeam >= limitFirst && secondTeam >= limitSecond) {
|
| | | process = true;
|
| | | targetNum1 = limitFirst;
|
| | | targetNum2 = limitSecond;
|
| | | item = "邀请粉丝";
|
| | | }
|
| | |
|
| | | if (process) {
|
| | | try {
|
| | | Date upgradeTime = new Date();
|
| | | UserVIPPreInfo info = new UserVIPPreInfo();
|
| | | info.setUid(uid);
|
| | | info.setProcess(UserVIPPreInfo.PROCESS_2);
|
| | | info.setCreateTime(new Date());
|
| | | info.setUpdateTime(new Date());
|
| | | info.setCreateTime(upgradeTime);
|
| | | info.setUpdateTime(upgradeTime);
|
| | | addUserVIPPreInfo(info);
|
| | |
|
| | | // 升级消息
|
| | | UserVIPPreInfo pre1 = userVIPPreInfoMapper.selectByUidAndProcess(uid, UserVIPPreInfo.PROCESS_1);
|
| | | int daysBetween = DateUtil.daysBetween(pre1.getCreateTime(), new Date());
|
| | | int daysBetween = DateUtil.daysBetween(pre1.getCreateTime(), upgradeTime);
|
| | | userAccountMsgNotificationService.vipPreUpgrade(uid, "普通会员", "高级会员", daysBetween, targetNum1, targetNum2, type);
|
| | |
|
| | | // 赠送奖励券
|
| | |
| | | if (!StringUtil.isNullOrEmpty(rewardCoupon)) {
|
| | | int num = Integer.parseInt(rewardCoupon);
|
| | | BigDecimal percent = new BigDecimal(configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey()));
|
| | | for (int i = 0; i < num; i++) {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_SYSTEM_PUSH, percent, false);
|
| | | }
|
| | | |
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("状 态", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("恭喜你!成功升级为高级会员", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("奖 励", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("获得返利奖励券" + num +"张", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备 注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("详情查看,对应会员权益", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | userOtherMsgNotificationService.createMsgOtherDetail(uid, listMsg, MsgTypeOtherTypeEnum.vipUpgradeReward);
|
| | | userSystemCouponService.rewardCouponWin(uid, UserSystemCoupon.SOURCE_SYSTEM_PUSH, num, true, percent);
|
| | | }
|
| | | |
| | | // 提醒上级
|
| | | remindBoss(uid, "高级会员", item, upgradeTime, false);
|
| | | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.error(e);
|
| | |
| | | }
|
| | | return process;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void remindBoss(Long uid, String rankName, String item, Date time, boolean divorced) {
|
| | | // 是否存在上级
|
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
|
| | | if (threeSale == null)
|
| | | return;
|
| | | Long bossId = threeSale.getBoss().getId();
|
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | |
| | | // 粉丝升级提醒
|
| | | userInviteMsgNotificationService.fansUpgrade(bossId, "直接粉丝", rankName, userInfo.getNickName(), item, time);
|
| | | |
| | | // 是否存在上上级
|
| | | ThreeSale threeSaleSuper = threeSaleSerivce.getMyBoss(bossId);
|
| | | if (threeSaleSuper != null) { // 粉丝升级提醒
|
| | | Long bossIdSuper = threeSaleSuper.getBoss().getId();
|
| | | userInviteMsgNotificationService.fansUpgrade(bossIdSuper, "间接粉丝", rankName, userInfo.getNickName(), item, time);
|
| | | }
|
| | | |
| | | // 是否升级脱离
|
| | | if (!divorced) {
|
| | | return;
|
| | | }
|
| | | |
| | | // 验证上级是否已是会员
|
| | | UserVIPPreInfo oldInfo = userVIPPreInfoMapper.selectByUidAndProcess(bossId, UserVIPPreInfo.PROCESS_1);
|
| | | if (oldInfo == null) {
|
| | | // 添加脱离关系倒计时
|
| | | userInviteSeparateService.addPreSeparateRecord(uid, bossId);
|
| | | |
| | | // 直接粉丝脱离-开始脱离提醒
|
| | | userInviteMsgNotificationService.fansPreDivorced(bossId, rankName, userInfo.getNickName(), item, time);
|
| | | |
| | | //间接粉丝脱离-开始脱离提醒
|
| | | if (threeSaleSuper != null) { |
| | | UserInfo boss = userInfoService.selectByPKey(bossId);
|
| | | Long bossIdSuper = threeSaleSuper.getBoss().getId();
|
| | | userInviteMsgNotificationService.fansPredivorcedIndirect(bossIdSuper, rankName, userInfo.getNickName(),
|
| | | boss.getNickName(), item, time);
|
| | | } |
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | public UserVIPPreInfo selectByUidAndProcess(Long uid, int process) {
|
| | | UserVIPPreInfo info = userVIPPreInfoMapper.selectByUidAndProcess(uid, process);
|
| | | return info;
|
| | |
| | | */
|
| | | public List<UserMoneyExtra> listValid(int page, int count);
|
| | |
|
| | | /**
|
| | | * 红包对换金币
|
| | | * @param page
|
| | | * @param count
|
| | | */
|
| | | public void taoLiJinExchange(int page, int count);
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.msg;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherRewardIntegralDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherSystemGiveDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherVIPDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
|
| | | import java.util.Date;
|
| | |
|
| | | /**
|
| | | * 用户订单消息通知
|
| | |
| | | *
|
| | | */
|
| | | public interface UserOtherMsgNotificationService {
|
| | |
|
| | | // 福利奖励券
|
| | |
|
| | | |
| | | /**
|
| | | * 获得福利免单券
|
| | | * |
| | | * @param leftDay
|
| | | * 免单券消息 - 成功获得/激活成功/使用退回
|
| | | * @param uid
|
| | | * @param name
|
| | | * @param source
|
| | | * @param num
|
| | | * @param stateDesc
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void welfareCouponGet(UserSystemCoupon coupon);
|
| | | public void freeCouponWinMsg(Long uid, String name, String source, int num, String stateDesc, Date startTime,
|
| | | Date endTime);
|
| | |
|
| | | /**
|
| | | * 福利免单券激活
|
| | | * |
| | | * @param leftDay
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void welfareCouponActive(UserSystemCoupon coupon, UserInfo worker);
|
| | |
|
| | | /**
|
| | | * 福利免单券使用中
|
| | | * |
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void welfareCouponUsing(UserSystemCoupon coupon, String orderId, BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 福利免单券已被使用
|
| | | * |
| | | * @param leftDay
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void welfareCouponUsed(UserSystemCoupon coupon, String orderId);
|
| | |
|
| | | /**
|
| | | * 福利免单券即将过期
|
| | | * |
| | | * @param leftDay
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void welfareCouponWillOutOfDate(UserSystemCoupon coupon);
|
| | |
|
| | | /**
|
| | | * 福利免单券已经过期
|
| | | * |
| | | * @param coupon
|
| | | */
|
| | | public void welfareCouponAlreadyOutOfDate(UserSystemCoupon coupon);
|
| | |
|
| | | /**
|
| | | * 福利免单券已经退回
|
| | | * |
| | | * @param coupon
|
| | | */
|
| | | public void welfareCouponDrawBack(UserSystemCoupon coupon, String orderId);
|
| | |
|
| | | // 免单券
|
| | |
|
| | | /**
|
| | | * 免单券使用
|
| | | * |
| | | * @param leftDay
|
| | | * 免单券消息 -使用成功/已过期
|
| | | * @param uid
|
| | | * @param name
|
| | | * @param source
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param num
|
| | | * @param stateDesc
|
| | | */
|
| | | public void freeSheetCouponGet(UserSystemCoupon coupon);
|
| | | public void freeCouponEndMsg(Long uid, String name, String source, int num, String stateDesc);
|
| | |
|
| | | |
| | | /**
|
| | | * 免单券正在使用
|
| | | * |
| | | * 奖励券-成功获得/使用退回
|
| | | * @param uid
|
| | | * @param name
|
| | | * @param source
|
| | | * @param num
|
| | | * @param stateDesc
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void freeSheetCouponUsing(UserSystemCoupon coupon, String orderId, BigDecimal money);
|
| | | public void rewardCouponWinMsg(Long uid, String source, int num, String stateDesc, Date startTime,
|
| | | Date endTime);
|
| | |
|
| | | /**
|
| | | * 免单券已经使用
|
| | | * |
| | | * @param leftDay
|
| | | * 奖励券-使用成功/已过期
|
| | | * @param uid
|
| | | * @param name
|
| | | * @param source
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param num
|
| | | * @param stateDesc
|
| | | */
|
| | | public void freeSheetCouponUsed(UserSystemCoupon coupon, String orderId);
|
| | | public void rewardCouponEndMsg(Long uid, String source, int num, String stateDesc);
|
| | |
|
| | | /**
|
| | | * 免单券即将过期
|
| | | * |
| | | * @param leftDay
|
| | | * @param source
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void freeSheetCouponWillOutOfDate(UserSystemCoupon coupon);
|
| | |
|
| | | /**
|
| | | * 免单券已经过期
|
| | | * |
| | | * @param source
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void freeSheetCouponAlreadyOutOfDate(UserSystemCoupon coupon);
|
| | |
|
| | | /**
|
| | | * 已退回
|
| | | * |
| | | * @param coupon
|
| | | */
|
| | | public void freeSheetCouponDrawBack(UserSystemCoupon coupon, String orderId);
|
| | |
|
| | | // 奖励券
|
| | |
|
| | | /**
|
| | | * 奖励券获得
|
| | | * |
| | | * @param coupon
|
| | | * @param percent
|
| | | * -百分比
|
| | | */
|
| | | public void rewardCouponGet(UserSystemCoupon coupon, int percent);
|
| | |
|
| | | /**
|
| | | * 奖励券使用成功
|
| | | * |
| | | * @param coupon
|
| | | * @param oldFanLiMoney-原始返利金额
|
| | | * @param rewardMoney-奖励金额
|
| | | */
|
| | | public void rewardCouponUsed(UserSystemCoupon coupon, BigDecimal oldFanLiMoney, BigDecimal rewardMoney,
|
| | | String orderId);
|
| | |
|
| | | /**
|
| | | * 奖励券即将过期
|
| | | * |
| | | * @param leftDay
|
| | | * @param source
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void rewardCouponWillOutOfDate(UserSystemCoupon coupon, int percent);
|
| | |
|
| | | /**
|
| | | * 奖励券已经过期
|
| | | * |
| | | * @param source
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void rewardCouponAlreadyOutOfDate(UserSystemCoupon coupon);
|
| | |
|
| | | /**
|
| | | * 淘礼金消息
|
| | | * |
| | | * 系统赠送金币提醒
|
| | | * @param uid
|
| | | * @param beiZhu
|
| | | * @param content
|
| | | * @param num
|
| | | * @param banlce
|
| | | */
|
| | | public void taoLiJinMsg(Long uid, String beiZhu, MsgOtherTaoLiJinContentDTO content);
|
| | | public void goldCoinSystemGiveMsg(Long uid, int num, int banlce);
|
| | |
|
| | | /**
|
| | | * 口令赠送领取
|
| | | * |
| | | * 金币奖励提醒-邀请粉丝
|
| | | * @param uid
|
| | | * @param beiZhu
|
| | | * @param content
|
| | | * @param num
|
| | | * @param banlce
|
| | | * @param directFans
|
| | | */
|
| | | public void tokenGiveMsg(Long uid, String beiZhu, MsgOtherGiveContentDTO content);
|
| | | public void goldCoinRewardInviteSucceedMsg(Long uid, int num, int banlce, boolean directFans);
|
| | |
|
| | | /**
|
| | | * 兑换消息
|
| | | * |
| | | * 金币奖励提醒 - 下单产生的团队收益不足0.01元
|
| | | * @param uid
|
| | | * @param beiZhu
|
| | | * @param content
|
| | | * @param num
|
| | | * @param banlce
|
| | | * @param directFans
|
| | | */
|
| | | public void exchangeMsg(Long uid, String beiZhu, MsgOtherExchangeContentDTO content);
|
| | | public void goldCoinOrderSubsidyMsg(Long uid, int num, int banlce, boolean directFans);
|
| | |
|
| | | /**
|
| | | * 券退回
|
| | | * |
| | | * @param coupon
|
| | | * @param orderId
|
| | | * @param type
|
| | | */
|
| | | public void couponDrawBack(UserSystemCoupon coupon, String orderId, MsgTypeOtherTypeEnum type);
|
| | |
|
| | | /**
|
| | | * 券
|
| | | * |
| | | * @param coupon
|
| | | * @param type
|
| | | */
|
| | | public void outOfDate(UserSystemCoupon coupon, MsgTypeOtherTypeEnum type);
|
| | |
|
| | | /**
|
| | | * 免单券正在使用
|
| | | * |
| | | * @param source
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void couponUsingFreeSheet(UserSystemCoupon coupon, String orderId, BigDecimal money,
|
| | | MsgTypeOtherTypeEnum type);
|
| | |
|
| | | public void couponUsedFreeSheet(UserSystemCoupon coupon, String orderId, MsgTypeOtherTypeEnum type);
|
| | |
|
| | | /**
|
| | | * 赠送的免单券激活
|
| | | * |
| | | * 金币兑换提醒
|
| | | * @param uid
|
| | | * @param beiZhu
|
| | | * @param content
|
| | | * @param num
|
| | | * @param banlce
|
| | | * @param name
|
| | | * @param exNum
|
| | | */
|
| | | public void giveCouponActivateMsg(Long uid, String beiZhu, MsgOtherCouponActivateDTO content);
|
| | |
|
| | | /**
|
| | | * 队员首单奖励邀请人
|
| | | * |
| | | * @param uid
|
| | | * @param beiZhu
|
| | | * @param content
|
| | | */
|
| | | public void firstOrderRewardMsg(Long uid, String beiZhu, MsgOtherRewardIntegralDTO content);
|
| | |
|
| | | /**
|
| | | * 系统赠送的免单券
|
| | | * @param uid
|
| | | * @param beiZhu
|
| | | * @param dto
|
| | | */
|
| | | public void systemGiveRewardCoupon(Long uid, String beiZhu, MsgOtherSystemGiveDTO dto);
|
| | |
|
| | | /**
|
| | | * 淘礼金兑换成金币消息
|
| | | * @param uid
|
| | | * @param beiZhu
|
| | | * @param dto
|
| | | */
|
| | | public void taoLiJinExchangeMsg(Long uid, String beiZhu, MsgOtherRewardIntegralDTO msgOther);
|
| | |
|
| | | /**
|
| | | * 会员申请通过消息
|
| | | * @param uid
|
| | | * @param beiZhu
|
| | | * @param dto
|
| | | */
|
| | | public void passVIPApplyMsg(Long uid, String beiZhu, MsgOtherVIPDTO dto);
|
| | |
|
| | | /**
|
| | | * 会员升级未通过
|
| | | * @param uid
|
| | | * @param beiZhu
|
| | | * @param dto
|
| | | */
|
| | | public void rejectVIPApply(Long uid, String beiZhu, MsgOtherVIPDTO dto);
|
| | |
|
| | | /**
|
| | | * 温馨提醒 |
| | | * @param uid
|
| | | * @param beiZhu
|
| | | * @param dto
|
| | | */
|
| | | public void teamVIPCallBoss(Long uid, String beiZhu, MsgOtherVIPDTO dto);
|
| | |
|
| | | /**
|
| | | * 邀请脱离
|
| | | * @param uid
|
| | | * @param beiZhu
|
| | | * @param dto
|
| | | */
|
| | | public void teamSplitCallBoss(Long uid, String beiZhu, MsgOtherVIPDTO dto);
|
| | |
|
| | |
|
| | | /**
|
| | | * 创建消息明细
|
| | | * @param uid
|
| | | * @param type
|
| | | * @param listMsg
|
| | | */
|
| | | public void createMsgOtherDetail(Long uid, List<CommonMsgItemVO> listMsg, MsgTypeOtherTypeEnum type);
|
| | | public void goldCoinExChangeMsg(Long uid, int num, int banlce, String name, String exNum);
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.exception.user.UserSystemCouponException;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponRecordVO;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponVO;
|
| | |
| | | */
|
| | | public List<UserSystemCoupon> getUserCouponBySource(Long uid, String source);
|
| | |
|
| | | /**
|
| | | * 插入券信息
|
| | | * @param uid
|
| | | * @param couponType
|
| | | * @param source 来源
|
| | | * @throws UserSystemCouponException
|
| | | * @throws Exception
|
| | | */
|
| | | public UserSystemCoupon insertUserCoupon(Long uid, String couponType, String source, BigDecimal percent,Boolean needNotify) throws UserSystemCouponException, Exception;
|
| | |
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | public void sendBackTimeOutCoupon(Long uid);
|
| | |
|
| | | /**
|
| | | * 激活福利免单券
|
| | | * @param uid
|
| | | */
|
| | | public void activatedWelfareFreeCoupon(Long uid, String from);
|
| | |
|
| | | /**
|
| | | * 更新券记录 ——匹配免单券
|
| | |
| | | */
|
| | | public void updateStateByArrivalAccount(String orderNo) throws Exception;
|
| | |
|
| | | /**
|
| | | * 领取未登录时已抽奖的礼品
|
| | | * @param uid
|
| | | * @param platform
|
| | | * @param device
|
| | | * @throws Exception
|
| | | */
|
| | | public void copyLotteryPrize(Long uid, int platform, String device) throws Exception;
|
| | |
|
| | |
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | public int countTodatyUserCouponBySource(Long uid, String source);
|
| | |
|
| | | /**
|
| | | * 随机生成奖励券
|
| | | * @param num
|
| | | * @param uid
|
| | | * @param source
|
| | | * @throws Exception
|
| | | */
|
| | | public void randomRewardCoupon(int num, Long uid, String source) throws Exception;
|
| | | |
| | | |
| | | |
| | | |
| | | /**
|
| | | * 系统赠送奖励券
|
| | | * @param num
|
| | | * @param uid
|
| | | * @param source
|
| | | * @throws Exception
|
| | | */
|
| | | public void systemGiveRewardCoupon(Long uid,int num,String orderId,Integer orderType,String reason) throws Exception;
|
| | | |
| | | |
| | |
|
| | |
|
| | |
|
| | |
| | | */
|
| | | public long countGiveFreeCoupon(Long uid);
|
| | |
|
| | | |
| | | /**
|
| | | * 免单券获得
|
| | | * @param uid
|
| | | * @param typeEnum 类型
|
| | | * @param source 来源
|
| | | * @param num 数量
|
| | | * @param notify 是否发送消息
|
| | | * @return
|
| | | * @throws UserSystemCouponException
|
| | | */
|
| | | public UserSystemCoupon freeCouponWin(Long uid, CouponTypeEnum typeEnum, String source, int num, boolean notify)
|
| | | throws UserSystemCouponException, Exception;
|
| | |
|
| | | /**
|
| | | * 奖励券券获得
|
| | | * @param uid
|
| | | * @param typeEnum
|
| | | * @param source
|
| | | * @param num
|
| | | * @param notify
|
| | | * @param percent
|
| | | * @return
|
| | | * @throws UserSystemCouponException
|
| | | * @throws Exception
|
| | | */
|
| | | public UserSystemCoupon rewardCouponWin(Long uid, String source, int num, boolean notify,
|
| | | BigDecimal percent) throws UserSystemCouponException, Exception;
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.user.integral;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | |
| | | * @return
|
| | | */
|
| | | public List<IntegralTaskRecord> getSign7DaysRecord(long uid, Long cid);
|
| | |
|
| | |
|
| | | /**
|
| | | * 推广红包折算金币
|
| | | * @param uid
|
| | | * @param addGoldCoin
|
| | | * @param tlj
|
| | | */
|
| | | public void taoLiJinExchange(Long uid, Integer addGoldCoin, BigDecimal tlj);
|
| | |
|
| | | /**
|
| | | * 金币过期
|
| | |
| | | package com.yeshi.fanli.service.inter.user.invite;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | |
|
| | | /**
|
| | | * 用户邀请消息通知
|
| | |
| | | public interface UserInviteMsgNotificationService {
|
| | |
|
| | | /**
|
| | | * 二维码扫描
|
| | | * |
| | | * @param uid
|
| | | * @param sale
|
| | | */
|
| | | public void inviteScan(Long uid, ThreeSale sale);
|
| | |
|
| | | /**
|
| | | * 邀请成功
|
| | | * |
| | | * @param uid
|
| | | * @param sale
|
| | | */
|
| | | public void inviteSuccess(Long uid, ThreeSale sale);
|
| | |
|
| | | /**
|
| | | * 邀请失败
|
| | | * |
| | | * @param uid
|
| | | * @param sale
|
| | | */
|
| | | public void inviteFail(Long uid, ThreeSale sale);
|
| | |
|
| | | /**
|
| | | * 领取券、红包激活邀请
|
| | | * @param uid
|
| | | * @param beizu
|
| | |
| | | */
|
| | | public void receiveGift(Long uid, String beizu, MsgInviteContentDTO content);
|
| | |
|
| | |
|
| | | /**
|
| | | * 2.0.2 版本新邀请消息
|
| | | * 直接粉丝邀请成功
|
| | | * @param uid
|
| | | * @param sale
|
| | | * @param nickName
|
| | | * @param portrait
|
| | | * @param time
|
| | | */
|
| | | public void inviteSuccess2_1(Long uid, ThreeSale sale);
|
| | | public void directInviteSuccess(Long uid, String nickName, String portrait, Date time);
|
| | |
|
| | | /**
|
| | | * 间接粉丝
|
| | | * @param uid
|
| | | * @param inviteName
|
| | | * @param nickName
|
| | | * @param portrait
|
| | | * @param time
|
| | | */
|
| | | public void indirectInviteSuccess(Long uid, String inviteName, String nickName, String portrait, Date time);
|
| | |
|
| | |
|
| | | /**
|
| | | * 粉丝升级提醒
|
| | | * @param uid
|
| | | * @param relation 直接粉丝 、 间接粉丝
|
| | | * @param rankName 等级名称
|
| | | * @param nickName 昵称
|
| | | * @param item 满足条件项名称
|
| | | * @param time 升级时间
|
| | | */
|
| | | public void fansUpgrade(Long uid, String relation, String rankName, String nickName, String item, Date time);
|
| | |
|
| | |
|
| | | /**
|
| | | * 直接粉丝脱离-开始脱离提醒
|
| | | * @param uid
|
| | | * @param rankName
|
| | | * @param nickName
|
| | | * @param item
|
| | | * @param time
|
| | | */
|
| | | public void fansPreDivorced(Long uid, String rankName, String nickName, String item, Date time);
|
| | |
|
| | |
|
| | | /**
|
| | | * 间接粉丝脱离-开始脱离提醒
|
| | | * @param uid
|
| | | * @param rankName
|
| | | * @param nickName
|
| | | * @param fansName 直接粉丝昵称
|
| | | * @param item
|
| | | * @param time
|
| | | */
|
| | | public void fansPredivorcedIndirect(Long uid, String rankName, String nickName, String fansName, String item, Date time);
|
| | |
|
| | |
|
| | | /**
|
| | | * 直接粉丝脱离-已经脱离提醒
|
| | | * @param uid
|
| | | * @param nickName
|
| | | * @param time
|
| | | */
|
| | | public void fansDivorced(Long uid, String nickName, Date time);
|
| | |
|
| | | /**
|
| | | * 间接粉丝脱离-已经脱离提醒
|
| | | * @param uid
|
| | | * @param nickName
|
| | | * @param fansName 直接粉丝昵称
|
| | | * @param time
|
| | | */
|
| | | public void fansDivorcedIndirect(Long uid, String nickName, String fansName, Date time);
|
| | | }
|
| | |
| | | */
|
| | | public UserVIPPreInfo getVipByProcess(Long uid, int process);
|
| | |
|
| | | |
| | | /**
|
| | | * 升级提醒上级
|
| | | * @param uid
|
| | | * @param rankName
|
| | | * @param item
|
| | | * @param time
|
| | | * @param divorced
|
| | | */
|
| | | public void remindBoss(Long uid, String rankName, String item, Date time, boolean divorced);
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail.MsgTypeInviteTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVOFactory;
|
| | |
| | | public class MsgInviteDetailFactory {
|
| | |
|
| | | /**
|
| | | * 邀请成功
|
| | | * |
| | | * @param threeSale
|
| | | * 直接粉丝邀请提醒
|
| | | * @param uid
|
| | | * @param nickName
|
| | | * @param portrait
|
| | | * @param time
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail createInviteSuccess(ThreeSale threeSale, Long uid, String beiZhu) {
|
| | | if (threeSale == null || uid == null)
|
| | | public static MsgInviteDetail directInviteSuccess(Long uid, String nickName, String portrait, Date time) {
|
| | | if (nickName == null || uid == null || portrait == null || time == null)
|
| | | return null;
|
| | |
|
| | | |
| | | |
| | | |
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("恭喜你!团队增加直接粉丝:", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("",ClientTextStyleVO.COLOR_CONTENT, portrait));
|
| | | contentList.add(new ClientTextStyleVO("、" + nickName, ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("直接粉丝", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("加入时间", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(TimeUtil.formatDate(time), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("无", ClientTextStyleVO.COLOR_CONTENT)));
|
| | |
|
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | if (StringUtil.isNullOrEmpty(beiZhu))
|
| | | detail.setBeiZhu("无");
|
| | | else
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setDesc("恭喜你,成功邀请一个粉丝");
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.invite);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | |
|
| | | return detail;
|
| | | }
|
| | | /**
|
| | | * 邀请成功
|
| | | * |
| | | * @param threeSale
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail createInviteSuccess2_1(Long uid, ThreeSale threeSale) {
|
| | | if (threeSale == null || uid == null)
|
| | | return null;
|
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.inviteSucceed);
|
| | | detail.setDesc("粉丝(好友)熟练使用App可获得红包");
|
| | | detail.setBeiZhu("满足获得红包条件后系统将自动下发到“我的-红包”中");
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 扫描邀请二维码成功,但是未登录
|
| | | * |
| | | * @param threeSale
|
| | | * 间接邀请
|
| | | * @param uid
|
| | | * @param inviteName
|
| | | * @param nickName
|
| | | * @param portrait
|
| | | * @param time
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail createInviteScanSuccess(ThreeSale threeSale, Long uid, String beiZhu) {
|
| | | if (threeSale == null || uid == null)
|
| | | public static MsgInviteDetail indirectInviteSuccess(Long uid, String inviteName, String nickName, String portrait, Date time) {
|
| | | if (nickName == null || uid == null || portrait == null || time == null)
|
| | | return null;
|
| | |
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("恭喜你!团队增加直接粉丝:", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("",ClientTextStyleVO.COLOR_CONTENT, portrait));
|
| | | contentList.add(new ClientTextStyleVO("、" + nickName, ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("间接粉丝", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | |
| | | List<ClientTextStyleVO> contentList2 = new ArrayList<>();
|
| | | contentList2.add(new ClientTextStyleVO("由直接粉丝", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO(inviteName,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO("邀请", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("邀请人", ClientTextStyleVO.COLOR_TITLE),contentList2));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("加入时间", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(TimeUtil.formatDate(time), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("无", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | if (StringUtil.isNullOrEmpty(beiZhu))
|
| | | detail.setBeiZhu("无");
|
| | | else
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setDesc("恭喜你,有新粉丝加入你的队列,若对方60天内未激活将会与你脱离邀请关系");
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.invite);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.inviteSucceed);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 粉丝升级
|
| | | * @param uid
|
| | | * @param rankName
|
| | | * @param nickName
|
| | | * @param item
|
| | | * @param time
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail fansUpgrade(Long uid, String relation, String rankName, String nickName, String item, Date time) {
|
| | | if (nickName == null || uid == null || item == null || time == null)
|
| | | return null;
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("恭喜你!你的" + relation + ":", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(nickName ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("已升级为", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(rankName, ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("升级说明", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | |
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("升级时间", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(TimeUtil.formatDate(time), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("升级方式", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(String.format("满足%s条件后完成的升级", item), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("如有疑问请联系人工客服", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.fansUpgrade);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 直接粉丝脱离-开始脱离提醒
|
| | | * @param uid
|
| | | * @param rankName
|
| | | * @param nickName
|
| | | * @param item
|
| | | * @param time
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail fansPreDivorced(Long uid, String rankName, String nickName, String item, Date time) {
|
| | | if (nickName == null || uid == null || item == null || time == null)
|
| | | return null;
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("很抱歉!你的直接粉丝:", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(nickName ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("已升级为", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(rankName, ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("脱离粉丝", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("升级时间", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(TimeUtil.formatDate(time), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("脱离原因", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("你还不是会员,即日起你需要在60天内升级为任意会员", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("可在【\"我的-我的粉丝\"】中查看脱离剩余时间", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.fansDivorced);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | |
| | | /**
|
| | | * 间接粉丝脱离-开始脱离提醒
|
| | | * @param uid
|
| | | * @param rankName
|
| | | * @param nickName
|
| | | * @param fansName
|
| | | * @param item
|
| | | * @param time
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail fansPredivorcedIndirect(Long uid, String rankName, String nickName, String fansName,
|
| | | String item, Date time) {
|
| | | if (nickName == null || uid == null || item == null || time == null)
|
| | | return null;
|
| | | |
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("脱离粉丝", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(String.format("很抱歉!你的间接粉丝:%s已升级为%s", nickName, rankName), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("升级时间", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(TimeUtil.formatDate(time), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("你的直接粉丝", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(fansName,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("还不是会员,即日起你需要在60天内助力他成长为任意会员", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("脱离原因", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("可在【\"我的-我的粉丝\"】中查看脱离剩余时间", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.fansDivorced);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请失败
|
| | | * |
| | | * @param threeSale
|
| | | * 直接粉丝脱离-已经脱离提醒
|
| | | * @param uid
|
| | | * @param rankName
|
| | | * @param nickName
|
| | | * @param item
|
| | | * @param time
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail createInviteFail(ThreeSale threeSale, Long uid, String beiZhu) {
|
| | | if (threeSale == null || uid == null)
|
| | | public static MsgInviteDetail fansDivorced(Long uid, String nickName, Date time) {
|
| | | if (nickName == null || uid == null || time == null)
|
| | | return null;
|
| | |
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("很抱歉!你的直接粉丝:", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(nickName ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("已经脱离了你", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("脱离粉丝", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("脱离时间", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(TimeUtil.formatDate(time), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("脱离原因", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("你未能在60天内升级为任意会员", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("如有疑问请联系人工客服", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | if (StringUtil.isNullOrEmpty(beiZhu))
|
| | | detail.setBeiZhu("无");
|
| | | else
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setDesc("抱歉,该粉丝因60天内未激活,已脱离了你的队列,可以试着重新邀请");
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.invite);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.fansDivorced);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 直接粉丝脱离-已经脱离提醒
|
| | | * @param uid
|
| | | * @param rankName
|
| | | * @param nickName
|
| | | * @param item
|
| | | * @param time
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail fansDivorcedIndirect(Long uid, String nickName, String fansName, Date time) {
|
| | | if (nickName == null || uid == null || time == null)
|
| | | return null;
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("很抱歉!你的间接粉丝:", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(nickName ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("已经脱离了你", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("脱离粉丝", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("脱离时间", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(TimeUtil.formatDate(time), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("脱离原因", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(String.format("你的直接粉丝%s未能在60天内升级为任意会员", fansName), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("如有疑问请联系人工客服", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.fansDivorced);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | |
| | |
|
| | | |
| | |
|
| | |
|
| | | /**
|
| | |
| | | package com.yeshi.fanli.util.factory.msg;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVOFactory;
|
| | |
|
| | | public class MsgOtherDetailFactory {
|
| | |
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 免单券相关提醒
|
| | | * @param uid
|
| | | * @param name
|
| | | * @param source
|
| | | * @param num
|
| | | * @param stateDesc
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param days
|
| | | * @return
|
| | | */
|
| | | public static MsgOtherDetail freeCouponMsg(Long uid, String name, String source, int num, String stateDesc,
|
| | | Date startTime, Date endTime) {
|
| | | Integer days = null;
|
| | | if (endTime != null) {
|
| | | int cha = TimeUtil.getDayDifferenceCount(new Date(), endTime);
|
| | | if (cha < 0)
|
| | | days = 0;
|
| | | else
|
| | | days = cha + 1;
|
| | | }
|
| | | |
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("类别", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(name, ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("来源", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(source, ClientTextStyleVO.COLOR_CONTENT)));
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(num+"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("张", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("数量", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("状态", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(stateDesc, ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT)));
|
| | | |
| | | if (days != null) {
|
| | | List<ClientTextStyleVO> contentList2 = new ArrayList<>();
|
| | | contentList2.add(new ClientTextStyleVO(TimeUtil.formatDateDot(startTime) + "-" + TimeUtil.formatDateDot(endTime) + "-于", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO(days +"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO("天过期", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("有效期", ClientTextStyleVO.COLOR_TITLE),contentList2));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("使用范围", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("\"首页-免单商品\"专题中的全部商品可免单购买", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | }
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("无", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setType(MsgTypeOtherTypeEnum.couponMianDan);
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 奖励券相关提醒
|
| | | * @param uid
|
| | | * @param name
|
| | | * @param source
|
| | | * @param num
|
| | | * @param stateDesc
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param days
|
| | | * @return
|
| | | */
|
| | | public static MsgOtherDetail rewardCouponMsg(Long uid, String source, int num, String stateDesc,
|
| | | Date startTime, Date endTime) {
|
| | | Integer days = null;
|
| | | if (endTime != null) {
|
| | | int cha = TimeUtil.getDayDifferenceCount(new Date(), endTime);
|
| | | if (cha < 0)
|
| | | days = 0;
|
| | | else
|
| | | days = cha + 1;
|
| | | }
|
| | | |
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("来源", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(source, ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(num+"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("张", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("数量", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("状态", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(stateDesc, ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT)));
|
| | | |
| | | if (days != null) {
|
| | | List<ClientTextStyleVO> contentList2 = new ArrayList<>();
|
| | | contentList2.add(new ClientTextStyleVO(TimeUtil.formatDateDot(startTime) + "-" + TimeUtil.formatDateDot(endTime) + "-于", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO(days +"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO("天过期", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("有效期", ClientTextStyleVO.COLOR_TITLE),contentList2));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("使用范围", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("在\"我的-订单中\",可使5天内产生的返利订单再返", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | }
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("奖励券也可在【\"我的-福利中心\"】赠送他人", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setType(MsgTypeOtherTypeEnum.couponReward);
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 系统赠送金币提醒
|
| | | * @param uid
|
| | | * @param num
|
| | | * @param banlce
|
| | | * @return
|
| | | */
|
| | | public static MsgOtherDetail goldCoinSystemGiveMsg(Long uid, int num, int banlce) {
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("类别", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("系统赠送", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(num+"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("枚", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("获得数量", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("剩余总数", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(banlce + "枚", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("使用范围", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("可在\"我的-金币\"兑换好礼", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("系统赠送金币无需手动领取,已自动进入到金币账户中", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setType(MsgTypeOtherTypeEnum.goldCoin);
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | |
| | | /**
|
| | | * 金币奖励提醒- 邀请成功
|
| | | * @param uid
|
| | | * @param num
|
| | | * @param banlce
|
| | | * @param directFans
|
| | | * @return
|
| | | */
|
| | | public static MsgOtherDetail goldCoinRewardInviteSucceedMsg(Long uid, int num, int banlce, boolean directFans) {
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("类别", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("金币奖励", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("来源", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("成功邀请" + (directFans?"直接粉丝":"间接粉丝"), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(num+"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("枚", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("获得数量", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("剩余总数", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(banlce + "枚", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("使用范围", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("可在\"我的-金币\"兑换好礼", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("系统赠送金币无需手动领取,已自动进入到金币账户中", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setType(MsgTypeOtherTypeEnum.goldCoin);
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 金币奖励提醒 - 订单团队收益不足0.01元不足0.01元
|
| | | * @param uid
|
| | | * @param num
|
| | | * @param banlce
|
| | | * @param directFans
|
| | | * @return
|
| | | */
|
| | | public static MsgOtherDetail goldCoinOrderSubsidyMsg(Long uid, int num, int banlce, boolean directFans) {
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("类别", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("金币奖励", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("来源", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO((directFans?"直接粉丝":"间接粉丝") +"下单产生的团队收益不足0.01元", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(num+"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("枚", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("获得数量", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("剩余总数", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(banlce + "枚", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("使用范围", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("可在\"我的-金币\"兑换好礼", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("系统赠送金币无需手动领取,已自动进入到金币账户中", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setType(MsgTypeOtherTypeEnum.goldCoin);
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 金币兑换提醒
|
| | | * @param uid
|
| | | * @param num
|
| | | * @param banlce
|
| | | * @param directFans
|
| | | * @return
|
| | | */
|
| | | public static MsgOtherDetail goldCoinExChangeMsg(Long uid, int num, int banlce, String name, String exNum) {
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("类别", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("金币兑换", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(num+"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("枚", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("消耗数量", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("剩余总数", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(banlce + "枚", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("兑换物品", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(String.format("礼品:%s 数量:%s",name, exNum), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("无", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setType(MsgTypeOtherTypeEnum.goldCoin);
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | |
| | | }
|