todo:报餐统计分页

This commit is contained in:
ryoeiken 2021-01-11 13:46:34 +08:00
parent e69d57e1a1
commit c726fb7b60
6 changed files with 129 additions and 26 deletions

View File

@ -130,8 +130,15 @@ public class FtOrderDaoController extends BaseController {
*/ */
@PostMapping("/getStatisGetOrderOfDay") @PostMapping("/getStatisGetOrderOfDay")
public AjaxResult getStatisGetOrderOfDay(@RequestBody JSONObject params) { public AjaxResult getStatisGetOrderOfDay(@RequestBody JSONObject params) {
startPage();
Date selectDay = params.getDate("selectDay"); 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) { public AjaxResult getStatisGetOrderOfWeek(@RequestBody JSONObject params) {
System.out.println(params); System.out.println(params);
Date selectWeek = params.getDate("selectWeek"); 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") @PostMapping("/getStatisGetOrderOfMonth")
public AjaxResult getStatisGetOrderOfMonth(@RequestBody JSONObject params) { public AjaxResult getStatisGetOrderOfMonth(@RequestBody JSONObject params) {
Date selectMonth = params.getDate("selectMonth"); 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);
}
} }
} }

View File

@ -156,4 +156,10 @@ public class FtOrderDao implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private Long departId; private Long departId;
@TableField(exist = false)
private String staffName;
@TableField(exist = false)
private String tel;
} }

View File

