123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- package com.bizmatics.controller.web;
- import com.bizmatics.common.core.bean.ApiResult;
- import com.bizmatics.common.core.bean.CommonPage;
- import com.bizmatics.model.Device;
- 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.vo.DeviceCountVO;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import org.springframework.web.multipart.MultipartFile;
- import java.util.Date;
- import java.util.List;
- /**
- * 设备管理-通信设备
- *
- * @author ya
- * @since 2021-07-07
- */
- @Slf4j
- @RestController
- @RequestMapping("/device")
- public class DeviceController {
- @Autowired
- private DeviceService deviceService;
- /**
- * 查询设备总数
- *
- * @param startTime
- * @param endTime
- * @return
- */
- @GetMapping("/count")
- 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) {
- return ApiResult.success(deviceService.selectDeviceCountByType(site));
- }
- /**
- * 通信设备-设备下拉框查询
- *
- * @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
- */
- @PostMapping("correspondDeviceAdd")
- public ApiResult<Void> correspondDeviceAdd(@RequestBody Device device) {
- deviceService.correspondDeviceAdd(device);
- return ApiResult.success();
- }
- /**
- * 设备管理-通信设备-修改
- *
- * @param device
- * @return
- */
- @PostMapping("correspondDeviceUpdate")
- public ApiResult<Void> correspondDeviceUpdate(@RequestBody Device device) {
- deviceService.correspondDeviceUpdate(device);
- return ApiResult.success();
- }
- /**
- * 设备管理-通信设备-注销
- *
- * @param id
- * @return
- */
- @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
- */
- @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
- */
- @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
- */
- @GetMapping("correspondDeviceExport")
- public ApiResult<String> correspondDeviceExport(@RequestParam(required = false) String deviceName) {
- return ApiResult.success(deviceService.correspondDeviceExport(deviceName));
- }
- /**
- * 通信设备-导入
- *
- * @param file 导入文件
- * @return
- * @throws Exception
- */
- @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));
- }
- }
|