sinake
2 天以前 d6e936e3dcb645658fa7e0c3e02c1daa30bfeb68
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
@@ -221,7 +221,7 @@
        Collections.sort(list, new Comparator<SpFinancialExpensesFundOut>() {
            @Override
            public int compare(SpFinancialExpensesFundOut o1, SpFinancialExpensesFundOut o2) {
                return o1.getApplyTime().compareTo(o2.getApplyTime());
                return o2.getApplyTime().compareTo(o1.getApplyTime());
            }
        });
        return getCustomDataTable(list, pageNum, pageSize);
@@ -320,6 +320,23 @@
    public AjaxResult addOrUpdateNew(@RequestBody ServiceFundVO serviceFundVO) {
        return AjaxResult.success(serviceFundService.addOrUpdateNew(serviceFundVO));
    }
    /**
     * 专家劳务费:保存前的费用控制校验(干跑,不落库)
     *
     * <p>供专家劳务费填报页在点“保存”前调用,把 9 条规则的校验结果
     * (errors 阻断 / warnings 提示)返回前端展示;真正的落库拦截在 addOrUpdateNew 中。
     */
    @ApiOperation("专家劳务费保存前校验")
    @PostMapping("/validateExpertFee")
    public AjaxResult validateExpertFee(@RequestBody ServiceFundVO serviceFundVO) {
        ExpertFeeCheckResult result = serviceFundService.validateExpertFee(serviceFundVO);
        AjaxResult ajaxResult = AjaxResult.success();
        ajaxResult.put("errors", result.getErrors());
        ajaxResult.put("warnings", result.getWarnings());
        ajaxResult.put("blocked", result.hasError());
        return ajaxResult;
    }
