Authored by mali

商品费率调整

... ... @@ -17,4 +17,8 @@ public class ProductProfit {
private Integer updateTime;
private Byte delStatus;
private BigDecimal profitMinPrice; // 费率价格下限
private BigDecimal profitMaxPrice; // 费率价格上限
}
\ No newline at end of file
... ...
... ... @@ -295,12 +295,12 @@
<select id="queryUserDopositBackCount" resultType="java.lang.Integer" parameterType="java.lang.Integer" >
select count(*) from storage_deposit
where owner_uid = #{uid} and status in(2,3,4,5) and out_type in(1,3) and del_status=0
where owner_uid = #{uid} and status in(2,3,4,5) and out_type in(1) and del_status=0
</select>
<select id="queryUserDopositBack" resultMap="BaseResultMap">
select * from storage_deposit
where owner_uid = #{uid} and status in(2,3,4,5) and out_type in(1,3) and del_status=0
where owner_uid = #{uid} and status in(2,3,4,5) and out_type in(1) and del_status=0
limit #{start}, #{count}
</select>
... ...
... ... @@ -7,15 +7,17 @@
<result column="profit_rate" property="profitRate" jdbcType="DECIMAL" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="del_status" property="delStatus" jdbcType="TINYINT" />
<result column="profit_min_price" property="profitMinPrice" jdbcType="DECIMAL" />
<result column="profit_max_price" property="profitMaxPrice" jdbcType="DECIMAL" />
</resultMap>
<sql id="Base_Column_List" >
id, product_id, profit_rate, update_time, del_status
id, product_id, profit_rate, update_time, del_status, profit_min_price, profit_max_price
</sql>
<select id="selectByProductId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product_profit
where product_id = #{productId, jdbcType=INTEGER} AND del_status = 0 Limit 1
where product_id = #{productId, jdbcType=INTEGER} AND del_status = 0 ORDER BY id DESC Limit 1
</select>
<insert id="insert" parameterType="com.yohoufo.dal.product.model.ProductProfit" >
... ...
... ... @@ -264,7 +264,60 @@ public class ProductSearchController {
}
return new ApiResponse.ApiResponseBuilder().code(200).message("search.suggest.").data(resp).build();
}
@ApiOperation(name = "ufo.product.search.deposit", desc="现货寄存的商品列表")
@RequestMapping(params = "method=ufo.product.search.deposit")
@IgnoreSession
@Cachable(expire = 60)
public ApiResponse searchDepositProductList(
@RequestParam(value = "type", required = false)Integer type,
@RequestParam(value = "order", required = false)String order,
@RequestParam(value = "product_id", required = false)String id,
@RequestParam(value = "productPool", required = false) String productPool,
@RequestParam(value = "sort", required = false)String sort,
@RequestParam(value = "brand", required = false)String brand,
@RequestParam(value = "series", required = false)String series,
@RequestParam(value = "gender", required = false) String gender,
@RequestParam(value = "size", required = false) String size,
@RequestParam(value = "isSoonSale", required = false) String isSoonSale,
@RequestParam(value = "query", required = false)String query,
@RequestParam(value = "limit", required = false)Integer limit,
@RequestParam(value = "page", required = false)Integer page,
@RequestParam(value = "app_version", required = false)String appVersion
) {
if (type != null) {
Map<Integer,Integer> poolConfig = ufoServiceCaller.call("ufo.resource.goodsPool", Map.class);
if (type == 0) {
productPool = String.valueOf(poolConfig.get(2));
order = "pools.order_by:desc";
} else if (type == 1) {
productPool = String.valueOf(poolConfig.get(4));
order = "pools.order_by:desc";
} else if (type == 2) {
isSoonSale = "Y";
}
}
if (StringUtils.isNotBlank(productPool)
&& StringUtils.isBlank(query)
&& StringUtils.isBlank(order)) {
order = "pools.order_by:desc"; // 如果走商品池接口,默认走排序倒序接口
}
SortIdLevel sortIdLevel = productSearchService.getSortLevelById(sort);
ProductSearchReq req = new ProductSearchReq().setOrder(order).setId(id).setPool(productPool).setBrand(brand).setMidSort(sortIdLevel.getMidSortId()).setMaxSort(sortIdLevel.getMaxSortId())
.setSeries(series).setGender(gender).setSize(size).setIsSoonSale(isSoonSale).setViewNum(limit).setPage(page).setIsIdFilter(type).setSearchType(type);
searchHelpService.setQuery(query, req);
//设置是否包含有货商品
searchHelpService.setContainYoho(appVersion, req);
LOG.info("in method=ufo.product.search.list req={}", req.toString());
JSONObject resp = productSearchService.searchProductList(req);
if (resp != null) {
resp.put("rec_id", UUID.randomUUID());
}
return new ApiResponse.ApiResponseBuilder().code(200).message("Product List.").data(resp).build();
}
private Integer getValidTimestamp(String dateStr, boolean start) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
... ...
... ... @@ -1092,7 +1092,8 @@ public class ProductServiceImpl implements ProductService {
}
}
productInfo.setProductProfitRate(getProductProfitRateById(productInfo.getProductId()));
setProductProfitRate(productInfo, productInfo.getProductId());
ProductDetailResp productDetailResp = new ProductDetailResp();
productDetailResp.setProduct_info(productInfo);
... ... @@ -1890,12 +1891,16 @@ public class ProductServiceImpl implements ProductService {
return "";
}
private BigDecimal getProductProfitRateById(Integer productId) {
private void setProductProfitRate(ProductInfo productInfo, Integer productId) {
if (null == productId) {
return null;
return;
}
ProductProfit productProfit = productProfitMapper.selectByProductId(productId);
return null == productProfit ? null : productProfit.getProfitRate();
if (!Objects.isNull(productProfit)) {
productInfo.setProductProfitRate(productProfit.getProfitRate());
productInfo.setProfitMaxPrice(productProfit.getProfitMaxPrice());
productInfo.setProfitMinPrice(productProfit.getProfitMinPrice());
}
}
/**
... ...