补充数据
This commit is contained in:
@@ -3,6 +3,8 @@ package com.czg.account.vo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -44,4 +46,86 @@ public class UserCouponVo {
|
||||
*/
|
||||
List<UserCouponFoodVo> useFoods = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
* 领取时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 使用时间
|
||||
*/
|
||||
private LocalDateTime useTime;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private LocalDateTime effectEndTime;
|
||||
/**
|
||||
* 优惠券生效时间
|
||||
*/
|
||||
private LocalDateTime effectStartTime;
|
||||
|
||||
/**
|
||||
* 0未使用
|
||||
* 1已使用
|
||||
* 2已过期
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 可用门店类型:only-仅本店;all-所有门店,custom-指定门店
|
||||
*/
|
||||
private String useShopType;
|
||||
|
||||
/**
|
||||
* 可用门店
|
||||
*/
|
||||
private String useShops;
|
||||
|
||||
|
||||
/**
|
||||
* 可使用类型:dine堂食/pickup自取/deliv配送/express快递
|
||||
*/
|
||||
private String useType;
|
||||
|
||||
/**
|
||||
* 可用周期,如:周一,周二,周三,周四,周五,周六,周七
|
||||
*/
|
||||
private String useDays;
|
||||
|
||||
/**
|
||||
* 可用时间段类型:all-全时段,custom-指定时段
|
||||
*/
|
||||
private String useTimeType;
|
||||
|
||||
/**
|
||||
* 可用开始时间
|
||||
*/
|
||||
private Time useStartTime;
|
||||
|
||||
/**
|
||||
* 可用结束时间
|
||||
*/
|
||||
private Time useEndTime;
|
||||
|
||||
|
||||
/**
|
||||
* 每人领取限量,-10086为不限量
|
||||
*/
|
||||
private Integer getLimit;
|
||||
|
||||
/**
|
||||
* 每人每日使用限量,-10086为不限量
|
||||
*/
|
||||
private Integer useLimit;
|
||||
|
||||
/**
|
||||
* 与限时折扣同享:0-否,1-是
|
||||
*/
|
||||
private Integer discountShare;
|
||||
|
||||
/**
|
||||
* 与会员价同享:0-否,1-是
|
||||
*/
|
||||
private Integer vipPriceShare;
|
||||
}
|
||||
|
||||
@@ -293,6 +293,56 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
||||
//券id 券使用描述
|
||||
Map<Long, JSONObject> coupons = new HashMap<>();
|
||||
for (UserCouponVo tbUserCouponVo : tbUserCouponVos) {
|
||||
int maxShow = 5;
|
||||
// if (StrUtil.isNotBlank(tbUserCouponVo.getFoods())) {
|
||||
// List<String> productNames = productService.listAs(new QueryWrapper().select(Product::getName)
|
||||
// .in(Product::getId, Arrays.stream(tbUserCouponVo.getFoods().split(",")).map(Long::parseLong).toList())
|
||||
// .eq(Product::getIsDel, 0), String.class);
|
||||
// if (CollUtil.isNotEmpty(productNames)) {
|
||||
// StringBuilder result = new StringBuilder();
|
||||
// for (int i = 0; i < productNames.size(); i++) {
|
||||
// if (i > 0) {
|
||||
// result.append(",");
|
||||
// }
|
||||
// result.append(productNames.get(i));
|
||||
// if (i == maxShow - 1 && i != productNames.size() - 1) {
|
||||
// result.append("...");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// tbUserCouponVo.setFoods(result.toString());
|
||||
// }
|
||||
// } else {
|
||||
// tbUserCouponVo.setFoods("全部商品");
|
||||
// }
|
||||
if ("only".equals(tbUserCouponVo.getUseShopType())) {
|
||||
ShopInfo shopInfo = shopInfoService.getById(tbUserCouponVo.getShopId());
|
||||
tbUserCouponVo.setUseShops("仅本店:" + shopInfo.getShopName());
|
||||
} else if ("all".equals(tbUserCouponVo.getUseShopType())) {
|
||||
tbUserCouponVo.setUseShops("所有门店");
|
||||
} else if ("custom".equals(tbUserCouponVo.getUseShopType())) {
|
||||
if (StrUtil.isNotBlank(tbUserCouponVo.getUseShops())) {
|
||||
tbUserCouponVo.setUseShops(tbUserCouponVo.getUseShops() + "," + tbUserCouponVo.getShopId());
|
||||
QueryWrapper queryWrapper = QueryWrapper.create().select(ShopInfo::getShopName)
|
||||
.in(ShopInfo::getId, Arrays.stream(tbUserCouponVo.getUseShops().split(",")).map(Long::parseLong).toList())
|
||||
.eq(ShopInfo::getStatus, 1);
|
||||
List<String> shopNames = shopInfoService.listAs(queryWrapper, String.class);
|
||||
if (CollUtil.isNotEmpty(shopNames)) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (int i = 0; i < shopNames.size(); i++) {
|
||||
if (i > 0) {
|
||||
result.append(",");
|
||||
}
|
||||
result.append(shopNames.get(i));
|
||||
if (i == maxShow - 1 && i != shopNames.size() - 1) {
|
||||
result.append("...");
|
||||
break;
|
||||
}
|
||||
}
|
||||
tbUserCouponVo.setUseShops(result.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!coupons.containsKey(tbUserCouponVo.getCouponId())) {
|
||||
setCouponInfo(coupons, tbUserCouponVo, null, week, formatter);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user