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();
CommonResponse commonResponse = dutyModeServer.dutyListByDate(toke.getAppKey(), toke.getProduct(), toke.getToke(), orgCode, param.toJSONString());
// String result = HttpUtil.appendPostJson("duty/dutyListByDate", param.toJSONString());
// JSONObject jsonObject = JSONObject.parseObject(result);
// JSONArray dataList = JSONObject.parseObject(commonResponse.getDataList().toString());
String JSONStr = JSON.toJSONString(commonResponse.getDataList());
JSONArray dataList = JSONObject.parseArray(JSONStr); JSONArray dataList = JSONObject.parseArray(JSONStr);
log.info(String.format("请求值班系统返回dataList:%s", dataList));
if (!ObjectUtils.isEmpty(dataList)) { if (!ObjectUtils.isEmpty(dataList)) {
Map<String, String> finalReturnMap = returnMap; Map<String, String> finalReturnMap = returnMap;
dataList.forEach( dataList.forEach(x -> {
x -> { Map<String, Object> resultMap = new HashMap<>();
JSONObject obj = (JSONObject) x; JSONObject obj = (JSONObject) x;
String name = obj.getString("position"); finalReturnMap.put(obj.getString("postTypeName"), obj.getString("userName"));
finalReturnMap.put(name, obj.getString("dutyName")); });
} }
);
} }
stringStringMap.put(batchNo, returnMap); stringStringMap.put(batchNo, returnMap);
} }
...@@ -216,12 +213,10 @@ public class ContingencyAction implements CustomerAction { ...@@ -216,12 +213,10 @@ 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;
String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
...@@ -244,48 +239,18 @@ public class ContingencyAction implements CustomerAction { ...@@ -244,48 +239,18 @@ public class ContingencyAction implements CustomerAction {
log.info("步骤更新(new)" + JSONObject.toJSONString(result)); log.info("步骤更新(new)" + JSONObject.toJSONString(result));
this.sendcmd("steparea", contingencyRo, result); this.sendcmd("steparea", contingencyRo, result);
} }
}
/** /**
* @param stepCode 当前步骤编号 * @param stepCode 当前步骤编号
* @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,8 +326,11 @@ public class ContingencyAction implements CustomerAction { ...@@ -365,8 +326,11 @@ 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;
String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
iContingencyInstance.updateStep(stepCode, contingencyRo.getBatchNo()); iContingencyInstance.updateStep(stepCode, contingencyRo.getBatchNo());
} }
}
/** /**
...@@ -376,6 +340,8 @@ public class ContingencyAction implements CustomerAction { ...@@ -376,6 +340,8 @@ 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;
String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
//转换content中的变量 //转换content中的变量
content = instedParams(content, contingencyRo); content = instedParams(content, contingencyRo);
...@@ -406,6 +372,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -406,6 +372,7 @@ public class ContingencyAction implements CustomerAction {
this.sendcmd("recordarea", paramObj, result); this.sendcmd("recordarea", paramObj, result);
this.sendweb("recordarea", paramObj, result); this.sendweb("recordarea", paramObj, result);
} }
}
/** /**
* <pre> * <pre>
...@@ -421,14 +388,10 @@ public class ContingencyAction implements CustomerAction { ...@@ -421,14 +388,10 @@ 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;
String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
//转换智能辅助中的变量 //转换智能辅助中的变量
...@@ -443,13 +406,12 @@ public class ContingencyAction implements CustomerAction { ...@@ -443,13 +406,12 @@ public class ContingencyAction implements CustomerAction {
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());
// tempmap1.put("contingencyRo", contingencyRo);
result.add(tempmap1); result.add(tempmap1);
this.sendcmd("helparea", paramObj, result); this.sendcmd("helparea", paramObj, result);
} }
}
private String instedParams(String content, ContingencyRo contingencyRo) { private String instedParams(String content, ContingencyRo contingencyRo) {
...@@ -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,22 +461,18 @@ public class ContingencyAction implements CustomerAction { ...@@ -502,22 +461,18 @@ 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;
String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
//转换content中的变量 //转换content中的变量
tips = instedParams(tips, contingencyRo); tips = instedParams(tips, contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson); String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson);
tempmap1.put("actionName", actionName); tempmap1.put("actionName", actionName);
...@@ -529,22 +484,11 @@ public class ContingencyAction implements CustomerAction { ...@@ -529,22 +484,11 @@ public class ContingencyAction implements CustomerAction {
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,13 +518,10 @@ public class ContingencyAction implements CustomerAction { ...@@ -576,13 +518,10 @@ 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;
String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
//转换content中的变量 //转换content中的变量
...@@ -595,7 +534,6 @@ public class ContingencyAction implements CustomerAction { ...@@ -595,7 +534,6 @@ public class ContingencyAction implements CustomerAction {
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);
...@@ -607,9 +545,9 @@ public class ContingencyAction implements CustomerAction { ...@@ -607,9 +545,9 @@ public class ContingencyAction implements CustomerAction {
e.printStackTrace(); e.printStackTrace();
} }
result.add(tempmap1); result.add(tempmap1);
System.out.println("--------------------saveOperation----------------------" + result);
this.sendcmd("recordarea", paramObj, 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) {
String cacheKey = batchNo + actionName; String cacheKey = batchNo + actionName;
...@@ -636,8 +574,8 @@ public class ContingencyAction implements CustomerAction { ...@@ -636,8 +574,8 @@ 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();
...@@ -653,16 +591,13 @@ public class ContingencyAction implements CustomerAction { ...@@ -653,16 +591,13 @@ public class ContingencyAction implements CustomerAction {
result.add(tempmap1); result.add(tempmap1);
this.sendcmd("maparea", paramObj, result); 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);
...@@ -675,6 +610,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -675,6 +610,7 @@ public class ContingencyAction implements CustomerAction {
result.add(tempmap1); result.add(tempmap1);
this.sendcmd("maparea", paramObj, result); this.sendcmd("maparea", paramObj, result);
} }
}
/** /**
* 顶部消息提示 * 顶部消息提示
...@@ -684,13 +620,10 @@ public class ContingencyAction implements CustomerAction { ...@@ -684,13 +620,10 @@ 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;
String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
stopSnapshop(contingencyRo); stopSnapshop(contingencyRo);
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
...@@ -706,6 +639,7 @@ public class ContingencyAction implements CustomerAction { ...@@ -706,6 +639,7 @@ public class ContingencyAction implements CustomerAction {
this.sendcmd("message", paramObj, result); this.sendcmd("message", paramObj, result);
} }
}
/** /**
* 启动预案 * 启动预案
...@@ -817,13 +751,10 @@ public class ContingencyAction implements CustomerAction { ...@@ -817,13 +751,10 @@ 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;
String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
ContingencyPlanInstance contingencyPlanInstance = iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), actionName, "DEFAULT", "", "OPERATE", ""); ContingencyPlanInstance contingencyPlanInstance = iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), actionName, "DEFAULT", "", "OPERATE", "");
Toke toke = remoteSecurityService.getServerToken(); Toke toke = remoteSecurityService.getServerToken();
...@@ -836,12 +767,13 @@ public class ContingencyAction implements CustomerAction { ...@@ -836,12 +767,13 @@ public class ContingencyAction implements CustomerAction {
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<>();
...@@ -860,12 +792,10 @@ public class ContingencyAction implements CustomerAction { ...@@ -860,12 +792,10 @@ public class ContingencyAction implements CustomerAction {
result.add(tempmap1); result.add(tempmap1);
this.sendcmd("message", ro, result); 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,31 +820,25 @@ public class ContingencyAction implements CustomerAction { ...@@ -890,31 +820,25 @@ 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) {
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
String batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
Map<String, Object> equipemtnPoints = pointCache.get(contingencyRo.getEquipmentId()); Map<String, Object> equipemtnPoints = pointCache.get(contingencyRo.getEquipmentId());
tempmap1.put("type", "buttonCache"); tempmap1.put("type", "buttonCache");
tempmap1.put("content", ObjectUtils.isEmpty(equipemtnPoints) ? new ArrayList<>() : equipemtnPoints.values()); tempmap1.put("content", ObjectUtils.isEmpty(equipemtnPoints) ? new ArrayList<>() : equipemtnPoints.values());
result.add(tempmap1); result.add(tempmap1);
this.sendcmd("message", paramObj, result); 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 batchNo = contingencyRo.getBatchNo();
if (!findByBatchNoAndStatus(batchNo)) {
String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson); String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson);
try { try {
contingencyInstance.fire(contingencyRo.getBatchNo(), stepCode, contingencyPlanId, buttonCode, confirm, stepState, RequestContext.getToken(), RequestContext.getProduct()); contingencyInstance.fire(contingencyRo.getBatchNo(), stepCode, contingencyPlanId, buttonCode, confirm, stepState, RequestContext.getToken(), RequestContext.getProduct());
...@@ -922,13 +846,12 @@ public class ContingencyAction implements CustomerAction { ...@@ -922,13 +846,12 @@ public class ContingencyAction implements CustomerAction {
e.printStackTrace(); 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;
...@@ -151,17 +153,21 @@ public class PlanVisual3dController extends BaseController { ...@@ -151,17 +153,21 @@ public class PlanVisual3dController extends BaseController {
@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
AmosRequestContext amosRequestContext;
@Value("${security.password}") @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,8 +91,8 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -88,8 +91,8 @@ 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;
...@@ -119,7 +122,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -119,7 +122,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
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();
...@@ -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,13 +217,13 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -215,13 +217,13 @@ 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;
...@@ -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;
}
...@@ -85,10 +85,10 @@ public class PermissionAspect { ...@@ -85,10 +85,10 @@ public class PermissionAspect {
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);
DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
regionParam.setCompany(companyBo); regionParam.setCompany(companyBo);
if(deptList.size() > 0){
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();
......
...@@ -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=换流站消防专项预案
......
...@@ -737,4 +737,13 @@ ...@@ -737,4 +737,13 @@
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