@ -21,10 +21,30 @@ public interface FtOrderDaoMapper extends BaseMapper<FtOrderDao> {
@Select("select a.order_type, count(a.order_type) as count_order , c.depart_name from ft_order a\n" + @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_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") " GROUP BY a.order_type, c.depart_name")
List<FtOrderDao> statisGetOrderOfDate(@Param("start") String start, @Param("end") String end); List<FtOrderDao> 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<FtOrderDao> statisGetOrderOfDateByPerson(@Param("start") String start, @Param("end") String end);
List<FtOrderDao> listDetailedByDate(@Param("orderType") Integer orderType, @Param("start") String start, @Param("end") String end); List<FtOrderDao> listDetailedByDate(@Param("orderType") Integer orderType, @Param("start") String start, @Param("end") String end);

View File

@ -33,10 +33,16 @@ public interface IFtOrderDaoService extends IService<FtOrderDao> {
AjaxResult statisGetOrderOfDate(Date date); AjaxResult statisGetOrderOfDate(Date date);
AjaxResult statisGetOrderOfDateByPerson(Date date);
AjaxResult statisGetOrderOfWeek(Date date); AjaxResult statisGetOrderOfWeek(Date date);
AjaxResult statisGetOrderOfWeekByPerson(Date date);
AjaxResult statisGetOrderOfMonth(Date date); AjaxResult statisGetOrderOfMonth(Date date);
AjaxResult statisGetOrderOfMonthByPerson(Date date);
List<FtOrderDao> listDetailedByDate(Integer orderType, String start, String end); List<FtOrderDao> listDetailedByDate(Integer orderType, String start, String end);
List<FtOrderDao> listAllDetailedByDate(String start, String end); List<FtOrderDao> listAllDetailedByDate(String start, String end);

View File

@ -130,16 +130,31 @@ public class FtOrderDaoServiceImpl extends ServiceImpl<FtOrderDaoMapper, FtOrder
return AjaxResult.success(this.baseMapper.statisGetOrderOfDate(DateUtil.beginOfDay(date).toString(), DateUtil.endOfDay(date).toString())); return AjaxResult.success(this.baseMapper.statisGetOrderOfDate(DateUtil.beginOfDay(date).toString(), DateUtil.endOfDay(date).toString()));
} }
@Override
public AjaxResult statisGetOrderOfDateByPerson(Date date) {
return AjaxResult.success(this.baseMapper.statisGetOrderOfDateByPerson(DateUtil.beginOfDay(date).toString(), DateUtil.endOfDay(date).toString()));
}
@Override @Override
public AjaxResult statisGetOrderOfWeek(Date date) { public AjaxResult statisGetOrderOfWeek(Date date) {
return AjaxResult.success(this.baseMapper.statisGetOrderOfDate(DateUtil.beginOfWeek(date).toString(), DateUtil.endOfWeek(date).toString())); return AjaxResult.success(this.baseMapper.statisGetOrderOfDate(DateUtil.beginOfWeek(date).toString(), DateUtil.endOfWeek(date).toString()));
} }
@Override
public AjaxResult statisGetOrderOfWeekByPerson(Date date) {
return AjaxResult.success(this.baseMapper.statisGetOrderOfDateByPerson(DateUtil.beginOfWeek(date).toString(), DateUtil.endOfWeek(date).toString()));
}
@Override @Override
public AjaxResult statisGetOrderOfMonth(Date date) { public AjaxResult statisGetOrderOfMonth(Date date) {
return AjaxResult.success(this.baseMapper.statisGetOrderOfDate(DateUtil.beginOfMonth(date).toString(), DateUtil.endOfMonth(date).toString())); return AjaxResult.success(this.baseMapper.statisGetOrderOfDate(DateUtil.beginOfMonth(date).toString(), DateUtil.endOfMonth(date).toString()));
} }
@Override
public AjaxResult statisGetOrderOfMonthByPerson(Date date) {
return AjaxResult.success(this.baseMapper.statisGetOrderOfDateByPerson(DateUtil.beginOfMonth(date).toString(), DateUtil.endOfMonth(date).toString()));
}
@Override @Override
public List<FtOrderDao> listDetailedByDate(Integer orderType, String start, String end) { public List<FtOrderDao> listDetailedByDate(Integer orderType, String start, String end) {
return this.baseMapper.listDetailedByDate(orderType, start, end); return this.baseMapper.listDetailedByDate(orderType, start, end);

View File

@ -1,8 +1,21 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :inline="true" :model="formStatisticsType" class="demo-form-inline">
<el-form-item label="统计方式">
<el-select v-model="formStatisticsType.statisticsType" placeholder="请选择统计方式" @change="changeStatisticsType">
<el-option
v-for="item in statisticsTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
<el-form :inline="true" :model="formDay" class="demo-form-inline"> <el-form :inline="true" :model="formDay" class="demo-form-inline">
<el-form-item label="日统计"> <el-form-item label="日统计" label-width="68px">
<el-date-picker <el-date-picker
v-model="formDay.selectDay" v-model="formDay.selectDay"
type="date" type="date"
@ -16,7 +29,7 @@
<el-form :inline="true" :model="formWeek" class="demo-form-inline"> <el-form :inline="true" :model="formWeek" class="demo-form-inline">
<el-form-item label="周统计"> <el-form-item label="周统计" label-width="68px">
<el-date-picker <el-date-picker
v-model="formWeek.selectWeek" v-model="formWeek.selectWeek"
:picker-options="{ :picker-options="{
@ -33,7 +46,7 @@
</el-form> </el-form>
<el-form :inline="true" :model="formMonth" class="demo-form-inline"> <el-form :inline="true" :model="formMonth" class="demo-form-inline">
<el-form-item label="月统计"> <el-form-item label="月统计" label-width="68px">
<el-date-picker <el-date-picker
v-model="formMonth.selectMonth" v-model="formMonth.selectMonth"
type="month" type="month"
@ -183,15 +196,16 @@
<el-table-column label="报餐部门" align="center" prop="departName"/> <el-table-column label="报餐部门" align="center" prop="departName"/>
<el-table-column label="报餐类型" align="center" prop="orderType" :formatter="formatOrderType"/> <el-table-column label="报餐类型" align="center" prop="orderType" :formatter="formatOrderType"/>
<el-table-column label="报餐数量" align="center" prop="countOrder"/> <el-table-column label="报餐数量" align="center" prop="countOrder"/>
<el-table-column label="报餐员工" align="center" prop="staffName"/>
<el-table-column label="电话" align="center" prop="tel"/>
</el-table> </el-table>
<!-- <pagination--> <pagination
<!-- v-show="total>0"--> v-show="total>0"
<!-- :total="total"--> :total="total"
<!-- :page.sync="queryParams.pageNum"--> :page.sync="queryParams.pageNum"
<!-- :limit.sync="queryParams.pageSize"--> :limit.sync="queryParams.pageSize"
<!-- @pagination="getList"--> />
<!-- />-->
</div> </div>
</template> </template>
@ -214,15 +228,28 @@ export default {
components: {}, components: {},
data() { data() {
return { return {
statisticsTypeOptions: [{
value: 1,
label: '按部门'
}, {
value: 2,
label: '按人'
}],
typeOptions: [], typeOptions: [],
formStatisticsType: {
statisticsType: null,
},
formMonth: { formMonth: {
selectMonth: null, selectMonth: null,
statisticsType: null,
}, },
formWeek: { formWeek: {
selectWeek: null, selectWeek: null,
statisticsType: null,
}, },
formDay: { formDay: {
selectDay: null, selectDay: null,
statisticsType: null,
}, },
orderTypeOptions: [], orderTypeOptions: [],
// //
@ -248,15 +275,6 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
orderType: null,
totalPrice: null,
discount: null,
receipts: null,
createAt: null,
orderSrc: null,
currentPrice: null,
payType: null,
writeOffAt: null,
}, },
// //
form: {}, form: {},
@ -271,7 +289,16 @@ export default {
}); });
}, },
methods: { methods: {
changeStatisticsType(item) {
console.log(item)
this.formDay.statisticsType = item;
this.formWeek.statisticsType = item;
this.formMonth.statisticsType = item;
},
resetCount() { resetCount() {
this.formStatisticsType = {
statisticsType: null
}
this.formDay = { this.formDay = {
selectDay: null selectDay: null
} }
@ -287,7 +314,10 @@ export default {
return this.selectDictLabel(this.typeOptions, row.orderType); return this.selectDictLabel(this.typeOptions, row.orderType);
}, },
onMonthSubmit() { 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) console.log(this.formMonth)
getStatisGetOrderOfMonth(this.formMonth).then(response => { getStatisGetOrderOfMonth(this.formMonth).then(response => {
this.orderCountList = response.data; this.orderCountList = response.data;
@ -295,7 +325,10 @@ export default {
} }
}, },
onWeekSubmit() { 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) console.log(this.formWeek)
getStatisGetOrderOfWeek(this.formWeek).then(response => { getStatisGetOrderOfWeek(this.formWeek).then(response => {
console.log(response) console.log(response)
@ -304,7 +337,10 @@ export default {
} }
}, },
onDaySubmit() { 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) console.log(this.formDay)
getStatisGetOrderOfDay(this.formDay).then(response => { getStatisGetOrderOfDay(this.formDay).then(response => {
console.log(response) console.log(response)