数据报表
This commit is contained in:
parent
8cbe957833
commit
0a8973a24c
|
|
@ -33,9 +33,7 @@ public interface SummaryService {
|
|||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
// void download(Integer type, String shopId, Long startTime, Long endTime, HttpServletResponse response) throws IOException;
|
||||
void download(ShopSummaryDto summaryDto, HttpServletResponse response) throws IOException;
|
||||
|
||||
// List<TbOrderPayCountVo> summaryCount(String shopId, Long startTime, Long endTime);
|
||||
List<TbOrderPayCountVo> summaryCount(String shopId, Date startTime, Date endTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,28 +327,7 @@ public class SummaryServiceImpl implements SummaryService {
|
|||
return map;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public <T> Page<T> selectSummaryByDay(ShopSummaryDto summaryDto, Integer page, Integer size) {
|
||||
// Pageable pageable = PageRequest.of(page, size);
|
||||
// if (summaryDto.getType() != null && summaryDto.getType() == 1) {//金额
|
||||
// if (summaryDto.getStartTime() == null || summaryDto.getEndTime() == null) {
|
||||
// summaryDto.setStartTime(1704038400000L);
|
||||
// summaryDto.setEndTime(Instant.now().toEpochMilli());
|
||||
// }
|
||||
// return (Page<T>) tbOrderInfoRepository.queryTbOrderPayCountByDay(summaryDto.getShopId(), summaryDto.getStartTime(), summaryDto.getEndTime(), pageable);
|
||||
// } else {//销量
|
||||
// Date end = null;
|
||||
// Date start = null;
|
||||
// if (summaryDto.getStartTime() == null || summaryDto.getEndTime() == null) {
|
||||
// start = DateUtil.toDate(DateUtil.fromTimeStamp(1704038400L));
|
||||
// end = new Date();
|
||||
// } else {
|
||||
// start = DateUtil.toDate(DateUtil.fromTimeStamp(summaryDto.getStartTime()));
|
||||
// end = DateUtil.toDate(DateUtil.fromTimeStamp(summaryDto.getEndTime()));
|
||||
// }
|
||||
// return (Page<T>) detailRepository.queryTbOrderSalesCountByDay(Integer.valueOf(summaryDto.getShopId()), start, end, pageable);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public <T> Page<T> selectSummaryByDay(ShopSummaryDto summaryDto, Integer page, Integer size) {
|
||||
Pageable pageable = PageRequest.of(page, size);
|
||||
|
|
@ -369,47 +348,7 @@ public class SummaryServiceImpl implements SummaryService {
|
|||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void download(Integer type, String shopId, Long startTime, Long endTime, HttpServletResponse response) throws IOException {
|
||||
// List<Map<String, Object>> list = new ArrayList<>();
|
||||
// if (type != null && type == 1) {//金额
|
||||
// if (startTime == null || endTime == null) {
|
||||
// startTime = 1704038400000L;
|
||||
// endTime = Instant.now().toEpochMilli();
|
||||
// }
|
||||
// List<TbOrderPayCountByDayVo> tbOrderPayCountByDayVos = tbOrderInfoRepository.queryTbOrderPayCountByDay(shopId, startTime, endTime);
|
||||
// for (TbOrderPayCountByDayVo all : tbOrderPayCountByDayVos) {
|
||||
// Map<String, Object> map = new LinkedHashMap<>();
|
||||
// map.put("现金", all.getCash());
|
||||
// map.put("扫码支付", all.getScanCode());
|
||||
// map.put("微信小程序支付", all.getWxLite());
|
||||
// map.put("总金额", all.getTotal());
|
||||
// map.put("日期", all.getTradeDay());
|
||||
// list.add(map);
|
||||
// }
|
||||
// } else {//销量
|
||||
// Date end = null;
|
||||
// Date start = null;
|
||||
// if (startTime == null || endTime == null) {
|
||||
// start = DateUtil.toDate(DateUtil.fromTimeStamp(1704038400L));
|
||||
// end = new Date();
|
||||
// } else {
|
||||
// start = DateUtil.toDate(DateUtil.fromTimeStamp(startTime));
|
||||
// end = DateUtil.toDate(DateUtil.fromTimeStamp(endTime));
|
||||
// }
|
||||
// List<TbOrderSalesCountByDayVo> tbOrderSalesCountByDayVos = detailRepository.queryTbOrderSalesCountByDay(Integer.valueOf(shopId), start, end);
|
||||
// for (TbOrderSalesCountByDayVo all : tbOrderSalesCountByDayVos) {
|
||||
// Map<String, Object> map = new LinkedHashMap<>();
|
||||
// map.put("商品名称", all.getProductName());
|
||||
// map.put("商品规格", StringUtils.isBlank(all.getProductSkuName()) ? "" : all.getProductSkuName());
|
||||
// map.put("销量", all.getSalesNum());
|
||||
// map.put("退单量", all.getRefNum());
|
||||
// map.put("总量", all.getNum());
|
||||
// list.add(map);
|
||||
// }
|
||||
// }
|
||||
// FileUtil.downloadExcel(list, response);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void download(ShopSummaryDto summaryDto, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
|
|
@ -423,10 +362,10 @@ public class SummaryServiceImpl implements SummaryService {
|
|||
List<TbOrderPayCountByDayVo> tbOrderPayCountByDayVos = tbOrderInfoRepository.queryTbOrderPayCountByDay(summaryDto.getShopId(), start, end);
|
||||
for (TbOrderPayCountByDayVo all : tbOrderPayCountByDayVos) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("总金额", all.getTotal());
|
||||
map.put("现金", all.getCash());
|
||||
map.put("扫码支付", all.getScanCode());
|
||||
map.put("微信小程序支付", all.getWxLite());
|
||||
map.put("总金额", all.getTotal());
|
||||
map.put("日期", all.getTradeDay());
|
||||
list.add(map);
|
||||
}
|
||||
|
|
@ -449,36 +388,6 @@ public class SummaryServiceImpl implements SummaryService {
|
|||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<TbOrderPayCountVo> summaryCount(String shopId, Long startTime, Long endTime) {
|
||||
// List<TbOrderPayCountVo> list = new ArrayList<>();
|
||||
// Date end = null;
|
||||
// Date start = null;
|
||||
// if (startTime == null || endTime == null) {
|
||||
// startTime = 1704038400000L;
|
||||
// endTime = Instant.now().toEpochMilli();
|
||||
// start = DateUtil.toDate(DateUtil.fromTimeStamp(1704038400L));
|
||||
// end = new Date();
|
||||
// } else {//销量
|
||||
// start = DateUtil.toDate(DateUtil.fromTimeStamp(startTime));
|
||||
// end = DateUtil.toDate(DateUtil.fromTimeStamp(endTime));
|
||||
// }
|
||||
// TbOrderPayCountVo payCount = tbOrderInfoRepository.queryOrderPayCount(shopId, startTime, endTime);
|
||||
// list.add(payCount);
|
||||
// TbOrderPayCountVo refCount = tbOrderInfoRepository.queryTbOrderRefund(shopId, startTime, endTime);
|
||||
// refCount.setPayType("退款金额");
|
||||
// list.add(refCount);
|
||||
// List<TbOrderPayCountVo> tbOrderPayCountVos = detailRepository.queryTbOrderSalesCount(Integer.valueOf(shopId), start, end);
|
||||
// for (TbOrderPayCountVo tbOrderPayCountVo : tbOrderPayCountVos) {
|
||||
// if (tbOrderPayCountVo.getPayType().equals("closed")) {
|
||||
// tbOrderPayCountVo.setPayType("销售量");
|
||||
// } else if (tbOrderPayCountVo.getPayType().equals("refund")) {
|
||||
// tbOrderPayCountVo.setPayType("退单量");
|
||||
// }
|
||||
// list.add(tbOrderPayCountVo);
|
||||
// }
|
||||
// return list;
|
||||
// }
|
||||
@Override
|
||||
public List<TbOrderPayCountVo> summaryCount(String shopId, Date startTime, Date endTime) {
|
||||
List<TbOrderPayCountVo> list = new ArrayList<>();
|
||||
|
|
@ -492,17 +401,21 @@ public class SummaryServiceImpl implements SummaryService {
|
|||
endTime = new Date();
|
||||
}
|
||||
TbOrderPayCountVo payCount = tbOrderInfoRepository.queryOrderPayCount(shopId, start, end);
|
||||
payCount.setIcon("el-icon-coin");
|
||||
list.add(payCount);
|
||||
TbOrderPayCountVo refCount = tbOrderInfoRepository.queryTbOrderRefund(shopId, start, end);
|
||||
refCount.setPayType("退款金额");
|
||||
refCount.setIcon("el-icon-money");
|
||||
list.add(refCount);
|
||||
|
||||
List<TbOrderPayCountVo> tbOrderPayCountVos = detailRepository.queryTbOrderSalesCount(Integer.valueOf(shopId), startTime, endTime);
|
||||
for (TbOrderPayCountVo tbOrderPayCountVo : tbOrderPayCountVos) {
|
||||
if (tbOrderPayCountVo.getPayType().equals("closed")) {
|
||||
tbOrderPayCountVo.setPayType("销售量");
|
||||
tbOrderPayCountVo.setIcon("el-icon-goods");
|
||||
} else if (tbOrderPayCountVo.getPayType().equals("refund")) {
|
||||
tbOrderPayCountVo.setPayType("退单量");
|
||||
tbOrderPayCountVo.setIcon("el-icon-circle-close");
|
||||
}
|
||||
list.add(tbOrderPayCountVo);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue