|
@@ -1,27 +1,20 @@
|
|
package com.usky.iot.controller.web;
|
|
package com.usky.iot.controller.web;
|
|
|
|
|
|
-
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
import com.usky.backend.domain.*;
|
|
import com.usky.backend.domain.*;
|
|
import com.usky.common.core.bean.ApiResult;
|
|
import com.usky.common.core.bean.ApiResult;
|
|
import com.usky.common.core.bean.CommonPage;
|
|
import com.usky.common.core.bean.CommonPage;
|
|
import com.usky.common.core.utils.poi.ExcelUtil;
|
|
import com.usky.common.core.utils.poi.ExcelUtil;
|
|
-import com.usky.iot.domain.BaseFacilityDevice;
|
|
|
|
|
|
+import com.usky.demo.domain.LastInnerQueryVO;
|
|
import com.usky.iot.domain.DmpDeviceInfo;
|
|
import com.usky.iot.domain.DmpDeviceInfo;
|
|
import com.usky.iot.service.DmpDeviceInfoService;
|
|
import com.usky.iot.service.DmpDeviceInfoService;
|
|
-import com.usky.iot.service.vo.BaseFacilityDeviceVO;
|
|
|
|
-import com.usky.iot.service.vo.DmpDeviceInfoRequest;
|
|
|
|
|
|
+import com.usky.iot.service.vo.*;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
-import javax.validation.constraints.NotNull;
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
-import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -44,7 +37,7 @@ public class DmpDeviceInfoController {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping
|
|
@PostMapping
|
|
- public ApiResult<Void> add(@RequestBody DmpDeviceInfo dmpDeviceInfo){
|
|
|
|
|
|
+ public ApiResult<Void> add(@RequestBody DmpDeviceInfo dmpDeviceInfo) {
|
|
dmpDeviceInfoService.add(dmpDeviceInfo);
|
|
dmpDeviceInfoService.add(dmpDeviceInfo);
|
|
return ApiResult.success();
|
|
return ApiResult.success();
|
|
}
|
|
}
|
|
@@ -55,11 +48,21 @@ public class DmpDeviceInfoController {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PutMapping
|
|
@PutMapping
|
|
- public ApiResult<Void> edit(@RequestBody DmpDeviceInfo dmpDeviceInfo){
|
|
|
|
|
|
+ public ApiResult<Void> edit(@RequestBody DmpDeviceInfo dmpDeviceInfo) {
|
|
dmpDeviceInfoService.update(dmpDeviceInfo);
|
|
dmpDeviceInfoService.update(dmpDeviceInfo);
|
|
return ApiResult.success();
|
|
return ApiResult.success();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 更新设备列表状态
|
|
|
|
+ * @param queryVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("updateDeviceStatus")
|
|
|
|
+ public ApiResult<Void> updateDeviceStatus(@RequestBody LastInnerQueryVO queryVO){
|
|
|
|
+ dmpDeviceInfoService.updateDeviceStatus(queryVO);
|
|
|
|
+ return ApiResult.success();
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 分页
|
|
* 分页
|
|
@@ -67,8 +70,7 @@ public class DmpDeviceInfoController {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/page")
|
|
@PostMapping("/page")
|
|
- public ApiResult<CommonPage<DmpDeviceInfo>> page(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest)
|
|
|
|
- {
|
|
|
|
|
|
+ public ApiResult<CommonPage<DmpDeviceInfo>> page(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest) {
|
|
return ApiResult.success(dmpDeviceInfoService.page(dmpDeviceInfoRequest));
|
|
return ApiResult.success(dmpDeviceInfoService.page(dmpDeviceInfoRequest));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -79,8 +81,7 @@ public class DmpDeviceInfoController {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/pageWhite")
|
|
@PostMapping("/pageWhite")
|
|
- public ApiResult<CommonPage<DmpDeviceInfo>> pageWhite(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest)
|
|
|
|
- {
|
|
|
|
|
|
+ public ApiResult<CommonPage<DmpDeviceInfo>> pageWhite(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest) {
|
|
return ApiResult.success(dmpDeviceInfoService.pageWhite(dmpDeviceInfoRequest));
|
|
return ApiResult.success(dmpDeviceInfoService.pageWhite(dmpDeviceInfoRequest));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -88,8 +89,7 @@ public class DmpDeviceInfoController {
|
|
* 删除记录
|
|
* 删除记录
|
|
*/
|
|
*/
|
|
@DeleteMapping("/{id}")
|
|
@DeleteMapping("/{id}")
|
|
- public ApiResult<Void> remove(@PathVariable("id") Integer id)
|
|
|
|
- {
|
|
|
|
|
|
+ public ApiResult<Void> remove(@PathVariable("id") Integer id) {
|
|
dmpDeviceInfoService.remove(id);
|
|
dmpDeviceInfoService.remove(id);
|
|
return ApiResult.success();
|
|
return ApiResult.success();
|
|
}
|
|
}
|
|
@@ -100,7 +100,7 @@ public class DmpDeviceInfoController {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/addByFile")
|
|
@PostMapping("/addByFile")
|
|
- public ApiResult<Void> addByFile(@RequestParam(value = "file") MultipartFile multipartFiles){
|
|
|
|
|
|
+ public ApiResult<Void> addByFile(@RequestParam(value = "file") MultipartFile multipartFiles) {
|
|
dmpDeviceInfoService.addByFile(multipartFiles);
|
|
dmpDeviceInfoService.addByFile(multipartFiles);
|
|
return ApiResult.success();
|
|
return ApiResult.success();
|
|
}
|
|
}
|
|
@@ -112,7 +112,7 @@ public class DmpDeviceInfoController {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/importDeviceInfo")
|
|
@PostMapping("/importDeviceInfo")
|
|
- public ApiResult<Void> importDeviceInfo(@RequestBody List<DmpDeviceInfo> list){
|
|
|
|
|
|
+ public ApiResult<Void> importDeviceInfo(@RequestBody List<DmpDeviceInfo> list) {
|
|
dmpDeviceInfoService.importDeviceInfo(list);
|
|
dmpDeviceInfoService.importDeviceInfo(list);
|
|
return ApiResult.success();
|
|
return ApiResult.success();
|
|
}
|
|
}
|
|
@@ -124,8 +124,8 @@ public class DmpDeviceInfoController {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/export")
|
|
@PostMapping("/export")
|
|
- public void export(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest, HttpServletResponse response){
|
|
|
|
- dmpDeviceInfoService.export(dmpDeviceInfoRequest,response);
|
|
|
|
|
|
+ public void export(@RequestBody DmpDeviceInfoRequest dmpDeviceInfoRequest, HttpServletResponse response) {
|
|
|
|
+ dmpDeviceInfoService.export(dmpDeviceInfoRequest, response);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -139,12 +139,12 @@ public class DmpDeviceInfoController {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@GetMapping("deviceCurrentDataList")
|
|
@GetMapping("deviceCurrentDataList")
|
|
- public ApiResult<CommonPage<Object>> deviceCurrentDataList(@RequestParam(value = "deviceName",required = false) String deviceName,
|
|
|
|
- @RequestParam(value = "installAddress",required = false) String installAddress,
|
|
|
|
- @RequestParam(value = "productCode",required = false) String productCode,
|
|
|
|
|
|
+ public ApiResult<CommonPage<Object>> deviceCurrentDataList(@RequestParam(value = "deviceName", required = false) String deviceName,
|
|
|
|
+ @RequestParam(value = "installAddress", required = false) String installAddress,
|
|
|
|
+ @RequestParam(value = "productCode", required = false) String productCode,
|
|
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
|
|
- @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize){
|
|
|
|
- return ApiResult.success(dmpDeviceInfoService.deviceCurrentDataList(deviceName,installAddress,productCode,pageNum,pageSize));
|
|
|
|
|
|
+ @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
|
|
|
|
+ return ApiResult.success(dmpDeviceInfoService.deviceCurrentDataList(deviceName, installAddress, productCode, pageNum, pageSize));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -154,7 +154,7 @@ public class DmpDeviceInfoController {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("dataTVList")
|
|
@PostMapping("dataTVList")
|
|
- public ApiResult<CommonPage<DataTVResponseVO>> dataTVList(@RequestBody DataTVRequestVO requestVO){
|
|
|
|
|
|
+ public ApiResult<CommonPage<DataTVResponseVO>> dataTVList(@RequestBody DataTVRequestVO requestVO) {
|
|
return ApiResult.success(dmpDeviceInfoService.dataTVList(requestVO));
|
|
return ApiResult.success(dmpDeviceInfoService.dataTVList(requestVO));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -165,7 +165,7 @@ public class DmpDeviceInfoController {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("dataTVStatistic")
|
|
@PostMapping("dataTVStatistic")
|
|
- public ApiResult<List<DataTVStatisticResponseVO>> dataTVStatistic(@RequestBody DataTVRequestVO requestVO){
|
|
|
|
|
|
+ public ApiResult<List<DataTVStatisticResponseVO>> dataTVStatistic(@RequestBody DataTVRequestVO requestVO) {
|
|
return ApiResult.success(dmpDeviceInfoService.dataTVStatistic(requestVO));
|
|
return ApiResult.success(dmpDeviceInfoService.dataTVStatistic(requestVO));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -176,7 +176,7 @@ public class DmpDeviceInfoController {
|
|
*/
|
|
*/
|
|
@PostMapping("deviceDataTotal")
|
|
@PostMapping("deviceDataTotal")
|
|
@ApiOperation("获取设备某个时间端内的汇总值")
|
|
@ApiOperation("获取设备某个时间端内的汇总值")
|
|
- public ApiResult<List<Map<String,Object>>> deviceDataTotal(@RequestBody DataTotalRequestVO requestVO){
|
|
|
|
|
|
+ public ApiResult<List<Map<String, Object>>> deviceDataTotal(@RequestBody DataTotalRequestVO requestVO) {
|
|
return ApiResult.success(dmpDeviceInfoService.deviceDataTotal(requestVO));
|
|
return ApiResult.success(dmpDeviceInfoService.deviceDataTotal(requestVO));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -187,7 +187,7 @@ public class DmpDeviceInfoController {
|
|
*/
|
|
*/
|
|
@PostMapping("deviceDataAverage")
|
|
@PostMapping("deviceDataAverage")
|
|
@ApiOperation("获取设备日平均、月平均、年平均值")
|
|
@ApiOperation("获取设备日平均、月平均、年平均值")
|
|
- public ApiResult<List<DataAverageResponseVO>> deviceDataAverage(@RequestBody DataAverageRequestVO requestVO){
|
|
|
|
|
|
+ public ApiResult<List<DataAverageResponseVO>> deviceDataAverage(@RequestBody DataAverageRequestVO requestVO) {
|
|
return ApiResult.success(dmpDeviceInfoService.deviceDataAverage(requestVO));
|
|
return ApiResult.success(dmpDeviceInfoService.deviceDataAverage(requestVO));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -198,10 +198,32 @@ public class DmpDeviceInfoController {
|
|
* @throws IOException
|
|
* @throws IOException
|
|
*/
|
|
*/
|
|
@PostMapping("deviceDataAverageExport")
|
|
@PostMapping("deviceDataAverageExport")
|
|
- public void export(@RequestBody DataAverageRequestVO requestVO, HttpServletResponse response) throws IOException{
|
|
|
|
|
|
+ public void export(@RequestBody DataAverageRequestVO requestVO, HttpServletResponse response) throws IOException {
|
|
List<DataAverageExportVO> list = dmpDeviceInfoService.DataAverageExport(requestVO);
|
|
List<DataAverageExportVO> list = dmpDeviceInfoService.DataAverageExport(requestVO);
|
|
ExcelUtil<DataAverageExportVO> util = new ExcelUtil<DataAverageExportVO>(DataAverageExportVO.class);
|
|
ExcelUtil<DataAverageExportVO> util = new ExcelUtil<DataAverageExportVO>(DataAverageExportVO.class);
|
|
- util.exportExcel(response,list,requestVO.getSheetName(),requestVO.getTitleName());
|
|
|
|
|
|
+ util.exportExcel(response, list, requestVO.getSheetName(), requestVO.getTitleName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取设备topic列表
|
|
|
|
+ * @param requestVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("topic")
|
|
|
|
+ public ApiResult<CommonPage<DmpTopicResponseVO>> topic(@RequestBody DmpTopicRequestVO requestVO) {
|
|
|
|
+ return ApiResult.success(dmpDeviceInfoService.topic(requestVO));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取设备告警请求信息
|
|
|
|
+ * @param deviceId 设备id
|
|
|
|
+ * @param productCode 产品编码
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("alarmResponse")
|
|
|
|
+ public ApiResult<DmpHttpAlarmResponseVO> alarmResponse(@RequestParam(value = "deviceId") String deviceId,
|
|
|
|
+ @RequestParam(value = "productCode") String productCode){
|
|
|
|
+ return ApiResult.success(dmpDeviceInfoService.alarmResponse(deviceId, productCode));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|