# Conflicts:
#	ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquBaseController.java
#	ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquSupplierController.java
#	ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertMessageController.java
#	ALOps_sys_backend/alops-system/pom.xml
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquBase.java
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquSupplier.java
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquVlan.java
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/EquBaseQueryDto.java
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/AlertMessageMapper.java
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/EquBaseMapper.java
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/EquSupplierMapper.java
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IAlertMessageService.java
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IEquBaseService.java
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IEquSupplierService.java
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/AlertMessageServiceImpl.java
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/EquBaseServiceImpl.java
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/EquSupplierServiceImpl.java
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/EquTypeServiceImpl.java
#	ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertMessageMapper.xml
#	ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquBaseMapper.xml
#	ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquSupplierMapper.xml
dev
YYD-YY 11 months ago
commit f38f389443
  1. 168
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquBaseController.java
  2. 12
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquSupplierController.java
  3. 177
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/ScheduleRulesController.java
  4. 148
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertMessageController.java
  5. 175
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertRuleController.java
  6. 12
      ALOps_sys_backend/alops-common/src/main/java/com/alops/common/utils/html/EscapeUtil.java
  7. 16
      ALOps_sys_backend/alops-system/pom.xml
  8. 62
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/AlertMessage.java
  9. 4
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/AlertRule.java
  10. 5
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/AlertRuleCondition.java
  11. 2
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/DictAlarmParam.java
  12. 146
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquBase.java
  13. 3
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquGather.java
  14. 3
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquInterface.java
  15. 4
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquRouting.java
  16. 22
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquSupplier.java
  17. 3
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquValn.java
  18. 6
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquVeneer.java
  19. 7
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquVlan.java
  20. 4
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/InternalMessage.java
  21. 104
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/ScheduleRules.java
  22. 15
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/AlertDto.java
  23. 47
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/EquBaseQueryDto.java
  24. 11
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/vo/RolePickerVo.java
  25. 13
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/vo/dropDownVo.java
  26. 8
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/vo/imageVo.java
  27. 97
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/vo/queryEquBaseVO.java
  28. 101
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/job/GatherJob.java
  29. 6
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/AlertMessageMapper.java
  30. 10
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/AlertRuleConditionMapper.java
  31. 5
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/AlertRuleMapper.java
  32. 2
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/DictAlarmParamMapper.java
  33. 38
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/EquBaseMapper.java
  34. 2
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/EquManuMapper.java
  35. 5
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/EquSupplierMapper.java
  36. 5
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/EquTypeMapper.java
  37. 9
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/ScheduleRulesMapper.java
  38. 3
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/SysRoleMapper.java
  39. 3
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IAlertLaunchService.java
  40. 5
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IAlertMessageService.java
  41. 13
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IAlertRuleService.java
  42. 1
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IAlertSenderService.java
  43. 2
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IDictAlarmParamService.java
  44. 23
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IEquBaseService.java
  45. 2
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IEquSupplierService.java
  46. 12
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IQuartzService.java
  47. 9
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IScheduleRulesService.java
  48. 3
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/ISysRoleService.java
  49. 1
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/MemoryToolService.java
  50. 153
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/AlertLaunchServiceImpl.java
  51. 19
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/AlertMessageServiceImpl.java
  52. 122
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/AlertRuleServiceImpl.java
  53. 12
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/AlertSenderServiceImpl.java
  54. 4
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/ConvertRawValueServiceImpl.java
  55. 4
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/DictAlarmParamServiceImpl.java
  56. 52
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/EquBaseServiceImpl.java
  57. 11
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/EquSupplierServiceImpl.java
  58. 2
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/MemoryToolServiceImpl.java
  59. 105
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/QuartzService.java
  60. 349
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/ScheduleRulesServiceImpl.java
  61. 4
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/SnmpServiceImpl.java
  62. 8
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/SysRoleServiceImpl.java
  63. 96
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertMessageMapper.xml
  64. 22
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertRuleConditionMapper.xml
  65. 66
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertRuleMapper.xml
  66. 1
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/DictAlarmParamMapper.xml
  67. 215
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquBaseMapper.xml
  68. 1
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquGatherMapper.xml
  69. 1
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquInterfaceMapper.xml
  70. 8
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquManuMapper.xml
  71. 1
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquRoutingMapper.xml
  72. 8
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquSupplierMapper.xml
  73. 9
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquTypeMapper.xml
  74. 1
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquVeneerMapper.xml
  75. 1
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquVlanMapper.xml
  76. 1
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/InternalMessageMapper.xml
  77. 64
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/ScheduleRulesMapper.xml
  78. 14
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/SysRoleMapper.xml
  79. 1
      ALOps_sys_fe/alops-ui/package.json
  80. 6
      ALOps_sys_fe/alops-ui/src/api/device/files.js
  81. 2
      ALOps_sys_fe/alops-ui/src/main.js
  82. 6
      ALOps_sys_fe/alops-ui/src/views/QandA/Aiassistant/index.vue
  83. 40
      ALOps_sys_fe/alops-ui/src/views/dashboard/digital.vue
  84. 449
      ALOps_sys_fe/alops-ui/src/views/device/deviceSupplier/index.vue
  85. 437
      ALOps_sys_fe/alops-ui/src/views/index.vue
  86. 98
      ALOps_sys_fe/alops-ui/src/views/index_v1.vue

