Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
station
YeeAmosFireAutoSysRoot
Commits
0a8405c4
Commit
0a8405c4
authored
May 28, 2020
by
吴江
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
规则修改适配
parent
6e7ae3b0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
461 additions
and
452 deletions
+461
-452
ContingencyAction.java
...m/yeejoin/amos/fas/business/action/ContingencyAction.java
+437
-437
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+5
-0
IContingencyInstance.java
...amos/fas/business/service/intfc/IContingencyInstance.java
+19
-15
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/ContingencyAction.java
View file @
0a8405c4
//
package com.yeejoin.amos.fas.business.action;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
action
;
//
//
//
import java.io.IOException;
import
java.io.IOException
;
//
import java.lang.reflect.Constructor;
import
java.lang.reflect.Constructor
;
//
import java.lang.reflect.Field;
import
java.lang.reflect.Field
;
//
import java.lang.reflect.Method;
import
java.lang.reflect.Method
;
//
import java.text.SimpleDateFormat;
import
java.text.SimpleDateFormat
;
//
import java.util.Date;
import
java.util.Date
;
//
import java.util.HashMap;
import
java.util.HashMap
;
//
import java.util.List;
import
java.util.List
;
//
import java.util.Map;
import
java.util.Map
;
//
//
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Autowired
;
//
import org.springframework.stereotype.Component;
import
org.springframework.stereotype.Component
;
//
import org.springframework.util.CollectionUtils;
import
org.springframework.util.CollectionUtils
;
//
//
import com.fasterxml.jackson.databind.ObjectMapper;
import
com.fasterxml.jackson.databind.ObjectMapper
;
//
import com.yeejoin.amos.fas.business.action.result.ActionResult;
import
com.yeejoin.amos.fas.business.action.result.ActionResult
;
//
import com.yeejoin.amos.fas.business.action.result.BubbleTipResult;
import
com.yeejoin.amos.fas.business.action.result.BubbleTipResult
;
//
import com.yeejoin.amos.fas.business.action.result.message.ActionResultMessage;
import
com.yeejoin.amos.fas.business.action.result.message.ActionResultMessage
;
//
import com.yeejoin.amos.fas.business.service.impl.RuleRunigSnapshotServiceImpl;
import
com.yeejoin.amos.fas.business.service.impl.RuleRunigSnapshotServiceImpl
;
//
import com.yeejoin.amos.fas.business.service.intfc.FireStengthService;
import
com.yeejoin.amos.fas.business.service.intfc.FireStengthService
;
//
import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
import
com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance
;
//
import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
import
com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService
;
//
import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
import
com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus
;
//
import com.yeejoin.amos.fas.business.service.model.ContingencyRo;
import
com.yeejoin.amos.fas.business.service.model.ContingencyRo
;
//
import com.yeejoin.amos.fas.business.util.StringUtil;
import
com.yeejoin.amos.fas.business.util.StringUtil
;
//
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import
com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance
;
//
import com.yeejoin.amos.fas.dao.entity.FireStrength;
import
com.yeejoin.amos.fas.dao.entity.FireStrength
;
//
//
@Component
@Component
//
public class ContingencyAction implements CustomerAction {
public
class
ContingencyAction
implements
CustomerAction
{
//
//
//
private static String PACKAGEURL = "com.yeejoin.amos.fas.business.action.result.message.";
private
static
String
PACKAGEURL
=
"com.yeejoin.amos.fas.business.action.result.message."
;
//
//
@Autowired
@Autowired
//
private IContingencyInstance iContingencyInstance;
private
IContingencyInstance
iContingencyInstance
;
//
//
@Autowired
@Autowired
//
private FireStengthService fireStrengthService;
private
FireStengthService
fireStrengthService
;
//
//
// private RestTemplate restTemplate = new RestTemplate();
// private RestTemplate restTemplate = new RestTemplate();
//
//
// @Value("${bussunis.domain}")
// @Value("${bussunis.domain}")
//
// private String bussunisDomain ;
// private String bussunisDomain ;
//
//
@Autowired
@Autowired
//
private IRiskSourceService riskSourceService;
private
IRiskSourceService
riskSourceService
;
//
//
private static Map<String, String> OPERATE_RECORD_ID = new HashMap<>();
private
static
Map
<
String
,
String
>
OPERATE_RECORD_ID
=
new
HashMap
<>();
//
//
private static Map<String, Map<String,String>> stringStringMap = new HashMap<>();
private
static
Map
<
String
,
Map
<
String
,
String
>>
stringStringMap
=
new
HashMap
<>();
//
static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
static
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
//
//
//当值值班长(S1)、副值班长(S2)、值班员(A1,A2,A3)、白班值班员、保安人员、驻站消防队长(F1)
//当值值班长(S1)、副值班长(S2)、值班员(A1,A2,A3)、白班值班员、保安人员、驻站消防队长(F1)
//
/* private static Map<String, String> positionMap = new HashMap<String, String>() {{
/* private static Map<String, String> positionMap = new HashMap<String, String>() {{
//
put("S1", "S1");
put("S1", "S1");
//
put("S2", "S2");
put("S2", "S2");
//
put("A1", "A1");
put("A1", "A1");
//
put("A2", "A2");
put("A2", "A2");
//
put("A3", "A3");
put("A3", "A3");
//
put("F1", "F1");
put("F1", "F1");
//
}};
}};
//
*/
*/
//
//
private Map<String, String> getStrengthMap(String batchNo) {
private
Map
<
String
,
String
>
getStrengthMap
(
String
batchNo
)
{
//
//
Map<String,String> returnMap = stringStringMap.get(batchNo);
Map
<
String
,
String
>
returnMap
=
stringStringMap
.
get
(
batchNo
);
//
if (CollectionUtils.isEmpty(returnMap)) {
if
(
CollectionUtils
.
isEmpty
(
returnMap
))
{
//
stringStringMap = new HashMap<>();
stringStringMap
=
new
HashMap
<>();
//
returnMap = new HashMap<>();
returnMap
=
new
HashMap
<>();
//
//
//
//
Date now = new Date();
Date
now
=
new
Date
();
//
String time = sdf.format(now);
String
time
=
sdf
.
format
(
now
);
//
//
//
List<FireStrength> strengths = fireStrengthService.queryForStrengthList(time);
List
<
FireStrength
>
strengths
=
fireStrengthService
.
queryForStrengthList
(
time
);
//
// List<FireStrength> strengths = iStrengthRepository.queryForStrengthList(time);
// List<FireStrength> strengths = iStrengthRepository.queryForStrengthList(time);
//
//
if (!CollectionUtils.isEmpty(strengths))
if
(!
CollectionUtils
.
isEmpty
(
strengths
))
//
{
{
//
for (FireStrength fireStrength : strengths)
for
(
FireStrength
fireStrength
:
strengths
)
//
{
{
//
String name = returnMap.get(fireStrength.getPosition());
String
name
=
returnMap
.
get
(
fireStrength
.
getPosition
());
//
if (StringUtil.isNotEmpty(name))
if
(
StringUtil
.
isNotEmpty
(
name
))
//
{
{
//
returnMap.put(fireStrength.getPosition(), name + "、" + fireStrength.getUsername());
returnMap
.
put
(
fireStrength
.
getPosition
(),
name
+
"、"
+
fireStrength
.
getUsername
());
//
}else
}
else
//
{
{
//
returnMap.put(fireStrength.getPosition(), fireStrength.getUsername());
returnMap
.
put
(
fireStrength
.
getPosition
(),
fireStrength
.
getUsername
());
//
}
}
//
}
}
//
}
}
//
stringStringMap.put(batchNo,returnMap);
stringStringMap
.
put
(
batchNo
,
returnMap
);
//
}
}
//
return returnMap;
return
returnMap
;
//
}
}
//
//
//
public static void sendcmd(String firstStr, String secondStr, String thirdStr, BubbleTipResult result) {
public
static
void
sendcmd
(
String
firstStr
,
String
secondStr
,
String
thirdStr
,
BubbleTipResult
result
)
{
//
//
Constructor<?> constructor;
Constructor
<?>
constructor
;
//
try {
try
{
//
constructor = Class.forName(
constructor
=
Class
.
forName
(
//
PACKAGEURL + result.getClass().getSimpleName() + "Message")
PACKAGEURL
+
result
.
getClass
().
getSimpleName
()
+
"Message"
)
//
.getConstructor(ActionResult.class);
.
getConstructor
(
ActionResult
.
class
);
//
ActionResultMessage<?> action = (ActionResultMessage<?>) constructor.newInstance(result);
ActionResultMessage
<?>
action
=
(
ActionResultMessage
<?>)
constructor
.
newInstance
(
result
);
//
action.execute(firstStr, secondStr, thirdStr);
action
.
execute
(
firstStr
,
secondStr
,
thirdStr
);
//
} catch (Exception e) {
}
catch
(
Exception
e
)
{
//
e.printStackTrace();
e
.
printStackTrace
();
//
}
}
//
}
}
//
//
//
/**
/**
//
* @param stepCode 当前步骤编号
* @param stepCode 当前步骤编号
//
* @param stepName 当前步骤名称
* @param stepName 当前步骤名称
//
* @param state 当前步骤状态
* @param state 当前步骤状态
//
* @param nextStepCode 下一步编号
* @param nextStepCode 下一步编号
//
* @param nextStepName 下一步名称
* @param nextStepName 下一步名称
//
* @param stepType 步骤类型,总览步骤、详细步骤
* @param stepType 步骤类型,总览步骤、详细步骤
//
* @param paramObj 预案对象
* @param paramObj 预案对象
//
*/
*/
//
public void stepInfo(String stepCode, String stepName, String state, String nextStepCode, String nextStepName, String stepType, Object paramObj) {
public
void
stepInfo
(
String
stepCode
,
String
stepName
,
String
state
,
String
nextStepCode
,
String
nextStepName
,
String
stepType
,
Object
paramObj
)
{
//
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
//
stopSnapshop(contingencyRo);
stopSnapshop
(
contingencyRo
);
//
//
//
BubbleTipResult result = new BubbleTipResult();
BubbleTipResult
result
=
new
BubbleTipResult
();
//
Map<String, Object> tempmap1 = new HashMap<>();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
//
//
tempmap1.put("stepCode", stepCode);
tempmap1
.
put
(
"stepCode"
,
stepCode
);
//
tempmap1.put("stepName", stepName);
tempmap1
.
put
(
"stepName"
,
stepName
);
//
tempmap1.put("state", state);
tempmap1
.
put
(
"state"
,
state
);
//
tempmap1.put("nextStepCode", nextStepCode);
tempmap1
.
put
(
"nextStepCode"
,
nextStepCode
);
//
tempmap1.put("nextStepName", nextStepName);
tempmap1
.
put
(
"nextStepName"
,
nextStepName
);
//
tempmap1.put("batchNo", contingencyRo.getBatchNo());
tempmap1
.
put
(
"batchNo"
,
contingencyRo
.
getBatchNo
());
//
tempmap1.put("contingencyRo", contingencyRo);
tempmap1
.
put
(
"contingencyRo"
,
contingencyRo
);
//
result.add(tempmap1);
result
.
add
(
tempmap1
);
//
//
this.sendcmd("fromws", "stepArea", stepType, result);
this
.
sendcmd
(
"fromws"
,
"stepArea"
,
stepType
,
result
);
//
}
}
//
//
/**
/**
//
* @param stepCode 当前步骤编号
* @param stepCode 当前步骤编号
//
* @param paramObj 预案对象
* @param paramObj 预案对象
//
*/
*/
//
public void saveStepInfo(String stepCode, Object paramObj) {
public
void
saveStepInfo
(
String
stepCode
,
Object
paramObj
)
{
//
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
//
iContingencyInstance.updateStep(stepCode, contingencyRo.getBatchNo());
iContingencyInstance
.
updateStep
(
stepCode
,
contingencyRo
.
getBatchNo
());
//
}
}
//
//
//
/**
/**
//
* @param content 消息内容
* @param content 消息内容
//
* @param paramObj 预案对象
* @param paramObj 预案对象
//
*/
*/
//
public void messageRecord(String content, Object paramObj) {
public
void
messageRecord
(
String
content
,
Object
paramObj
)
{
//
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
//
stopSnapshop(contingencyRo);
stopSnapshop
(
contingencyRo
);
//
//转换content中的变量
//转换content中的变量
//
content = instedParams(content,contingencyRo);
content
=
instedParams
(
content
,
contingencyRo
);
//
//
BubbleTipResult result = new BubbleTipResult();
BubbleTipResult
result
=
new
BubbleTipResult
();
//
Map<String, Object> tempmap1 = new HashMap<>();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
//
//
tempmap1.put("refresh", "refresh");
tempmap1
.
put
(
"refresh"
,
"refresh"
);
//
tempmap1.put("batchNo", contingencyRo.getBatchNo());
tempmap1
.
put
(
"batchNo"
,
contingencyRo
.
getBatchNo
());
//
result.add(tempmap1);
result
.
add
(
tempmap1
);
//
iContingencyInstance.createInstanceRecord(contingencyRo.getBatchNo(), "", "DEFAULT", content, "MESSAGE", "");
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
""
,
"DEFAULT"
,
content
,
"MESSAGE"
,
""
);
//
this.sendcmd("fromws", "recordArea", "refresh", result);
this
.
sendcmd
(
"fromws"
,
"recordArea"
,
"refresh"
,
result
);
//
}
}
//
//
/**
/**
//
* <pre>
* <pre>
//
* 智能辅助
* 智能辅助
//
* </pre>
* </pre>
//
*
*
//
* @param step 当前步骤
* @param step 当前步骤
//
* @param icon 图标
* @param icon 图标
//
* @param title 标题
* @param title 标题
//
* @param image 图片集合
* @param image 图片集合
//
* @param table 表格
* @param table 表格
//
* @param content 内容
* @param content 内容
//
* @param paramObj 预案对象
* @param paramObj 预案对象
//
*/
*/
//
public void help(String step, String icon, String title, String image, String table, String content, Object paramObj) {
public
void
help
(
String
step
,
String
icon
,
String
title
,
String
image
,
String
table
,
String
content
,
Object
paramObj
)
{
//
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
//
stopSnapshop(contingencyRo);
stopSnapshop
(
contingencyRo
);
//
//
//
//转换智能辅助中的变量
//转换智能辅助中的变量
//
content = instedParams(content,contingencyRo);
content
=
instedParams
(
content
,
contingencyRo
);
//
//
BubbleTipResult result = new BubbleTipResult();
BubbleTipResult
result
=
new
BubbleTipResult
();
//
Map<String, Object> tempmap1 = new HashMap<>();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
//
//
tempmap1.put("icon", icon);
tempmap1
.
put
(
"icon"
,
icon
);
//
tempmap1.put("step", step);
tempmap1
.
put
(
"step"
,
step
);
//
tempmap1.put("title", title);
tempmap1
.
put
(
"title"
,
title
);
//
tempmap1.put("content", content);
tempmap1
.
put
(
"content"
,
content
);
//
tempmap1.put("image", image);
tempmap1
.
put
(
"image"
,
image
);
//
tempmap1.put("table", table);
tempmap1
.
put
(
"table"
,
table
);
//
tempmap1.put("batchNo", contingencyRo.getBatchNo());
tempmap1
.
put
(
"batchNo"
,
contingencyRo
.
getBatchNo
());
//
tempmap1.put("contingencyRo", contingencyRo);
tempmap1
.
put
(
"contingencyRo"
,
contingencyRo
);
//
result.add(tempmap1);
result
.
add
(
tempmap1
);
//
//
this.sendcmd("fromws", "helpArea", "", result);
this
.
sendcmd
(
"fromws"
,
"helpArea"
,
""
,
result
);
//
}
}
//
//
//
private String instedParams(String content, ContingencyRo contingencyRo) {
private
String
instedParams
(
String
content
,
ContingencyRo
contingencyRo
)
{
//
//
Map<String, String> strengthMap = this.getStrengthMap(contingencyRo.getBatchNo());
Map
<
String
,
String
>
strengthMap
=
this
.
getStrengthMap
(
contingencyRo
.
getBatchNo
());
//
for (String key : strengthMap.keySet())
for
(
String
key
:
strengthMap
.
keySet
())
//
content = content.replaceAll("\\$\\{" + key + "}", strengthMap.get(key));
content
=
content
.
replaceAll
(
"\\$\\{"
+
key
+
"}"
,
strengthMap
.
get
(
key
));
//
//
//
/* for (String key : positionMap.keySet())
/* for (String key : positionMap.keySet())
//
c ontent = content.replaceAll("\\$\\{" + key + "}", positionMap.get(key));
c ontent = content.replaceAll("\\$\\{" + key + "}", positionMap.get(key));
//
*/
*/
//
//
Field[] fields = contingencyRo.getClass().getDeclaredFields();
Field
[]
fields
=
contingencyRo
.
getClass
().
getDeclaredFields
();
//
Method getMethod = null;
Method
getMethod
=
null
;
//
try {
try
{
//
for (Field field : fields) {
for
(
Field
field
:
fields
)
{
//
if(field.getName().equals("serialVersionUID"))
if
(
field
.
getName
().
equals
(
"serialVersionUID"
))
//
continue;
continue
;
//
String fileNameInMethod = String.valueOf(field.getName().charAt(0)).toUpperCase() + field.getName().substring(1);
String
fileNameInMethod
=
String
.
valueOf
(
field
.
getName
().
charAt
(
0
)).
toUpperCase
()
+
field
.
getName
().
substring
(
1
);
//
getMethod = contingencyRo.getClass().getMethod("get" + fileNameInMethod);
getMethod
=
contingencyRo
.
getClass
().
getMethod
(
"get"
+
fileNameInMethod
);
//
String value = String.valueOf(getMethod.invoke(contingencyRo));
String
value
=
String
.
valueOf
(
getMethod
.
invoke
(
contingencyRo
));
//
content = content.replaceAll("\\$\\{" + field.getName() + "}", value);
content
=
content
.
replaceAll
(
"\\$\\{"
+
field
.
getName
()
+
"}"
,
value
);
//
}
}
//
//
content = content.replaceAll("\\$\\{", "");
content
=
content
.
replaceAll
(
"\\$\\{"
,
""
);
//
content = content.replaceAll("}", "");
content
=
content
.
replaceAll
(
"}"
,
""
);
//
} catch (Exception e) {
}
catch
(
Exception
e
)
{
//
e.printStackTrace();
e
.
printStackTrace
();
//
}
}
//
return content;
return
content
;
//
}
}
//
//
//
/**
/**
//
* 交互动作
* 交互动作
//
*
*
//
* @param actionName 动作名称
* @param actionName 动作名称
//
* @param icon 图标
* @param icon 图标
//
* @param tips 提示信息
* @param tips 提示信息
//
* @param buttonJson 按钮json字符串
* @param buttonJson 按钮json字符串
//
* @param paramObj 预案对象
* @param paramObj 预案对象
//
*/
*/
//
public void operation(String actionName, String icon, String tips, String buttonJson, Object paramObj) {
public
void
operation
(
String
actionName
,
String
icon
,
String
tips
,
String
buttonJson
,
Object
paramObj
)
{
//
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
//
stopSnapshop(contingencyRo);
stopSnapshop
(
contingencyRo
);
//
//
//转换content中的变量
//转换content中的变量
//
tips = instedParams(tips,contingencyRo);
tips
=
instedParams
(
tips
,
contingencyRo
);
//
//
//
BubbleTipResult result = new BubbleTipResult();
BubbleTipResult
result
=
new
BubbleTipResult
();
//
Map<String, Object> tempmap1 = new HashMap<>();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
//
//
//
String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson);
String
contingencyPlanId
=
getContingencyPlanId
(
contingencyRo
.
getBatchNo
(),
actionName
,
icon
,
tips
,
buttonJson
);
//
//
//
tempmap1.put("actionName", actionName);
tempmap1
.
put
(
"actionName"
,
actionName
);
//
tempmap1.put("icon", icon);
tempmap1
.
put
(
"icon"
,
icon
);
//
tempmap1.put("tips", tips);
tempmap1
.
put
(
"tips"
,
tips
);
//
tempmap1.put("buttonJson", buttonJson);
tempmap1
.
put
(
"buttonJson"
,
buttonJson
);
//
tempmap1.put("batchNo", contingencyRo.getBatchNo());
tempmap1
.
put
(
"batchNo"
,
contingencyRo
.
getBatchNo
());
//
tempmap1.put("contingencyRo", contingencyRo);
tempmap1
.
put
(
"contingencyRo"
,
contingencyRo
);
//
tempmap1.put("contingencyPlanId", contingencyPlanId);
tempmap1
.
put
(
"contingencyPlanId"
,
contingencyPlanId
);
//
result.add(tempmap1);
result
.
add
(
tempmap1
);
//
//
//
this.sendcmd("fromws", "optionArea", "", result);
this
.
sendcmd
(
"fromws"
,
"optionArea"
,
""
,
result
);
//
//
//
sendButton(contingencyRo.getBatchNo(),contingencyPlanId,contingencyRo.getEquipmentId(),actionName,buttonJson);
sendButton
(
contingencyRo
.
getBatchNo
(),
contingencyPlanId
,
contingencyRo
.
getEquipmentId
(),
actionName
,
buttonJson
);
//
//
}
}
//
//
//
private boolean sendButton(String batchNo,String contingencyPlanId,String equipmentId,String actionName,String buttonJson) {
private
boolean
sendButton
(
String
batchNo
,
String
contingencyPlanId
,
String
equipmentId
,
String
actionName
,
String
buttonJson
)
{
//
//
// String url = bussunisDomain+ "/api/risksource/contingency/setup";
// String url = bussunisDomain+ "/api/risksource/contingency/setup";
//
//
ObjectMapper objectMapper = new ObjectMapper();
ObjectMapper
objectMapper
=
new
ObjectMapper
();
//
//Map<String,Object> map = new HashMap<>();
//Map<String,Object> map = new HashMap<>();
//
//
/**
/**
//
* batchNo
* batchNo
//
* stepCode
* stepCode
//
* buttonCode
* buttonCode
//
* confirm
* confirm
//
* contingencyPlanId
* contingencyPlanId
//
* stepState
* stepState
//
*/
*/
//
//
try {
try
{
//
Map button = objectMapper.readValue(buttonJson,Map.class);
Map
button
=
objectMapper
.
readValue
(
buttonJson
,
Map
.
class
);
//
Map operateInstance = (Map)((List)button.get("operate")).get(0);
Map
operateInstance
=
(
Map
)((
List
)
button
.
get
(
"operate"
)).
get
(
0
);
//
//
map.put("batchNo",batchNo);
// map.put("batchNo",batchNo);
//
//
map.put("actionName",actionName);
// map.put("actionName",actionName);
//
//
map.put("equipmentId",equipmentId);
// map.put("equipmentId",equipmentId);
//
//
map.put("stepCode",button.get("stepCode"));
// map.put("stepCode",button.get("stepCode"));
//
//
map.put("buttonCode",operateInstance.get("code"));
// map.put("buttonCode",operateInstance.get("code"));
//
//
map.put("confirm","CONFIRM");
// map.put("confirm","CONFIRM");
//
//
map.put("stepState",operateInstance.get("stepState"));
// map.put("stepState",operateInstance.get("stepState"));
//
//
map.put("contingencyPlanId",contingencyPlanId);
// map.put("contingencyPlanId",contingencyPlanId);
//
ContingencyDeviceStatus contingencyDeviceStatus = new ContingencyDeviceStatus();
ContingencyDeviceStatus
contingencyDeviceStatus
=
new
ContingencyDeviceStatus
();
//
contingencyDeviceStatus.setActionName(actionName);
contingencyDeviceStatus
.
setActionName
(
actionName
);
//
contingencyDeviceStatus.setButtonCode(String.valueOf(operateInstance.get("code")));
contingencyDeviceStatus
.
setButtonCode
(
String
.
valueOf
(
operateInstance
.
get
(
"code"
)));
//
contingencyDeviceStatus.setConfirm("CONFIRM");
contingencyDeviceStatus
.
setConfirm
(
"CONFIRM"
);
//
contingencyDeviceStatus.setContingencyPlanId(contingencyPlanId);
contingencyDeviceStatus
.
setContingencyPlanId
(
contingencyPlanId
);
//
contingencyDeviceStatus.setEquipmentId(equipmentId);
contingencyDeviceStatus
.
setEquipmentId
(
equipmentId
);
//
contingencyDeviceStatus.setStepCode(String.valueOf(button.get("stepCode")));
contingencyDeviceStatus
.
setStepCode
(
String
.
valueOf
(
button
.
get
(
"stepCode"
)));
//
contingencyDeviceStatus.setStepState(String.valueOf(operateInstance.get("stepState")));
contingencyDeviceStatus
.
setStepState
(
String
.
valueOf
(
operateInstance
.
get
(
"stepState"
)));
//
riskSourceService.queryContingencyDeviceStatus(contingencyDeviceStatus);
riskSourceService
.
queryContingencyDeviceStatus
(
contingencyDeviceStatus
);
//
//HttpEntity<Map> entity = new HttpEntity<>(map);
//HttpEntity<Map> entity = new HttpEntity<>(map);
//
// restTemplate.exchange(url, HttpMethod.POST,entity,Map.class);
// restTemplate.exchange(url, HttpMethod.POST,entity,Map.class);
//
//
} catch (IOException e) {
}
catch
(
IOException
e
)
{
//
e.printStackTrace();
e
.
printStackTrace
();
//
}
}
//
//
return false;
return
false
;
//
}
}
//
//
//
/**
/**
//
* 保存交互动作
* 保存交互动作
//
*
*
//
* @param actionName 动作名称
* @param actionName 动作名称
//
* @param icon 图标
* @param icon 图标
//
* @param tips 提示信息
* @param tips 提示信息
//
* @param buttonJson 按钮json字符串
* @param buttonJson 按钮json字符串
//
* @param paramObj 预案对象
* @param paramObj 预案对象
//
*/
*/
//
public void saveOperation(String actionName, String icon, String tips, String buttonJson, Object paramObj) {
public
void
saveOperation
(
String
actionName
,
String
icon
,
String
tips
,
String
buttonJson
,
Object
paramObj
)
{
//
//
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
//
stopSnapshop(contingencyRo);
stopSnapshop
(
contingencyRo
);
//
//
//转换content中的变量
//转换content中的变量
//
tips = instedParams(tips,contingencyRo);
tips
=
instedParams
(
tips
,
contingencyRo
);
//
//
BubbleTipResult result1 = new BubbleTipResult();
BubbleTipResult
result1
=
new
BubbleTipResult
();
//
Map<String, Object> tempmap2 = new HashMap<>();
Map
<
String
,
Object
>
tempmap2
=
new
HashMap
<>();
//
tempmap2.put("refresh", "refresh");
tempmap2
.
put
(
"refresh"
,
"refresh"
);
//
tempmap2.put("batchNo", contingencyRo.getBatchNo());
tempmap2
.
put
(
"batchNo"
,
contingencyRo
.
getBatchNo
());
//
result1.add(tempmap2);
result1
.
add
(
tempmap2
);
//
//
String contingencyPlanId = getContingencyPlanId(contingencyRo.getBatchNo(), actionName, icon, tips, buttonJson);
String
contingencyPlanId
=
getContingencyPlanId
(
contingencyRo
.
getBatchNo
(),
actionName
,
icon
,
tips
,
buttonJson
);
//
//
this.sendcmd("fromws", "recordArea", "refresh", result1);
this
.
sendcmd
(
"fromws"
,
"recordArea"
,
"refresh"
,
result1
);
//
//
}
}
//
//
private String getContingencyPlanId(String batchNo, String actionName, String icon, String tips, String buttonJson) {
private
String
getContingencyPlanId
(
String
batchNo
,
String
actionName
,
String
icon
,
String
tips
,
String
buttonJson
)
{
//
String cacheKey = batchNo + actionName;
String
cacheKey
=
batchNo
+
actionName
;
//
String contingencyPlanId = null;
String
contingencyPlanId
=
null
;
//
ContingencyPlanInstance contingencyPlanInstance = null;
ContingencyPlanInstance
contingencyPlanInstance
=
null
;
//
if (OPERATE_RECORD_ID.get(cacheKey) == null) {
if
(
OPERATE_RECORD_ID
.
get
(
cacheKey
)
==
null
)
{
//
contingencyPlanInstance = iContingencyInstance.createInstanceRecord(batchNo, actionName, "DEFAULT", buttonJson, "OPERATE", icon);
contingencyPlanInstance
=
iContingencyInstance
.
createInstanceRecord
(
batchNo
,
actionName
,
"DEFAULT"
,
buttonJson
,
"OPERATE"
,
icon
);
//
contingencyPlanId = contingencyPlanInstance.getId();
contingencyPlanId
=
contingencyPlanInstance
.
getId
();
//
OPERATE_RECORD_ID.put(cacheKey, contingencyPlanId);
OPERATE_RECORD_ID
.
put
(
cacheKey
,
contingencyPlanId
);
//
} else {
}
else
{
//
contingencyPlanId = OPERATE_RECORD_ID.get(cacheKey);
contingencyPlanId
=
OPERATE_RECORD_ID
.
get
(
cacheKey
);
//
OPERATE_RECORD_ID.remove(cacheKey);
OPERATE_RECORD_ID
.
remove
(
cacheKey
);
//
}
}
//
return contingencyPlanId;
return
contingencyPlanId
;
//
}
}
//
//
//
/**
/**
//
* 地图动作推送
* 地图动作推送
//
*
*
//
* @param actionName 动作名称标识
* @param actionName 动作名称标识
//
* @param paramObj 预案对象
* @param paramObj 预案对象
//
*/
*/
//
public void mapAction(String actionName, Object paramObj) {
public
void
mapAction
(
String
actionName
,
Object
paramObj
)
{
//
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
//
stopSnapshop(contingencyRo);
stopSnapshop
(
contingencyRo
);
//
//
//
BubbleTipResult result = new BubbleTipResult();
BubbleTipResult
result
=
new
BubbleTipResult
();
//
Map<String, Object> tempmap1 = new HashMap<>();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
//
//
tempmap1.put("actionName", actionName);
tempmap1
.
put
(
"actionName"
,
actionName
);
//
tempmap1.put("batchNo", contingencyRo.getBatchNo());
tempmap1
.
put
(
"batchNo"
,
contingencyRo
.
getBatchNo
());
//
tempmap1.put("contingencyRo", contingencyRo);
tempmap1
.
put
(
"contingencyRo"
,
contingencyRo
);
//
result.add(tempmap1);
result
.
add
(
tempmap1
);
//
//
this.sendcmd("fromws", "mapArea", actionName, result);
this
.
sendcmd
(
"fromws"
,
"mapArea"
,
actionName
,
result
);
//
}
}
//
//
//
/**
/**
//
* 顶部消息提示
* 顶部消息提示
//
*
*
//
* @param content 消息内容
* @param content 消息内容
//
* @param messageType 消息类型 messageType 黑色框消息类型CONTINGENCY,,滚动消息:CURRENTMESSAGE
* @param messageType 消息类型 messageType 黑色框消息类型CONTINGENCY,,滚动消息:CURRENTMESSAGE
//
* @param paramObj 预案对象
* @param paramObj 预案对象
//
*/
*/
//
public void topMessage(String content, String messageType, Object paramObj) {
public
void
topMessage
(
String
content
,
String
messageType
,
Object
paramObj
)
{
//
ContingencyRo contingencyRo = (ContingencyRo) paramObj;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
//
stopSnapshop(contingencyRo);
stopSnapshop
(
contingencyRo
);
//
//
//
BubbleTipResult result = new BubbleTipResult();
BubbleTipResult
result
=
new
BubbleTipResult
();
//
Map<String, Object> tempmap1 = new HashMap<>();
Map
<
String
,
Object
>
tempmap1
=
new
HashMap
<>();
//
//转换content中的变量
//转换content中的变量
//
content = instedParams(content,contingencyRo);
content
=
instedParams
(
content
,
contingencyRo
);
//
//
tempmap1.put("content", content);
tempmap1
.
put
(
"content"
,
content
);
//
tempmap1.put("messageType", messageType);//消息类型 messageType 黑色框消息类型 CONTINGENCY,,滚动消息:CURRENTMESSAGE
tempmap1
.
put
(
"messageType"
,
messageType
);
//消息类型 messageType 黑色框消息类型 CONTINGENCY,,滚动消息:CURRENTMESSAGE
//
tempmap1.put("batchNo", contingencyRo.getBatchNo());
tempmap1
.
put
(
"batchNo"
,
contingencyRo
.
getBatchNo
());
//
tempmap1.put("contingencyRo", contingencyRo);
tempmap1
.
put
(
"contingencyRo"
,
contingencyRo
);
//
result.add(tempmap1);
result
.
add
(
tempmap1
);
//
//
this.sendcmd("fromws", "topArea", messageType, result);
this
.
sendcmd
(
"fromws"
,
"topArea"
,
messageType
,
result
);
//
}
}
//
//
//
private void stopSnapshop(ContingencyRo contingencyRo) {
private
void
stopSnapshop
(
ContingencyRo
contingencyRo
)
{
//
if (RuleRunigSnapshotServiceImpl.getReplayBatchNo() != null && !RuleRunigSnapshotServiceImpl.getReplayBatchNo().equals(contingencyRo.getBatchNo()))
if
(
RuleRunigSnapshotServiceImpl
.
getReplayBatchNo
()
!=
null
&&
!
RuleRunigSnapshotServiceImpl
.
getReplayBatchNo
().
equals
(
contingencyRo
.
getBatchNo
()))
//
RuleRunigSnapshotServiceImpl.setReplayBatchNoToNull();
RuleRunigSnapshotServiceImpl
.
setReplayBatchNoToNull
();
//
}
}
//
//
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
0a8405c4
...
@@ -7,6 +7,7 @@ import com.google.common.base.Joiner;
...
@@ -7,6 +7,7 @@ import com.google.common.base.Joiner;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Sets
;
import
com.google.common.collect.Sets
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.fas.business.bo.*
;
import
com.yeejoin.amos.fas.business.bo.*
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.dao.mapper.*
;
import
com.yeejoin.amos.fas.business.dao.mapper.*
;
...
@@ -40,6 +41,8 @@ import com.yeejoin.amos.fas.dao.entity.*;
...
@@ -40,6 +41,8 @@ import com.yeejoin.amos.fas.dao.entity.*;
import
com.yeejoin.amos.fas.exception.YeeException
;
import
com.yeejoin.amos.fas.exception.YeeException
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -148,6 +151,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -148,6 +151,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired
@Autowired
private
RedisTemplate
redisTemplate
;
private
RedisTemplate
redisTemplate
;
private
RuleTrigger
ruleTrigger
;
@Autowired
@Autowired
private
FmeaEquipmentPointMapper
fmeaEquipmentPointMapper
;
private
FmeaEquipmentPointMapper
fmeaEquipmentPointMapper
;
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IContingencyInstance.java
View file @
0a8405c4
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
intfc
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
intfc
;
import
java.util.List
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance
;
public
interface
IContingencyInstance
{
public
interface
IContingencyInstance
{
//
//
ContingencyPlanInstance createInstanceRecord(String instanceNo, String category, String subCategory, String content, String recordType, String icon);
ContingencyPlanInstance
createInstanceRecord
(
String
instanceNo
,
String
category
,
String
subCategory
,
String
content
,
String
recordType
,
String
icon
);
//
//
//
//
List<ContingencyPlanInstance> queryForTimeLine(String instanceNo,String recordType) throws Exception;
List
<
ContingencyPlanInstance
>
queryForTimeLine
(
String
instanceNo
,
String
recordType
)
throws
Exception
;
//
//
//
void setButtonExecuted(String batchNo,String contingencyPlanId,String code,String buttonState) throws Exception;
void
setButtonExecuted
(
String
batchNo
,
String
contingencyPlanId
,
String
code
,
String
buttonState
)
throws
Exception
;
//
void setButtonWait(String batchNo,String contingencyPlanId,String buttonState) throws Exception;
void
setButtonWait
(
String
batchNo
,
String
contingencyPlanId
,
String
buttonState
)
throws
Exception
;
//
//
//
void fire(String batchNo,String stepCode, String contingencyPlanId, String buttonCode,String buttonState,String stepStateOnbutton) throws Exception;
void
fire
(
String
batchNo
,
String
stepCode
,
String
contingencyPlanId
,
String
buttonCode
,
String
buttonState
,
String
stepStateOnbutton
)
throws
Exception
;
//
//
void updateStep(String step, String batchNo);
void
updateStep
(
String
step
,
String
batchNo
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment