Yansen 2 年之前
父節點
當前提交
9fd1128dfa

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

47
     @Autowired
47
     @Autowired
48
     TaDeviceJobService taDeviceJobService;
48
     TaDeviceJobService taDeviceJobService;
49
 
49
 
50
+    @Autowired
51
+    TdRawDeviceService tdRawDeviceService;
52
+
50
 
53
 
51
     @GetMapping("/basic")
54
     @GetMapping("/basic")
52
     @ApiOperation(value="基本数据统计", notes = "基本数据统计", httpMethod = "GET", response = ResponseBean.class)
55
     @ApiOperation(value="基本数据统计", notes = "基本数据统计", httpMethod = "GET", response = ResponseBean.class)
146
         // 农机总数
149
         // 农机总数
147
         int totalMachineryNum = iTaMachineryService.countBy("1", 1, true);
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
         Double totalAreaNum = taDeviceJobService.sumArea();
156
         Double totalAreaNum = taDeviceJobService.sumArea();
154
 
157
 

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

67
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
67
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
68
     public ResponseBean sysUserList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
68
     public ResponseBean sysUserList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
69
                                     @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
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
                                     @ApiParam("名称") @RequestParam(value ="userName", required = false) String userName,
71
                                     @ApiParam("名称") @RequestParam(value ="userName", required = false) String userName,
72
                                     @ApiParam("手机号") @RequestParam(value ="phone", required = false) String phone) throws Exception{
72
                                     @ApiParam("手机号") @RequestParam(value ="phone", required = false) String phone) throws Exception{
73
 
73
 

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

4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.core.metadata.IPage;
6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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
 import java.time.LocalDateTime;
9
 import java.time.LocalDateTime;
12
 import java.util.List;
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
 import io.swagger.annotations.Api;
14
 import io.swagger.annotations.Api;
16
 import io.swagger.annotations.ApiOperation;
15
 import io.swagger.annotations.ApiOperation;
17
 import io.swagger.annotations.ApiParam;
16
 import io.swagger.annotations.ApiParam;
17
+import org.apache.poi.ss.formula.functions.T;
18
 import org.springframework.beans.factory.annotation.Autowired;
18
 import org.springframework.beans.factory.annotation.Autowired;
19
 import org.springframework.beans.factory.annotation.Value;
19
 import org.springframework.beans.factory.annotation.Value;
20
 import org.springframework.web.bind.annotation.*;
20
 import org.springframework.web.bind.annotation.*;
41
     @Autowired
41
     @Autowired
42
     private TdRawDeviceService tdRawDeviceService;
42
     private TdRawDeviceService tdRawDeviceService;
43
 
43
 
44
+    @Autowired
45
+    private ITdDeviceService iTdDeviceService;
46
+
44
 //    /** 
47
 //    /** 
45
 //     * 通过ID查询单条数据 
48
 //     * 通过ID查询单条数据 
46
 //     *
49
 //     *
107
         tdRawDevice.setDeviceStatus(0); // 默认离线
110
         tdRawDevice.setDeviceStatus(0); // 默认离线
108
         tdRawDevice.setCreateDate(LocalDateTime.now());
111
         tdRawDevice.setCreateDate(LocalDateTime.now());
109
         tdRawDeviceService.save(tdRawDevice);
112
         tdRawDeviceService.save(tdRawDevice);
113
+
110
         return ResponseBean.success(tdRawDevice);
114
         return ResponseBean.success(tdRawDevice);
111
     }
115
     }
112
 
116
 
123
         String s = httpUtils.get(url);
127
         String s = httpUtils.get(url);
124
         return JSONObject.parseObject(s, ResponseBean.class);
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 查看文件

67
     @ApiModelProperty(value = "当前位置")
67
     @ApiModelProperty(value = "当前位置")
68
     private String location;
68
     private String location;
69
 
69
 
70
+    @ApiModelProperty(value = "位置信息")
71
+    private String locAddr;
72
+
70
     @ApiModelProperty(value = "APP 注册状态")
73
     @ApiModelProperty(value = "APP 注册状态")
71
     private String appStatus;
74
     private String appStatus;
72
 
75
 

+ 3
- 0
src/main/java/com/yunzhi/nanyang/entity/TdDevice.java 查看文件

51
     @ApiModelProperty(value = "定位")
51
     @ApiModelProperty(value = "定位")
52
     private String location;
52
     private String location;
53
 
53
 
54
+    @ApiModelProperty(value = "位置信息")
55
+    private String address;
56
+
54
     @ApiModelProperty(value = "在线状态")
57
     @ApiModelProperty(value = "在线状态")
55
     private Integer onlineStatus;
58
     private Integer onlineStatus;
56
 
59
 

+ 6
- 0
src/main/java/com/yunzhi/nanyang/entity/TdRawDevice.java 查看文件

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

+ 2
- 1
src/main/resources/mapper/TdDeviceMapper.xml 查看文件

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