use of io.jpom.model.data.CommandExecLogModel in project Jpom by dromara.
the class CommandLogController method downloadLog.
/**
* 下载日志
*
* @param logId 日志 id
*
* @api {GET} node/ssh_command_log/download_log 下载日志
* @apiGroup node/ssh_command_log
* @apiUse defResultJson
* @apiParam {String} logId 日志 id
* @apiSuccess {File} file 日志文件
*/
@RequestMapping(value = "download_log", method = RequestMethod.GET)
@ResponseBody
@Feature(method = MethodFeature.DOWNLOAD)
public void downloadLog(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据") String logId) {
CommandExecLogModel item = commandExecLogService.getByKey(logId);
Assert.notNull(item, "没有对应数据");
File logFile = item.logFile();
if (!FileUtil.exist(logFile)) {
return;
}
if (logFile.isFile()) {
ServletUtil.write(getResponse(), logFile);
}
}
use of io.jpom.model.data.CommandExecLogModel in project Jpom by dromara.
the class CommandService method updateStatus.
/**
* 修改执行状态
*
* @param id ID
* @param status 状态
*/
private void updateStatus(String id, CommandExecLogModel.Status status) {
CommandExecLogModel commandExecLogModel = new CommandExecLogModel();
commandExecLogModel.setId(id);
commandExecLogModel.setStatus(status.getCode());
commandExecLogService.update(commandExecLogModel);
}
Aggregations