|
@@ -31,6 +31,7 @@ import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.nodes.Element;
|
|
|
import org.jsoup.nodes.Node;
|
|
|
import org.jsoup.select.Elements;
|
|
|
+import org.springblade.business.dto.TrialSeleInspectionRecordBaseInfoDTO;
|
|
|
import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
|
|
|
import org.springblade.business.entity.*;
|
|
|
import org.springblade.business.feign.ContractLogClient;
|
|
@@ -2633,7 +2634,59 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
htmlString = htmlString.replaceAll("title", "titlexx");
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
keyNames= getKeyNameList(doc);
|
|
|
- if(entrustId != null){
|
|
|
+ TrialSelfInspectionRecord record = jdbcTemplate.query("select * from u_trial_self_inspection_record where id = " + groupId, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
|
|
|
+ // 优先使用试验记录中的委托单和样品
|
|
|
+ TrialSeleInspectionRecordBaseInfoDTO baseInfoDTO = null;
|
|
|
+ if (record != null) {
|
|
|
+ if (record.getBaseInfo() != null && !record.getBaseInfo().isEmpty()) {
|
|
|
+ try {
|
|
|
+ baseInfoDTO = JSON.parseObject(record.getBaseInfo(), TrialSeleInspectionRecordBaseInfoDTO.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("JSON反序列化失败:" + record.getBaseInfo());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ EntrustInfo entrustInfo = null;
|
|
|
+ Long sampleId = null;
|
|
|
+ if (record.getEntrustId() != null) {
|
|
|
+ String sql = "select * from u_entrust_info where id ="+ record.getEntrustId();
|
|
|
+ try {
|
|
|
+ entrustInfo = jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<>(EntrustInfo.class));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("委托单查询失败:" + record.getEntrustId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (entrustInfo == null) {
|
|
|
+ entrustInfo = new EntrustInfo();
|
|
|
+ }
|
|
|
+ if (baseInfoDTO != null && StringUtil.hasText(baseInfoDTO.getEntrustNo())) {
|
|
|
+ entrustInfo.setEntrustNo(baseInfoDTO.getEntrustNo());
|
|
|
+ }
|
|
|
+ TrialSampleInfo sampleInfo;
|
|
|
+ if (baseInfoDTO != null && baseInfoDTO.getTrialSampleInfo() != null) {
|
|
|
+ sampleInfo = baseInfoDTO.getTrialSampleInfo();
|
|
|
+ sampleId = sampleInfo.getId();
|
|
|
+ } else {
|
|
|
+ sampleId = entrustInfo.getSampleId();
|
|
|
+ String querySql1 = "select * from u_trial_sample_info where id=" + sampleId ;
|
|
|
+ try {
|
|
|
+ sampleInfo = jdbcTemplate.queryForObject(querySql1, new BeanPropertyRowMapper<>(TrialSampleInfo.class));
|
|
|
+ } catch (Exception e) {
|
|
|
+ sampleInfo = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ TrialMaterialMobilization trialMaterialMobilization = null;
|
|
|
+ if (sampleInfo != null) {
|
|
|
+ //用sampleId查询出关联的材料对象
|
|
|
+ String querySql2 = "select * from u_trial_material_mobilization where id =(select mobilization_id from u_trial_sampling_record where sample_info_id = "+sampleId+") ";
|
|
|
+ try {
|
|
|
+ trialMaterialMobilization = jdbcTemplate.queryForObject(querySql2, new BeanPropertyRowMapper<>(TrialMaterialMobilization.class));
|
|
|
+ } catch (DataAccessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //通过html获取页面上的key值 返回key值对应的数据
|
|
|
+ setBasicFormData(doc, reData, sampleInfo, trialMaterialMobilization, entrustInfo, false);
|
|
|
+ } else if(entrustId != null){
|
|
|
//有委托单信息是从实验报告关联委托单进来的 通过委托单查询到具体的样品id
|
|
|
String sql = "select * from u_entrust_info where id ="+entrustId;
|
|
|
EntrustInfo entrustInfo = jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<>(EntrustInfo.class));
|
|
@@ -2691,17 +2744,29 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
ContractInfo contractInfo = jdbcTemplate.query("select construction_unit_name,supervision_unit_name,contract_name,laboratory_name,is_test_record from m_contract_info where id = " + contractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
|
|
|
if (contractInfo != null) {
|
|
|
//承包单位
|
|
|
+ String constructionUnitName = "";
|
|
|
+ if (baseInfoDTO != null && ObjectUtils.isNotEmpty(baseInfoDTO.getConstructionUnit())) {
|
|
|
+ constructionUnitName = baseInfoDTO.getConstructionUnit();
|
|
|
+ } else if (ObjectUtils.isNotEmpty(contractInfo.getConstructionUnitName())) {
|
|
|
+ constructionUnitName = contractInfo.getConstructionUnitName();
|
|
|
+ }
|
|
|
if (cbdwBH.size() >= 1) {
|
|
|
for (Element element : cbdwBH) {
|
|
|
- reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getConstructionUnitName()) ? contractInfo.getConstructionUnitName() : "");
|
|
|
+ reData.put(element.attr("keyname"), constructionUnitName);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//监理单位
|
|
|
+ String supervisionUnitName = "";
|
|
|
+ if (baseInfoDTO != null && ObjectUtils.isNotEmpty(baseInfoDTO.getSupervisionUnit())) {
|
|
|
+ supervisionUnitName = baseInfoDTO.getSupervisionUnit();
|
|
|
+ } else if (ObjectUtils.isNotEmpty(contractInfo.getSupervisionUnitName())) {
|
|
|
+ supervisionUnitName = contractInfo.getSupervisionUnitName();
|
|
|
+ }
|
|
|
if (jldwBH.size() >= 1) {
|
|
|
for (Element element : jldwBH) {
|
|
|
- reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getSupervisionUnitName()) ? contractInfo.getSupervisionUnitName() : "");
|
|
|
+ reData.put(element.attr("keyname"), supervisionUnitName);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -2709,7 +2774,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
//施工单位
|
|
|
if (sgName.size() >= 1) {
|
|
|
for (Element element : sgName) {
|
|
|
- reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getConstructionUnitName()) ? contractInfo.getConstructionUnitName() : "");
|
|
|
+ reData.put(element.attr("keyname"), constructionUnitName);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -2717,23 +2782,35 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
//委托单位
|
|
|
if (wtName.size() >= 1) {
|
|
|
for (Element element : wtName) {
|
|
|
- reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getSupervisionUnitName()) ? contractInfo.getSupervisionUnitName() : "");
|
|
|
+ reData.put(element.attr("keyname"), supervisionUnitName);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//检测单位名称
|
|
|
if (jcdwName.size() >= 1) {
|
|
|
+ String laboratoryName = "";
|
|
|
+ if (baseInfoDTO != null && ObjectUtils.isNotEmpty(baseInfoDTO.getLabName())) {
|
|
|
+ laboratoryName = baseInfoDTO.getLabName();
|
|
|
+ } else if (ObjectUtils.isNotEmpty(contractInfo.getLaboratoryName())) {
|
|
|
+ laboratoryName = contractInfo.getLaboratoryName();
|
|
|
+ }
|
|
|
for (Element element : jcdwName) {
|
|
|
- reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getLaboratoryName()) ? contractInfo.getLaboratoryName() : "");
|
|
|
+ reData.put(element.attr("keyname"), laboratoryName);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//合同段/工区
|
|
|
if (htdName.size() >= 1) {
|
|
|
+ String contractName = "";
|
|
|
+ if (baseInfoDTO != null && ObjectUtils.isNotEmpty(baseInfoDTO.getContractName())) {
|
|
|
+ contractName = baseInfoDTO.getContractName();
|
|
|
+ } else if (ObjectUtils.isNotEmpty(contractInfo.getContractName())) {
|
|
|
+ contractName = contractInfo.getContractName();
|
|
|
+ }
|
|
|
for (Element element : htdName) {
|
|
|
- reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getContractName()) ? contractInfo.getContractName() : "");
|
|
|
+ reData.put(element.attr("keyname"), contractName);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -2742,14 +2819,18 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (projectInfo != null) {
|
|
|
//工程名称
|
|
|
if (gcName.size() >= 1) {
|
|
|
+ String projectName = "";
|
|
|
+ if (baseInfoDTO != null && ObjectUtils.isNotEmpty(baseInfoDTO.getProjectName())) {
|
|
|
+ projectName = baseInfoDTO.getProjectName();
|
|
|
+ } else if (ObjectUtils.isNotEmpty(projectInfo.getProjectName())) {
|
|
|
+ projectName = projectInfo.getProjectName();
|
|
|
+ }
|
|
|
for (Element element : gcName) {
|
|
|
- reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(projectInfo.getProjectName()) ? projectInfo.getProjectName() : "");
|
|
|
+ reData.put(element.attr("keyname"), projectName);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- TrialSelfInspectionRecord record = jdbcTemplate.query("select record_no,report_no from u_trial_self_inspection_record where id = " + groupId, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
|
|
|
if (record != null) {
|
|
|
//报告编号
|
|
|
if (bgBH.size() >= 1) {
|