dbs
2024-12-23 03af32fb651a4a8046a6380dad84d20d731a9ffe
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package com.itstyle.quartz.web;
 
import com.itstyle.quartz.entity.QuartzEntity;
import com.itstyle.quartz.entity.Result;
import com.itstyle.quartz.entity.SysConfigEntity;
import com.itstyle.quartz.service.DistrbutionService;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletResponse;
 
/**
 * 异构系统数据分发配置
 */
@RestController
@RequestMapping("/distribution")
public class DistributionConfigController {
    private final static Logger LOGGER = LoggerFactory.getLogger(JobController.class);
    @Autowired
    private DistrbutionService distrbutionService;
    /**
     * 异构系统分发配置列表
     * @param sysConfig
     * @param pageNo
     * @param pageSize
     * @return
     * @throws SchedulerException
     */
    @PostMapping("/list")
    public Result list(SysConfigEntity sysConfig, Integer pageNo, Integer pageSize) throws SchedulerException {
        return distrbutionService.list(sysConfig, pageNo, pageSize);
    }
 
    /**
     * 新增异构系统分发配置
     * @param sysConfig
     * @return
     */
    @PostMapping("/add")
    public Result save(SysConfigEntity sysConfig){
        LOGGER.info("新增任务");
        try {
            distrbutionService.save(sysConfig);
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error();
        }
        return Result.ok();
    }
 
    /**
     * 启用配置
     * @param sysConfig
     * @param response
     * @return
     */
    @PostMapping("/enable")
    public Result enable(SysConfigEntity sysConfig, HttpServletResponse response){
        LOGGER.info("启用配置");
        try {
            distrbutionService.enable(sysConfig);
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error();
        }
        return Result.ok();
    }
 
    /**
     * 启用配置
     * @param sysConfig
     * @param response
     * @return
     */
    @PostMapping("/remove")
    public Result remove(SysConfigEntity sysConfig, HttpServletResponse response){
        LOGGER.info("废弃配置");
        try {
            distrbutionService.remove(sysConfig);
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error();
        }
        return Result.ok();
    }
}