Commit f9939759 authored by sml's avatar sml

冲突处理

parent 50594f0b
......@@ -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.getRoleType(), role.getRemark());
rolePermissMap.put(role.getRoleCode(), 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());
}
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);
}
/*Integer[] execIds = new Integer[] {};
if (postForObject.get("execIds")!=null) {
execIds = (Integer[])postForObject.get("execIds");
settings += "settings%5B" + i +"%5D=" + sla.getFlow() +"," + sla.getSlaRule() +"," + sla.getDuration()+"," + sla.getEmailNotification()+"," + sla.getKill();
}
String result = HttpClientUtils.post(executeFlowUrl + settings,"");
return result;
}
LOGGER.info("获取所有任务("+projectName+")正在调度execids"+execIds.toString());*/
/**
* 获取 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;
}
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