根据配置文件切换模板地址,下载地址

This commit is contained in:
ryoeiken 2021-02-10 08:36:25 +08:00
parent f995596733
commit 50caf7df97
6 changed files with 40 additions and 5 deletions

View File

@ -17,6 +17,12 @@
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- swagger2-->
<dependency>
<groupId>io.springfox</groupId>

View File

@ -0,0 +1,14 @@
{
"properties": [
{
"name": "fantang.templatePath",
"type": "java.lang.String",
"description": "Description for spring.fantang.templatePath."
},
{
"name": "fantang.fileWebUrl",
"type": "java.lang.String",
"description": "Description for spring.fantang.fileWebUrl."
}
]
}

View File

@ -77,3 +77,7 @@ spring:
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
fantang:
templatePath: Z:\\程序开发\\项目测试\\三院饭堂\\饭堂收费票据模板.pdf
fileWebUrl: http://127.0.0.1:9001/dev-api/

View File

@ -77,3 +77,8 @@ spring:
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# 饭堂配置参数
fantang:
templatePath: /root/sanyuan/template/饭堂收费票据模板.pdf
fileWebUrl: http://8.135.81.183:8080/prod-api/

View File

@ -18,6 +18,7 @@ import com.ruoyi.system.fantang.service.IFtPrepaymentDaoService;
import com.ruoyi.system.fantang.utils.PdfUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@ -38,6 +39,11 @@ public class FtPrepaymentDaoController extends BaseController {
private final IFtPrepaymentDaoService iFtPrepaymentDaoService;
@Value("${fantang.templatePath}")
private String templatePath;
@Value("${fantang.fileWebUrl}")
private String fileWebUrl;
@GetMapping("/getCountById/{patientId}")
public AjaxResult getCountById(@PathVariable("patientId") Long patientId) {
@ -196,7 +202,7 @@ public class FtPrepaymentDaoController extends BaseController {
// 模板路径
// String templatePath = "F:\\pdfTemplate\\饭堂票据模板2.pdf";
String templatePath = "Z:\\程序开发\\项目测试\\三院饭堂\\饭堂收费票据模板.pdf";
// String templatePath = "Z:\\程序开发\\项目测试\\三院饭堂\\饭堂收费票据模板.pdf";
// 生成的新文件路径
String outputPath = RuoYiConfig.getUploadPath() + "\\饭堂票据" + patientId + ".pdf";
@ -206,7 +212,7 @@ public class FtPrepaymentDaoController extends BaseController {
// 下载地址
String downloadPath = "profile/upload/饭堂票据" + patientId + ".pdf";
return AjaxResult.success(downloadPath);
return AjaxResult.success(fileWebUrl + downloadPath);
}
}

View File

@ -283,7 +283,7 @@ export default {
// pdf
handleGenerateReceiptPdf(row) {
generateReceiptPdf(row).then(response => {
window.open("http://192.168.3.93:9001/dev-api/" + response.msg)
window.open(response.msg)
})
console.log(process.env);
},