Commit 95688d2d authored by 高建强's avatar 高建强

item:删除预案调用值班编码匹配人业务逻辑

parent 2608d58a
...@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.component.rule.MethodParam; import com.yeejoin.amos.component.rule.MethodParam;
import com.yeejoin.amos.component.rule.RuleActionBean; import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod; import com.yeejoin.amos.component.rule.RuleMethod;
import com.yeejoin.amos.fas.business.action.el.ELEvaluationContext;
import com.yeejoin.amos.fas.business.action.model.ContingencyEvent; import com.yeejoin.amos.fas.business.action.model.ContingencyEvent;
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.model.DeviceRo; import com.yeejoin.amos.fas.business.action.model.DeviceRo;
...@@ -53,9 +54,13 @@ import org.typroject.tyboot.core.foundation.context.RequestContext; ...@@ -53,9 +54,13 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Component @Component
...@@ -137,6 +142,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -137,6 +142,7 @@ public class ContingencyAction implements CustomerAction {
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<>();
static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); 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<>();
...@@ -312,6 +318,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -312,6 +318,7 @@ public class ContingencyAction implements CustomerAction {
redisTemplate.opsForValue().set("action:token", params.getOrDefault("token", "").toString()); redisTemplate.opsForValue().set("action:token", params.getOrDefault("token", "").toString());
//转换content中的变量 //转换content中的变量
content = instedParams(content, contingencyRo);
iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", content, "MESSAGE", ""); iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", content, "MESSAGE", "");
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
...@@ -335,7 +342,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -335,7 +342,7 @@ public class ContingencyAction implements CustomerAction {
e.printStackTrace(); e.printStackTrace();
} }
result.add(tempmap1); result.add(tempmap1);
System.out.println("--------------------messageRecord----------------------" + result); System.out.printf("=========recordarea=====396====%s=========%s=========%n", JSONObject.toJSONString(paramObj), JSONObject.toJSONString(result));
sendcmd("recordarea", paramObj, result); sendcmd("recordarea", paramObj, result);
sendweb("recordarea", paramObj, result); sendweb("recordarea", paramObj, result);
} }
...@@ -361,6 +368,9 @@ public class ContingencyAction implements CustomerAction { ...@@ -361,6 +368,9 @@ public class ContingencyAction implements CustomerAction {
if (!findByBatchNoAndStatus(batchNo)) { if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
//转换智能辅助中的变量
content = instedParams(content, contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
...@@ -377,6 +387,40 @@ public class ContingencyAction implements CustomerAction { ...@@ -377,6 +387,40 @@ public class ContingencyAction implements CustomerAction {
} }
} }
private String instedParams(String content, ContingencyRo contingencyRo) {
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;
}
/** /**
* 交互动作 * 交互动作
* *
...@@ -394,6 +438,9 @@ public class ContingencyAction implements CustomerAction { ...@@ -394,6 +438,9 @@ public class ContingencyAction implements CustomerAction {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
String buttonCode = contingencyRo.getButtonCode(); String buttonCode = contingencyRo.getButtonCode();
//转换content中的变量
tips = instedParams(tips, contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
...@@ -489,6 +536,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -489,6 +536,7 @@ public class ContingencyAction implements CustomerAction {
e.printStackTrace(); e.printStackTrace();
} }
result.add(tempmap1); result.add(tempmap1);
System.out.printf("=========recordarea=====595====%s=========%s=========%n", JSONObject.toJSONString(paramObj), JSONObject.toJSONString(result));
this.sendcmd("recordarea", paramObj, result); this.sendcmd("recordarea", paramObj, result);
} }
} }
...@@ -543,13 +591,14 @@ public class ContingencyAction implements CustomerAction { ...@@ -543,13 +591,14 @@ public class ContingencyAction implements CustomerAction {
String batchNo = contingencyRo.getBatchNo(); String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) { if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
String parameter = instedParams(paramJSON, contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
tempmap1.put("key", actionName); tempmap1.put("key", actionName);
tempmap1.put("content", actionType); tempmap1.put("content", actionType);
tempmap1.put("parameter", paramJSON); tempmap1.put("parameter", parameter);
result.add(tempmap1); result.add(tempmap1);
this.sendcmd("maparea", paramObj, result); this.sendcmd("maparea", paramObj, result);
} }
...@@ -571,6 +620,8 @@ public class ContingencyAction implements CustomerAction { ...@@ -571,6 +620,8 @@ public class ContingencyAction implements CustomerAction {
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
//转换content中的变量
content = instedParams(content, contingencyRo);
tempmap1.put("content", content); tempmap1.put("content", content);
tempmap1.put("type", messageType);//消息类型 messageType 黑色框消息类型 CONTINGENCY,,滚动消息:CURRENTMESSAGE tempmap1.put("type", messageType);//消息类型 messageType 黑色框消息类型 CONTINGENCY,,滚动消息:CURRENTMESSAGE
...@@ -655,6 +706,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -655,6 +706,7 @@ public class ContingencyAction implements CustomerAction {
planDetailDataSync(detail); planDetailDataSync(detail);
} }
//数字预案业务屏web端发送消息 //数字预案业务屏web端发送消息
System.out.printf("=========recordarea====765=====%s=========%s=========%n", JSONObject.toJSONString(paramObj), JSONObject.toJSONString(result));
this.sendweb("recordarea", paramObj, result); this.sendweb("recordarea", paramObj, result);
} }
...@@ -842,6 +894,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -842,6 +894,7 @@ public class ContingencyAction implements CustomerAction {
tempmap1.put("status", PlanRecordStatusEnum.INTERRUPT.getCode()); tempmap1.put("status", PlanRecordStatusEnum.INTERRUPT.getCode());
result.add(tempmap1); result.add(tempmap1);
//数字预案业务屏web端发送消息 //数字预案业务屏web端发送消息
System.out.printf("=========recordarea====953=====%s=========%s=========%n", JSONObject.toJSONString(contingencyRo), JSONObject.toJSONString(result));
this.sendweb("recordarea", contingencyRo, result); this.sendweb("recordarea", contingencyRo, result);
updateNumberPlan(batchNo); updateNumberPlan(batchNo);
// 应急处置中断,初始化planStep,json数据;更新预案结束时间 // 应急处置中断,初始化planStep,json数据;更新预案结束时间
......
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