liding
2 天以前 bd46f203b0d30a3d33b7c51ae9a528e4807477e1
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodServiceImpl.java
@@ -244,9 +244,11 @@
    @Override
    public StandardMethodAttachment uploadAttachment(Integer standardMethodId, MultipartFile file) {
        if (standardMethodMapper.selectById(standardMethodId) == null) throw new BaseException("标准不存在");
        if (file == null || file.isEmpty() || file.getSize() > 10 * 1024 * 1024) throw new BaseException("附件不能为空且不能超过10MB");
        if (file == null || file.isEmpty() || file.getSize() > 10 * 1024 * 1024)
            throw new BaseException("附件不能为空且不能超过10MB");
        String originalName = file.getOriginalFilename();
        if (originalName == null || !originalName.matches("(?i).+\\.(jpg|jpeg|png|gif|doc|docx|xls|xlsx|ppt|pptx|pdf|zip|rar)$")) throw new BaseException("不支持的附件格式");
        if (originalName == null || !originalName.matches("(?i).+\\.(jpg|jpeg|png|gif|doc|docx|xls|xlsx|ppt|pptx|pdf|zip|rar)$"))
            throw new BaseException("不支持的附件格式");
        try {
            boolean image = originalName.matches("(?i).+\\.(jpg|jpeg|png|gif)$");
            File directory = new File(image ? filePath : wordUrl);