Commit f56dffa2 authored by maoying's avatar maoying

修改数据上传保存接口

parent 84608603
......@@ -21,54 +21,67 @@ public class Alarm extends BasicEntity {
/**
* 消防设备id
*/
@Column(name = "fire_equipment_id")
private Long fireEquipmentId;
/**
* 消防设备名称
*/
@Column(name = "fire_equipment_name")
private String fireEquipmentName;
/**
* 消防设备编码
*/
@Column(name = "fire_equipment_code")
private String fireEquipmentCode;
/**
* 消防点位id
*/
@Column(name = "fire_equipment_point_id")
private Long fireEquipmentPointId;
/**
* 消防点位名称
*/
@Column(name = "fire_equipment_point_name")
private String fireEquipmentPointName;
/**
* 消防点位编码
*/
@Column(name = "fire_equipment_point_code")
private String fireEquipmentPointCode;
/**
* 消防点位上传值
*/
@Column(name = "fire_equipment_point_value")
private String fireEquipmentPointValue;
/**
* 发生频率
*/
@Column(name = "frequency")
private int frequency = 1;
/**
* 告警状态
*/
@Column(name = "status")
private Boolean status = true;
/**
* 报警类型:alarm_type_fire(火灾报警)/alarm_type_trouble(故障告警)
*/
@Column(name = "type")
private String type;
/**
* 创建时间
*/
@Column(name = "create_date")
private Date createDate = new Date();
/**
* 更新时间
*/
@Column(name = "update_date")
private Date updateDate = new Date();
/**
* 告警恢复时间
*/
@Column(name = "recovery_date")
private Date recoveryDate;
......
......@@ -45,6 +45,13 @@ public interface View3dMapper extends BaseMapper{
* @return Long
*/
Long countCheckException(Map<String,Object> param);
/**
* 统计故障告警数量(不合格、漏检)-日期+机构
* @param param
* @return
*/
Long countFireException(Map<String,Object> param);
/**
* 今日安全指数详情
......
......@@ -7,5 +7,5 @@ import com.yeejoin.amos.fas.dao.entity.Alarm;
@Repository("iAlarmDao")
public interface IAlarmDao extends BaseDao<Alarm, Long> {
Alarm findByFireEquipmentCodeAndStatusTrue(String code);
Alarm findByStatusTrueAndFireEquipmentPointCode(String code);
}
......@@ -457,10 +457,10 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Override
public EquipCommunicationData findFireEquipmentByPointCode(String code) {
EquipCommunicationData data = (EquipCommunicationData) redisTemplate.opsForHash().get("fireEquipData", code);
if (ObjectUtils.isEmpty(data)) {
data = fireEquipMapper.findOneByPointCode(code);
}
// EquipCommunicationData data = (EquipCommunicationData) redisTemplate.opsForHash().get("fireEquipData", code);
// if (ObjectUtils.isEmpty(data)) {
EquipCommunicationData data = fireEquipMapper.findOneByPointCode(code);
// }
return data;
}
......
......@@ -848,8 +848,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
private void saveFireEquipmentData(FireEquipmentPoint fireEquipmentPoint, FireEquipment fireEquipment, AlarmParam deviceData, String fireEquipmentPointType) {
if("alarm_type_fire".equals(fireEquipmentPointType) || "alarm_type_trouble".equals(fireEquipmentPointType)){
Alarm alarm = iAlarmDao.findByFireEquipmentCodeAndStatusTrue(deviceData.getPointCode());
Alarm alarm = iAlarmDao.findByStatusTrueAndFireEquipmentPointCode(deviceData.getPointCode());
if(alarm != null){
alarm.setFireEquipmentPointValue(deviceData.getState());
if("false".equals(deviceData.getState())){
alarm.setRecoveryDate(new Date());
alarm.setStatus(false);
......@@ -882,6 +883,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
fireEquipmentData.setFireEquipmentPointId(fireEquipmentPoint.getId());
fireEquipmentData.setFireEquipmentId(fireEquipmentPoint.getFireEquipmentId());
fireEquipmentData.setType("monitor");
iFireEquipmentDataDao.save(fireEquipmentData);
Map<String, Object> content = new HashMap<>();
content.put("id", fireEquipmentData.getId());
content.put("label", fireEquipmentData.getEqPointName());
......
......@@ -105,6 +105,7 @@ public class View3dServiceImpl implements IView3dService {
private IDataRefreshService iDataRefreshService;
@Autowired
private RiskSourceMapper riskSourceMapper;
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -305,7 +306,7 @@ public class View3dServiceImpl implements IView3dService {
//3.统计巡检异常数量(不合格、漏检)-日期+机构
Long checkExceptionNum = this.getCheckExceptionNum(orgCode,date);
vo.setCheckExceptionNum(checkExceptionNum);
//4.统计火灾报警数量-日期+机构
//4.统计故障数量-日期+机构
//TODO:待毛颖确认调整完成后继续
vo.setFireExceptionNum(0L);
} else {
......@@ -377,6 +378,13 @@ public class View3dServiceImpl implements IView3dService {
param.put("date", date);
return view3dMapper.countUpperRiskPoint(param);
}
private Long getFireExceptionNum(String orgCode, String date) {
Map<String,Object> params = new HashMap<>();
params.put("orgCode", orgCode);
params.put("date", date);
return view3dMapper.countFireException(params);
}
private double changeRpnToSafetyIndex(BigDecimal rpn) {
BigDecimal rpnBig = rpn == null ? new BigDecimal("0") : rpn;
......
......@@ -240,7 +240,7 @@
add COLUMN `flicker_frequency` int(11) DEFAULT 0 COMMENT '闪烁频率' after `status`;
</sql>
</changeSet>
<changeSet author="maoying" id="1589444792911-1">
<changeSet author="maoying" id="1589444792914-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="f_alarm"/>
</preConditions>
......@@ -251,9 +251,10 @@
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`org_code` varchar(100) NOT NULL COMMENT '机构编号',
`fire_equipment_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '消防设备id',
`fire_equipment_code` varchar(255) NOT NULL COMMENT '设备编码',
`fire_equipment_name` varchar(255) NOT NULL COMMENT '设备名称',
`fire_equpment_point_id` bigint(20) NOT NULL COMMENT '消防点位id',
`fire_equpment_point_code` varchar(255) NOT NULL COMMENT '消防点位名称',
`fire_equipment_point_id` bigint(20) NOT NULL COMMENT '消防点位id',
`fire_equipment_point_code` varchar(255) NOT NULL COMMENT '消防点位名称',
`fire_equipment_point_name` varchar(255) NOT NULL,
`fire_equipment_point_value` varchar(500) DEFAULT NULL COMMENT '报警值',
`frequency` int(10) NOT NULL DEFAULT '1' COMMENT '发生频次',
......@@ -262,8 +263,7 @@
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`recovery_date` datetime DEFAULT NULL COMMENT '告警恢复时间',
PRIMARY KEY (`id`),
UNIQUE KEY `type_index` (`type`) USING HASH
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='报警信息表';
</sql>
</changeSet>
......
......@@ -436,6 +436,11 @@
) pt
where #{date} BETWEEN pt.begin_date and pt.end_date
</select>
<select id="countFireException" resultType="long">
</select>
<select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo" >
SELECT
b.id,
......
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