@ -1,8 +1,8 @@
package com.alops.web.controller.equManagement;
import java.util.HashMap;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import com.alops.common.annotation.Anonymous;
@ -19,24 +19,21 @@ import com.alops.system.domain.dto.MonitorStatisticDto;
import com.alops.system.domain.vo.EquMonitorVO;
import com.alops.system.domain.vo.queryEquBaseVO;
import com.alops.system.service.IEquBaseService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.http.MediaType;
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 org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
* 设备基本信息Controller
*
* @author ruoyi
* @date 2025-08-01
* @date 2025-09-19
*/
@RestController
@RequestMapping("/device/files")
@ -45,20 +42,19 @@ public class EquBaseController extends BaseController
@Autowired
private IEquBaseService equBaseService;
/**
* 查询设备基本信息列表
*/
@PreAuthorize("@ss.hasPermi('device:files:queryByVO')")
@GetMapping("/queryByVO")
@ApiOperation("查询符合参数设备信息")
public AjaxResult list(EquBaseQueryDto equBaseQueryDto ) {
@PreAuthorize("@ss.hasPermi('device:files:list')")
@PostMapping("/list")
@ApiOperation("查询多个设备信息")
public TableDataInfo list(@RequestBody EquBaseQueryDto equBase)
{
startPage();
List<queryEquBaseVO> list = equBaseService.selectEquBaseList(equBaseQueryDto);
TableDataInfo tableDataInfo = getDataTable(list);
Map<String, Object> data = new HashMap<>();
data.put("total", tableDataInfo.getTotal());
data.put("rows", tableDataInfo.getRows());
return AjaxResult.success("查询成功", data);
List<queryEquBaseVO> list = equBaseService.selectEquBaseList(equBase);
return getDataTable(list);
}
/**查询设备监测信息列表(查询多台显示界面的单独信息)**/
@ -108,27 +104,125 @@ public class EquBaseController extends BaseController
return AjaxResult.success("查询成功", list);
}
/**
* 获取设备基本信息详细信息
*/
@PreAuthorize("@ss.hasPermi('device:files:query')")
@GetMapping(value = "/{id}")
@ApiOperation("查询单个设备信息")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(equBaseService.selectEquBaseById(id));
}
/**
* 根据设备ID返回图片流
* 前端直接 <img src="/equBase/image/{id}">
*/
@PreAuthorize("@ss.hasPermi('device:files:queryimage')")
@GetMapping(value = "/queryimage/{id}")
@ApiOperation("查询单个设备图片")
public void getImage(@PathVariable String id, HttpServletResponse response) throws IOException {
if (id instanceof String) {
System.out.println("这是一个字符串");
}
byte[] imgBytes = equBaseService.selectEquBaseImageById(id).getEquImage();
if (imgBytes != null && imgBytes.length > 0) {
// 设置响应类型,可根据实际图片类型动态修改
response.setContentType("image/png");
// 可选:缓存图片
response.setHeader("Cache-Control", "max-age=3600");
// 输出流写入响应
ServletOutputStream os = response.getOutputStream();
os.write(imgBytes);
os.flush();
os.close();
} else {
// 图片不存在
response.sendError(HttpServletResponse.SC_NOT_FOUND);
}
}
//厂商下拉表
@PreAuthorize("@ss.hasPermi('device:files:queryManufacture')")
@GetMapping( "/manufacture")
@ApiOperation("厂商下拉表")
public AjaxResult getManufacture()
{
return success(equBaseService.selectEquManu());
}
//供应商下拉表
@PreAuthorize("@ss.hasPermi('device:files:querySupplier')")
@GetMapping( "/supplier")
@ApiOperation("供应商下拉表")
public AjaxResult getSupplier()
{
return success(equBaseService.selectEquSupp());
}
//设备类型下拉表
@PreAuthorize("@ss.hasPermi('device:files:queryEquType')")
@GetMapping( "/equType")
@ApiOperation("设备类型下拉表")
public AjaxResult getEquType()
{
return success(equBaseService.selectEquType());
}
/**
* 新增设备基本信息
*/
@PreAuthorize("@ss.hasPermi('device:files:add')")
@Log(title = "设备档案", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ApiOperation("新增设备信息")
public AjaxResult add(@RequestBody EquBase equBase)
{
@Log(title = "设备基本信息", businessType = BusinessType.INSERT)
@PostMapping(value = "/add")
@ApiOperation("增加设备档案信息")
public AjaxResult add(
@ModelAttribute EquBase equBase,
@RequestPart(value = "file", required = false) // 使用 @RequestPart
@ApiParam(value = "设备图片文件", type = "file")
MultipartFile file
) throws IOException {
// 处理图片
if (file != null && !file.isEmpty()) {
equBase.setEquImage(file.getBytes());
}
// 调用 Service 插入数据库
return toAjax(equBaseService.insertEquBase(equBase));
}
/**
* 修改设备基本信息
*/
@PreAuthorize("@ss.hasPermi('device:files:modify')")
@Log(title = "设备档案", businessType = BusinessType.UPDATE)
@PreAuthorize("@ss.hasPermi('device:files:edit')")
@Log(title = "设备基本信息", businessType = BusinessType.UPDATE)
@PutMapping("/modify")
@ApiOperation("修改设备信息")
public AjaxResult edit(@RequestBody EquBase equBase)
{
@ApiOperation("修改设备档案信息")
public AjaxResult edit(
@ModelAttribute EquBase equBase, // 自动绑定表单字段
@RequestPart(value = "file", required = false) // 使用 @RequestPart
@ApiParam(value = "设备图片文件", type = "file")
MultipartFile file
) throws IOException {
// 处理图片
if (file != null && !file.isEmpty()) {
equBase.setEquImage(file.getBytes()); // 存数据库 Blob
}
// 调用 Service 插入数据库
return toAjax(equBaseService.updateEquBase(equBase));
}
@ -136,12 +230,14 @@ public class EquBaseController extends BaseController
/**
* 删除设备基本信息
*/
@PreAuthorize("@ss.hasPermi('device:files:delete')")
@Log(title = "设备档案", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
@ApiOperation("删除设备信息")
@PreAuthorize("@ss.hasPermi('device:files:remove')")
@Log(title = "设备基本信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
@ApiOperation("删除设备档案信息")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(equBaseService.deleteEquBaseByIds(ids));
}
}

@ -4,6 +4,14 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.ApiOperation;
import com.alops.common.annotation.Log;
import com.alops.common.core.controller.BaseController;
import com.alops.common.core.domain.AjaxResult;
import com.alops.common.core.page.TableDataInfo;
import com.alops.common.enums.BusinessType;
import com.alops.common.utils.poi.ExcelUtil;
import com.alops.system.domain.EquSupplier;
import com.alops.system.service.IEquSupplierService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -25,9 +33,9 @@ import com.alops.common.core.page.TableDataInfo;
/**
* 供应商功能Controller
*
*
* @author ruoyi
* @date 2025-09-20
* @date 2025-09-19
*/
@RestController
@RequestMapping("/device/supplier")

@ -12,18 +12,14 @@ import com.alops.common.enums.BusinessType;
import com.alops.common.utils.poi.ExcelUtil;
import com.alops.system.domain.ScheduleRules;
import com.alops.system.domain.vo.Code;
import com.alops.system.mapper.ScheduleRulesMapper;
import com.alops.system.service.IScheduleRulesService;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Mapper;
import org.quartz.SchedulerException;
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 org.springframework.web.bind.annotation.*;
/**
* 定时采集规则Controller
@ -32,33 +28,55 @@ import org.springframework.web.bind.annotation.RestController;
* @date 2025-08-03
*/
@RestController
@RequestMapping("/equipmentRule")
@RequestMapping("/device/deviceInformation")
public class ScheduleRulesController extends BaseController
{
@Autowired
private IScheduleRulesService scheduleRulesService;
@Mapper
private ScheduleRulesMapper scheduleRulesMapper;
/**
* 立即执行按钮
*/
@PreAuthorize("@ss.hasPermi('equipment:rules:list')")
@GetMapping("/protoCollect")
@ApiOperation("立即执行")
public AjaxResult protoCollect() throws ExecutionException, InterruptedException {
// 调用 Service 层执行采集,返回业务状态码
int code = scheduleRulesService.executeImmediately();
// 根据返回码生成 AjaxResult
if(code == Code.SUCCESS){
return AjaxResult.success("采集完成");
} else if(code == Code.PARTIAL){
return AjaxResult.warn("部分设备采集失败");
} else {
return AjaxResult.error("采集失败");
}
// public AjaxResult protoCollect() throws ExecutionException, InterruptedException {
//
//
// // 调用 Service 层执行采集,返回业务状态码
// int code = scheduleRulesService.executeImmediately();
//
// // 根据返回码生成 AjaxResult
// if(code == Code.SUCCESS){
// return AjaxResult.success("采集完成");
// } else if(code == Code.PARTIAL){
// return AjaxResult.warn("部分设备采集失败");
// } else {
// return AjaxResult.error("采集失败");
// }
// }
@PreAuthorize("@ss.hasPermi('device:deviceInformation:protoCollect')")
@PostMapping("/addRule")
@ApiOperation("立即确定")
public AjaxResult run(@RequestBody ScheduleRules newRule) throws SchedulerException, ExecutionException, InterruptedException {
if (newRule.getRuleType() == 2) {
// 立即执行
return scheduleRulesService.executeRule(newRule);
} else {
// 固定时间/按频率:异步处理异常
scheduleRulesService.executeRule(newRule);
return AjaxResult.success("任务已调度成功,异常会通过站内信/邮件通知");
}
}
/**
* 查询定时采集规则列表
*/
@ -71,65 +89,66 @@ public class ScheduleRulesController extends BaseController
return getDataTable(list);
}
/**
* 导出定时采集规则列表
*/
@PreAuthorize("@ss.hasPermi('equipment:rules:export')")
@Log(title = "定时采集规则", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScheduleRules scheduleRules)
{
List<ScheduleRules> list = scheduleRulesService.selectScheduleRulesList(scheduleRules);
ExcelUtil<ScheduleRules> util = new ExcelUtil<ScheduleRules>(ScheduleRules.class);
util.exportExcel(response, list, "定时采集规则数据");
}
// /**
// * 导出定时采集规则列表
// */
// @PreAuthorize("@ss.hasPermi('equipment:rules:export')")
// @Log(title = "定时采集规则", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, ScheduleRules scheduleRules)
// {
// List<ScheduleRules> list = scheduleRulesService.selectScheduleRulesList(scheduleRules);
// ExcelUtil<ScheduleRules> util = new ExcelUtil<ScheduleRules>(ScheduleRules.class);
// util.exportExcel(response, list, "定时采集规则数据");
// }
//
/**
* 获取定时采集规则详细信息
*/
@PreAuthorize("@ss.hasPermi('equipment:rules:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(scheduleRulesService.selectScheduleRulesById(id));
}
/**
* 新增定时采集规则
*/
@PreAuthorize("@ss.hasPermi('equipment:rules:add')")
@Log(title = "定时采集规则", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ScheduleRules scheduleRules)
{
return toAjax(scheduleRulesService.insertScheduleRules(scheduleRules));
}
/**
* 修改定时采集规则
*/
@PreAuthorize("@ss.hasPermi('equipment:rules:edit')")
@Log(title = "定时采集规则", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ScheduleRules scheduleRules)
{
return toAjax(scheduleRulesService.updateScheduleRules(scheduleRules));
}
/**
* 删除定时采集规则
*/
@PreAuthorize("@ss.hasPermi('equipment:rules:remove')")
@Log(title = "定时采集规则", businessType = BusinessType.DELETE)
@DeleteMapping("rule/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
@PreAuthorize("@ss.hasPermi('device:deviceInformation:query')")
@GetMapping(value = "/queryRule")
@ApiOperation("获取规则")
public AjaxResult getInfo()
{
return toAjax(scheduleRulesService.deleteScheduleRulesByIds(ids));
return success(scheduleRulesService.selectScheduleRuleByMaxTime());
}
//
//
//
// /**
// * 新增定时采集规则
// */
// @PreAuthorize("@ss.hasPermi('equipment:rules:add')")
// @Log(title = "定时采集规则", businessType = BusinessType.INSERT)
// @PostMapping
// public AjaxResult add(@RequestBody ScheduleRules scheduleRules)
// {
// return toAjax(scheduleRulesService.insertScheduleRules(scheduleRules));
// }
//
//
//
// /**
// * 修改定时采集规则
// */
// @PreAuthorize("@ss.hasPermi('equipment:rules:edit')")
// @Log(title = "定时采集规则", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult edit(@RequestBody ScheduleRules scheduleRules)
// {
// return toAjax(scheduleRulesService.updateScheduleRules(scheduleRules));
// }
//
//
// /**
// * 删除定时采集规则
// */
// @PreAuthorize("@ss.hasPermi('equipment:rules:remove')")
// @Log(title = "定时采集规则", businessType = BusinessType.DELETE)
// @DeleteMapping("rule/{ids}")
// public AjaxResult remove(@PathVariable Long[] ids)
// {
// return toAjax(scheduleRulesService.deleteScheduleRulesByIds(ids));
// }
}

@ -1,6 +1,7 @@
package com.alops.web.controller.exceptionController;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.alops.common.annotation.Log;
@ -8,8 +9,11 @@ import com.alops.common.core.controller.BaseController;
import com.alops.common.core.domain.AjaxResult;
import com.alops.common.core.page.TableDataInfo;
import com.alops.common.enums.BusinessType;
import com.alops.common.utils.SecurityUtils;
import com.alops.common.utils.poi.ExcelUtil;
import com.alops.system.domain.AlertMessage;
import com.alops.system.domain.dto.AlertDto;
import com.alops.system.service.IAlertLaunchService;
import com.alops.system.domain.AlertRule;
import com.alops.system.domain.EquInterface;
import com.alops.system.domain.dto.AlertStatisticDto;
@ -33,18 +37,66 @@ import org.springframework.web.bind.annotation.RestController;
* @date 2025-09-04
*/
@RestController
@RequestMapping("/system/message")
@RequestMapping("/inMonitoring/alertMessage")
public class AlertMessageController extends BaseController
{
@Autowired
private IAlertMessageService alertMessageService;
@Autowired
private IAlertLaunchService iAlertLaunchService;
//立即预警方法
//1.拿到预警规则,拿到查询语句(如果是change执行change的方法)和预警规则表的东西,进行查询,查询组成一个内从实体
//2.根据每次预警模版,+进行对应填入,根据预警方式发送信息,再存入预警信息实体类
//{设备id:{} 报错:{预警名称} 返回实体{自己看} }
//3.批量存入预警信息数据库
/**
* 立即执行预警带规则 ID 列表
*/
// @PreAuthorize("@ss.hasPermi('equipment:rules:execute')")
// @ApiOperation("立即执行预警")
// @Log(title = "【立即执行预警】", businessType = BusinessType.DELETE)
// @PostMapping("/executeImmediate")
// public AjaxResult executeImmediate(@RequestBody Map<String, List<Long>> paramMap) {
// try {
// List<Long> ruleIds = paramMap.get("ruleIds");
// if (ruleIds == null || ruleIds.isEmpty()) {
// return AjaxResult.error("请选择至少一条规则");
// }
//
// iAlertLaunchService.executeImmediateAlerts(); // 调用 Service 执行
// return AjaxResult.success("立即预警任务已触发,存入成功,请查看");
//
// } catch (Exception e) {
// e.printStackTrace();
// return AjaxResult.error("执行立即预警失败: " + e.getMessage());
// }
//
// }
/**
* 修改预警信息
*/
@PreAuthorize("@ss.hasPermi('inMonitoring:alertMessage:edit')")
@Log(title = "修改预警信息", businessType = BusinessType.UPDATE)
@PutMapping("/editAlertMessage")
@ApiOperation("修改预警信息")
public AjaxResult edit(@RequestBody AlertMessage alertMessage)
{
return AjaxResult.success("修改成功",alertMessageService.updateAlertMessage(alertMessage));
}
/**
* 查询预警信息统计列表
*/
@PreAuthorize("@ss.hasPermi('system:message:list')")
@GetMapping("/list")
public TableDataInfo list(AlertMessage alertMessage)
@PreAuthorize("@ss.hasPermi('inMonitoring:alertMessage:list')")
@GetMapping ("/list")
@ApiOperation("查询预警信息")
@Log(title = "查询预警信息", businessType = BusinessType.UPDATE)
public TableDataInfo list( @RequestBody AlertDto alertMessage)
{
startPage();
List<AlertMessage> list = alertMessageService.selectAlertMessageList(alertMessage);
@ -78,60 +130,44 @@ public class AlertMessageController extends BaseController
}
/**
* 导出 预警信息列表
*/
@PreAuthorize("@ss.hasPermi('system:message:export')")
@Log(title = "故障统计", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AlertMessage alertMessage)
{
List<AlertMessage> list = alertMessageService.selectAlertMessageList(alertMessage);
ExcelUtil<AlertMessage> util = new ExcelUtil<AlertMessage>(AlertMessage.class);
util.exportExcel(response, list, "故障统计数据");
}
/**
* 获取预警信息
*/
@PreAuthorize("@ss.hasPermi('system:message:query')")
@GetMapping(value = "/query")
public AjaxResult getInfo(Long id)
{
return success(alertMessageService.selectAlertMessageById(id));
}
}
// /**
// * 导出 预警信息列表
// */
// @PreAuthorize("@ss.hasPermi('system:message:export')")
// @Log(title = "故障统计", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, AlertDto alertMessage)
// {
// List<AlertMessage> list = alertMessageService.selectAlertMessageList(alertMessage);
// ExcelUtil<AlertMessage> util = new ExcelUtil<AlertMessage>(AlertMessage.class);
// util.exportExcel(response, list, "故障统计数据");
// }
// /**
// * 获取预警信息
// */
// @PreAuthorize("@ss.hasPermi('system:message:query')")
// @GetMapping(value = "/{id}")
//
// public AjaxResult getInfo(@PathVariable("id") Long id)
// {
// return success(alertMessageService.selectAlertMessageById(id));
// }
// /**
// * 新增预警信息
// */
// @PreAuthorize("@ss.hasPermi('system:message:add')")
// @Log(title = "故障统计", businessType = BusinessType.INSERT)
// @PostMapping
// public AjaxResult add(@RequestBody AlertMessage alertMessage)
// {
// return toAjax(alertMessageService.insertAlertMessage(alertMessage));
// }
/**
* 新增预警信息
*/
@PreAuthorize("@ss.hasPermi('system:message:add')")
@Log(title = "故障统计", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody AlertMessage alertMessage)
{
return toAjax(alertMessageService.insertAlertMessage(alertMessage));
}
/**
* 修改预警信息
*/
@PreAuthorize("@ss.hasPermi('system:message:edit')")
@Log(title = "故障统计", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody AlertMessage alertMessage)
{
return toAjax(alertMessageService.updateAlertMessage(alertMessage));
}
/**
* 删除预警信息
*/
@PreAuthorize("@ss.hasPermi('system:message:remove')")
@Log(title = "故障统计", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(alertMessageService.deleteAlertMessageByIds(ids));
}
}

@ -14,18 +14,12 @@ import com.alops.system.domain.AlertRule;
import com.alops.system.domain.dto.AlertRuleAddDto;
import com.alops.system.service.IAlertLaunchService;
import com.alops.system.service.IAlertRuleService;
import com.alops.system.service.IDictAlarmParamService;
import com.sun.jna.platform.win32.Winspool;
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 org.springframework.web.bind.annotation.*;
/**
* 请填写功能名称Controller
@ -34,30 +28,33 @@ import org.springframework.web.bind.annotation.RestController;
* @date 2025-09-04
*/
@RestController
@RequestMapping("/system/rule")
public class AlertRuleController extends BaseController
{
@RequestMapping("/inMonitoring/alertRule")
public class AlertRuleController extends BaseController {
@Autowired
private IAlertRuleService alertRuleService;
@Autowired
private IAlertLaunchService iAlertLaunchService;
private IDictAlarmParamService dictAlarmParamService;
//增加预警规则,生成对应的sql语句存入方法(只能针对个体表,表之间不能共同构成预警,特殊符号的规则只能有一个查询条件)
//1.拿到 //预警名称,预警级别,预警对应的表格,预警方式,预警的到站方 预警规则,预警模版 内容描述 启用状态,创建人
//1.拿到 //预警名称,预警级别,预警对应的表格,预警方式,预警的到站方 预警规则,预警模版 内容描述 启用状态,创建人
//+好几个规则条件实体类
//2.生成sql语句
//如果是如果是equ_gather直接根据组成条件构成查询语句,
//如果是其他表格除去组成条件构成的语句+通过equ_garher_id关联到equ_gather表,搜索出实体外+设备id和设备类型
//3.然后存入预警规则和预警规则条件表
//3.然后存入预警规则和预警规则条件表
/**
* 新增预警规则
*/
@PreAuthorize("@ss.hasPermi('equipment:rules:add')")
@PreAuthorize("@ss.hasPermi('inMonitoring:alertRule:add')")
@ApiOperation("增加预警规则")
@PostMapping("/add")
@Log(title = "【增加预警规则】", businessType = BusinessType.DELETE)
@PostMapping("/addRule")
public AjaxResult addRule(@RequestBody AlertRuleAddDto dto) {
try {
AlertRule alertRule = alertRuleService.saveRule(dto);
return AjaxResult.success("预警规则新增成功", alertRule);
} catch (Exception e) {
@ -66,99 +63,109 @@ public class AlertRuleController extends BaseController
}
}
//立即预警方法
//1.拿到预警规则,拿到查询语句(如果是change执行change的方法)和预警规则表的东西,进行查询,查询组成一个内从实体
//2.根据每次预警模版,+进行对应填入,根据预警方式发送信息,再存入预警信息实体类
//{设备id:{} 报错:{预警名称} 返回实体{自己看} }
//3.批量存入预警信息数据库
/**
* 立即执行预警带规则 ID 列表
* 修改预警规则
*/
@PreAuthorize("@ss.hasPermi('equipment:rules:execute')")
@ApiOperation("立即执行预警")
@PostMapping("/executeImmediate")
public AjaxResult executeImmediate(@RequestBody Map<String, List<Long>> paramMap) {
@PreAuthorize("@ss.hasPermi('inMonitoring:alertRule:edit')")
@ApiOperation("修改预警规则")
@Log(title = "【修改预警规则】", businessType = BusinessType.DELETE)
@PostMapping("/editRule")
public AjaxResult editRule(@RequestBody AlertRuleAddDto dto) {
try {
List<Long> ruleIds = paramMap.get("ruleIds");
if (ruleIds == null || ruleIds.isEmpty()) {
return AjaxResult.error("请选择至少一条规则");
}
iAlertLaunchService.executeImmediateAlerts(ruleIds); // 调用 Service 执行
return AjaxResult.success("立即预警任务已触发,存入成功,请查看");
AlertRule alertRule = alertRuleService.updateRule(dto);
return AjaxResult.success("预警规则修改成功", alertRule);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("执行立即预警失败: " + e.getMessage());
return AjaxResult.error("新增预警修改失败: " + e.getMessage());
}
}
/**
* 查询请填写功能名称列表
* 查询预警列表不涉及规则条件(另外是搜索查询不涉及时间和创建人)
*/
@PreAuthorize("@ss.hasPermi('system:rule:list')")
@PreAuthorize("@ss.hasPermi('inMonitoring:alertRule:list')")
@GetMapping("/list")
public TableDataInfo list(AlertRule alertRule)
{
@Log(title = "【查询预警规则】", businessType = BusinessType.DELETE)
@ApiOperation("查询预警规则")
public TableDataInfo list(AlertRule alertRule) {
startPage();
List<AlertRule> list = alertRuleService.selectAlertRuleList(alertRule);
return getDataTable(list);
}
return getDataTable(list);
/**
* 导出请填写功能名称列表
*/
@PreAuthorize("@ss.hasPermi('system:rule:export')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AlertRule alertRule)
{
List<AlertRule> list = alertRuleService.selectAlertRuleList(alertRule);
ExcelUtil<AlertRule> util = new ExcelUtil<AlertRule>(AlertRule.class);
util.exportExcel(response, list, "【请填写功能名称】数据");
}
/**
* 获取请填写功能名称详细信息
* 查询预警列表涉及规则条件(用于修改是获得单独页面)
*/
@PreAuthorize("@ss.hasPermi('system:rule:query')")
@PreAuthorize("@ss.hasPermi('inMonitoring:alertRule:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(alertRuleService.selectAlertRuleById(id));
@ApiOperation("查询预警详细规则")
@Log(title = "【查询预警详细规则】", businessType = BusinessType.DELETE)
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(alertRuleService.selectDetailAlertRuleById(id));
}
/**
* 新增请填写功能名称
* 删除请填写功能名称
*/
@PreAuthorize("@ss.hasPermi('system:rule:add')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody AlertRule alertRule)
{
return toAjax(alertRuleService.insertAlertRule(alertRule));
}
@PreAuthorize("@ss.hasPermi('inMonitoring:alertRule:remove')")
@Log(title = "【删除预警功能】", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
@ApiOperation("删除预警规则")
public AjaxResult remove(@PathVariable Long[] ids) {
return AjaxResult.success("删除成功", alertRuleService.deleteAlertRuleByIds(ids));
/**
* 修改请填写功能名称
*/
@PreAuthorize("@ss.hasPermi('system:rule:edit')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody AlertRule alertRule)
{
return toAjax(alertRuleService.updateAlertRule(alertRule));
}
/**
* 删除请填写功能名称
*/
@PreAuthorize("@ss.hasPermi('system:rule:remove')")
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(alertRuleService.deleteAlertRuleByIds(ids));
// /**
// * 导出【请填写功能名称】列表
// */
// @PreAuthorize("@ss.hasPermi('inMonitoring:alertRule:export')")
// @Log(title = "【导出预警规则】", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// @ApiOperation("导出预警规则")
// public void export(HttpServletResponse response, AlertRule alertRule) {
// List<AlertRule> list = alertRuleService.selectAlertRuleList(alertRule);
// ExcelUtil<AlertRule> util = new ExcelUtil<AlertRule>(AlertRule.class);
// util.exportExcel(response, list, "导出预警规则数据");
// }
@ApiOperation("获取预警参数")
@PreAuthorize("@ss.hasPermi('inMonitoring:alertRule:byTable')")
@GetMapping("/byTable")
@Log(title = "【获取预警参数】", businessType = BusinessType.EXPORT)
public AjaxResult getParamsByTableName() {
return AjaxResult.success("获取预警参数成功",dictAlarmParamService.getParamsByTableName());
}
}
// /**
// * 新增【请填写功能名称】
// */
// @PreAuthorize("@ss.hasPermi('system:rule:add')")
// @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
// @PostMapping
// public AjaxResult add(@RequestBody AlertRule alertRule)
// {
// return toAjax(alertRuleService.insertAlertRule(alertRule));
// }
// /**
// * 修改【请填写功能名称】
// */
// @PreAuthorize("@ss.hasPermi('system:rule:edit')")
// @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult edit(@RequestBody AlertRule alertRule)
// {
// return toAjax(alertRuleService.updateAlertRule(alertRule));
// }

@ -58,7 +58,17 @@ public class EscapeUtil
*/
public static String clean(String content)
{
return new HTMLFilter().filter(content);
if (StringUtils.isBlank(content)) {
return null;
}
// 跑一遍 HTMLFilter(去掉真正危险的标签,比如 <script>)
String safe = new HTMLFilter().filter(content);
// 特殊处理:把 &lt; 和 &gt; 转回原始符号
// 避免 <20 或 >45 被吃掉
safe = safe.replace("&lt;", "<").replace("&gt;", ">");
return safe;
}
/**

@ -36,6 +36,22 @@
<artifactId>spring-boot-starter-mail</artifactId>
<version>2.5.15</version>
</dependency>
<!-- 定时任务 -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<exclusions>
<exclusion>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>

@ -30,9 +30,6 @@ public class AlertMessage
@Excel(name = "设备ID")
private String equId;
/** 预警现象简述 */
@Excel(name = "预警现象简述")
private String description;
/** 预警类型(枚举表名) */
@Excel(name = "预警类型(枚举表名)")
@ -42,9 +39,7 @@ public class AlertMessage
@Excel(name = "设备类型")
private String equType;
/** 可能原因 */
@Excel(name = "可能原因")
private String cause;
/** 解决方案 */
@Excel(name = "解决方案")
@ -59,13 +54,11 @@ public class AlertMessage
@Excel(name = "发生时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date occurTime;
/** 报告人ID */
@Excel(name = "报告人ID")
private Long reporter;
/** 处理人ID */
@Excel(name = "处理人ID")
private Long handler;
private String handler;
/** 解决时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ -73,9 +66,16 @@ public class AlertMessage
private Date handleTime;
/** 处理状态(open、in_progress_closed) */
@Excel(name = "处理状态", readConverterExp = "o=pen、in_progress_closed")
@Excel(name = "处理状态")
private String status;
@Excel(name = "信息批次")
private Integer batch;
public void setId(Long id)
{
this.id = id;
@ -96,16 +96,6 @@ public class AlertMessage
return equId;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setType(String type)
{
this.type = type;
@ -126,15 +116,6 @@ public class AlertMessage
return equType;
}
public void setCause(String cause)
{
this.cause = cause;
}
public String getCause()
{
return cause;
}
public void setSolution(String solution)
{
@ -166,22 +147,12 @@ public class AlertMessage
return occurTime;
}
public void setReporter(Long reporter)
{
this.reporter = reporter;
}
public Long getReporter()
{
return reporter;
}
public void setHandler(Long handler)
public void setHandler(String handler)
{
this.handler = handler;
}
public Long getHandler()
public String getHandler()
{
return handler;
}
@ -211,17 +182,18 @@ public class AlertMessage
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("equId", getEquId())
.append("description", getDescription())
.append("type", getType())
.append("equType", getEquType())
.append("cause", getCause())
.append("solution", getSolution())
.append("level", getLevel())
.append("occurTime", getOccurTime())
.append("reporter", getReporter())
.append("handler", getHandler())
.append("handleTime", getHandleTime())
.append("status", getStatus())
.append("batch",getBatch())
.toString();
}
}

@ -2,6 +2,7 @@ package com.alops.system.domain;
import com.alops.common.annotation.Excel;
import com.alops.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -48,6 +49,7 @@ public class AlertRule extends BaseEntity
/** 预警sql语句查询 */
@Excel(name = "预警sql语句查询")
@JsonIgnore
private String alertSql;
/** 预警模版(参数用数据库命名法) */
@ -58,6 +60,8 @@ public class AlertRule extends BaseEntity
@Excel(name = "预警类型")
private String type;
public void setId(Long id)
{
this.id = id;

@ -2,6 +2,7 @@ package com.alops.system.domain;
import com.alops.common.annotation.Excel;
import com.alops.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -11,7 +12,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* @author ruoyi
* @date 2025-09-04
*/
public class AlertRuleCondition extends BaseEntity
public class AlertRuleCondition
{
private static final long serialVersionUID = 1L;
@ -36,10 +37,12 @@ public class AlertRuleCondition extends BaseEntity
/** 与下一个条件的逻辑符号 */
@Excel(name = "与下一个条件的逻辑符号")
@JsonIgnore
private String logicOperator;
/** 条件顺序 */
@Excel(name = "条件顺序")
@JsonIgnore
private Long orderNo;
/** 比较值的类型 */

@ -11,7 +11,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* @author ruoyi
* @date 2025-09-05
*/
public class DictAlarmParam extends BaseEntity
public class DictAlarmParam
{
private static final long serialVersionUID = 1L;

@ -1,6 +1,6 @@
package com.alops.system.domain;
import java.math.BigDecimal;
import java.sql.Blob;
import java.util.Date;
import com.alops.common.annotation.Excel;
@ -15,14 +15,14 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* 设备基本信息对象 equ_base
*
* @author ruoyi
* @date 2025-08-01
* @date 2025-09-19
*/
@Data
public class EquBase
{
private static final long serialVersionUID = 1L;
/** 设备唯一标识 */
/** 设备唯一标识(设备编号) */
private String id;
/** 设备名称 */
@ -37,7 +37,8 @@ public class EquBase
@Excel(name = "带外管理 IP")
private String ip;
/** 设备厂商 */
/** 设备厂商 id */
@Excel(name = "设备厂商 id")
private String manufacture;
public EquManu getManufactureVO() {
@ -50,8 +51,8 @@ public class EquBase
private EquManu manufactureVO;
/** 安装位置 id */
@Excel(name = "安装位置 id")
/** 安装位置 */
@Excel(name = "安装位置 ")
private String location;
/** 设备类型 id */
@ -68,14 +69,13 @@ public class EquBase
private EquType equTypeVO;
/** 设备管理员 id */
@Excel(name = "设备管理员 id")
private Long inCharge;
/** 出厂日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出厂日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date releaseDate;
/** 设备管理员姓名 */
@Excel(name = "设备管理员姓名")
private String inCharge;
/** 安装日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ -86,39 +86,41 @@ public class EquBase
@Excel(name = "预计年限(年)")
private Long lifeCycle;
/** 服役年限(年) */
@Excel(name = "服役年限(年)")
private Long serviceTime;
/** 质保时间(年) */
@Excel(name = "质保时间(年)")
private Long warranty;
/** 添加日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "添加日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date createDate;
/** 最后修改日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后修改日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date updateDate;
/** 启用状态 */
@Excel(name = "启用状态")
/** 启用状态(1启用0禁用) */
@Excel(name = "启用状态", readConverterExp = "0=启用1禁用")
private Long status;
/** 累积故障次数 */
@Excel(name = "累积故障次数")
/** 累计预警次数 */
@Excel(name = "累计预警次数")
private Long failureFrequency;
/** 累积维修次数 */
@Excel(name = "累积维修次数")
private Long repairFrequency;
/** 设备级别 */
@Excel(name = "设备级别")
private String deviceLevel;
/** 供应商id */
@Excel(name = "供应商id")
private String supplierId;
/** 采集次数 */
@Excel(name = "采集次数")
private Long gatherFrequency;
@Excel(name = "采集次数")
private Long createBy ;
@Excel(name = "设备图片")
private byte[] equImage ;
/** 累积维修金额(元) */
@Excel(name = "累积维修金额(元)")
private BigDecimal repairCost;
public void setId(String id)
{
@ -190,26 +192,16 @@ public class EquBase
return equType;
}
public void setInCharge(Long inCharge)
public void setInCharge(String inCharge)
{
this.inCharge = inCharge;
}
public Long getInCharge()
public String getInCharge()
{
return inCharge;
}
public void setReleaseDate(Date releaseDate)
{
this.releaseDate = releaseDate;
}
public Date getReleaseDate()
{
return releaseDate;
}
public void setInstallDate(Date installDate)
{
this.installDate = installDate;
@ -230,16 +222,6 @@ public class EquBase
return lifeCycle;
}
public void setServiceTime(Long serviceTime)
{
this.serviceTime = serviceTime;
}
public Long getServiceTime()
{
return serviceTime;
}
public void setWarranty(Long warranty)
{
this.warranty = warranty;
@ -250,8 +232,6 @@ public class EquBase
return warranty;
}
public void setCreateDate(Date createDate)
{
this.createDate = createDate;
@ -262,16 +242,6 @@ public class EquBase
return createDate;
}
public void setUpdateDate(Date updateDate)
{
this.updateDate = updateDate;
}
public Date getUpdateDate()
{
return updateDate;
}
public void setStatus(Long status)
{
this.status = status;
@ -281,6 +251,7 @@ public class EquBase
{
return status;
}
public void setFailureFrequency(Long failureFrequency)
{
this.failureFrequency = failureFrequency;
@ -291,24 +262,34 @@ public class EquBase
return failureFrequency;
}
public void setRepairFrequency(Long repairFrequency)
public void setDeviceLevel(String deviceLevel)
{
this.deviceLevel = deviceLevel;
}
public String getDeviceLevel()
{
this.repairFrequency = repairFrequency;
return deviceLevel;
}
public Long getRepairFrequency()
public void setSupplierId(String supplierId)
{
return repairFrequency;
this.supplierId = supplierId;
}
public void setRepairCost(BigDecimal repairCost)
public String getSupplierId()
{
this.repairCost = repairCost;
return supplierId;
}
public BigDecimal getRepairCost()
public void setGatherFrequency(Long gatherFrequency)
{
return repairCost;
this.gatherFrequency = gatherFrequency;
}
public Long getGatherFrequency()
{
return gatherFrequency;
}
@Override
@ -322,20 +303,17 @@ public class EquBase
.append("location", getLocation())
.append("equType", getEquType())
.append("inCharge", getInCharge())
.append("releaseDate", getReleaseDate())
.append("installDate", getInstallDate())
.append("lifeCycle", getLifeCycle())
.append("serviceTime", getServiceTime())
.append("warranty", getWarranty())
//.append("createBy", getCreateBy())
.append("createBy", getCreateBy())
.append("createDate", getCreateDate())
//.append("updateBy", getUpdateBy())
.append("updateDate", getUpdateDate())
.append("status", getStatus())
.append("failureFrequency", getFailureFrequency())
.append("repairFrequency", getRepairFrequency())
.append("repairCost", getRepairCost())
.append("failureFrequency", getFailureFrequency())
.append("deviceLevel", getDeviceLevel())
.append("supplierId", getSupplierId())
.append("gatherFrequency", getGatherFrequency())
.append("createBy", getCreateBy())
.toString();
}
}

@ -6,6 +6,7 @@ import java.util.Date;
import com.alops.common.annotation.Excel;
import com.alops.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.ibatis.annotations.Mapper;
@ -16,7 +17,7 @@ import org.apache.ibatis.annotations.Mapper;
* @author ruoyi
* @date 2025-08-15
*/
@Data
public class EquGather extends BaseEntity
{
private static final long serialVersionUID = 1L;

@ -6,6 +6,7 @@ import java.util.Date;
import com.alops.common.annotation.Excel;
import com.alops.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -15,6 +16,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* @author ruoyi
* @date 2025-08-20
*/
@Data
public class EquInterface extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -75,6 +77,7 @@ public class EquInterface extends BaseEntity
@Excel(name = "出方向带宽占有率(%)")
private BigDecimal outBandwidth;
public void setId(String id)
{
this.id = id;

@ -2,6 +2,7 @@ package com.alops.system.domain;
import com.alops.common.annotation.Excel;
import com.alops.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.ibatis.annotations.Mapper;
@ -12,7 +13,7 @@ import org.apache.ibatis.annotations.Mapper;
* @author ruoyi
* @date 2025-08-15
*/
@Data
public class EquRouting extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -38,6 +39,7 @@ public class EquRouting extends BaseEntity
@Excel(name = "下一跳地址 (ipv4/ipv6网段)")
private String nextHop;
public void setId(String id)
{
this.id = id;

@ -5,15 +5,19 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.alops.common.annotation.Excel;
import com.alops.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 供应商功能 对象 equ_supplier
*
*
* @author ruoyi
* @date 2025-09-20
*/
@Data
public class EquSupplier
{
private static final long serialVersionUID = 1L;
@ -36,20 +40,24 @@ public class EquSupplier
/** l联系方式 */
@Excel(name = "l联系方式")
private String contactWay;
/** 联系人姓名 */
@Excel(name = "创建人id")
private long createBy;
/** 状态(0禁1启用) */
@Excel(name = "状态", readConverterExp = "0=禁1启用")
private Long status;
/** 创建者 */
private String createBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
public void setId(String id)
public void setId(String id)
{
this.id = id;
}
@ -109,12 +117,12 @@ public class EquSupplier
return status;
}
public String getCreateBy()
public Long getCreateBy()
{
return createBy;
}
public void setCreateBy(String createBy)
public void setCreateBy(Long createBy)
{
this.createBy = createBy;
}
@ -142,6 +150,4 @@ public class EquSupplier
.append("status", getStatus())
.toString();
}
}

@ -2,6 +2,7 @@ package com.alops.system.domain;
import com.alops.common.annotation.Excel;
import com.alops.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.ibatis.annotations.Mapper;
@ -12,7 +13,7 @@ import org.apache.ibatis.annotations.Mapper;
* @author ruoyi
* @date 2025-08-09
*/
@Data
public class EquValn extends BaseEntity
{
private static final long serialVersionUID = 1L;

@ -2,6 +2,7 @@ package com.alops.system.domain;
import com.alops.common.annotation.Excel;
import com.alops.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.ibatis.annotations.Mapper;
@ -12,7 +13,7 @@ import org.apache.ibatis.annotations.Mapper;
* @author ruoyi
* @date 2025-08-15
*/
@Data
public class EquVeneer extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -33,6 +34,9 @@ public class EquVeneer extends BaseEntity
@Excel(name = "采集id")
private String equGatherId;
@Excel(name = "采集+预警同一批标志")
private String batchId;
public void setId(String id)
{
this.id = id;

@ -3,6 +3,7 @@ package com.alops.system.domain;
import com.alops.common.annotation.Excel;
import com.alops.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.ibatis.annotations.Mapper;
@ -10,12 +11,12 @@ import org.apache.ibatis.annotations.Mapper;
import java.util.Date;
/**
* 对象 equ_vlan
* 请填写功能名称对象 equ_vlan
*
* @author ruoyi
* @date 2025-08-15
*/
@Data
public class EquVlan
{
private static final long serialVersionUID = 1L;
@ -57,7 +58,7 @@ public class EquVlan
/** 更新者 */
private String updateBy;
public void setId(String id)
public void setId(String id)
{
this.id = id;
}

@ -2,6 +2,7 @@ package com.alops.system.domain;
import com.alops.common.annotation.Excel;
import com.alops.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -11,6 +12,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* @author ruoyi
* @date 2025-09-04
*/
@Data
public class InternalMessage extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -30,6 +32,8 @@ public class InternalMessage extends BaseEntity
@Excel(name = "消息状态(unread/read)")
private String status;
public void setId(Long id)
{
this.id = id;

@ -5,6 +5,7 @@ import java.util.Date;
import com.alops.common.annotation.Excel;
import com.alops.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -14,7 +15,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* @author ruoyi
* @date 2025-08-03
*/
public class ScheduleRules extends BaseEntity
@Data
public class ScheduleRules
{
private static final long serialVersionUID = 1L;
@ -31,49 +33,38 @@ public class ScheduleRules extends BaseEntity
/** 采集频率(当rule_type=0时有效),如"5分钟" */
@Excel(name = "采集频率(当rule_type=0时有效)")
private String frequency;
private Integer frequency;
/** 固定采集时间(当rule_type=1时有效) */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "固定采集时间(当rule_type=1时有效)", width = 30, dateFormat = "yyyy-MM-dd")
private Date fixedTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date gatherTime;
/** 是否启用时间限制 */
@Excel(name = "是否启用时间限制")
private Integer timeLimitEnabled;
/** 采集开始时间(当time_limit_enabled=TRUE时有效) */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "采集开始时间(当time_limit_enabled=TRUE时有效)", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
/** 采集结束时间(当time_limit_enabled=TRUE时有效) */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "采集结束时间(当time_limit_enabled=TRUE时有效)", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
/** 是否启用该规则 */
@Excel(name = "是否启用该规则")
private Integer isActive;
@Excel(name = "规则状态")
private Integer status;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdAt;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt;
/** 创建人 */
@Excel(name = "创建人")
private Long createdBy;
/** 更新人 */
@Excel(name = "更新人")
private Long updatedBy;
public void setId(Long id)
{
this.id = id;
@ -103,36 +94,25 @@ public class ScheduleRules extends BaseEntity
{
return ruleType;
}
public void setFrequency(String frequency)
{
this.frequency = frequency;
}
public String getFrequency()
public Integer getStatus()
{
return frequency;
return status;
}
public void setFixedTime(Date fixedTime)
public void setStatus(Integer status)
{
this.fixedTime = fixedTime;
this.status = status;
}
public Date getFixedTime()
public void setFrequency(Integer frequency)
{
return fixedTime;
this.frequency = frequency;
}
public void setTimeLimitEnabled(Integer timeLimitEnabled)
public Integer getFrequency()
{
this.timeLimitEnabled = timeLimitEnabled;
return frequency;
}
public Integer getTimeLimitEnabled()
{
return timeLimitEnabled;
}
public void setStartTime(Date startTime)
{
@ -154,15 +134,6 @@ public class ScheduleRules extends BaseEntity
return endTime;
}
public void setIsActive(Integer isActive)
{
this.isActive = isActive;
}
public Integer getIsActive()
{
return isActive;
}
public void setCreatedAt(Date createdAt)
{
@ -174,15 +145,6 @@ public class ScheduleRules extends BaseEntity
return createdAt;
}
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
{
return updatedAt;
}
public void setCreatedBy(Long createdBy)
{
@ -194,15 +156,6 @@ public class ScheduleRules extends BaseEntity
return createdBy;
}
public void setUpdatedBy(Long updatedBy)
{
this.updatedBy = updatedBy;
}
public Long getUpdatedBy()
{
return updatedBy;
}
@Override
public String toString() {
@ -211,15 +164,14 @@ public class ScheduleRules extends BaseEntity
.append("ruleName", getRuleName())
.append("ruleType", getRuleType())
.append("frequency", getFrequency())
.append("fixedTime", getFixedTime())
.append("timeLimitEnabled", getTimeLimitEnabled())
.append("gatherTime", getGatherTime())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("isActive", getIsActive())
.append("status", getStatus())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.append("createdBy", getCreatedBy())
.append("updatedBy", getUpdatedBy())
.toString();
}
}

@ -0,0 +1,15 @@
package com.alops.system.domain.dto;
import lombok.Data;
import java.util.Date;
@Data
public class AlertDto {
private Date minTime;
private Date maxTime;
private Long level;
private String status;
private String location;
private String inCharge;
}

@ -21,19 +21,12 @@ public class EquBaseQueryDto implements Serializable {
private String equType;
/** 设备名称 (name, varchar) */
private String equName;
private String name;
/** 安装位置 ID (location, varchar) */
private String location;
/** 厂商 ID (manufacture, varchar) */
private String manufacture;
/** 设备管理员 ID (in_charge, bigint) */
private Long inCharge;
/** 健康度 (额外查询条件,int 或百分比) */
private Integer health;
/** 起始时间 (min_time) */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -45,21 +38,16 @@ public class EquBaseQueryDto implements Serializable {
/** 状态 (status, tinyint) */
private Integer status;
// ====== Getter 和 Setter ======
public String getEquType() {
return equType;
}
public void setEquType(String equType) {
this.equType = equType;
}
public String getEquName() {
return equName;
public String getName() {
return name;
}
public void setEquName(String equName) {
this.equName = equName;
public void setName(String equName) {
this.name = equName;
}
public String getLocation() {
@ -70,29 +58,6 @@ public class EquBaseQueryDto implements Serializable {
this.location = location;
}
public String getManufacture() {
return manufacture;
}
public void setManufacture(String manufacture) {
this.manufacture = manufacture;
}
public Long getInCharge() {
return inCharge;
}
public void setInCharge(Long inCharge) {
this.inCharge = inCharge;
}
public Integer getHealth() {
return health;
}
public void setHealth(Integer health) {
this.health = health;
}
public Date getMinTime() {
return minTime;

@ -0,0 +1,11 @@
package com.alops.system.domain.vo;
import lombok.Data;
@Data
public class RolePickerVo {
private Long roleId;
private String roleName;
private String roleKey;
}

@ -0,0 +1,13 @@
package com.alops.system.domain.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class dropDownVo {
private String id;
private String name;
}

@ -0,0 +1,8 @@
package com.alops.system.domain.vo;
import lombok.Data;
@Data
public class imageVo {
private byte[] equImage;
}

@ -15,7 +15,7 @@ import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class queryEquBaseVO extends BaseEntity {
public class queryEquBaseVO {
/**
* 设备基本信息对象 equ_base
@ -39,32 +39,23 @@ public class queryEquBaseVO extends BaseEntity {
/** 带外管理 IP */
@Excel(name = "带外管理 IP")
private String ip;
// /** 设备厂商 */
// @Excel(name = "设备厂商 ")
// private EquManu manufacture;
/** 设备厂商 */
@Excel(name = "设备厂商id ")
private String manuId;
/** 设备厂商 */
/** 设备厂商 */
@Excel(name = "设备厂商名称 ")
private String manuName;
/** 设备厂商 */
@Excel(name = "设备厂商名称 ")
private String supplierName;
/** 安装位置 id */
@Excel(name = "安装位置 id")
private String location;
/** 设备类型 id */
@Excel(name = "设备类型 id")
@Excel(name = "设备类型名称")
private String equType;
/** 设备管理员 id */
@Excel(name = "设备管理员 id")
private Long inCharge;
/** 出厂日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出厂日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date releaseDate;
@Excel(name = "设备管理员 名称")
private String inCharge;
/** 安装日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ -75,41 +66,30 @@ public class queryEquBaseVO extends BaseEntity {
@Excel(name = "预计年限(年)")
private Long lifeCycle;
/** 服役年限(年) */
@Excel(name = "服役年限(年)")
private Long serviceTime;
/** 质保时间(年) */
@Excel(name = "质保时间(年)")
private Long warranty;
/** 添加日期 */
@Excel(name = "创建人")
private String createBy;
@Excel(name = "健康度")
private BigDecimal health;
/** 添加日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "添加日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date createDate;
/** 最后修改日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后修改日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date updateDate;
/** 启用状态 */
@Excel(name = "启用状态")
private Long status;
/** 累积故障次数 */
@Excel(name = "累积故障次数")
private Long failureFrequency;
/** 累积维修次数 */
@Excel(name = "累积维修次数")
private Long repairFrequency;
/** 累积故障次数 */
@Excel(name = "累积故障次数")
private String deviceLevel;
/** 累积维修金额(元) */
@Excel(name = "累积维修金额(元)")
private BigDecimal repairCost;
public void setId(String id)
public void setId(String id)
{
this.id = id;
}
@ -171,25 +151,17 @@ public class queryEquBaseVO extends BaseEntity {
return equType;
}
public void setInCharge(Long inCharge)
public void setInCharge(String inCharge)
{
this.inCharge = inCharge;
}
public Long getInCharge()
public String getInCharge()
{
return inCharge;
}
public void setReleaseDate(Date releaseDate)
{
this.releaseDate = releaseDate;
}
public Date getReleaseDate()
{
return releaseDate;
}
public void setInstallDate(Date installDate)
{
@ -211,15 +183,6 @@ public class queryEquBaseVO extends BaseEntity {
return lifeCycle;
}
public void setServiceTime(Long serviceTime)
{
this.serviceTime = serviceTime;
}
public Long getServiceTime()
{
return serviceTime;
}
public void setWarranty(Long warranty)
{
@ -243,15 +206,7 @@ public class queryEquBaseVO extends BaseEntity {
return createDate;
}
public void setUpdateDate(Date updateDate)
{
this.updateDate = updateDate;
}
public Date getUpdateDate()
{
return updateDate;
}
public void setStatus(Long status)
{
@ -270,24 +225,20 @@ public class queryEquBaseVO extends BaseEntity {
.append("name", getName())
.append("version", getVersion())
.append("ip", getIp())
.append("manuId", getManuId())
.append("supplierName", getSupplierName())
.append("manuName", getManuName())
.append("location", getLocation())
.append("equType", getEquType())
.append("inCharge", getInCharge())
.append("releaseDate", getReleaseDate())
.append("installDate", getInstallDate())
.append("lifeCycle", getLifeCycle())
.append("serviceTime", getServiceTime())
.append("warranty", getWarranty())
.append("createBy", getCreateBy())
.append("createDate", getCreateDate())
.append("updateBy", getUpdateBy())
.append("updateDate", getUpdateDate())
.append("status", getStatus())
.append("failureFrequency", getFailureFrequency())
.append("repairFrequency", getRepairFrequency())
.append("repairCost", getRepairCost())
.append("deviceLevel", getDeviceLevel())
.append("health", getHealth())
.toString();
}
}

@ -0,0 +1,101 @@
package com.alops.system.job;
import com.alops.system.domain.InternalMessage;
import com.alops.system.domain.ScheduleRules;
import com.alops.system.mapper.ScheduleRulesMapper;
import com.alops.system.service.IAlertSenderService;
import com.alops.system.service.IScheduleRulesService;
import com.alops.system.service.impl.ScheduleRulesServiceImpl;
import org.quartz.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
;
import java.util.Date;
@Component
public class GatherJob implements Job {
private static final Logger log = LoggerFactory.getLogger(GatherJob.class);
@Autowired
private ScheduleRulesMapper scheduleRulesMapper;
@Autowired
private IScheduleRulesService iScheduleRulesService;
@Autowired
private IAlertSenderService iAlertSenderService;
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
Long ruleId = context.getJobDetail().getJobDataMap().getLong("ruleId");
ScheduleRules rule = scheduleRulesMapper.selectScheduleRulesById(ruleId);
// 统一使用 Date
Date now = new Date();
try {
if (rule == null) return;
// 按频率判断时间范围
if (rule.getRuleType() == 0) {
Date start = rule.getStartTime();
Date end = rule.getEndTime();
if (start != null && end != null) {
// 当前时间不在范围内
if ( now.after(end)) {
rule.setStatus(2); // 超出范围标记完成
scheduleRulesMapper.updateScheduleRules(rule);
return;
}
}
}
// 执行任务
iScheduleRulesService.executeImmediately();
// 执行成功
if (rule.getRuleType() == 0 || rule.getRuleType() == 1) {
rule.setStatus(2);
}
scheduleRulesMapper.updateScheduleRules(rule);
} catch (Exception e) {
//执行失败是不会有采集信息和预警信息的
// 记录详细异常日志,方便排查
log.error("GatherJob 执行失败, ruleId={}, 原因: {}", rule.getId(), e.getMessage(), e);
// 更新数据库任务状态为失败
rule.setStatus(3);
scheduleRulesMapper.updateScheduleRules(rule);
try {
String Content=String.format("任务执行失败,规则ID=%s,规则名称=%s,原因:%s",
rule.getId(), rule.getRuleName(), e.getMessage());
iAlertSenderService.sendInternalMessage( Content,"2" );
log.info("已发送失败通知给运维人员");
} catch (Exception ne) {
log.error("发送站内信失败: {}", ne.getMessage(), ne);
}
// 如果是定时类规则,取消后续调度
if (rule.getRuleType() == 0) {
try {
// 从上下文取出 Scheduler
Scheduler scheduler = context.getScheduler();
JobKey jobKey = context.getJobDetail().getKey();
scheduler.deleteJob(jobKey); // 取消后续执行
log.info("已取消定时任务: {}", jobKey);
} catch (SchedulerException se) {
log.error("取消后续定时任务失败: {}", se.getMessage(), se);
}
}
}
}
}

@ -1,6 +1,7 @@
package com.alops.system.mapper;
import com.alops.system.domain.AlertMessage;
import com.alops.system.domain.dto.AlertDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -17,7 +18,10 @@ import java.util.Map;
@Mapper
public interface AlertMessageMapper
{
/**
* 查询当前最大的实验批次号没有则返回 0
*/
Integer selectMaxBatch();
/**
* 批量插入预警消息
* @param messages 消息列表

@ -16,6 +16,16 @@ import java.util.List;
public interface AlertRuleConditionMapper
{
// 删除多个规则对应的条件
int deleteByAlertRuleIds(@Param("ids") Long[] ids);
List<AlertRuleCondition> selectByAlertRuleId(@Param("ruleId") Long ruleId);
/**
* 根据规则ID删除所有条件
* @param alertRuleId 规则IDLong 类型
* @return 受影响的行数
*/
int deleteByAlertRuleId(@Param("alertRuleId") Long alertRuleId);
/**
* 根据预警规则ID查询对应的规则条件
* @param ruleId 预警规则ID整型

@ -1,6 +1,7 @@
package com.alops.system.mapper;
import com.alops.system.domain.AlertRule;
import com.alops.system.domain.dto.AlertRuleAddDto;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.data.repository.query.Param;
@ -18,7 +19,7 @@ public interface AlertRuleMapper
//根据id组,批量返回
// Mapper 接口
List<AlertRule> selectByIds(@Param("list") List<Long> ids);
List<AlertRule> selectAlertRule();
/**
* 查询请填写功能名称
*
@ -65,5 +66,5 @@ public interface AlertRuleMapper
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteAlertRuleByIds(Long[] ids);
public int deleteAlertRuleByIds(@Param("ids") Long[] ids);
}

@ -16,7 +16,7 @@ import java.util.List;
public interface DictAlarmParamMapper
{
List<DictAlarmParam> selectByTableName(@Param("tableName") String tableName);
List<DictAlarmParam> selectByTableName();
/**
* 查询请填写功能名称
*

@ -1,10 +1,15 @@
package com.alops.system.mapper;
import java.util.List;
import java.util.Map;
import com.alops.system.domain.EquBase;
import com.alops.system.domain.dto.*;
import com.alops.system.domain.dto.EquBaseQueryDto;
import com.alops.system.domain.vo.imageVo;
import com.alops.system.domain.vo.queryEquBaseVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.repository.query.Param;
import java.util.List;
import java.util.Map;
@ -14,11 +19,13 @@ import java.util.Map;
* 设备基本信息Mapper接口
*
* @author ruoyi
* @date 2025-08-01
* @date 2025-09-19
*/
@Mapper
public interface EquBaseMapper
{
int incrementCollectCount(@Param("ids") List<String> ids);
@Update("DELETE FROM equ_interface")
void deleteEquInterface();
@ -31,13 +38,22 @@ public interface EquBaseMapper
@Update("DELETE FROM equ_vlan")
void deleteEquVlan();
/**
* 批量更新 failure_frequency
* @param list List of maps: each map contains "equId" "count"
* @return 受影响的行数
*/
int batchUpdateFailureFrequency(@Param("list") List<Map<String, Object>> list);
public List<EquBase> findEquBaseList();
/**
* 查询设备基本信息
*
* @param id 设备基本信息主键
* @return 设备基本信息
*/
public EquBase selectEquBaseById(String id);
public queryEquBaseVO selectEquBaseById(String id);
public imageVo selectEquBaseImageById(@Param("id") String id);
/**查询界面具体信息 -YY**/
@ -48,21 +64,13 @@ public interface EquBaseMapper
/**分类统计界面信息 -YY**/
List<MonitorStatisticDto> selectEquStatisticByType();
/**
* 查询设备基本信息和厂商信息
*
* @param equBaseQueryDto 设备基本信息
* @return 设备基本信息集合
*/
public List<queryEquBaseVO> selectEquBaseList(EquBaseQueryDto equBaseQueryDto);
/**
/**
* 查询设备基本信息列表
*
*
* @param equBase 设备基本信息
* @return 设备基本信息集合
*/
public List<EquBase> findEquBaseList();
public List<queryEquBaseVO> selectEquBaseList(EquBaseQueryDto equBase);
/**
* 新增设备基本信息

@ -1,6 +1,7 @@
package com.alops.system.mapper;
import com.alops.system.domain.EquManu;
import com.alops.system.domain.vo.dropDownVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -14,6 +15,7 @@ import java.util.List;
@Mapper
public interface EquManuMapper
{
List<dropDownVo> selectEquManuDropDown();
/**
* 查询设备厂商管理
*

@ -2,8 +2,11 @@ package com.alops.system.mapper;
import java.util.List;
import com.alops.system.domain.EquSupplier;
import com.alops.system.domain.vo.dropDownVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 请填写功能名称Mapper接口
*
@ -13,6 +16,8 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface EquSupplierMapper
{
List<dropDownVo> selectEquSupDropDown();
/**
* 查询请填写功能名称
*

@ -1,6 +1,7 @@
package com.alops.system.mapper;
import com.alops.system.domain.EquType;
import com.alops.system.domain.vo.dropDownVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -14,6 +15,10 @@ import java.util.List;
@Mapper
public interface EquTypeMapper
{
/**
* 查询设备类型下拉数据
*/
List<dropDownVo> selectEquTypeDropDown();
/**
* 查询设备类型管理
*

@ -14,14 +14,19 @@ import java.util.List;
@Mapper
public interface ScheduleRulesMapper
{
public List<ScheduleRules> selectList();
/**
* 查询定时采集规则
*
* @param id 定时采集规则主键
*
* @return 定时采集规则
*/
public ScheduleRules selectScheduleRulesById(Long id);
public ScheduleRules selectScheduleRulesByMaxTime();
public ScheduleRules selectScheduleRulesById(Long id);
/**
* 查询定时采集规则列表
*

@ -2,6 +2,7 @@ package com.alops.system.mapper;
import java.util.List;
import com.alops.common.core.domain.entity.SysRole;
import com.alops.system.domain.vo.RolePickerVo;
import org.apache.ibatis.annotations.Mapper;
/**
@ -12,6 +13,8 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SysRoleMapper
{
//角色下拉表
List<RolePickerVo> selectAllRolesSimple();
/**
* 根据条件分页查询角色数据
*

@ -1,7 +1,8 @@
package com.alops.system.service;
import java.util.List;
import java.util.concurrent.ExecutionException;
public interface IAlertLaunchService {
public void executeImmediateAlerts(List<Long> ruleIds);
public void executeImmediateAlerts() throws ExecutionException, InterruptedException;
}

@ -1,6 +1,7 @@
package com.alops.system.service;
import com.alops.system.domain.AlertMessage;
import com.alops.system.domain.dto.AlertDto;
import com.alops.system.domain.dto.AlertStatisticDto;
import java.util.List;
@ -28,7 +29,7 @@ public interface IAlertMessageService
* @param alertMessage 故障统计
* @return 故障统计集合
*/
public List<AlertMessage> selectAlertMessageList(AlertMessage alertMessage);
public List<AlertMessage> selectAlertMessageList(AlertDto alertMessage);
public List<AlertMessage> selectAlertMessageListByEquId(Long equId);
@ -51,7 +52,7 @@ public interface IAlertMessageService
* @param alertMessage 故障统计
* @return 结果
*/
public int updateAlertMessage(AlertMessage alertMessage);
public AlertMessage updateAlertMessage(AlertMessage alertMessage);
/**
* 批量删除故障统计

@ -4,6 +4,7 @@ import com.alops.system.domain.AlertRule;
import com.alops.system.domain.dto.AlertRuleAddDto;
import java.util.List;
import java.util.Map;
/**
* 请填写功能名称Service接口
@ -15,6 +16,16 @@ public interface IAlertRuleService
{
public AlertRule saveRule(AlertRuleAddDto dto);
public AlertRule updateRule(AlertRuleAddDto dto);
/**
* 根据规则ID查询完整的规则及其条件
* @param id 规则ID
* @return AlertRuleAddDto
*/
AlertRuleAddDto selectDetailAlertRuleById(Long id);
/**
* 查询请填写功能名称
*
@ -53,7 +64,7 @@ public interface IAlertRuleService
* @param ids 需要删除的请填写功能名称主键集合
* @return 结果
*/
public int deleteAlertRuleByIds(Long[] ids);
public Map<String, Integer> deleteAlertRuleByIds(Long[] ids);
/**
* 删除请填写功能名称信息

@ -4,4 +4,5 @@ import java.util.List;
public interface IAlertSenderService {
public void sendAlert(List<String> alertMessage, String alertWay, String target);
public void sendInternalMessage(String content, String roleIdStr);
}

@ -13,7 +13,7 @@ import java.util.List;
public interface IDictAlarmParamService
{
List<DictAlarmParam> getParamsByTableName(String tableName);
List<DictAlarmParam> getParamsByTableName();
/**
* 查询请填写功能名称
*

@ -1,6 +1,9 @@
package com.alops.system.service;
import com.alops.system.domain.EquBase;
import com.alops.system.domain.dto.EquBaseQueryDto;
import com.alops.system.domain.vo.dropDownVo;
import com.alops.system.domain.vo.imageVo;
import com.alops.system.domain.dto.*;
import com.alops.system.domain.vo.queryEquBaseVO;
@ -11,18 +14,25 @@ import java.util.List;
* 设备基本信息Service接口
*
* @author ruoyi
* @date 2025-08-01
* @date 2025-09-19
*/
public interface IEquBaseService
{
public List<dropDownVo> selectEquManu();
public List<dropDownVo> selectEquSupp();
public List<dropDownVo> selectEquType();
/**
* 查询设备基本信息
*
* @param id 设备基本信息主键
* @return 设备基本信息
*/
public EquBase selectEquBaseById(String id);
/**查询界面具体信息**/
public queryEquBaseVO selectEquBaseById(String id);
public imageVo selectEquBaseImageById(String id);
/**查询界面具体信息**/
// EquMonitorVO selectEquMonitorInfo(EquBaseQueryDto queryDto);
@ -45,10 +55,10 @@ public interface IEquBaseService
/**
* 查询设备基本信息列表
*
* @param equBaseQueryDto 设备基本信息
* @param equBase 设备基本信息
* @return 设备基本信息集合
*/
public List<queryEquBaseVO> selectEquBaseList(EquBaseQueryDto equBaseQueryDto);
public List<queryEquBaseVO> selectEquBaseList(EquBaseQueryDto equBase);
public List<MonitorListDto> selectEquMonitorList(EquBaseQueryDto equBaseQueryDto);
@ -86,5 +96,4 @@ public interface IEquBaseService
* @return 结果
*/
public int deleteEquBaseById(String id);
}
}

@ -3,6 +3,8 @@ package com.alops.system.service;
import java.util.List;
import com.alops.system.domain.EquSupplier;
import java.util.List;
/**
* 请填写功能名称Service接口
*

@ -0,0 +1,12 @@
package com.alops.system.service;
import com.alops.system.domain.ScheduleRules;
import com.alops.system.service.impl.QuartzService;
import org.quartz.SchedulerException;
public interface IQuartzService {
public void createOrUpdateJob(ScheduleRules rule);
public void deleteJob(Long ruleId) throws SchedulerException;
}

@ -2,6 +2,7 @@ package com.alops.system.service;
import com.alops.common.core.domain.AjaxResult;
import com.alops.system.domain.ScheduleRules;
import org.quartz.SchedulerException;
import org.springframework.stereotype.Service;
import java.util.List;
@ -19,15 +20,17 @@ public interface IScheduleRulesService
{
public AjaxResult executeRule(ScheduleRules newRule) throws SchedulerException, ExecutionException, InterruptedException;
public int executeImmediately() throws ExecutionException, InterruptedException;
/**
* 查询定时采集规则
*
* @param id 定时采集规则主键
* @return 定时采集规则
*/
public ScheduleRules selectScheduleRulesById(Long id);
public ScheduleRules selectScheduleRuleByMaxTime();
/**
* 查询定时采集规则列表
@ -43,7 +46,7 @@ public interface IScheduleRulesService
* @param scheduleRules 定时采集规则
* @return 结果
*/
public int insertScheduleRules(ScheduleRules scheduleRules);
public int insertScheduleRules (ScheduleRules scheduleRules);
/**
* 修改定时采集规则

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Set;
import com.alops.common.core.domain.entity.SysRole;
import com.alops.system.domain.SysUserRole;
import com.alops.system.domain.vo.RolePickerVo;
/**
* 角色业务层
@ -12,6 +13,8 @@ import com.alops.system.domain.SysUserRole;
*/
public interface ISysRoleService
{
List<RolePickerVo> selectAllRolesSimple();
/**
* 根据条件分页查询角色数据
*

@ -6,6 +6,7 @@ import com.alops.system.domain.vo.EquGatherInsertInfo;
import com.alops.system.domain.vo.GatherEntities;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;

@ -6,6 +6,7 @@ import com.alops.system.domain.AlertRuleCondition;
import com.alops.system.mapper.AlertMessageMapper;
import com.alops.system.mapper.AlertRuleConditionMapper;
import com.alops.system.mapper.AlertRuleMapper;
import com.alops.system.mapper.EquBaseMapper;
import com.alops.system.service.IAlertLaunchService;
import com.alops.system.service.IAlertSenderService;
import org.springframework.beans.factory.annotation.Autowired;
@ -14,8 +15,11 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
@Service
public class AlertLaunchServiceImpl implements IAlertLaunchService {
@ -30,22 +34,81 @@ public class AlertLaunchServiceImpl implements IAlertLaunchService {
private JdbcTemplate jdbcTemplate;
@Autowired
private IAlertSenderService alertSender; // 发送通知
@Autowired
private EquBaseMapper equBaseMapper;
private final ExecutorService executor = Executors.newFixedThreadPool(5);
/**
* 执行立即预警
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void executeImmediateAlerts(List<Long> ruleIds) {
List<AlertRule> rules = alertRuleMapper.selectByIds(ruleIds);
//每个规则开一个线程
public void executeImmediateAlerts() {
Integer maxBatch = alertMessageMapper.selectMaxBatch();
Integer currentBatch = (maxBatch == null ? 0 : maxBatch) + 1;
List<AlertRule> rules = alertRuleMapper.selectAlertRule();
Map<String, Integer> totalFailureCount = new HashMap<>();
for (AlertRule rule : rules) {
executor.submit(() -> processRule(rule));
Map<String, Integer> map = processRule(rule, currentBatch); // 直接同步调用
map.forEach((equId, count) -> totalFailureCount.merge(equId, count, Integer::sum));
}
List<Map<String, Object>> updateList = totalFailureCount.entrySet().stream()
.map(entry -> {
Map<String, Object> map = new HashMap<>();
map.put("equId", entry.getKey());
map.put("count", entry.getValue());
return map;
})
.collect(Collectors.toList());
if (!updateList.isEmpty()) {
equBaseMapper.batchUpdateFailureFrequency(updateList); // 出异常会触发回滚
}
}
// public void executeImmediateAlerts() throws ExecutionException, InterruptedException {
// // 1. 查询当前最大批次,没有则返回 0
// Integer maxBatch = alertMessageMapper.selectMaxBatch();
// Integer currentBatch = (maxBatch == null ? 0 : maxBatch) + 1;
//
// List<AlertRule> rules = alertRuleMapper.selectAlertRule();
//
// // 2. 用于收集每个线程返回的统计结果
// List<Future<Map<String, Integer>>> futures = new ArrayList<>();
//
// for (AlertRule rule : rules) {
// futures.add(executor.submit(() -> processRule(rule, currentBatch)));
// }
//
// // 3. 合并所有线程的统计结果
// Map<String, Integer> totalFailureCount = new HashMap<>();
// for (Future<Map<String, Integer>> future : futures) {
// Map<String, Integer> map = future.get(); // 阻塞等待线程完成
// map.forEach((equId, count) -> totalFailureCount.merge(equId, count, Integer::sum));
// }
//
// // 4. 转成 List<Map<String,Object>> 用于 mapper 批量更新
// List<Map<String, Object>> updateList = totalFailureCount.entrySet().stream()
// .map(entry -> {
// Map<String, Object> map = new HashMap<>();
// map.put("equId", entry.getKey());
// map.put("count", entry.getValue());
// return map;
// }).collect(Collectors.toList());
//
// if (!updateList.isEmpty()) {
// equBaseMapper.batchUpdateFailureFrequency(updateList);
// }
// }
/**
* 同步插入消息
*/
@ -64,46 +127,54 @@ public class AlertLaunchServiceImpl implements IAlertLaunchService {
/**
* 处理单条预警规则
*/
private void processRule(AlertRule rule) {
private Map<String, Integer> processRule(AlertRule rule, Integer currentBatch) {
Map<String, Integer> failureCountMap = new HashMap<>();
try {
//1.一次预警规则的所有预警信息实体存一块
List<AlertMessage> messages = new ArrayList<>();
List<String> msgs=new ArrayList<>();
//2.判断是否特殊符号
List<String> msgs = new ArrayList<>();
boolean isChangedRule = "CHANGED".equalsIgnoreCase(rule.getAlertSql());
//3.一个预警规则查询的所有行数据
List<Map<String, Object>> queryResults;
if (isChangedRule) {
queryResults = handleChangedRule(rule);
} else {
queryResults = jdbcTemplate.queryForList(rule.getAlertSql());
}
//构建预警信息实体和预警信息内容
List<Map<String, Object>> queryResults = isChangedRule
? handleChangedRule(rule)
: jdbcTemplate.queryForList(rule.getAlertSql());
for (Map<String, Object> row : queryResults) {
AlertMessage msg = new AlertMessage();
String msgdes=null;
msg.setLevel(rule.getSeverity());
msg.setType(rule.getType());
msg.setOccurTime(new Date());
msg.setStatus("open");
msg.setEquId(row.get("equ_id") != null ? row.get("equ_id").toString() : null);
msg.setStatus("UNHANDLED");
String equId = row.get("equ_id") != null ? row.get("equ_id").toString() : null;
msg.setEquId(equId);
msg.setEquType(row.get("equ_type") != null ? row.get("equ_type").toString() : null);
msgdes=fillTemplate(rule.getAlertTemplate(), row, rule);
msg.setDescription(msgdes);
// msg.setEquType(row.get("equ_name") != null ? row.get("equ_name").toString() : null);
String msgdes = fillTemplate(rule.getAlertTemplate(), row, rule);
msg.setBatch(currentBatch);
messages.add(msg);
msgs.add(msgdes);
// 统计每个设备出现的次数
if (equId != null) {
failureCountMap.put(equId, failureCountMap.getOrDefault(equId, 0) + 1);
}
}
if (!messages.isEmpty()) {
alertSender.sendAlert(msgs,rule.getAlertWay(), rule.getAlertStation());
alertSender.sendAlert(msgs, rule.getAlertWay(), rule.getAlertStation());
sendInternalMessages(messages);
}
} catch (Exception e) {
e.printStackTrace();
}
return failureCountMap;
}
private String fillTemplate(String template, Map<String, Object> row, AlertRule rule) {
String msg = template;
Map<String, Object> ruleMap = convertRuleToMap(rule);
@ -131,24 +202,40 @@ public class AlertLaunchServiceImpl implements IAlertLaunchService {
}
private List<Map<String, Object>> handleChangedRule(AlertRule rule) {
// 1. 取出规则对应的条件
List<AlertRuleCondition> conditions = alertRuleConditionMapper.findByRuleId(rule.getId());
if (conditions.isEmpty() || conditions.get(0).getParamName() == null) {
return new ArrayList<>();
}
// 2. 需要比较的字段,如 health、temperature 等
String col = conditions.get(0).getParamName();
String sql = "SELECT g1.* FROM equ_gather g1 " +
"JOIN equ_gather g2 ON g1.equ_id = g2.equ_id " +
"AND g1.gather_time > g2.gather_time " +
"AND NOT EXISTS (" +
" SELECT 1 FROM equ_gather g3 " +
" WHERE g3.equ_id = g1.equ_id " +
" AND g3.gather_time > g2.gather_time " +
" AND g3.gather_time < g1.gather_time" +
") " +
"WHERE (g1.`" + col + "` <> g2.`" + col + "`)";
// 3. SQL:取每台设备最新记录和次新记录,比较该字段是否变化,并关联设备类型
String sql =
"SELECT g1.*, t.name AS equ_type,b.name AS equ_name" +
"FROM equ_gather g1 " +
"JOIN equ_gather g2 ON g1.equ_id = g2.equ_id " +
"JOIN equ_base b ON g1.equ_id = b.id " +
"JOIN equ_type t ON b.equ_type = t.id " +
"WHERE g1.gather_time = ( " +
" SELECT MAX(tg.gather_time) " +
" FROM equ_gather tg " +
" WHERE tg.equ_id = g1.equ_id " +
" ) " +
" AND g2.gather_time = ( " +
" SELECT MAX(t2.gather_time) " +
" FROM equ_gather t2 " +
" WHERE t2.equ_id = g1.equ_id " +
" AND t2.gather_time < ( " +
" SELECT MAX(t3.gather_time) " +
" FROM equ_gather t3 " +
" WHERE t3.equ_id = g1.equ_id " +
" ) " +
" ) " +
" AND g1.`" + col + "` <> g2.`" + col + "`";
// 4. 返回查询结果
return jdbcTemplate.queryForList(sql);
}

@ -3,10 +3,12 @@ package com.alops.system.service.impl;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.alops.system.domain.AlertMessage;
import com.alops.system.domain.dto.AlertDto;
import com.alops.system.domain.dto.AlertStatisticDto;
import com.alops.system.mapper.AlertMessageMapper;
import com.alops.system.service.IAlertMessageService;
@ -44,7 +46,7 @@ public class AlertMessageServiceImpl implements IAlertMessageService
* @return 故障统计
*/
@Override
public List<AlertMessage> selectAlertMessageList(AlertMessage alertMessage)
public List<AlertMessage> selectAlertMessageList(AlertDto alertMessage)
{
return alertMessageMapper.selectAlertMessageList(alertMessage);
}
@ -107,9 +109,20 @@ public class AlertMessageServiceImpl implements IAlertMessageService
* @return 结果
*/
@Override
public int updateAlertMessage(AlertMessage alertMessage)
public AlertMessage updateAlertMessage(AlertMessage alertMessage)
{
return alertMessageMapper.updateAlertMessage(alertMessage);
alertMessage.setHandleTime(new Date());
// 2. 执行更新
int rows = alertMessageMapper.updateAlertMessage(alertMessage);
if (rows == 0) {
// 没有任何行被更新,可根据需要抛出异常或返回 null
return null;
}
// 3. 更新成功后,按主键重新查询最新数据并返回
return alertMessageMapper.selectAlertMessageById(alertMessage.getId());
}
/**

@ -1,11 +1,10 @@
package com.alops.system.service.impl;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import com.alops.common.utils.DateUtils;
import com.alops.common.utils.SecurityUtils;
import com.alops.system.domain.AlertRule;
import com.alops.system.domain.AlertRuleCondition;
import com.alops.system.domain.dto.AlertRuleAddDto;
@ -16,6 +15,7 @@ import com.alops.system.service.IAlertRuleService;
import org.apache.commons.lang3.StringEscapeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 请填写功能名称Service业务层处理
@ -35,11 +35,17 @@ public class AlertRuleServiceImpl implements IAlertRuleService
/**
* 保存预警规则及条件同时生成 SQL
*/
@Override
public AlertRule saveRule(AlertRuleAddDto dto) {
Long userId = SecurityUtils.getLoginUser().getUserId();
AlertRule rule = dto.getAlertRule();
rule.setCreateBy(String.valueOf(userId));
rule.setUpdateBy(String.valueOf(userId));
List<AlertRuleCondition> conditions = dto.getAlertRuleConditionList();
System.out.println(conditions);
// 生成 SQL,先判断是否是 CHANGED
String sql;
if (conditions != null
@ -61,8 +67,65 @@ public class AlertRuleServiceImpl implements IAlertRuleService
alertRuleConditionMapper.insertAlertRuleCondition(c);
}
}
AlertRule fullRule = alertRuleMapper.selectAlertRuleById(rule.getId());
return fullRule;
}
@Override
@Transactional(rollbackFor = Exception.class)
public AlertRule updateRule(AlertRuleAddDto dto) {
// 1. 获取更新后的规则和条件
AlertRule rule = dto.getAlertRule();
Long userId = SecurityUtils.getLoginUser().getUserId();
rule.setUpdateBy(String.valueOf(userId));
List<AlertRuleCondition> conditions = dto.getAlertRuleConditionList();
// 2. 生成 SQL
String sql;
if (conditions != null
&& conditions.size() == 1
&& "CHANGED".equalsIgnoreCase(conditions.get(0).getOperator())) {
sql = "CHANGED";
} else {
sql = buildSql(rule, conditions);
}
rule.setAlertSql(sql);
// 3. 更新规则表
alertRuleMapper.updateAlertRule(rule);
// 4. 先删旧条件,再插入新条件
alertRuleConditionMapper.deleteByAlertRuleId(rule.getId());
if (conditions != null && !conditions.isEmpty()) {
for (AlertRuleCondition c : conditions) {
c.setAlertRuleId(rule.getId());
alertRuleConditionMapper.insertAlertRuleCondition(c);
}
}
AlertRule fullRule = alertRuleMapper.selectAlertRuleById(rule.getId());
return fullRule;
}
@Override
public AlertRuleAddDto selectDetailAlertRuleById(Long id) {
// 1. 查询主表
AlertRule rule = alertRuleMapper.selectAlertRuleById(id);
if (rule == null) {
return null;
}
// 2. 查询子表
List<AlertRuleCondition> conditions =
alertRuleConditionMapper.selectByAlertRuleId(id);
return rule;
// 3. 组装 DTO
AlertRuleAddDto dto = new AlertRuleAddDto();
dto.setAlertRule(rule);
dto.setAlertRuleConditionList(conditions);
return dto;
}
/**
@ -71,31 +134,39 @@ public class AlertRuleServiceImpl implements IAlertRuleService
public String buildSql(AlertRule rule, List<AlertRuleCondition> conditions) {
if (conditions == null || conditions.isEmpty()) return "";
System.out.println(conditions);
conditions.sort(Comparator.comparing(AlertRuleCondition::getOrderNo));
StringBuilder sql = new StringBuilder("SELECT ");
if ("equ_gather".equalsIgnoreCase(rule.getTableName())) {
// equ_gather 表直接拼接条件
sql.append("g.*, b.equ_type FROM equ_gather g ")
// equ_gather 作为主表
sql.append("g.*, t.name AS equ_type ,b.name AS equ_name")
.append("FROM equ_gather g ")
.append("JOIN equ_base b ON g.equ_id = b.id ")
.append("WHERE ");
sql.append(buildConditionsSql(conditions));
.append("JOIN equ_type t ON b.equ_type = t.id ") // ★ 新增关联
.append("JOIN ( ")
.append(" SELECT equ_id, MAX(gather_time) AS latest_time ")
.append(" FROM equ_gather ")
.append(" GROUP BY equ_id ")
.append(") latest ON g.equ_id = latest.equ_id AND g.gather_time = latest.latest_time ")
.append("WHERE ")
.append(buildConditionsSql(conditions));
} else {
// 其他表关联 equ_gather 和 equ_base
sql.append("t.*, g.equ_id, b.equ_type FROM ")
.append(rule.getTableName()).append(" t ")
.append("JOIN equ_gather g ON t.equ_gather_id = g.id ")
// 其他表,需要连 equ_gather → equ_base → equ_type
sql.append("src.*, g.equ_id, t.name AS equ_type,b.name AS equ_name ")
.append("FROM ").append(rule.getTableName()).append(" src ")
.append("JOIN equ_gather g ON src.equ_gather_id = g.id ")
.append("JOIN equ_base b ON g.equ_id = b.id ")
.append("WHERE ");
sql.append(buildConditionsSql(conditions));
.append("JOIN equ_type t ON b.equ_type = t.id ") // ★ 新增关联
.append("WHERE ")
.append(buildConditionsSql(conditions));
}
return sql.toString();
}
/**
* 拼接条件 SQL
*/
@ -293,11 +364,24 @@ public class AlertRuleServiceImpl implements IAlertRuleService
* @return 结果
*/
@Override
public int deleteAlertRuleByIds(Long[] ids)
{
return alertRuleMapper.deleteAlertRuleByIds(ids);
@Transactional(rollbackFor = Exception.class)
public Map<String, Integer> deleteAlertRuleByIds(Long[] ids) {
Map<String, Integer> result = new HashMap<>();
if (ids == null || ids.length == 0) {
result.put("rulesDeleted", 0);
result.put("conditionsDeleted", 0);
return result;
}
int conditionsDeleted = alertRuleConditionMapper.deleteByAlertRuleIds(ids);
int rulesDeleted = alertRuleMapper.deleteAlertRuleByIds(ids);
result.put("rulesDeleted", rulesDeleted);
result.put("conditionsDeleted", conditionsDeleted);
return result;
}
/**
* 删除请填写功能名称信息
*

@ -45,16 +45,20 @@ public class AlertSenderServiceImpl implements IAlertSenderService {
// 将多条消息合并成一条
String combinedMessage = String.join("\n", alertMessages);
System.out.println(alertWay);
//运维人员2
sendInternalMessage(combinedMessage,"2" );
if ("email".equalsIgnoreCase(alertWay)) {
sendEmail(combinedMessage, target);
} else if ("message".equalsIgnoreCase(alertWay)) {
sendInternalMessage(combinedMessage, target);
} else {
throw new IllegalArgumentException("未知预警方式:" + alertWay);
}
}
/**
* 邮件发送
*/
@ -77,7 +81,7 @@ public class AlertSenderServiceImpl implements IAlertSenderService {
/**
* 站内信发送
*/
private void sendInternalMessage(String content, String roleIdStr) {
public void sendInternalMessage(String content, String roleIdStr) {
long roleId = Long.parseLong(roleIdStr);
List<SysUser> users = userMapper.selectByRoleId(roleId);
if (users == null || users.isEmpty()) return;

@ -17,9 +17,9 @@ public class ConvertRawValueServiceImpl implements ConvertRawValueService {
case "veneer_status":
// Fan board → Fault,其它 → Online
if ("Fan board".equalsIgnoreCase(val)) {
return "Fault";
return "0";
} else {
return "Online";
return "1";
}
case "fan_speed_status":

@ -19,8 +19,8 @@ public class DictAlarmParamServiceImpl implements IDictAlarmParamService
{
@Override
public List<DictAlarmParam> getParamsByTableName(String tableName) {
return dictAlarmParamMapper.selectByTableName(tableName);
public List<DictAlarmParam> getParamsByTableName() {
return dictAlarmParamMapper.selectByTableName();
}
@Autowired
private DictAlarmParamMapper dictAlarmParamMapper;

@ -1,13 +1,24 @@
package com.alops.system.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import com.alops.common.utils.SecurityUtils;
import com.alops.system.domain.EquBase;
import com.alops.system.domain.EquSupplier;
import com.alops.system.domain.EquType;
import com.alops.system.domain.dto.EquBaseQueryDto;
import com.alops.system.domain.vo.dropDownVo;
import com.alops.system.domain.vo.imageVo;
import com.alops.system.domain.dto.*;
import com.alops.system.domain.vo.queryEquBaseVO;
import com.alops.system.mapper.EquBaseMapper;
import com.alops.system.mapper.EquInterfaceMapper;
import com.alops.system.mapper.EquManuMapper;
import com.alops.system.mapper.EquSupplierMapper;
import com.alops.system.mapper.EquTypeMapper;
import com.alops.system.service.IEquBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -17,13 +28,32 @@ import org.springframework.util.StringUtils;
* 设备基本信息Service业务层处理
*
* @author ruoyi
* @date 2025-08-01
* @date 2025-09-19
*/
@Service
public class EquBaseServiceImpl implements IEquBaseService
{
@Autowired
private EquBaseMapper equBaseMapper;
@Autowired
private EquTypeMapper equTypeMapper;
@Autowired
private EquManuMapper equManuMapper;
@Autowired
private EquSupplierMapper equSupplierMapper;
@Override
public List<dropDownVo> selectEquType(){
return equTypeMapper.selectEquTypeDropDown();
}
@Override
public List<dropDownVo>selectEquManu(){
return equManuMapper.selectEquManuDropDown();
}
@Override
public List<dropDownVo> selectEquSupp(){
return equSupplierMapper.selectEquSupDropDown();
}
@Autowired
private EquInterfaceMapper interfaceMapper;
@ -34,11 +64,19 @@ public class EquBaseServiceImpl implements IEquBaseService
* @return 设备基本信息
*/
@Override
public EquBase selectEquBaseById(String id)
public queryEquBaseVO selectEquBaseById(String id)
{
return equBaseMapper.selectEquBaseById(id);
}
@Override
public imageVo selectEquBaseImageById(String id){
if (id instanceof String) {
System.out.println("这是一个字符串");
}
return equBaseMapper.selectEquBaseImageById(id);
}
@ -83,13 +121,13 @@ public class EquBaseServiceImpl implements IEquBaseService
/**
* 查询设备基本信息列表
*
* @param equBaseQueryDto 设备基本信息
* @param equBase 设备基本信息
* @return 设备基本信息
*/
@Override
public List<queryEquBaseVO> selectEquBaseList(EquBaseQueryDto equBaseQueryDto)
public List<queryEquBaseVO> selectEquBaseList(EquBaseQueryDto equBase)
{
return equBaseMapper.selectEquBaseList(equBaseQueryDto);
return equBaseMapper.selectEquBaseList(equBase);
}
/**
@ -119,6 +157,10 @@ public class EquBaseServiceImpl implements IEquBaseService
@Override
public int insertEquBase(EquBase equBase)
{
if (equBase.getCreateDate() == null) {
equBase.setCreateDate(new Date());
}
equBase.setCreateBy(SecurityUtils.getLoginUser().getUserId());
return equBaseMapper.insertEquBase(equBase);
}

@ -1,13 +1,20 @@
package com.alops.system.service.impl;
import java.util.Date;
import java.util.List;
import com.alops.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alops.system.mapper.EquSupplierMapper;
import com.alops.system.domain.EquSupplier;
import com.alops.system.mapper.EquSupplierMapper;
import com.alops.system.service.IEquSupplierService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 请填写功能名称Service业务层处理
*
@ -15,7 +22,7 @@ import com.alops.system.service.IEquSupplierService;
* @date 2025-09-20
*/
@Service
public class EquSupplierServiceImpl implements IEquSupplierService
public class EquSupplierServiceImpl implements IEquSupplierService
{
@Autowired
private EquSupplierMapper equSupplierMapper;
@ -53,7 +60,7 @@ public class EquSupplierServiceImpl implements IEquSupplierService
@Override
public int insertEquSupplier(EquSupplier equSupplier)
{
equSupplier.setCreateTime(DateUtils.getNowDate());
equSupplier.setCreateTime(new Date());
return equSupplierMapper.insertEquSupplier(equSupplier);
}

@ -19,6 +19,7 @@ import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
//建造实体类的工具
@ -111,6 +112,7 @@ public class MemoryToolServiceImpl implements MemoryToolService {
* @param allEntities 待插入的实体列表
* @return 状态码Code.SUCCESS 成功Code.FAIL 失败
*/
@Transactional(rollbackFor = Exception.class)
public int persistAll(List<GatherEntities> allEntities) {
// 1. 空检查
if (allEntities == null || allEntities.isEmpty()) {

@ -0,0 +1,105 @@
package com.alops.system.service.impl;
import com.alops.system.domain.ScheduleRules;
import com.alops.system.job.GatherJob;
import com.alops.system.service.IQuartzService;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.quartz.Trigger; // ✅ Quartz 的 Trigger
import org.quartz.TriggerBuilder;
import org.quartz.Scheduler;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class QuartzService implements IQuartzService {
@Autowired
private Scheduler scheduler;
@Override
public void createOrUpdateJob(ScheduleRules rule) {
try {
String jobName = "job_" + rule.getId();
String groupName = "gather_rules";
JobDetail jobDetail = JobBuilder.newJob(GatherJob.class)
.withIdentity(jobName, groupName)
.usingJobData("ruleId", rule.getId())
.build();
TriggerBuilder<Trigger> triggerBuilder = TriggerBuilder.newTrigger()
.withIdentity("trigger_" + rule.getId(), groupName);
if (rule.getRuleType() == 1 && rule.getGatherTime() != null) {
triggerBuilder.startAt(Date.from(rule.getGatherTime()
.toInstant()));
} else if (rule.getRuleType() == 0 && rule.getFrequency() != null) {
if (rule.getStartTime() != null) {
triggerBuilder.startAt(rule.getStartTime());
}
if (rule.getEndTime() != null) {
triggerBuilder.endAt(rule.getEndTime());
}
// 替换这里:不再使用 Cron,而是使用 SimpleSchedule
triggerBuilder.withSchedule(
SimpleScheduleBuilder.simpleSchedule()
.withIntervalInMinutes(rule.getFrequency()) // 每 rule.getFrequency() 分钟
.repeatForever() // 一直重复,直到 endTime
);
}
Trigger trigger = triggerBuilder.build();
if (scheduler.checkExists(jobDetail.getKey())) {
scheduler.deleteJob(jobDetail.getKey());
}
scheduler.scheduleJob(jobDetail, trigger);
if (!scheduler.isStarted()) {
scheduler.start();
}
} catch (SchedulerException e) {
e.printStackTrace();
}
}
// /**
// * 将分钟频率转换为 Quartz Cron 表达式
// * 支持 frequency >= 1
// * 最大间隔是23小时59分钟 !!!!!!!!!!!!!!1
// */
// private String convertFrequencyToCron(Integer frequency) {
// if (frequency == null || frequency <= 0) {
// throw new IllegalArgumentException("frequency 必须是大于 0 的分钟数");
// }
//
// // 计算小时和分钟
// int hours = frequency / 60; // 每隔多少小时
// int minutes = frequency % 60; // 余下多少分钟
//
// if (hours > 0 && minutes == 0) {
// // 整小时倍数
// return String.format("0 0 0/%d * * ?", hours);
// } else if (hours > 0) {
// // 既有小时又有分钟,折中为:每 hours 小时的第 minutes 分
// return String.format("0 %d 0/%d * * ?", minutes, hours);
// } else {
// // 纯分钟且小于 60
// return String.format("0 0/%d * * * ?", minutes);
// }
// }
@Override
public void deleteJob(Long ruleId) throws SchedulerException {
String jobName = "job_" + ruleId;
String groupName = "gather_rules";
JobKey key = JobKey.jobKey(jobName, groupName);
if (scheduler.checkExists(key)) {
scheduler.deleteJob(key);
}
}
}

@ -3,6 +3,7 @@ package com.alops.system.service.impl;
import java.math.BigDecimal;
import java.sql.SQLOutput;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
@ -11,15 +12,15 @@ import java.util.concurrent.Future;
import java.util.stream.Collectors;
import com.alops.common.core.domain.AjaxResult;
import com.alops.common.utils.SecurityUtils;
import com.alops.system.domain.*;
import com.alops.system.domain.vo.Code;
import com.alops.system.domain.vo.EquGatherResult;
import com.alops.system.domain.vo.GatherEntities;
import com.alops.system.mapper.*;
import com.alops.system.service.IScheduleRulesService;
import com.alops.system.service.MemoryToolService;
import com.alops.system.service.SnmpService;
import com.alops.system.service.*;
import org.apache.poi.ss.formula.functions.Now;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -48,12 +49,99 @@ public class ScheduleRulesServiceImpl implements IScheduleRulesService {
private SnmpService snmpService;
@Autowired
private EquGatherMapper equGatherMapper;
@Autowired
private IAlertLaunchService iAlertLaunchService;
@Autowired
private IQuartzService quartzService;
@Autowired
private MemoryToolService memoryToolService;
private static final Logger log = LoggerFactory.getLogger(ScheduleRulesServiceImpl.class);
@Override
public AjaxResult executeRule(ScheduleRules newRule) throws SchedulerException, ExecutionException, InterruptedException {
// 1. 获取所有正在执行(1)和待执行(0)的规则
List<ScheduleRules> runningOrWaiting = scheduleRulesMapper.selectList();
if (runningOrWaiting!=null) {
for (ScheduleRules rule : runningOrWaiting) {
switch (rule.getStatus()) {
case 1: // 正在执行
log.info("规则[{}]:正在执行上一个任务,等待上一个任务完成……", rule.getId());
waitTaskFinish(rule.getId());
log.info("规则[{}]:完成上一个任务任务,开始新的任务…", rule.getId());
if (rule.getRuleType() == 2 || rule.getRuleType() == 1) {
rule.setStatus(2);
} else if (rule.getRuleType() == 0) {
rule.setStatus(4);
}
scheduleRulesMapper.updateScheduleRules(rule);
break;
case 0: // 待执行
if (rule.getRuleType() == 0 || rule.getRuleType() == 1) {
quartzService.deleteJob(rule.getId());
}
rule.setStatus(4);
scheduleRulesMapper.updateScheduleRules(rule);
break;
default:
break;
}
}
}
// 2. 执行新规则
//首先存入规则在执行
Date now = new Date();
Long userId = SecurityUtils.getLoginUser().getUserId();
newRule.setCreatedBy(userId);
newRule.setCreatedAt(now);
newRule.setStatus(0);
scheduleRulesMapper.insertScheduleRules(newRule);
switch (newRule.getRuleType().toString()) {
case "2": // 立即执行
newRule.setStatus(1);
scheduleRulesMapper.updateScheduleRules(newRule);
try {
executeImmediately();
newRule.setStatus(2);
scheduleRulesMapper.updateScheduleRules(newRule);
return AjaxResult.success("立即执行任务成功:"); // 异常会抛出,前端收到
} catch (Exception e) {
newRule.setStatus(3);
scheduleRulesMapper.updateScheduleRules(newRule);
// 只捕获立即执行异常
return AjaxResult.error("立即执行任务失败:" + e.getMessage());
}
case "1": // 固定时间
newRule.setStatus(0);
scheduleRulesMapper.updateScheduleRules(newRule);
quartzService.createOrUpdateJob(newRule);
break;
case "0": // 按频率
if (newRule.getStartTime() != null && !now.before(newRule.getStartTime())) {
newRule.setStatus(1);
scheduleRulesMapper.updateScheduleRules(newRule);
quartzService.createOrUpdateJob(newRule);
} else {
newRule.setStatus(0);
scheduleRulesMapper.updateScheduleRules(newRule);
quartzService.createOrUpdateJob(newRule);
}
break;
default:
throw new IllegalArgumentException("Unsupported rule type");
}
return null;
}
/**
* 删除所有设备相关表数据保证事务一致性
*/
@ -64,24 +152,18 @@ public class ScheduleRulesServiceImpl implements IScheduleRulesService {
equBaseMapper.deleteEquVeneer();
equBaseMapper.deleteEquVlan();
}
@Override
//往上抛异常
@Override
public int executeImmediately() throws ExecutionException, InterruptedException {
//删除之前的信息
deleteAllEquipmentData();
// 删除之前的信息
deleteAllEquipmentData();
// 1.收集设备信息
List<EquBase> devices = equBaseMapper.findEquBaseList();
if (devices.isEmpty()) {
return Code.FAIL;
}
if (devices.isEmpty()) return Code.FAIL;
// 2.根据厂商ip收集 OID
Map<String, List<EquOid>> oidMap = new HashMap<>();
for (EquBase dev : devices) {
String key = dev.getManufacture();
List<EquOid> oids = equOidMapper.findByManuIdAndStatus(key);
oidMap.put(key, oids);
oidMap.put(dev.getManufacture(), equOidMapper.findByManuIdAndStatus(dev.getManufacture()));
}
ExecutorService executor = Executors.newFixedThreadPool(10);
@ -89,56 +171,175 @@ public class ScheduleRulesServiceImpl implements IScheduleRulesService {
for (EquBase device : devices) {
futures.add(executor.submit(() -> {
try {
long start = System.currentTimeMillis();
List<EquOid> oids = oidMap.getOrDefault(device.getManufacture(), Collections.emptyList());
Map<String, Object> snmpResults = snmpService.query(device.getIp(), oids);
long afterSnmp = System.currentTimeMillis();
System.out.println("SNMP查询耗时: " + (afterSnmp - start) + " ms");
GatherEntities entities = memoryToolService.buildAndInsertEntity(device, snmpResults);
long afterBuild = System.currentTimeMillis();
System.out.println("buildAndInsertEntity构建实体类耗时: " + (afterBuild - afterSnmp) + " ms");
if (entities != null && entities.getEquGather() != null) {
Double temperature = parseDouble(snmpResults.get("temperature")); // 温度
Double cpuUsage = parseDouble(snmpResults.get("cpu_utilization"));
Double memUsage = parseDouble(snmpResults.get("memory_utilization"));
double tempHealth = calculateTemperatureHealth(temperature);
double humidityHealth = 1;
double cpuHealth = calculateCpuHealth(cpuUsage);
double memHealth = calculateMemoryHealth(memUsage);
double totalHealth = Math.max(
Math.max(tempHealth, humidityHealth),
Math.max(cpuHealth, memHealth)
);
entities.getEquGather().setHealth(BigDecimal.valueOf(totalHealth));
return entities;
}
return null;
} catch (Exception e) {
e.printStackTrace();
log.error("设备采集失败,设备ID: {}, IP: {}, 原因: {}", device.getId(), device.getIp(), e.getMessage(), e);
return null;
long start = System.currentTimeMillis();
List<EquOid> oids = oidMap.getOrDefault(device.getManufacture(), Collections.emptyList());
Map<String, Object> snmpResults = snmpService.query(device.getIp(), oids);
long afterSnmp = System.currentTimeMillis();
System.out.println("SNMP查询耗时: " + (afterSnmp - start) + " ms");
GatherEntities entities = memoryToolService.buildAndInsertEntity(device, snmpResults);
long afterBuild = System.currentTimeMillis();
System.out.println("buildAndInsertEntity耗时: " + (afterBuild - afterSnmp) + " ms");
if (entities != null && entities.getEquGather() != null) {
Double temperature = parseDouble(snmpResults.get("temperature"));
Double cpuUsage = parseDouble(snmpResults.get("cpu_utilization"));
Double memUsage = parseDouble(snmpResults.get("memory_utilization"));
double tempHealth = calculateTemperatureHealth(temperature);
double cpuHealth = calculateCpuHealth(cpuUsage);
double memHealth = calculateMemoryHealth(memUsage);
double totalHealth = Math.max(Math.max(tempHealth, 1), Math.max(cpuHealth, memHealth));
entities.getEquGather().setHealth(BigDecimal.valueOf(totalHealth));
return entities;
}
return null;
}));
}
List<GatherEntities> allEntities = new ArrayList<>();
try {
for (Future<GatherEntities> f : futures) {
GatherEntities g = f.get(); // 阻塞等待线程完成,如果线程异常会抛ExecutionException
if (g == null) throw new RuntimeException("设备采集返回 null,可能采集失败");
allEntities.add(g);
}
} catch (ExecutionException | InterruptedException e) {
e.printStackTrace();
executor.shutdownNow(); // 出异常直接中断剩余线程
throw e; // 抛给调用方 Job 捕获
} finally {
executor.shutdown();
}
return persistAndUpdate(allEntities);
}
/**
* 批量落库更新采集次数执行最新预警
* 事务保证如果任何步骤失败整个操作回滚
*/
@Transactional(rollbackFor = Exception.class)
public int persistAndUpdate(List<GatherEntities> allEntities) throws ExecutionException, InterruptedException {
if (allEntities == null || allEntities.isEmpty()) {
return 0;
}
List<GatherEntities> allEntities = new ArrayList<>();
for (Future<GatherEntities> f : futures) {
GatherEntities g = f.get();
if (g != null) allEntities.add(g);
// 批量落库
long persistStart = System.currentTimeMillis();
int result = memoryToolService.persistAll(allEntities);
long persistEnd = System.currentTimeMillis();
System.out.println("批量落库耗时: " + (persistEnd - persistStart) + " ms");
// 更新采集次数
Set<String> idSet = allEntities.stream()
.filter(g -> g.getEquGather() != null)
.map(g -> g.getEquGather().getEquId())
.filter(Objects::nonNull)
.collect(Collectors.toSet());
if (!idSet.isEmpty()) {
equBaseMapper.incrementCollectCount(new ArrayList<>(idSet));
}
long persistStart = System.currentTimeMillis();
// 统一批量落库
int result=memoryToolService.persistAll(allEntities);
long persistEnd = System.currentTimeMillis();
System.out.println("批量落库耗时: " + (persistEnd - persistStart) + " ms");
// 执行最新预警
iAlertLaunchService.executeImmediateAlerts();
return result;
}
// @Override
// public int executeImmediately() throws ExecutionException, InterruptedException {
// //删除之前的信息
// deleteAllEquipmentData();
//
// // 1.收集设备信息
// List<EquBase> devices = equBaseMapper.findEquBaseList();
// if (devices.isEmpty()) {
// return Code.FAIL;
// }
//
// // 2.根据厂商ip收集 OID
// Map<String, List<EquOid>> oidMap = new HashMap<>();
// for (EquBase dev : devices) {
// String key = dev.getManufacture();
// List<EquOid> oids = equOidMapper.findByManuIdAndStatus(key);
// oidMap.put(key, oids);
// }
//
// ExecutorService executor = Executors.newFixedThreadPool(10);
// List<Future<GatherEntities>> futures = new ArrayList<>();
//
// for (EquBase device : devices) {
// futures.add(executor.submit(() -> {
// try {
// long start = System.currentTimeMillis();
// List<EquOid> oids = oidMap.getOrDefault(device.getManufacture(), Collections.emptyList());
// Map<String, Object> snmpResults = snmpService.query(device.getIp(), oids);
// long afterSnmp = System.currentTimeMillis();
// System.out.println("SNMP查询耗时: " + (afterSnmp - start) + " ms");
//
// GatherEntities entities = memoryToolService.buildAndInsertEntity(device, snmpResults);
// long afterBuild = System.currentTimeMillis();
// System.out.println("buildAndInsertEntity构建实体类耗时: " + (afterBuild - afterSnmp) + " ms");
// if (entities != null && entities.getEquGather() != null) {
// Double temperature = parseDouble(snmpResults.get("temperature")); // 温度
// Double cpuUsage = parseDouble(snmpResults.get("cpu_utilization"));
// Double memUsage = parseDouble(snmpResults.get("memory_utilization"));
// double tempHealth = calculateTemperatureHealth(temperature);
// double humidityHealth = 1;
// double cpuHealth = calculateCpuHealth(cpuUsage);
// double memHealth = calculateMemoryHealth(memUsage);
//
// double totalHealth = Math.max(
// Math.max(tempHealth, humidityHealth),
// Math.max(cpuHealth, memHealth)
// );
// entities.getEquGather().setHealth(BigDecimal.valueOf(totalHealth));
// return entities;
// }
// return null;
// } catch (Exception e) {
// e.printStackTrace();
// log.error("设备采集失败,设备ID: {}, IP: {}, 原因: {}", device.getId(), device.getIp(), e.getMessage(), e);
// return null;
// }
// }));
// }
//
// List<GatherEntities> allEntities = new ArrayList<>();
// for (Future<GatherEntities> f : futures) {
// GatherEntities g = f.get();
// if (g != null) allEntities.add(g);
// }
// long persistStart = System.currentTimeMillis();
// // 统一批量落库
// int result=memoryToolService.persistAll(allEntities);
// long persistEnd = System.currentTimeMillis();
// System.out.println("批量落库耗时: " + (persistEnd - persistStart) + " ms");
// //更新采集次数
// Set<String> idSet = new HashSet<>();
// for (GatherEntities g : allEntities) {
// if (g != null && g.getEquGather() != null) {
// String id = g.getEquGather().getEquId();
// if (id != null) {
// idSet.add(id);
// }
// }
// }
// List<String> successIds = new ArrayList<>(idSet);
// if (!successIds.isEmpty()) {
// equBaseMapper.incrementCollectCount(successIds);
// }
// //执行最新预警
// try {
// iAlertLaunchService.executeImmediateAlerts(); // 调用 Service 执行
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// return result;
//
// }
// 健康度计算函数示例
private int calculateTemperatureHealth(Double temp) {
if (temp == null) return 4; // 无数据视为需维护
@ -173,19 +374,51 @@ public class ScheduleRulesServiceImpl implements IScheduleRulesService {
}
}
/**
* 阻塞等待某个任务执行完成
*
* @param ruleId 规则ID
* @param timeoutMillis 超时时间毫秒避免无限等待
*/
public void waitTaskFinish(Long ruleId, long timeoutMillis) {
long start = System.currentTimeMillis();
while (true) {
ScheduleRules rule = scheduleRulesMapper.selectScheduleRulesById(ruleId);
// 不是执行中(1)就结束等待
if (rule == null || rule.getStatus() != 1) {
break;
}
// 超时则退出
if (System.currentTimeMillis() - start > timeoutMillis) {
throw new RuntimeException("等待任务执行超时, ruleId=" + ruleId);
}
try {
Thread.sleep(2000); // 每2秒查询一次
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("等待任务执行被中断", e);
}
}
}
/**
* 不带超时时间的简化版默认10分钟//这个等最后设备出来是什么样子再说吧
*/
public void waitTaskFinish(Long ruleId) {
waitTaskFinish(ruleId, 10 * 60 * 1000);
}
/**
* 查询定时采集规则
*
* @param id 定时采集规则主键
* @return 定时采集规则
*/
@Override
public ScheduleRules selectScheduleRulesById (Long id)
public ScheduleRules selectScheduleRuleByMaxTime ()
{
return scheduleRulesMapper.selectScheduleRulesById(id);
return scheduleRulesMapper. selectScheduleRulesByMaxTime();
}
/**

@ -114,13 +114,13 @@ private ConvertRawValueService convertRawValueService;
continue;
}
// 普通字段 convertRawValueService.convertValue(oid.getConvertRule(), val)
// 普通字段 convertRawValueService.convertValue(oid.getConvertRule(), val)
Map<String, String> entry = mergedMap.getOrDefault(index, new HashMap<>());
if (keys2.length > 0) {
entry.put(keys2[0], index);
paramDynamicKeyMap.put(oid.getParam(), keys2[0]);}
if (keys2.length > 1) entry.put(keys2[1], val);
if (keys2.length > 1) entry.put(keys2[1],convertRawValueService.convertValue(oid.getConvertRule(), val) );
mergedMap.put(index, entry);
}
}

@ -5,6 +5,8 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.alops.system.domain.vo.RolePickerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -49,13 +51,17 @@ public class SysRoleServiceImpl implements ISysRoleService
* @param role 角色信息
* @return 角色数据集合信息
*/
@Override
public List<SysRole> selectRoleList(SysRole role)
{
return roleMapper.selectRoleList(role);
}
@Override
public List<RolePickerVo> selectAllRolesSimple() {
return roleMapper.selectAllRolesSimple();
}
/**
* 根据用户ID查询角色
*

@ -7,38 +7,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="AlertMessage" id="AlertMessageResult">
<result property="id" column="id" />
<result property="equId" column="equ_id" />
<result property="description" column="description" />
<result property="type" column="type" />
<result property="equType" column="equ_type" />
<result property="cause" column="cause" />
<result property="solution" column="solution" />
<result property="level" column="level" />
<result property="occurTime" column="occur_time" />
<result property="reporter" column="reporter" />
<result property="handler" column="handler" />
<result property="handleTime" column="handle_time" />
<result property="status" column="status" />
<result property="batch" column="batch" />
</resultMap>
</resultMap>
<select id="selectMaxBatch" resultType="integer">
SELECT COALESCE(MAX(batch), 0)
FROM alert_message
</select>
<insert id="batchInsert" parameterType="java.util.List">
INSERT INTO alert_message
(equ_id, description, type, equ_type, cause, solution, level, occur_time, reporter, handler, handle_time, status, batch)
(equ_id, type, equ_type, solution, level, occur_time, handler, handle_time, status,batch)
VALUES
<foreach collection="list" item="msg" separator=",">
(#{msg.equId}, #{msg.description}, #{msg.type}, #{msg.equType},
#{msg.cause}, #{msg.solution}, #{msg.level}, #{msg.occurTime},
#{msg.reporter}, #{msg.handler}, #{msg.handleTime}, #{msg.status},#{msg.batch}))
(#{msg.equId},#{msg.type}, #{msg.equType},
#{msg.solution}, #{msg.level}, #{msg.occurTime},
#{msg.handler}, #{msg.handleTime}, #{msg.status}, #{msg.batch})
</foreach>
</insert>
<sql id="selectAlertMessageVo">
SELECT am.id,
am.equ_id,
am.type,
am.equ_type,
am.solution,
am.level,
am.occur_time,
am.handler,
am.handle_time,
am.status,
am.batch
FROM alert_message am
LEFT JOIN equ_base eb ON am.equ_id = eb.id
select id, equ_id, type, equ_type, solution, level, occur_time, handler, handle_time, status,batch from alert_message
</sql>
@ -46,28 +62,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select a.id, g.equ_id, type, equ_type solution, level, occur_time, handler, handle_time, status,batch from alert_message a LEFT JOIN equ_gather g ON a.equ_id = g.equ_id
</sql>
<select id="selectAlertMessageList" parameterType="AlertMessage" resultMap="AlertMessageResult">
<select id="selectAlertMessageList" parameterType="AlertDto" resultMap="AlertMessageResult">
<include refid="selectAlertMessageVo"/>
<where>
<if test="equId != null and equId != ''"> and equ_id = #{equId}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="type != null "> and type = #{type}</if>
<if test="equType != null and equType != ''"> and equ_type = #{equType}</if>
<if test="cause != null and cause != ''"> and cause = #{cause}</if>
<if test="solution != null and solution != ''"> and solution = #{solution}</if>
<if test="level != null "> and level = #{level}</if>
<if test="occurTime != null "> and occur_time = #{occurTime}</if>
<if test="reporter != null "> and reporter = #{reporter}</if>
<if test="handler != null "> and handler = #{handler}</if>
<if test="handleTime != null "> and handle_time = #{handleTime}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="batch != null and batch != ''"> and batch = #{batch}</if>
<where>
<!-- 时间范围 -->
<if test="minTime != null"> AND am.occur_time &gt;= #{minTime} </if>
<if test="maxTime != null"> AND am.occur_time &lt;= #{maxTime} </if>
<!-- 预警等级 -->
<if test="level != null"> AND am.level = #{level} </if>
<!-- 预警状态 -->
<if test="status != null and status != ''"> AND am.status = #{status} </if>
<!-- 位置模糊匹配 -->
<if test="location != null and location != ''"> AND eb.location LIKE CONCAT('%', #{location}, '%') </if>
<!-- 设备管理员精确匹配 -->
<if test="inCharge != null and inCharge != ''"> AND eb.in_charge = #{inCharge} </if>
</where>
<!-- 按 batch 从大到小排序 -->
ORDER BY am.batch DESC
</select>
<select id="selectAlertMessageById" parameterType="Long" resultMap="AlertMessageResult">
<include refid="selectAlertMessageVo"/>
where id = #{id}
where am.id = #{id}
</select>
<select id="selectAlertMessageByEquId" parameterType="Long" resultMap="AlertMessageResult">
@ -114,14 +134,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into alert_message
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="equId != null and equId != ''">equ_id,</if>
<if test="description != null and description != ''">description,</if>
<if test="type != null">type,</if>
<if test="equType != null">equ_type,</if>
<if test="cause != null">cause,</if>
<if test="solution != null">solution,</if>
<if test="level != null">level,</if>
<if test="occurTime != null">occur_time,</if>
<if test="reporter != null">reporter,</if>
<if test="handler != null">handler,</if>
<if test="handleTime != null">handle_time,</if>
<if test="status != null">status,</if>
@ -129,14 +149,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="equId != null and equId != ''">#{equId},</if>
<if test="description != null and description != ''">#{description},</if>
<if test="type != null">#{type},</if>
<if test="equType != null">#{equType},</if>
<if test="cause != null">#{cause},</if>
<if test="solution != null">#{solution},</if>
<if test="level != null">#{level},</if>
<if test="occurTime != null">#{occurTime},</if>
<if test="reporter != null">#{reporter},</if>
<if test="handler != null">#{handler},</if>
<if test="handleTime != null">#{handleTime},</if>
<if test="status != null">#{status},</if>
@ -147,27 +167,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateAlertMessage" parameterType="AlertMessage">
update alert_message
<trim prefix="SET" suffixOverrides=",">
<if test="equId != null and equId != ''">equ_id = #{equId},</if>
<if test="description != null and description != ''">description = #{description},</if>
<if test="type != null">type = #{type},</if>
<if test="equType != null">equ_type = #{equType},</if>
<if test="cause != null">cause = #{cause},</if>
<if test="solution != null">solution = #{solution},</if>
<if test="level != null">level = #{level},</if>
<if test="occurTime != null">occur_time = #{occurTime},</if>
<if test="reporter != null">reporter = #{reporter},</if>
<if test="handler != null">handler = #{handler},</if>
<if test="handleTime != null">handle_time = #{handleTime},</if>
<if test="status != null">status = #{status},</if>
status = "HANDLED"
</trim>
where id = #{id}
where alert_message.id = #{id}
</update>
<delete id="deleteAlertMessageById" parameterType="Long">
delete from alert_message where id = #{id}
</delete>
<delete id="deleteAlertMessageByIds" parameterType="String">
<delete id="deleteAlertMessageByIds" parameterType="Long">
delete from alert_message where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}

@ -15,6 +15,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="valueType" column="value_type" />
</resultMap>
<delete id="deleteByAlertRuleIds" parameterType="long[]">
DELETE FROM alert_rule_condition
WHERE alert_rule_id IN
<foreach item="id" index="index" collection="array"
open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectByAlertRuleId" resultMap="AlertRuleConditionResult" parameterType="long">
SELECT *
FROM alert_rule_condition
WHERE alert_rule_id = #{ruleId}
ORDER BY order_no
</select>
<!-- 删除指定规则的全部条件 -->
<delete id="deleteByAlertRuleId" parameterType="long">
DELETE FROM alert_rule_condition
WHERE alert_rule_id = #{alertRuleId}
</delete>
<select id="findByRuleId" resultMap="AlertRuleConditionResult">
SELECT *
FROM alert_rule_condition

@ -22,34 +22,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="type" column="type" />
</resultMap>
<!-- 根据 id 列表查询 AlertRule -->
<select id="selectByIds" resultMap="AlertRuleResult" parameterType="java.util.List">
<select id="selectAlertRule" resultMap="AlertRuleResult" parameterType="java.util.List">
SELECT *
FROM alert_rule
WHERE id IN
<foreach collection="list" item="id" open="(" separator="," close=")">
#{id}
</foreach>
where enable=1
</select>
<sql id="selectAlertRuleVo">
select id, rule_name, severity, alert_way, alert_station, description, enable, create_time, update_time, create_by, update_by, table_name, alert_sql, alert_template, type from alert_rule
SELECT
ar.id,
ar.rule_name,
ar.severity,
ar.alert_way,
ar.alert_station,
ar.description,
ar.enable,
ar.create_time,
ar.update_time,
su1.user_name AS create_by,
su2.user_name AS update_by,
ar.table_name,
ar.alert_sql,
ar.alert_template,
ar.type
FROM alert_rule ar
LEFT JOIN sys_user su1 ON ar.create_by = su1.user_id
LEFT JOIN sys_user su2 ON ar.update_by = su2.user_id
</sql>
<select id="selectAlertRuleList" parameterType="AlertRule" resultMap="AlertRuleResult">
<include refid="selectAlertRuleVo"/>
<where>
<if test="ruleName != null and ruleName != ''"> and rule_name like concat('%', #{ruleName}, '%')</if>
<if test="severity != null "> and severity = #{severity}</if>
<if test="alertWay != null and alertWay != ''"> and alert_way = #{alertWay}</if>
<if test="alertStation != null and alertStation != ''"> and alert_station = #{alertStation}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="enable != null "> and enable = #{enable}</if>
<if test="tableName != null and tableName != ''"> and table_name like concat('%', #{tableName}, '%')</if>
<if test="alertSql != null and alertSql != ''"> and alert_sql = #{alertSql}</if>
<if test="alertTemplate != null and alertTemplate != ''"> and alert_template = #{alertTemplate}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<where>
<if test="ruleName != null and ruleName != ''"> and ar.rule_name like concat('%', #{ruleName}, '%')</if>
<if test="severity != null "> and ar.severity = #{severity}</if>
<if test="enable != null "> and ar.enable = #{enable}</if>
<if test="type != null and type != ''"> and ar.type = #{type}</if>
</where>
</select>
<select id="selectAlertRuleById" parameterType="Long" resultMap="AlertRuleResult">
<include refid="selectAlertRuleVo"/>
where id = #{id}
@ -98,7 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateAlertRule" parameterType="AlertRule">
update alert_rule
UPDATE alert_rule
<trim prefix="SET" suffixOverrides=",">
<if test="ruleName != null">rule_name = #{ruleName},</if>
<if test="severity != null">severity = #{severity},</if>
@ -106,18 +121,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="alertStation != null">alert_station = #{alertStation},</if>
<if test="description != null">description = #{description},</if>
<if test="enable != null">enable = #{enable},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<!-- create_time 不更新 -->
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="tableName != null">table_name = #{tableName},</if>
<if test="alertSql != null">alert_sql = #{alertSql},</if>
<if test="alertTemplate != null">alert_template = #{alertTemplate},</if>
<if test="type != null">type = #{type},</if>
create_time=create_time,
<!-- update_time:如果前端传了值用前端的,否则自动 NOW() -->
<choose>
<when test="updateTime != null">update_time = #{updateTime},</when>
<otherwise>update_time = NOW(),</otherwise>
</choose>
</trim>
where id = #{id}
WHERE id = #{id}
</update>
<delete id="deleteAlertRuleById" parameterType="Long">
delete from alert_rule where id = #{id}
</delete>

@ -16,7 +16,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectByTableName" resultMap="DictAlarmParamResult">
SELECT id, param_name, table_name, column_name, param_type
FROM dict_alarm_param
WHERE table_name = #{tableName}
</select>
<sql id="selectDictAlarmParamVo">
select id, param_name, table_name, column_name, param_type from dict_alarm_param

@ -13,17 +13,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="location" column="location" />
<result property="equType" column="equ_type" />
<result property="inCharge" column="in_charge" />
<result property="releaseDate" column="release_date" />
<result property="installDate" column="install_date" />
<result property="lifeCycle" column="life_cycle" />
<result property="serviceTime" column="service_time" />
<result property="warranty" column="warranty" />
<result property="createBy" column="create_by" />
<result property="createDate" column="create_date" />
<result property="updateBy" column="update_by" />
<result property="updateDate" column="update_date" />
<result property="status" column="status" />
<result property="failureFrequency" column="failure_frequency" />
<result property="deviceLevel" column="device_level" />
<result property="supplierId" column="supplier_id" />
<result property="gatherFrequency" column="gather_frequency" />
<result property="equImage" column="equ_image" />
<result property="repairFrequency" column="repair_frequency" />
<result property="repairCost" column="repair_cost" />
@ -91,68 +91,81 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectEquBaseVo">
select id, name, version, ip, manufacture, location, equ_type, in_charge, release_date, install_date, life_cycle, service_time, warranty, create_by, create_date, update_by, update_date, status, failure_frequency, repair_frequency, repair_cost from equ_base
select id, name, version, ip, manufacture, location, equ_type, in_charge, install_date, life_cycle, warranty, create_by, create_date, status, device_level, supplier_id from equ_base
</sql>
<update id="incrementCollectCount">
UPDATE equ_base
SET gather_frequency = gather_frequency + 1
WHERE id IN
<foreach collection="list" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="findEquBaseList" resultMap="EquBaseResult">
<include refid="selectEquBaseVo"/>
<where>
status = 1
</where>
</select>
<!-- 查询列 -->
<sql id="selectEquBaseVo2">
b.id AS id,
b.name AS name,
b.version AS version,
b.ip AS ip,
m.name AS manuName,
s.name AS supplierName,
b.location AS location,
t.name AS equType,
b.in_charge AS inCharge,
b.install_date AS installDate,
b.life_cycle AS lifeCycle,
b.warranty AS warranty,
su.user_name AS createBy,
b.create_date AS createDate,
b.status AS status,
b.device_level AS deviceLevel,
g.health AS health
</sql>
<select id="selectEquBaseList" parameterType="EquBaseQueryDto" resultType="com.alops.system.domain.vo.queryEquBaseVO">
<select id="selectEquBaseList" parameterType="equBaseQueryDto" resultType="com.alops.system.domain.vo.queryEquBaseVO">
SELECT
b.id,
b.name,
b.version,
b.ip,
m.id as manuId,
m.name as manuName,
b.location,
b.equ_type,
t.name AS equTypeName,
b.in_charge,
#b.release_date,
b.install_date,
b.life_cycle,
#b.service_time,
b.warranty,
b.create_by,
b.create_date,
#b.update_by,
#b.update_date,
b.device_level,
b.supplier_id,
b.status,
b.failure_frequency as failureFrequency,
#b.repair_frequency as repairFrequency,
#b.repair_cost as repairCost,
g.health
<include refid="selectEquBaseVo2"/>
FROM equ_base b
LEFT JOIN equ_gather g ON b.id = g.equ_id
LEFT JOIN equ_manu m ON b.manufacture = m.id
LEFT JOIN equ_supplier s ON b.supplier_id = s.id
LEFT JOIN equ_type t ON b.equ_type = t.id
LEFT JOIN sys_user su ON b.create_by = su.user_id
LEFT JOIN (
-- 子查询:每台设备取最新的健康度
SELECT eg.equ_id, eg.health
FROM equ_gather eg
INNER JOIN (
SELECT equ_id, MAX(gather_time) AS max_time
FROM equ_gather
GROUP BY equ_id
) tmp ON eg.equ_id = tmp.equ_id AND eg.gather_time = tmp.max_time
) g ON b.id = g.equ_id
<where>
<if test="equType != null and equType != ''">
AND b.equ_type = #{equType}
</if>
<if test="equName != null and equName != ''">
AND b.name LIKE concat('%', #{equName}, '%')
<if test="name != null and name != ''">
AND b.name LIKE CONCAT('%', #{name}, '%')
</if>
<if test="location != null and location != ''">
AND b.location = #{location}
</if>
<if test="manufacture != null and manufacture != ''">
AND b.manufacture = #{manufacture}
</if>
<if test="inCharge != null">
AND b.in_charge = #{inCharge}
</if>
<if test="status != null">
AND b.status = #{status}
AND b.location LIKE CONCAT('%', #{location}, '%')
</if>
<if test="minTime != null">
AND b.create_date <![CDATA[>=]]> #{minTime}
AND b.create_date &gt;= #{minTime}
</if>
<if test="maxTime != null">
AND b.create_date <![CDATA[<=]]> #{maxTime}
AND b.create_date &lt;= #{maxTime}
</if>
<if test="health != null">
AND g.health <![CDATA[>=]]> #{health}
<if test="status != null">
AND b.status = #{status}
</if>
</where>
</select>
@ -290,9 +303,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="findEquBaseList" resultMap="EquBaseResult">
<include refid="selectEquBaseVo"/>
</select>
<select id="selectEquBaseById" parameterType="String" resultMap="EquBaseResult">
<include refid="selectEquBaseVo"/>
where id = #{id}
<update id="batchUpdateFailureFrequency">
UPDATE equ_base
SET failure_frequency = CASE id
<foreach collection="list" item="item">
WHEN #{item.equId} THEN failure_frequency + #{item.count}
</foreach>
END
WHERE id IN
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.equId}
</foreach>
</update>
<!-- 查询设备图片(BLOB) -->
<select id="selectEquBaseImageById" parameterType="String" resultType="ImageVo">
SELECT equ_image AS equImage
FROM equ_base
WHERE id = #{id}
</select>
<select id="selectEquBaseById" parameterType="String" resultType="com.alops.system.domain.vo.queryEquBaseVO" >
SELECT
<include refid="selectEquBaseVo2"/>
FROM equ_base b
LEFT JOIN equ_manu m ON b.manufacture = m.id
LEFT JOIN equ_supplier s ON b.supplier_id = s.id
LEFT JOIN equ_type t ON b.equ_type = t.id
LEFT JOIN sys_user su ON b.create_by = su.user_id
LEFT JOIN (
-- 子查询:每台设备取最新的健康度
SELECT eg.equ_id, eg.health
FROM equ_gather eg
INNER JOIN (
SELECT equ_id, MAX(gather_time) AS max_time
FROM equ_gather
GROUP BY equ_id
) tmp ON eg.equ_id = tmp.equ_id AND eg.gather_time = tmp.max_time
) g ON b.id = g.equ_id
where b.id = #{id}
</select>
<insert id="insertEquBase" parameterType="EquBase">
@ -306,21 +361,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="location != null">location,</if>
<if test="equType != null">equ_type,</if>
<if test="inCharge != null">in_charge,</if>
<if test="releaseDate != null">release_date,</if>
<if test="installDate != null">install_date,</if>
<if test="lifeCycle != null">life_cycle,</if>
<if test="serviceTime != null">service_time,</if>
<if test="warranty != null">warranty,</if>
<if test="createBy != null">create_by,</if>
<if test="createDate != null">create_date,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateDate != null">update_date,</if>
<if test="status != null">status,</if>
<if test="failureFrequency != null">failure_frequency,</if>
<if test="repairFrequency != null">repair_frequency,</if>
<if test="repairCost != null">repair_cost,</if>
</trim>
status,
<if test="equImage != null">equ_image,</if>
failure_frequency,
gather_frequency,
<if test="deviceLevel != null">device_level,</if>
<if test="supplierId != null">supplier_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null">#{name},</if>
@ -330,23 +383,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="location != null">#{location},</if>
<if test="equType != null">#{equType},</if>
<if test="inCharge != null">#{inCharge},</if>
<if test="releaseDate != null">#{releaseDate},</if>
<if test="installDate != null">#{installDate},</if>
<if test="lifeCycle != null">#{lifeCycle},</if>
<if test="serviceTime != null">#{serviceTime},</if>
<if test="warranty != null">#{warranty},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createDate != null">#{createDate},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateDate != null">#{updateDate},</if>
<if test="status != null">#{status},</if>
<if test="failureFrequency != null">#{failureFrequency},</if>
<if test="repairFrequency != null">#{repairFrequency},</if>
<if test="repairCost != null">#{repairCost},</if>
</trim>
COALESCE(#{status,jdbcType=INTEGER}, 0),
<if test="equImage != null">#{equImage,jdbcType=BLOB},</if>
COALESCE(#{failureFrequency,jdbcType=BIGINT}, 0),
COALESCE(#{gatherFrequency,jdbcType=BIGINT}, 0),
<if test="deviceLevel != null">#{deviceLevel},</if>
<if test="supplierId != null">#{supplierId},</if>
</trim>
</insert>
<update id="updateEquBase" parameterType="EquBase">
update equ_base
<trim prefix="SET" suffixOverrides=",">
@ -357,20 +409,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="location != null">location = #{location},</if>
<if test="equType != null">equ_type = #{equType},</if>
<if test="inCharge != null">in_charge = #{inCharge},</if>
<if test="releaseDate != null">release_date = #{releaseDate},</if>
<if test="installDate != null">install_date = #{installDate},</if>
<if test="lifeCycle != null">life_cycle = #{lifeCycle},</if>
<if test="serviceTime != null">service_time = #{serviceTime},</if>
<if test="warranty != null">warranty = #{warranty},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createDate != null">create_date = #{createDate},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateDate != null">update_date = #{updateDate},</if>
<if test="status != null">status = #{status},</if>
<if test="failureFrequency != null">failure_frequency = #{failureFrequency},</if>
<if test="repairFrequency != null">repair_frequency = #{repairFrequency},</if>
<if test="repairCost != null">repair_cost = #{repairCost},</if>
<if test="deviceLevel != null">device_level = #{deviceLevel},</if>
<if test="supplierId != null">supplier_id = #{supplierId},</if>
<if test="equImage != null">equ_image = #{equImage},</if>
</trim>
where id = #{id}
</update>

@ -23,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="volOutStatus" column="vol_out_status" />
<result property="fanSpeedStatus" column="fan_speed_status" />
<result property="contWorkPeriod" column="cont_work_period" />
</resultMap>
<!-- updateHealth 方法 -->

@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="equGatherId" column="equ_gather_id" />
<result property="interfaceId" column="interface_id" />
<result property="outBandwidth" column="out_bandwidth" />
</resultMap>
<insert id="insertBatch" parameterType="java.util.List">

@ -15,6 +15,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="status" column="status" />
</resultMap>
<select id="selectEquManuDropDown"
resultType="com.alops.system.domain.vo.dropDownVo">
SELECT id,
name
FROM equ_manu
ORDER BY name
</select>
<sql id="selectEquManuVo">
select id, name, description, contact_by, contact_way, create_by, create_date, status from equ_manu
</sql>

@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="desAddress" column="des_address" />
<result property="subnetMask" column="subnet_mask" />
<result property="nextHop" column="next_hop" />
</resultMap>
<!-- EquRouting 批量插入 -->

@ -14,7 +14,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="status" column="status" />
</resultMap>
<select id="selectEquSupDropDown"
resultType="com.alops.system.domain.vo.dropDownVo">
SELECT id,
name
FROM equ_supplier
ORDER BY name
</select>
<sql id="selectEquSupplierVo">
select id, name, description, contact_by, contact_way, create_by, create_time, status from equ_supplier
</sql>

@ -13,6 +13,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createDate" column="create_date" />
</resultMap>
<!-- 设备类型下拉列表 -->
<select id="selectEquTypeDropDown"
resultType="com.alops.system.domain.vo.dropDownVo">
SELECT id,
name
FROM equ_type
ORDER BY name
</select>
<sql id="selectEquTypeVo">
select id, name, description, image, create_by, create_date from equ_type
</sql>

@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="veneerId" column="veneer_id" />
<result property="veneerStatus" column="veneer_status" />
<result property="equGatherId" column="equ_gather_id" />
</resultMap>
<!-- EquVeneer 批量插入 -->

@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="vlanId" column="vlan_id" />
</resultMap>
<!-- EquVlan 批量插入 -->
<insert id="insertBatchVlan" parameterType="java.util.List">

@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="content" column="content" />
<result property="status" column="status" />
<result property="createTime" column="create_time" />
</resultMap>

@ -9,21 +9,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="ruleName" column="rule_name" />
<result property="ruleType" column="rule_type" />
<result property="frequency" column="frequency" />
<result property="fixedTime" column="fixed_time" />
<result property="timeLimitEnabled" column="time_limit_enabled" />
<result property="gatherTime" column="gather_time" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="isActive" column="is_active" />
<result property="status" column="status" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
<result property="createdBy" column="created_by" />
<result property="updatedBy" column="updated_by" />
</resultMap>
<select id="selectScheduleRulesByMaxTime"
resultMap="ScheduleRulesResult">
SELECT
id,
rule_name,
rule_type,
frequency,
gather_time,
start_time,
end_time,
status,
created_at,
created_by
FROM schedule_rules
ORDER BY gather_time DESC
LIMIT 1
</select>
<sql id="selectScheduleRulesVo">
select id, rule_name, rule_type, frequency, fixed_time, time_limit_enabled, start_time, end_time, is_active, created_at, updated_at, created_by, updated_by from schedule_rules
select id, rule_name, rule_type, frequency, gather_time, start_time, end_time, status,created_at ,created_by from schedule_rules
</sql>
<select id="selectList" resultMap="ScheduleRulesResult">
SELECT *
FROM schedule_rules
WHERE status IN (0, 1)
</select>
<select id="selectScheduleRulesList" parameterType="ScheduleRules" resultMap="ScheduleRulesResult">
<include refid="selectScheduleRulesVo"/>
<where>
@ -53,29 +78,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ruleName != null and ruleName != ''">rule_name,</if>
<if test="ruleType != null">rule_type,</if>
<if test="frequency != null">frequency,</if>
<if test="fixedTime != null">fixed_time,</if>
<if test="timeLimitEnabled != null">time_limit_enabled,</if>
<if test="gatherTime != null">gather_time,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="isActive != null">is_active,</if>
<if test="status!= null">status,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
<if test="createdBy != null">created_by,</if>
<if test="updatedBy != null">updated_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ruleName != null and ruleName != ''">#{ruleName},</if>
<if test="ruleType != null">#{ruleType},</if>
<if test="frequency != null">#{frequency},</if>
<if test="fixedTime != null">#{fixedTime},</if>
<if test="timeLimitEnabled != null">#{timeLimitEnabled},</if>
<if test="gatherTime != null">#{gatherTime},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="isActive != null">#{isActive},</if>
<if test="status!= null">#{status},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="updatedBy != null">#{updatedBy},</if>
</trim>
</insert>
@ -85,15 +110,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ruleName != null and ruleName != ''">rule_name = #{ruleName},</if>
<if test="ruleType != null">rule_type = #{ruleType},</if>
<if test="frequency != null">frequency = #{frequency},</if>
<if test="fixedTime != null">fixed_time = #{fixedTime},</if>
<if test="timeLimitEnabled != null">time_limit_enabled = #{timeLimitEnabled},</if>
<if test="gatherTime != null">gather_time = #{gatherTime},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="isActive != null">is_active = #{isActive},</if>
<if test="status != null">status = #{status},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
</trim>
where id = #{id}
</update>

@ -19,6 +19,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<!-- 查询所有角色,仅返回 roleId、roleName、roleKey -->
<select id="selectAllRolesSimple" resultType="rolePickerVo">
SELECT
role_id AS roleId,
role_name AS roleName,
role_key AS roleKey
FROM sys_role
</select>
<resultMap id="SysRoleSimpleResult" type="SysRole">
<id property="roleId" column="role_id"/>
<result property="roleName" column="role_name"/>
<result property="roleKey" column="role_key"/>
</resultMap>
<sql id="selectRoleVo">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly,

@ -24,6 +24,7 @@
"url": "https://gitee.com/y_project/RuoYi-Vue.git"
},
"dependencies": {
"@jiaminghi/data-view": "^2.10.0",
"@riophae/vue-treeselect": "0.4.0",
"axios": "0.28.1",
"clipboard": "2.0.8",

@ -1,6 +1,6 @@
import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";
const api = '/equipment/'
const api = '/device/files/'
// 查询详细
export function getDict() {
@ -13,8 +13,8 @@ export function getDict() {
// 查询列表
export function list(query) {
return request({
url: api + 'queryByVO',
method: 'get',
url: api + 'list',
method: 'post',
params: query
})
}

@ -35,6 +35,7 @@ import ImagePreview from "@/components/ImagePreview"
import DictTag from '@/components/DictTag'
// 字典数据组件
import DictData from '@/components/DictData'
import dataV from '@jiaminghi/data-view'
// 全局方法挂载
Vue.prototype.getDicts = getDicts
@ -58,6 +59,7 @@ Vue.component('ImagePreview', ImagePreview)
Vue.use(directive)
Vue.use(plugins)
Vue.use(dataV)
DictData.install()
/**

@ -10,7 +10,7 @@
<div class="service-container">
<!-- 左侧常见问题 -->
<div class="faq-section">
<!-- <div class="faq-section">
<h3>常见问题</h3>
<div
v-for="(faq, index) in faqs"
@ -20,7 +20,7 @@
>
{{ faq.question }}
</div>
</div>
</div> -->
<!-- 右侧聊天区域 -->
<div class="chat-section">
@ -205,7 +205,7 @@ export default {
padding: 15px;
}
.chat-section {
width: 70%;
width: 100%;
display: flex;
flex-direction: column;
}

@ -0,0 +1,40 @@
<template>
<dv-digital-flop :config="config" />
</template>
<script>
export default {
props: {
configData: {
type: Object,
default: () => {
return {}
}
}
},
data() {
return {
config:{
number: [123456],
content: '{nt}个',
formatter: this.formatter,
style:{
fill: '#000',
fontSize: 26,
fontWeight: 'bold'
},
...this.configData
}
}
},
methods: {
formatter (number) {
const numbers = number.toString().split('').reverse()
const segs = []
while (numbers.length) segs.push(numbers.splice(0, 3).join(''))
return segs.join(',').split('').reverse().join('')
},
}
}
</script>

@ -0,0 +1,449 @@
<template>
<div class="app-container">
<el-row :gutter="20">
<splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
<!--供应商-->
<pane size="84">
<el-col>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="供应商名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入厂商名称" clearable style="width: 240px" @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="联系人" prop="contactBy">
<el-input v-model="queryParams.contactBy" placeholder="请输入联系人" clearable style="width: 240px" @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['device:deviceManufacturer:add']">新增</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['device:deviceManufacturer:import']">导入</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['device:deviceManufacturer:export']">导出</el-button>
</el-col> -->
</el-row>
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" key="Id" prop="Id" />
<el-table-column label="供应商名称" align="center" key="name" prop="name" width="120" />
<el-table-column label="联系人" align="center" key="contactBy" prop="contactBy" width="120" />
<el-table-column label="联系方式" align="center" key="contactWay" prop="contactWay" width="120" />
<el-table-column label="供应商简介" align="center" key="contactWay" prop="contactWay" width="120" />
<el-table-column label="创建人" align="center" key="CreateBy" prop="CreateBy" width="120" />
<el-table-column label="创建日期" align="center" prop="CreateDate" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.CreateDate) }}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" key="Status" prop="Status" width="120" />
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['device:deviceManufacturer:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['device:deviceManufacturer:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
</el-col>
</pane>
</splitpanes>
</el-row>
<el-dialog :title="title" :visible.sync="open" width="760px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="厂商名称" prop="name">
<el-input v-model="form.name" placeholder="请输入用户昵称" maxlength="30" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系人" prop="contactBy">
<el-input v-model="form.contactBy" placeholder="请输入手机号码" maxlength="30" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系方式" prop="contactWay">
<el-input v-model="form.contactWay" placeholder="请输入手机号码" maxlength="11" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</span>
</el-dialog>
<!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<div class="el-upload__tip" slot="tip">
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的供应商
</div>
<span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板</el-link>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user"
import { getToken } from "@/utils/auth"
import Treeselect from "@riophae/vue-treeselect"
import "@riophae/vue-treeselect/dist/vue-treeselect.css"
import { Splitpanes, Pane } from "splitpanes"
import "splitpanes/dist/splitpanes.css"
export default {
name: "User",
dicts: ['sys_normal_disable', 'sys_user_sex'],
components: { Treeselect, Splitpanes, Pane },
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
userList: null,
//
title: "",
//
deptOptions: undefined,
//
enabledDeptOptions: undefined,
//
open: false,
//
deptName: undefined,
//
initPassword: undefined,
//
dateRange: [],
//
postOptions: [],
//
roleOptions: [],
//
form: {},
defaultProps: {
children: "children",
label: "label"
},
//
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
updateSupport: 0,
//
headers: { Authorization: "Bearer " + getToken() },
//
url: process.env.VUE_APP_BASE_API + "/system/user/importData"
},
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: undefined,
contactBy: undefined,
status: undefined,
deptId: undefined
},
//
rules: {
name: [
{ required: true, message: "用户名称不能为空", trigger: "blur" },
{ min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' }
],
nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
],
password: [
{ required: true, message: "用户密码不能为空", trigger: "blur" },
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' },
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
],
email: [
{
type: "email",
message: "请输入正确的邮箱地址",
trigger: ["blur", "change"]
}
],
contactBy: [
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
]
}
}
},
watch: {
//
deptName(val) {
this.$refs.tree.filter(val)
}
},
created() {
this.getList()
// this.getDeptTree()
this.getConfigKey("sys.user.initPassword").then(response => {
this.initPassword = response.msg
})
},
methods: {
/** 查询用户列表 */
getList() {
this.loading = true
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.userList = response.rows
this.total = response.total
this.loading = false
}
)
},
// /** */
// getDeptTree() {
// deptTreeSelect().then(response => {
// this.deptOptions = response.data
// this.enabledDeptOptions = this.filterDisabledDept(JSON.parse(JSON.stringify(response.data)))
// })
// },
//
filterDisabledDept(deptList) {
return deptList.filter(dept => {
if (dept.disabled) {
return false
}
if (dept.children && dept.children.length) {
dept.children = this.filterDisabledDept(dept.children)
}
return true
})
},
//
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
//
handleNodeClick(data) {
this.queryParams.deptId = data.id
this.handleQuery()
},
//
handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用"
this.$modal.confirm('确认要"' + text + '""' + row.name + '"用户吗?').then(function() {
return changeUserStatus(row.Id, row.status)
}).then(() => {
this.$modal.msgSuccess(text + "成功")
}).catch(function() {
row.status = row.status === "0" ? "1" : "0"
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
Id: undefined,
deptId: undefined,
name: undefined,
nickName: undefined,
password: undefined,
contactBy: undefined,
email: undefined,
sex: undefined,
status: "0",
remark: undefined,
postIds: [],
roleIds: []
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = []
this.resetForm("queryForm")
this.queryParams.deptId = undefined
this.$refs.tree.setCurrentKey(null)
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.Id)
this.single = selection.length != 1
this.multiple = !selection.length
},
//
handleCommand(command, row) {
switch (command) {
case "handleResetPwd":
this.handleResetPwd(row)
break
case "handleAuthRole":
this.handleAuthRole(row)
break
default:
break
}
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
getUser().then(response => {
this.postOptions = response.posts
this.roleOptions = response.roles
this.open = true
this.title = "添加用户"
this.form.password = this.initPassword
})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const Id = row.Id || this.ids
getUser(Id).then(response => {
this.form = response.data
this.postOptions = response.posts
this.roleOptions = response.roles
this.$set(this.form, "postIds", response.postIds)
this.$set(this.form, "roleIds", response.roleIds)
this.open = true
this.title = "修改用户"
this.form.password = ""
})
},
/** 重置密码按钮操作 */
handleResetPwd(row) {
this.$prompt('请输入"' + row.name + '"的新密码', "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnClickModal: false,
inputPattern: /^.{5,20}$/,
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
inputValidator: (value) => {
if (/<|>|"|'|\||\\/.test(value)) {
return "不能包含非法字符:< > \" ' \\\ |"
}
},
}).then(({ value }) => {
resetUserPwd(row.Id, value).then(response => {
this.$modal.msgSuccess("修改成功,新密码是:" + value)
})
}).catch(() => {})
},
/** 分配角色操作 */
handleAuthRole: function(row) {
const Id = row.Id
this.$router.push("/system/user-auth/role/" + Id)
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.Id != undefined) {
updateUser(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addUser(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const Ids = row.Id || this.ids
this.$modal.confirm('是否确认删除用户编号为"' + Ids + '"的数据项?').then(function() {
return delUser(Ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('system/user/export', {
...this.queryParams
}, `user_${new Date().getTime()}.xlsx`)
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = "用户导入"
this.upload.open = true
},
/** 下载模板操作 */
importTemplate() {
this.download('system/user/importTemplate', {
}, `user_template_${new Date().getTime()}.xlsx`)
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false
this.upload.isUploading = false
this.$refs.upload.clearFiles()
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true })
this.getList()
},
//
submitFileForm() {
this.$refs.upload.submit()
}
}
}
</script>

@ -1,187 +1,300 @@
<template>
<div class="dashboard">
<h1>唐山烟草智能网络设备运维与问答系统</h1>
<el-row :gutter="20">
<!-- 设备状态监控 -->
<el-col :span="12">
<el-card>
<h2>设备状态监控</h2>
<!-- 这里可以添加设备状态监控的具体内容例如表格或图表 -->
<el-table :data="deviceStatusData" style="width: 100%">
<el-table-column prop="name" label="设备名称"></el-table-column>
<el-table-column prop="location" label="设备位置"></el-table-column>
<el-table-column prop="cpuUsage" label="CPU使用率"></el-table-column>
<el-table-column prop="memoryUsage" label="内存使用率"></el-table-column>
<el-table-column prop="status" label="状态">
<template slot-scope="scope">
<el-tag :type="scope.row.status === '正常' ? 'success' : 'danger'">
{{ scope.row.status }}
</el-tag>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
<!-- 设备状态统计图表 -->
<el-col :span="12">
<el-card>
<h2>检测设备信息 (按状态统计饼状图)</h2>
<!-- 这里可以使用echarts或其他图表库来展示饼状图 -->
<div id="statusChart" style="width: 100%; height: 300px;"></div>
</el-card>
<el-card>
<h2>检测设备信息 (按设备类型饼状图)</h2>
<div id="typeChart" style="width: 100%; height: 300px;"></div>
</el-card>
<div class="dashboard-editor-container">
<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<div class="card-title"><i class="el-icon-data-line"></i>预警信息统计</div>
<div class="data-overview">
<div class="data-item">
<div class="data-label">预警总数</div>
<digital :configData="{number:[111]}" />
</div>
<div class="data-item">
<div class="data-label">预警总数</div>
<digital :configData="{number:[111]}" />
</div>
<div class="data-item">
<div class="data-label">预警总数</div>
<digital :configData="{number:[111]}" />
</div>
<div class="data-item">
<div class="data-label">预警总数</div>
<digital :configData="{number:[111]}" />
</div>
<div class="data-item">
<div class="data-label">预警总数</div>
<digital :configData="{number:[111]}" />
</div>
<div class="data-item">
<div class="data-label">预警总数</div>
<digital :configData="{number:[111]}" />
</div>
<div class="data-item">
<div class="data-label">预警总数</div>
<digital :configData="{number:[111]}" />
</div>
<div class="data-item">
<div class="data-label">预警总数</div>
<digital :configData="{number:[111]}" />
</div>
<div class="data-item">
<div class="data-label">预警总数</div>
<digital :configData="{number:[111]}" />
</div>
</div>
</div>
</el-col>
</el-row>
<el-row :gutter="20" style="margin-top: 20px;">
<!-- 设备预警信息 -->
<el-col :span="12">
<el-card>
<h2>设备预警信息</h2>
<el-table :data="alertData" style="width: 100%">
<el-table-column prop="time" label="预警时间"></el-table-column>
<el-table-column prop="device" label="设备名称"></el-table-column>
<el-table-column prop="location" label="设备位置"></el-table-column>
<el-table-column prop="level" label="预警等级">
<template slot-scope="scope">
<el-tag :type="getTagType(scope.row.level)">
{{ scope.row.level }}
</el-tag>
</template>
</el-table-column>
</el-table>
</el-card>
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<div class="card-title"><i class="el-icon-pie-chart"></i>检测设备信息</div>
<pie-chart />
</div>
</el-col>
<!-- 预警信息统计 -->
<el-col :span="12">
<el-card>
<h2>预警信息统计</h2>
<div id="alertStatsChart" style="width: 100%; height: 300px;"></div>
</el-card>
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<div class="card-title"><i class="el-icon-monitor"></i>设备预警信息</div>
<div class="div0">
<div class="div1" v-for="(alert, index) in alerts" :key="index" :class="`alert-level-${alert.level}`">
<dv-border-box-13 class="div2">
<el-row>
<el-col span="12">
<span class="alert-lable">预警时间:{{ alert.time }}</span>
</el-col>
<el-col span="12">
<span class="alert-lable">设备名称:{{ alert.deviceName }}</span>
</el-col>
<el-col span="12">
<span class="alert-lable">设备位置:{{ alert.deviceLocation }}</span>
</el-col>
<el-col span="12">
<span class="alert-lable">预警等级:<span class="alert-lable" :style="{ color: getLevelColor(alert.level) }">{{ alert.level }}</span></span>
</el-col>
<el-col span="12">
<span class="alert-lable">预警信息:{{ alert.message }}</span>
</el-col>
<el-col span="12">
<span class="alert-lable">预警状态:{{ alert.status }}</span>
</el-col>
</el-row>
</dv-border-box-13>
</div>
</div>
</div>
</el-col>
</el-row>
<el-row style="background:#fff;padding:16px;">
<div class="card-title"><i class="el-icon-s-data"></i> 设备状态监控</div>
<dv-scroll-board :config="scrollConfig" style="height:220px;" />
</el-row>
</div>
</template>
<script>
import * as echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import PanelGroup from './dashboard/PanelGroup'
import LineChart from './dashboard/LineChart'
import RaddarChart from './dashboard/RaddarChart'
import PieChart from './dashboard/PieChart'
import BarChart from './dashboard/BarChart'
import digital from './dashboard/digital'
const lineChartData = {
newVisitis: {
expectedData: [100, 120, 161, 134, 105, 160, 165],
actualData: [120, 82, 91, 154, 162, 140, 145]
},
messages: {
expectedData: [200, 192, 120, 144, 160, 130, 140],
actualData: [180, 160, 151, 106, 145, 150, 130]
},
purchases: {
expectedData: [80, 100, 121, 104, 105, 90, 100],
actualData: [120, 90, 100, 138, 142, 130, 130]
},
shoppings: {
expectedData: [130, 140, 141, 142, 145, 150, 160],
actualData: [120, 82, 91, 154, 162, 140, 130]
}
}
export default {
name: 'Index',
components: {
PanelGroup,
LineChart,
RaddarChart,
PieChart,
BarChart,
digital
},
data() {
return {
deviceStatusData: [
//
{ name: '设备1', location: '位置1', cpuUsage: '30%', memoryUsage: '40%', status: '正常' },
{ name: '设备2', location: '位置2', cpuUsage: '70%', memoryUsage: '80%', status: '异常' },
],
alertData: [
//
{ time: '2023-10-01 10:00:00', device: '设备2', location: '位置2', level: '高' },
{ time: '2023-10-01 11:00:00', device: '设备3', location: '位置3', level: '中' },
],
};
},
mounted() {
this.initCharts();
lineChartData: lineChartData.newVisitis,
scrollConfig:{
header: ['设备名称', '设备位置', 'CPU使用率','内存使用率','温度', '健康度', '设备运行时长','采集时间'],
data: [
['行1列1', '行1列2', '行1列3', '行1列4', '行1列5', '行1列6','行1列7', '行1列8'],
['行2列1', '行2列2', '行2列3', '行2列4', '行2列5', '行2列6','行2列7', '行2列8'],
['行3列1', '行3列2', '行3列3', '行3列4', '行3列5', '行3列6','行3列7', '行3列8'],
['行4列1', '行4列2', '行4列3', '行4列4', '行4列5', '行4列6','行4列7', '行4列8'],
['行5列1', '行5列2', '行5列3', '行5列4', '行5列5', '行5列6','行5列7', '行5列8'],
['行6列1', '行6列2', '行6列3', '行6列4', '行6列5', '行6列6','行6列7', '行6列8'],
['行7列1', '行7列2', '行7列3', '行7列4', '行7列5', '行7列6','行7列7', '行7列8'],
['行8列1', '行8列2', '行8列3', '行8列4', '行8列5', '行8列6','行8列7', '行8列8'],
['行9列1', '行9列2', '行9列3', '行9列4', '行9列5', '行9列6','行9列7', '行9列8'],
['行10列1', '行10列2', '行10列3', '行10列4', '行10列5', '行10列6','行10列7', '行10列8']
],
headerBGC:'#f8f8f9',
headerHeight:60,
oddRowBGC:'#f5f7fa',
evenRowBGC:'#fff',
},
alerts: [
{
time: '2021-10-16 14:54:11',
deviceName: 'PLC远程监控系统',
deviceLocation: '污水处理监控系统',
level: 1,
message: '2#电机运行状态等于1',
status: '触发值: 1'
},
{
time: '2021-10-16 14:54:04',
deviceName: 'PLC远程监控系统',
deviceLocation: '污水处理监控系统',
level: 0,
message: '2#电机运行状态报警恢复',
status: '触发值: 0'
},
{
time: '2021-10-16 14:54:11',
deviceName: 'PLC远程监控系统',
deviceLocation: '污水处理监控系统',
level: 1,
message: '2#电机运行状态等于1',
status: '触发值: 1'
},
{
time: '2021-10-16 14:54:04',
deviceName: 'PLC远程监控系统',
deviceLocation: '污水处理监控系统',
level: 0,
message: '2#电机运行状态报警恢复',
status: '触发值: 0'
},
//
]
}
},
methods: {
getTagType(level) {
const types = { '高': 'danger', '中': 'warning', '低': 'success' };
return types[level] || 'info';
handleSetLineChartData(type) {
this.lineChartData = lineChartData[type]
},
initCharts() {
//
const statusChart = echarts.init(document.getElementById('statusChart'));
statusChart.setOption({
title: { text: '设备状态统计', subtext: '按状态', left: 'center' },
tooltip: { trigger: 'item' },
series: [
{
name: '设备状态',
type: 'pie',
radius: '50%',
data: [
{ value: 44, name: '自主房屋' },
{ value: 33, name: '出租房屋' },
{ value: 11, name: '空置房屋' },
{ value: 11, name: '其他' },
],
},
],
});
getLevelColor(level) {
const levelColors = {
0: 'green',
1: 'orange',
2: 'red'
};
return levelColors[level] || 'black'; //
}
}
}
</script>
//
const typeChart = echarts.init(document.getElementById('typeChart'));
typeChart.setOption({
title: { text: '设备类型统计', subtext: '按设备类型', left: 'center' },
tooltip: { trigger: 'item' },
series: [
{
name: '设备类型',
type: 'pie',
radius: '50%',
data: [
{ value: 44, name: '自主房屋' },
{ value: 33, name: '出租房屋' },
{ value: 11, name: '空置房屋' },
{ value: 11, name: '其他' },
],
},
],
});
<style lang="scss" scoped>
.dashboard-editor-container {
padding: 32px;
background-color: rgb(240, 242, 245);
position: relative;
//
const alertStatsChart = echarts.init(document.getElementById('alertStatsChart'));
alertStatsChart.setOption({
title: { text: '预警信息统计', left: 'center' },
tooltip: {},
radar: {
indicator: [
{ name: '火警类', max: 500 },
{ name: '冲禁类', max: 500 },
{ name: '灾害', max: 500 },
{ name: '群体性', max: 500 },
{ name: '行政类', max: 500 },
{ name: '交通类', max: 500 },
{ name: '重大', max: 500 },
],
},
series: [{
name: '预警统计',
type: 'radar',
data: [
{
value: [75, 452, 64, 94, 44, 0, 29],
name: '预警次数',
},
],
}],
});
},
},
};
</script>
.chart-wrapper {
background: #fff;
padding: 16px;
margin-bottom: 32px;
height: 420px;
}
}
<style>
.dashboard {
padding: 20px;
background-color: #f0f2f5;
min-height: 100vh;
@media (max-width:1024px) {
.chart-wrapper {
padding: 8px;
}
}
.dv-scroll-board{
color: #3d3d3d;
}
.card-title {
font-size: 16px;
margin-bottom: 15px;
display: flex;
align-items: center;
color: #3d3d3d;
font-weight: bold;
}
.card-title i {
margin-right: 8px;
font-size: 18px;
}
.data-overview {
display: flex;
flex-wrap: wrap;
gap: 15px;
}
h1, h2 {
.data-item {
flex: 1;
min-width: 30%;
text-align: center;
padding: 15px 10px;
background: #f5f7fa;
border-radius: 8px;
transition: all 0.3s ease;
}
.el-card {
margin-bottom: 20px;
.data-item:hover {
background: #f1f2f4;
transform: translateY(-3px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
.data-value {
font-size: 24px;
font-weight: bold;
margin: 10px 0;
color: #3d3d3d;
}
.data-label {
font-size: 14px;
color: #3d3d3d;
}
.alert-list .div0 {
list-style-type: none;
padding: 0;
}
.alert-list .div1 {
display: flex;
justify-content: space-between;
}
.div1{
margin-bottom: 5px;
}
.div2{
padding: 20px 16px;
}
.alert-time, .alert-device-name, .alert-device-location, .alert-message, .alert-status {
flex: 1;
}
.alert-level {
flex: 0.5;
text-align: center;
}
</style>
</style>

@ -1,98 +0,0 @@
<template>
<div class="dashboard-editor-container">
<panel-group @handleSetLineChartData="handleSetLineChartData" />
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
<line-chart :chart-data="lineChartData" />
</el-row>
<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<raddar-chart />
</div>
</el-col>
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<pie-chart />
</div>
</el-col>
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<bar-chart />
</div>
</el-col>
</el-row>
</div>
</template>
<script>
import PanelGroup from './dashboard/PanelGroup'
import LineChart from './dashboard/LineChart'
import RaddarChart from './dashboard/RaddarChart'
import PieChart from './dashboard/PieChart'
import BarChart from './dashboard/BarChart'
const lineChartData = {
newVisitis: {
expectedData: [100, 120, 161, 134, 105, 160, 165],
actualData: [120, 82, 91, 154, 162, 140, 145]
},
messages: {
expectedData: [200, 192, 120, 144, 160, 130, 140],
actualData: [180, 160, 151, 106, 145, 150, 130]
},
purchases: {
expectedData: [80, 100, 121, 104, 105, 90, 100],
actualData: [120, 90, 100, 138, 142, 130, 130]
},
shoppings: {
expectedData: [130, 140, 141, 142, 145, 150, 160],
actualData: [120, 82, 91, 154, 162, 140, 130]
}
}
export default {
name: 'Index',
components: {
PanelGroup,
LineChart,
RaddarChart,
PieChart,
BarChart
},
data() {
return {
lineChartData: lineChartData.newVisitis
}
},
methods: {
handleSetLineChartData(type) {
this.lineChartData = lineChartData[type]
}
}
}
</script>
<style lang="scss" scoped>
.dashboard-editor-container {
padding: 32px;
background-color: rgb(240, 242, 245);
position: relative;
.chart-wrapper {
background: #fff;
padding: 16px 16px 0;
margin-bottom: 32px;
}
}
@media (max-width:1024px) {
.chart-wrapper {
padding: 8px;
}
}
</style>
Loading…
Cancel
Save