Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev

dev-discount
袁野 2 years ago
commit cec0057718
  1. 84
      hai-order/src/main/resources/prod/logback.xml
  2. 12
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java
  3. 46
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java
  4. 8
      hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java

@ -57,6 +57,74 @@
<charset>UTF-8</charset> <!-- 此处设置字符集 --> <charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder> </encoder>
</appender> </appender>
<appender name="HltCardLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/HltCardLog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/hlt/hltcard.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="PayNotify"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/PayNotify.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/paynotify/paynotify.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="QzLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/QzLog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/QzLog/QzLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<appender name="RechargeLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/RechargeLog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/RechargeLog/RechargeLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<root level="DEBUG"> <root level="DEBUG">
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
</root> </root>
@ -69,4 +137,20 @@
<logger name="com.hai" level="ERROR"> <logger name="com.hai" level="ERROR">
<appender-ref ref="errorlog" /> <appender-ref ref="errorlog" />
</logger> </logger>
<logger name="com.hai.config.HuiLianTongUnionCardConfig" level="INFO">
<appender-ref ref="HltCardLog" />
</logger>
<logger name="com.web.controller.OrderPayNotifyController" level="INFO">
<appender-ref ref="PayNotify" />
</logger>
<logger name="com.hai.config.QianZhuConfig" level="INFO">
<appender-ref ref="QzLog" />
</logger>
<logger name="com.hai.config.RechargeConfig" level="INFO">
<appender-ref ref="RechargeLog" />
</logger>
<logger name="com.hai.service.impl.OutRechargeOrderServiceImpl" level="INFO">
<appender-ref ref="RechargeLog" />
</logger>
</configuration> </configuration>

@ -305,6 +305,18 @@ public class OrderServiceImpl implements OrderService {
if (!order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber())) { if (!order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此优惠券只能充值话费中使用"); 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())) { } else if (discountUserRel.getHighDiscount().getUseScope().equals(DiscountUseScope.type7.getType())) {
if (!order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) { if (!order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此优惠券只能加油订单中使用"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此优惠券只能加油订单中使用");

@ -11,6 +11,7 @@ import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.RedisUtil; import com.hai.common.utils.RedisUtil;
import com.hai.dao.*; import com.hai.dao.*;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.enum_type.DiscountPlatform;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import com.hai.service.*; import com.hai.service.*;
import com.hai.service.HighDiscountPackageService; import com.hai.service.HighDiscountPackageService;
@ -265,7 +266,6 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
@Transactional(propagation= Propagation.REQUIRES_NEW) @Transactional(propagation= Propagation.REQUIRES_NEW)
public HighDiscountPackageActual freeUserDiscountPackage(Map<String , Object> map) throws Exception { public HighDiscountPackageActual freeUserDiscountPackage(Map<String , Object> map) throws Exception {
HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(MapUtils.getInteger(map , "discountPackageId")); HighDiscountPackage highDiscountPackage = highDiscountPackageService.findDiscountPackageById(MapUtils.getInteger(map , "discountPackageId"));
// 查询优惠券包实际库存 // 查询优惠券包实际库存
@ -282,6 +282,39 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
// 循环赠送优惠券 // 循环赠送优惠券
for (HighDiscountPackageDiscountActual actualList: discountPackageDiscountActual) { 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 highDiscountUserRel = new HighDiscountUserRel();
highDiscountUserRel.setDiscountId(actualList.getDiscountId()); highDiscountUserRel.setDiscountId(actualList.getDiscountId());
@ -291,17 +324,6 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
highDiscountUserRel.setStatus(1); highDiscountUserRel.setStatus(1);
highDiscountUserRel.setCreateTime(new Date()); 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()); HighDiscountAgentCode discountAgentCode = highDiscountAgentCodeService.getCodeById(actualList.getAgentDiscountCodeId());
// 修改优惠券二维码状态 // 修改优惠券二维码状态

@ -162,7 +162,15 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
HighDiscountUserRel userRel = new HighDiscountUserRel(); HighDiscountUserRel userRel = new HighDiscountUserRel();
userRel.setDiscountPlatform(DiscountPlatform.getPlatformByCode(discount.getPlatform()).getNumber()); userRel.setDiscountPlatform(DiscountPlatform.getPlatformByCode(discount.getPlatform()).getNumber());
userRel.setDiscountCompanyId(discount.getCompanyId());
userRel.setDiscountId(discountAgentRel.getDiscountId()); 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.setAgentId(discountAgentRel.getAgentId());
userRel.setUserId(userId); userRel.setUserId(userId);
userRel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 userRel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用

Loading…
Cancel
Save