分享奖励接口修改
This commit is contained in:
@@ -3,6 +3,8 @@ package com.czg.service.account.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.account.dto.ShopShareCouponDTO;
|
||||
import com.czg.account.dto.ShopShareDTO;
|
||||
import com.czg.account.entity.ShopCoupon;
|
||||
import com.czg.account.service.ShopCouponService;
|
||||
@@ -42,11 +44,13 @@ public class ShopShareServiceImpl extends ServiceImpl<ShopShareMapper, ShopShare
|
||||
if (shopShare != null) {
|
||||
BeanUtil.copyProperties(shopShare, shopShareVO);
|
||||
if (StrUtil.isNotBlank(shopShare.getRewardCoupon())) {
|
||||
shopShareVO.setRewardCouponList(shopCouponService.list(new QueryWrapper().eq(ShopCoupon::getShopId, shopId).in(ShopCoupon::getId, JSONArray.parseArray(shopShare.getRewardCoupon()))));
|
||||
// shopShareVO.setRewardCouponList(shopCouponService.list(new QueryWrapper().eq(ShopCoupon::getShopId, shopId).in(ShopCoupon::getId, JSONArray.parseArray(shopShare.getRewardCoupon()))));
|
||||
shopShareVO.setRewardCouponList(JSONArray.parseArray(shopShare.getRewardCoupon(), ShopShareCouponDTO.class));
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(shopShare.getNewCoupon())) {
|
||||
shopShareVO.setNewCouponList(shopCouponService.list(new QueryWrapper().eq(ShopCoupon::getShopId, shopId).in(ShopCoupon::getId, JSONArray.parseArray(shopShare.getNewCoupon()))));
|
||||
// shopShareVO.setNewCouponList(shopCouponService.list(new QueryWrapper().eq(ShopCoupon::getShopId, shopId).in(ShopCoupon::getId, JSONArray.parseArray(shopShare.getNewCoupon()))));
|
||||
shopShareVO.setNewCouponList(JSONArray.parseArray(shopShare.getNewCoupon(), ShopShareCouponDTO.class));
|
||||
}
|
||||
}
|
||||
return shopShareVO;
|
||||
@@ -55,14 +59,14 @@ public class ShopShareServiceImpl extends ServiceImpl<ShopShareMapper, ShopShare
|
||||
@Override
|
||||
public Boolean add(Long shopId, ShopShareDTO shopShareDTO) {
|
||||
if (shopShareDTO.getNewCouponList() != null && !shopShareDTO.getRewardCouponList().isEmpty()) {
|
||||
long count = shopCouponService.count(new QueryWrapper().in(ShopCoupon::getId, shopShareDTO.getNewCouponList()).eq(ShopCoupon::getShopId, shopId));
|
||||
long count = shopCouponService.count(new QueryWrapper().in(ShopCoupon::getId, shopShareDTO.getNewCouponList().stream().map(ShopShareCouponDTO::getId).toList()).eq(ShopCoupon::getShopId, shopId));
|
||||
if (count != shopShareDTO.getNewCouponList().size()) {
|
||||
throw new ApiNotPrintException("优惠券不存在");
|
||||
}
|
||||
}
|
||||
|
||||
if (shopShareDTO.getRewardCouponList() != null && !shopShareDTO.getRewardCouponList().isEmpty()) {
|
||||
long count = shopCouponService.count(new QueryWrapper().in(ShopCoupon::getId, shopShareDTO.getRewardCouponList()).eq(ShopCoupon::getShopId, shopId));
|
||||
long count = shopCouponService.count(new QueryWrapper().in(ShopCoupon::getId, shopShareDTO.getRewardCouponList().stream().map(ShopShareCouponDTO::getId).toList()).eq(ShopCoupon::getShopId, shopId));
|
||||
if (count != shopShareDTO.getRewardCouponList().size()) {
|
||||
throw new ApiNotPrintException("优惠券不存在");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user