Commit 84cd3003 authored by KeYong's avatar KeYong

提交研发环境配置文件及升级预案消息推送

parent b1f2804f
...@@ -102,12 +102,19 @@ ...@@ -102,12 +102,19 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> --> </dependency> -->
<dependency> <dependency>
<groupId>com.itextpdf</groupId> <groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId> <artifactId>itextpdf</artifactId>
<version>5.5.13</version> <version>5.5.13</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-spring-boot-starter</artifactId>
<version>2.2.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -39,6 +39,7 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; ...@@ -39,6 +39,7 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.Equipment; import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.PlanDetail; import com.yeejoin.amos.fas.dao.entity.PlanDetail;
import com.yeejoin.amos.fas.dao.entity.PlanOperationRecord; import com.yeejoin.amos.fas.dao.entity.PlanOperationRecord;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -101,6 +102,12 @@ public class ContingencyAction implements CustomerAction { ...@@ -101,6 +102,12 @@ public class ContingencyAction implements CustomerAction {
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@Autowired
private RocketMQTemplate rocketMQTemplate;
@Value("${rocket-plan-topic}")
private String rocketTopic;
private static Map<String, String> OPERATE_RECORD_ID = new HashMap<>(); private static Map<String, String> OPERATE_RECORD_ID = new HashMap<>();
private static Map<String, Map<String, String>> stringStringMap = new HashMap<>(); private static Map<String, Map<String, String>> stringStringMap = new HashMap<>();
...@@ -287,6 +294,17 @@ public class ContingencyAction implements CustomerAction { ...@@ -287,6 +294,17 @@ public class ContingencyAction implements CustomerAction {
event.setMsgType(msgType); event.setMsgType(msgType);
event.setContingency(contingency); event.setContingency(contingency);
contingencyLogPublisher.publish(event); contingencyLogPublisher.publish(event);
// 将预案的确认消息发送至中心级
if ("CONFIRM".equals(ro.getConfirm())) {
String msg = JSON.toJSONString(event);
log.info("RocketMQ发送的主题是: " + rocketTopic + ", 消息体是: " + msg + "!");
try {
rocketMQTemplate.convertAndSend(rocketTopic, msg);
} catch (Exception e) {
throw new RuntimeException("RocketMQ消息发送失败!");
}
}
} else if ("websocket".equals(pushType.toLowerCase())){ } else if ("websocket".equals(pushType.toLowerCase())){
action.execute(msgType, contingency); action.execute(msgType, contingency);
} }
......
package com.yeejoin.amos.fas.business.bo;
/**
* @author keyong
* @title: PlanFlag
* <pre>
* @description: TODO
* </pre>
* @date 2022/5/11 15:31
*/
public class PlanFlagBo {
public static Integer id;
public static Boolean flag;
public static void setId(Integer id) {
PlanFlagBo.id = id;
}
public static void setFlag(Boolean flag) {
PlanFlagBo.flag = flag;
}
public static Integer getId() {
return id;
}
public static Boolean getFlag() {
return flag;
}
}
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo; import com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo;
import com.yeejoin.amos.fas.business.action.model.ProtalDataRo; import com.yeejoin.amos.fas.business.action.model.ProtalDataRo;
import com.yeejoin.amos.fas.business.bo.DangerResultBo; import com.yeejoin.amos.fas.business.bo.DangerResultBo;
import com.yeejoin.amos.fas.business.bo.PlanFlagBo;
import com.yeejoin.amos.fas.business.bo.RiskSourceSynBo; import com.yeejoin.amos.fas.business.bo.RiskSourceSynBo;
import com.yeejoin.amos.fas.business.param.AlarmParam; import com.yeejoin.amos.fas.business.param.AlarmParam;
import com.yeejoin.amos.fas.business.param.FmeaBindParam; import com.yeejoin.amos.fas.business.param.FmeaBindParam;
...@@ -625,7 +626,7 @@ public class RiskSourceController extends BaseController { ...@@ -625,7 +626,7 @@ public class RiskSourceController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "重点设备启动预案", notes = "重点设备启动预案") @ApiOperation(httpMethod = "GET", value = "重点设备启动预案", notes = "重点设备启动预案")
@RequestMapping(value = "/startEquipReserve", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/startEquipReserve", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public ResponseModel startEquipReserve(@RequestParam Long id, @RequestParam String typeCode) { public ResponseModel startEquipReserve(@RequestParam Long id, @RequestParam String typeCode) {
PlanFlagBo.setFlag(Boolean.TRUE);
ReserveEnum reserveEnum = riskSourceService.startEquipReserve(id, typeCode); ReserveEnum reserveEnum = riskSourceService.startEquipReserve(id, typeCode);
Integer status = reserveEnum.getStatus(); Integer status = reserveEnum.getStatus();
String text = reserveEnum.getText(); String text = reserveEnum.getText();
......
...@@ -4,6 +4,7 @@ import com.yeejoin.amos.fas.business.vo.PlanDetailVo; ...@@ -4,6 +4,7 @@ import com.yeejoin.amos.fas.business.vo.PlanDetailVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.xml.crypto.Data;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -49,6 +50,6 @@ public interface PlanDetailMapper { ...@@ -49,6 +50,6 @@ public interface PlanDetailMapper {
PlanDetailVo getPlanDetailByEquipmentId(@Param("fireEquipmentId") Long fireEquipmentId); PlanDetailVo getPlanDetailByEquipmentId(@Param("fireEquipmentId") Long fireEquipmentId);
Integer planReset(); Integer planReset(@Param("date") Date date);
} }
...@@ -678,7 +678,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -678,7 +678,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
public AtomicBoolean planReset() { public AtomicBoolean planReset() {
AtomicBoolean bool = new AtomicBoolean(true); AtomicBoolean bool = new AtomicBoolean(true);
try { try {
planDetailMapper.planReset(); Date date = new Date();
planDetailMapper.planReset(date);
} catch (Exception e) { } catch (Exception e) {
bool.set(false); bool.set(false);
e.printStackTrace(); e.printStackTrace();
......
...@@ -8,6 +8,7 @@ import com.yeejoin.amos.component.rule.RuleTrigger; ...@@ -8,6 +8,7 @@ import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.fas.business.action.model.ContingencyRo; import com.yeejoin.amos.fas.business.action.model.ContingencyRo;
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent; import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe; import com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe;
import com.yeejoin.amos.fas.business.bo.PlanFlagBo;
import com.yeejoin.amos.fas.business.bo.SafetyExecuteBo; import com.yeejoin.amos.fas.business.bo.SafetyExecuteBo;
import com.yeejoin.amos.fas.business.dao.mapper.*; import com.yeejoin.amos.fas.business.dao.mapper.*;
import com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao; import com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao;
...@@ -26,6 +27,7 @@ import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum; ...@@ -26,6 +27,7 @@ import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum;
import com.yeejoin.amos.fas.core.util.StringUtil; import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.*; import com.yeejoin.amos.fas.dao.entity.*;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -134,6 +136,12 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -134,6 +136,12 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Autowired @Autowired
IContingencyPlanService iContingencyPlanService; IContingencyPlanService iContingencyPlanService;
@Autowired
private RocketMQTemplate rocketMQTemplate;
@Value("${rocket-plan-topic}")
private String rocketTopic;
@Override @Override
public void handlerMqttMessage(String topic, String data) { public void handlerMqttMessage(String topic, String data) {
...@@ -168,13 +176,25 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -168,13 +176,25 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
} }
if(topicEntity.getSimulationDate().equals("false") && nameKeys.contains(typeCode) && indexStateIsChange(equipmentSpecificIndex)){ if(topicEntity.getSimulationDate().equals("false") && nameKeys.contains(typeCode) && indexStateIsChange(equipmentSpecificIndex)){
log.info("指标值没有发生变化: " + equipmentSpecificIndex.getIotCode()+"-"+equipmentSpecificIndex.getNameKey()+":"+equipmentSpecificIndex.getValue()); log.info("指标值没有发生变化: " + equipmentSpecificIndex.getIotCode()+"-"+equipmentSpecificIndex.getNameKey()+":"+equipmentSpecificIndex.getValue());
// 三维屏指标状态推送 // 三维屏指标状态推送
equipmentSpecificIndex.setId(equipmentSpecific.getId()); String msg = JSON.toJSONString(equipmentSpecificIndex);
equipmentSpecificIndex.setName(equipmentSpecific.getName()); equipmentSpecificIndex.setId(equipmentSpecific.getId());
equipmentSpecificIndex.setCode(equipmentSpecific.getCode()); equipmentSpecificIndex.setName(equipmentSpecific.getName());
equipmentSpecificIndex.setType("equip"); equipmentSpecificIndex.setCode(equipmentSpecific.getCode());
String title = String.format("/%s/%s", serviceName, "data/refresh/indexStatus"); equipmentSpecificIndex.setType("equip");
webMqttComponent.publish(title, JSON.toJSONString(equipmentSpecificIndex)); String title = String.format("/%s/%s", serviceName, "data/refresh/indexStatus");
webMqttComponent.publish(title, msg);
// 中心级系统指标推送消息
if ("FIREALARM".equals(typeCode) && "true".equals(equipmentSpecificIndex.getValue()) && PlanFlagBo.getFlag()) {
log.info("RocketMQ发送的主题是: " + rocketTopic + ", 消息体是: " + msg + "!");
try {
rocketMQTemplate.convertAndSend(rocketTopic, msg);
PlanFlagBo.setFlag(Boolean.FALSE);
} catch (Exception e) {
throw new RuntimeException("RocketMQ消息发送失败!");
}
}
} }
Equipment equipment = topicEntity.getEquipment()==null?impAndFireEquipMapper.queryImpEqumtByFireEquipmt(eqSpecId):topicEntity.getEquipment(); Equipment equipment = topicEntity.getEquipment()==null?impAndFireEquipMapper.queryImpEqumtByFireEquipmt(eqSpecId):topicEntity.getEquipment();
......
#DB properties: #DB properties:
spring.datasource.url = jdbc:mysql://172.16.3.20:3307/autosys_business_v3.0.1.3?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.datasource.url = jdbc:mysql://172.16.11.201:3306/dl_business_v3.0.1.3?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=123456 spring.datasource.password=Yeejoin@2020
spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver
spring.datasource.hikari.maxLifetime = 1765000 spring.datasource.hikari.maxLifetime = 1765000
spring.datasource.hikari.maximum-pool-size = 10 spring.datasource.hikari.maximum-pool-size = 10
...@@ -10,13 +10,13 @@ spring.datasource.validationQuery = SELECT 1 ...@@ -10,13 +10,13 @@ spring.datasource.validationQuery = SELECT 1
#系统服务账号,用户后端服务调用 #系统服务账号,用户后端服务调用
security.password=a1234560 security.password=a1234560
security.loginId=fas_system security.loginId=fas_autosys
#应用product appkey #应用product appkey
security.productWeb=STUDIO_APP_WEB security.productWeb=STUDIO_APP_WEB
security.appKey=studio_normalapp_3056965 security.appKey =studio_normalapp_3056965
eureka.client.serviceUrl.defaultZone=http://172.16.11.20:10001/eureka/ eureka.client.serviceUrl.defaultZone=http://172.16.11.201:10001/eureka/
eureka.client.register-with-eureka = true eureka.client.register-with-eureka = true
eureka.client.fetch-registry = true eureka.client.fetch-registry = true
eureka.client.healthcheck.enabled = true eureka.client.healthcheck.enabled = true
...@@ -26,7 +26,7 @@ eureka.instance.prefer-ip-address=true ...@@ -26,7 +26,7 @@ eureka.instance.prefer-ip-address=true
#redis #redis
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.11.20 spring.redis.host=172.16.11.201
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password=1234560 spring.redis.password=1234560
spring.redis.jedis.pool.max-active=200 spring.redis.jedis.pool.max-active=200
...@@ -39,16 +39,22 @@ windows.img.path = C:\\ ...@@ -39,16 +39,22 @@ windows.img.path = C:\\
linux.img.path = / linux.img.path = /
file.uploadUrl=C:\\upload\\files\\ file.uploadUrl=C:\\upload\\files\\
#picture read #picture read
file.readUrl=http://172.16.11.33:8085/file/getFile?in= file.readUrl=http://172.16.11.201:8085/file/getFile?in=
#jpush 推送开关 #jpush 推送开关
params.isPush=false params.isPush=false
## emqx ## emqx
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.33:1883 emqx.broker=tcp://172.16.11.201:1883
emqx.user-name=admin emqx.user-name=admin
emqx.password=public emqx.password=public
#文件服务器地址
file.downLoad.url=http://39.98.246.31:8888/
#rocketmq生产者配置
rocketmq.name-server=localhost:9876
rocketmq.producer.group=my-group
rocketmq.producer.sendMessageTimeout=300000
rocket-plan-topic=template_topic
#文件服务器地址
file.downLoad.url=http://172.16.11.201:9000/
\ No newline at end of file
...@@ -137,5 +137,6 @@ ...@@ -137,5 +137,6 @@
<update id="planReset"> <update id="planReset">
UPDATE c_plan_detail SET `status` = 2; UPDATE c_plan_detail SET `status` = 2;
UPDATE c_plan_operation_record SET `status`=1; UPDATE c_plan_operation_record SET `status`=1;
UPDATE c_plan_operation_record SET `end_time`=#{date} ORDER BY id DESC LIMIT 1;
</update> </update>
</mapper> </mapper>
\ No newline at end of file
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