master:系统调优;
parent
68b05b7063
commit
b9530d76f6
|
|
@ -337,7 +337,8 @@ public class GtAndFhbBizController extends BaseController {
|
|||
// 获取GT匹配的商品sku列表
|
||||
List<GtProdSkuVO> gtMatchSkuList = this.getGtFirstSku(multiSaleSameGoMap, gtSaleGroupMap, storeProd.getProdArtNum());
|
||||
// 当前货号在GT的所有尺码,作为标准尺码
|
||||
List<Integer> gtStandardSizeList = gtMatchSkuList.stream().map(GtProdSkuVO::getSize).collect(Collectors.toList());
|
||||
List<Integer> gtStandardSizeList = gtMatchSkuList.stream().map(sku -> (int) Math.floor(Double.parseDouble(sku.getSize())))
|
||||
.collect(Collectors.toList());
|
||||
// 先获取最低价格,然后给所有颜色和尺码添加初始值,之后再来单独改,这是最方便的方式了
|
||||
final BigDecimal minPrice = gtMatchSkuList.stream().map(GtProdSkuVO::getPrice).min(Comparator.comparing(x -> x))
|
||||
.orElseThrow(() -> new ServiceException("没有GT商品价格!", HttpStatus.ERROR));
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -47,11 +48,16 @@ public class GtController extends BaseController {
|
|||
// 先从redis中获取列表数据
|
||||
List<GtProdSkuVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_GT_SALE_BASIC_KEY + userId), new ArrayList<>());
|
||||
artNoList.forEach(artNoInfo -> {
|
||||
artNoInfo.getSkus().forEach(x -> x.setColor(this.decodeUnicode(x.getColor())).setCharacters(artNoInfo.getCharacters())
|
||||
.setArticle_number(artNoInfo.getArticle_number()).setProduct_id(artNoInfo.getId()).setCategory_nid(artNoInfo.getCategory_nid()));
|
||||
cacheList.addAll(artNoInfo.getSkus());
|
||||
});
|
||||
// 三年前的时间
|
||||
Date threeYearsBefore = java.sql.Date.valueOf(LocalDate.now().minusYears(3));
|
||||
artNoList
|
||||
// 只处理近3年商品
|
||||
.stream().filter(x -> x.getCreate_time().after(threeYearsBefore) || x.getUpdate_time().after(threeYearsBefore))
|
||||
.forEach(artNoInfo -> {
|
||||
artNoInfo.getSkus().forEach(x -> x.setColor(this.decodeUnicode(x.getColor())).setCharacters(artNoInfo.getCharacters())
|
||||
.setArticle_number(artNoInfo.getArticle_number()).setProduct_id(artNoInfo.getId()).setCategory_nid(artNoInfo.getCategory_nid()));
|
||||
cacheList.addAll(artNoInfo.getSkus());
|
||||
});
|
||||
// 存到redis中
|
||||
redisCache.setCacheObject(CacheConstants.MIGRATION_GT_SALE_BASIC_KEY + userId, cacheList);
|
||||
return R.ok();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class GtProdSkuVO {
|
|||
private String article_number;
|
||||
private Integer category_nid;
|
||||
private String color;
|
||||
private Integer size;
|
||||
private String size;
|
||||
private String characters;
|
||||
private BigDecimal weight;
|
||||
private BigDecimal price;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.web.controller.xkt.migartion.vo.gt;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -25,6 +26,8 @@ public class GtProdVO {
|
|||
private Integer category_nid;
|
||||
private String article_number;
|
||||
private String characters;
|
||||
private Date create_time;
|
||||
private Date update_time;
|
||||
private List<GtProdSkuVO> skus;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue