Commit 6e7ae3b0 authored by 吴江's avatar 吴江

Merge branch 'dev_upgrade' into 'dev_rule'

# Conflicts: # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyInstanceImpl.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
parents eef8eff5 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.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.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);
} }
...@@ -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;
} }
......
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.apache.commons.lang3.ArrayUtils;
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;
...@@ -82,45 +21,47 @@ import com.yeejoin.amos.fas.business.jpush.PushMsgParam; ...@@ -82,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 {
...@@ -208,9 +149,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -208,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
...@@ -229,9 +167,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -229,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");
...@@ -792,7 +727,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -792,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;
...@@ -905,6 +840,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -905,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());
...@@ -912,7 +848,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -912,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<>();
...@@ -1081,8 +1017,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1081,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();
} }
......
...@@ -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);
} }
...@@ -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