...
|
...
|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ui.contants.AlarmGroupContants;
|
|
|
import com.ui.contants.HttpUriContants;
|
|
|
import com.ui.ctrl.util.ReleaseCheck;
|
|
|
import com.ui.http.HttpRestClient;
|
|
|
import com.ui.model.BaseResponse;
|
|
|
import com.ui.model.domain.BuildMessage;
|
...
|
...
|
@@ -42,6 +43,9 @@ public class ProjectBuildCtrl { |
|
|
@Autowired
|
|
|
private HttpRestClient httpRestClient;
|
|
|
|
|
|
@Autowired
|
|
|
private ReleaseCheck releaseCheck;
|
|
|
|
|
|
@RequestMapping("/toOm")
|
|
|
public ModelAndView toOm() {
|
|
|
return new ModelAndView("project/om");
|
...
|
...
|
@@ -171,34 +175,33 @@ public class ProjectBuildCtrl { |
|
|
*/
|
|
|
@RequestMapping(value = "check")
|
|
|
@ResponseBody
|
|
|
public String check(String projects, String branch, String environment,String workid,HttpSession httpSession) {
|
|
|
|
|
|
public BaseResponse check(String projects, String branch, String environment,String workid,HttpSession httpSession) {
|
|
|
BaseResponse rtnResponse=releaseCheck.check(workid,httpSession);
|
|
|
if(200!=rtnResponse.getCode()){
|
|
|
return rtnResponse;
|
|
|
}
|
|
|
//项目冲突的校验
|
|
|
List<Object> checkRtn= ProjectMutex.checkMutex(projects);
|
|
|
boolean mutex=(Boolean)checkRtn.get(0);
|
|
|
if(mutex){
|
|
|
return (String)checkRtn.get(1);
|
|
|
rtnResponse.setCode(201);
|
|
|
rtnResponse.setMessage((String)checkRtn.get(1));
|
|
|
return rtnResponse;
|
|
|
}
|
|
|
|
|
|
User user = (User) httpSession.getAttribute("user");
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
if (!StringUtils.equals("release0",workid)){//查询用户是否有工单处理权限
|
|
|
map.put("id",workid);
|
|
|
map.put("user",user.getName());
|
|
|
BaseResponse baseResponse = httpRestClient.defaultGet(HttpUriContants.CHECK_JOB_BY_OPERATOR,BaseResponse.class,map);
|
|
|
if (baseResponse.getCode() != 200){
|
|
|
return baseResponse.getMessage();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
log.info("check environment {} projects {} branch {}",environment,projects,branch);
|
|
|
if (!("master".equals(branch) || "test".equals(branch) || "dev".equals(branch) )) {
|
|
|
map.clear();
|
|
|
map.put("projects", projects);
|
|
|
map.put("branch", branch);
|
|
|
return httpRestClient.get(ProjectEnvironment.getUrl(environment) + "checkBranch", String.class, map);
|
|
|
String checkBranchResult= httpRestClient.get(ProjectEnvironment.getUrl(environment) + "checkBranch", String.class, map);
|
|
|
if(!"1".equals(checkBranchResult)){
|
|
|
rtnResponse.setCode(201);
|
|
|
rtnResponse.setMessage("分支不存在"+branch+",result :"+checkBranchResult);
|
|
|
return rtnResponse;
|
|
|
}
|
|
|
}
|
|
|
return "1";
|
|
|
return rtnResponse;
|
|
|
|
|
|
|
|
|
}
|
...
|
...
|
|