Commit 79c919f9 authored by 赵啸非's avatar 赵啸非

告警内容修改

parent 517e7875
......@@ -154,7 +154,6 @@ PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备模块使用频率';
-- ----------------------------
-- 设备告警配置表
-- ----------------------------
......@@ -165,7 +164,7 @@ CREATE TABLE mortals_xhx_alarm_config(
`alarmType` tinyint(2) NOT NULL COMMENT '告警类型(0.离线)',
`alarmLevel` tinyint(2) NOT NULL COMMENT '告警级别,(0.危险,1.次要,2.一般)',
`alarmPusW1ay` tinyint(2) NOT NULL COMMENT '推送方式,(0.不推送,1.短信)',
`isUse` tinyint(2) NOT NULL COMMENT '是否启用(0.不启动,1.启动)',
`enabled` tinyint(2) NOT NULL COMMENT '是否启用(0.不启用,1.启用)',
`remark` varchar(2048) COMMENT '备注',
`createTime` datetime NOT NULL COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
......@@ -175,6 +174,8 @@ PRIMARY KEY (`id`)
-- ----------------------------
-- 短信发送记录表
-- ----------------------------
......
......@@ -29,13 +29,28 @@
},
/** 重写编辑方法 */
toEdit(row) {
this.$refs.dialogform.edit(row);
this.$refs.drawerform.edit(row);
},
/** 重写查看方法 */
// toView(row) {
// this.$refs.dialogform.view(row);
// },
// 操作菜单状态
changeStatus(row, column) {
return (
<device-switch
confirm
url="/alarm/config/save"
row={row}
onChange={this.statusChange}
value={this.tableData.data}
onInput={(data) => {
this.tableData.data = data;
}}
/>
);
},
},
data() {
......@@ -46,15 +61,25 @@
columns: [
{type: "selection", width: 60},
{label: "产品", prop: "productId", formatter: this.formatterString},
{label: "序号",type: "index", width: 60},
{label: "告警内容", prop: "alarmType",formatter: this.formatter},
{label: "设备类型", prop: "productId", formatter: this.formatterString},
{label: "告警类型", prop: "alarmType",formatter: this.formatter},
{label: "告警级别", prop: "alarmLevel",formatter: this.formatter},
{label: "推送方式", prop: "alarmPusW1ay",formatter: this.formatter},
{label: "备注", prop: "remark"},
{label: "告警级别,", prop: "alarmLevel",formatter: this.formatter},
{label: "创建时间", prop: "createTime",formatter:this.formatterDate},
{label: "更新时间", prop: "updateTime",formatter:this.formatterDate},
{
prop: "enabled",
label: "启用/停用",
width: 100,
formatter: this.changeStatus,
},
{label: "推送方式,", prop: "alarmPusW1ay",formatter: this.formatter},
{label: "是否启用", prop: "isUse",formatter: this.formatter},
{
label: "操作",
width: 240,
......
......@@ -33,9 +33,9 @@ public class AlarmConfigEntity extends AlarmConfigVo {
*/
private Integer alarmPusW1ay;
/**
* 是否启用(0.不启动,1.启动)
* 是否启用(0.不启用,1.启用)
*/
private Integer isUse;
private Integer enabled;
/**
* 备注
*/
......@@ -101,18 +101,18 @@ public class AlarmConfigEntity extends AlarmConfigVo {
this.alarmPusW1ay = alarmPusW1ay;
}
/**
* 获取 是否启用(0.不启动,1.启动)
* 获取 是否启用(0.不启用,1.启用)
* @return Integer
*/
public Integer getIsUse(){
return isUse;
public Integer getEnabled(){
return enabled;
}
/**
* 设置 是否启用(0.不启动,1.启动)
* @param isUse
* 设置 是否启用(0.不启用,1.启用)
* @param enabled
*/
public void setIsUse(Integer isUse){
this.isUse = isUse;
public void setEnabled(Integer enabled){
this.enabled = enabled;
}
/**
* 获取 备注
......@@ -154,7 +154,7 @@ public class AlarmConfigEntity extends AlarmConfigVo {
sb.append(",alarmType:").append(getAlarmType());
sb.append(",alarmLevel:").append(getAlarmLevel());
sb.append(",alarmPusW1ay:").append(getAlarmPusW1ay());
sb.append(",isUse:").append(getIsUse());
sb.append(",enabled:").append(getEnabled());
sb.append(",remark:").append(getRemark());
return sb.toString();
}
......@@ -165,11 +165,11 @@ public class AlarmConfigEntity extends AlarmConfigVo {
this.alarmType = 0;
this.alarmLevel = null;
this.alarmLevel = 2;
this.alarmPusW1ay = 0;
this.isUse = null;
this.enabled = 1;
this.remark = "";
}
......
......@@ -69,17 +69,17 @@ public class AlarmConfigQuery extends AlarmConfigEntity {
/** 推送方式,(0.不推送,1.短信)列表 */
private List <Integer> alarmPusW1ayList;
/** 开始 是否启用(0.不启动,1.启动) */
private Integer isUseStart;
/** 开始 是否启用(0.不启用,1.启用) */
private Integer enabledStart;
/** 结束 是否启用(0.不启动,1.启动) */
private Integer isUseEnd;
/** 结束 是否启用(0.不启用,1.启用) */
private Integer enabledEnd;
/** 增加 是否启用(0.不启动,1.启动) */
private Integer isUseIncrement;
/** 增加 是否启用(0.不启用,1.启用) */
private Integer enabledIncrement;
/** 是否启用(0.不启动,1.启动)列表 */
private List <Integer> isUseList;
/** 是否启用(0.不启用,1.启用)列表 */
private List <Integer> enabledList;
/** 备注 */
private List<String> remarkList;
......@@ -437,67 +437,67 @@ public class AlarmConfigQuery extends AlarmConfigEntity {
}
/**
* 获取 开始 是否启用(0.不启动,1.启动)
* @return isUseStart
* 获取 开始 是否启用(0.不启用,1.启用)
* @return enabledStart
*/
public Integer getIsUseStart(){
return this.isUseStart;
public Integer getEnabledStart(){
return this.enabledStart;
}
/**
* 设置 开始 是否启用(0.不启动,1.启动)
* @param isUseStart
* 设置 开始 是否启用(0.不启用,1.启用)
* @param enabledStart
*/
public void setIsUseStart(Integer isUseStart){
this.isUseStart = isUseStart;
public void setEnabledStart(Integer enabledStart){
this.enabledStart = enabledStart;
}
/**
* 获取 结束 是否启用(0.不启动,1.启动)
* @return $isUseEnd
* 获取 结束 是否启用(0.不启用,1.启用)
* @return $enabledEnd
*/
public Integer getIsUseEnd(){
return this.isUseEnd;
public Integer getEnabledEnd(){
return this.enabledEnd;
}
/**
* 设置 结束 是否启用(0.不启动,1.启动)
* @param isUseEnd
* 设置 结束 是否启用(0.不启用,1.启用)
* @param enabledEnd
*/
public void setIsUseEnd(Integer isUseEnd){
this.isUseEnd = isUseEnd;
public void setEnabledEnd(Integer enabledEnd){
this.enabledEnd = enabledEnd;
}
/**
* 获取 增加 是否启用(0.不启动,1.启动)
* @return isUseIncrement
* 获取 增加 是否启用(0.不启用,1.启用)
* @return enabledIncrement
*/
public Integer getIsUseIncrement(){
return this.isUseIncrement;
public Integer getEnabledIncrement(){
return this.enabledIncrement;
}
/**
* 设置 增加 是否启用(0.不启动,1.启动)
* @param isUseIncrement
* 设置 增加 是否启用(0.不启用,1.启用)
* @param enabledIncrement
*/
public void setIsUseIncrement(Integer isUseIncrement){
this.isUseIncrement = isUseIncrement;
public void setEnabledIncrement(Integer enabledIncrement){
this.enabledIncrement = enabledIncrement;
}
/**
* 获取 是否启用(0.不启动,1.启动)
* @return isUseList
* 获取 是否启用(0.不启用,1.启用)
* @return enabledList
*/
public List<Integer> getIsUseList(){
return this.isUseList;
public List<Integer> getEnabledList(){
return this.enabledList;
}
/**
* 设置 是否启用(0.不启动,1.启动)
* @param isUseList
* 设置 是否启用(0.不启用,1.启用)
* @param enabledList
*/
public void setIsUseList(List<Integer> isUseList){
this.isUseList = isUseList;
public void setEnabledList(List<Integer> enabledList){
this.enabledList = enabledList;
}
/**
......@@ -869,47 +869,47 @@ public class AlarmConfigQuery extends AlarmConfigEntity {
}
/**
* 设置 是否启用(0.不启动,1.启动)
* @param isUse
* 设置 是否启用(0.不启用,1.启用)
* @param enabled
*/
public AlarmConfigQuery isUse(Integer isUse){
setIsUse(isUse);
public AlarmConfigQuery enabled(Integer enabled){
setEnabled(enabled);
return this;
}
/**
* 设置 开始 是否启用(0.不启动,1.启动)
* @param isUseStart
* 设置 开始 是否启用(0.不启用,1.启用)
* @param enabledStart
*/
public AlarmConfigQuery isUseStart(Integer isUseStart){
this.isUseStart = isUseStart;
public AlarmConfigQuery enabledStart(Integer enabledStart){
this.enabledStart = enabledStart;
return this;
}
/**
* 设置 结束 是否启用(0.不启动,1.启动)
* @param isUseEnd
* 设置 结束 是否启用(0.不启用,1.启用)
* @param enabledEnd
*/
public AlarmConfigQuery isUseEnd(Integer isUseEnd){
this.isUseEnd = isUseEnd;
public AlarmConfigQuery enabledEnd(Integer enabledEnd){
this.enabledEnd = enabledEnd;
return this;
}
/**
* 设置 增加 是否启用(0.不启动,1.启动)
* @param isUseIncrement
* 设置 增加 是否启用(0.不启用,1.启用)
* @param enabledIncrement
*/
public AlarmConfigQuery isUseIncrement(Integer isUseIncrement){
this.isUseIncrement = isUseIncrement;
public AlarmConfigQuery enabledIncrement(Integer enabledIncrement){
this.enabledIncrement = enabledIncrement;
return this;
}
/**
* 设置 是否启用(0.不启动,1.启动)
* @param isUseList
* 设置 是否启用(0.不启用,1.启用)
* @param enabledList
*/
public AlarmConfigQuery isUseList(List<Integer> isUseList){
this.isUseList = isUseList;
public AlarmConfigQuery enabledList(List<Integer> enabledList){
this.enabledList = enabledList;
return this;
}
......
package com.mortals.xhx.module.alarm.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.alarm.model.AlarmConfigQuery;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.alarm.dao.AlarmConfigDao;
import com.mortals.xhx.module.alarm.model.AlarmConfigEntity;
import com.mortals.xhx.module.alarm.service.AlarmConfigService;
import org.springframework.util.ObjectUtils;
/**
* AlarmConfigService
* 设备告警配置 service实现
......@@ -13,5 +18,25 @@ import com.mortals.xhx.module.alarm.service.AlarmConfigService;
*/
@Service("alarmConfigService")
public class AlarmConfigServiceImpl extends AbstractCRUDServiceImpl<AlarmConfigDao, AlarmConfigEntity, Long> implements AlarmConfigService {
@Override
protected void saveBefore(AlarmConfigEntity entity, Context context) throws AppException {
//校验产品是否已经存在配置
AlarmConfigEntity alarmConfigEntity = this.selectOne(new AlarmConfigQuery().productId(entity.getProductId()));
if(!ObjectUtils.isEmpty(alarmConfigEntity)){
throw new AppException("当前产品已存在告警配置!");
}
super.saveBefore(entity, context);
}
@Override
protected void updateBefore(AlarmConfigEntity entity, Context context) throws AppException {
//校验
AlarmConfigEntity alarmConfigEntity = this.selectOne(new AlarmConfigQuery().productId(entity.getProductId()));
if(!ObjectUtils.isEmpty(alarmConfigEntity)&&entity.getId()!=alarmConfigEntity.getId()){
entity.setId(alarmConfigEntity.getId());
}
super.updateBefore(entity, context);
}
}
\ No newline at end of file
......@@ -39,8 +39,7 @@ public class AlarmConfigController extends BaseCRUDJsonBodyMappingController<Ala
this.addDict(model, "alarmType", paramService.getParamBySecondOrganize("AlarmConfig","alarmType"));
this.addDict(model, "alarmLevel", paramService.getParamBySecondOrganize("AlarmConfig","alarmLevel"));
this.addDict(model, "alarmPusW1ay", paramService.getParamBySecondOrganize("AlarmConfig","alarmPusW1ay"));
this.addDict(model, "isUse", paramService.getParamBySecondOrganize("AlarmConfig","isUse"));
this.addDict(model, "enabled", paramService.getParamBySecondOrganize("AlarmConfig","isUse"));
this.addDict(model, "productId", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName())));
super.init(model, context);
......
......@@ -10,7 +10,7 @@
<result property="alarmType" column="alarmType" />
<result property="alarmLevel" column="alarmLevel" />
<result property="alarmPusW1ay" column="alarmPusW1ay" />
<result property="isUse" column="isUse" />
<result property="enabled" column="enabled" />
<result property="remark" column="remark" />
<result property="createTime" column="createTime" />
<result property="updateUserId" column="updateUserId" />
......@@ -37,8 +37,8 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('alarmPusW1ay') or colPickMode == 1 and data.containsKey('alarmPusW1ay')))">
a.alarmPusW1ay,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('isUse') or colPickMode == 1 and data.containsKey('isUse')))">
a.isUse,
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('enabled') or colPickMode == 1 and data.containsKey('enabled')))">
a.enabled,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('remark') or colPickMode == 1 and data.containsKey('remark')))">
a.remark,
......@@ -57,18 +57,18 @@
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="AlarmConfigEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_alarm_config
(productId,alarmType,alarmLevel,alarmPusW1ay,isUse,remark,createTime,updateUserId,updateTime)
(productId,alarmType,alarmLevel,alarmPusW1ay,enabled,remark,createTime,updateUserId,updateTime)
VALUES
(#{productId},#{alarmType},#{alarmLevel},#{alarmPusW1ay},#{isUse},#{remark},#{createTime},#{updateUserId},#{updateTime})
(#{productId},#{alarmType},#{alarmLevel},#{alarmPusW1ay},#{enabled},#{remark},#{createTime},#{updateUserId},#{updateTime})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_alarm_config
(productId,alarmType,alarmLevel,alarmPusW1ay,isUse,remark,createTime,updateUserId,updateTime)
(productId,alarmType,alarmLevel,alarmPusW1ay,enabled,remark,createTime,updateUserId,updateTime)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.productId},#{item.alarmType},#{item.alarmLevel},#{item.alarmPusW1ay},#{item.isUse},#{item.remark},#{item.createTime},#{item.updateUserId},#{item.updateTime})
(#{item.productId},#{item.alarmType},#{item.alarmLevel},#{item.alarmPusW1ay},#{item.enabled},#{item.remark},#{item.createTime},#{item.updateUserId},#{item.updateTime})
</foreach>
</insert>
......@@ -102,11 +102,11 @@
<if test="(colPickMode==0 and data.containsKey('alarmPusW1ayIncrement')) or (colPickMode==1 and !data.containsKey('alarmPusW1ayIncrement'))">
a.alarmPusW1ay=ifnull(a.alarmPusW1ay,0) + #{data.alarmPusW1ayIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('isUse')) or (colPickMode==1 and !data.containsKey('isUse'))">
a.isUse=#{data.isUse},
<if test="(colPickMode==0 and data.containsKey('enabled')) or (colPickMode==1 and !data.containsKey('enabled'))">
a.enabled=#{data.enabled},
</if>
<if test="(colPickMode==0 and data.containsKey('isUseIncrement')) or (colPickMode==1 and !data.containsKey('isUseIncrement'))">
a.isUse=ifnull(a.isUse,0) + #{data.isUseIncrement},
<if test="(colPickMode==0 and data.containsKey('enabledIncrement')) or (colPickMode==1 and !data.containsKey('enabledIncrement'))">
a.enabled=ifnull(a.enabled,0) + #{data.enabledIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('remark')) or (colPickMode==1 and !data.containsKey('remark'))">
a.remark=#{data.remark},
......@@ -183,14 +183,14 @@
</choose>
</foreach>
</trim>
<trim prefix="isUse=(case" suffix="ELSE isUse end),">
<trim prefix="enabled=(case" suffix="ELSE enabled end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('isUse')) or (colPickMode==1 and !item.containsKey('isUse'))">
when a.id=#{item.id} then #{item.isUse}
<when test="(colPickMode==0 and item.containsKey('enabled')) or (colPickMode==1 and !item.containsKey('enabled'))">
when a.id=#{item.id} then #{item.enabled}
</when>
<when test="(colPickMode==0 and item.containsKey('isUseIncrement')) or (colPickMode==1 and !item.containsKey('isUseIncrement'))">
when a.id=#{item.id} then ifnull(a.isUse,0) + #{item.isUseIncrement}
<when test="(colPickMode==0 and item.containsKey('enabledIncrement')) or (colPickMode==1 and !item.containsKey('enabledIncrement'))">
when a.id=#{item.id} then ifnull(a.enabled,0) + #{item.enabledIncrement}
</when>
</choose>
</foreach>
......@@ -434,25 +434,25 @@
${_conditionType_} a.alarmPusW1ay <![CDATA[ <= ]]> #{${_conditionParam_}.alarmPusW1ayEnd}
</if>
<if test="conditionParamRef.containsKey('isUse')">
<if test="conditionParamRef.isUse != null ">
${_conditionType_} a.isUse = #{${_conditionParam_}.isUse}
<if test="conditionParamRef.containsKey('enabled')">
<if test="conditionParamRef.enabled != null ">
${_conditionType_} a.enabled = #{${_conditionParam_}.enabled}
</if>
<if test="conditionParamRef.isUse == null">
${_conditionType_} a.isUse is null
<if test="conditionParamRef.enabled == null">
${_conditionType_} a.enabled is null
</if>
</if>
<if test="conditionParamRef.containsKey('isUseList')">
${_conditionType_} a.isUse in
<foreach collection="conditionParamRef.isUseList" open="(" close=")" index="index" item="item" separator=",">
<if test="conditionParamRef.containsKey('enabledList')">
${_conditionType_} a.enabled in
<foreach collection="conditionParamRef.enabledList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('isUseStart') and conditionParamRef.isUseStart != null">
${_conditionType_} a.isUse <![CDATA[ >= ]]> #{${_conditionParam_}.isUseStart}
<if test="conditionParamRef.containsKey('enabledStart') and conditionParamRef.enabledStart != null">
${_conditionType_} a.enabled <![CDATA[ >= ]]> #{${_conditionParam_}.enabledStart}
</if>
<if test="conditionParamRef.containsKey('isUseEnd') and conditionParamRef.isUseEnd != null">
${_conditionType_} a.isUse <![CDATA[ <= ]]> #{${_conditionParam_}.isUseEnd}
<if test="conditionParamRef.containsKey('enabledEnd') and conditionParamRef.enabledEnd != null">
${_conditionType_} a.enabled <![CDATA[ <= ]]> #{${_conditionParam_}.enabledEnd}
</if>
......@@ -559,9 +559,9 @@
<if test='orderCol.alarmPusW1ay != null and "DESC".equalsIgnoreCase(orderCol.alarmPusW1ay)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('isUse')">
a.isUse
<if test='orderCol.isUse != null and "DESC".equalsIgnoreCase(orderCol.isUse)'>DESC</if>
<if test="orderCol.containsKey('enabled')">
a.enabled
<if test='orderCol.enabled != null and "DESC".equalsIgnoreCase(orderCol.enabled)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('remark')">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment