whycxzp
2024-08-01 52f98f1a31e682f725f09b4a37bcd316332d3131
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
package com.whyc.controller;
 
import com.whyc.dto.Response;
import com.whyc.service.ReportService;
import org.docx4j.Docx4J;
import org.docx4j.openpackaging.exceptions.Docx4JException;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
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.xml.bind.JAXBException;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.HashMap;
 
/**
 * 报告生成
 */
@RestController
@RequestMapping("report")
public class ReportController {
 
    @Autowired
    private ReportService service;
 
    @GetMapping("generateDocument")
    public Response<String> generateDocument() throws JAXBException, Docx4JException {
        return service.generateDocument();
    }
 
}