yujian
2019-08-16 fb5a8918a7983bbdf83586f773884d3961bb3c6d
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -198,8 +198,8 @@
      }
      SystemCoupon coupon = null;
      if (couponType.equals(CouponTypeEnum.welfareFreeCoupon.name())) {
         // 福利免单券
      if (couponType.equals(CouponTypeEnum.welfareFreeCoupon.name()) || couponType.equals(CouponTypeEnum.freeCoupon.name())) {
         // 免单券
         coupon = systemCouponService.getCouponByType(couponType);
      } else if (couponType.equals(CouponTypeEnum.rebatePercentCoupon.name())) {
         // 随机奖励券
@@ -219,6 +219,8 @@
         if (countSuccess == 0) {
            stateActivated = 0;
         }
      } else if (coupon.getType() == CouponTypeEnum.freeCoupon) {
         stateActivated = 0;
      }
      // 结束日期
@@ -1899,7 +1901,7 @@
               tokenRecord.setStartTime(nowDate);
               tokenRecord.setEndTime(DateUtil.plusDayDate(3, nowDate));
               tokenRecord.setToken(token);
               tokenRecord.setState(state);
               tokenRecord.setState(0);
               tokenRecordService.insertSelective(tokenRecord);
            } catch (Exception e) {
               LogHelper.errorDetailInfo(e);
@@ -1927,12 +1929,37 @@
      String tips = "送给你一张返利奖励券快去领取吧,复制本条消息[&%s&],打开[返利券]App领取,使用后可让返利加倍。\r\n" 
            +"----------------------------\r\n" 
            + "下载[返利券]App链接:http://t.cn/2H7AXAH\r\n"
            + "下载[返利券]App链接:%s\r\n"
            + "PS:口令将会24小时内失效,请及时领取。";
      
      tips = String.format(tips, token);
      tips = String.format(tips, token, configService.get("app_down_link"));
      
      return tips;
   }
   @Override
   public void updateGiveRecord(Long uid, Long id, String couponType) {
      Date date = new Date();
      // 更新券状态:已使用
      UserSystemCoupon userCoupon = new UserSystemCoupon();
      userCoupon.setId(id);
      userCoupon.setState(UserSystemCoupon.STATE_END_USE);
      userCoupon.setUseTime(date);
      userCoupon.setUpdateTime(date);
      userSystemCouponMapper.updateByPrimaryKeySelective(userCoupon);
      // 插入使用券记录
      UserSystemCouponRecord couponRecord = new UserSystemCouponRecord();
      couponRecord.setState(UserSystemCouponRecord.STATE_SUCCESS);
      couponRecord.setUserSystemCoupon(userCoupon);
      couponRecord.setCouponType(couponType);
      couponRecord.setCreateTime(date);
      couponRecord.setUpdateTime(date);
      userSystemCouponRecordService.insertSelective(couponRecord);
      // TODO 赠送消息
   }
}