Commit f9e59dc1 authored by 盖献康's avatar 盖献康

检验报告 - 活数据

parent 23ead691
......@@ -105,6 +105,11 @@ public class InspectionReportPdfVO {
*/
private String productionDate;
/**
* 检验依据
*/
private String inspectionBasis;
/**
* 检验项目
*/
......
......@@ -3,6 +3,7 @@ package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.Task;
import com.ruoyi.domain.vo.EnterpriseFilePdfVO;
import com.ruoyi.domain.vo.InspectionReportPdfVO;
import com.ruoyi.web.request.TaskFindFinishRequest;
import com.ruoyi.web.request.TaskFindPendingRequest;
import com.ruoyi.web.request.TaskFindRequest;
......@@ -42,4 +43,11 @@ public interface TaskMapper extends BaseMapper<Task> {
* @return
*/
EnterpriseFilePdfVO selectEnterpriseFileData(@Param("taskId") Long taskId);
/**
* 通过总任务ID,获取检验报告数据
* @param taskId
* @return
*/
InspectionReportPdfVO selectInspectionReportData(Long taskId);
}
......@@ -86,7 +86,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
fields.addSubstitutionFont(bf);
// 测试数据
InspectionReportPdfVO inspectionReportPdfVO = requireData();
InspectionReportPdfVO inspectionReportPdfVO = requireData(taskId);
// 渲染数据
renderData(fields, inspectionReportPdfVO);
......@@ -181,9 +181,18 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
* @return
*/
private EnterpriseFilePdfVO getEnterpriseFileData(Long taskId) {
List<SysDictData> dictDataList = dictDataMapper.selectDictDataByType("inspection_item");
EnterpriseFilePdfVO enterpriseFileData = taskMapper.selectEnterpriseFileData(taskId);
List<String> list = Arrays.asList(enterpriseFileData.getInspectionItem().split(","));
enterpriseFileData.setInspectionItem(getInspectionItemByTaskItem(enterpriseFileData.getInspectionItem()));
return enterpriseFileData;
}
/**
* 获取当前项目的检验项目
* @return
*/
private String getInspectionItemByTaskItem(String inspectionItem) {
List<SysDictData> dictDataList = dictDataMapper.selectDictDataByType("inspection_item");
List<String> list = Arrays.asList(inspectionItem.split(","));
StringBuilder taskItem = new StringBuilder();
for (String item : list) {
Optional<SysDictData> first = dictDataList.stream().filter(data -> data.getDictValue().equals(item)).findFirst();
......@@ -192,8 +201,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
taskItem.append(dictData.getDictLabel()).append("、");
}
}
enterpriseFileData.setInspectionItem(taskItem.substring(0, taskItem.length() - 1));
return enterpriseFileData;
return taskItem.substring(0, taskItem.length() - 1);
}
/**
......@@ -234,38 +242,10 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
* 模拟数据
* @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;
private InspectionReportPdfVO requireData(Long taskId) {
InspectionReportPdfVO inspectionReport = taskMapper.selectInspectionReportData(taskId);
inspectionReport.setInspectionItem(getInspectionItemByTaskItem(inspectionReport.getInspectionItem()));
return inspectionReport;
}
/**
......
......@@ -285,7 +285,7 @@
<select id="selectEnterpriseFileData" resultType="com.ruoyi.domain.vo.EnterpriseFilePdfVO">
select
t.task_initiator_dept inspectionCenterName,
concat(s.standard_no, s.name) inspectionBasis,
concat(s.standard_no, ' ', s.name) inspectionBasis,
t.task_list inspectionItem,
DATE_FORMAT(t.create_time, '%Y-%m-%d') createTime,
t.entrusted_unit clientName
......@@ -295,5 +295,39 @@
where t.id = #{taskId}
</select>
<select id="selectInspectionReportData" resultType="com.ruoyi.domain.vo.InspectionReportPdfVO">
select
t.id AS reportNumber,
t.product_name AS productName,
t.product_model AS productModel,
t.entrusted_unit AS entrustedUnit,
t.entrusted_unit_address AS clientAddress,
t.entrusted_unit_phone AS entrustedUnitTelephone,
t.entrusted_unit_code AS clientPostalCode,
GROUP_CONCAT(distinct s.sample_name) AS sampleName,
t.product_model AS typeSpecification,
concat(st.standard_no, ' ', st.name) AS inspectionBasis,
GROUP_CONCAT(distinct ae.enterprise_name) AS productionEnterprise,
GROUP_CONCAT(distinct s.sample_sender) AS sampleSender,
GROUP_CONCAT(distinct DATE_FORMAT(s.delivery_date, '%Y-%m-%d')) AS sampleDeliveryDate,
count(s.id) AS sampleQuantity,
sum(s.number_of_samples) AS sampleSum,
GROUP_CONCAT(distinct DATE_FORMAT(s.manufacture_date, '%Y-%m-%d')) AS sampleDeliveryDate,
t.product_model AS vehicleType,
t.id AS taskNumber,
GROUP_CONCAT(distinct s.sample_number) AS sampleNumberSummary,
GROUP_CONCAT(distinct s.identification_code) AS vehicleIdentificationNumber,
t.task_list AS inspectionItem,
DATE_FORMAT(t.create_time, '%Y-%m-%d') AS productionDate
from
t_task t
left join t_task_sample_relation tsr on t.id = tsr.task_id
left join t_sample s on tsr.sample_id = s.id
left join t_automobile_enterprise ae on s.manufacturing_enterprise_id = ae.id
left join t_standard st on t.standard_id = st.id
where t.id = #{taskId}
group by t.id
</select>
</mapper>
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