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
0f836c11
Commit
0f836c11
authored
Sep 29, 2022
by
zhangyingbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
城燃管道流程大体框架
parent
87dd1100
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1401 additions
and
1 deletion
+1401
-1
ProjectInitiationEnum.java
.../amos/boot/module/ugp/api/Enum/ProjectInitiationEnum.java
+57
-0
CommonResponse.java
...yeejoin/amos/boot/module/ugp/api/Util/CommonResponse.java
+133
-0
CommonResponseUtil.java
...oin/amos/boot/module/ugp/api/Util/CommonResponseUtil.java
+61
-0
Constants.java
.../com/yeejoin/amos/boot/module/ugp/api/Util/Constants.java
+64
-0
HttpUtil.java
...a/com/yeejoin/amos/boot/module/ugp/api/Util/HttpUtil.java
+578
-0
XJConstant.java
...eejoin/amos/boot/module/ugp/api/constants/XJConstant.java
+402
-0
ProjectInitiationController.java
...odule/ugp/biz/controller/ProjectInitiationController.java
+28
-0
ProjectInitiationServiceImpl.java
...le/ugp/biz/service/impl/ProjectInitiationServiceImpl.java
+74
-0
application-dev.properties
...ule-ugp-biz/src/main/resources/application-dev.properties
+1
-1
application.properties
...-module-ugp-biz/src/main/resources/application.properties
+3
-0
No files found.
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/Enum/ProjectInitiationEnum.java
0 → 100644
View file @
0f836c11
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
api
.
Enum
;
public
enum
ProjectInitiationEnum
{
启动流程
(
"启动流程"
,
"/workflow/task/startTask"
,
""
),
流程详情
(
"流程详情"
,
"/workflow/task/{taskId}"
,
"taskId"
),
合并启动流程
(
"合并启动流程"
,
"/workflow/task/startProcess"
,
""
),
所有已执行任务详情
(
"所有已执行任务详情"
,
"/workflow/activitiHistory/task/detail/{taskId}"
,
"taskId"
),
流程任务
(
"流程任务"
,
"/workflow/task?processInstanceId={processInstanceId}"
,
"processInstanceId"
),
我的代办
(
"我的代办"
,
"/workflow/task/all-list?processDefinitionKey={processDefinitionKey}"
,
"processDefinitionKey"
),
我的代办有
ID
(
"我的代办有ID"
,
"/workflow/task/all-list?processDefinitionKey={processDefinitionKey}&userId={userId}"
,
"processDefinitionKey,userId"
),
已执行任务
(
"已执行任务"
,
"/workflow/activitiHistory/all-historytasks?processDefinitionKey={processDefinitionKey}"
,
"processDefinitionKey"
),
已执行任务有
ID
(
"已执行任务有ID"
,
"/workflow/activitiHistory/all-historytasks?processDefinitionKey={processDefinitionKey}&userId={userId}"
,
"processDefinitionKey,userId"
),
启动免登录流程
(
"启动免登录流程"
,
"/processes/{appKey}"
,
"appKey"
),
当前节点
(
"当前节点"
,
"/wf/taskstodo?processInstanceId={processInstanceId}"
,
"processInstanceId"
),
执行流程
(
"执行流程"
,
"/workflow/task/pickupAndCompleteTask/{taskId}"
,
"taskId"
),
终止流程
(
"终止流程"
,
"/wf/processes/{processInstanceId}?deleteReason={deleteReason}"
,
"processInstanceId,deleteReason"
),
当前子节点
(
"当前子节点"
,
"/wf/processes/{processInstanceId}/tasks?taskDefinitionKey={taskDefinitionKey}"
,
"processInstanceId,taskDefinitionKey"
),
工作流流水
(
"工作流流水"
,
"/wf/processes/{processInstanceId}/tasks"
,
"processInstanceId"
),
子节点信息
(
"子节点信息"
,
"/workflow/task/list/all/{instanceId}"
,
"instanceId"
);
private
String
desc
;
private
String
uri
;
private
String
params
;
ProjectInitiationEnum
(
String
desc
,
String
uri
,
String
params
)
{
this
.
desc
=
desc
;
this
.
uri
=
uri
;
this
.
params
=
params
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
String
getUri
()
{
return
uri
;
}
public
void
setUri
(
String
uri
)
{
this
.
uri
=
uri
;
}
public
String
getParams
()
{
return
params
;
}
public
void
setParams
(
String
params
)
{
this
.
params
=
params
;
}
}
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/Util/CommonResponse.java
0 → 100644
View file @
0f836c11
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
api
.
Util
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
/**
* <pre>
* 返回封装对象
* </pre>
*
* @author mincx
* @version CommonReponse.java v0.1
* @time 2017-9-19 15:43:32
*/
public
class
CommonResponse
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
8737351878134480646L
;
/**
* 操作状态
*/
@ApiModelProperty
(
required
=
true
,
value
=
"操作状态"
)
private
String
result
;
/**
* 操作状态
*/
@ApiModelProperty
(
required
=
true
,
value
=
"状态码"
)
private
int
status
;
/**
* 数据
*/
@ApiModelProperty
(
required
=
false
,
value
=
"数据"
)
private
Object
dataList
;
/**
* 操作详细信息
*/
@ApiModelProperty
(
required
=
false
,
value
=
"操作详细信息"
)
private
String
message
;
public
CommonResponse
(){
}
public
CommonResponse
(
String
result
)
{
this
.
result
=
result
;
}
public
CommonResponse
(
Object
dataList
)
{
this
.
dataList
=
dataList
;
this
.
result
=
""
;
}
public
CommonResponse
(
String
result
,
Object
dataList
)
{
this
.
dataList
=
dataList
;
this
.
result
=
result
;
}
public
CommonResponse
(
String
result
,
String
message
)
{
this
.
result
=
result
;
this
.
message
=
message
;
}
public
CommonResponse
(
String
result
,
Object
dataList
,
String
message
)
{
this
.
dataList
=
dataList
;
this
.
result
=
result
;
this
.
message
=
message
;
}
public
CommonResponse
(
String
result
,
Object
dataList
,
int
status
)
{
this
.
dataList
=
dataList
;
this
.
result
=
result
;
this
.
status
=
status
;
}
public
CommonResponse
(
String
result
,
String
message
,
int
status
)
{
this
.
result
=
result
;
this
.
message
=
message
;
this
.
status
=
status
;
}
public
CommonResponse
(
String
result
,
Object
dataList
,
String
message
,
int
status
)
{
this
.
dataList
=
dataList
;
this
.
result
=
result
;
this
.
message
=
message
;
this
.
status
=
status
;
}
public
Boolean
isSuccess
(){
return
"SUCCESS"
.
equals
(
getResult
());
}
public
String
getResult
()
{
return
result
;
}
public
void
setResult
(
String
result
)
{
this
.
result
=
result
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
Object
getDataList
()
{
return
dataList
;
}
public
void
setDataList
(
Object
dataList
)
{
this
.
dataList
=
dataList
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
public
int
getStatus
()
{
return
status
;
}
public
String
toJsonStr
()
throws
Exception
{
return
JSON
.
toJSONString
(
this
,
SerializerFeature
.
WriteMapNullValue
,
SerializerFeature
.
DisableCircularReferenceDetect
,
SerializerFeature
.
SkipTransientField
);
}
}
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/Util/CommonResponseUtil.java
0 → 100644
View file @
0f836c11
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
api
.
Util
;
import
org.springframework.http.HttpStatus
;
public
class
CommonResponseUtil
{
public
static
CommonResponse
success
()
{
CommonResponse
response
=
new
CommonResponse
();
response
.
setResult
(
Constants
.
RESULT_SUCCESS
);
response
.
setStatus
(
HttpStatus
.
OK
.
value
());
return
response
;
}
public
static
CommonResponse
success
(
Object
obj
)
{
CommonResponse
response
=
new
CommonResponse
();
response
.
setResult
(
Constants
.
RESULT_SUCCESS
);
response
.
setStatus
(
HttpStatus
.
OK
.
value
());
response
.
setDataList
(
obj
);
return
response
;
}
public
static
CommonResponse
success
(
Object
obj
,
String
message
)
{
CommonResponse
response
=
new
CommonResponse
();
response
.
setResult
(
Constants
.
RESULT_SUCCESS
);
response
.
setStatus
(
HttpStatus
.
OK
.
value
());
response
.
setDataList
(
obj
);
response
.
setMessage
(
message
);
return
response
;
}
public
static
CommonResponse
failure
()
{
CommonResponse
response
=
new
CommonResponse
();
response
.
setResult
(
Constants
.
RESULT_FAILURE
);
response
.
setStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
());
return
response
;
}
public
static
CommonResponse
failure
(
String
message
)
{
CommonResponse
response
=
new
CommonResponse
();
response
.
setResult
(
Constants
.
RESULT_FAILURE
);
response
.
setStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
());
response
.
setMessage
(
message
);
return
response
;
}
public
static
CommonResponse
failure
(
Object
obj
,
String
message
)
{
CommonResponse
response
=
new
CommonResponse
();
response
.
setResult
(
Constants
.
RESULT_FAILURE
);
response
.
setStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
());
response
.
setDataList
(
obj
);
response
.
setMessage
(
message
);
return
response
;
}
}
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/Util/Constants.java
0 → 100644
View file @
0f836c11
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
api
.
Util
;
/**
* <pre>
* 系统常量
* </pre>
*
* @author mincx
* @version Constants.java v0.1
* @time 2017-9-19 15:43:32
*/
public
class
Constants
{
public
static
final
String
ERROR_MESSAGE
=
"系统异常"
;
public
static
final
String
RESULT_SUCCESS
=
"SUCCESS"
;
public
static
final
String
RESULT_FAILURE
=
"FAILURE"
;
public
static
final
String
RULE_FACT_PREFIX
=
"rule_"
;
public
static
final
String
RULE_COMPILATION_ERROR
=
"规则编译异常"
;
public
static
final
String
NEW_LINE
=
"\r\n"
;
public
static
final
String
POSITION_LATITUDE
=
"latitude"
;
public
static
final
String
POSITION_LONGITUDE
=
"longitude"
;
public
static
final
double
PI
=
3.1415
;
public
static
final
double
EARTH_RADIUS
=
6370.996
;
public
static
final
String
RULE_CONDITION_AND
=
"&&"
;
public
static
final
String
RULE_CONDITION_OR
=
"||"
;
/**
* DES加密解密默认key
*/
public
static
final
String
XSS_KEY
=
"qaz"
;
/**
* 灾情状态
*/
public
static
final
String
FireHappenStateID
=
"90db70b7-49a4-4a72-b54b-0fabbed9bec7"
;
//发生
public
static
final
String
FireDevelopStateID
=
"1f7fe7d7-b30c-4518-8c95-6e3bc506ca86"
;
//猛烈
/**
* 车辆状态
*/
public
static
final
String
CarArrivedStateID
=
"ad55748a-1206-4507-8831-95b7f2ad804f"
;
//到达
public
static
final
String
CarDispatchingStateID
=
"43a23576-3d0f-4c3d-a46b-555391a4d870"
;
//待出动
public
static
final
String
CarOnDutyStateID
=
"21cc717f-60b4-46ae-942e-9efd63d13415"
;
//执勤
public
static
final
String
CarOnSiteStateID
=
"d7eddc16-4c55-4de0-b726-3547c7b0b980"
;
//在位
public
static
final
String
CarOnTheWayStateID
=
"5e1b6e98-d1dc-4c49-a7ad-b959d2278dba"
;
//在途
public
static
final
String
CarRepairStateID
=
"e86d455b-e9fd-4938-9826-38ca46623287"
;
//维修
/**
* 战斗力量编队状态
*/
public
static
final
String
RescuePowerArrivedStateID
=
"0951f770-7f75-43d8-bcec-47d7559be727"
;
//到达
public
static
final
String
RescuePowerDispatchedStateID
=
"ec4afc56-6cec-41a3-95f5-20c735f052d4"
;
//已调派
public
static
final
String
RescuePowerEnhanceStateID
=
"3d6cf113-b69d-47c3-a3a8-ded448cc4636"
;
//增援
public
static
final
String
RescuePowerFightingStateID
=
"4bacd4b4-b07d-454e-b737-431e7c997cde"
;
//战斗
public
static
final
String
RescuePowerStandByStateID
=
"4fc6e4d6-c6a8-453c-b554-ce7de0b828b2"
;
//待命
/**
* sql注入关键字
*/
public
static
String
badStr
=
"'|and|exec|execute|insert|select|delete|update|count|drop|%|chr|mid|master|truncate|"
+
"char|declare|sitename|net user|xp_cmdshell|;|or|-|+|,|like'|and|exec|execute|insert|create|drop|"
+
"table|from|grant|use|group_concat|column_name|"
+
"information_schema.columns|table_schema|union|where|select|delete|update|order|by|count|"
+
"chr|mid|master|truncate|char|declare|or|;|-|--|,|like|//|/|%|#"
;
}
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/Util/HttpUtil.java
0 → 100644
View file @
0f836c11
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
api
.
Util
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpStatus
;
import
org.apache.http.client.config.RequestConfig
;
import
org.apache.http.client.methods.*
;
import
org.apache.http.config.Registry
;
import
org.apache.http.config.RegistryBuilder
;
import
org.apache.http.conn.socket.ConnectionSocketFactory
;
import
org.apache.http.conn.socket.PlainConnectionSocketFactory
;
import
org.apache.http.conn.ssl.SSLConnectionSocketFactory
;
import
org.apache.http.conn.ssl.TrustSelfSignedStrategy
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.DefaultHttpRequestRetryHandler
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.impl.conn.PoolingHttpClientConnectionManager
;
import
org.apache.http.ssl.SSLContextBuilder
;
import
org.apache.http.util.EntityUtils
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.PrintWriter
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.util.Iterator
;
import
java.util.Map
;
public
class
HttpUtil
{
// utf-8字符编码
private
static
final
String
CHARSET_UTF_8
=
"utf-8"
;
// HTTP内容类型。
private
static
final
String
CONTENT_TYPE_TEXT_HTML
=
"text/xml"
;
// HTTP内容类型。相当于form表单的形式,提交数据
private
static
final
String
CONTENT_TYPE_FORM_URL
=
"application/x-www-form-urlencoded"
;
// HTTP内容类型。相当于form表单的形式,提交数据
private
static
final
String
CONTENT_TYPE_JSON_URL
=
"application/json;charset=utf-8"
;
// 连接管理器
private
static
PoolingHttpClientConnectionManager
pool
;
// 请求配置
private
static
RequestConfig
requestConfig
;
static
{
try
{
//System.out.println("初始化HttpClientTest~~~开始");
SSLContextBuilder
builder
=
new
SSLContextBuilder
();
builder
.
loadTrustMaterial
(
null
,
new
TrustSelfSignedStrategy
());
SSLConnectionSocketFactory
sslsf
=
new
SSLConnectionSocketFactory
(
builder
.
build
());
// 配置同时支持 HTTP 和 HTPPS
Registry
<
ConnectionSocketFactory
>
socketFactoryRegistry
=
RegistryBuilder
.<
ConnectionSocketFactory
>
create
().
register
(
"http"
,
PlainConnectionSocketFactory
.
getSocketFactory
()).
register
(
"https"
,
sslsf
).
build
();
// 初始化连接管理器
pool
=
new
PoolingHttpClientConnectionManager
(
socketFactoryRegistry
);
// 将最大连接数增加到200,实际项目最好从配置文件中读取这个值
pool
.
setMaxTotal
(
200
);
// 设置最大路由
pool
.
setDefaultMaxPerRoute
(
2
);
// 根据默认超时限制初始化requestConfig
int
socketTimeout
=
10000
;
int
connectTimeout
=
10000
;
int
connectionRequestTimeout
=
10000
;
requestConfig
=
RequestConfig
.
custom
().
setConnectionRequestTimeout
(
connectionRequestTimeout
).
setSocketTimeout
(
socketTimeout
).
setConnectTimeout
(
connectTimeout
).
build
();
//System.out.println("初始化HttpClientTest~~~结束");
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
// 设置请求超时时间
requestConfig
=
RequestConfig
.
custom
().
setSocketTimeout
(
50000
).
setConnectTimeout
(
50000
)
.
setConnectionRequestTimeout
(
50000
).
build
();
}
private
static
CloseableHttpClient
getHttpClient
()
{
return
HttpClients
.
custom
()
// 设置连接池管理
.
setConnectionManager
(
pool
)
// 设置请求配置
.
setDefaultRequestConfig
(
requestConfig
)
// 设置重试次数
.
setRetryHandler
(
new
DefaultHttpRequestRetryHandler
(
0
,
false
))
.
build
();
}
/**
* 发送Post请求
*/
private
static
String
sendHttpPost
(
HttpPost
httpPost
)
{
CloseableHttpClient
httpClient
=
null
;
CloseableHttpResponse
response
=
null
;
// 响应内容
String
responseContent
=
null
;
try
{
// 创建默认的httpClient实例.
httpClient
=
getHttpClient
();
// 配置请求信息
httpPost
.
setConfig
(
requestConfig
);
// 执行请求
response
=
httpClient
.
execute
(
httpPost
);
// 得到响应实例
HttpEntity
entity
=
response
.
getEntity
();
// 可以获得响应头
// Header[] headers = response.getHeaders(HttpHeaders.CONTENT_TYPE);
// for (Header header : headers) {
// System.out.println(header.getName());
// }
// 得到响应类型
// System.out.println(ContentType.getOrDefault(response.getEntity()).getMimeType());
// 判断响应状态
if
(
response
.
getStatusLine
().
getStatusCode
()
>=
300
)
{
throw
new
Exception
(
"HTTP Request is not success, Response code is "
+
response
.
getStatusLine
().
getStatusCode
());
}
if
(
HttpStatus
.
SC_OK
==
response
.
getStatusLine
().
getStatusCode
()
||
HttpStatus
.
SC_CREATED
==
response
.
getStatusLine
().
getStatusCode
())
{
responseContent
=
EntityUtils
.
toString
(
entity
,
CHARSET_UTF_8
);
EntityUtils
.
consume
(
entity
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
// 释放资源
if
(
response
!=
null
)
{
response
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
responseContent
;
}
/**
* 发送Post请求
*
* @param httpPut
* @return
*/
private
static
String
sendHttpPut
(
HttpPut
httpPut
)
{
CloseableHttpClient
httpClient
=
null
;
CloseableHttpResponse
response
=
null
;
// 响应内容
String
responseContent
=
null
;
try
{
// 创建默认的httpClient实例.
httpClient
=
getHttpClient
();
// 配置请求信息
httpPut
.
setConfig
(
requestConfig
);
// 执行请求
response
=
httpClient
.
execute
(
httpPut
);
// 得到响应实例
HttpEntity
entity
=
response
.
getEntity
();
// 可以获得响应头
// Header[] headers = response.getHeaders(HttpHeaders.CONTENT_TYPE);
// for (Header header : headers) {
// System.out.println(header.getName());
// }
// 得到响应类型
// System.out.println(ContentType.getOrDefault(response.getEntity()).getMimeType());
// 判断响应状态
if
(
response
.
getStatusLine
().
getStatusCode
()
>=
300
)
{
throw
new
Exception
(
"HTTP Request is not success, Response code is "
+
response
.
getStatusLine
().
getStatusCode
());
}
if
(
HttpStatus
.
SC_OK
==
response
.
getStatusLine
().
getStatusCode
()
||
HttpStatus
.
SC_CREATED
==
response
.
getStatusLine
().
getStatusCode
())
{
responseContent
=
EntityUtils
.
toString
(
entity
,
CHARSET_UTF_8
);
EntityUtils
.
consume
(
entity
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
// 释放资源
if
(
response
!=
null
)
{
response
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
responseContent
;
}
/**
* 发送Post请求
*
* @param httpDelete
* @return
*/
private
static
String
sendHttpDelete
(
HttpDelete
httpDelete
)
{
CloseableHttpClient
httpClient
=
null
;
CloseableHttpResponse
response
=
null
;
// 响应内容
String
responseContent
=
null
;
try
{
// 创建默认的httpClient实例.
httpClient
=
getHttpClient
();
// 配置请求信息
httpDelete
.
setConfig
(
requestConfig
);
// 执行请求
response
=
httpClient
.
execute
(
httpDelete
);
// 得到响应实例
HttpEntity
entity
=
response
.
getEntity
();
// 可以获得响应头
// Header[] headers = response.getHeaders(HttpHeaders.CONTENT_TYPE);
// for (Header header : headers) {
// System.out.println(header.getName());
// }
// 得到响应类型
// System.out.println(ContentType.getOrDefault(response.getEntity()).getMimeType());
// 判断响应状态
if
(
response
.
getStatusLine
().
getStatusCode
()
>=
300
)
{
throw
new
Exception
(
"HTTP Request is not success, Response code is "
+
response
.
getStatusLine
().
getStatusCode
());
}
if
(
HttpStatus
.
SC_OK
==
response
.
getStatusLine
().
getStatusCode
()
||
HttpStatus
.
SC_CREATED
==
response
.
getStatusLine
().
getStatusCode
())
{
responseContent
=
EntityUtils
.
toString
(
entity
,
CHARSET_UTF_8
);
EntityUtils
.
consume
(
entity
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
// 释放资源
if
(
response
!=
null
)
{
response
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
responseContent
;
}
/**
* 发送Get请求
*
* @param httpGet
* @return
*/
private
static
String
sendHttpGet
(
HttpGet
httpGet
)
{
CloseableHttpClient
httpClient
=
null
;
CloseableHttpResponse
response
=
null
;
// 响应内容
String
responseContent
=
null
;
try
{
// 创建默认的httpClient实例.
httpClient
=
getHttpClient
();
// 配置请求信息
httpGet
.
setConfig
(
requestConfig
);
// 执行请求
response
=
httpClient
.
execute
(
httpGet
);
// 得到响应实例
HttpEntity
entity
=
response
.
getEntity
();
// 可以获得响应头
// Header[] headers = response.getHeaders(HttpHeaders.CONTENT_TYPE);
// for (Header header : headers) {
// System.out.println(header.getName());
// }
// 得到响应类型
// System.out.println(ContentType.getOrDefault(response.getEntity()).getMimeType());
// 判断响应状态
if
(
response
.
getStatusLine
().
getStatusCode
()
>=
300
)
{
throw
new
Exception
(
"HTTP Request is not success, Response code is "
+
response
.
getStatusLine
().
getStatusCode
());
}
if
(
HttpStatus
.
SC_OK
==
response
.
getStatusLine
().
getStatusCode
())
{
responseContent
=
EntityUtils
.
toString
(
entity
,
CHARSET_UTF_8
);
EntityUtils
.
consume
(
entity
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
// 释放资源
if
(
response
!=
null
)
{
response
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
responseContent
;
}
/**
* 发送 post请求
*
* @param httpUrl 地址
*/
public
static
String
sendHttpPost
(
String
httpUrl
)
{
// 创建httpPost
HttpPost
httpPost
=
new
HttpPost
(
httpUrl
);
return
sendHttpPost
(
httpPost
);
}
/**
* 发送 delete请求
*
* @param httpUrl 地址
*/
public
static
String
sendHttpDelete
(
String
httpUrl
)
{
// 创建httpPost
HttpDelete
httpDelete
=
new
HttpDelete
(
httpUrl
);
return
sendHttpDelete
(
httpDelete
);
}
/**
* 发送 post请求
*
* @param httpUrl 地址
*/
public
static
String
sendHttpPostWithHeader
(
String
httpUrl
,
Map
<
String
,
String
>
headerMap
)
{
// 创建httpPost
HttpPost
httpPost
=
new
HttpPost
(
httpUrl
);
for
(
Map
.
Entry
<
String
,
String
>
entry
:
headerMap
.
entrySet
())
{
httpPost
.
setHeader
(
entry
.
getKey
(),
entry
.
getValue
());
}
return
sendHttpPost
(
httpPost
);
}
/**
* 发送 get请求
*
* @param httpUrl
*/
public
static
String
sendHttpGet
(
String
httpUrl
)
{
// 创建get请求
HttpGet
httpGet
=
new
HttpGet
(
httpUrl
);
return
sendHttpGet
(
httpGet
);
}
/**
* 发送 delete请求带请求头
*/
public
static
String
sendHttpDeleteWithHeader
(
String
httpUrl
,
Map
<
String
,
String
>
headerMap
)
{
// 创建get请求
HttpDelete
httpDelete
=
new
HttpDelete
(
httpUrl
);
for
(
Map
.
Entry
<
String
,
String
>
entry
:
headerMap
.
entrySet
())
{
httpDelete
.
setHeader
(
entry
.
getKey
(),
entry
.
getValue
());
}
return
sendHttpDelete
(
httpDelete
);
}
/**
* 发送 get请求带请求头
*/
public
static
String
sendHttpGetWithHeader
(
String
httpUrl
,
Map
<
String
,
String
>
headerMap
)
{
// 创建get请求
HttpGet
httpGet
=
new
HttpGet
(
httpUrl
);
for
(
Map
.
Entry
<
String
,
String
>
entry
:
headerMap
.
entrySet
())
{
httpGet
.
setHeader
(
entry
.
getKey
(),
entry
.
getValue
());
}
return
sendHttpGet
(
httpGet
);
}
/**
* 发送 delete请求带请求头
*/
public
static
String
sendHttpDeleteJsonWithHeader
(
String
httpUrl
,
String
paramsJson
,
Map
<
String
,
String
>
headerMap
)
{
StringBuffer
content
=
new
StringBuffer
();
try
{
URL
url
=
new
URL
(
httpUrl
);
HttpURLConnection
connection
=
(
HttpURLConnection
)
url
.
openConnection
();
connection
.
setRequestMethod
(
"DELETE"
);
connection
.
setDoInput
(
true
);
connection
.
setDoOutput
(
true
);
connection
.
setRequestProperty
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
for
(
Map
.
Entry
<
String
,
String
>
entry
:
headerMap
.
entrySet
())
{
connection
.
setRequestProperty
(
entry
.
getKey
(),
entry
.
getValue
());
}
PrintWriter
printWriter
=
new
PrintWriter
(
connection
.
getOutputStream
());
printWriter
.
write
(
paramsJson
);
printWriter
.
flush
();
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
connection
.
getInputStream
()));
String
line
;
while
((
line
=
br
.
readLine
())
!=
null
)
{
content
.
append
(
line
);
}
br
.
close
();
connection
.
disconnect
();
}
catch
(
Exception
e
)
{
}
return
content
.
toString
();
}
/**
* 发送 post请求
*
* @param httpUrl 地址
* @param params 参数(格式:key1=value1&key2=value2)
*/
public
static
String
sendHttpPost
(
String
httpUrl
,
String
params
)
{
HttpPost
httpPost
=
new
HttpPost
(
httpUrl
);
// 创建httpPost
try
{
// 设置参数
if
(
params
!=
null
&&
params
.
trim
().
length
()
>
0
)
{
StringEntity
stringEntity
=
new
StringEntity
(
params
,
"UTF-8"
);
stringEntity
.
setContentType
(
CONTENT_TYPE_FORM_URL
);
httpPost
.
setEntity
(
stringEntity
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
sendHttpPost
(
httpPost
);
}
/**
* 发送 post请求
*
* @param maps 参数
*/
public
static
String
sendHttpPost
(
String
httpUrl
,
Map
<
String
,
String
>
maps
)
{
String
parem
=
convertStringParamter
(
maps
);
return
sendHttpPost
(
httpUrl
,
parem
);
}
/**
* 发送 post请求 发送json数据
*
* @param httpUrl 地址
* @param paramsJson 参数(格式 json)
*/
public
static
String
sendHttpPostJsonWithHeader
(
String
httpUrl
,
String
paramsJson
,
Map
<
String
,
String
>
headerMap
)
{
HttpPost
httpPost
=
new
HttpPost
(
httpUrl
);
// 创建httpPost
try
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
headerMap
.
entrySet
())
{
httpPost
.
setHeader
(
entry
.
getKey
(),
entry
.
getValue
());
}
// 设置参数
if
(
paramsJson
!=
null
&&
paramsJson
.
trim
().
length
()
>
0
)
{
StringEntity
stringEntity
=
new
StringEntity
(
paramsJson
,
"UTF-8"
);
stringEntity
.
setContentType
(
CONTENT_TYPE_JSON_URL
);
httpPost
.
setEntity
(
stringEntity
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
sendHttpPost
(
httpPost
);
}
/**
* 发送 put请求 发送json数据
*
* @param httpUrl 地址
* @param paramsJson 参数(格式 json)
*/
public
static
String
sendHttpPutJsonWithHeader
(
String
httpUrl
,
String
paramsJson
,
Map
<
String
,
String
>
headerMap
)
{
HttpPut
httpPost
=
new
HttpPut
(
httpUrl
);
// 创建HttpPut
try
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
headerMap
.
entrySet
())
{
httpPost
.
setHeader
(
entry
.
getKey
(),
entry
.
getValue
());
}
// 设置参数
if
(
paramsJson
!=
null
&&
paramsJson
.
trim
().
length
()
>
0
)
{
StringEntity
stringEntity
=
new
StringEntity
(
paramsJson
,
"UTF-8"
);
stringEntity
.
setContentType
(
CONTENT_TYPE_JSON_URL
);
httpPost
.
setEntity
(
stringEntity
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
sendHttpPut
(
httpPost
);
}
/**
* 发送 post请求 发送json数据
*
* @param httpUrl 地址
* @param paramsJson 参数(格式 json)
*/
public
static
String
sendHttpPostJson
(
String
httpUrl
,
String
paramsJson
)
{
HttpPost
httpPost
=
new
HttpPost
(
httpUrl
);
// 创建httpPost
try
{
// 设置参数
if
(
paramsJson
!=
null
&&
paramsJson
.
trim
().
length
()
>
0
)
{
StringEntity
stringEntity
=
new
StringEntity
(
paramsJson
,
"UTF-8"
);
stringEntity
.
setContentType
(
CONTENT_TYPE_JSON_URL
);
httpPost
.
setEntity
(
stringEntity
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
sendHttpPost
(
httpPost
);
}
/**
* 发送 post请求 发送xml数据
*
* @param httpUrl 地址
* @param paramsXml 参数(格式 Xml)
*/
public
static
String
sendHttpPostXml
(
String
httpUrl
,
String
paramsXml
)
{
HttpPost
httpPost
=
new
HttpPost
(
httpUrl
);
// 创建httpPost
try
{
// 设置参数
if
(
paramsXml
!=
null
&&
paramsXml
.
trim
().
length
()
>
0
)
{
StringEntity
stringEntity
=
new
StringEntity
(
paramsXml
,
"UTF-8"
);
stringEntity
.
setContentType
(
CONTENT_TYPE_TEXT_HTML
);
httpPost
.
setEntity
(
stringEntity
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
sendHttpPost
(
httpPost
);
}
/**
* 将map集合的键值对转化成:key1=value1&key2=value2 的形式
*
* @param parameterMap 需要转化的键值对集合
* @return 字符串
*/
private
static
String
convertStringParamter
(
Map
parameterMap
)
{
StringBuffer
parameterBuffer
=
new
StringBuffer
();
if
(
parameterMap
!=
null
)
{
Iterator
iterator
=
parameterMap
.
keySet
().
iterator
();
String
key
=
null
;
String
value
=
null
;
while
(
iterator
.
hasNext
())
{
key
=
(
String
)
iterator
.
next
();
if
(
parameterMap
.
get
(
key
)
!=
null
)
{
value
=
(
String
)
parameterMap
.
get
(
key
);
}
else
{
value
=
""
;
}
parameterBuffer
.
append
(
key
).
append
(
"="
).
append
(
value
);
if
(
iterator
.
hasNext
())
{
parameterBuffer
.
append
(
"&"
);
}
}
}
return
parameterBuffer
.
toString
();
}
}
\ No newline at end of file
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/constants/XJConstant.java
0 → 100644
View file @
0f836c11
/**
*
*/
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
api
.
constants
;
import
org.slf4j.LoggerFactory
;
import
java.text.SimpleDateFormat
;
/**
* 常量
*/
public
class
XJConstant
{
public
static
final
String
ROOT_PATH
=
"F:/software/nginx-1.14.2/html/"
;
public
static
final
String
NGINX_ADDRESS
=
"172.16.3.77:8081/"
;
public
static
final
String
DEFAULT_RISKDESC
=
"默认"
;
public
static
final
String
JPUSH_USER_KEY
=
"BANK88"
;
public
static
final
String
CHECK_TYPE
=
"CHECK_TYPE"
;
public
static
final
String
DEPT_WF_MAP_DIC_CODE
=
"DEPT_WF_MAP"
;
/**
* 构造方法
*/
private
XJConstant
()
{
LoggerFactory
.
getLogger
(
this
.
getClass
()).
debug
(
XJConstant
.
CONSTRUCTOR
);
}
/**
* 网络服务ip
*/
public
static
final
String
NET_SERVER_HOST
=
"0.0.0.0"
;
/**
* 请求头key
*/
public
static
final
String
TOKEN_KEY
=
"token"
;
/**
* 请求头key
*/
public
static
final
String
PRODUCT
=
"product"
;
/**
* 请求头key
*/
public
static
final
String
APPKEY
=
"appKey"
;
/**
* 时间格式(yyyy-MM-dd HH:mm:ss)
*/
public
static
final
SimpleDateFormat
SIMPLEDATAFORMAT_YMDHMS
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
/**
* 构造方法字符串
*/
public
static
final
String
CONSTRUCTOR
=
"constructor..."
;
/**
* 轮询job最大线程数
*/
public
static
final
int
POLLING_JOB_THREAD_MAX_NUM
=
20
;
/**
* amos线程池数量
*/
public
static
final
int
AMOS_THREAD_NUM
=
20
;
/**
* 设备测试最大线程数
*/
public
static
final
int
TEST_EQUIPMENT_THREAD_MAX_NUM
=
5
;
/**
* 时间格式字符串:yyyy-MM-dd HH:mm:ss
*/
public
static
final
String
DATE_TIME_STR_YMDHMS
=
"yyyy-MM-dd HH:mm:ss"
;
/**
* bar
*/
public
static
final
String
BAR
=
"-"
;
/**
* Underline
*/
public
static
final
String
UNDERLINE
=
"_"
;
/**
* user
*/
public
static
final
String
USER
=
"user"
;
/**
* token
*/
public
static
final
String
TOKEN
=
"token"
;
/**
* loginType
*/
public
static
final
String
LOGIN_TYPE
=
"loginType"
;
/**
* subGraphId
*/
public
static
final
String
SUB_GRAPH_ID
=
"subGraphId"
;
public
static
final
String
ADMIN_ID
=
"1"
;
/**
* 帧报文异常
*/
public
static
final
String
FRAME_EXECPTION
=
"FRAME"
;
/**
* 性能指标
*/
public
static
final
String
METRIC
=
"METRIC"
;
/**
* 报文通道
*/
public
static
final
String
CHANNEL
=
"CHANNEL"
;
/**
* 设备状态(掉线)告警
*/
public
static
final
String
EQUIPMENT_STATUS
=
"EQUIPMENT_STATUS"
;
/**
* 设备连通性告警告警
*/
public
static
final
String
EQUIPMENT_CONNECTION
=
"EQUIPMENT_CONNECTION"
;
/**
* 通道注册
*/
public
static
final
String
REGISTER
=
"REGISTER"
;
/**
* 通道注销
*/
public
static
final
String
UNREGISTER
=
"UNREGISTER"
;
/**
* 报文正常
*/
public
static
final
String
NORMAL
=
"NORMAL"
;
/**
* 报文异常
*/
public
static
final
String
UNNORMAL
=
"UNNORMAL"
;
/**
* 告警socket类型
*/
public
static
final
String
ALARM_SOCKET
=
"ALARM_SOCKET"
;
/**
* 数据socket类型
*/
public
static
final
String
METRIC_SOCKET
=
"METRIC_SOCKET"
;
/**
* 数据socket类型
*/
public
static
final
String
MORPHIC_SOCKET
=
"MORPHIC_SOCKET"
;
/**
* false
*/
public
static
final
Boolean
FAIL_BOOLEAN_VALUE
=
Boolean
.
FALSE
;
/**
* 0
*/
public
static
final
Integer
ZERO_INT_VALUE
=
Integer
.
parseInt
(
"0"
);
/**
* -1
*/
public
static
final
Integer
FAIL_INT_VALUE
=
Integer
.
parseInt
(
"-1"
);
/**
* -1
*/
public
static
final
Long
FAIL_LONG_VALUE
=
Long
.
parseLong
(
"-1"
);
/**
* -1
*/
public
static
final
Short
FAIL_SHORT_VALUE
=
Short
.
parseShort
(
"-1"
);
/**
*
*/
public
static
final
Float
FAIL_FLOAT_VALUE
=
Float
.
parseFloat
(
"-1"
);
/**
* -1
*/
public
static
final
Double
FAIL_DOUBLE_VALUE
=
Double
.
parseDouble
(
"-1"
);
/**
* 空格
*/
public
static
final
Character
FAIL_CHARACTER_VALUE
=
Character
.
valueOf
(
' '
);
/**
* 失败
*/
public
static
final
int
FAILURE
=
0
;
/**
* 成功
*/
public
static
final
int
SUCCESS
=
1
;
/**
* 在线
*/
public
static
final
String
ONLINE
=
"在线"
;
/**
* 掉线
*/
public
static
final
String
OFFLINE
=
"掉线"
;
/**
* 通
*/
public
static
final
String
OPEN
=
"通"
;
/**
* 不通
*/
public
static
final
String
OFF
=
"不通"
;
/**
* ip
*/
public
static
final
String
IP
=
"ip"
;
/**
* #
*/
public
static
final
String
SHARP
=
"#"
;
/**
* TCP
*/
public
static
final
String
TCP
=
"TCP"
;
public
static
final
String
PIE_CHAR
=
"pieChar"
;
public
static
final
String
BAR_CHAR
=
"barChar"
;
public
static
final
String
HBAR_CHAR
=
"hbarChar"
;
public
static
final
String
LINE_CHAR
=
"lineChar"
;
public
static
final
String
DOUGHUNT_CHAR
=
"doughuntChar"
;
public
static
final
String
ROSE_CHAR
=
"roseChar"
;
public
static
final
String
AREA_CHAR
=
"areaChar"
;
public
static
final
String
DIMENSION
=
"dimension"
;
public
static
final
String
MEASURE
=
"measure"
;
/**
* xunjian
*/
public
static
final
String
TABLE_USERS
=
"Users"
;
public
static
final
String
EDIT_PWD
=
"editPassword"
;
public
static
final
String
EDIT_NOT_PWD
=
"editUsersInfo"
;
public
static
final
String
SAVE_USERS
=
"saveTableById"
;
public
static
final
String
SAVE_COM_USER
=
"saveComUserInfo"
;
public
static
final
String
EDIT_COM_USER
=
"editComUserInfo"
;
public
static
final
String
TABLE_CHECK
=
"Check"
;
public
static
final
String
TABLE_COM_USER
=
"companyUser"
;
public
static
final
int
FINISH_YES
=
2
;
public
static
final
int
FINISH_ING
=
1
;
public
static
final
int
FINISH_NO
=
0
;
public
static
final
String
SAVE_DEPART
=
"saveDepartMent"
;
public
static
final
String
EDIT_DEPART
=
"editsDepartMent"
;
public
static
final
String
TABLE_DEPART
=
"Group"
;
public
static
final
String
TABLE_ERROR
=
"Error"
;
//隐患表
public
static
final
String
SAVE_ERROR
=
"saveErrorByID"
;
//更新隐患表
public
static
final
int
XJ_ADMIN_ROLE
=
9
;
//巡检管理员角色ID
public
static
final
int
XJ_USER_ROLE
=
0
;
//巡检普通用户角色ID
public
static
final
int
TASK_STATUS_TIMEOUT
=
3
;
//已超时
public
static
final
int
TASK_STATUS_FINISH
=
2
;
//已结束
public
static
final
int
TASK_STATUS_DEAL
=
1
;
//进行中
public
static
final
int
TASK_STATUS_NO_START
=
0
;
//未开始
public
static
final
String
PLAN_TASK_DET_FINISH_NO
=
"0"
;
//任务明细状态:未完成
public
static
final
String
PLAN_TASK_DET_FINISH_YES
=
"1"
;
//任务明细状态:完成
public
static
final
String
PLAN_TASK_DET_FINISH_OUT
=
"2"
;
//任务明细状态:超时漏检
public
static
final
String
USER_DATA_ADMIN
=
"全部可见"
;
//用户数据可见范围
public
static
final
String
USER_DATA_DEPART
=
"部门可见"
;
//用户数据可见范围
public
static
final
String
USER_DATA_PERSON
=
"个人可见"
;
//用户数据可见范围
public
static
final
String
USER_ROLE_SUPERADMIN
=
"1"
;
//权限id-超级管理员
public
static
final
String
USER_ROLE_ADMIN
=
"2"
;
//权限id-管理员
public
static
final
String
USER_ROLE_DEPART
=
"3"
;
//权限id-部门管理
public
static
final
String
USER_ROLE_PERSON
=
"4"
;
//权限id-普通用户
public
static
final
String
ROLE_NAME_SUPERADMIN
=
"SUPERADMIN"
;
//数据权限-超级管理员
public
static
final
String
ROLE_NAME_ADMIN
=
"ADMIN"
;
//数据权限-超级管理员
public
static
final
String
ROLE_NAME_DEPTADMIN
=
"DEPTADMIN"
;
//数据权限-部门
public
static
final
String
ROLE_NAME_PERSON
=
"PERSONAL"
;
//数据权限-个人
public
static
final
String
ADMIN_FLAG
=
"2"
;
//权限标记
public
static
final
String
DEPART_FLAG
=
"1"
;
//权限标记
public
static
final
String
PERSON_FLAG
=
"0"
;
//权限标记
public
static
final
String
ADMIN_FLAG_NO
=
"0"
;
//标记 0-无关
public
static
final
String
ADMIN_FLAG_UP
=
"1"
;
//1-上级admin
public
static
final
String
ADMIN_FLAG_THIS
=
"2"
;
//2-本级admin
public
static
final
String
UNCLASSIFIED
=
"Unclassifed"
;
//巡检点未分类
public
static
final
String
ADMIN_ORG_CODE
=
"2"
;
public
static
final
String
CHECK_CHANGE_NO
=
"0"
;
//是否记为合格:否
public
static
final
String
CHECK_CHANGE_YES
=
"1"
;
//是否记为合格:是
public
static
final
String
SCHED_FLAG
=
"99"
;
//自动任务标记
public
static
final
String
REGEN_FLAG
=
"98"
;
//重做任务标记
public
static
final
String
FIX_DATE_NO
=
"0"
;
//不固定日期(区间)
public
static
final
String
FIX_DATE_YES
=
"1"
;
//固定日期
//计划类型
public
static
final
String
PLAN_TYPE_DAY
=
"1"
;
//日计划
public
static
final
String
PLAN_TYPE_WEEK
=
"2"
;
//周计划
public
static
final
String
PLAN_TYPE_MONTH
=
"3"
;
//月计划
public
static
final
String
PLAN_TYPE_YEAR
=
"4"
;
//年计划
//月类型
public
static
final
String
MONTH_TYPE_DAY
=
"1"
;
//第几天
public
static
final
String
MONTH_TYPE_AT
=
"2"
;
//在第几周的第几天
public
static
final
String
INTERVAL_UNIT_HOUR
=
"1"
;
//执行间隔小时
public
static
final
String
INTERVAL_UNIT_MINUTE
=
"2"
;
//执行间隔分钟
public
static
final
String
INTERVAL_UNIT_SECOND
=
"3"
;
//执行间隔秒
public
static
final
String
ZERO_TIME
=
"00:00:00"
;
//time
public
static
final
String
PLAN_STATUS_START
=
"0"
;
//计划状态:正常
public
static
final
String
PLAN_STATUS_STOP
=
"1"
;
//计划状态:已停用
public
static
final
int
PLAN_FIRST_STATUS_YES
=
0
;
//计划:初始状态
public
static
final
int
PLAN_FIRST_STATUS_NO
=
1
;
//计划:非初始状态
public
static
final
String
UPD_PLAN_GEN_DATE
=
"1"
;
//更新plan表日期
public
static
final
String
UPD_PLAN_STATUS
=
"2"
;
//更新plan表next_gen_status
public
static
final
int
DAY_RATE_ONE
=
0
;
//0-1次
public
static
final
int
DAY_RATE_MANY
=
1
;
//1-多次
public
static
final
int
IS_DETETE_NO
=
0
;
//未删除
public
static
final
int
IS_DETETE_YES
=
1
;
//删除
public
static
final
String
UPLOAD_ROOT_PATH
=
"upload"
;
public
static
final
String
INPUT_ITEM_TEXT
=
"文本"
;
public
static
final
String
INPUT_ITEM_NUMBER
=
"数字"
;
public
static
final
String
INPUT_ITEM_SELECT
=
"选择"
;
public
static
final
String
CHECK_TYPE_ALWAYS_OK
=
"始终合格"
;
public
static
final
String
CHECK_TYPE_ALWAYS_NO
=
"始终不合格"
;
public
static
final
String
CHECK_TYPE_NO_CONTEXT_OK
=
"无内容合格"
;
public
static
final
String
CHECK_TYPE_CONTEXT_OK
=
"有内容合格"
;
public
static
final
String
OK
=
"合格"
;
public
static
final
String
NO
=
"不合格"
;
public
static
final
String
YES
=
"是"
;
public
static
final
String
NOT
=
"否"
;
public
static
final
String
INPUT_ITEM_OK_SCORE
=
"OkScore"
;
public
static
final
String
INPUT_ITEM_NOT_SCORE
=
"NoScore"
;
public
static
final
String
POINT_OK_SCORE
=
"1"
;
public
static
final
String
POINT_NOT_SCORE
=
"0"
;
/**
* 任务是否发送消息状态
*/
public
static
final
String
TASK_WARN
=
"是"
;
public
static
final
String
TASK_NOT_WARN
=
"否"
;
/**
* 系统定时任务类型
*/
public
static
final
String
STATUS_MONITOR_START
=
"statusMonitorStart"
;
//状态监控是否开始
public
static
final
String
STATUS_MONITOR_END
=
"statusMonitorEnd"
;
//状态监控是否结束
public
static
final
String
PLAN_TASK_WARN_MSG_PUSH
=
"planTaskWarnMsgPush"
;
//计划即将开始消息提醒推送
public
static
final
String
PLAN_TASK_BEGIN_MSG_PUSH
=
"planTaskBeginMsgPush"
;
//计划已经开始消息提醒推送
public
static
final
String
PLAN_TASK_END_MSG_PUSH
=
"planTaskEndMsgPush"
;
//计划已经开始消息提醒推送
public
static
final
String
MESSAGE_PUSH
=
"messagePush"
;
//消息推送
public
static
final
int
IS_SENT
=
1
;
//已发送
public
static
final
int
NOT_SENT
=
0
;
//未发送
public
static
final
String
IS_FIXED_YES
=
"1"
;
//固定点
}
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/controller/ProjectInitiationController.java
0 → 100644
View file @
0f836c11
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
biz
.
controller
;
import
com.yeejoin.amos.boot.module.ugp.biz.service.impl.ProjectInitiationServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
@RestController
@Api
(
tags
=
"流程相关"
)
@RequestMapping
(
value
=
"/projectInitiation"
)
public
class
ProjectInitiationController
{
@Autowired
ProjectInitiationServiceImpl
projectInitiationServiceImpl
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/start"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"流程启动"
,
notes
=
"流程启动"
)
public
void
start
()
throws
Exception
{
projectInitiationServiceImpl
.
start
();
}
}
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/service/impl/ProjectInitiationServiceImpl.java
0 → 100644
View file @
0f836c11
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Maps
;
import
com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService
;
import
com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil
;
import
com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectInitiationEnum
;
import
com.yeejoin.amos.boot.module.ugp.api.Util.CommonResponse
;
import
com.yeejoin.amos.boot.module.ugp.api.Util.HttpUtil
;
import
com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.Map
;
@Service
public
class
ProjectInitiationServiceImpl
{
@Autowired
WorkflowExcuteServiceImpl
workflowExcuteService
;
@Autowired
WorkflowFeignService
workflowFeignService
;
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ProjectInitiationServiceImpl
.
class
);
@Value
(
"${params.work.flow.processDefinitionKey}"
)
private
String
processDefinitionKey
;
public
ResponseModel
start
()
throws
Exception
{
String
instanceId
=
workflowExcuteService
.
startAndComplete
(
processDefinitionKey
,
null
);
JSONObject
jsonObject
=
workflowFeignService
.
getTask
(
instanceId
);
// workflowFeignService.completeByVariable(,)
return
CommonResponseUtil
.
success
();
}
// public JSONObject startNew(String processDefinitionKey) {
// String url = buildUrl(address, ProjectInitiationEnum.合并启动流程, 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("processDefinitionKey", processDefinitionKey);
// String resultStr = HttpUtil.sendHttpPostJsonWithHeader(url, body.toJSONString(), headerMap);
// logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + body + "\r\n返回参数=======================>" + resultStr);
// return JSON.parseObject(resultStr);
// }
//
// private String buildUrl(String address, ProjectInitiationEnum projectInitiationEnum, Map<String, String> map) {
// String uri = projectInitiationEnum.getUri();
// String params = projectInitiationEnum.getParams();
// if (!StringUtils.isEmpty(params) && map != null) {
// String[] paramsArr = params.split(",");
// for (String param : paramsArr) {
// uri = uri.replace("{" + param + "}", map.get(param));
// }
// }
// return address + uri;
// }
}
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/resources/application-dev.properties
View file @
0f836c11
...
...
@@ -6,7 +6,7 @@ spring.datasource.username=root
spring.datasource.password
=
Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone
=
http://172.16.
10.210
:10001/eureka/
eureka.client.service-url.defaultZone
=
http://172.16.
3.99
:10001/eureka/
eureka.instance.prefer-ip-address
=
true
management.endpoint.health.show-details
=
always
management.endpoints.web.exposure.include
=
*
...
...
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/resources/application.properties
View file @
0f836c11
...
...
@@ -50,3 +50,5 @@ emqx.user-name=super
emqx.password
=
123456
fire-rescue
=
123
params.work.flow.processDefinitionKey
=
ceshi
\ No newline at end of file
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