积分商品获取问题

This commit is contained in:
2025-12-10 17:06:52 +08:00
parent b281607022
commit df12c83b8e
3 changed files with 16 additions and 3 deletions

View File

@@ -54,7 +54,12 @@ public class PointsGoodsController {
public CzgResult<Boolean> addPointsGoodsSetting(@RequestBody @Validated MkPointsGoodsDTO dto) { public CzgResult<Boolean> addPointsGoodsSetting(@RequestBody @Validated MkPointsGoodsDTO dto) {
dto.setShopId(StpKit.USER.getShopId()); dto.setShopId(StpKit.USER.getShopId());
MkPointsGoods entity = BeanUtil.copyProperties(dto, MkPointsGoods.class); MkPointsGoods entity = BeanUtil.copyProperties(dto, MkPointsGoods.class);
boolean ret = pointsGoodsSettingService.saveOrUpdate(entity); boolean ret;
if (entity.getId() != null) {
ret = pointsGoodsSettingService.saveOrUpdate(entity);
} else {
ret = pointsGoodsSettingService.updateById(entity, false);
}
return CzgResult.success(ret); return CzgResult.success(ret);
} }

View File

@@ -13,5 +13,5 @@ import java.util.List;
*/ */
public interface MkPointsGoodsMapper extends BaseMapper<MkPointsGoods> { public interface MkPointsGoodsMapper extends BaseMapper<MkPointsGoods> {
List<MkPointsGoods> getPointsGoodsPageByUser(Long shopId, Long userId,String goodsCategory); List<MkPointsGoods> getPointsGoodsPageByUser(Long shopId, Long userId, String goodsCategory);
} }

View File

@@ -1,5 +1,6 @@
package com.czg.service.market.service.impl; package com.czg.service.market.service.impl;
import cn.hutool.core.util.StrUtil;
import com.czg.BaseQueryParam; import com.czg.BaseQueryParam;
import com.czg.exception.CzgException; import com.czg.exception.CzgException;
import com.czg.market.entity.*; import com.czg.market.entity.*;
@@ -64,7 +65,14 @@ public class MkPointsGoodsServiceImpl extends ServiceImpl<MkPointsGoodsMapper, M
Map<String, Object> result = new HashMap<>(2); Map<String, Object> result = new HashMap<>(2);
MkPointsUser pointsUser = pointsUserService.getPointsUser(shopId, null, userId); MkPointsUser pointsUser = pointsUserService.getPointsUser(shopId, null, userId);
PageHelper.startPage(page, size); PageHelper.startPage(page, size);
List<MkPointsGoods> list = mapper.getPointsGoodsPageByUser(shopId, userId, goodsCategory.trim()); if (StrUtil.isNotBlank(goodsCategory)) {
if (goodsCategory.contains("优惠劵")) {
goodsCategory = "优惠劵";
} else if (goodsCategory.contains("其他商品")) {
goodsCategory = "其他商品";
}
}
List<MkPointsGoods> list = mapper.getPointsGoodsPageByUser(shopId, userId, StrUtil.trim(goodsCategory));
list.forEach(goods -> { list.forEach(goods -> {
if (goods.getGoodsCategory().equals("优惠劵")) { if (goods.getGoodsCategory().equals("优惠劵")) {
ShopCoupon one = shopCouponService.getOne(query().eq(ShopCoupon::getId, goods.getCouponId()) ShopCoupon one = shopCouponService.getOne(query().eq(ShopCoupon::getId, goods.getCouponId())