zjh
2025-01-04 06059e134de6817418335516f56bbf4280ff351b
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjReservationController.java
@@ -103,56 +103,61 @@
    @ApiOperation(value = "导出excel表模板")
    public void importTemplate(HttpServletResponse response) {
        //原来的下载模板调用接口
        String base64String = PDFBinaryUtil.getPDFBinary(configService.selectConfigByKey("default_excelTemplate"));
        if (null != base64String) {
            PDFBinaryUtil.base64StringToPDF(base64String, FileUtil.mkdir(value).getPath() + File.separator + "团体预约Excel模版.xls");
            String filePath = value + File.separator + "团体预约Excel模版.xls";
            File f = new File(filePath);
            BufferedInputStream br = null;
            OutputStream out = null;
            FileInputStream fileInputStream = null;
            try {
                fileInputStream = new FileInputStream(f);
                br = new BufferedInputStream(fileInputStream);
                byte[] bs = new byte[1024];
                int len = 0;
                response.reset(); // 非常重要
                if (true) {
                    // 在线打开方式
                    URL u = new URL("file:///" + filePath);
                    //System.out.println(u);
                    String contentType = u.openConnection().getContentType();
                    response.setContentType(contentType);
                    response.setHeader("Content-Disposition", "inline;filename=团体预约Excel模版.xls");
                } else {
                    // 纯下载方式
                    response.setContentType("application/x-msdownload");
                    response.setContentType("application/pdf;charset=utf-8");
                    response.setHeader("Content-Disposition", "attachment;filename=团体预约Excel模版.xls");
                }
                out = response.getOutputStream();
                while ((len = br.read(bs)) > 0) {
                    out.write(bs, 0, len);
                }
                out.flush();
                out.close();
                br.close();
                fileInputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
                //System.out.println("pdf处理文件异常" + e);
            } finally {
                if (out != null) {
                    try {
                        out.close();
                        br.close();
                        fileInputStream.close();
        try {
            String base64String = PDFBinaryUtil.getPDFBinary(value + File.separator + "西安路泰机电科技有限公司.xls");
            if (null != base64String) {
                PDFBinaryUtil.base64StringToPDF(base64String, FileUtil.mkdir(value).getPath() + File.separator + "团体预约Excel模版.xls");
                String filePath = value + File.separator + "团体预约Excel模版.xls";
                File f = new File(filePath);
                BufferedInputStream br = null;
                OutputStream out = null;
                FileInputStream fileInputStream = null;
                try {
                    fileInputStream = new FileInputStream(f);
                    br = new BufferedInputStream(fileInputStream);
                    byte[] bs = new byte[1024];
                    int len = 0;
                    response.reset(); // 非常重要
                    if (true) {
                        // 在线打开方式
                        URL u = new URL("file:///" + filePath);
                        //System.out.println(u);
                        String contentType = u.openConnection().getContentType();
                        response.setContentType(contentType);
                        response.setHeader("Content-Disposition", "inline;filename=团体预约Excel模版.xls");
                    } else {
                        // 纯下载方式
                        response.setContentType("application/x-msdownload");
                        response.setContentType("application/pdf;charset=utf-8");
                        response.setHeader("Content-Disposition", "attachment;filename=团体预约Excel模版.xls");
                    }
                    out = response.getOutputStream();
                    while ((len = br.read(bs)) > 0) {
                        out.write(bs, 0, len);
                    }
                    out.flush();
                    out.close();
                    br.close();
                    fileInputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                    //System.out.println("pdf处理文件异常" + e);
                } finally {
                    if (out != null) {
                        try {
                            out.close();
                            br.close();
                            fileInputStream.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                }
            }
        } catch (Exception e) {
            ExcelUtils.exportTemplate(response,"团体预约Excel模版",TjReservation.class);
            throw new RuntimeException(e);
        }
    }
@@ -743,11 +748,11 @@
        LambdaQueryWrapper<TjGroupingPro> wq = new LambdaQueryWrapper<>();
        wq.eq(TjGroupingPro::getGroupingId, groupingId);
        List<TjGroupingPro> proList = groupingProService.list(wq);
        if (null != proList && proList.size() > 0) {
        if (null != proList && !proList.isEmpty()) {
            for (TjGroupingPro groupingPro : proList) {
                TjProject project = projectService.getById(groupingPro.getProId());
                if (null != project) {
                    if (project.getProType() == null || project.getProType().equals("")) {
                    if (project.getProType() == null || project.getProType().isEmpty()) {
                        groupingPro.setProType("2");
                    } else {
                        groupingPro.setProType(project.getProType());