|
@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Optional;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -90,8 +91,16 @@ public class GoodsDonController {
|
|
|
.build());
|
|
.build());
|
|
|
DateTime now = DateTime.now();
|
|
DateTime now = DateTime.now();
|
|
|
Integer randomNum = 2000;
|
|
Integer randomNum = 2000;
|
|
|
- List<GoodsDonPopularizeView> collect = search.getDataList().stream().filter(data -> data.getPrice().compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
|
|
|
|
|
- collect.forEach(data -> {
|
|
|
|
|
|
|
+ search.getDataList().forEach(data -> {
|
|
|
|
|
+ GoodsDonSku goodsDonSku = goodsDonSkuMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSku.class)
|
|
|
|
|
+ .eq(GoodsDonSku::getGoodsId, data.getId())
|
|
|
|
|
+ .eq(GoodsDonSku::getStatus, true)
|
|
|
|
|
+ .orderByAsc(GoodsDonSku::getPrice)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ Optional.ofNullable(goodsDonSku).ifPresent(sku -> {
|
|
|
|
|
+ data.setPrice(sku.getPrice());
|
|
|
|
|
+ data.setMonths(sku.getMonths());
|
|
|
|
|
+ });
|
|
|
data.setSpecs(beanSearcher.searchFirst(GoodsDonSpec.class, MapUtils.builder().field(GoodsDonSpec::getGoodsId, data.getId()).build()));
|
|
data.setSpecs(beanSearcher.searchFirst(GoodsDonSpec.class, MapUtils.builder().field(GoodsDonSpec::getGoodsId, data.getId()).build()));
|
|
|
data.setSkuList(beanSearcher.searchAll(GoodsDonSku.class, MapUtils.builder().field(GoodsDonSku::getGoodsId, data.getId()).field(GoodsDonSku::getStatus, true).build()));
|
|
data.setSkuList(beanSearcher.searchAll(GoodsDonSku.class, MapUtils.builder().field(GoodsDonSku::getGoodsId, data.getId()).field(GoodsDonSku::getStatus, true).build()));
|
|
|
if (data.getId() != 17) {
|
|
if (data.getId() != 17) {
|
|
@@ -138,6 +147,7 @@ public class GoodsDonController {
|
|
|
notifyMsg.append("前有人购买");
|
|
notifyMsg.append("前有人购买");
|
|
|
data.setNotifyMsg(notifyMsg.toString());
|
|
data.setNotifyMsg(notifyMsg.toString());
|
|
|
});
|
|
});
|
|
|
|
|
+ List<GoodsDonPopularizeView> collect = search.getDataList().stream().filter(data -> data.getPrice().compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
|
|
|
search = new SearchResult<>(collect);
|
|
search = new SearchResult<>(collect);
|
|
|
search.setTotalCount(collect.size());
|
|
search.setTotalCount(collect.size());
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|