Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
0bdd5b54
Commit
0bdd5b54
authored
Oct 08, 2022
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码同步
parent
9eac2ec1
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
754 additions
and
295 deletions
+754
-295
WorkflowFeignService.java
.../boot/biz/common/workflow/feign/WorkflowFeignService.java
+75
-0
ConfigPageTopicEnum.java
...yeejoin/equipmanage/common/enums/ConfigPageTopicEnum.java
+1
-1
EquipmentIotMqttReceiveConfig.java
...oin/equipmanage/config/EquipmentIotMqttReceiveConfig.java
+2
-2
RemoteWorkFlowService.java
...mos/latentdanger/common/remote/RemoteWorkFlowService.java
+152
-59
RemoteWorkFlowService.java
...join/amos/patrol/common/remote/RemoteWorkFlowService.java
+235
-103
RemoteWorkFlowService.java
...amos/supervision/common/remote/RemoteWorkFlowService.java
+239
-117
application.properties
...ot-system-equip/src/main/resources/application.properties
+8
-0
application.properties
...boot-system-fas/src/main/resources/application.properties
+1
-1
application.properties
...boot-system-jcs/src/main/resources/application.properties
+8
-11
JpushApplication.java
...push/src/main/java/com/yeejoin/amos/JpushApplication.java
+1
-1
WebSecurityConfig.java
...java/com/yeejoin/amos/jpush/config/WebSecurityConfig.java
+28
-0
pom.xml
amos-boot-utils/pom.xml
+4
-0
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/workflow/feign/WorkflowFeignService.java
View file @
0bdd5b54
...
@@ -214,4 +214,79 @@ public interface WorkflowFeignService {
...
@@ -214,4 +214,79 @@ public interface WorkflowFeignService {
*/
*/
@RequestMapping
(
value
=
"/activitiHistory/getTaskListForTaskName/{taskName}/{definitionKey}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/activitiHistory/getTaskListForTaskName/{taskName}/{definitionKey}"
,
method
=
RequestMethod
.
GET
)
JSONObject
getTaskListForTaskName
(
@PathVariable
String
taskName
,
@PathVariable
String
definitionKey
)
throws
Exception
;
JSONObject
getTaskListForTaskName
(
@PathVariable
String
taskName
,
@PathVariable
String
definitionKey
)
throws
Exception
;
/*
//// * 发起流程
//// **/
@RequestMapping
(
value
=
"/task/startTask"
,
method
=
RequestMethod
.
POST
)
JSONObject
getTaskAssignDB
(
@RequestBody
JSONObject
variables
);
/*
* 任务详情
**/
@RequestMapping
(
value
=
"/task/{taskId}"
,
method
=
RequestMethod
.
GET
)
JSONObject
queryTaskDB
(
@PathVariable
(
"taskId"
)
String
taskId
);
/*
* 发起流程
**/
@RequestMapping
(
value
=
"/task/startProcess"
,
method
=
RequestMethod
.
POST
)
JSONObject
startByVariableDB
(
@RequestBody
HashMap
<
String
,
Object
>
variables
);
/*
* 所有已执行任务详情
**/
@RequestMapping
(
value
=
"/activitiHistory/task/detail/{taskId}"
,
method
=
RequestMethod
.
GET
)
JSONObject
queryHistoryTaskDetailDB
(
@PathVariable
(
"taskId"
)
String
taskId
);
/*
* 我的待办
**/
@RequestMapping
(
value
=
"/task"
,
method
=
RequestMethod
.
POST
)
JSONObject
getTaskDB
(
@RequestParam
(
value
=
"processInstanceId"
,
required
=
false
)
String
processInstanceId
);
/*
* 我的待办
**/
@RequestMapping
(
value
=
"/task/all-list"
,
method
=
RequestMethod
.
GET
)
JSONObject
getTaskAssignDB
(
@RequestParam
(
value
=
"userId"
,
required
=
false
)
String
userId
,
@RequestParam
(
value
=
"processDefinitionKey"
,
required
=
false
)
String
processDefinitionKey
);
/*
* 我的待办
**/
@RequestMapping
(
value
=
"/task/all-list"
,
method
=
RequestMethod
.
GET
)
JSONObject
getTaskAssignDBuser
(
@RequestParam
(
value
=
"processDefinitionKey"
,
required
=
false
)
String
processDefinitionKey
);
/*
* 所有已执行任务详情
**/
@RequestMapping
(
value
=
"/activitiHistory/all-historytasks"
,
method
=
RequestMethod
.
GET
)
JSONObject
queryAllHistoryTasksDB
(
@RequestParam
(
value
=
"processDefinitionKey"
,
required
=
false
)
String
processDefinitionKey
,
@RequestParam
(
value
=
"userId"
,
required
=
false
)
String
username
);
/*
* 所有已执行任务详情
**/
@RequestMapping
(
value
=
"/activitiHistory/all-historytasks"
,
method
=
RequestMethod
.
GET
)
JSONObject
queryAllHistoryTasksDBuser
(
@RequestParam
(
value
=
"processDefinitionKey"
,
required
=
false
)
String
processDefinitionKey
);
/*
* 所有已执行任务
**/
@RequestMapping
(
value
=
"/task/pickupAndCompleteTask/{taskID}"
,
method
=
RequestMethod
.
POST
)
JSONObject
pickupAndCompleteTaskDB
(
@PathVariable
(
"taskID"
)
String
taskID
,
@RequestBody
(
required
=
false
)
JSONObject
variable
);
/*
* 查询当前流程对应的可执行任务,无权限级别
**/
@RequestMapping
(
value
=
"/task/getTaskNoAuth/{processInstanceId}"
,
method
=
RequestMethod
.
GET
)
JSONObject
queryTaskNoAuthDB
(
@PathVariable
(
"processInstanceId"
)
String
processInstanceId
);
/*
* 我的待办
**/
@RequestMapping
(
value
=
"/task/list/all/{instanceId}"
,
method
=
RequestMethod
.
GET
)
JSONObject
getTaskListDB
(
@PathVariable
(
"instanceId"
)
String
instanceId
);
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/ConfigPageTopicEnum.java
View file @
0bdd5b54
...
@@ -16,7 +16,7 @@ import lombok.Getter;
...
@@ -16,7 +16,7 @@ import lombok.Getter;
@AllArgsConstructor
@AllArgsConstructor
public
enum
ConfigPageTopicEnum
{
public
enum
ConfigPageTopicEnum
{
INTEGRATE
(
"INTEGRATE_TOPIC/#"
,
"集成页面统配主题"
);
INTEGRATE
(
"
$share/AMOS-EQUIPMANAGE/
INTEGRATE_TOPIC/#"
,
"集成页面统配主题"
);
private
String
topic
;
private
String
topic
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/config/EquipmentIotMqttReceiveConfig.java
View file @
0bdd5b54
...
@@ -122,8 +122,8 @@ public class EquipmentIotMqttReceiveConfig {
...
@@ -122,8 +122,8 @@ public class EquipmentIotMqttReceiveConfig {
list
.
add
(
defaultTopic
);
list
.
add
(
defaultTopic
);
}
}
list
.
addAll
(
ConfigPageTopicEnum
.
getEnumTopicList
());
//大屏数据推送接口订阅
list
.
addAll
(
ConfigPageTopicEnum
.
getEnumTopicList
());
//大屏数据推送接口订阅
list
.
add
(
"+/+/property"
);
// 添加iot車輛裝備數據上報事件监听
list
.
add
(
"
$share/AMOS-EQUIPMANAGE/
+/+/property"
);
// 添加iot車輛裝備數據上報事件监听
list
.
add
(
"+/+/event"
);
// 添加iot事件监听
list
.
add
(
"
$share/AMOS-EQUIPMANAGE/
+/+/event"
);
// 添加iot事件监听
String
[]
arr
=
list
.
toArray
(
new
String
[
list
.
size
()]);
String
[]
arr
=
list
.
toArray
(
new
String
[
list
.
size
()]);
adapter
=
new
MqttPahoMessageDrivenChannelAdapter
(
clientId
+
"_inbound"
,
mqttPahoClientFactory
(),
arr
);
adapter
=
new
MqttPahoMessageDrivenChannelAdapter
(
clientId
+
"_inbound"
,
mqttPahoClientFactory
(),
arr
);
adapter
.
setCompletionTimeout
(
completionTimeout
);
adapter
.
setCompletionTimeout
(
completionTimeout
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/common/remote/RemoteWorkFlowService.java
View file @
0bdd5b54
package
com
.
yeejoin
.
amos
.
latentdanger
.
common
.
remote
;
package
com
.
yeejoin
.
amos
.
latentdanger
.
common
.
remote
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService
;
import
com.yeejoin.amos.latentdanger.common.enums.YesOrNoEnum
;
import
com.yeejoin.amos.latentdanger.common.enums.YesOrNoEnum
;
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.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -23,7 +27,7 @@ public class RemoteWorkFlowService {
...
@@ -23,7 +27,7 @@ public class RemoteWorkFlowService {
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
RemoteWorkFlowService
.
class
);
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
RemoteWorkFlowService
.
class
);
@Value
(
"${params.work.flow.address}"
)
//
@Value("${params.work.flow.address}")
private
String
address
;
private
String
address
;
private
static
final
String
success
=
"SUCCESS"
;
private
static
final
String
success
=
"SUCCESS"
;
...
@@ -33,6 +37,9 @@ public class RemoteWorkFlowService {
...
@@ -33,6 +37,9 @@ public class RemoteWorkFlowService {
@Value
(
"${params.work.flow.processDefinitionKey}"
)
@Value
(
"${params.work.flow.processDefinitionKey}"
)
private
String
processDefinitionKey
;
private
String
processDefinitionKey
;
@Autowired
private
WorkflowFeignService
workFlowFeign
;
private
String
buildUrl
(
String
address
,
WorkFlowUriEnum
workFlowUriEnum
,
Map
<
String
,
String
>
map
)
{
private
String
buildUrl
(
String
address
,
WorkFlowUriEnum
workFlowUriEnum
,
Map
<
String
,
String
>
map
)
{
String
uri
=
workFlowUriEnum
.
getUri
();
String
uri
=
workFlowUriEnum
.
getUri
();
String
params
=
workFlowUriEnum
.
getParams
();
String
params
=
workFlowUriEnum
.
getParams
();
...
@@ -65,17 +72,32 @@ public class RemoteWorkFlowService {
...
@@ -65,17 +72,32 @@ public class RemoteWorkFlowService {
return
handleResult
(
resultStr
);
return
handleResult
(
resultStr
);
}
}
private
JSONObject
handleResultDATE
(
JSONObject
json
)
{
if
(
json
==
null
)
{
return
null
;
}
if
(
"200"
.
equals
(
json
.
getString
(
"code"
)))
{
return
json
;
}
return
null
;
}
public
JSONObject
getChildNodeDetail
(
String
instanceId
)
{
public
JSONObject
getChildNodeDetail
(
String
instanceId
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"instanceId"
,
instanceId
);
JSONObject
js
=
workFlowFeign
.
getTaskListDB
(
instanceId
);
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
子节点信息
,
map
);
return
handleResultDATE
(
js
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
headerMap
.
put
(
Constants
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
Constants
.
PRODUCT
,
RequestContext
.
getProduct
());
// Map<String, String> map = Maps.newHashMap();
headerMap
.
put
(
Constants
.
APPKEY
,
RequestContext
.
getAppKey
());
// map.put("instanceId", instanceId);
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
// String url = buildUrl(address, WorkFlowUriEnum.子节点信息, map);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n请求参数=======================>"
+
instanceId
+
"\r\n返回参数=======================>"
+
resultStr
);
// Map<String, String> headerMap = Maps.newHashMap();
return
handleResult
(
resultStr
);
// headerMap.put(Constants.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(Constants.PRODUCT, RequestContext.getProduct());
// headerMap.put(Constants.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + instanceId + "\r\n返回参数=======================>" + resultStr);
// return handleResult(resultStr);
}
}
...
@@ -110,20 +132,32 @@ public class RemoteWorkFlowService {
...
@@ -110,20 +132,32 @@ public class RemoteWorkFlowService {
}
}
public
JSONObject
startNew
(
Long
dangerId
,
String
businessKey
,
String
processDefinitionKey
)
{
public
JSONObject
startNew
(
Long
dangerId
,
String
businessKey
,
String
processDefinitionKey
)
{
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
合并启动流程
,
null
);
HashMap
<
String
,
Object
>
body
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
headerMap
.
put
(
Constants
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
Constants
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
Constants
.
APPKEY
,
RequestContext
.
getAppKey
());
JSONObject
body
=
new
JSONObject
();
body
.
put
(
"businessKey"
,
businessKey
);
body
.
put
(
"businessKey"
,
businessKey
);
body
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
body
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
JSONObject
dangerIdJson
=
new
JSONObject
();
JSONObject
dangerIdJson
=
new
JSONObject
();
dangerIdJson
.
put
(
"dangerId"
,
dangerId
);
dangerIdJson
.
put
(
"dangerId"
,
dangerId
);
body
.
put
(
"variables"
,
dangerIdJson
);
body
.
put
(
"variables"
,
dangerIdJson
);
String
resultStr
=
HttpUtil
.
sendHttpPostJsonWithHeader
(
url
,
body
.
toJSONString
(),
headerMap
);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n请求参数=======================>"
+
body
+
"\r\n返回参数=======================>"
+
resultStr
);
JSONObject
js
=
workFlowFeign
.
startByVariableDB
(
body
);
return
JSON
.
parseObject
(
resultStr
);
return
js
;
// String url = buildUrl(address, WorkFlowUriEnum.合并启动流程, null);
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(Constants.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(Constants.PRODUCT, RequestContext.getProduct());
// headerMap.put(Constants.APPKEY, RequestContext.getAppKey());
// JSONObject body = new JSONObject();
// body.put("businessKey", businessKey);
// body.put("processDefinitionKey", processDefinitionKey);
// JSONObject dangerIdJson = new JSONObject();
// dangerIdJson.put("dangerId", dangerId);
// body.put("variables", dangerIdJson);
// String resultStr = HttpUtil.sendHttpPostJsonWithHeader(url, body.toJSONString(), headerMap);
// logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + body + "\r\n返回参数=======================>" + resultStr);
// return JSON.parseObject(resultStr);
}
}
public
JSONObject
stop
(
String
processInstanceId
)
{
public
JSONObject
stop
(
String
processInstanceId
)
{
...
@@ -141,17 +175,24 @@ public class RemoteWorkFlowService {
...
@@ -141,17 +175,24 @@ public class RemoteWorkFlowService {
}
}
public
JSONObject
execute
(
String
taskId
,
String
requestBody
)
{
public
JSONObject
execute
(
String
taskId
,
String
requestBody
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"taskId"
,
taskId
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
requestBody
);
headerMap
.
put
(
Constants
.
TOKEN_KEY
,
RequestContext
.
getToken
());
JSONObject
js
=
workFlowFeign
.
pickupAndCompleteTaskDB
(
taskId
,
jsonObject
);
headerMap
.
put
(
Constants
.
PRODUCT
,
RequestContext
.
getProduct
());
return
handleResultDATE
(
js
);
headerMap
.
put
(
Constants
.
APPKEY
,
RequestContext
.
getAppKey
());
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
执行流程
,
map
);
String
resultStr
=
HttpUtil
.
sendHttpPostJsonWithHeader
(
url
,
requestBody
,
headerMap
);
// Map<String, String> map = Maps.newHashMap();
JSONObject
json
=
handleResult
(
resultStr
);
// map.put("taskId", taskId);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n请求参数=======================>"
+
requestBody
+
"\r\n返回参数=======================>"
+
resultStr
);
// Map<String, String> headerMap = Maps.newHashMap();
return
json
;
// headerMap.put(Constants.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(Constants.PRODUCT, RequestContext.getProduct());
// headerMap.put(Constants.APPKEY, RequestContext.getAppKey());
// String url = buildUrl(address, WorkFlowUriEnum.执行流程, map);
// String resultStr = HttpUtil.sendHttpPostJsonWithHeader(url, requestBody, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + requestBody + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
public
JSONObject
currentTask
(
String
instanceId
)
{
public
JSONObject
currentTask
(
String
instanceId
)
{
...
@@ -193,46 +234,98 @@ public class RemoteWorkFlowService {
...
@@ -193,46 +234,98 @@ public class RemoteWorkFlowService {
}
}
public
JSONObject
pageTask
(
String
userId
,
Integer
BelongType
)
{
public
JSONObject
pageTask
(
String
userId
,
Integer
BelongType
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
String
url
=
""
;
map
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
if
(
Integer
.
parseInt
(
YesOrNoEnum
.
YES
.
getCode
())==
BelongType
){
if
(
Integer
.
parseInt
(
YesOrNoEnum
.
YES
.
getCode
())==
BelongType
){
map
.
put
(
"userId"
,
userId
);
JSONObject
js
=
workFlowFeign
.
getTaskAssignDB
(
userId
,
processDefinitionKey
);
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
我的代办有
ID
,
map
);
return
handleResultDATE
(
js
);
}
else
{
}
else
{
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
我的代办
,
map
);
JSONObject
js
=
workFlowFeign
.
getTaskAssignDBuser
(
processDefinitionKey
);
return
handleResultDATE
(
js
);
}
}
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
headerMap
.
put
(
Constants
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
Constants
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
Constants
.
APPKEY
,
RequestContext
.
getAppKey
());
// Map<String, String> map = Maps.newHashMap();
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
// String url = "";
JSONObject
json
=
handleResult
(
resultStr
);
// map.put("processDefinitionKey", processDefinitionKey);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n返回参数=======================>"
+
resultStr
);
// if(Integer.parseInt(YesOrNoEnum.YES.getCode())==BelongType){
return
json
;
// map.put("userId", userId);
// url = buildUrl(address, WorkFlowUriEnum.我的代办有ID, map);
// }else{
// url = buildUrl(address, WorkFlowUriEnum.我的代办, map);
// }
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(Constants.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(Constants.PRODUCT, RequestContext.getProduct());
// headerMap.put(Constants.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
/* public JSONObject pageTask(String userId,Integer BelongType) {
JSONObject json;
if(Integer.parseInt(YesOrNoEnum.YES.getCode())==BelongType){
json= workFlowFeign.getTaskAssign(userId,processDefinitionKey);
}else{
json= workFlowFeign.getTaskAssign(null,processDefinitionKey);
}
return json;
}*/
public
JSONObject
completedPageTask
(
String
userId
,
Integer
BelongType
)
{
public
JSONObject
completedPageTask
(
String
userId
,
Integer
BelongType
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
String
url
=
""
;
map
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
if
(
Integer
.
parseInt
(
YesOrNoEnum
.
YES
.
getCode
())==
BelongType
){
if
(
Integer
.
parseInt
(
YesOrNoEnum
.
YES
.
getCode
())==
BelongType
){
map
.
put
(
"userId"
,
userId
);
JSONObject
js
=
workFlowFeign
.
queryAllHistoryTasksDB
(
userId
,
processDefinitionKey
);
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
已执行任务有
ID
,
map
);
return
handleResultDATE
(
js
);
}
else
{
}
else
{
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
已执行任务
,
map
);
JSONObject
js
=
workFlowFeign
.
queryAllHistoryTasksDBuser
(
processDefinitionKey
);
return
handleResultDATE
(
js
);
}
}
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
headerMap
.
put
(
Constants
.
TOKEN_KEY
,
RequestContext
.
getToken
());
// Map<String, String> map = Maps.newHashMap();
headerMap
.
put
(
Constants
.
PRODUCT
,
RequestContext
.
getProduct
());
// String url = "";
headerMap
.
put
(
Constants
.
APPKEY
,
RequestContext
.
getAppKey
());
// map.put("processDefinitionKey", processDefinitionKey);
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
// if(Integer.parseInt(YesOrNoEnum.YES.getCode())==BelongType){
JSONObject
json
=
handleResult
(
resultStr
);
// map.put("userId", userId);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n返回参数=======================>"
+
resultStr
);
// url = buildUrl(address, WorkFlowUriEnum.已执行任务有ID, map);
return
json
;
// }else{
// url = buildUrl(address, WorkFlowUriEnum.已执行任务, map);
// }
//
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(Constants.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(Constants.PRODUCT, RequestContext.getProduct());
// headerMap.put(Constants.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
/*
public JSONObject completedPageTask(String userId,Integer BelongType) {
if(Integer.parseInt(YesOrNoEnum.YES.getCode())==BelongType){
return workFlowFeign.queryAllHistoryTasks(processDefinitionKey, userId);
}else{
return workFlowFeign.queryAllHistoryTasks(processDefinitionKey, null);
}
}
*/
public
JSONObject
queryTaskDetail
(
String
taskId
)
{
public
JSONObject
queryTaskDetail
(
String
taskId
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"taskId"
,
taskId
);
map
.
put
(
"taskId"
,
taskId
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/common/remote/RemoteWorkFlowService.java
View file @
0bdd5b54
package
com
.
yeejoin
.
amos
.
patrol
.
common
.
remote
;
package
com
.
yeejoin
.
amos
.
patrol
.
common
.
remote
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService
;
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.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -23,7 +27,7 @@ public class RemoteWorkFlowService {
...
@@ -23,7 +27,7 @@ public class RemoteWorkFlowService {
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
RemoteWorkFlowService
.
class
);
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
RemoteWorkFlowService
.
class
);
@Value
(
"${params.work.flow.address}"
)
//
@Value("${params.work.flow.address}")
private
String
address
;
private
String
address
;
private
static
final
String
success
=
"SUCCESS"
;
private
static
final
String
success
=
"SUCCESS"
;
...
@@ -33,6 +37,9 @@ public class RemoteWorkFlowService {
...
@@ -33,6 +37,9 @@ public class RemoteWorkFlowService {
@Value
(
"${params.work.flow.processDefinitionKey}"
)
@Value
(
"${params.work.flow.processDefinitionKey}"
)
private
String
processDefinitionKey
;
private
String
processDefinitionKey
;
@Autowired
private
WorkflowFeignService
workFlowFeign
;
private
String
buildUrl
(
String
address
,
WorkFlowUriEnum
workFlowUriEnum
,
Map
<
String
,
String
>
map
)
{
private
String
buildUrl
(
String
address
,
WorkFlowUriEnum
workFlowUriEnum
,
Map
<
String
,
String
>
map
)
{
String
uri
=
workFlowUriEnum
.
getUri
();
String
uri
=
workFlowUriEnum
.
getUri
();
String
params
=
workFlowUriEnum
.
getParams
();
String
params
=
workFlowUriEnum
.
getParams
();
...
@@ -58,6 +65,7 @@ public class RemoteWorkFlowService {
...
@@ -58,6 +65,7 @@ public class RemoteWorkFlowService {
public
JSONObject
start
(
String
businessKey
,
String
processDefinitionKey
)
{
public
JSONObject
start
(
String
businessKey
,
String
processDefinitionKey
)
{
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
启动流程
,
null
);
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
启动流程
,
null
);
JSONObject
body
=
new
JSONObject
();
JSONObject
body
=
new
JSONObject
();
body
.
put
(
"businessKey"
,
businessKey
);
body
.
put
(
"businessKey"
,
businessKey
);
body
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
body
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
...
@@ -66,16 +74,32 @@ public class RemoteWorkFlowService {
...
@@ -66,16 +74,32 @@ public class RemoteWorkFlowService {
}
}
public
JSONObject
getChildNodeDetail
(
String
instanceId
)
{
public
JSONObject
getChildNodeDetail
(
String
instanceId
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"instanceId"
,
instanceId
);
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
子节点信息
,
map
);
JSONObject
js
=
workFlowFeign
.
getTaskListDB
(
instanceId
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
return
handleResultDATE
(
js
);
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
// Map<String, String> map = Maps.newHashMap();
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
// map.put("instanceId", instanceId);
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
// String url = buildUrl(address, WorkFlowUriEnum.子节点信息, map);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n请求参数=======================>"
+
instanceId
+
"\r\n返回参数=======================>"
+
resultStr
);
// Map<String, String> headerMap = Maps.newHashMap();
return
handleResult
(
resultStr
);
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + instanceId + "\r\n返回参数=======================>" + resultStr);
// return handleResult(resultStr);
}
private
JSONObject
handleResultDATE
(
JSONObject
json
)
{
if
(
json
==
null
)
{
return
null
;
}
if
(
"200"
.
equals
(
json
.
getString
(
"code"
)))
{
return
json
;
}
return
null
;
}
}
...
@@ -122,20 +146,36 @@ public class RemoteWorkFlowService {
...
@@ -122,20 +146,36 @@ public class RemoteWorkFlowService {
}
}
public
JSONObject
startNew
(
Long
dangerId
,
String
businessKey
,
String
processDefinitionKey
)
{
public
JSONObject
startNew
(
Long
dangerId
,
String
businessKey
,
String
processDefinitionKey
)
{
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
合并启动流程
,
null
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
HashMap
<
String
,
Object
>
body
=
new
HashMap
<
String
,
Object
>();
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
JSONObject
body
=
new
JSONObject
();
body
.
put
(
"businessKey"
,
businessKey
);
body
.
put
(
"businessKey"
,
businessKey
);
body
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
body
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
JSONObject
dangerIdJson
=
new
JSONObject
();
JSONObject
dangerIdJson
=
new
JSONObject
();
dangerIdJson
.
put
(
"dangerId"
,
dangerId
);
dangerIdJson
.
put
(
"dangerId"
,
dangerId
);
body
.
put
(
"variables"
,
dangerIdJson
);
body
.
put
(
"variables"
,
dangerIdJson
);
String
resultStr
=
HttpUtil
.
sendHttpPostJsonWithHeader
(
url
,
body
.
toJSONString
(),
headerMap
);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n请求参数=======================>"
+
body
+
"\r\n返回参数=======================>"
+
resultStr
);
JSONObject
js
=
workFlowFeign
.
startByVariableDB
(
body
);
return
JSON
.
parseObject
(
resultStr
);
return
js
;
// String url = buildUrl(address, WorkFlowUriEnum.合并启动流程, null);
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// JSONObject body = new JSONObject();
// body.put("businessKey", businessKey);
// body.put("processDefinitionKey", processDefinitionKey);
// JSONObject dangerIdJson = new JSONObject();
// dangerIdJson.put("dangerId", dangerId);
// body.put("variables", dangerIdJson);
// String resultStr = HttpUtil.sendHttpPostJsonWithHeader(url, body.toJSONString(), headerMap);
// logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + body + "\r\n返回参数=======================>" + resultStr);
// return JSON.parseObject(resultStr);
}
}
// public JSONObject stop(String processInstanceId, String deleteReason) {
// public JSONObject stop(String processInstanceId, String deleteReason) {
// Map<String, String> map = Maps.newHashMap();
// Map<String, String> map = Maps.newHashMap();
...
@@ -174,17 +214,26 @@ public class RemoteWorkFlowService {
...
@@ -174,17 +214,26 @@ public class RemoteWorkFlowService {
// }
// }
public
JSONObject
execute
(
String
taskId
,
String
requestBody
)
{
public
JSONObject
execute
(
String
taskId
,
String
requestBody
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"taskId"
,
taskId
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
JSONObject
jsonObject
=
JSON
.
parseObject
(
requestBody
);
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
JSONObject
js
=
workFlowFeign
.
pickupAndCompleteTaskDB
(
taskId
,
jsonObject
);
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
return
handleResultDATE
(
js
);
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
执行流程
,
map
);
String
resultStr
=
HttpUtil
.
sendHttpPostJsonWithHeader
(
url
,
requestBody
,
headerMap
);
JSONObject
json
=
handleResult
(
resultStr
);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n请求参数=======================>"
+
requestBody
+
"\r\n返回参数=======================>"
+
resultStr
);
// Map<String, String> map = Maps.newHashMap();
return
json
;
// map.put("taskId", taskId);
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String url = buildUrl(address, WorkFlowUriEnum.执行流程, map);
// String resultStr = HttpUtil.sendHttpPostJsonWithHeader(url, requestBody, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + requestBody + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
public
JSONObject
currentTask
(
String
instanceId
)
{
public
JSONObject
currentTask
(
String
instanceId
)
{
...
@@ -226,96 +275,179 @@ public class RemoteWorkFlowService {
...
@@ -226,96 +275,179 @@ public class RemoteWorkFlowService {
}
}
public
JSONObject
pageTask
(
String
userId
,
Integer
BelongType
)
{
public
JSONObject
pageTask
(
String
userId
,
Integer
BelongType
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
String
url
=
""
;
map
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
if
(
Integer
.
parseInt
(
YesOrNoEnum
.
YES
.
getCode
())==
BelongType
){
if
(
Integer
.
parseInt
(
YesOrNoEnum
.
YES
.
getCode
())==
BelongType
){
map
.
put
(
"userId"
,
userId
);
JSONObject
js
=
workFlowFeign
.
getTaskAssignDB
(
userId
,
processDefinitionKey
);
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
我的代办有
ID
,
map
);
return
handleResultDATE
(
js
);
}
else
{
}
else
{
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
我的代办
,
map
);
JSONObject
js
=
workFlowFeign
.
getTaskAssignDBuser
(
processDefinitionKey
);
return
handleResultDATE
(
js
);
}
}
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
// Map<String, String> map = Maps.newHashMap();
JSONObject
json
=
handleResult
(
resultStr
);
// String url = "";
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n返回参数=======================>"
+
resultStr
);
// map.put("processDefinitionKey", processDefinitionKey);
return
json
;
// if(Integer.parseInt(YesOrNoEnum.YES.getCode())==BelongType){
// map.put("userId", userId);
// url = buildUrl(address, WorkFlowUriEnum.我的代办有ID, map);
// }else{
// url = buildUrl(address, WorkFlowUriEnum.我的代办, map);
// }
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
/* public JSONObject pageTask(String userId,Integer BelongType) {
JSONObject json;
if(Integer.parseInt(YesOrNoEnum.YES.getCode())==BelongType){
json= workFlowFeign.getTaskAssign(userId,processDefinitionKey);
}else{
json= workFlowFeign.getTaskAssign(null,processDefinitionKey);
}
return json;
}
*/
public
JSONObject
completedPageTask
(
String
userId
,
Integer
BelongType
)
{
public
JSONObject
completedPageTask
(
String
userId
,
Integer
BelongType
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
String
url
=
""
;
map
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
if
(
Integer
.
parseInt
(
YesOrNoEnum
.
YES
.
getCode
())==
BelongType
){
if
(
Integer
.
parseInt
(
YesOrNoEnum
.
YES
.
getCode
())==
BelongType
){
map
.
put
(
"userId"
,
userId
);
JSONObject
js
=
workFlowFeign
.
queryAllHistoryTasksDB
(
userId
,
processDefinitionKey
);
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
已执行任务有
ID
,
map
);
return
handleResultDATE
(
js
);
}
else
{
}
else
{
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
已执行任务
,
map
);
JSONObject
js
=
workFlowFeign
.
queryAllHistoryTasksDBuser
(
processDefinitionKey
);
return
handleResultDATE
(
js
);
}
}
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
JSONObject
json
=
handleResult
(
resultStr
);
// Map<String, String> map = Maps.newHashMap();
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n返回参数=======================>"
+
resultStr
);
// String url = "";
return
json
;
// map.put("processDefinitionKey", processDefinitionKey);
// if(Integer.parseInt(YesOrNoEnum.YES.getCode())==BelongType){
// map.put("userId", userId);
// url = buildUrl(address, WorkFlowUriEnum.已执行任务有ID, map);
// }else{
// url = buildUrl(address, WorkFlowUriEnum.已执行任务, map);
// }
//
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
/* public JSONObject completedPageTask(String userId,Integer BelongType) {
if(Integer.parseInt(YesOrNoEnum.YES.getCode())==BelongType){
return workFlowFeign.queryAllHistoryTasks(processDefinitionKey, userId);
}else{
return workFlowFeign.queryAllHistoryTasks(processDefinitionKey, null);
}
}
*/
public
JSONObject
queryTask
(
String
id
)
{
public
JSONObject
queryTask
(
String
id
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"processInstanceId"
,
id
);
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
流程任务
,
map
);
JSONObject
js
=
workFlowFeign
.
getTaskDB
(
id
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
return
handleResultDATE
(
js
);
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
// Map<String, String> map = Maps.newHashMap();
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
// map.put("processInstanceId", id);
JSONObject
json
=
handleResult
(
resultStr
);
// String url = buildUrl(address, WorkFlowUriEnum.流程任务, map);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n返回参数=======================>"
+
resultStr
);
// Map<String, String> headerMap = Maps.newHashMap();
return
json
;
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
public
JSONObject
queryTaskNoAuth
(
String
id
)
{
public
JSONObject
queryTaskNoAuth
(
String
id
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"processInstanceId"
,
id
);
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
无权限流程任务
,
map
);
JSONObject
js
=
workFlowFeign
.
queryTaskNoAuthDB
(
id
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
return
handleResultDATE
(
js
);
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
JSONObject
json
=
handleResult
(
resultStr
);
// Map<String, String> map = Maps.newHashMap();
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n返回参数=======================>"
+
resultStr
);
// map.put("processInstanceId", id);
return
json
;
// String url = buildUrl(address, WorkFlowUriEnum.无权限流程任务, map);
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
public
JSONObject
queryTaskDetail
(
String
taskId
)
{
public
JSONObject
queryTaskDetail
(
String
taskId
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"taskId"
,
taskId
);
JSONObject
js
=
workFlowFeign
.
queryTaskDB
(
taskId
);
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
流程详情
,
map
);
return
handleResultDATE
(
js
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
//
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
// Map<String, String> map = Maps.newHashMap();
JSONObject
json
=
handleResult
(
resultStr
);
// map.put("taskId", taskId);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n返回参数=======================>"
+
resultStr
);
// String url = buildUrl(address, WorkFlowUriEnum.流程详情, map);
return
json
;
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
public
JSONObject
queryFinishTaskDetail
(
String
taskId
)
{
public
JSONObject
queryFinishTaskDetail
(
String
taskId
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"taskId"
,
taskId
);
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
所有已执行任务详情
,
map
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
JSONObject
js
=
workFlowFeign
.
queryHistoryTaskDetailDB
(
taskId
);
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
return
handleResultDATE
(
js
);
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
JSONObject
json
=
handleResult
(
resultStr
);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n返回参数=======================>"
+
resultStr
);
// Map<String, String> map = Maps.newHashMap();
return
json
;
// map.put("taskId", taskId);
// String url = buildUrl(address, WorkFlowUriEnum.所有已执行任务详情, map);
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/common/remote/RemoteWorkFlowService.java
View file @
0bdd5b54
...
@@ -4,17 +4,20 @@ import com.alibaba.fastjson.JSON;
...
@@ -4,17 +4,20 @@ 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.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService
;
import
com.yeejoin.amos.supervision.business.util.HttpUtil
;
import
com.yeejoin.amos.supervision.business.util.HttpUtil
;
import
com.yeejoin.amos.supervision.business.constants.XJConstant
;
import
com.yeejoin.amos.supervision.business.constants.XJConstant
;
import
com.yeejoin.amos.supervision.common.enums.WorkFlowUriEnum
;
import
com.yeejoin.amos.supervision.common.enums.WorkFlowUriEnum
;
import
com.yeejoin.amos.supervision.common.enums.YesOrNoEnum
;
import
com.yeejoin.amos.supervision.common.enums.YesOrNoEnum
;
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.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
@Service
(
"remoteWorkFlowService"
)
@Service
(
"remoteWorkFlowService"
)
...
@@ -22,7 +25,7 @@ public class RemoteWorkFlowService {
...
@@ -22,7 +25,7 @@ public class RemoteWorkFlowService {
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
RemoteWorkFlowService
.
class
);
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
RemoteWorkFlowService
.
class
);
@Value
(
"${params.work.flow.address}"
)
//
@Value("${params.work.flow.address}")
private
String
address
;
private
String
address
;
private
static
final
String
success
=
"SUCCESS"
;
private
static
final
String
success
=
"SUCCESS"
;
...
@@ -32,6 +35,11 @@ public class RemoteWorkFlowService {
...
@@ -32,6 +35,11 @@ public class RemoteWorkFlowService {
@Value
(
"${params.work.flow.processDefinitionKey}"
)
@Value
(
"${params.work.flow.processDefinitionKey}"
)
private
String
processDefinitionKey
;
private
String
processDefinitionKey
;
@Autowired
private
WorkflowFeignService
workFlowFeign
;
private
String
buildUrl
(
String
address
,
WorkFlowUriEnum
workFlowUriEnum
,
Map
<
String
,
String
>
map
)
{
private
String
buildUrl
(
String
address
,
WorkFlowUriEnum
workFlowUriEnum
,
Map
<
String
,
String
>
map
)
{
String
uri
=
workFlowUriEnum
.
getUri
();
String
uri
=
workFlowUriEnum
.
getUri
();
String
params
=
workFlowUriEnum
.
getParams
();
String
params
=
workFlowUriEnum
.
getParams
();
...
@@ -56,56 +64,95 @@ public class RemoteWorkFlowService {
...
@@ -56,56 +64,95 @@ public class RemoteWorkFlowService {
}
}
public
JSONObject
start
(
String
businessKey
,
String
processDefinitionKey
)
{
public
JSONObject
start
(
String
businessKey
,
String
processDefinitionKey
)
{
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
启动流程
,
null
);
JSONObject
body
=
new
JSONObject
();
JSONObject
body
=
new
JSONObject
();
body
.
put
(
"businessKey"
,
businessKey
);
body
.
put
(
"businessKey"
,
businessKey
);
body
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
body
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
String
resultStr
=
HttpUtil
.
sendHttpPostJson
(
url
,
body
.
toJSONString
());
return
handleResult
(
resultStr
);
}
JSONObject
js
=
workFlowFeign
.
getTaskAssignDB
(
body
);
return
handleResultDATE
(
js
);
// String url = buildUrl(address, WorkFlowUriEnum.启动流程, null);
// JSONObject body = new JSONObject();
// body.put("businessKey", businessKey);
// body.put("processDefinitionKey", processDefinitionKey);
// String resultStr = HttpUtil.sendHttpPostJson(url, body.toJSONString());
// return handleResult(resultStr);
}
private
JSONObject
handleResultDATE
(
JSONObject
json
)
{
if
(
json
==
null
)
{
return
null
;
}
if
(
"200"
.
equals
(
json
.
getString
(
"code"
)))
{
return
json
;
}
return
null
;
}
public
JSONObject
getChildNodeDetail
(
String
instanceId
)
{
public
JSONObject
getChildNodeDetail
(
String
instanceId
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"instanceId"
,
instanceId
);
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
子节点信息
,
map
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
JSONObject
js
=
workFlowFeign
.
getTaskListDB
(
instanceId
);
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
return
handleResultDATE
(
js
);
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n请求参数=======================>"
+
instanceId
+
"\r\n返回参数=======================>"
+
resultStr
);
// Map<String, String> map = Maps.newHashMap();
return
handleResult
(
resultStr
);
// map.put("instanceId", instanceId);
// String url = buildUrl(address, WorkFlowUriEnum.子节点信息, map);
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + instanceId + "\r\n返回参数=======================>" + resultStr);
// return handleResult(resultStr);
}
}
public
JSONObject
start
(
Long
dangerId
,
String
businessKey
,
String
processDefinitionKey
)
{
public
JSONObject
start
(
Long
dangerId
,
String
businessKey
,
String
processDefinitionKey
)
{
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
启动流程
,
null
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
JSONObject
body
=
new
JSONObject
();
JSONObject
body
=
new
JSONObject
();
body
.
put
(
"businessKey"
,
businessKey
);
body
.
put
(
"businessKey"
,
businessKey
);
body
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
body
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
JSONArray
variables
=
new
JSONArray
();
// JSONObject companyJson = new JSONObject();
// companyJson.put("name", "companyId");
// companyJson.put("value", companyId);
// JSONObject departmentJson = new JSONObject();
// departmentJson.put("name", "departmentId");
// departmentJson.put("value", departmentId);
JSONObject
dangerIdJson
=
new
JSONObject
();
JSONObject
dangerIdJson
=
new
JSONObject
();
// dangerIdJson.put("name", "dangerId");
dangerIdJson
.
put
(
"dangerId"
,
dangerId
);
dangerIdJson
.
put
(
"dangerId"
,
dangerId
);
// variables.add(companyJson);
// variables.add(departmentJson);
// variables.add(dangerIdJson);
// body.put("variables", variables);
// String requestBody = body.toJSONString();
body
.
put
(
"variables"
,
dangerIdJson
);
body
.
put
(
"variables"
,
dangerIdJson
);
String
resultStr
=
HttpUtil
.
sendHttpPostJsonWithHeader
(
url
,
body
.
toJSONString
(),
headerMap
);
JSONObject
js
=
workFlowFeign
.
getTaskAssignDB
(
body
);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n请求参数=======================>"
+
body
+
"\r\n返回参数=======================>"
+
resultStr
);
return
handleResultDATE
(
js
);
return
JSON
.
parseObject
(
resultStr
);
// String url = buildUrl(address, WorkFlowUriEnum.启动流程, null);
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// JSONObject body = new JSONObject();
// body.put("businessKey", businessKey);
// body.put("processDefinitionKey", processDefinitionKey);
// JSONArray variables = new JSONArray();
//// JSONObject companyJson = new JSONObject();
//// companyJson.put("name", "companyId");
//// companyJson.put("value", companyId);
//// JSONObject departmentJson = new JSONObject();
//// departmentJson.put("name", "departmentId");
//// departmentJson.put("value", departmentId);
// JSONObject dangerIdJson = new JSONObject();
//// dangerIdJson.put("name", "dangerId");
// dangerIdJson.put("dangerId", dangerId);
//// variables.add(companyJson);
//// variables.add(departmentJson);
//// variables.add(dangerIdJson);
//// body.put("variables", variables);
//// String requestBody = body.toJSONString();
// body.put("variables", dangerIdJson);
// String resultStr = HttpUtil.sendHttpPostJsonWithHeader(url, body.toJSONString(), headerMap);
// logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + body + "\r\n返回参数=======================>" + resultStr);
// return JSON.parseObject(resultStr);
}
}
public
JSONObject
startWithAppKey
(
JSONObject
body
)
{
public
JSONObject
startWithAppKey
(
JSONObject
body
)
{
...
@@ -121,20 +168,33 @@ public class RemoteWorkFlowService {
...
@@ -121,20 +168,33 @@ public class RemoteWorkFlowService {
}
}
public
JSONObject
startNew
(
Long
dangerId
,
String
businessKey
,
String
processDefinitionKey
)
{
public
JSONObject
startNew
(
Long
dangerId
,
String
businessKey
,
String
processDefinitionKey
)
{
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
合并启动流程
,
null
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
HashMap
<
String
,
Object
>
body
=
new
HashMap
<
String
,
Object
>();
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
JSONObject
body
=
new
JSONObject
();
body
.
put
(
"businessKey"
,
businessKey
);
body
.
put
(
"businessKey"
,
businessKey
);
body
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
body
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
JSONObject
dangerIdJson
=
new
JSONObject
();
JSONObject
dangerIdJson
=
new
JSONObject
();
dangerIdJson
.
put
(
"dangerId"
,
dangerId
);
dangerIdJson
.
put
(
"dangerId"
,
dangerId
);
body
.
put
(
"variables"
,
dangerIdJson
);
body
.
put
(
"variables"
,
dangerIdJson
);
String
resultStr
=
HttpUtil
.
sendHttpPostJsonWithHeader
(
url
,
body
.
toJSONString
(),
headerMap
);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n请求参数=======================>"
+
body
+
"\r\n返回参数=======================>"
+
resultStr
);
JSONObject
js
=
workFlowFeign
.
startByVariableDB
(
body
);
return
JSON
.
parseObject
(
resultStr
);
return
js
;
// String url = buildUrl(address, WorkFlowUriEnum.合并启动流程, null);
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// JSONObject body = new JSONObject();
// body.put("businessKey", businessKey);
// body.put("processDefinitionKey", processDefinitionKey);
// JSONObject dangerIdJson = new JSONObject();
// dangerIdJson.put("dangerId", dangerId);
// body.put("variables", dangerIdJson);
// String resultStr = HttpUtil.sendHttpPostJsonWithHeader(url, body.toJSONString(), headerMap);
// logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + body + "\r\n返回参数=======================>" + resultStr);
// return JSON.parseObject(resultStr);
}
}
// public JSONObject stop(String processInstanceId, String deleteReason) {
// public JSONObject stop(String processInstanceId, String deleteReason) {
// Map<String, String> map = Maps.newHashMap();
// Map<String, String> map = Maps.newHashMap();
...
@@ -173,17 +233,25 @@ public class RemoteWorkFlowService {
...
@@ -173,17 +233,25 @@ public class RemoteWorkFlowService {
// }
// }
public
JSONObject
excute
(
String
taskId
,
String
requestBody
)
{
public
JSONObject
excute
(
String
taskId
,
String
requestBody
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"taskId"
,
taskId
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
requestBody
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
JSONObject
js
=
workFlowFeign
.
pickupAndCompleteTaskDB
(
taskId
,
jsonObject
);
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
return
handleResultDATE
(
js
);
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
执行流程
,
map
);
String
resultStr
=
HttpUtil
.
sendHttpPostJsonWithHeader
(
url
,
requestBody
,
headerMap
);
JSONObject
json
=
handleResult
(
resultStr
);
// Map<String, String> map = Maps.newHashMap();
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n请求参数=======================>"
+
requestBody
+
"\r\n返回参数=======================>"
+
resultStr
);
// map.put("taskId", taskId);
return
json
;
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String url = buildUrl(address, WorkFlowUriEnum.执行流程, map);
// String resultStr = HttpUtil.sendHttpPostJsonWithHeader(url, requestBody, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + requestBody + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
public
JSONObject
currentTask
(
String
instanceId
)
{
public
JSONObject
currentTask
(
String
instanceId
)
{
...
@@ -225,84 +293,138 @@ public class RemoteWorkFlowService {
...
@@ -225,84 +293,138 @@ public class RemoteWorkFlowService {
}
}
public
JSONObject
pageTask
(
String
userId
,
Integer
BelongType
)
{
public
JSONObject
pageTask
(
String
userId
,
Integer
BelongType
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
String
url
=
""
;
map
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
if
(
Integer
.
parseInt
(
YesOrNoEnum
.
YES
.
getCode
())==
BelongType
){
if
(
Integer
.
parseInt
(
YesOrNoEnum
.
YES
.
getCode
())==
BelongType
){
map
.
put
(
"userId"
,
userId
);
JSONObject
js
=
workFlowFeign
.
getTaskAssignDB
(
userId
,
processDefinitionKey
);
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
我的代办有
ID
,
map
);
return
handleResultDATE
(
js
);
}
else
{
}
else
{
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
我的代办
,
map
);
JSONObject
js
=
workFlowFeign
.
getTaskAssignDBuser
(
processDefinitionKey
);
return
handleResultDATE
(
js
);
}
}
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
// Map<String, String> map = Maps.newHashMap();
JSONObject
json
=
handleResult
(
resultStr
);
// String url = "";
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n返回参数=======================>"
+
resultStr
);
// map.put("processDefinitionKey", processDefinitionKey);
return
json
;
// if(Integer.parseInt(YesOrNoEnum.YES.getCode())==BelongType){
// map.put("userId", userId);
// url = buildUrl(address, WorkFlowUriEnum.我的代办有ID, map);
// }else{
// url = buildUrl(address, WorkFlowUriEnum.我的代办, map);
// }
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
public
JSONObject
completedPageTask
(
String
userId
,
Integer
BelongType
)
{
public
JSONObject
completedPageTask
(
String
userId
,
Integer
BelongType
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
String
url
=
""
;
map
.
put
(
"processDefinitionKey"
,
processDefinitionKey
);
if
(
Integer
.
parseInt
(
YesOrNoEnum
.
YES
.
getCode
())==
BelongType
){
if
(
Integer
.
parseInt
(
YesOrNoEnum
.
YES
.
getCode
())==
BelongType
){
map
.
put
(
"userId"
,
userId
);
JSONObject
js
=
workFlowFeign
.
queryAllHistoryTasksDB
(
userId
,
processDefinitionKey
);
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
已执行任务有
ID
,
map
);
return
handleResultDATE
(
js
);
}
else
{
}
else
{
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
已执行任务
,
map
);
JSONObject
js
=
workFlowFeign
.
queryAllHistoryTasksDBuser
(
processDefinitionKey
);
return
handleResultDATE
(
js
);
}
}
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
// Map<String, String> map = Maps.newHashMap();
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
// String url = "";
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
// map.put("processDefinitionKey", processDefinitionKey);
JSONObject
json
=
handleResult
(
resultStr
);
// if(Integer.parseInt(YesOrNoEnum.YES.getCode())==BelongType){
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n返回参数=======================>"
+
resultStr
);
// map.put("userId", userId);
return
json
;
// url = buildUrl(address, WorkFlowUriEnum.已执行任务有ID, map);
// }else{
// url = buildUrl(address, WorkFlowUriEnum.已执行任务, map);
// }
//
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
public
JSONObject
queryTask
(
String
id
)
{
public
JSONObject
queryTask
(
String
id
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"processInstanceId"
,
id
);
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
流程任务
,
map
);
JSONObject
js
=
workFlowFeign
.
getTaskDB
(
id
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
return
handleResultDATE
(
js
);
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
// Map<String, String> map = Maps.newHashMap();
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
// map.put("processInstanceId", id);
JSONObject
json
=
handleResult
(
resultStr
);
// String url = buildUrl(address, WorkFlowUriEnum.流程任务, map);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n返回参数=======================>"
+
resultStr
);
// Map<String, String> headerMap = Maps.newHashMap();
return
json
;
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
public
JSONObject
queryTaskDetail
(
String
taskId
)
{
public
JSONObject
queryTaskDetail
(
String
taskId
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"taskId"
,
taskId
);
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
流程详情
,
map
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
JSONObject
js
=
workFlowFeign
.
queryTaskDB
(
taskId
);
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
return
handleResultDATE
(
js
);
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
JSONObject
json
=
handleResult
(
resultStr
);
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n返回参数=======================>"
+
resultStr
);
// Map<String, String> map = Maps.newHashMap();
return
json
;
// map.put("taskId", taskId);
// String url = buildUrl(address, WorkFlowUriEnum.流程详情, map);
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
public
JSONObject
queryFinishTaskDetail
(
String
taskId
)
{
public
JSONObject
queryFinishTaskDetail
(
String
taskId
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"taskId"
,
taskId
);
String
url
=
buildUrl
(
address
,
WorkFlowUriEnum
.
所有已执行任务详情
,
map
);
Map
<
String
,
String
>
headerMap
=
Maps
.
newHashMap
();
JSONObject
js
=
workFlowFeign
.
queryHistoryTaskDetailDB
(
taskId
);
headerMap
.
put
(
XJConstant
.
TOKEN_KEY
,
RequestContext
.
getToken
());
return
handleResultDATE
(
js
);
headerMap
.
put
(
XJConstant
.
PRODUCT
,
RequestContext
.
getProduct
());
headerMap
.
put
(
XJConstant
.
APPKEY
,
RequestContext
.
getAppKey
());
String
resultStr
=
HttpUtil
.
sendHttpGetWithHeader
(
url
,
headerMap
);
JSONObject
json
=
handleResult
(
resultStr
);
// Map<String, String> map = Maps.newHashMap();
logger
.
info
(
"\r\n请求路径=======================>"
+
url
+
"\r\n返回参数=======================>"
+
resultStr
);
// map.put("taskId", taskId);
return
json
;
// String url = buildUrl(address, WorkFlowUriEnum.所有已执行任务详情, map);
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// String resultStr = HttpUtil.sendHttpGetWithHeader(url, headerMap);
// JSONObject json = handleResult(resultStr);
// logger.info("\r\n请求路径=======================>" + url + "\r\n返回参数=======================>" + resultStr);
// return json;
}
}
}
}
amos-boot-system-equip/src/main/resources/application.properties
View file @
0bdd5b54
...
@@ -89,6 +89,14 @@ dcs.x.hw.appKey=s+YkvQhwilx91TRJHhNDmw==
...
@@ -89,6 +89,14 @@ dcs.x.hw.appKey=s+YkvQhwilx91TRJHhNDmw==
# 故障告警/消防告警/跑马灯权限标识 true 机场 / false 电力
# 故障告警/消防告警/跑马灯权限标识 true 机场 / false 电力
equip.enabled
=
true
equip.enabled
=
true
management.security.enabled
=
true
endpoints.enabled
=
false
endpoints.health.enabled
=
true
management.endpoint.health.show-details
=
never
spring.security.user.name
=
admin
spring.security.user.password
=
a1234560
#management.endpoints.enabled-by-default=false
#management.endpoints.enabled-by-default=false
## 增加接口文档验证
## 增加接口文档验证
...
...
amos-boot-system-fas/src/main/resources/application.properties
View file @
0bdd5b54
...
@@ -55,7 +55,7 @@ param.safetyIndexChange.cron = 0 0 2 * * ?
...
@@ -55,7 +55,7 @@ param.safetyIndexChange.cron = 0 0 2 * * ?
param.weather.url
=
http://wthrcdn.etouch.cn/weather_mini?citykey=
param.weather.url
=
http://wthrcdn.etouch.cn/weather_mini?citykey=
# 只用于初始化
# 只用于初始化
emqx.defaultTopic
=
mqtt_topic
emqx.defaultTopic
=
$share/-${spring.application.name}/
mqtt_topic
## 规则配置(风险管控及预案)
## 规则配置(风险管控及预案)
rule.definition.load
=
false
rule.definition.load
=
false
...
...
amos-boot-system-jcs/src/main/resources/application.properties
View file @
0bdd5b54
...
@@ -39,8 +39,6 @@ spring.liquibase.enabled= false
...
@@ -39,8 +39,6 @@ spring.liquibase.enabled= false
## eureka properties:
## eureka properties:
eureka.client.registry-fetch-interval-seconds
=
5
eureka.client.registry-fetch-interval-seconds
=
5
eureka.instance.prefer-ip-address
=
true
eureka.instance.prefer-ip-address
=
true
management.endpoint.health.show-details
=
always
management.endpoints.web.exposure.include
=
*
eureka.instance.health-check-url-path
=
/actuator/health
eureka.instance.health-check-url-path
=
/actuator/health
eureka.instance.lease-expiration-duration-in-seconds
=
10
eureka.instance.lease-expiration-duration-in-seconds
=
10
eureka.instance.lease-renewal-interval-in-seconds
=
5
eureka.instance.lease-renewal-interval-in-seconds
=
5
...
@@ -131,11 +129,10 @@ knife4j.basic.enable=true
...
@@ -131,11 +129,10 @@ knife4j.basic.enable=true
knife4j.basic.username
=
admin
knife4j.basic.username
=
admin
knife4j.basic.password
=
yeejoin@2020
knife4j.basic.password
=
yeejoin@2020
management.security.enabled
=
true
endpoints.enabled
=
false
#阿里云实时语音识别参数
endpoints.health.enabled
=
true
speech-config.access-key-id
=
LTAI5t62oH95jgbjRiNXPsho
management.endpoint.health.show-details
=
always
speech-config.access-key-secret
=
shy9SpogYgcdDoyTB3bvP21VSRmz8n
management.endpoints.web.exposure.include
=
*
speech-config.app-key
=
FC84bGUpbNFrexoL
spring.security.user.name
=
admin
spring.security.user.password
=
a1234560
mqtt.topic.command.car.jw
=
carCoordinates
\ No newline at end of file
\ No newline at end of file
amos-boot-utils/amos-boot-utils-jpush/src/main/java/com/yeejoin/amos/JpushApplication.java
View file @
0bdd5b54
...
@@ -33,7 +33,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
...
@@ -33,7 +33,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
@EnableFeignClients
@EnableFeignClients
@EnableAsync
@EnableAsync
@EnableEurekaClient
@EnableEurekaClient
@ComponentScan
({
"
org.typroject"
,
"
com.yeejoin.amos"
})
@ComponentScan
({
"com.yeejoin.amos"
})
public
class
JpushApplication
{
public
class
JpushApplication
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
JpushApplication
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
JpushApplication
.
class
);
...
...
amos-boot-utils/amos-boot-utils-jpush/src/main/java/com/yeejoin/amos/jpush/config/WebSecurityConfig.java
0 → 100644
View file @
0bdd5b54
package
com
.
yeejoin
.
amos
.
jpush
.
config
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
@Configuration
@EnableWebSecurity
public
class
WebSecurityConfig
extends
WebSecurityConfigurerAdapter
{
// 授权
@Override
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
http
.
csrf
().
disable
()
.
headers
()
.
frameOptions
()
.
disable
()
.
and
()
.
authorizeRequests
()
.
regexMatchers
(
"^(?!/actuator).*$"
).
permitAll
()
.
regexMatchers
(
"/actuator/health"
).
permitAll
()
.
regexMatchers
(
"/actuator/info"
).
permitAll
()
.
anyRequest
().
authenticated
().
and
()
.
formLogin
();
}
}
amos-boot-utils/pom.xml
View file @
0bdd5b54
...
@@ -13,6 +13,10 @@
...
@@ -13,6 +13,10 @@
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
<dependencies>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-security
</artifactId>
</dependency>
</dependencies>
</dependencies>
...
...
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