|
@@ -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
|