|
@@ -24,10 +24,7 @@ import org.springblade.business.service.ITrialSelfInspectionRecordService;
|
|
|
import org.springblade.business.utils.FileUtils;
|
|
|
import org.springblade.business.utils.FileUtils2;
|
|
|
import org.springblade.business.utils.StringSPUtils;
|
|
|
-import org.springblade.business.vo.SampleAncillaryDocumentsVO;
|
|
|
-import org.springblade.business.vo.TrialSampleInfoVO;
|
|
|
-import org.springblade.business.vo.TrialSelfInspectionRecordVO;
|
|
|
-import org.springblade.business.vo.TrialSelfInspectionRecordVO2;
|
|
|
+import org.springblade.business.vo.*;
|
|
|
import org.springblade.business.wrapper.TrialSelfInspectionRecordWarpper;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
@@ -40,6 +37,7 @@ import org.springblade.core.tool.utils.*;
|
|
|
import org.springblade.manager.entity.*;
|
|
|
import org.springblade.manager.feign.ContractClient;
|
|
|
import org.springblade.manager.feign.ExcelTabClient;
|
|
|
+import org.springblade.manager.feign.WbsTreeContractClient;
|
|
|
import org.springblade.manager.feign.WbsTreePrivateClient;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
import org.springblade.system.cache.ParamCache;
|
|
@@ -68,6 +66,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
private IUserClient iUserClient;
|
|
|
private ContractClient contractClient;
|
|
|
private WbsTreePrivateClient wbsTreePrivateClient;
|
|
|
+ private WbsTreeContractClient wbsTreeContractClient;
|
|
|
private ExcelTabClient excelTabClient;
|
|
|
private IDictClient iDictClient;
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
@@ -95,6 +94,9 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
IPage<TrialSelfInspectionRecordVO> trialSelfInspectionRecordVOIPage = TrialSelfInspectionRecordWarpper.build().pageVO(pages);
|
|
|
List<TrialSelfInspectionRecordVO> records = trialSelfInspectionRecordVOIPage.getRecords();
|
|
|
List<Dict> trialDetectionCategory = iDictClient.getList("trial_detection_category").getData();
|
|
|
+
|
|
|
+ List<WbsTreeContract> contractTreeList = wbsTreeContractClient.getContractWbsTreeByContractId(dto.getContractId());
|
|
|
+
|
|
|
for (TrialSelfInspectionRecordVO record : records) {
|
|
|
for (Dict dict : trialDetectionCategory) {
|
|
|
if (dict.getDictKey().equals(String.valueOf(record.getDetectionCategory()))) {
|
|
@@ -103,7 +105,18 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
}
|
|
|
record.setIsUploadCertificateName(record.getIsUploadCertificate().equals(1) ? "是" : "否");
|
|
|
record.setDetectionResultName(record.getDetectionResult().equals(1) ? "合格" : "不合格");
|
|
|
- //record.setProjectPositionName(); TODO 工程部位及用途名称
|
|
|
+
|
|
|
+ //工程部位及用途名称
|
|
|
+ if (contractTreeList.size() > 0) {
|
|
|
+ List<String> projectPositionNames = new ArrayList<>();
|
|
|
+ for (WbsTreeContract wbsTreeContract : contractTreeList) {
|
|
|
+ if (String.valueOf(wbsTreeContract.getPKeyId()).contains(record.getProjectPosition())) {
|
|
|
+ projectPositionNames.add(wbsTreeContract.getNodeName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String name = projectPositionNames.stream().findAny().orElse(null);
|
|
|
+ record.setProjectPositionName(name + "等" + projectPositionNames.size() + "个工程部位信息");
|
|
|
+ }
|
|
|
}
|
|
|
return trialSelfInspectionRecordVOIPage.setRecords(records);
|
|
|
}
|
|
@@ -293,6 +306,60 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void updateTrialSelfInspectionRecordStatus(List<TaskApprovalVO> obj) throws FileNotFoundException {
|
|
|
+ for (TaskApprovalVO taskApprovalVO : obj) {
|
|
|
+ if (ObjectUtil.isNotEmpty(taskApprovalVO.getParallelProcessInstanceId())) {
|
|
|
+ String trialSelfInspectionRecordId = baseMapper.selectTaskByTaskId(taskApprovalVO.getParallelProcessInstanceId());
|
|
|
+ if (StringUtils.isNotEmpty(trialSelfInspectionRecordId)) {
|
|
|
+ LambdaUpdateWrapper<TrialSelfInspectionRecord> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.set(TrialSelfInspectionRecord::getTaskStatus, "OK".equals(taskApprovalVO.getFlag()) ? "已审批" : "已废除");
|
|
|
+ updateWrapper.eq(TrialSelfInspectionRecord::getId, trialSelfInspectionRecordId);
|
|
|
+ baseMapper.update(null, updateWrapper);
|
|
|
+
|
|
|
+ TrialSelfInspectionRecord entity = updateWrapper.getEntity();
|
|
|
+
|
|
|
+ //把当前试验的PDF合并关联到质检树节点下
|
|
|
+ if (ObjectUtil.isNotEmpty(entity) && ("已审批").equals(entity.getTaskStatus())) {
|
|
|
+ List<String> contractNodePKeyIds = baseMapper.selectQualityNodeId(trialSelfInspectionRecordId);
|
|
|
+
|
|
|
+ for (String id : contractNodePKeyIds) {
|
|
|
+ WbsTreeContract wbsTreeContract = wbsTreeContractClient.getContractNodeByPrimaryKeyId(id);
|
|
|
+ if (wbsTreeContract != null) {
|
|
|
+ List<String> pdfUrlList = new ArrayList<>();
|
|
|
+ String classify;
|
|
|
+ if (wbsTreeContract.getTableOwner().contains("1") || wbsTreeContract.getTableOwner().contains("2") || wbsTreeContract.getTableOwner().contains("3")) {
|
|
|
+ classify = "1";
|
|
|
+ } else {
|
|
|
+ classify = "2";
|
|
|
+ }
|
|
|
+ String pdfUrlAll = baseMapper.selectInformationQuery(id, wbsTreeContract.getContractId(), classify);
|
|
|
+ //质检节点合并pdfUrl
|
|
|
+ pdfUrlList.add(pdfUrlAll);
|
|
|
+ //试验pdfUrl
|
|
|
+ pdfUrlList.add(ObjectUtil.isNotEmpty(entity.getPdfUrl()) ? entity.getPdfUrl() : "");
|
|
|
+
|
|
|
+ //合并PDF
|
|
|
+ String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ String listPdf = filePath + "/pdf/" + id + ".pdf";
|
|
|
+ File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
+ if (tabPDF.exists()) {
|
|
|
+ tabPDF.delete();
|
|
|
+ }
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfUrlList, listPdf);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(id + ".pdf", listPdf);
|
|
|
+ if (bladeFile != null) {
|
|
|
+ //修改质检合并pdfURL
|
|
|
+ baseMapper.updateInformationQuery(id, wbsTreeContract.getContractId(), classify, bladeFile.getLink());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private String getTrialPdfUrl(WbsTreePrivate wbsTreePrivate) throws Exception {
|
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
if (wbsTreePrivate == null) {
|
|
@@ -361,9 +428,14 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean selfSubmit(TrialSelfInspectionRecordDTO dto) throws Exception {
|
|
|
- if (ObjectUtil.isEmpty(dto.getId())) { //构建记录表编号、报告单编号
|
|
|
+ if (ObjectUtil.isEmpty(dto.getId())) {
|
|
|
+ //构建记录表编号、报告单编号
|
|
|
this.buildNumber(dto);
|
|
|
+
|
|
|
+ //任务流程状态初始化
|
|
|
+ dto.setTaskStatus("待审批");
|
|
|
}
|
|
|
+
|
|
|
JSONArray dataArray = dto.getDataInfo().getJSONArray("orderList");
|
|
|
List<String> tableIds = new ArrayList<>();
|
|
|
for (int i = 0; i < dataArray.size(); i++) {
|
|
@@ -373,18 +445,70 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
String tableIdsAll = Func.toStr(tableIds).replaceAll("\\[", "").replaceAll("]", "");
|
|
|
dto.setTableIds(tableIdsAll);
|
|
|
|
|
|
- this.saveOrUpdate(dto); //新增或修改
|
|
|
+ //新增或修改
|
|
|
+ this.saveOrUpdate(dto);
|
|
|
|
|
|
- if (ObjectUtil.isNotEmpty(dto.getId())) { //关联样品
|
|
|
- List<String> ids = Func.toStrList(dto.getSampleIds());
|
|
|
- baseMapper.delSelfSample(dto.getId()); //删除关联信息
|
|
|
- for (String id : ids) { //新增关联信息
|
|
|
- baseMapper.saveSelfSample(SnowFlakeUtil.getId(), dto.getId(), id);
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getId())) {
|
|
|
+ //关联样品信息
|
|
|
+ if (StringUtils.isNotEmpty(dto.getSampleIds())) {
|
|
|
+ baseMapper.delSelfSample(dto.getId()); //删除关联信息
|
|
|
+ List<String> ids = Func.toStrList(dto.getSampleIds());
|
|
|
+ for (String id : ids) { //新增关联信息
|
|
|
+ baseMapper.saveSelfSample(SnowFlakeUtil.getId(), dto.getId(), id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //关联工程部位及用途信息
|
|
|
+ if (StringUtils.isNotEmpty(dto.getProjectPosition())) {
|
|
|
+ baseMapper.delSelfQuality(dto.getId()); //删除关联信息
|
|
|
+ List<String> ids = Func.toStrList(dto.getProjectPosition());
|
|
|
+ for (String id : ids) { //新增关联信息
|
|
|
+ baseMapper.saveSelfQuality(SnowFlakeUtil.getId(), dto.getId(), id);
|
|
|
+ }
|
|
|
+
|
|
|
+ //已审批填报记录
|
|
|
+ if (("已审批").equals(dto.getTaskStatus())) {
|
|
|
+ //把当前试验的PDF合并关联到质检树节点下
|
|
|
+ List<String> contractNodePKeyIds = baseMapper.selectQualityNodeId(String.valueOf(dto.getId()));
|
|
|
+
|
|
|
+ for (String id : contractNodePKeyIds) {
|
|
|
+ WbsTreeContract wbsTreeContract = wbsTreeContractClient.getContractNodeByPrimaryKeyId(id);
|
|
|
+ if (wbsTreeContract != null) {
|
|
|
+ List<String> pdfUrlList = new ArrayList<>();
|
|
|
+ String classify;
|
|
|
+ if (wbsTreeContract.getTableOwner().contains("1") || wbsTreeContract.getTableOwner().contains("2") || wbsTreeContract.getTableOwner().contains("3")) {
|
|
|
+ classify = "1";
|
|
|
+ } else {
|
|
|
+ classify = "2";
|
|
|
+ }
|
|
|
+ String pdfUrlAll = baseMapper.selectInformationQuery(id, wbsTreeContract.getContractId(), classify);
|
|
|
+ //质检节点合并pdfUrl
|
|
|
+ pdfUrlList.add(pdfUrlAll);
|
|
|
+ //试验pdfUrl
|
|
|
+ pdfUrlList.add(ObjectUtil.isNotEmpty(dto.getPdfUrl()) ? dto.getPdfUrl() : "");
|
|
|
+
|
|
|
+ //合并PDF
|
|
|
+ String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ String listPdf = filePath + "/pdf/" + id + ".pdf";
|
|
|
+ File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
+ if (tabPDF.exists()) {
|
|
|
+ tabPDF.delete();
|
|
|
+ }
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfUrlList, listPdf);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(id + ".pdf", listPdf);
|
|
|
+ if (bladeFile != null) {
|
|
|
+ //修改质检合并pdfURL
|
|
|
+ baseMapper.updateInformationQuery(id, wbsTreeContract.getContractId(), classify, bladeFile.getLink());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//保存实体表数据、记录信息
|
|
|
String pdfURL = excelTabClient.saveTabData(dto.getDataInfo(), dto.getType(), dto.getTableType(), dto.getId());
|
|
|
+ //返回合并pdfURL
|
|
|
if (StringUtils.isNotEmpty(pdfURL)) {
|
|
|
LambdaUpdateWrapper<TrialSelfInspectionRecord> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.set(TrialSelfInspectionRecord::getPdfUrl, pdfURL);
|