Commit e54da26b authored by wujiang's avatar wujiang

添加离散率告警

parent c02800ae
package com.yeejoin.amos.boot.module.jxiop.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipDic;
public interface EquipDicMapper extends BaseMapper<EquipDic> {
}
......@@ -27,7 +27,7 @@ public class MasterDbConfig {
private Logger logger = LoggerFactory.getLogger(MasterDbConfig.class);
// 精确到 master 目录,以便跟其他数据源隔离
private static final String MAPPER_LOCATION = "classpath*:mapper/*.xml";
private static final String MAPPER_LOCATION = "classpath*:mapper/master/*.xml";
@Value("${spring.db1.datasource.url}")
private String dbUrl;
......
package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("monitor_equip_dic")
public class EquipDic {
@TableId(value = "sequence_nbr", type = IdType.ID_WORKER)
private Long sequenceNumber;
@TableField("value")
Double value;
@TableField("desc")
String desc;
}
package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@Data
@Accessors(chain = true)
@TableName("equip_alarm_event")
public class EquipDivergenceAlarmEvent {
@TableField("created_time")
private Long createdTime;
@TableField("station_name")
private String stationName;
@TableField("station_id")
private String stationId;
@TableField("gateway_id")
private String gatewayId;
@TableField("equip_index")
private String equipIndex;
@TableField("event_desc")
private String eventDesc;
@TableField("equip_name")
private String equipName;
/**
* 分类 逆变器、箱变、汇流箱
*/
@TableField("front_module")
private String frontModule;
@TableField("value")
private String value;
@TableField(exist = false)
private String time;
@TableField("alarm_group_name")
private String alarmGroupName;
}
package com.yeejoin.amos.boot.module.jxiop.biz.scheduled;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl;
@EnableScheduling
public class EquipWarnSchedule {
@Autowired
private MonitorFanIndicatorImpl monitorFanIndicatorImpl;
@Scheduled(cron = "${equip.warn.cron}")
private void doEquipDivergencWarn() {
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdmapper;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.EquipAlarmEventDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipAlarmEvent;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipDivergenceAlarmEvent;
public interface EquipDivergenceAlarmEventMapper extends BaseMapper<EquipDivergenceAlarmEvent> {
void save(List<EquipDivergenceAlarmEvent> list);
List<EquipDivergenceAlarmEvent> getEventList(String gatewayId, String equipName, String frontModule, Date time);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.api.mapper.EquipDicMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.EquipDivergenceAlarmEventMapper">
<select id="getEventList" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipDivergenceAlarmEvent">
SELECT
*
FROM
equip_divergence_alarm_event
<where>
<if test="gatewayId != null and gatewayId != ''">
AND gateway_id = #{gatewayId}
</if>
<if test="equipName!= null and equipName != ''">
AND equip_name LIKE #{equipName}
</if>
<if test="frontModule!= null and frontModule != ''">
AND front_module = #{frontModule}
</if>
AND #{time} &lt;= created_time
</where>
ORDER BY created_time DESC
</select>
<insert id="save">
INSERT INTO
equip_divergence_alarm_event(created_time,staion_name,staion_id,gateway_id,equip_index,event_desc,equip_name,front_module,value,alarm_group_name)
VALUES
<foreach collection="list" item="item" separator=",">
(NOW(),#{item.stationName},#{item.stationId},#{item.gatewayId},#{item.equipIndex},'#{item.eventDesc}','#{item.equipName}',#{item.frontModule},'#{item.value}','#{item.alarmGroupName}')
</foreach>
</insert>
</mapper>
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