Commit e8fa7dd2 authored by taabe's avatar taabe

3维点闪烁频次修改

parent 2b7d6730
......@@ -19,7 +19,7 @@ public interface Node3dVoMapper extends BaseMapper {
/**
* 风险点数据同步--更新
*/
Integer incrementalUpdateRiskSource(@Param("rsId") Long rsId);
Integer incrementalUpdateRiskSource(@Param("rsId") Long rsId, @Param("frequency") Integer frequency);
......
......@@ -81,7 +81,7 @@ public class Node3dVoServiceImpl implements Node3dVoService {
result = node3dVoMapper.incrementalUpdateImpEqumt(null);
break;
case DATATYPE_RISKSOURCE:
result = node3dVoMapper.incrementalUpdateRiskSource(null);
result = node3dVoMapper.incrementalUpdateRiskSource(null, null);
break;
case DATATYPE_FIRECAR:
result = node3dVoMapper.incrementalUpdateFireCar(null);
......@@ -119,7 +119,7 @@ public class Node3dVoServiceImpl implements Node3dVoService {
break;
case DATATYPE_RISKSOURCE:
result += node3dVoMapper.incrementalCreateRiskSource(null)==null?0:node3dVoMapper.incrementalCreateRiskSource(null);
result += node3dVoMapper.incrementalUpdateRiskSource(null)==null?0:node3dVoMapper.incrementalUpdateRiskSource(null);
result += node3dVoMapper.incrementalUpdateRiskSource(null, null)==null?0:node3dVoMapper.incrementalUpdateRiskSource(null, null);
result += node3dVoMapper.incrementalDeleteRiskSource(null)==null?0:node3dVoMapper.incrementalDeleteRiskSource(null);
break;
case DATATYPE_FIRECAR:
......@@ -158,7 +158,7 @@ public class Node3dVoServiceImpl implements Node3dVoService {
//风险点
result += node3dVoMapper.incrementalCreateRiskSource(null)==null?0:node3dVoMapper.incrementalCreateRiskSource(null);
result += node3dVoMapper.incrementalUpdateRiskSource(null)==null?0:node3dVoMapper.incrementalUpdateRiskSource(null);
result += node3dVoMapper.incrementalUpdateRiskSource(null, null)==null?0:node3dVoMapper.incrementalUpdateRiskSource(null, null);
result += node3dVoMapper.incrementalDeleteRiskSource(null)==null?0:node3dVoMapper.incrementalDeleteRiskSource(null);
//消防车
......@@ -182,6 +182,13 @@ public class Node3dVoServiceImpl implements Node3dVoService {
return result;
}
@Override
public Integer updateByRiskSourceId(Long riskSourceId, Integer frequency) {
Integer result = 0;
result = node3dVoMapper.incrementalUpdateRiskSource(riskSourceId, frequency);
return result;
}
@Async
@Override
public Integer syncData(Callable<Integer> callable ) throws Exception
......
......@@ -489,7 +489,11 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
List<RiskSource> riskSources = this.riskSourceMapper.queryByFireEqument(deviceData.getFireEquimentId());
//asymbleWithParent(batchNo, riskSources, FireEquimentDataRo.class.getSimpleName(), deviceData.getFireEquimentId(), deviceData.getNodeState(), null, null);
try {
alermContingency(deviceData.getBatchNo(), fireEquipment, equipment);
} catch (Exception e) {
log.error("调用规则失败", e);
}
}
}
......@@ -1132,7 +1136,11 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
Object canBeRunning = redisTemplate.opsForValue().get(cacheKeyForCanBeRunning());
if (canBeRunning == null) {
try {
alermContingency(batchNo, fireEquipment, equipment);
} catch (Exception e) {
log.error("调用规则失败", e);
}
} else {
redisTemplate.expire(cacheKeyForCanBeRunning(), 24 * 60 * 60, TimeUnit.SECONDS);
}
......@@ -1652,6 +1660,14 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSourceRuleRo.setRpni(rpni);
riskSourceRuleRo.setLevelChangeType(changeType);
riskSourceRuleRo.setNotifyType(notifyType);
BigDecimal rg = rpnr.subtract(rpni);
Integer frequency = 0;
if ("up".equals(changeType) && rg.intValue() > 0) {
frequency = 3;
} else if ("no".equals(changeType) && rg.intValue() > 0) {
frequency = 1;
}
node3dVoService.updateByRiskSourceId(riskSourceRuleRo.getId(), frequency);
try {
remoteRuleServer.fireRule(riskSourceRuleRo, "风险管控/riskSource");
} catch (Exception e) {
......
......@@ -50,7 +50,7 @@ public interface Node3dVoService {
*/
Integer wholeIncremental();
Integer updateByRiskSourceId(Long riskSourceId, Integer frequency);
Integer syncData(Callable<Integer> callable )throws Exception;
......
......@@ -30,7 +30,8 @@
(select rl.`level` from f_risk_level rl where rl.id = rs.risk_level_id)data_level,
rs.`code` data_code,
null protect_obj_name,
null route_name
null route_name,
0 frequency
from f_risk_source rs
where
<choose>
......@@ -81,30 +82,6 @@
</select>
<select id="incrementalUpdateRiskSource" resultType="java.lang.Integer">
UPDATE
toip_biz_node3dvo AS bn
JOIN f_risk_source AS rs
ON bn.oid = rs.id
SET
bn.config = CONCAT('{"isIndoor":',CASE rs.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',rs.floor3d,'"}'),
bn.org_code = rs.org_code,
bn.position = CASE WHEN (ISNULL(rs.position3d) || LENGTH(trim(rs.position3d)) <![CDATA[<]]>1) THEN NULL ELSE CONCAT('{"x":',substring_index(rs.position3d,',', 1),',"y":',substring_index(substring_index(rs.position3d,',', -2), ',', 1),',"z":',substring_index(rs.position3d,',', -1),'}') END,
bn.data_level = (select rl.`level` from f_risk_level rl where rl.id = rs.risk_level_id),
bn.data_code = rs.`code`,
bn.display_name = rs.`name`
WHERE
bn.type = 'riskSource'
<if test="rsId !=null">
and rs.id = #{rsId}
</if>
</select>
<select id="incrementalCreateFierEqumt" resultType="java.lang.Integer">
INSERT INTO toip_biz_node3dvo
select
......@@ -156,6 +133,34 @@
</select>
<select id="incrementalUpdateRiskSource" resultType="java.lang.Integer">
UPDATE
toip_biz_node3dvo AS bn
JOIN f_risk_source AS rs
ON bn.oid = rs.id
SET
bn.config = CONCAT('{"isIndoor":',CASE rs.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',rs.floor3d,'"}'),
bn.org_code = rs.org_code,
bn.position = CASE WHEN (ISNULL(rs.position3d) || LENGTH(trim(rs.position3d)) <![CDATA[<]]>1) THEN NULL ELSE CONCAT('{"x":',substring_index(rs.position3d,',', 1),',"y":',substring_index(substring_index(rs.position3d,',', -2), ',', 1),',"z":',substring_index(rs.position3d,',', -1),'}') END,
bn.data_level = (select rl.`level` from f_risk_level rl where rl.id = rs.risk_level_id),
bn.data_code = rs.`code`,
bn.display_name = rs.`name`,
<if test="frequency != null">
bn.frequency = #{frequency},
</if>
bn.node_state = rs.rpn
WHERE
bn.type = 'riskSource'
<if test="rsId !=null">
and rs.id = #{rsId}
</if>
</select>
<select id="incrementalDeleteFierEqumt" resultType="java.lang.Integer">
DELETE
FROM
......
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