Search in sources :

Example 1 with TimedReleaseType

use of com.orion.ops.consts.app.TimedReleaseType 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;
}
Also used : TimedReleaseType(com.orion.ops.consts.app.TimedReleaseType) Date(java.util.Date) EventLog(com.orion.ops.annotation.EventLog) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

EventLog (com.orion.ops.annotation.EventLog)1 TimedReleaseType (com.orion.ops.consts.app.TimedReleaseType)1 Date (java.util.Date)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1