Authored by tanling

Merge branch 'test6.9.17' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.17

package com.yohoufo.dal.product;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yohoufo.dal.product.model.SizePoolDetail;
/**
* Created by caoyan.
*/
public interface SizePoolDetailMapper {
List<SizePoolDetail> queryByProductId(@Param("productId") Integer productId);
List<SizePoolDetail> queryByBrandId(@Param("brandId") Integer brandId);
}
... ...
package com.yohoufo.dal.product;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yohoufo.dal.product.model.SizePool;
/**
* Created by caoyan.
*/
public interface SizePoolMapper {
SizePool querySizePoolByIds(@Param("sizePoolIds") List<Integer> sizePoolIds);
}
... ...
package com.yohoufo.dal.product.model;
import com.alibaba.fastjson.JSONObject;
public class SizePool {
private Integer id;
private Integer status;
private Integer rangeType;
private String imageUrl;
private Integer updateTime;
private Integer updateUid;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getRangeType() {
return rangeType;
}
public void setRangeType(Integer rangeType) {
this.rangeType = rangeType;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public Integer getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Integer updateTime) {
this.updateTime = updateTime;
}
public Integer getUpdateUid() {
return updateUid;
}
public void setUpdateUid(Integer updateUid) {
this.updateUid = updateUid;
}
@Override
public String toString() {
return JSONObject.toJSONString(this);
}
}
\ No newline at end of file
... ...
package com.yohoufo.dal.product.model;
import com.alibaba.fastjson.JSONObject;
public class SizePoolDetail {
private Integer id;
private Integer sizePoolId;
private Integer isInclude;
private Integer itemId;
private Integer itemType;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getSizePoolId() {
return sizePoolId;
}
public void setSizePoolId(Integer sizePoolId) {
this.sizePoolId = sizePoolId;
}
public Integer getIsInclude() {
return isInclude;
}
public void setIsInclude(Integer isInclude) {
this.isInclude = isInclude;
}
public Integer getItemId() {
return itemId;
}
public void setItemId(Integer itemId) {
this.itemId = itemId;
}
public Integer getItemType() {
return itemType;
}
public void setItemType(Integer itemType) {
this.itemType = itemType;
}
@Override
public String toString() {
return JSONObject.toJSONString(this);
}
}
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yohoufo.dal.product.SizePoolDetailMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.product.model.SizePoolDetail">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="size_pool_id" property="sizePoolId" jdbcType="INTEGER" />
<result column="is_include" property="isInclude" jdbcType="INTEGER" />
<result column="item_id" property="itemId" jdbcType="INTEGER" />
<result column="item_type" property="itemType" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, size_pool_id, is_include, item_id, item_type
</sql>
<select id="queryByProductId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from size_pool_detail
where is_include=1 and item_type=2 and item_id=#{productId}
</select>
<select id="queryByBrandId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from size_pool_detail
where is_include=1 and item_type=1 and item_id=#{brandId}
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yohoufo.dal.product.SizePoolMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.product.model.SizePool">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="range_type" property="rangeType" jdbcType="INTEGER" />
<result column="image_url" property="imageUrl" jdbcType="VARCHAR" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="update_uid" property="updateUid" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, status, range_type, image_url, update_time, update_uid
</sql>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from size_pool
where id = #{id,jdbcType=INTEGER}
</delete>
<select id="querySizePoolByIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from size_pool
where status=1 and id in
<foreach collection="sizePoolIds" item="sizePoolId" open="(" close=")" separator=",">
#{sizePoolId}
</foreach>
limit 1
</select>
</mapper>
\ No newline at end of file
... ...
package com.yohoufo.order.controller;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.rest.annotation.ServiceDesc;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.order.service.impl.MetaConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author: 杨长江
* @Date: 2019-12-06 10:46
* @Description: 说明
*/
@RestController
@ServiceDesc("orderMetaConfig")
public class MetaConfigController {
private final Logger logger = LoggerFactory.getLogger(MetaConfigController.class);
@Autowired
private MetaConfigService metaConfigService;
/**
* 根据code清除redis缓存
* @param jsonObject
* @return
*/
@IgnoreSession
@IgnoreSignature
@RequestMapping("/orderMetaConfig/cleanCacheByCode")
@ResponseBody
public ApiResponse cleanCacheByCode(@RequestBody JSONObject jsonObject){
String code = jsonObject.getString("jsonObject");
if(null != code && !"".equals(code)){
logger.info("clean metaConfig cache by code :{}",code);
metaConfigService.clearCacheByCode(code);
return new ApiResponse.ApiResponseBuilder().code(200).build();
}
return new ApiResponse.ApiResponseBuilder().code(500).build();
}
}
... ...
... ... @@ -431,4 +431,57 @@ public class MetaConfigService {
return bpfMap;
}
/**
* 根据code清除配置缓存
* @param code
*/
public void clearCacheByCode(String code){
switch (code){
case "buyer_penalty":
cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_CANCEL_PENALTY.builderKeyOnlyFixed().getKey());
break;
case "seller_enter_threshold":
cacheClient.delete(CacheKeyBuilder.KeyTemp.ENTRY_THRESHOLD.builderKeyOnlyFixed().getKey());
break;
case "seller_earnest_money":
cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_EARNEST_MONEY_CONFIG.builderKeyOnlyFixed().getKey());
break;
case "seller_penalty":
cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_PENALTY_CONFIG.builderKeyOnlyFixed().getKey());
break;
case "presale_threshold":
cacheClient.delete(CacheKeyBuilder.KeyTemp.PRESALE_THRESHOLD.builderKeyOnlyFixed().getKey());
break;
case "order_code_rule":
cacheClient.delete(CacheKeyBuilder.KeyTemp.ORDER_CODE_RULE.builderKeyOnlyFixed().getKey());
break;
case "seller_goods_fee_rate":
cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_GOODS_FEE_RATE.builderKeyOnlyFixed().getKey());
break;
case "seller_goods_platform_fee":
cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_GOODS_PLATFORM_FEE.builderKeyOnlyFixed().getKey());
break;
case "buyer_order_fee":
cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_ORDER_FEE.builderKeyOnlyFixed().getKey());
break;
case "buyer_overseas_order_cut_policy":
cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_ORDER_CUT_POLICY.builderKeyOnlyFixed().getKey());
break;
case "seller_goods_price_limit":
cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_SALE_PRICE_LIMIT.builderKeyOnlyFixed().getKey());
break;
case "depositFee":
cacheClient.delete(CacheKeyBuilder.KeyTemp.DEPOSIT_PLATFORM_FEE.builderKeyOnlyFixed().getKey());
break;
case "buyer_bid_config":
cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_BID_CONFIG.builderKeyOnlyFixed().getKey());
break;
case "seller_bid_goods_fee_rate":
cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_BID_GOODS_FEE_RATE.builderKeyOnlyFixed().getKey());
break;
case "buyer_order_violation_penalty":
cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_ORDER_VIOLATION_PENALTY.builderKeyOnlyFixed().getKey());
break;
}
}
}
... ...
... ... @@ -1001,4 +1001,17 @@ public class ProductController {
ProductDetailResp resp = productService.queryProductDetail3ById(productId);
return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build();
}
@ApiOperation(name = "ufo.product.sizeImage", desc = "查询尺码图片")
@RequestMapping(params = "method=ufo.product.sizeImage")
public ApiResponse getSizeImage(@RequestParam(value = "product_id") Integer productId) {
if (null == productId) {
LOG.info("in method=ufo.product.sizeImage product_id Is Null or empty");
return new ApiResponse(400, "product_id Is Null or empty", null);
}
LOG.info("in method=ufo.product.sizeImage product_id is {}", productId);
String result =productService.getSizeImage(productId);
return new ApiResponse.ApiResponseBuilder().code(200).data(result).message("getSizeImage success").build();
}
}
\ No newline at end of file
... ...
... ... @@ -362,9 +362,11 @@ public class ProductSearchController {
@RequestParam(value = "gender", required = false)String gender,
@RequestParam(value = "brand", required = false) String brand,
@RequestParam(value = "size", required = false) String size,
@RequestParam(value = "price", required = false) String price) {
@RequestParam(value = "price", required = false) String price,
@RequestParam(value = "maxSot", required = false) String maxSort,
@RequestParam(value = "order", required = false) String order) {
ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page).setPreSaleFlag(preSaleFlag).setBusinessClient(businessClient)
.setPool(productPool).setGender(gender).setBrand(brand).setSize(size).setPrice(price);
.setPool(productPool).setGender(gender).setBrand(brand).setSize(size).setPrice(price).setMaxSort(maxSort).setOrder(order);
LOG.info("in method=ufo.product.search.secondhand.skupList req={}", req);
JSONObject resp = productSearchService.searchSecondhandSkupList(req);
return new ApiResponse.ApiResponseBuilder().code(200).message("secondhand skupList.").data(resp).build();
... ... @@ -380,9 +382,10 @@ public class ProductSearchController {
@RequestParam(value = "business_client", required = false) String businessClient,
@RequestParam(value = "brand", required = false) String brand,
@RequestParam(value = "size", required = false) String size,
@RequestParam(value = "price", required = false) String price) {
@RequestParam(value = "price", required = false) String price,
@RequestParam(value = "maxSort", required = false) String maxSort) {
ProductSearchReq req = new ProductSearchReq().setPreSaleFlag(preSaleFlag).setBusinessClient(businessClient).setPool(productPool)
.setGender(gender).setBrand(brand).setSize(size).setPrice(price);
.setGender(gender).setBrand(brand).setSize(size).setPrice(price).setMaxSort(maxSort);
LOG.info("in method=ufo.product.search.secondhand.skupList req={}", req);
SearchProductListFilterResp resp = productSearchService.searchSecondhandSkupListFilter(req);
return new ApiResponse.ApiResponseBuilder().code(200).message("secondhand skupList filter.").data(resp).build();
... ...
... ... @@ -154,4 +154,6 @@ public interface ProductService {
* @return
*/
ProductDetailResp queryProductDetail3ById(Integer productId);
String getSizeImage(Integer productId);
}
... ...
... ... @@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
... ... @@ -187,4 +189,20 @@ public class ProductHelpService {
}
return cache;
}
/**
* 商品维护设置各种库存的最低价或者最高价
* @param goodsSizes
* @param mapper 获取库存类型的价格
* @param consumer
* @return
*/
public ProductHelpService setSkupLeastPrice(List<GoodsSize> goodsSizes, Function<GoodsSize, BigDecimal> mapper, Consumer<BigDecimal> consumer) {
List<BigDecimal> leastPriceList = goodsSizes.stream().map(mapper).filter(Objects::nonNull).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(leastPriceList)) {
BigDecimal leastPrice = leastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get();
consumer.accept(leastPrice);
}
return this;
}
}
... ...
... ... @@ -560,12 +560,30 @@ public class ProductSearchServiceImpl implements ProductSearchService {
if (filterData != null) {
List<FilterItem> filterItems = new ArrayList<>();
if (!CollectionUtils.isEmpty(filterData.getJSONArray("maxSort"))) {
JSONArray preSaleFlagArray = filterData.getJSONArray("maxSort");
FilterItem preSaleFlagFilterItem = new FilterItem();
preSaleFlagFilterItem.setFilterId("maxSort");
preSaleFlagFilterItem.setFilterName("品类");
preSaleFlagFilterItem.setMultiSelect(true);
List<FilterItem.Item> itemList = new ArrayList<>();
for (Object sort : preSaleFlagArray) {
FilterItem.Item item = new FilterItem.Item();
item.setItemName(((JSONObject)sort).getString("sort_name"));
item.setItemId(((JSONObject)sort).getString("id"));
itemList.add(item);
}
preSaleFlagFilterItem.setItemList(itemList);
filterItems.add(preSaleFlagFilterItem);
}
if (!CollectionUtils.isEmpty(filterData.getJSONArray("preSaleFlag"))) {
JSONArray preSaleFlagArray = filterData.getJSONArray("preSaleFlag");
FilterItem preSaleFlagFilterItem = new FilterItem();
preSaleFlagFilterItem.setFilterId("preSaleFlag");
preSaleFlagFilterItem.setFilterName("新旧程度");
preSaleFlagFilterItem.setMultiSelect(false);
preSaleFlagFilterItem.setMultiSelect(true);
List<FilterItem.Item> itemList = new ArrayList<>();
for (Object sort : preSaleFlagArray) {
... ... @@ -601,7 +619,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
FilterItem sizeFilterItem = new FilterItem();
sizeFilterItem.setFilterId("size");
sizeFilterItem.setFilterName("尺码");
sizeFilterItem.setMultiSelect(false);
sizeFilterItem.setMultiSelect(true);
List<FilterItem.Item> itemList = new ArrayList<>();
for (Object size : sizeArray) {
... ... @@ -643,7 +661,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
FilterItem brandFilterItem = new FilterItem();
brandFilterItem.setFilterId("brand");
brandFilterItem.setFilterName("品牌");
brandFilterItem.setMultiSelect(false);
brandFilterItem.setMultiSelect(true);
List<FilterItem.Item> itemList = new ArrayList<>();
String brandLogo;
... ...
package com.yohoufo.product.service.impl;
import java.math.BigDecimal;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yohobuy.ufo.model.request.product.ProductRequestBo;
import com.yohobuy.ufo.model.response.StorageCheckResp;
import com.yohobuy.ufo.model.response.store.StoreInfoBo;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.constant.BusinessClientEnum;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.utils.OrikaUtils;
import com.yohoufo.dal.product.*;
import com.yohoufo.dal.product.model.*;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
... ... @@ -28,14 +28,14 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.util.CollectionUtils;
import org.springframework.web.servlet.ModelAndView;
import com.yohobuy.ufo.model.enums.StorageCheckEnum;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.google.common.collect.Lists;
import com.yoho.core.common.helpers.ImagesHelper;
import com.yoho.core.config.ConfigReader;
... ... @@ -45,15 +45,65 @@ import com.yohobuy.ufo.model.GoodsBO;
import com.yohobuy.ufo.model.GoodsImageBO;
import com.yohobuy.ufo.model.GoodsSize;
import com.yohobuy.ufo.model.ProductInfo;
import com.yohobuy.ufo.model.enums.StorageCheckEnum;
import com.yohobuy.ufo.model.request.StoragePriceBo;
import com.yohobuy.ufo.model.request.product.PriceTrendBO;
import com.yohobuy.ufo.model.request.product.ProductRequestBo;
import com.yohobuy.ufo.model.response.ProductDetailResp;
import com.yohobuy.ufo.model.response.StorageCheckResp;
import com.yohobuy.ufo.model.response.StorageDataResp;
import com.yohobuy.ufo.model.response.StorageInfoResp;
import com.yohobuy.ufo.model.response.store.StoreInfoBo;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.caller.UfoServiceCaller;
import com.yohoufo.common.constant.BusinessClientEnum;
import com.yohoufo.common.helper.ImageUrlAssist;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.common.utils.OrikaUtils;
import com.yohoufo.common.utils.UfoStringUtils;
import com.yohobuy.ufo.model.request.product.PriceTrendBO;
import com.yohoufo.dal.product.BrandMapper;
import com.yohoufo.dal.product.BrandSeriesMapper;
import com.yohoufo.dal.product.GoodsImagesMapper;
import com.yohoufo.dal.product.GoodsMapper;
import com.yohoufo.dal.product.PriceTrendDayMapper;
import com.yohoufo.dal.product.PriceTrendMonthMapper;
import com.yohoufo.dal.product.ProductLimitSaleMapper;
import com.yohoufo.dal.product.ProductMapper;
import com.yohoufo.dal.product.ProductProfitMapper;
import com.yohoufo.dal.product.ProductSalesMapper;
import com.yohoufo.dal.product.ProductSortMapper;
import com.yohoufo.dal.product.SaleCategoryMapper;
import com.yohoufo.dal.product.SecondhandFlawMapper;
import com.yohoufo.dal.product.SecondhandImagesMapper;
import com.yohoufo.dal.product.SecondhandInfoMapper;
import com.yohoufo.dal.product.SelfSizeMapper;
import com.yohoufo.dal.product.SelfSizeUidMapper;
import com.yohoufo.dal.product.SizeMapper;
import com.yohoufo.dal.product.SizePoolDetailMapper;
import com.yohoufo.dal.product.SizePoolMapper;
import com.yohoufo.dal.product.StorageMapper;
import com.yohoufo.dal.product.StoragePriceMapper;
import com.yohoufo.dal.product.model.Brand;
import com.yohoufo.dal.product.model.BrandSeries;
import com.yohoufo.dal.product.model.Goods;
import com.yohoufo.dal.product.model.GoodsImages;
import com.yohoufo.dal.product.model.PriceTrendModel;
import com.yohoufo.dal.product.model.Product;
import com.yohoufo.dal.product.model.ProductLimitSale;
import com.yohoufo.dal.product.model.ProductProfit;
import com.yohoufo.dal.product.model.ProductSales;
import com.yohoufo.dal.product.model.ProductSort;
import com.yohoufo.dal.product.model.SaleCategory;
import com.yohoufo.dal.product.model.SecondhandFlaw;
import com.yohoufo.dal.product.model.SecondhandImages;
import com.yohoufo.dal.product.model.SecondhandInfo;
import com.yohoufo.dal.product.model.SelfSize;
import com.yohoufo.dal.product.model.SelfSizeUid;
import com.yohoufo.dal.product.model.Size;
import com.yohoufo.dal.product.model.SizePool;
import com.yohoufo.dal.product.model.SizePoolDetail;
import com.yohoufo.dal.product.model.Storage;
import com.yohoufo.dal.product.model.StoragePrice;
import com.yohoufo.product.model.ProductSeriesTemplate;
import com.yohoufo.product.model.ProductSortTemplate;
import com.yohoufo.product.model.SkupDetailForScreenInfo;
... ... @@ -68,7 +118,6 @@ import com.yohoufo.product.response.SkupDetailForScreenResp;
import com.yohoufo.product.response.StorageLeastPriceResp;
import com.yohoufo.product.service.ProductSearchService;
import com.yohoufo.product.service.ProductService;
import com.yohoufo.dal.product.model.Size;
@Service
... ... @@ -165,26 +214,25 @@ public class ProductServiceImpl implements ProductService {
@Autowired
private BidProductService bidProductService;
@Autowired
private SizePoolMapper sizePoolMapper;
@Autowired
private SizePoolDetailMapper sizePoolDetailMapper;
@Override
public ProductDetailResp queryProductDetailById(Integer productId) {
ProductDetailResp productDetailResp = new ProductDetailResp();
Product product = productMapper.selectByPrimaryKey(productId);
Product product = productHelpService.selectByIdCache(productId);
if (product != null) {
ProductInfo productInfo = new ProductInfo();
productInfo.setProductId(product.getId());
productInfo.setProductName(product.getProductName());
productInfo.setProductCode(product.getProductCode());
productInfo.setMaxSortId(product.getMaxSortId());
productInfo.setMaxPrice(product.getMaxPrice());
productInfo.setMinPrice(product.getMinPrice());
productInfo.setShelveStatus(product.getShelveStatus());
productInfo.setGender(productHelpService.getGenderName(product.getGender()));
productInfo.setSaleTime((product.getSaleTime() == null || product.getSaleTime().equals(0)) ? "0" : DateUtil.getDateString(product.getSaleTime(), DateUtil.YYYY_MM_DD_DOT));
productInfo.setOfferPrice(product.getOfferPrice());
setBrand(productInfo, product.getBrandId());
setSeries(productInfo, product.getSeriesId());
productInfo.setLeastPrice(null);
productInfo.setProductId(product.getId()).setProductName(product.getProductName()).setProductCode(product.getProductCode())
.setMaxSortId(product.getMaxSortId()).setMaxPrice(product.getMaxPrice()).setMinPrice(product.getMinPrice()).setLeastPrice(null)
.setShelveStatus(product.getShelveStatus()).setGender(productHelpService.getGenderName(product.getGender())).setOfferPrice(product.getOfferPrice())
.setSaleTime((product.getSaleTime() == null || product.getSaleTime().equals(0)) ? "0" : DateUtil.getDateString(product.getSaleTime(), DateUtil.YYYY_MM_DD_DOT));
productHelpService.setBrand(productInfo, product.getBrandId()).setSeries(productInfo, product.getSeriesId());
List<GoodsBO> goodsBOList = getGoodsList(product.getId(), product.getMinPrice(), product.getMaxPrice());
if (!CollectionUtils.isEmpty(goodsBOList) && goodsBOList.get(0) != null) {
... ... @@ -195,46 +243,13 @@ public class ProductServiceImpl implements ProductService {
// 设置求购信息
bidProductService.setBidStroagePrice(goodsSizes, productId, false);
List<BigDecimal> leastPriceList = goodsSizes.stream().map(GoodsSize::getLeastPrice).filter(Objects::nonNull).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(leastPriceList)) {
BigDecimal leastPrice = leastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get();
productInfo.setLeastPrice(leastPrice);
}
List<BigDecimal> preSaleLeastPriceList = goodsSizes.stream().map(GoodsSize::getPreSaleLeastPrice).filter(Objects::nonNull).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(preSaleLeastPriceList)) {
BigDecimal preSaleLeastPrice = preSaleLeastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get();
productInfo.setPreSaleLeastPrice(preSaleLeastPrice);
}
List<BigDecimal> secondHandLeastPriceList = goodsSizes.stream().map(GoodsSize::getSecondHandLeastPrice).filter(Objects::nonNull).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(secondHandLeastPriceList)) {
BigDecimal secondHandLeastPrice = secondHandLeastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get();
productInfo.setSecondHandLeastPrice(secondHandLeastPrice);
}
List<BigDecimal> hkLeastPriceList = goodsSizes.stream().map(GoodsSize::getHkLeastPrice).filter(Objects::nonNull).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(hkLeastPriceList)) {
BigDecimal hkLeastPrice = hkLeastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get();
productInfo.setHkLeastPrice(hkLeastPrice);
}
List<BigDecimal> flashLeastPriceList = goodsSizes.stream().map(GoodsSize::getFlashLeastPrice).filter(Objects::nonNull).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(flashLeastPriceList)) {
BigDecimal flashLeastPrice = flashLeastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get();
productInfo.setFlashLeastPrice(flashLeastPrice);
}
List<BigDecimal> quickDeliveryLeastPriceList = goodsSizes.stream().map(GoodsSize::getQuickDeliveryPrice).filter(Objects::nonNull).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(quickDeliveryLeastPriceList)) {
BigDecimal quickDeliveryLeastPrice = quickDeliveryLeastPriceList.stream().min((p1, p2) -> (p1.compareTo(p2))).get();
productInfo.setQuickDeliveryPrice(quickDeliveryLeastPrice);
}
List<BigDecimal> bidMosterPriceList = goodsSizes.stream().map(GoodsSize::getBidMosterPrice).filter(Objects::nonNull).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(bidMosterPriceList)) {
BigDecimal bidMosterPrice = bidMosterPriceList.stream().max((p1, p2) -> (p1.compareTo(p2))).get();
productInfo.setMosterPrice(bidMosterPrice);
}
productHelpService.setSkupLeastPrice(goodsSizes, GoodsSize::getLeastPrice, productInfo::setLeastPrice)
.setSkupLeastPrice(goodsSizes, GoodsSize::getPreSaleLeastPrice, productInfo::setPreSaleLeastPrice)
.setSkupLeastPrice(goodsSizes, GoodsSize::getSecondHandLeastPrice, productInfo::setSecondHandLeastPrice)
.setSkupLeastPrice(goodsSizes, GoodsSize::getHkLeastPrice, productInfo::setHkLeastPrice)
.setSkupLeastPrice(goodsSizes, GoodsSize::getFlashLeastPrice, productInfo::setFlashLeastPrice)
.setSkupLeastPrice(goodsSizes, GoodsSize::getQuickDeliveryPrice, productInfo::setQuickDeliveryPrice)
.setSkupLeastPrice(goodsSizes, GoodsSize::getBidMosterPrice, productInfo::setMosterPrice);
goodsSizes.sort(Comparator.comparing(GoodsSize::getOrderBy));
List<JSONObject> otherAddSizeList = getOtherSizeList(product.getMaxSortId(), product.getMidSortId(), goodsSizes);
... ... @@ -1941,6 +1956,30 @@ public class ProductServiceImpl implements ProductService {
}
@Override
public String getSizeImage(Integer productId) {
Product product = productMapper.selectByPrimaryKey(productId);
if(null == product) {
return StringUtils.EMPTY;
}
List<SizePoolDetail> list = sizePoolDetailMapper.queryByProductId(productId);
if(CollectionUtils.isEmpty(list)) {
list = sizePoolDetailMapper.queryByBrandId(product.getBrandId());
}
if(CollectionUtils.isEmpty(list)) {
return StringUtils.EMPTY;
}
List<Integer> poolIdList = list.stream().map(SizePoolDetail::getSizePoolId).collect(Collectors.toList());
SizePool pool = sizePoolMapper.querySizePoolByIds(poolIdList);
if(null == pool) {
return StringUtils.EMPTY;
}
return pool.getImageUrl();
}
private List<Integer> buildSizeIdList(String[] sizeIdArr){
List<Integer> sizeIdList = Lists.newArrayList();
for(int i=0; i<sizeIdArr.length; i++) {
... ...
商品服务、订单服务、用户服务、资源位服务、促销优惠券服务等功能
### web.xml中的配置
#### `spring active profile` 配置
... ...
... ... @@ -51,6 +51,8 @@ datasources:
- com.yohoufo.dal.product.ProductProfitMapper
- com.yohoufo.dal.product.ProductPoolDetailMapper
- com.yohoufo.dal.product.BidStoragePriceMapper
- com.yohoufo.dal.product.SizePoolMapper
- com.yohoufo.dal.product.SizePoolDetailMapper
ufo_order:
... ...
... ... @@ -53,6 +53,8 @@ datasources:
- com.yohoufo.dal.product.ProductProfitMapper
- com.yohoufo.dal.product.ProductPoolDetailMapper
- com.yohoufo.dal.product.BidStoragePriceMapper
- com.yohoufo.dal.product.SizePoolMapper
- com.yohoufo.dal.product.SizePoolDetailMapper
ufo_order:
username: ${jdbc.mysql.cobar.username}
... ...