修改打印模板地址

master
郑明梁 2 years ago
parent f658c2c4c9
commit 7ee91a1a2c

@ -34,6 +34,7 @@ import com.glxp.api.service.system.SystemPDFTemplateRelevanceService;
import com.glxp.api.service.system.SystemPDFTemplateService;
import com.glxp.api.util.JasperUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@ -68,6 +69,8 @@ public class BasicOrderPrintController {
IBasicBussinessTypeService basicBussinessTypeService;
@Resource
IoCodeService ioCodeService;
@Value("${file_path}")
private String filePath;
//校验模板是否正确
@AuthRuleAnnotation("")
@ -195,7 +198,7 @@ public class BasicOrderPrintController {
data.put("data", list);
String param = JSON.toJSONString(data);
JasperUtils.jasperReport(request, response, param, systemPDFTemplateEntity.getPath(), "pdf");
JasperUtils.jasperReport(request, response, param, filePath + "/pdf/template/"+systemPDFTemplateEntity.getPath(), "pdf");
}
}

@ -20,6 +20,7 @@ import com.glxp.api.service.system.SystemPDFModuleService;
import com.glxp.api.service.system.SystemPDFTemplateService;
import com.glxp.api.util.JasperUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -47,6 +48,8 @@ public class DeviceMAOrderController {
private SystemPDFTemplateService systemPDFTemplateService;
@Resource
private SystemPDFModuleService systemPDFModuleService;
@Value("${file_path}")
private String filePath;
/**
@ -171,7 +174,7 @@ public class DeviceMAOrderController {
Map<String, Object> data = deviceMAOrderService.getPrintData(filterDeviceMAOrderRequest.getOrderId());
Map<String, List<Map<String, Object>>> printData = new HashMap<>(1);
printData.put("data", Arrays.asList(data));
JasperUtils.jasperReport(request, response, JSONUtil.toJsonStr(printData), systemPDFTemplateEntity.getPath(), "pdf");
JasperUtils.jasperReport(request, response, JSONUtil.toJsonStr(printData), filePath + "/pdf/template/"+systemPDFTemplateEntity.getPath(), "pdf");
}

@ -22,6 +22,7 @@ import com.glxp.api.service.inv.InvCountOrderService;
import com.glxp.api.service.system.SystemPDFModuleService;
import com.glxp.api.service.system.SystemPDFTemplateService;
import com.glxp.api.util.JasperUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -49,6 +50,8 @@ public class InvCountOrderController {
private SystemPDFTemplateService systemPDFTemplateService;
@Resource
private SystemPDFModuleService systemPDFModuleService;
@Value("${file_path}")
private String filePath;
/**
*
@ -172,7 +175,7 @@ public class InvCountOrderController {
data.put("orderId", invCountOrderPrintRequest.getOrderId());
Map<String, List<Map<String, Object>>> printData = new HashMap<>(1);
printData.put("data", Arrays.asList(data));
JasperUtils.jasperReport(request, response, JSONUtil.toJsonStr(printData), systemPDFTemplateEntity.getPath(), "pdf");
JasperUtils.jasperReport(request, response, JSONUtil.toJsonStr(printData), filePath + "/pdf/template/"+systemPDFTemplateEntity.getPath(), "pdf");
}
//------------------------------------------------------手持终端接口---------------------------------------------------------------

@ -62,6 +62,8 @@ public class InvInnerOrderPrintController {
private IoOrderService ioOrderService;
@Resource
private InnerOrderService innerOrderService;
@Value("${file_path}")
private String filePath;
@GetMapping("/udiwms/innerOrderPrint/filter")
@ -182,7 +184,7 @@ public class InvInnerOrderPrintController {
} else {
Map<String, Object> data = new HashMap<String, Object>();
data.put("data", printEntities);
JasperUtils.jasperReport(request, response, data, systemPDFTemplateEntity.getPath(), "pdf");
JasperUtils.jasperReport(request, response, data, filePath + "/pdf/template/"+systemPDFTemplateEntity.getPath(), "pdf");
}

@ -405,7 +405,7 @@ public class SupCertController {
}
String param = JSON.toJSONString(list);
JasperUtils.jasperReport(request, response, param, systemPDFTemplateEntity.getPath(), "pdf");
JasperUtils.jasperReport(request, response, param, filePath + "/pdf/template/"+systemPDFTemplateEntity.getPath(), "pdf");
}
/**
@ -520,7 +520,7 @@ public class SupCertController {
}
String param = JSON.toJSONString(list);
JasperUtils.jasperReport(request, response, param, systemPDFTemplateEntity.getPath(), "pdf");
JasperUtils.jasperReport(request, response, param, filePath + "/pdf/template/"+systemPDFTemplateEntity.getPath(), "pdf");
}
/**
@ -586,7 +586,7 @@ public class SupCertController {
}
String param = JSON.toJSONString(list);
JasperUtils.jasperReport(request, response, param, systemPDFTemplateEntity.getPath(), "pdf");
JasperUtils.jasperReport(request, response, param, filePath + "/pdf/template/"+systemPDFTemplateEntity.getPath(), "pdf");
}
//首营预览文件

@ -15,6 +15,7 @@ import com.glxp.api.service.system.SystemPDFTemplateService;
import com.glxp.api.util.JasperUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
@ -33,6 +34,9 @@ public class SysPdfTemplateController {
@Resource
private SystemPDFTemplateService systemPDFTemplateService;
@Value("${file_path}")
private String filePath;
@AuthRuleAnnotation("system/pdf/template/list")
@GetMapping("/system/pdf/template/list")
public BaseResponse list(@Valid FilterPdfTemplateRequest filterPdfTemplateRequest,
@ -63,17 +67,20 @@ public class SysPdfTemplateController {
@RequestBody FilterPdfTemplateRequest filterPdfTemplateRequest,
HttpServletRequest request, HttpServletResponse response) throws Exception {
SystemPDFTemplateEntity systemPDFTemplateEntity =
systemPDFTemplateService.selectById(String.valueOf(filterPdfTemplateRequest.getId()));
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(String.valueOf(filterPdfTemplateRequest.getId()));
String data = "";
if (systemPDFTemplateEntity.getModule() == 2) {
if (systemPDFTemplateEntity.getModule() == 2 || systemPDFTemplateEntity.getModule() == 3) {
data =
"{\"data\":[{\"batchNo\":\"2020\",\"billNo\":\"2022040811589\",\"billType\":\"ST39730635520\",\"billdate\":\"2022-04-08\",\"corpId\":\"39864007581\",\"corpName\":\"漳州**有限公司\",\"count\":\"4\",\"customerId\":\"39864007581\",\"expireDate\":\"251020\",\"id\":\"10\",\"index\":\"1\",\"locInv\":\"总库\",\"orderIdFk\":\"SM412208685600\",\"printStatus\":\"102\",\"productDate\":\"201020\",\"productId\":\"169\",\"productName\":\"一次性使用开环式微创肛肠吻合器\",\"sourceType\":\"1\",\"spec\":\"TST33-T80——2993规格\",\"status\":\"5\",\"sweepCount\":\"0\",\"title\":\"漳州**医院\",\"type\":\"2\",\"unitIdFk\":\"39864007581\",\"ylqxzcrbarmc\":\"漳州**有限公司\",\"zczbhhzbapzbh\":\"苏械注准2022000000\",\"price\":\"10.00\"},{\"batchNo\":\"2023\",\"billNo\":\"2022040811589\",\"billType\":\"ST39730635520\",\"billdate\":\"2022-04-08\",\"corpId\":\"39864007581\",\"corpName\":\"漳州**有限公司\",\"count\":\"4\",\"customerId\":\"39864007581\",\"expireDate\":\"251020\",\"id\":\"10\",\"index\":\"2\",\"locInv\":\"总库\",\"orderIdFk\":\"SM412208685600\",\"printStatus\":\"102\",\"productDate\":\"201020\",\"productId\":\"169\",\"productName\":\"一次性使用开环式微创肛肠吻合器\",\"sourceType\":\"1\",\"spec\":\"TST33-T80——2993规格\",\"status\":\"5\",\"sweepCount\":\"0\",\"title\":\"漳州**医院\",\"type\":\"2\",\"unitIdFk\":\"39864007581\",\"ylqxzcrbarmc\":\"漳州**有限公司\",\"zczbhhzbapzbh\":\"苏械注准2022000000\",\"price\":\"10.00\"},{\"batchNo\":\"2021\",\"billNo\":\"2022040811589\",\"billType\":\"ST39730635520\",\"billdate\":\"2022-04-08\",\"corpId\":\"39864007581\",\"corpName\":\"漳州**有限公司\",\"count\":\"4\",\"customerId\":\"39864007581\",\"expireDate\":\"251020\",\"id\":\"10\",\"index\":\"3\",\"locInv\":\"总库\",\"orderIdFk\":\"SM412208685600\",\"printStatus\":\"102\",\"productDate\":\"201020\",\"productId\":\"169\",\"productName\":\"一次性使用开环式微创肛肠吻合器\",\"sourceType\":\"1\",\"spec\":\"TST33-T80——2993规格\",\"status\":\"5\",\"sweepCount\":\"0\",\"title\":\"漳州**医院\",\"type\":\"2\",\"unitIdFk\":\"39864007581\",\"ylqxzcrbarmc\":\"漳州**有限公司\",\"zczbhhzbapzbh\":\"苏械注准2022000000\",\"price\":\"10.00\"}]}";
} else if (systemPDFTemplateEntity.getModule() == 0) {
data =
"{\"data\":[{\"batchNo\":\"2021\",\"corpName\":\"漳州***医院\",\"count\":10,\"cpmctymc\":\"髋关节假体\",\"expireDate\":\"230606\",\"ggxh\":\"DTUCS Ⅱ 3#\",\"id\":4,\"nameCode\":\"06902139302144\",\"produceDate\":\"210606\",\"udiCode\":\"#06902139302144#210606#230606#2021###\",\"ylqxzcrbarmc\":\"漳州**有限公司\",\"zczbhhzbapzbh\":\"国械注准201000000000\"},{\"batchNo\":\"2021\",\"corpName\":\"漳州***医院\",\"count\":10,\"cpmctymc\":\"髋关节假体\",\"expireDate\":\"230606\",\"ggxh\":\"DTUCS Ⅱ 3#\",\"id\":4,\"nameCode\":\"06902139302144\",\"produceDate\":\"210606\",\"udiCode\":\"#06902139302144#210606#230606#2021###\",\"ylqxzcrbarmc\":\"漳州**有限公司\",\"zczbhhzbapzbh\":\"国械注准201000000000\"},{\"batchNo\":\"2021\",\"corpName\":\"漳州***医院\",\"count\":10,\"cpmctymc\":\"髋关节假体\",\"expireDate\":\"230606\",\"ggxh\":\"DTUCS Ⅱ 3#\",\"id\":4,\"nameCode\":\"06902139302144\",\"produceDate\":\"210606\",\"udiCode\":\"#06902139302144#210606#230606#2021###\",\"ylqxzcrbarmc\":\"漳州**有限公司\",\"zczbhhzbapzbh\":\"国械注准201000000000\"},{\"batchNo\":\"2021\",\"corpName\":\"漳州***医院\",\"count\":10,\"cpmctymc\":\"髋关节假体\",\"expireDate\":\"230606\",\"ggxh\":\"DTUCS Ⅱ 3#\",\"id\":4,\"nameCode\":\"06902139302144\",\"produceDate\":\"210606\",\"udiCode\":\"#06902139302144#210606#230606#2021###\",\"ylqxzcrbarmc\":\"漳州**有限公司\",\"zczbhhzbapzbh\":\"国械注准201000000000\"},{\"batchNo\":\"2021\",\"corpName\":\"漳州***医院\",\"count\":10,\"cpmctymc\":\"髋关节假体\",\"expireDate\":\"230606\",\"ggxh\":\"DTUCS Ⅱ 3#\",\"id\":4,\"nameCode\":\"06902139302144\",\"produceDate\":\"210606\",\"udiCode\":\"#06902139302144#210606#230606#2021###\",\"ylqxzcrbarmc\":\"漳州**有限公司\",\"zczbhhzbapzbh\":\"国械注准201000000000\"},{\"batchNo\":\"2021\",\"corpName\":\"漳州***医院\",\"count\":10,\"cpmctymc\":\"髋关节假体\",\"expireDate\":\"230606\",\"ggxh\":\"DTUCS Ⅱ 3#\",\"id\":4,\"nameCode\":\"06902139302144\",\"produceDate\":\"210606\",\"udiCode\":\"#06902139302144#210606#230606#2021###\",\"ylqxzcrbarmc\":\"漳州**有限公司\",\"zczbhhzbapzbh\":\"国械注准201000000000\"}]}";
} else if (systemPDFTemplateEntity.getModule() == 1) {
data =
"[{\"area\":\"福建省厦门市湖里区\",\"vaiDate\":\"2023-03-15\",\"code\":\"1113\",\"companyName\":\"盛夏科技\",\"classes\":\"经营企业\",\"mobile\":\"18575144832\",\"index\":\"1\",\"remark\":\"12\",\"detailAddr\":\"湖里\",\"name\":\"业务许可证\",\"creditNum\":\"6464684643\",\"auditStatus\":\"审核通过\",\"expireDate\":\"2023-03-16\",\"contacts\":\"东\",\"email\":\"46456@qq.com\",\"status\":\"有效\"}]";
}
JasperUtils.jasperReport(request, response, data, systemPDFTemplateEntity.getPath(), "pdf");
JasperUtils.jasperReport(request, response, data, filePath + "/pdf/template/"+systemPDFTemplateEntity.getPath(), "pdf");
}

@ -73,7 +73,7 @@ public class DownloadController {
@RequestParam String fileName) throws IOException {
OutputStream os = null;
try {
FileInputStream input = new FileInputStream(new File(fileName));
FileInputStream input = new FileInputStream(new File(filePath + "/pdf/template/"+fileName));
OutputStream out = response.getOutputStream();
byte[] b = new byte[2048];
int len;

@ -54,7 +54,7 @@ public class uploadController {
file.transferTo(file1);
Map<String, String> rMap = new HashMap<>();
rMap.put("msg", "上传成功");
rMap.put("path", savePath + "/" + newName);
rMap.put("path", newName);
return ResultVOUtils.success(rMap);
} catch (IOException e) {
e.printStackTrace();
@ -87,7 +87,7 @@ public class uploadController {
file.transferTo(file1);
Map<String, String> rMap = new HashMap<>();
rMap.put("msg", "上传成功");
rMap.put("path", savePath + "/" + newName);
rMap.put("path",newName);
return ResultVOUtils.success(rMap);
} catch (IOException e) {
e.printStackTrace();

Loading…
Cancel
Save