Yansen 2 年之前
父節點
當前提交
a512bd3670

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

@@ -44,6 +44,9 @@ public class ScreenDataController extends BaseController {
44 44
     @Autowired
45 45
     ITdDeviceService iTdDeviceService;
46 46
 
47
+    @Autowired
48
+    TaDeviceJobService taDeviceJobService;
49
+
47 50
 
48 51
     @GetMapping("/basic")
49 52
     @ApiOperation(value="基本数据统计", notes = "基本数据统计", httpMethod = "GET", response = ResponseBean.class)
@@ -134,4 +137,27 @@ public class ScreenDataController extends BaseController {
134 137
         List<TdDevice> result = iTdDeviceService.getListByTypes(typeList);
135 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,7 +117,7 @@ public class TdRawDeviceController extends BaseController {
117 117
      * @return 实例对象
118 118
      */
119 119
     @ApiOperation("同步设备")
120
-    @PutMapping("/raw-device/sync")
120
+    @PutMapping("/admin/raw-device/sync")
121 121
     public ResponseBean sync() throws Exception {
122 122
         String url = deviceServer + "/shensong/syncDevice";
123 123
         String s = httpUtils.get(url);

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

@@ -52,4 +52,6 @@ public interface TaDeviceJobMapper  extends BaseMapper<TaDeviceJob>{
52 52
                                  @Param("endDate") String endDate);
53 53
 
54 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,18 +8,21 @@ import java.util.List;
8 8
 
9 9
 /**
10 10
  * 设备作业表;(ta_device_job)表服务接口
11
+ *
11 12
  * @author : http://njyunzhi.com
12 13
  * @date : 2022-11-3
13 14
  */
14 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 23
     IPage<TaDeviceJob> getPageBy(IPage<TaDeviceJob> pg, String deviceKind, String deviceNo, String startDate, String endDate);
23 24
 
24 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,4 +42,9 @@ public class TaDeviceJobServiceImpl extends BaseServiceImpl<TaDeviceJobMapper, T
42 42
     public List<TaMachinery> getMachineryListByUser(String userId) {
43 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,4 +92,7 @@
92 92
         ORDER BY
93 93
             t.create_date DESC
94 94
     </select>
95
+    <select id="sumArea" resultType="java.lang.Double">
96
+        SELECT SUM(job_area) FROM ta_device_job
97
+    </select>
95 98
 </mapper>