Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jz-dmp-service
Project
Project
Details
Activity
Releases
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
姚本章
jz-dmp-service
Commits
f9939759
Commit
f9939759
authored
Mar 09, 2021
by
sml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
冲突处理
parent
50594f0b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
36 deletions
+36
-36
AzkabanApiUtils2.java
src/main/java/com/jz/common/utils/AzkabanApiUtils2.java
+36
-36
No files found.
src/main/java/com/jz/common/utils/AzkabanApiUtils2.java
View file @
f9939759
...
...
@@ -2,11 +2,14 @@ package com.jz.common.utils;
import
java.io.File
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.jz.common.constant.JsonResult
;
import
com.jz.dmp.modules.controller.dataOperation.bean.SetSlaReq
;
import
com.jz.dmp.modules.controller.dataOperation.bean.SetSlaRulesReq
;
import
org.slf4j.Logger
;
...
...
@@ -139,7 +142,7 @@ public class AzkabanApiUtils2 {
List
<
DmpRole
>
memberProjectRoles
=
dmpMember
.
getMemberProjectRoleList
();
for
(
DmpRole
role
:
memberProjectRoles
)
{
rolePermissMap
.
put
(
role
.
getRole
Typ
e
(),
role
.
getRemark
());
rolePermissMap
.
put
(
role
.
getRole
Cod
e
(),
role
.
getRemark
());
}
SSOUserInfo
ssoUserInfo
=
new
SSOUserInfo
();
ssoUserInfo
.
setUserName
(
dmpMember
.
getUsername
());
...
...
@@ -730,51 +733,48 @@ public class AzkabanApiUtils2 {
/**
* Set SLA
* @author Bellamy
* @return 调用成功后,返回execid
* @since 2021-03-08
* @return
*/
@SuppressWarnings
(
"unchecked"
)
public
String
saveSla
(
SetSlaReq
req
)
{
String
sessionId
=
login
();
String
executeFlowUrl
=
azkabanServerUrl
+
"/schedule?token="
+
sessionId
;
LinkedMultiValueMap
<
String
,
Object
>
linkedMultiValueMap
=
new
LinkedMultiValueMap
<
String
,
Object
>();
linkedMultiValueMap
.
add
(
"session.id"
,
sessionId
);
linkedMultiValueMap
.
add
(
"ajax"
,
"setSla"
);
linkedMultiValueMap
.
add
(
"scheduleId"
,
req
.
getScheduleId
());
linkedMultiValueMap
.
add
(
"slaEmails"
,
req
.
getSlaEmails
());
String
executeFlowUrl
=
azkabanServerUrl
+
"/schedule?ajax=setSla&session.id="
+
sessionId
;
executeFlowUrl
+=
"&scheduleId="
+
req
.
getScheduleId
()
+
"&slaEmails="
+
req
.
getSlaEmails
();
String
settings
=
"&"
;
List
<
SetSlaRulesReq
>
slaRule
=
req
.
getSlaRule
();
for
(
int
i
=
0
;
i
<
slaRule
.
size
();
i
++)
{
SetSlaRulesReq
sla
=
slaRule
.
get
(
i
);
linkedMultiValueMap
.
add
(
"settings["
+
i
+
"]"
,
sla
.
getFlow
()
+
","
+
sla
.
getSlaRule
()
+
","
+
sla
.
getDuration
()+
","
+
sla
.
getEmailNotification
()+
","
+
sla
.
getKill
()
);
settings
+=
"settings%5B"
+
i
+
"%5D="
+
sla
.
getFlow
()
+
","
+
sla
.
getSlaRule
()
+
","
+
sla
.
getDuration
()+
","
+
sla
.
getEmailNotification
()+
","
+
sla
.
getKill
(
);
}
Map
<
String
,
Object
>
postForObject
=
null
;
try
{
postForObject
=
bulidRestTemplate
().
postForObject
(
executeFlowUrl
,
linkedMultiValueMap
,
Map
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
executeFlowUrl
+
"----"
+
linkedMultiValueMap
+
"----设置SLA接口异常"
);
e
.
printStackTrace
();
throw
new
RuntimeException
(
"设置SLA接口异常"
);
}
if
(
postForObject
.
containsKey
(
"error"
)){
throw
new
RuntimeException
(
postForObject
.
get
(
"error"
).
toString
());
}
String
status
=
(
String
)
postForObject
.
get
(
"status"
);
if
(
"error"
.
equals
(
status
))
{
String
message
=
(
String
)
postForObject
.
get
(
"message"
);
throw
new
RuntimeException
(
message
);
String
result
=
HttpClientUtils
.
post
(
executeFlowUrl
+
settings
,
""
);
return
result
;
}
/*Integer[] execIds = new Integer[] {};
if (postForObject.get("execIds")!=null) {
execIds = (Integer[])postForObject.get("execIds");
/**
* 获取 SLA
* @author Bellamy
* @since 2021-03-08
* @return
*/
public
String
getSlaInfo
(
String
scheduleId
)
{
String
sessionId
=
login
();
String
executeFlowUrl
=
azkabanServerUrl
+
"/schedule?ajax=slaInfo&session.id="
+
sessionId
+
"&scheduleId="
+
scheduleId
;
String
result
=
HttpClientUtils
.
getJsonForParam
(
executeFlowUrl
,
new
HashMap
<>());
return
result
;
}
LOGGER.info("获取所有任务("+projectName+")正在调度execids"+execIds.toString());*/
return
null
;
/**
* 获取 业务流程 调度周期
* @author Bellamy
* @since 2021-03-08
* @return
*/
public
String
getSchedule
(
String
projectId
,
String
flowId
)
{
String
sessionId
=
login
();
String
executeFlowUrl
=
azkabanServerUrl
+
"/schedule?ajax=fetchSchedule&session.id="
+
sessionId
+
"&projectId="
+
projectId
+
"&flowId="
+
flowId
;
String
result
=
HttpClientUtils
.
getJsonForParam
(
executeFlowUrl
,
new
HashMap
<>());
return
result
;
}
}
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