feat: 获取门店关联的优惠券无需登录也可查询

This commit is contained in:
wst 2024-12-14 20:21:03 +08:00
parent c4abb9cebe
commit 0a871abf65
2 changed files with 12 additions and 12 deletions

View file

@ -35,13 +35,9 @@ import java.util.List;
@ApiModel(value = "优惠券/模版信息管理实体类")
public class Coupon extends BaseGeneralInfo {
// @TableField(value = "store_id_list")
// @ApiModelProperty(value = "发布门店id列表", required = "json")
// private List<String> storeIdList;
@TableField(value = "store_id")
@ApiModelProperty(value = "发布门店id列表")
private String storeId;
@TableField(value = "store_id_list")
@ApiModelProperty(value = "发布门店id列表", required = "json")
private List<String> storeIdList;
@TableField(value = "template_id")
@ApiModelProperty(value = "模板id")

View file

@ -23,6 +23,7 @@ import com.skyeye.common.util.mybatisplus.MybatisPlusUtil;
import com.skyeye.coupon.dao.CouponDao;
import com.skyeye.coupon.entity.Coupon;
import com.skyeye.coupon.entity.CouponMaterial;
import com.skyeye.coupon.entity.CouponStore;
import com.skyeye.coupon.enums.CouponValidityType;
import com.skyeye.coupon.enums.PromotionDiscountType;
import com.skyeye.coupon.enums.PromotionMaterialScope;
@ -136,9 +137,9 @@ public class CouponServiceImpl extends SkyeyeBusinessServiceImpl<CouponDao, Coup
@Override
public void createPostpose(Coupon entity, String userId) {
// if (CollectionUtil.isNotEmpty(entity.getStoreIdList())) {// 优惠券关联门店
// couponStoreService.createEntity(entity.getId(),entity.getStoreIdList());
// }
if (CollectionUtil.isNotEmpty(entity.getStoreIdList())) {// 优惠券关联门店
couponStoreService.createEntity(entity.getId(),entity.getStoreIdList());
}
if (StrUtil.isNotEmpty(entity.getTemplateId())) {// 优惠券
if (Objects.equals(entity.getValidityType(), CouponValidityType.DATE.getKey())) {
log.info("优惠券id" + entity.getId() + "创建定时任务-- 开始");
@ -212,9 +213,12 @@ public class CouponServiceImpl extends SkyeyeBusinessServiceImpl<CouponDao, Coup
QueryWrapper<Coupon> queryWrapper = new QueryWrapper<>();
String storeId = params.get("storeId").toString();
String type = params.get("type").toString();
if (StrUtil.isNotEmpty(storeId)) {
queryWrapper.eq(MybatisPlusUtil.toColumns(Coupon::getStoreId), storeId);
List<CouponStore> couponStoreList = couponStoreService.queryListByStoreId(storeId);
List<String> couponIdList = couponStoreList.stream().map(CouponStore::getCouponId).distinct().collect(Collectors.toList());
if(CollectionUtil.isEmpty(couponIdList)){
return;
}
queryWrapper.in(CommonConstants.ID, couponIdList);
String typeKey = MybatisPlusUtil.toColumns(Coupon::getTemplateId);
if (StrUtil.equals(type, CommonNumConstants.NUM_ZERO.toString())) {
queryWrapper.and(wrapper -> {