Commit f62edb79 by 章家宝

fixbug:优惠券发放记录新增订单id

1 parent 7e56e022
...@@ -64,12 +64,11 @@ public interface CouponAccountRepository extends BaseRepository<CouponAccount, L ...@@ -64,12 +64,11 @@ public interface CouponAccountRepository extends BaseRepository<CouponAccount, L
* @param now 当前时间 * @param now 当前时间
* @return 优惠券列表 * @return 优惠券列表
*/ */
@Query("SELECT c FROM CouponAccount c WHERE c.accountId = :accountId AND c.status = :status AND c.deleteFlag = :deleteFlag AND c.validStartTime <= :now AND c.validEndTime > :now") @Query("SELECT c FROM CouponAccount c WHERE c.accountId = :accountId AND c.status = :status AND c.deleteFlag = :deleteFlag ")
List<CouponAccount> findAvailableCoupons( List<CouponAccount> findAvailableCoupons(
@Param("accountId") Integer accountId, @Param("accountId") Integer accountId,
@Param("status") Integer status, @Param("status") Integer status,
@Param("deleteFlag") String deleteFlag, @Param("deleteFlag") String deleteFlag
@Param("now") LocalDateTime now
); );
/** /**
......
...@@ -129,6 +129,7 @@ public interface CouponDistributionRecordRepository extends BaseRepository<Coupo ...@@ -129,6 +129,7 @@ public interface CouponDistributionRecordRepository extends BaseRepository<Coupo
r.operator, r.operator,
r.createTime, r.createTime,
v.orderCode, v.orderCode,
v.orderId,
v.vehicleInfo, v.vehicleInfo,
v.vehicleId, v.vehicleId,
v.transactionAmount, v.transactionAmount,
......
...@@ -36,6 +36,7 @@ public class CouponDistributionRecordDTO implements Serializable { ...@@ -36,6 +36,7 @@ public class CouponDistributionRecordDTO implements Serializable {
private String operator; private String operator;
private LocalDateTime createTime; private LocalDateTime createTime;
private String orderCode; private String orderCode;
private Integer orderId;
private String vehicleInfo; private String vehicleInfo;
private Integer vehicleId; private Integer vehicleId;
private BigDecimal transactionAmount; private BigDecimal transactionAmount;
......
...@@ -176,7 +176,11 @@ public class CouponVerificationService { ...@@ -176,7 +176,11 @@ public class CouponVerificationService {
// 获取车辆信息 // 获取车辆信息
Vehicle vehicle = order.getVehicle(); Vehicle vehicle = order.getVehicle();
Integer vehicleId = vehicle != null ? vehicle.getVehicleId() : null; Integer vehicleId = vehicle != null ? vehicle.getVehicleId() : null;
String vehicleInfo = vehicle != null ? vehicle.toVehicleName() : null; String vehicleInfo = vehicle != null ? String.format("%s %s %s %s",
vehicle.getBaseInfo().getCarBrand(),
vehicle.getBaseInfo().getCarChildsBrandName(),
vehicle.getBaseInfo().getCarSeriesName(),
vehicle.getBaseInfo().getCarTypeName()) : null;
// 3. 校验优惠券归属 // 3. 校验优惠券归属
if (!coupon.getAccountId().equals(accountId)) { if (!coupon.getAccountId().equals(accountId)) {
...@@ -235,6 +239,7 @@ public class CouponVerificationService { ...@@ -235,6 +239,7 @@ public class CouponVerificationService {
.orderId(orderId) .orderId(orderId)
.orderCode(orderCode) .orderCode(orderCode)
.accountId(accountId) .accountId(accountId)
.vehicleId(vehicleId)
.couponId(couponId) .couponId(couponId)
.templateId(coupon.getTemplateId()) .templateId(coupon.getTemplateId())
.templateName(coupon.getTemplateName()) .templateName(coupon.getTemplateName())
...@@ -409,7 +414,7 @@ public class CouponVerificationService { ...@@ -409,7 +414,7 @@ public class CouponVerificationService {
// 2. 查询用户所有待使用的优惠券(未过期、未核销、未退回) // 2. 查询用户所有待使用的优惠券(未过期、未核销、未退回)
List<CouponAccount> allCoupons = couponAccountRepository.findAvailableCoupons( List<CouponAccount> allCoupons = couponAccountRepository.findAvailableCoupons(
accountId, CouponUserStatusEnum.UNUSED.getCode(), DeleteFlag.NOT_DELETED.getCode(), now); accountId, CouponUserStatusEnum.UNUSED.getCode(), DeleteFlag.NOT_DELETED.getCode());
if (allCoupons.isEmpty()) { if (allCoupons.isEmpty()) {
return List.of(); return List.of();
......
...@@ -73,6 +73,9 @@ public class CouponDistributionRecordRespVO implements Serializable { ...@@ -73,6 +73,9 @@ public class CouponDistributionRecordRespVO implements Serializable {
@Schema(description = "关联订单号") @Schema(description = "关联订单号")
private String orderCode; private String orderCode;
@Schema(description = "关联订单ID")
private Integer orderId;
@Schema(description = "车型") @Schema(description = "车型")
private String vehicleInfo; private String vehicleInfo;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!