| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public long countCouponOld(Long uid) {
|
| | | return userSystemCouponMapper.countCouponOld(uid);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countUserCouponList(Long uid) {
|
| | | return userSystemCouponMapper.countUserCouponList(uid);
|
| | | }
|
| | |
| | | // 退回券
|
| | | 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;
|
| | | }
|
| | |
| | | // 可使用、 可赠送
|
| | | 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("赠送中");
|
| | |
| | |
|
| | | @Override
|
| | | public boolean getIncludeExchange(Long uid) {
|
| | | List<String> list = new ArrayList<String>();
|
| | | list.add(UserSystemCoupon.SOURCE_EXCHANGE);
|
| | | list.add(UserSystemCoupon.SOURCE_GIVE);
|
| | | List<UserSystemCoupon> listCoupon = userSystemCouponMapper.getIncludeExchange(uid, list);
|
| | | 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) {
|
| | | List<String> list = new ArrayList<String>();
|
| | | list.add(UserSystemCoupon.SOURCE_EXCHANGE);
|
| | | list.add(UserSystemCoupon.SOURCE_GIVE);
|
| | | List<UserSystemCoupon> listCoupon = userSystemCouponMapper.getIncludeNotExchange(uid, list);
|
| | | 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;
|
| | | }
|
| | | }
|