张延森 il y a 3 ans
Parent
révision
dbf11f7f8d

+ 5
- 0
pom.xml Voir le fichier

@@ -135,6 +135,7 @@
135 135
 			<artifactId>sa-token-jwt</artifactId>
136 136
 			<version>1.29.0</version>
137 137
 		</dependency>
138
+
138 139
 	</dependencies>
139 140
 
140 141
 	<profiles>
@@ -153,6 +154,7 @@
153 154
 						<groupId>org.springframework.boot</groupId>
154 155
 						<artifactId>spring-boot-maven-plugin</artifactId>
155 156
 						<configuration>
157
+							<includeSystemScope>true</includeSystemScope>
156 158
 							<excludes>
157 159
 								<exclude>
158 160
 									<groupId>org.springframework.boot</groupId>
@@ -204,6 +206,9 @@
204 206
 					<plugin>
205 207
 						<groupId>org.springframework.boot</groupId>
206 208
 						<artifactId>spring-boot-maven-plugin</artifactId>
209
+						<configuration>
210
+							<includeSystemScope>true</includeSystemScope>
211
+						</configuration>
207 212
 					</plugin>
208 213
 
209 214
 					<!-- 跳过测试 -->

+ 9
- 0
src/main/java/com/yunzhi/nanyang/common/ResponseBean.java Voir le fichier

