|
|
@ -71,7 +71,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
* @return 分页查询结果 |
|
|
|
*/ |
|
|
|
@ApiOperation("分页查询设备列表") |
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:list')")
|
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:list')")
|
|
|
|
@GetMapping("list") |
|
|
|
public TableDataInfo listDevice(DcDevice dcDevice) { |
|
|
|
return getDataTable(dcDeviceService.pageDevice(dcDevice)); |
|
|
@ -83,7 +83,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
* @return 查询结果 |
|
|
|
*/ |
|
|
|
@ApiOperation("统计异常设备") |
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:list')")
|
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:list')")
|
|
|
|
@GetMapping("abnormalDevice") |
|
|
|
public AjaxResult statisticalAnomalyDevice() { |
|
|
|
return AjaxResult.success(dcDeviceService.statisticalAnomalyDevice()); |
|
|
@ -96,7 +96,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
* @return 查询结果 |
|
|
|
*/ |
|
|
|
@ApiOperation("无分页查询设备列表") |
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:query')")
|
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:query')")
|
|
|
|
@GetMapping("query") |
|
|
|
public AjaxResult queryDevice(DcDevice dcDevice) { |
|
|
|
return AjaxResult.success(dcDeviceService.listDevice(dcDevice)); |
|
|
@ -122,7 +122,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
* @return 查询结果 |
|
|
|
*/ |
|
|
|
@ApiOperation("根据id查询设备信息") |
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:query')")
|
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:query')")
|
|
|
|
@GetMapping("{id}") |
|
|
|
public AjaxResult getDevice(@PathVariable String id) { |
|
|
|
return AjaxResult.success(dcDeviceService.getDevice(id)); |
|
|
@ -154,7 +154,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
* @return 新增操作结果 |
|
|
|
*/ |
|
|
|
@ApiOperation("新增") |
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:add')")
|
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:add')")
|
|
|
|
@Log(title = "新增设备", businessType = BusinessType.INSERT) |
|
|
|
@PostMapping |
|
|
|
public AjaxResult addDevice(@Valid @RequestBody DcDevice dcDevice) { |
|
|
@ -168,7 +168,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
* @return 修改操作结果 |
|
|
|
*/ |
|
|
|
@ApiOperation("修改") |
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
|
|
|
@Log(title = "修改设备", businessType = BusinessType.UPDATE) |
|
|
|
@PutMapping |
|
|
|
public AjaxResult editDevice(@Valid @RequestBody DcDevice dcDevice) { |
|
|
@ -182,7 +182,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
* @return 删除操作结果 |
|
|
|
*/ |
|
|
|
@ApiOperation("删除") |
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
|
|
|
@Log(title = "删除", businessType = BusinessType.DELETE) |
|
|
|
@DeleteMapping("{ids}") |
|
|
|
public AjaxResult removeDevice(@PathVariable List<String> ids) { |
|
|
@ -192,10 +192,11 @@ public class DcDeviceController extends BaseController { |
|
|
|
|
|
|
|
/** |
|
|
|
* 导出 |
|
|
|
* @param response 响应 |
|
|
|
* |
|
|
|
* @param response 响应 |
|
|
|
* @param iotDevice 导入数据结果 |
|
|
|
*/ |
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:export')")
|
|
|
|
// @PreAuthorize("@ss.hasPermi('iot:device:export')")
|
|
|
|
@Log(title = "导出设备", businessType = BusinessType.EXPORT) |
|
|
|
@PostMapping("export") |
|
|
|
public void exportDevice(HttpServletResponse response, DcDevice iotDevice) { |
|
|
@ -481,7 +482,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
@PathVariable String deviceId, |
|
|
|
@PathVariable String functionId, |
|
|
|
@RequestBody HashMap<String, Object> props) throws HttpException, IOException { |
|
|
|
//public AjaxResult invokedFunction(@PathVariable String deviceId,@PathVariable String functionId,@RequestBody HashMap<String, Object> props,int operType) throws HttpException, IOException { todo
|
|
|
|
//public AjaxResult invokedFunction(@PathVariable String deviceId,@PathVariable String functionId,@RequestBody HashMap<String, Object> props,int operType) throws HttpException, IOException { todo
|
|
|
|
|
|
|
|
return getAjaxResult(deviceId, functionId, props); |
|
|
|
|
|
|
@ -591,8 +592,8 @@ public class DcDeviceController extends BaseController { |
|
|
|
resultArray.add(getAjaxResult(deviceId, functionId, (HashMap<String, Object>) param)); |
|
|
|
} |
|
|
|
HashMap<String, Object> hashMap = new HashMap<>(); |
|
|
|
hashMap.put("SET", UniversalEnum.SEVEN.getValue()); |
|
|
|
getAjaxResult(deviceId, "SETMD", hashMap); |
|
|
|
hashMap.put(UniversalEnum.SET.getValue(), UniversalEnum.SEVEN.getValue()); |
|
|
|
getAjaxResult(deviceId, UniversalEnum.SETMD.getValue(), hashMap); |
|
|
|
return AjaxResult.success(resultArray); |
|
|
|
} |
|
|
|
|
|
|
@ -633,7 +634,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
* 查询物联设备指定事件数据 |
|
|
|
* |
|
|
|
* @param deviceId 物联设备id |
|
|
|
* @param type 类型 |
|
|
|
* @param type 类型 |
|
|
|
* @param queryParam 查询条件 |
|
|
|
* @return 查询事件结果 |
|
|
|
*/ |
|
|
@ -648,7 +649,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
if (!StringUtils.hasText(deviceId) || !StringUtils.hasText(type)) { |
|
|
|
return AjaxResult.error(UniversalEnum.DEVICE_NOT_CONNECTED.getValue()); |
|
|
|
} |
|
|
|
if (type.equals(UniversalEnum.ALL.getValue())){ |
|
|
|
if (type.equals(UniversalEnum.ALL.getValue())) { |
|
|
|
|
|
|
|
OkHttp okHttp = new OkHttp(); |
|
|
|
|
|
|
@ -656,11 +657,11 @@ public class DcDeviceController extends BaseController { |
|
|
|
|
|
|
|
Response response // 请求响应
|
|
|
|
= okHttp |
|
|
|
.url(iotAddress + UniversalEnum.QUERY_EVENT_DATA_OF_IOT_DEVICES.getValue()+deviceId) // 请求地址
|
|
|
|
.url(iotAddress + UniversalEnum.QUERY_EVENT_DATA_OF_IOT_DEVICES.getValue() + deviceId) // 请求地址
|
|
|
|
.data(requestParams) |
|
|
|
.get(); // 请求方法
|
|
|
|
return JSON.parseObject(response.body().string(), AjaxResult.class); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
return queryPagerDeviceEvents(deviceId, type, queryParam); |
|
|
|
} |
|
|
|
} |
|
|
@ -678,38 +679,37 @@ public class DcDeviceController extends BaseController { |
|
|
|
OkHttp okHttp = new OkHttp(); |
|
|
|
Response response // 请求响应
|
|
|
|
= okHttp |
|
|
|
.url(iotAddress + UniversalEnum.GET_A_PHYSICAL_MODEL_OF_AN_IOT_DEVICE.getValue()+ id) // 请求地址
|
|
|
|
.url(iotAddress + UniversalEnum.GET_A_PHYSICAL_MODEL_OF_AN_IOT_DEVICE.getValue() + id) // 请求地址
|
|
|
|
.get(); // 请求方法
|
|
|
|
return JSON.parseObject(response.body().string(), AjaxResult.class); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 查询上游10公里内的情报板 |
|
|
|
* |
|
|
|
* @author liuwenge |
|
|
|
* @date 2024/4/15 14:22 |
|
|
|
* @param stakeMark |
|
|
|
* @param direction |
|
|
|
* @return com.ruoyi.common.core.domain.AjaxResult |
|
|
|
* @Description 查询上游10公里内的情报板 |
|
|
|
* @author liuwenge |
|
|
|
* @date 2024/4/15 14:22 |
|
|
|
*/ |
|
|
|
@ApiOperation("查询上游10公里内的情报板") |
|
|
|
@PostMapping("/selectNearBoard") |
|
|
|
public AjaxResult selectNearBoard(@ApiParam(value="桩号", name="stakeMark", required=true) @RequestParam ("stakeMark") String stakeMark, |
|
|
|
@ApiParam(value="方向", name="direction", required=true) @RequestParam ("direction") String direction){ |
|
|
|
return dcDeviceService.selectNearBoard(stakeMark,direction); |
|
|
|
public AjaxResult selectNearBoard(@ApiParam(value = "桩号", name = "stakeMark", required = true) @RequestParam("stakeMark") String stakeMark, |
|
|
|
@ApiParam(value = "方向", name = "direction", required = true) @RequestParam("direction") String direction) { |
|
|
|
return dcDeviceService.selectNearBoard(stakeMark, direction); |
|
|
|
} |
|
|
|
|
|
|
|
@OperationLog(operUrl = "/business/device/batchFunctions") |
|
|
|
public AjaxResult batchInvokedFunction(Object object) throws HttpException, IOException, InterruptedException { |
|
|
|
//public AjaxResult batchInvokedFunction(Object object,int operType) throws HttpException, IOException, InterruptedException { todo
|
|
|
|
//public AjaxResult batchInvokedFunction(Object object,int operType) throws HttpException, IOException, InterruptedException { todo
|
|
|
|
Map<String, Object> map = new ObjectMapper().convertValue(object, Map.class); |
|
|
|
return batchInvokedFunction(map); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 分页查询设备名称列表 |
|
|
|
* |
|
|
|
* @param dcDevice 请求参数 |
|
|
|
* @return 分页查询结果 |
|
|
|
*/ |
|
|
@ -718,9 +718,10 @@ public class DcDeviceController extends BaseController { |
|
|
|
startPage(); |
|
|
|
return getDataTable(dcDeviceService.selectDeviceNameList(dcDevice)); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/deviceParameter") |
|
|
|
public TableDataInfo selectDeviceParameterProperties(DcDevice dcDevice) { |
|
|
|
if (dcDevice==null||dcDevice.getDeviceType()==null){ |
|
|
|
if (dcDevice == null || dcDevice.getDeviceType() == null) { |
|
|
|
TableDataInfo tableDataInfo = new TableDataInfo(); |
|
|
|
tableDataInfo.setCode(UniversalEnum.FIVE_HUNDRED.getNumber()); |
|
|
|
tableDataInfo.setMsg(UniversalEnum.PARAMETER_ERROR.getValue()); |
|
|
@ -729,29 +730,31 @@ public class DcDeviceController extends BaseController { |
|
|
|
startPage(); |
|
|
|
return getDataTable(dcDeviceService.selectDeviceParameterProperties(dcDevice)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询设备指定属性属性列表 |
|
|
|
* param参数 |
|
|
|
* deviceId 设备id |
|
|
|
* propertyId 属性id |
|
|
|
* propertyName 属性名称 |
|
|
|
* deviceType 设备类型 |
|
|
|
* dateTime 时间 |
|
|
|
* param参数 |
|
|
|
* deviceId 设备id |
|
|
|
* propertyId 属性id |
|
|
|
* propertyName 属性名称 |
|
|
|
* deviceType 设备类型 |
|
|
|
* dateTime 时间 |
|
|
|
* |
|
|
|
* @return 属性列表 |
|
|
|
*/ |
|
|
|
@PostMapping("/properties/deviceNameData") |
|
|
|
public AjaxResult queryDevice(@RequestBody HashMap map) throws HttpException, IOException { |
|
|
|
if (map==null||!map.containsKey("deviceId")||!map.containsKey("deviceType") |
|
|
|
||!map.containsKey("propertyName")||!map.containsKey("propertyId") |
|
|
|
||!map.containsKey("dateTime")){ |
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue()); |
|
|
|
} |
|
|
|
if (map == null || !map.containsKey("deviceId") || !map.containsKey("deviceType") |
|
|
|
|| !map.containsKey("propertyName") || !map.containsKey("propertyId") |
|
|
|
|| !map.containsKey("dateTime")) { |
|
|
|
return AjaxResult.error(UniversalEnum.PARAMETER_ERROR.getValue()); |
|
|
|
} |
|
|
|
String deviceType = map.get("deviceType").toString();//设备类型
|
|
|
|
String deviceId = map.get("deviceId").toString();//设备id
|
|
|
|
String propertyId = map.get("propertyId").toString();//属性id
|
|
|
|
String propertyName = map.get("propertyName").toString();//属性名称
|
|
|
|
HashMap<String, Object> props = new HashMap<>(); |
|
|
|
// 设置查询条件的键为“timestamp$BTW”,表示时间戳在一定范围内
|
|
|
|
// 设置查询条件的键为“timestamp$BTW”,表示时间戳在一定范围内
|
|
|
|
props.put("terms[0].column", "timestamp$BTW"); |
|
|
|
ArrayList<String> dateList = new ArrayList<>(); |
|
|
|
// 添加当前日期的开始和结束时间到列表,用于设定时间范围
|
|
|
@ -770,7 +773,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
props.put("sorts[0].name", "timestamp"); |
|
|
|
AjaxResult ajaxResult = queryDeviceProperties(deviceId, propertyId, props); |
|
|
|
String code = ajaxResult.get("code").toString(); |
|
|
|
if ("500".equals(code)){ |
|
|
|
if (UniversalEnum.FIVE_HUNDRED.getValue().equals(code)) { |
|
|
|
return ajaxResult; |
|
|
|
} |
|
|
|
if (UniversalEnum.THIRTEEN.getValue().equals(deviceType) || UniversalEnum.SIXTEEN.getValue().equals(deviceType)) { //判断是否为设备箱/远端机
|
|
|
@ -820,6 +823,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设备箱-设备操作口令校验 |
|
|
|
*/ |
|
|
@ -829,4 +833,22 @@ public class DcDeviceController extends BaseController { |
|
|
|
return AjaxResult.success(key.equals(secretKey)); |
|
|
|
} |
|
|
|
|
|
|
|
///***
|
|
|
|
// * 合流区预警设备设备电量不足警告
|
|
|
|
// */
|
|
|
|
//@Scheduled(cron = "0 0/1 * * * ?")
|
|
|
|
//public void ConfluenceAreaEarlyWarningDeviceBatteryLowWarning() throws HttpException, IOException {
|
|
|
|
// DcDevice dcDevice = new DcDevice();
|
|
|
|
// dcDevice.setDeviceType("8");
|
|
|
|
// List<DcDevice> devices = dcDeviceService.listDevice(dcDevice);
|
|
|
|
// for (DcDevice device : devices) {
|
|
|
|
// String iotDeviceId = device.getIotDeviceId();
|
|
|
|
// if (iotDeviceId != null && !iotDeviceId.equals("")) {
|
|
|
|
// AjaxResult deviceLatestProperty = queryDeviceProperties(iotDeviceId, "batteryCapacity",new HashMap<>());
|
|
|
|
// System.out.println(deviceLatestProperty.get("code"));
|
|
|
|
// System.out.println(deviceLatestProperty.get("msg"));
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
} |
|
|
|