yujian
2019-08-26 da36dbefcd945cc85d170c5c2e78682d13497f97
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -1838,20 +1838,24 @@
            userCouponVO.setCouponEffect("赠送中");
            userCouponVO.setCouponRule(systemCoupon.getRemark());
            String tips = null;
            TokenTypeEnum tokenType = null;
            if (CouponTypeEnum.freeCouponGive == type) {
               userCouponVO.setState(UserSystemCoupon.STATE_GIVE_IN);
               tips = configService.get("give_free_coupon_tips");
               tokenType = TokenTypeEnum.freeCoupon;
            }
            
            if (CouponTypeEnum.rebatePercentCoupon == type) {
               userCouponVO.setState(UserSystemCoupon.STATE_GIVE_IN);
               tips = configService.get("give_free_coupon_tips");
               tokenType = TokenTypeEnum.rebatePercentCoupon;
            }
            
            if (!StringUtil.isNullOrEmpty(tips)) {
            if (!StringUtil.isNullOrEmpty(tips) && tokenType != null) {
               UserSystemCouponGiveRecord record = userSystemCouponGiveRecordService.getRecordByUidAndCouponId(uid, userCouponVO.getId());
               if (record != null) {
                  TokenRecord tokenRecord = tokenRecordService.getNearByTypeAndIdentify(CouponTypeEnum.freeCoupon.name(), record.getId().toString());
                  TokenRecord tokenRecord = tokenRecordService.getNearByTypeAndIdentify(tokenType.name(), record.getId().toString());
                  if (tokenRecord != null && !StringUtil.isNullOrEmpty(tokenRecord.getToken())) {
                     String projectChineseName = Constant.systemCommonConfig.getProjectChineseName();
                     while(tips.contains("{APP名称}")) {
@@ -1870,28 +1874,40 @@
                  }
               } 
            } 
         } 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.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);
            }
            
@@ -2032,11 +2048,7 @@
      userCouponVO.setCouponTerm(couponTerm);
      
      Map<String, Object> remainDays = new HashMap<String, Object>();
      try {
         remainDays.put("content", "剩余" + DateUtil.dateDiff2(new Date(), record.getGiveTime()) + "过期");
      } catch (Exception e) {
      }
      remainDays.put("content", "剩余23时59分过期");
      remainDays.put("fontColor", "#F14242");
      userCouponVO.setRemainDays(remainDays);