添加获取积分产品列表接口
This commit is contained in:
@ -4,6 +4,9 @@
|
|||||||
-- 字段修改
|
-- 字段修改
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
ALTER TABLE yx_store_product ADD COLUMN is_integral tinyint(1) ZEROFILL NULL DEFAULT 0 COMMENT '是开启积分兑换' AFTER is_del;
|
ALTER TABLE yx_store_product ADD COLUMN is_integral tinyint(1) ZEROFILL NULL DEFAULT 0 COMMENT '是开启积分兑换' AFTER is_del;
|
||||||
|
|
||||||
|
ALTER TABLE yx_store_product ADD COLUMN integral tinyint(1) ZEROFILL NULL DEFAULT 0 COMMENT '需要多少积分兑换' AFTER is_integral;
|
||||||
|
|
||||||
ALTER TABLE yx_store_product_attr_value ADD COLUMN integral INT(10) DEFAULT 0 COMMENT '需要多少积分兑换' AFTER seckill_price;
|
ALTER TABLE yx_store_product_attr_value ADD COLUMN integral INT(10) DEFAULT 0 COMMENT '需要多少积分兑换' AFTER seckill_price;
|
||||||
|
|
||||||
ALTER TABLE yx_store_order ADD COLUMN `pay_integral` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '支付积分';
|
ALTER TABLE yx_store_order ADD COLUMN `pay_integral` decimal(8, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '支付积分';
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
package co.yixiang.modules.activity.rest;
|
||||||
|
|
||||||
|
import co.yixiang.api.ApiResult;
|
||||||
|
import co.yixiang.modules.product.param.YxStoreProductQueryParam;
|
||||||
|
import co.yixiang.modules.product.service.YxStoreProductService;
|
||||||
|
import co.yixiang.modules.product.vo.YxStoreProductQueryVo;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分兑换前端控制器
|
||||||
|
* @author yshop
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping
|
||||||
|
@Api(value = "积分兑换", tags = "营销:积分兑换", description = "积分兑换")
|
||||||
|
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||||
|
public class StoreIntegralController {
|
||||||
|
|
||||||
|
private final YxStoreProductService storeProductService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取积分产品列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/products")
|
||||||
|
@ApiOperation(value = "获取积分产品列表",notes = "获取积分产品列表")
|
||||||
|
public ApiResult<List<YxStoreProductQueryVo>> goodsList(YxStoreProductQueryParam productQueryParam){
|
||||||
|
return ApiResult.ok(storeProductService.getGoodsList(productQueryParam));
|
||||||
|
}
|
||||||
|
}
|
@ -138,6 +138,11 @@ public class YxStoreProduct extends BaseDomain {
|
|||||||
private Integer stock;
|
private Integer stock;
|
||||||
|
|
||||||
|
|
||||||
|
/** 需要多少积分兑换 */
|
||||||
|
@ApiModelProperty(value = "需要多少积分兑换 只在开启积分兑换时生效")
|
||||||
|
private Integer integral;
|
||||||
|
|
||||||
|
|
||||||
/** 状态(0:未上架,1:上架) */
|
/** 状态(0:未上架,1:上架) */
|
||||||
@ApiModelProperty(value = "状态(0:未上架,1:上架)")
|
@ApiModelProperty(value = "状态(0:未上架,1:上架)")
|
||||||
private Integer isShow;
|
private Integer isShow;
|
||||||
|
@ -29,6 +29,9 @@ public class YxStoreProductQueryParam extends QueryParam {
|
|||||||
@ApiModelProperty(value = "是否新品")
|
@ApiModelProperty(value = "是否新品")
|
||||||
private String news;
|
private String news;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否积分兑换商品")
|
||||||
|
private Integer isIntegral;
|
||||||
|
|
||||||
@ApiModelProperty(value = "价格排序")
|
@ApiModelProperty(value = "价格排序")
|
||||||
private String priceOrder;
|
private String priceOrder;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package co.yixiang.modules.product.service.dto;
|
package co.yixiang.modules.product.service.dto;
|
||||||
|
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -20,4 +21,6 @@ public class ProductResultDto {
|
|||||||
private Double minCost;
|
private Double minCost;
|
||||||
|
|
||||||
private Integer stock;
|
private Integer stock;
|
||||||
|
|
||||||
|
private Integer minIntegral;
|
||||||
}
|
}
|
||||||
|
@ -60,13 +60,11 @@ import co.yixiang.utils.ShopKeyUtils;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.qiniu.util.StringUtils;
|
import com.qiniu.util.StringUtils;
|
||||||
import lombok.val;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -79,8 +77,6 @@ import java.math.BigDecimal;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static co.yixiang.common.utils.QueryHelpPlus.humpToUnderline;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hupeng
|
* @author hupeng
|
||||||
@ -237,6 +233,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
wrapper.eq(YxStoreProduct::getIsDel, CommonEnum.DEL_STATUS_0.getValue());
|
wrapper.eq(YxStoreProduct::getIsDel, CommonEnum.DEL_STATUS_0.getValue());
|
||||||
// wrapper.eq(YxStoreProduct::getIsIntegral, CommonEnum.SHOW_STATUS_1.getValue());
|
// wrapper.eq(YxStoreProduct::getIsIntegral, CommonEnum.SHOW_STATUS_1.getValue());
|
||||||
|
|
||||||
|
if(productQueryParam.getIsIntegral()!=null){
|
||||||
|
wrapper.eq(YxStoreProduct::getIsIntegral, productQueryParam.getIsIntegral());
|
||||||
|
}
|
||||||
//多字段模糊查询分类搜索
|
//多字段模糊查询分类搜索
|
||||||
if (StrUtil.isNotBlank(productQueryParam.getSid()) &&
|
if (StrUtil.isNotBlank(productQueryParam.getSid()) &&
|
||||||
!ShopConstants.YSHOP_ZERO.equals(productQueryParam.getSid())) {
|
!ShopConstants.YSHOP_ZERO.equals(productQueryParam.getSid())) {
|
||||||
@ -735,6 +734,13 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
.min(Comparator.naturalOrder())
|
.min(Comparator.naturalOrder())
|
||||||
.orElse(0d);
|
.orElse(0d);
|
||||||
|
|
||||||
|
//取最小积分
|
||||||
|
Integer minIntegral = attrs
|
||||||
|
.stream()
|
||||||
|
.map(ProductFormatDto::getIntegral)
|
||||||
|
.min(Comparator.naturalOrder())
|
||||||
|
.orElse(0);
|
||||||
|
|
||||||
Double minOtPrice = attrs
|
Double minOtPrice = attrs
|
||||||
.stream()
|
.stream()
|
||||||
.map(ProductFormatDto::getOtPrice)
|
.map(ProductFormatDto::getOtPrice)
|
||||||
@ -762,6 +768,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
.minOtPrice(minOtPrice)
|
.minOtPrice(minOtPrice)
|
||||||
.minCost(minCost)
|
.minCost(minCost)
|
||||||
.stock(stock)
|
.stock(stock)
|
||||||
|
.minIntegral(minIntegral)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user