Authored by Lixiaodi

商品限制销售信息

... ... @@ -20,4 +20,6 @@ public interface ProductLimitSaleMapper {
int updateByPrimaryKey(ProductLimitSale record);
List<ProductLimitSale> selectByProductIdAndUid(@Param("productId")Integer productId, @Param("uid")Integer uid);
ProductLimitSale selectOneByProductIdAndUid(@Param("productId")Integer productId, @Param("uid")Integer uid);
}
\ No newline at end of file
... ...
... ... @@ -29,6 +29,13 @@
and uid = #{uid}
</if>
</select>
<select id="selectOneByProductIdAndUid" resultMap="BaseResultMap" >
select *
from product_limit_sale
where del_status = 0 and product_id = #{productId} and uid = #{uid}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from product_limit_sale
where id = #{id,jdbcType=INTEGER}
... ...
... ... @@ -134,13 +134,13 @@ public class ProductController {
@ApiOperation(name = "ufo.product.baseInfo", desc = "出售商品,卖家出售的价格区间")
@RequestMapping(params = "method=ufo.product.baseInfo")
@Cachable(expire = 180)
public ProductDetailResp queryProductBaseInfo(@RequestParam(value = "product_id") Integer productId) {
public ProductDetailResp queryProductBaseInfo(@RequestParam(value = "product_id") Integer productId, @RequestParam(value = "uid") Integer uid) {
if (productId == null) {
LOG.info("in method=ufo.product.baseInfo productId Is Null");
return null;
}
LOG.info("in method=ufo.product.baseInfo productId={}", productId);
return productService.queryProductBaseInfo(productId);
LOG.info("in method=ufo.product.baseInfo productId={}, uid is {}", productId, uid);
return productService.queryProductBaseInfo(productId, uid);
}
... ...
... ... @@ -40,7 +40,7 @@ public interface ProductService {
ProductSimpleResp queryPriceLimit(Integer productId);
// 查询商品的基本信息
ProductDetailResp queryProductBaseInfo(Integer productId);
ProductDetailResp queryProductBaseInfo(Integer productId, Integer uid);
void batchCreateSkup(List<StoragePriceBo> skupBoList);
... ...
... ... @@ -751,7 +751,7 @@ public class ProductServiceImpl implements ProductService {
// 查询商品的基本信息
public ProductDetailResp queryProductBaseInfo(Integer productId) {
public ProductDetailResp queryProductBaseInfo(Integer productId, Integer uid) {
Product product = productMapper.selectByPrimaryKey(productId);
if (null == product) {
return new ProductDetailResp();
... ... @@ -763,6 +763,18 @@ public class ProductServiceImpl implements ProductService {
productInfo.setSaleTime((product.getSaleTime() == null || product.getSaleTime().equals(0)) ? "0" : DateUtil.getDateString(product.getSaleTime(), DateUtil.YYYY_MM_DD_DOT));
productInfo.setMinPrice(product.getMinPrice());
productInfo.setMaxPrice(product.getMaxPrice());
if (uid != null && uid > 0) {
boolean isLimit = !CollectionUtils.isEmpty(productLimitSaleMapper.selectByProductIdAndUid(productId, null));
if (isLimit) {
ProductLimitSale limitSale = productLimitSaleMapper.selectOneByProductIdAndUid(productId, uid);
if (limitSale != null) {
productInfo.setSellerServiceFeeRate(limitSale.getProfitRate());
} else {
LOGGER.error("该用户" + uid + ",没有商品" + productId + "的发布权限");
productInfo.setSellerCanPublish(false);
}
}
}
ProductDetailResp productDetailResp = new ProductDetailResp();
productDetailResp.setProduct_info(productInfo);
... ...