Yansen 2 年前
父节点
当前提交
a512bd3670

+ 26
- 0
src/main/java/com/yunzhi/nanyang/controller/ScreenDataController.java 查看文件

44
     @Autowired
44
     @Autowired
45
     ITdDeviceService iTdDeviceService;
45
     ITdDeviceService iTdDeviceService;
46
 
46
 
47
+    @Autowired
48
+    TaDeviceJobService taDeviceJobService;
49
+
47
 
50
 
48
     @GetMapping("/basic")
51
     @GetMapping("/basic")
49
     @ApiOperation(value="基本数据统计", notes = "基本数据统计", httpMethod = "GET", response = ResponseBean.class)
52
     @ApiOperation(value="基本数据统计", notes = "基本数据统计", httpMethod = "GET", response = ResponseBean.class)
134
         List<TdDevice> result = iTdDeviceService.getListByTypes(typeList);
137
         List<TdDevice> result = iTdDeviceService.getListByTypes(typeList);
135
         return ResponseBean.success(result);
138
         return ResponseBean.success(result);
136
     }
139
     }
140
+
141
+
142
+
143
+    @GetMapping("/device-basic")
144
+    @ApiOperation(value="基本作业数据统计", notes = "基本作业数据统计", httpMethod = "GET", response = ResponseBean.class)
145
+    public ResponseBean getDeviceBasic() throws Exception {
146
+        // 农机总数
147
+        int totalMachineryNum = iTaMachineryService.countBy("1", 1, true);
148
+        // 设备总数
149
+        int totalDeviceNum = iTdDeviceService.countBy("1", 1, true);
150
+        // 在线设备总数
151
+        int totalOnlineDeviceNum = iTdDeviceService.countBy("online_status", 1, true);
152
+        //
153
+        Double totalAreaNum = taDeviceJobService.sumArea();
154
+
155
+        List<ChartParam> result = new ArrayList<>();
156
+        result.add(new ChartParam("totalMachineryNum", totalMachineryNum));
157
+        result.add(new ChartParam("totalDeviceNum", totalDeviceNum));
158
+        result.add(new ChartParam("totalOnlineDeviceNum", totalOnlineDeviceNum));
159
+        result.add(new ChartParam("totalAreaNum", totalAreaNum));
160
+
161
+        return ResponseBean.success(result);
162
+    }
137
 }
163
 }

+ 1
- 1
src/main/java/com/yunzhi/nanyang/controller/TdRawDeviceController.java 查看文件

117
      * @return 实例对象
117
      * @return 实例对象
118
      */
118
      */
119
     @ApiOperation("同步设备")
119
     @ApiOperation("同步设备")
120
-    @PutMapping("/raw-device/sync")
120
+    @PutMapping("/admin/raw-device/sync")
121
     public ResponseBean sync() throws Exception {
121
     public ResponseBean sync() throws Exception {
122
         String url = deviceServer + "/shensong/syncDevice";
122
         String url = deviceServer + "/shensong/syncDevice";
123
         String s = httpUtils.get(url);
123
         String s = httpUtils.get(url);

+ 2
- 0
src/main/java/com/yunzhi/nanyang/mapper/TaDeviceJobMapper.java 查看文件

52
                                  @Param("endDate") String endDate);
52
                                  @Param("endDate") String endDate);
53
 
53
 
54
     List<TaMachinery> getMachineryListByUser(@Param("userId") String userId);
54
     List<TaMachinery> getMachineryListByUser(@Param("userId") String userId);
55
+
56
+    Double sumArea();
55
 }
57
 }

+ 6
- 3
src/main/java/com/yunzhi/nanyang/service/TaDeviceJobService.java 查看文件

8
 
8
 
9
 /**
9
 /**
10
  * 设备作业表;(ta_device_job)表服务接口
10
  * 设备作业表;(ta_device_job)表服务接口
11
+ *
11
  * @author : http://njyunzhi.com
12
  * @author : http://njyunzhi.com
12
  * @date : 2022-11-3
13
  * @date : 2022-11-3
13
  */
14
  */
14
 public interface TaDeviceJobService extends IBaseService<TaDeviceJob> {
15
 public interface TaDeviceJobService extends IBaseService<TaDeviceJob> {
15
 
16
 
16
-     IPage<TaDeviceJob> statisOrgBy(IPage<TaDeviceJob> pg, String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone);
17
+    IPage<TaDeviceJob> statisOrgBy(IPage<TaDeviceJob> pg, String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone);
17
 
18
 
18
-     Double statisTotalArea(String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone);
19
+    Double statisTotalArea(String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone);
19
 
20
 
20
-     List<TaDeviceJob> listOrgBy(String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone);
21
+    List<TaDeviceJob> listOrgBy(String orgName, String deviceKind, String deviceNo, String startDate, String endDate, String machineryName, String userName, String phone);
21
 
22
 
22
     IPage<TaDeviceJob> getPageBy(IPage<TaDeviceJob> pg, String deviceKind, String deviceNo, String startDate, String endDate);
23
     IPage<TaDeviceJob> getPageBy(IPage<TaDeviceJob> pg, String deviceKind, String deviceNo, String startDate, String endDate);
23
 
24
 
24
     List<TaMachinery> getMachineryListByUser(String userId);
25
     List<TaMachinery> getMachineryListByUser(String userId);
26
+
27
+    Double sumArea();
25
 }
28
 }

+ 5
- 0
src/main/java/com/yunzhi/nanyang/service/impl/TaDeviceJobServiceImpl.java 查看文件

42
     public List<TaMachinery> getMachineryListByUser(String userId) {
42
     public List<TaMachinery> getMachineryListByUser(String userId) {
43
         return baseMapper.getMachineryListByUser(userId);
43
         return baseMapper.getMachineryListByUser(userId);
44
     }
44
     }
45
+
46
+    @Override
47
+    public Double sumArea() {
48
+        return baseMapper.sumArea();
49
+    }
45
 }
50
 }

+ 3
- 0
src/main/resources/mapper/TaDeviceJobMapper.xml 查看文件

92
         ORDER BY
92
         ORDER BY
93
             t.create_date DESC
93
             t.create_date DESC
94
     </select>
94
     </select>
95
+    <select id="sumArea" resultType="java.lang.Double">
96
+        SELECT SUM(job_area) FROM ta_device_job
97
+    </select>
95
 </mapper>
98
 </mapper>