From bc6df1cbd259c80539d11ae0107ccb938b570266 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 26 八月 2019 10:15:04 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java | 62 ++++++++++++++++++++++++++----- 1 files changed, 52 insertions(+), 10 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java index 394ecf6..a6549da 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java @@ -204,7 +204,7 @@ coupon = systemCouponService.getCouponByType(couponType); } else if (couponType.equals(CouponTypeEnum.rebatePercentCoupon.name())) { // 闅忔満濂栧姳鍒� - if (percent == null || percent.compareTo(new BigDecimal(0)) > 0) { + if (percent == null || percent.compareTo(new BigDecimal(0)) < 1) { randomRewardCoupon(1, uid, source); return; } else { @@ -228,9 +228,16 @@ stateActivated = 0; } + Integer expiryDay = null; + if (stateActivated == 0) + expiryDay = coupon.getActivateDay(); + + if (expiryDay == null || expiryDay == 0) + expiryDay = coupon.getExpiryDay(); + // 缁撴潫鏃ユ湡 // 浠婂ぉ鍦ㄥ唴 鍑忓幓涓�澶� - String endDay = DateUtil.plusDay(coupon.getExpiryDay() - 1, new Date()); + String endDay = DateUtil.plusDay(expiryDay - 1, new Date()); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date endTime = format.parse(endDay); @@ -1662,9 +1669,18 @@ } else if (couponType == CouponTypeEnum.welfareFreeCoupon.name() && threeSaleSerivce.countSuccessFirstTeam(uid) <= 0) { stateActivated = 0; // 鏃犱笅绾ч槦鍛� --寰呮縺娲� } - + + + Integer expiryDay = null; + if (stateActivated == 0) + expiryDay = coupon.getActivateDay(); + + if (expiryDay == null || expiryDay == 0) + expiryDay = coupon.getExpiryDay(); + + // 璁$畻缁撴潫鏃ユ湡锛氫粖澶╁湪鍐� 鍑忓幓涓�澶� - String endDay = DateUtil.plusDay(coupon.getExpiryDay() - 1, new Date()); + String endDay = DateUtil.plusDay(expiryDay - 1, new Date()); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date endTime = format.parse(endDay); @@ -1713,7 +1729,12 @@ continue; // 鍒镐俊鎭笉瀹屾暣 } - userCouponVO.setSource("鏉ユ簮锛�" + userCouponVO.getSource()); + 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()); @@ -1791,6 +1812,8 @@ give = false; } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); + if (UserSystemCoupon.STATE_CAN_USE == state) { Map<String, Object> jumpLink = new HashMap<String, Object>(); if (CouponTypeEnum.freeCouponGive == type) { @@ -1815,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鍚嶇О}")) { @@ -1847,7 +1874,6 @@ } } } - } else if (give && UserSystemCoupon.STATE_END_USE == state) { userCouponVO.setCouponRule(systemCoupon.getRemark()); if (CouponTypeEnum.freeCouponGive == type) { @@ -1857,8 +1883,24 @@ if (CouponTypeEnum.rebatePercentCoupon == type) { userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END); } - }else if (give && UserSystemCoupon.STATE_OVERDUE == state) { - userCouponVO.setCouponRule(systemCoupon.getRemark()); + + 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"); + userCouponVO.setRemainDays(remainDays); + } + + if(give) + userCouponVO.setCouponRule(systemCoupon.getRemark()); } userCouponVO.setJumpBtn(jumpBtn); } -- Gitblit v1.8.0