| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public long countCouponOld(Long uid) {
|
| | | return userSystemCouponMapper.countCouponOld(uid);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countUserCouponList(Long uid) {
|
| | | return userSystemCouponMapper.countUserCouponList(uid);
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | SystemCoupon coupon = null;
|
| | | if (couponType.equals(CouponTypeEnum.welfareFreeCoupon.name()) || couponType.equals(CouponTypeEnum.freeCoupon.name())) {
|
| | | 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())) {
|
| | |
| | | // 退回券
|
| | | sendBackTimeOutCoupon(uid);
|
| | |
|
| | | List<UserSystemCouponVO> listVO = userSystemCouponMapper.getUserCouponVOList(start, count, uid);
|
| | | List<UserSystemCouponVO> listVO = userSystemCouponMapper.getCouponListOld(start, count, uid);
|
| | | if (listVO == null || listVO.size() == 0) {
|
| | | return listVO;
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | String source = userCouponVO.getSource();
|
| | | if (source != null && "奖励券天天抽".equals(source)) {
|
| | | source = "天天抽";
|
| | | }
|
| | | |
| | | userCouponVO.setSource("来源:" + source);
|
| | |
|
| | | userCouponVO.setCouponName(systemCoupon.getName());
|
| | | userCouponVO.setCouponEffect(systemCoupon.getEffect());
|
| | | userCouponVO.setCouponRule(systemCoupon.getRule());
|
| | | userCouponVO.setCouponRuleLink(systemCoupon.getRuleLink());
|
| | | userCouponVO.setCouponPicture(systemCoupon.getPicture());
|
| | | userCouponVO.setCouponPictureInvalid(systemCoupon.getPictureInvalid());
|
| | |
|
| | | int differentDays = 0;
|
| | |
| | | differentDays = 0;
|
| | | }
|
| | | }
|
| | |
|
| | | userCouponVO.setCouponTerm(couponTerm);
|
| | |
|
| | | // 剩余天数
|
| | |
| | | userCouponVO.setState(0);
|
| | | userCouponVO.setCouponEffect("待激活");
|
| | | userCouponVO.setCouponPicture(systemCoupon.getPictureInvalid());
|
| | |
|
| | | remainDaysFontColor = "#CCCCCC";
|
| | |
|
| | | } else {
|
| | | userCouponVO.setCouponPicture(systemCoupon.getPicture());
|
| | |
|
| | | remainDaysFontColor = "#F14242";
|
| | | }
|
| | |
|
| | |
| | | return listVO;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 是否存在奖励券
|
| | | *
|
| | |
| | | }
|
| | |
|
| | | List<UserSystemCouponVO> list = getEnableListByCouponId(uid, null, couponList);
|
| | |
|
| | | |
| | | // 获取商品详情
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = redisManager.getTaoBaoGoodsBrief(auctionId);
|
| | | if (taoBaoGoodsBrief != null) {
|
| | | BigDecimal quanPrice = TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief);
|
| | |
|
| | | // 券后价 大于10元 不能免单
|
| | | if (quanPrice.compareTo(new BigDecimal(10)) > 0) {
|
| | | if (list != null && list.size() > 0) {
|
| | |
| | | map.put("fontColor", "#CCCCCC");
|
| | | }
|
| | | userCouponVO.setRemainDays(map);
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | if (baseCoupon.getType() != CouponTypeEnum.freeCoupon
|
| | | && baseCoupon.getType() != CouponTypeEnum.welfareFreeCoupon) {
|
| | | && baseCoupon.getType() != CouponTypeEnum.welfareFreeCoupon
|
| | | && baseCoupon.getType() != CouponTypeEnum.freeCouponBuy) {
|
| | | throw new UserSystemCouponException(1, "券类型不匹配");
|
| | | }
|
| | |
|
| | |
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | 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);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | // 可使用、 可赠送
|
| | | userCouponVO.setState(UserSystemCoupon.STATE_USE_GIVE);
|
| | |
|
| | | // 返利奖励券- 跳转至订单到账界面
|
| | | // 返利奖励券- 跳转至已到账-已收货
|
| | | jumpLink.put("state", "2");
|
| | | jumpLink.put("type", "1");
|
| | | jumpBtn = new HashMap<String, Object>();
|
| | | jumpBtn.put("params", jumpLink);
|
| | | jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("orderList"));
|
| | | jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("order_screen_list"));
|
| | | }
|
| | | } else if (UserSystemCoupon.STATE_IN_USE == state && give) {
|
| | | userCouponVO.setCouponEffect("赠送中");
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | } else if (give && UserSystemCoupon.STATE_END_USE == state) {
|
| | | userCouponVO.setCouponRule(systemCoupon.getRemark());
|
| | | if (CouponTypeEnum.freeCouponGive == type) {
|
| | | userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END);
|
| | | } else if (UserSystemCoupon.STATE_END_USE == state) {
|
| | | |
| | | if (give) {
|
| | | userCouponVO.setCouponEffect("任性0元购");
|
| | | userCouponVO.setCouponRule(systemCoupon.getRemark());
|
| | | if (CouponTypeEnum.freeCouponGive == type) {
|
| | | userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END);
|
| | | }
|
| | | |
| | | if (CouponTypeEnum.rebatePercentCoupon == type) {
|
| | | userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END);
|
| | | }
|
| | | |
| | | Date useTime = userCouponVO.getUseTime();
|
| | | if (useTime != null) {
|
| | | Map<String, Object> remainDays = new HashMap<String, Object>();
|
| | | remainDays.put("content", "于" + sdf.format(useTime) + "成功赠送");
|
| | | remainDays.put("fontColor", "#CCCCCC");
|
| | | userCouponVO.setRemainDays(remainDays);
|
| | | }
|
| | | } else {
|
| | | Date useTime = userCouponVO.getUseTime();
|
| | | if (useTime != null) {
|
| | | Map<String, Object> remainDays = new HashMap<String, Object>();
|
| | | remainDays.put("content", "于" + sdf.format(useTime) + "成功使用");
|
| | | remainDays.put("fontColor", "#CCCCCC");
|
| | | userCouponVO.setRemainDays(remainDays);
|
| | | }
|
| | | }
|
| | |
|
| | | if (CouponTypeEnum.rebatePercentCoupon == type) {
|
| | | userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END);
|
| | | }
|
| | | |
| | | Date useTime = userCouponVO.getUseTime();
|
| | | if (useTime != null) {
|
| | | Map<String, Object> remainDays = new HashMap<String, Object>();
|
| | | remainDays.put("content", "于" + sdf.format(useTime) + "成功赠送");
|
| | | remainDays.put("fontColor", "#999999");
|
| | | userCouponVO.setRemainDays(remainDays);
|
| | | }
|
| | | }else if (UserSystemCoupon.STATE_OVERDUE == state) {
|
| | | if (endTime != null) {
|
| | | Map<String, Object> remainDays = new HashMap<String, Object>();
|
| | | remainDays.put("content", "于" + sdf.format(endTime) + "过期");
|
| | | remainDays.put("fontColor", "#999999");
|
| | | remainDays.put("fontColor", "#CCCCCC");
|
| | | userCouponVO.setRemainDays(remainDays);
|
| | | }
|
| | |
|
| | |
| | | if (systemCoupon == null)
|
| | | continue;
|
| | |
|
| | | String couponName = systemCoupon.getName();
|
| | | if (CouponTypeEnum.freeCouponGive == systemCoupon.getType())
|
| | | couponName = "免单券";
|
| | | |
| | | // 退回消息
|
| | | String beiZhu = "请到我的-福利中心查看";
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
|
| | | msgOther.setType(MsgOtherGiveContentDTO.TYEP_COUPON);
|
| | | msgOther.setTitle("赠送" + systemCoupon.getName() + "退回");
|
| | | msgOther.setGiveType("你赠送的"+ systemCoupon.getName() + "未被成功领取");
|
| | | msgOther.setTitle("赠送" + couponName + "退回");
|
| | | msgOther.setGiveType("你赠送的"+ couponName + "未被成功领取");
|
| | | msgOther.setGiveTime(sd.format(record.getGiveTime()));
|
| | | msgOther.setReturnTime(sd.format(new Date()));
|
| | | userOtherMsgNotificationService.tokenGiveMsg(record.getGiveUid(), beiZhu, msgOther);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public boolean getIncludeExchange(Long uid) {
|
| | | String percent = configService.get("exchange_rebate_percent");
|
| | | if (StringUtil.isNullOrEmpty(percent)) |
| | | percent = "35";
|
| | | List<UserSystemCoupon> listCoupon = userSystemCouponMapper.getIncludeExchange(uid, Integer.parseInt(percent), CouponTypeEnum.rebatePercentCoupon.name());
|
| | | if (listCoupon == null || listCoupon.size() == 0)
|
| | | return false;
|
| | | return true;
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public boolean getIncludeNotExchange(Long uid) {
|
| | | String percent = configService.get("exchange_rebate_percent");
|
| | | if (StringUtil.isNullOrEmpty(percent)) |
| | | percent = "35";
|
| | | List<UserSystemCouponVO> listCoupon = userSystemCouponMapper.getIncludeNotExchange(uid, Integer.parseInt(percent), CouponTypeEnum.rebatePercentCoupon.name());
|
| | | if (listCoupon == null || listCoupon.size() == 0)
|
| | | return false;
|
| | | return true;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<UserSystemCouponVO> listIncludeNotExchange(Long uid) throws Exception{
|
| | | sendBackTimeOutCoupon(uid);
|
| | | |
| | | String percent = configService.get("exchange_rebate_percent");
|
| | | if (StringUtil.isNullOrEmpty(percent)) |
| | | percent = "35";
|
| | | |
| | | List<UserSystemCouponVO> listCoupon = userSystemCouponMapper.getIncludeNotExchange(uid, Integer.parseInt(percent), CouponTypeEnum.rebatePercentCoupon.name());
|
| | | if (listCoupon == null || listCoupon.size() == 0)
|
| | | return null;
|
| | |
|
| | | for (UserSystemCouponVO userCouponVO : listCoupon) {
|
| | | String source = userCouponVO.getSource();
|
| | | if (source != null && "奖励券天天抽".equals(source)) {
|
| | | source = "天天抽";
|
| | | }
|
| | | |
| | | SystemCoupon systemCoupon = userCouponVO.getSystemCoupon();
|
| | | if (systemCoupon == null) {
|
| | | continue; // 券信息不完整
|
| | | }
|
| | |
|
| | | systemCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
|
| | | |
| | | userCouponVO.setSource("来源:" + source);
|
| | | userCouponVO.setCouponName(systemCoupon.getName());
|
| | | userCouponVO.setCouponEffect(systemCoupon.getEffect());
|
| | | userCouponVO.setCouponRule(systemCoupon.getRule());
|
| | | userCouponVO.setCouponRuleLink(systemCoupon.getRuleLink());
|
| | | userCouponVO.setCouponPicture(systemCoupon.getPicture());
|
| | | userCouponVO.setCouponPictureInvalid(systemCoupon.getPictureInvalid());
|
| | |
|
| | | int differentDays = 0;
|
| | | String couponTerm = "有效期:";
|
| | | Date startTime = userCouponVO.getStartTime();
|
| | | Date endTime = userCouponVO.getEndTime();
|
| | | if (endTime != null && startTime != null) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
| | | couponTerm = couponTerm + sdf.format(startTime) + "-" + sdf.format(endTime);
|
| | |
|
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
|
| | | differentDays = DateUtil.daysBetween(sdf2.format(new Date()), sdf2.format(endTime)) + 1;
|
| | | if (differentDays < 0) {
|
| | | differentDays = 0;
|
| | | }
|
| | | }
|
| | | userCouponVO.setCouponTerm(couponTerm);
|
| | |
|
| | | // 剩余天数
|
| | | Map<String, Object> remainDays = new HashMap<String, Object>();
|
| | | remainDays.put("content", "还剩" + differentDays + "天过期");
|
| | | String remainDaysFontColor = "";
|
| | |
|
| | | Integer stateActivated = userCouponVO.getStateActivated();
|
| | | if (stateActivated == null || stateActivated == 0) {
|
| | | userCouponVO.setState(0);
|
| | | userCouponVO.setCouponEffect("待激活");
|
| | | userCouponVO.setCouponPicture(systemCoupon.getPictureInvalid());
|
| | | remainDaysFontColor = "#CCCCCC";
|
| | | } else {
|
| | | userCouponVO.setCouponPicture(systemCoupon.getPicture());
|
| | | remainDaysFontColor = "#F14242";
|
| | | }
|
| | |
|
| | | remainDays.put("fontColor", remainDaysFontColor);
|
| | | userCouponVO.setRemainDays(remainDays);
|
| | | }
|
| | |
|
| | | return listCoupon;
|
| | | }
|
| | | }
|