Showing
5 changed files
with
72 additions
and
8 deletions
@@ -17,4 +17,8 @@ public class ProductProfit { | @@ -17,4 +17,8 @@ public class ProductProfit { | ||
17 | private Integer updateTime; | 17 | private Integer updateTime; |
18 | 18 | ||
19 | private Byte delStatus; | 19 | private Byte delStatus; |
20 | + | ||
21 | + private BigDecimal profitMinPrice; // 费率价格下限 | ||
22 | + | ||
23 | + private BigDecimal profitMaxPrice; // 费率价格上限 | ||
20 | } | 24 | } |
@@ -295,12 +295,12 @@ | @@ -295,12 +295,12 @@ | ||
295 | 295 | ||
296 | <select id="queryUserDopositBackCount" resultType="java.lang.Integer" parameterType="java.lang.Integer" > | 296 | <select id="queryUserDopositBackCount" resultType="java.lang.Integer" parameterType="java.lang.Integer" > |
297 | select count(*) from storage_deposit | 297 | select count(*) from storage_deposit |
298 | - where owner_uid = #{uid} and status in(2,3,4,5) and out_type in(1,3) and del_status=0 | 298 | + where owner_uid = #{uid} and status in(2,3,4,5) and out_type in(1) and del_status=0 |
299 | </select> | 299 | </select> |
300 | 300 | ||
301 | <select id="queryUserDopositBack" resultMap="BaseResultMap"> | 301 | <select id="queryUserDopositBack" resultMap="BaseResultMap"> |
302 | select * from storage_deposit | 302 | select * from storage_deposit |
303 | - where owner_uid = #{uid} and status in(2,3,4,5) and out_type in(1,3) and del_status=0 | 303 | + where owner_uid = #{uid} and status in(2,3,4,5) and out_type in(1) and del_status=0 |
304 | limit #{start}, #{count} | 304 | limit #{start}, #{count} |
305 | </select> | 305 | </select> |
306 | 306 |
@@ -7,15 +7,17 @@ | @@ -7,15 +7,17 @@ | ||
7 | <result column="profit_rate" property="profitRate" jdbcType="DECIMAL" /> | 7 | <result column="profit_rate" property="profitRate" jdbcType="DECIMAL" /> |
8 | <result column="update_time" property="updateTime" jdbcType="INTEGER" /> | 8 | <result column="update_time" property="updateTime" jdbcType="INTEGER" /> |
9 | <result column="del_status" property="delStatus" jdbcType="TINYINT" /> | 9 | <result column="del_status" property="delStatus" jdbcType="TINYINT" /> |
10 | + <result column="profit_min_price" property="profitMinPrice" jdbcType="DECIMAL" /> | ||
11 | + <result column="profit_max_price" property="profitMaxPrice" jdbcType="DECIMAL" /> | ||
10 | </resultMap> | 12 | </resultMap> |
11 | <sql id="Base_Column_List" > | 13 | <sql id="Base_Column_List" > |
12 | - id, product_id, profit_rate, update_time, del_status | 14 | + id, product_id, profit_rate, update_time, del_status, profit_min_price, profit_max_price |
13 | </sql> | 15 | </sql> |
14 | <select id="selectByProductId" resultMap="BaseResultMap"> | 16 | <select id="selectByProductId" resultMap="BaseResultMap"> |
15 | select | 17 | select |
16 | <include refid="Base_Column_List" /> | 18 | <include refid="Base_Column_List" /> |
17 | from product_profit | 19 | from product_profit |
18 | - where product_id = #{productId, jdbcType=INTEGER} AND del_status = 0 Limit 1 | 20 | + where product_id = #{productId, jdbcType=INTEGER} AND del_status = 0 ORDER BY id DESC Limit 1 |
19 | </select> | 21 | </select> |
20 | 22 | ||
21 | <insert id="insert" parameterType="com.yohoufo.dal.product.model.ProductProfit" > | 23 | <insert id="insert" parameterType="com.yohoufo.dal.product.model.ProductProfit" > |
@@ -265,6 +265,59 @@ public class ProductSearchController { | @@ -265,6 +265,59 @@ public class ProductSearchController { | ||
265 | return new ApiResponse.ApiResponseBuilder().code(200).message("search.suggest.").data(resp).build(); | 265 | return new ApiResponse.ApiResponseBuilder().code(200).message("search.suggest.").data(resp).build(); |
266 | } | 266 | } |
267 | 267 | ||
268 | + | ||
269 | + @ApiOperation(name = "ufo.product.search.deposit", desc="现货寄存的商品列表") | ||
270 | + @RequestMapping(params = "method=ufo.product.search.deposit") | ||
271 | + @IgnoreSession | ||
272 | + @Cachable(expire = 60) | ||
273 | + public ApiResponse searchDepositProductList( | ||
274 | + @RequestParam(value = "type", required = false)Integer type, | ||
275 | + @RequestParam(value = "order", required = false)String order, | ||
276 | + @RequestParam(value = "product_id", required = false)String id, | ||
277 | + @RequestParam(value = "productPool", required = false) String productPool, | ||
278 | + @RequestParam(value = "sort", required = false)String sort, | ||
279 | + @RequestParam(value = "brand", required = false)String brand, | ||
280 | + @RequestParam(value = "series", required = false)String series, | ||
281 | + @RequestParam(value = "gender", required = false) String gender, | ||
282 | + @RequestParam(value = "size", required = false) String size, | ||
283 | + @RequestParam(value = "isSoonSale", required = false) String isSoonSale, | ||
284 | + @RequestParam(value = "query", required = false)String query, | ||
285 | + @RequestParam(value = "limit", required = false)Integer limit, | ||
286 | + @RequestParam(value = "page", required = false)Integer page, | ||
287 | + @RequestParam(value = "app_version", required = false)String appVersion | ||
288 | + ) { | ||
289 | + if (type != null) { | ||
290 | + Map<Integer,Integer> poolConfig = ufoServiceCaller.call("ufo.resource.goodsPool", Map.class); | ||
291 | + if (type == 0) { | ||
292 | + productPool = String.valueOf(poolConfig.get(2)); | ||
293 | + order = "pools.order_by:desc"; | ||
294 | + } else if (type == 1) { | ||
295 | + productPool = String.valueOf(poolConfig.get(4)); | ||
296 | + order = "pools.order_by:desc"; | ||
297 | + } else if (type == 2) { | ||
298 | + isSoonSale = "Y"; | ||
299 | + } | ||
300 | + } | ||
301 | + if (StringUtils.isNotBlank(productPool) | ||
302 | + && StringUtils.isBlank(query) | ||
303 | + && StringUtils.isBlank(order)) { | ||
304 | + order = "pools.order_by:desc"; // 如果走商品池接口,默认走排序倒序接口 | ||
305 | + } | ||
306 | + SortIdLevel sortIdLevel = productSearchService.getSortLevelById(sort); | ||
307 | + ProductSearchReq req = new ProductSearchReq().setOrder(order).setId(id).setPool(productPool).setBrand(brand).setMidSort(sortIdLevel.getMidSortId()).setMaxSort(sortIdLevel.getMaxSortId()) | ||
308 | + .setSeries(series).setGender(gender).setSize(size).setIsSoonSale(isSoonSale).setViewNum(limit).setPage(page).setIsIdFilter(type).setSearchType(type); | ||
309 | + searchHelpService.setQuery(query, req); | ||
310 | + //设置是否包含有货商品 | ||
311 | + searchHelpService.setContainYoho(appVersion, req); | ||
312 | + LOG.info("in method=ufo.product.search.list req={}", req.toString()); | ||
313 | + | ||
314 | + JSONObject resp = productSearchService.searchProductList(req); | ||
315 | + if (resp != null) { | ||
316 | + resp.put("rec_id", UUID.randomUUID()); | ||
317 | + } | ||
318 | + return new ApiResponse.ApiResponseBuilder().code(200).message("Product List.").data(resp).build(); | ||
319 | + } | ||
320 | + | ||
268 | private Integer getValidTimestamp(String dateStr, boolean start) { | 321 | private Integer getValidTimestamp(String dateStr, boolean start) { |
269 | try { | 322 | try { |
270 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); | 323 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); |
@@ -1092,7 +1092,8 @@ public class ProductServiceImpl implements ProductService { | @@ -1092,7 +1092,8 @@ public class ProductServiceImpl implements ProductService { | ||
1092 | } | 1092 | } |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | - productInfo.setProductProfitRate(getProductProfitRateById(productInfo.getProductId())); | 1095 | + setProductProfitRate(productInfo, productInfo.getProductId()); |
1096 | + | ||
1096 | 1097 | ||
1097 | ProductDetailResp productDetailResp = new ProductDetailResp(); | 1098 | ProductDetailResp productDetailResp = new ProductDetailResp(); |
1098 | productDetailResp.setProduct_info(productInfo); | 1099 | productDetailResp.setProduct_info(productInfo); |
@@ -1890,12 +1891,16 @@ public class ProductServiceImpl implements ProductService { | @@ -1890,12 +1891,16 @@ public class ProductServiceImpl implements ProductService { | ||
1890 | return ""; | 1891 | return ""; |
1891 | } | 1892 | } |
1892 | 1893 | ||
1893 | - private BigDecimal getProductProfitRateById(Integer productId) { | 1894 | + private void setProductProfitRate(ProductInfo productInfo, Integer productId) { |
1894 | if (null == productId) { | 1895 | if (null == productId) { |
1895 | - return null; | 1896 | + return; |
1896 | } | 1897 | } |
1897 | ProductProfit productProfit = productProfitMapper.selectByProductId(productId); | 1898 | ProductProfit productProfit = productProfitMapper.selectByProductId(productId); |
1898 | - return null == productProfit ? null : productProfit.getProfitRate(); | 1899 | + if (!Objects.isNull(productProfit)) { |
1900 | + productInfo.setProductProfitRate(productProfit.getProfitRate()); | ||
1901 | + productInfo.setProfitMaxPrice(productProfit.getProfitMaxPrice()); | ||
1902 | + productInfo.setProfitMinPrice(productProfit.getProfitMinPrice()); | ||
1903 | + } | ||
1899 | } | 1904 | } |
1900 | 1905 | ||
1901 | /** | 1906 | /** |
-
Please register or login to post a comment