use of com.orion.ops.annotation.EventLog in project orion-ops by lijiahangmax.
the class ApplicationReleaseController method submitAppRelease.
/**
* 提交发布
*/
@RequestMapping("/submit")
@EventLog(EventType.SUBMIT_RELEASE)
public Long submitAppRelease(@RequestBody ApplicationReleaseRequest request) {
Valid.notBlank(request.getTitle());
Valid.notNull(request.getAppId());
Valid.notNull(request.getProfileId());
Valid.notNull(request.getBuildId());
Valid.notEmpty(request.getMachineIdList());
TimedReleaseType timedReleaseType = Valid.notNull(TimedReleaseType.of(request.getTimedRelease()));
if (TimedReleaseType.TIMED.equals(timedReleaseType)) {
Date timedReleaseTime = Valid.notNull(request.getTimedReleaseTime());
Valid.isTrue(timedReleaseTime.compareTo(new Date()) > 0, MessageConst.TIMED_GREATER_THAN_NOW);
}
// 提交
Long id = applicationReleaseService.submitAppRelease(request);
// 提交任务
if (TimedReleaseType.TIMED.equals(timedReleaseType)) {
taskRegister.submit(TaskType.RELEASE, request.getTimedReleaseTime(), id);
}
return id;
}
use of com.orion.ops.annotation.EventLog in project orion-ops by lijiahangmax.
the class SftpController method uploadFile.
/**
* 上传文件
*/
@RequestMapping("/upload/exec")
@EventLog(EventType.SFTP_UPLOAD)
public void uploadFile(@RequestParam("accessToken") String accessToken, @RequestParam("remotePath") String remotePath, @RequestParam("files") List<MultipartFile> files) throws IOException {
// 检查路径
Valid.checkNormalize(remotePath);
Valid.notBlank(accessToken);
Valid.notEmpty(files);
// 检查token
Long machineId = sftpService.checkUploadAccessToken(accessToken);
List<FileUploadRequest> requestFiles = Lists.newList();
for (MultipartFile file : files) {
// 传输文件到本地
String fileToken = ObjectIds.next();
String localPath = PathBuilders.getSftpUploadFilePath(fileToken);
Path localAbsolutePath = Paths.get(SystemEnvAttr.SWAP_PATH.getValue(), localPath);
Files1.touch(localAbsolutePath);
file.transferTo(localAbsolutePath);
// 提交任务
FileUploadRequest request = new FileUploadRequest();
request.setMachineId(machineId);
request.setFileToken(fileToken);
request.setLocalPath(localPath);
request.setRemotePath(Files1.getPath(remotePath, file.getOriginalFilename()));
request.setSize(file.getSize());
requestFiles.add(request);
}
sftpService.upload(machineId, requestFiles);
}
use of com.orion.ops.annotation.EventLog in project orion-ops by lijiahangmax.
the class SystemController method cleanSystemFile.
/**
* 清理系统文件
*/
@RequestMapping("/clean-system-file")
@EventLog(EventType.CLEAN_SYSTEM_FILE)
@RequireRole(RoleType.ADMINISTRATOR)
public HttpWrapper<?> cleanSystemFile(@RequestBody SystemFileCleanRequest request) {
SystemCleanType cleanType = Valid.notNull(SystemCleanType.of(request.getCleanType()));
systemService.cleanSystemFile(cleanType);
return HttpWrapper.ok();
}
use of com.orion.ops.annotation.EventLog in project orion-ops by lijiahangmax.
the class SystemEnvController method viewSave.
/**
* 视图保存
*/
@RequestMapping("/view-save")
@EventLog(EventType.SAVE_SYSTEM_ENV)
public Integer viewSave(@RequestBody SystemEnvRequest request) {
String value = Valid.notBlank(request.getValue());
EnvViewType viewType = Valid.notNull(EnvViewType.of(request.getViewType()));
try {
MutableLinkedHashMap<String, String> result = viewType.toMap(value);
systemEnvService.saveEnv(result);
return result.size();
} catch (Exception e) {
throw Exceptions.argument(MessageConst.PARSE_ERROR, e);
}
}
use of com.orion.ops.annotation.EventLog in project orion-ops by lijiahangmax.
the class MachineInfoController method add.
/**
* 添加
*/
@RequestMapping("/add")
@EventLog(EventType.ADD_MACHINE)
public Long add(@RequestBody MachineInfoRequest request) {
this.check(request);
MachineAuthType machineAuthTypeEnum = Valid.notNull(MachineAuthType.of(request.getAuthType()));
if (MachineAuthType.PASSWORD.equals(machineAuthTypeEnum)) {
Valid.notBlank(request.getPassword());
}
return machineInfoService.addMachine(request);
}
Aggregations