Commit 49dec6b2 authored by maoying's avatar maoying

Merge branch 'dev_upgrade' of…

Merge branch 'dev_upgrade' of http://39.98.45.134:8090/station/YeeAmosFireAutoSysRoot into dev_upgrade
parents c9e6635d 93984635
package com.yeejoin.amos.fas.common.enums;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*0、运行中,1、完毕,3、中断
* @author suhg
*/
public enum DutyPersonEnum {
FIRE_PERSON("驻站消防","fire"),
OPS_PERSON("运维人员","ops"),
REAL_PERSON("物业安保","realEstate");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
/**
* 颜色
*/
private String color;
private DutyPersonEnum(String name, String code){
this.name = name;
this.code = code;
}
public static DutyPersonEnum getEnum(String code) {
DutyPersonEnum checkStatusEnum = null;
for(DutyPersonEnum type: DutyPersonEnum.values()) {
if (type.getCode().equals(code)) {
checkStatusEnum = type;
break;
}
}
return checkStatusEnum;
}
public static List<Map<String,Object>> getEnumList() {
List<Map<String,Object>> nameList = new ArrayList<>();
for (DutyPersonEnum c: DutyPersonEnum.values()) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", c.getName());
map.put("code", c.getCode());
nameList.add(map);
}
return nameList;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
...@@ -136,7 +136,21 @@ ...@@ -136,7 +136,21 @@
<version>6.11</version> <version>6.11</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-authtoken</artifactId>
<version>1.7.13-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>io.springfox</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies> </dependencies>
......
...@@ -22,6 +22,7 @@ import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper; ...@@ -22,6 +22,7 @@ import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper;
import com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao; import com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao;
import com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao; import com.yeejoin.amos.fas.business.dao.repository.IPlanOperationRecordDao;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer; import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
import com.yeejoin.amos.fas.business.feign.JcsFeign;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService; import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
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.*; import com.yeejoin.amos.fas.business.service.intfc.*;
...@@ -36,6 +37,7 @@ import com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum; ...@@ -36,6 +37,7 @@ import com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum;
import com.yeejoin.amos.fas.core.enums.NumberEnum; import com.yeejoin.amos.fas.core.enums.NumberEnum;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.DateUtil; import com.yeejoin.amos.fas.core.util.DateUtil;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.Equipment; import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.PlanDetail; import com.yeejoin.amos.fas.dao.entity.PlanDetail;
...@@ -75,6 +77,9 @@ public class ContingencyAction implements CustomerAction { ...@@ -75,6 +77,9 @@ public class ContingencyAction implements CustomerAction {
@Autowired @Autowired
private WebMqttComponent webMqttComponent; private WebMqttComponent webMqttComponent;
@Autowired
private JcsFeign jcsFeign;
@Value("${auto-sys.push.type}") @Value("${auto-sys.push.type}")
private String pushType; private String pushType;
@Value("${spring.application.name}") @Value("${spring.application.name}")
...@@ -119,6 +124,9 @@ public class ContingencyAction implements CustomerAction { ...@@ -119,6 +124,9 @@ public class ContingencyAction implements CustomerAction {
@Autowired @Autowired
private PlanDetailMapper planDetailMapper; private PlanDetailMapper planDetailMapper;
@Autowired
private IPlanRuleService planRuleService;
@Value("${rocket-plan-topic}") @Value("${rocket-plan-topic}")
private String rocketTopic; private String rocketTopic;
...@@ -177,30 +185,19 @@ public class ContingencyAction implements CustomerAction { ...@@ -177,30 +185,19 @@ public class ContingencyAction implements CustomerAction {
stringStringMap = new HashMap<>(); stringStringMap = new HashMap<>();
returnMap = new HashMap<>(); returnMap = new HashMap<>();
Date curDate = new Date(); ResponseModel responseModel = jcsFeign.dutyPersonList();
JSONObject param = new JSONObject(); if ("SUCCESS".equals(responseModel.getDevMessage())) {
param.put("dutyDate", curDate); String JSONStr = JSON.toJSONString(responseModel.getResult());
Toke toke = remoteSecurityService.getServerToken(); JSONArray dataList = JSONObject.parseArray(JSONStr);
CommonResponse commonResponse = dutyModeServer.dutyListByDate(toke.getAppKey(), toke.getProduct(), toke.getToke(), orgCode, param.toJSONString()); if (!ObjectUtils.isEmpty(dataList)) {
Map<String, String> finalReturnMap = returnMap;
// String result = HttpUtil.appendPostJson("duty/dutyListByDate", param.toJSONString()); dataList.forEach(x -> {
// JSONObject jsonObject = JSONObject.parseObject(result); Map<String, Object> resultMap = new HashMap<>();
// JSONArray dataList = JSONObject.parseObject(commonResponse.getDataList().toString()); JSONObject obj = (JSONObject) x;
finalReturnMap.put(obj.getString("postTypeName"), obj.getString("userName"));
});
String JSONStr = JSON.toJSONString(commonResponse.getDataList()); }
JSONArray dataList = JSONObject.parseArray(JSONStr);
log.info(String.format("请求值班系统返回dataList:%s", dataList));
if (!ObjectUtils.isEmpty(dataList)) {
Map<String, String> finalReturnMap = returnMap;
dataList.forEach(
x -> {
JSONObject obj = (JSONObject) x;
String name = obj.getString("position");
finalReturnMap.put(name, obj.getString("dutyName"));
}
);
} }
stringStringMap.put(batchNo, returnMap); stringStringMap.put(batchNo, returnMap);
} }
...@@ -216,33 +213,32 @@ public class ContingencyAction implements CustomerAction { ...@@ -216,33 +213,32 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象 * @param paramObj 预案对象
*/ */
@RuleMethod(methodLabel = "步骤更新", project = "换流站消防专项预案") @RuleMethod(methodLabel = "步骤更新", project = "换流站消防专项预案")
public void stepInfo(@MethodParam(paramLabel = "当前步骤编号") String stepCode, public void stepInfo(@MethodParam(paramLabel = "当前步骤编号") String stepCode, @MethodParam(paramLabel = "当前步骤名称") String stepName, @MethodParam(paramLabel = "下一步编号") String nextStepCode, @MethodParam(paramLabel = "下一步名称") String nextStepName, @MethodParam(paramLabel = "对象") Object paramObj) {
@MethodParam(paramLabel = "当前步骤名称") String stepName,
@MethodParam(paramLabel = "下一步编号") String nextStepCode,
@MethodParam(paramLabel = "下一步名称") String nextStepName,
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
SafteyPlanResult result = new SafteyPlanResult(); stopSnapshop(contingencyRo);
Map<String, Object> tempmap1 = new HashMap<>();
ArrayList list = new ArrayList(); SafteyPlanResult result = new SafteyPlanResult();
HashMap step = new HashMap(); Map<String, Object> tempmap1 = new HashMap<>();
ArrayList list = new ArrayList();
step.put("stepCode", stepCode); HashMap step = new HashMap();
step.put("stepName", stepName);
step.put("stepCode", stepCode);
HashMap nextmap = new HashMap(); step.put("stepName", stepName);
nextmap.put("stepCode", nextStepCode);
nextmap.put("stepName", nextStepName); HashMap nextmap = new HashMap();
list.add(step); nextmap.put("stepCode", nextStepCode);
list.add(nextmap); nextmap.put("stepName", nextStepName);
list.add(step);
tempmap1.put("step", list); list.add(nextmap);
tempmap1.put("preStep", new HashMap());
result.add(tempmap1); tempmap1.put("step", list);
log.info("步骤更新(new)" + JSONObject.toJSONString(result)); tempmap1.put("preStep", new HashMap());
this.sendcmd("steparea", contingencyRo, result); result.add(tempmap1);
log.info("步骤更新(new)" + JSONObject.toJSONString(result));
this.sendcmd("steparea", contingencyRo, result);
}
} }
/** /**
...@@ -250,42 +246,11 @@ public class ContingencyAction implements CustomerAction { ...@@ -250,42 +246,11 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象 * @param paramObj 预案对象
*/ */
@RuleMethod(methodLabel = "步骤更新(旧)", project = "换流站消防专项预案") @RuleMethod(methodLabel = "步骤更新(旧)", project = "换流站消防专项预案")
public void stepInfoOld(@MethodParam(paramLabel = "当前编号") String stepCode, public void stepInfoOld(@MethodParam(paramLabel = "当前编号") String stepCode, @MethodParam(paramLabel = "对象") Object paramObj) {
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
// Map<String, Object> tempmap1 = new HashMap<>();
// SetpEnum[] stepArr = SetpEnum.values();
// ArrayList list = new ArrayList();
// HashMap preStep = new HashMap();
// StepComparator comparator = new StepComparator();
// Arrays.sort(stepArr, comparator);
//
// boolean flage = false;
// SetpEnum pstep = null;
// for (SetpEnum step : stepArr) {
// if (Long.valueOf(step.getValue()) == Long.valueOf(stepCode)) {
// if (!ObjectUtils.isEmpty(pstep)) {
// preStep.put("stepCode", pstep.getValue());
// preStep.put("stepName", pstep.getTitle());
// }
// flage = true;
// }
// if (flage) {
// HashMap map = new HashMap();
// map.put("stepCode", step.getValue());
// map.put("stepName", step.getTitle());
// list.add(map);
// }
// pstep = step;
// }
//
// tempmap1.put("step", list);
// tempmap1.put("preStep", preStep);
// result.add(tempmap1);
// log.info("巡检消息发送规则" + JSONObject.toJSONString(result));
this.sendcmd("steparea", contingencyRo, result); this.sendcmd("steparea", contingencyRo, result);
} }
...@@ -296,9 +261,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -296,9 +261,7 @@ public class ContingencyAction implements CustomerAction {
ro.setTelesignallingMap(null); ro.setTelesignallingMap(null);
Constructor<?> constructor; Constructor<?> constructor;
try { try {
constructor = Class.forName( constructor = Class.forName(PACKAGEURL + result.getClass().getSimpleName() + "Message").getConstructor(ActionResult.class);
PACKAGEURL + result.getClass().getSimpleName() + "Message")
.getConstructor(ActionResult.class);
AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result); AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result);
if ("mqtt".equals(pushType.toLowerCase())) { if ("mqtt".equals(pushType.toLowerCase())) {
ToipResponse toipResponse = action.buildResponse(msgType, contingency, result.toJson()); ToipResponse toipResponse = action.buildResponse(msgType, contingency, result.toJson());
...@@ -338,9 +301,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -338,9 +301,7 @@ public class ContingencyAction implements CustomerAction {
ro.setTelesignallingMap(null); ro.setTelesignallingMap(null);
Constructor<?> constructor; Constructor<?> constructor;
try { try {
constructor = Class.forName( constructor = Class.forName(PACKAGEURL + result.getClass().getSimpleName() + "Message").getConstructor(ActionResult.class);
PACKAGEURL + result.getClass().getSimpleName() + "Message")
.getConstructor(ActionResult.class);
AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result); AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result);
ToipResponse toipResponse = action.buildResponse(msgType, contingency, result.toJson()); ToipResponse toipResponse = action.buildResponse(msgType, contingency, result.toJson());
String topic = String.format("/%s/%s/%s", serviceName, stationName, "numberPlan"); String topic = String.format("/%s/%s/%s", serviceName, stationName, "numberPlan");
...@@ -365,7 +326,10 @@ public class ContingencyAction implements CustomerAction { ...@@ -365,7 +326,10 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod(methodLabel = "步骤更新保存", project = "换流站消防专项预案") @RuleMethod(methodLabel = "步骤更新保存", project = "换流站消防专项预案")
public void saveStepInfo(@MethodParam(paramLabel = "当前编号") String stepCode, @MethodParam(paramLabel = "对象") Object paramObj) { public void saveStepInfo(@MethodParam(paramLabel = "当前编号") String stepCode, @MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
iContingencyInstance.updateStep(stepCode, contingencyRo.getBatchNo()); String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
iContingencyInstance.updateStep(stepCode, contingencyRo.getBatchNo());
}
} }
...@@ -376,35 +340,38 @@ public class ContingencyAction implements CustomerAction { ...@@ -376,35 +340,38 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod(methodLabel = "执行记录", project = "换流站消防专项预案") @RuleMethod(methodLabel = "执行记录", project = "换流站消防专项预案")
public void messageRecord(@MethodParam(paramLabel = "消息内容") String content, @MethodParam(paramLabel = "对象") Object paramObj) { public void messageRecord(@MethodParam(paramLabel = "消息内容") String content, @MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); String batchNo = contingencyRo.getBatchNo();
//转换content中的变量 if (!findByBatchNoAndStatus(batchNo)) {
content = instedParams(content, contingencyRo); stopSnapshop(contingencyRo);
iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", content, "MESSAGE", ""); //转换content中的变量
content = instedParams(content, contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", content, "MESSAGE", "");
Map<String, Object> tempmap1 = new HashMap<>();
try { SafteyPlanResult result = new SafteyPlanResult();
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map<String, Object> tempmap1 = new HashMap<>();
List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE"); try {
ArrayList records = new ArrayList<>(); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (!ObjectUtils.isEmpty(list)) { List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE");
list.forEach(action -> { ArrayList records = new ArrayList<>();
HashMap map = new HashMap(); if (!ObjectUtils.isEmpty(list)) {
map.put("time", sdf1.format(action.getCreateDate().getTime())); list.forEach(action -> {
map.put("stepName", action.getContent()); HashMap map = new HashMap();
records.add(map); map.put("time", sdf1.format(action.getCreateDate().getTime()));
}); map.put("stepName", action.getContent());
records.add(map);
});
}
tempmap1.put("content", records);
tempmap1.put("status", PlanRecordStatusEnum.OPERATION.getCode());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }
tempmap1.put("content", records); result.add(tempmap1);
tempmap1.put("status", PlanRecordStatusEnum.OPERATION.getCode()); System.out.println("--------------------messageRecord----------------------" + result);
} catch (Exception e) { this.sendcmd("recordarea", paramObj, result);
// TODO Auto-generated catch block this.sendweb("recordarea", paramObj, result);
e.printStackTrace();
} }
result.add(tempmap1);
System.out.println("--------------------messageRecord----------------------" + result);
this.sendcmd("recordarea", paramObj, result);
this.sendweb("recordarea", paramObj, result);
} }
/** /**
...@@ -421,34 +388,29 @@ public class ContingencyAction implements CustomerAction { ...@@ -421,34 +388,29 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象 * @param paramObj 预案对象
*/ */
@RuleMethod(methodLabel = "智能辅助", project = "换流站消防专项预案") @RuleMethod(methodLabel = "智能辅助", project = "换流站消防专项预案")
public void help(@MethodParam(paramLabel = "当前步骤") String step, public void help(@MethodParam(paramLabel = "当前步骤") String step, @MethodParam(paramLabel = "图标") String icon, @MethodParam(paramLabel = "标题") String title, @MethodParam(paramLabel = "图片集") String image, @MethodParam(paramLabel = "表格数据") String table, @MethodParam(paramLabel = "文本内容") String content, @MethodParam(paramLabel = "对象") Object paramObj) {
@MethodParam(paramLabel = "图标") String icon,
@MethodParam(paramLabel = "标题") String title,
@MethodParam(paramLabel = "图片集") String image,
@MethodParam(paramLabel = "表格数据") String table,
@MethodParam(paramLabel = "文本内容") String content,
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo);
//转换智能辅助中的变量 //转换智能辅助中的变量
content = instedParams(content, contingencyRo); content = instedParams(content, contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
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);
iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", /*JSONObject.toJSONString(tempmap1)*/JSONUtil.toJson(tempmap1), "HELPAREA", ""); iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", JSONUtil.toJson(tempmap1), "HELPAREA", "");
// tempmap1.put("batchNo", contingencyRo.getBatchNo()); result.add(tempmap1);
// tempmap1.put("contingencyRo", contingencyRo);
result.add(tempmap1);
this.sendcmd("helparea", paramObj, result); this.sendcmd("helparea", paramObj, result);
}
} }
...@@ -462,8 +424,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -462,8 +424,7 @@ public class ContingencyAction implements CustomerAction {
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));
...@@ -483,11 +444,9 @@ public class ContingencyAction implements CustomerAction { ...@@ -483,11 +444,9 @@ public class ContingencyAction implements CustomerAction {
while (m.find()) { while (m.find()) {
String parameter = m.group(); String parameter = m.group();
Object parametervalue = ELEvaluationContext Object parametervalue = ELEvaluationContext.getValue(parameter.substring(1, parameter.length() - 1));
.getValue(parameter.substring(1, parameter.length() - 1));
if (parametervalue != null) if (parametervalue != null)
str = str.replace(parameter, str = str.replace(parameter, parametervalue != null ? parametervalue.toString() : null);
parametervalue != null ? parametervalue.toString() : null);
} }
return str; return str;
} }
...@@ -502,49 +461,34 @@ public class ContingencyAction implements CustomerAction { ...@@ -502,49 +461,34 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象 * @param paramObj 预案对象
*/ */
@RuleMethod(methodLabel = "交互动作", project = "换流站消防专项预案") @RuleMethod(methodLabel = "交互动作", project = "换流站消防专项预案")
public void operation(@MethodParam(paramLabel = "动作名称") String actionName, public void operation(@MethodParam(paramLabel = "动作名称") String actionName, @MethodParam(paramLabel = "图标") String icon, @MethodParam(paramLabel = "提示信息") String tips, @MethodParam(paramLabel = "按钮json字符串") String buttonJson, @MethodParam(paramLabel = "预案对象") Object paramObj) {
@MethodParam(paramLabel = "图标") String icon,
@MethodParam(paramLabel = "提示信息") String tips,
@MethodParam(paramLabel = "按钮json字符串") String buttonJson,
@MethodParam(paramLabel = "预案对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
//转换content中的变量 stopSnapshop(contingencyRo);
tips = instedParams(tips, contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); //转换content中的变量
Map<String, Object> tempmap1 = new HashMap<>(); tips = instedParams(tips, contingencyRo);
SafteyPlanResult result = new SafteyPlanResult();
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("button", buttonJson); tempmap1.put("button", buttonJson);
tempmap1.put("caseId", contingencyPlanId); tempmap1.put("caseId", contingencyPlanId);
result.add(tempmap1); result.add(tempmap1);
this.sendcmd("optionarea", paramObj, result); this.sendcmd("optionarea", paramObj, result);
}
} }
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) {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
/**
* batchNo
* stepCode
* buttonCode
* confirm
* contingencyPlanId
* 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);
...@@ -557,11 +501,9 @@ public class ContingencyAction implements CustomerAction { ...@@ -557,11 +501,9 @@ public class ContingencyAction implements CustomerAction {
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);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return false; return false;
} }
...@@ -576,39 +518,35 @@ public class ContingencyAction implements CustomerAction { ...@@ -576,39 +518,35 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象 * @param paramObj 预案对象
*/ */
@RuleMethod(methodLabel = "保存交互动作", project = "换流站消防专项预案") @RuleMethod(methodLabel = "保存交互动作", project = "换流站消防专项预案")
public void saveOperation(@MethodParam(paramLabel = "动作名称") String actionName, public void saveOperation(@MethodParam(paramLabel = "动作名称") String actionName, @MethodParam(paramLabel = "图标") String icon, @MethodParam(paramLabel = "提示信息") String tips, @MethodParam(paramLabel = "按钮json字符串") String buttonJson, @MethodParam(paramLabel = "对象") Object paramObj) {
@MethodParam(paramLabel = "图标") String icon,
@MethodParam(paramLabel = "提示信息") String tips,
@MethodParam(paramLabel = "按钮json字符串") String buttonJson,
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo);
//转换content中的变量 //转换content中的变量
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
try { try {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE"); List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE");
ArrayList records = new ArrayList<>(); ArrayList records = new ArrayList<>();
if (!ObjectUtils.isEmpty(list)) { if (!ObjectUtils.isEmpty(list)) {
list.forEach(action -> { list.forEach(action -> {
HashMap map = new HashMap(); HashMap map = new HashMap();
// map.put("time", sdf.format(action.getCreateDate())); map.put("time", sdf1.format(action.getCreateDate().getTime()));
map.put("time", sdf1.format(action.getCreateDate().getTime())); map.put("stepName", action.getContent());
map.put("stepName", action.getContent()); records.add(map);
records.add(map); });
}); }
tempmap1.put("content", records);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }
tempmap1.put("content", records); result.add(tempmap1);
} catch (Exception e) { this.sendcmd("recordarea", paramObj, result);
// TODO Auto-generated catch block
e.printStackTrace();
} }
result.add(tempmap1);
System.out.println("--------------------saveOperation----------------------" + result);
this.sendcmd("recordarea", paramObj, result);
} }
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) {
...@@ -636,44 +574,42 @@ public class ContingencyAction implements CustomerAction { ...@@ -636,44 +574,42 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod(methodLabel = "地图动作", project = "换流站消防专项预案") @RuleMethod(methodLabel = "地图动作", project = "换流站消防专项预案")
public void mapAction(@MethodParam(paramLabel = "动作名称标识") String actionName, @MethodParam(paramLabel = "参数") String paramJSON, @MethodParam(paramLabel = "对象") Object paramObj) { public void mapAction(@MethodParam(paramLabel = "动作名称标识") String actionName, @MethodParam(paramLabel = "参数") String paramJSON, @MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
String batchNo = contingencyRo.getBatchNo();
log.error("======================================================================================="); if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
tempmap1.put("key", actionName); tempmap1.put("key", actionName);
tempmap1.put("content", paramJSON); tempmap1.put("content", paramJSON);
if (isArea.contains(paramJSON)) { if (isArea.contains(paramJSON)) {
tempmap1.put("isArea", true); tempmap1.put("isArea", true);
} else { } else {
tempmap1.put("isArea", false); tempmap1.put("isArea", false);
}
result.add(tempmap1);
this.sendcmd("maparea", paramObj, result);
} }
result.add(tempmap1);
this.sendcmd("maparea", paramObj, result);
} }
@RuleMethod(methodLabel = "地图动画", project = "换流站消防专项预案") @RuleMethod(methodLabel = "地图动画", project = "换流站消防专项预案")
public void mapCartoonAction( public void mapCartoonAction(@MethodParam(paramLabel = "动作名称标识") String actionName, @MethodParam(paramLabel = "动作类型") String actionType, @MethodParam(paramLabel = "动作类型参数") String paramJSON, @MethodParam(paramLabel = "对象") Object paramObj) {
@MethodParam(paramLabel = "动作名称标识") String actionName,
@MethodParam(paramLabel = "动作类型") String actionType,
@MethodParam(paramLabel = "动作类型参数") String paramJSON,
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
String batchNo = contingencyRo.getBatchNo();
log.error("======================================================================================="); if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
String parameter = instedParams(paramJSON, contingencyRo); String parameter = instedParams(paramJSON, contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
tempmap1.put("key", actionName); tempmap1.put("key", actionName);
tempmap1.put("content", actionType); tempmap1.put("content", actionType);
tempmap1.put("parameter", parameter); tempmap1.put("parameter", parameter);
result.add(tempmap1); result.add(tempmap1);
this.sendcmd("maparea", paramObj, result); this.sendcmd("maparea", paramObj, result);
}
} }
/** /**
...@@ -684,27 +620,25 @@ public class ContingencyAction implements CustomerAction { ...@@ -684,27 +620,25 @@ public class ContingencyAction implements CustomerAction {
* @param paramObj 预案对象 * @param paramObj 预案对象
*/ */
@RuleMethod(methodLabel = "消息提示", project = "换流站消防专项预案") @RuleMethod(methodLabel = "消息提示", project = "换流站消防专项预案")
public void topMessage( public void topMessage(@MethodParam(paramLabel = "标题") String title, @MethodParam(paramLabel = "内容") String content, @MethodParam(paramLabel = "图标") String icon, @MethodParam(paramLabel = "类型") String messageType, @MethodParam(paramLabel = "对象") Object paramObj) {
@MethodParam(paramLabel = "标题") String title,
@MethodParam(paramLabel = "内容") String content,
@MethodParam(paramLabel = "图标") String icon,
@MethodParam(paramLabel = "类型") String messageType,
@MethodParam(paramLabel = "对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
stopSnapshop(contingencyRo); String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
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("type", messageType);//消息类型 messageType 黑色框消息类型 CONTINGENCY,,滚动消息:CURRENTMESSAGE tempmap1.put("type", messageType);//消息类型 messageType 黑色框消息类型 CONTINGENCY,,滚动消息:CURRENTMESSAGE
tempmap1.put("title", title); tempmap1.put("title", title);
tempmap1.put("icon", icon); tempmap1.put("icon", icon);
result.add(tempmap1); result.add(tempmap1);
this.sendcmd("message", paramObj, result); this.sendcmd("message", paramObj, result);
}
} }
/** /**
...@@ -817,55 +751,51 @@ public class ContingencyAction implements CustomerAction { ...@@ -817,55 +751,51 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod(methodLabel = "自动执行步骤", project = "换流站消防专项预案") @RuleMethod(methodLabel = "自动执行步骤", project = "换流站消防专项预案")
public void autoExecute( public void autoExecute(@MethodParam(paramLabel = "动作名称") String actionName, @MethodParam(paramLabel = "步骤编号") String stepCode, @MethodParam(paramLabel = "按钮编码") String buttonCode, @MethodParam(paramLabel = "步骤状态") String stepState, @MethodParam(paramLabel = "预案对象") Object paramObj) {
@MethodParam(paramLabel = "动作名称") String actionName,
@MethodParam(paramLabel = "步骤编号") String stepCode,
@MethodParam(paramLabel = "按钮编码") String buttonCode,
@MethodParam(paramLabel = "步骤状态") String stepState,
@MethodParam(paramLabel = "预案对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
ContingencyPlanInstance contingencyPlanInstance = iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), actionName, "DEFAULT", "", "OPERATE", ""); String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
ContingencyPlanInstance contingencyPlanInstance = iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), actionName, "DEFAULT", "", "OPERATE", "");
Toke toke = remoteSecurityService.getServerToken(); Toke toke = remoteSecurityService.getServerToken();
RequestContext.setToken(toke.getToke()); RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.getProduct()); RequestContext.setProduct(toke.getProduct());
try { try {
iContingencyInstance.setButtonExecuted(contingencyRo.getBatchNo(), contingencyPlanInstance.getId(), buttonCode, "CONFIRM"); iContingencyInstance.setButtonExecuted(contingencyRo.getBatchNo(), contingencyPlanInstance.getId(), buttonCode, "CONFIRM");
iContingencyInstance.fire(contingencyRo.getBatchNo(), stepCode, contingencyPlanInstance.getId(), buttonCode, "CONFIRM", stepState); iContingencyInstance.fire(contingencyRo.getBatchNo(), stepCode, contingencyPlanInstance.getId(), buttonCode, "CONFIRM", stepState);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
}
} }
} }
@RuleMethod(methodLabel = "添加步骤执行", project = "换流站消防专项预案") @RuleMethod(methodLabel = "添加步骤执行", project = "换流站消防专项预案")
public void addExecute( public void addExecute(@MethodParam(paramLabel = "步骤编号") String stepCode, @MethodParam(paramLabel = "按钮编码") String buttonCode, @MethodParam(paramLabel = "设备数据") Object paramObj) {
@MethodParam(paramLabel = "步骤编号") String stepCode, ContingencyRo contingencyRo = (ContingencyRo) paramObj;
@MethodParam(paramLabel = "按钮编码") String buttonCode, String batchNo = contingencyRo.getBatchNo();
@MethodParam(paramLabel = "设备数据") Object paramObj) { if (!findByBatchNoAndStatus(batchNo)) {
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
Map<String, Object> content = new HashMap<>(); Map<String, Object> content = new HashMap<>();
content.put("stepCode", stepCode); content.put("stepCode", stepCode);
content.put("buttonCode", buttonCode); content.put("buttonCode", buttonCode);
DeviceRo ro = (DeviceRo) paramObj; DeviceRo ro = (DeviceRo) paramObj;
Map<String, Object> equipemtnPoints = pointCache.get(ro.getEquipmentId()); Map<String, Object> equipemtnPoints = pointCache.get(ro.getEquipmentId());
if (ObjectUtils.isEmpty(equipemtnPoints)) { if (ObjectUtils.isEmpty(equipemtnPoints)) {
equipemtnPoints = new HashMap<>(); equipemtnPoints = new HashMap<>();
}
equipemtnPoints.put(stepCode + "-" + buttonCode, content);
tempmap1.put("type", "buttonCache");
tempmap1.put("content", equipemtnPoints.values());
result.add(tempmap1);
this.sendcmd("message", ro, result);
} }
equipemtnPoints.put(stepCode + "-" + buttonCode, content);
tempmap1.put("type", "buttonCache");
tempmap1.put("content", equipemtnPoints.values());
result.add(tempmap1);
this.sendcmd("message", ro, result);
} }
@RuleMethod(methodLabel = "清除步骤执行", project = "换流站消防专项预案") @RuleMethod(methodLabel = "清除步骤执行", project = "换流站消防专项预案")
public void clearExecute( public void clearExecute(@MethodParam(paramLabel = "步骤编号") String stepCode, @MethodParam(paramLabel = "按钮编码") String buttonCode, @MethodParam(paramLabel = "重点设备ID") String fireEquipmentId) {
@MethodParam(paramLabel = "步骤编号") String stepCode,
@MethodParam(paramLabel = "按钮编码") String buttonCode,
@MethodParam(paramLabel = "重点设备ID") String fireEquipmentId) {
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
Map<String, Object> content = new HashMap<>(); Map<String, Object> content = new HashMap<>();
...@@ -890,45 +820,38 @@ public class ContingencyAction implements CustomerAction { ...@@ -890,45 +820,38 @@ public class ContingencyAction implements CustomerAction {
@RuleMethod(methodLabel = "同步自动执行步骤", project = "换流站消防专项预案") @RuleMethod(methodLabel = "同步自动执行步骤", project = "换流站消防专项预案")
public void sendExecute(@MethodParam(paramLabel = "预案对象") Object paramObj) { public void sendExecute(@MethodParam(paramLabel = "预案对象") Object paramObj) {
SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>();
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
Map<String, Object> equipemtnPoints = pointCache.get(contingencyRo.getEquipmentId()); String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
tempmap1.put("type", "buttonCache"); SafteyPlanResult result = new SafteyPlanResult();
tempmap1.put("content", ObjectUtils.isEmpty(equipemtnPoints) ? new ArrayList<>() : equipemtnPoints.values()); Map<String, Object> tempmap1 = new HashMap<>();
result.add(tempmap1); Map<String, Object> equipemtnPoints = pointCache.get(contingencyRo.getEquipmentId());
tempmap1.put("type", "buttonCache");
this.sendcmd("message", paramObj, result); tempmap1.put("content", ObjectUtils.isEmpty(equipemtnPoints) ? new ArrayList<>() : equipemtnPoints.values());
result.add(tempmap1);
this.sendcmd("message", paramObj, result);
}
} }
@RuleMethod(methodLabel = "自动执行动作V2", project = "换流站消防专项预案") @RuleMethod(methodLabel = "自动执行动作V2", project = "换流站消防专项预案")
public void autoExecuteActionV2( public void autoExecuteActionV2(@MethodParam(paramLabel = "步骤编码") String stepCode, @MethodParam(paramLabel = "按钮编码") String buttonCode, @MethodParam(paramLabel = "按钮状态") String confirm, @MethodParam(paramLabel = "步骤状态") String stepState, @MethodParam(paramLabel = "动作名称") String actionName, @MethodParam(paramLabel = "图标") String icon, @MethodParam(paramLabel = "提示信息") String tips, @MethodParam(paramLabel = "按钮json字符串") String buttonJson, @MethodParam(paramLabel = "预案对象") Object paramObj) {
@MethodParam(paramLabel = "步骤编码") String stepCode,
@MethodParam(paramLabel = "按钮编码") String buttonCode,
@MethodParam(paramLabel = "按钮状态") String confirm,
@MethodParam(paramLabel = "步骤状态") String stepState,
@MethodParam(paramLabel = "动作名称") String actionName,
@MethodParam(paramLabel = "图标") String icon,
@MethodParam(paramLabel = "提示信息") String tips,
@MethodParam(paramLabel = "按钮json字符串") String buttonJson,
@MethodParam(paramLabel = "预案对象") Object paramObj) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj; ContingencyRo contingencyRo = (ContingencyRo) paramObj;
String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson); String batchNo = contingencyRo.getBatchNo();
try { if (!findByBatchNoAndStatus(batchNo)) {
contingencyInstance.fire(contingencyRo.getBatchNo(), stepCode, contingencyPlanId, buttonCode, confirm, stepState, RequestContext.getToken(), RequestContext.getProduct()); String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson);
} catch (Exception e) { try {
e.printStackTrace(); contingencyInstance.fire(contingencyRo.getBatchNo(), stepCode, contingencyPlanId, buttonCode, confirm, stepState, RequestContext.getToken(), RequestContext.getProduct());
} catch (Exception e) {
e.printStackTrace();
}
} }
} }
public void sendcmd(String msgType, SafteyPlanResult result) { public void sendcmd(String msgType, SafteyPlanResult result) {
Constructor<?> constructor; Constructor<?> constructor;
try { try {
constructor = Class.forName( constructor = Class.forName(PACKAGEURL + result.getClass().getSimpleName() + "Message").getConstructor(ActionResult.class);
PACKAGEURL + result.getClass().getSimpleName() + "Message")
.getConstructor(ActionResult.class);
AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result); AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result);
if ("mqtt".equals(pushType.toLowerCase())) { if ("mqtt".equals(pushType.toLowerCase())) {
ToipResponse toipResponse = action.buildResponse(msgType, null, result.toJson()); ToipResponse toipResponse = action.buildResponse(msgType, null, result.toJson());
...@@ -971,7 +894,9 @@ public class ContingencyAction implements CustomerAction { ...@@ -971,7 +894,9 @@ public class ContingencyAction implements CustomerAction {
result.add(tempmap1); result.add(tempmap1);
//数字预案业务屏web端发送消息 //数字预案业务屏web端发送消息
this.sendweb("recordarea", contingencyRo, result); this.sendweb("recordarea", contingencyRo, result);
updateNumberPlan(contingencyRo.getBatchNo()); updateNumberPlan(batchNo);
// 应急处置中断,初始化planStep,json数据
planRuleService.updatePlanRuleByBatchNo(batchNo);
} }
/** /**
...@@ -996,4 +921,13 @@ public class ContingencyAction implements CustomerAction { ...@@ -996,4 +921,13 @@ public class ContingencyAction implements CustomerAction {
} }
} }
} }
/**
* 通过batchNo获取预案的状态
* @param batchNo
* @return
*/
private Boolean findByBatchNoAndStatus(String batchNo) {
return CollectionUtils.isEmpty(planOperationRecordDao.findByBatchNoAndStatus(batchNo, 0));
}
} }
...@@ -232,4 +232,10 @@ public class ContingencyPlanController extends BaseController { ...@@ -232,4 +232,10 @@ public class ContingencyPlanController extends BaseController {
return CommonResponseUtil2.success(bool); return CommonResponseUtil2.success(bool);
} }
@ApiOperation(value = "获取预案状态")
@RequestMapping(value = "/getPlanStatus", method = RequestMethod.GET)
public ResponseModel getPlanStatus() {
return CommonResponseUtil2.success(contingencyPlanService.getPlanStatus());
}
} }
...@@ -64,10 +64,10 @@ public class LoginController { ...@@ -64,10 +64,10 @@ public class LoginController {
@Value("${outSystem.user.password}") @Value("${outSystem.user.password}")
private String password; private String password;
@Value("${security.productWeb}") @Value("${amos.system.user.product}")
private String product; private String product;
@Value("${security.appKey}") @Value("${amos.system.user.app-key}")
private String appKey; private String appKey;
@ApiOperation(value = "通过userId登录", notes = "查询设备指标") @ApiOperation(value = "通过userId登录", notes = "查询设备指标")
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService; import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.business.util.StringUtil; import com.yeejoin.amos.fas.business.util.StringUtil;
import com.yeejoin.amos.fas.business.vo.PlanStepVo;
import com.yeejoin.amos.fas.config.Permission; import com.yeejoin.amos.fas.config.Permission;
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;
...@@ -10,6 +11,7 @@ import com.yeejoin.amos.fas.dao.entity.TextPlan; ...@@ -10,6 +11,7 @@ import com.yeejoin.amos.fas.dao.entity.TextPlan;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -128,40 +130,44 @@ public class PlanVisual3dController extends BaseController { ...@@ -128,40 +130,44 @@ public class PlanVisual3dController extends BaseController {
List<Map<String, Object>> list = planVisual3dService.getResourceById(type, id); List<Map<String, Object>> list = planVisual3dService.getResourceById(type, id);
return CommonResponseUtil.success(list); return CommonResponseUtil.success(list);
} }
@Permission @Permission
@ApiOperation(value = "预案应用树", notes = "预案应用树") @ApiOperation(value = "预案应用树", notes = "预案应用树")
@GetMapping(value = "/plan/textPlanTree/{appId}") @GetMapping(value = "/plan/textPlanTree/{appId}")
public CommonResponse getPlanTree(@PathVariable("appId") String appId) { public CommonResponse getPlanTree(@PathVariable("appId") String appId) {
return CommonResponseUtil.success(planVisual3dService.getTextPlanBySubjectId(appId)); return CommonResponseUtil.success(planVisual3dService.getTextPlanBySubjectId(appId));
} }
@Permission @Permission
@ApiOperation(value = "删除预案文件", notes = "删除预案文件") @ApiOperation(value = "删除预案文件", notes = "删除预案文件")
@DeleteMapping(value = "/plan/textPlan/{id}") @DeleteMapping(value = "/plan/textPlan/{id}")
public CommonResponse deleteTextPlanFile(@PathVariable("id") Long id) { public CommonResponse deleteTextPlanFile(@PathVariable("id") Long id) {
try { try {
planVisual3dService.deleteTextPlanFile(id); planVisual3dService.deleteTextPlanFile(id);
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} catch (Exception e) { } catch (Exception e) {
return CommonResponseUtil.failure(e.getMessage()); return CommonResponseUtil.failure(e.getMessage());
} }
} }
@Permission @Permission
@ApiOperation(value = "根据批次号获取预案的步骤", notes = "根据批次号获取预案的步骤") @ApiOperation(value = "根据批次号获取预案的步骤", notes = "根据批次号获取预案的步骤")
@GetMapping(value = "/plan/getPlanStep") @GetMapping(value = "/plan/getPlanStep")
public ResponseModel getPlanStep(@RequestParam("batchNo") String batchNo) { public ResponseModel getPlanStep(@RequestParam(value = "batchNo", required = false) String batchNo) {
if (!StringUtil.isNotEmpty(batchNo)) { if (StringUtils.isEmpty(batchNo)) {
batchNo = planVisual3dService.getNewestBatchNo(); batchNo = planVisual3dService.getNewestBatchNo();
} }
if (!StringUtil.isNotEmpty(batchNo)) {
return CommonResponseUtil.successNew(null);
}
return CommonResponseUtil.successNew(planVisual3dService.getPlanStepByBatchNo(batchNo)); return CommonResponseUtil.successNew(planVisual3dService.getPlanStepByBatchNo(batchNo));
} }
@Permission @Permission
@ApiOperation(value = "根据批次号更新预案的步骤", notes = "根据批次号更新预案的步骤")
@PostMapping(value = "/plan/updatePlanStep")
public ResponseModel updatePlanStep(@RequestBody PlanStepVo planStepVo) {
return CommonResponseUtil.successNew(planVisual3dService.updatePlanStep(planStepVo));
}
@Permission
@ApiOperation(value = "根据批次号获取预案的记录", notes = "根据R批次号获取预案的记录") @ApiOperation(value = "根据批次号获取预案的记录", notes = "根据R批次号获取预案的记录")
@GetMapping(value = "/plan/getPlaneRecord") @GetMapping(value = "/plan/getPlaneRecord")
public ResponseModel getPlaneRecord(@RequestParam("batchNo") String batchNo) { public ResponseModel getPlaneRecord(@RequestParam("batchNo") String batchNo) {
......
...@@ -180,13 +180,7 @@ public class View3dController extends BaseController { ...@@ -180,13 +180,7 @@ public class View3dController extends BaseController {
@ApiOperation(value = "今日值班统计",notes = "今日值班统计") @ApiOperation(value = "今日值班统计",notes = "今日值班统计")
@GetMapping(value = "statistics/duty") @GetMapping(value = "statistics/duty")
public CommonResponse getStatisticsDuty(){ public CommonResponse getStatisticsDuty(){
ReginParams reginParams =getSelectedOrgInfo(); return CommonResponseUtil.success(view3dService.getStatisticsDuty());
String orgCode = this.getOrgCode(reginParams);
appKey = getAppKey();
product = getProduct();
staticOrgCode = orgCode;
token = getToken();
return view3dService.getStatisticsDuty(getAppKey(),getProduct(),token,orgCode);
} }
@Permission @Permission
...@@ -332,6 +326,15 @@ public class View3dController extends BaseController { ...@@ -332,6 +326,15 @@ public class View3dController extends BaseController {
return CommonResponseUtil.success(view3dService.listPointsByRegionId(regionId,type)); return CommonResponseUtil.success(view3dService.listPointsByRegionId(regionId,type));
} }
@Permission
@ApiOperation(value = "今日值班列表",notes = "今日值班列表")
@GetMapping(value = "dutyList")
public CommonResponse dutyList(){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
return CommonResponseUtil.success(view3dService.dutyList(orgCode));
}
@Autowired @Autowired
IRocketMQService rocketMQService; IRocketMQService rocketMQService;
......
package com.yeejoin.amos.fas.business.dao.mapper; package com.yeejoin.amos.fas.business.dao.mapper;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.yeejoin.amos.fas.dao.entity.PlanRule;
import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo; import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -34,4 +35,6 @@ public interface PlanOperationRecordMapper { ...@@ -34,4 +35,6 @@ public interface PlanOperationRecordMapper {
* @return * @return
*/ */
String getNewestBatchNo(); String getNewestBatchNo();
PlanRule getPlanRuleByBatchNo(String batchNo);
} }
...@@ -81,4 +81,7 @@ public interface IContingencyPlanInstanceRepository extends BaseDao<ContingencyP ...@@ -81,4 +81,7 @@ public interface IContingencyPlanInstanceRepository extends BaseDao<ContingencyP
" ORDER BY" + " ORDER BY" +
" t.create_date DESC limit 1", nativeQuery = true) " t.create_date DESC limit 1", nativeQuery = true)
String queryRecordOne(String batchNo, String recordType); String queryRecordOne(String batchNo, String recordType);
@Query(value = "SELECT * FROM `contingency_plan_instance` WHERE batch_no = ?1", nativeQuery = true)
List<ContingencyPlanInstance> findByBatchNo(String batchNo);
} }
...@@ -30,4 +30,5 @@ public interface IPlanOperationRecordDao extends BaseDao<PlanOperationRecord, Lo ...@@ -30,4 +30,5 @@ public interface IPlanOperationRecordDao extends BaseDao<PlanOperationRecord, Lo
*/ */
List<PlanOperationRecord> findByStatus(Integer status); List<PlanOperationRecord> findByStatus(Integer status);
List<PlanOperationRecord> findByBatchNoAndStatus(String batchNo, Integer status);
} }
package com.yeejoin.amos.fas.business.feign;
import com.yeejoin.amos.fas.business.jpush.PushMsgParam;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
/**
* 消息推送
* @author maoying
*
*/
@FeignClient(name = "${Jcs.fegin.name}", configuration={MultipartSupportConfig.class})
public interface JcsFeign {
/**
* 新值班月视图
* @param dutyDay
* @param shiftId
* @param postType
* @return
*/
@RequestMapping(value = "/jcs/common/duty-person/new-duty-detail", method = RequestMethod.GET,consumes = "application/json")
ResponseModel dutyStatisticsByDate(
@RequestParam String beginDate,
@RequestParam String endDate,
@RequestParam(required = false) String fieldCode);
/**
* 查询当前值班人信息列表
* @return
*/
@RequestMapping(value = "/jcs/common/duty-person/person/on_duty/list", method = RequestMethod.GET,consumes = "application/json")
ResponseModel dutyPersonList();
}
...@@ -9,6 +9,7 @@ import java.util.Set; ...@@ -9,6 +9,7 @@ import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.yeejoin.amos.component.authtoken.robot.AmosRequestContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
...@@ -38,20 +39,12 @@ import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel; ...@@ -38,20 +39,12 @@ import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
@Service("remoteSecurityService") @Service("remoteSecurityService")
public class RemoteSecurityService { public class RemoteSecurityService {
@Autowired
@Value("${security.password}") AmosRequestContext amosRequestContext;
@Value("${amos.system.user.password}")
private String password; private String password;
@Value("${security.loginId}")
private String loginId;
@Value("${security.productWeb}")
private String productWeb;
@Value("${security.appKey}")
private String appKey;
@Autowired @Autowired
private RedisTemplate<String, String> redisTemplate; private RedisTemplate<String, String> redisTemplate;
...@@ -157,15 +150,15 @@ public class RemoteSecurityService { ...@@ -157,15 +150,15 @@ public class RemoteSecurityService {
public Toke getServerToken() { public Toke getServerToken() {
IdPasswordAuthModel dPasswordAuthModel=new IdPasswordAuthModel(); IdPasswordAuthModel dPasswordAuthModel=new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(loginId); dPasswordAuthModel.setLoginId(amosRequestContext.getUserName());
dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz")); dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
Toke toke = null; Toke toke = null;
try { try {
toke = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(loginId)), Toke.class); toke = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(amosRequestContext.getUserName())), Toke.class);
if(ObjectUtils.isEmpty(toke)){ if(ObjectUtils.isEmpty(toke)){
toke = getLogin(dPasswordAuthModel); toke = getLogin(dPasswordAuthModel);
}else{ }else{
RequestContext.setProduct(productWeb); RequestContext.setProduct(amosRequestContext.getProduct());
if (!TokenOperation.refresh(toke.getToke())) { if (!TokenOperation.refresh(toke.getToke())) {
toke = getLogin(dPasswordAuthModel); toke = getLogin(dPasswordAuthModel);
} }
...@@ -178,15 +171,11 @@ public class RemoteSecurityService { ...@@ -178,15 +171,11 @@ public class RemoteSecurityService {
private Toke getLogin(IdPasswordAuthModel dPasswordAuthModel){ private Toke getLogin(IdPasswordAuthModel dPasswordAuthModel){
Toke toke = new Toke(); Toke toke = new Toke();
RequestContext.setProduct(productWeb); RequestContext.setProduct(amosRequestContext.getProduct());
FeignClientResult feignClientResult = Privilege.authClient.idpassword(dPasswordAuthModel); toke.setToke(amosRequestContext.getToken());
Map map = (Map) feignClientResult.getResult(); toke.setProduct(amosRequestContext.getProduct());
if(map!=null){ toke.setAppKey(amosRequestContext.getAppKey());
toke.setToke(map.get("token").toString()); redisTemplate.opsForValue().set(buildKey(dPasswordAuthModel.getLoginId()), JSONObject.toJSONString(toke), 28, TimeUnit.DAYS);
toke.setProduct(productWeb);
toke.setAppKey(appKey);
redisTemplate.opsForValue().set(buildKey(dPasswordAuthModel.getLoginId()), JSONObject.toJSONString(toke),28,TimeUnit.DAYS);
}
return toke; return toke;
} }
......
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import com.yeejoin.amos.fas.business.service.intfc.IPlanRuleService;
import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo; import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -92,6 +93,9 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -92,6 +93,9 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
@Autowired @Autowired
private ContingencyOriginalMapper contingencyOriginalMapper; private ContingencyOriginalMapper contingencyOriginalMapper;
@Autowired
private IPlanRuleService planRuleService;
private static Map<String, String> stepMap = new HashMap<>(); private static Map<String, String> stepMap = new HashMap<>();
...@@ -313,8 +317,13 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla ...@@ -313,8 +317,13 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
if ("CONFIRM".equals(buttonState)) { if ("CONFIRM".equals(buttonState)) {
if (code.equals(operate.getCode())) { if (code.equals(operate.getCode())) {
operate.setState("executed"); operate.setState("executed");
if ("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code)) if ("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code)) {
redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning()); redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
}
if ("END_EMERGENCY".equals(code)) {
// 应急处置中断,初始化planStep,json数据
planRuleService.updatePlanRuleByBatchNo(batchNo);
}
} else { } else {
operate.setState("disable"); operate.setState("disable");
} }
......
...@@ -33,6 +33,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -33,6 +33,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -814,4 +815,9 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -814,4 +815,9 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
return bool; return bool;
} }
@Override
public Boolean getPlanStatus() {
return CollectionUtils.isEmpty(planOperationRecordDao.findByStatus(0));
}
} }
\ No newline at end of file
...@@ -130,7 +130,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -130,7 +130,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Value("${autoSys.alarm.nameKeys}") @Value("${autoSys.alarm.nameKeys}")
private String nameKeys; private String nameKeys;
@Value("${security.loginId}") @Value("${amos.system.user.user-name}")
private String loginId; private String loginId;
@Value("${autoSys.fire.pool.index_key}") @Value("${autoSys.fire.pool.index_key}")
......
package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper;
import com.yeejoin.amos.fas.business.dao.repository.IPlanRuleDao;
import com.yeejoin.amos.fas.business.service.intfc.IPlanRuleService;
import com.yeejoin.amos.fas.dao.entity.PlanRule;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@Service
public class PlanRuleServiceImpl implements IPlanRuleService {
@Autowired
private IPlanRuleDao planRuleDao;
@Autowired
private PlanOperationRecordMapper planOperationRecordMapper;
@Value("classpath:/json/plan-step.json")
private Resource planStepResource;
@Override
public void updatePlanRuleByBatchNo(String batchNo) {
try {
// 根据批次号查询预案步骤
PlanRule planRule = planOperationRecordMapper.getPlanRuleByBatchNo(batchNo);
String json = IOUtils.toString(planStepResource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
planRule.setPlanStep(json);
planRuleDao.save(planRule);
} catch (IOException e) {
throw new RuntimeException("初始化预案规则planStep数据失败!");
}
}
}
...@@ -2,30 +2,27 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -2,30 +2,27 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.constants.FasConstant; import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.DictMapper; import com.yeejoin.amos.fas.business.dao.mapper.DictMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper; import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanVisual3dMapper; import com.yeejoin.amos.fas.business.dao.mapper.PlanVisual3dMapper;
import com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao; import com.yeejoin.amos.fas.business.dao.repository.*;
import com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository;
import com.yeejoin.amos.fas.business.dao.repository.ITextPlanDao;
import com.yeejoin.amos.fas.business.feign.IMaasVisualServer; import com.yeejoin.amos.fas.business.feign.IMaasVisualServer;
import com.yeejoin.amos.fas.business.service.intfc.IDictService; import com.yeejoin.amos.fas.business.service.intfc.IDictService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService; import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.business.service.model.ToipResponse; import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.util.JSONUtil; import com.yeejoin.amos.fas.business.util.JSONUtil;
import com.yeejoin.amos.fas.business.util.StringUtil; import com.yeejoin.amos.fas.business.util.StringUtil;
import com.yeejoin.amos.fas.business.vo.PlanStepVo;
import com.yeejoin.amos.fas.business.vo.TreeSubjectVo; import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
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 com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData; import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import org.apache.commons.lang3.StringUtils;
import com.yeejoin.amos.fas.dao.entity.Dict;
import com.yeejoin.amos.fas.dao.entity.TextPlan;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -59,6 +56,12 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -59,6 +56,12 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired @Autowired
private IContingencyPlanInstanceRepository contingencyPlanInstanceRepository; private IContingencyPlanInstanceRepository contingencyPlanInstanceRepository;
@Autowired
private IPlanRuleDao planRuleDao;
@Autowired
private IPlanOperationRecordDao planOperationRecordDao;
@Override @Override
public List<TreeSubjectVo> getPlanTree() { public List<TreeSubjectVo> getPlanTree() {
...@@ -88,11 +91,11 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -88,11 +91,11 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Override @Override
public TextPlan getTextPlanInfoById(Long id) { public TextPlan getTextPlanInfoById(Long id) {
Optional<TextPlan> textPlan =iTextPlanDao.findById(id); Optional<TextPlan> textPlan = iTextPlanDao.findById(id);
if(textPlan.isPresent()){ if (textPlan.isPresent()) {
return textPlan.get(); return textPlan.get();
} }
return null; return null;
} }
private List<TreeSubjectVo> listToTree(List<Object> list) { private List<TreeSubjectVo> listToTree(List<Object> list) {
...@@ -117,11 +120,11 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -117,11 +120,11 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
List<TreeSubjectVo> childrenVos = Lists.newArrayList(); List<TreeSubjectVo> childrenVos = Lists.newArrayList();
List<Object> res = (List<Object>) response.getDataList(); List<Object> res = (List<Object>) response.getDataList();
res.forEach(r -> { res.forEach(r -> {
LinkedHashMap<String, Object> map1 = (LinkedHashMap<String, Object>) r; LinkedHashMap<String, Object> map1 = (LinkedHashMap<String, Object>) r;
Integer state = (Integer) map1.get("publishState"); Integer state = (Integer) map1.get("publishState");
if(state == 0) {//过滤 未发布状态 if (state == 0) {//过滤 未发布状态
return; return;
} }
TreeSubjectVo subjectVo = new TreeSubjectVo(); TreeSubjectVo subjectVo = new TreeSubjectVo();
subjectVo.setType("listNode"); subjectVo.setType("listNode");
subjectVo.setParentId((String) map.get("id")); subjectVo.setParentId((String) map.get("id"));
...@@ -187,8 +190,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -187,8 +190,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
Dict dict = new Dict(); Dict dict = new Dict();
dict.setDictCode(type); dict.setDictCode(type);
List<Dict> dictList = dictService.getDictList(dict); List<Dict> dictList = dictService.getDictList(dict);
Map<String, String> dicts = dictList.stream().collect( Map<String, String> dicts = dictList.stream().collect(Collectors.toMap(Dict::getDictValue, Dict::getDictName, (key1, key2) -> key2));
Collectors.toMap(Dict::getDictValue, Dict::getDictName, (key1, key2) -> key2));
//2.1换key为中文 //2.1换key为中文
Map<String, Object> tempMap = new HashMap<String, Object>(); Map<String, Object> tempMap = new HashMap<String, Object>();
...@@ -215,22 +217,22 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -215,22 +217,22 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
dict.setDictCode(FasConstant.PLAN_SOURCE_TYPE); dict.setDictCode(FasConstant.PLAN_SOURCE_TYPE);
List<Dict> dictList = dictMapper.getDictList(dict); List<Dict> dictList = dictMapper.getDictList(dict);
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
list = dictList.stream().map(e->{ list = dictList.stream().map(e -> {
Map<String, Object> newMap = new HashMap<String, Object>(); Map<String, Object> newMap = new HashMap<String, Object>();
newMap.put("key",e.getDictValue()); newMap.put("key", e.getDictValue());
newMap.put("value",e.getDictValue());//前端级联Cascader使用 newMap.put("value", e.getDictValue());//前端级联Cascader使用
newMap.put("isLeaf",false);////前端级联Cascader使用 newMap.put("isLeaf", false);////前端级联Cascader使用
newMap.put("dataType","type"); newMap.put("dataType", "type");
newMap.put("label",e.getDictName()); newMap.put("label", e.getDictName());
return newMap; return newMap;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return list; return list;
} }
@Override @Override
public List<TreeSubjectVo> getTextPlanBySubjectId(String appId) { public List<TreeSubjectVo> getTextPlanBySubjectId(String appId) {
//关联文字预案 //关联文字预案
List<TreeSubjectVo> subjectVos = new ArrayList<>(); List<TreeSubjectVo> subjectVos = new ArrayList<>();
List<TextPlan> textPlans = iTextPlanDao.findByAppId(appId); List<TextPlan> textPlans = iTextPlanDao.findByAppId(appId);
textPlans.forEach(t -> { textPlans.forEach(t -> {
TreeSubjectVo textTreeSubjectVo = new TreeSubjectVo(); TreeSubjectVo textTreeSubjectVo = new TreeSubjectVo();
...@@ -240,13 +242,13 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -240,13 +242,13 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
textTreeSubjectVo.setType("textNode"); textTreeSubjectVo.setType("textNode");
subjectVos.add(textTreeSubjectVo); subjectVos.add(textTreeSubjectVo);
}); });
return subjectVos; return subjectVos;
} }
@Override @Override
public void deleteTextPlanFile(Long id) { public void deleteTextPlanFile(Long id) {
iTextPlanDao.deleteById(id); iTextPlanDao.deleteById(id);
} }
@Override @Override
public String getNewestBatchNo() { public String getNewestBatchNo() {
...@@ -263,9 +265,19 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -263,9 +265,19 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
// 查询当前步骤 // 查询当前步骤
ContingencyOriginalData contingencyOriginalData = contingencyOriginalDataDao.findByBatchNo(batchNo); ContingencyOriginalData contingencyOriginalData = contingencyOriginalDataDao.findByBatchNo(batchNo);
String step = contingencyOriginalData.getStep(); String step = contingencyOriginalData.getStep();
String confirm = contingencyOriginalData.getConfirm();
Map<String, Object> msgContext = new HashMap<>(2); Map<String, Object> msgContext = new HashMap<>(2);
msgContext.put("step", objects); msgContext.put("step", objects);
msgContext.put("currentStep", step); msgContext.put("currentStep", contingencyOriginalData.getStep());
msgContext.put("confirm", contingencyOriginalData.getConfirm());
msgContext.put("createDate", contingencyOriginalData.getCreateDate());
List<ContingencyPlanInstance> list = contingencyPlanInstanceRepository.findByBatchNo(batchNo);
if (!CollectionUtils.isEmpty(list)) {
List<ContingencyPlanInstance> collect = list.stream().filter(x -> "OPERATE".equals(x.getRecordType())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
msgContext.put("caseId", collect.get(0).getId());
}
}
toipResponse.setMsgType("steparea"); toipResponse.setMsgType("steparea");
toipResponse.setMsgContext(msgContext); toipResponse.setMsgContext(msgContext);
toipResponse.setContingency(contingencyOriginalData); toipResponse.setContingency(contingencyOriginalData);
...@@ -303,4 +315,18 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -303,4 +315,18 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
} }
return toipResponse; return toipResponse;
} }
@Override
@Transactional
public PlanStepVo updatePlanStep(PlanStepVo planStepVo) {
// 运行中的设置为重置
List<PlanOperationRecord> planList = planOperationRecordDao.findByStatus(0);
if (!CollectionUtils.isEmpty(planList)) {
// 根据批次号查询预案步骤
PlanRule planRule = planOperationRecordMapper.getPlanRuleByBatchNo(planStepVo.getBatchNo());
planRule.setPlanStep(planStepVo.getPlanStep());
planRuleDao.save(planRule);
}
return planStepVo;
}
} }
...@@ -18,6 +18,7 @@ import com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao; ...@@ -18,6 +18,7 @@ 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.IRiskSourceDao;
import com.yeejoin.amos.fas.business.dao.repository.ISafetyIndexChangeLogDao; import com.yeejoin.amos.fas.business.dao.repository.ISafetyIndexChangeLogDao;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer; import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
import com.yeejoin.amos.fas.business.feign.JcsFeign;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService; import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
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.IView3dService; import com.yeejoin.amos.fas.business.service.intfc.IView3dService;
...@@ -30,6 +31,7 @@ import com.yeejoin.amos.fas.core.common.response.Node3DVoResponse; ...@@ -30,6 +31,7 @@ import com.yeejoin.amos.fas.core.common.response.Node3DVoResponse;
import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse; import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
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 com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.core.util.StringUtil; import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.Equipment; import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.RiskLevel; import com.yeejoin.amos.fas.dao.entity.RiskLevel;
...@@ -87,6 +89,9 @@ public class View3dServiceImpl implements IView3dService { ...@@ -87,6 +89,9 @@ public class View3dServiceImpl implements IView3dService {
@Autowired @Autowired
private IDutyModeServer dutyModeServer; private IDutyModeServer dutyModeServer;
@Autowired
private JcsFeign jcsFeign;
@Value("${param.system.online.date}") @Value("${param.system.online.date}")
private String onLineDate; private String onLineDate;
...@@ -495,12 +500,45 @@ public class View3dServiceImpl implements IView3dService { ...@@ -495,12 +500,45 @@ public class View3dServiceImpl implements IView3dService {
} }
@Override @Override
public CommonResponse getStatisticsDuty(String appKey, String product, String token, String orgCode) { public Map<String, Object> getStatisticsDuty() {
Date curDate = new Date(); Map<String, Object> map = new HashMap<>();
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
JSONObject param = new JSONObject(); String dateStr = format.format(date);
param.put("dutyDate", curDate); ResponseModel responseModel = jcsFeign.dutyStatisticsByDate(dateStr, dateStr, "personType");
return dutyModeServer.dutyListByDay(appKey, product, token, orgCode, param.toJSONString()); if ("SUCCESS".equals(responseModel.getDevMessage())) {
String JSONStr = JSON.toJSONString(responseModel.getResult());
JSONArray dataList = JSONObject.parseArray(JSONStr);
if (!ObjectUtils.isEmpty(dataList)) {
for (Object x : dataList) {
Map<String, Object> resultMap = new HashMap<>();
String json = JSON.toJSONString(((JSONObject) x).get("data"));
JSONArray array = JSONObject.parseArray(json);
if (!ObjectUtils.isEmpty(array)) {
Map<String, String> result = (Map<String, String>) array.get(0);
String total = result.get("total");
String postTypeName = result.get("postTypeName");
if (DutyPersonEnum.FIRE_PERSON.getName().equals(postTypeName)) {
map.put("firePersonNumber", total);
} else if (DutyPersonEnum.OPS_PERSON.getName().equals(postTypeName)) {
map.put("dutyPersonNumber", total);
} else if (DutyPersonEnum.REAL_PERSON.getName().equals(postTypeName)) {
map.put("securityPersonNumber", total);
}
}
}
}
}
if (!map.containsKey("firePersonNumber")) {
map.put("firePersonNumber", 0);
}
if (!map.containsKey("dutyPersonNumber")) {
map.put("dutyPersonNumber", 0);
}
if (!map.containsKey("securityPersonNumber")) {
map.put("securityPersonNumber", 0);
}
return map;
} }
@Override @Override
...@@ -657,6 +695,27 @@ public class View3dServiceImpl implements IView3dService { ...@@ -657,6 +695,27 @@ public class View3dServiceImpl implements IView3dService {
return pointList; return pointList;
} }
@Override
public List<Map<String, Object>> dutyList(String orgCode) {
ArrayList<Map<String, Object>> list = new ArrayList<>();
ResponseModel responseModel = jcsFeign.dutyPersonList();
if ("SUCCESS".equals(responseModel.getDevMessage())) {
String JSONStr = JSON.toJSONString(responseModel.getResult());
JSONArray dataList = JSONObject.parseArray(JSONStr);
if (!ObjectUtils.isEmpty(dataList)) {
dataList.forEach(x -> {
Map<String, Object> resultMap = new HashMap<>();
JSONObject obj = (JSONObject) x;
resultMap.put("postName", obj.getString("postTypeName"));
resultMap.put("name", obj.getString("userName"));
resultMap.put("phone", obj.getString("telephone"));
list.add(resultMap);
});
}
}
return list;
}
private List<Map<String, Object>> getPointsByRegionIds(List<Long> ids) { private List<Map<String, Object>> getPointsByRegionIds(List<Long> ids) {
return view3dMapper.getAllPointInRegions(ids); return view3dMapper.getAllPointInRegions(ids);
......
...@@ -135,4 +135,5 @@ public interface IContingencyPlanService { ...@@ -135,4 +135,5 @@ public interface IContingencyPlanService {
AtomicBoolean planReset(); AtomicBoolean planReset();
Boolean getPlanStatus();
} }
package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.dao.entity.PlanRule;
public interface IPlanRuleService {
void updatePlanRuleByBatchNo(String batchNo);
}
package com.yeejoin.amos.fas.business.service.intfc; package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.business.service.model.ToipResponse; import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.vo.PlanStepVo;
import com.yeejoin.amos.fas.business.vo.TreeSubjectVo; import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.dao.entity.PlanRule;
import com.yeejoin.amos.fas.dao.entity.TextPlan; import com.yeejoin.amos.fas.dao.entity.TextPlan;
import java.util.List; import java.util.List;
...@@ -68,4 +70,6 @@ public interface IPlanVisual3dService { ...@@ -68,4 +70,6 @@ public interface IPlanVisual3dService {
* @return 预案记录 * @return 预案记录
*/ */
ToipResponse getPlaneRecordOneByBatchNo(String batchNo); ToipResponse getPlaneRecordOneByBatchNo(String batchNo);
PlanStepVo updatePlanStep(PlanStepVo planStepVo);
} }
...@@ -104,7 +104,7 @@ public interface IView3dService { ...@@ -104,7 +104,7 @@ public interface IView3dService {
* 今日值班统计 * 今日值班统计
* @return * @return
*/ */
CommonResponse getStatisticsDuty(String appKey, String product, String token, String orgCode); Map<String, Object> getStatisticsDuty();
/** /**
* 设备状态消息最新5条 * 设备状态消息最新5条
...@@ -189,4 +189,10 @@ public interface IView3dService { ...@@ -189,4 +189,10 @@ public interface IView3dService {
*/ */
List<Map<String, Object>> listPointsByRegionId(Long regionId, String type); List<Map<String, Object>> listPointsByRegionId(Long regionId, String type);
/**
* 今日值班列表
* @param orgCode
* @return
*/
List<Map<String, Object>> dutyList(String orgCode);
} }
package com.yeejoin.amos.fas.business.vo;
import lombok.Data;
@Data
public class PlanStepVo {
private String batchNo;
private String planStep;
}
package com.yeejoin.amos.fas.config; package com.yeejoin.amos.fas.config;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.feign.config.InnerInvokException; import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.config.TokenOperation; import com.yeejoin.amos.component.feign.config.TokenOperation;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService; import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.vo.CompanyBo; import com.yeejoin.amos.fas.business.vo.CompanyBo;
import com.yeejoin.amos.fas.business.vo.DepartmentBo; import com.yeejoin.amos.fas.business.vo.DepartmentBo;
import com.yeejoin.amos.fas.business.vo.ReginParams; import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.business.vo.RoleBo; import com.yeejoin.amos.fas.business.vo.RoleBo;
import com.yeejoin.amos.fas.exception.PermissionException; import com.yeejoin.amos.fas.exception.PermissionException;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@Aspect @Aspect
@Component @Component
@ResponseBody @ResponseBody
public class PermissionAspect { public class PermissionAspect {
private static final Logger logger = LoggerFactory.getLogger(PermissionAspect.class); private static final Logger logger = LoggerFactory.getLogger(PermissionAspect.class);
@Autowired @Autowired
private RedisTemplate<String, String> redisTemplate; private RedisTemplate<String, String> redisTemplate;
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
// 前置通知,在方法执行之前 // 前置通知,在方法执行之前
@Before(value = "@annotation(Permission)") @Before(value = "@annotation(Permission)")
public void PermissionCheck(JoinPoint joinPoint) throws PermissionException { public void PermissionCheck(JoinPoint joinPoint) throws PermissionException {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
.getRequestAttributes()).getRequest(); .getRequestAttributes()).getRequest();
logger.info("======开始权限校验======"); logger.info("======开始权限校验======");
// 用户token // 用户token
String token = (String) request.getHeader("token"); String token = (String) request.getHeader("token");
token = ObjectUtils.isEmpty(token) ? (String) request.getHeader("X-Access-Token") : token; token = ObjectUtils.isEmpty(token) ? (String) request.getHeader("X-Access-Token") : token;
String product = (String) request.getHeader("product"); String product = (String) request.getHeader("product");
String appKey = (String) request.getHeader("appKey"); String appKey = (String) request.getHeader("appKey");
logger.info("用户token:" + token); logger.info("用户token:" + token);
RequestContext.setToken(token); RequestContext.setToken(token);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
if (!TokenOperation.refresh(token)) { if (!TokenOperation.refresh(token)) {
throw new PermissionException("登录信息失效,请重新登录"); throw new PermissionException("登录信息失效,请重新登录");
} }
if (joinPoint.getSignature().getName().equals("saveCurCompany")) { if (joinPoint.getSignature().getName().equals("saveCurCompany")) {
return; return;
} }
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
AgencyUserModel userModel=null; AgencyUserModel userModel=null;
try { try {
feignClientResult = Privilege.agencyUserClient.getme(); feignClientResult = Privilege.agencyUserClient.getme();
userModel = (AgencyUserModel) feignClientResult.getResult(); userModel = (AgencyUserModel) feignClientResult.getResult();
String userId = null; String userId = null;
ReginParams regionParam = new ReginParams(); ReginParams regionParam = new ReginParams();
if(userModel != null){ if(userModel != null){
userId = userModel.getUserId(); userId = userModel.getUserId();
ReginParams reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userModel.getUserId(), token)), ReginParams.class); ReginParams reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userModel.getUserId(), token)), ReginParams.class);
if(reginParams == null && userModel.getCompanys().size() > 0){ if(reginParams == null && userModel.getCompanys().size() > 0){
CompanyModel companyModel = userModel.getCompanys().get(0); CompanyModel companyModel = userModel.getCompanys().get(0);
List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(token, product, appKey, companyModel.getSequenceNbr().toString()); List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(token, product, appKey, companyModel.getSequenceNbr().toString());
if(deptList.size() > 0){ CompanyBo companyBo = convertCompanyModelToBo(companyModel);
CompanyBo companyBo = convertCompanyModelToBo(companyModel); regionParam.setCompany(companyBo);
DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0)); if(deptList.size() > 0){
regionParam.setCompany(companyBo); DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
regionParam.setDepartment(departmentBo); regionParam.setDepartment(departmentBo);
} }
Map<Long, List<RoleModel>> orgRoles = userModel.getOrgRoles(); Map<Long, List<RoleModel>> orgRoles = userModel.getOrgRoles();
List<RoleModel> roleModels = null; List<RoleModel> roleModels = null;
if(!ObjectUtils.isEmpty(orgRoles)) { if(!ObjectUtils.isEmpty(orgRoles)) {
for (Map.Entry<Long, List<RoleModel>> entry : orgRoles.entrySet()) { for (Map.Entry<Long, List<RoleModel>> entry : orgRoles.entrySet()) {
roleModels = entry.getValue(); roleModels = entry.getValue();
break; break;
} }
} }
if(!ObjectUtils.isEmpty(roleModels)){ if(!ObjectUtils.isEmpty(roleModels)){
regionParam.setRole(convertRoleModelToBo(roleModels.get(0))); regionParam.setRole(convertRoleModelToBo(roleModels.get(0)));
} }
redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(regionParam),28, TimeUnit.DAYS); redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(regionParam),28, TimeUnit.DAYS);
} }
} }
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
} }
private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel){ private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel){
DepartmentBo departmentBo = new DepartmentBo(); DepartmentBo departmentBo = new DepartmentBo();
if(departmentModel != null) { if(departmentModel != null) {
departmentBo.setCompanySeq(departmentModel.getCompanySeq().toString()); departmentBo.setCompanySeq(departmentModel.getCompanySeq().toString());
departmentBo.setDepartmentDesc(departmentModel.getDepartmentDesc()); departmentBo.setDepartmentDesc(departmentModel.getDepartmentDesc());
departmentBo.setDepartmentName(departmentModel.getDepartmentName()); departmentBo.setDepartmentName(departmentModel.getDepartmentName());
departmentBo.setLevel(departmentModel.getLevel()); departmentBo.setLevel(departmentModel.getLevel());
departmentBo.setOrgCode(departmentModel.getOrgCode()); departmentBo.setOrgCode(departmentModel.getOrgCode());
departmentBo.setParentId(departmentModel.getParentId().toString()); departmentBo.setParentId(departmentModel.getParentId().toString());
departmentBo.setDeptOrgCode(departmentModel.getDeptOrgCode().toString()); departmentBo.setDeptOrgCode(departmentModel.getDeptOrgCode().toString());
departmentBo.setSequenceNbr(departmentModel.getSequenceNbr().toString()); departmentBo.setSequenceNbr(departmentModel.getSequenceNbr().toString());
} }
return departmentBo; return departmentBo;
} }
/** /**
* Model 转 Bo * Model 转 Bo
*/ */
private CompanyBo convertCompanyModelToBo(CompanyModel companyModel){ private CompanyBo convertCompanyModelToBo(CompanyModel companyModel){
CompanyBo companyBo = new CompanyBo(); CompanyBo companyBo = new CompanyBo();
if(companyModel != null) { if(companyModel != null) {
companyBo.setAddress(companyModel.getAddress()); companyBo.setAddress(companyModel.getAddress());
companyBo.setCompanyName(companyModel.getCompanyName()); companyBo.setCompanyName(companyModel.getCompanyName());
companyBo.setCompanyOrgCode(Long.parseLong(companyModel.getCompanyOrgCode().toString())); companyBo.setCompanyOrgCode(Long.parseLong(companyModel.getCompanyOrgCode().toString()));
companyBo.setEmail(companyModel.getEmail()); companyBo.setEmail(companyModel.getEmail());
companyBo.setLandlinePhone(companyModel.getLandlinePhone()); companyBo.setLandlinePhone(companyModel.getLandlinePhone());
companyBo.setLongitude(companyModel.getLongitude()); companyBo.setLongitude(companyModel.getLongitude());
companyBo.setLatitude(companyModel.getLatitude()); companyBo.setLatitude(companyModel.getLatitude());
companyBo.setLevel(companyModel.getLevel()); companyBo.setLevel(companyModel.getLevel());
companyBo.setOrgCode(companyModel.getOrgCode()); companyBo.setOrgCode(companyModel.getOrgCode());
companyBo.setSequenceNbr(companyModel.getSequenceNbr().toString()); companyBo.setSequenceNbr(companyModel.getSequenceNbr().toString());
companyBo.setParentId(companyModel.getParentId().toString()); companyBo.setParentId(companyModel.getParentId().toString());
} }
return companyBo; return companyBo;
} }
private RoleBo convertRoleModelToBo(RoleModel roleModel) { private RoleBo convertRoleModelToBo(RoleModel roleModel) {
RoleBo roleBo = new RoleBo(); RoleBo roleBo = new RoleBo();
if(roleModel != null){ if(roleModel != null){
roleBo.setRoleName(roleModel.getRoleName()); roleBo.setRoleName(roleModel.getRoleName());
roleBo.setRoleType(roleModel.getRoleType()); roleBo.setRoleType(roleModel.getRoleType());
roleBo.setSequenceNbr(roleModel.getSequenceNbr().toString()); roleBo.setSequenceNbr(roleModel.getSequenceNbr().toString());
} }
return roleBo; return roleBo;
} }
//redi缓存选择的用户信息 //redi缓存选择的用户信息
private String buildKey(String userId, String token) { private String buildKey(String userId, String token) {
return "region_" + userId + "_" + token; return "region_" + userId + "_" + token;
} }
} }
...@@ -9,12 +9,16 @@ spring.datasource.testWhileIdle = true ...@@ -9,12 +9,16 @@ spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1 spring.datasource.validationQuery = SELECT 1
#系统服务账号,用户后端服务调用 #系统服务账号,用户后端服务调用
security.password=a1234560 #security.password=a1234560
security.loginId=fas_autosys #security.loginId=fas_autosys
amos.system.user.user-name=fas_autosys
amos.system.user.password=a1234560
#应用product appkey #应用product appkey
security.productWeb=STUDIO_APP_WEB #security.productWeb=STUDIO_APP_WEB
security.appKey =studio_normalapp_3056965 #security.appKey =studio_normalapp_3056965
amos.system.user.app-key=studio_normalapp_3056965
amos.system.user.product=STUDIO_APP_WEB
eureka.client.serviceUrl.defaultZone=http://172.16.11.201:10001/eureka/ eureka.client.serviceUrl.defaultZone=http://172.16.11.201:10001/eureka/
eureka.client.register-with-eureka = true eureka.client.register-with-eureka = true
......
...@@ -9,12 +9,16 @@ spring.datasource.testWhileIdle = true ...@@ -9,12 +9,16 @@ spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1 spring.datasource.validationQuery = SELECT 1
#系统服务账号,用户后端服务调用 #系统服务账号,用户后端服务调用
security.password=a1234560 #security.password=a1234560
security.loginId=fas_autosys #security.loginId=fas_autosys
amos.system.user.user-name=fas_autosys
amos.system.user.password=a1234560
#应用product appkey #应用product appkey
security.productWeb=STUDIO_APP_WEB #security.productWeb=STUDIO_APP_WEB
security.appKey =studio_normalapp_2681691 #security.appKey =studio_normalapp_3056965
amos.system.user.app-key=studio_normalapp_3056965
amos.system.user.product=STUDIO_APP_WEB
eureka.client.serviceUrl.defaultZone=http://172.16.11.20:10001/eureka/ eureka.client.serviceUrl.defaultZone=http://172.16.11.20:10001/eureka/
eureka.client.register-with-eureka = true eureka.client.register-with-eureka = true
......
...@@ -9,12 +9,16 @@ spring.datasource.testWhileIdle = true ...@@ -9,12 +9,16 @@ spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1 spring.datasource.validationQuery = SELECT 1
#系统服务账号,用户后端服务调用 #系统服务账号,用户后端服务调用
security.password=a1234560 #security.password=a1234560
security.loginId=fas_autosys #security.loginId=fas_autosys
amos.system.user.user-name=fas_autosys
amos.system.user.password=a1234560
#应用product appkey #应用product appkey
security.productWeb=STUDIO_APP_WEB #security.productWeb=STUDIO_APP_WEB
security.appKey =studio_normalapp_2681691 #security.appKey =studio_normalapp_3056965
amos.system.user.app-key=studio_normalapp_3056965
amos.system.user.product=STUDIO_APP_WEB
eureka.client.serviceUrl.defaultZone=http://172.16.11.20:10001/eureka/ eureka.client.serviceUrl.defaultZone=http://172.16.11.20:10001/eureka/
eureka.client.register-with-eureka = true eureka.client.register-with-eureka = true
......
...@@ -52,6 +52,10 @@ equipManage.fegin.name=AMOS-EQUIPMANAGE ...@@ -52,6 +52,10 @@ equipManage.fegin.name=AMOS-EQUIPMANAGE
#jpush 服务名称 #jpush 服务名称
Push.fegin.name=AMOS-JPUSH Push.fegin.name=AMOS-JPUSH
#JCS 服务名称
Jcs.fegin.name=JCS
#feginName #feginName
number.plan.projectName=换流站消防专项预案 number.plan.projectName=换流站消防专项预案
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog <databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"> http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<changeSet author="suhuiguang" id="1587349916716-1"> <changeSet author="suhuiguang" id="1587349916716-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_risk_source" columnName="ue4_location"/> <columnExists tableName="f_risk_source" columnName="ue4_location"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_risk_source add column ue4_location</comment> <comment>f_risk_source add column ue4_location</comment>
<sql> <sql>
alter table `f_risk_source` add column `ue4_location` text default null comment 'ue4位置' after `position3d`; alter table `f_risk_source` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1587349916716-2"> <changeSet author="suhuiguang" id="1587349916716-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_risk_source" columnName="ue4_rotation"/> <columnExists tableName="f_risk_source" columnName="ue4_rotation"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_risk_source add column ue4_rotation</comment> <comment>f_risk_source add column ue4_rotation</comment>
<sql> <sql>
alter table `f_risk_source` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`; alter table `f_risk_source` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1587349916716-3"> <changeSet author="suhuiguang" id="1587349916716-3">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_risk_source" columnName="ue4_extent"/> <columnExists tableName="f_risk_source" columnName="ue4_extent"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_risk_source add column ue4_extent</comment> <comment>f_risk_source add column ue4_extent</comment>
<sql> <sql>
alter table `f_risk_source` add column `ue4_extent` text default null comment 'ue4缩放' after `position3d`; alter table `f_risk_source` add column `ue4_extent` text default null comment 'ue4缩放' after `position3d`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1587351415717-1"> <changeSet author="suhuiguang" id="1587351415717-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_equipment" columnName="ue4_location"/> <columnExists tableName="f_equipment" columnName="ue4_location"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_equipment add column ue4_location</comment> <comment>f_equipment add column ue4_location</comment>
<sql> <sql>
alter table `f_equipment` add column `ue4_location` text default null comment 'ue4位置' after `position3d`; alter table `f_equipment` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1587351415717-2"> <changeSet author="suhuiguang" id="1587351415717-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_equipment" columnName="ue4_rotation"/> <columnExists tableName="f_equipment" columnName="ue4_rotation"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_equipment add column ue4_rotation</comment> <comment>f_equipment add column ue4_rotation</comment>
<sql> <sql>
alter table `f_equipment` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`; alter table `f_equipment` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1587350552716-1"> <changeSet author="suhuiguang" id="1587350552716-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_fire_equipment" columnName="ue4_location"/> <columnExists tableName="f_fire_equipment" columnName="ue4_location"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_fire_equipment add column ue4_location</comment> <comment>f_fire_equipment add column ue4_location</comment>
<sql> <sql>
alter table `f_fire_equipment` add column `ue4_location` text default null comment 'ue4位置' after `position3d`; alter table `f_fire_equipment` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1587350552716-2"> <changeSet author="suhuiguang" id="1587350552716-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_fire_equipment" columnName="ue4_rotation"/> <columnExists tableName="f_fire_equipment" columnName="ue4_rotation"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_fire_equipment add column ue4_rotation</comment> <comment>f_fire_equipment add column ue4_rotation</comment>
<sql> <sql>
alter table `f_fire_equipment` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`; alter table `f_fire_equipment` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1587350593716-1"> <changeSet author="suhuiguang" id="1587350593716-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_fire_station" columnName="ue4_location"/> <columnExists tableName="f_fire_station" columnName="ue4_location"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_fire_station add column ue4_location</comment> <comment>f_fire_station add column ue4_location</comment>
<sql> <sql>
alter table `f_fire_station` add column `ue4_location` text default null comment 'ue4位置' after `position3d`; alter table `f_fire_station` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1587350593716-2"> <changeSet author="suhuiguang" id="1587350593716-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_fire_station" columnName="ue4_rotation"/> <columnExists tableName="f_fire_station" columnName="ue4_rotation"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_fire_station add column ue4_rotation</comment> <comment>f_fire_station add column ue4_rotation</comment>
<sql> <sql>
alter table `f_fire_station` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`; alter table `f_fire_station` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1587350759717-1"> <changeSet author="suhuiguang" id="1587350759717-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_water_resource" columnName="ue4_location"/> <columnExists tableName="f_water_resource" columnName="ue4_location"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_water_resource add column ue4_location</comment> <comment>f_water_resource add column ue4_location</comment>
<sql> <sql>
alter table `f_water_resource` add column `ue4_location` text default null comment 'ue4位置' after `position3d`; alter table `f_water_resource` add column `ue4_location` text default null comment 'ue4位置' after `position3d`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1587350759717-2"> <changeSet author="suhuiguang" id="1587350759717-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_water_resource" columnName="ue4_rotation"/> <columnExists tableName="f_water_resource" columnName="ue4_rotation"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_water_resource add column ue4_rotation</comment> <comment>f_water_resource add column ue4_rotation</comment>
<sql> <sql>
alter table `f_water_resource` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`; alter table `f_water_resource` add column `ue4_rotation` text default null comment 'ue4旋转' after `position3d`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1587350860716-1"> <changeSet author="suhuiguang" id="1587350860716-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<tableExists tableName="f_safety_index_change_log"/> <tableExists tableName="f_safety_index_change_log"/>
</not> </not>
</preConditions> </preConditions>
<comment>create f_safety_index_change_log</comment> <comment>create f_safety_index_change_log</comment>
<sql> <sql>
create table f_safety_index_change_log create table f_safety_index_change_log
( (
id bigint(20) not null auto_increment comment '物理主键', id bigint(20) not null auto_increment comment '物理主键',
safety_index decimal(4,1) comment '安全指数', safety_index decimal(4,1) comment '安全指数',
collect_date date comment '统计日期', collect_date date comment '统计日期',
org_code varchar(100) comment '机构', org_code varchar(100) comment '机构',
remark varchar(255) comment '备注', remark varchar(255) comment '备注',
primary key (id) primary key (id)
); );
alter table f_safety_index_change_log comment '安全指数日流水'; alter table f_safety_index_change_log comment '安全指数日流水';
create index Index_org_code on f_safety_index_change_log create index Index_org_code on f_safety_index_change_log
( (
org_code org_code
); );
</sql> </sql>
</changeSet> </changeSet>
<changeSet id="1587882668719-1" author="suhuiguang"> <changeSet id="1587882668719-1" author="suhuiguang">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<indexExists indexName="idx_type"/> <indexExists indexName="idx_type"/>
</not> </not>
</preConditions> </preConditions>
<createIndex <createIndex
indexName="idx_type" indexName="idx_type"
tableName="f_fire_station" tableName="f_fire_station"
tablespace="A String" tablespace="A String"
unique="false"> unique="false">
<column name="type"/> <column name="type"/>
</createIndex> </createIndex>
</changeSet> </changeSet>
<changeSet author="shanqiyun" id="1588067351000-1"> <changeSet author="shanqiyun" id="1588067351000-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_risk_source" columnName="route_path"/> <columnExists tableName="f_risk_source" columnName="route_path"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_risk_source add column route_path </comment> <comment>f_risk_source add column route_path </comment>
<sql> <sql>
alter table f_risk_source add column `route_path` varchar(2000) DEFAULT NULL COMMENT '路径坐标' after `position3d`; alter table f_risk_source add column `route_path` varchar(2000) DEFAULT NULL COMMENT '路径坐标' after `position3d`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1588140925893-1"> <changeSet author="suhuiguang" id="1588140925893-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_safety_index_change_log" columnName="create_date"/> <columnExists tableName="f_safety_index_change_log" columnName="create_date"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_safety_index_change_log add column create_date</comment> <comment>f_safety_index_change_log add column create_date</comment>
<sql> <sql>
alter table `f_safety_index_change_log` add column `create_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间'; alter table `f_safety_index_change_log` add column `create_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1588990926789-1"> <changeSet author="suhuiguang" id="1588990926789-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_risk_level " columnName="manage_level"/> <columnExists tableName="f_risk_level " columnName="manage_level"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_risk_level add column manage_level 管控级别</comment> <comment>f_risk_level add column manage_level 管控级别</comment>
<sql> <sql>
ALTER TABLE `f_risk_level` ALTER TABLE `f_risk_level`
add COLUMN `manage_level` tinyint(4) DEFAULT NULL COMMENT '管控级别'; add COLUMN `manage_level` tinyint(4) DEFAULT NULL COMMENT '管控级别';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1589165258908-1"> <changeSet author="suhuiguang" id="1589165258908-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_rpn_change_log " columnName="trigger_type"/> <columnExists tableName="f_rpn_change_log " columnName="trigger_type"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_rpn_change_log add column trigger_type 触发类型</comment> <comment>f_rpn_change_log add column trigger_type 触发类型</comment>
<sql> <sql>
ALTER TABLE `f_rpn_change_log` ALTER TABLE `f_rpn_change_log`
add COLUMN `trigger_type` varchar(20) DEFAULT NULL COMMENT '触发类型:巡检、告警、评价、删除' after `trigger_by`; add COLUMN `trigger_type` varchar(20) DEFAULT NULL COMMENT '触发类型:巡检、告警、评价、删除' after `trigger_by`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1589165258908-2"> <changeSet author="suhuiguang" id="1589165258908-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_risk_source " columnName="flicker_frequency"/> <columnExists tableName="f_risk_source " columnName="flicker_frequency"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_risk_source add column flicker_frequency 闪烁频率</comment> <comment>f_risk_source add column flicker_frequency 闪烁频率</comment>
<sql> <sql>
ALTER TABLE `f_risk_source` ALTER TABLE `f_risk_source`
add COLUMN `flicker_frequency` int(11) DEFAULT 0 COMMENT '闪烁频率' after `status`; add COLUMN `flicker_frequency` int(11) DEFAULT 0 COMMENT '闪烁频率' after `status`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="zhouyi" id="1589444792916-1"> <changeSet author="zhouyi" id="1589444792916-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<tableExists tableName="f_station_info"/> <tableExists tableName="f_station_info"/>
</preConditions> </preConditions>
<comment>create table f_station_info</comment> <comment>create table f_station_info</comment>
<sql> <sql>
DROP TABLE IF EXISTS f_station_info; DROP TABLE IF EXISTS f_station_info;
CREATE TABLE `f_station_info` ( CREATE TABLE `f_station_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(20) DEFAULT NULL COMMENT '名称', `name` varchar(20) DEFAULT NULL COMMENT '名称',
`station_code` varchar(32) NOT NULL COMMENT '环流站编码', `station_code` varchar(32) NOT NULL COMMENT '环流站编码',
`code` varchar(10) DEFAULT NULL COMMENT '后三位编码', `code` varchar(10) DEFAULT NULL COMMENT '后三位编码',
`elec_type` tinyint(4) DEFAULT NULL COMMENT '换流站类型:1-发电类型;2-收电类型', `elec_type` tinyint(4) DEFAULT NULL COMMENT '换流站类型:1-发电类型;2-收电类型',
`use_type` tinyint(4) NOT NULL COMMENT '用途类型:1-电厂升压变电站;2-公用普通变电站;3-公用换流变电站;4-企业自备变电站;5-其他', `use_type` tinyint(4) NOT NULL COMMENT '用途类型:1-电厂升压变电站;2-公用普通变电站;3-公用换流变电站;4-企业自备变电站;5-其他',
`province_code` varchar(32) DEFAULT NULL COMMENT '省份编码', `province_code` varchar(32) DEFAULT NULL COMMENT '省份编码',
`city_code` varchar(32) DEFAULT NULL COMMENT '市区编码', `city_code` varchar(32) DEFAULT NULL COMMENT '市区编码',
`district_code` varchar(32) DEFAULT NULL COMMENT '区县编码', `district_code` varchar(32) DEFAULT NULL COMMENT '区县编码',
`address` varchar(255) DEFAULT NULL COMMENT '详细地址', `address` varchar(255) DEFAULT NULL COMMENT '详细地址',
`status` bit(1) NOT NULL DEFAULT b'0' COMMENT '0-启用;1-停用', `status` bit(1) NOT NULL DEFAULT b'0' COMMENT '0-启用;1-停用',
`longitude` double DEFAULT NULL COMMENT '经度', `longitude` double DEFAULT NULL COMMENT '经度',
`latitude` double DEFAULT NULL COMMENT '纬度', `latitude` double DEFAULT NULL COMMENT '纬度',
`station_charge_user_id` varchar(50) DEFAULT NULL COMMENT '换流站负责人', `station_charge_user_id` varchar(50) DEFAULT NULL COMMENT '换流站负责人',
`safety_charge_user_id` varchar(50) DEFAULT NULL COMMENT '安全负责人', `safety_charge_user_id` varchar(50) DEFAULT NULL COMMENT '安全负责人',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', `create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人', `create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
`remark` varchar(255) DEFAULT NULL COMMENT '备注', `remark` varchar(255) DEFAULT NULL COMMENT '备注',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `f_station_info_uniq` (`station_code`) UNIQUE KEY `f_station_info_uniq` (`station_code`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COMMENT='站端信息表'; ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COMMENT='站端信息表';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1589769364577-1"> <changeSet author="suhuiguang" id="1589769364577-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<columnExists tableName="f_risk_level " columnName="manage_level"/> <columnExists tableName="f_risk_level " columnName="manage_level"/>
</preConditions> </preConditions>
<comment>f_risk_level 增加管控级别 初始化数据</comment> <comment>f_risk_level 增加管控级别 初始化数据</comment>
<sql> <sql>
update f_risk_level set manage_level = 1 where level = '1'; update f_risk_level set manage_level = 1 where level = '1';
update f_risk_level set manage_level = 2 where level = '2'; update f_risk_level set manage_level = 2 where level = '2';
update f_risk_level set manage_level = 3 where level = '3'; update f_risk_level set manage_level = 3 where level = '3';
update f_risk_level set manage_level = 4 where level = '4'; update f_risk_level set manage_level = 4 where level = '4';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="maoying" id="11590390304001-1"> <changeSet author="maoying" id="11590390304001-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<columnExists tableName="f_fire_equipment_point " columnName="fire_equipment_id"/> <columnExists tableName="f_fire_equipment_point " columnName="fire_equipment_id"/>
</preConditions> </preConditions>
<comment>修改fire_equipment_id可为空</comment> <comment>修改fire_equipment_id可为空</comment>
<sql> <sql>
ALTER TABLE `f_fire_equipment_point` ALTER TABLE `f_fire_equipment_point`
MODIFY COLUMN `fire_equipment_id` bigint(20) NULL COMMENT '消防装备id' AFTER `code`; MODIFY COLUMN `fire_equipment_id` bigint(20) NULL COMMENT '消防装备id' AFTER `code`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="shanqiyun" id="1591672147780-1"> <changeSet author="shanqiyun" id="1591672147780-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<viewExists viewName="toip_biz_message"/> <viewExists viewName="toip_biz_message"/>
</preConditions> </preConditions>
<comment>create view toip_biz_message</comment> <comment>create view toip_biz_message</comment>
<sql> <sql>
DROP VIEW IF EXISTS toip_biz_message; DROP VIEW IF EXISTS toip_biz_message;
CREATE ALGORITHM = UNDEFINED DEFINER = `root` @`%` SQL SECURITY DEFINER VIEW `toip_biz_message` AS SELECT CREATE ALGORITHM = UNDEFINED DEFINER = `root` @`%` SQL SECURITY DEFINER VIEW `toip_biz_message` AS SELECT
`m`.`id` AS `id`, `m`.`id` AS `id`,
`m`.`time` AS `time`, `m`.`time` AS `time`,
`m`.`content` AS `content`, `m`.`content` AS `content`,
`m`.`title` AS `title`, `m`.`title` AS `title`,
`m`.`type` AS `type`, `m`.`type` AS `type`,
`m`.`sender` AS `sender`, `m`.`sender` AS `sender`,
`m`.`receiver` AS `receiver`, `m`.`receiver` AS `receiver`,
`m`.`reader` AS `reader`, `m`.`reader` AS `reader`,
`m`.`biz_id` AS `biz_id`, `m`.`biz_id` AS `biz_id`,
`m`.`bizclass_name` AS `bizclass_name`, `m`.`bizclass_name` AS `bizclass_name`,
`n`.`org_code` AS `org_code` `n`.`org_code` AS `org_code`
FROM FROM
( `toip_sys_message` `m` JOIN `f_equipment` `n` ) ( `toip_sys_message` `m` JOIN `f_equipment` `n` )
WHERE WHERE
( ( `n`.`id` = `m`.`biz_id` ) AND ( `m`.`bizclass_name` = 'class com.yeejoin.amos.fas.business.service.model.FireEquimentDataRo' ) ) UNION ALL ( ( `n`.`id` = `m`.`biz_id` ) AND ( `m`.`bizclass_name` = 'class com.yeejoin.amos.fas.business.service.model.FireEquimentDataRo' ) ) UNION ALL
SELECT SELECT
`m`.`id` AS `id`, `m`.`id` AS `id`,
`m`.`time` AS `time`, `m`.`time` AS `time`,
`m`.`content` AS `content`, `m`.`content` AS `content`,
`m`.`title` AS `title`, `m`.`title` AS `title`,
`m`.`type` AS `type`, `m`.`type` AS `type`,
`m`.`sender` AS `sender`, `m`.`sender` AS `sender`,
`m`.`receiver` AS `receiver`, `m`.`receiver` AS `receiver`,
`m`.`reader` AS `reader`, `m`.`reader` AS `reader`,
`m`.`biz_id` AS `biz_id`, `m`.`biz_id` AS `biz_id`,
`m`.`bizclass_name` AS `bizclass_name`, `m`.`bizclass_name` AS `bizclass_name`,
`n`.`org_code` AS `org_code` `n`.`org_code` AS `org_code`
FROM FROM
( `toip_sys_message` `m` JOIN `p_point` `n` ) ( `toip_sys_message` `m` JOIN `p_point` `n` )
WHERE WHERE
( ( `n`.`id` = `m`.`biz_id` ) AND ( `m`.`bizclass_name` = 'class com.yeejoin.amos.fas.business.service.model.ProtalDataRo' ) ) UNION ALL ( ( `n`.`id` = `m`.`biz_id` ) AND ( `m`.`bizclass_name` = 'class com.yeejoin.amos.fas.business.service.model.ProtalDataRo' ) ) UNION ALL
SELECT SELECT
`m`.`id` AS `id`, `m`.`id` AS `id`,
`m`.`time` AS `time`, `m`.`time` AS `time`,
`m`.`content` AS `content`, `m`.`content` AS `content`,
`m`.`title` AS `title`, `m`.`title` AS `title`,
`m`.`type` AS `type`, `m`.`type` AS `type`,
`m`.`sender` AS `sender`, `m`.`sender` AS `sender`,
`m`.`receiver` AS `receiver`, `m`.`receiver` AS `receiver`,
`m`.`reader` AS `reader`, `m`.`reader` AS `reader`,
`m`.`biz_id` AS `biz_id`, `m`.`biz_id` AS `biz_id`,
`m`.`bizclass_name` AS `bizclass_name`, `m`.`bizclass_name` AS `bizclass_name`,
`n`.`org_code` AS `org_code` `n`.`org_code` AS `org_code`
FROM FROM
( `toip_sys_message` `m` JOIN `f_risk_source` `n` ) ( `toip_sys_message` `m` JOIN `f_risk_source` `n` )
WHERE WHERE
( ( `n`.`id` = `m`.`biz_id` ) AND ( `m`.`bizclass_name` = 'class com.yeejoin.amos.fas.business.service.model.RiskSourceRuleRo' ) ); ( ( `n`.`id` = `m`.`biz_id` ) AND ( `m`.`bizclass_name` = 'class com.yeejoin.amos.fas.business.service.model.RiskSourceRuleRo' ) );
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="shanqiyun" id="1593309428780-1"> <changeSet author="shanqiyun" id="1593309428780-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<tableExists tableName="contingency_original_data" /> <tableExists tableName="contingency_original_data" />
</not> </not>
</preConditions> </preConditions>
<comment>create table contingency_original_data</comment> <comment>create table contingency_original_data</comment>
<sql> <sql>
DROP TABLE IF EXISTS contingency_original_data; DROP TABLE IF EXISTS contingency_original_data;
CREATE TABLE `contingency_original_data` ( CREATE TABLE `contingency_original_data` (
`id` varchar(36) NOT NULL COMMENT 'rule', `id` varchar(36) NOT NULL COMMENT 'rule',
`fire_Equipment_Name` varchar(32) NOT NULL COMMENT '记录类型:消息MESSAGE,操作OPERATE', `fire_Equipment_Name` varchar(32) NOT NULL COMMENT '记录类型:消息MESSAGE,操作OPERATE',
`fire_Equipment_Id` varchar(500) NOT NULL COMMENT '记录内容:文本信息或者json数据', `fire_Equipment_Id` varchar(500) NOT NULL COMMENT '记录内容:文本信息或者json数据',
`layer` int(11) NOT NULL COMMENT '一级分类', `layer` int(11) NOT NULL COMMENT '一级分类',
`fire_Equipment_Layer` int(11) NOT NULL COMMENT '二级分类', `fire_Equipment_Layer` int(11) NOT NULL COMMENT '二级分类',
`fire_Equipment_Position` varchar(255) DEFAULT NULL COMMENT '图标,url,或者文件名', `fire_Equipment_Position` varchar(255) DEFAULT NULL COMMENT '图标,url,或者文件名',
`equipment_Id` int(11) NOT NULL COMMENT '排序', `equipment_Id` int(11) NOT NULL COMMENT '排序',
`equipment_Name` varchar(255) DEFAULT NULL, `equipment_Name` varchar(255) DEFAULT NULL,
`mobile` varchar(255) DEFAULT NULL, `mobile` varchar(255) DEFAULT NULL,
`admin_Name` varchar(255) DEFAULT NULL, `admin_Name` varchar(255) DEFAULT NULL,
`camera_Codes` varchar(255) DEFAULT NULL, `camera_Codes` varchar(255) DEFAULT NULL,
`camera_Ids` varchar(255) DEFAULT NULL, `camera_Ids` varchar(255) DEFAULT NULL,
`fire_Count` int(11) DEFAULT NULL, `fire_Count` int(11) DEFAULT NULL,
`confirm` varchar(255) DEFAULT NULL, `confirm` varchar(255) DEFAULT NULL,
`create_date` datetime DEFAULT NULL, `create_date` datetime DEFAULT NULL,
`create_user` varchar(50) DEFAULT NULL, `create_user` varchar(50) DEFAULT NULL,
`update_date` datetime DEFAULT NULL, `update_date` datetime DEFAULT NULL,
`update_user` varchar(50) DEFAULT NULL, `update_user` varchar(50) DEFAULT NULL,
`is_delete` bit(1) DEFAULT NULL, `is_delete` bit(1) DEFAULT NULL,
`batch_No` varchar(36) NOT NULL, `batch_No` varchar(36) NOT NULL,
`picture1` varchar(255) DEFAULT NULL, `picture1` varchar(255) DEFAULT NULL,
`picture2` varchar(255) DEFAULT NULL, `picture2` varchar(255) DEFAULT NULL,
`picture4` varchar(255) DEFAULT NULL, `picture4` varchar(255) DEFAULT NULL,
`picture3` varchar(255) DEFAULT NULL, `picture3` varchar(255) DEFAULT NULL,
`fire_Truck_Route` varchar(2000) DEFAULT NULL, `fire_Truck_Route` varchar(2000) DEFAULT NULL,
`runstep` bit(1) DEFAULT NULL, `runstep` bit(1) DEFAULT NULL,
`step_state` varchar(255) DEFAULT NULL, `step_state` varchar(255) DEFAULT NULL,
`step` varchar(255) DEFAULT NULL, `step` varchar(255) DEFAULT NULL,
`equipment_position3d` varchar(255) DEFAULT NULL, `equipment_position3d` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `INDEX_BATCH_NO` (`batch_No`) UNIQUE KEY `INDEX_BATCH_NO` (`batch_No`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应急预案信息节点定义'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应急预案信息节点定义';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="shanqiyun" id="1593309428780-2"> <changeSet author="shanqiyun" id="1593309428780-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<tableExists tableName="contingency_plan" /> <tableExists tableName="contingency_plan" />
</not> </not>
</preConditions> </preConditions>
<comment>create table contingency_plan</comment> <comment>create table contingency_plan</comment>
<sql> <sql>
DROP TABLE IF EXISTS contingency_plan; DROP TABLE IF EXISTS contingency_plan;
CREATE TABLE `contingency_plan` ( CREATE TABLE `contingency_plan` (
`id` varchar(36) NOT NULL COMMENT 'rule', `id` varchar(36) NOT NULL COMMENT 'rule',
`record_type` varchar(32) NOT NULL COMMENT '记录类型:消息MESSAGE,操作OPERATE', `record_type` varchar(32) NOT NULL COMMENT '记录类型:消息MESSAGE,操作OPERATE',
`content` varchar(500) NOT NULL COMMENT '记录内容:文本信息或者json数据', `content` varchar(500) NOT NULL COMMENT '记录内容:文本信息或者json数据',
`category` varchar(36) NOT NULL COMMENT '一级分类', `category` varchar(36) NOT NULL COMMENT '一级分类',
`sub_category` varchar(36) NOT NULL COMMENT '二级分类', `sub_category` varchar(36) NOT NULL COMMENT '二级分类',
`icon` varchar(255) DEFAULT NULL COMMENT '图标,url,或者文件名', `icon` varchar(255) DEFAULT NULL COMMENT '图标,url,或者文件名',
`sort` int(11) NOT NULL COMMENT '排序', `sort` int(11) NOT NULL COMMENT '排序',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应急预案信息节点定义'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应急预案信息节点定义';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="shanqiyun" id="1593309428780-3"> <changeSet author="shanqiyun" id="1593309428780-3">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<tableExists tableName="contingency_plan_instance" /> <tableExists tableName="contingency_plan_instance" />
</not> </not>
</preConditions> </preConditions>
<comment>create table contingency_plan_instance</comment> <comment>create table contingency_plan_instance</comment>
<sql> <sql>
DROP TABLE IF EXISTS contingency_plan_instance; DROP TABLE IF EXISTS contingency_plan_instance;
CREATE TABLE `contingency_plan_instance` ( CREATE TABLE `contingency_plan_instance` (
`id` varchar(36) NOT NULL COMMENT 'rule', `id` varchar(36) NOT NULL COMMENT 'rule',
`record_type` varchar(32) NOT NULL COMMENT '记录类型:消息MESSAGE,操作OPERATE', `record_type` varchar(32) NOT NULL COMMENT '记录类型:消息MESSAGE,操作OPERATE',
`category` varchar(36) DEFAULT NULL COMMENT '一级分类', `category` varchar(36) DEFAULT NULL COMMENT '一级分类',
`content` varchar(2000) NOT NULL COMMENT '记录内容:文本信息或者json数据', `content` varchar(2000) NOT NULL COMMENT '记录内容:文本信息或者json数据',
`icon` varchar(255) DEFAULT NULL COMMENT '图标,url,或者文件名', `icon` varchar(255) DEFAULT NULL COMMENT '图标,url,或者文件名',
`sort` int(11) DEFAULT NULL COMMENT '所有节点一起的排序号', `sort` int(11) DEFAULT NULL COMMENT '所有节点一起的排序号',
`sequence_num` int(11) DEFAULT NULL COMMENT '用于显示的序号', `sequence_num` int(11) DEFAULT NULL COMMENT '用于显示的序号',
`batch_no` varchar(36) NOT NULL COMMENT '预案实例编号,暂时无法区分多个火灾,暂时存储报警设备id', `batch_no` varchar(36) NOT NULL COMMENT '预案实例编号,暂时无法区分多个火灾,暂时存储报警设备id',
`create_date` datetime DEFAULT NULL, `create_date` datetime DEFAULT NULL,
`create_user` varchar(50) DEFAULT NULL, `create_user` varchar(50) DEFAULT NULL,
`update_date` datetime DEFAULT NULL, `update_date` datetime DEFAULT NULL,
`update_user` varchar(50) DEFAULT NULL, `update_user` varchar(50) DEFAULT NULL,
`is_delete` bit(1) DEFAULT NULL, `is_delete` bit(1) DEFAULT NULL,
`tips` varchar(255) DEFAULT NULL, `tips` varchar(255) DEFAULT NULL,
`runstate` bit(1) DEFAULT NULL, `runstate` bit(1) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应急预案执行记录实例'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应急预案执行记录实例';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="1605924681-1"> <changeSet author="keyong" id="1605924681-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_station_info" columnName="station_charge_user_name" /> <columnExists tableName="f_station_info" columnName="station_charge_user_name" />
</not> </not>
</preConditions> </preConditions>
<comment>修改f_station_info表结构</comment> <comment>修改f_station_info表结构</comment>
<sql> <sql>
ALTER TABLE `f_station_info` ADD COLUMN `station_charge_user_name` varchar(20) NULL COMMENT '换流站负责人姓名'; ALTER TABLE `f_station_info` ADD COLUMN `station_charge_user_name` varchar(20) NULL COMMENT '换流站负责人姓名';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="1605924681-2"> <changeSet author="keyong" id="1605924681-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_station_info" columnName="safety_charge_user_name" /> <columnExists tableName="f_station_info" columnName="safety_charge_user_name" />
</not> </not>
</preConditions> </preConditions>
<comment>修改f_station_info表结构</comment> <comment>修改f_station_info表结构</comment>
<sql> <sql>
ALTER TABLE `f_station_info` ADD COLUMN `safety_charge_user_name` varchar(20) NULL COMMENT '安全负责人姓名'; ALTER TABLE `f_station_info` ADD COLUMN `safety_charge_user_name` varchar(20) NULL COMMENT '安全负责人姓名';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="1605924681-3"> <changeSet author="keyong" id="1605924681-3">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_station_info" columnName="create_user_name" /> <columnExists tableName="f_station_info" columnName="create_user_name" />
</not> </not>
</preConditions> </preConditions>
<comment>修改f_station_info表结构</comment> <comment>修改f_station_info表结构</comment>
<sql> <sql>
ALTER TABLE `f_station_info` ADD COLUMN `create_user_name` varchar(20) NULL COMMENT '创建人姓名'; ALTER TABLE `f_station_info` ADD COLUMN `create_user_name` varchar(20) NULL COMMENT '创建人姓名';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="1606290088-1"> <changeSet author="keyong" id="1606290088-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_station_info" columnName="create_user_phone_num" /> <columnExists tableName="f_station_info" columnName="create_user_phone_num" />
</not> </not>
</preConditions> </preConditions>
<comment>修改f_station_info表结构</comment> <comment>修改f_station_info表结构</comment>
<sql> <sql>
ALTER TABLE `f_station_info` ADD COLUMN `create_user_phone_num` varchar(20) NULL COMMENT '创建人联系方式'; ALTER TABLE `f_station_info` ADD COLUMN `create_user_phone_num` varchar(20) NULL COMMENT '创建人联系方式';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="1606290088-2"> <changeSet author="keyong" id="1606290088-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_station_info" columnName="station_user_phone_num" /> <columnExists tableName="f_station_info" columnName="station_user_phone_num" />
</not> </not>
</preConditions> </preConditions>
<comment>修改f_station_info表结构</comment> <comment>修改f_station_info表结构</comment>
<sql> <sql>
ALTER TABLE `f_station_info` ADD COLUMN `station_user_phone_num` varchar(20) NULL COMMENT '换流站负责人联系方式'; ALTER TABLE `f_station_info` ADD COLUMN `station_user_phone_num` varchar(20) NULL COMMENT '换流站负责人联系方式';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="1606290088-3"> <changeSet author="keyong" id="1606290088-3">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_station_info" columnName="safety_user_phone_num" /> <columnExists tableName="f_station_info" columnName="safety_user_phone_num" />
</not> </not>
</preConditions> </preConditions>
<comment>修改f_station_info表结构</comment> <comment>修改f_station_info表结构</comment>
<sql> <sql>
ALTER TABLE `f_station_info` ADD COLUMN `safety_user_phone_num` varchar(20) NULL COMMENT '安全负责人联系方式'; ALTER TABLE `f_station_info` ADD COLUMN `safety_user_phone_num` varchar(20) NULL COMMENT '安全负责人联系方式';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="1608279637-1"> <changeSet author="keyong" id="1608279637-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_station_info" columnName="fire_captain_name" /> <columnExists tableName="f_station_info" columnName="fire_captain_name" />
</not> </not>
</preConditions> </preConditions>
<comment>修改f_station_info表结构</comment> <comment>修改f_station_info表结构</comment>
<sql> <sql>
ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_name` varchar(20) NULL COMMENT '驻站消防队队长姓名'; ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_name` varchar(20) NULL COMMENT '驻站消防队队长姓名';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="1608279637-2"> <changeSet author="keyong" id="1608279637-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_station_info" columnName="fire_captain_phone_num" /> <columnExists tableName="f_station_info" columnName="fire_captain_phone_num" />
</not> </not>
</preConditions> </preConditions>
<comment>修改f_station_info表结构</comment> <comment>修改f_station_info表结构</comment>
<sql> <sql>
ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_phone_num` varchar(20) NULL COMMENT '驻站消防队队长电话'; ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_phone_num` varchar(20) NULL COMMENT '驻站消防队队长电话';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="1608279637-3"> <changeSet author="keyong" id="1608279637-3">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_station_info" columnName="fire_captain_user_id" /> <columnExists tableName="f_station_info" columnName="fire_captain_user_id" />
</not> </not>
</preConditions> </preConditions>
<comment>修改f_station_info表结构</comment> <comment>修改f_station_info表结构</comment>
<sql> <sql>
ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_user_id` varchar(20) NULL COMMENT '驻站消防队队长'; ALTER TABLE `f_station_info` ADD COLUMN `fire_captain_user_id` varchar(20) NULL COMMENT '驻站消防队队长';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="shg" id="1609226808866-1"> <changeSet author="shg" id="1609226808866-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_risk_source" columnName="source_id"/> <columnExists tableName="f_risk_source" columnName="source_id"/>
</not> </not>
</preConditions> </preConditions>
<comment>f_risk_source add column source_id</comment> <comment>f_risk_source add column source_id</comment>
<sql> <sql>
alter table `f_risk_source` add column `source_id` bigint(20) DEFAULT NULL AFTER `status`; alter table `f_risk_source` add column `source_id` bigint(20) DEFAULT NULL AFTER `status`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="shg" id="1609226808867-2"> <changeSet author="shg" id="1609226808867-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<indexExists indexName="unique_idx_source_id" /> <indexExists indexName="unique_idx_source_id" />
</not> </not>
</preConditions> </preConditions>
<comment>f_risk_source add UNIQUE source_id</comment> <comment>f_risk_source add UNIQUE source_id</comment>
<sql> <sql>
ALTER TABLE `f_risk_source` ADD UNIQUE unique_idx_source_id(source_id); ALTER TABLE `f_risk_source` ADD UNIQUE unique_idx_source_id(source_id);
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="gaojianqiang" id="1609989898-1"> <changeSet author="gaojianqiang" id="1609989898-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="f_equipment" columnName="status" /> <columnExists tableName="f_equipment" columnName="status" />
</not> </not>
</preConditions> </preConditions>
<comment>修改f_equipment表结构</comment> <comment>修改f_equipment表结构</comment>
<sql> <sql>
ALTER TABLE `f_equipment` ADD COLUMN `status` tinyint(4) NULL DEFAULT 0 COMMENT '预案状态:1-启动,0-未启动'; ALTER TABLE `f_equipment` ADD COLUMN `status` tinyint(4) NULL DEFAULT 0 COMMENT '预案状态:1-启动,0-未启动';
ALTER TABLE `f_equipment` ADD COLUMN `start_time` datetime(0) NULL DEFAULT NULL COMMENT '预案开始时间'; ALTER TABLE `f_equipment` ADD COLUMN `start_time` datetime(0) NULL DEFAULT NULL COMMENT '预案开始时间';
ALTER TABLE `f_equipment` ADD COLUMN `end_time` datetime(0) NULL DEFAULT NULL COMMENT '预案结束时间'; ALTER TABLE `f_equipment` ADD COLUMN `end_time` datetime(0) NULL DEFAULT NULL COMMENT '预案结束时间';
ALTER TABLE `f_equipment` ADD COLUMN `reserve_source` tinyint(4) NULL DEFAULT 0 COMMENT '预案来源:1-手动触发,0-自动触发(默认)'; ALTER TABLE `f_equipment` ADD COLUMN `reserve_source` tinyint(4) NULL DEFAULT 0 COMMENT '预案来源:1-手动触发,0-自动触发(默认)';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="wujunkai" id="1612272587000-1"> <changeSet author="wujunkai" id="1612272587000-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<tableExists tableName="c_plan_classify_tree" /> <tableExists tableName="c_plan_classify_tree" />
</not> </not>
</preConditions> </preConditions>
<comment>create table c_plan_classify_tree</comment> <comment>create table c_plan_classify_tree</comment>
<sql> <sql>
DROP TABLE IF EXISTS c_plan_classify_tree; DROP TABLE IF EXISTS c_plan_classify_tree;
CREATE TABLE `c_plan_classify_tree` ( CREATE TABLE `c_plan_classify_tree` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`classify_name` varchar(255) DEFAULT NULL COMMENT '预案分类名称', `classify_name` varchar(255) DEFAULT NULL COMMENT '预案分类名称',
`parent_id` bigint(20) DEFAULT NULL COMMENT '父类id', `parent_id` bigint(20) DEFAULT NULL COMMENT '父类id',
`create_date` datetime DEFAULT NULL COMMENT '创建时间', `create_date` datetime DEFAULT NULL COMMENT '创建时间',
`creator` varchar(255) DEFAULT NULL COMMENT '创建人', `creator` varchar(255) DEFAULT NULL COMMENT '创建人',
`org_code` varchar(255) DEFAULT NULL COMMENT '组织机构', `org_code` varchar(255) DEFAULT NULL COMMENT '组织机构',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COMMENT='预案分类树'; ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COMMENT='预案分类树';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="wujunkai" id="1612272587000-2"> <changeSet author="wujunkai" id="1612272587000-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<tableExists tableName="c_plan_detail" /> <tableExists tableName="c_plan_detail" />
</not> </not>
</preConditions> </preConditions>
<comment>create table c_plan_detail</comment> <comment>create table c_plan_detail</comment>
<sql> <sql>
DROP TABLE IF EXISTS c_plan_detail; DROP TABLE IF EXISTS c_plan_detail;
CREATE TABLE `c_plan_detail` ( CREATE TABLE `c_plan_detail` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '数字预案ID', `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '数字预案ID',
`plan_name` varchar(255) DEFAULT NULL COMMENT '预案名称', `plan_name` varchar(255) DEFAULT NULL COMMENT '预案名称',
`code` varchar(255) DEFAULT NULL COMMENT '预案编号', `code` varchar(255) DEFAULT NULL COMMENT '预案编号',
`classify_id` bigint(20) DEFAULT NULL COMMENT '预案类型', `classify_id` bigint(20) DEFAULT NULL COMMENT '预案类型',
`plan_range` varchar(255) DEFAULT NULL COMMENT '适用范围', `plan_range` varchar(255) DEFAULT NULL COMMENT '适用范围',
`edit_org_name` varchar(255) DEFAULT NULL COMMENT '编写部门', `edit_org_name` varchar(255) DEFAULT NULL COMMENT '编写部门',
`edition` varchar(255) DEFAULT NULL COMMENT '版次', `edition` varchar(255) DEFAULT NULL COMMENT '版次',
`implementation_time` datetime DEFAULT NULL COMMENT '实施时间', `implementation_time` datetime DEFAULT NULL COMMENT '实施时间',
`create_date` datetime NOT NULL COMMENT '录入时间', `create_date` datetime NOT NULL COMMENT '录入时间',
`remark` text COMMENT '备注', `remark` text COMMENT '备注',
`status` int(255) DEFAULT NULL COMMENT '预案状态', `status` int(255) DEFAULT NULL COMMENT '预案状态',
`creator` varchar(255) DEFAULT NULL COMMENT '创建人', `creator` varchar(255) DEFAULT NULL COMMENT '创建人',
`reviser` varchar(255) DEFAULT NULL COMMENT '修改人', `reviser` varchar(255) DEFAULT NULL COMMENT '修改人',
`update_time` datetime DEFAULT NULL COMMENT '修改时间', `update_time` datetime DEFAULT NULL COMMENT '修改时间',
`org_code` varchar(255) DEFAULT NULL COMMENT '部门code', `org_code` varchar(255) DEFAULT NULL COMMENT '部门code',
`is_delete` tinyint(1) DEFAULT '0' COMMENT '删除状态(0、正常,1、删除)', `is_delete` tinyint(1) DEFAULT '0' COMMENT '删除状态(0、正常,1、删除)',
`input_time` datetime DEFAULT NULL COMMENT '录入时间', `input_time` datetime DEFAULT NULL COMMENT '录入时间',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COMMENT='预案详情表'; ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COMMENT='预案详情表';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="wujunkai" id="1612272587000-3"> <changeSet author="wujunkai" id="1612272587000-3">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<tableExists tableName="c_plan_doc" /> <tableExists tableName="c_plan_doc" />
</not> </not>
</preConditions> </preConditions>
<comment>create table c_plan_doc</comment> <comment>create table c_plan_doc</comment>
<sql> <sql>
DROP TABLE IF EXISTS c_plan_doc; DROP TABLE IF EXISTS c_plan_doc;
CREATE TABLE `c_plan_doc` ( CREATE TABLE `c_plan_doc` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID', `plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID',
`doc_id` bigint(20) DEFAULT NULL COMMENT '文档ID', `doc_id` bigint(20) DEFAULT NULL COMMENT '文档ID',
`create_date` datetime NOT NULL COMMENT '创建时间', `create_date` datetime NOT NULL COMMENT '创建时间',
`is_delete` tinyint(1) DEFAULT NULL COMMENT '删除状态', `is_delete` tinyint(1) DEFAULT NULL COMMENT '删除状态',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COMMENT='预案文档关系表'; ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COMMENT='预案文档关系表';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="wujunkai" id="1612272587000-4"> <changeSet author="wujunkai" id="1612272587000-4">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<tableExists tableName="c_plan_equipment" /> <tableExists tableName="c_plan_equipment" />
</not> </not>
</preConditions> </preConditions>
<comment>create table c_plan_equipment</comment> <comment>create table c_plan_equipment</comment>
<sql> <sql>
DROP TABLE IF EXISTS c_plan_equipment; DROP TABLE IF EXISTS c_plan_equipment;
CREATE TABLE `c_plan_equipment` ( CREATE TABLE `c_plan_equipment` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID', `plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID',
`fire_equipment_id` bigint(20) DEFAULT NULL COMMENT '电力装备ID', `fire_equipment_id` bigint(20) DEFAULT NULL COMMENT '电力装备ID',
`create_date` datetime NOT NULL COMMENT '创建时间', `create_date` datetime NOT NULL COMMENT '创建时间',
`is_delete` tinyint(1) DEFAULT NULL COMMENT '删除状态', `is_delete` tinyint(1) DEFAULT NULL COMMENT '删除状态',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COMMENT='预案电力设备关系表'; ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COMMENT='预案电力设备关系表';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="wujunkai" id="1612272587000-5"> <changeSet author="wujunkai" id="1612272587000-5">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<tableExists tableName="c_plan_operation_record" /> <tableExists tableName="c_plan_operation_record" />
</not> </not>
</preConditions> </preConditions>
<comment>create table c_plan_operation_record</comment> <comment>create table c_plan_operation_record</comment>
<sql> <sql>
DROP TABLE IF EXISTS c_plan_operation_record; DROP TABLE IF EXISTS c_plan_operation_record;
CREATE TABLE `c_plan_operation_record` ( CREATE TABLE `c_plan_operation_record` (
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT '记录ID', `id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT '记录ID',
`plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID', `plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID',
`plan_pattern` tinyint(4) DEFAULT NULL COMMENT '运行模式(4、模拟,5、自动)', `plan_pattern` tinyint(4) DEFAULT NULL COMMENT '运行模式(4、模拟,5、自动)',
`status` tinyint(4) DEFAULT NULL COMMENT '运行状态(0、运行中,1、完毕,3、中断)', `status` tinyint(4) DEFAULT NULL COMMENT '运行状态(0、运行中,1、完毕,3、中断)',
`execution_type` tinyint(4) DEFAULT NULL COMMENT '执行方式(0、预案验证 1、火灾处置)', `execution_type` tinyint(4) DEFAULT NULL COMMENT '执行方式(0、预案验证 1、火灾处置)',
`start_time` datetime DEFAULT NULL COMMENT '开始时间', `start_time` datetime DEFAULT NULL COMMENT '开始时间',
`end_time` datetime DEFAULT NULL COMMENT '结束时间', `end_time` datetime DEFAULT NULL COMMENT '结束时间',
`create_date` datetime DEFAULT NULL COMMENT '创建时间', `create_date` datetime DEFAULT NULL COMMENT '创建时间',
`batch_no` varchar(255) DEFAULT NULL COMMENT '批次号', `batch_no` varchar(255) DEFAULT NULL COMMENT '批次号',
`is_delete` tinyint(1) DEFAULT NULL COMMENT '是否删除', `is_delete` tinyint(1) DEFAULT NULL COMMENT '是否删除',
`start_user_name` varchar(255) DEFAULT NULL COMMENT '启动人名称', `start_user_name` varchar(255) DEFAULT NULL COMMENT '启动人名称',
`start_user_id` varchar(255) DEFAULT NULL COMMENT '启动人id', `start_user_id` varchar(255) DEFAULT NULL COMMENT '启动人id',
`equipment_code` varchar(20) DEFAULT NULL COMMENT '装备code', `equipment_code` varchar(20) DEFAULT NULL COMMENT '装备code',
`equipment_name` varchar(255) DEFAULT NULL COMMENT '装备名称', `equipment_name` varchar(255) DEFAULT NULL COMMENT '装备名称',
`equipment_id` bigint(11) DEFAULT NULL COMMENT '装备ID', `equipment_id` bigint(11) DEFAULT NULL COMMENT '装备ID',
`fire_equipment_id` bigint(255) DEFAULT NULL COMMENT '电力设备ID', `fire_equipment_id` bigint(255) DEFAULT NULL COMMENT '电力设备ID',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=114 DEFAULT CHARSET=utf8mb4 COMMENT='预案运行记录表'; ) ENGINE=InnoDB AUTO_INCREMENT=114 DEFAULT CHARSET=utf8mb4 COMMENT='预案运行记录表';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="wujunkai" id="1612272587000-6"> <changeSet author="wujunkai" id="1612272587000-6">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<tableExists tableName="c_plan_rule" /> <tableExists tableName="c_plan_rule" />
</not> </not>
</preConditions> </preConditions>
<comment>create table c_plan_rule</comment> <comment>create table c_plan_rule</comment>
<sql> <sql>
DROP TABLE IF EXISTS c_plan_rule; DROP TABLE IF EXISTS c_plan_rule;
CREATE TABLE `c_plan_rule` ( CREATE TABLE `c_plan_rule` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`rule_id` varchar(32) DEFAULT NULL COMMENT '规则ID', `rule_id` varchar(32) DEFAULT NULL COMMENT '规则ID',
`plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID', `plan_id` bigint(20) DEFAULT NULL COMMENT '预案ID',
`create_date` datetime DEFAULT NULL COMMENT '创建时间', `create_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` tinyint(1) DEFAULT NULL COMMENT '是否删除', `is_delete` tinyint(1) DEFAULT NULL COMMENT '是否删除',
`rule_name` varchar(100) DEFAULT NULL COMMENT '规则名称', `rule_name` varchar(100) DEFAULT NULL COMMENT '规则名称',
`pic_url` varchar(100) DEFAULT NULL COMMENT '规则树形图路径', `pic_url` varchar(100) DEFAULT NULL COMMENT '规则树形图路径',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="maoying" id="1612272587000-7"> <changeSet author="maoying" id="1612272587000-7">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<columnExists tableName="c_plan_operation_record" columnName="equipment_code" /> <columnExists tableName="c_plan_operation_record" columnName="equipment_code" />
</preConditions> </preConditions>
<comment>c_plan_operation_record table equipment_code MODIFY</comment> <comment>c_plan_operation_record table equipment_code MODIFY</comment>
<sql> <sql>
ALTER TABLE `c_plan_operation_record` ALTER TABLE `c_plan_operation_record`
MODIFY COLUMN `equipment_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '装备code' ; MODIFY COLUMN `equipment_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '装备code' ;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="xixinzhao" id="xxz-2022-07-07-01"> <changeSet author="xixinzhao" id="xxz-2022-07-07-01">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="c_plan_rule" columnName="plan_step"/> <columnExists tableName="c_plan_rule" columnName="plan_step"/>
</not> </not>
</preConditions> </preConditions>
<comment>c_plan_rule add column plan_step</comment> <comment>c_plan_rule add column plan_step</comment>
<sql> <sql>
alter table `c_plan_rule` add column `plan_step` json DEFAULT NULL COMMENT '预案步骤'; alter table `c_plan_rule` add column `plan_step` json DEFAULT NULL COMMENT '预案步骤';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="gaojianqiang" id="20220901-01">
<preConditions onFail="MARK_RAN">
<columnExists tableName="toip_rm_snapshot" columnName="method_param"/>
</preConditions>
<comment>修改属性字段 method_param</comment>
<sql>
ALTER TABLE `toip_rm_snapshot` MODIFY COLUMN `method_param` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '方法参数' AFTER `equipment_id`;
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -115,6 +115,15 @@ ...@@ -115,6 +115,15 @@
WHERE WHERE
cpor.batch_no = #{batchNo} cpor.batch_no = #{batchNo}
</select> </select>
<select id="getPlanRuleByBatchNo" resultType="com.yeejoin.amos.fas.dao.entity.PlanRule">
SELECT
cpr.*
FROM
c_plan_rule cpr
LEFT JOIN c_plan_operation_record cpor ON cpor.plan_id = cpr.plan_id
WHERE
cpor.batch_no = #{batchNo}
</select>
<select id="getNewestBatchNo" resultType="java.lang.String"> <select id="getNewestBatchNo" resultType="java.lang.String">
select batch_no as batchNo from c_plan_operation_record where status = 0 and is_delete = 0 order by create_date desc limit 1 select batch_no as batchNo from c_plan_operation_record where status = 0 and is_delete = 0 order by create_date desc limit 1
......
[
{
"stepCode": "0",
"stepName": "确认灾情",
"stepStatus": "0",
"buttonCode": "FIRE_CONFIRM"
},
{
"stepCode": "1",
"stepName": "停运换流阀",
"stepStatus": "0",
"buttonCode": "STOP_COMMUTATION"
},
{
"stepCode": "2",
"stepName": "拨打报警电话",
"stepStatus": "0",
"buttonCode": "CALL_PHONE"
},
{
"stepCode": "3",
"stepName": "确认油枕排油系统已开启",
"stepStatus": "0",
"buttonCode": "DRAIN_OIL_CONFIRM"
},
{
"stepCode": "4",
"stepName": "确认水喷雾系统已开启",
"stepStatus": "0",
"buttonCode": "OPEN_WATERSYSTEM"
},
{
"stepCode": "5",
"stepName": "断开上级电源",
"stepStatus": "0",
"buttonCode": "OFF_POWER"
},
{
"stepCode": "6",
"stepName": "停运阀厅空调系统",
"stepStatus": "0",
"buttonCode": "STOP_AIRCON"
},
{
"stepCode": "7",
"stepName": "一键开启消防炮",
"stepStatus": "0",
"buttonCode": "MONITOR_START"
},
{
"stepCode": "8",
"stepName": "驻站消防队指挥权交接",
"stepStatus": "0",
"buttonCode": "HANDOVER_COMMAND"
},
{
"stepCode": "9",
"stepName": "确认本体排油已开启",
"stepStatus": "0",
"buttonCode": "OWNER_DRAIN_OIL"
},
{
"stepCode": "10",
"stepName": "启动阀厅应急预案",
"stepStatus": "0",
"buttonCode": "START_VALVE_HALL_CONTINGENCY"
},
{
"stepCode": "11",
"stepName": "电缆沟封堵",
"stepStatus": "0",
"buttonCode": "PLUG_CABLETRENCH"
},
{
"stepCode": "12",
"stepName": "政府消防队指挥权交接",
"stepStatus": "0",
"buttonCode": "HANDOVER_FIGTHHING"
},
{
"stepCode": "13",
"stepName": "确认明火扑灭",
"stepStatus": "0",
"buttonCode": "FIRE_EXTINCT"
},
{
"stepCode": "14",
"stepName": "应急处置结束",
"stepStatus": "0",
"buttonCode": "END_EMERGENCY"
}
]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment