@ -16,7 +16,6 @@ import com.xujie.sys.modules.sift.vo.QuerySavedVo;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Service ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Transactional ;
import org.springframework.transaction.annotation.Transactional ;
import java.util.* ;
import java.util.* ;
import java.util.function.Function ;
import java.util.function.Function ;
@ -30,6 +29,16 @@ import java.util.function.Function;
@Service
@Service
public class ProofingInformationServiceImpl implements ProofingInformationService {
public class ProofingInformationServiceImpl implements ProofingInformationService {
/ * *
* 工程试验申请单在 sys_oss 中的业务标识 ( 与 erf_exp_apply 附件查询一致 )
* /
private static final String ERF_OSS_MODULE = "ERF" ;
private static final String ERF_OSS_EXP_APPLY = "EXP_APPLY" ;
/ * *
* 打样文档与 getCopyDocumentFileList 等查询一致
* /
private static final String PROOF_OSS_REFTYPE = "项目文档" ;
@Autowired
@Autowired
private ProofingInformationMapper proofingInformationMapper ;
private ProofingInformationMapper proofingInformationMapper ;
@ -102,7 +111,11 @@ public class ProofingInformationServiceImpl implements ProofingInformationServic
boolean deleteSuccessful = true ;
boolean deleteSuccessful = true ;
/ / 根据Id拿到旧数据
/ / 根据Id拿到旧数据
ProofingInformationData proofingInformationData = proofingInformationMapper . selecProofingOne ( data . getProofingId ( ) ) ;
ProofingInformationData proofingInformationData = proofingInformationMapper . selecProofingOne ( data . getProofingId ( ) ) ;
if ( data . getType ( ) ! = 1 ) {
if ( Objects . equals ( data . getType ( ) , 1 ) ) {
copyErfExpApplyAttachmentsToProofDocument ( data ) ;
}
if ( ! Objects . equals ( data . getType ( ) , 1 ) ) {
/ / 如果有旧记录且项目分类不同 , 进行删除操作
/ / 如果有旧记录且项目分类不同 , 进行删除操作
if ( proofingInformationData ! = null & & ! proofingInformationData . getcProjectTypeDb ( ) . equals ( data . getcProjectTypeDb ( ) ) ) {
if ( proofingInformationData ! = null & & ! proofingInformationData . getcProjectTypeDb ( ) . equals ( data . getcProjectTypeDb ( ) ) ) {
try {
try {
@ -462,6 +475,75 @@ public class ProofingInformationServiceImpl implements ProofingInformationServic
return proofingInformationMapper . getCopyDocumentFileList ( data ) ;
return proofingInformationMapper . getCopyDocumentFileList ( data ) ;
}
}
/ * *
* 打样单号与工程试验申请单号一致时 , 将 erf_exp_apply 在 sys_oss 中的附件 ( order_ref1 = ERF , order_ref6 = EXP_APPLY )
* 复制到打样文档 「 试验申请单 + 三方签字 」 对应的文档清单行 。
* /
private void copyErfExpApplyAttachmentsToProofDocument ( ProofingInformationData data ) {
if ( data = = null ) {
return ;
}
String applyNo = data . getProofingNo ( ) ;
if ( applyNo = = null | | applyNo . trim ( ) . isEmpty ( ) ) {
return ;
}
applyNo = applyNo . trim ( ) ;
Integer proofingId = data . getProofingId ( ) ;
Integer projectId = data . getProjectId ( ) ;
Integer projectPartId = data . getProjectPartId ( ) ;
String site = data . getSite ( ) ;
if ( proofingId = = null | | projectId = = null | | projectPartId = = null | | site = = null | | site . isEmpty ( ) ) {
return ;
}
Integer docListId = proofingInformationMapper . selectDocumentListIdForErfProofCopy ( site , proofingId , projectId , projectPartId ) ;
if ( docListId = = null ) {
return ;
}
QueryWrapper < SysOssEntity > qw = new QueryWrapper < > ( ) ;
qw . eq ( "order_ref1" , ERF_OSS_MODULE ) . eq ( "order_ref2" , applyNo ) . eq ( "order_ref6" , ERF_OSS_EXP_APPLY ) ;
List < SysOssEntity > sources = sysOssService . list ( qw ) ;
if ( sources = = null | | sources . isEmpty ( ) ) {
return ;
}
String updateBy = data . getUpdateBy ( ) ! = null ? data . getUpdateBy ( ) : "" ;
String docDefIdStr = String . valueOf ( docListId ) ;
Date now = new Date ( ) ;
boolean first = true ;
for ( SysOssEntity src : sources ) {
if ( src = = null ) {
continue ;
}
SysOssEntity n = new SysOssEntity ( ) ;
n . setUrl ( src . getUrl ( ) ) ;
n . setNewFileName ( src . getNewFileName ( ) ) ;
n . setFileName ( src . getFileName ( ) ) ;
n . setFileType ( src . getFileType ( ) ) ;
n . setFileSuffix ( src . getFileSuffix ( ) ) ;
n . setFileTypeCode ( src . getFileTypeCode ( ) ) ;
n . setCreatedBy ( updateBy ) ;
n . setCreateDate ( now ) ;
n . setOrderRef1 ( site ) ;
n . setOrderRef2 ( String . valueOf ( proofingId ) ) ;
n . setOrderRef3 ( docDefIdStr ) ;
n . setOrderRef4 ( String . valueOf ( projectId ) ) ;
n . setOrderRef5 ( String . valueOf ( projectPartId ) ) ;
n . setOrderRef6 ( null ) ;
n . setOrderReftype ( PROOF_OSS_REFTYPE ) ;
n . setConclusion ( src . getConclusion ( ) ) ;
n . setCAdditionalInfo ( src . getCAdditionalInfo ( ) ) ;
n . setProjectIspush ( src . getProjectIspush ( ) ) ;
sysOssService . save ( n ) ;
if ( first ) {
ProofDocumentData pd = new ProofDocumentData ( ) ;
pd . setDocumentDefinitionListId ( docDefIdStr ) ;
pd . setUpdateBy ( updateBy ) ;
pd . setUpdateDate ( now ) ;
proofingInformationMapper . updateDocumentListForCopy ( pd ) ;
first = false ;
}
}
}
@Override
@Override
@Transactional ( rollbackFor = Exception . class )
@Transactional ( rollbackFor = Exception . class )
public void copyDocumentFileToDoc ( ProofDocumentData data ) {
public void copyDocumentFileToDoc ( ProofDocumentData data ) {