Kaynağa Gözat

合同拉取

wangyf 3 gün önce
ebeveyn
işleme
b7f095138e

+ 66 - 9
src/main/java/com/sunxung/factoring/service/financing/payment/impl/PaymentApplyServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -32,8 +33,7 @@ import com.sunxung.factoring.entity.financing.payment.*;
 import com.sunxung.factoring.entity.financing.review.*;
 import com.sunxung.factoring.entity.financing.sop.*;
 import com.sunxung.factoring.entity.project.ProjectInformation;
-import com.sunxung.factoring.entity.purchcontractmanagement.PurchContractBasicInfo;
-import com.sunxung.factoring.entity.purchcontractmanagement.PurchContractManagement;
+import com.sunxung.factoring.entity.purchcontractmanagement.*;
 import com.sunxung.factoring.entity.salescontractmanagement.CSalesContract;
 import com.sunxung.factoring.entity.salescontractmanagement.CSalesContractBasicInfo;
 import com.sunxung.factoring.entity.salescontractmanagement.CSalesSignConfirmation;
@@ -63,8 +63,7 @@ import com.sunxung.factoring.service.financing.review.*;
 import com.sunxung.factoring.service.loanmanagement.IExemptionMattersService;
 import com.sunxung.factoring.service.project.BusinessAssigneeService;
 import com.sunxung.factoring.service.project.IProjectInformationService;
-import com.sunxung.factoring.service.purchcontractmanagement.PurchContractBasicInfoService;
-import com.sunxung.factoring.service.purchcontractmanagement.PurchContractService;
+import com.sunxung.factoring.service.purchcontractmanagement.*;
 import com.sunxung.factoring.service.salescontractmanagement.ICSalesContractBasicInfoService;
 import com.sunxung.factoring.service.salescontractmanagement.ICSalesSignConfirmationElectronicInfoService;
 import com.sunxung.factoring.service.salescontractmanagement.ICSalesSignConfirmationService;
@@ -242,6 +241,12 @@ public class PaymentApplyServiceImpl extends ServiceImpl<PaymentApplyMapper, Pay
     private IProjectInformationService projectInformationService;
     @Autowired
     private ICreditResolutionService creditResolutionService;
+    @Autowired
+    private PurchContractApprovalService purchContractApprovalService;
+    @Autowired
+    private IPurchContractSupplementInfoService purchContractSupplementInfoService;
+    @Autowired
+    IPurchContractSupplementApprovalService supplementApprovalService;
 
     @Override
     public PaymentApply getToEditPageById(Long id) {
@@ -655,13 +660,65 @@ public class PaymentApplyServiceImpl extends ServiceImpl<PaymentApplyMapper, Pay
         PurchContractManagement purchContractManagement = purchContractService
                 .getOne(new QueryWrapper<PurchContractManagement>().eq("business_number", businessNo)
                 );
-        PurchContractBasicInfo purchContractBasicInfo = purchContractBasicInfoService.lambdaQuery().eq(PurchContractBasicInfo::getPurchContractManagementId, purchContractManagement.getId()).one();
+        
+        List<FileStorage> purchaseContractFileList;
+        if (purchContractManagement != null) {
+            PurchContractBasicInfo purchContractBasicInfo = purchContractBasicInfoService.lambdaQuery().eq(PurchContractBasicInfo::getPurchContractManagementId, purchContractManagement.getId()).one();
+
+            PurchContractApproval purchContractApproval = purchContractApprovalService.getOne(
+                    new LambdaQueryWrapper<PurchContractApproval>()
+                            .eq(PurchContractApproval::getPurchContractBasicInfoId, purchContractBasicInfo.getId())
+                            .orderByDesc(PurchContractApproval::getGmtCreate).last("LIMIT 1"));
+            if (purchContractApproval.getSignMode() != null && purchContractApproval.getSignMode() == 1){
+                purchaseContractFileList = sysAttachmentRefService.getFiles(AttachmentDto.builder()
+                        .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_SIGN_FILE)
+                        .setEntityId(purchContractBasicInfo.getId()).build());
+
+            }else {
+                //采购合同线下签署文件
+                purchaseContractFileList = sysAttachmentRefService.getFiles(AttachmentDto.builder()
+                        .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_OFFLINE_SIGN_FILE)
+                        .setEntityId(purchContractApproval.getId()).build());
+            }
 
