当前位置: 首页 > news >正文

实习项目|苍穹外卖|day11

Apache ECharts

前端技术。
在这里插入图片描述

营业额统计

还是比较简单的。

用户统计

订单统计

在这里插入图片描述
在这里插入图片描述
以上所有需求。难点在于对时间类的处理:

// 接收格式
@GetMapping("/turnoverStatistics")@ApiOperation("营业额统计")public Result<TurnoverReportVO> turnoverStatistics(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin,@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end){log.info("营业额统计:{},{}", begin, end);return Result.success(reportService.getTurnoverStatistics(begin, end));}
//日期扩展到时分秒
@Overridepublic TurnoverReportVO getTurnoverStatistics(LocalDate begin, LocalDate end) {// deteList: 开始日期,到结束日期List<LocalDate> dateList = new ArrayList<>();dateList.add(begin);while (!begin.equals(end)){begin = begin.plusDays(1);dateList.add(begin);}List<Double> turnoverList = new ArrayList<>();for (LocalDate date : dateList) {LocalDateTime dateBegin = LocalDateTime.of(date, LocalTime.MIN);LocalDateTime dateEnd = LocalDateTime.of(date, LocalTime.MAX);Map map = new HashMap();map.put("begin", dateBegin);map.put("end", dateEnd);map.put("status", Orders.COMPLETED);Double turnover = orderMapper.sumByMap(map);turnover = turnover == null ? 0.0 : turnover;turnoverList.add(turnover);}return TurnoverReportVO.builder().dateList(StringUtils.join(dateList, ",")).turnoverList(StringUtils.join(turnoverList, ",")).build();}

销量排名Top10

难点在于查询数据库设计。

order_detail一张表不够,还需要确定对应的订单是否是完成状态。——》连接查询

    <select id="getSalesTop10" resultType="com.sky.dto.GoodsSalesDTO">select od.name name, sum(od.number) numberfrom order_detail od, orders owhere od.order_id = o.id and o.status=5<if test="begin != null">and order_time &gt; #{begin}</if><if test="end != null">and order_time &lt; #{end}</if>group by od.nameorder by number desclimit 0,10</select>

http://www.mrgr.cn/news/29705.html

相关文章:

  • 什么是注解?
  • VBS学习1 - 语法、内置函数、内置对象
  • [mysql]mysql排序和分页
  • 计算机毕业设计 办公用品管理系统 Java+SpringBoot+Vue 前后端分离 文档报告 代码讲解 安装调试
  • 壹嘉情,中国与世界经济文化交流的新桥梁
  • C++11: 声明和定义
  • 【C++ Primer Plus习题】16.8
  • 【渗透测试】-vulnhub源码框架漏洞-Os-hackNos-1
  • SQL编程复习(24/9/18)
  • 链表经典面试题
  • LCR 026
  • JavaScript第五天(函数,this,严格模式,高阶函数,闭包,递归,正则,ES6)高级
  • Python 入门教程(4)数据类型 | 4.3、数字类型
  • 请求转发和重定向的区别
  • 掌握Python虚拟环境:隔离项目依赖,提升开发效率的必备指南
  • 【Transformer深入学习】之一:Sinusoidal位置编码的精妙
  • Ubuntu上如何使用sh文件更新CMake
  • Redis - 深入理解Redis事务
  • 微服务配置中心介绍
  • 【学习笔记】IOC容器