use of com.flink.platform.web.entity.JobQuartzInfo in project flink-platform-backend by itinycheng.
the class UserGroupController method createOrUpdate.
@PostMapping(value = "/createOrUpdate")
public ResultInfo<Long> createOrUpdate(@RequestBody UserGroupRequest userGroupRequest) {
try {
ResultInfo<String> sqlInfo = insertSelect(userGroupRequest.getSelect());
String sql = sqlInfo.getData();
JobInfo jobInfo = new JobInfo();
BeanUtils.copyProperties(userGroupRequest, jobInfo);
jobInfo.setSubject(sql);
jobInfo.setType(JobType.FLINK_SQL);
jobInfo.setDeployMode(DeployMode.FLINK_YARN_PER);
jobInfo.setExecMode(ExecutionMode.BATCH);
LongArrayList longs = new LongArrayList();
longs.add(1L);
jobInfo.setCatalogs(longs);
jobInfo.setStatus(JobStatus.ONLINE);
boolean bool = jobInfoService.saveOrUpdate(jobInfo);
if (bool && userGroupRequest.getId() == null) {
JobQuartzInfo jobQuartzInfo = new JobQuartzInfo(jobInfo);
quartzService.runOnce(jobQuartzInfo);
quartzService.addJobToQuartz(jobQuartzInfo);
}
return ResultInfo.success(jobInfo.getId());
} catch (Exception e) {
log.error("create or update user group failed", e);
return ResultInfo.failure(ResponseStatus.SERVICE_ERROR);
}
}
Aggregations