| | |
| | | userSystemCouponRecordService.updateByPrimaryKeySelective(couponRecord);
|
| | |
|
| | | UserSystemCoupon userSystemCoupon = couponRecord.getUserSystemCoupon();
|
| | |
|
| | | // 状态初始化
|
| | | userSystemCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
|
| | | userSystemCoupon.setUseTime(null);
|
| | |
| | | Date now = new Date();
|
| | | Date endTime = userCoupon.getEndTime();
|
| | | if (endTime != null && endTime.getTime() < now.getTime()) {
|
| | | |
| | | // TODO 过期
|
| | | // 过期
|
| | | List<UserSystemCoupon> list = new ArrayList<UserSystemCoupon>();
|
| | | list.add(userCoupon);
|
| | | updateCounponInvalid(list);
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | userCouponVO.setCouponPicture(systemCoupon.getPicture());
|
| | | }
|
| | |
|
| | | if (UserSystemCoupon.STATE_CAN_USE == state) {
|
| | | if (UserSystemCoupon.STATE_CAN_USE == state || UserSystemCoupon.STATE_IN_USE == state) {
|
| | | int differentDays = 0;
|
| | | if (endTime != null && startTime != null) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | |
| | | }
|
| | | tips = tips.replace("{口令}", tokenRecord.getToken()).replace("{下载链接}", configService.get("app_down_link"));
|
| | | }
|
| | | |
| | | Date endTimeGive = record.getEndTime();
|
| | | if (endTimeGive != null) {
|
| | | Map<String, Object> remainDays = new HashMap<String, Object>();
|
| | | remainDays.put("content", "剩余" + DateUtil.dateDiff2(new Date(), endTimeGive) + "过期");
|
| | | remainDays.put("fontColor", "#F14242");
|
| | | userCouponVO.setRemainDays(remainDays);
|
| | | }
|
| | | }
|
| | | } else {
|
| | | tips = "";
|
| | | }
|
| | | userCouponVO.setGiveTips(tips);
|
| | | |
| | | } else if (UserSystemCoupon.STATE_END_USE == state) {
|
| | | if (give && CouponTypeEnum.freeCouponGive == type) {
|
| | | userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END);
|
| | |
| | | Date now = new Date();
|
| | | Date endTime = userCoupon.getEndTime();
|
| | | if (endTime != null && endTime.getTime() < now.getTime()) {
|
| | | |
| | | // TODO 过期
|
| | | List<UserSystemCoupon> list = new ArrayList<UserSystemCoupon>();
|
| | | list.add(userCoupon);
|
| | | updateCounponInvalid(list);
|
| | | continue;
|
| | | }
|
| | |
|