|
|
package com.ui.ctrl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.ui.contants.HttpUriContants;
|
|
|
import com.ui.http.HttpRestClient;
|
|
|
import com.ui.model.BaseResponse;
|
|
|
import com.ui.model.domain.DockerProjectModel;
|
|
|
import com.ui.model.req.*;
|
|
|
import com.ui.project.Platform;
|
|
|
import com.ui.project.Project;
|
...
|
...
|
@@ -22,7 +24,10 @@ import org.springframework.web.bind.annotation.ResponseBody; |
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Created by zhengyouwei on 2016/9/5.
|
...
|
...
|
@@ -42,6 +47,8 @@ public class WorkSystemCtrl { |
|
|
|
|
|
model.addAttribute("platforms", Platform.getPlatforms());
|
|
|
model.addAttribute("environments", ProjectEnvironment.getEnviroments());
|
|
|
model.addAttribute("dockerEnvironments", ProjectEnvironment.getDockerEnvironments());
|
|
|
model.addAttribute("projectTypes", ProjectEnvironment.getDockerProjectTypeMap());
|
|
|
BaseResponse<List<User>> resp = httpRestClient.exchangeForget(HttpUriContants.GET_All_USER, new ParameterizedTypeReference<BaseResponse<List<User>>>() {
|
|
|
}, null);
|
|
|
model.addAttribute("verifiers",resp.getData());//审核人列表
|
...
|
...
|
@@ -96,7 +103,7 @@ public class WorkSystemCtrl { |
|
|
|
|
|
@RequestMapping("/getProjectsByPlatform")
|
|
|
@ResponseBody
|
|
|
public List<Project> getProjectsByPlatform(String platform) {
|
|
|
public List<Project> getProjectsByPlatform(String platform,String projectType) {
|
|
|
if (Platform.JAVA.equals(platform)) {
|
|
|
return ProjectOnline.getJavaList();
|
|
|
} else if (Platform.PHP.equals(platform)) {
|
...
|
...
|
@@ -106,7 +113,19 @@ public class WorkSystemCtrl { |
|
|
String result = httpRestClient.get("http://172.31.16.167:8883/node/getProjects", String.class, null);
|
|
|
return JSON.parseObject(result,List.class);
|
|
|
}else if (Platform.DOCKER.equals(platform)) {
|
|
|
return ProjectOnline.getDockerList();
|
|
|
Map map = new HashMap<>();
|
|
|
map.put("projectType",projectType);
|
|
|
BaseResponse response=httpRestClient.defaultGet("/dockerProject/getDockerProjectByProjectType", BaseResponse.class, map);
|
|
|
List<DockerProjectModel> models=JSONArray.parseArray(JSONArray.toJSON(response.getData()).toString(),DockerProjectModel.class);
|
|
|
List<Project> ls=new LinkedList<>();
|
|
|
if(models!=null&&models.size()>0){
|
|
|
for(DockerProjectModel model:models){
|
|
|
Project pro=new Project();
|
|
|
pro.setName(model.getProjectName());
|
|
|
ls.add(pro);
|
|
|
}
|
|
|
}
|
|
|
return ls;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
...
|
...
|
|