@@ -60,14 +60,23 @@ public class ResponseBean<T> implements Serializable {
60 60
     public int getCode() {
61 61
         return code;
62 62
     }
63
+    public void setCode(int code) {
64
+        this.code = code;
65
+    }
63 66
 
64 67
     public String getMessage() {
65 68
         return message;
66 69
     }
70
+    public void setMessage(String message) {
71
+        this.message = message;
72
+    }
67 73
 
68 74
     public T getData() {
69 75
         return data;
70 76
     }
77
+    public void setData(T data) {
78
+        this.data = data;
79
+    }
71 80
     
72 81
     @Override
73 82
     public String toString() {

+ 6
- 0
src/main/java/com/yunzhi/nanyang/common/StringUtils.java Voir le fichier

@@ -42,6 +42,12 @@ public class StringUtils {
42 42
         return isEmpty(src) ? defaultVal : src;
43 43
     }
44 44
 
45
+    public static String like(String src) {
46
+        if (null == src) return null;
47
+        if ("".equals(src)) return src;
48
+        return "%" + src + "%";
49
+    }
50
+
45 51
     public static String random(int length) {
46 52
         String str="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
47 53
         Random random = new Random();

+ 62
- 11
src/main/java/com/yunzhi/nanyang/controller/TaMachineryController.java Voir le fichier

@@ -1,17 +1,13 @@
1 1
 package com.yunzhi.nanyang.controller;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
3 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
-import com.yunzhi.nanyang.common.BaseController;
7
-import com.yunzhi.nanyang.common.Constants;
8
-import com.yunzhi.nanyang.common.ResponseBean;
9
-import com.yunzhi.nanyang.common.StringUtils;
10
-import com.yunzhi.nanyang.entity.SysUser;
11
-import com.yunzhi.nanyang.entity.TaOrder;
12
-import com.yunzhi.nanyang.entity.TaPerson;
13
-import com.yunzhi.nanyang.service.ISysUserService;
14
-import com.yunzhi.nanyang.service.ITaOrderService;
7
+import com.yunzhi.nanyang.common.*;
8
+import com.yunzhi.nanyang.entity.*;
9
+import com.yunzhi.nanyang.service.*;
10
+import com.yunzhi.nanyang.vo.DeviceSummary;
15 11
 import com.yunzhi.nanyang.vo.MachineSummary;
16 12
 import io.swagger.annotations.Api;
17 13
 import io.swagger.annotations.ApiOperation;
@@ -20,16 +16,17 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
20 16
 import org.slf4j.Logger;
21 17
 import org.slf4j.LoggerFactory;
22 18
 import org.springframework.beans.factory.annotation.Autowired;
19
+import org.springframework.beans.factory.annotation.Value;
23 20
 import org.springframework.web.bind.annotation.PathVariable;
24 21
 import org.springframework.web.bind.annotation.RequestBody;
25 22
 import org.springframework.web.bind.annotation.RequestMapping;
26 23
 import org.springframework.web.bind.annotation.RequestMethod;
27 24
 import org.springframework.web.bind.annotation.RequestParam;
28
-import com.yunzhi.nanyang.service.ITaMachineryService;
29
-import com.yunzhi.nanyang.entity.TaMachinery;
30 25
 import org.springframework.web.bind.annotation.RestController;
31 26
 
27
+import java.util.HashMap;
32 28
 import java.util.List;
29
+import java.util.Map;
33 30
 
34 31
 /**
35 32
  * <p>
@@ -56,6 +53,17 @@ public class TaMachineryController extends BaseController {
56 53
     @Autowired
57 54
     public ITaOrderService iTaOrderService;
58 55
 
56
+    @Autowired
57
+    public ITdDeviceService iTdDeviceService;
58
+
59
+    @Autowired
60
+    public ITdHatcDeviceService iTdHatcDeviceService;
61
+
62
+    @Autowired
63
+    public HttpUtils httpUtils;
64
+
65
+    @Value("${hatc.apiServer}")
66
+    private String hatcApiServer;
59 67
 
60 68
     /**
61 69
      * 分页查询列表
@@ -230,4 +238,47 @@ public class TaMachineryController extends BaseController {
230 238
 
231 239
         return ResponseBean.success(taOrderList);
232 240
     }
241
+
242
+    /**
243
+     * 车辆实时预览
244
+     * @param id  实体ID
245
+     */
246
+    @RequestMapping(value="/admin/machinery/{id}/preview",method= RequestMethod.GET)
247
+    @ApiOperation(value="车辆实时预览", notes = "车辆实时预览", httpMethod = "GET", response = ResponseBean.class)
248
+    public ResponseBean machineryPreview(@ApiParam("对象ID") @PathVariable String id) throws Exception{
249
+
250
+        TdDevice tdDevice = iTdDeviceService.getExistBy("machinery_id", id, false, true);
251
+        if (tdDevice == null) {
252
+            return ResponseBean.error("当前车辆未绑定设备");
253
+        }
254
+
255
+        DeviceSummary deviceSummary = JSONObject.parseObject(tdDevice.getApiConfig(), DeviceSummary.class);
256
+        TdHatcDevice hatcDevice = iTdHatcDeviceService.getById(deviceSummary.getDeviceId());
257
+
258
+        if (hatcDevice == null || null == hatcDevice.getDeviceStatus() || hatcDevice.getDeviceStatus() != 1) {
259
+            return ResponseBean.error("车辆设备离线");
260
+        }
261
+
262
+        String url = String.format("%s/preview?terminalID=%s&productKey=%s&channelNo=%d&netType=%d",
263
+                hatcApiServer,
264
+                StringUtils.urlEncode(hatcDevice.getTerminalId()),
265
+                StringUtils.urlEncode(hatcDevice.getProductKey()),
266
+                deviceSummary.getChannel(),
267
+                deviceSummary.getNetType()
268
+                );
269
+
270
+        String respStr = httpUtils.get(url);
271
+        ResponseBean responseBean = JSONObject.parseObject(respStr, ResponseBean.class);
272
+
273
+        Map<String, Object> data = new HashMap<>();
274
+        data.put("url", responseBean.getData());
275
+        data.put("devSerialNum", hatcDevice.getTerminalId());
276
+        data.put("productKey", hatcDevice.getProductKey());
277
+        data.put("channel", deviceSummary.getChannel());
278
+        data.put("streamType", 1);  // 0 主码流, 1 子码流
279
+        data.put("code", 0);
280
+        data.put("protocol", 0);
281
+
282
+        return ResponseBean.success(data);
283
+    }
233 284
 }

+ 131
- 51
src/main/java/com/yunzhi/nanyang/controller/TdDeviceController.java Voir le fichier

@@ -1,10 +1,17 @@
1 1
 package com.yunzhi.nanyang.controller;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
3 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 7
 import com.yunzhi.nanyang.common.BaseController;
7 8
 import com.yunzhi.nanyang.common.ResponseBean;
9
+import com.yunzhi.nanyang.common.StringUtils;
10
+import com.yunzhi.nanyang.entity.TaMachinery;
11
+import com.yunzhi.nanyang.entity.TdHatcDevice;
12
+import com.yunzhi.nanyang.service.ITaMachineryService;
13
+import com.yunzhi.nanyang.service.ITdHatcDeviceService;
14
+import com.yunzhi.nanyang.vo.DeviceSummary;
8 15
 import io.swagger.annotations.Api;
9 16
 import io.swagger.annotations.ApiOperation;
10 17
 import io.swagger.annotations.ApiParam;
@@ -39,81 +46,154 @@ public class TdDeviceController extends BaseController {
39 46
     @Autowired
40 47
     public ITdDeviceService iTdDeviceService;
41 48
 
49
+    @Autowired
50
+    public ITdHatcDeviceService iTdHatcDeviceService;
42 51
 
43
-    /**
44
-     * 分页查询列表
45
-     * @param pageNum
46
-     * @param pageSize
47
-     * @return
48
-     */
49
-    @RequestMapping(value="/tdDevice",method= RequestMethod.GET)
50
-    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
-    public ResponseBean tdDeviceList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
-
54
-		    IPage<TdDevice> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TdDevice> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
52
+    @Autowired
53
+    public ITaMachineryService iTaMachineryService;
57 54
 
58
-            IPage<TdDevice> result = iTdDeviceService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
60
-    }
55
+//
56
+//    /**
57
+//     * 分页查询列表
58
+//     * @param pageNum
59
+//     * @param pageSize
60
+//     * @return
61
+//     */
62
+//    @RequestMapping(value="/tdDevice",method= RequestMethod.GET)
63
+//    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
64
+//    public ResponseBean tdDeviceList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
65
+//									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
66
+//
67
+//		    IPage<TdDevice> pg = new Page<>(pageNum, pageSize);
68
+//            QueryWrapper<TdDevice> queryWrapper = new QueryWrapper<>();
69
+//            queryWrapper.orderByDesc("create_date");
70
+//
71
+//            IPage<TdDevice> result = iTdDeviceService.page(pg, queryWrapper);
72
+//            return ResponseBean.success(result);
73
+//    }
61 74
 
62 75
     /**
63 76
      * 保存对象
64 77
      * @param tdDevice 实体对象
65 78
      * @return
66 79
      */
67
-    @RequestMapping(value="/tdDevice",method= RequestMethod.POST)
80
+    @RequestMapping(value="/admin/device",method= RequestMethod.POST)
68 81
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69 82
     public ResponseBean tdDeviceAdd(@ApiParam("保存内容") @RequestBody TdDevice tdDevice) throws Exception{
70 83
 
71
-        if (iTdDeviceService.save(tdDevice)){
72
-            return ResponseBean.success(tdDevice);
73
-        }else {
74
-            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
84
+        boolean isNew = StringUtils.isEmpty(tdDevice.getDeviceId());
85
+
86
+        if (StringUtils.isEmpty(tdDevice.getMachineryId())) {
87
+            return ResponseBean.error("未绑定农机");
75 88
         }
76
-    }
77 89
 
78
-    /**
79
-     * 根据id删除对象
80
-     * @param id  实体ID
81
-     */
82
-    @RequestMapping(value="/tdDevice/{id}", method= RequestMethod.DELETE)
83
-    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean tdDeviceDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
-        if(iTdDeviceService.removeById(id)){
86
-            return ResponseBean.success("success");
87
-        }else {
88
-            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
90
+        TdDevice origin = iTdDeviceService.getExistBy("machinery_id", tdDevice.getMachineryId(), false, true);
91
+        if (isNew) {
92
+            // 如果是新增操作
93
+            if (null != origin) {
94
+                return ResponseBean.error("该农机已绑定设备");
95
+            }
96
+        } else {
97
+            if (null != origin) {
98
+                // 如果非新增操作, 并且当前的 id 与 数据库 id 不一致
99
+                if (!tdDevice.getDeviceId().equals(origin.getDeviceId())) {
100
+                    return ResponseBean.error("该农机已绑定设备");
101
+                }
102
+            } else {
103
+                isNew = true;
104
+            }
89 105
         }
90
-    }
91 106
 
92
-    /**
93
-     * 修改对象
94
-     * @param id  实体ID
95
-     * @param tdDevice 实体对象
96
-     * @return
97
-     */
98
-    @RequestMapping(value="/tdDevice/{id}",method= RequestMethod.PUT)
99
-    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
-    public ResponseBean tdDeviceUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
-                                        @ApiParam("更新内容") @RequestBody TdDevice tdDevice) throws Exception{
107
+        if (StringUtils.isEmpty(tdDevice.getApiConfig())) {
108
+            return ResponseBean.error("未绑定海康设备");
109
+        }
110
+
111
+        TaMachinery taMachinery = iTaMachineryService.getExistBy("machinery_id", tdDevice.getMachineryId(), false, true);
112
+        if (taMachinery == null) {
113
+            return ResponseBean.error("绑定农机不存在");
114
+        }
115
+
116
+        try {
117
+            DeviceSummary deviceSummary = JSONObject.parseObject(tdDevice.getApiConfig(), DeviceSummary.class);
118
+            if (null == deviceSummary) {
119
+                return ResponseBean.error("未绑定海康设备");
120
+            }
121
+
122
+            if (StringUtils.isEmpty(deviceSummary.getDeviceId())) {
123
+                return ResponseBean.error("未绑定海康设备");
124
+            }
102 125
 
103
-        if (iTdDeviceService.updateById(tdDevice)){
104
-            return ResponseBean.success(iTdDeviceService.getById(id));
126
+            TdHatcDevice hatcDevice = iTdHatcDeviceService.getById(deviceSummary.getDeviceId());
127
+            if (null == hatcDevice) {
128
+                return ResponseBean.error("绑定的海康设备不存在");
129
+            }
130
+
131
+            if (null == deviceSummary.getChannel() || deviceSummary.getChannel() < 1) {
132
+                return ResponseBean.error("未设置通道号, 或者通道号不正确");
133
+            }
134
+
135
+            if (null == deviceSummary.getNetType() || deviceSummary.getNetType() < 0 || deviceSummary.getNetType() > 3) {
136
+                return ResponseBean.error("未设置网络类型, 或者网络类型不正确");
137
+            }
138
+
139
+            tdDevice.setDeviceNo(hatcDevice.getTerminalId());
140
+            tdDevice.setDeviceType(hatcDevice.getProductKey());
141
+            taMachinery.setOnlineStatus(hatcDevice.getDeviceStatus());
142
+        } catch (Exception e) {
143
+            e.printStackTrace();
144
+            return ResponseBean.error("海康设备参数无效");
145
+        }
146
+
147
+        boolean isOk = isNew ? iTdDeviceService.save(tdDevice) : iTdDeviceService.updateById(tdDevice);
148
+        iTaMachineryService.updateById(taMachinery);
149
+
150
+        if (isOk){
151
+            return ResponseBean.success(tdDevice);
105 152
         }else {
106
-            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
153
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
107 154
         }
108 155
     }
156
+//
157
+//    /**
158
+//     * 根据id删除对象
159
+//     * @param id  实体ID
160
+//     */
161
+//    @RequestMapping(value="/tdDevice/{id}", method= RequestMethod.DELETE)
162
+//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
163
+//    public ResponseBean tdDeviceDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
164
+//        if(iTdDeviceService.removeById(id)){
165
+//            return ResponseBean.success("success");
166
+//        }else {
167
+//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
168
+//        }
169
+//    }
170
+//
171
+//    /**
172
+//     * 修改对象
173
+//     * @param id  实体ID
174
+//     * @param tdDevice 实体对象
175
+//     * @return
176
+//     */
177
+//    @RequestMapping(value="/tdDevice/{id}",method= RequestMethod.PUT)
178
+//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
179
+//    public ResponseBean tdDeviceUpdate(@ApiParam("对象ID") @PathVariable Integer id,
180
+//                                        @ApiParam("更新内容") @RequestBody TdDevice tdDevice) throws Exception{
181
+//
182
+//        if (iTdDeviceService.updateById(tdDevice)){
183
+//            return ResponseBean.success(iTdDeviceService.getById(id));
184
+//        }else {
185
+//            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
186
+//        }
187
+//    }
109 188
 
110 189
     /**
111 190
      * 根据id查询对象
112 191
      * @param id  实体ID
113 192
      */
114
-    @RequestMapping(value="/tdDevice/{id}",method= RequestMethod.GET)
193
+    @RequestMapping(value="/admin/machinery/{id}/device",method= RequestMethod.GET)
115 194
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean tdDeviceGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
-        return ResponseBean.success(iTdDeviceService.getById(id));
195
+    public ResponseBean tdDeviceGet(@ApiParam("农机ID") @PathVariable String id) throws Exception{
196
+        TdDevice tdDevice = iTdDeviceService.getExistBy("machinery_id", id, false, true);
197
+        return ResponseBean.success(tdDevice);
118 198
     }
119 199
 }

+ 74
- 0
src/main/java/com/yunzhi/nanyang/controller/TdHatcDeviceController.java Voir le fichier

@@ -0,0 +1,74 @@
1
+package com.yunzhi.nanyang.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.nanyang.common.BaseController;
7
+import com.yunzhi.nanyang.common.ResponseBean;
8
+import com.yunzhi.nanyang.common.StringUtils;
9
+import io.swagger.annotations.Api;
10
+import io.swagger.annotations.ApiOperation;
11
+import io.swagger.annotations.ApiParam;
12
+import org.slf4j.Logger;
13
+import org.slf4j.LoggerFactory;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.web.bind.annotation.PathVariable;
16
+import org.springframework.web.bind.annotation.RequestBody;
17
+import org.springframework.web.bind.annotation.RequestMapping;
18
+import org.springframework.web.bind.annotation.RequestMethod;
19
+import org.springframework.web.bind.annotation.RequestParam;
20
+import com.yunzhi.nanyang.service.ITdHatcDeviceService;
21
+import com.yunzhi.nanyang.entity.TdHatcDevice;
22
+import org.springframework.web.bind.annotation.RestController;
23
+
24
+/**
25
+ * <p>
26
+    * 海康设备表 前端控制器
27
+    * </p>
28
+ *
29
+ * @author yansen
30
+ * @since 2022-05-11
31
+ */
32
+
33
+@Api(tags = "海康设备表")
34
+@RestController
35
+@RequestMapping("/")
36
+public class TdHatcDeviceController extends BaseController {
37
+
38
+    private final Logger logger = LoggerFactory.getLogger(TdHatcDeviceController.class);
39
+
40
+    @Autowired
41
+    public ITdHatcDeviceService iTdHatcDeviceService;
42
+
43
+
44
+    /**
45
+     * 分页查询列表
46
+     * @param pageNum
47
+     * @param pageSize
48
+     * @return
49
+     */
50
+    @RequestMapping(value="/admin/hatc-device",method= RequestMethod.GET)
51
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
52
+    public ResponseBean getList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
53
+                                @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
54
+                                @ApiParam("终端ID") @RequestParam(value ="terminalId", required = false) String terminalId) throws Exception{
55
+
56
+        IPage<TdHatcDevice> pg = new Page<>(pageNum, pageSize);
57
+        QueryWrapper<TdHatcDevice> queryWrapper = new QueryWrapper<>();
58
+        queryWrapper.like(!StringUtils.isEmpty(terminalId), "terminal_id", StringUtils.like(terminalId));
59
+        queryWrapper.orderByDesc("terminal_id");
60
+
61
+        IPage<TdHatcDevice> result = iTdHatcDeviceService.page(pg, queryWrapper);
62
+        return ResponseBean.success(result);
63
+    }
64
+
65
+    /**
66
+     * 根据id查询对象
67
+     * @param id  实体ID
68
+     */
69
+    @RequestMapping(value="/admin/hatc-device/{id}",method= RequestMethod.GET)
70
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
71
+    public ResponseBean tdHatcDeviceGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
72
+        return ResponseBean.success(iTdHatcDeviceService.getById(id));
73
+    }
74
+}

