use of com.ibeiliao.deployment.admin.common.RestResult 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);
}
use of com.ibeiliao.deployment.admin.common.RestResult in project Corgi by kevinYin.
the class ViewProjectController method transfer.
private RestResult<Object> transfer(int historyId, JavaTransferService javaTransferService) {
TransferResult transferResult = javaTransferService.pushPackageToServer();
int code = (transferResult.getSuccessType() == DeployResult.SUCCESS ? ApiCode.SUCCESS : ApiCode.FAILURE);
String message = transferResult.getFailLog();
if (StringUtils.isEmpty(message)) {
message = transferResult.getSuccessType().toString();
}
deployHistoryService.finishStopRestart(historyId, transferResult.getSuccessType());
logger.info("对服务器操作结果: {}, code: {}, message: {}", transferResult.getSuccessType(), code, message);
return new RestResult<>(code, message);
}
use of com.ibeiliao.deployment.admin.common.RestResult in project Corgi by kevinYin.
the class ViewProjectController method projectDetail.
/**
* 查看项目详情
*/
@RequestMapping("projectDetail")
@ResponseBody
@MenuResource("项目详情")
public RestResult projectDetail(int projectId) {
Project project = projectService.getProject(projectId);
GlobalSetting globalSetting = globalSettingService.getGlobalSetting();
ProjectDetailInfo projectDetailInfo = new ProjectDetailInfo();
projectDetailInfo.setProject(project);
projectDetailInfo.setGlobalSetting(globalSetting);
List<ProjectEnv> allEnv = projectEnvService.findAllEnv();
projectDetailInfo.setProjectEnvs(allEnv);
List<ProjectModule> modules = projectModuleService.getByProjectId(projectId);
fillServerGroupIntoModule(modules);
fillJvmArgsIntoModule(modules);
projectDetailInfo.setModules(modules);
return new RestResult<>(projectDetailInfo);
}
use of com.ibeiliao.deployment.admin.common.RestResult in project Corgi by kevinYin.
the class WelcomeController method login.
/**
* 登录接口,sso登录时回调
* @param request
* @param response
* @param account
* @param password
* @return
*/
@RequestMapping("/login.do")
@MenuResource("授权登录")
@AllowAnonymous
@ResponseBody
public RestResult login(HttpServletRequest request, HttpServletResponse response, String account, String password) {
ParameterUtil.assertNotBlank(account, "账户不能为空");
ParameterUtil.assertNotBlank(password, "密码不能为空");
AdminAccount adminAccount = adminAccountService.getByAccount(account);
if (adminAccount == null) {
return new RestResult(ApiCode.FAILURE, "账号不存在");
}
if (!Objects.equals(encoder.encode(password), adminAccount.getPassword())) {
return new RestResult(ApiCode.FAILURE, "账号密码不正确");
}
AdminLoginUser loginUser = new AdminLoginUser();
loginUser.setAccountId(adminAccount.getUid());
loginUser.setAppId(AppConstants.APP_ID_DEFAULT);
AdminContext.saveToCookie(response, loginUser);
logger.info("登录成功 | uid: {}", adminAccount.getUid());
return new RestResult(ApiCode.SUCCESS, "");
}
use of com.ibeiliao.deployment.admin.common.RestResult in project Corgi by kevinYin.
the class ViewDeployHistoryController method getDeployHistory.
@RequestMapping("getDeployHistory")
@ResponseBody
@MenuResource("发布详情")
public RestResult<DeployHistory> getDeployHistory(int historyId) {
long accountId = AdminContext.getAccountId();
DeployHistory deployHistory = deployHistoryService.getByHistoryId(historyId);
if (deployHistory == null) {
return new RestResult<>(ApiCode.FAILURE, "找不到发布记录");
}
return new RestResult<>(deployHistory);
}
Aggregations