管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-21 bd609e15a1e0508d2f242163d39248bc7574ede3
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
92
93
94
95
package com.lf.server.controller.all;
 
import com.lf.server.annotation.SysLog;
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.data.DirEntity;
import com.lf.server.helper.HttpHelper;
import com.lf.server.helper.StringHelper;
import com.lf.server.service.data.DirService;
import com.lf.server.service.data.FmeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
/**
 * CRDS系统接口
 * @author WWW
 */
@Api(tags = "系统对接\\CRDS")
@RestController
@RequestMapping("/crds")
public class CrdsController extends BaseController {
    @Autowired
    DirService dirService;
 
    @Autowired
    protected FmeService fmeService;
 
    @SysLog()
    @ApiOperation(value = "查询项目")
    @GetMapping(value = "/selectProject")
    public ResponseMsg<List<DirEntity>> selectProject() {
        try {
            List<DirEntity> list = dirService.selectProject();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "查询项目目录树")
    @GetMapping(value = "/selectDirsForPrj")
    public ResponseMsg<List<DirEntity>> selectDirsForPrj() {
        try {
            List<DirEntity> list = dirService.selectDirsForPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "请求打包")
    @GetMapping(value = "/uploadReqPackaging")
    public ResponseMsg<Object> uploadReqPackaging() {
        try {
            List<DirEntity> list = dirService.selectDirsForPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "下载文件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "任务ID", dataType = "String", paramType = "query", example = "29db09ee-2aae-4c62-bec0-0b5c5d8084e4")
    })
    @GetMapping(value = "/downloadFile")
    public void downloadResult(String id, HttpServletRequest req, HttpServletResponse res) {
        try {
            if (!StringHelper.isEmpty(id)) {
                String url = fmeService.getDownloadUrl(id, req);
 
                HttpHelper httpHelper = new HttpHelper();
                // res.sendRedirect(url)
                httpHelper.service(req, res, url, null);
            }
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
        }
    }
}