Authored by mali

求购价加上默认值

... ... @@ -233,13 +233,21 @@ public class BidProductService {
return selectMosterPCache(productId).stream().collect(Collectors.toMap(BidStoragePrice::getStorageId, Function.identity()));
}
public void setBidStroagePrice(List<GoodsSize> goodsSizes, Integer productId) {
/**
*
* @param goodsSizes
* @param productId
* @param showNoSkup 是否展示没有求购价的时候,字段值
*/
public void setBidStroagePrice(List<GoodsSize> goodsSizes, Integer productId, boolean showNoSkup) {
if (CollectionUtils.isNotEmpty(goodsSizes)) {
Map<Integer, BidStoragePrice> selectInStockLeastP = selectInStockLeastP(productId);
goodsSizes.stream().forEach(item -> {
BidStoragePrice bidStoragePrice = selectInStockLeastP.get(item.getId());
if (null != bidStoragePrice) {
item.setBidStatus(1).setBidNum(1).setBidMosterPrice(bidStoragePrice.getPrice()).setBidSkup(bidStoragePrice.getSkup());
} else if (showNoSkup){
item.setBidStatus(0).setBidNum(0).setBidMosterPrice(new BigDecimal(0)).setBidSkup(0);
}
});
}
... ...
... ... @@ -192,7 +192,7 @@ public class ProductServiceImpl implements ProductService {
if (!CollectionUtils.isEmpty(goodsSizes)) {
// 设置求购信息
bidProductService.setBidStroagePrice(goodsSizes, productId);
bidProductService.setBidStroagePrice(goodsSizes, productId, false);
List<BigDecimal> leastPriceList = goodsSizes.stream().map(GoodsSize::getLeastPrice).filter(Objects::nonNull).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(leastPriceList)) {
... ... @@ -2285,7 +2285,7 @@ public class ProductServiceImpl implements ProductService {
productHelpService.setProductLeastPrice(productInfo, goodsSizes); // 设置商品SKn的最低价
bidProductService.setBidStroagePrice(goodsSizes, productId); // 设置尺码的最高求购价
bidProductService.setBidStroagePrice(goodsSizes, productId, true); // 设置尺码的最高求购价
productHelpService.setProductMosterPrice(productInfo, goodsSizes); // 设置商品SKn的最高求购价
... ...
package com.yohoufo.resource.service.impl.resource;
import com.alibaba.fastjson.JSONObject;
import com.yohoufo.resource.helper.MakeUrlService;
import com.yohoufo.resource.service.IResourceParse;
import com.yohoufo.resource.service.Resource;
import org.springframework.stereotype.Service;
/**
* 图片列表
*/
@Service
public class ImageListResourceParse implements IResourceParse {
@javax.annotation.Resource
private MakeUrlService makeUrlService;
public JSONObject parse(Resource resource) {
JSONObject data = resource.getData();
data.put("template_id", resource.getId().toString());
data.put("template_name", "image_list");
if (null == data.getJSONObject("data") || null == data.getJSONObject("data").getJSONObject("list")) {
return data;
}
JSONObject list = data.getJSONObject("data").getJSONObject("list");
for (String key : list.keySet()) {
JSONObject value = list.getJSONObject(key);
value.put("title", value.getString("alt"));
value.put("url", makeUrlService.makeUrl(value.getJSONObject("url"), resource.getClientType()));
}
return data;
}
}
... ...