-        List<FileStorage> purchaseContract = sysAttachmentRefService.getFiles(AttachmentDto.builder()
-                .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_SIGN_FILE)
-                .setEntityId(purchContractBasicInfo.getId()).build());
+            //采购合同补充合同
+            List<PurchContractSupplementInfo> contractSupplementInfos = purchContractSupplementInfoService
+                    .list(new QueryWrapper<PurchContractSupplementInfo>().eq("c_purch_contract_management_id", purchContractManagement.getId()));
+            //采购合同状态
+            if (purchContractManagement.getContractStatus().equals(ProjectInitiationStatusDict.ChildEnum.COMPLETED.getCode())) {
+                if (com.sunxung.factoring.component.util.CollectionUtil.isNotEmpty(contractSupplementInfos)) {
+                    for (PurchContractSupplementInfo contractSupplementInfo : contractSupplementInfos) {
+                        PurchContractSupplementApproval purchContractSupplementApproval = supplementApprovalService.lambdaQuery()
+                                .eq(PurchContractSupplementApproval::getPurchContractSupplementInfoId, contractSupplementInfo.getId())
+                                .orderByDesc(PurchContractSupplementApproval::getGmtCreate)
+                                .last("LIMIT 1")
+                                .one();
+                        if (purchContractSupplementApproval.getSignMode() != null && purchContractSupplementApproval.getSignMode() == 1){
+                            //采购合同变更已签署文件
+                            AttachmentDto attachmentDto = AttachmentDto.builder()
+                                    .setEntityId(contractSupplementInfo.getId())
+                                    .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_SUPPLEMENT_SIGN_FILE).build();
+                            //只有一个文件
+                            List<FileStorage> files = sysAttachmentRefService.getFiles(attachmentDto);
+                            purchaseContractFileList.addAll(files);
+
+                        }else {
+                            AttachmentDto attachmentDto = AttachmentDto.builder()
+                                    .setEntityId(purchContractSupplementApproval.getId())
+                                    .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_SUPPLEMENT_OFFLINE_SIGN_FILE)
+                                    .build();
+                            //只有一个文件
+                            List<FileStorage> files = sysAttachmentRefService.getFiles(attachmentDto);
+                            purchaseContractFileList.addAll(files);
+                        }
+                    }
+                }
+            }
+        } else {
+            purchaseContractFileList = Collections.emptyList();
+        }
 
-        return purchaseContract;
+        return purchaseContractFileList;
     }
 
     @Override

+ 41 - 6
src/main/java/com/sunxung/factoring/service/financing/payment/impl/PaymentApprovalServiceImpl.java

@@ -9,13 +9,12 @@ import com.sunxung.factoring.component.exception.ValidatorException;
 import com.sunxung.factoring.component.util.CodeUtil;
 import com.sunxung.factoring.component.util.ConstantUtil;
 import com.sunxung.factoring.dict.impl.FileModuleDict;
+import com.sunxung.factoring.dict.impl.ProjectInitiationStatusDict;
 import com.sunxung.factoring.entity.financing.apply.CFinancingBasicInfo;
 import com.sunxung.factoring.entity.financing.apply.CFinancingGoodsInfo;
 import com.sunxung.factoring.entity.financing.payment.*;
 import com.sunxung.factoring.entity.financing.review.ReviewFinancingInfo;
-import com.sunxung.factoring.entity.purchcontractmanagement.PurchContractApproval;
-import com.sunxung.factoring.entity.purchcontractmanagement.PurchContractBasicInfo;
-import com.sunxung.factoring.entity.purchcontractmanagement.PurchContractManagement;
+import com.sunxung.factoring.entity.purchcontractmanagement.*;
 import com.sunxung.factoring.entity.salescontractmanagement.CSalesContract;
 import com.sunxung.factoring.entity.salescontractmanagement.CSalesContractBasicInfo;
 import com.sunxung.factoring.entity.salescontractmanagement.CSalesSignConfirmation;
@@ -27,9 +26,7 @@ import com.sunxung.factoring.service.financing.apply.ICFinancingBasicInfoService
 import com.sunxung.factoring.service.financing.apply.ICFinancingGoodsInfoService;
 import com.sunxung.factoring.service.financing.payment.*;
 import com.sunxung.factoring.service.financing.review.ReviewFinancingInfoService;
