1.数据报表导出cpu拉高问题修复
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.ysk.cashier.dto.ShopSummaryDto;
|
||||
import cn.ysk.cashier.dto.shop.ShopTableSeleInfoDto;
|
||||
import cn.ysk.cashier.enums.PayTypeEnum;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbOrderInfoMapper;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopUserFlowService;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopTable;
|
||||
import cn.ysk.cashier.repository.ShopUserDutyDetailRepository;
|
||||
@@ -39,6 +40,7 @@ import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -68,6 +70,7 @@ public class SummaryServiceImpl implements SummaryService {
|
||||
|
||||
@Resource
|
||||
TbShopAreaRepository tbShopAreaRepository;
|
||||
private final TbOrderInfoMapper orderInfoMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -407,13 +410,12 @@ public class SummaryServiceImpl implements SummaryService {
|
||||
|
||||
@Override
|
||||
public void download(ShopSummaryDto summaryDto, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
// ConcurrentLinkedQueue<Map<String, Object>> list = new ConcurrentLinkedQueue();
|
||||
// List<Map<String, Object>> list = new ArrayList<>();
|
||||
ConcurrentLinkedQueue<Map<String, Object>> list = new ConcurrentLinkedQueue();
|
||||
if(StringUtils.isBlank(summaryDto.getCateId())){
|
||||
summaryDto.setCateId(null);
|
||||
}
|
||||
|
||||
ArrayList<Integer> mergeRowIndex = new ArrayList<>();
|
||||
List<Integer> mergeRowIndex = Collections.synchronizedList(new ArrayList<>());
|
||||
if (summaryDto.getType() != null && summaryDto.getType() == 1) {//金额
|
||||
Long start = 1704038400000L;
|
||||
Long end = Instant.now().toEpochMilli();
|
||||
@@ -439,9 +441,35 @@ public class SummaryServiceImpl implements SummaryService {
|
||||
}
|
||||
List<TbOrderSalesCountByDayVo> tbOrderSalesCountByDayVos = detailRepository
|
||||
.queryTbOrderSalesCountByDay(Integer.valueOf(summaryDto.getShopId()),summaryDto.getCateId(),summaryDto.getProName(), summaryDto.getStartTime(), summaryDto.getEndTime());
|
||||
tbOrderSalesCountByDayVos.forEach(all -> {
|
||||
List<TbOrderSaleVO> tbOrderSaleVOS = detailRepository.querySaleOrderInfo(new Timestamp(summaryDto.getStartTime().getTime()),
|
||||
new Timestamp(summaryDto.getEndTime().getTime()), all.getProductId(), all.getProductSkuId(), Integer.valueOf(summaryDto.getShopId()));
|
||||
|
||||
ArrayList<Integer> skuIds = new ArrayList<>();
|
||||
for (TbOrderSalesCountByDayVo tbOrderSalesCountByDayVo : tbOrderSalesCountByDayVos) {
|
||||
if (tbOrderSalesCountByDayVo.getProductSkuId() != null) {
|
||||
skuIds.add(tbOrderSalesCountByDayVo.getProductSkuId());
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, List<TbOrderSaleVO>> saleOrderMap = new HashMap<>();
|
||||
if (!skuIds.isEmpty()) {
|
||||
List<TbOrderSaleVO> tbOrderSaleVOS = orderInfoMapper.selectAllSaleInfo(new Timestamp(summaryDto.getStartTime().getTime()),
|
||||
new Timestamp(summaryDto.getEndTime().getTime()), skuIds, Integer.valueOf(summaryDto.getShopId()));
|
||||
|
||||
for (TbOrderSaleVO tbOrderSaleVO : tbOrderSaleVOS) {
|
||||
List<TbOrderSaleVO> orderSaleVOS = saleOrderMap.get(tbOrderSaleVO.getSkuId().toString());
|
||||
if (orderSaleVOS == null) {
|
||||
orderSaleVOS = new ArrayList<>();
|
||||
}
|
||||
orderSaleVOS.add(tbOrderSaleVO);
|
||||
|
||||
saleOrderMap.put(tbOrderSaleVO.getSkuId().toString(), orderSaleVOS);
|
||||
}
|
||||
}
|
||||
|
||||
tbOrderSalesCountByDayVos.parallelStream().forEach(all -> {
|
||||
List<TbOrderSaleVO> tbOrderSaleVOS = saleOrderMap.get(all.getProductSkuId().toString());
|
||||
if (tbOrderSaleVOS == null) {
|
||||
return;
|
||||
}
|
||||
for (TbOrderSaleVO tbOrderSaleVO : tbOrderSaleVOS) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("商品分类", all.getCateName());
|
||||
|
||||
Reference in New Issue
Block a user