Yansen 2 years ago
parent
commit
9fd1128dfa

+ 5
- 2
src/main/java/com/yunzhi/nanyang/controller/ScreenDataController.java View File

@@ -47,6 +47,9 @@ public class ScreenDataController extends BaseController {
47 47
     @Autowired
48 48
     TaDeviceJobService taDeviceJobService;
49 49
 
50
+    @Autowired
51
+    TdRawDeviceService tdRawDeviceService;
52
+
50 53
 
51 54
     @GetMapping("/basic")
52 55
     @ApiOperation(value="基本数据统计", notes = "基本数据统计", httpMethod = "GET", response = ResponseBean.class)
@@ -146,9 +149,9 @@ public class ScreenDataController extends BaseController {
146 149
         // 农机总数
147 150
         int totalMachineryNum = iTaMachineryService.countBy("1", 1, true);
148 151
         // 设备总数
149
-        int totalDeviceNum = iTdDeviceService.countBy("1", 1, true);
152
+        int totalDeviceNum = tdRawDeviceService.countBy("1", 1, false);
150 153
         // 在线设备总数
151
-        int totalOnlineDeviceNum = iTdDeviceService.countBy("online_status", 1, true);
154
+        int totalOnlineDeviceNum = tdRawDeviceService.countBy("device_status", 1, false);
152 155
         //
153 156
         Double totalAreaNum = taDeviceJobService.sumArea();
154 157
 

+ 1
- 1
src/main/java/com/yunzhi/nanyang/controller/SysUserController.java View File

@@ -67,7 +67,7 @@ public class SysUserController extends BaseController {
67 67
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
68 68
     public ResponseBean sysUserList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
69 69
                                     @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
70
-                                    @ApiParam("机构") @RequestParam(value ="org_id", required = false) String orgId,
70
+                                    @ApiParam("机构") @RequestParam(value ="orgId", required = false) String orgId,
71 71
                                     @ApiParam("名称") @RequestParam(value ="userName", required = false) String userName,
72 72
                                     @ApiParam("手机号") @RequestParam(value ="phone", required = false) String phone) throws Exception{
73 73
 

+ 33
- 17
src/main/java/com/yunzhi/nanyang/controller/TdRawDeviceController.java View File

@@ -4,17 +4,17 @@ import com.alibaba.fastjson.JSONObject;
4 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
6 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
-import com.yunzhi.nanyang.common.BaseController;
8
-import com.yunzhi.nanyang.common.HttpUtils;
9
-import com.yunzhi.nanyang.common.ResponseBean;
7
+import com.yunzhi.nanyang.common.*;
10 8
 
11 9
 import java.time.LocalDateTime;
12 10
 import java.util.List;
13 11
 
14
-import com.yunzhi.nanyang.common.StringUtils;
12
+import com.yunzhi.nanyang.entity.TdDevice;
13
+import com.yunzhi.nanyang.service.ITdDeviceService;
15 14
 import io.swagger.annotations.Api;
16 15
 import io.swagger.annotations.ApiOperation;
17 16
 import io.swagger.annotations.ApiParam;
17
+import org.apache.poi.ss.formula.functions.T;
18 18
 import org.springframework.beans.factory.annotation.Autowired;
19 19
 import org.springframework.beans.factory.annotation.Value;
20 20
 import org.springframework.web.bind.annotation.*;
@@ -41,6 +41,9 @@ public class TdRawDeviceController extends BaseController {
41 41
     @Autowired
42 42
     private TdRawDeviceService tdRawDeviceService;
43 43
 
44
+    @Autowired
45
+    private ITdDeviceService iTdDeviceService;
46
+
44 47
 //    /** 
45 48
 //     * 通过ID查询单条数据 
46 49
 //     *
@@ -107,6 +110,7 @@ public class TdRawDeviceController extends BaseController {
107 110
         tdRawDevice.setDeviceStatus(0); // 默认离线
108 111
         tdRawDevice.setCreateDate(LocalDateTime.now());
109 112
         tdRawDeviceService.save(tdRawDevice);
113
+
110 114
         return ResponseBean.success(tdRawDevice);
111 115
     }
112 116
 
@@ -123,17 +127,29 @@ public class TdRawDeviceController extends BaseController {
123 127
         String s = httpUtils.get(url);
124 128
         return JSONObject.parseObject(s, ResponseBean.class);
125 129
     }
126
-//    
127
-//    /** 
128
-//     * 通过主键删除数据
129
-//     *
130
-//     * @param deviceId 主键
131
-//     * @return 是否成功
132
-//     */
133
-//    @ApiOperation("通过主键删除数据")
134
-//    @DeleteMapping("/raw-device/{id}")
135
-//    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id){
136
-//        tdRawDeviceService.removeLogicById(id);
137
-//        return ResponseBean.success("success");
138
-//    }
130
+
131
+    /**
132
+     * 通过主键删除数据
133
+     *
134
+     * @param deviceId 主键
135
+     * @return 是否成功
136
+     */
137
+    @ApiOperation("通过主键删除数据")
138
+    @DeleteMapping("/admin/raw-device/{id}")
139
+    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id){
140
+
141
+        TdRawDevice tdRawDevice = tdRawDeviceService.getById(id);
142
+        if (null == tdRawDevice) {
143
+            return ResponseBean.error("未找到数据");
144
+        }
145
+
146
+        TdDevice tdDevice = iTdDeviceService.getExistByDevice(tdRawDevice.getDeviceKind(), tdRawDevice.getDeviceNo());
147
+        if (null != tdDevice) {
148
+            tdDevice.setStatus(Constants.STATUS_DELETE);
149
+            iTdDeviceService.updateById(tdDevice);
150
+        }
151
+
152
+        tdRawDeviceService.removeById(id);
153
+        return ResponseBean.success("success");
154
+    }
139 155
 }

+ 3
- 0
src/main/java/com/yunzhi/nanyang/entity/TaMachinery.java View File

@@ -67,6 +67,9 @@ public class TaMachinery implements Serializable {
67 67
     @ApiModelProperty(value = "当前位置")
68 68
     private String location;
69 69
 
70
+    @ApiModelProperty(value = "位置信息")
71
+    private String locAddr;
72
+
70 73
     @ApiModelProperty(value = "APP 注册状态")
71 74
     private String appStatus;
72 75
 

+ 3
- 0
src/main/java/com/yunzhi/nanyang/entity/TdDevice.java View File

@@ -51,6 +51,9 @@ public class TdDevice implements Serializable {
51 51
     @ApiModelProperty(value = "定位")
52 52
     private String location;
53 53
 
54
+    @ApiModelProperty(value = "位置信息")
55
+    private String address;
56
+
54 57
     @ApiModelProperty(value = "在线状态")
55 58
     private Integer onlineStatus;
56 59
 

+ 6
- 0
src/main/java/com/yunzhi/nanyang/entity/TdRawDevice.java View File

@@ -39,6 +39,12 @@ public class TdRawDevice implements Serializable,Cloneable{
39 39
     /** 具体信息;全部信息json格式 */
40 40
     @ApiModelProperty(name = "具体信息",notes = "全部信息json格式")
41 41
     private String deviceInfo ;
42
+
43
+     @ApiModelProperty(value = "定位")
44
+     private String location;
45
+
46
+     @ApiModelProperty(value = "位置信息")
47
+     private String address;
42 48
     /** 设备状态;0离线,1在线 */
43 49
     @ApiModelProperty(name = "设备状态",notes = "0离线,1在线")
44 50
     private Integer deviceStatus ;

+ 2
- 1
src/main/resources/mapper/TdDeviceMapper.xml View File

@@ -4,7 +4,7 @@
4 4
 
5 5
     <select id="getPageBy" resultType="com.yunzhi.nanyang.entity.TdDevice">
6 6
         SELECT
7
-            s.device_id,
7
+            t.device_id,
8 8
             t.device_no,
9 9
             t.device_kind AS device_type,
10 10
             s.machinery_id,
@@ -49,6 +49,7 @@
49 49
                 INNER JOIN ta_machinery s ON t.machinery_id = s.machinery_id
50 50
         WHERE
51 51
             t.location IS NOT NULL
52
+          AND t.status &gt; -1
52 53
           AND t.device_type IN
53 54
             <foreach collection="typeList" index="index" item="item" open="(" separator="," close=")">
54 55
                 #{item}