SaveJobInfoController.java
1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
*
*/
package com.yoho.jobs.server.controller;
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import com.yoho.jobs.common.domain.ProcessResult;
import com.yoho.jobs.dal.IJobResultMapper;
import com.yoho.jobs.dal.domain.ProcessResultVO;
/**
* @author yanzhang.fu
*
*/
@Controller
@RequestMapping("/jobmanager")
public class SaveJobInfoController {
@Resource
private IJobResultMapper jobResultMapper;
@RequestMapping("/saveJobResult.do")
public void saveJobResult(@RequestBody ProcessResult jobInfo) {
ProcessResultVO result = new ProcessResultVO();
convert(result, jobInfo);
//TODO 若执行失败,则上报告警并入库
jobResultMapper.insertJob(result);
}
private void convert(ProcessResultVO result, ProcessResult jobInfo) {
result.setActiveMode(jobInfo.getJobInfo().getActiveMode());
result.setBeginTime(jobInfo.getBeginTime());
result.setCode(jobInfo.getCode());
result.setContext(jobInfo.getJobInfo().getContext());
result.setCronExpression(jobInfo.getJobInfo().getCronExpression());
result.setDesc(jobInfo.getJobInfo().getDesc());
result.setEndTime(jobInfo.getEndTime());
result.setJobGroup(jobInfo.getJobInfo().getJobGroup());
result.setJobName(jobInfo.getJobInfo().getJobName());
result.setJobType(jobInfo.getJobInfo().getJobType());
result.setMessage(jobInfo.getMessage());
result.setModule(jobInfo.getJobInfo().getModule());
result.setOperator(jobInfo.getJobInfo().getOperator());
result.setProcessIp(jobInfo.getJobInfo().getProcessIp());
result.setProcessor(jobInfo.getJobInfo().getProcessor());
result.setStatus(jobInfo.getJobInfo().getStatus());
result.setRecordDate(new Date());
}
}