Commit 8b53bc04 by 吕明尚

修改优惠券查询适用门店

parent 1e3311ac
......@@ -5,6 +5,7 @@ import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.domain.R;
......@@ -80,7 +81,7 @@ public class QPController {
}
//查询当前优惠券适用门店
@GetMapping("/queryshop")
@PostMapping("/queryshop")
public R<List<SStoreVo>> queryshop(SStoreDto dto) throws Exception {
if (StringUtils.isEmpty(dto.getCode())) {
throw new RuntimeException("券码缺失");
......
......@@ -19,4 +19,6 @@ public class SStoreDto extends BaseEntity {
private String code;
private Long[] storeIds;
private Long storeId;
}
......@@ -423,11 +423,15 @@ public class QPServiceImpl implements QPService {
if (StringUtils.isEmpty(dto.getLatitude()) || StringUtils.isEmpty(dto.getLongitude())) {
throw new Exception("经纬度不能为空");
}
LambdaQueryWrapper<SStore> sStoreLambdaQueryWrapper = new LambdaQueryWrapper<>(SStore.class);
sStoreLambdaQueryWrapper.eq(SStore::getStoreType, StoreType.HOTEL.getCode());
List<SStore> sStoreList = storeService.list(sStoreLambdaQueryWrapper);
if (ObjectUtils.isEmpty(dto.getStoreId())) {
throw new Exception("门店异常,请联系客服");
}
SStore sStore = storeService.selectSStoreById(dto.getStoreId());
if (ObjectUtils.isEmpty(sStore) || sStore.getStatus().equals(StoreStatusEnum.STOP.getIndex()) || StringUtils.isBlank(sStore.getOpenShopUuid())) {
throw new Exception("门店异常,请更换门店");
}
//验券准备
TuangouReceiptPrepareResponseEntity prepare = prepare(code.trim(), sStoreList.get(0).getOpenShopUuid(), "");
TuangouReceiptPrepareResponseEntity prepare = prepare(code.trim(), sStore.getOpenShopUuid(), "");
//获取用户信息
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
//查询领取记录表
......@@ -439,7 +443,7 @@ public class QPServiceImpl implements QPService {
if (ObjectUtils.isNotEmpty(unUsedCoupon)) {
throw new Exception("该券码已被使用");
}
sStoreList = storeService.list(new LambdaQueryWrapper<>(SStore.class).isNotNull(SStore::getOpenShopUuid));
List<SStore> sStoreList = storeService.list(new LambdaQueryWrapper<>(SStore.class).isNotNull(SStore::getOpenShopUuid));
SCoupon sCoupon = isCouponService.getOne(new LambdaQueryWrapper<>(SCoupon.class).
eq(SCoupon::getCouponType, CouponTypeEnum.CASH.getCode()).
eq(SCoupon::getDealgroupId, prepare.getDealgroup_id()).
......
......@@ -475,9 +475,13 @@ public class TiktokServiceImpl implements TiktokService {
if (StringUtils.isEmpty(dto.getLatitude()) || StringUtils.isEmpty(dto.getLongitude())) {
throw new Exception("经纬度不能为空");
}
LambdaQueryWrapper<SStore> sStoreLambdaQueryWrapper = new LambdaQueryWrapper<>(SStore.class);
sStoreLambdaQueryWrapper.eq(SStore::getStoreType, StoreType.HOTEL.getCode());
List<SStore> sStoreList = storeService.list(sStoreLambdaQueryWrapper);
if (ObjectUtils.isEmpty(dto.getStoreId())) {
throw new Exception("门店异常,请联系客服");
}
SStore sStore = storeService.selectSStoreById(dto.getStoreId());
if (ObjectUtils.isEmpty(sStore) || sStore.getStatus().equals(StoreStatusEnum.STOP.getIndex()) || StringUtils.isBlank(sStore.getTiktokPoiId())) {
throw new Exception("门店异常,请更换门店");
}
if (code.startsWith("https://v.douyin.com/") | code.length() == 15 | code.length() == 12) {
try {
TiktokCouponDto tiktokCouponDto = new TiktokCouponDto();
......@@ -486,7 +490,7 @@ public class TiktokServiceImpl implements TiktokService {
} else {
tiktokCouponDto.setCode(code);
}
tiktokCouponDto.setPoiId(sStoreList.get(0).getTiktokPoiId());
tiktokCouponDto.setPoiId(sStore.getTiktokPoiId());
JSONObject prepare = prepare(tiktokCouponDto);
JSONArray certificates = prepare.getJSONArray("certificates");
if (CollectionUtils.isEmpty(certificates)) {
......@@ -499,7 +503,7 @@ public class TiktokServiceImpl implements TiktokService {
eq(SCoupon::getCouponType, CouponTypeEnum.CASH.getCode()).
eq(SCoupon::getTiktokSkuId, sku.getStr("sku_id")).
eq(SCoupon::getPlatformType, PlatformTypeEnum.TIKTOK.getCode()));
sStoreList = storeService.list(new LambdaQueryWrapper<>(SStore.class).isNotNull(SStore::getTiktokPoiId));
List<SStore> sStoreList = storeService.list(new LambdaQueryWrapper<>(SStore.class).isNotNull(SStore::getTiktokPoiId));
if (!ObjectUtils.isEmpty(sCoupon)) {
return qpService.getsStores(sStoreList, sCoupon, dto);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment