Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
SongZhang 2024-08-17 15:22:38 +08:00
commit 7eab45ae49
14 changed files with 175 additions and 83 deletions

View File

@ -23,9 +23,11 @@ import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter; import cn.hutool.poi.excel.ExcelWriter;
import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.exception.BadRequestException;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.streaming.SXSSFSheet; import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -37,10 +39,7 @@ import java.io.*;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
/** /**
@ -238,6 +237,51 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
IoUtil.close(out); IoUtil.close(out);
} }
public static void downloadAndMergeExcel(List<Map<String, Object>> list, List<List<Integer>> mergeData, List<String> keyList, HttpServletResponse response) throws IOException {
String tempPath = SYS_TEM_DIR + IdUtil.fastSimpleUUID() + ".xlsx";
// 创建工作簿
Workbook workbook = new XSSFWorkbook();
// 创建工作表
Sheet sheet = workbook.createSheet("Sheet1");
// 合并单元格从第 0 行第 0 列到第 0 行第 2
// sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 2));
for (List<Integer> mergeDatum : mergeData) {
sheet.addMergedRegion(new CellRangeAddress(mergeDatum.get(0), mergeDatum.get(1), mergeDatum.get(2), mergeDatum.get(3)));
}
Row row0 = sheet.createRow(0);
for (int i = 0; i < keyList.size(); i++) {
Cell cell = row0.createCell(i);
cell.setCellValue(keyList.get(i));
}
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map = list.get(i);
Row row = sheet.createRow(i + 1);
for (int j = 0; j < keyList.size(); j++) {
Cell cell = row.createCell(j);
cell.setCellValue(map.get(keyList.get(j)) == null ? "" : map.get(keyList.get(j)).toString());
}
}
// response为HttpServletResponse对象
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=file.xlsx");
try (FileOutputStream outputStream = new FileOutputStream(tempPath);
ServletOutputStream out = response.getOutputStream()) {
workbook.write(outputStream);
workbook.write(out);
} catch (IOException e) {
// 更详细的错误处理
e.printStackTrace();
// 可以考虑返回一个错误响应给客户端
}
}
/** /**
* 输入标题到excel * 输入标题到excel
* *

View File

@ -21,6 +21,7 @@ import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* @author admin * @author admin
@ -65,4 +66,6 @@ public class ViewConInfoFlowDto implements Serializable {
private String isCheck; private String isCheck;
private Date createTime;
private Date updateTime;
} }

View File

@ -42,10 +42,8 @@ public class SummaryByDayController {
} }
@GetMapping(value = "count") @GetMapping(value = "count")
public List<TbOrderPayCountVo> summaryCount(ShopSummaryDto summaryDto, public List<TbOrderPayCountVo> summaryCount(ShopSummaryDto summaryDto) {
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime, return summaryService.summaryCount(summaryDto);
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) {
return summaryService.summaryCount(summaryDto, startTime, endTime);
} }
} }

View File

@ -1,24 +1,10 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.product; package cn.ysk.cashier.dto.product;
import lombok.Data; import lombok.Data;
import javax.persistence.Column;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
/** /**

View File

@ -1,13 +1,19 @@
package cn.ysk.cashier.mybatis.entity; package cn.ysk.cashier.mybatis.entity;
import cn.ysk.cashier.utils.ListUtil;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ -23,4 +29,25 @@ public class Activate extends Model<Activate> {
private String handselType; private String handselType;
private String isDel; private String isDel;
private String isUser; private String isUser;
//是否赠送商品 0否 1是
private Integer isGiftPro;
private String productIds;
@TableField(exist = false)
private List<Integer> prodIds;
public void setProductIds(String productIds) {
this.productIds = productIds;
if(StringUtils.isNotBlank(productIds)){
prodIds=ListUtil.stringChangeIntegerList(productIds);
}
}
public void setProdIds(List<Integer> prodIds) {
this.prodIds = prodIds;
if(!CollectionUtils.isEmpty(prodIds)){
productIds="["+prodIds.stream()
.map(String::valueOf)
.collect(Collectors.joining(","))+"]";
}
}
} }

View File

@ -1,7 +1,6 @@
package cn.ysk.cashier.mybatis.mapper; package cn.ysk.cashier.mybatis.mapper;
import cn.ysk.cashier.mybatis.entity.Activate; import cn.ysk.cashier.mybatis.entity.Activate;
import cn.ysk.cashier.mybatis.entity.TbUserStorage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface ActivateMapper extends BaseMapper<Activate> { public interface ActivateMapper extends BaseMapper<Activate> {

View File

@ -27,9 +27,10 @@ public interface ShopUserMapper extends BaseMapper<TbShopUser> {
" or u.telephone like concat('%', #{param.name}, '%') or su.telephone like concat('%', #{param.name}, '%'))" + " or u.telephone like concat('%', #{param.name}, '%') or su.telephone like concat('%', #{param.name}, '%'))" +
"</if>" + "</if>" +
"<if test='isVip != null'>" + "<if test='isVip != null'>" +
"AND su.is_vip=#{isVip}" + "AND su.is_vip=#{isVip} " +
"</if>" + "</if>" +
"</where>" + "</where>" +
"order by su.created_at" +
"</script>") "</script>")
IPage<ShopUserInfoVo> queryUser(TbShopUserQueryCriteria param, Integer isVip, Page pageInfo); IPage<ShopUserInfoVo> queryUser(TbShopUserQueryCriteria param, Integer isVip, Page pageInfo);

View File

@ -1,6 +1,5 @@
package cn.ysk.cashier.mybatis.mapper; package cn.ysk.cashier.mybatis.mapper;
import cn.ysk.cashier.mybatis.entity.Activate;
import cn.ysk.cashier.pojo.order.TbCashierCart; import cn.ysk.cashier.pojo.order.TbCashierCart;
import cn.ysk.cashier.vo.CarVO; import cn.ysk.cashier.vo.CarVO;
import cn.ysk.cashier.vo.PendingCountVO; import cn.ysk.cashier.vo.PendingCountVO;

View File

@ -2,7 +2,6 @@ package cn.ysk.cashier.mybatis.rest;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
import cn.ysk.cashier.domain.QiniuContent; import cn.ysk.cashier.domain.QiniuContent;
import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.mybatis.entity.Activate; import cn.ysk.cashier.mybatis.entity.Activate;
@ -14,6 +13,7 @@ import cn.ysk.cashier.utils.SecurityUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -23,9 +23,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.io.InputStream; import java.io.InputStream;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
@Slf4j @Slf4j
@RestController @RestController
@ -50,11 +48,19 @@ public class StorageController {
} }
@PostMapping("/modityActivate") @PostMapping("/modityActivate")
public ResponseEntity<Object> modityActivate(@RequestBody Activate activate){ public ResponseEntity<Object> modityActivate(@RequestBody Activate activate){
if (activate.getIsGiftPro() != null && activate.getIsGiftPro() == 1 && CollectionUtils.isEmpty(activate.getProdIds()))
throw new BadRequestException("赠送商品不可为空");
String userName = SecurityUtils.getCurrentUsername(); String userName = SecurityUtils.getCurrentUsername();
shopService.modityActivate(activate); shopService.modityActivate(activate);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@GetMapping("/activate/{activateId}")
@ApiOperation("查询活动赠送商品")
public ResponseEntity<Object> queryActivatePros(@PathVariable("activateId") Integer activateId){
return new ResponseEntity<>(shopService.findActivatePros(activateId),HttpStatus.OK);
}
/** /**
* @param params * @param params
* shopId 必填 * shopId 必填

View File

@ -1,24 +1,12 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.mybatis.service; package cn.ysk.cashier.mybatis.service;
import cn.ysk.cashier.mybatis.entity.Activate; import cn.ysk.cashier.mybatis.entity.Activate;
import cn.ysk.cashier.mybatis.entity.StorageVo; import cn.ysk.cashier.mybatis.entity.StorageVo;
import cn.ysk.cashier.pojo.product.TbProduct;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.List;
/** /**
* @website https://eladmin.vip * @website https://eladmin.vip
* @description 服务接口 * @description 服务接口
@ -36,4 +24,6 @@ public interface ShopService {
Object findActivate(String shopId); Object findActivate(String shopId);
void modityActivate(Activate activate); void modityActivate(Activate activate);
List<TbProduct> findActivatePros(Integer activate);
} }

View File

@ -1,23 +1,10 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.mybatis.service.impl; package cn.ysk.cashier.mybatis.service.impl;
import cn.ysk.cashier.mybatis.entity.Activate; import cn.ysk.cashier.mybatis.entity.Activate;
import cn.ysk.cashier.mybatis.mapper.*; import cn.ysk.cashier.mybatis.mapper.*;
import cn.ysk.cashier.pojo.product.TbProduct;
import cn.ysk.cashier.pojo.shop.TbMerchantAccount; import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
import cn.ysk.cashier.repository.product.TbProductRepository;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -30,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.*; import java.util.*;
@ -50,6 +38,8 @@ public class ShopServiceImpl implements ShopService {
private TbProducSkutMapper producSkutMapper; private TbProducSkutMapper producSkutMapper;
@Autowired @Autowired
private ActivateMapper activateMapper; private ActivateMapper activateMapper;
@Autowired
private TbProductRepository tbProductRepository;
@Override @Override
public Object findStorage(Integer shopId, String account, Pageable pageable) { public Object findStorage(Integer shopId, String account, Pageable pageable) {
QueryWrapper<TbUserStorage> queryWrapper = new QueryWrapper<>(); QueryWrapper<TbUserStorage> queryWrapper = new QueryWrapper<>();
@ -139,4 +129,13 @@ public class ShopServiceImpl implements ShopService {
activateMapper.insert(activate); activateMapper.insert(activate);
} }
} }
@Override
public List<TbProduct> findActivatePros(Integer activateId) {
Activate activate = activateMapper.selectById(activateId);
if (!CollectionUtils.isEmpty(activate.getProdIds())){
return tbProductRepository.findByIds(activate.getProdIds());
}
return new ArrayList<>();
}
} }

View File

@ -37,7 +37,7 @@ public interface SummaryService {
*/ */
void download(ShopSummaryDto summaryDto, HttpServletResponse response) throws IOException; void download(ShopSummaryDto summaryDto, HttpServletResponse response) throws IOException;
List<TbOrderPayCountVo> summaryCount(ShopSummaryDto summaryDto, Date startTime, Date endTime); List<TbOrderPayCountVo> summaryCount(ShopSummaryDto summaryDto);
List<ShopTableSaleInfoVo> selectSummaryTable(Integer shopId, Date startTime, Date endTime); List<ShopTableSaleInfoVo> selectSummaryTable(Integer shopId, Date startTime, Date endTime);

View File

@ -15,6 +15,8 @@ import cn.ysk.cashier.service.SummaryService;
import cn.ysk.cashier.utils.DateUtil; import cn.ysk.cashier.utils.DateUtil;
import cn.ysk.cashier.utils.FileUtil; import cn.ysk.cashier.utils.FileUtil;
import cn.ysk.cashier.vo.*; import cn.ysk.cashier.vo.*;
import com.alibaba.fastjson.JSONObject;
import com.beust.ah.A;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -450,16 +452,16 @@ public class SummaryServiceImpl implements SummaryService {
} }
@Override @Override
public List<TbOrderPayCountVo> summaryCount(ShopSummaryDto summaryDto, Date startTime, Date endTime) { public List<TbOrderPayCountVo> summaryCount(ShopSummaryDto summaryDto) {
List<TbOrderPayCountVo> list = new ArrayList<>(); List<TbOrderPayCountVo> list = new ArrayList<>();
Long start = 1704038400000L; Long start = 1704038400000L;
Long end = Instant.now().toEpochMilli(); Long end = Instant.now().toEpochMilli();
if (startTime != null || endTime != null) { if (summaryDto.getStartTime() != null || summaryDto.getEndTime() != null) {
start = startTime.getTime(); start = summaryDto.getStartTime().getTime();
end = endTime.getTime(); end = summaryDto.getEndTime().getTime();
} else { } else {
startTime = DateUtil.toDate(DateUtil.fromTimeStamp(1704038400L)); summaryDto.setStartTime(DateUtil.toDate(DateUtil.fromTimeStamp(1704038400L)));
endTime = new Date(); summaryDto.setEndTime(new Date());
} }
if (summaryDto.getType() != null && summaryDto.getType() == 1) { if (summaryDto.getType() != null && summaryDto.getType() == 1) {
TbOrderPayCountVo payCount = tbOrderInfoRepository.queryOrderPayCount(summaryDto.getShopId(), start, end); TbOrderPayCountVo payCount = tbOrderInfoRepository.queryOrderPayCount(summaryDto.getShopId(), start, end);
@ -474,7 +476,7 @@ public class SummaryServiceImpl implements SummaryService {
refCount.setIcon("el-icon-money"); refCount.setIcon("el-icon-money");
list.add(refCount); list.add(refCount);
TbOrderSalesCountByDayVo numCount = detailRepository.queryTbOrderSalesCount(Integer.valueOf(summaryDto.getShopId()), startTime, endTime); TbOrderSalesCountByDayVo numCount = detailRepository.queryTbOrderSalesCount(Integer.valueOf(summaryDto.getShopId()), summaryDto.getStartTime(), summaryDto.getEndTime());
TbOrderPayCountVo salesNum =new TbOrderPayCountVo("el-icon-goods","销售量","0",numCount.getSalesNum()-numCount.getRefNum()); TbOrderPayCountVo salesNum =new TbOrderPayCountVo("el-icon-goods","销售量","0",numCount.getSalesNum()-numCount.getRefNum());
TbOrderPayCountVo refNum =new TbOrderPayCountVo("el-icon-goods","退单量","0",numCount.getRefNum()); TbOrderPayCountVo refNum =new TbOrderPayCountVo("el-icon-goods","退单量","0",numCount.getRefNum());
list.add(salesNum); list.add(salesNum);
@ -557,38 +559,77 @@ public class SummaryServiceImpl implements SummaryService {
Map<String, List<TbOrderSalesCountByTable>> countByTableMap = countByTables.stream() Map<String, List<TbOrderSalesCountByTable>> countByTableMap = countByTables.stream()
.collect(Collectors.groupingBy(TbOrderSalesCountByTable::getTableId)); .collect(Collectors.groupingBy(TbOrderSalesCountByTable::getTableId));
ConcurrentLinkedQueue<Map<String, Object>> list = new ConcurrentLinkedQueue<>();
ArrayList<Integer> mergeRowIndex = new ArrayList<>(); // 比较 shopTableSeleInfoDto startTime endTime 是不是同一天
boolean sameDay = cn.hutool.core.date.DateUtil.isSameDay(shopTableSeleInfoDto.getStartTime(), shopTableSeleInfoDto.getEndTime());
String queryDate = cn.hutool.core.date.DateUtil.format(shopTableSeleInfoDto.getStartTime(), "yyyy-MM-dd");
if (!sameDay) {
queryDate += "" + cn.hutool.core.date.DateUtil.format(shopTableSeleInfoDto.getEndTime(), "yyyy-MM-dd");
}
List<Map<String, Object>> list = new ArrayList<>();
List<List<Integer>> mergeList = new ArrayList<>();
Map<String, Integer> tableStartIndexMap = new HashMap<>();
int rowIndex = 1;
for (ShopTableSaleInfoVo all : infoVos) { for (ShopTableSaleInfoVo all : infoVos) {
List<TbOrderSalesCountByTable> tables = countByTableMap.get(all.getTableCode()); List<TbOrderSalesCountByTable> tables = countByTableMap.get(all.getTableCode());
if (tables == null) { if (tables == null) {
continue; continue;
} }
BigDecimal total = BigDecimal.ZERO;
for (TbOrderSalesCountByTable table : tables) {
total = total.add(table.getSalesAmount().abs());
}
String tableCode = all.getTableName().toString();
if (!tableStartIndexMap.containsKey(tableCode)) {
tableStartIndexMap.put(tableCode, rowIndex);
}
for (TbOrderSalesCountByTable table : tables) { for (TbOrderSalesCountByTable table : tables) {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("开始时间", shopTableSeleInfoDto.getStartTime()); map.put("日期", queryDate);
map.put("结束时间", shopTableSeleInfoDto.getEndTime()); map.put("台桌", all.getTableName());
map.put("区域名称", all.getAreaName());
map.put("桌台名称", all.getTableName());
map.put("商品分类", table.getCateName()); map.put("商品分类", table.getCateName());
map.put("商品名称", table.getProductName()); map.put("商品名称", table.getProductName());
map.put("单位", table.getUnitName()); map.put("单位", table.getUnitName());
map.put("商品规格", table.getProductSkuName()); map.put("商品规格", table.getProductSkuName());
map.put("销量", table.getSalesNum()); map.put("销量", table.getSalesNum());
map.put("销售额", table.getSalesAmount()); map.put("单价", table.getPrice());
map.put("金额", table.getSalesAmount());
map.put("销售额", total);
map.put("退单量", table.getRefNum());
map.put("退单额", table.getRefAmount());
list.add(map); list.add(map);
rowIndex++;
} }
if (!tables.isEmpty()) { int start = tableStartIndexMap.get(tableCode);
if (mergeRowIndex.isEmpty()) { int end = rowIndex - 1;
mergeRowIndex.add(tables.size()); if (end - start > 0) {
}else { mergeList.add(Arrays.asList(start, end, 0, 0));
mergeRowIndex.add(mergeRowIndex.get(mergeRowIndex.size() - 1) + tables.size()); mergeList.add(Arrays.asList(start, end, 1, 1));
} mergeList.add(Arrays.asList(start, end, 9, 9));
} }
} }
FileUtil.downloadExcelAndMerge(list, 4, response, mergeRowIndex);
List<String> keyList = new ArrayList<>();
keyList.add("日期");
keyList.add("台桌");
keyList.add("商品分类");
keyList.add("商品名称");
keyList.add("单位");
keyList.add("商品规格");
keyList.add("销量");
keyList.add("单价");
keyList.add("金额");
keyList.add("销售额");
keyList.add("退单量");
keyList.add("退单额");
FileUtil.downloadAndMergeExcel(list, mergeList, keyList, response);
} }
} }

View File

@ -58,7 +58,6 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
PageRequest sort = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("sort")); PageRequest sort = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("sort"));
Page<TbProductGroup> page = tbProductGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) -> Page<TbProductGroup> page = tbProductGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) ->
QueryHelp.getPredicate(root,criteria,criteriaBuilder),sort); QueryHelp.getPredicate(root,criteria,criteriaBuilder),sort);
return PageUtil.toPage(page.map(tbProductGroupMapper::toDto)); return PageUtil.toPage(page.map(tbProductGroupMapper::toDto));
} }