桌台统计--导出
This commit is contained in:
parent
fd8cc67578
commit
11db8451d9
|
|
@ -1,17 +1,19 @@
|
|||
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.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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
|
@ -23,44 +25,49 @@ import java.util.Date;
|
|||
public class SummaryController {
|
||||
@Resource
|
||||
private SummaryService summaryService;
|
||||
|
||||
@GetMapping
|
||||
private Object shopSummary(@RequestParam Integer shopId){
|
||||
private Object shopSummary(@RequestParam Integer shopId) {
|
||||
return summaryService.selectSummary(shopId);
|
||||
}
|
||||
|
||||
@GetMapping("/date")
|
||||
private Object shopSummaryDate(@RequestParam Integer shopId,@RequestParam Integer day){
|
||||
return summaryService.selectSummaryDate(shopId,day);
|
||||
private Object shopSummaryDate(@RequestParam Integer shopId, @RequestParam Integer day) {
|
||||
return summaryService.selectSummaryDate(shopId, day);
|
||||
}
|
||||
|
||||
@GetMapping("/today")
|
||||
private Object shopSummaryDate(@RequestParam Integer shopId){
|
||||
private Object shopSummaryDate(@RequestParam Integer shopId) {
|
||||
return summaryService.selectSummaryToday(shopId);
|
||||
}
|
||||
|
||||
@GetMapping("/dateAmount")
|
||||
private Object shopSummaryAmount(@RequestParam Integer shopId,@RequestParam Integer day){
|
||||
return summaryService.selectSummaryAmount(shopId,day);
|
||||
private Object shopSummaryAmount(@RequestParam Integer shopId, @RequestParam Integer day) {
|
||||
return summaryService.selectSummaryAmount(shopId, day);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/dateProduct")
|
||||
private Object shopSummaryProduct(@RequestParam Integer shopId,@RequestParam Integer day,
|
||||
@RequestParam Integer page, @RequestParam Integer size){
|
||||
return summaryService.selectSummaryProduct(shopId,day,page,size);
|
||||
private Object shopSummaryProduct(@RequestParam Integer shopId, @RequestParam Integer day,
|
||||
@RequestParam Integer page, @RequestParam Integer size) {
|
||||
return summaryService.selectSummaryProduct(shopId, day, page, size);
|
||||
}
|
||||
|
||||
@GetMapping("/datePayType")
|
||||
private Object shopSummaryPayType(@RequestParam Integer shopId,@RequestParam Integer day){
|
||||
return summaryService.selectSummaryPayType(shopId,day);
|
||||
private Object shopSummaryPayType(@RequestParam Integer shopId, @RequestParam Integer day) {
|
||||
return summaryService.selectSummaryPayType(shopId, day);
|
||||
}
|
||||
|
||||
@GetMapping("/table")
|
||||
@AnonymousGetMapping
|
||||
private Object shopSummaryTable(@RequestParam Integer shopId,
|
||||
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
|
||||
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime){
|
||||
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) {
|
||||
return summaryService.selectSummaryTable(shopId, startTime, endTime);
|
||||
}
|
||||
|
||||
@PostMapping("/table/download")
|
||||
private void downloadShopSummaryTable(HttpServletResponse response, @RequestBody ShopTableSeleInfoDto exportRequest) throws IOException {
|
||||
summaryService.downloadTableSeleInfo(exportRequest, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package cn.ysk.cashier.dto.shop;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
@Data
|
||||
public class ShopTableSeleInfoDto {
|
||||
private Integer shopId;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue