Commit f56dffa2 authored by maoying's avatar maoying

修改数据上传保存接口

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