Commit e9b75c08 authored by maoying's avatar maoying

Merge branch 'dev_upgrade' of 172.16.10.76:station/YeeAmosFireAutoSysRoot into upgrade

parents 2af26dc9 9e592a48
...@@ -16,7 +16,7 @@ public enum StatisticsErrorTypeEum { ...@@ -16,7 +16,7 @@ public enum StatisticsErrorTypeEum {
/** /**
* 设备故障 * 设备故障
*/ */
equip("equip", "设备故障"), equip("equip", "故障告警"),
/** /**
* 火灾告警 * 火灾告警
*/ */
......
...@@ -49,6 +49,23 @@ public class FireEquipmentData extends BasicEntity { ...@@ -49,6 +49,23 @@ public class FireEquipmentData extends BasicEntity {
@Column(name="is_invalid") @Column(name="is_invalid")
private int isInvalid; // 是否有效 private int isInvalid; // 是否有效
/**
* 机构
*/
@Column(name="org_code")
private String orgCode;
public String getOrgCode() {
return orgCode;
}
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
public FireEquipmentData() {
}
public Long getFireEquipmentId() { public Long getFireEquipmentId() {
return fireEquipmentId; return fireEquipmentId;
} }
......
package com.yeejoin.amos.fas.dao.entity;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
/**
*
* <pre>
* 消息实体
* </pre>
*
* @author HK
* @version $Id: Message.java, v 0.1 2018年1月18日 下午7:48:58 HK Exp $
*/
@Entity
@Table(name = "toip_sys_message")
public class Message extends BusinessEntity
{
/**
* <pre>
*
* </pre>
*/
private static final long serialVersionUID = 292329658525267887L;
/**
* id
*/
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
@Column(name = "id", nullable = false, length = 36)
protected String id;
/**
* 时间
*/
private Date time;
/**
* 标题
*/
private String title;
/**
* 内容
*/
private String content;
/**
* 类型
*/
private String type;
/**
* 发送者
*/
private String sender;
/**
* 接收者
*/
private String receiver;
/**
* 已读者
*/
private String reader;
/**
* 业务id
*/
private String bizId;
/**
* 业务员实体名,例如com.yeejoin.amos.toip.bizrulebridge.entity.Fire
*/
private String bizclassName;
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public Date getTime()
{
return time;
}
public void setTime(Date time)
{
this.time = time;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getContent()
{
return content;
}
public void setContent(String content)
{
this.content = content;
}
public String getType()
{
return type;
}
public void setType(String type)
{
this.type = type;
}
public String getSender()
{
return sender;
}
public void setSender(String sender)
{
this.sender = sender;
}
public String getReceiver()
{
return receiver;
}
public void setReceiver(String receiver)
{
this.receiver = receiver;
}
public String getReader()
{
return reader;
}
public void setReader(String reader)
{
this.reader = reader;
}
public String getBizId()
{
return bizId;
}
public void setBizId(String bizId)
{
this.bizId = bizId;
}
public String getBizclassName()
{
return bizclassName;
}
public void setBizclassName(String bizclassName)
{
this.bizclassName = bizclassName;
}
}
package com.yeejoin.amos.fas.business.action;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Component;
import com.yeejoin.amos.fas.business.action.result.ActionResult;
import com.yeejoin.amos.fas.business.action.result.BubbleTipResult;
import com.yeejoin.amos.fas.business.action.result.message.ActionResultMessage;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
/**
*
* <pre>
* 气泡提示动作
* </pre>
*
* @author amos
* @version $Id: BubbleTipAction.java, v 0.1 2019年5月16日 上午10:42:32 amos Exp $
*/
@Component
public class BubbleTipAction implements CustomerAction
{
private static String PACKAGEURL = "com.yeejoin.amos.rule.map.action.result.message.";
//@ExposeAction("气泡提示")
public void sendBubbleTip(Object bizobj, Boolean showInfo, Object title, String type)
{
BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>();
tempmap1.put("bizobj", bizobj);
result.add(tempmap1);
//是否显示气泡
Map<String, Object> tempmap2 = new HashMap<>();
tempmap2.put("showInfo", showInfo);
result.add(tempmap2);
//显示title提示
Map<String, Object> tempmap3 = new HashMap<>();
tempmap3.put("title", title);
result.add(tempmap3);
//节点类型
Map<String, Object> tempmap4 = new HashMap<>();
tempmap4.put("type", type);
result.add(tempmap4);
Constructor<?> constructor;
try
{
constructor = Class.forName(
PACKAGEURL + result.getClass().getSimpleName() + "Message")
.getConstructor(ActionResult.class);
ActionResultMessage<?> action = (ActionResultMessage<?>) constructor.newInstance(result);
String firstStr = "fromws";
String secondStr = "map";
String thirdStr = "bubble";
Object obj = action.execute(firstStr, secondStr, thirdStr);
result.setToipResponse((ToipResponse) obj);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
package com.yeejoin.amos.fas.business.action; //package com.yeejoin.amos.fas.business.action;
//
//
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.Field;
import java.lang.reflect.Method; //import java.lang.reflect.Method;
import java.text.SimpleDateFormat; //import java.text.SimpleDateFormat;
import java.util.Date; //import java.util.Date;
import java.util.HashMap; //import java.util.HashMap;
import java.util.List; //import java.util.List;
import java.util.Map; //import java.util.Map;
//
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; //import org.springframework.util.CollectionUtils;
//
import com.fasterxml.jackson.databind.ObjectMapper; //import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.fas.business.action.result.ActionResult; //import com.yeejoin.amos.fas.business.action.result.ActionResult;
import com.yeejoin.amos.fas.business.action.result.BubbleTipResult; //import com.yeejoin.amos.fas.business.action.result.BubbleTipResult;
import com.yeejoin.amos.fas.business.action.result.message.ActionResultMessage; //import com.yeejoin.amos.fas.business.action.result.message.ActionResultMessage;
import com.yeejoin.amos.fas.business.service.impl.RuleRunigSnapshotServiceImpl; //import com.yeejoin.amos.fas.business.service.impl.RuleRunigSnapshotServiceImpl;
import com.yeejoin.amos.fas.business.service.intfc.FireStengthService; //import com.yeejoin.amos.fas.business.service.intfc.FireStengthService;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance; //import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService; //import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus; //import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
import com.yeejoin.amos.fas.business.service.model.ContingencyRo; //import com.yeejoin.amos.fas.business.service.model.ContingencyRo;
import com.yeejoin.amos.fas.business.util.StringUtil; //import com.yeejoin.amos.fas.business.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; //import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.FireStrength; //import com.yeejoin.amos.fas.dao.entity.FireStrength;
//
@Component //@Component
public class ContingencyAction implements CustomerAction { //public class ContingencyAction implements CustomerAction {
//
//
private static String PACKAGEURL = "com.yeejoin.amos.fas.business.action.result.message."; // private static String PACKAGEURL = "com.yeejoin.amos.fas.business.action.result.message.";
//
@Autowired // @Autowired
private IContingencyInstance iContingencyInstance; // private IContingencyInstance iContingencyInstance;
//
@Autowired // @Autowired
private FireStengthService fireStrengthService; // private FireStengthService fireStrengthService;
//
// private RestTemplate restTemplate = new RestTemplate(); // // private RestTemplate restTemplate = new RestTemplate();
//
// @Value("${bussunis.domain}") // // @Value("${bussunis.domain}")
// private String bussunisDomain ; // // private String bussunisDomain ;
//
@Autowired // @Autowired
private IRiskSourceService riskSourceService; // private IRiskSourceService riskSourceService;
//
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<>();
static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); // static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
//
//当值值班长(S1)、副值班长(S2)、值班员(A1,A2,A3)、白班值班员、保安人员、驻站消防队长(F1) // //当值值班长(S1)、副值班长(S2)、值班员(A1,A2,A3)、白班值班员、保安人员、驻站消防队长(F1)
/* private static Map<String, String> positionMap = new HashMap<String, String>() {{ // /* private static Map<String, String> positionMap = new HashMap<String, String>() {{
put("S1", "S1"); // put("S1", "S1");
put("S2", "S2"); // put("S2", "S2");
put("A1", "A1"); // put("A1", "A1");
put("A2", "A2"); // put("A2", "A2");
put("A3", "A3"); // put("A3", "A3");
put("F1", "F1"); // put("F1", "F1");
}}; // }};
*/ //*/
//
private Map<String, String> getStrengthMap(String batchNo) { // private Map<String, String> getStrengthMap(String batchNo) {
//
Map<String,String> returnMap = stringStringMap.get(batchNo); // Map<String,String> returnMap = stringStringMap.get(batchNo);
if (CollectionUtils.isEmpty(returnMap)) { // if (CollectionUtils.isEmpty(returnMap)) {
stringStringMap = new HashMap<>(); // stringStringMap = new HashMap<>();
returnMap = new HashMap<>(); // returnMap = new HashMap<>();
//
//
//
Date now = new Date(); // Date now = new Date();
String time = sdf.format(now); // String time = sdf.format(now);
//
//
List<FireStrength> strengths = fireStrengthService.queryForStrengthList(time); // List<FireStrength> strengths = fireStrengthService.queryForStrengthList(time);
// List<FireStrength> strengths = iStrengthRepository.queryForStrengthList(time); // // List<FireStrength> strengths = iStrengthRepository.queryForStrengthList(time);
//
if (!CollectionUtils.isEmpty(strengths)) // if (!CollectionUtils.isEmpty(strengths))
{ // {
for (FireStrength fireStrength : strengths) // for (FireStrength fireStrength : strengths)
{ // {
String name = returnMap.get(fireStrength.getPosition()); // String name = returnMap.get(fireStrength.getPosition());
if (StringUtil.isNotEmpty(name)) // if (StringUtil.isNotEmpty(name))
{ // {
returnMap.put(fireStrength.getPosition(), name + "、" + fireStrength.getUsername()); // returnMap.put(fireStrength.getPosition(), name + "、" + fireStrength.getUsername());
}else // }else
{ // {
returnMap.put(fireStrength.getPosition(), fireStrength.getUsername()); // returnMap.put(fireStrength.getPosition(), fireStrength.getUsername());
} // }
} // }
} // }
stringStringMap.put(batchNo,returnMap); // stringStringMap.put(batchNo,returnMap);
} // }
return returnMap; // return returnMap;
} // }
//
//
public static void sendcmd(String firstStr, String secondStr, String thirdStr, BubbleTipResult result) { // public static void sendcmd(String firstStr, String secondStr, String thirdStr, BubbleTipResult result) {
//
Constructor<?> constructor; // Constructor<?> constructor;
try { // try {
constructor = Class.forName( // constructor = Class.forName(
PACKAGEURL + result.getClass().getSimpleName() + "Message") // PACKAGEURL + result.getClass().getSimpleName() + "Message")
.getConstructor(ActionResult.class); // .getConstructor(ActionResult.class);
ActionResultMessage<?> action = (ActionResultMessage<?>) constructor.newInstance(result); // ActionResultMessage<?> action = (ActionResultMessage<?>) constructor.newInstance(result);
action.execute(firstStr, secondStr, thirdStr); // action.execute(firstStr, secondStr, thirdStr);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
//
//
/** // /**
* @param stepCode 当前步骤编号 // * @param stepCode 当前步骤编号
* @param stepName 当前步骤名称 // * @param stepName 当前步骤名称
* @param state 当前步骤状态 // * @param state 当前步骤状态
* @param nextStepCode 下一步编号 // * @param nextStepCode 下一步编号
* @param nextStepName 下一步名称 // * @param nextStepName 下一步名称
* @param stepType 步骤类型,总览步骤、详细步骤 // * @param stepType 步骤类型,总览步骤、详细步骤
* @param paramObj 预案对象 // * @param paramObj 预案对象
*/ // */
public void stepInfo(String stepCode, String stepName, String state, String nextStepCode, String nextStepName, String stepType, Object paramObj) { // public void stepInfo(String stepCode, String stepName, String state, String nextStepCode, String nextStepName, String stepType, Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; // ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); // stopSnapshop(contingencyRo);
//
//
BubbleTipResult result = new BubbleTipResult(); // BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>(); // Map<String, Object> tempmap1 = new HashMap<>();
//
tempmap1.put("stepCode", stepCode); // tempmap1.put("stepCode", stepCode);
tempmap1.put("stepName", stepName); // tempmap1.put("stepName", stepName);
tempmap1.put("state", state); // tempmap1.put("state", state);
tempmap1.put("nextStepCode", nextStepCode); // tempmap1.put("nextStepCode", nextStepCode);
tempmap1.put("nextStepName", nextStepName); // tempmap1.put("nextStepName", nextStepName);
tempmap1.put("batchNo", contingencyRo.getBatchNo()); // tempmap1.put("batchNo", contingencyRo.getBatchNo());
tempmap1.put("contingencyRo", contingencyRo); // tempmap1.put("contingencyRo", contingencyRo);
result.add(tempmap1); // result.add(tempmap1);
//
this.sendcmd("fromws", "stepArea", stepType, result); // this.sendcmd("fromws", "stepArea", stepType, result);
} // }
//
/** // /**
* @param stepCode 当前步骤编号 // * @param stepCode 当前步骤编号
* @param paramObj 预案对象 // * @param paramObj 预案对象
*/ // */
public void saveStepInfo(String stepCode, Object paramObj) { // public void saveStepInfo(String stepCode, Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; // ContingencyRo contingencyRo = (ContingencyRo) paramObj;
iContingencyInstance.updateStep(stepCode, contingencyRo.getBatchNo()); // iContingencyInstance.updateStep(stepCode, contingencyRo.getBatchNo());
} // }
//
//
/** // /**
* @param content 消息内容 // * @param content 消息内容
* @param paramObj 预案对象 // * @param paramObj 预案对象
*/ // */
public void messageRecord(String content, Object paramObj) { // public void messageRecord(String content, Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; // ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); // stopSnapshop(contingencyRo);
//转换content中的变量 // //转换content中的变量
content = instedParams(content,contingencyRo); // content = instedParams(content,contingencyRo);
//
BubbleTipResult result = new BubbleTipResult(); // BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>(); // Map<String, Object> tempmap1 = new HashMap<>();
//
tempmap1.put("refresh", "refresh"); // tempmap1.put("refresh", "refresh");
tempmap1.put("batchNo", contingencyRo.getBatchNo()); // tempmap1.put("batchNo", contingencyRo.getBatchNo());
result.add(tempmap1); // result.add(tempmap1);
iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", content, "MESSAGE", ""); // iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", content, "MESSAGE", "");
this.sendcmd("fromws", "recordArea", "refresh", result); // this.sendcmd("fromws", "recordArea", "refresh", result);
} // }
//
/** // /**
* <pre> // * <pre>
* 智能辅助 // * 智能辅助
* </pre> // * </pre>
* // *
* @param step 当前步骤 // * @param step 当前步骤
* @param icon 图标 // * @param icon 图标
* @param title 标题 // * @param title 标题
* @param image 图片集合 // * @param image 图片集合
* @param table 表格 // * @param table 表格
* @param content 内容 // * @param content 内容
* @param paramObj 预案对象 // * @param paramObj 预案对象
*/ // */
public void help(String step, String icon, String title, String image, String table, String content, Object paramObj) { // public void help(String step, String icon, String title, String image, String table, String content, Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; // ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); // stopSnapshop(contingencyRo);
//
//
//转换智能辅助中的变量 // //转换智能辅助中的变量
content = instedParams(content,contingencyRo); // content = instedParams(content,contingencyRo);
//
BubbleTipResult result = new BubbleTipResult(); // BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>(); // Map<String, Object> tempmap1 = new HashMap<>();
//
tempmap1.put("icon", icon); // tempmap1.put("icon", icon);
tempmap1.put("step", step); // tempmap1.put("step", step);
tempmap1.put("title", title); // tempmap1.put("title", title);
tempmap1.put("content", content); // tempmap1.put("content", content);
tempmap1.put("image", image); // tempmap1.put("image", image);
tempmap1.put("table", table); // tempmap1.put("table", table);
tempmap1.put("batchNo", contingencyRo.getBatchNo()); // tempmap1.put("batchNo", contingencyRo.getBatchNo());
tempmap1.put("contingencyRo", contingencyRo); // tempmap1.put("contingencyRo", contingencyRo);
result.add(tempmap1); // result.add(tempmap1);
//
this.sendcmd("fromws", "helpArea", "", result); // this.sendcmd("fromws", "helpArea", "", result);
} // }
//
//
private String instedParams(String content, ContingencyRo contingencyRo) { // private String instedParams(String content, ContingencyRo contingencyRo) {
//
Map<String, String> strengthMap = this.getStrengthMap(contingencyRo.getBatchNo()); // Map<String, String> strengthMap = this.getStrengthMap(contingencyRo.getBatchNo());
for (String key : strengthMap.keySet()) // for (String key : strengthMap.keySet())
content = content.replaceAll("\\$\\{" + key + "}", strengthMap.get(key)); // content = content.replaceAll("\\$\\{" + key + "}", strengthMap.get(key));
//
//
/* for (String key : positionMap.keySet()) // /* for (String key : positionMap.keySet())
c ontent = content.replaceAll("\\$\\{" + key + "}", positionMap.get(key)); // c ontent = content.replaceAll("\\$\\{" + key + "}", positionMap.get(key));
*/ //*/
//
Field[] fields = contingencyRo.getClass().getDeclaredFields(); // Field[] fields = contingencyRo.getClass().getDeclaredFields();
Method getMethod = null; // Method getMethod = null;
try { // try {
for (Field field : fields) { // for (Field field : fields) {
if(field.getName().equals("serialVersionUID")) // if(field.getName().equals("serialVersionUID"))
continue; // continue;
String fileNameInMethod = String.valueOf(field.getName().charAt(0)).toUpperCase() + field.getName().substring(1); // String fileNameInMethod = String.valueOf(field.getName().charAt(0)).toUpperCase() + field.getName().substring(1);
getMethod = contingencyRo.getClass().getMethod("get" + fileNameInMethod); // getMethod = contingencyRo.getClass().getMethod("get" + fileNameInMethod);
String value = String.valueOf(getMethod.invoke(contingencyRo)); // String value = String.valueOf(getMethod.invoke(contingencyRo));
content = content.replaceAll("\\$\\{" + field.getName() + "}", value); // content = content.replaceAll("\\$\\{" + field.getName() + "}", value);
} // }
//
content = content.replaceAll("\\$\\{", ""); // content = content.replaceAll("\\$\\{", "");
content = content.replaceAll("}", ""); // content = content.replaceAll("}", "");
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
return content; // return content;
} // }
//
//
/** // /**
* 交互动作 // * 交互动作
* // *
* @param actionName 动作名称 // * @param actionName 动作名称
* @param icon 图标 // * @param icon 图标
* @param tips 提示信息 // * @param tips 提示信息
* @param buttonJson 按钮json字符串 // * @param buttonJson 按钮json字符串
* @param paramObj 预案对象 // * @param paramObj 预案对象
*/ // */
public void operation(String actionName, String icon, String tips, String buttonJson, Object paramObj) { // public void operation(String actionName, String icon, String tips, String buttonJson, Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; // ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); // stopSnapshop(contingencyRo);
//
//转换content中的变量 // //转换content中的变量
tips = instedParams(tips,contingencyRo); // tips = instedParams(tips,contingencyRo);
//
//
BubbleTipResult result = new BubbleTipResult(); // BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>(); // Map<String, Object> tempmap1 = new HashMap<>();
//
//
String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson); // String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson);
//
//
tempmap1.put("actionName", actionName); // tempmap1.put("actionName", actionName);
tempmap1.put("icon", icon); // tempmap1.put("icon", icon);
tempmap1.put("tips", tips); // tempmap1.put("tips", tips);
tempmap1.put("buttonJson", buttonJson); // tempmap1.put("buttonJson", buttonJson);
tempmap1.put("batchNo", contingencyRo.getBatchNo()); // tempmap1.put("batchNo", contingencyRo.getBatchNo());
tempmap1.put("contingencyRo", contingencyRo); // tempmap1.put("contingencyRo", contingencyRo);
tempmap1.put("contingencyPlanId", contingencyPlanId); // tempmap1.put("contingencyPlanId", contingencyPlanId);
result.add(tempmap1); // result.add(tempmap1);
//
//
this.sendcmd("fromws", "optionArea", "", result); // this.sendcmd("fromws", "optionArea", "", result);
//
//
sendButton(contingencyRo.getBatchNo(),contingencyPlanId,contingencyRo.getEquipmentId(),actionName,buttonJson); // sendButton(contingencyRo.getBatchNo(),contingencyPlanId,contingencyRo.getEquipmentId(),actionName,buttonJson);
//
} // }
//
//
private boolean sendButton(String batchNo,String contingencyPlanId,String equipmentId,String actionName,String buttonJson) { // private boolean sendButton(String batchNo,String contingencyPlanId,String equipmentId,String actionName,String buttonJson) {
//
// String url = bussunisDomain+ "/api/risksource/contingency/setup"; // // String url = bussunisDomain+ "/api/risksource/contingency/setup";
//
ObjectMapper objectMapper = new ObjectMapper(); // ObjectMapper objectMapper = new ObjectMapper();
//Map<String,Object> map = new HashMap<>(); // //Map<String,Object> map = new HashMap<>();
//
/** // /**
* batchNo // * batchNo
* stepCode // * stepCode
* buttonCode // * buttonCode
* confirm // * confirm
* contingencyPlanId // * contingencyPlanId
* stepState // * stepState
*/ // */
//
try { // try {
Map button = objectMapper.readValue(buttonJson,Map.class); // Map button = objectMapper.readValue(buttonJson,Map.class);
Map operateInstance = (Map)((List)button.get("operate")).get(0); // Map operateInstance = (Map)((List)button.get("operate")).get(0);
// map.put("batchNo",batchNo); //// map.put("batchNo",batchNo);
// map.put("actionName",actionName); //// map.put("actionName",actionName);
// map.put("equipmentId",equipmentId); //// map.put("equipmentId",equipmentId);
// map.put("stepCode",button.get("stepCode")); //// map.put("stepCode",button.get("stepCode"));
// map.put("buttonCode",operateInstance.get("code")); //// map.put("buttonCode",operateInstance.get("code"));
// map.put("confirm","CONFIRM"); //// map.put("confirm","CONFIRM");
// map.put("stepState",operateInstance.get("stepState")); //// map.put("stepState",operateInstance.get("stepState"));
// map.put("contingencyPlanId",contingencyPlanId); //// map.put("contingencyPlanId",contingencyPlanId);
ContingencyDeviceStatus contingencyDeviceStatus = new ContingencyDeviceStatus(); // ContingencyDeviceStatus contingencyDeviceStatus = new ContingencyDeviceStatus();
contingencyDeviceStatus.setActionName(actionName); // contingencyDeviceStatus.setActionName(actionName);
contingencyDeviceStatus.setButtonCode(String.valueOf(operateInstance.get("code"))); // contingencyDeviceStatus.setButtonCode(String.valueOf(operateInstance.get("code")));
contingencyDeviceStatus.setConfirm("CONFIRM"); // contingencyDeviceStatus.setConfirm("CONFIRM");
contingencyDeviceStatus.setContingencyPlanId(contingencyPlanId); // contingencyDeviceStatus.setContingencyPlanId(contingencyPlanId);
contingencyDeviceStatus.setEquipmentId(equipmentId); // contingencyDeviceStatus.setEquipmentId(equipmentId);
contingencyDeviceStatus.setStepCode(String.valueOf(button.get("stepCode"))); // contingencyDeviceStatus.setStepCode(String.valueOf(button.get("stepCode")));
contingencyDeviceStatus.setStepState(String.valueOf(operateInstance.get("stepState"))); // contingencyDeviceStatus.setStepState(String.valueOf(operateInstance.get("stepState")));
riskSourceService.queryContingencyDeviceStatus(contingencyDeviceStatus); // riskSourceService.queryContingencyDeviceStatus(contingencyDeviceStatus);
//HttpEntity<Map> entity = new HttpEntity<>(map); // //HttpEntity<Map> entity = new HttpEntity<>(map);
// restTemplate.exchange(url, HttpMethod.POST,entity,Map.class); // // restTemplate.exchange(url, HttpMethod.POST,entity,Map.class);
//
} catch (IOException e) { // } catch (IOException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
//
return false; // return false;
} // }
//
//
/** // /**
* 保存交互动作 // * 保存交互动作
* // *
* @param actionName 动作名称 // * @param actionName 动作名称
* @param icon 图标 // * @param icon 图标
* @param tips 提示信息 // * @param tips 提示信息
* @param buttonJson 按钮json字符串 // * @param buttonJson 按钮json字符串
* @param paramObj 预案对象 // * @param paramObj 预案对象
*/ // */
public void saveOperation(String actionName, String icon, String tips, String buttonJson, Object paramObj) { // public void saveOperation(String actionName, String icon, String tips, String buttonJson, Object paramObj) {
//
ContingencyRo contingencyRo = (ContingencyRo) paramObj; // ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); // stopSnapshop(contingencyRo);
//
//转换content中的变量 // //转换content中的变量
tips = instedParams(tips,contingencyRo); // tips = instedParams(tips,contingencyRo);
//
BubbleTipResult result1 = new BubbleTipResult(); // BubbleTipResult result1 = new BubbleTipResult();
Map<String, Object> tempmap2 = new HashMap<>(); // Map<String, Object> tempmap2 = new HashMap<>();
tempmap2.put("refresh", "refresh"); // tempmap2.put("refresh", "refresh");
tempmap2.put("batchNo", contingencyRo.getBatchNo()); // tempmap2.put("batchNo", contingencyRo.getBatchNo());
result1.add(tempmap2); // result1.add(tempmap2);
//
String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson); // String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson);
//
this.sendcmd("fromws", "recordArea", "refresh", result1); // this.sendcmd("fromws", "recordArea", "refresh", result1);
//
} // }
//
private String getContingencyPlanId(String batchNo, String actionName, String icon, String tips, String buttonJson) { // private String getContingencyPlanId(String batchNo, String actionName, String icon, String tips, String buttonJson) {
String cacheKey = batchNo + actionName; // String cacheKey = batchNo + actionName;
String contingencyPlanId = null; // String contingencyPlanId = null;
ContingencyPlanInstance contingencyPlanInstance = null; // ContingencyPlanInstance contingencyPlanInstance = null;
if (OPERATE_RECORD_ID.get(cacheKey) == null) { // if (OPERATE_RECORD_ID.get(cacheKey) == null) {
contingencyPlanInstance = iContingencyInstance.createInstanceRecord(batchNo, actionName, "DEFAULT", buttonJson, "OPERATE", icon); // contingencyPlanInstance = iContingencyInstance.createInstanceRecord(batchNo, actionName, "DEFAULT", buttonJson, "OPERATE", icon);
contingencyPlanId = contingencyPlanInstance.getId(); // contingencyPlanId = contingencyPlanInstance.getId();
OPERATE_RECORD_ID.put(cacheKey, contingencyPlanId); // OPERATE_RECORD_ID.put(cacheKey, contingencyPlanId);
} else { // } else {
contingencyPlanId = OPERATE_RECORD_ID.get(cacheKey); // contingencyPlanId = OPERATE_RECORD_ID.get(cacheKey);
OPERATE_RECORD_ID.remove(cacheKey); // OPERATE_RECORD_ID.remove(cacheKey);
} // }
return contingencyPlanId; // return contingencyPlanId;
} // }
//
//
/** // /**
* 地图动作推送 // * 地图动作推送
* // *
* @param actionName 动作名称标识 // * @param actionName 动作名称标识
* @param paramObj 预案对象 // * @param paramObj 预案对象
*/ // */
public void mapAction(String actionName, Object paramObj) { // public void mapAction(String actionName, Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; // ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); // stopSnapshop(contingencyRo);
//
//
BubbleTipResult result = new BubbleTipResult(); // BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>(); // Map<String, Object> tempmap1 = new HashMap<>();
//
tempmap1.put("actionName", actionName); // tempmap1.put("actionName", actionName);
tempmap1.put("batchNo", contingencyRo.getBatchNo()); // tempmap1.put("batchNo", contingencyRo.getBatchNo());
tempmap1.put("contingencyRo", contingencyRo); // tempmap1.put("contingencyRo", contingencyRo);
result.add(tempmap1); // result.add(tempmap1);
//
this.sendcmd("fromws", "mapArea", actionName, result); // this.sendcmd("fromws", "mapArea", actionName, result);
} // }
//
//
/** // /**
* 顶部消息提示 // * 顶部消息提示
* // *
* @param content 消息内容 // * @param content 消息内容
* @param messageType 消息类型 messageType 黑色框消息类型CONTINGENCY,,滚动消息:CURRENTMESSAGE // * @param messageType 消息类型 messageType 黑色框消息类型CONTINGENCY,,滚动消息:CURRENTMESSAGE
* @param paramObj 预案对象 // * @param paramObj 预案对象
*/ // */
public void topMessage(String content, String messageType, Object paramObj) { // public void topMessage(String content, String messageType, Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; // ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); // stopSnapshop(contingencyRo);
//
//
BubbleTipResult result = new BubbleTipResult(); // BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>(); // Map<String, Object> tempmap1 = new HashMap<>();
//转换content中的变量 // //转换content中的变量
content = instedParams(content,contingencyRo); // content = instedParams(content,contingencyRo);
//
tempmap1.put("content", content); // tempmap1.put("content", content);
tempmap1.put("messageType", messageType);//消息类型 messageType 黑色框消息类型 CONTINGENCY,,滚动消息:CURRENTMESSAGE // tempmap1.put("messageType", messageType);//消息类型 messageType 黑色框消息类型 CONTINGENCY,,滚动消息:CURRENTMESSAGE
tempmap1.put("batchNo", contingencyRo.getBatchNo()); // tempmap1.put("batchNo", contingencyRo.getBatchNo());
tempmap1.put("contingencyRo", contingencyRo); // tempmap1.put("contingencyRo", contingencyRo);
result.add(tempmap1); // result.add(tempmap1);
//
this.sendcmd("fromws", "topArea", messageType, result); // this.sendcmd("fromws", "topArea", messageType, result);
} // }
//
//
private void stopSnapshop(ContingencyRo contingencyRo) { // private void stopSnapshop(ContingencyRo contingencyRo) {
if (RuleRunigSnapshotServiceImpl.getReplayBatchNo() != null && !RuleRunigSnapshotServiceImpl.getReplayBatchNo().equals(contingencyRo.getBatchNo())) // if (RuleRunigSnapshotServiceImpl.getReplayBatchNo() != null && !RuleRunigSnapshotServiceImpl.getReplayBatchNo().equals(contingencyRo.getBatchNo()))
RuleRunigSnapshotServiceImpl.setReplayBatchNoToNull(); // RuleRunigSnapshotServiceImpl.setReplayBatchNoToNull();
} // }
//
} //}
package com.yeejoin.amos.fas.business.action;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Component;
import com.yeejoin.amos.fas.business.action.result.ActionResult;
import com.yeejoin.amos.fas.business.action.result.BubbleTipResult;
import com.yeejoin.amos.fas.business.action.result.message.ActionResultMessage;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
/**
*
* <pre>
* 风险态势图动作
* </pre>
*
* @author amos
* @version $Id: RiskSituationAction.java, v 0.1 2019年5月16日 下午5:26:27 amos Exp $
*/
@Component
public class RiskSituationAction implements CustomerAction
{
private static String PACKAGEURL = "com.yeejoin.amos.rule.map.action.result.message.";
//@ExposeAction("气泡提示")
public void sendBubbleTip(Object bizobj, Boolean showInfo, String title)
{
BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>();
tempmap1.put("bizobj", bizobj);
result.add(tempmap1);
//是否显示气泡
Map<String, Object> tempmap2 = new HashMap<>();
tempmap2.put("showInfo", showInfo);
result.add(tempmap2);
//显示title提示
Map<String, Object> tempmap3 = new HashMap<>();
tempmap3.put("title", title);
result.add(tempmap3);
Constructor<?> constructor;
try
{
constructor = Class.forName(
PACKAGEURL + result.getClass().getSimpleName() + "Message")
.getConstructor(ActionResult.class);
ActionResultMessage<?> action = (ActionResultMessage<?>) constructor.newInstance(result);
String firstStr = "fromws";
String secondStr = "riskSituation";
String thirdStr = "bubble";
Object obj = action.execute(firstStr, secondStr, thirdStr);
result.setToipResponse((ToipResponse) obj);
}
catch (Exception e)
{
e.printStackTrace();
}
}
//@ExposeAction("区域颜色改变")
public void regionChange(Object bizobj, String colour)
{
BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>();
tempmap1.put("bizobj", bizobj);
result.add(tempmap1);
//更改颜色
Map<String, Object> tempmap2 = new HashMap<>();
tempmap2.put("colour", colour);
result.add(tempmap2);
Constructor<?> constructor;
try
{
constructor = Class.forName(
PACKAGEURL + result.getClass().getSimpleName() + "Message")
.getConstructor(ActionResult.class);
ActionResultMessage<?> action = (ActionResultMessage<?>) constructor.newInstance(result);
String firstStr = "fromws";
String secondStr = "riskSituation";
String thirdStr = "colour";
Object obj = action.execute(firstStr, secondStr, thirdStr);
result.setToipResponse((ToipResponse) obj);
}
catch (Exception e)
{
e.printStackTrace();
}
}
//@ExposeAction(value = "区域闪烁",snapshot = false)
public void regionFlicker(Object bizobj, Integer frequency)
{
BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>();
tempmap1.put("bizobj", bizobj);
result.add(tempmap1);
//更改颜色
Map<String, Object> tempmap2 = new HashMap<>();
tempmap2.put("frequency", frequency);
result.add(tempmap2);
Constructor<?> constructor;
try
{
constructor = Class.forName(
PACKAGEURL + result.getClass().getSimpleName() + "Message")
.getConstructor(ActionResult.class);
ActionResultMessage<?> action = (ActionResultMessage<?>) constructor.newInstance(result);
String firstStr = "fromws";
String secondStr = "riskSituation";
String thirdStr = "flicker";
Object obj = action.execute(firstStr, secondStr, thirdStr);
result.setToipResponse((ToipResponse) obj);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
package com.yeejoin.amos.fas.business.action;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.yeejoin.amos.fas.business.action.el.ELEvaluationContext;
import com.yeejoin.amos.fas.business.action.result.AbstractActionResult;
import com.yeejoin.amos.fas.business.action.result.ActionResult;
import com.yeejoin.amos.fas.business.action.result.TipResult;
import com.yeejoin.amos.fas.business.action.result.message.ActionResultMessage;
import com.yeejoin.amos.fas.business.action.util.DataItemUtil;
import com.yeejoin.amos.fas.business.service.model.BasicsRo;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.dao.entity.BusinessEntity;
import com.yeejoin.amos.fas.dao.entity.Message;
/**
*
* <pre>
* 消息提示动作
* </pre>
*
* @author amos
* @version $Id: SimpleTipAction.java, v 0.1 2019年4月24日 下午2:47:37 amos Exp $
*/
@Component
public class SimpleTipAction implements CustomerAction
{
private static String PACKAGEURL = "com.yeejoin.amos.rule.map.action.result.message.";
// @Autowired
// private IMessageService messageService;
//@ExposeAction("消息提示")
// public void sendMessageTip(Object bizobj, String title, String content,String type)
// {
//
// try
// {
//
// ELEvaluationContext.setVariable("bizobj",bizobj);
// TipResult result = new TipResult();
// result.add(bizobj);
// Map<String, Object> tempmap1 = new HashMap<>();
// tempmap1.put("title", title);
// result.add(tempmap1);
// Map<String, Object> tempmap2 = new HashMap<>();
// content =DataItemUtil.getNative(content);
// tempmap2.put("content", content);
// result.add(tempmap2);
//
//
// Constructor<?> constructor;
//
// constructor = Class.forName(
// PACKAGEURL + result.getClass().getSimpleName() + "Message")
// .getConstructor(ActionResult.class);
// ActionResultMessage<?> action = (ActionResultMessage<?>) constructor.newInstance(result);
// String firstStr = "fromws";
// String secondStr = "global";
// String thirdStr = "msg";
// result.setBizObj((BusinessEntity)bizobj);
// Object obj = action.execute(firstStr, secondStr, thirdStr);
// result.setToipResponse((ToipResponse) obj);
// saveMessageAction(result,type);
// }
// catch (Exception e)
// {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
// @SuppressWarnings("unchecked")
// private void saveMessageAction(AbstractActionResult abstractActionResult,String type)
// {
// Message message = new Message();
// List<Map<String, Object>> list = (List<Map<String, Object>>) abstractActionResult.getData();
// for(Map<String, Object> map : list) {
// for(String str: map.keySet()) {
// if(str.equals("content")) {
// message.setContent(map.get("content").toString());
// }else
// if (str.equals("title"))
// {
// message.setTitle(map.get("title").toString());
// }
// }
// BasicsRo basicsRo = (BasicsRo)abstractActionResult.getToipResponse().getBizObj();
// message.setTime(basicsRo.getDateTime());
// message.setBizId(basicsRo.getId());
// message.setBizclassName(abstractActionResult.getToipResponse().getBizObj().getClass().toString());
// message.setType(type);
// messageService.save(message);
// }
// }
}
package com.yeejoin.amos.fas.business.action.el;
import java.util.Map;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
public class ELEvaluationContext
{
private static EvaluationContext instance = new StandardEvaluationContext();
private static ExpressionParser parser = new SpelExpressionParser();
public static EvaluationContext getInstance()
{
return instance;
}
public static void setVariable(String name, Object value)
{
instance.setVariable(name, value);
}
public static void setVariable(Map<String, Object> vars)
{
for (Map.Entry<String, Object> entry : vars.entrySet())
{
instance.setVariable(entry.getKey(), entry.getValue());
}
}
public static Object getValue(String Expression){
return parser.parseExpression(Expression).getValue(instance);
}
}
package com.yeejoin.amos.fas.business.action.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.fas.business.action.el.ELEvaluationContext;
public class DataItemUtil
{
public static boolean getEnable(JSONObject jsonObject)
{
try
{
return jsonObject.getBooleanValue("enable");
}
catch (Exception e)
{
return false;
}
}
public static String getDisplayName(JSONObject jsonObject)
{
try
{
return jsonObject.get("displayname").toString();
}
catch (Exception e)
{
return null;
}
}
public static String getValue(JSONObject jsonObject)
{
try
{
return jsonObject.get("value").toString();
}
catch (Exception e)
{
return null;
}
}
public static String getName(JSONObject jsonObject)
{
try
{
return jsonObject.get("name").toString();
}
catch (Exception e)
{
return null;
}
}
public static 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;
}
}
...@@ -249,6 +249,8 @@ public class BaseController { ...@@ -249,6 +249,8 @@ public class BaseController {
if (reginParams.getCompany() != null) { if (reginParams.getCompany() != null) {
return reginParams.getCompany().getOrgCode(); return reginParams.getCompany().getOrgCode();
} }
return null; return null;
} }
......
package com.yeejoin.amos.fas.business.controller; //package com.yeejoin.amos.fas.business.controller;
//
//
import com.yeejoin.amos.fas.business.service.impl.ContingencyInstanceImpl; //import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance; //import com.yeejoin.amos.fas.business.service.intfc.IContingencyOriginalDataService;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyOriginalDataService; //import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.request.CommonPageable; //import com.yeejoin.amos.fas.core.common.request.CommonRequest;
import com.yeejoin.amos.fas.core.common.request.CommonRequest; //import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponse; //import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil; //import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; //import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiOperation; //import org.slf4j.Logger;
import io.swagger.annotations.ApiParam; //import org.slf4j.LoggerFactory;
import org.slf4j.Logger; //import org.springframework.beans.factory.annotation.Autowired;
import org.slf4j.LoggerFactory; //import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.util.CollectionUtils;
import org.springframework.scheduling.annotation.Scheduled; //import org.springframework.web.bind.annotation.*;
import org.springframework.util.CollectionUtils; //
import org.springframework.web.bind.annotation.*; //import java.util.HashMap;
//import java.util.LinkedList;
import javax.xml.bind.ValidationEvent; //import java.util.List;
import java.util.*; //import java.util.Map;
//
@RestController //@RestController
@RequestMapping(value = "/api/timeline") //@RequestMapping(value = "/api/timeline")
@Api(tags="时间轴") //@Api(tags="时间轴")
public class TimeLineController extends BaseController{ //public class TimeLineController extends BaseController{
//
private static final Logger log = LoggerFactory.getLogger(TimeLineController.class); // private static final Logger log = LoggerFactory.getLogger(TimeLineController.class);
@Autowired //
IContingencyInstance iContingencyInstance; // @Autowired
// IContingencyOriginalDataService iContingencyOriginalDataService;
@Autowired //
IContingencyOriginalDataService iContingencyOriginalDataService; // static LinkedList<Map<String,String >> fireQueue = new LinkedList<>();
//
static LinkedList<Map<String,String >> fireQueue = new LinkedList<>(); //
// //@Authorization(ingore = true)
// @ApiOperation(httpMethod = "GET",value = "根据批次号查询时间轴", notes = "根据批次号查询时间轴")
//@Authorization(ingore = true) // @RequestMapping(value = "/{instanceNo}", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET",value = "根据批次号查询时间轴", notes = "根据批次号查询时间轴") // public CommonResponse queryPoint(@PathVariable String instanceNo,@RequestParam("recordType") String recordType) throws Exception{
@RequestMapping(value = "/{instanceNo}", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) // return CommonResponseUtil.success();
public CommonResponse queryPoint(@PathVariable String instanceNo,@RequestParam("recordType") String recordType) throws Exception{ //// return CommonResponseUtil.success(iContingencyInstance.queryForTimeLine(instanceNo,recordType));
// }
return CommonResponseUtil.success(iContingencyInstance.queryForTimeLine(instanceNo,recordType)); //
} //
// //@Authorization(ingore = true)
// @ApiOperation(httpMethod = "PUT",value = "点击按钮", notes = "点击按钮")
//@Authorization(ingore = true) // @RequestMapping(value = "/fire", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT",value = "点击按钮", notes = "点击按钮") // public CommonResponse fire(@RequestParam("batchNo") String batchNo,
@RequestMapping(value = "/fire", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT) // @RequestParam("stepCode") String stepCode,
public CommonResponse fire(@RequestParam("batchNo") String batchNo, // @RequestParam("buttonCode") String buttonCode,
@RequestParam("stepCode") String stepCode, // @RequestParam("confirm") String confirm,
@RequestParam("buttonCode") String buttonCode, // @RequestParam("contingencyPlanId") String contingencyPlanId,
@RequestParam("confirm") String confirm, // @RequestParam("stepState") String stepState) throws Exception{
@RequestParam("contingencyPlanId") String contingencyPlanId, //
@RequestParam("stepState") String stepState) throws Exception{ //
// Map<String,String> map = new HashMap<>();
// map.put("batchNo",batchNo);
Map<String,String> map = new HashMap<>(); // map.put("stepCode",stepCode);
map.put("batchNo",batchNo); // map.put("buttonCode",buttonCode);
map.put("stepCode",stepCode); // map.put("confirm",confirm);
map.put("buttonCode",buttonCode); // map.put("contingencyPlanId",contingencyPlanId);
map.put("confirm",confirm); // map.put("stepState",stepState);
map.put("contingencyPlanId",contingencyPlanId); // fireQueue.addLast(map);
map.put("stepState",stepState); //
fireQueue.addLast(map); // return CommonResponseUtil.success("SUCCESS");
// }
return CommonResponseUtil.success("SUCCESS"); //
} //
// @Scheduled(cron = "*/2 * * * * ?")
// private void runFireQueue() throws Exception
@Scheduled(cron = "*/2 * * * * ?") // {
private void runFireQueue() throws Exception //
{ // if(fireQueue.size() == 0)
// return;
if(fireQueue.size() == 0) //
return; // Map<String,String> map = fireQueue.getFirst();
//
Map<String,String> map = fireQueue.getFirst(); // String batchNo = map.get("batchNo");
// String stepCode = map.get("stepCode");
String batchNo = map.get("batchNo"); // String buttonCode = map.get("buttonCode");
String stepCode = map.get("stepCode"); // String confirm = map.get("confirm");
String buttonCode = map.get("buttonCode"); // String contingencyPlanId = map.get("contingencyPlanId");
String confirm = map.get("confirm"); // String stepState = map.get("stepState");
String contingencyPlanId = map.get("contingencyPlanId"); // try
String stepState = map.get("stepState"); // {
try // log.info("fireQueue-size:"+fireQueue.size());
{ // log.info("stepCode:" + map.get("stepCode"));
log.info("fireQueue-size:"+fireQueue.size()); // log.info("buttonCode:" + map.get("buttonCode"));
log.info("stepCode:" + map.get("stepCode")); // log.info("confirm:" + map.get("confirm"));
log.info("buttonCode:" + map.get("buttonCode")); // log.info("stepState:" + map.get("stepState"));
log.info("confirm:" + map.get("confirm")); //
log.info("stepState:" + map.get("stepState")); //// iContingencyInstance.setButtonExecuted(batchNo,contingencyPlanId,buttonCode,confirm);
//// iContingencyInstance.fire(batchNo,stepCode,contingencyPlanId,buttonCode,confirm,stepState);
iContingencyInstance.setButtonExecuted(batchNo,contingencyPlanId,buttonCode,confirm); // }catch (Exception e)
iContingencyInstance.fire(batchNo,stepCode,contingencyPlanId,buttonCode,confirm,stepState); // {
}catch (Exception e) // //iContingencyInstance.setButtonWait(batchNo,contingencyPlanId,confirm);
{ // throw e;
//iContingencyInstance.setButtonWait(batchNo,contingencyPlanId,confirm); // }finally {
throw e; // fireQueue.removeFirst();
}finally { // }
fireQueue.removeFirst(); // }
} //
} //
//
//
//
//
//
//
//
// // @Authorization(ingore = true)
// @ApiOperation(httpMethod = "POST",value = "查询预案记录", notes = "查询预案记录")
// @Authorization(ingore = true) // @RequestMapping(value = "/contingency/page", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST",value = "查询预案记录", notes = "查询预案记录") // public CommonResponse contingencyRecord(
@RequestMapping(value = "/contingency/page", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) // @ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
public CommonResponse contingencyRecord( // @ApiParam(value = "分页参数", required = true) CommonPageable commonPageable
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, // ) {
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable // //CommonPageable commonPageable = new CommonPageable(pageNumber,pageSize);
) { //
//CommonPageable commonPageable = new CommonPageable(pageNumber,pageSize); // String contingencyName = null;
// String equipmentId = null;
String contingencyName = null; // String createTime = null;
String equipmentId = null; // if(!CollectionUtils.isEmpty(queryRequests))
String createTime = null; // {
if(!CollectionUtils.isEmpty(queryRequests)) // for(CommonRequest request:queryRequests)
{ // {
for(CommonRequest request:queryRequests) // if("contingencyName".equals(request.getName()))
{ // {
if("contingencyName".equals(request.getName())) // contingencyName = String.valueOf(request.getValue());
{ // }
contingencyName = String.valueOf(request.getValue()); // if("equipmentId".equals(request.getName()))
} // {
if("equipmentId".equals(request.getName())) // equipmentId = String.valueOf(request.getValue());
{ // }
equipmentId = String.valueOf(request.getValue()); // if("createTime".equals(request.getName()))
} // {
if("createTime".equals(request.getName())) // createTime = String.valueOf(request.getValue());
{ // }
createTime = String.valueOf(request.getValue()); // }
} // }
} //
} // return CommonResponseUtil.success(iContingencyOriginalDataService.queryForPage(contingencyName,equipmentId,createTime,commonPageable));
// }
return CommonResponseUtil.success(iContingencyOriginalDataService.queryForPage(contingencyName,equipmentId,createTime,commonPageable)); //
} //
//
//
//
//
//
//
//
//
//
// String operate = "{" +
// " \"type\": \"button\"," +
String operate = "{" + // " \"operate\": [" +
" \"type\": \"button\"," + // " {" +
" \"operate\": [" + // " \"title\": \"确认着火\"," +
" {" + // " \"paramName\": \"batchNo\"," +
" \"title\": \"确认着火\"," + // " \"paramValue\": \"11\"," +
" \"paramName\": \"batchNo\"," + // " \"requestUrl\": \"url\"," +
" \"paramValue\": \"11\"," + // " \"icon\": \"querenzhuohuo\"," +
" \"requestUrl\": \"url\"," + // " \"confirm\": true," +
" \"icon\": \"querenzhuohuo\"," + // " \"state\": \"executed\"" +
" \"confirm\": true," + // " }," +
" \"state\": \"executed\"" + // " {" +
" }," + // " \"title\": \"消除误报\"," +
" {" + // " \"paramName\": \"batchNo\"," +
" \"title\": \"消除误报\"," + // " \"paramValue\": \"11\"," +
" \"paramName\": \"batchNo\"," + // " \"requestUrl\": \"url\"," +
" \"paramValue\": \"11\"," + // " \"icon\": \"xiaochuwubao\"," +
" \"requestUrl\": \"url\"," + // " \"confirm\": true," +
" \"icon\": \"xiaochuwubao\"," + // " \"state\": \"wait\"" +
" \"confirm\": true," + // " }" +
" \"state\": \"wait\"" + // " ]" +
" }" + // "}";
" ]" + //
"}"; //}
}
...@@ -11,12 +11,14 @@ public interface ContingencyOriginalMapper extends BaseMapper { ...@@ -11,12 +11,14 @@ public interface ContingencyOriginalMapper extends BaseMapper {
Long queryCountForPage( Long queryCountForPage(
@Param("equipmentId")String equipmentId, @Param("equipmentId")String equipmentId,
@Param("createTime")String createTime); @Param("createTime")String createTime,
@Param("contingencyName")String contingencyName);
List<Map> queryForPage( @Param("equipmentId")String equipmentId, List<Map> queryForPage( @Param("equipmentId")String equipmentId,
@Param("createTime")String createTime, @Param("createTime")String createTime,
@Param("start") long start, @Param("start") long start,
@Param("length") Integer length); @Param("length") Integer length,
@Param("contingencyName")String contingencyName);
} }
...@@ -144,7 +144,7 @@ public interface View3dMapper extends BaseMapper{ ...@@ -144,7 +144,7 @@ public interface View3dMapper extends BaseMapper{
*/ */
List<View3dNodeVo> initViewErrorNode(String type,Long riskSourceId, String orgCode); List<View3dNodeVo> initViewErrorNode(String type,Long riskSourceId, String orgCode);
List<Node3DVoResponse> findViewDataByType(String type,Long riskSourceId,String orgCode); List<Node3DVoResponse> findViewDataByType(@Param("type")String type,@Param("riskSourceId")Long riskSourceId,@Param("orgCode")String orgCode);
Long retrieveAllCount(String type, String inputText,String orgCode,String dataLevel,String protectObjName); Long retrieveAllCount(String type, String inputText,String orgCode,String dataLevel,String protectObjName);
......
package com.yeejoin.amos.fas.business.service.impl; //<<<<<<< HEAD
////package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.component.rule.RuleTrigger; ////
import com.yeejoin.amos.fas.business.action.ContingencyAction; ////
import com.yeejoin.amos.fas.business.action.result.BubbleTipResult; ////import com.yeejoin.amos.fas.business.action.ContingencyAction;
import com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper; ////import com.yeejoin.amos.fas.business.action.result.BubbleTipResult;
import com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao; ////import com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper;
import com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository; ////import com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao;
import com.yeejoin.amos.fas.business.feign.RemoteRuleServer; ////import com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance; ////import com.yeejoin.amos.fas.business.feign.RemoteRuleServer;
import com.yeejoin.amos.fas.business.service.model.ContingencyRo; ////import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
import com.yeejoin.amos.fas.business.service.model.Operate; ////import com.yeejoin.amos.fas.business.service.model.ContingencyRo;
import com.yeejoin.amos.fas.business.service.model.OperateGroup; ////import com.yeejoin.amos.fas.business.service.model.Operate;
import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData; ////import com.yeejoin.amos.fas.business.service.model.OperateGroup;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; ////import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData;
import com.yeejoin.amos.fas.dao.entity.Equipment; ////import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
////import com.yeejoin.amos.fas.dao.entity.Equipment;
import org.codehaus.jackson.map.ObjectMapper; ////
import org.slf4j.Logger; ////import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.LoggerFactory; ////import org.slf4j.Logger;
import org.springframework.beans.BeanUtils; ////import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; ////import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; ////import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; ////import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity; ////import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpMethod; ////import org.springframework.http.HttpEntity;
import org.springframework.scheduling.annotation.Async; ////import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service; ////import org.springframework.scheduling.annotation.Async;
import org.springframework.util.CollectionUtils; ////import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate; ////import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.component.cache.Redis; ////import org.springframework.web.client.RestTemplate;
////import org.typroject.tyboot.component.cache.Redis;
import java.util.HashMap; ////
import java.util.List; ////import java.util.HashMap;
import java.util.Map; ////import java.util.List;
import java.util.Optional; ////import java.util.Map;
////import java.util.Optional;
@Service ////
public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPlanInstance, String>*/ implements IContingencyInstance { ////@Service
////public class ContingencyInstanceImpl {
private static final Logger log = LoggerFactory.getLogger(ContingencyInstanceImpl.class); ////
//// private static final Logger log = LoggerFactory.getLogger(ContingencyInstanceImpl.class);
@Autowired //////
private IContingencyPlanInstanceRepository repository; ////// @Autowired
////// private IContingencyPlanInstanceRepository repository;
//////
@Autowired //////
IContingencyOriginalDataDao iContingencyOriginalDataDao; ////// @Autowired
////// IContingencyOriginalDataDao iContingencyOriginalDataDao;
//////
@Autowired //////
private RemoteRuleServer remoteRuleServer; ////// @Autowired
////// private RemoteRuleServer remoteRuleServer;
@Autowired //////
private RestTemplate restTemplate; ////// @Autowired
////// private RestTemplate restTemplate;
@Autowired //////
private ImpAndFireEquipMapper impAndFireEquipMapper; ////// @Autowired
////// private ImpAndFireEquipMapper impAndFireEquipMapper;
@Autowired //////
private RedisTemplate redisTemplate; ////// @Autowired
////// private RedisTemplate redisTemplate;
//////
@Value("${params.remoteRuleUrl}") //////
private String remoteRuleUrl; ////// @Value("${params.remoteRuleUrl}")
////// private String remoteRuleUrl;
//////
private static Map<String, String> stepMap = new HashMap<>(); //////
////// private static Map<String, String> stepMap = new HashMap<>();
@Autowired //////
private RuleTrigger ruleTrigger; ////// @Autowired
////// private RuleTrigger ruleTrigger;
/* public ContingencyInstanceImpl(IContingencyPlanInstanceRepository repository) { //////
super(repository); ////// /* public ContingencyInstanceImpl(IContingencyPlanInstanceRepository repository) {
this.repository = repository; ////// super(repository);
}*/ ////// this.repository = repository;
////// }*/
//////
/** //////
* 创建预案执行记录 ////// /**
* ////// * 创建预案执行记录
* @param category 一级分类 ////// *
* @param subCategory 二级分类 ////// * @param category 一级分类
* @param content 信息内容 ////// * @param subCategory 二级分类
* @param recordType 信息分类 ////// * @param content 信息内容
* @param icon 信息显示图标 ////// * @param recordType 信息分类
*/ ////// * @param icon 信息显示图标
public ContingencyPlanInstance createInstanceRecord(String instanceNo, String category, String subCategory, String content, String recordType, String icon) { ////// */
ContingencyPlanInstance planInstance = new ContingencyPlanInstance(); ////// public ContingencyPlanInstance createInstanceRecord(String instanceNo, String category, String subCategory, String content, String recordType, String icon) {
////// ContingencyPlanInstance planInstance = new ContingencyPlanInstance();
planInstance.setContent(content); //////
planInstance.setIcon(icon); ////// planInstance.setContent(content);
planInstance.setRecordType(recordType); ////// planInstance.setIcon(icon);
planInstance.setCategory(category); ////// planInstance.setRecordType(recordType);
planInstance.setBatchNo(instanceNo); ////// planInstance.setCategory(category);
////// planInstance.setBatchNo(instanceNo);
//计算序号 //////
int count = repository.countByBatchNo(instanceNo); ////// //计算序号
planInstance.setSort(++count); ////// int count = repository.countByBatchNo(instanceNo);
return this.repository.save(planInstance); ////// planInstance.setSort(++count);
} ////// return this.repository.save(planInstance);
////// }
//////
/** //////
* 查询时间轴 ////// /**
* ////// * 查询时间轴
* @param instanceNo ////// *
* @return ////// * @param instanceNo
* @throws Exception ////// * @return
*/ ////// * @throws Exception
public List<ContingencyPlanInstance> queryForTimeLine(String instanceNo, String recordType) throws Exception { ////// */
List<ContingencyPlanInstance> categorys = repository.queryForCategory(instanceNo, recordType); ////// public List<ContingencyPlanInstance> queryForTimeLine(String instanceNo, String recordType) throws Exception {
return categorys; ////// List<ContingencyPlanInstance> categorys = repository.queryForCategory(instanceNo, recordType);
} ////// return categorys;
////// }
//////
public void fire(String batchNo, String stepCode, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton) throws Exception { //////
//火灾误报 ////// public void fire(String batchNo, String stepCode, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton) throws Exception {
////// //火灾误报
ContingencyOriginalData contingencyOriginalData = iContingencyOriginalDataDao.findByBatchNo(batchNo); //////
if("FIRE_CANCEL".equals(buttonCode) || "END_EMERGENCY".equals(buttonCode)){ ////// ContingencyOriginalData contingencyOriginalData = iContingencyOriginalDataDao.findByBatchNo(batchNo);
redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning()); ////// if("FIRE_CANCEL".equals(buttonCode) || "END_EMERGENCY".equals(buttonCode)){
}else{ ////// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
redisTemplate.opsForValue().setIfAbsent(RiskSourceServiceImpl.cacheKeyForCanBeRunning(),"CONTINGENCYRUNING"); ////// }else{
} ////// redisTemplate.opsForValue().setIfAbsent(RiskSourceServiceImpl.cacheKeyForCanBeRunning(),"CONTINGENCYRUNING");
String stepKey = batchNo + "_" + stepCode; ////// }
if (stepMap.get(stepKey) == null) ////// String stepKey = batchNo + "_" + stepCode;
stepMap.put(stepKey, ""); ////// if (stepMap.get(stepKey) == null)
if (contingencyOriginalData != null) { ////// stepMap.put(stepKey, "");
log.info("数据库中的stepcode:" + contingencyOriginalData.getStep()); ////// if (contingencyOriginalData != null) {
contingencyOriginalData.setConfirm(buttonState); ////// log.info("数据库中的stepcode:" + contingencyOriginalData.getStep());
contingencyOriginalData.setRunstep(false); ////// contingencyOriginalData.setConfirm(buttonState);
if (contingencyOriginalData.getStepState() == null) ////// contingencyOriginalData.setRunstep(false);
contingencyOriginalData.setStepState(""); ////// if (contingencyOriginalData.getStepState() == null)
////// contingencyOriginalData.setStepState("");
if ("CONFIRM".equals(buttonState) //////
&& !contingencyOriginalData.getStepState().contains(stepStateOnbutton) ////// if ("CONFIRM".equals(buttonState)
&& stepCode.equals(contingencyOriginalData.getStep())) ////// && !contingencyOriginalData.getStepState().contains(stepStateOnbutton)
contingencyOriginalData.setStepState(contingencyOriginalData.getStepState() + stepStateOnbutton); ////// && stepCode.equals(contingencyOriginalData.getStep()))
////// contingencyOriginalData.setStepState(contingencyOriginalData.getStepState() + stepStateOnbutton);
//////
//请求中的步骤小于以保存的步骤 //////
if (Integer.parseInt(stepCode) < Integer.parseInt(contingencyOriginalData.getStep())) { ////// //请求中的步骤小于以保存的步骤
contingencyOriginalData.setRunstep(true); ////// if (Integer.parseInt(stepCode) < Integer.parseInt(contingencyOriginalData.getStep())) {
} ////// contingencyOriginalData.setRunstep(true);
////// }
//////
if (Integer.parseInt(stepCode) > Integer.parseInt(contingencyOriginalData.getStep())) { //////
//contingencyOriginalData.setStep(stepCode); ////// if (Integer.parseInt(stepCode) > Integer.parseInt(contingencyOriginalData.getStep())) {
contingencyOriginalData.setStepState(stepStateOnbutton); ////// //contingencyOriginalData.setStep(stepCode);
} ////// contingencyOriginalData.setStepState(stepStateOnbutton);
////// }
//////
iContingencyOriginalDataDao.updateByButton( //////
contingencyOriginalData.getConfirm(), ////// iContingencyOriginalDataDao.updateByButton(
contingencyOriginalData.getRunstep(), ////// contingencyOriginalData.getConfirm(),
contingencyOriginalData.getStepState(), ////// contingencyOriginalData.getRunstep(),
contingencyOriginalData.getBatchNo()); ////// contingencyOriginalData.getStepState(),
//setButtonExecuted(batchNo,contingencyPlanId, buttonCode,buttonState); ////// contingencyOriginalData.getBatchNo());
////// //setButtonExecuted(batchNo,contingencyPlanId, buttonCode,buttonState);
//使用原始数据触发规则 //////
////// //使用原始数据触发规则
//////
if ("CONFIRM".equals(buttonState) //////
&& !stepMap.get(stepKey).contains(stepStateOnbutton)) ////// if ("CONFIRM".equals(buttonState)
stepMap.put(stepKey, stepMap.get(stepKey) + stepStateOnbutton); ////// && !stepMap.get(stepKey).contains(stepStateOnbutton))
////// stepMap.put(stepKey, stepMap.get(stepKey) + stepStateOnbutton);
ContingencyRo contingencyRo = new ContingencyRo(); //////
contingencyRo.setButtonCode(buttonCode); ////// ContingencyRo contingencyRo = new ContingencyRo();
contingencyRo.setButtonState(buttonState); ////// contingencyRo.setButtonCode(buttonCode);
BeanUtils.copyProperties(contingencyOriginalData, contingencyRo); ////// contingencyRo.setButtonState(buttonState);
contingencyRo.setStep(stepCode); ////// BeanUtils.copyProperties(contingencyOriginalData, contingencyRo);
contingencyRo.setStepState(stepMap.get(stepKey)); ////// contingencyRo.setStep(stepCode);
log.info("stepstate:" + contingencyRo.getStepState()); ////// contingencyRo.setStepState(stepMap.get(stepKey));
////// log.info("stepstate:" + contingencyRo.getStepState());
//////
Equipment equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(Long.parseLong(contingencyRo.getFireEquipmentId())); //////
//Object result = remoteRuleServer.fireRuleFlow(contingencyRo, equipment.getReservePlan(),equipment.getName()); ////// Equipment equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(Long.parseLong(contingencyRo.getFireEquipmentId()));
ruleTrigger.publish(contingencyRo, equipment.getReservePlan()); ////// //Object result = remoteRuleServer.fireRuleFlow(contingencyRo, equipment.getReservePlan(),equipment.getName());
////// ruleTrigger.publish(contingencyRo, equipment.getReservePlan());
BubbleTipResult result1 = new BubbleTipResult(); //////
Map<String, Object> tempmap2 = new HashMap<>(); ////// BubbleTipResult result1 = new BubbleTipResult();
tempmap2.put("refresh","refresh"); ////// Map<String, Object> tempmap2 = new HashMap<>();
tempmap2.put("batchNo",batchNo); ////// tempmap2.put("refresh","refresh");
ContingencyAction.sendcmd("fromws","recordArea","refresh",result1); ////// tempmap2.put("batchNo",batchNo);
// String url = remoteRuleUrl + "/urule/rule/refreshTimeline?batchNo=" + batchNo; ////// ContingencyAction.sendcmd("fromws","recordArea","refresh",result1);
//restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY, Object.class); ////// // String url = remoteRuleUrl + "/urule/rule/refreshTimeline?batchNo=" + batchNo;
} else { ////// //restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY, Object.class);
throw new Exception("数据异常,请联系管理员."); ////// } else {
} ////// throw new Exception("数据异常,请联系管理员.");
} ////// }
////// }
//////
public void setButtonExecuted(String batchNo, String contingencyPlanId, String code, String buttonState) throws Exception { //////
ObjectMapper objectMapper = new ObjectMapper(); ////// public void setButtonExecuted(String batchNo, String contingencyPlanId, String code, String buttonState) throws Exception {
Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId); ////// ObjectMapper objectMapper = new ObjectMapper();
////// Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId);
ContingencyPlanInstance contingencyPlanInstance=contingencyPlanInstance1.get(); //////
////// ContingencyPlanInstance contingencyPlanInstance=contingencyPlanInstance1.get();
if(contingencyPlanInstance1.isPresent()){ //////
if (contingencyPlanInstance != null && "OPERATE".equals(contingencyPlanInstance.getRecordType())) { ////// if(contingencyPlanInstance1.isPresent()){
String operateJson = contingencyPlanInstance.getContent(); ////// if (contingencyPlanInstance != null && "OPERATE".equals(contingencyPlanInstance.getRecordType())) {
OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class); ////// String operateJson = contingencyPlanInstance.getContent();
////// OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class);
List<Operate> operates = operateGroup.getOperate(); //////
if (!CollectionUtils.isEmpty(operates)) { ////// List<Operate> operates = operateGroup.getOperate();
for (Operate operate : operates) { ////// if (!CollectionUtils.isEmpty(operates)) {
////// for (Operate operate : operates) {
if (code.equals(operate.getCode()) && ("executed".equals(operate.getState()) || "disable".equals(operate.getState()))){ //////
if("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code)){ ////// if (code.equals(operate.getCode()) && ("executed".equals(operate.getState()) || "disable".equals(operate.getState()))){
redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning()); ////// if("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code)){
} ////// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
throw new Exception("请勿重复操作."); ////// }
} ////// throw new Exception("请勿重复操作.");
////// }
//////
if ("CONFIRM".equals(buttonState)) { //////
if (code.equals(operate.getCode())) { ////// if ("CONFIRM".equals(buttonState)) {
operate.setState("executed"); ////// if (code.equals(operate.getCode())) {
if("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code)) ////// operate.setState("executed");
redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning()); ////// if("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code))
} else { ////// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
operate.setState("disable"); ////// } else {
} ////// operate.setState("disable");
} ////// }
} ////// }
} ////// }
////// }
//////
if (buttonState.equals("CONFIRM")) //////
contingencyPlanInstance.setRunstate(true); ////// if (buttonState.equals("CONFIRM"))
operateJson = objectMapper.writeValueAsString(operateGroup); ////// contingencyPlanInstance.setRunstate(true);
contingencyPlanInstance.setContent(operateJson); ////// operateJson = objectMapper.writeValueAsString(operateGroup);
repository.save(contingencyPlanInstance); ////// contingencyPlanInstance.setContent(operateJson);
} ////// repository.save(contingencyPlanInstance);
} ////// }
////// }
} //////
////// }
public void setButtonWait(String batchNo, String contingencyPlanId, String buttonState) throws Exception { //////
ObjectMapper objectMapper = new ObjectMapper(); ////// public void setButtonWait(String batchNo, String contingencyPlanId, String buttonState) throws Exception {
Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId); ////// ObjectMapper objectMapper = new ObjectMapper();
ContingencyPlanInstance contingencyPlanInstance=null; ////// Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId);
if(contingencyPlanInstance1.isPresent()){ ////// ContingencyPlanInstance contingencyPlanInstance=null;
contingencyPlanInstance=contingencyPlanInstance1.get(); ////// if(contingencyPlanInstance1.isPresent()){
} ////// contingencyPlanInstance=contingencyPlanInstance1.get();
////// }
if (contingencyPlanInstance != null && "OPERATE".equals(contingencyPlanInstance.getRecordType())) { //////
String operateJson = contingencyPlanInstance.getContent(); ////// if (contingencyPlanInstance != null && "OPERATE".equals(contingencyPlanInstance.getRecordType())) {
OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class); ////// String operateJson = contingencyPlanInstance.getContent();
////// OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class);
List<Operate> operates = operateGroup.getOperate(); //////
if (!CollectionUtils.isEmpty(operates)) { ////// List<Operate> operates = operateGroup.getOperate();
for (Operate operate : operates) { ////// if (!CollectionUtils.isEmpty(operates)) {
////// for (Operate operate : operates) {
if ("CONFIRM".equals(buttonState)) { //////
operate.setState("executed"); ////// if ("CONFIRM".equals(buttonState)) {
} ////// operate.setState("executed");
} ////// }
} ////// }
////// }
//////
if (buttonState.equals("CONFIRM")) //////
contingencyPlanInstance.setRunstate(true); ////// if (buttonState.equals("CONFIRM"))
operateJson = objectMapper.writeValueAsString(operateGroup); ////// contingencyPlanInstance.setRunstate(true);
contingencyPlanInstance.setContent(operateJson); ////// operateJson = objectMapper.writeValueAsString(operateGroup);
repository.save(contingencyPlanInstance); ////// contingencyPlanInstance.setContent(operateJson);
} ////// repository.save(contingencyPlanInstance);
} ////// }
////// }
//////
@Override //////
public void updateStep(String step, String batchNo) { ////// @Override
// TODO Auto-generated method stub ////// public void updateStep(String step, String batchNo) {
////// // TODO Auto-generated method stub
} //////
} ////// }
////}
//=======
//package com.yeejoin.amos.fas.business.service.impl;
//
//import com.yeejoin.amos.component.rule.RuleTrigger;
//import com.yeejoin.amos.fas.business.action.ContingencyAction;
//import com.yeejoin.amos.fas.business.action.result.BubbleTipResult;
//import com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper;
//import com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao;
//import com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository;
//import com.yeejoin.amos.fas.business.feign.RemoteRuleServer;
//import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
//import com.yeejoin.amos.fas.business.service.model.ContingencyRo;
//import com.yeejoin.amos.fas.business.service.model.Operate;
//import com.yeejoin.amos.fas.business.service.model.OperateGroup;
//import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData;
//import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
//import com.yeejoin.amos.fas.dao.entity.Equipment;
//
//import org.apache.commons.lang3.ArrayUtils;
//import org.codehaus.jackson.map.ObjectMapper;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.http.HttpEntity;
//import org.springframework.http.HttpMethod;
//import org.springframework.scheduling.annotation.Async;
//import org.springframework.stereotype.Service;
//import org.springframework.util.CollectionUtils;
//import org.springframework.web.client.RestTemplate;
//import org.typroject.tyboot.component.cache.Redis;
//
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.Optional;
//
//@Service
//public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPlanInstance, String>*/ implements IContingencyInstance {
//
// private static final Logger log = LoggerFactory.getLogger(ContingencyInstanceImpl.class);
//
// @Autowired
// private IContingencyPlanInstanceRepository repository;
//
//
// @Autowired
// IContingencyOriginalDataDao iContingencyOriginalDataDao;
//
//
// @Autowired
// private RemoteRuleServer remoteRuleServer;
//
// @Autowired
// private RestTemplate restTemplate;
//
// @Autowired
// private ImpAndFireEquipMapper impAndFireEquipMapper;
//
// @Autowired
// private RedisTemplate redisTemplate;
//
//
// @Value("${params.remoteRuleUrl}")
// private String remoteRuleUrl;
//
//
// private static Map<String, String> stepMap = new HashMap<>();
//
// @Autowired
// private RuleTrigger ruleTrigger;
//
// /* public ContingencyInstanceImpl(IContingencyPlanInstanceRepository repository) {
// super(repository);
// this.repository = repository;
// }*/
//
//
// /**
// * 创建预案执行记录
// *
// * @param category 一级分类
// * @param subCategory 二级分类
// * @param content 信息内容
// * @param recordType 信息分类
// * @param icon 信息显示图标
// */
// public ContingencyPlanInstance createInstanceRecord(String instanceNo, String category, String subCategory, String content, String recordType, String icon) {
// ContingencyPlanInstance planInstance = new ContingencyPlanInstance();
//
// planInstance.setContent(content);
// planInstance.setIcon(icon);
// planInstance.setRecordType(recordType);
// planInstance.setCategory(category);
// planInstance.setBatchNo(instanceNo);
//
// //计算序号
// int count = repository.countByBatchNo(instanceNo);
// planInstance.setSort(++count);
// return this.repository.save(planInstance);
// }
//
//
// /**
// * 查询时间轴
// *
// * @param instanceNo
// * @return
// * @throws Exception
// */
// public List<ContingencyPlanInstance> queryForTimeLine(String instanceNo, String recordType) throws Exception {
// List<ContingencyPlanInstance> categorys = repository.queryForCategory(instanceNo, recordType);
// return categorys;
// }
//
//
// public void fire(String batchNo, String stepCode, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton) throws Exception {
// //火灾误报
//
// ContingencyOriginalData contingencyOriginalData = iContingencyOriginalDataDao.findByBatchNo(batchNo);
// if("FIRE_CANCEL".equals(buttonCode) || "END_EMERGENCY".equals(buttonCode)){
// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
// }else{
// redisTemplate.opsForValue().setIfAbsent(RiskSourceServiceImpl.cacheKeyForCanBeRunning(),"CONTINGENCYRUNING");
// }
// String stepKey = batchNo + "_" + stepCode;
// if (stepMap.get(stepKey) == null)
// stepMap.put(stepKey, "");
// if (contingencyOriginalData != null) {
// log.info("数据库中的stepcode:" + contingencyOriginalData.getStep());
// contingencyOriginalData.setConfirm(buttonState);
// contingencyOriginalData.setRunstep(false);
// if (contingencyOriginalData.getStepState() == null)
// contingencyOriginalData.setStepState("");
//
// if ("CONFIRM".equals(buttonState)
// && !contingencyOriginalData.getStepState().contains(stepStateOnbutton)
// && stepCode.equals(contingencyOriginalData.getStep()))
// contingencyOriginalData.setStepState(contingencyOriginalData.getStepState() + stepStateOnbutton);
//
//
// //请求中的步骤小于以保存的步骤
// if (Integer.parseInt(stepCode) < Integer.parseInt(contingencyOriginalData.getStep())) {
// contingencyOriginalData.setRunstep(true);
// }
//
//
// if (Integer.parseInt(stepCode) > Integer.parseInt(contingencyOriginalData.getStep())) {
// //contingencyOriginalData.setStep(stepCode);
// contingencyOriginalData.setStepState(stepStateOnbutton);
// }
//
//
// iContingencyOriginalDataDao.updateByButton(
// contingencyOriginalData.getConfirm(),
// contingencyOriginalData.getRunstep(),
// contingencyOriginalData.getStepState(),
// contingencyOriginalData.getBatchNo());
// //setButtonExecuted(batchNo,contingencyPlanId, buttonCode,buttonState);
//
// //使用原始数据触发规则
//
//
// if ("CONFIRM".equals(buttonState)
// && !stepMap.get(stepKey).contains(stepStateOnbutton))
// stepMap.put(stepKey, stepMap.get(stepKey) + stepStateOnbutton);
//
// ContingencyRo contingencyRo = new ContingencyRo();
// contingencyRo.setButtonCode(buttonCode);
// contingencyRo.setButtonState(buttonState);
// BeanUtils.copyProperties(contingencyOriginalData, contingencyRo);
// contingencyRo.setStep(stepCode);
// contingencyRo.setStepState(stepMap.get(stepKey));
// log.info("stepstate:" + contingencyRo.getStepState());
//
//
// Equipment equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(Long.parseLong(contingencyRo.getFireEquipmentId()));
// //Object result = remoteRuleServer.fireRuleFlow(contingencyRo, equipment.getReservePlan(),equipment.getName());
// equipment.setName("极Ⅰ高端YY换流变A相");
// ruleTrigger.publish(contingencyRo, equipment.getReservePlan(), ArrayUtils.toArray(equipment.getName()));
//
// BubbleTipResult result1 = new BubbleTipResult();
// Map<String, Object> tempmap2 = new HashMap<>();
// tempmap2.put("refresh","refresh");
// tempmap2.put("batchNo",batchNo);
// ContingencyAction.sendcmd("fromws","recordArea","refresh",result1);
// // String url = remoteRuleUrl + "/urule/rule/refreshTimeline?batchNo=" + batchNo;
// //restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY, Object.class);
// } else {
// throw new Exception("数据异常,请联系管理员.");
// }
// }
//
//
// public void setButtonExecuted(String batchNo, String contingencyPlanId, String code, String buttonState) throws Exception {
// ObjectMapper objectMapper = new ObjectMapper();
// Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId);
//
// ContingencyPlanInstance contingencyPlanInstance=contingencyPlanInstance1.get();
//
// if(contingencyPlanInstance1.isPresent()){
// if (contingencyPlanInstance != null && "OPERATE".equals(contingencyPlanInstance.getRecordType())) {
// String operateJson = contingencyPlanInstance.getContent();
// OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class);
//
// List<Operate> operates = operateGroup.getOperate();
// if (!CollectionUtils.isEmpty(operates)) {
// for (Operate operate : operates) {
//
// if (code.equals(operate.getCode()) && ("executed".equals(operate.getState()) || "disable".equals(operate.getState()))){
// if("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code)){
// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
// }
// throw new Exception("请勿重复操作.");
// }
//
//
// if ("CONFIRM".equals(buttonState)) {
// if (code.equals(operate.getCode())) {
// operate.setState("executed");
// if("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code))
// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
// } else {
// operate.setState("disable");
// }
// }
// }
// }
//
//
// if (buttonState.equals("CONFIRM"))
// contingencyPlanInstance.setRunstate(true);
// operateJson = objectMapper.writeValueAsString(operateGroup);
// contingencyPlanInstance.setContent(operateJson);
// repository.save(contingencyPlanInstance);
// }
// }
//
// }
//
// public void setButtonWait(String batchNo, String contingencyPlanId, String buttonState) throws Exception {
// ObjectMapper objectMapper = new ObjectMapper();
// Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId);
// ContingencyPlanInstance contingencyPlanInstance=null;
// if(contingencyPlanInstance1.isPresent()){
// contingencyPlanInstance=contingencyPlanInstance1.get();
// }
//
// if (contingencyPlanInstance != null && "OPERATE".equals(contingencyPlanInstance.getRecordType())) {
// String operateJson = contingencyPlanInstance.getContent();
// OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class);
//
// List<Operate> operates = operateGroup.getOperate();
// if (!CollectionUtils.isEmpty(operates)) {
// for (Operate operate : operates) {
//
// if ("CONFIRM".equals(buttonState)) {
// operate.setState("executed");
// }
// }
// }
//
//
// if (buttonState.equals("CONFIRM"))
// contingencyPlanInstance.setRunstate(true);
// operateJson = objectMapper.writeValueAsString(operateGroup);
// contingencyPlanInstance.setContent(operateJson);
// repository.save(contingencyPlanInstance);
// }
// }
//
//
// @Override
// public void updateStep(String step, String batchNo) {
// // TODO Auto-generated method stub
//
// }
//}
//>>>>>>> 28409f79427e917f31bc936696f98f961a5dd24d
...@@ -50,8 +50,8 @@ public class ContingencyOriginalServiceImpl /*extends GenericManagerImpl<Conting ...@@ -50,8 +50,8 @@ public class ContingencyOriginalServiceImpl /*extends GenericManagerImpl<Conting
public Page queryForPage(String contingencyName, String equipmentId, String createTime, CommonPageable pageable) public Page queryForPage(String contingencyName, String equipmentId, String createTime, CommonPageable pageable)
{ {
Long total = contingencyOriginalMapper.queryCountForPage(equipmentId,createTime); Long total = contingencyOriginalMapper.queryCountForPage(equipmentId,createTime,contingencyName);
List<Map> content = contingencyOriginalMapper.queryForPage(equipmentId,createTime,pageable.getOffset(),pageable.getPageSize()); List<Map> content = contingencyOriginalMapper.queryForPage(equipmentId,createTime,pageable.getOffset(),pageable.getPageSize(),contingencyName);
Page result = new PageImpl(content,pageable,total); Page result = new PageImpl(content,pageable,total);
return result; return result;
} }
......
...@@ -243,6 +243,10 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -243,6 +243,10 @@ public class EquipmentServiceImpl implements IEquipmentService {
} }
long total = this.impAndFireEquipMapper.queryBindFirEqumtPageCount(String.valueOf(equipmentId)); long total = this.impAndFireEquipMapper.queryBindFirEqumtPageCount(String.valueOf(equipmentId));
List<FireEquipment> list = this.impAndFireEquipMapper.queryBindFirEqumtPage(start, length, String.valueOf(equipmentId)); List<FireEquipment> list = this.impAndFireEquipMapper.queryBindFirEqumtPage(start, length, String.valueOf(equipmentId));
if(commonPageable==null)
{
commonPageable = new CommonPageable();
}
Page result = new PageImpl(list, commonPageable, total); Page result = new PageImpl(list, commonPageable, total);
return result; return result;
} }
......
package com.yeejoin.amos.fas.business.service.impl; package com.yeejoin.amos.fas.business.service.impl;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.component.cache.enumeration.CacheType;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.yeejoin.amos.component.rule.RuleTrigger; import com.yeejoin.amos.fas.business.bo.*;
import com.yeejoin.amos.component.rule.action.ActionHandler;
import com.yeejoin.amos.fas.business.bo.BindRegionBo;
import com.yeejoin.amos.fas.business.bo.JpushMsgBo;
import com.yeejoin.amos.fas.business.bo.JpushMsgContentBo;
import com.yeejoin.amos.fas.business.bo.MsgParamBo;
import com.yeejoin.amos.fas.business.bo.RpnCalculationBo;
import com.yeejoin.amos.fas.business.constants.FasConstant; import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper; import com.yeejoin.amos.fas.business.dao.mapper.*;
import com.yeejoin.amos.fas.business.dao.mapper.FireEquipPointMapper;
import com.yeejoin.amos.fas.business.dao.mapper.FmeaEquipmentPointMapper;
import com.yeejoin.amos.fas.business.dao.mapper.FmeaMapper;
import com.yeejoin.amos.fas.business.dao.mapper.FmeaPointInputitemMapper;
import com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.RiskSourceMapper;
import com.yeejoin.amos.fas.business.dao.mongo.EquipCommunicationDao; import com.yeejoin.amos.fas.business.dao.mongo.EquipCommunicationDao;
import com.yeejoin.amos.fas.business.dao.repository.IAlarmDao; import com.yeejoin.amos.fas.business.dao.repository.*;
import com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao;
import com.yeejoin.amos.fas.business.dao.repository.IDictDao;
import com.yeejoin.amos.fas.business.dao.repository.IEvaluationModelDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDataDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentPointDao;
import com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskFactorDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskSourceDao;
import com.yeejoin.amos.fas.business.dao.repository.IRpnChangeLogDao;
import com.yeejoin.amos.fas.business.feign.RemoteRuleServer; import com.yeejoin.amos.fas.business.feign.RemoteRuleServer;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService; import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer; import com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer;
...@@ -81,45 +21,47 @@ import com.yeejoin.amos.fas.business.jpush.PushMsgParam; ...@@ -81,45 +21,47 @@ import com.yeejoin.amos.fas.business.jpush.PushMsgParam;
import com.yeejoin.amos.fas.business.param.AlarmParam; import com.yeejoin.amos.fas.business.param.AlarmParam;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam; import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.param.FmeaBindParam; import com.yeejoin.amos.fas.business.param.FmeaBindParam;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
import com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService; import com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService; import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService;
import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService; import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
import com.yeejoin.amos.fas.business.service.model.CheckInputItemRo; import com.yeejoin.amos.fas.business.service.model.*;
import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
import com.yeejoin.amos.fas.business.service.model.ContingencyRo;
import com.yeejoin.amos.fas.business.service.model.FireEquimentDataRo;
import com.yeejoin.amos.fas.business.service.model.ProtalDataRo;
import com.yeejoin.amos.fas.business.service.model.RiskSourceRuleRo;
import com.yeejoin.amos.fas.business.util.DateUtils; import com.yeejoin.amos.fas.business.util.DateUtils;
import com.yeejoin.amos.fas.business.util.JexlUtil; import com.yeejoin.amos.fas.business.util.JexlUtil;
import com.yeejoin.amos.fas.business.util.RpnUtils; import com.yeejoin.amos.fas.business.util.RpnUtils;
import com.yeejoin.amos.fas.business.vo.EquipCommunicationData; import com.yeejoin.amos.fas.business.vo.EquipCommunicationData;
import com.yeejoin.amos.fas.client.invoke.RsDataQueue; import com.yeejoin.amos.fas.client.invoke.RsDataQueue;
import com.yeejoin.amos.fas.common.enums.DataRefreshTypeEum; import com.yeejoin.amos.fas.common.enums.DataRefreshTypeEum;
import com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum;
import com.yeejoin.amos.fas.core.common.request.CommonPageable; import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse; import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse; import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse;
import com.yeejoin.amos.fas.core.util.StringUtil; import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.Alarm; import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData;
import com.yeejoin.amos.fas.dao.entity.Dict;
import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.EvaluationModel;
import com.yeejoin.amos.fas.dao.entity.FireEquipment;
import com.yeejoin.amos.fas.dao.entity.FireEquipmentData;
import com.yeejoin.amos.fas.dao.entity.FireEquipmentPoint;
import com.yeejoin.amos.fas.dao.entity.Fmea;
import com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint;
import com.yeejoin.amos.fas.dao.entity.FmeaPointInputitem;
import com.yeejoin.amos.fas.dao.entity.PreplanPicture;
import com.yeejoin.amos.fas.dao.entity.RiskFactor;
import com.yeejoin.amos.fas.dao.entity.RiskLevel;
import com.yeejoin.amos.fas.dao.entity.RiskSource;
import com.yeejoin.amos.fas.dao.entity.RpnChangeLog;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.component.cache.enumeration.CacheType;
import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors;
@Service("riskSourceService") @Service("riskSourceService")
public class RiskSourceServiceImpl implements IRiskSourceService { public class RiskSourceServiceImpl implements IRiskSourceService {
...@@ -207,9 +149,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -207,9 +149,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@Autowired @Autowired
IContingencyInstance iContingencyInstance;
@Autowired
private FmeaEquipmentPointMapper fmeaEquipmentPointMapper; private FmeaEquipmentPointMapper fmeaEquipmentPointMapper;
@Autowired @Autowired
...@@ -228,9 +167,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -228,9 +167,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired @Autowired
private IDataRefreshService iDataRefreshService; private IDataRefreshService iDataRefreshService;
@Autowired
private RuleTrigger ruleTrigger;
@Override @Override
public RiskSource editRiskSource(HashMap<String, Object> map) throws Exception { public RiskSource editRiskSource(HashMap<String, Object> map) throws Exception {
RiskSource riskSource = (RiskSource) map.get("param"); RiskSource riskSource = (RiskSource) map.get("param");
...@@ -549,7 +485,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -549,7 +485,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
//Object result = remoteRuleServer.fireRuleFlow(contingencyRo, equipment.getReservePlan(), equipment.getName()); //Object result = remoteRuleServer.fireRuleFlow(contingencyRo, equipment.getReservePlan(), equipment.getName());
ruleTrigger.publish(contingencyRo, equipment.getReservePlan()); // ruleTrigger.publish(contingencyRo, equipment.getReservePlan());
ContingencyOriginalData contingencyOriginalData = new ContingencyOriginalData(); ContingencyOriginalData contingencyOriginalData = new ContingencyOriginalData();
BeanUtils.copyProperties(contingencyRo, contingencyOriginalData); BeanUtils.copyProperties(contingencyRo, contingencyOriginalData);
iContingencyOriginalDataDao.save(contingencyOriginalData); iContingencyOriginalDataDao.save(contingencyOriginalData);
...@@ -791,7 +727,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -791,7 +727,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
* @param fireEquipmentPointType * @param fireEquipmentPointType
*/ */
@Async @Async
private void dynamicPlan(AlarmParam deviceData, Equipment equipment, FireEquipment fireEquipment, String fireEquipmentPointType){ void dynamicPlan(AlarmParam deviceData, Equipment equipment, FireEquipment fireEquipment, String fireEquipmentPointType){
String batchNo = null; String batchNo = null;
Object batch = null; Object batch = null;
Dict dict = null; Dict dict = null;
...@@ -904,6 +840,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -904,6 +840,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");
fireEquipmentData.setOrgCode(fireEquipment.getOrgCode());
iFireEquipmentDataDao.save(fireEquipmentData); 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());
...@@ -911,7 +848,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -911,7 +848,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
content.put("changeDate", fireEquipmentData.getCreateDate()); content.put("changeDate", fireEquipmentData.getCreateDate());
content.put("orgCode", fireEquipment.getOrgCode()); content.put("orgCode", fireEquipment.getOrgCode());
content.put("status", deviceData.getSoe()); content.put("status", deviceData.getSoe());
iDataRefreshService.sendRefreshDataWithArea(DataRefreshTypeEum.monitor.getCode(), content); iDataRefreshService.sendRefreshDataWithArea(View3dRefreshAreaEum.monitor_data.getCode(), content);
} }
} }
List<AlarmParam> list = new ArrayList<>(); List<AlarmParam> list = new ArrayList<>();
...@@ -1080,8 +1017,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1080,8 +1017,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if (pointCount > 0 && pointCount == count) { if (pointCount > 0 && pointCount == count) {
try { try {
String batchNo = (String) redisTemplate.opsForHash().get("currentContingency", "batchNo"); String batchNo = (String) redisTemplate.opsForHash().get("currentContingency", "batchNo");
iContingencyInstance.setButtonExecuted(batchNo, contingencyDeviceStatus.getContingencyPlanId(), contingencyDeviceStatus.getButtonCode(), contingencyDeviceStatus.getConfirm()); // iContingencyInstance.setButtonExecuted(batchNo, contingencyDeviceStatus.getContingencyPlanId(), contingencyDeviceStatus.getButtonCode(), contingencyDeviceStatus.getConfirm());
iContingencyInstance.fire(batchNo, contingencyDeviceStatus.getStepCode(), contingencyDeviceStatus.getContingencyPlanId(), contingencyDeviceStatus.getButtonCode(), contingencyDeviceStatus.getConfirm(), contingencyDeviceStatus.getStepState()); // iContingencyInstance.fire(batchNo, contingencyDeviceStatus.getStepCode(), contingencyDeviceStatus.getContingencyPlanId(), contingencyDeviceStatus.getButtonCode(), contingencyDeviceStatus.getConfirm(), contingencyDeviceStatus.getStepState());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -299,8 +299,7 @@ public class View3dServiceImpl implements IView3dService { ...@@ -299,8 +299,7 @@ public class View3dServiceImpl implements IView3dService {
} }
Optional<RiskSource> optional = iRiskSourceDao.findByOrgCodeAndParentId(orgCode,0L); Optional<RiskSource> optional = iRiskSourceDao.findByOrgCodeAndParentId(orgCode,0L);
TodaySafetyIndexVo vo = new TodaySafetyIndexVo(); TodaySafetyIndexVo vo = new TodaySafetyIndexVo();
if(optional.isPresent()){ if(optional.isPresent()){ //1.按照等级进行转换rpn为分数-机构
//1.按照等级进行转换rpn为分数-机构
RiskSource riskSource = optional.get(); RiskSource riskSource = optional.get();
double safetyIndex = this.changeRpnToSafetyIndex(riskSource.getRpn()); double safetyIndex = this.changeRpnToSafetyIndex(riskSource.getRpn());
vo.setSafetyIndex(safetyIndex); vo.setSafetyIndex(safetyIndex);
...@@ -424,7 +423,8 @@ public class View3dServiceImpl implements IView3dService { ...@@ -424,7 +423,8 @@ public class View3dServiceImpl implements IView3dService {
List<RiskSource> regionList = iRiskSourceDao.findByParentIdAndIsRegion(optional.get().getId(),RiskSourceRegionEum.TRUE.getCode()); List<RiskSource> regionList = iRiskSourceDao.findByParentIdAndIsRegion(optional.get().getId(),RiskSourceRegionEum.TRUE.getCode());
exceptionList = regionList.stream().filter(riskSource -> { exceptionList = regionList.stream().filter(riskSource -> {
BigDecimal rpn = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn(); BigDecimal rpn = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn();
return rpn.subtract(riskSource.getRpni()).doubleValue() > 0; BigDecimal rpni = riskSource.getRpni() == null ? new BigDecimal("0") : riskSource.getRpni();
return rpn.subtract(rpni).doubleValue() > 0;
}).map(riskSource -> { }).map(riskSource -> {
ExceptionRegionVo regionVo = new ExceptionRegionVo(); ExceptionRegionVo regionVo = new ExceptionRegionVo();
regionVo.setId(riskSource.getId()); regionVo.setId(riskSource.getId());
...@@ -491,23 +491,6 @@ public class View3dServiceImpl implements IView3dService { ...@@ -491,23 +491,6 @@ public class View3dServiceImpl implements IView3dService {
return view3dMapper.getCheckErrorTop5(orgCode); return view3dMapper.getCheckErrorTop5(orgCode);
case "fire": case "fire":
return view3dMapper.getFireAlarmTop5(orgCode); return view3dMapper.getFireAlarmTop5(orgCode);
// return JSON.parseArray(" [\r\n" +
// " {\r\n" +
// " \"id\": 35781,\r\n" +
// " \"code\": \"s001\",\r\n" +
// " \"label\": \"设备test\",\r\n" +
// " \"pointId\": \"1\",\r\n" +
// " \"type\": \"check\",\r\n" +
// " \"changeDate\": \"2020-04-23 14:31:31\"\r\n" +
// " },\r\n" +
// " {\r\n" +
// " \"id\": 35780,\r\n" +
// " \"code\": \"s002\",\r\n" +
// " \"label\": \"设备002\",\r\n" +
// " \"pointId\": \"23123\",\r\n" +
// " \"type\": \"check\",\r\n" +
// " \"changeDate\": \"2020-04-23 14:31:27\"\r\n" +
// " }]", SafetyExecuteBo.class);
default: default:
throw new YeeException("不支持的类型 -->"+ type); throw new YeeException("不支持的类型 -->"+ type);
} }
...@@ -525,8 +508,6 @@ public class View3dServiceImpl implements IView3dService { ...@@ -525,8 +508,6 @@ public class View3dServiceImpl implements IView3dService {
@Override @Override
public List<SafetyExecuteBo> getEquipStatusList(String orgCode) { public List<SafetyExecuteBo> getEquipStatusList(String orgCode) {
return view3dMapper.getEquipStatusTop5(orgCode); return view3dMapper.getEquipStatusTop5(orgCode);
// return JSON.parseArray("[{\"id\":1,\"label\":\"设备1 label\",\"changeDate\":\"2020-04-26 10:00:00\"}"
// + ",{\"id\":2,\"label\":\"设备2 label\",\"changeDate\":\"2020-04-25 10:00:00\"}]");
} }
@Override @Override
...@@ -600,10 +581,14 @@ public class View3dServiceImpl implements IView3dService { ...@@ -600,10 +581,14 @@ public class View3dServiceImpl implements IView3dService {
List<HashMap<String, Object>> retrieveAll = view3dMapper.retrieveAll(type, inputText,pageable.getOffset(),pageable.getPageSize(),orgCode,dataLevel,protectObjName); List<HashMap<String, Object>> retrieveAll = view3dMapper.retrieveAll(type, inputText,pageable.getOffset(),pageable.getPageSize(),orgCode,dataLevel,protectObjName);
retrieveAll.stream().forEach(e->{ retrieveAll.stream().forEach(e->{
String person = (String)e.get("person"); String person = (String)e.get("person");
JSONArray ue4Location = this.getInitJSONArray(String.valueOf(e.get("ue4Location")));
JSONArray ue4Rotation = this.getInitJSONArray(String.valueOf(e.get("ue4Rotation")));
if(person != null && !person.equals("")) { if(person != null && !person.equals("")) {
AgencyUserModel user = remoteSecurityService.getUserById(token, product, appKey, person); AgencyUserModel user = remoteSecurityService.getUserById(token, product, appKey, person);
e.put("person", user != null ? user.getRealName() : ""); e.put("person", user != null ? user.getRealName() : "");
} }
e.put("ue4Location",ue4Location);
e.put("ue4Rotation",ue4Rotation);
}); });
Page result = new PageImpl(retrieveAll,pageable,count); Page result = new PageImpl(retrieveAll,pageable,count);
return CommonResponseUtil.success(result); return CommonResponseUtil.success(result);
......
package com.yeejoin.amos.fas.business.service.intfc; package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import java.util.List;
import java.util.Map;
public interface IContingencyInstance { public interface IContingencyInstance {
//
ContingencyPlanInstance createInstanceRecord(String instanceNo, String category, String subCategory, String content, String recordType, String icon); // ContingencyPlanInstance createInstanceRecord(String instanceNo, String category, String subCategory, String content, String recordType, String icon);
//
//
//
List<ContingencyPlanInstance> queryForTimeLine(String instanceNo,String recordType) throws Exception; // List<ContingencyPlanInstance> queryForTimeLine(String instanceNo,String recordType) throws Exception;
//
//
void setButtonExecuted(String batchNo,String contingencyPlanId,String code,String buttonState) throws Exception; // void setButtonExecuted(String batchNo,String contingencyPlanId,String code,String buttonState) throws Exception;
void setButtonWait(String batchNo,String contingencyPlanId,String buttonState) throws Exception; // void setButtonWait(String batchNo,String contingencyPlanId,String buttonState) throws Exception;
//
//
void fire(String batchNo,String stepCode, String contingencyPlanId, String buttonCode,String buttonState,String stepStateOnbutton) throws Exception; // void fire(String batchNo,String stepCode, String contingencyPlanId, String buttonCode,String buttonState,String stepStateOnbutton) throws Exception;
//
void updateStep(String step, String batchNo); // void updateStep(String step, String batchNo);
} }
package com.yeejoin.amos.fas.business.service.model; package com.yeejoin.amos.fas.business.service.model;
public class ContingencyRo extends BasicsRo { import java.io.Serializable;
public class ContingencyRo implements Serializable {
private String batchNo;
public String getBatchNo() {
return batchNo;
}
public void setBatchNo(String batchNo) {
this.batchNo = batchNo;
}
/** /**
* *
......
...@@ -8,9 +8,9 @@ import org.slf4j.Logger; ...@@ -8,9 +8,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
...@@ -18,6 +18,7 @@ import org.springframework.cloud.netflix.hystrix.EnableHystrix; ...@@ -18,6 +18,7 @@ import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
...@@ -27,6 +28,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; ...@@ -27,6 +28,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.yeejoin.amos.fas.client.invoke.RsDataQueue; import com.yeejoin.amos.fas.client.invoke.RsDataQueue;
import com.yeejoin.amos.fas.context.IotContext; import com.yeejoin.amos.fas.context.IotContext;
import com.yeejoin.amos.filter.CrossDomainFilter;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
...@@ -91,4 +93,25 @@ public class YeeAmosFireAutoSysStart implements ApplicationContextAware ...@@ -91,4 +93,25 @@ public class YeeAmosFireAutoSysStart implements ApplicationContextAware
IotContext.getInstance().setApplicationContext(applicationContext); IotContext.getInstance().setApplicationContext(applicationContext);
RsDataQueue.getInstance().start(); RsDataQueue.getInstance().start();
} }
/**
*
* <pre>
* 跨域处理的FilterBean
* </pre>
*
* @return
*/
@Bean
public FilterRegistrationBean crossFilterRegistrationBean()
{
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
CrossDomainFilter crossDomainFilter = new CrossDomainFilter();
registrationBean.setFilter(crossDomainFilter);
// List<String> urlPatterns = new ArrayList<String>();
// urlPatterns.add("/*");
// registrationBean.setUrlPatterns(urlPatterns);
registrationBean.setOrder(0);//值小的Filter先执行
return registrationBean;
}
} }
\ No newline at end of file
...@@ -5,12 +5,12 @@ security.appKeyWeb=CONVERTER_STATION ...@@ -5,12 +5,12 @@ security.appKeyWeb=CONVERTER_STATION
#environment #environment
#spring.profiles.active = dev #spring.profiles.active = dev
eureka.client.serviceUrl.defaultZone=http://172.16.10.72:10001/eureka/ eureka.client.serviceUrl.defaultZone=http://172.16.3.75: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
eureka.client.fetchRegistry = true eureka.client.fetchRegistry = true
eureka.instance.prefer-ip-address=true
#DB properties: #DB properties:
spring.datasource.url=jdbc:mysql://172.16.11.33:3306/safety-business-2.0?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.datasource.url=jdbc:mysql://172.16.11.33:3306/safety-business-2.0?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root spring.datasource.username=root
...@@ -53,5 +53,10 @@ emqx.broker=tcp://172.16.10.85:1883 ...@@ -53,5 +53,10 @@ emqx.broker=tcp://172.16.10.85:1883
emqx.user-name=super emqx.user-name=super
emqx.password=a123456 emqx.password=a123456
Push.fegin.name=PPMESSAGEPUSHSERVICE15 Push.fegin.name=PPMESSAGEPUSHSERVICE15
dutyMode.fegin.name=AMOS-DUTY dutyMode.fegin.name=AMOS-DUTY
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load=true
rule.definition.model-package=com.yeejoin.amos.fas.business.service.model
\ No newline at end of file
...@@ -10,6 +10,7 @@ eureka.client.register-with-eureka = true ...@@ -10,6 +10,7 @@ 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
eureka.client.fetchRegistry = true eureka.client.fetchRegistry = true
eureka.instance.prefer-ip-address=true
#DB properties: #DB properties:
spring.datasource.url=jdbc:mysql://amos-mysql:3306/yeejoin_safety_business?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.datasource.url=jdbc:mysql://amos-mysql:3306/yeejoin_safety_business?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
...@@ -55,3 +56,7 @@ emqx.password=a123456 ...@@ -55,3 +56,7 @@ emqx.password=a123456
Push.fegin.name=AMOS-PUSH Push.fegin.name=AMOS-PUSH
dutyMode.fegin.name=AMOS-DUTY dutyMode.fegin.name=AMOS-DUTY
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load=true
rule.definition.model-package=com.yeejoin.amos.fas.business.service.model
\ No newline at end of file
...@@ -10,6 +10,7 @@ eureka.client.register-with-eureka = true ...@@ -10,6 +10,7 @@ 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
eureka.client.fetchRegistry = true eureka.client.fetchRegistry = true
eureka.instance.prefer-ip-address=true
#DB properties: #DB properties:
spring.datasource.url=jdbc:mysql://47.103.14.66:3306/91-safety-business?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.datasource.url=jdbc:mysql://47.103.14.66:3306/91-safety-business?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
...@@ -55,3 +56,7 @@ emqx.password=a123456 ...@@ -55,3 +56,7 @@ emqx.password=a123456
Push.fegin.name=PPMESSAGEPUSHSERVICE15 Push.fegin.name=PPMESSAGEPUSHSERVICE15
dutyMode.fegin.name=AMOS-DUTY dutyMode.fegin.name=AMOS-DUTY
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load=true
rule.definition.model-package=com.yeejoin.amos.fas.business.service.model
\ No newline at end of file
spring.application.name = AMOS-AUTOSYS spring.application.name = AMOS-AUTOSYS-WJ
server.port = 8083 server.port = 8083
......
...@@ -15,14 +15,18 @@ ...@@ -15,14 +15,18 @@
1 = 1 1 = 1
<if test="equipmentId!=null"> <if test="equipmentId!=null">
AND t.equipment_Id = ${equipmentId} AND t.equipment_Id = #{equipmentId}
</if> </if>
<if test="createTime!=null"> <if test="createTime!=null">
AND TO_DAYS(t.create_date) = TO_DAYS(${createTime}) AND TO_DAYS(t.create_date) = TO_DAYS(#{createTime})
</if>
<if test="contingencyName!=null and contingencyName!=''">
AND t.fire_Equipment_Name like concat('%',#{contingencyName},'%')
OR t.equipment_Name like concat('%',#{contingencyName},'%')
</if> </if>
order by t.create_date desc order by t.create_date desc
LIMIT ${start},${length} ; LIMIT #{start},#{length} ;
</select> </select>
...@@ -35,11 +39,15 @@ ...@@ -35,11 +39,15 @@
1 = 1 1 = 1
<if test="equipmentId!=null"> <if test="equipmentId!=null">
AND t.equipment_Id = ${equipmentId} AND t.equipment_Id = #{equipmentId}
</if> </if>
<if test="createTime!=null"> <if test="createTime!=null">
AND TO_DAYS(t.create_date) = TO_DAYS(${createTime}) AND TO_DAYS(t.create_date) = TO_DAYS(#{createTime})
</if>
<if test="contingencyName!=null and contingencyName!=''">
AND t.fire_Equipment_Name like concat('%',#{contingencyName},'%')
OR t.equipment_Name like concat('%',#{contingencyName},'%')
</if> </if>
</select> </select>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
R.id,R.name,R.code,R.parent_id,R.ue4_location,R.ue4_rotation,R.ue4_extent, R.id,R.name,R.code,R.parent_id,R.ue4_location,R.ue4_rotation,R.ue4_extent,
<choose> <choose>
<when test="channelType == '3dpage'"> <when test="channelType == '3dpage'">
IF(ISNULL(route_path) || LENGTH(trim(route_path)) <![CDATA[ <]]> 1,0,1) as is_bind, IF(ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,
</when> </when>
<otherwise> <otherwise>
IF(ISNULL(IF(replace(trim(ue4_rotation),'[]','')='',NULL,R.ue4_rotation)) IF(ISNULL(IF(replace(trim(ue4_rotation),'[]','')='',NULL,R.ue4_rotation))
...@@ -115,84 +115,37 @@ ...@@ -115,84 +115,37 @@
AND B.id is not null AND B.id is not null
</when> </when>
<when test="type == 'fireEquipment'"> <when test="type == 'fireEquipment'">
select select tmp.id,tmp.name,tmp.type,tmp.position3d,tmp.ue4_rotation,tmp.ue4_location,tmp.code,R.parent_id,
<!-- R.id, -->
CASE
WHEN ISNULL(C.id) = 0 then C.id
WHEN ISNULL(E.id) = 0 then E.id
WHEN ISNULL(S.id) = 0 then S.id
WHEN ISNULL(W.id) = 0 then W.id
END as id
,R.parent_id,
<choose> <choose>
<when test="channelType == '3dpage'"> <when test="channelType == '3dpage'">
CASE IF(ISNULL(tmp.position3d) || LENGTH(trim(tmp.position3d)) <![CDATA[ <]]> 1,0,1) as isBind
WHEN ISNULL(C.id) = 0 AND ISNULL(C.position3d) OR LENGTH(trim(C.position3d)) <![CDATA[ <]]> 1 then 0
WHEN ISNULL(E.id) = 0 AND ISNULL(E.position3d) OR LENGTH(trim(E.position3d)) <![CDATA[ <]]> 1 then 0
WHEN ISNULL(S.id) = 0 AND ISNULL(S.position3d) OR LENGTH(trim(S.position3d)) <![CDATA[ <]]> 1 then 0
WHEN ISNULL(W.id) = 0 AND ISNULL(W.position3d) OR LENGTH(trim(W.position3d)) <![CDATA[ <]]> 1 then 0
ELSE 1
END as is_bind,
</when> </when>
<otherwise> <otherwise>
CASE IF(ISNULL(IF(replace(trim(tmp.ue4_rotation),'[]','')='',NULL,tmp.ue4_rotation))
WHEN ISNULL(C.id) = 0 then IF(ISNULL(IF(replace(trim(C.ue4_rotation),'[]','')='',NULL,C.ue4_rotation)) AND ISNULL(IF(replace(trim(tmp.ue4_location),'[]','')='',NULL,tmp.ue4_location)),0,1) as isBind
AND ISNULL(IF(replace(trim(C.ue4_rotation),'[]','')='',NULL,C.ue4_location)),0,1)
WHEN ISNULL(E.id) = 0 then IF(ISNULL(IF(replace(trim(E.ue4_rotation),'[]','')='',NULL,E.ue4_rotation))
AND ISNULL(IF(replace(trim(E.ue4_rotation),'[]','')='',NULL,E.ue4_location)),0,1)
WHEN ISNULL(S.id) = 0 then IF(ISNULL(IF(replace(trim(S.ue4_rotation),'[]','')='',NULL,S.ue4_rotation))
AND ISNULL(IF(replace(trim(S.ue4_rotation),'[]','')='',NULL,S.ue4_location)),0,1)
WHEN ISNULL(W.id) = 0 then IF(ISNULL(IF(replace(trim(W.ue4_rotation),'[]','')='',NULL,W.ue4_rotation))
AND ISNULL(IF(replace(trim(W.ue4_rotation),'[]','')='',NULL,W.ue4_location)),0,1)
END as is_bind,
</otherwise> </otherwise>
</choose> </choose>
from (
select id,name,'fireCar' as type,position3d,car_num as code,ue4_location,ue4_rotation,risk_source_id
from f_fire_car
union all
select id,name,'fireEquipment' as type,position3d,code,ue4_location,ue4_rotation,risk_source_id
from f_fire_equipment
union all
select id,name,CASE
WHEN S.type = 1 then 'fireChamber'
WHEN S.type = 2 then 'fireFoamRoom'
END as type,position3d,code,ue4_location,ue4_rotation,risk_source_id
from f_fire_station s
union all
select id,name,
CASE CASE
WHEN ISNULL(C.id) = 0 then 'fireCar' WHEN W.type = 1 then 'hydrant'
WHEN ISNULL(E.id) = 0 then 'fireEquipment' WHEN W.type = 2 then 'pool'
WHEN ISNULL(S.id) = 0 AND S.type = 1 then 'fireChamber' END as type,position3d,code,ue4_location,ue4_rotation,risk_source_id
WHEN ISNULL(S.id) = 0 AND S.type = 2 then 'fireFoamRoom' from f_water_resource w
WHEN ISNULL(W.id) = 0 AND W.type = 1 then 'hydrant' ) tmp
WHEN ISNULL(W.id) = 0 AND W.type = 2 then 'pool' left join f_risk_source R on R.id = tmp.risk_source_id
END as type,
CASE
WHEN ISNULL(C.id) = 0 then C.name
WHEN ISNULL(E.id) = 0 then E.name
WHEN ISNULL(S.id) = 0 then S.name
WHEN ISNULL(W.id) = 0 then W.name
END as name,
CASE
WHEN ISNULL(C.id) = 0 then C.car_num
WHEN ISNULL(E.id) = 0 then E.code
WHEN ISNULL(S.id) = 0 then S.code
WHEN ISNULL(W.id) = 0 then W.code
END as code,
CASE
WHEN ISNULL(C.id) = 0 then C.ue4_location
WHEN ISNULL(E.id) = 0 then E.ue4_location
WHEN ISNULL(S.id) = 0 then S.ue4_location
WHEN ISNULL(W.id) = 0 then W.ue4_location
END as ue4_location,
CASE
WHEN ISNULL(C.id) = 0 then C.ue4_rotation
WHEN ISNULL(E.id) = 0 then E.ue4_rotation
WHEN ISNULL(S.id) = 0 then S.ue4_rotation
WHEN ISNULL(W.id) = 0 then W.ue4_rotation
END as ue4_rotation,
0 as is_region,
CASE
WHEN ISNULL(C.id) = 0 then C.position3d
WHEN ISNULL(E.id) = 0 then E.position3d
WHEN ISNULL(S.id) = 0 then S.position3d
WHEN ISNULL(W.id) = 0 then W.position3d
END as position3d
from f_risk_source R
left join f_fire_car C on C.risk_source_id = R.id
left join f_fire_equipment E on E.risk_source_id = R.id AND equip_classify = 3
left join f_fire_station S on S.risk_source_id = R.id
left join f_water_resource W on W.risk_source_id = R.id
where 1=1
AND (C.id is not null OR E.id is not null OR S.id is not null OR w.id is not null)
</when> </when>
</choose> </choose>
...@@ -457,7 +410,7 @@ ...@@ -457,7 +410,7 @@
b.create_date as changeDate b.create_date as changeDate
FROM FROM
f_risk_source a, f_risk_source a,
f_rpn_change_log b (SELECT a.id,a.type,a.risk_source_id,max(a.create_date) as create_date FROM `f_rpn_change_log` a GROUP BY a.risk_source_id) as b
WHERE WHERE
b.risk_source_id = a.id b.risk_source_id = a.id
AND b.type = '0' AND b.type = '0'
...@@ -466,19 +419,26 @@ ...@@ -466,19 +419,26 @@
</select> </select>
<select id="getAllErrorPatrolPoint" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo"> <select id="getAllErrorPatrolPoint" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
SELECT SELECT
a.id, pc.id,
b.`name`, b.`name`,
a.`is_ok` as status, pc.`is_ok` as status,
a.check_time as changeDate pc.check_time as changeDate
FROM
(select
a.id,
a.point_id,
a.`is_ok`,
max(a.check_time) as check_time
FROM FROM
p_check a, p_check a
where DATE_FORMAT(a.check_time,'%Y-%m-%d') = #{date}
and a.`is_ok` IN ('2', '3')
GROUP BY a.point_id) as pc,
p_point b p_point b
WHERE WHERE
a.`is_ok` IN ('2', '3') pc.point_id = b.id
AND a.point_id = b.id
and b.is_delete = false and b.is_delete = false
and DATE_FORMAT(a.check_time,'%Y-%m-%d') = #{date} and b.org_code = #{orgCode}
and a.org_code = #{orgCode}
</select> </select>
<select id="getAllFaultAlarm" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo"> <select id="getAllFaultAlarm" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
......
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