| | |
| | | import com.yeshi.fanli.service.inter.user.DeviceLotteryRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponRecordVO;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | | |
| | | @Resource
|
| | | private UserInviteService userInviteService;
|
| | |
|
| | | /**
|
| | | * 用户券列表查询
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | if (userVIPInfoService.isVIP(uid)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("超级会员不可使用奖励券"));
|
| | | |
| | | // 当前用户是否VIP
|
| | | boolean vip = userInviteService.verifyVIP(uid);
|
| | | if (vip) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("会员不可使用奖励券"));
|
| | | return;
|
| | | }
|
| | | if (goodsType == null || goodsType > 3 || goodsType < 1) {
|
| | |
| | | }
|
| | | } else {
|
| | | Date accountTime = hongBaoV2.getGetTime();
|
| | | if (accountTime != null) { |
| | | // 到账时间 -红包金额限制
|
| | | if (accountTime != null && hongBao.compareTo(Constant.REWARD_COUPON_LIMIT_MONEY) <= 0) { |
| | | boolean vip = userInviteService.verifyVIP(uid);
|
| | | Date endDay = DateUtil.plusDayDate(Constant.COUPON_REWARD_LIMIT_DAY, accountTime);
|
| | | long currentTime = java.lang.System.currentTimeMillis();
|
| | | if (endDay.getTime() > currentTime && !vip) {
|
| | | UserSystemCouponRecord couponRecord = userSystemCouponRecordService.getRecordByOrderNo(orderNo, null);
|
| | | if (couponRecord == null |
| | | || (couponRecord.getCouponType() == CouponTypeEnum.rebatePercentCoupon.name() && couponRecord.getState() != UserSystemCouponRecord.STATE_SUCCESS)) {
|
| | | if (couponRecord == null) {
|
| | | orderRebateVO.setCoupon(true);
|
| | | orderRebateVO.setCouponType(1);
|
| | | orderRebateVO.setCouponText("立即使用");
|
| | |
| | | package com.yeshi.fanli.entity.bus.user.vip;
|
| | |
|
| | | public enum UserLevelEnum {
|
| | | daRen(0, 0, "快省达人", "actived", "http://www.baidu.com"),
|
| | | normalVIP(3, 30, "普通会员", "vipPre1", "http://www.baidu.com"),
|
| | | highVIP(7, 70, "高级会员", "vipPre2", "http://www.baidu.com"),
|
| | | superVIP(10, 100, "超级会员", "vip", "http://www.baidu.com"),
|
| | | tearcher(11, 101, "资深导师", "tearcher", "http://www.baidu.com");
|
| | | daRen(0, 0, "快省达人", "actived", "http://apph5.banliapp.com/AppInside/vipNew/supvip.html"),
|
| | | normalVIP(3, 30, "普通会员", "vipPre1", "http://apph5.banliapp.com/AppInside/vipNew/supvip.html"),
|
| | | highVIP(7, 70, "高级会员", "vipPre2", "http://apph5.banliapp.com/AppInside/vipNew/supvip.html"),
|
| | | superVIP(10, 100, "超级会员", "vip", "http://apph5.banliapp.com/AppInside/vipNew/supvip.html"),
|
| | | tearcher(11, 101, "资深导师", "tearcher", "http://apph5.banliapp.com/AppInside/vipNew/supvip.html");
|
| | |
|
| | | private int level;
|
| | | private int orderRank;
|
| | |
| | | import javax.imageio.ImageIO; |
| | | |
| | | import org.apache.commons.beanutils.PropertyUtils; |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.core.task.TaskExecutor; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void offlineTaoBaoGoods(Long goodsId) { |
| | | try { |
| | | if (goodsId == null) { |
| | | return; |
| | | } |
| | | List<GoodsEvaluate> list = goodsEvaluateDao.queryExist(Constant.SOURCE_TYPE_TAOBAO, goodsId); |
| | | if (list == null || list.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | // 下架商品 |
| | | offlineGoods(list, Constant.SOURCE_TYPE_TAOBAO, goodsId); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @CacheEvict(value = "dynamicCache", allEntries = true) |
| | | private void offlineGoods(List<GoodsEvaluate> list, int goodsType, Long goodsId) { |
| | | |
| | | for (GoodsEvaluate goodsEvaluate : list) { |
| | | // 商品下架 |
| | | GoodsDetailVO goodsDetailVO = goodsEvaluate.getGoods(); |
| | | goodsDetailVO.setState(1); |
| | | |
| | | List<ImgInfo> imgList = goodsEvaluate.getImgList(); |
| | | if (imgList == null || imgList.size() == 0) { |
| | | goodsEvaluate.setUpdateTime(new Date()); |
| | | goodsEvaluateDao.save(goodsEvaluate); |
| | | continue; |
| | | } |
| | | |
| | | for (ImgInfo imgInfo : imgList) { |
| | | SimpleGoods simpleGoods = imgInfo.getGoods(); |
| | | if (simpleGoods == null || simpleGoods.getGoodsId() != goodsId |
| | | || goodsType != simpleGoods.getGoodsType()) { |
| | | continue; |
| | | } |
| | | simpleGoods.setState(1); |
| | | GoodsDetailVO goodsVO = imgInfo.getGoodsVO(); |
| | | goodsVO.setState(1); |
| | | |
| | | imgInfo.setGoods(simpleGoods); |
| | | imgInfo.setGoodsVO(goodsVO); |
| | | } |
| | | |
| | | goodsEvaluate.setImgList(imgList); |
| | | goodsEvaluate.setUpdateTime(new Date()); |
| | | goodsEvaluateDao.save(goodsEvaluate); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | private void removeOverdue() { |
| | | List<GoodsEvaluate> list = goodsEvaluateDao.queryOverdue(); |
| | | if (list == null || list.size() == 0) { |
| | |
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType) { |
| | | // 奖励订单、免单 使用记录 |
| | | if (sourceType == null) { |
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip, acceptData); |
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip, acceptData, hongBao); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip, |
| | | acceptData); |
| | | acceptData, hongBao); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_JD) { |
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip, |
| | | acceptData); |
| | | acceptData, hongBao); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) { |
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, vip, |
| | | acceptData); |
| | | acceptData, hongBao); |
| | | } |
| | | } |
| | | |
| | |
| | | * @param signList |
| | | */ |
| | | private void couponFactory(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState, Integer hongBaoType, |
| | | List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData) throws Exception { |
| | | List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData, BigDecimal hongBao) throws Exception { |
| | | |
| | | // 是否免单商品 |
| | | boolean freeOrder = false; |
| | |
| | | order.setRewardDetail(rewardMap); |
| | | } |
| | | |
| | | // 使用奖励券 金额额限制 |
| | | if (hongBao.compareTo(Constant.REWARD_COUPON_LIMIT_MONEY) > 0){ |
| | | return; |
| | | } |
| | | |
| | | // 是否可使用奖励券 |
| | | if (!rewardSuccess && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType |
| | | && HongBaoV2.STATE_YILINGQU == hongBaoState && !vip && CommonOrder.STATE_WQ != order.getState()) { |
| | |
| | |
|
| | | // 分享爆款数据删除
|
| | | shareHotGoodsService.deleteByGoodsId(auctionId);
|
| | | |
| | | goodsEvaluateService.offlineTaoBaoGoods(auctionId);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | | }
|
| | |
|
| | | BigDecimal hongBao = orderVO.getHongBao();
|
| | | |
| | | // 红包状态
|
| | | Integer hongBaoState = orderVO.getHongBaoState();
|
| | | // 红包类型
|
| | |
| | | if (order == null)
|
| | | throw new UserSystemCouponException(1, "该订单不存在");
|
| | |
|
| | | // 使用奖励券 金额额限制
|
| | | if (hongBao.compareTo(Constant.REWARD_COUPON_LIMIT_MONEY) > 0){
|
| | | throw new UserSystemCouponException(1, "该订单不能使用奖励券");
|
| | | }
|
| | | |
| | | /* 奖金计算 以及相关红包信息处理 */
|
| | |
|
| | | // 转换成小数点
|
| | |
| | | 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.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class UserVIPInfoServiceImpl implements UserVIPInfoService {
|
| | |
| | | try {
|
| | | // 升级消息
|
| | | UserVIPPreInfo pre1 = userVIPPreInfoService.getVipByProcess(uid, UserVIPPreInfo.PROCESS_2);
|
| | | int days = DateUtil.daysBetween(pre1.getCreateTime(), new Date());
|
| | | userAccountMsgNotificationService.vipUpgradeSuccess(uid, days);
|
| | | userAccountMsgNotificationService.vipUpgradeSuccess(uid, TimeUtil.getDayDifferenceCount(pre1.getCreateTime(), new Date()));
|
| | |
|
| | | // 升级提醒上级
|
| | | userVIPPreInfoService.remindBoss(uid, "超级会员", getPassItem(uid), upgradeTime, false);
|
| | |
| | | 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.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | |
|
| | | @Service
|
| | |
| | | if (userInfoRegister != null && userInfoRegister.getCreateTime() != null) {
|
| | | registerTime = userInfoRegister.getCreateTime();
|
| | | }
|
| | | int daysBetween = DateUtil.daysBetween(registerTime, new Date());
|
| | | int daysBetween = TimeUtil.getDayDifferenceCount(registerTime, new Date());
|
| | | userAccountMsgNotificationService.vipPreUpgrade(uid, "快省达人", "普通会员", daysBetween, limit1, limit2, type);
|
| | |
|
| | | // 升级弹框提示
|
| | |
| | | if (userInfoRegister != null && userInfoRegister.getCreateTime() != null) {
|
| | | registerTime = userInfoRegister.getCreateTime();
|
| | | }
|
| | | daysBetween = DateUtil.daysBetween(registerTime, upgradeTime);
|
| | | daysBetween = TimeUtil.getDayDifferenceCount(registerTime, upgradeTime);
|
| | |
|
| | | // 金币奖励 (直接升级高级会员补齐一级奖励)
|
| | | goldcoinReward(uid);
|
| | |
| | | */ |
| | | public void addGoodsEvaluate(Long goodsId,List<ImgInfo> imgList, ActivityUser user, String title,String comment,Date startTime) throws GoodsEvaluateException; |
| | | |
| | | |
| | | /** |
| | | * 下架商品 |
| | | * @param goodsId |
| | | */ |
| | | public void offlineTaoBaoGoods(Long goodsId); |
| | | |
| | | } |
| | |
| | | // 新的规则生效时间
|
| | | public static final long NEW_ORDER_FANLI_RULE_TIME = TimeUtil.convertToTimeTemp("2020-04-14", "yyyy-MM-dd");
|
| | |
|
| | | // 新人抽奖-最大次数
|
| | | public static final int MAX_COUNT_LOTTERY_NEWBIES = 5;
|
| | | // 使用奖励券最大金额限制
|
| | | public static final BigDecimal REWARD_COUPON_LIMIT_MONEY = new BigDecimal("10");
|
| | | |
| | | |
| | | |
| | |
|
| | | // 线程等待数量
|
| | | public static Set<Long> waitingThreadSet = new HashSet<>();
|