@@ -475,18 +492,16 @@
        //输出文档路径及名称
        File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc");
        Writer out = null;
        try {
            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        if (t == null) {
            throw new ServiceException("模板加载失败,请检查模板文件是否存在", HttpStatus.NO_CONTENT);
        }
        try {
        // Writer 必须关闭/刷新:BufferedWriter 带缓冲,不关闭会造成文件句柄泄漏且内容可能不完整
        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
            t.process(dataMap, out);
        } catch (TemplateException e) {
            e.printStackTrace();
        } catch (TemplateException | IOException e) {
            log.error("生成模板文档失败, name={}", name, e);
            throw new ServiceException("生成文档失败", HttpStatus.ERROR);
        }
        Map<String, Object> map = new HashMap<>();
        map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -659,18 +674,16 @@
        //输出文档路径及名称
        File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc");
        Writer out = null;
        try {
            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        if (t == null) {
            throw new ServiceException("模板加载失败,请检查模板文件是否存在", HttpStatus.NO_CONTENT);
        }
        try {
        // Writer 必须关闭/刷新:BufferedWriter 带缓冲,不关闭会造成文件句柄泄漏且内容可能不完整
        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
            t.process(dataMap, out);
        } catch (TemplateException e) {
            e.printStackTrace();
        } catch (TemplateException | IOException e) {
            log.error("生成模板文档失败, name={}", name, e);
            throw new ServiceException("生成文档失败", HttpStatus.ERROR);
        }
        Map<String, Object> map = new HashMap<>();
        map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -756,18 +769,16 @@
        //输出文档路径及名称
        File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc");
        Writer out = null;
        try {
            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        if (t == null) {
            throw new ServiceException("模板加载失败,请检查模板文件是否存在", HttpStatus.NO_CONTENT);
        }
        try {
        // Writer 必须关闭/刷新:BufferedWriter 带缓冲,不关闭会造成文件句柄泄漏且内容可能不完整
        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
            t.process(dataMap, out);
        } catch (TemplateException e) {
            e.printStackTrace();
        } catch (TemplateException | IOException e) {
            log.error("生成模板文档失败, name={}", name, e);
            throw new ServiceException("生成文档失败", HttpStatus.ERROR);
        }
        Map<String, Object> map = new HashMap<>();
        map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -858,20 +869,16 @@
        }
        //输出文档路径及名称
        File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc");
        Writer out = null;
        try {
            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
        } catch (FileNotFoundException e1) {
            log.error("FileNotFoundException报错信息是:{}", e1.getMessage());
//            e1.printStackTrace();
        if (t == null) {
            throw new ServiceException("模板加载失败,请检查模板文件是否存在", HttpStatus.NO_CONTENT);
        }
        try {
        // Writer 必须关闭/刷新:BufferedWriter 带缓冲,不关闭会造成文件句柄泄漏且内容可能不完整
        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
            t.process(dataMap, out);
        } catch (TemplateException e) {
            log.error("TemplateException报错信自是:{}", e.getMessage());
            e.getMessage();
        } catch (TemplateException | IOException e) {
            log.error("生成模板文档失败, name={}", name, e);
            throw new ServiceException("生成文档失败", HttpStatus.ERROR);
        }
        Map<String, Object> map = new HashMap<>();
        map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -1083,18 +1090,16 @@
        //输出文档路径及名称
        File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc");
        Writer out = null;
        try {
            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        if (t == null) {
            throw new ServiceException("模板加载失败,请检查模板文件是否存在", HttpStatus.NO_CONTENT);
        }
        try {
        // Writer 必须关闭/刷新:BufferedWriter 带缓冲,不关闭会造成文件句柄泄漏且内容可能不完整
        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
            t.process(dataMap, out);
        } catch (TemplateException e) {
            e.printStackTrace();
        } catch (TemplateException | IOException e) {
            log.error("生成模板文档失败, name={}", name, e);
            throw new ServiceException("生成文档失败", HttpStatus.ERROR);
        }
        Map<String, Object> map = new HashMap<>();
        map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -1152,18 +1157,16 @@
        //输出文档路径及名称
        File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc");
        Writer out = null;
        try {
            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        if (t == null) {
            throw new ServiceException("模板加载失败,请检查模板文件是否存在", HttpStatus.NO_CONTENT);
        }
        try {
        // Writer 必须关闭/刷新:BufferedWriter 带缓冲,不关闭会造成文件句柄泄漏且内容可能不完整
        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
            t.process(dataMap, out);
        } catch (TemplateException e) {
            e.printStackTrace();
        } catch (TemplateException | IOException e) {
            log.error("生成模板文档失败, name={}", name, e);
            throw new ServiceException("生成文档失败", HttpStatus.ERROR);
        }
        Map<String, Object> map = new HashMap<>();
        map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -1652,18 +1655,16 @@
        //输出文档路径及名称
        File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc");
        Writer out = null;
        try {
            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        if (t == null) {
            throw new ServiceException("模板加载失败,请检查模板文件是否存在", HttpStatus.NO_CONTENT);
        }
        try {
        // Writer 必须关闭/刷新:BufferedWriter 带缓冲,不关闭会造成文件句柄泄漏且内容可能不完整
        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
            t.process(dataMap, out);
        } catch (TemplateException e) {
            e.printStackTrace();
        } catch (TemplateException | IOException e) {
            log.error("生成模板文档失败, name={}", name, e);
            throw new ServiceException("生成文档失败", HttpStatus.ERROR);
        }
        Map<String, Object> map = new HashMap<>();
        map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
@@ -1741,18 +1742,16 @@
        //输出文档路径及名称
        File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc");
        Writer out = null;
        try {
            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        if (t == null) {
            throw new ServiceException("模板加载失败,请检查模板文件是否存在", HttpStatus.NO_CONTENT);
        }
        try {
        // Writer 必须关闭/刷新:BufferedWriter 带缓冲,不关闭会造成文件句柄泄漏且内容可能不完整
        try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) {
            t.process(dataMap, out);
        } catch (TemplateException e) {
            e.printStackTrace();
        } catch (TemplateException | IOException e) {
            log.error("生成模板文档失败, name={}", name, e);
            throw new ServiceException("生成文档失败", HttpStatus.ERROR);
        }
        Map<String, Object> map = new HashMap<>();
        map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");