提交 | 用户 | 时间
|
449017
|
1 |
package com.iailab.module.model.mpk.controller.admin; |
D |
2 |
|
|
3 |
import com.iailab.framework.common.page.PageData; |
|
4 |
import com.iailab.framework.common.pojo.CommonResult; |
|
5 |
import com.iailab.module.model.mpk.dto.ProjectPackageHistoryDTO; |
|
6 |
import com.iailab.module.model.mpk.dto.ProjectPackageHistoryModelDTO; |
|
7 |
import com.iailab.module.model.mpk.service.ProjectPackageHistoryModelService; |
|
8 |
import com.iailab.module.model.mpk.service.ProjectPackageHistoryService; |
|
9 |
import org.apache.commons.io.IOUtils; |
|
10 |
import org.springframework.beans.factory.annotation.Autowired; |
|
11 |
import org.springframework.web.bind.annotation.*; |
|
12 |
|
|
13 |
import javax.servlet.http.HttpServletResponse; |
|
14 |
import java.io.IOException; |
|
15 |
import java.net.URLEncoder; |
|
16 |
import java.util.List; |
|
17 |
import java.util.Map; |
|
18 |
|
|
19 |
|
|
20 |
/** |
|
21 |
* 项目打包历史记录表 |
|
22 |
* |
|
23 |
* @author Dzd |
|
24 |
* @since 1.0.0 2024-08-22 |
|
25 |
*/ |
|
26 |
@RestController |
|
27 |
@RequestMapping("/model/mpk/projectPackageHistory") |
|
28 |
public class ProjectPackageHistoryController { |
|
29 |
@Autowired |
|
30 |
private ProjectPackageHistoryService projectPackageHistoryService; |
|
31 |
@Autowired |
|
32 |
private ProjectPackageHistoryModelService projectPackageHistoryModelService; |
|
33 |
|
|
34 |
@GetMapping("page") |
|
35 |
public CommonResult<PageData<ProjectPackageHistoryDTO>> page(@RequestParam Map<String, Object> params){ |
|
36 |
PageData<ProjectPackageHistoryDTO> page = projectPackageHistoryService.page(params); |
|
37 |
|
|
38 |
return CommonResult.success(page); |
|
39 |
} |
|
40 |
|
|
41 |
@GetMapping("download") |
|
42 |
public void generat(String filePath, String fileName, HttpServletResponse response) throws IOException { |
|
43 |
byte[] data = projectPackageHistoryService.download(filePath); |
|
44 |
|
|
45 |
response.reset(); |
|
46 |
response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(fileName,"utf-8") + "\""); |
|
47 |
response.addHeader("Content-Length", "" + data.length); |
|
48 |
response.setContentType("application/octet-stream; charset=UTF-8"); |
|
49 |
|
|
50 |
IOUtils.write(data, response.getOutputStream()); |
|
51 |
} |
|
52 |
|
|
53 |
@GetMapping("getPackageModel") |
|
54 |
public CommonResult<PageData<ProjectPackageHistoryModelDTO>> getPackageModel(@RequestParam Map<String, Object> params){ |
|
55 |
PageData<ProjectPackageHistoryModelDTO> page = projectPackageHistoryModelService.page(params); |
|
56 |
|
|
57 |
return CommonResult.success(page); |
|
58 |
} |
|
59 |
|
|
60 |
} |