diff --git a/hai-order/src/main/resources/prod/logback.xml b/hai-order/src/main/resources/prod/logback.xml index 516350df..17bea0c3 100644 --- a/hai-order/src/main/resources/prod/logback.xml +++ b/hai-order/src/main/resources/prod/logback.xml @@ -57,6 +57,74 @@ UTF-8 + + log/HltCardLog.log + + log/hlt/hltcard.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + log/PayNotify.log + + log/paynotify/paynotify.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + log/QzLog.log + + log/QzLog/QzLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + log/RechargeLog.log + + log/RechargeLog/RechargeLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + @@ -69,4 +137,20 @@ + + + + + + + + + + + + + + + + diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 459f42b7..75e0a13b 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -305,6 +305,18 @@ public class OrderServiceImpl implements OrderService { if (!order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber())) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此优惠券只能充值话费中使用"); } + } else if (discountUserRel.getHighDiscount().getUseScope().equals(DiscountUseScope.type4.getType())) { + if (!order.getProductType().equals(OrderProductType.PRODUCT_TYPE2.getNumber())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此优惠券只能肯德基中使用"); + } + } else if (discountUserRel.getHighDiscount().getUseScope().equals(DiscountUseScope.type5.getType())) { + if (!order.getProductType().equals(OrderProductType.PRODUCT_TYPE1.getNumber())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此优惠券只能星巴克中使用"); + } + } else if (discountUserRel.getHighDiscount().getUseScope().equals(DiscountUseScope.type6.getType())) { + if (!order.getProductType().equals(OrderProductType.PRODUCT_TYPE3.getNumber())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此优惠券只能第三方会员充值中使用"); + } } else if (discountUserRel.getHighDiscount().getUseScope().equals(DiscountUseScope.type7.getType())) { if (!order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此优惠券只能加油订单中使用"); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java index 8f539976..d7c8c78b 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java @@ -11,6 +11,7 @@ import com.hai.common.utils.IDGenerator; import com.hai.common.utils.RedisUtil; import com.hai.dao.*; import com.hai.entity.*; +import com.hai.enum_type.DiscountPlatform; import com.hai.model.UserInfoModel; import com.hai.service.*; import com.hai.service.HighDiscountPackageService; @@ -265,7 +266,6 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic @Transactional(propagation= Propagation.REQUIRES_NEW) public HighDiscountPackageActual freeUserDiscountPackage(Map map) throws Exception { - HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(MapUtils.getInteger(map , "discountPackageId")); // 查询优惠券包实际库存 @@ -282,6 +282,39 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic // 循环赠送优惠券 for (HighDiscountPackageDiscountActual actualList: discountPackageDiscountActual) { + HighDiscount discount = highDiscountService.getDiscountById(actualList.getDiscountId()); + if (discount == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券信息不存在"); + } + HighDiscountUserRel userRel = new HighDiscountUserRel(); + userRel.setDiscountPlatform(DiscountPlatform.getPlatformByCode(discount.getPlatform()).getNumber()); + userRel.setDiscountCompanyId(discount.getCompanyId()); + userRel.setDiscountId(discount.getId()); + userRel.setDiscountName(discount.getDiscountName()); + userRel.setDiscountImg(discount.getDiscountImg()); + userRel.setDiscountUseScope(discount.getUseScope()); + userRel.setDiscountUsingRange(discount.getUsingRange()); + userRel.setDiscountType(discount.getDiscountType()); + userRel.setDiscountCondition(discount.getDiscountCondition()); + userRel.setDiscountPrice(discount.getDiscountPrice()); + userRel.setAgentId(actualList.getAgentId()); + userRel.setUserId(MapUtils.getLong(map , "userId")); + userRel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 + userRel.setCreateTime(new Date()); + userRel.setDiscountAgentCodeId(actualList.getAgentDiscountCodeId()); + // 计算使用有效期 + Calendar userEndTime = Calendar.getInstance(); + userEndTime.setTime(new Date()); + userEndTime.set(Calendar.HOUR_OF_DAY, 23); + userEndTime.set(Calendar.MINUTE, 59); + userEndTime.set(Calendar.SECOND, 59); + userEndTime.add(Calendar.DATE, discount.getEffectiveDay()); + + if (userEndTime.getTime().compareTo(discount.getSalesEndTime()) == 1) { + userRel.setUseEndTime(discount.getSalesEndTime()); + } else { + userRel.setUseEndTime(userEndTime.getTime()); + } HighDiscountUserRel highDiscountUserRel = new HighDiscountUserRel(); highDiscountUserRel.setDiscountId(actualList.getDiscountId()); @@ -291,17 +324,6 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic highDiscountUserRel.setStatus(1); highDiscountUserRel.setCreateTime(new Date()); - HighDiscount highDiscount = highDiscountService.getDiscountById(actualList.getDiscountId()); - - // 计算使用有效期 - Calendar userEndTime = Calendar.getInstance(); - userEndTime.setTime(new Date()); - userEndTime.set(Calendar.HOUR_OF_DAY, 23); - userEndTime.set(Calendar.MINUTE, 59); - userEndTime.set(Calendar.SECOND, 59); - userEndTime.add(Calendar.DATE, highDiscount.getEffectiveDay()); - highDiscountUserRel.setUseEndTime(userEndTime.getTime()); - HighDiscountAgentCode discountAgentCode = highDiscountAgentCodeService.getCodeById(actualList.getAgentDiscountCodeId()); // 修改优惠券二维码状态 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java index d997906a..0fa3492d 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java @@ -162,7 +162,15 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic HighDiscountUserRel userRel = new HighDiscountUserRel(); userRel.setDiscountPlatform(DiscountPlatform.getPlatformByCode(discount.getPlatform()).getNumber()); + userRel.setDiscountCompanyId(discount.getCompanyId()); userRel.setDiscountId(discountAgentRel.getDiscountId()); + userRel.setDiscountName(discount.getDiscountName()); + userRel.setDiscountImg(discount.getDiscountImg()); + userRel.setDiscountUseScope(discount.getUseScope()); + userRel.setDiscountUsingRange(discount.getUsingRange()); + userRel.setDiscountType(discount.getDiscountType()); + userRel.setDiscountCondition(discount.getDiscountCondition()); + userRel.setDiscountPrice(discount.getDiscountPrice()); userRel.setAgentId(discountAgentRel.getAgentId()); userRel.setUserId(userId); userRel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用