-import com.sunxung.factoring.service.purchcontractmanagement.PurchContractApprovalService;
-import com.sunxung.factoring.service.purchcontractmanagement.PurchContractBasicInfoService;
-import com.sunxung.factoring.service.purchcontractmanagement.PurchContractService;
+import com.sunxung.factoring.service.purchcontractmanagement.*;
 import com.sunxung.factoring.service.salescontractmanagement.ICSalesContractBasicInfoService;
 import com.sunxung.factoring.service.salescontractmanagement.ICSalesSignConfirmationElectronicInfoService;
 import com.sunxung.factoring.service.salescontractmanagement.ICSalesSignConfirmationService;
@@ -95,6 +92,10 @@ public class PaymentApprovalServiceImpl extends ServiceImpl<PaymentApprovalMappe
     private ICFinancingGoodsInfoService financingGoodsInfoService;
     @Autowired
     private PurchContractApprovalService purchContractApprovalService;
+    @Autowired
+    private IPurchContractSupplementInfoService purchContractSupplementInfoService;
+    @Autowired
+    IPurchContractSupplementApprovalService supplementApprovalService;
 
     @Override
     public PaymentApproval getView(Long id) {
@@ -260,6 +261,40 @@ public class PaymentApprovalServiceImpl extends ServiceImpl<PaymentApprovalMappe
                     .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_SUPPLEMENT_OFFLINE_SIGN_FILE)
                     .setEntityId(purchContractApproval.getId()).build());
         }
+
+        //采购合同补充合同
+        List<PurchContractSupplementInfo> contractSupplementInfos = purchContractSupplementInfoService
+                .list(new QueryWrapper<PurchContractSupplementInfo>().eq("c_purch_contract_management_id", purchContractManagement.getId()));
+        //采购合同状态
+        if (purchContractManagement.getContractStatus().equals(ProjectInitiationStatusDict.ChildEnum.COMPLETED.getCode())) {
+            if (com.sunxung.factoring.component.util.CollectionUtil.isNotEmpty(contractSupplementInfos)) {
+                for (PurchContractSupplementInfo contractSupplementInfo : contractSupplementInfos) {
+                    PurchContractSupplementApproval purchContractSupplementApproval = supplementApprovalService.lambdaQuery()
+                            .eq(PurchContractSupplementApproval::getPurchContractSupplementInfoId, contractSupplementInfo.getId())
+                            .orderByDesc(PurchContractSupplementApproval::getGmtCreate)
+                            .last("LIMIT 1")
+                            .one();
+                    if (purchContractSupplementApproval.getSignMode() != null && purchContractSupplementApproval.getSignMode() == 1){
+                        //采购合同变更已签署文件
+                        AttachmentDto attachmentDto = AttachmentDto.builder()
+                                .setEntityId(contractSupplementInfo.getId())
+                                .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_SUPPLEMENT_SIGN_FILE).build();
+                        //只有一个文件
+                        List<FileStorage> files = sysAttachmentRefService.getFiles(attachmentDto);
+                        purchaseContract.addAll(files);
+
+                    }else {
+                        AttachmentDto attachmentDto = AttachmentDto.builder()
+                                .setEntityId(purchContractSupplementApproval.getId())
+                                .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_SUPPLEMENT_OFFLINE_SIGN_FILE)
+                                .build();
+                        //只有一个文件
+                        List<FileStorage> files = sysAttachmentRefService.getFiles(attachmentDto);
+                        purchaseContract.addAll(files);
+                    }
+                }
+            }
+        }
         return purchaseContract;
     }
 

+ 42 - 6
src/main/java/com/sunxung/factoring/service/fundmanagement/impl/FinancialInstitutionServiceImpl.java

@@ -33,9 +33,7 @@ import com.sunxung.factoring.entity.invoicemanage.InvoiceGoodsInfo;
 import com.sunxung.factoring.entity.invoicemanage.SalesInvoiceInfo;
 import com.sunxung.factoring.entity.project.BusinessAssignee;
 import com.sunxung.factoring.entity.project.BusinessProcessingLog;
-import com.sunxung.factoring.entity.purchcontractmanagement.PurchContractApproval;
-import com.sunxung.factoring.entity.purchcontractmanagement.PurchContractBasicInfo;
-import com.sunxung.factoring.entity.purchcontractmanagement.PurchContractManagement;
+import com.sunxung.factoring.entity.purchcontractmanagement.*;
 import com.sunxung.factoring.entity.salescontractmanagement.CSalesContract;
 import com.sunxung.factoring.entity.salescontractmanagement.CSalesContractBasicInfo;
 import com.sunxung.factoring.entity.salescontractmanagement.CSalesSignConfirmation;
