桌台统计--导出

This commit is contained in:
GYJ
2024-07-06 17:25:28 +08:00
parent fd8cc67578
commit 11db8451d9
5 changed files with 78 additions and 19 deletions

View File

@@ -1,6 +1,7 @@
package cn.ysk.cashier.service;
import cn.ysk.cashier.dto.ShopSummaryDto;
import cn.ysk.cashier.dto.shop.ShopTableSeleInfoDto;
import cn.ysk.cashier.vo.ShopTableSaleInfoVo;
import cn.ysk.cashier.vo.SummaryVO;
import cn.ysk.cashier.vo.TbOrderPayCountVo;
@@ -39,4 +40,6 @@ public interface SummaryService {
List<TbOrderPayCountVo> summaryCount(String shopId, Date startTime, Date endTime);
List<ShopTableSaleInfoVo> selectSummaryTable(Integer shopId, Date startTime, Date endTime);
void downloadTableSeleInfo(ShopTableSeleInfoDto shopTableSeleInfoDto, HttpServletResponse response) throws IOException;
}

View File

@@ -1,6 +1,7 @@
package cn.ysk.cashier.service.impl;
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.service.TbShopUserFlowService;
@@ -474,12 +475,41 @@ public class SummaryServiceImpl implements SummaryService {
@Override
public List<ShopTableSaleInfoVo> selectSummaryTable(Integer shopId, Date startTime, Date endTime) {
Long start = 1704038400000L;
Long end = Instant.now().toEpochMilli();
long start = 1704038400000L;
long end = Instant.now().toEpochMilli();
if (startTime != null && endTime != null) {
start = startTime.getTime();
end = endTime.getTime();
}
return tbOrderInfoRepository.queryShopTableSaleInfo(shopId.toString(), start, end);
}
@Override
public void downloadTableSeleInfo(ShopTableSeleInfoDto shopTableSeleInfoDto, HttpServletResponse response) throws IOException {
if (shopTableSeleInfoDto.getStartTime() == null) {
shopTableSeleInfoDto.setStartTime(DateUtil.toDate(DateUtil.fromTimeStamp(1704038400L)));
}
if (shopTableSeleInfoDto.getEndTime() == null) {
shopTableSeleInfoDto.setEndTime(new Date());
}
List<ShopTableSaleInfoVo> infoVos = selectSummaryTable(shopTableSeleInfoDto.getShopId(), shopTableSeleInfoDto.getStartTime(), shopTableSeleInfoDto.getEndTime());
List<Map<String, Object>> list = new ArrayList<>();
for (ShopTableSaleInfoVo all : infoVos) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("开始时间", shopTableSeleInfoDto.getStartTime());
map.put("结束时间", shopTableSeleInfoDto.getEndTime());
map.put("区域名称", all.getAreaName());
map.put("桌台名称", all.getTableName());
map.put("订单数量", all.getOrderCount());
map.put("销售额", all.getOrderAmount());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -220,6 +220,7 @@ public class StockServiceImpl implements StockService {
stockDetail.setShopId(sku.getShopId());
stockDetail.setSkuId(sku.getId().toString());
stockDetail.setProductId(product.getId().toString());
stockDetail.setProductName(product.getName());
stockDetail.setUnitName(shopUnit.getName());
stockDetail.setLeftNumber(0);