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
66bc74c0
Commit
66bc74c0
authored
Nov 06, 2020
by
maoying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改系统账号登陆信息存储
parent
028f276b
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
584 additions
and
672 deletions
+584
-672
ContingencyAction.java
...m/yeejoin/amos/fas/business/action/ContingencyAction.java
+48
-92
ContingencyRo.java
...yeejoin/amos/fas/business/action/model/ContingencyRo.java
+5
-1
View3dController.java
...eejoin/amos/fas/business/controller/View3dController.java
+0
-6
PushFeignServer.java
.../com/yeejoin/amos/fas/business/feign/PushFeignServer.java
+51
-51
RemoteRuleServer.java
...com/yeejoin/amos/fas/business/feign/RemoteRuleServer.java
+150
-150
RemoteSecurityService.java
...eejoin/amos/fas/business/feign/RemoteSecurityService.java
+45
-20
AppMessagePushService.java
...eejoin/amos/fas/business/jpush/AppMessagePushService.java
+3
-51
ContingencyInstanceImpl.java
...os/fas/business/service/impl/ContingencyInstanceImpl.java
+0
-4
DataRefreshServiceImpl.java
...mos/fas/business/service/impl/DataRefreshServiceImpl.java
+1
-0
FmeaServiceImpl.java
...ejoin/amos/fas/business/service/impl/FmeaServiceImpl.java
+16
-76
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+141
-90
View3dServiceImpl.java
...oin/amos/fas/business/service/impl/View3dServiceImpl.java
+0
-6
IView3dService.java
...ejoin/amos/fas/business/service/intfc/IView3dService.java
+0
-1
HttpUtil.java
...ain/java/com/yeejoin/amos/fas/business/util/HttpUtil.java
+109
-109
RsDataQueue.java
.../java/com/yeejoin/amos/fas/client/invoke/RsDataQueue.java
+9
-8
application-dev.properties
...utoSysStart/src/main/resources/application-dev.properties
+3
-2
application-docker.properties
...SysStart/src/main/resources/application-docker.properties
+1
-2
application-test.properties
...toSysStart/src/main/resources/application-test.properties
+1
-2
application.properties
...ireAutoSysStart/src/main/resources/application.properties
+1
-1
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/ContingencyAction.java
View file @
66bc74c0
...
@@ -26,6 +26,7 @@ import org.springframework.util.CollectionUtils;
...
@@ -26,6 +26,7 @@ import org.springframework.util.CollectionUtils;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
...
@@ -54,8 +55,8 @@ import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
...
@@ -54,8 +55,8 @@ import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
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.CacheFactory
;
import
com.yeejoin.amos.fas.business.util.CacheFactory
;
import
com.yeejoin.amos.fas.business.util.CacheMap
;
import
com.yeejoin.amos.fas.business.util.CacheMap
;
import
com.yeejoin.amos.fas.business.util.HttpUtil
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance
;
@Component
@Component
...
@@ -82,10 +83,6 @@ public class ContingencyAction implements CustomerAction {
...
@@ -82,10 +83,6 @@ public class ContingencyAction implements CustomerAction {
private
FireStengthService
fireStrengthService
;
private
FireStengthService
fireStrengthService
;
@Autowired
@Autowired
private
ContingencyLogPublisher
contingencyLogPublisher
;
private
ContingencyLogPublisher
contingencyLogPublisher
;
// private RestTemplate restTemplate = new RestTemplate();
// @Value("${bussunis.domain}")
// private String bussunisDomain ;
@Autowired
@Autowired
private
IRiskSourceService
riskSourceService
;
private
IRiskSourceService
riskSourceService
;
...
@@ -102,6 +99,12 @@ public class ContingencyAction implements CustomerAction {
...
@@ -102,6 +99,12 @@ public class ContingencyAction implements CustomerAction {
static
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
static
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
public
static
ConcurrentHashMap
<
String
,
Map
<
String
,
Object
>>
pointCache
=
new
ConcurrentHashMap
<>();
public
static
ConcurrentHashMap
<
String
,
Map
<
String
,
Object
>>
pointCache
=
new
ConcurrentHashMap
<>();
private
static
CacheMap
cacheMap
=
CacheFactory
.
newChacheMap
();
private
static
final
String
TOKE
=
"TOKE"
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
//当值值班长(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>() {{
...
@@ -127,9 +130,10 @@ public class ContingencyAction implements CustomerAction {
...
@@ -127,9 +130,10 @@ public class ContingencyAction implements CustomerAction {
* A1...A6 副值班员 deputyDutyCivilian 规则配置中副值班员1...6:deputyDutyCivilian1...deputyDutyCivilian6
* A1...A6 副值班员 deputyDutyCivilian 规则配置中副值班员1...6:deputyDutyCivilian1...deputyDutyCivilian6
*/
*/
public
Map
<
String
,
String
>
getStrengthMap
(
String
batchNo
)
{
public
Map
<
String
,
String
>
getStrengthMap
(
ContingencyRo
contingencyRo
)
{
String
batchNo
=
contingencyRo
.
getBatchNo
();
Map
<
String
,
String
>
returnMap
=
stringStringMap
.
get
(
batchNo
);
String
orgCode
=
contingencyRo
.
getEquipmentOrgCode
();
Map
<
String
,
String
>
returnMap
=
stringStringMap
.
get
(
contingencyRo
.
getBatchNo
());
if
(
CollectionUtils
.
isEmpty
(
returnMap
))
{
if
(
CollectionUtils
.
isEmpty
(
returnMap
))
{
stringStringMap
=
new
HashMap
<>();
stringStringMap
=
new
HashMap
<>();
returnMap
=
new
HashMap
<>();
returnMap
=
new
HashMap
<>();
...
@@ -137,11 +141,16 @@ public class ContingencyAction implements CustomerAction {
...
@@ -137,11 +141,16 @@ public class ContingencyAction implements CustomerAction {
Date
curDate
=
new
Date
();
Date
curDate
=
new
Date
();
JSONObject
param
=
new
JSONObject
();
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"dutyDate"
,
curDate
);
param
.
put
(
"dutyDate"
,
curDate
);
//CommonResponse commonResponse = dutyModeServer.dutyListByDate(appKey, product, token, staticOrgCode, param.toJSONString());
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
);
// String result = HttpUtil.appendPostJson("duty/dutyListByDate", param.toJSONString());
JSONArray
dataList
=
(
JSONArray
)
jsonObject
.
get
(
"dataList"
);
// JSONObject jsonObject = JSONObject.parseObject(result);
// JSONArray dataList = JSONObject.parseObject(commonResponse.getDataList().toString());
String
JSONStr
=
JSON
.
toJSONString
(
commonResponse
.
getDataList
());
JSONArray
dataList
=
JSONObject
.
parseArray
(
JSONStr
);
log
.
info
(
String
.
format
(
"请求值班系统返回dataList:%s"
,
dataList
));
log
.
info
(
String
.
format
(
"请求值班系统返回dataList:%s"
,
dataList
));
if
(!
ObjectUtils
.
isEmpty
(
dataList
))
{
if
(!
ObjectUtils
.
isEmpty
(
dataList
))
{
...
@@ -241,37 +250,6 @@ public class ContingencyAction implements CustomerAction {
...
@@ -241,37 +250,6 @@ public class ContingencyAction implements CustomerAction {
log
.
info
(
"巡检消息发送规则"
+
JSONObject
.
toJSONString
(
result
));
log
.
info
(
"巡检消息发送规则"
+
JSONObject
.
toJSONString
(
result
));
this
.
sendcmd
(
"steparea"
,
contingencyRo
,
result
);
this
.
sendcmd
(
"steparea"
,
contingencyRo
,
result
);
}
}
// public static void main(String[] args) {
// SetpEnum[] stepArr = SetpEnum.values();
// Map<String, Object> tempmap1 = new HashMap<>();
// 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("3")) {
// 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);
// log.info("巡检消息发送规则" + JSONObject.toJSONString(tempmap1));
// }
/**
/**
* @param stepCode 当前步骤编号
* @param stepCode 当前步骤编号
...
@@ -366,33 +344,26 @@ public class ContingencyAction implements CustomerAction {
...
@@ -366,33 +344,26 @@ public class ContingencyAction implements CustomerAction {
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
);
for
(
String
key
:
strengthMap
.
keySet
())
for
(
String
key
:
strengthMap
.
keySet
())
content
=
content
.
replaceAll
(
"\\$\\{"
+
key
+
"}"
,
strengthMap
.
get
(
key
));
content
=
content
.
replaceAll
(
"\\$\\{"
+
key
+
"}"
,
strengthMap
.
get
(
key
));
Field
[]
fields
=
contingencyRo
.
getClass
().
getDeclaredFields
();
/* for (String key : positionMap.keySet())
Method
getMethod
=
null
;
c ontent = content.replaceAll("\\$\\{" + key + "}", positionMap.get(key));
try
{
*/
for
(
Field
field
:
fields
)
{
if
(
field
.
getName
().
equals
(
"serialVersionUID"
))
Field
[]
fields
=
contingencyRo
.
getClass
().
getDeclaredFields
();
continue
;
Method
getMethod
=
null
;
String
fileNameInMethod
=
String
.
valueOf
(
field
.
getName
().
charAt
(
0
)).
toUpperCase
()
+
field
.
getName
().
substring
(
1
);
try
{
getMethod
=
contingencyRo
.
getClass
().
getMethod
(
"get"
+
fileNameInMethod
);
for
(
Field
field
:
fields
)
{
String
value
=
String
.
valueOf
(
getMethod
.
invoke
(
contingencyRo
));
if
(
field
.
getName
().
equals
(
"serialVersionUID"
))
content
=
content
.
replaceAll
(
"\\$\\{"
+
field
.
getName
()
+
"}"
,
value
);
continue
;
}
String
fileNameInMethod
=
String
.
valueOf
(
field
.
getName
().
charAt
(
0
)).
toUpperCase
()
+
field
.
getName
().
substring
(
1
);
getMethod
=
contingencyRo
.
getClass
().
getMethod
(
"get"
+
fileNameInMethod
);
content
=
getNative
(
content
);
String
value
=
String
.
valueOf
(
getMethod
.
invoke
(
contingencyRo
));
}
catch
(
Exception
e
)
{
content
=
content
.
replaceAll
(
"\\$\\{"
+
field
.
getName
()
+
"}"
,
value
);
e
.
printStackTrace
();
}
}
content
=
getNative
(
content
);
// content = content.replaceAll("\\$\\{", "");
// content = content.replaceAll("}", "");
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
content
;
return
content
;
}
}
...
@@ -450,16 +421,13 @@ public class ContingencyAction implements CustomerAction {
...
@@ -450,16 +421,13 @@ public class ContingencyAction implements CustomerAction {
this
.
sendcmd
(
"optionarea"
,
paramObj
,
result
);
this
.
sendcmd
(
"optionarea"
,
paramObj
,
result
);
// 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";
ObjectMapper
objectMapper
=
new
ObjectMapper
();
ObjectMapper
objectMapper
=
new
ObjectMapper
();
//Map<String,Object> map = new HashMap<>();
/**
/**
* batchNo
* batchNo
...
@@ -473,14 +441,6 @@ public class ContingencyAction implements CustomerAction {
...
@@ -473,14 +441,6 @@ public class ContingencyAction implements CustomerAction {
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("actionName",actionName);
// map.put("equipmentId",equipmentId);
// map.put("stepCode",button.get("stepCode"));
// map.put("buttonCode",operateInstance.get("code"));
// map.put("confirm","CONFIRM");
// map.put("stepState",operateInstance.get("stepState"));
// 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"
)));
...
@@ -490,8 +450,6 @@ public class ContingencyAction implements CustomerAction {
...
@@ -490,8 +450,6 @@ 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
);
//HttpEntity<Map> entity = new HttpEntity<>(map);
// restTemplate.exchange(url, HttpMethod.POST,entity,Map.class);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -681,11 +639,7 @@ public class ContingencyAction implements CustomerAction {
...
@@ -681,11 +639,7 @@ public class ContingencyAction implements CustomerAction {
redisTemplate
.
delete
(
"contingencyRo"
);
redisTemplate
.
delete
(
"contingencyRo"
);
}
}
private
static
CacheMap
cacheMap
=
CacheFactory
.
newChacheMap
();
private
static
final
String
TOKE
=
"TOKE"
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
@RuleMethod
(
methodLabel
=
"自动执行步骤"
,
project
=
"青海换流站消防预案"
)
@RuleMethod
(
methodLabel
=
"自动执行步骤"
,
project
=
"青海换流站消防预案"
)
public
void
autoExecute
(
public
void
autoExecute
(
...
@@ -696,12 +650,14 @@ public class ContingencyAction implements CustomerAction {
...
@@ -696,12 +650,14 @@ public class ContingencyAction implements CustomerAction {
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
@MethodParam
(
paramLabel
=
"预案对象"
)
Object
paramObj
)
{
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyRo
contingencyRo
=
(
ContingencyRo
)
paramObj
;
ContingencyPlanInstance
contingencyPlanInstance
=
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
actionName
,
"DEFAULT"
,
""
,
"OPERATE"
,
""
);
ContingencyPlanInstance
contingencyPlanInstance
=
iContingencyInstance
.
createInstanceRecord
(
contingencyRo
.
getBatchNo
(),
actionName
,
"DEFAULT"
,
""
,
"OPERATE"
,
""
);
Toke
toke
=
cacheMap
.
getValue
(
TOKE
);
if
(
toke
==
null
)
{
Toke
toke
=
remoteSecurityService
.
getServerToken
();
toke
=
remoteSecurityService
.
come
();
// Toke toke = cacheMap.getValue(TOKE);
Long
times
=
(
long
)
(
20
*
24
*
60
*
60
);
// if (toke == null) {
cacheMap
.
setex
(
TOKE
,
toke
,
times
);
// toke = remoteSecurityService.come();
}
// Long times = (long) (20 * 24 * 60 * 60);
// cacheMap.setex(TOKE, toke, times);
// }
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setToken
(
toke
.
getToke
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
RequestContext
.
setProduct
(
toke
.
getProduct
());
try
{
try
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/model/ContingencyRo.java
View file @
66bc74c0
...
@@ -17,7 +17,7 @@ public class ContingencyRo implements Serializable {
...
@@ -17,7 +17,7 @@ public class ContingencyRo implements Serializable {
/**
/**
*
*
*/
*/
private
static
final
long
serialVersionUID
=
1863437780244849215
L
;
private
static
final
long
serialVersionUID
=
-
8687517896814257800
L
;
@Label
(
"消防设备名称"
)
@Label
(
"消防设备名称"
)
private
String
fireEquipmentName
;
//消防设备名称
private
String
fireEquipmentName
;
//消防设备名称
@Label
(
"消防设备id"
)
@Label
(
"消防设备id"
)
...
@@ -35,6 +35,10 @@ public class ContingencyRo implements Serializable {
...
@@ -35,6 +35,10 @@ public class ContingencyRo implements Serializable {
//负责人名称,手机号
//负责人名称,手机号
@Label
(
"重点设备id"
)
@Label
(
"重点设备id"
)
private
String
equipmentId
;
//重点设备id
private
String
equipmentId
;
//重点设备id
@Label
(
"重点设备组织编码"
)
private
String
equipmentOrgCode
=
"10"
;
//重点设备组织编码
@Label
(
"重点设备名称"
)
@Label
(
"重点设备名称"
)
private
String
equipmentName
;
private
String
equipmentName
;
@Label
(
"重点设备坐标"
)
@Label
(
"重点设备坐标"
)
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/View3dController.java
View file @
66bc74c0
...
@@ -278,10 +278,4 @@ public class View3dController extends BaseController {
...
@@ -278,10 +278,4 @@ 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
=
"dutyListByDate"
)
public
Map
<
String
,
String
>
getDutyListByDate
(){
return
view3dService
.
getDutyListByDate
();
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/feign/PushFeignServer.java
View file @
66bc74c0
package
com
.
yeejoin
.
amos
.
fas
.
business
.
feign
;
//
package com.yeejoin.amos.fas.business.feign;
//
import
java.util.List
;
//
import java.util.List;
//
import
org.springframework.beans.factory.annotation.Value
;
//
import org.springframework.beans.factory.annotation.Value;
import
org.springframework.http.HttpEntity
;
//
import org.springframework.http.HttpEntity;
import
org.springframework.http.HttpHeaders
;
//
import org.springframework.http.HttpHeaders;
import
org.springframework.http.MediaType
;
//
import org.springframework.http.MediaType;
import
org.springframework.stereotype.Service
;
//
import org.springframework.stereotype.Service;
import
org.springframework.web.client.RestTemplate
;
//
import org.springframework.web.client.RestTemplate;
//
import
com.yeejoin.amos.fas.business.jpush.PushMsgParam
;
//
import com.yeejoin.amos.fas.business.jpush.PushMsgParam;
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;
@Service
(
"pushFeignServer"
)
//
@Service("pushFeignServer")
public
class
PushFeignServer
{
//
public class PushFeignServer {
private
final
RestTemplate
restTemplate
;
//
private final RestTemplate restTemplate;
//
public
PushFeignServer
()
{
//
public PushFeignServer() {
this
.
restTemplate
=
new
RestTemplate
();
//
this.restTemplate = new RestTemplate();
}
//
}
//
@Value
(
"${Push.fegin.name}"
)
//
@Value("${Push.fegin.name}")
private
String
RPushFeginName
;
//
private String RPushFeginName;
private
static
String
sendMessage
=
"/api/user/sendMessage"
;
//
private static String sendMessage = "/api/user/sendMessage";
//
public
String
geturls
(
String
url
){
//
public String geturls(String url){
return
"http://"
+
RPushFeginName
+
url
;
//
return "http://"+RPushFeginName+url;
}
//
}
public
HttpHeaders
getHeader
(
String
toke
,
String
product
,
String
appKey
){
//
public HttpHeaders getHeader(String toke,String product,String appKey){
HttpHeaders
headers
=
new
HttpHeaders
();
//
HttpHeaders headers = new HttpHeaders();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
//
headers.setContentType(MediaType.APPLICATION_JSON);
headers
.
set
(
"Content-Type"
,
"application/json"
);
//
headers.set("Content-Type", "application/json");
headers
.
set
(
"token"
,
toke
);
//
headers.set("token", toke);
headers
.
set
(
"product"
,
product
);
//
headers.set("product",product);
headers
.
set
(
"appKey"
,
appKey
);
//
headers.set("appKey", appKey);
return
headers
;
//
return headers;
}
//
}
//
public
CommonResponse
sendMessage
(
String
toke
,
String
product
,
String
appKey
,
List
<
PushMsgParam
>
pushMsgParam
){
//
public CommonResponse sendMessage( String toke,String product,String appKey, List<PushMsgParam> pushMsgParam){
try
{
//
try {
HttpEntity
httpEntity
=
new
HttpEntity
<>(
pushMsgParam
,
getHeader
(
toke
,
product
,
appKey
));
//
HttpEntity httpEntity = new HttpEntity<>(pushMsgParam, getHeader( toke, product, appKey));
CommonResponse
commonResponse1
=
restTemplate
.
postForObject
(
geturls
(
sendMessage
),
httpEntity
,
CommonResponse
.
class
);
//
CommonResponse commonResponse1 = restTemplate.postForObject(geturls(sendMessage),httpEntity, CommonResponse.class);
return
commonResponse1
;
//
return commonResponse1;
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
e
.
printStackTrace
();
//
e.printStackTrace();
return
CommonResponseUtil
.
failure
(
"发送失败"
);
//
return CommonResponseUtil.failure("发送失败");
//
}
//
}
}
//
}
}
//
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/feign/RemoteRuleServer.java
View file @
66bc74c0
package
com
.
yeejoin
.
amos
.
fas
.
business
.
feign
;
//package com.yeejoin.amos.fas.business.feign;
//
import
com.yeejoin.amos.fas.business.action.model.BasicsRo
;
//import com.yeejoin.amos.fas.business.action.model.BasicsRo;
import
com.yeejoin.amos.fas.business.action.model.RiskSourceRuleRo
;
//import com.yeejoin.amos.fas.business.action.model.RiskSourceRuleRo;
import
com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus
;
//import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
//import com.yeejoin.amos.op.core.util.ApplicationConfig;
////import com.yeejoin.amos.op.core.util.ApplicationConfig;
//import com.yeejoin.amos.op.core.util.Constants;
////import com.yeejoin.amos.op.core.util.Constants;
import
com.yeejoin.amos.fas.business.util.Constants
;
//import com.yeejoin.amos.fas.business.util.Constants;
import
com.yeejoin.amos.fas.business.util.JSONUtil
;
//import com.yeejoin.amos.fas.business.util.JSONUtil;
//
import
org.codehaus.jackson.map.ObjectMapper
;
//import org.codehaus.jackson.map.ObjectMapper;
import
org.slf4j.Logger
;
//import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
//import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
//import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
//import org.springframework.beans.factory.annotation.Value;
import
org.springframework.http.HttpEntity
;
//import org.springframework.http.HttpEntity;
import
org.springframework.http.HttpHeaders
;
//import org.springframework.http.HttpHeaders;
import
org.springframework.http.HttpMethod
;
//import org.springframework.http.HttpMethod;
import
org.springframework.http.MediaType
;
//import org.springframework.http.MediaType;
import
org.springframework.http.ResponseEntity
;
//import org.springframework.http.ResponseEntity;
import
org.springframework.stereotype.Service
;
//import org.springframework.stereotype.Service;
import
org.springframework.web.client.RestTemplate
;
//import org.springframework.web.client.RestTemplate;
//
import
java.util.HashMap
;
//import java.util.HashMap;
import
java.util.Map
;
//import java.util.Map;
//
/**
///**
* <pre>
// * <pre>
* 规则模型系统远程调用
// * 规则模型系统远程调用
* </pre>
// * </pre>
*
// *
* @author amos
// * @author amos
* @version $Id: RemoteRuleServer.java, v 0.1 2019年5月7日 下午5:52:21 amos Exp $
// * @version $Id: RemoteRuleServer.java, v 0.1 2019年5月7日 下午5:52:21 amos Exp $
*/
// */
@Service
(
"remoteRuleServer"
)
//@Service("remoteRuleServer")
public
class
RemoteRuleServer
{
//public class RemoteRuleServer {
//
/* @Autowired
// /* @Autowired
private ApplicationConfig applicationConfig;*/
// private ApplicationConfig applicationConfig;*/
@Value
(
"${params.remoteRuleUrl}"
)
// @Value("${params.remoteRuleUrl}")
private
String
remoteRuleUrl
;
// private String remoteRuleUrl;
//
private
final
RestTemplate
restTemplate
;
// private final RestTemplate restTemplate;
//
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
RemoteRuleServer
.
class
);
// private final Logger log = LoggerFactory.getLogger(RemoteRuleServer.class);
//
private
ObjectMapper
objectMapper
=
new
ObjectMapper
();
// private ObjectMapper objectMapper = new ObjectMapper();
//
public
RemoteRuleServer
()
{
// public RemoteRuleServer() {
this
.
restTemplate
=
new
RestTemplate
();
// this.restTemplate = new RestTemplate();
}
// }
//
/**
// /**
* 触发风险点规则
// * 触发风险点规则
*/
// */
public
Object
fireRule
(
RiskSourceRuleRo
riskSourceRuleRo
,
String
packageId
)
throws
Exception
{
// public Object fireRule(RiskSourceRuleRo riskSourceRuleRo, String packageId) throws Exception {
Map
<
String
,
String
>
map
=
new
HashMap
<>();
// Map<String, String> map = new HashMap<>();
String
data
=
JSONUtil
.
toJson
(
riskSourceRuleRo
);
// String data = JSONUtil.toJson(riskSourceRuleRo);
log
.
info
(
data
);
// log.info(data);
map
.
put
(
"resFact"
,
data
);
// map.put("resFact", data);
map
.
put
(
"packageId"
,
packageId
);
// map.put("packageId", packageId);
map
.
put
(
"className"
,
riskSourceRuleRo
.
getClass
().
getName
());
// map.put("className", riskSourceRuleRo.getClass().getName());
/*String url = applicationConfig.getParamValueStr("params.remoteRuleUrl");*/
// /*String url = applicationConfig.getParamValueStr("params.remoteRuleUrl");*/
String
url
=
remoteRuleUrl
;
// String url =remoteRuleUrl;
HttpHeaders
headers
=
new
HttpHeaders
();
// HttpHeaders headers = new HttpHeaders();
MediaType
type
=
MediaType
.
parseMediaType
(
"application/json; charset=UTF-8"
);
// MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
headers
.
setContentType
(
type
);
// headers.setContentType(type);
headers
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON
.
toString
());
// headers.add("Accept", MediaType.APPLICATION_JSON.toString());
HttpEntity
<
Map
<
String
,
String
>>
formEntity
=
new
HttpEntity
<>(
map
,
headers
);
// HttpEntity<Map<String, String>> formEntity = new HttpEntity<>(map, headers);
ResponseEntity
responseEntity
=
restTemplate
.
exchange
(
url
+
"urule/rule/fireRule"
,
// ResponseEntity responseEntity = restTemplate.exchange(url + "urule/rule/fireRule",
HttpMethod
.
POST
,
formEntity
,
String
.
class
);
// HttpMethod.POST, formEntity, String.class);
//
responseEntity
.
getBody
();
// responseEntity.getBody();
Map
commonResponse
=
objectMapper
.
readValue
(
responseEntity
.
getBody
().
toString
(),
Map
.
class
);
// Map commonResponse = objectMapper.readValue(responseEntity.getBody().toString(), Map.class);
if
(
commonResponse
!=
null
&&
commonResponse
.
get
(
"result"
).
equals
(
Constants
.
RESULT_SUCCESS
))
{
// if (commonResponse != null && commonResponse.get("result").equals(Constants.RESULT_SUCCESS)) {
log
.
info
(
"调用规则服务成功,请求参数:"
+
formEntity
.
toString
());
// log.info("调用规则服务成功,请求参数:" + formEntity.toString());
return
commonResponse
.
get
(
"dataList"
);
// return commonResponse.get("dataList");
}
// }
return
null
;
// return null;
}
// }
//
/**
// /**
* <pre>
// * <pre>
* 触发规则流
// * 触发规则流
* </pre>
// * </pre>
*
// *
* @param resFact 触发规则对象
// * @param resFact 触发规则对象
* @param packageId 规范规则包
// * @param packageId 规范规则包
* @param processId 规则流id
// * @param processId 规则流id
* @return
// * @return
*/
// */
public
Object
fireRuleFlow
(
BasicsRo
resFact
,
String
packageId
,
String
processId
)
throws
Exception
{
// public Object fireRuleFlow(BasicsRo resFact, String packageId, String processId) throws Exception {
String
data
=
JSONUtil
.
toJson
(
resFact
);
// String data = JSONUtil.toJson(resFact);
log
.
info
(
"调用规则请求====================>"
+
data
);
// log.info("调用规则请求====================>" + data);
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
// Map<String, String> map = new HashMap<String, String>();
map
.
put
(
"resFact"
,
data
);
// map.put("resFact", data);
map
.
put
(
"packageId"
,
packageId
);
// map.put("packageId", packageId);
map
.
put
(
"processId"
,
processId
);
// map.put("processId", processId);
map
.
put
(
"className"
,
resFact
.
getClass
().
getName
());
// map.put("className", resFact.getClass().getName());
//String url = applicationConfig.getParamValueStr("params.remoteRuleUrl");
// //String url = applicationConfig.getParamValueStr("params.remoteRuleUrl");
String
url
=
remoteRuleUrl
;
// String url =remoteRuleUrl;
HttpHeaders
headers
=
new
HttpHeaders
();
// HttpHeaders headers = new HttpHeaders();
MediaType
type
=
MediaType
// MediaType type = MediaType
.
parseMediaType
(
"application/json; charset=UTF-8"
);
// .parseMediaType("application/json; charset=UTF-8");
headers
.
setContentType
(
type
);
// headers.setContentType(type);
headers
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON
.
toString
());
// headers.add("Accept", MediaType.APPLICATION_JSON.toString());
HttpEntity
<
Map
<
String
,
String
>>
formEntity
=
new
HttpEntity
<
Map
<
String
,
String
>>(
map
,
headers
);
// HttpEntity<Map<String, String>> formEntity = new HttpEntity<Map<String, String>>(map, headers);
ResponseEntity
responseEntity
=
restTemplate
.
exchange
(
url
+
"urule/rule/fireRuleFlow"
,
// ResponseEntity responseEntity = restTemplate.exchange(url + "urule/rule/fireRuleFlow",
HttpMethod
.
POST
,
formEntity
,
String
.
class
);
// HttpMethod.POST, formEntity, String.class);
//
//
Map
commonResponse
=
objectMapper
.
readValue
(
responseEntity
.
getBody
().
toString
(),
Map
.
class
);
// Map commonResponse = objectMapper.readValue(responseEntity.getBody().toString(), Map.class);
if
(
commonResponse
!=
null
&&
commonResponse
.
get
(
"result"
).
equals
(
Constants
.
RESULT_SUCCESS
))
{
// if (commonResponse != null && commonResponse.get("result").equals(Constants.RESULT_SUCCESS)) {
return
commonResponse
.
get
(
"dataList"
);
// return commonResponse.get("dataList");
}
// }
return
null
;
// return null;
}
// }
//
//
public
Object
autoProcessContingency
(
ContingencyDeviceStatus
contingencyDeviceStatus
)
throws
Exception
{
// public Object autoProcessContingency(ContingencyDeviceStatus contingencyDeviceStatus) throws Exception {
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
// Map<String, String> map = new HashMap<String, String>();
//
// String url = applicationConfig.getParamValueStr("params.remoteRuleUrl");
// // String url = applicationConfig.getParamValueStr("params.remoteRuleUrl");
String
url
=
remoteRuleUrl
;
// String url =remoteRuleUrl;
// String url = "http://172.16.10.70:8080/";
// // String url = "http://172.16.10.70:8080/";
HttpHeaders
headers
=
new
HttpHeaders
();
// HttpHeaders headers = new HttpHeaders();
MediaType
type
=
MediaType
// MediaType type = MediaType
.
parseMediaType
(
"application/json; charset=UTF-8"
);
// .parseMediaType("application/json; charset=UTF-8");
headers
.
setContentType
(
type
);
// headers.setContentType(type);
headers
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON
.
toString
());
// headers.add("Accept", MediaType.APPLICATION_JSON.toString());
HttpEntity
<
Map
<
String
,
String
>>
formEntity
=
new
HttpEntity
<
Map
<
String
,
String
>>(
map
,
headers
);
// HttpEntity<Map<String, String>> formEntity = new HttpEntity<Map<String, String>>(map, headers);
String
urlParams
=
"batchNo=%s&stepCode=%s&buttonCode=%s&confirm=%s&contingencyPlanId=%s&stepState=%s"
;
// String urlParams = "batchNo=%s&stepCode=%s&buttonCode=%s&confirm=%s&contingencyPlanId=%s&stepState=%s";
String
.
format
(
urlParams
,
// String.format(urlParams,
contingencyDeviceStatus
.
getButtonCode
(),
// contingencyDeviceStatus.getButtonCode(),
contingencyDeviceStatus
.
getStepCode
(),
// contingencyDeviceStatus.getStepCode(),
contingencyDeviceStatus
.
getConfirm
(),
// contingencyDeviceStatus.getConfirm(),
contingencyDeviceStatus
.
getContingencyPlanId
(),
// contingencyDeviceStatus.getContingencyPlanId(),
contingencyDeviceStatus
.
getStepState
());
// contingencyDeviceStatus.getStepState());
ResponseEntity
responseEntity
=
restTemplate
.
exchange
(
url
+
"/api/timeline/fire?"
+
urlParams
,
// ResponseEntity responseEntity = restTemplate.exchange(url + "/api/timeline/fire?" + urlParams,
HttpMethod
.
PUT
,
formEntity
,
String
.
class
);
// HttpMethod.PUT, formEntity, String.class);
//
//
Map
commonResponse
=
objectMapper
.
readValue
(
responseEntity
.
getBody
().
toString
(),
Map
.
class
);
// Map commonResponse = objectMapper.readValue(responseEntity.getBody().toString(), Map.class);
if
(
commonResponse
!=
null
&&
commonResponse
.
get
(
"result"
).
equals
(
Constants
.
RESULT_SUCCESS
))
{
// if (commonResponse != null && commonResponse.get("result").equals(Constants.RESULT_SUCCESS)) {
return
commonResponse
.
get
(
"dataList"
);
// return commonResponse.get("dataList");
}
// }
return
null
;
// return null;
}
// }
}
//}
\ No newline at end of file
\ No newline at end of file
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/feign/RemoteSecurityService.java
View file @
66bc74c0
...
@@ -6,16 +6,25 @@ import com.alibaba.fastjson.JSONArray;
...
@@ -6,16 +6,25 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.base.Joiner
;
import
com.google.common.base.Joiner
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.component.feign.config.TokenOperation
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.fas.business.util.CacheFactory
;
import
com.yeejoin.amos.fas.business.util.CacheMap
;
import
com.yeejoin.amos.fas.business.vo.ReginParams
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.exception.PermissionException
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.*
;
import
com.yeejoin.amos.feign.privilege.model.*
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
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.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -23,6 +32,7 @@ import java.util.HashMap;
...
@@ -23,6 +32,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
(
"remoteSecurityService"
)
@Service
(
"remoteSecurityService"
)
...
@@ -35,12 +45,13 @@ public class RemoteSecurityService {
...
@@ -35,12 +45,13 @@ public class RemoteSecurityService {
private
String
productWeb
;
private
String
productWeb
;
@Value
(
"${security.appKeyWeb}"
)
@Value
(
"${security.appKeyWeb}"
)
private
String
appKeyWeb
;
private
String
appKeyWeb
;
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
//根据公司名称获取公司人
//根据公司名称获取公司人
public
List
<
CompanyModel
>
listCompanyTree
(
String
toke
,
String
product
,
String
appKey
,
String
companyName
)
{
public
List
<
CompanyModel
>
listCompanyTree
(
String
toke
,
String
product
,
String
appKey
,
String
companyName
)
{
// CommonResponse commonResponse = iAmosSecurityServer.listCompanyTree();
//return handleArray(commonResponse, CompanyBo.class);
RequestContext
.
setToken
(
toke
);
RequestContext
.
setToken
(
toke
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setAppKey
(
appKey
);
...
@@ -61,9 +72,6 @@ public class RemoteSecurityService {
...
@@ -61,9 +72,6 @@ public class RemoteSecurityService {
if
(
deparmentId
==
null
||
deparmentId
.
equals
(
""
))
{
if
(
deparmentId
==
null
||
deparmentId
.
equals
(
""
))
{
return
null
;
return
null
;
}
}
// CommonResponse commonResponse = iAmosSecurityServer.getDepartmentByDeptId(deparmentId);
// return handleObj(commonResponse, DepartmentBo.class);
RequestContext
.
setToken
(
toke
);
RequestContext
.
setToken
(
toke
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setAppKey
(
appKey
);
...
@@ -97,8 +105,6 @@ public class RemoteSecurityService {
...
@@ -97,8 +105,6 @@ public class RemoteSecurityService {
}
}
return
departmentModel
;
return
departmentModel
;
//CommonResponse commonResponse = iAmosSecurityServer.listDepartmentsByCompanyId(companyId);
//return handleArray(commonResponse, DepartmentBo.class);
}
}
// * 根据公司id查询机构用户
// * 根据公司id查询机构用户
public
List
<
AgencyUserModel
>
listUserByCompanyId
(
String
toke
,
String
product
,
String
appKey
,
String
companyId
)
{
public
List
<
AgencyUserModel
>
listUserByCompanyId
(
String
toke
,
String
product
,
String
appKey
,
String
companyId
)
{
...
@@ -144,27 +150,46 @@ public class RemoteSecurityService {
...
@@ -144,27 +150,46 @@ public class RemoteSecurityService {
return
agencyUserModel
;
return
agencyUserModel
;
}
}
public
Toke
come
()
{
public
Toke
getServerToken
()
{
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
dPasswordAuthModel
.
setLoginId
(
loginId
);
dPasswordAuthModel
.
setLoginId
(
loginId
);
dPasswordAuthModel
.
setPassword
(
password
);
dPasswordAuthModel
.
setPassword
(
password
);
Map
map
=
null
;
Toke
toke
=
null
;
FeignClientResult
feignClientResult
;
Toke
oked
=
new
Toke
();
try
{
try
{
RequestContext
.
setProduct
(
productWeb
);
toke
=
JSON
.
parseObject
(
redisTemplate
.
opsForValue
().
get
(
buildKey
(
loginId
)),
Toke
.
class
);
feignClientResult
=
Privilege
.
authClient
.
idpassword
(
dPasswordAuthModel
);
if
(
ObjectUtils
.
isEmpty
(
toke
)){
map
=
(
Map
)
feignClientResult
.
getResult
(
);
toke
=
getLogin
(
dPasswordAuthModel
);
if
(
map
!=
null
){
}
else
{
oked
.
setToke
(
map
.
get
(
"token"
).
toString
());
if
(!
TokenOperation
.
refresh
(
toke
.
getToke
()))
{
oked
.
setProduct
(
productWeb
);
toke
=
getLogin
(
dPasswordAuthModel
);
oked
.
setAppKey
(
appKeyWeb
);
}
}
}
}
catch
(
InnerInvokException
e
)
{
}
catch
(
InnerInvokException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
oked
;
return
toke
;
}
}
private
Toke
getLogin
(
IdPasswordAuthModel
dPasswordAuthModel
){
Toke
toke
=
new
Toke
();
RequestContext
.
setProduct
(
productWeb
);
FeignClientResult
feignClientResult
=
Privilege
.
authClient
.
idpassword
(
dPasswordAuthModel
);
Map
map
=
(
Map
)
feignClientResult
.
getResult
();
if
(
map
!=
null
){
toke
.
setToke
(
map
.
get
(
"token"
).
toString
());
toke
.
setProduct
(
productWeb
);
toke
.
setAppKey
(
appKeyWeb
);
redisTemplate
.
opsForValue
().
set
(
buildKey
(
dPasswordAuthModel
.
getLoginId
()),
JSONObject
.
toJSONString
(
toke
),
28
,
TimeUnit
.
DAYS
);
}
return
toke
;
}
//redi缓存系统用户token信息
private
String
buildKey
(
String
username
)
{
return
"system_"
+
username
;
}
/**
/**
* 用户id批量获取用户信息
* 用户id批量获取用户信息
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/jpush/AppMessagePushService.java
View file @
66bc74c0
package
com
.
yeejoin
.
amos
.
fas
.
business
.
jpush
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
jpush
;
import
cn.jpush.api.JPushClient
;
import
cn.jpush.api.push.model.Platform
;
import
cn.jpush.api.push.model.PushPayload
;
import
cn.jpush.api.push.model.audience.Audience
;
import
cn.jpush.api.push.model.notification.Notification
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
cn.jpush.api.push.model.PushPayload
;
@Service
@Service
public
class
AppMessagePushService
{
public
class
AppMessagePushService
{
protected
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
AppMessagePushService
.
class
);
protected
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
AppMessagePushService
.
class
);
/*
@Value("${params.isPush}")
private String isPush;
private static final String APP_KEY = "1b3f7b961200f4b236811dfe";
private static final String MASTER_SECRET = "8b650e645fb3a43c96be02b2";
private static JPushClient jpushClient = new JPushClient(MASTER_SECRET, APP_KEY);
*/
@Autowired
@Autowired
private
com
.
yeejoin
.
amos
.
fas
.
business
.
feign
.
PushFeign
PushFeign
;
private
com
.
yeejoin
.
amos
.
fas
.
business
.
feign
.
PushFeign
PushFeign
;
// public void sendMessage(List<PushMsgParam> responses) {
// try {
// if (responses != null && "true".equals(isPush)) {
// for (PushMsgParam response : responses) {
// PushPayload payload = buildPushPayload(response);
// jpushClient.sendPush(payload);
// }
// }
// } catch (Exception e) {
// log.error("极光推送异常", e);
// }
// }
private
PushPayload
buildPushPayload
(
PushMsgParam
response
)
{
private
PushPayload
buildPushPayload
(
PushMsgParam
response
)
{
CommonResponse
commonResponse
=
PushFeign
.
buildPushPayload
(
response
);
CommonResponse
commonResponse
=
PushFeign
.
buildPushPayload
(
response
);
return
(
PushPayload
)
commonResponse
.
getDataList
();
return
(
PushPayload
)
commonResponse
.
getDataList
();
// if (JPushTypeEnum.ALL.getCode().equals(response.getType())) {
// return PushPayload.newBuilder()
// .setPlatform(Platform.android())
// .setAudience(Audience.all())
// .setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
// .build();
// } else if (JPushTypeEnum.TAG.getCode().equals(response.getType())) {
// return PushPayload.newBuilder()
// .setPlatform(Platform.android())
// .setAudience(Audience.tag(response.getRecivers()))
// .setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
// .build();
// } else {
// return PushPayload.newBuilder()
// .setPlatform(Platform.android())
// .setAudience(Audience.alias(response.getRecivers()))
// .setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
// .build();
// }
}
}
public
void
sendMessage
(
PushMsgParam
response
)
{
public
void
sendMessage
(
PushMsgParam
response
)
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyInstanceImpl.java
View file @
66bc74c0
...
@@ -31,7 +31,6 @@ import com.yeejoin.amos.fas.business.dao.mapper.FireEquipPointMapper;
...
@@ -31,7 +31,6 @@ import com.yeejoin.amos.fas.business.dao.mapper.FireEquipPointMapper;
import
com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository
;
import
com.yeejoin.amos.fas.business.feign.RemoteRuleServer
;
import
com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance
;
import
com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance
;
import
com.yeejoin.amos.fas.business.service.model.Operate
;
import
com.yeejoin.amos.fas.business.service.model.Operate
;
import
com.yeejoin.amos.fas.business.service.model.OperateGroup
;
import
com.yeejoin.amos.fas.business.service.model.OperateGroup
;
...
@@ -51,9 +50,6 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
...
@@ -51,9 +50,6 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
IContingencyOriginalDataDao
iContingencyOriginalDataDao
;
IContingencyOriginalDataDao
iContingencyOriginalDataDao
;
@Autowired
@Autowired
private
RemoteRuleServer
remoteRuleServer
;
@Autowired
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
;
@Autowired
@Autowired
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/DataRefreshServiceImpl.java
View file @
66bc74c0
...
@@ -53,6 +53,7 @@ public class DataRefreshServiceImpl implements IDataRefreshService {
...
@@ -53,6 +53,7 @@ public class DataRefreshServiceImpl implements IDataRefreshService {
remoteWebSocketServer
.
sendMessage
(
"3dViewMessage"
,
JSON
.
toJSONString
(
param
));
remoteWebSocketServer
.
sendMessage
(
"3dViewMessage"
,
JSON
.
toJSONString
(
param
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"通知前端数据刷新失败-->"
+
JSON
.
toJSONString
(
param
));
log
.
error
(
"通知前端数据刷新失败-->"
+
JSON
.
toJSONString
(
param
));
log
.
error
(
"通知前端数据刷新失败-->"
+
e
.
getMessage
());
}
}
}
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/FmeaServiceImpl.java
View file @
66bc74c0
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
com.google.common.base.Joiner
;
import
com.google.common.base.Joiner
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.fas.business.action.model.RiskSourceRo
;
import
com.yeejoin.amos.fas.business.action.model.RiskSourceRo
;
import
com.yeejoin.amos.fas.business.dao.mapper.FmeaEquipmentPointMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FmeaEquipmentPointMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FmeaMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FmeaMapper
;
...
@@ -11,7 +26,6 @@ import com.yeejoin.amos.fas.business.dao.repository.IFmeaDao;
...
@@ -11,7 +26,6 @@ import com.yeejoin.amos.fas.business.dao.repository.IFmeaDao;
import
com.yeejoin.amos.fas.business.dao.repository.IRiskFactorDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRiskFactorDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao
;
import
com.yeejoin.amos.fas.business.dao.repository.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.feign.RemoteRuleServer
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.param.CommonPageInfoParam
;
import
com.yeejoin.amos.fas.business.param.CommonPageInfoParam
;
import
com.yeejoin.amos.fas.business.service.intfc.IFmeaService
;
import
com.yeejoin.amos.fas.business.service.intfc.IFmeaService
;
...
@@ -20,20 +34,8 @@ import com.yeejoin.amos.fas.dao.entity.Fmea;
...
@@ -20,20 +34,8 @@ import com.yeejoin.amos.fas.dao.entity.Fmea;
import
com.yeejoin.amos.fas.dao.entity.RiskFactor
;
import
com.yeejoin.amos.fas.dao.entity.RiskFactor
;
import
com.yeejoin.amos.fas.dao.entity.RiskLevel
;
import
com.yeejoin.amos.fas.dao.entity.RiskLevel
;
import
com.yeejoin.amos.fas.dao.entity.RiskSource
;
import
com.yeejoin.amos.fas.dao.entity.RiskSource
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
org.bouncycastle.util.Arrays
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
(
"fmeaService"
)
@Service
(
"fmeaService"
)
public
class
FmeaServiceImpl
implements
IFmeaService
{
public
class
FmeaServiceImpl
implements
IFmeaService
{
...
@@ -120,26 +122,6 @@ public class FmeaServiceImpl implements IFmeaService {
...
@@ -120,26 +122,6 @@ public class FmeaServiceImpl implements IFmeaService {
}
}
// public void updateRpniInfo(Long riskSourceId) {
//
//
// new Thread(() ->
// {
// String batchNo = UUID.randomUUID().toString();
//
// List<RiskSource> riskSources = new ArrayList<>();
//
// RiskSource riskSource = this.iRiskSourceDao.findById(riskSourceId);
// riskSources.add(riskSource);
// try {
// asymbleWithParent(batchNo, riskSources, RiskFactor.class.getSimpleName());
// } catch (Exception e) {
// e.printStackTrace();
// }
// }).start();
//
// }
@Override
@Override
public
int
queryControlObjCount
(
String
[]
ids
)
{
public
int
queryControlObjCount
(
String
[]
ids
)
{
int
count1
=
iFmeaDao
.
countAssociatedEquipPointByIds
(
ids
);
int
count1
=
iFmeaDao
.
countAssociatedEquipPointByIds
(
ids
);
...
@@ -150,48 +132,6 @@ public class FmeaServiceImpl implements IFmeaService {
...
@@ -150,48 +132,6 @@ public class FmeaServiceImpl implements IFmeaService {
return
0
;
//没有关联对象
return
0
;
//没有关联对象
}
}
// private boolean asymbleWithParent(String bacthNo, List<RiskSource> riskSourceList, String from) throws Exception {
// if (!CollectionUtils.isEmpty(riskSourceList)) {
// for (RiskSource riskSource : riskSourceList) {
// //当前规则
// RiskSourceRo riskSourceRo = this.transfer(bacthNo, riskSource, from, new BigDecimal(0));
//
// Object result = remoteRuleServer.fireRule(riskSourceRo, "风险管控/riskFactor");
// BigDecimal RPNi = updateRpn(result, riskSource, null);
// //处理返回结果
//
// //反查 父级风险点,取得处于第二级的父级风险点
// findParent(bacthNo, riskSource, RPNi);
// }
// }
// return true;
// }
// /**
// * 查询父节点风险点
// *
// * @param riskSource
// * @param RPNi
// * @return
// */
// private BigDecimal findParent(String bacthNo, RiskSource riskSource,
// BigDecimal RPNi) throws Exception {
// if (riskSource != null && riskSource.getId() != 0 && RPNi.doubleValue() != 0) {
// RiskSource parent = this.iRiskSourceDao.findOne(riskSource.getParentId());
// if (null != parent) {
// RiskSourceRo parentRiskResource = this.transfer(bacthNo, parent, "child", RPNi);
// Object result = remoteRuleServer.fireRule(parentRiskResource, "风险管控/riskFactorParent");
// updateRpn(result, parent, RPNi);
//
// if (parent.getParentId() != 0)
// this.findParent(bacthNo, parent, RPNi);
// }
// }
//
// return RPNi;
// }
private
RiskSourceRo
transfer
(
String
bacthNo
,
RiskSource
riskSource
,
String
from
,
BigDecimal
rpni
)
{
private
RiskSourceRo
transfer
(
String
bacthNo
,
RiskSource
riskSource
,
String
from
,
BigDecimal
rpni
)
{
RiskSourceRo
riskSourceRo
=
new
RiskSourceRo
();
RiskSourceRo
riskSourceRo
=
new
RiskSourceRo
();
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
66bc74c0
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.UUID
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.stream.Collectors
;
import
javax.annotation.PostConstruct
;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.component.cache.Redis
;
import
org.typroject.tyboot.component.cache.enumeration.CacheType
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
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.alibaba.fastjson.JSONObject
;
...
@@ -8,13 +49,40 @@ import com.google.common.collect.Lists;
...
@@ -8,13 +49,40 @@ 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.component.rule.RuleTrigger
;
import
com.yeejoin.amos.fas.business.action.model.*
;
import
com.yeejoin.amos.fas.business.action.model.CheckInputItemRo
;
import
com.yeejoin.amos.fas.business.action.model.ContingencyRo
;
import
com.yeejoin.amos.fas.business.action.model.DeviceRo
;
import
com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo
;
import
com.yeejoin.amos.fas.business.action.model.ProtalDataRo
;
import
com.yeejoin.amos.fas.business.action.model.RiskSourceRuleRo
;
import
com.yeejoin.amos.fas.business.action.model.SetpEnum
;
import
com.yeejoin.amos.fas.business.action.mq.WebMqttComponent
;
import
com.yeejoin.amos.fas.business.action.mq.WebMqttComponent
;
import
com.yeejoin.amos.fas.business.bo.*
;
import
com.yeejoin.amos.fas.business.bo.BindRegionBo
;
import
com.yeejoin.amos.fas.business.bo.JpushMsgBo
;
import
com.yeejoin.amos.fas.business.bo.JpushMsgContentBo
;
import
com.yeejoin.amos.fas.business.bo.MsgParamBo
;
import
com.yeejoin.amos.fas.business.bo.RpnCalculationBo
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.dao.mapper.*
;
import
com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FireEquipPointMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FmeaEquipmentPointMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FmeaMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.FmeaPointInputitemMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.RiskSourceMapper
;
import
com.yeejoin.amos.fas.business.dao.mongo.EquipCommunicationDao
;
import
com.yeejoin.amos.fas.business.dao.mongo.EquipCommunicationDao
;
import
com.yeejoin.amos.fas.business.dao.repository.*
;
import
com.yeejoin.amos.fas.business.dao.repository.IAlarmDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IDictDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IEvaluationModelDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentPointDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRiskFactorDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRiskSourceDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IRpnChangeLogDao
;
import
com.yeejoin.amos.fas.business.feign.IEquipManageFeign
;
import
com.yeejoin.amos.fas.business.feign.IEquipManageFeign
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.feign.RemoteSecurityService
;
import
com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer
;
import
com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer
;
...
@@ -29,7 +97,11 @@ import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService;
...
@@ -29,7 +97,11 @@ import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService;
import
com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService
;
import
com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService
;
import
com.yeejoin.amos.fas.business.service.intfc.IView3dService
;
import
com.yeejoin.amos.fas.business.service.intfc.IView3dService
;
import
com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus
;
import
com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus
;
import
com.yeejoin.amos.fas.business.util.*
;
import
com.yeejoin.amos.fas.business.util.CacheFactory
;
import
com.yeejoin.amos.fas.business.util.CacheMap
;
import
com.yeejoin.amos.fas.business.util.DateUtils
;
import
com.yeejoin.amos.fas.business.util.JexlUtil
;
import
com.yeejoin.amos.fas.business.util.RpnUtils
;
import
com.yeejoin.amos.fas.business.vo.EquipCommunicationData
;
import
com.yeejoin.amos.fas.business.vo.EquipCommunicationData
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.fas.client.invoke.RsDataQueue
;
import
com.yeejoin.amos.fas.client.invoke.RsDataQueue
;
...
@@ -41,39 +113,24 @@ import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
...
@@ -41,39 +113,24 @@ import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
import
com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse
;
import
com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.StringUtil
;
import
com.yeejoin.amos.fas.core.util.StringUtil
;
import
com.yeejoin.amos.fas.dao.entity.*
;
import
com.yeejoin.amos.fas.dao.entity.Alarm
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData
;
import
com.yeejoin.amos.fas.dao.entity.Dict
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
com.yeejoin.amos.fas.dao.entity.EvaluationModel
;
import
com.yeejoin.amos.fas.dao.entity.FireEquipment
;
import
com.yeejoin.amos.fas.dao.entity.FireEquipmentData
;
import
com.yeejoin.amos.fas.dao.entity.FireEquipmentPoint
;
import
com.yeejoin.amos.fas.dao.entity.Fmea
;
import
com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint
;
import
com.yeejoin.amos.fas.dao.entity.FmeaPointInputitem
;
import
com.yeejoin.amos.fas.dao.entity.PreplanPicture
;
import
com.yeejoin.amos.fas.dao.entity.RiskFactor
;
import
com.yeejoin.amos.fas.dao.entity.RiskLevel
;
import
com.yeejoin.amos.fas.dao.entity.RiskSource
;
import
com.yeejoin.amos.fas.dao.entity.RpnChangeLog
;
import
com.yeejoin.amos.fas.exception.YeeException
;
import
com.yeejoin.amos.fas.exception.YeeException
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.component.cache.Redis
;
import
org.typroject.tyboot.component.cache.enumeration.CacheType
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.annotation.PostConstruct
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.stream.Collectors
;
@Service
(
"riskSourceService"
)
@Service
(
"riskSourceService"
)
...
@@ -556,19 +613,13 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -556,19 +613,13 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
contingencyRo
.
setEquipmentName
(
equipment
.
getName
());
contingencyRo
.
setEquipmentName
(
equipment
.
getName
());
contingencyRo
.
setFireEquipmentId
(
String
.
valueOf
(
fireEquipment
.
getId
()));
contingencyRo
.
setFireEquipmentId
(
String
.
valueOf
(
fireEquipment
.
getId
()));
contingencyRo
.
setFireEquipmentName
(
fireEquipment
.
getName
());
contingencyRo
.
setFireEquipmentName
(
fireEquipment
.
getName
());
// if (ObjectUtils.isEmpty(oldContingencyRo)) {
// contingencyRo.setStep(SetpEnum.STEP0.getValue());
// } else {
// contingencyRo.setStep(((ContingencyRo)oldContingencyRo).getStep());
// }
contingencyRo
.
setStep
(
SetpEnum
.
STEP0
.
getValue
());
contingencyRo
.
setStep
(
SetpEnum
.
STEP0
.
getValue
());
contingencyRo
.
setConfirm
(
"NONE"
);
contingencyRo
.
setConfirm
(
"NONE"
);
contingencyRo
.
setFireTruckRoute
(
equipment
.
getFireTruckRoute
());
contingencyRo
.
setFireTruckRoute
(
equipment
.
getFireTruckRoute
());
contingencyRo
.
setRunstep
(
false
);
contingencyRo
.
setRunstep
(
false
);
contingencyRo
.
setEquipmentPosition3d
(
equipment
.
getPosition3d
());
contingencyRo
.
setEquipmentPosition3d
(
equipment
.
getPosition3d
());
contingencyRo
.
setEquipmentCode
(
equipment
.
getCode
());
contingencyRo
.
setEquipmentCode
(
equipment
.
getCode
());
contingencyRo
.
setEquipmentOrgCode
(
equipment
.
getOrgCode
());
Map
cameraInfo
=
impAndFireEquipMapper
.
queryForCamera
(
String
.
valueOf
(
equipment
.
getId
()));
Map
cameraInfo
=
impAndFireEquipMapper
.
queryForCamera
(
String
.
valueOf
(
equipment
.
getId
()));
...
@@ -702,7 +753,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -702,7 +753,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Override
@Override
public
boolean
processTaskData
(
ProtalDataRo
taskData
)
throws
Exception
{
public
boolean
processTaskData
(
ProtalDataRo
taskData
)
throws
Exception
{
taskData
.
setBatchNo
(
UUID
.
randomUUID
().
toString
());
taskData
.
setBatchNo
(
UUID
.
randomUUID
().
toString
());
//Object result = remoteRuleServer.fireRule(taskData, "风险管控/patrol");
return
true
;
return
true
;
}
}
...
@@ -856,14 +906,15 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -856,14 +906,15 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
log
.
warn
(
"alarmParam is empty!"
);
log
.
warn
(
"alarmParam is empty!"
);
}
else
{
}
else
{
try
{
try
{
Toke
toke
=
cacheMap
.
getValue
(
TOKE
);
if
(
toke
==
null
)
{
// Toke toke = cacheMap.getValue(TOKE);
toke
=
remoteSecurityService
.
come
();
// if (toke == null) {
Long
times
=
(
long
)
(
20
*
24
*
60
*
60
);
// toke = remoteSecurityService.come();
cacheMap
.
setex
(
TOKE
,
toke
,
times
);
// Long times = (long) (20 * 24 * 60 * 60);
}
// cacheMap.setex(TOKE, toke, times);
log
.
error
(
"rule token "
,
toke
.
toString
());
// }
processDeivceData
(
deviceData
,
toke
);
// log.error("rule token ", toke.toString());
processDeivceData
(
deviceData
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"parse alarmParam happened error"
,
e
);
log
.
error
(
"parse alarmParam happened error"
,
e
);
// 失败处理
// 失败处理
...
@@ -875,48 +926,51 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -875,48 +926,51 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
}
private
void
processDeivceData
(
AlarmParam
deviceData
,
Toke
toke
)
{
private
void
processDeivceData
(
AlarmParam
deviceData
)
{
//处理设备和巡检数据
//处理设备和巡检数据
deviceData
.
setNodeState
(
deviceData
.
getState
());
deviceData
.
setNodeState
(
deviceData
.
getState
());
FireEquipmentPoint
fireEquipmentPoint
=
iFireEquipmentPointDao
.
findOneByCode
(
deviceData
.
getPointCode
());
FireEquipmentPoint
fireEquipmentPoint
=
iFireEquipmentPointDao
.
findOneByCode
(
deviceData
.
getPointCode
());
fireEquipmentPoint
.
setValue
(
deviceData
.
getState
());
if
(!
ObjectUtils
.
isEmpty
(
fireEquipmentPoint
)){
updateFirePointValue
(
fireEquipmentPoint
.
getId
(),
deviceData
.
getState
());
fireEquipmentPoint
.
setValue
(
deviceData
.
getState
());
String
fireEquipmentPointType
=
null
;
updateFirePointValue
(
fireEquipmentPoint
.
getId
(),
deviceData
.
getState
());
if
(!
ObjectUtils
.
isEmpty
(
fireEquipmentPoint
.
getAlarmType
()))
{
Dict
dict
=
dictDao
.
getOne
(
fireEquipmentPoint
.
getAlarmType
());
String
fireEquipmentPointType
=
null
;
fireEquipmentPointType
=
dict
.
getDictValue
();
if
(!
ObjectUtils
.
isEmpty
(
fireEquipmentPoint
.
getAlarmType
()))
{
}
Dict
dict
=
dictDao
.
getOne
(
fireEquipmentPoint
.
getAlarmType
());
fireEquipmentPointType
=
dict
.
getDictValue
();
// 根据监测点获取监测点设备信息
}
Optional
<
FireEquipment
>
fireEquipment1
=
this
.
iFireEquipmentDao
.
findById
(
fireEquipmentPoint
.
getFireEquipmentId
());
FireEquipment
fireEquipment
=
null
;
if
(
fireEquipment1
.
isPresent
())
{
fireEquipment
=
fireEquipment1
.
get
();
}
Equipment
equipment
=
null
;
if
(
fireEquipment
!=
null
)
{
//保存实时数据
// 根据监测点获取监测点设备信息
// 根据监测点设备信息获取保护的重点装备
Optional
<
FireEquipment
>
fireEquipment1
=
this
.
iFireEquipmentDao
.
findById
(
fireEquipmentPoint
.
getFireEquipmentId
());
equipment
=
impAndFireEquipMapper
.
queryImpEqumtByFireEquipmt
(
fireEquipmentPoint
.
getFireEquipmentId
());
FireEquipment
fireEquipment
=
null
;
deviceData
.
setMonitor
(
equipment
!=
null
?
equipment
.
getName
():
""
);
if
(
fireEquipment1
.
isPresent
())
{
deviceData
.
setId
(
String
.
valueOf
(
fireEquipment
.
getId
()));
fireEquipment
=
fireEquipment1
.
get
();
deviceData
.
setCode
(
fireEquipment
.
getCode
());
saveFireEquipmentData
(
fireEquipmentPoint
,
fireEquipment
,
deviceData
,
fireEquipmentPointType
,
toke
);
DeviceRo
deviceRo
=
new
DeviceRo
();
deviceRo
.
setEquipmentId
(
equipment
.
getId
());
deviceRo
.
setPointCode
(
deviceData
.
getPointCode
());
deviceRo
.
setValue
(
deviceData
.
getState
());
triggerPlanDevice
(
deviceRo
,
equipment
,
toke
);
Boolean
have
=
impAndFireEquipMapper
.
existsAlarmPointByEqpPointIdAndEquipId
(
fireEquipmentPoint
.
getId
(),
equipment
.
getId
());
if
(!
ObjectUtils
.
isEmpty
(
have
)
&&
have
)
{
//动态预案执行
dynamicPlan
(
deviceData
,
equipment
,
fireEquipment
,
toke
);
}
}
Equipment
equipment
=
null
;
if
(
fireEquipment
!=
null
)
{
Toke
toke
=
remoteSecurityService
.
getServerToken
();
//保存实时数据
// 根据监测点设备信息获取保护的重点装备
equipment
=
impAndFireEquipMapper
.
queryImpEqumtByFireEquipmt
(
fireEquipmentPoint
.
getFireEquipmentId
());
deviceData
.
setMonitor
(
equipment
!=
null
?
equipment
.
getName
():
""
);
deviceData
.
setId
(
String
.
valueOf
(
fireEquipment
.
getId
()));
deviceData
.
setCode
(
fireEquipment
.
getCode
());
saveFireEquipmentData
(
fireEquipmentPoint
,
fireEquipment
,
deviceData
,
fireEquipmentPointType
,
toke
);
DeviceRo
deviceRo
=
new
DeviceRo
();
deviceRo
.
setEquipmentId
(
equipment
.
getId
());
deviceRo
.
setPointCode
(
deviceData
.
getPointCode
());
deviceRo
.
setValue
(
deviceData
.
getState
());
triggerPlanDevice
(
deviceRo
,
equipment
,
toke
);
Boolean
have
=
impAndFireEquipMapper
.
existsAlarmPointByEqpPointIdAndEquipId
(
fireEquipmentPoint
.
getId
(),
equipment
.
getId
());
if
(!
ObjectUtils
.
isEmpty
(
have
)
&&
have
)
{
//动态预案执行
dynamicPlan
(
deviceData
,
equipment
,
fireEquipment
,
toke
);
}
}
}
}
}
}
/**
/**
...
@@ -1017,9 +1071,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
...
@@ -1017,9 +1071,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
deviceData
.
setMonitor
(
equipment
.
getName
());
deviceData
.
setMonitor
(
equipment
.
getName
());
deviceData
.
setEquimentId
(
String
.
valueOf
(
equipment
.
getId
()));
deviceData
.
setEquimentId
(
String
.
valueOf
(
equipment
.
getId
()));
//Object result = remoteRuleServer.fireRule(deviceData, "风险管控/fireEquiment");
//处理返回结果
List
<
RiskSource
>
riskSources
=
this
.
riskSourceMapper
.
queryByFireEqument
(
deviceData
.
getFireEquimentId
());
List
<
RiskSource
>
riskSources
=
this
.
riskSourceMapper
.
queryByFireEqument
(
deviceData
.
getFireEquimentId
());
//asymbleWithParent(batchNo, riskSources, FireEquimentDataRo.class.getSimpleName(), deviceData.getFireEquimentId(), deviceData.getNodeState(), null, null);
//asymbleWithParent(batchNo, riskSources, FireEquimentDataRo.class.getSimpleName(), deviceData.getFireEquimentId(), deviceData.getNodeState(), null, null);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/View3dServiceImpl.java
View file @
66bc74c0
...
@@ -661,12 +661,6 @@ public class View3dServiceImpl implements IView3dService {
...
@@ -661,12 +661,6 @@ public class View3dServiceImpl implements IView3dService {
return
pointList
;
return
pointList
;
}
}
@Override
public
Map
<
String
,
String
>
getDutyListByDate
()
{
ContingencyAction
contingencyAction
=
new
ContingencyAction
();
Map
<
String
,
String
>
f1
=
contingencyAction
.
getStrengthMap
(
"F1"
);
return
f1
;
}
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
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IView3dService.java
View file @
66bc74c0
...
@@ -174,5 +174,4 @@ public interface IView3dService {
...
@@ -174,5 +174,4 @@ public interface IView3dService {
*/
*/
List
<
Map
<
String
,
Object
>>
listPointsByRegionId
(
Long
regionId
,
String
type
);
List
<
Map
<
String
,
Object
>>
listPointsByRegionId
(
Long
regionId
,
String
type
);
Map
<
String
,
String
>
getDutyListByDate
();
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/util/HttpUtil.java
View file @
66bc74c0
package
com
.
yeejoin
.
amos
.
fas
.
business
.
util
;
//
package com.yeejoin.amos.fas.business.util;
//
import
com.alibaba.fastjson.JSONObject
;
//
import com.alibaba.fastjson.JSONObject;
import
com.fasterxml.jackson.databind.ObjectMapper
;
//
import com.fasterxml.jackson.databind.ObjectMapper;
import
org.springframework.beans.factory.annotation.Value
;
//
import org.springframework.beans.factory.annotation.Value;
import
org.springframework.http.*
;
//
import org.springframework.http.*;
import
org.springframework.http.client.SimpleClientHttpRequestFactory
;
//
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import
org.springframework.stereotype.Component
;
//
import org.springframework.stereotype.Component;
import
org.springframework.util.ObjectUtils
;
//
import org.springframework.util.ObjectUtils;
import
org.springframework.web.client.RestTemplate
;
//
import org.springframework.web.client.RestTemplate;
//
import
static
com
.
yeejoin
.
amos
.
fas
.
business
.
constants
.
FasConstant
.*;
//
import static com.yeejoin.amos.fas.business.constants.FasConstant.*;
//
@Component
//
@Component
public
class
HttpUtil
{
//
public class HttpUtil {
//
private
ObjectMapper
objectMapper
=
new
ObjectMapper
();
//
private ObjectMapper objectMapper = new ObjectMapper();
//
private
static
String
dutyUrl
;
//
private static String dutyUrl;
//
@Value
(
"${DutyMode.dutyUrl}"
)
//
@Value("${DutyMode.dutyUrl}")
public
void
setDutyUrl
(
String
dutyUrl
)
{
//
public void setDutyUrl(String dutyUrl) {
HttpUtil
.
dutyUrl
=
dutyUrl
;
//
HttpUtil.dutyUrl = dutyUrl;
}
//
}
//
public
static
String
doGet
(
String
url
)
{
//
public static String doGet(String url) {
SimpleClientHttpRequestFactory
requestFactory
=
new
SimpleClientHttpRequestFactory
();
//
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory
.
setConnectTimeout
(
2000
);
//
requestFactory.setConnectTimeout(2000);
RestTemplate
restTemplate
=
new
RestTemplate
(
requestFactory
);
//
RestTemplate restTemplate = new RestTemplate(requestFactory);
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
//
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders
.
setContentType
(
MediaType
.
TEXT_HTML
);
//
httpHeaders.setContentType(MediaType.TEXT_HTML);
httpHeaders
.
setContentType
(
MediaType
.
APPLICATION_JSON_UTF8
);
//
httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
HttpEntity
<
String
>
httpEntity
=
new
HttpEntity
(
httpHeaders
);
//
HttpEntity<String> httpEntity = new HttpEntity(httpHeaders);
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
GET
,
httpEntity
,
String
.
class
);
//
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, String.class);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
.
getBody
());
//
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
return
jsonObject
.
toString
();
//
return jsonObject.toString();
}
//
}
//
//
public
static
String
PostJson
(
String
url
,
String
json
)
{
//
public static String PostJson(String url, String json) {
SimpleClientHttpRequestFactory
requestFactory
=
new
SimpleClientHttpRequestFactory
();
//
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory
.
setConnectTimeout
(
2000
);
//
requestFactory.setConnectTimeout(2000);
RestTemplate
restTemplate
=
new
RestTemplate
(
requestFactory
);
//
RestTemplate restTemplate = new RestTemplate(requestFactory);
//
HttpHeaders
headers
=
new
HttpHeaders
();
//
HttpHeaders headers = new HttpHeaders();
HttpMethod
method
=
HttpMethod
.
POST
;
//
HttpMethod method = HttpMethod.POST;
// 以表单的方式提交
//
// 以表单的方式提交
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON_UTF8
);
//
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
headers
.
add
(
"X-From-Service"
,
"true"
);
//
headers.add("X-From-Service", "true");
//将请求头部和参数合成一个请求
//
//将请求头部和参数合成一个请求
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
json
,
headers
);
//
HttpEntity<String> requestEntity = new HttpEntity<>(json, headers);
//执行HTTP请求,将返回的结构使用ResultVO类格式化
//
//执行HTTP请求,将返回的结构使用ResultVO类格式化
ResponseEntity
<
String
>
response
=
restTemplate
.
postForEntity
(
url
,
requestEntity
,
String
.
class
);
//
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
//
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
.
getBody
());
//
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
return
jsonObject
.
toString
();
//
return jsonObject.toString();
}
//
}
//
//
public
static
String
doPostJson
(
String
url
,
String
json
)
{
//
public static String doPostJson(String url, String json) {
if
(
ObjectUtils
.
isEmpty
(
url
)){
//
if (ObjectUtils.isEmpty(url)){
url
=
dutyUrl
;
//
url = dutyUrl;
}
//
}
SimpleClientHttpRequestFactory
requestFactory
=
new
SimpleClientHttpRequestFactory
();
//
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory
.
setConnectTimeout
(
2000
);
//
requestFactory.setConnectTimeout(2000);
RestTemplate
restTemplate
=
new
RestTemplate
(
requestFactory
);
//
RestTemplate restTemplate = new RestTemplate(requestFactory);
//
HttpHeaders
headers
=
new
HttpHeaders
();
//
HttpHeaders headers = new HttpHeaders();
HttpMethod
method
=
HttpMethod
.
POST
;
//
HttpMethod method = HttpMethod.POST;
// 以表单的方式提交
//
// 以表单的方式提交
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON_UTF8
);
//
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
headers
.
set
(
"appKey"
,
appKey
);
//
headers.set("appKey", appKey);
headers
.
set
(
"product"
,
product
);
//
headers.set("product", product);
headers
.
set
(
"token"
,
token
);
//
headers.set("token", token);
headers
.
set
(
"orgCode"
,
staticOrgCode
);
//
headers.set("orgCode", staticOrgCode);
headers
.
set
(
"X-Access-Token"
,
token
);
//
headers.set("X-Access-Token", token);
//将请求头部和参数合成一个请求
//
//将请求头部和参数合成一个请求
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
json
,
headers
);
//
HttpEntity<String> requestEntity = new HttpEntity<>(json, headers);
//执行HTTP请求,将返回的结构使用ResultVO类格式化
//
//执行HTTP请求,将返回的结构使用ResultVO类格式化
ResponseEntity
<
String
>
response
=
restTemplate
.
postForEntity
(
url
,
requestEntity
,
String
.
class
);
//
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
//
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
.
getBody
());
//
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
return
jsonObject
.
toString
();
//
return jsonObject.toString();
}
//
}
//
public
static
String
appendPostJson
(
String
suffix
,
String
json
)
{
//
public static String appendPostJson(String suffix,String json) {
String
url
=
dutyUrl
+
suffix
;
//
String url = dutyUrl + suffix;
SimpleClientHttpRequestFactory
requestFactory
=
new
SimpleClientHttpRequestFactory
();
//
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory
.
setConnectTimeout
(
2000
);
//
requestFactory.setConnectTimeout(2000);
RestTemplate
restTemplate
=
new
RestTemplate
(
requestFactory
);
//
RestTemplate restTemplate = new RestTemplate(requestFactory);
//
HttpHeaders
headers
=
new
HttpHeaders
();
//
HttpHeaders headers = new HttpHeaders();
HttpMethod
method
=
HttpMethod
.
POST
;
//
HttpMethod method = HttpMethod.POST;
// 以表单的方式提交
//
// 以表单的方式提交
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON_UTF8
);
//
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
headers
.
set
(
"appKey"
,
appKey
);
//
headers.set("appKey", appKey);
headers
.
set
(
"product"
,
product
);
//
headers.set("product", product);
headers
.
set
(
"token"
,
token
);
//
headers.set("token", token);
headers
.
set
(
"orgCode"
,
staticOrgCode
);
//
headers.set("orgCode", staticOrgCode);
headers
.
set
(
"X-Access-Token"
,
token
);
//
headers.set("X-Access-Token", token);
//将请求头部和参数合成一个请求
//
//将请求头部和参数合成一个请求
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
json
,
headers
);
//
HttpEntity<String> requestEntity = new HttpEntity<>(json, headers);
//执行HTTP请求,将返回的结构使用ResultVO类格式化
//
//执行HTTP请求,将返回的结构使用ResultVO类格式化
ResponseEntity
<
String
>
response
=
restTemplate
.
postForEntity
(
url
,
requestEntity
,
String
.
class
);
//
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
//
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
.
getBody
());
//
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
return
jsonObject
.
toString
();
//
return jsonObject.toString();
}
//
}
}
//
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/client/invoke/RsDataQueue.java
View file @
66bc74c0
...
@@ -102,14 +102,15 @@ public class RsDataQueue {
...
@@ -102,14 +102,15 @@ public class RsDataQueue {
try
{
try
{
FmeaMessage
fmeaMessage
=
blockingQueue
.
take
();
FmeaMessage
fmeaMessage
=
blockingQueue
.
take
();
if
(
riskSourceService
!=
null
)
{
if
(
riskSourceService
!=
null
)
{
//获取缓存
//获取缓存
CacheMap
cacheMap
=
CacheFactory
.
newChacheMap
();
Toke
toke
=
remoteSecurityService
.
getServerToken
();
Toke
toke
=
cacheMap
.
getValue
(
TOKE
);
// CacheMap cacheMap = CacheFactory.newChacheMap();
if
(
toke
==
null
)
{
// Toke toke = cacheMap.getValue(TOKE);
toke
=
remoteSecurityService
.
come
();
// if (toke == null) {
Long
times
=
(
long
)
(
20
*
24
*
60
*
60
);
// toke = remoteSecurityService.come();
cacheMap
.
setex
(
TOKE
,
toke
,
times
);
// Long times = (long) (20 * 24 * 60 * 60);
}
// cacheMap.setex(TOKE, toke, times);
// }
String
from
=
fmeaMessage
.
getNorifyFrom
();
String
from
=
fmeaMessage
.
getNorifyFrom
();
Long
handId
=
fmeaMessage
.
getHandId
();
Long
handId
=
fmeaMessage
.
getHandId
();
String
userName
=
fmeaMessage
.
getUserName
();
String
userName
=
fmeaMessage
.
getUserName
();
...
...
YeeAmosFireAutoSysStart/src/main/resources/application-dev.properties
View file @
66bc74c0
...
@@ -28,7 +28,7 @@ spring.data.mongodb.uri = mongodb://172.16.11.33:27017/iecmonitor
...
@@ -28,7 +28,7 @@ spring.data.mongodb.uri = mongodb://172.16.11.33:27017/iecmonitor
#rule
#rule
#params.remoteRuleUrl=http://172.16.3.3:8080/
#params.remoteRuleUrl=http://172.16.3.3:8080/
params.remoteRuleUrl
=
http://magintursh.xicp.net:18080/
params.remoteRuleUrl
=
http://magintursh.xicp.net:18080/
params.remoteWebsocketUrl
=
http://172.16.1
0.72
:10600/
params.remoteWebsocketUrl
=
http://172.16.1
1.36
:10600/
spring.redis.database
=
0
spring.redis.database
=
0
spring.redis.host
=
172.16.10.85
spring.redis.host
=
172.16.10.85
...
@@ -56,14 +56,15 @@ emqx.password=a123456
...
@@ -56,14 +56,15 @@ emqx.password=a123456
Push.fegin.name
=
APPMESSAGEPUSHSERVICE-36
Push.fegin.name
=
APPMESSAGEPUSHSERVICE-36
dutyMode.fegin.name
=
AMOSDUTYMODE
dutyMode.fegin.name
=
AMOSDUTYMODE
DutyMode.dutyUrl
=
http://172.16.10.72:10005/
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load
=
true
rule.definition.load
=
true
rule.definition.model-package
=
com.yeejoin.amos.fas.business.action.model
rule.definition.model-package
=
com.yeejoin.amos.fas.business.action.model
rule.definition.default-agency
=
STATE_GRID
rule.definition.default-agency
=
STATE_GRID
#Fegin service config
amos.feign.gennerator.use-gateway
=
true
amos.feign.gennerator.use-gateway
=
true
autoSys.push.type
=
mqtt
autoSys.push.type
=
mqtt
#�����
#�����
...
...
YeeAmosFireAutoSysStart/src/main/resources/application-docker.properties
View file @
66bc74c0
...
@@ -55,8 +55,7 @@ emqx.user-name=super
...
@@ -55,8 +55,7 @@ emqx.user-name=super
emqx.password
=
a123456
emqx.password
=
a123456
Push.fegin.name
=
AMOS-PUSH
Push.fegin.name
=
AMOS-PUSH
dutyMode.fegin.name
=
AMOS-DUTY
dutyMode.fegin.name
=
AMOSDUTYMODE
DutyMode.dutyUrl
=
http://172.16.11.36:10005/
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load
=
true
rule.definition.load
=
true
...
...
YeeAmosFireAutoSysStart/src/main/resources/application-test.properties
View file @
66bc74c0
...
@@ -55,8 +55,7 @@ emqx.user-name=super
...
@@ -55,8 +55,7 @@ emqx.user-name=super
emqx.password
=
a123456
emqx.password
=
a123456
Push.fegin.name
=
PPMESSAGEPUSHSERVICE15
Push.fegin.name
=
PPMESSAGEPUSHSERVICE15
dutyMode.fegin.name
=
AMOS-DUTY
dutyMode.fegin.name
=
AMOSDUTYMODE
DutyMode.dutyUrl
=
http://172.16.11.36:10005/
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load
=
true
rule.definition.load
=
true
...
...
YeeAmosFireAutoSysStart/src/main/resources/application.properties
View file @
66bc74c0
spring.application.name
=
A
MOS-AUTOSYS
spring.application.name
=
A
mos-autosys
server.port
=
8083
server.port
=
8083
...
...
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