|
@@ -2,28 +2,26 @@ package com.bizmatics.controller.web;
|
|
|
|
|
|
|
|
|
import com.bizmatics.common.core.bean.ApiResult;
|
|
|
-import com.bizmatics.common.core.util.DateUtils;
|
|
|
+import com.bizmatics.common.core.bean.CommonPage;
|
|
|
import com.bizmatics.model.Device;
|
|
|
-import com.bizmatics.model.HtAnalogData;
|
|
|
-import com.bizmatics.persistence.mapper.DeviceMapper;
|
|
|
-import com.bizmatics.persistence.mapper.HtAnalogDataMapper;
|
|
|
+import com.bizmatics.model.DeviceList;
|
|
|
+import com.bizmatics.model.vo.CorrespondDeviceListVO;
|
|
|
+import com.bizmatics.model.vo.CorrespondDeviceVO;
|
|
|
+import com.bizmatics.model.vo.DeviceOneVo;
|
|
|
import com.bizmatics.service.DeviceService;
|
|
|
+import com.bizmatics.service.aop.BusinessType;
|
|
|
+import com.bizmatics.service.aop.Log;
|
|
|
import com.bizmatics.service.vo.DeviceCountVO;
|
|
|
-import lombok.Synchronized;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
- * 设备
|
|
|
+ * 设备管理-通信设备
|
|
|
*
|
|
|
* @author ya
|
|
|
* @since 2021-07-07
|
|
@@ -35,46 +33,230 @@ public class DeviceController {
|
|
|
@Autowired
|
|
|
private DeviceService deviceService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private DeviceMapper deviceMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private HtAnalogDataMapper htAnalogDataMapper;
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 查询设备总数
|
|
|
+ *
|
|
|
* @param startTime
|
|
|
* @param endTime
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/count")
|
|
|
- public ApiResult<DeviceCountVO> count(@RequestParam Date startTime, @RequestParam Date endTime){
|
|
|
- return ApiResult.success(deviceService.selectDeviceCount(startTime,endTime));
|
|
|
+ public ApiResult<DeviceCountVO> count(@RequestParam Date startTime, @RequestParam Date endTime) {
|
|
|
+ return ApiResult.success(deviceService.selectDeviceCount(startTime, endTime));
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询不同类型的设备数量
|
|
|
+ *
|
|
|
* @param site 站点id
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/deviceTypeCount")
|
|
|
- public ApiResult<DeviceCountVO> selectDeviceCountByType(@RequestParam Integer site){
|
|
|
+ public ApiResult<DeviceCountVO> selectDeviceCountByType(@RequestParam Integer site) {
|
|
|
return ApiResult.success(deviceService.selectDeviceCountByType(site));
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/test")
|
|
|
- public List<String> test(){
|
|
|
- List<Device> list = deviceMapper.list(1, null, null, null, null, null);
|
|
|
- List<String> list1 = new ArrayList<>();
|
|
|
- for (Device device:list) {
|
|
|
- long l = System.currentTimeMillis();
|
|
|
- List<HtAnalogData> list2 = htAnalogDataMapper.list(DateUtils.addYears(new Date(), -10), new Date(), device.getDeviceCode());
|
|
|
- long e = System.currentTimeMillis();
|
|
|
- log.info("一个站点的数据获取时间"+(e-l));
|
|
|
- }
|
|
|
- return list1;
|
|
|
+ /**
|
|
|
+ * 通信设备-设备下拉框查询
|
|
|
+ *
|
|
|
+ * @param siteId 站点ID
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("deviceList")
|
|
|
+ public ApiResult<List<DeviceList>> deviceList(@RequestParam(value = "siteId", required = false, defaultValue = "0") String siteId) {
|
|
|
+ return ApiResult.success(deviceService.deviceList(siteId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 数据管理-同比分析报表-右侧设备查询
|
|
|
+ *
|
|
|
+ * @param siteId 站点ID
|
|
|
+ * @param deviceType 设备类型 默认1、用电设备
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("dataManagementDeviceList")
|
|
|
+ public ApiResult<List<DeviceOneVo>> dataManagementDeviceList(@RequestParam int siteId,
|
|
|
+ @RequestParam(value = "deviceType", required = false, defaultValue = "1") int deviceType) {
|
|
|
+ return ApiResult.success(deviceService.dataManagementDeviceList(siteId, deviceType));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备管理-通信设备-新增
|
|
|
+ *
|
|
|
+ * @param device
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Log(title = "设备管理-通信设备", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("correspondDeviceAdd")
|
|
|
+ public ApiResult<Void> correspondDeviceAdd(@RequestBody Device device) {
|
|
|
+ deviceService.correspondDeviceAdd(device);
|
|
|
+ return ApiResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备管理-通信设备-修改
|
|
|
+ *
|
|
|
+ * @param device
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Log(title = "设备管理-通信设备", businessType = BusinessType.UPDATE)
|
|
|
+ @PostMapping("correspondDeviceUpdate")
|
|
|
+ public ApiResult<Void> correspondDeviceUpdate(@RequestBody Device device) {
|
|
|
+ deviceService.correspondDeviceUpdate(device);
|
|
|
+ return ApiResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备管理-通信设备-注销
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Log(title = "设备管理-通信设备", businessType = BusinessType.DELETE)
|
|
|
+ @GetMapping("correspondDeviceDel")
|
|
|
+ public ApiResult<Void> correspondDeviceDel(@RequestParam int id) {
|
|
|
+ deviceService.correspondDeviceDel(id);
|
|
|
+ return ApiResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备管理-通信设备-查询
|
|
|
+ *
|
|
|
+ * @param deviceName 设备名称
|
|
|
+ * @param size 条数
|
|
|
+ * @param current 页数
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("correspondDeviceList")
|
|
|
+ public ApiResult<CommonPage<CorrespondDeviceVO>> correspondDeviceList(@RequestParam(required = false) String deviceName,
|
|
|
+ @RequestParam(value = "size", required = false, defaultValue = "15") int size,
|
|
|
+ @RequestParam(value = "current", required = false, defaultValue = "1") int current) {
|
|
|
+ return ApiResult.success(deviceService.correspondDeviceList(deviceName, size, current));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备管理-通信设备-修改回显
|
|
|
+ *
|
|
|
+ * @param id 通信设备表主键ID
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("correspondDeviceListEcho")
|
|
|
+ public ApiResult<List<CorrespondDeviceListVO>> correspondDeviceListEcho(@RequestParam int id) {
|
|
|
+ return ApiResult.success(deviceService.correspondDeviceListEcho(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备管理-视频监测-列表查询
|
|
|
+ *
|
|
|
+ * @param siteId 站点ID
|
|
|
+ * @param deviceName 设备名称
|
|
|
+ * @param size 页数
|
|
|
+ * @param current 条数
|
|
|
+ * @param deviceType 1:183用电设备,2:视频监控设备,3:171用电设备,4:173用电设备,5:158智能网关,6:其他 0:所有
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("videoMonitoringDeviceList")
|
|
|
+ public ApiResult<CommonPage<Device>> videoMonitoringDeviceList(@RequestParam Integer siteId,
|
|
|
+ @RequestParam(required = false) String deviceName,
|
|
|
+ @RequestParam(value = "size", required = false, defaultValue = "10") Integer size,
|
|
|
+ @RequestParam(value = "current", required = false, defaultValue = "1") Integer current,
|
|
|
+ @RequestParam(value = "deviceType", required = false, defaultValue = "2") Integer deviceType
|
|
|
+ ) {
|
|
|
+ return ApiResult.success(deviceService.videoMonitoringDeviceList(deviceName, deviceType, siteId, size, current));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备管理-通信设备-克隆
|
|
|
+ *
|
|
|
+ * @param type 1 新设备 2 已有设备
|
|
|
+ * @param newDeviceCode 克隆设备对象
|
|
|
+ * @param oldDeviceCode 设备编号
|
|
|
+ * @param deviceName 设备名称
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Log(title = "设备管理-通信设备", businessType = BusinessType.INSERT)
|
|
|
+ @GetMapping("variableCloning")
|
|
|
+ public ApiResult<Void> variableCloning(@RequestParam Integer type,
|
|
|
+ @RequestParam String newDeviceCode,
|
|
|
+ @RequestParam String oldDeviceCode,
|
|
|
+ @RequestParam(required = false) String deviceName
|
|
|
+ ) {
|
|
|
+ deviceService.variableCloning(type, newDeviceCode, oldDeviceCode, deviceName);
|
|
|
+ return ApiResult.success();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通信设备列表查询-无分页
|
|
|
+ *
|
|
|
+ * @param siteId 站点ID
|
|
|
+ * @param deviceType 1电力 2视频
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("deviceListOne")
|
|
|
+ public ApiResult<List<Device>> deviceListOne(@RequestParam Integer siteId,
|
|
|
+ @RequestParam(value = "deviceType", required = false, defaultValue = "1") Integer deviceType) {
|
|
|
+ return ApiResult.success(deviceService.deviceListOne(siteId, deviceType));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 站点管理-摄像头-导出
|
|
|
+ *
|
|
|
+ * @param siteId 站点Id
|
|
|
+ * @param deviceName 设备名称
|
|
|
+ * @param deviceType 1:183用电设备,2:视频监控设备,3:171用电设备,4:173用电设备,5:158智能网关,6:其他
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Log(title = "设备管理-摄像头", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("deviceExport")
|
|
|
+ public ApiResult<String> deviceExport(@RequestParam(value = "siteId", required = false, defaultValue = "0") Integer siteId,
|
|
|
+ @RequestParam(required = false) String deviceName,
|
|
|
+ @RequestParam(value = "deviceType", required = false, defaultValue = "2") Integer deviceType) {
|
|
|
+ return ApiResult.success(deviceService.deviceExport(deviceName, deviceType, siteId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设备管理-通信设备-导出
|
|
|
+ *
|
|
|
+ * @param deviceName 设备名称
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Log(title = "设备管理-通信设备", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("correspondDeviceExport")
|
|
|
+ public ApiResult<String> correspondDeviceExport(@RequestParam(required = false) String deviceName) {
|
|
|
+ return ApiResult.success(deviceService.correspondDeviceExport(deviceName));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通信设备-导入
|
|
|
+ *
|
|
|
+ * @param file 导入文件
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @Log(title = "设备管理-通信设备", businessType = BusinessType.IMPORT)
|
|
|
+ @PostMapping("/deviceImport")
|
|
|
+ public ApiResult<Void> deviceImport(@RequestParam("file") MultipartFile file){
|
|
|
+ deviceService.deviceImport(file);
|
|
|
+ return ApiResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 数据管理-需量分析-用能月报查询
|
|
|
+ * @param siteId 站点ID
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("deviceBoxList")
|
|
|
+ public ApiResult<List<DeviceOneVo>> deviceBoxList(@RequestParam (required = false) Integer siteId) {
|
|
|
+ return ApiResult.success(deviceService.deviceBoxList(siteId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|