diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwDictConstants.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwDictConstants.java index 886a7a8..a6a18c1 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwDictConstants.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwDictConstants.java @@ -163,4 +163,12 @@ public class HwDictConstants { public static final String ALARM_INFO_FLAG_YES = "1";//有关联报警信息; public static final String ALARM_INFO_FLAG_NO = "0";//无关联报警信息; + + + public static final String ALARM_LEVEL_COMMON_FLAG_YES = "1";//报警级别通用标识:是 + public static final String ALARM_LEVEL_COMMON_FLAG_NO = "0";//报警级别通用标识:否 + + public static final String ALARM_TYPE_COMMON_FLAG_YES = "1";//报警类型通用标识:是 + public static final String ALARM_TYPE_COMMON_FLAG_NO = "0";//报警类型通用标识:否 + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmLevelController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmLevelController.java new file mode 100644 index 0000000..d4ba0f8 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmLevelController.java @@ -0,0 +1,124 @@ +package com.ruoyi.business.controller; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.business.domain.HwScene; +import com.ruoyi.business.service.IHwSceneService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.business.domain.HwAlarmLevel; +import com.ruoyi.business.service.IHwAlarmLevelService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.page.TableDataInfo; + +/** + * 报警级别Controller + * + * @author xins + * @date 2023-09-15 + */ +@RestController +@RequestMapping("/alarmLevel") +public class HwAlarmLevelController extends BaseController +{ + @Autowired + private IHwAlarmLevelService hwAlarmLevelService; + + @Autowired + private IHwSceneService hwSceneService; + + /** + * 查询报警级别列表 + */ + @RequiresPermissions("business:alarmLevel:list") + @GetMapping("/list") + public TableDataInfo list(HwAlarmLevel hwAlarmLevel) + { + startPage(); + List list = hwAlarmLevelService.selectHwAlarmLevelJoinList(hwAlarmLevel); + return getDataTable(list); + } + + /** + * 导出报警级别列表 + */ + @RequiresPermissions("business:alarmLevel:export") + @Log(title = "报警级别", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, HwAlarmLevel hwAlarmLevel) + { + List list = hwAlarmLevelService.selectHwAlarmLevelJoinList(hwAlarmLevel); + ExcelUtil util = new ExcelUtil(HwAlarmLevel.class); + util.exportExcel(response, list, "报警级别数据"); + } + + /** + * 获取报警级别详细信息 + */ + @RequiresPermissions("business:alarmLevel:query") + @GetMapping(value = "/{alarmLevelId}") + public AjaxResult getInfo(@PathVariable("alarmLevelId") Long alarmLevelId) + { + return success(hwAlarmLevelService.selectHwAlarmLevelByAlarmLevelId(alarmLevelId)); + } + + /** + * 新增报警级别 + */ + @RequiresPermissions("business:alarmLevel:add") + @Log(title = "报警级别", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody HwAlarmLevel hwAlarmLevel) + { + return toAjax(hwAlarmLevelService.insertHwAlarmLevel(hwAlarmLevel)); + } + + /** + * 修改报警级别 + */ + @RequiresPermissions("business:alarmLevel:edit") + @Log(title = "报警级别", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody HwAlarmLevel hwAlarmLevel) + { + return toAjax(hwAlarmLevelService.updateHwAlarmLevel(hwAlarmLevel)); + } + + /** + * 删除报警级别 + */ + @RequiresPermissions("business:alarmLevel:remove") + @Log(title = "报警级别", businessType = BusinessType.DELETE) + @DeleteMapping("/{alarmLevelId}") + public AjaxResult remove(@PathVariable Long alarmLevelId) + { + return toAjax(hwAlarmLevelService.deleteHwAlarmLevelByAlarmLevelId(alarmLevelId)); + } + + @RequiresPermissions("business:alarmLevel:list") + @GetMapping("/getScenes") + public AjaxResult getScenes(HwScene scene) { + return success(hwSceneService.selectHwSceneList(scene)); + } + + @RequiresPermissions("business:alarmLevel:list") + @GetMapping("/getEditedScenes") + public AjaxResult getEditedScenes(HwScene scene) { + return success(hwSceneService.selectHwSceneList4Select(scene)); + } + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmRuleController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmRuleController.java index 3447106..754900d 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmRuleController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmRuleController.java @@ -58,7 +58,7 @@ public class HwAlarmRuleController extends BaseController { @GetMapping("/list") public TableDataInfo list(HwAlarmRule hwAlarmRule) { startPage(); - List list = hwAlarmRuleService.selectHwAlarmRuleList(hwAlarmRule); + List list = hwAlarmRuleService.selectHwAlarmRuleJoinList(hwAlarmRule); return getDataTable(list); } @@ -69,7 +69,7 @@ public class HwAlarmRuleController extends BaseController { @Log(title = "报警规则", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HwAlarmRule hwAlarmRule) { - List list = hwAlarmRuleService.selectHwAlarmRuleList(hwAlarmRule); + List list = hwAlarmRuleService.selectHwAlarmRuleJoinList(hwAlarmRule); ExcelUtil util = new ExcelUtil(HwAlarmRule.class); util.exportExcel(response, list, "报警规则数据"); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmTypeController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmTypeController.java new file mode 100644 index 0000000..4f028f4 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwAlarmTypeController.java @@ -0,0 +1,124 @@ +package com.ruoyi.business.controller; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.business.domain.HwScene; +import com.ruoyi.business.service.IHwSceneService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.business.domain.HwAlarmType; +import com.ruoyi.business.service.IHwAlarmTypeService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.page.TableDataInfo; + +/** + * 报警类型Controller + * + * @author xins + * @date 2023-09-15 + */ +@RestController +@RequestMapping("/alarmType") +public class HwAlarmTypeController extends BaseController +{ + @Autowired + private IHwAlarmTypeService hwAlarmTypeService; + + @Autowired + private IHwSceneService hwSceneService; + + /** + * 查询报警类型列表 + */ + @RequiresPermissions("business:alarmType:list") + @GetMapping("/list") + public TableDataInfo list(HwAlarmType hwAlarmType) + { + startPage(); + List list = hwAlarmTypeService.selectHwAlarmTypeJoinList(hwAlarmType); + return getDataTable(list); + } + + /** + * 导出报警类型列表 + */ + @RequiresPermissions("business:alarmType:export") + @Log(title = "报警类型", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, HwAlarmType hwAlarmType) + { + List list = hwAlarmTypeService.selectHwAlarmTypeJoinList(hwAlarmType); + ExcelUtil util = new ExcelUtil(HwAlarmType.class); + util.exportExcel(response, list, "报警类型数据"); + } + + /** + * 获取报警类型详细信息 + */ + @RequiresPermissions("business:alarmType:query") + @GetMapping(value = "/{alarmTypeId}") + public AjaxResult getInfo(@PathVariable("alarmTypeId") Long alarmTypeId) + { + return success(hwAlarmTypeService.selectHwAlarmTypeByAlarmTypeId(alarmTypeId)); + } + + /** + * 新增报警类型 + */ + @RequiresPermissions("business:alarmType:add") + @Log(title = "报警类型", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody HwAlarmType hwAlarmType) + { + return toAjax(hwAlarmTypeService.insertHwAlarmType(hwAlarmType)); + } + + /** + * 修改报警类型 + */ + @RequiresPermissions("business:alarmType:edit") + @Log(title = "报警类型", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody HwAlarmType hwAlarmType) + { + return toAjax(hwAlarmTypeService.updateHwAlarmType(hwAlarmType)); + } + + /** + * 删除报警类型 + */ + @RequiresPermissions("business:alarmType:remove") + @Log(title = "报警类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{alarmTypeId}") + public AjaxResult remove(@PathVariable Long alarmTypeId) + { + return toAjax(hwAlarmTypeService.deleteHwAlarmTypeByAlarmTypeId(alarmTypeId)); + } + + @RequiresPermissions("business:alarmType:list") + @GetMapping("/getScenes") + public AjaxResult getScenes(HwScene scene) { + return success(hwSceneService.selectHwSceneList(scene)); + } + + @RequiresPermissions("business:alarmType:list") + @GetMapping("/getEditedScenes") + public AjaxResult getEditedScenes(HwScene scene) { + return success(hwSceneService.selectHwSceneList4Select(scene)); + } + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmLevel.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmLevel.java index a7d11b9..58f2eb8 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmLevel.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmLevel.java @@ -16,6 +16,7 @@ public class HwAlarmLevel extends BaseEntity private static final long serialVersionUID = 1L; /** 报警级别ID */ + @Excel(name = "报警级别ID") private Long alarmLevelId; /** 报警级别名称 */ @@ -23,37 +24,39 @@ public class HwAlarmLevel extends BaseEntity private String alarmLevelName; /** 租户ID,关联hw_tenant的tenant_id */ - @Excel(name = "租户ID,关联hw_tenant的tenant_id") + @Excel(name = "租户ID") private Long tenantId; /** 所属场景,关联hw_scene表的scene_id字段 */ - @Excel(name = "所属场景,关联hw_scene表的scene_id字段") + @Excel(name = "所属场景ID") private Long sceneId; /** 语言code,关联表hw_language的language_code字段 */ - @Excel(name = "语言code,关联表hw_language的language_code字段") private String languageCode; /** 通用标识(1:是,0:否) */ - @Excel(name = "通用标识", readConverterExp = "1=:是,0:否") private String commonFlag; /** 严重程度(数字越大,级别越高) */ - @Excel(name = "严重程度", readConverterExp = "数=字越大,级别越高") + @Excel(name = "严重程度") private Long levelNumber; /** 状态(1、正常,9、删除) */ - @Excel(name = "状态", readConverterExp = "1=、正常,9、删除") private String levelStatus; /** 默认通知方式(1、邮箱,2、短信,3、钉钉,4、微信公众号,5、企业微信),多个保存用,隔开。 */ - @Excel(name = "默认通知方式", readConverterExp = "1=、邮箱,2、短信,3、钉钉,4、微信公众号,5、企业微信") + //@Excel(name = "默认通知方式", readConverterExp = "1=、邮箱,2、短信,3、钉钉,4、微信公众号,5、企业微信") private String defaultNotifyMode; /** 预留字段 */ - @Excel(name = "预留字段") private String alarmLevelField; + @Excel(name = "租户名称") + private String tenantName; + + @Excel(name = "场景名称") + private String sceneName; + public void setAlarmLevelId(Long alarmLevelId) { this.alarmLevelId = alarmLevelId; @@ -145,6 +148,22 @@ public class HwAlarmLevel extends BaseEntity return alarmLevelField; } + public String getTenantName() { + return tenantName; + } + + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + + public String getSceneName() { + return sceneName; + } + + public void setSceneName(String sceneName) { + this.sceneName = sceneName; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmType.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmType.java index 61c07c4..a8bc5e6 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmType.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmType.java @@ -16,6 +16,7 @@ public class HwAlarmType extends BaseEntity private static final long serialVersionUID = 1L; /** 报警类型ID */ + @Excel(name = "报警类型ID") private Long alarmTypeId; /** 报警类型名称 */ @@ -23,33 +24,34 @@ public class HwAlarmType extends BaseEntity private String alarmTypeName; /** 租户ID,关联hw_tenant的tenant_id */ - @Excel(name = "租户ID,关联hw_tenant的tenant_id") + @Excel(name = "租户ID") private Long tenantId; /** 所属场景,关联hw_scene表的scene_id字段 */ - @Excel(name = "所属场景,关联hw_scene表的scene_id字段") + @Excel(name = "所属场景ID") private Long sceneId; /** 语言code,关联表hw_language的language_code字段 */ - @Excel(name = "语言code,关联表hw_language的language_code字段") private String languageCode; /** 通用标识(1:是,0:否) */ - @Excel(name = "通用标识", readConverterExp = "1=:是,0:否") private String commonFlag; /** 处理方式(1、云端处理,2:终端上报) */ - @Excel(name = "处理方式", readConverterExp = "1=、云端处理,2:终端上报") private String handleMode; /** 状态(1、正常,9、删除) */ - @Excel(name = "状态", readConverterExp = "1=、正常,9、删除") private String typeStatus; /** 预留字段 */ - @Excel(name = "预留字段") private String alarmTypeField; + @Excel(name = "租户名称") + private String tenantName; + + @Excel(name = "场景名称") + private String sceneName; + public void setAlarmTypeId(Long alarmTypeId) { this.alarmTypeId = alarmTypeId; @@ -132,6 +134,22 @@ public class HwAlarmType extends BaseEntity return alarmTypeField; } + public String getTenantName() { + return tenantName; + } + + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + + public String getSceneName() { + return sceneName; + } + + public void setSceneName(String sceneName) { + this.sceneName = sceneName; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmLevelMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmLevelMapper.java index 900e477..c49ff20 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmLevelMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmLevelMapper.java @@ -58,4 +58,13 @@ public interface HwAlarmLevelMapper * @return 结果 */ public int deleteHwAlarmLevelByAlarmLevelIds(Long[] alarmLevelIds); + + /** + * 查询报警级别列表join + * + * @param hwAlarmLevel 报警级别 + * @return 报警级别集合 + */ + public List selectHwAlarmLevelJoinList(HwAlarmLevel hwAlarmLevel); + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmRuleMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmRuleMapper.java index fb4b659..57a73b2 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmRuleMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmRuleMapper.java @@ -22,6 +22,14 @@ public interface HwAlarmRuleMapper /** * 查询报警规则列表 + * + * @param hwAlarmRule 报警规则 + * @return 报警规则集合 + */ + public List selectHwAlarmRuleList(HwAlarmRule hwAlarmRule); + + /** + * 查询报警规则列表Join * * @param hwAlarmRule 报警规则 * @return 报警规则集合 diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmTypeMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmTypeMapper.java index 6e07a0d..1d63fd1 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmTypeMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmTypeMapper.java @@ -58,4 +58,12 @@ public interface HwAlarmTypeMapper * @return 结果 */ public int deleteHwAlarmTypeByAlarmTypeIds(Long[] alarmTypeIds); + + /** + * 查询报警类型列表join + * + * @param hwAlarmType 报警类型 + * @return 报警类型集合 + */ + public List selectHwAlarmTypeJoinList(HwAlarmType hwAlarmType); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmLevelService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmLevelService.java index 92c673c..e53bf03 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmLevelService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmLevelService.java @@ -21,12 +21,20 @@ public interface IHwAlarmLevelService /** * 查询报警级别列表 - * + * * @param hwAlarmLevel 报警级别 * @return 报警级别集合 */ public List selectHwAlarmLevelList(HwAlarmLevel hwAlarmLevel); + /** + * 查询报警级别列表Join + * + * @param hwAlarmLevel 报警级别 + * @return 报警级别集合 + */ + public List selectHwAlarmLevelJoinList(HwAlarmLevel hwAlarmLevel); + /** * 新增报警级别 * diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmRuleService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmRuleService.java index 06081de..9d9e555 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmRuleService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmRuleService.java @@ -20,13 +20,21 @@ public interface IHwAlarmRuleService public HwAlarmRule selectHwAlarmRuleByAlarmRuleId(Long alarmRuleId); /** - * 查询报警规则列表 - * + * 查询报警规则列表Join + * * @param hwAlarmRule 报警规则 * @return 报警规则集合 */ public List selectHwAlarmRuleList(HwAlarmRule hwAlarmRule); + /** + * 查询报警规则列表Join + * + * @param hwAlarmRule 报警规则 + * @return 报警规则集合 + */ + public List selectHwAlarmRuleJoinList(HwAlarmRule hwAlarmRule); + /** * 新增报警规则 * diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmTypeService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmTypeService.java index 356edeb..023f818 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmTypeService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmTypeService.java @@ -21,12 +21,20 @@ public interface IHwAlarmTypeService /** * 查询报警类型列表 - * + * * @param hwAlarmType 报警类型 * @return 报警类型集合 */ public List selectHwAlarmTypeList(HwAlarmType hwAlarmType); + /** + * 查询报警类型列表Join + * + * @param hwAlarmType 报警类型 + * @return 报警类型集合 + */ + public List selectHwAlarmTypeJoinList(HwAlarmType hwAlarmType); + /** * 新增报警类型 * diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmLevelServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmLevelServiceImpl.java index e0cbb07..a69172a 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmLevelServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmLevelServiceImpl.java @@ -1,7 +1,14 @@ package com.ruoyi.business.service.impl; import java.util.List; + +import com.ruoyi.business.domain.HwAlarmRule; +import com.ruoyi.business.mapper.HwAlarmRuleMapper; +import com.ruoyi.common.core.constant.HwDictConstants; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.datascope.annotation.DataScope; +import com.ruoyi.common.security.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.business.mapper.HwAlarmLevelMapper; @@ -10,87 +17,109 @@ import com.ruoyi.business.service.IHwAlarmLevelService; /** * 报警级别Service业务层处理 - * + * * @author xins * @date 2023-09-15 */ @Service -public class HwAlarmLevelServiceImpl implements IHwAlarmLevelService -{ +public class HwAlarmLevelServiceImpl implements IHwAlarmLevelService { @Autowired private HwAlarmLevelMapper hwAlarmLevelMapper; + @Autowired + private HwAlarmRuleMapper hwAlarmRuleMapper; + /** * 查询报警级别 - * + * * @param alarmLevelId 报警级别主键 * @return 报警级别 */ @Override - public HwAlarmLevel selectHwAlarmLevelByAlarmLevelId(Long alarmLevelId) - { + public HwAlarmLevel selectHwAlarmLevelByAlarmLevelId(Long alarmLevelId) { return hwAlarmLevelMapper.selectHwAlarmLevelByAlarmLevelId(alarmLevelId); } /** * 查询报警级别列表 - * + * * @param hwAlarmLevel 报警级别 * @return 报警级别 */ @Override - public List selectHwAlarmLevelList(HwAlarmLevel hwAlarmLevel) - { + @DataScope(tenantAlias = "hal") + public List selectHwAlarmLevelList(HwAlarmLevel hwAlarmLevel) { return hwAlarmLevelMapper.selectHwAlarmLevelList(hwAlarmLevel); } + + /** + * 查询报警级别列表 + * + * @param hwAlarmLevel 报警级别 + * @return 报警级别 + */ + @Override + @DataScope(tenantAlias = "hal") + public List selectHwAlarmLevelJoinList(HwAlarmLevel hwAlarmLevel) { + return hwAlarmLevelMapper.selectHwAlarmLevelJoinList(hwAlarmLevel); + } + /** * 新增报警级别 - * + * * @param hwAlarmLevel 报警级别 * @return 结果 */ @Override - public int insertHwAlarmLevel(HwAlarmLevel hwAlarmLevel) - { + public int insertHwAlarmLevel(HwAlarmLevel hwAlarmLevel) { hwAlarmLevel.setCreateTime(DateUtils.getNowDate()); + hwAlarmLevel.setTenantId(SecurityUtils.getTenantId()); + hwAlarmLevel.setCreateBy(SecurityUtils.getUsername()); + hwAlarmLevel.setCommonFlag(HwDictConstants.ALARM_LEVEL_COMMON_FLAG_NO); + return hwAlarmLevelMapper.insertHwAlarmLevel(hwAlarmLevel); } /** * 修改报警级别 - * + * * @param hwAlarmLevel 报警级别 * @return 结果 */ @Override - public int updateHwAlarmLevel(HwAlarmLevel hwAlarmLevel) - { + public int updateHwAlarmLevel(HwAlarmLevel hwAlarmLevel) { hwAlarmLevel.setUpdateTime(DateUtils.getNowDate()); + hwAlarmLevel.setUpdateBy(SecurityUtils.getUsername()); return hwAlarmLevelMapper.updateHwAlarmLevel(hwAlarmLevel); } /** * 批量删除报警级别 - * + * * @param alarmLevelIds 需要删除的报警级别主键 * @return 结果 */ @Override - public int deleteHwAlarmLevelByAlarmLevelIds(Long[] alarmLevelIds) - { + public int deleteHwAlarmLevelByAlarmLevelIds(Long[] alarmLevelIds) { + return hwAlarmLevelMapper.deleteHwAlarmLevelByAlarmLevelIds(alarmLevelIds); } /** * 删除报警级别信息 - * + * * @param alarmLevelId 报警级别主键 * @return 结果 */ @Override - public int deleteHwAlarmLevelByAlarmLevelId(Long alarmLevelId) - { + public int deleteHwAlarmLevelByAlarmLevelId(Long alarmLevelId) { + HwAlarmRule queryAlarmRule = new HwAlarmRule(); + queryAlarmRule.setAlarmLevelId(alarmLevelId); + List alarmRuleList = hwAlarmRuleMapper.selectHwAlarmRuleList(queryAlarmRule); + if (alarmRuleList != null && !alarmRuleList.isEmpty()) { + throw new ServiceException("已有设备报警规则关联,不能删除!"); + } return hwAlarmLevelMapper.deleteHwAlarmLevelByAlarmLevelId(alarmLevelId); } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java index a12ebb9..30be5cc 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java @@ -82,6 +82,7 @@ public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService { return alarmRule; } + /** * 查询报警规则列表 * @@ -91,6 +92,18 @@ public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService { @Override @DataScope(tenantAlias = "har") public List selectHwAlarmRuleList(HwAlarmRule hwAlarmRule) { + return hwAlarmRuleMapper.selectHwAlarmRuleList(hwAlarmRule); + } + + /** + * 查询报警规则列表 + * + * @param hwAlarmRule 报警规则 + * @return 报警规则 + */ + @Override + @DataScope(tenantAlias = "har") + public List selectHwAlarmRuleJoinList(HwAlarmRule hwAlarmRule) { hwAlarmRule.setRuleType(HwDictConstants.ALARM_RULE_RULE_TYPE_DEVICE); return hwAlarmRuleMapper.selectHwAlarmRuleJoinList(hwAlarmRule); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmTypeServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmTypeServiceImpl.java index 145303b..13b72ee 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmTypeServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmTypeServiceImpl.java @@ -1,96 +1,123 @@ package com.ruoyi.business.service.impl; -import java.util.List; +import com.ruoyi.business.domain.HwAlarmRule; +import com.ruoyi.business.domain.HwAlarmType; +import com.ruoyi.business.mapper.HwAlarmRuleMapper; +import com.ruoyi.business.mapper.HwAlarmTypeMapper; +import com.ruoyi.business.service.IHwAlarmTypeService; +import com.ruoyi.common.core.constant.HwDictConstants; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.datascope.annotation.DataScope; +import com.ruoyi.common.security.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.business.mapper.HwAlarmTypeMapper; -import com.ruoyi.business.domain.HwAlarmType; -import com.ruoyi.business.service.IHwAlarmTypeService; + +import java.util.List; /** * 报警类型Service业务层处理 - * + * * @author xins * @date 2023-09-15 */ @Service -public class HwAlarmTypeServiceImpl implements IHwAlarmTypeService -{ +public class HwAlarmTypeServiceImpl implements IHwAlarmTypeService { @Autowired private HwAlarmTypeMapper hwAlarmTypeMapper; + @Autowired + private HwAlarmRuleMapper hwAlarmRuleMapper; + /** * 查询报警类型 - * + * * @param alarmTypeId 报警类型主键 * @return 报警类型 */ @Override - public HwAlarmType selectHwAlarmTypeByAlarmTypeId(Long alarmTypeId) - { + public HwAlarmType selectHwAlarmTypeByAlarmTypeId(Long alarmTypeId) { return hwAlarmTypeMapper.selectHwAlarmTypeByAlarmTypeId(alarmTypeId); } /** * 查询报警类型列表 - * + * * @param hwAlarmType 报警类型 * @return 报警类型 */ @Override - public List selectHwAlarmTypeList(HwAlarmType hwAlarmType) - { + @DataScope(tenantAlias = "hat") + public List selectHwAlarmTypeList(HwAlarmType hwAlarmType) { return hwAlarmTypeMapper.selectHwAlarmTypeList(hwAlarmType); } + /** + * 查询报警类型列表Join + * + * @param hwAlarmType 报警类型 + * @return 报警类型 + */ + @Override + @DataScope(tenantAlias = "hat") + public List selectHwAlarmTypeJoinList(HwAlarmType hwAlarmType) { + return hwAlarmTypeMapper.selectHwAlarmTypeJoinList(hwAlarmType); + } + /** * 新增报警类型 - * + * * @param hwAlarmType 报警类型 * @return 结果 */ @Override - public int insertHwAlarmType(HwAlarmType hwAlarmType) - { + public int insertHwAlarmType(HwAlarmType hwAlarmType) { hwAlarmType.setCreateTime(DateUtils.getNowDate()); + hwAlarmType.setCreateBy(SecurityUtils.getUsername()); + hwAlarmType.setTenantId(SecurityUtils.getTenantId()); + hwAlarmType.setCommonFlag(HwDictConstants.ALARM_TYPE_COMMON_FLAG_NO); + return hwAlarmTypeMapper.insertHwAlarmType(hwAlarmType); } /** * 修改报警类型 - * + * * @param hwAlarmType 报警类型 * @return 结果 */ @Override - public int updateHwAlarmType(HwAlarmType hwAlarmType) - { + public int updateHwAlarmType(HwAlarmType hwAlarmType) { hwAlarmType.setUpdateTime(DateUtils.getNowDate()); + hwAlarmType.setUpdateBy(SecurityUtils.getUsername()); return hwAlarmTypeMapper.updateHwAlarmType(hwAlarmType); } /** * 批量删除报警类型 - * + * * @param alarmTypeIds 需要删除的报警类型主键 * @return 结果 */ @Override - public int deleteHwAlarmTypeByAlarmTypeIds(Long[] alarmTypeIds) - { + public int deleteHwAlarmTypeByAlarmTypeIds(Long[] alarmTypeIds) { return hwAlarmTypeMapper.deleteHwAlarmTypeByAlarmTypeIds(alarmTypeIds); } /** * 删除报警类型信息 - * + * * @param alarmTypeId 报警类型主键 * @return 结果 */ @Override - public int deleteHwAlarmTypeByAlarmTypeId(Long alarmTypeId) - { + public int deleteHwAlarmTypeByAlarmTypeId(Long alarmTypeId) { + HwAlarmRule queryAlarmRule = new HwAlarmRule(); + queryAlarmRule.setAlarmTypeId(alarmTypeId); + List alarmRuleList = hwAlarmRuleMapper.selectHwAlarmRuleList(queryAlarmRule); + if (alarmRuleList != null && !alarmRuleList.isEmpty()) { + throw new ServiceException("已有设备报警规则关联,不能删除!"); + } return hwAlarmTypeMapper.deleteHwAlarmTypeByAlarmTypeId(alarmTypeId); } } diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmLevelMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmLevelMapper.xml index 8f7ccd7..7bf990c 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmLevelMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmLevelMapper.xml @@ -20,10 +20,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - select alarm_level_id, alarm_level_name, tenant_id, scene_id, language_code, common_flag, level_number, level_status, default_notify_mode, remark, create_by, create_time, update_by, update_time, alarm_level_field from hw_alarm_level + select alarm_level_id, alarm_level_name, tenant_id, scene_id, language_code, common_flag, level_number, level_status, default_notify_mode, remark, create_by, create_time, update_by, update_time, alarm_level_field from hw_alarm_level hal + select hal.alarm_level_id,hal.alarm_level_name,hal.tenant_id,hal.scene_id,hal.level_number, + ht.tenant_name,hs.scene_name + from hw_alarm_level hal + left join hw_tenant ht on hal.tenant_id = ht.tenant_id + left join hw_scene hs on hal.scene_id=hs.scene_id + + hal.level_status!='9' + and hal.alarm_level_name like concat('%', #{alarmLevelName}, '%') + and hal.tenant_id = #{tenantId} + and hal.scene_id = #{sceneId} + and hal.language_code = #{languageCode} + and hal.common_flag = #{commonFlag} + and hal.level_number = #{levelNumber} + and hal.level_status = #{levelStatus} + and hal.default_notify_mode = #{defaultNotifyMode} + + ${params.tenantDataScope} + + order by hal.scene_id,hal.level_number + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmRuleMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmRuleMapper.xml index 6f8b592..8ab27df 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmRuleMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmRuleMapper.xml @@ -51,9 +51,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select alarm_rule_id, alarm_rule_name, tenant_id, scene_id, language_code, alarm_level_id, alarm_type_id, rule_type, rule_device_id, rule_function_total, trigger_expression, link_flag, alarm_rule_status, alarm_push_flag, alarm_push_content, alarm_recover_content, remark, create_by, create_time, update_by, update_time, alarm_rule_field from hw_alarm_rule + select alarm_rule_id, alarm_rule_name, tenant_id, scene_id, language_code, alarm_level_id, alarm_type_id, rule_type, rule_device_id, rule_function_total, trigger_expression, link_flag, alarm_rule_status, alarm_push_flag, alarm_push_content, alarm_recover_content, remark, create_by, create_time, update_by, update_time, alarm_rule_field from hw_alarm_rule har + + + select hat.alarm_type_id, hat.alarm_type_name,hat.tenant_id,hat.scene_id, + ht.tenant_name,hs.scene_name + from hw_alarm_type hat + left join hw_tenant ht on hat.tenant_id = ht.tenant_id + left join hw_scene hs on hat.scene_id=hs.scene_id + + hat.type_status!='9' + and hat.alarm_type_name like concat('%', #{alarmTypeName}, '%') + and hat.tenant_id = #{tenantId} + and hat.scene_id = #{sceneId} + and hat.language_code = #{languageCode} + and hat.common_flag = #{commonFlag} + and hat.handle_mode = #{handleMode} + and hat.type_status = #{typeStatus} + + ${params.tenantDataScope} + + order by hat.scene_id,hat.alarm_type_id desc + + \ No newline at end of file diff --git a/ruoyi-ui/src/api/business/alarmLevel.js b/ruoyi-ui/src/api/business/alarmLevel.js new file mode 100644 index 0000000..9b3870b --- /dev/null +++ b/ruoyi-ui/src/api/business/alarmLevel.js @@ -0,0 +1,63 @@ +import request from '@/utils/request' + +// 查询报警级别列表 +export function listAlarmLevel(query) { + return request({ + url: '/business/alarmLevel/list', + method: 'get', + params: query + }) +} + +// 查询报警级别详细 +export function getAlarmLevel(alarmLevelId) { + return request({ + url: '/business/alarmLevel/' + alarmLevelId, + method: 'get' + }) +} + +// 新增报警级别 +export function addAlarmLevel(data) { + return request({ + url: '/business/alarmLevel', + method: 'post', + data: data + }) +} + +// 修改报警级别 +export function updateAlarmLevel(data) { + return request({ + url: '/business/alarmLevel', + method: 'put', + data: data + }) +} + +// 删除报警级别 +export function delAlarmLevel(alarmLevelId) { + return request({ + url: '/business/alarmLevel/' + alarmLevelId, + method: 'delete' + }) +} + + +// 查询场景信息列表供查询页面选择使用(例如下拉列表) +export function getScenes(query) { + return request({ + url: '/business/alarmLevel/getScenes', + method: 'get', + params: query + }) +} + +// 查询场景信息列表供编辑页面选择使用(例如下拉列表) +export function getEditedScenes(query) { + return request({ + url: '/business/alarmLevel/getEditedScenes', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/api/business/alarmType.js b/ruoyi-ui/src/api/business/alarmType.js new file mode 100644 index 0000000..4659136 --- /dev/null +++ b/ruoyi-ui/src/api/business/alarmType.js @@ -0,0 +1,63 @@ +import request from '@/utils/request' + +// 查询报警类型列表 +export function listAlarmType(query) { + return request({ + url: '/business/alarmType/list', + method: 'get', + params: query + }) +} + +// 查询报警类型详细 +export function getAlarmType(alarmTypeId) { + return request({ + url: '/business/alarmType/' + alarmTypeId, + method: 'get' + }) +} + +// 新增报警类型 +export function addAlarmType(data) { + return request({ + url: '/business/alarmType', + method: 'post', + data: data + }) +} + +// 修改报警类型 +export function updateAlarmType(data) { + return request({ + url: '/business/alarmType', + method: 'put', + data: data + }) +} + +// 删除报警类型 +export function delAlarmType(alarmTypeId) { + return request({ + url: '/business/alarmType/' + alarmTypeId, + method: 'delete' + }) +} + + +// 查询场景信息列表供查询页面选择使用(例如下拉列表) +export function getScenes(query) { + return request({ + url: '/business/alarmType/getScenes', + method: 'get', + params: query + }) +} + +// 查询场景信息列表供编辑页面选择使用(例如下拉列表) +export function getEditedScenes(query) { + return request({ + url: '/business/alarmType/getEditedScenes', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/views/business/alarmLevel/index.vue b/ruoyi-ui/src/views/business/alarmLevel/index.vue new file mode 100644 index 0000000..56b190f --- /dev/null +++ b/ruoyi-ui/src/views/business/alarmLevel/index.vue @@ -0,0 +1,330 @@ + + + diff --git a/ruoyi-ui/src/views/business/alarmRule/index.vue b/ruoyi-ui/src/views/business/alarmRule/index.vue index 412fc97..b0f8d19 100644 --- a/ruoyi-ui/src/views/business/alarmRule/index.vue +++ b/ruoyi-ui/src/views/business/alarmRule/index.vue @@ -192,7 +192,7 @@ j + :disabled="sceneDisabled"> +
+ + + + + + + + + + + 搜索 + 重置 + + + + + + 新增 + + + 修改 + + + 导出 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +