use of com.ibeiliao.deployment.admin.utils.resource.MenuResource in project Corgi by kevinYin.
the class CreateDeploymentController method queryModuleServer.
/**
* 查询模块在某个环境的服务器列表
*
* @param moduleId 模块ID
* @param envId 环境ID,必定大于0
* @return
*/
@RequestMapping("queryModuleServer")
@ResponseBody
@MenuResource("查询模块服务器列表")
public RestResult<Map<String, Object>> queryModuleServer(int moduleId, int envId) {
Assert.isTrue(moduleId > 0);
Assert.isTrue(envId > 0);
List<ServerGroup> groups = serverGroupService.getByModuleAndEnv(moduleId, envId);
List<Integer> groupIds = new ArrayList<>(groups.size());
for (ServerGroup group : groups) {
groupIds.add(group.getGroupId());
}
List<Server> servers = serverService.getByGroupIds(groupIds);
Map<String, Object> result = new HashMap<>(4);
result.put("servers", servers);
result.put("groups", groups);
return new RestResult<>(result);
}
use of com.ibeiliao.deployment.admin.utils.resource.MenuResource in project Corgi by kevinYin.
the class DeployController method index.
/**
* 发布中主页,xhtml 仅用于展示页面,ajax 调用 .do 接口获取参数
* @return
*/
@MenuResource("发布主页")
@RequestMapping("deploy.xhtml")
public String index(HttpServletRequest request) throws Exception {
Integer historyId = ServletRequestUtils.getIntParameter(request, "historyId");
if (historyId != null) {
DeployHistory history = deployHistoryService.getByHistoryId(historyId);
request.setAttribute("history", history);
request.setAttribute("canDeploy", AdminContext.getAccountId() == history.getAccountId() && history.getDeployStatus() == DeployStatus.WAITING_FOR_DEPLOYMENT.getValue());
}
return ("/deploy/deploy");
}
use of com.ibeiliao.deployment.admin.utils.resource.MenuResource in project Corgi by kevinYin.
the class EditAccountController method getAdmin.
/**
* 读取管理员信息
* @param uid 管理员ID
* @return 返回管理员信息
*/
@RequestMapping("getAdmin")
@MenuResource("读取管理员信息")
@ResponseBody
public RestResult<AdminAccount> getAdmin(long uid) {
AdminAccount account = adminAccountService.getById(uid);
RestResult<AdminAccount> result;
if (account == null) {
result = new RestResult<>(ApiCode.FAILURE, "管理员不存在:uid=" + uid);
} else {
List<AccountRoleRelation> list = adminAccountService.listAccountRoles(uid);
if (list.size() == 1) {
account.setRoleId(list.get(0).getRoleId());
}
account.setPassword(aesPropertiesEncoder.decode(account.getPassword()));
result = new RestResult<>(account);
}
return result;
}
use of com.ibeiliao.deployment.admin.utils.resource.MenuResource in project Corgi by kevinYin.
the class ViewProjectController method stopServer.
/**
* 停止服务
*/
@RequestMapping("stopServer.do")
@ResponseBody
@MenuResource("停止服务")
public RestResult<Object> stopServer(int serverId) {
TransferRequest request;
try {
request = createTransferRequest(serverId, false);
Assert.isTrue(request.getModuleType() != ModuleType.STATIC.getValue(), "静态项目不能stop");
JavaTransferService javaTransferService = new JavaTransferService(request, DeployType.STOP);
return transfer(request.getHistoryId(), javaTransferService);
} catch (Exception e) {
logger.info("停止失败,{}", e);
return new RestResult<>(ApiCode.FAILURE, "停止失败");
}
}
use of com.ibeiliao.deployment.admin.utils.resource.MenuResource in project Corgi by kevinYin.
the class ViewProjectController method getProject.
/**
* 获取项目
*/
@RequestMapping("getProject")
@ResponseBody
@MenuResource("获取项目")
public RestResult getProject(int projectId) {
Project project = new Project();
if (projectId > 0) {
project = projectService.getProject(projectId);
}
List<AdminAccount> adminAccounts = adminAccountService.listAll();
GlobalSetting globalSetting = globalSettingService.getGlobalSetting();
ProjectDetailInfo projectDetailInfo = new ProjectDetailInfo();
projectDetailInfo.setProject(project);
projectDetailInfo.setAllAccounts(adminAccounts);
projectDetailInfo.setGlobalSetting(globalSetting);
List<ProjectAccountRelation> accountRelations = projectAccountRelationService.getByProjectId(projectId);
projectDetailInfo.setProjectAccountRelations(accountRelations);
return new RestResult<>(projectDetailInfo);
}
Aggregations