|
@@ -3,6 +3,7 @@ package com.sckw.order.dubbo;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.model.constant.NumberConstant;
|
|
import com.sckw.core.model.constant.NumberConstant;
|
|
@@ -26,7 +27,6 @@ import com.sckw.order.model.vo.res.AddressInfoDtoDetailRes;
|
|
|
import com.sckw.order.repository.*;
|
|
import com.sckw.order.repository.*;
|
|
|
import com.sckw.order.serivce.*;
|
|
import com.sckw.order.serivce.*;
|
|
|
import com.sckw.product.api.dubbo.GoodsInfoService;
|
|
import com.sckw.product.api.dubbo.GoodsInfoService;
|
|
|
-import com.sckw.product.api.model.GoodsDetail;
|
|
|
|
|
import com.sckw.product.api.model.GoodsDetails;
|
|
import com.sckw.product.api.model.GoodsDetails;
|
|
|
import com.sckw.redis.constant.RedisConstant;
|
|
import com.sckw.redis.constant.RedisConstant;
|
|
|
import com.sckw.redis.utils.RedissonUtils;
|
|
import com.sckw.redis.utils.RedissonUtils;
|
|
@@ -691,6 +691,7 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
|
|
|
|
|
|
|
|
private List<BigDecimal> getData(List<String> times, List<TradeSaleVo> data) {
|
|
private List<BigDecimal> getData(List<String> times, List<TradeSaleVo> data) {
|
|
|
Map<String, BigDecimal> map = data.stream().collect(Collectors.toMap(TradeSaleVo::getTimePeriod, vo -> vo.getAmount() == null ? BigDecimal.ZERO : vo.getAmount(), (a, b) -> a));
|
|
Map<String, BigDecimal> map = data.stream().collect(Collectors.toMap(TradeSaleVo::getTimePeriod, vo -> vo.getAmount() == null ? BigDecimal.ZERO : vo.getAmount(), (a, b) -> a));
|
|
|
|
|
+ log.info("map times {} {}", JSONObject.toJSONString(times), JSONObject.toJSONString(map));
|
|
|
return times.stream().map(d -> {
|
|
return times.stream().map(d -> {
|
|
|
BigDecimal bigDecimal = map.get(d);
|
|
BigDecimal bigDecimal = map.get(d);
|
|
|
if (Objects.isNull(bigDecimal)) {
|
|
if (Objects.isNull(bigDecimal)) {
|
|
@@ -710,17 +711,17 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
|
|
|
if (CollUtil.isEmpty(tradeSaleVos)) {
|
|
if (CollUtil.isEmpty(tradeSaleVos)) {
|
|
|
tradeSaleVos = new ArrayList<>();
|
|
tradeSaleVos = new ArrayList<>();
|
|
|
}
|
|
}
|
|
|
- Map<Long, GoodsDetail> goodsMap = new HashMap<>();
|
|
|
|
|
|
|
+ Map<Long, GoodsDetails> goodsMap = new HashMap<>();
|
|
|
List<Long> collect = tradeSaleVos.stream().map(TradeSaleVo::getGoodsId).distinct().toList();
|
|
List<Long> collect = tradeSaleVos.stream().map(TradeSaleVo::getGoodsId).distinct().toList();
|
|
|
for (Long aLong : collect) {
|
|
for (Long aLong : collect) {
|
|
|
- GoodsDetail detailById = goodsInfoService.getDetailById(aLong);
|
|
|
|
|
|
|
+ GoodsDetails detailById = goodsInfoService.getDetail(aLong);
|
|
|
if (Objects.nonNull(detailById)) {
|
|
if (Objects.nonNull(detailById)) {
|
|
|
goodsMap.put(aLong, detailById);
|
|
goodsMap.put(aLong, detailById);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Map<Long, List<TradeSaleVo>> collect1 = tradeSaleVos.stream().collect(Collectors.groupingBy(TradeSaleVo::getGoodsId));
|
|
Map<Long, List<TradeSaleVo>> collect1 = tradeSaleVos.stream().collect(Collectors.groupingBy(TradeSaleVo::getGoodsId));
|
|
|
-
|
|
|
|
|
|
|
+ log.info("data {}", JSONObject.toJSONString(collect1));
|
|
|
List<TimeSaleDataDto> data = new ArrayList<>();
|
|
List<TimeSaleDataDto> data = new ArrayList<>();
|
|
|
List<String> strings1 = DateUtil.generateHourRanges(countPara.getStartTime(), countPara.getEndTime());
|
|
List<String> strings1 = DateUtil.generateHourRanges(countPara.getStartTime(), countPara.getEndTime());
|
|
|
TimeSaleDto timeSaleDto = new TimeSaleDto();
|
|
TimeSaleDto timeSaleDto = new TimeSaleDto();
|
|
@@ -732,12 +733,12 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
|
|
|
Long key = map.getKey();
|
|
Long key = map.getKey();
|
|
|
List<TradeSaleVo> value = map.getValue();
|
|
List<TradeSaleVo> value = map.getValue();
|
|
|
|
|
|
|
|
- GoodsDetail goodsDetail = goodsMap.get(key);
|
|
|
|
|
|
|
+ GoodsDetails goodsDetail = goodsMap.get(key);
|
|
|
if (Objects.isNull(goodsDetail)) {
|
|
if (Objects.isNull(goodsDetail)) {
|
|
|
timeSaleDataDto.setName("-");
|
|
timeSaleDataDto.setName("-");
|
|
|
timeSaleDataDto.setData(sizeOf(strings1.size()));
|
|
timeSaleDataDto.setData(sizeOf(strings1.size()));
|
|
|
} else {
|
|
} else {
|
|
|
- timeSaleDataDto.setName(goodsDetail.getName() + goodsDetail.getSpec());
|
|
|
|
|
|
|
+ timeSaleDataDto.setName(goodsDetail.getName() + goodsDetail.getSpecLabel());
|
|
|
if (CollUtil.isEmpty(value)) {
|
|
if (CollUtil.isEmpty(value)) {
|
|
|
timeSaleDataDto.setData(sizeOf(strings1.size()));
|
|
timeSaleDataDto.setData(sizeOf(strings1.size()));
|
|
|
} else {
|
|
} else {
|