传智健康项目讲义第十章 五
程序员文章站
2022-03-03 18:42:49
...
2.3 后台代码
2.3.1 Controller
在ReportController中提供getBusinessReportData方法
@Reference
private ReportService reportService;
/**
* 获取运营统计数据
* @return
*/
@RequestMapping("/getBusinessReportData")
public Result getBusinessReportData(){
try {
Map<String, Object> result = reportService.getBusinessReport();
return new
Result(true,MessageConstant.GET_BUSINESS_REPORT_SUCCESS,result);
} catch (Exception e) {
e.printStackTrace();
return new Result(true,MessageConstant.GET_BUSINESS_REPORT_FAIL);
}
}
2.3.2 服务接口
在health_interface工程中创建ReportService服务接口并声明getBusinessReport方法
package com.itheima.service;
import java.util.Map;
public interface ReportService {
/**
* 获得运营统计数据
* Map数据格式:
* todayNewMember ‐> number
* totalMember ‐> number
* thisWeekNewMember ‐> number
* thisMonthNewMember ‐> number
* todayOrderNumber ‐> number
* todayVisitsNumber ‐> number
* thisWeekOrderNumber ‐> number
* thisWeekVisitsNumber ‐> number
* thisMonthOrderNumber ‐> number
* thisMonthVisitsNumber ‐> number
* hotSetmeals ‐> List<Setmeal>
*/
public Map<String,Object> getBusinessReport() throws Exception;
}