Commit c23e993b authored by maoying's avatar maoying

解决冲突

parents 064cdd91 2882a6f5
package com.yeejoin.amos.fas.common.enums;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.common.enums
* @ClassName: SqlKeyWordEnum
* @Author: Jianqiang Gao
* @Description: SqlKeyWordEnum
* @Date: 2022/5/20 17:59
* @Version: 1.0
*/
public enum SqlKeyWordEnum {
AND("and", "并且"),
OR("or", "或者");
private String key;
private String value;
SqlKeyWordEnum(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
\ No newline at end of file
......@@ -17,7 +17,6 @@ import com.yeejoin.amos.fas.business.action.result.ActionResult;
import com.yeejoin.amos.fas.business.action.result.SafteyPlanResult;
import com.yeejoin.amos.fas.business.action.result.message.AbstractActionResultMessage;
import com.yeejoin.amos.fas.business.action.util.ContingencyLogPublisher;
import com.yeejoin.amos.fas.business.bo.FirePlanAlarmBo;
import com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao;
import com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
......@@ -41,6 +40,7 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.PlanDetail;
import com.yeejoin.amos.fas.dao.entity.PlanOperationRecord;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -63,7 +63,7 @@ import java.util.regex.Pattern;
@Component
@RuleActionBean(beanLabel = "动态预案" )
@RuleActionBean(beanLabel = "动态预案")
public class ContingencyAction implements CustomerAction {
......@@ -101,18 +101,18 @@ public class ContingencyAction implements CustomerAction {
private RedisTemplate redisTemplate;
@Autowired
IRocketMQService rocketMQService;
IRocketMQService rocketMQService;
@Value("${rocket-plan-topic}")
private String rocketTopic;
private static Map<String, String> OPERATE_RECORD_ID = new HashMap<>();
private static Map<String, Map<String, String>> stringStringMap = new HashMap<>();
static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
public static ConcurrentHashMap<String, Map<String, Object>> pointCache = new ConcurrentHashMap<>();
public static ConcurrentHashMap<String, Map<String, Object>> pointCache = new ConcurrentHashMap<>();
private static CacheMap cacheMap = CacheFactory.newChacheMap();
......@@ -124,6 +124,9 @@ public class ContingencyAction implements CustomerAction {
private IPlanDetailDao planDetailDao;
@Autowired
private IPlanOperationRecordDao planOperationRecordDao;
@Autowired
private com.yeejoin.amos.component.rule.RuleTrigger ruleTrigger;
//当值值班长(S1)、副值班长(S2)、值班员(A1,A2,A3)、白班值班员、保安人员、驻站消防队长(F1)
/* private static Map<String, String> positionMap = new HashMap<String, String>() {{
put("S1", "S1");
......@@ -149,8 +152,8 @@ public class ContingencyAction implements CustomerAction {
*/
public Map<String, String> getStrengthMap(ContingencyRo contingencyRo) {
String batchNo = contingencyRo.getBatchNo();
String orgCode = contingencyRo.getEquipmentOrgCode();
String batchNo = contingencyRo.getBatchNo();
String orgCode = contingencyRo.getEquipmentOrgCode();
Map<String, String> returnMap = stringStringMap.get(contingencyRo.getBatchNo());
if (CollectionUtils.isEmpty(returnMap)) {
stringStringMap = new HashMap<>();
......@@ -196,9 +199,9 @@ public class ContingencyAction implements CustomerAction {
*/
@RuleMethod(methodLabel = "步骤更新", project = "换流站消防专项预案")
public void stepInfo(@MethodParam(paramLabel = "当前步骤编号") String stepCode,
@MethodParam(paramLabel = "当前步骤名称") String stepName,
@MethodParam(paramLabel = "下一步编号") String nextStepCode,
@MethodParam(paramLabel = "下一步名称") String nextStepName,
@MethodParam(paramLabel = "当前步骤名称") String stepName,
@MethodParam(paramLabel = "下一步编号") String nextStepCode,
@MethodParam(paramLabel = "下一步名称") String nextStepName,
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo);
......@@ -225,12 +228,12 @@ public class ContingencyAction implements CustomerAction {
}
/**
* @param stepCode 当前步骤编号
* @param paramObj 预案对象
* @param stepCode 当前步骤编号
* @param paramObj 预案对象
*/
@RuleMethod(methodLabel = "步骤更新(旧)", project = "换流站消防专项预案")
public void stepInfoOld(@MethodParam(paramLabel = "当前编号") String stepCode,
@MethodParam(paramLabel = "对象") Object paramObj) {
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo);
......@@ -269,10 +272,8 @@ public class ContingencyAction implements CustomerAction {
}
public void sendcmd(String msgType, Object contingency, SafteyPlanResult result) {
ContingencyRo ro = (ContingencyRo)contingency;
ContingencyRo ro = (ContingencyRo) contingency;
ro.setTelemetryMap(null);
ro.setTelesignallingMap(null);
Constructor<?> constructor;
......@@ -283,7 +284,7 @@ public class ContingencyAction implements CustomerAction {
AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result);
if ("mqtt".equals(pushType.toLowerCase())) {
ToipResponse toipResponse = action.buildResponse(msgType, contingency, result.toJson());
String topic = String.format("/%s/%s/%s", serviceName, stationName,"plan");
String topic = String.format("/%s/%s/%s", serviceName, stationName, "plan");
log.info(String.format("mqtt[%s]:【 %s 】", topic, toipResponse.toJsonStr()));
webMqttComponent.publish(topic, toipResponse.toJsonStr());
......@@ -301,11 +302,11 @@ public class ContingencyAction implements CustomerAction {
try {
rocketMQService.sendMsg(rocketTopic, "plan_process", toipResponse);
} catch (Exception e) {
log.error(e.getMessage(), e);
log.error(e.getMessage(), e);
throw new RuntimeException("RocketMQ消息发送失败!");
}
}
} else if ("websocket".equals(pushType.toLowerCase())){
} else if ("websocket".equals(pushType.toLowerCase())) {
action.execute(msgType, contingency);
}
......@@ -315,7 +316,7 @@ public class ContingencyAction implements CustomerAction {
}
public void sendweb(String msgType, Object contingency, SafteyPlanResult result) {
ContingencyRo ro = (ContingencyRo)contingency;
ContingencyRo ro = (ContingencyRo) contingency;
ro.setTelemetryMap(null);
ro.setTelesignallingMap(null);
Constructor<?> constructor;
......@@ -325,7 +326,7 @@ public class ContingencyAction implements CustomerAction {
.getConstructor(ActionResult.class);
AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result);
ToipResponse toipResponse = action.buildResponse(msgType, contingency, result.toJson());
String topic = String.format("/%s/%s/%s", serviceName, stationName,"numberPlan");
String topic = String.format("/%s/%s/%s", serviceName, stationName, "numberPlan");
log.info(String.format("mqtt[%s]:【 %s 】", topic, toipResponse.toJsonStr()));
webMqttComponent.publish(topic, toipResponse.toJsonStr());
ContingencyEvent event = new ContingencyEvent(this);
......@@ -339,6 +340,7 @@ public class ContingencyAction implements CustomerAction {
e.printStackTrace();
}
}
/**
* @param stepCode 当前步骤编号
* @param paramObj 预案对象
......@@ -365,25 +367,25 @@ public class ContingencyAction implements CustomerAction {
SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>();
try {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE");
ArrayList records = new ArrayList<>();
if (!ObjectUtils.isEmpty(list)) {
list.forEach(action -> {
HashMap map = new HashMap();
map.put("time", sdf1.format(action.getCreateDate().getTime()));
map.put("stepName", action.getContent());
records.add(map);
});
}
tempmap1.put("content", records);
tempmap1.put("status",PlanRecordStatusEnum.OPERATION.getCode());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE");
ArrayList records = new ArrayList<>();
if (!ObjectUtils.isEmpty(list)) {
list.forEach(action -> {
HashMap map = new HashMap();
map.put("time", sdf1.format(action.getCreateDate().getTime()));
map.put("stepName", action.getContent());
records.add(map);
});
}
tempmap1.put("content", records);
tempmap1.put("status", PlanRecordStatusEnum.OPERATION.getCode());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
result.add(tempmap1);
System.out.println("--------------------messageRecord----------------------"+result);
System.out.println("--------------------messageRecord----------------------" + result);
this.sendcmd("recordarea", paramObj, result);
this.sendweb("recordarea", paramObj, result);
}
......@@ -403,12 +405,12 @@ public class ContingencyAction implements CustomerAction {
*/
@RuleMethod(methodLabel = "智能辅助", project = "换流站消防专项预案")
public void help(@MethodParam(paramLabel = "当前步骤") String step,
@MethodParam(paramLabel = "图标")String icon,
@MethodParam(paramLabel = "标题")String title,
@MethodParam(paramLabel = "图片集") String image,
@MethodParam(paramLabel = "表格数据") String table,
@MethodParam(paramLabel = "文本内容") String content,
@MethodParam(paramLabel = "对象") Object paramObj) {
@MethodParam(paramLabel = "图标") String icon,
@MethodParam(paramLabel = "标题") String title,
@MethodParam(paramLabel = "图片集") String image,
@MethodParam(paramLabel = "表格数据") String table,
@MethodParam(paramLabel = "文本内容") String content,
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo);
......@@ -438,41 +440,39 @@ public class ContingencyAction implements CustomerAction {
for (String key : strengthMap.keySet())
content = content.replaceAll("\\$\\{" + key + "}", strengthMap.get(key));
Field[] fields = contingencyRo.getClass().getDeclaredFields();
Method getMethod = null;
try {
for (Field field : fields) {
if (field.getName().equals("serialVersionUID"))
continue;
String fileNameInMethod = String.valueOf(field.getName().charAt(0)).toUpperCase() + field.getName().substring(1);
getMethod = contingencyRo.getClass().getMethod("get" + fileNameInMethod);
String value = String.valueOf(getMethod.invoke(contingencyRo));
content = content.replaceAll("\\$\\{" + field.getName() + "}", value);
}
content = getNative(content);
} catch (Exception e) {
e.printStackTrace();
}
Field[] fields = contingencyRo.getClass().getDeclaredFields();
Method getMethod = null;
try {
for (Field field : fields) {
if (field.getName().equals("serialVersionUID"))
continue;
String fileNameInMethod = String.valueOf(field.getName().charAt(0)).toUpperCase() + field.getName().substring(1);
getMethod = contingencyRo.getClass().getMethod("get" + fileNameInMethod);
String value = String.valueOf(getMethod.invoke(contingencyRo));
content = content.replaceAll("\\$\\{" + field.getName() + "}", value);
}
content = getNative(content);
} catch (Exception e) {
e.printStackTrace();
}
return content;
}
public String getNative(String str)
{
Pattern p = Pattern.compile("\\$\\{(.*?)\\}");
Matcher m = p.matcher(str);
while (m.find())
{
String parameter = m.group();
Object parametervalue = ELEvaluationContext
.getValue(parameter.substring(1, parameter.length() - 1));
if(parametervalue != null)
str = str.replace(parameter,
parametervalue != null ? parametervalue.toString() : null);
}
return str;
}
public String getNative(String str) {
Pattern p = Pattern.compile("\\$\\{(.*?)\\}");
Matcher m = p.matcher(str);
while (m.find()) {
String parameter = m.group();
Object parametervalue = ELEvaluationContext
.getValue(parameter.substring(1, parameter.length() - 1));
if (parametervalue != null)
str = str.replace(parameter,
parametervalue != null ? parametervalue.toString() : null);
}
return str;
}
/**
* 交互动作
......@@ -485,10 +485,10 @@ public class ContingencyAction implements CustomerAction {
*/
@RuleMethod(methodLabel = "交互动作", project = "换流站消防专项预案")
public void operation(@MethodParam(paramLabel = "动作名称") String actionName,
@MethodParam(paramLabel = "图标") String icon,
@MethodParam(paramLabel = "提示信息") String tips,
@MethodParam(paramLabel = "按钮json字符串") String buttonJson,
@MethodParam(paramLabel = "预案对象") Object paramObj) {
@MethodParam(paramLabel = "图标") String icon,
@MethodParam(paramLabel = "提示信息") String tips,
@MethodParam(paramLabel = "按钮json字符串") String buttonJson,
@MethodParam(paramLabel = "预案对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo);
......@@ -560,10 +560,10 @@ public class ContingencyAction implements CustomerAction {
*/
@RuleMethod(methodLabel = "保存交互动作", project = "换流站消防专项预案")
public void saveOperation(@MethodParam(paramLabel = "动作名称") String actionName,
@MethodParam(paramLabel = "图标") String icon,
@MethodParam(paramLabel = "提示信息") String tips,
@MethodParam(paramLabel = "按钮json字符串") String buttonJson,
@MethodParam(paramLabel = "对象") Object paramObj) {
@MethodParam(paramLabel = "图标") String icon,
@MethodParam(paramLabel = "提示信息") String tips,
@MethodParam(paramLabel = "按钮json字符串") String buttonJson,
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo);
......@@ -572,25 +572,25 @@ public class ContingencyAction implements CustomerAction {
SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>();
try {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE");
ArrayList records = new ArrayList<>();
if (!ObjectUtils.isEmpty(list)) {
list.forEach(action -> {
HashMap map = new HashMap();
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE");
ArrayList records = new ArrayList<>();
if (!ObjectUtils.isEmpty(list)) {
list.forEach(action -> {
HashMap map = new HashMap();
// map.put("time", sdf.format(action.getCreateDate()));
map.put("time", sdf1.format(action.getCreateDate().getTime()));
map.put("stepName", action.getContent());
records.add(map);
});
}
tempmap1.put("content", records);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
map.put("stepName", action.getContent());
records.add(map);
});
}
tempmap1.put("content", records);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
result.add(tempmap1);
System.out.println("--------------------saveOperation----------------------"+result);
System.out.println("--------------------saveOperation----------------------" + result);
this.sendcmd("recordarea", paramObj, result);
}
......@@ -611,13 +611,13 @@ public class ContingencyAction implements CustomerAction {
/**
* 地图动作推送
* 地图动作推送
*
* @param actionName 动作名称标识
* @param paramObj 预案对象
*/
@RuleMethod(methodLabel = "地图动作", project = "换流站消防专项预案")
public void mapAction(@MethodParam(paramLabel = "动作名称标识") String actionName, @MethodParam(paramLabel = "参数") String paramJSON, @MethodParam(paramLabel = "对象") Object paramObj) {
public void mapAction(@MethodParam(paramLabel = "动作名称标识") String actionName, @MethodParam(paramLabel = "参数") String paramJSON, @MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
log.error("=======================================================================================");
......@@ -627,17 +627,17 @@ public class ContingencyAction implements CustomerAction {
Map<String, Object> tempmap1 = new HashMap<>();
tempmap1.put("key", actionName);
tempmap1.put("content",paramJSON);
tempmap1.put("content", paramJSON);
result.add(tempmap1);
this.sendcmd("maparea", paramObj, result);
}
@RuleMethod(methodLabel = "地图动画", project = "换流站消防专项预案")
public void mapCartoonAction(
@MethodParam(paramLabel = "动作名称标识") String actionName,
@MethodParam(paramLabel = "动作类型") String actionType,
@MethodParam(paramLabel = "动作类型参数") String paramJSON,
@MethodParam(paramLabel = "对象") Object paramObj) {
@MethodParam(paramLabel = "动作名称标识") String actionName,
@MethodParam(paramLabel = "动作类型") String actionType,
@MethodParam(paramLabel = "动作类型参数") String paramJSON,
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
log.error("=======================================================================================");
......@@ -648,8 +648,8 @@ public class ContingencyAction implements CustomerAction {
Map<String, Object> tempmap1 = new HashMap<>();
tempmap1.put("key", actionName);
tempmap1.put("content",actionType);
tempmap1.put("parameter",parameter);
tempmap1.put("content", actionType);
tempmap1.put("parameter", parameter);
result.add(tempmap1);
this.sendcmd("maparea", paramObj, result);
}
......@@ -663,11 +663,11 @@ public class ContingencyAction implements CustomerAction {
*/
@RuleMethod(methodLabel = "消息提示", project = "换流站消防专项预案")
public void topMessage(
@MethodParam(paramLabel = "标题") String title,
@MethodParam(paramLabel = "内容") String content,
@MethodParam(paramLabel = "图标") String icon,
@MethodParam(paramLabel = "类型") String messageType,
@MethodParam(paramLabel = "对象") Object paramObj) {
@MethodParam(paramLabel = "标题") String title,
@MethodParam(paramLabel = "内容") String content,
@MethodParam(paramLabel = "图标") String icon,
@MethodParam(paramLabel = "类型") String messageType,
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo);
......@@ -688,7 +688,7 @@ public class ContingencyAction implements CustomerAction {
/**
* 启动预案
*
* @param paramObj 预案对象
* @param paramObj 预案对象
*/
@RuleMethod(methodLabel = "启动预案", project = "换流站消防专项预案")
public void startPlan(@MethodParam(paramLabel = "对象") Object paramObj) {
......@@ -711,7 +711,7 @@ public class ContingencyAction implements CustomerAction {
/**
* 启动预案
*
* @param paramObj 预案对象
* @param paramObj 预案对象
*/
@RuleMethod(methodLabel = "结束预案", project = "换流站消防专项预案")
public void stopPlan(@MethodParam(paramLabel = "对象") Object paramObj) {
......@@ -724,7 +724,7 @@ public class ContingencyAction implements CustomerAction {
tempmap1.put("type", "event");
tempmap1.put("content", "stopPlan");
//数字预案结束状态
tempmap1.put("status",PlanRecordStatusEnum.COMPLETE.getCode());
tempmap1.put("status", PlanRecordStatusEnum.COMPLETE.getCode());
result.add(tempmap1);
this.sendcmd("message", paramObj, result);
......@@ -743,12 +743,12 @@ public class ContingencyAction implements CustomerAction {
// 结束预案 更新预案记录表,预案状态
PlanOperationRecord planOperationRecord = planOperationRecordDao.findByBatchNo(contingencyRo.getBatchNo());
if(planOperationRecord!=null && planOperationRecord.getStatus()==PlanRecordStatusEnum.OPERATION.getCode()){
if (planOperationRecord != null && planOperationRecord.getStatus() == PlanRecordStatusEnum.OPERATION.getCode()) {
planOperationRecord.setStatus(PlanRecordStatusEnum.COMPLETE.getCode());
planOperationRecord.setEndTime(new Date());
planOperationRecordDao.save(planOperationRecord);
Optional<PlanDetail> optionalPlanDetail = planDetailDao.findById(planOperationRecord.getPlanId());
if(optionalPlanDetail.get()!=null){
Optional<PlanDetail> optionalPlanDetail = planDetailDao.findById(planOperationRecord.getPlanId());
if (optionalPlanDetail.get() != null) {
PlanDetail planDetail = optionalPlanDetail.get();
planDetail.setStatus(ContingencyPlanStatusEnum.AVAILABLE.getCode());
planDetailDao.save(planDetail);
......@@ -762,43 +762,43 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod(methodLabel = "自动执行步骤", project = "换流站消防专项预案")
public void autoExecute(
@MethodParam(paramLabel = "动作名称") String actionName,
@MethodParam(paramLabel = "步骤编号") String stepCode,
@MethodParam(paramLabel = "按钮编码") String buttonCode,
@MethodParam(paramLabel = "步骤状态") String stepState,
@MethodParam(paramLabel = "预案对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
ContingencyPlanInstance contingencyPlanInstance = iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), actionName, "DEFAULT", "", "OPERATE", "");
Toke toke = remoteSecurityService.getServerToken();
RequestContext.setToken(toke.getToke());
@MethodParam(paramLabel = "动作名称") String actionName,
@MethodParam(paramLabel = "步骤编号") String stepCode,
@MethodParam(paramLabel = "按钮编码") String buttonCode,
@MethodParam(paramLabel = "步骤状态") String stepState,
@MethodParam(paramLabel = "预案对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
ContingencyPlanInstance contingencyPlanInstance = iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), actionName, "DEFAULT", "", "OPERATE", "");
Toke toke = remoteSecurityService.getServerToken();
RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.getProduct());
try {
iContingencyInstance.setButtonExecuted(contingencyRo.getBatchNo(),contingencyPlanInstance.getId(),buttonCode,"CONFIRM");
iContingencyInstance.fire(contingencyRo.getBatchNo(),stepCode, contingencyPlanInstance.getId(),buttonCode, "CONFIRM", stepState);
} catch (Exception e) {
e.printStackTrace();
}
iContingencyInstance.setButtonExecuted(contingencyRo.getBatchNo(), contingencyPlanInstance.getId(), buttonCode, "CONFIRM");
iContingencyInstance.fire(contingencyRo.getBatchNo(), stepCode, contingencyPlanInstance.getId(), buttonCode, "CONFIRM", stepState);
} catch (Exception e) {
e.printStackTrace();
}
}
@RuleMethod(methodLabel = "添加步骤执行", project = "换流站消防专项预案")
public void addExecute(
@MethodParam(paramLabel = "步骤编号") String stepCode,
@MethodParam(paramLabel = "按钮编码") String buttonCode,
@MethodParam(paramLabel = "设备数据") Object paramObj) {
SafteyPlanResult result = new SafteyPlanResult();
@MethodParam(paramLabel = "步骤编号") String stepCode,
@MethodParam(paramLabel = "按钮编码") String buttonCode,
@MethodParam(paramLabel = "设备数据") Object paramObj) {
SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>();
Map<String, Object> content = new HashMap<>();
content.put("stepCode", stepCode);
content.put("buttonCode", buttonCode);
DeviceRo ro = (DeviceRo)paramObj;
DeviceRo ro = (DeviceRo) paramObj;
Map<String, Object> equipemtnPoints = pointCache.get(ro.getEquipmentId());
if (ObjectUtils.isEmpty(equipemtnPoints)) {
equipemtnPoints = new HashMap<>();
equipemtnPoints = new HashMap<>();
}
equipemtnPoints.put(stepCode+"-"+buttonCode, content);
equipemtnPoints.put(stepCode + "-" + buttonCode, content);
tempmap1.put("type", "buttonCache");
tempmap1.put("content", equipemtnPoints.values());
result.add(tempmap1);
......@@ -807,27 +807,27 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod(methodLabel = "清除步骤执行", project = "换流站消防专项预案")
public void clearExecute(
@MethodParam(paramLabel = "步骤编号") String stepCode,
@MethodParam(paramLabel = "按钮编码") String buttonCode,
@MethodParam(paramLabel = "设备数据") Object paramObj) {
SafteyPlanResult result = new SafteyPlanResult();
@MethodParam(paramLabel = "步骤编号") String stepCode,
@MethodParam(paramLabel = "按钮编码") String buttonCode,
@MethodParam(paramLabel = "设备数据") Object paramObj) {
SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>();
Map<String, Object> content = new HashMap<>();
content.put("stepCode", stepCode);
content.put("buttonCode", buttonCode);
DeviceRo ro = (DeviceRo)paramObj;
DeviceRo ro = (DeviceRo) paramObj;
Map<String, Object> equipemtnPoints = pointCache.get(ro.getEquipmentId());
if (!ObjectUtils.isEmpty(equipemtnPoints)) {
equipemtnPoints.remove(stepCode+"-"+buttonCode);
equipemtnPoints.remove(stepCode + "-" + buttonCode);
}
tempmap1.put("type", "buttonCache");
if (!ObjectUtils.isEmpty(equipemtnPoints)) {
tempmap1.put("content", equipemtnPoints.values());
tempmap1.put("content", equipemtnPoints.values());
} else {
tempmap1.put("content", new ArrayList());
tempmap1.put("content", new ArrayList());
}
result.add(tempmap1);
......@@ -836,7 +836,7 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod(methodLabel = "同步自动执行步骤", project = "换流站消防专项预案")
public void sendExecute(@MethodParam(paramLabel = "预案对象") Object paramObj) {
SafteyPlanResult result = new SafteyPlanResult();
SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>();
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
......@@ -849,6 +849,24 @@ public class ContingencyAction implements CustomerAction {
this.sendcmd("message", paramObj, result);
}
@RuleMethod(methodLabel = "自动执行动作", project = "换流站消防专项预案")
public void autoExecuteAction(
@MethodParam(paramLabel = "按钮状态") String buttonStatus,
@MethodParam(paramLabel = "按钮编码") String buttonCode,
@MethodParam(paramLabel = "规则主题") String topic,
@MethodParam(paramLabel = "预案对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
contingencyRo.setButtonState(buttonStatus);
contingencyRo.setButtonCode(buttonCode);
try {
//电力设备
Equipment equipment = equipmentService.queryOne(Long.parseLong(contingencyRo.getEquipmentId()));
ruleTrigger.publish(contingencyRo, equipment.getReservePlan(), ArrayUtils.toArray(contingencyRo.getEquipmentName()));
} catch (Exception e) {
e.printStackTrace();
}
}
public void sendcmd(String msgType, DeviceRo deviceRo, SafteyPlanResult result) {
Constructor<?> constructor;
try {
......@@ -857,9 +875,9 @@ public class ContingencyAction implements CustomerAction {
.getConstructor(ActionResult.class);
AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result);
if ("mqtt".equals(pushType.toLowerCase())) {
ToipResponse toipResponse = action.buildResponse(msgType, deviceRo, result.toJson());
String topic = String.format("/%s/%s/%s", serviceName, stationName,"plan");
log.info(String.format("mqtt[%s]:【 %s 】", topic, toipResponse.toJsonStr()));
ToipResponse toipResponse = action.buildResponse(msgType, deviceRo, result.toJson());
String topic = String.format("/%s/%s/%s", serviceName, stationName, "plan");
log.info(String.format("mqtt[%s]:【 %s 】", topic, toipResponse.toJsonStr()));
webMqttComponent.publish(topic, toipResponse.toJsonStr());
ContingencyEvent event = new ContingencyEvent(this);
......@@ -868,8 +886,8 @@ public class ContingencyAction implements CustomerAction {
event.setMsgType(msgType);
event.setContingency(deviceRo);
contingencyLogPublisher.publish(event);
} else if ("websocket".equals(pushType.toLowerCase())){
action.execute(msgType, deviceRo);
} else if ("websocket".equals(pushType.toLowerCase())) {
action.execute(msgType, deviceRo);
}
} catch (Exception e) {
e.printStackTrace();
......@@ -892,11 +910,11 @@ public class ContingencyAction implements CustomerAction {
ArrayList records = new ArrayList<>();
HashMap map = new HashMap();
map.put("time", sdf.format(new Date()));
map.put("stepName","应急处置中断");
map.put("stepName", "应急处置中断");
records.add(map);
tempmap1.put("content", records);
//数字预案结束状态
tempmap1.put("status",PlanRecordStatusEnum.INTERRUPT.getCode());
tempmap1.put("status", PlanRecordStatusEnum.INTERRUPT.getCode());
result.add(tempmap1);
//数字预案业务屏web端发送消息
this.sendweb("recordarea", contingencyRo, result);
......@@ -905,16 +923,16 @@ public class ContingencyAction implements CustomerAction {
/**
* 修改数字预案状态
* */
public void updateNumberPlan(String batchNo){
*/
public void updateNumberPlan(String batchNo) {
// 结束预案 更新预案记录表,预案状态
PlanOperationRecord planOperationRecord = planOperationRecordDao.findByBatchNo(batchNo);
if(planOperationRecord!=null){
if (planOperationRecord != null) {
planOperationRecord.setStatus(PlanRecordStatusEnum.INTERRUPT.getCode());
planOperationRecord.setEndTime(new Date());
planOperationRecordDao.save(planOperationRecord);
Optional<PlanDetail> optionalPlanDetail = planDetailDao.findById(planOperationRecord.getPlanId());
if(optionalPlanDetail.get()!=null){
Optional<PlanDetail> optionalPlanDetail = planDetailDao.findById(planOperationRecord.getPlanId());
if (optionalPlanDetail.get() != null) {
PlanDetail planDetail = optionalPlanDetail.get();
planDetail.setStatus(ContingencyPlanStatusEnum.AVAILABLE.getCode());
planDetailDao.save(planDetail);
......
......@@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@RuleFact(value = "动态预案",project = "换流站消防专项预案")
......@@ -94,4 +95,7 @@ public class ContingencyRo implements Serializable {
private String fireMonitorCodes;
@Label("消防炮id")
private String fireMonitorIds;
@Label("参数map")
private Map<String, Object> params = new HashMap<>();
}
package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentFireEquipmentService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.controller
* @ClassName: equipmentFireEquipmentController
* @Author: Jianqiang Gao
* @Description: equipmentFireEquipmentController
* @Date: 2022/5/23 10:11
* @Version: 1.0
*/
@RestController
@RequestMapping(value = "/api/equipFireEquip")
public class equipmentFireEquipmentController {
@Autowired
private IEquipmentFireEquipmentService equipmentFireEquipmentService;
@ApiOperation(value = "判断是否自动执行", notes = "判断是否自动执行")
@GetMapping("/automaticExecute")
public Object automaticExecute(@RequestParam(required = false) String equipmentId,
@RequestParam(required = false) String equipCode,
@RequestParam(required = false) String equipSpeCode,
@RequestParam(required = false) String type,
@RequestParam(required = false) String indexKeys,
@RequestParam(required = false) String value) {
return equipmentFireEquipmentService.automaticExecute(equipmentId, equipCode, equipSpeCode, type, indexKeys, value);
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 装备性能指标 Mapper 接口
......@@ -19,4 +20,6 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif
List<EquipmentSpecificIndexVo> queryInitAlarm(@Param("value") String value, @Param("list") String[] nameKeys);
List<EquipmentSpecificIndexVo> getInitAlarm(@Param("value") String value, @Param("list") String[] nameKeys);
Map<String, Object> countEquipIndexAndValueOfNum(@Param("list") List<Long> equipSpecificIdList, @Param("equipCodes") String[] equipCodes, @Param("equipSpeCodes") String[] equipSpeCodes, @Param("indexKeys") String[] indexKeys, @Param("value") String value);
}
......@@ -33,4 +33,9 @@ public interface IEquipmentFireEquipmentDao extends BaseDao<EquipmentFireEquipme
@Query(value = "delete FROM `f_equipment_fire_equipment` WHERE equipment_id = ?1", nativeQuery = true)
void deleteByEquipmentId(Long id);
@Query(value = "SELECT ffe.* FROM f_equipment_fire_equipment ffe LEFT JOIN wl_equipment_specific es ON ffe.fire_equipment_id = es.id LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id WHERE ffe.equipment_id = ?1 AND ed.`code` IN ?2", nativeQuery = true)
List<EquipmentFireEquipment> findByEquipIdAndEquipCodeIn(Long equipmentId, String[] equipCodes);
@Query(value = "SELECT ffe.* FROM f_equipment_fire_equipment ffe LEFT JOIN wl_equipment_specific es ON ffe.fire_equipment_id = es.id WHERE ffe.equipment_id = ?1 AND es.`code` IN ?2", nativeQuery = true)
List<EquipmentFireEquipment> findByEquipIdAndEquipSpeCodeIn(Long equipmentId, String[] equipSpeCodes);
}
package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao;
import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificIndexService;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentFireEquipmentService;
import com.yeejoin.amos.fas.common.enums.SqlKeyWordEnum;
import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.service.impl
* @ClassName: EquipmentFireEquipmentServiceImpl
* @Author: Jianqiang Gao
* @Description:
* @Date: 2022/5/20 14:40
* @Version: 1.0
*/
@Service
public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmentService {
private final Logger log = LoggerFactory.getLogger(EquipmentFireEquipmentServiceImpl.class);
private static final String TYPE = "or";
private static final String VALUE = "true";
@Autowired
private IEquipmentFireEquipmentService equipmentFireEquipmentService;
@Autowired
private EquipmentSpecificIndexService equipmentSpecificIndexService;
@Autowired
private IEquipmentFireEquipmentDao equipmentFireEquipmentDao;
@Override
public List<EquipmentFireEquipment> findByEquipmentId(Long equipmentId) {
return equipmentFireEquipmentDao.findAllByEquipmentId(equipmentId);
}
@Override
public List<EquipmentFireEquipment> findByEquipIdAndEquipCodeIn(Long equipmentId, String[] equipCodes) {
return equipmentFireEquipmentDao.findByEquipIdAndEquipCodeIn(equipmentId, equipCodes);
}
@Override
public List<EquipmentFireEquipment> findByEquipIdAndEquipSpeCodeIn(Long equipmentId, String[] equipSpeCodes) {
return equipmentFireEquipmentDao.findByEquipIdAndEquipSpeCodeIn(equipmentId, equipSpeCodes);
}
@Override
public Object automaticExecute(String equipmentId, String equipCode, String equipSpeCode, String type, String indexKeys, String value) {
Map<String, Object> map = null;
if (StringUtils.isBlank(type)) {
type = TYPE;
}
if (StringUtils.isBlank(value)) {
value = VALUE;
}
if (StringUtils.isNotBlank(equipmentId)) {
// 1. 查询重点设备绑定的消防设备
List<EquipmentFireEquipment> list = null;
if (StringUtils.isBlank(equipSpeCode)) {
if (StringUtils.isBlank(equipCode)) {
list = equipmentFireEquipmentService.findByEquipmentId(Long.parseLong(equipmentId));
} else {
list = equipmentFireEquipmentService.findByEquipIdAndEquipCodeIn(Long.parseLong(equipmentId), equipCode.split(","));
}
} else {
list = equipmentFireEquipmentService.findByEquipIdAndEquipSpeCodeIn(Long.parseLong(equipmentId), equipSpeCode.split(","));
}
if (!CollectionUtils.isEmpty(list)) {
List<Long> equipSpecificIdList = list.stream().map(EquipmentFireEquipment::getFireEquipmentId).collect(Collectors.toList());
// 2 获取消防设备满足条件的集合
if (StringUtils.isNotBlank(indexKeys)) {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(equipSpecificIdList, null, null, indexKeys.split(","), value);
} else {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(equipSpecificIdList, null, null, null, value);
}
}
} else {
// 不存在重点设备,直接查消防设备
if (StringUtils.isNotBlank(equipSpeCode)) {
if (StringUtils.isNotBlank(indexKeys)) {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(null, null, equipSpeCode.split(","), indexKeys.split(","), value);
} else {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(null, null, equipSpeCode.split(","), null, value);
}
} else if (StringUtils.isNotBlank(equipCode)) {
if (StringUtils.isNotBlank(indexKeys)) {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(null, equipCode.split(","), null, indexKeys.split(","), value);
} else {
map = equipmentSpecificIndexService.countEquipIndexAndValueOfNum(null, equipCode.split(","), null, null, value);
}
}
}
if (!CollectionUtils.isEmpty(map)) {
Integer total = Integer.parseInt(map.get("total").toString());
Integer count = Integer.parseInt(map.get("count").toString());
if (SqlKeyWordEnum.AND.getKey().equalsIgnoreCase(type)) {
if (total.equals(count)) {
return true;
}
} else if (SqlKeyWordEnum.OR.getKey().equalsIgnoreCase(type)) {
if (count != 0) {
return true;
}
}
}
return false;
}
}
......@@ -18,7 +18,7 @@ import java.util.stream.Collectors;
* @Package: com.yeejoin.amos.fas.business.service.impl
* @ClassName: EquipmentSpecificIndexServiceImpl
* @Author: Jianqiang Gao
* @Description: EquipmentSpecificIndexServiceImpl
* @Description: EquipmentSpecificIndexServiceImpl
* @Date: 2021/1/18 16:35
* @Version: 1.0
*/
......@@ -38,7 +38,7 @@ public class EquipmentSpecificIndexServiceImpl implements EquipmentSpecificIndex
List<EquipmentSpecificIndexVo> equipmentSpecificAlarmVoList = equipmentSpecificIndexMapper.queryInitAlarm(value, nameKeys.split(","));
map.put("equip", equipmentSpecificAlarmVoList);
// 查询巡检告警
List<PollPointVo> pollPointVoList = pollPointMapper.queryInitAlarm(status.split(","));
List<PollPointVo> pollPointVoList = pollPointMapper.queryInitAlarm(status.split(","));
map.put("poll", pollPointVoList);
return map;
}
......@@ -48,8 +48,13 @@ public class EquipmentSpecificIndexServiceImpl implements EquipmentSpecificIndex
// 查询设备告警
List<EquipmentSpecificIndexVo> equipmentSpecificAlarmVoList = equipmentSpecificIndexMapper.getInitAlarm(value, nameKeys.split(","));
// 查询巡检告警
List<EquipmentSpecificIndexVo> pollPointVoList = pollPointMapper.getInitAlarm(status.split(","));
List<EquipmentSpecificIndexVo> pollPointVoList = pollPointMapper.getInitAlarm(status.split(","));
pollPointVoList.stream().sequential().collect(Collectors.toCollection(() -> equipmentSpecificAlarmVoList));
return equipmentSpecificAlarmVoList;
}
@Override
public Map<String, Object> countEquipIndexAndValueOfNum(List<Long> equipSpecificIdList, String[] equipCodes, String[] equipSpeCodes, String[] indexKeys, String value) {
return equipmentSpecificIndexMapper.countEquipIndexAndValueOfNum(equipSpecificIdList, equipCodes, equipSpeCodes, indexKeys, value);
}
}
\ No newline at end of file
......@@ -8,7 +8,6 @@ import com.yeejoin.amos.component.rule.RuleTrigger;
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.WebMqttSubscribe;
import com.yeejoin.amos.fas.business.bo.PlanFlagBo;
import com.yeejoin.amos.fas.business.bo.SafetyExecuteBo;
import com.yeejoin.amos.fas.business.dao.mapper.*;
import com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao;
......@@ -27,7 +26,6 @@ import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum;
import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.*;
import org.apache.commons.lang3.ArrayUtils;
//import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -71,10 +69,10 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Value("${data.type.fireMonitor}")
private String fireMonitor;
@Value("${integrated3Dtype}")
private String integrated3Dtype;
@Autowired
private WebMqttComponent webMqttComponent;
......@@ -156,8 +154,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
Long eqSpecId = equipmentSpecificIndex.getEquipmentSpecificId();
EquipmentSpecificForRiskVo equipmentSpecific = equipmentSpecificMapper.getOneById(eqSpecId);
log.info("========equipmentSpecific==========: " + JSON.toJSONString(equipmentSpecific));
if(ObjectUtils.isEmpty(equipmentSpecific)){
return;
if (ObjectUtils.isEmpty(equipmentSpecific)) {
return;
}
String specificIndexType = equipmentSpecificIndex.getType();
String typeCode = equipmentSpecificIndex.getTypeCode();
......@@ -177,10 +175,10 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
sendWaterLevel(formInstanceVo);
}
}
if(topicEntity.getSimulationDate().equals("false") && nameKeys.contains(typeCode) && indexStateIsChange(equipmentSpecificIndex)){
log.info("指标值没有发生变化: " + equipmentSpecificIndex.getIotCode()+"-"+equipmentSpecificIndex.getNameKey()+":"+equipmentSpecificIndex.getValue());
if (topicEntity.getSimulationDate().equals("false") && nameKeys.contains(typeCode) && indexStateIsChange(equipmentSpecificIndex)) {
log.info("指标值没有发生变化: " + equipmentSpecificIndex.getIotCode() + "-" + equipmentSpecificIndex.getNameKey() + ":" + equipmentSpecificIndex.getValue());
// 三维屏指标状态推送
equipmentSpecificIndex.setId(equipmentSpecific.getId());
equipmentSpecificIndex.setName(equipmentSpecific.getName());
equipmentSpecificIndex.setCode(equipmentSpecific.getCode());
......@@ -201,7 +199,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
// }
}
Equipment equipment = topicEntity.getEquipment()==null?impAndFireEquipMapper.queryImpEqumtByFireEquipmt(eqSpecId):topicEntity.getEquipment();
Equipment equipment = topicEntity.getEquipment() == null ? impAndFireEquipMapper.queryImpEqumtByFireEquipmt(eqSpecId) : topicEntity.getEquipment();
Toke toke = remoteSecurityService.getServerToken();
AlarmParam deviceData = new AlarmParam();
......@@ -254,7 +252,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
String dateString = formatter.format(new Date());
String topicOne = String.format("/%s/%s/%s/%s", serviceName, stationName, "data/refresh", "todaySafetyIndex");
webMqttComponent.publish(topicOne, JSON.toJSONString(view3dService.getSafetyIndexInfoByDate(equipmentSpecific.getOrgCode(), dateString)));
refreshFireSafety(equipmentSpecific.getOrgCode());
} else {
// 监测数据逻辑
......@@ -286,26 +284,27 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
/**
* 三维故障火警模块推送最新5条数据
*
* @param orgCode
*/
private void refreshFireSafety(String orgCode){
String title = String.format("/%s/%s/%s/%s", serviceName, stationName, "data/refresh", "fireSafety");
private void refreshFireSafety(String orgCode) {
String title = String.format("/%s/%s/%s/%s", serviceName, stationName, "data/refresh", "fireSafety");
List<SafetyExecuteBo> dataList = view3dService.getSafetyExecuteListTop5("fire", orgCode);
Map<String, Object> result = new HashMap<>();
result.put("type", "fire");
result.put("dataList", dataList);
webMqttComponent.publish(title, JSON.toJSONString(result));
}
private void startPlan(Equipment equipment, Toke toke, Long fireEquipmentId) {
PlanDetailVo planDetailVo = planDetailMapper.getPlanDetailByEquipmentId(equipment.getId());
//3d页面打开且存在预案,套用之前数字源码启动逻辑 进行预案的启动
boolean isOnLine = "web".equals(integrated3Dtype)?this.getOpen3dUser():true;
//this.getOpen3dUser();
log.info("isOnLine==="+isOnLine);
log.info("planDetailVo==="+JSONObject.toJSONString(planDetailVo));
boolean isOnLine = "web".equals(integrated3Dtype) ? this.getOpen3dUser() : true;
//this.getOpen3dUser();
log.info("isOnLine===" + isOnLine);
log.info("planDetailVo===" + JSONObject.toJSONString(planDetailVo));
if (planDetailVo != null && isOnLine) {
ContingencyPlanParamVo vo = new ContingencyPlanParamVo();
vo.setUserId(loginId);
......@@ -510,7 +509,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
contingencyRo.setEquipmentPosition3d(equipment.getPosition3d());
contingencyRo.setEquipmentCode(equipment.getCode());
contingencyRo.setEquipmentOrgCode(equipment.getOrgCode());
contingencyRo.getParams().put("equipmentId", equipment.getId());
//查询重点设备关联视频点位
Map<String, Object> cameraInfo = impAndFireEquipMapper.queryCamera(String.valueOf(equipment.getId()));
if (cameraInfo != null && !cameraInfo.isEmpty()) {
......
......@@ -19,4 +19,6 @@ public interface EquipmentSpecificIndexService {
Map<String, Object> queryInitAlarm(String value, String nameKeys, String status);
List<EquipmentSpecificIndexVo> getInitAlarm(String value, String nameKeys, String status);
Map<String, Object> countEquipIndexAndValueOfNum(List<Long> equipSpecificIdList, String[] equipCodes, String[] equipSpeCodes, String[] indexKeys, String value);
}
\ No newline at end of file
package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment;
import java.util.List;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.service
* @ClassName: IEquipmentFireEquipmentService
* @Author: Jianqiang Gao
* @Description:
* @Date: 2022/5/20 14:40
* @Version: 1.0
*/
public interface IEquipmentFireEquipmentService {
List<EquipmentFireEquipment> findByEquipmentId(Long equipmentId);
List<EquipmentFireEquipment> findByEquipIdAndEquipCodeIn(Long equipmentId, String[] equipCodes);
List<EquipmentFireEquipment> findByEquipIdAndEquipSpeCodeIn(Long equipmentId, String[] equipSpeCodes);
Object automaticExecute(String equipmentId, String equipCode, String equipSpeCode, String type, String indexKeys, String value);
}
......@@ -88,35 +88,44 @@
ORDER BY
wes.realtime_iot_index_update_date DESC
</select>
<!-- <select id="getInitAlarm" resultType="com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo">-->
<!-- SELECT-->
<!-- concat(wes.id) as id,-->
<!-- concat(wes.id) as equipmentSpecificId,-->
<!-- wed.`name`,-->
<!-- wes.`code`,-->
<!-- wei.name_key,-->
<!-- wei.`name` AS equipmentIndexName,-->
<!-- wsi.`value`,-->
<!-- 'equip' AS type-->
<!-- FROM-->
<!-- `wl_equipment_specific_index` wsi-->
<!-- LEFT JOIN wl_equipment_index wei ON wsi.equipment_index_id = wei.id-->
<!-- LEFT JOIN wl_equipment_specific wes ON wsi.equipment_specific_id = wes.id-->
<!-- LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id-->
<!-- where-->
<!-- wei.is_iot = 1 -->
<!-- <if test="value != null and value != ''">-->
<!-- AND wsi.`value` = #{value}-->
<!-- </if>-->
<!-- <if test="list != null and list.length > 0">-->
<!-- AND-->
<!-- <foreach collection="list" item="item" index="index" open="(" close=")" separator="OR">-->
<!-- wei.type_code = #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- GROUP BY-->
<!-- wsi.equipment_specific_id-->
<!-- ORDER BY-->
<!-- wsi.update_date DESC-->
<!-- </select>-->
<select id="countEquipIndexAndValueOfNum" resultType="map">
SELECT
COUNT( 1 ) AS total,
IF
(
SUM( IF ( esi.`value` = #{value}, 1, 0 ) ) IS NULL,
0,
SUM( IF ( esi.`value` = #{value}, 1, 0 ) )
) AS count
FROM
`wl_equipment_specific_index` esi
LEFT JOIN wl_equipment_specific es ON esi.equipment_specific_id = es.id
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
<where>
<if test="list != null and list.size() > 0">
AND esi.equipment_specific_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="equipCodes != null and equipCodes.length > 0">
AND ed.`code` IN
<foreach collection="equipCodes" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="equipSpeCodes != null and equipSpeCodes.length > 0">
AND es.`code` IN
<foreach collection="equipSpeCodes" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="indexKeys != null and indexKeys.length > 0">
AND esi.equipment_index_key IN
<foreach collection="indexKeys" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</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