cjl
2023-11-01 2744ca3c268b64b3245d274b2979a047817d4402
screen-api/src/main/java/com/moral/api/controller/CruiserController.java
@@ -26,6 +26,7 @@
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.xmlbeans.impl.jam.provider.ResourcePath;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.*;
@@ -234,6 +235,7 @@
     * @return
     */
    @PostMapping("dailyDustlds")
    @Transactional
    public ResultMessage  dailyDustlds(@RequestBody Map<String,Object> params, HttpServletResponse response) throws IOException {
//        Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
@@ -317,14 +319,6 @@
        InputStream  inputStream = WordUtil.class.getClassLoader().getResourceAsStream("word/尘负荷监测报告.docx");
        XWPFDocument compile = null;
        try {
           // File file = new File("尘负荷监测报告.docx");
           // FileUtils.copyToFile(inputStream,file);
            //获取当前模板的路径
            /*File rootFile = new File(ResourceUtils.getURL("classpath:").getPath());
            File file= new File(rootFile, path);*/
            //第一步:读取模板
            //第二步:创建数据,用于把我们模板中的{{}}包裹的变量替换掉,map中保存的key一定要和模板中的变量保持一致
            HashMap<String, Object> map = new HashMap<>();
            //设置单元格,表头
@@ -352,7 +346,8 @@
                map.put("table3", new MiniTableRenderData(rsList3));
            }
            map.put("table1", new MiniTableRenderData(header1, rsList1));
            map.put("data",params.get("data"));
            String data = params.get("data").toString();
            map.put("data",data);
            map.put("time",params.get("time").toString());
            map.put("date1",params.get("date1").toString());
            map.put("date2",params.get("date2").toString());