Commit f9939759 authored by sml's avatar sml

冲突处理

parent 50594f0b
...@@ -2,11 +2,14 @@ package com.jz.common.utils; ...@@ -2,11 +2,14 @@ package com.jz.common.utils;
import java.io.File; import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.jz.common.constant.JsonResult;
import com.jz.dmp.modules.controller.dataOperation.bean.SetSlaReq; import com.jz.dmp.modules.controller.dataOperation.bean.SetSlaReq;
import com.jz.dmp.modules.controller.dataOperation.bean.SetSlaRulesReq; import com.jz.dmp.modules.controller.dataOperation.bean.SetSlaRulesReq;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -139,7 +142,7 @@ public class AzkabanApiUtils2 { ...@@ -139,7 +142,7 @@ public class AzkabanApiUtils2 {
List<DmpRole> memberProjectRoles = dmpMember.getMemberProjectRoleList(); List<DmpRole> memberProjectRoles = dmpMember.getMemberProjectRoleList();
for (DmpRole role : memberProjectRoles) { for (DmpRole role : memberProjectRoles) {
rolePermissMap.put(role.getRoleType(), role.getRemark()); rolePermissMap.put(role.getRoleCode(), role.getRemark());
} }
SSOUserInfo ssoUserInfo = new SSOUserInfo(); SSOUserInfo ssoUserInfo = new SSOUserInfo();
ssoUserInfo.setUserName(dmpMember.getUsername()); ssoUserInfo.setUserName(dmpMember.getUsername());
...@@ -730,51 +733,48 @@ public class AzkabanApiUtils2 { ...@@ -730,51 +733,48 @@ public class AzkabanApiUtils2 {
/** /**
* Set SLA * Set SLA
* @author Bellamy * @author Bellamy
* @return 调用成功后,返回execid * @since 2021-03-08
* @return
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public String saveSla(SetSlaReq req) { public String saveSla(SetSlaReq req) {
String sessionId = login(); String sessionId = login();
String executeFlowUrl = azkabanServerUrl + "/schedule?token=" + sessionId; String executeFlowUrl = azkabanServerUrl + "/schedule?ajax=setSla&session.id=" + sessionId;
LinkedMultiValueMap<String, Object> linkedMultiValueMap = new LinkedMultiValueMap<String, Object>(); executeFlowUrl += "&scheduleId=" + req.getScheduleId() + "&slaEmails="+ req.getSlaEmails();
linkedMultiValueMap.add("session.id", sessionId); String settings = "&";
linkedMultiValueMap.add("ajax", "setSla");
linkedMultiValueMap.add("scheduleId", req.getScheduleId());
linkedMultiValueMap.add("slaEmails",req.getSlaEmails());
List<SetSlaRulesReq> slaRule = req.getSlaRule(); List<SetSlaRulesReq> slaRule = req.getSlaRule();
for (int i = 0; i < slaRule.size(); i++) { for (int i = 0; i < slaRule.size(); i++) {
SetSlaRulesReq sla = slaRule.get(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();
} }
String result = HttpClientUtils.post(executeFlowUrl + settings,"");
Map<String, Object> postForObject = null; return result;
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);
} }
/*Integer[] execIds = new Integer[] {}; /**
* 获取 SLA
if (postForObject.get("execIds")!=null) { * @author Bellamy
execIds = (Integer[])postForObject.get("execIds"); * @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;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment