Commit 908c5184 by zhangxw

Merge branch 'v1.4.0' of http://192.168.3.233:8090/usedCarAuction/aus into v1.4.0

2 parents 7dfacba3 f62edb79
......@@ -64,12 +64,11 @@ public interface CouponAccountRepository extends BaseRepository<CouponAccount, L
* @param now 当前时间
* @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(
@Param("accountId") Integer accountId,
@Param("status") Integer status,
@Param("deleteFlag") String deleteFlag,
@Param("now") LocalDateTime now
@Param("deleteFlag") String deleteFlag
);
/**
......
......@@ -129,6 +129,7 @@ public interface CouponDistributionRecordRepository extends BaseRepository<Coupo
r.operator,
r.createTime,
v.orderCode,
v.orderId,
v.vehicleInfo,
v.vehicleId,
v.transactionAmount,
......
......@@ -36,6 +36,7 @@ public class CouponDistributionRecordDTO implements Serializable {
private String operator;
private LocalDateTime createTime;
private String orderCode;
private Integer orderId;
private String vehicleInfo;
private Integer vehicleId;
private BigDecimal transactionAmount;
......
......@@ -176,7 +176,11 @@ public class CouponVerificationService {
// 获取车辆信息
Vehicle vehicle = order.getVehicle();
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. 校验优惠券归属
if (!coupon.getAccountId().equals(accountId)) {
......@@ -235,6 +239,7 @@ public class CouponVerificationService {
.orderId(orderId)
.orderCode(orderCode)
.accountId(accountId)
.vehicleId(vehicleId)
.couponId(couponId)
.templateId(coupon.getTemplateId())
.templateName(coupon.getTemplateName())
......@@ -409,7 +414,7 @@ public class CouponVerificationService {
// 2. 查询用户所有待使用的优惠券(未过期、未核销、未退回)
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()) {
return List.of();
......
......@@ -73,6 +73,9 @@ public class CouponDistributionRecordRespVO implements Serializable {
@Schema(description = "关联订单号")
private String orderCode;
@Schema(description = "关联订单ID")
private Integer orderId;
@Schema(description = "车型")
private String vehicleInfo;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!