Compare commits
48 Commits
daijunxion
...
master
Author | SHA1 | Date | |
---|---|---|---|
cc44f8f5c2 | |||
170e449f4e | |||
|
f94a551286 | ||
5f0b373d3b | |||
e1d0aee060 | |||
ade7ee8cbd | |||
5cc7545233 | |||
|
2309df3a99 | ||
8122a51f29 | |||
7a743e871d | |||
2b3a041a29 | |||
6c9450cc94 | |||
759fb54ead | |||
f60b86da4f | |||
fec69fcecd | |||
de3a4cb120 | |||
4a3d56407c | |||
5a84afd8bc | |||
3f5dd2d165 | |||
82fef86d12 | |||
d5d1137e3c | |||
f412e56114 | |||
|
3494cd3a17 | ||
|
461dc26a7d | ||
|
acd0c1982d | ||
f170c60d3f | |||
|
ac1274b565 | ||
|
aefd70308e | ||
|
3c75bedb8e | ||
|
8bab53a026 | ||
b995656323 | |||
3cd4cf8e1c | |||
|
692b678d8e | ||
|
6546b269ef | ||
c9f7c850f6 | |||
|
f52b5ef762 | ||
|
b491b9a30b | ||
|
9e9de4d232 | ||
|
8658c56976 | ||
|
5d3b21da57 | ||
6c4f479b52 | |||
a148e2e0c4 | |||
6566bc6ead | |||
252850b53d | |||
510a37abac | |||
8aef25f377 | |||
c508ee8900 | |||
6a36a3b324 |
@ -11,6 +11,7 @@ RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk
|
||||
apk add fontconfig &&\
|
||||
apk --update add unzip &&\
|
||||
mkdir -p /usr/share/fonts/chinese &&\
|
||||
mkdir -p /usr/share/fonts/korean &&\
|
||||
cd /tmp &&\
|
||||
wget http://kkfileview.keking.cn/fonts.zip &&\
|
||||
unzip -d /usr/share/fonts/chinese fonts.zip &&\
|
||||
@ -18,13 +19,10 @@ RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk
|
||||
mkfontscale &&\
|
||||
mkfontdir &&\
|
||||
fc-cache -fv &&\
|
||||
cd /usr/share/fonts/korean &&\
|
||||
mkfontscale &&\
|
||||
mkfontdir &&\
|
||||
fc-cache -fv &&\
|
||||
rm -rf /var/cache/*
|
||||
|
||||
COPY ./fonts/* /usr/share/fonts/korean/
|
||||
COPY ./server/target/crm-print-server-1.0.0.jar /
|
||||
WORKDIR /
|
||||
EXPOSE 9089
|
||||
CMD ["java","-Xms1000m","-Xmx1000m","-jar","crm-print-server-1.0.0.jar"]
|
||||
CMD ["java", "-Xms3072m", "-jar","crm-print-server-1.0.0.jar"]
|
@ -11,6 +11,7 @@ RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk
|
||||
apk add fontconfig &&\
|
||||
apk --update add unzip &&\
|
||||
mkdir -p /usr/share/fonts/chinese &&\
|
||||
mkdir -p /usr/share/fonts/korean &&\
|
||||
cd /tmp &&\
|
||||
wget http://kkfileview.keking.cn/fonts.zip &&\
|
||||
unzip -d /usr/share/fonts/chinese fonts.zip &&\
|
||||
@ -20,6 +21,7 @@ RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk
|
||||
fc-cache -fv &&\
|
||||
rm -rf /var/cache/*
|
||||
|
||||
COPY ./fonts/* /usr/share/fonts/korean/
|
||||
COPY ./server/target/crm-print-server-1.0.0.jar /
|
||||
WORKDIR /
|
||||
HEALTHCHECK --interval=60s --timeout=3s CMD curl -fs http://localhost:8080/crm-print/actuator/health || exit 1
|
||||
|
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
BIN
fonts/(환)세고딕.TTF
Executable file
BIN
fonts/(환)세고딕.TTF
Executable file
Binary file not shown.
BIN
fonts/Perestroika.ttf
Normal file
BIN
fonts/Perestroika.ttf
Normal file
Binary file not shown.
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.openoffice:juh:3.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.openoffice:jurt:3.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.openoffice:ridl:3.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.openoffice:unoil:3.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-cli:commons-cli:1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hyperic:sigar:1.6.5.132" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.json:json:20090211" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.testng:testng:6.0.1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.beanshell:bsh:2.0b4" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.beust:jcommander:1.12" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.yaml:snakeyaml:1.6" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -30,6 +30,11 @@
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.boot</groupId>
|
||||
<artifactId>nacos-config-spring-boot-starter</artifactId>
|
||||
<version>0.3.0-RC</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.keking;
|
||||
|
||||
import com.alibaba.nacos.spring.context.annotation.config.EnableNacosConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@ -14,6 +15,7 @@ import org.springframework.util.StopWatch;
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
@EnableNacosConfig
|
||||
public class ServerMain {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ServerMain.class);
|
||||
|
@ -9,6 +9,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@ -26,7 +28,7 @@ public class KkfileConfig {
|
||||
*/
|
||||
private static final long DEFAULT_TEMPLATE_MAX_SIZE = 10 * 1024 * 1024;
|
||||
|
||||
private static final List<String> ALLOW_UPLOAD_TYPE = Collections.singletonList("docx");
|
||||
private static final List<String> ALLOW_UPLOAD_TYPE =Arrays.asList("docx","xlsx");
|
||||
|
||||
/**
|
||||
* 预览地址
|
||||
|
@ -1,5 +1,7 @@
|
||||
package cn.keking.service;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
|
||||
import cn.afterturn.easypoi.word.WordExportUtil;
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.config.KkfileConfig;
|
||||
@ -7,10 +9,12 @@ import cn.keking.exception.KkFileException;
|
||||
import cn.keking.service.impl.OtherFilePreviewImpl;
|
||||
import cn.keking.utils.Consts;
|
||||
import cn.keking.utils.WebUtils;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFTable;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTVMerge;
|
||||
@ -229,8 +233,15 @@ public class ContractService {
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回 pdf 文件
|
||||
* @param templateName
|
||||
* @param dataMap
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
public File download(String templateName, Map<String, Object> dataMap) throws Exception {
|
||||
public File download(String templateName, Map<String, Object> dataMap,String type) throws Exception {
|
||||
OutputStream os = null;
|
||||
try {
|
||||
File outFile = new File(Consts.uploadAbsDir());
|
||||
@ -259,14 +270,127 @@ public class ContractService {
|
||||
xwpfDocument.write(os);
|
||||
String outFilePath = Consts.uploadAbsDir()+ File.separator+ pdfName;
|
||||
officeToPdfService.openOfficeToPDF(pathFile, outFilePath);
|
||||
if("pdf".equals(type)){
|
||||
//返回pdf
|
||||
return new File(outFilePath);
|
||||
}
|
||||
//返回word
|
||||
//return new File(pathFile);
|
||||
return new File(pathFile);
|
||||
} finally {
|
||||
if (os != null) {
|
||||
os.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
public File downloadExcel(String templateName, Map<String, Object> dataMap) throws Exception {
|
||||
OutputStream os = null;
|
||||
try {
|
||||
File outFile = new File(Consts.uploadAbsDir());
|
||||
if (!outFile.exists()) {
|
||||
outFile.mkdirs();
|
||||
}
|
||||
String templatePath = Consts.getTemplatePath();
|
||||
String abTemplatePath = templatePath + File.separator + templateName + ".xlsx";
|
||||
//判断模板是否存在
|
||||
File file = new File(abTemplatePath);
|
||||
if(!file.exists()){
|
||||
throw new KkFileException("请先上传模板!");
|
||||
}
|
||||
|
||||
String excelFile = "/"+ UUID.randomUUID().toString().replace("-", "") + ".xlsx";
|
||||
//通过填参 生产文件 并放到 upload 文件夹中
|
||||
String path = Consts.uploadAbsDir();
|
||||
String pathFile = path + excelFile;
|
||||
os = new FileOutputStream(pathFile);
|
||||
TemplateExportParams params = new TemplateExportParams(
|
||||
abTemplatePath);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(params, dataMap);
|
||||
workbook.write(os);
|
||||
return new File(pathFile);
|
||||
} finally {
|
||||
if (os != null) {
|
||||
os.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 返回 word 文件
|
||||
* @param templateName
|
||||
* @param dataMap
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
public File downloadWord(String templateName, Map<String, Object> dataMap) throws Exception {
|
||||
OutputStream os = null;
|
||||
try {
|
||||
File outFile = new File(Consts.uploadAbsDir());
|
||||
if (!outFile.exists()) {
|
||||
outFile.mkdirs();
|
||||
}
|
||||
String templatePath = Consts.getTemplatePath();
|
||||
String abTemplatePath = templatePath + File.separator + templateName + ".docx";
|
||||
//判断模板是否存在
|
||||
File file = new File(abTemplatePath);
|
||||
if(!file.exists()){
|
||||
throw new KkFileException("请先上传模板!");
|
||||
}
|
||||
XWPFDocument xwpfDocument = WordExportUtil.exportWord07(abTemplatePath, dataMap);
|
||||
//如果是签收单,则需要合并单元格
|
||||
if (Consts.RECEIPT_FORM.equals(templateName)){
|
||||
List<Object> invoiceResList = (List<Object>) MapUtils.getObject(dataMap, "invoiceResList");
|
||||
mergeCell(xwpfDocument,0,7,7+invoiceResList.size()-1,Arrays.asList(5,6));
|
||||
}
|
||||
String docxFile = "/"+ UUID.randomUUID().toString().replace("-", "") + ".docx";
|
||||
//通过填参 生产文件 并放到 upload 文件夹中
|
||||
String path = Consts.uploadAbsDir();
|
||||
String pathFile = path + docxFile;
|
||||
os = new FileOutputStream(pathFile);
|
||||
xwpfDocument.write(os);
|
||||
//返回word
|
||||
return new File(pathFile);
|
||||
} finally {
|
||||
if (os != null) {
|
||||
os.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String excel(String templateName, Map<String, Object> dataMap) throws Exception {
|
||||
OutputStream os = null;
|
||||
try {
|
||||
File outFile = new File(Consts.uploadAbsDir());
|
||||
if (!outFile.exists()) {
|
||||
outFile.mkdirs();
|
||||
}
|
||||
String templatePath = Consts.getTemplatePath();
|
||||
String abTemplatePath = templatePath + File.separator + templateName + ".xlsx";
|
||||
//判断模板是否存在
|
||||
File file = new File(abTemplatePath);
|
||||
if (!file.exists()) {
|
||||
throw new KkFileException("请先上传模板!");
|
||||
}
|
||||
TemplateExportParams params = new TemplateExportParams(
|
||||
abTemplatePath);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(params, dataMap);
|
||||
String docxFile = "/"+ UUID.randomUUID().toString().replace("-", "") + ".xlsx";
|
||||
//通过填参 生产文件 并放到 upload 文件夹中
|
||||
String path = Consts.uploadAbsDir();
|
||||
String pathFile = path + docxFile;
|
||||
os = new FileOutputStream(pathFile);
|
||||
workbook.write(os);
|
||||
log.info("文件路径:{}", kkfileConfig.getLocalfileUrl() + File.separator + Consts.UPLOAD_PATH_NAME + docxFile);
|
||||
String previewUrl = WebUtils.getBaseUrl() + "onlinePreview?url=" +
|
||||
URLEncoder.encode(Base64.encodeBase64String((kkfileConfig.getLocalfileUrl() + File.separator + Consts.UPLOAD_PATH_NAME + docxFile).getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8.name());
|
||||
return previewUrl;
|
||||
} finally {
|
||||
if (os != null) {
|
||||
os.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import cn.keking.service.ContractService;
|
||||
import cn.keking.utils.Consts;
|
||||
import cn.keking.utils.ServiceResponse;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.github.xiaoymin.knife4j.core.util.StrUtil;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -60,6 +61,24 @@ public class ContractController {
|
||||
return new ServiceResponse<>(null, e.getMessage(), ServiceResponse.RESULT_SERVER_ERR_CODE);
|
||||
}
|
||||
}
|
||||
@ApiOperation("根据模板渲染excel")
|
||||
@PostMapping("/excel/{templateName}")
|
||||
public ServiceResponse<String> excel(
|
||||
@PathVariable String templateName,
|
||||
@RequestBody Map<String, Object> dataMap) {
|
||||
try {
|
||||
log.info("templateName:{},dataMap:{}", templateName, dataMap);
|
||||
return new ServiceResponse<>(contractService.excel(templateName, dataMap), "success",
|
||||
ServiceResponse.RESULT_CODE_SUCCESS_CODE);
|
||||
} catch (Exception e) {
|
||||
log.error("生成错误:", e);
|
||||
if (e instanceof KkFileException) {
|
||||
KkFileException kkFileException = (KkFileException) e;
|
||||
return new ServiceResponse<>(null, kkFileException.getMessage(), ServiceResponse.RESULT_CODE_ERROR_CODE);
|
||||
}
|
||||
return new ServiceResponse<>(null, e.getMessage(), ServiceResponse.RESULT_SERVER_ERR_CODE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 合同模板上传
|
||||
@ -110,6 +129,49 @@ public class ContractController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 下载合同excel文件
|
||||
*/
|
||||
@ApiParam("下载excel文件")
|
||||
@PostMapping("/downloadExcel/{templateName}")
|
||||
public ServiceResponse downloadExcel(
|
||||
@PathVariable String templateName,
|
||||
@RequestBody Map<String, Object> dataMap,
|
||||
HttpServletResponse response
|
||||
) {
|
||||
try {
|
||||
log.error(JSON.toJSONString(dataMap));
|
||||
OutputStream outstream = null;
|
||||
File file = contractService.downloadExcel(templateName, dataMap);
|
||||
outstream = response.getOutputStream();
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/octet-stream");
|
||||
String filename =file.getName();
|
||||
response.reset();
|
||||
// 设置response的Header
|
||||
response.addHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes()));
|
||||
response.addHeader("Content-Length", "" + file.length());
|
||||
// 刷新缓冲
|
||||
response.flushBuffer();
|
||||
FileInputStream fileInputStream = new FileInputStream(file);
|
||||
BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
|
||||
byte[] b = new byte[bufferedInputStream.available()];
|
||||
bufferedInputStream.read(b);
|
||||
outstream.write(b);
|
||||
bufferedInputStream.close();
|
||||
outstream.flush();
|
||||
outstream.close();
|
||||
return new ServiceResponse<>("success",
|
||||
ServiceResponse.RESULT_CODE_SUCCESS_CODE);
|
||||
} catch (Exception e) {
|
||||
log.error("生成错误:", e);
|
||||
if (e instanceof KkFileException) {
|
||||
KkFileException kkFileException = (KkFileException) e;
|
||||
return new ServiceResponse<>(null, kkFileException.getMessage(), ServiceResponse.RESULT_CODE_ERROR_CODE);
|
||||
}
|
||||
return new ServiceResponse<>(null, "fail", ServiceResponse.RESULT_SERVER_ERR_CODE);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return 下载合同pdf文件
|
||||
*/
|
||||
@ -119,17 +181,66 @@ public class ContractController {
|
||||
@ApiParam(value = "模板名称: 销售合同: sellContract ; 销售框架合同: frameContract", required = true) @PathVariable String templateName,
|
||||
@io.swagger.v3.oas.annotations.parameters.RequestBody()
|
||||
@RequestBody Map<String, Object> dataMap,
|
||||
HttpServletResponse response,
|
||||
@RequestParam(value = "type", required = false) String type
|
||||
) {
|
||||
try {
|
||||
log.error(JSON.toJSONString(dataMap));
|
||||
OutputStream outstream = null;
|
||||
if (type == null) {
|
||||
type="pdf";
|
||||
}
|
||||
|
||||
File file = contractService.download(templateName, dataMap,type);
|
||||
outstream = response.getOutputStream();
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/octet-stream");
|
||||
String filename = dataMap.get("conCode") + "."+type;
|
||||
response.reset();
|
||||
// 设置response的Header
|
||||
response.addHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes()));
|
||||
response.addHeader("Content-Length", "" + file.length());
|
||||
// 刷新缓冲
|
||||
response.flushBuffer();
|
||||
FileInputStream fileInputStream = new FileInputStream(file);
|
||||
BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
|
||||
byte[] b = new byte[bufferedInputStream.available()];
|
||||
bufferedInputStream.read(b);
|
||||
outstream.write(b);
|
||||
bufferedInputStream.close();
|
||||
outstream.flush();
|
||||
outstream.close();
|
||||
return new ServiceResponse<>("success",
|
||||
ServiceResponse.RESULT_CODE_SUCCESS_CODE);
|
||||
} catch (Exception e) {
|
||||
log.error("生成错误:", e);
|
||||
if (e instanceof KkFileException) {
|
||||
KkFileException kkFileException = (KkFileException) e;
|
||||
return new ServiceResponse<>(null, kkFileException.getMessage(), ServiceResponse.RESULT_CODE_ERROR_CODE);
|
||||
}
|
||||
return new ServiceResponse<>(null, "fail", ServiceResponse.RESULT_SERVER_ERR_CODE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载 word 文件
|
||||
*/
|
||||
@ApiParam("下载word文件")
|
||||
@PostMapping("/downloadWord/{templateName}")
|
||||
public ServiceResponse downloadWord(
|
||||
@PathVariable String templateName,
|
||||
@RequestBody Map<String, Object> dataMap,
|
||||
HttpServletResponse response
|
||||
) {
|
||||
try {
|
||||
log.error(JSON.toJSONString(dataMap));
|
||||
OutputStream outstream = null;
|
||||
|
||||
File file = contractService.download(templateName, dataMap);
|
||||
File file = contractService.downloadWord(templateName, dataMap);
|
||||
outstream = response.getOutputStream();
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/octet-stream");
|
||||
String filename = dataMap.get("conCode") + ".pdf";
|
||||
String filename = dataMap.get("conCode") + ".docx";
|
||||
response.reset();
|
||||
// 设置response的Header
|
||||
response.addHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes()));
|
||||
|
@ -1,9 +0,0 @@
|
||||
kkfile.fileDir=/appdata/upload/ecrm-print
|
||||
kkfile.baseUrl=http://192.168.1.169/ecrm-print
|
||||
kkfile.token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJaOURjQXBIOGUyakN1RXg1bmk1b3J5WVpjWjQ0djJzaCJ9.37eYpIAbrLbxF4X7-7Lhwox3LFVuv5hl_dwWVdwg7r8
|
||||
kkfile.localfileUrl=http://192.168.1.169/ecrm-print-jwt
|
||||
kkfile.cacheEnabled=true
|
||||
kkfile.cache.type=default
|
||||
server.servlet.context-path= /ecrm-print
|
||||
# 开启增强配置
|
||||
knife4j.enable=true
|
@ -1,9 +0,0 @@
|
||||
kkfile.fileDir=/appdata/upload/crm-print
|
||||
kkfile.baseUrl=http://192.168.21.31/crm-print
|
||||
kkfile.token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIya3FTbmE1TmoweTBmQzhETEJPd1dVdmxuRWNyZUQ4NiJ9.0iPPXwIiMHdQ0UVJ_bL5SYC4y_FLu6pGaJzmu0WV1Ao
|
||||
kkfile.localfileUrl=http://192.168.21.31/crm-print-jwt
|
||||
kkfile.cacheEnabled=true
|
||||
kkfile.cache.type=default
|
||||
server.servlet.context-path= /crm-print
|
||||
# 开启增强配置
|
||||
knife4j.enable=true
|
3
server/src/main/resources/application-gray.yml
Normal file
3
server/src/main/resources/application-gray.yml
Normal file
@ -0,0 +1,3 @@
|
||||
nacos:
|
||||
config:
|
||||
namespace: gray
|
@ -1,15 +0,0 @@
|
||||
server.port = 8080
|
||||
kkfile.fileDir=/appdata/upload/crm-print
|
||||
kkfile.baseUrl = https://crm.vazyme.com/crm-print
|
||||
kkfile.token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJCQ0FuMkNIRGtvU0RKdjdJcDBrMFdqVkhVUm85NElTRiJ9.zzJtS7TYaaLy-VIANMU96SOw2r9driz-0Qxy-To9ko8
|
||||
kkfile.localfileUrl=https://crm.vazyme.com/crm-print-jwt
|
||||
kkfile.cacheEnabled=true
|
||||
kkfile.cache.type=default
|
||||
kkfile.fileUploadDisable = false
|
||||
server.servlet.context-path= /crm-print
|
||||
|
||||
knife4j.enable=true
|
||||
knife4j.production=true
|
||||
knife4j.basic.enable=true
|
||||
knife4j.basic.username=crm
|
||||
knife4j.basic.password=crm@#$%&87811
|
3
server/src/main/resources/application-prod.yml
Normal file
3
server/src/main/resources/application-prod.yml
Normal file
@ -0,0 +1,3 @@
|
||||
nacos:
|
||||
config:
|
||||
namespace: prod
|
@ -1,15 +0,0 @@
|
||||
server.port = 8080
|
||||
kkfile.fileDir=/appdata/upload/crm-print
|
||||
kkfile.baseUrl = https://testcrm.vazyme.com/crm-print
|
||||
kkfile.token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqcWx6MTlJSWRRMTJwN2JKMk12UUNYS2JqU1BEcTdZRyJ9.DR3TgZq-4E8t2yjDGVLsat_EIOFAZvXGDV4ss0u-mYU
|
||||
kkfile.localfileUrl=https://testcrm.vazyme.com/crm-print-jwt
|
||||
kkfile.cacheEnabled=true
|
||||
kkfile.cache.type=default
|
||||
kkfile.fileUploadDisable = false
|
||||
server.servlet.context-path= /crm-print
|
||||
|
||||
knife4j.enable=true
|
||||
knife4j.production=true
|
||||
knife4j.basic.enable=true
|
||||
knife4j.basic.username=crm
|
||||
knife4j.basic.password=crm@#$%&87811
|
@ -1,9 +0,0 @@
|
||||
kkfile.fileDir=/appdata/upload/crm-print
|
||||
kkfile.baseUrl=https://www.rzdata.net/crm-print
|
||||
kkfile.token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ6UThLa0k5SEl0bkx0V2FXWW1mbjlLeTJ3OWxIZVhlMiJ9.LeOfenI2PMtXVL1W2sdwuw-YggAvXzV3Ne6RBwTef9k
|
||||
kkfile.localfileUrl=https://www.rzdata.net/crm-print-jwt
|
||||
kkfile.cacheEnabled=true
|
||||
kkfile.cache.type=default
|
||||
server.servlet.context-path= /crm-print
|
||||
# 开启增强配置
|
||||
knife4j.enable=true
|
4
server/src/main/resources/application-test.yml
Normal file
4
server/src/main/resources/application-test.yml
Normal file
@ -0,0 +1,4 @@
|
||||
nacos:
|
||||
config:
|
||||
namespace: test
|
||||
server-addr: 192.168.1.169:8848
|
@ -1,14 +0,0 @@
|
||||
kkfile.fileDir=/appdata/upload/crm-print
|
||||
kkfile.baseUrl = https://crm.vazyme.com/crm-print
|
||||
kkfile.token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJCQ0FuMkNIRGtvU0RKdjdJcDBrMFdqVkhVUm85NElTRiJ9.zzJtS7TYaaLy-VIANMU96SOw2r9driz-0Qxy-To9ko8
|
||||
kkfile.localfileUrl=https://crm.vazyme.com/crm-print-jwt
|
||||
kkfile.cacheEnabled=true
|
||||
kkfile.cache.type=default
|
||||
kkfile.fileUploadDisable = false
|
||||
server.servlet.context-path= /crm-print
|
||||
|
||||
knife4j.enable=true
|
||||
knife4j.production=true
|
||||
knife4j.basic.enable=true
|
||||
knife4j.basic.username=crm
|
||||
knife4j.basic.password=crm@#$%&87811
|
@ -1,10 +0,0 @@
|
||||
kkfile.fileDir=/appdata/upload/crm-print
|
||||
kkfile.baseUrl = http://117.78.50.82:9089/crm-print
|
||||
kkfile.token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJCQ0FuMkNIRGtvU0RKdjdJcDBrMFdqVkhVUm85NElTRiJ9.zzJtS7TYaaLy-VIANMU96SOw2r9driz-0Qxy-To9ko8
|
||||
kkfile.localfileUrl=http://117.78.50.82:9089/crm-print
|
||||
kkfile.cacheEnabled=true
|
||||
kkfile.cache.type=default
|
||||
kkfile.fileUploadDisable = false
|
||||
server.servlet.context-path= /crm-print
|
||||
# 开启增强配置
|
||||
knife4j.enable=true
|
@ -1,118 +0,0 @@
|
||||
#######################################不可动态配置,需要重启生效#######################################
|
||||
server.port = 9089
|
||||
server.servlet.context-path= /crm-print
|
||||
server.servlet.encoding.charset = utf-8
|
||||
#文件上传限制
|
||||
spring.servlet.multipart.max-file-size=500MB
|
||||
spring.servlet.multipart.max-request-size=500MB
|
||||
## Freemarker 配置
|
||||
spring.freemarker.template-loader-path = classpath:/web/
|
||||
spring.freemarker.cache = false
|
||||
spring.freemarker.charset = UTF-8
|
||||
spring.freemarker.check-template-location = true
|
||||
spring.freemarker.content-type = text/html
|
||||
spring.freemarker.expose-request-attributes = true
|
||||
spring.freemarker.expose-session-attributes = true
|
||||
spring.freemarker.request-context-attribute = request
|
||||
spring.freemarker.suffix = .ftl
|
||||
spring.profiles.active=dev
|
||||
|
||||
# office-plugin
|
||||
## office转换服务的进程数,默认开启两个进程
|
||||
kkfile.office.plugin.server.ports = 2001,2002
|
||||
## office 转换服务 task 超时时间,默认五分钟
|
||||
kkfile.office.plugin.task.timeout = 5m
|
||||
|
||||
#缓存实现类型,不配默认为内嵌RocksDB(type = default)实现,可配置为redis(type = redis)实现(需要配置spring.redisson.address等参数)和 JDK 内置对象实现(type = jdk),
|
||||
kkfile.cache.type = jdk
|
||||
|
||||
#缓存是否自动清理 true 为开启,注释掉或其他值都为关闭
|
||||
kkfile.cache.clean.enabled = true
|
||||
#缓存自动清理时间,cache.clean.enabled = true时才有用,cron表达式,基于Quartz cron
|
||||
kkfile.cache.clean.cron = 0 0 3 * * ?
|
||||
|
||||
#redis连接,只有当cache.type = redis时才有用
|
||||
spring.redisson.address = 127.0.0.1:6379
|
||||
spring.redisson.password =
|
||||
|
||||
#文件资源路径(默认为打包根路径下的file目录下)
|
||||
#file.dir = D:\\kkFileview\\
|
||||
kkfile.fileDir = /data/file
|
||||
#openoffice home路径
|
||||
#office.home = C:\\Program Files (x86)\\OpenOffice 4
|
||||
kkfile.officeHome = default
|
||||
|
||||
|
||||
|
||||
|
||||
#######################################可在运行时动态配置#######################################
|
||||
#提供预览服务的地址,默认从请求url读,如果使用nginx等反向代理,需要手动设置
|
||||
#base.url = https://file.keking.cn
|
||||
kkfile.baseUrl = default
|
||||
|
||||
#信任站点,多个用','隔开,设置了之后,会限制只能预览来自信任站点列表的文件,默认不限制
|
||||
#trust.host = file.keking.cn,kkfileview.keking.cn
|
||||
kkfile.trust.host = default
|
||||
|
||||
#是否启用缓存
|
||||
kkfile.cacheEnabled = true
|
||||
|
||||
#文本类型,默认如下,可自定义添加
|
||||
kkfile.simText = txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,log,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd
|
||||
#多媒体类型,默认如下,可自定义添加
|
||||
kkfile.media = mp3,wav,mp4,flv
|
||||
#是否开启多媒体类型转视频格式转换,目前可转换视频格式有:avi,mov,wmv,3gp,rm
|
||||
#请谨慎开启此功能,建议异步调用添加到处理队列,并且增加任务队列处理线程,防止视频转换占用完线程资源,转换比较耗费时间,并且控制了只能串行处理转换任务
|
||||
kkfile.mediaConvertDisable = false
|
||||
#支持转换的视频类型
|
||||
kkfile.convertMedias = avi,mov,wmv,mkv,3gp,rm
|
||||
#office类型文档(word ppt)样式,默认为图片(image),可配置为pdf(预览时也有按钮切换)
|
||||
kkfile.officePreviewType = pdf
|
||||
#是否关闭office预览切换开关,默认为false,可配置为true关闭
|
||||
kkfile.officePreviewSwitchDisabled= true
|
||||
|
||||
#是否禁止下载转换生成的pdf文件
|
||||
kkfile.pdfDownloadDisable = true
|
||||
#是否禁用首页文件上传
|
||||
kkfile.fileUploadDisable = false
|
||||
|
||||
#预览源为FTP时 FTP用户名,可在ftp url后面加参数ftp.username=ftpuser指定,不指定默认用配置的
|
||||
kkfile.ftpUsername = ftpuser
|
||||
#预览源为FTP时 FTP密码,可在ftp url后面加参数ftp.password=123456指定,不指定默认用配置的
|
||||
kkfile.ftpPassword= 1234561
|
||||
#预览源为FTP时, FTP连接默认ControlEncoding(根据FTP服务器操作系统选择,Linux一般为UTF-8,Windows一般为GBK),可在ftp url后面加参数ftp.control.encoding=UTF-8指定,不指定默认用配置的
|
||||
kkfile.ftpControlEncoding = UTF-8
|
||||
|
||||
#水印内容
|
||||
#例:watermark.txt = ${WATERMARK_TXT:凯京科技内部文件,严禁外泄}
|
||||
#如需取消水印,内容设置为空即可,例:watermark.txt = ${WATERMARK_TXT:}
|
||||
kkfile.watermarkTxt =
|
||||
#水印x轴间隔
|
||||
kkfile.watermarkXSpace = 10
|
||||
#水印y轴间隔
|
||||
kkfile.watermarkYSpace = 10
|
||||
#水印字体
|
||||
kkfile.watermarkFont = 微软雅黑
|
||||
#水印字体大小
|
||||
kkfile.watermarkFontsize = 18px
|
||||
#水印字体颜色
|
||||
kkfile.watermarkColor = black
|
||||
#水印透明度,要求设置在大于等于0.005,小于1
|
||||
kkfile.watermarkAlpha = 0.2
|
||||
#水印宽度
|
||||
kkfile.watermarkWidth = 180
|
||||
#水印高度
|
||||
kkfile.watermarkHeight = 80
|
||||
#水印倾斜度数,要求设置在大于等于0,小于90
|
||||
kkfile.watermarkAngle = 10
|
||||
|
||||
kkfile.previewUrl=http://127.0.0.1:9089/onlinePreview?url=%s
|
||||
|
||||
|
||||
# health 健康检查
|
||||
#management.endpoints.enabled-by-default=true
|
||||
#management.endpoints.web.base-path=/actuator
|
||||
#management.endpoints.web.exposure.include=health
|
||||
#management.endpoint.health.how-details=always
|
||||
|
||||
|
21
server/src/main/resources/application.yml
Normal file
21
server/src/main/resources/application.yml
Normal file
@ -0,0 +1,21 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: test
|
||||
|
||||
nacos:
|
||||
config:
|
||||
bootstrap:
|
||||
enable: true
|
||||
username: nacos
|
||||
password: nacos
|
||||
server-addr: nacos:8848
|
||||
|
||||
auto-refresh: true
|
||||
config-long-poll-timeout: 46000
|
||||
config-retry-time: 2333
|
||||
max-retry: 10
|
||||
enable-remote-sync-config: true
|
||||
|
||||
group: crm-public
|
||||
data-id: print
|
||||
type: yaml
|
Loading…
x
Reference in New Issue
Block a user