Commit a75c138f authored by wdy's avatar wdy

Merge branch 'dev' of http://gitlab.91isoft.com:90/wangfei/vehicle-quality-review into wangdingyi

parents d4aa5774 cab1dfbc
package com.ruoyi.service; package com.ruoyi.service;
import javax.servlet.http.HttpServletResponse;
/** /**
* PDF模板管理Service接口 * PDF模板管理Service接口
* @author gxk * @author gxk
......
...@@ -2,7 +2,9 @@ package com.ruoyi.service.impl; ...@@ -2,7 +2,9 @@ package com.ruoyi.service.impl;
import java.util.List; import java.util.List;
import cn.hutool.core.util.ObjUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.web.request.AutomobileEnterpriseListRequest; import com.ruoyi.web.request.AutomobileEnterpriseListRequest;
...@@ -59,6 +61,14 @@ public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnter ...@@ -59,6 +61,14 @@ public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnter
@Override @Override
public int insertAutomobileEnterprise(AutomobileEnterprise automobileEnterprise) public int insertAutomobileEnterprise(AutomobileEnterprise automobileEnterprise)
{ {
// 判断企业名称是否重复
if (lambdaQuery()
.eq(AutomobileEnterprise::getEnterpriseName, automobileEnterprise.getEnterpriseName())
.ne(ObjUtil.isNotEmpty(automobileEnterprise.getId()), AutomobileEnterprise::getId, automobileEnterprise.getId())
.exists()
) {
throw new ServiceException("企业名称已存在");
}
automobileEnterprise.setCreateTime(DateUtils.getNowDate()); automobileEnterprise.setCreateTime(DateUtils.getNowDate());
automobileEnterprise.setCreateBy(String.valueOf(SecurityUtils.getUserId())); automobileEnterprise.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
return automobileEnterpriseMapper.insert(automobileEnterprise); return automobileEnterpriseMapper.insert(automobileEnterprise);
...@@ -73,6 +83,14 @@ public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnter ...@@ -73,6 +83,14 @@ public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnter
@Override @Override
public int updateAutomobileEnterprise(AutomobileEnterprise automobileEnterprise) public int updateAutomobileEnterprise(AutomobileEnterprise automobileEnterprise)
{ {
// 判断企业名称是否重复
if (lambdaQuery()
.eq(AutomobileEnterprise::getEnterpriseName, automobileEnterprise.getEnterpriseName())
.ne(ObjUtil.isNotEmpty(automobileEnterprise.getId()), AutomobileEnterprise::getId, automobileEnterprise.getId())
.exists()
) {
throw new ServiceException("企业名称已存在");
}
automobileEnterprise.setUpdateTime(DateUtils.getNowDate()); automobileEnterprise.setUpdateTime(DateUtils.getNowDate());
automobileEnterprise.setUpdateBy(String.valueOf(SecurityUtils.getUserId())); automobileEnterprise.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
return automobileEnterpriseMapper.updateAutomobileEnterprise(automobileEnterprise); return automobileEnterpriseMapper.updateAutomobileEnterprise(automobileEnterprise);
......
...@@ -17,11 +17,9 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -17,11 +17,9 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.*; import java.util.*;
import java.util.List; import java.util.List;
...@@ -62,8 +60,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -62,8 +60,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
ByteArrayOutputStream bos = null; ByteArrayOutputStream bos = null;
try { try {
// 模板绝对路径--服务器 // 模板绝对路径--服务器
// String fileName = "/template/receipt_template_02_27.pdf"; String fileName = "/template/receipt_template_02_27.pdf";
String fileName = "E:/文件/PDF模板/receipt_template_02_27.pdf";
// 读取现有模板内容 // 读取现有模板内容
reader = new PdfReader(fileName); reader = new PdfReader(fileName);
// 创建输出流 // 创建输出流
...@@ -102,40 +99,6 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -102,40 +99,6 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
return uploadMinio(bos, "检验报告_" + taskId); return uploadMinio(bos, "检验报告_" + taskId);
} }
private InspectionReportPdfVO requireData() {
InspectionReportPdfVO inspectionReportPdfVO = InspectionReportPdfVO.builder()
.reportNumber("报告编号")
.productName("产品名称")
.productModel("产品型号")
.entrustedUnit("委托单位")
.inspectionCenterName("检验中心名称")
.inspectionCenterAddress("检验中心地址")
.inspectionCenterTelephone("检验中心电话")
.inspectionCenterPostcode("检验中心邮编")
.clientAddress("委托单位地址")
.entrustedUnitTelephone("委托单位电话")
.clientPostalCode("委托单位邮编")
.sampleName("样品名称")
.typeSpecification("型号规格")
.productionEnterprise("生产企业")
.sampleSender("送养着")
.sampleDeliveryDate("送样日期")
.sampleQuantity("样品数量")
.productionDate("生产日期")
.inspectionItem("检验项目")
.testConclusion("检验结论")
.issueDate("签发日期")
.remark("备注")
.taskNumber("任务编号")
.sampleSum("样品数量")
.vehicleType("车辆类型")
.vehicleModel("车辆型号")
.vehicleIdentificationNumber("车辆识别码")
.sampleNumberSummary("样品编号汇总")
.build();
return inspectionReportPdfVO;
}
/** /**
* 企业留档文件PDF下载 * 企业留档文件PDF下载
* @param taskId * @param taskId
...@@ -232,6 +195,44 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -232,6 +195,44 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
return StringUtils.format("{}/{}.pdf", DateUtils.datePath(), name); return StringUtils.format("{}/{}.pdf", DateUtils.datePath(), name);
} }
/**
* 模拟数据
* @return
*/
private InspectionReportPdfVO requireData() {
InspectionReportPdfVO inspectionReportPdfVO = InspectionReportPdfVO.builder()
.reportNumber("报告编号")
.productName("产品名称")
.productModel("产品型号")
.entrustedUnit("委托单位")
.inspectionCenterName("检验中心名称")
.inspectionCenterAddress("检验中心地址")
.inspectionCenterTelephone("检验中心电话")
.inspectionCenterPostcode("检验中心邮编")
.clientAddress("委托单位地址")
.entrustedUnitTelephone("委托单位电话")
.clientPostalCode("委托单位邮编")
.sampleName("样品名称")
.typeSpecification("型号规格")
.productionEnterprise("生产企业")
.sampleSender("送养着")
.sampleDeliveryDate("送样日期")
.sampleQuantity("样品数量")
.productionDate("生产日期")
.inspectionItem("检验项目")
.testConclusion("检验结论")
.issueDate("签发日期")
.remark("备注")
.taskNumber("任务编号")
.sampleSum("样品数量")
.vehicleType("车辆类型")
.vehicleModel("车辆型号")
.vehicleIdentificationNumber("车辆识别码")
.sampleNumberSummary("样品编号汇总")
.build();
return inspectionReportPdfVO;
}
/** /**
* 渲染数据 * 渲染数据
* @param fields * @param fields
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment