fix
Helius
2022-08-30 59ba8b1f022d4671c73c1b6e6f81beaa9928b3d7
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/CmsTemplateServiceImpl.java
@@ -31,6 +31,7 @@
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@@ -243,4 +244,17 @@
        return Result.ok("保存成功");
    }
    @Override
    public Result downloadTemplate() {
        Long companyId = LoginUserUtil.getCompanyId();
        CompanyEntity company = this.companyMapper.selectById(companyId);
        String templatePath = FileUtils.path(cmsProperties.getTemplatePath(), company.getCode());
        String staticPath = FileUtils.path(cmsProperties.getStaticPath(), company.getCode());
        String fileName = "template.zip";
        ZipUtil.zip(templatePath, staticPath + "/template.zip", true);
        return Result.ok("success", cmsProperties.getStaticUrl() + company.getCode() + "/" + fileName);
    }
}