|
@@ -0,0 +1,112 @@
|
|
1
|
+package com.yunzhi.nanyang.controller;
|
|
2
|
+
|
|
3
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
4
|
+import com.yunzhi.nanyang.common.BaseController;
|
|
5
|
+import com.yunzhi.nanyang.common.Constants;
|
|
6
|
+import com.yunzhi.nanyang.common.ResponseBean;
|
|
7
|
+import com.yunzhi.nanyang.entity.TaMachinery;
|
|
8
|
+import com.yunzhi.nanyang.entity.TaOrg;
|
|
9
|
+import com.yunzhi.nanyang.entity.TdMachineryType;
|
|
10
|
+import com.yunzhi.nanyang.service.ITaMachineryService;
|
|
11
|
+import com.yunzhi.nanyang.service.ITaOrderService;
|
|
12
|
+import com.yunzhi.nanyang.service.ITaOrgService;
|
|
13
|
+import com.yunzhi.nanyang.service.ITdMachineryTypeService;
|
|
14
|
+import com.yunzhi.nanyang.vo.ChartParam;
|
|
15
|
+import io.swagger.annotations.Api;
|
|
16
|
+import io.swagger.annotations.ApiOperation;
|
|
17
|
+import io.swagger.annotations.ApiParam;
|
|
18
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
19
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
20
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
21
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
22
|
+import org.springframework.web.bind.annotation.RestController;
|
|
23
|
+
|
|
24
|
+import java.util.ArrayList;
|
|
25
|
+import java.util.List;
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+@Api(tags = "数据大屏")
|
|
29
|
+@RestController
|
|
30
|
+@RequestMapping("/admin/screen-data")
|
|
31
|
+public class ScreenDataController extends BaseController {
|
|
32
|
+
|
|
33
|
+ @Autowired
|
|
34
|
+ ITaMachineryService iTaMachineryService;
|
|
35
|
+
|
|
36
|
+ @Autowired
|
|
37
|
+ ITaOrderService iTaOrderService;
|
|
38
|
+
|
|
39
|
+ @Autowired
|
|
40
|
+ ITdMachineryTypeService iTdMachineryTypeService;
|
|
41
|
+
|
|
42
|
+ @Autowired
|
|
43
|
+ ITaOrgService iTaOrgService;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+ @GetMapping("/basic")
|
|
47
|
+ @ApiOperation(value="基本数据统计", notes = "基本数据统计", httpMethod = "GET", response = ResponseBean.class)
|
|
48
|
+ public ResponseBean getBasicStatis() throws Exception {
|
|
49
|
+ // 农机总数
|
|
50
|
+ int totalMachineryNum = iTaMachineryService.countBy("1", 1, true);
|
|
51
|
+ // 农机使用数
|
|
52
|
+ int totalMachineryUsed = 0;
|
|
53
|
+ // 总预约数 == 订单数
|
|
54
|
+ int totalOrderNum = iTaOrderService.countBy("1", 1, true);
|
|
55
|
+ // 总服务数
|
|
56
|
+ int totalServiceNum = 0;
|
|
57
|
+
|
|
58
|
+ List<ChartParam> result = new ArrayList<>();
|
|
59
|
+ result.add(new ChartParam("totalMachineryNum", totalMachineryNum));
|
|
60
|
+ result.add(new ChartParam("totalMachineryUsed", totalMachineryUsed));
|
|
61
|
+ result.add(new ChartParam("totalOrderNum", totalOrderNum));
|
|
62
|
+ result.add(new ChartParam("totalServiceNum", totalServiceNum));
|
|
63
|
+
|
|
64
|
+ return ResponseBean.success(result);
|
|
65
|
+ }
|
|
66
|
+
|
|
67
|
+ @GetMapping("/machinery-type")
|
|
68
|
+ @ApiOperation(value="所有农机类型", notes = "所有农机类型", httpMethod = "GET", response = ResponseBean.class)
|
|
69
|
+ public ResponseBean getMachineryType() throws Exception {
|
|
70
|
+ List<TdMachineryType> result = iTdMachineryTypeService.getTypesOfScreen();
|
|
71
|
+ return ResponseBean.success(result);
|
|
72
|
+ }
|
|
73
|
+
|
|
74
|
+ @GetMapping("/machinery-type/machinery")
|
|
75
|
+ @ApiOperation(value="农机类型统计", notes = "农机类型统计", httpMethod = "GET", response = ResponseBean.class)
|
|
76
|
+ public ResponseBean getMachineryTypeStatis() throws Exception {
|
|
77
|
+ List<ChartParam> result = iTdMachineryTypeService.statisMachineryNum();
|
|
78
|
+ return ResponseBean.success(result);
|
|
79
|
+ }
|
|
80
|
+
|
|
81
|
+ @GetMapping("/machinery-type/work-job")
|
|
82
|
+ @ApiOperation(value="农机作业数统计", notes = "农机作业数统计", httpMethod = "GET", response = ResponseBean.class)
|
|
83
|
+ public ResponseBean getMachineryTypeWorkJobs() throws Exception {
|
|
84
|
+ List<ChartParam> result = iTdMachineryTypeService.statisWorkJobNum();
|
|
85
|
+ return ResponseBean.success(result);
|
|
86
|
+ }
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+ @GetMapping("/machinery-type/area")
|
|
90
|
+ @ApiOperation(value="农机作业面积统计", notes = "农机作业面积统计", httpMethod = "GET", response = ResponseBean.class)
|
|
91
|
+ public ResponseBean getMachineryTypeArea() throws Exception {
|
|
92
|
+ List<ChartParam> result = iTdMachineryTypeService.statisArea();
|
|
93
|
+ return ResponseBean.success(result);
|
|
94
|
+ }
|
|
95
|
+
|
|
96
|
+ @GetMapping("/org")
|
|
97
|
+ @ApiOperation(value="所有合作社", notes = "所有合作社", httpMethod = "GET", response = ResponseBean.class)
|
|
98
|
+ public ResponseBean getAllOrgs() throws Exception {
|
|
99
|
+ QueryWrapper<TaOrg> queryWrapper = new QueryWrapper<TaOrg>()
|
|
100
|
+ .gt("status", Constants.STATUS_DELETE);
|
|
101
|
+ List<TaOrg> result = iTaOrgService.list(queryWrapper);
|
|
102
|
+ return ResponseBean.success(result);
|
|
103
|
+ }
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+ @GetMapping("/machinery/all")
|
|
107
|
+ @ApiOperation(value="依据类型查询农机", notes = "依据类型查询农机", httpMethod = "GET", response = ResponseBean.class)
|
|
108
|
+ public ResponseBean getMachineryOfType(@ApiParam("农机类型") @RequestParam("typeId") String typeId) throws Exception {
|
|
109
|
+ List<TaMachinery> result = iTaMachineryService.listByTypeWithLoc(typeId);
|
|
110
|
+ return ResponseBean.success(result);
|
|
111
|
+ }
|
|
112
|
+}
|