From 2a6c54ba474c38be1bac4a43a22b953ccc6d7b14 Mon Sep 17 00:00:00 2001 From: yijiegong Date: Thu, 22 Aug 2024 16:20:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=8C=E5=8F=B0=E7=BB=9F=E8=AE=A1=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=94=B6=E9=93=B6=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/shop/SummaryController.java | 9 ++---- ...InfoDto.java => ShopTableSaleInfoDto.java} | 2 +- .../ysk/cashier/service/SummaryService.java | 4 +-- .../service/impl/SummaryServiceImpl.java | 29 +++++++++---------- 4 files changed, 20 insertions(+), 24 deletions(-) rename eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/{ShopTableSeleInfoDto.java => ShopTableSaleInfoDto.java} (90%) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryController.java index b260c37e..e7f09c34 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryController.java @@ -2,13 +2,10 @@ package cn.ysk.cashier.controller.shop; import cn.ysk.cashier.annotation.rest.AnonymousGetMapping; import cn.ysk.cashier.annotation.rest.AnonymousPostMapping; -import cn.ysk.cashier.dto.ShopSummaryDto; -import cn.ysk.cashier.dto.shop.ShopTableSeleInfoDto; +import cn.ysk.cashier.dto.shop.ShopTableSaleInfoDto; import cn.ysk.cashier.service.SummaryService; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.format.annotation.DateTimeFormat; -import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -68,8 +65,8 @@ public class SummaryController { @PostMapping("/table/download") @AnonymousPostMapping - private void downloadShopSummaryTable(HttpServletResponse response, @RequestBody ShopTableSeleInfoDto exportRequest) throws IOException { - summaryService.downloadTableSeleInfo(exportRequest, response); + private void downloadShopSummaryTable(HttpServletResponse response, @RequestBody ShopTableSaleInfoDto exportRequest) throws IOException { + summaryService.downloadTableSaleInfo(exportRequest, response); } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/ShopTableSeleInfoDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/ShopTableSaleInfoDto.java similarity index 90% rename from eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/ShopTableSeleInfoDto.java rename to eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/ShopTableSaleInfoDto.java index 329d1adf..21e74cac 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/ShopTableSeleInfoDto.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/ShopTableSaleInfoDto.java @@ -9,7 +9,7 @@ import java.util.Date; * @author GYJ */ @Data -public class ShopTableSeleInfoDto { +public class ShopTableSaleInfoDto { private Integer shopId; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/SummaryService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/SummaryService.java index 9c0cd5f1..61615be7 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/SummaryService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/SummaryService.java @@ -1,7 +1,7 @@ package cn.ysk.cashier.service; import cn.ysk.cashier.dto.ShopSummaryDto; -import cn.ysk.cashier.dto.shop.ShopTableSeleInfoDto; +import cn.ysk.cashier.dto.shop.ShopTableSaleInfoDto; import cn.ysk.cashier.vo.ShopTableSaleInfoVo; import cn.ysk.cashier.vo.SummaryVO; import cn.ysk.cashier.vo.TbOrderPayCountVo; @@ -41,5 +41,5 @@ public interface SummaryService { List selectSummaryTable(Integer shopId, Date startTime, Date endTime); - void downloadTableSeleInfo(ShopTableSeleInfoDto shopTableSeleInfoDto, HttpServletResponse response) throws IOException; + void downloadTableSaleInfo(ShopTableSaleInfoDto shopTableSaleInfoDto, HttpServletResponse response) throws IOException; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/SummaryServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/SummaryServiceImpl.java index 7be6de7e..e6c3a59e 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/SummaryServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/SummaryServiceImpl.java @@ -1,7 +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.dto.shop.ShopTableSaleInfoDto; import cn.ysk.cashier.enums.PayTypeEnum; import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.mybatis.service.TbShopUserFlowService; @@ -15,8 +15,6 @@ import cn.ysk.cashier.service.SummaryService; import cn.ysk.cashier.utils.DateUtil; import cn.ysk.cashier.utils.FileUtil; import cn.ysk.cashier.vo.*; -import com.alibaba.fastjson.JSONObject; -import com.beust.ah.A; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -37,7 +35,6 @@ import java.time.Instant; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.*; -import java.util.concurrent.ConcurrentLinkedQueue; import java.util.function.Function; import java.util.stream.Collectors; @@ -543,29 +540,31 @@ public class SummaryServiceImpl implements SummaryService { } @Override - public void downloadTableSeleInfo(ShopTableSeleInfoDto shopTableSeleInfoDto, HttpServletResponse response) throws IOException { - if (shopTableSeleInfoDto.getStartTime() == null) { - shopTableSeleInfoDto.setStartTime(DateUtil.toDate(DateUtil.fromTimeStamp(1704038400L))); + public void downloadTableSaleInfo(ShopTableSaleInfoDto shopTableSaleInfoDto, HttpServletResponse response) throws IOException { + if (shopTableSaleInfoDto.getStartTime() == null) { + shopTableSaleInfoDto.setStartTime(DateUtil.toDate(DateUtil.fromTimeStamp(1704038400L))); } - if (shopTableSeleInfoDto.getEndTime() == null) { - shopTableSeleInfoDto.setEndTime(new Date()); + if (shopTableSaleInfoDto.getEndTime() == null) { + shopTableSaleInfoDto.setEndTime(new Date()); } - List infoVos = selectSummaryTable(shopTableSeleInfoDto.getShopId(), shopTableSeleInfoDto.getStartTime(), shopTableSeleInfoDto.getEndTime()); + List infoVos = selectSummaryTable(shopTableSaleInfoDto.getShopId(), shopTableSaleInfoDto.getStartTime(), shopTableSaleInfoDto.getEndTime()); - List countByTables = tbOrderDetailRepository.queryTbOrderSalesCountByTable(shopTableSeleInfoDto.getShopId(), shopTableSeleInfoDto.getStartTime(), shopTableSeleInfoDto.getEndTime()); + infoVos.add(new ShopTableSaleInfoVo(99999, shopTableSaleInfoDto.getShopId(), null, "", "收银台", null, null, null, null)); + + List countByTables = tbOrderDetailRepository.queryTbOrderSalesCountByTable(shopTableSaleInfoDto.getShopId(), shopTableSaleInfoDto.getStartTime(), shopTableSaleInfoDto.getEndTime()); Map> countByTableMap = countByTables.stream() .collect(Collectors.groupingBy(TbOrderSalesCountByTable::getTableId)); - // 比较 shopTableSeleInfoDto 的 startTime 和 endTime 是不是同一天 - boolean sameDay = cn.hutool.core.date.DateUtil.isSameDay(shopTableSeleInfoDto.getStartTime(), shopTableSeleInfoDto.getEndTime()); + // 比较 shopTableSaleInfoDto 的 startTime 和 endTime 是不是同一天 + boolean sameDay = cn.hutool.core.date.DateUtil.isSameDay(shopTableSaleInfoDto.getStartTime(), shopTableSaleInfoDto.getEndTime()); - String queryDate = cn.hutool.core.date.DateUtil.format(shopTableSeleInfoDto.getStartTime(), "yyyy-MM-dd"); + String queryDate = cn.hutool.core.date.DateUtil.format(shopTableSaleInfoDto.getStartTime(), "yyyy-MM-dd"); if (!sameDay) { - queryDate += " 至 " + cn.hutool.core.date.DateUtil.format(shopTableSeleInfoDto.getEndTime(), "yyyy-MM-dd"); + queryDate += " 至 " + cn.hutool.core.date.DateUtil.format(shopTableSaleInfoDto.getEndTime(), "yyyy-MM-dd"); } List> list = new ArrayList<>();