提交修改
This commit is contained in:
@@ -34,6 +34,10 @@
|
||||
<artifactId>xinda-ruleEngine</artifactId>
|
||||
<version>3.8.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xinda</groupId>
|
||||
<artifactId>xinda-scada</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -112,6 +112,21 @@ public class AlertController extends BaseController
|
||||
return toAjax(alertService.insertAlert(alert));
|
||||
}
|
||||
|
||||
@Log(title = "设备告警", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/addCfg")
|
||||
public AjaxResult addCfg(@RequestBody Alert alert)
|
||||
{
|
||||
// 查询所属机构
|
||||
SysUser user = getLoginUser().getUser();
|
||||
if (null != user.getDeptId()) {
|
||||
alert.setTenantId(user.getDept().getDeptUserId());
|
||||
alert.setTenantName(user.getDept().getDeptUserName());
|
||||
}
|
||||
return toAjax(alertService.insertCfgAlert(alert));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改设备告警
|
||||
*/
|
||||
|
||||
@@ -60,6 +60,15 @@ public class AlertLogController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/snList")
|
||||
public TableDataInfo snList(AlertLog alertLog)
|
||||
{
|
||||
startPage();
|
||||
List<AlertLog> list = alertLogService.selectAlertLogSnList(alertLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出设备告警列表
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.xinda.common.annotation.Log;
|
||||
import com.xinda.common.constant.HttpStatus;
|
||||
import com.xinda.common.core.controller.BaseController;
|
||||
import com.xinda.common.core.domain.AjaxResult;
|
||||
import com.xinda.common.core.domain.entity.SysDept;
|
||||
import com.xinda.common.core.domain.entity.SysRole;
|
||||
import com.xinda.common.core.domain.model.LoginUser;
|
||||
import com.xinda.common.core.page.TableDataInfo;
|
||||
@@ -14,16 +15,24 @@ import com.xinda.common.utils.SecurityUtils;
|
||||
import com.xinda.common.utils.StringUtils;
|
||||
import com.xinda.common.utils.poi.ExcelUtil;
|
||||
import com.xinda.iot.domain.Device;
|
||||
import com.xinda.iot.model.DeviceAssignmentVO;
|
||||
import com.xinda.iot.model.DeviceImportVO;
|
||||
import com.xinda.iot.model.DeviceRelateUserInput;
|
||||
import com.xinda.iot.model.SerialNumberVO;
|
||||
|
||||
import com.xinda.iot.domain.Product;
|
||||
import com.xinda.iot.model.*;
|
||||
import com.xinda.iot.service.IDeviceService;
|
||||
import com.xinda.iot.service.IProductService;
|
||||
import com.xinda.mq.service.IMqttMessagePublish;
|
||||
import com.xinda.iot.model.dto.ThingsModelDTO;
|
||||
import com.xinda.iot.service.IDeviceService;
|
||||
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.service.IScadaDeviceBindService;
|
||||
import com.xinda.scada.service.IScadaService;
|
||||
import com.xinda.sip.domain.SipDeviceChannel;
|
||||
import com.xinda.sip.service.ISipDeviceChannelService;
|
||||
|
||||
import com.xinda.system.service.ISysDeptService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -37,6 +46,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -53,10 +63,25 @@ public class DeviceController extends BaseController
|
||||
@Autowired
|
||||
private IDeviceService deviceService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService sysDeptService;
|
||||
|
||||
@Autowired
|
||||
private ISipDeviceChannelService sipDeviceChannelService;
|
||||
|
||||
// @Lazy
|
||||
@Autowired
|
||||
private IMqttMessagePublish messagePublish;
|
||||
|
||||
@Autowired
|
||||
private IProductService productService;
|
||||
|
||||
@Autowired
|
||||
private IScadaService scadaService;
|
||||
|
||||
@Autowired
|
||||
private IScadaDeviceBindService scadaDeviceBindService;
|
||||
|
||||
/**
|
||||
* 查询设备列表
|
||||
*/
|
||||
@@ -162,6 +187,57 @@ public class DeviceController extends BaseController
|
||||
return getDataTable(deviceService.selectDeviceShortList(device));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/shortListWg")
|
||||
@ApiOperation("设备分页简短列表")
|
||||
public TableDataInfo shortListWg(Device device)
|
||||
{
|
||||
startPage();
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (null == loginUser.getDeptId()) {
|
||||
// 终端用户查询设备
|
||||
device.setTenantId(loginUser.getUserId());
|
||||
return getDataTable(deviceService.listTerminalUser(device));
|
||||
}
|
||||
if (null == device.getDeptId()) {
|
||||
device.setDeptId(getLoginUser().getDeptId());
|
||||
}
|
||||
if (Objects.isNull(device.getTenantId())){
|
||||
device.setTenantId(getLoginUser().getUserId());
|
||||
}
|
||||
if (null == device.getShowChild()) {
|
||||
device.setShowChild(false);
|
||||
}
|
||||
return getDataTable(deviceService.selectDeviceShortGwList(device));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备简短列表,主页列表数据
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/shortTreeList")
|
||||
@ApiOperation("设备分页简短列表")
|
||||
public List<DeviceShortOutput> shortTreeList(Device device)
|
||||
{
|
||||
startPage();
|
||||
if (null == device.getDeptId()) {
|
||||
device.setDeptId(getLoginUser().getDeptId());
|
||||
}
|
||||
if (Objects.isNull(device.getTenantId())){
|
||||
device.setTenantId(getLoginUser().getUserId());
|
||||
}
|
||||
if (null == device.getShowChild()) {
|
||||
device.setShowChild(false);
|
||||
}
|
||||
List<DeviceShortOutput> shortOutputs = deviceService.selectDeviceShortTreeList(device);
|
||||
for(DeviceShortOutput shortOutput :shortOutputs){
|
||||
List<DeviceShortOutput> sipDevices = deviceService.selectCamDeviceListByDeviceId(shortOutput.getDeviceId());
|
||||
shortOutput.setSipList(sipDevices);
|
||||
}
|
||||
|
||||
return shortOutputs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有设备简短列表
|
||||
*/
|
||||
@@ -271,7 +347,24 @@ public class DeviceController extends BaseController
|
||||
@ApiOperation("添加设备")
|
||||
public AjaxResult add(@RequestBody Device device)
|
||||
{
|
||||
return AjaxResult.success(deviceService.insertDevice(device));
|
||||
Product product = productService.selectProductByProductId(device.getProductId());
|
||||
//复制组态信息
|
||||
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());
|
||||
}
|
||||
deviceService.insertDevice(device);
|
||||
//复制组态信息
|
||||
if(StringUtils.isNotEmpty(product.getGuid())){
|
||||
ScadaDeviceBind scadaDeviceBind = new ScadaDeviceBind();
|
||||
scadaDeviceBind.setScadaGuid(device.getGuid());
|
||||
scadaDeviceBind.setSerialNumber(device.getSerialNumber());
|
||||
scadaDeviceBindService.insertScadaDeviceBind(scadaDeviceBind);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,6 +395,25 @@ public class DeviceController extends BaseController
|
||||
@ApiOperation("修改设备")
|
||||
public AjaxResult edit(@RequestBody Device device)
|
||||
{
|
||||
if(null != device.getAgenciesId()) {
|
||||
SysDept sysDept = sysDeptService.selectDeptById(device.getAgenciesId());
|
||||
Long deptUserId = sysDept.getDeptUserId();
|
||||
if (null == deptUserId) {
|
||||
deptUserId = sysDeptService.selectDeptById(sysDept.getParentId()).getDeptUserId();
|
||||
}
|
||||
if(device.getDeviceType()==3){
|
||||
SipDeviceChannel sipDeviceChannel = new SipDeviceChannel();
|
||||
sipDeviceChannel.setDeviceSipId(device.getSerialNumber());
|
||||
List<SipDeviceChannel> list = sipDeviceChannelService.selectSipDeviceChannelList(sipDeviceChannel);
|
||||
List<SipDeviceChannel> newList = new ArrayList<>();
|
||||
if (list != null && list.size() > 0) {
|
||||
for (SipDeviceChannel channel : list) {
|
||||
channel.setTenantId(deptUserId);
|
||||
sipDeviceChannelService.updateSipDeviceChannel(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return deviceService.updateDevice(device);
|
||||
}
|
||||
|
||||
@@ -327,6 +439,12 @@ public class DeviceController extends BaseController
|
||||
@DeleteMapping("/{deviceIds}")
|
||||
@ApiOperation("批量删除设备")
|
||||
public AjaxResult remove(@PathVariable Long[] deviceIds) throws SchedulerException {
|
||||
for(Long deviceId:deviceIds){
|
||||
Device device=deviceService.selectDeviceByDeviceId(deviceId);
|
||||
if(StringUtils.isNotEmpty(device.getGuid())){
|
||||
scadaService.deleteScadaByGuid(device.getGuid());
|
||||
}
|
||||
}
|
||||
return deviceService.deleteDeviceByDeviceId(deviceIds[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.xinda.data.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xinda.common.utils.StringUtils;
|
||||
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.Doc;
|
||||
import com.xinda.iot.service.IDocService;
|
||||
import com.xinda.common.utils.poi.ExcelUtil;
|
||||
import com.xinda.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 档案管理Controller
|
||||
*
|
||||
* @author leo
|
||||
* @date 2025-04-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/iot/doc")
|
||||
@Api(tags = "档案管理")
|
||||
public class DocController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDocService docService;
|
||||
|
||||
/**
|
||||
* 查询档案管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:doc:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询档案管理列表")
|
||||
public TableDataInfo list(Doc doc)
|
||||
{
|
||||
startPage();
|
||||
List<Doc> list = docService.selectDocList(doc);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出档案管理列表
|
||||
*/
|
||||
@ApiOperation("导出档案管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('iot:doc:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Doc doc)
|
||||
{
|
||||
List<Doc> list = docService.selectDocList(doc);
|
||||
ExcelUtil<Doc> util = new ExcelUtil<Doc>(Doc.class);
|
||||
util.exportExcel(response, list, "档案管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取档案管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:doc:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("获取档案管理详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(docService.selectDocById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增档案管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:doc:add')")
|
||||
@PostMapping
|
||||
@ApiOperation("新增档案管理")
|
||||
public AjaxResult add(@RequestBody Doc doc)
|
||||
{
|
||||
return toAjax(docService.insertDoc(doc));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改档案管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:doc:edit')")
|
||||
@PutMapping
|
||||
@ApiOperation("修改档案管理")
|
||||
public AjaxResult edit(@RequestBody Doc doc)
|
||||
{
|
||||
return toAjax(docService.updateDoc(doc));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除档案管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:doc:remove')")
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除档案管理")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(docService.deleteDocByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,23 +48,44 @@ public class ProductController extends BaseController
|
||||
public TableDataInfo list(Product product)
|
||||
{
|
||||
startPage();
|
||||
SysUser user = getLoginUser().getUser();
|
||||
if (null == user.getDeptId()) {
|
||||
product.setTenantId(user.getUserId());
|
||||
return getDataTable(productService.selectTerminalUserProduct(product));
|
||||
}
|
||||
// SysUser user = getLoginUser().getUser();
|
||||
// if (null == user.getDeptId()) {
|
||||
// product.setTenantId(user.getUserId());
|
||||
// return getDataTable(productService.selectTerminalUserProduct(product));
|
||||
// }
|
||||
Boolean showSenior = product.getShowSenior();
|
||||
if (Objects.isNull(showSenior)){
|
||||
//默认展示上级产品
|
||||
product.setShowSenior(true);
|
||||
}
|
||||
Long deptUserId = getLoginUser().getUser().getDept().getDeptUserId();
|
||||
product.setAdmin(SecurityUtils.isAdmin(deptUserId));
|
||||
product.setDeptId(getLoginUser().getDeptId());
|
||||
product.setTenantId(deptUserId);
|
||||
if(product.getDeptId()==null){
|
||||
Long deptUserId = getLoginUser().getUser().getDept().getDeptUserId();
|
||||
// product.setAdmin(SecurityUtils.isAdmin(deptUserId));
|
||||
product.setDeptId(getLoginUser().getDeptId());
|
||||
product.setTenantId(deptUserId);
|
||||
}
|
||||
|
||||
return getDataTable(productService.selectProductList(product));
|
||||
}
|
||||
|
||||
@GetMapping("/longList")
|
||||
@ApiOperation("产品分页列表")
|
||||
public List<Product> longList(Product product)
|
||||
{
|
||||
Boolean showSenior = product.getShowSenior();
|
||||
if (Objects.isNull(showSenior)){
|
||||
//默认展示上级产品
|
||||
product.setShowSenior(true);
|
||||
}
|
||||
if(product.getDeptId()==null){
|
||||
Long deptUserId = getLoginUser().getUser().getDept().getDeptUserId();
|
||||
product.setDeptId(getLoginUser().getDeptId());
|
||||
product.setTenantId(deptUserId);
|
||||
}
|
||||
|
||||
return productService.selectProductList(product);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品简短列表
|
||||
*/
|
||||
|
||||
@@ -35,7 +35,6 @@ public class ThingsModelStandardController extends BaseController {
|
||||
/**
|
||||
* 查询通用物模型列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:standard:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("通用物模型分页列表")
|
||||
public TableDataInfo list(ThingsModelStandard thingsModelStandard) {
|
||||
@@ -46,7 +45,7 @@ public class ThingsModelStandardController extends BaseController {
|
||||
/**
|
||||
* 导出通用物模型列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:standard:export')")
|
||||
|
||||
@Log(title = "通用物模型", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出通用物模型")
|
||||
@@ -59,7 +58,7 @@ public class ThingsModelStandardController extends BaseController {
|
||||
/**
|
||||
* 获取通用物模型详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:standard:query')")
|
||||
|
||||
@GetMapping(value = "/{templateId}")
|
||||
@ApiOperation("获取通用物模型详情")
|
||||
public AjaxResult getInfo(@PathVariable("templateId") Long templateId) {
|
||||
@@ -69,7 +68,6 @@ public class ThingsModelStandardController extends BaseController {
|
||||
/**
|
||||
* 新增通用物模型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:standard:add')")
|
||||
@Log(title = "通用物模型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加通用物模型")
|
||||
@@ -99,7 +97,7 @@ public class ThingsModelStandardController extends BaseController {
|
||||
/**
|
||||
* 删除通用物模型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:standard:remove')")
|
||||
|
||||
@Log(title = "通用物模型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{templateIds}")
|
||||
@ApiOperation("批量删除通用物模型")
|
||||
@@ -125,7 +123,7 @@ public class ThingsModelStandardController extends BaseController {
|
||||
/**
|
||||
* 导入采集点
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:standard:add')")
|
||||
|
||||
@ApiOperation(value = "采集点导入")
|
||||
@PostMapping(value = "/importData")
|
||||
public AjaxResult importData(MultipartFile file, String tempSlaveId) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user