use of io.jpom.model.log.BuildHistoryLog in project Jpom by dromara.
the class DbBuildHistoryLogService method updateResultDirFile.
// /**
// * 更新状态
// *
// * @param logId 记录id
// * @param status 状态
// */
// public void updateLog(String logId, BuildStatus status) {
// if (logId == null) {
// return;
// }
// BuildHistoryLog buildHistoryLog = new BuildHistoryLog();
// buildHistoryLog.setId(logId);
// buildHistoryLog.setStatus(status.getCode());
// if (status != BuildStatus.PubIng) {
// // 结束
// buildHistoryLog.setEndTime(SystemClock.now());
// }
// this.update(buildHistoryLog);
// }
/**
* 更新状态
*
* @param logId 记录id
* @param resultDirFile 构建产物目录
*/
public void updateResultDirFile(String logId, String resultDirFile) {
if (logId == null || StrUtil.isEmpty(resultDirFile)) {
return;
}
BuildHistoryLog buildHistoryLog = new BuildHistoryLog();
buildHistoryLog.setId(logId);
buildHistoryLog.setResultDirFile(resultDirFile);
this.update(buildHistoryLog);
}
use of io.jpom.model.log.BuildHistoryLog in project Jpom by dromara.
the class BuildInfoManageController method reRelease.
/**
* 重新发布
*
* @param logId logId
* @return json
*/
@RequestMapping(value = "/build/manage/reRelease", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@Feature(method = MethodFeature.EXECUTE)
public String reRelease(@ValidatorConfig(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据")) String logId) {
BuildHistoryLog buildHistoryLog = dbBuildHistoryLogService.getByKey(logId, getRequest());
Objects.requireNonNull(buildHistoryLog, "没有对应构建记录.");
BuildInfoModel item = buildInfoService.getByKey(buildHistoryLog.getBuildDataId());
Objects.requireNonNull(item, "没有对应数据");
String e = buildExecuteService.checkStatus(item.getStatus());
Assert.isNull(e, () -> e);
UserModel userModel = getUser();
BuildExtraModule buildExtraModule = BuildExtraModule.build(buildHistoryLog);
// new BuildExtraModule();
// buildExtraModule.updateValue(buildHistoryLog);
ReleaseManage manage = ReleaseManage.builder().buildExtraModule(buildExtraModule).logId(buildHistoryLog.getId()).userModel(userModel).buildId(buildHistoryLog.getBuildNumberId()).buildExecuteService(buildExecuteService).build();
// ReleaseManage releaseManage = new ReleaseManage(buildHistoryLog, userModel);
// 标记发布中
// releaseManage.updateStatus(BuildStatus.PubIng);
ThreadUtil.execute(manage);
return JsonMessage.getString(200, "重新发布中");
}
use of io.jpom.model.log.BuildHistoryLog in project Jpom by dromara.
the class BuildInfoHistoryController method downloadLog.
@RequestMapping(value = "/build/history/download_log.html", method = RequestMethod.GET)
@ResponseBody
@Feature(method = MethodFeature.DOWNLOAD)
public void downloadLog(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据") String logId) throws IOException {
BuildHistoryLog buildHistoryLog = dbBuildHistoryLogService.getByKey(logId);
Objects.requireNonNull(buildHistoryLog);
BuildInfoModel item = buildInfoService.getByKey(buildHistoryLog.getBuildDataId());
Objects.requireNonNull(item);
File logFile = BuildUtil.getLogFile(item.getId(), buildHistoryLog.getBuildNumberId());
if (!FileUtil.exist(logFile)) {
return;
}
if (logFile.isFile()) {
ServletUtil.write(getResponse(), logFile);
}
}
use of io.jpom.model.log.BuildHistoryLog in project Jpom by dromara.
the class BuildInfoHistoryController method historyList.
@RequestMapping(value = "/build/history/history_list.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@Feature(method = MethodFeature.LIST)
public String historyList() {
PageResultDto<BuildHistoryLog> pageResultTemp = dbBuildHistoryLogService.listPage(getRequest());
pageResultTemp.each(buildHistoryLog -> {
File file = BuildUtil.getHistoryPackageFile(buildHistoryLog.getBuildDataId(), buildHistoryLog.getBuildNumberId(), buildHistoryLog.getResultDirFile());
buildHistoryLog.setHashFile(FileUtil.exist(file));
//
File logFile = BuildUtil.getLogFile(buildHistoryLog.getBuildDataId(), buildHistoryLog.getBuildNumberId());
buildHistoryLog.setHasLog(FileUtil.exist(logFile));
});
return JsonMessage.getString(200, "获取成功", pageResultTemp);
}
use of io.jpom.model.log.BuildHistoryLog in project Jpom by dromara.
the class BuildInfoHistoryController method delete.
/**
* 构建
*
* @param logId id
* @return json
*/
@RequestMapping(value = "/build/history/delete_log.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@Feature(method = MethodFeature.DEL)
public String delete(@ValidatorConfig(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据")) String logId) {
BuildHistoryLog buildHistoryLog = dbBuildHistoryLogService.getByKey(logId, getRequest());
Objects.requireNonNull(buildHistoryLog);
JsonMessage<String> jsonMessage = dbBuildHistoryLogService.deleteLogAndFile(buildHistoryLog);
return jsonMessage.toString();
}
Aggregations