+ 3
- 0
src/main/java/com/yunzhi/nanyang/entity/TaMachinery.java Voir le fichier

@@ -83,6 +83,9 @@ public class TaMachinery implements Serializable {
83 83
     @ApiModelProperty(value = "状态")
84 84
     private Integer status;
85 85
 
86
+    @ApiModelProperty(value = "设备状态, 1在线")
87
+    private Integer onlineStatus;
88
+
86 89
     @ApiModelProperty(value = "创建用户")
87 90
     private String createUser;
88 91
 

+ 6
- 0
src/main/java/com/yunzhi/nanyang/entity/TaMachineryGps.java Voir le fichier

@@ -30,6 +30,9 @@ public class TaMachineryGps implements Serializable {
30 30
     @TableId(value = "serial_no", type = IdType.AUTO)
31 31
     private Integer serialNo;
32 32
 
33
+    @ApiModelProperty(value = "设备ID,海康设备表")
34
+    private String deviceId;
35
+
33 36
     @ApiModelProperty(value = "农机ID")
34 37
     private String machineryId;
35 38
 
@@ -39,6 +42,9 @@ public class TaMachineryGps implements Serializable {
39 42
     @ApiModelProperty(value = "维度")
40 43
     private String lat;
41 44
 
45
+    @ApiModelProperty(value = "全部GPS数据")
46
+    private String gpsData;
47
+
42 48
     @ApiModelProperty(value = "创建时间")
43 49
     private LocalDateTime createDate;
44 50
 

+ 1
- 1
src/main/java/com/yunzhi/nanyang/entity/TdDevice.java Voir le fichier

@@ -27,7 +27,7 @@ public class TdDevice implements Serializable {
27 27
     private static final long serialVersionUID = 1L;
28 28
 
29 29
     @ApiModelProperty(value = "设备ID")
30
-    @TableId(value = "device_id", type = IdType.INPUT)
30
+    @TableId(value = "device_id", type = IdType.UUID)
31 31
     private String deviceId;
32 32
 
33 33
     @ApiModelProperty(value = "设备号")

+ 91
- 0
src/main/java/com/yunzhi/nanyang/entity/TdHatcDevice.java Voir le fichier

@@ -0,0 +1,91 @@
1
+package com.yunzhi.nanyang.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import java.io.Serializable;
6
+import io.swagger.annotations.ApiModel;
7
+import io.swagger.annotations.ApiModelProperty;
8
+import lombok.Data;
9
+import lombok.EqualsAndHashCode;
10
+import lombok.experimental.Accessors;
11
+
12
+/**
13
+ * <p>
14
+ * 海康设备表
15
+ * </p>
16
+ *
17
+ * @author yansen
18
+ * @since 2022-05-11
19
+ */
20
+@Data
21
+@EqualsAndHashCode(callSuper = false)
22
+@Accessors(chain = true)
23
+@ApiModel(value="TdHatcDevice对象", description="海康设备表")
24
+public class TdHatcDevice implements Serializable {
25
+
26
+    private static final long serialVersionUID = 1L;
27
+
28
+    @ApiModelProperty(value = "ID")
29
+    @TableId(value = "device_id", type = IdType.UUID)
30
+    private String deviceId;
31
+
32
+    private String modelCode;
33
+    private String modelName;
34
+    private String protocol;
35
+
36
+    @ApiModelProperty(value = "终端ID;必填")
37
+    private String terminalId;
38
+
39
+    @ApiModelProperty(value = "产品密钥;设备所属型号的产品密钥,必填")
40
+    private String productKey;
41
+
42
+    @ApiModelProperty(value = "设备型号名称;选填")
43
+    private String deviceModel;
44
+
45
+    @ApiModelProperty(value = "设备名称;(最长不超过32个字),选填")
46
+    private String deviceName;
47
+
48
+    @ApiModelProperty(value = "软件版本;选填")
49
+    private String version;
50
+
51
+    @ApiModelProperty(value = "软件版本时间;(格式:yyyy-MM-dd),选填")
52
+    private String softwareVerTime;
53
+
54
+    @ApiModelProperty(value = "出厂时间;(格式:yyyy-MM-dd),选填")
55
+    private String createTime;
56
+
57
+    @ApiModelProperty(value = "在线状态;0:离线;1:在线,选填")
58
+    private Integer deviceStatus;
59
+
60
+    @ApiModelProperty(value = "SIM卡号;选填")
61
+    private String simcardNum;
62
+
63
+    @ApiModelProperty(value = "固件语言;必填")
64
+    private String language;
65
+
66
+    @ApiModelProperty(value = "厂商名;选填")
67
+    private String manufacturerName;
68
+
69
+    @ApiModelProperty(value = "验证码;选填")
70
+    private String cerificationCode;
71
+
72
+    @ApiModelProperty(value = "冻结状态;0:正常;1:冻结,选填")
73
+    private Integer useStatus;
74
+
75
+    @ApiModelProperty(value = "自动解冻时间;useStatus为 1 时该字段有效,选填")
76
+    private String useTime;
77
+
78
+    @ApiModelProperty(value = "设备在AMS系统中的项目编号;如果是ARM系统,该字段必填,其他系统该字段不填")
79
+    private String amsProjectCode;
80
+
81
+    @ApiModelProperty(value = "设备通道列表;选填")
82
+    private String deviceChannelList;
83
+
84
+    @ApiModelProperty(value = "车牌号;选填")
85
+    private String plateNum;
86
+
87
+    @ApiModelProperty(value = "机构ID")
88
+    private String orgId;
89
+
90
+
91
+}

+ 1
- 1
src/main/java/com/yunzhi/nanyang/mapper/TaOrderMapper.java Voir le fichier

@@ -50,7 +50,7 @@ public interface TaOrderMapper extends BaseMapper<TaOrder> {
50 50
 
51 51
     List<TaOrder> checkMachineryDuty(@Param("machineryId") String machineryId,@Param("appointmentDate") String appointmentDate);
52 52
 
53
-    @Update("UPDATE ta_order SET pay_status = #{payStatus} WHERE order_id = #{orderId}")
53
+//    @Update("UPDATE ta_order SET pay_status = #{payStatus} WHERE order_id = #{orderId}")
54 54
     int updatePayStatus(@Param("orderId") String orderId, @Param("payStatus") int payStatus);
55 55
 
56 56
     @Update("UPDATE ta_order SET dispatch_status = #{dispatchStatus} WHERE order_id = #{orderId}")

+ 18
- 0
src/main/java/com/yunzhi/nanyang/mapper/TdHatcDeviceMapper.java Voir le fichier

@@ -0,0 +1,18 @@
1
+package com.yunzhi.nanyang.mapper;
2
+
3
+import com.yunzhi.nanyang.entity.TdHatcDevice;
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 海康设备表 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2022-05-11
14
+ */
15
+@Mapper
16
+public interface TdHatcDeviceMapper extends BaseMapper<TdHatcDevice> {
17
+
18
+}

+ 16
- 0
src/main/java/com/yunzhi/nanyang/service/ITdHatcDeviceService.java Voir le fichier

@@ -0,0 +1,16 @@
1
+package com.yunzhi.nanyang.service;
2
+
3
+import com.yunzhi.nanyang.entity.TdHatcDevice;
4
+import com.baomidou.mybatisplus.extension.service.IService;
5
+
6
+/**
7
+ * <p>
8
+ * 海康设备表 服务类
9
+ * </p>
10
+ *
11
+ * @author yansen
12
+ * @since 2022-05-11
13
+ */
14
+public interface ITdHatcDeviceService extends IService<TdHatcDevice> {
15
+
16
+}

+ 22
- 0
src/main/java/com/yunzhi/nanyang/service/impl/TdHatcDeviceServiceImpl.java Voir le fichier

@@ -0,0 +1,22 @@
1
+package com.yunzhi.nanyang.service.impl;
2
+
3
+import com.yunzhi.nanyang.entity.TdHatcDevice;
4
+import com.yunzhi.nanyang.mapper.TdHatcDeviceMapper;
5
+import com.yunzhi.nanyang.service.ITdHatcDeviceService;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import lombok.extern.slf4j.Slf4j;
8
+import org.springframework.stereotype.Service;
9
+
10
+/**
11
+ * <p>
12
+ * 海康设备表 服务实现类
13
+ * </p>
14
+ *
15
+ * @author yansen
16
+ * @since 2022-05-11
17
+ */
18
+@Slf4j
19
+@Service
20
+public class TdHatcDeviceServiceImpl extends ServiceImpl<TdHatcDeviceMapper, TdHatcDevice> implements ITdHatcDeviceService {
21
+
22
+}

+ 19
- 0
src/main/java/com/yunzhi/nanyang/vo/DeviceSummary.java Voir le fichier

@@ -0,0 +1,19 @@
1
+package com.yunzhi.nanyang.vo;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+@ApiModel("设备信息")
8
+@Data
9
+public class DeviceSummary {
10
+
11
+    @ApiModelProperty(value = "设备ID")
12
+    private String deviceId;
13
+
14
+    @ApiModelProperty(value = "通道号")
15
+    private Integer channel;
16
+
17
+    @ApiModelProperty(value = "网络类型, 0 内网, 1 电信, 2 移动, 3 联通")
18
+    private Integer netType;
19
+}

+ 1
- 0
src/main/resources/application-dev.yml Voir le fichier

@@ -14,3 +14,4 @@ logging:
14 14
   level:
15 15
     root: info
16 16
     springfox: info
17
+

+ 5
- 0
src/main/resources/application.yml Voir le fichier

@@ -36,6 +36,11 @@ sms:
36 36
     code: SMS_207555188
37 37
     sign: 云致科技
38 38
 
39
+###
40
+hatc:
41
+  ### 海康接口服务, 自己写的
42
+  apiServer: http://localhost:7081
43
+
39 44
 ###
40 45
 yz:
41 46
   default:

+ 5
- 0
src/main/resources/mapper/TdHatcDeviceMapper.xml Voir le fichier

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.yunzhi.nanyang.mapper.TdHatcDeviceMapper">
4
+
5
+</mapper>

BIN
ssl/toSDK_D_SUB_HNYJ_1650285541603_Bc41O8/rootca.jks Voir le fichier


BIN
ssl/toSDK_D_SUB_HNYJ_1650285541603_bIBBd6/rootca.jks Voir le fichier


BIN
ssl/toSDK_D_SUB_HNYJ_1650285541603_gz8ERI/rootca.jks Voir le fichier