From c726fb7b60c7480618b6e034de8224cd4f9bb9fa Mon Sep 17 00:00:00 2001 From: ryoeiken <754264374@qq.com> Date: Mon, 11 Jan 2021 13:46:34 +0800 Subject: [PATCH] =?UTF-8?q?todo=EF=BC=9A=E6=8A=A5=E9=A4=90=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FtOrderDaoController.java | 26 +++++- .../system/fantang/domain/FtOrderDao.java | 6 ++ .../fantang/mapper/FtOrderDaoMapper.java | 22 ++++- .../fantang/service/IFtOrderDaoService.java | 6 ++ .../service/impl/FtOrderDaoServiceImpl.java | 15 ++++ .../views/fantang/orderStatistics/index.vue | 80 ++++++++++++++----- 6 files changed, 129 insertions(+), 26 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtOrderDaoController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtOrderDaoController.java index 614cbbe16..fa89517df 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtOrderDaoController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtOrderDaoController.java @@ -130,8 +130,15 @@ public class FtOrderDaoController extends BaseController { */ @PostMapping("/getStatisGetOrderOfDay") public AjaxResult getStatisGetOrderOfDay(@RequestBody JSONObject params) { + startPage(); Date selectDay = params.getDate("selectDay"); - return iFtOrderDaoService.statisGetOrderOfDate(selectDay); + Integer statisticsType = params.getInteger("statisticsType"); + + if (statisticsType == 1) { + return iFtOrderDaoService.statisGetOrderOfDate(selectDay); + } else { + return iFtOrderDaoService.statisGetOrderOfDateByPerson(selectDay); + } } /** @@ -141,7 +148,14 @@ public class FtOrderDaoController extends BaseController { public AjaxResult getStatisGetOrderOfWeek(@RequestBody JSONObject params) { System.out.println(params); Date selectWeek = params.getDate("selectWeek"); - return iFtOrderDaoService.statisGetOrderOfWeek(selectWeek); + Integer statisticsType = params.getInteger("statisticsType"); + + if (statisticsType == 1) { + return iFtOrderDaoService.statisGetOrderOfWeek(selectWeek); + } else { + return iFtOrderDaoService.statisGetOrderOfWeekByPerson(selectWeek); + } + } /** @@ -150,6 +164,12 @@ public class FtOrderDaoController extends BaseController { @PostMapping("/getStatisGetOrderOfMonth") public AjaxResult getStatisGetOrderOfMonth(@RequestBody JSONObject params) { Date selectMonth = params.getDate("selectMonth"); - return iFtOrderDaoService.statisGetOrderOfMonth(selectMonth); + Integer statisticsType = params.getInteger("statisticsType"); + + if (statisticsType == 1) { + return iFtOrderDaoService.statisGetOrderOfMonth(selectMonth); + }else { + return iFtOrderDaoService.statisGetOrderOfMonthByPerson(selectMonth); + } } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtOrderDao.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtOrderDao.java index 3123a84f3..1705cbbb3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtOrderDao.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtOrderDao.java @@ -156,4 +156,10 @@ public class FtOrderDao implements Serializable { @TableField(exist = false) private Long departId; + + @TableField(exist = false) + private String staffName; + + @TableField(exist = false) + private String tel; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtOrderDaoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtOrderDaoMapper.java index 07adfc072..6319a6f14 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtOrderDaoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtOrderDaoMapper.java @@ -21,10 +21,30 @@ public interface FtOrderDaoMapper extends BaseMapper { @Select("select a.order_type, count(a.order_type) as count_order , c.depart_name from ft_order a\n" + " LEFT JOIN ft_staff_info b on a.staff_id = b.staff_id\n" + - " LEFT JOIN ft_depart c on b.depart_id = c.depart_id where a.order_date BETWEEN #{start} and #{end}\n" + + " LEFT JOIN ft_depart c on b.depart_id = c.depart_id where b.depart_id = c.depart_id and a.order_date BETWEEN #{start} and #{end}\n" + " GROUP BY a.order_type, c.depart_name") List statisGetOrderOfDate(@Param("start") String start, @Param("end") String end); + @Select("SELECT\n" + + "\ta.order_type,\n" + + "\tcount( a.order_type ) AS count_order,\n" + + "\tc.depart_name,\n" + + "\tb.`name` AS staff_name,\n" + + "\tb.tel \n" + + "FROM\n" + + "\tft_order a\n" + + "\tLEFT JOIN ft_staff_info b ON a.staff_id = b.staff_id\n" + + "\tLEFT JOIN ft_depart c ON b.depart_id = c.depart_id \n" + + "WHERE\n" + + "\tb.depart_id = c.depart_id \n" + + "\tAND a.order_date BETWEEN #{start} \n" + + "\tAND #{end} \n" + + "GROUP BY\n" + + "\ta.order_type,\n" + + "\tc.depart_name,\n" + + "\tb.`name`,\n" + + "\tb.tel") + List statisGetOrderOfDateByPerson(@Param("start") String start, @Param("end") String end); List listDetailedByDate(@Param("orderType") Integer orderType, @Param("start") String start, @Param("end") String end); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtOrderDaoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtOrderDaoService.java index 94748fa98..84f9dedac 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtOrderDaoService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtOrderDaoService.java @@ -33,10 +33,16 @@ public interface IFtOrderDaoService extends IService { AjaxResult statisGetOrderOfDate(Date date); + AjaxResult statisGetOrderOfDateByPerson(Date date); + AjaxResult statisGetOrderOfWeek(Date date); + AjaxResult statisGetOrderOfWeekByPerson(Date date); + AjaxResult statisGetOrderOfMonth(Date date); + AjaxResult statisGetOrderOfMonthByPerson(Date date); + List listDetailedByDate(Integer orderType, String start, String end); List listAllDetailedByDate(String start, String end); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtOrderDaoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtOrderDaoServiceImpl.java index 26652d718..64b7e33c5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtOrderDaoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtOrderDaoServiceImpl.java @@ -130,16 +130,31 @@ public class FtOrderDaoServiceImpl extends ServiceImpl listDetailedByDate(Integer orderType, String start, String end) { return this.baseMapper.listDetailedByDate(orderType, start, end); diff --git a/ruoyi-ui/src/views/fantang/orderStatistics/index.vue b/ruoyi-ui/src/views/fantang/orderStatistics/index.vue index fa546afce..5a9778b1f 100644 --- a/ruoyi-ui/src/views/fantang/orderStatistics/index.vue +++ b/ruoyi-ui/src/views/fantang/orderStatistics/index.vue @@ -1,8 +1,21 @@ @@ -214,15 +228,28 @@ export default { components: {}, data() { return { + statisticsTypeOptions: [{ + value: 1, + label: '按部门' + }, { + value: 2, + label: '按人' + }], typeOptions: [], + formStatisticsType: { + statisticsType: null, + }, formMonth: { selectMonth: null, + statisticsType: null, }, formWeek: { selectWeek: null, + statisticsType: null, }, formDay: { selectDay: null, + statisticsType: null, }, orderTypeOptions: [], // 遮罩层 @@ -248,15 +275,6 @@ export default { queryParams: { pageNum: 1, pageSize: 10, - orderType: null, - totalPrice: null, - discount: null, - receipts: null, - createAt: null, - orderSrc: null, - currentPrice: null, - payType: null, - writeOffAt: null, }, // 表单参数 form: {}, @@ -271,7 +289,16 @@ export default { }); }, methods: { + changeStatisticsType(item) { + console.log(item) + this.formDay.statisticsType = item; + this.formWeek.statisticsType = item; + this.formMonth.statisticsType = item; + }, resetCount() { + this.formStatisticsType = { + statisticsType: null + } this.formDay = { selectDay: null } @@ -287,7 +314,10 @@ export default { return this.selectDictLabel(this.typeOptions, row.orderType); }, onMonthSubmit() { - if (this.formMonth.selectMonth != null) { + if (this.formMonth.statisticsType == null) { + this.msgError("请选择统计方式") + } + if (this.formMonth.selectMonth != null && this.formMonth.statisticsType != null) { console.log(this.formMonth) getStatisGetOrderOfMonth(this.formMonth).then(response => { this.orderCountList = response.data; @@ -295,7 +325,10 @@ export default { } }, onWeekSubmit() { - if (this.formWeek.selectWeek != null) { + if (this.formWeek.statisticsType == null) { + this.msgError("请选择统计方式") + } + if (this.formWeek.selectWeek != null && this.formWeek.statisticsType != null) { console.log(this.formWeek) getStatisGetOrderOfWeek(this.formWeek).then(response => { console.log(response) @@ -304,7 +337,10 @@ export default { } }, onDaySubmit() { - if (this.formDay.selectDay != null) { + if (this.formDay.statisticsType == null) { + this.msgError("请选择统计方式") + } + if (this.formDay.selectDay != null && this.formDay.statisticsType != null) { console.log(this.formDay) getStatisGetOrderOfDay(this.formDay).then(response => { console.log(response)