@@ -59,9 +57,7 @@ import com.sunxung.factoring.service.invoicemanage.SalesInvoiceInfoService;
 import com.sunxung.factoring.service.project.BusinessAssigneeService;
 import com.sunxung.factoring.service.project.BusinessProcessingLogService;
 import com.sunxung.factoring.service.project.BusinessProcessingTaskService;
-import com.sunxung.factoring.service.purchcontractmanagement.PurchContractApprovalService;
-import com.sunxung.factoring.service.purchcontractmanagement.PurchContractBasicInfoService;
-import com.sunxung.factoring.service.purchcontractmanagement.PurchContractService;
+import com.sunxung.factoring.service.purchcontractmanagement.*;
 import com.sunxung.factoring.service.salescontractmanagement.*;
 import com.sunxung.factoring.service.settlement.SettlementGoodsInfoService;
 import com.sunxung.factoring.service.supplier.ISupplierInfoService;
@@ -238,6 +234,12 @@ public class FinancialInstitutionServiceImpl extends ServiceImpl<FinancialInstit
     @Autowired
     private PurchContractApprovalService purchContractApprovalService;
 
+    @Autowired
+    private IPurchContractSupplementInfoService purchContractSupplementInfoService;
+
+    @Autowired
+    IPurchContractSupplementApprovalService supplementApprovalService;
+
     @Override
     public GridPage<FinancialInstitutionInfo> findBySearch(SeachUser search) {
 
@@ -767,6 +769,40 @@ public class FinancialInstitutionServiceImpl extends ServiceImpl<FinancialInstit
                                 .setEntityId(purchContractApproval.getId()).build());
                     }
 
+                    //采购合同补充合同
+                    List<PurchContractSupplementInfo> contractSupplementInfos = purchContractSupplementInfoService
+                            .list(new QueryWrapper<PurchContractSupplementInfo>().eq("c_purch_contract_management_id", purchContractManagement.getId()));
+                    //采购合同状态
+                    if (purchContractManagement.getContractStatus().equals(ProjectInitiationStatusDict.ChildEnum.COMPLETED.getCode())) {
+                        if (com.sunxung.factoring.component.util.CollectionUtil.isNotEmpty(contractSupplementInfos)) {
+                            for (PurchContractSupplementInfo contractSupplementInfo : contractSupplementInfos) {
+                                PurchContractSupplementApproval purchContractSupplementApproval = supplementApprovalService.lambdaQuery()
+                                        .eq(PurchContractSupplementApproval::getPurchContractSupplementInfoId, contractSupplementInfo.getId())
+                                        .orderByDesc(PurchContractSupplementApproval::getGmtCreate)
+                                        .last("LIMIT 1")
+                                        .one();
+                                if (purchContractSupplementApproval.getSignMode() != null && purchContractSupplementApproval.getSignMode() == 1){
+                                    //采购合同变更已签署文件
+                                    AttachmentDto attachmentDto = AttachmentDto.builder()
+                                            .setEntityId(contractSupplementInfo.getId())
+                                            .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_SUPPLEMENT_SIGN_FILE).build();
+                                    //只有一个文件
+                                    List<FileStorage> files = sysAttachmentRefService.getFiles(attachmentDto);
+                                    purchaseContractFileList.addAll(files);
+
+                                }else {
+                                    AttachmentDto attachmentDto = AttachmentDto.builder()
+                                            .setEntityId(purchContractSupplementApproval.getId())
+                                            .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_SUPPLEMENT_OFFLINE_SIGN_FILE)
+                                            .build();
+                                    //只有一个文件
+                                    List<FileStorage> files = sysAttachmentRefService.getFiles(attachmentDto);
+                                    purchaseContractFileList.addAll(files);
+                                }
+                            }
+                        }
+                    }
+
                     if (CollectionUtil.isNotEmpty(purchaseContractFileList)) {
                         purchaseContractFileList.stream().forEach(p -> {
                             sysAttachmentRefService.copyFile(p, FileModuleDict.ChildEnum.FINANCIAL_EXPENDITURE_UPSTREAM_PURCH_FILE,