提交增加运维管理

This commit is contained in:
LEED
2025-04-29 22:30:18 +08:00
parent 4201690d93
commit 360b630306
98 changed files with 6300 additions and 45 deletions

View File

@@ -1,6 +1,9 @@
package com.xinda.data.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.xinda.common.core.domain.entity.SysUser;
@@ -60,6 +63,34 @@ public class AlertLogController extends BaseController
return getDataTable(list);
}
/**
* 查询设备告警列表
*/
@PreAuthorize("@ss.hasPermi('iot:alertLog:list')")
@GetMapping("/listCount")
public Map<String,Integer> listCount()
{
Map<String,Integer> map = new HashMap<>();
AlertLog alertLog = new AlertLog();
alertLog.setStatus(2);
List<AlertLog> list = alertLogService.selectAlertLogList(alertLog);
//1=提醒通知2=轻微问题3=严重警告
List<AlertLog> tlist =list.stream()
.filter(log -> log.getAlertLevel() == 1)
.collect(Collectors.toList());
List<AlertLog> qlist =list.stream()
.filter(log -> log.getAlertLevel() == 2)
.collect(Collectors.toList());
List<AlertLog> ylist =list.stream()
.filter(log -> log.getAlertLevel() == 3)
.collect(Collectors.toList());
map.put("tx",tlist.size());
map.put("qw",qlist.size());
map.put("yz",ylist.size());
return map;
}
@GetMapping("/snList")
public TableDataInfo snList(AlertLog alertLog)
{

View File

@@ -27,6 +27,7 @@ import com.xinda.mq.service.IMqttMessagePublish;
import com.github.pagehelper.PageInfo;
import com.xinda.scada.domain.Scada;
import com.xinda.scada.domain.ScadaDeviceBind;
import com.xinda.scada.enums.ScadaTypeEnum;
import com.xinda.scada.service.IScadaDeviceBindService;
import com.xinda.scada.service.IScadaService;
import com.xinda.sip.domain.SipDeviceChannel;
@@ -43,10 +44,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -351,20 +349,27 @@ public class DeviceController extends BaseController
//复制组态信息
if(StringUtils.isNotEmpty(product.getGuid())){
Scada scada = scadaService.selectScadaByGuid(product.getGuid());
UUID uuid = UUID.randomUUID();
scada.setGuid(uuid.toString());
scadaService.insertScada(scada);
device.setGuid(uuid.toString());
if(scada!=null){
UUID uuid = UUID.randomUUID();
scada.setGuid(uuid.toString());
scada.setPageName(device.getDeviceName()+"组态");
scada.setType(ScadaTypeEnum.SCENE_MODEL.getType());
scada.setCreateTime(new Date());
scada.setCreateBy(SecurityUtils.getUsername());
scadaService.insertScada(scada);
device.setGuid(uuid.toString());
}
}
deviceService.insertDevice(device);
//复制组态信息
if(StringUtils.isNotEmpty(product.getGuid())){
if(StringUtils.isNotEmpty(device.getGuid())){
ScadaDeviceBind scadaDeviceBind = new ScadaDeviceBind();
scadaDeviceBind.setScadaGuid(device.getGuid());
scadaDeviceBind.setSerialNumber(device.getSerialNumber());
scadaDeviceBindService.insertScadaDeviceBind(scadaDeviceBind);
}
return AjaxResult.success();
return AjaxResult.success(device);
}
/**
@@ -405,7 +410,7 @@ public class DeviceController extends BaseController
SipDeviceChannel sipDeviceChannel = new SipDeviceChannel();
sipDeviceChannel.setDeviceSipId(device.getSerialNumber());
List<SipDeviceChannel> list = sipDeviceChannelService.selectSipDeviceChannelList(sipDeviceChannel);
List<SipDeviceChannel> newList = new ArrayList<>();
// List<SipDeviceChannel> newList = new ArrayList<>();
if (list != null && list.size() > 0) {
for (SipDeviceChannel channel : list) {
channel.setTenantId(deptUserId);
@@ -414,6 +419,24 @@ public class DeviceController extends BaseController
}
}
}
if(StringUtils.isBlank(device.getGuid())){
Product product = productService.selectProductByProductId(device.getProductId());
//复制组态信息
if(StringUtils.isNotEmpty(product.getGuid())){
Scada scada = scadaService.selectScadaByGuid(product.getGuid());
if(scada!=null){
UUID uuid = UUID.randomUUID();
scada.setGuid(uuid.toString());
scada.setPageName(device.getDeviceName()+"组态");
scada.setType(ScadaTypeEnum.SCENE_MODEL.getType());
scada.setCreateTime(new Date());
scada.setCreateBy(SecurityUtils.getUsername());
scadaService.insertScada(scada);
device.setGuid(uuid.toString());
}
}
}
return deviceService.updateDevice(device);
}

View File

@@ -0,0 +1,110 @@
package com.xinda.iot.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xinda.common.annotation.Log;
import com.xinda.common.core.controller.BaseController;
import com.xinda.common.core.domain.AjaxResult;
import com.xinda.common.enums.BusinessType;
import com.xinda.iot.domain.Pip;
import com.xinda.iot.service.IPipService;
import com.xinda.common.utils.poi.ExcelUtil;
import com.xinda.common.core.page.TableDataInfo;
/**
* 机构管网Controller
*
* @author kerwincui
* @date 2025-04-18
*/
@RestController
@RequestMapping("/iot/pip")
@Api(tags = "机构管网")
public class PipController extends BaseController
{
@Autowired
private IPipService pipService;
/**
* 查询机构管网列表
*/
@PreAuthorize("@ss.hasPermi('iot:pip:list')")
@GetMapping("/list")
@ApiOperation("查询机构管网列表")
public TableDataInfo list(Pip pip)
{
startPage();
List<Pip> list = pipService.selectPipList(pip);
return getDataTable(list);
}
// /**
// * 导出机构管网列表
// */
// @ApiOperation("导出机构管网列表")
// @PreAuthorize("@ss.hasPermi('iot:pip:export')")
// @PostMapping("/export")
// public void export(HttpServletResponse response, Pip pip)
// {
// List<Pip> list = pipService.selectPipList(pip);
// ExcelUtil<Pip> util = new ExcelUtil<Pip>(Pip.class);
// util.exportExcel(response, list, "机构管网数据");
// }
/**
* 获取机构管网详细信息
*/
// @PreAuthorize("@ss.hasPermi('iot:pip:query')")
@GetMapping(value = "/{deptId}")
@ApiOperation("获取机构管网详细信息")
public AjaxResult getInfo(@PathVariable("deptId") Long deptId)
{
return success(pipService.selectPipByDeptId(deptId));
}
/**
* 新增机构管网
*/
// @PreAuthorize("@ss.hasPermi('iot:pip:add')")
// @PostMapping
// @ApiOperation("新增机构管网")
// public AjaxResult add(@RequestBody Pip pip)
// {
// return toAjax(pipService.insertPip(pip));
// }
/**
* 修改机构管网
*/
// @PreAuthorize("@ss.hasPermi('iot:pip:edit')")
@PutMapping
@ApiOperation("修改机构管网")
public AjaxResult edit(@RequestBody Pip pip)
{
return toAjax(pipService.updatePip(pip));
}
// /**
// * 删除机构管网
// */
// @PreAuthorize("@ss.hasPermi('iot:pip:remove')")
// @DeleteMapping("/{deptIds}")
// @ApiOperation("删除机构管网")
// public AjaxResult remove(@PathVariable Long[] deptIds)
// {
// return toAjax(pipService.deletePipByDeptIds(deptIds));
// }
}