|
@@ -3,7 +3,6 @@ package com.sunxung.factoring.service.acceptancesheet.impl;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.deepoove.poi.data.*;
|
|
|
import com.deepoove.poi.data.style.BorderStyle;
|
|
@@ -20,7 +19,6 @@ import com.sunxung.factoring.entity.acceptance.*;
|
|
|
import com.sunxung.factoring.entity.acceptance.vo.GoodsSearch;
|
|
|
import com.sunxung.factoring.entity.entprise.Enterprise;
|
|
|
import com.sunxung.factoring.entity.project.BusinessProcessingLog;
|
|
|
-import com.sunxung.factoring.entity.project.ProjectCoreEnterprise;
|
|
|
import com.sunxung.factoring.entity.project.ProjectInformation;
|
|
|
import com.sunxung.factoring.entity.project.vo.BusinessProcessingTaskVo;
|
|
|
import com.sunxung.factoring.entity.project.vo.SearchBusinessProcessingTask;
|
|
@@ -29,7 +27,6 @@ import com.sunxung.factoring.entity.salescontractmanagement.*;
|
|
|
import com.sunxung.factoring.entity.settlement.SettlementBasicInfo;
|
|
|
import com.sunxung.factoring.entity.settlement.SettlementGoodsInfo;
|
|
|
import com.sunxung.factoring.entity.steelwaiter.SearchVo;
|
|
|
-import com.sunxung.factoring.entity.supplier.SupplierInfo;
|
|
|
import com.sunxung.factoring.entity.sys.Dictionary;
|
|
|
import com.sunxung.factoring.entity.sys.FileStorage;
|
|
|
import com.sunxung.factoring.entity.sys.FileStorageDO;
|
|
@@ -148,6 +145,9 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
@Autowired
|
|
|
private ISalesContractSupplementInfoService salesContractSupplementInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICSalesContractSupplementBasicInfoService salesContractSupplementBasicInfoService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IPurchContractSupplementInfoService purchContractSupplementInfoService;
|
|
|
|
|
@@ -225,11 +225,11 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
AcceptanceBasicInfo acceptanceBasicInfo = this.baseMapper.getSpecialOneById(id);
|
|
|
|
|
|
List<FileStorageDO> files1 = fileService.findByBusinessId(id,
|
|
|
- FileModuleDict.ChildEnum.ACCEPTANCE_FILE.getCode());
|
|
|
+ FileModuleDict.ChildEnum.ACCEPTANCE_FILE.getCode());
|
|
|
List<FileStorageDO> files2 = fileService.findByBusinessId(id,
|
|
|
- FileModuleDict.ChildEnum.ACCEPTANCE_SUPPLEMENT_FILE.getCode());
|
|
|
+ FileModuleDict.ChildEnum.ACCEPTANCE_SUPPLEMENT_FILE.getCode());
|
|
|
List<FileStorageDO> files3 = fileService.findByBusinessId(id,
|
|
|
- FileModuleDict.ChildEnum.ACCEPTANCE_UPSTREAM_FILE.getCode());
|
|
|
+ FileModuleDict.ChildEnum.ACCEPTANCE_UPSTREAM_FILE.getCode());
|
|
|
|
|
|
|
|
|
List<FileStorage> signConfirmFiles = Lists.newArrayList();
|
|
@@ -237,11 +237,11 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
AcceptanceSignConfirmation acceptanceSignConfirmation = acceptanceSignConfirmationService.lambdaQuery().eq(AcceptanceSignConfirmation::getAcceptanceBasicInfoId, id).one();
|
|
|
if (acceptanceSignConfirmation != null) {
|
|
|
List<AcceptanceSignConfirmationElectronicInfo> acceptanceSignConfirmationElectronicInfos = acceptanceSignConfirmationElectronicInfoService.lambdaQuery()
|
|
|
- .eq(AcceptanceSignConfirmationElectronicInfo::getAcceptanceSignConfirmationId, acceptanceSignConfirmation.getId())
|
|
|
- .eq(AcceptanceSignConfirmationElectronicInfo::getCallBack,1)
|
|
|
- .list();
|
|
|
- if(CollectionUtil.isNotEmpty(acceptanceSignConfirmationElectronicInfos)){
|
|
|
- acceptanceSignConfirmationElectronicInfos.forEach(x->{
|
|
|
+ .eq(AcceptanceSignConfirmationElectronicInfo::getAcceptanceSignConfirmationId, acceptanceSignConfirmation.getId())
|
|
|
+ .eq(AcceptanceSignConfirmationElectronicInfo::getCallBack, 1)
|
|
|
+ .list();
|
|
|
+ if (CollectionUtil.isNotEmpty(acceptanceSignConfirmationElectronicInfos)) {
|
|
|
+ acceptanceSignConfirmationElectronicInfos.forEach(x -> {
|
|
|
// List<FileStorage> files = fileStorageService.findByBelongIdAndBelongType(
|
|
|
// x.getContractId(),
|
|
|
// FileModuleDict.ChildEnum.ACCEPTANCE_SIGN_CONFIRM_BACK_FILE.getCode());
|
|
@@ -250,11 +250,11 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
// }
|
|
|
//获取已签署文件
|
|
|
AttachmentDto attachmentDto = AttachmentDto.builder()
|
|
|
- .setEntityId(x.getId())
|
|
|
- .setChildEnum(FileModuleDict.ChildEnum.ACCEPTANCE_SIGN_CONFIRM_BACK_FILE)
|
|
|
- .build();
|
|
|
+ .setEntityId(x.getId())
|
|
|
+ .setChildEnum(FileModuleDict.ChildEnum.ACCEPTANCE_SIGN_CONFIRM_BACK_FILE)
|
|
|
+ .build();
|
|
|
List<FileStorage> files = attachmentRefService.getFiles(attachmentDto);
|
|
|
- if(CollectionUtil.isNotEmpty(files)){
|
|
|
+ if (CollectionUtil.isNotEmpty(files)) {
|
|
|
signConfirmFiles.addAll(files);
|
|
|
}
|
|
|
});
|
|
@@ -284,86 +284,13 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
// List<FileStorageDO> files5 = fileService.findByBusinessId(
|
|
|
// purchContractBasicInfo.getId(), FileModuleDict.ChildEnum.PURCHASE_CONTRACT_FILE.getCode());
|
|
|
|
|
|
-
|
|
|
- //销售合同 文件
|
|
|
- List<FileStorage> salesContract = new ArrayList<>();
|
|
|
- CSalesContract salesContractManagement = salesContractService.getByBusinessNumber(acceptanceBasicInfo.getBusinessNumber());
|
|
|
- CSalesContractBasicInfo salesContractBasicInfo = salesContractBasicInfoService
|
|
|
- .getOne(new QueryWrapper<CSalesContractBasicInfo>().eq("c_sales_contract_management_id",salesContractManagement.getId()));
|
|
|
- CSalesSignConfirmation salesSignConfirmation = salesSignConfirmationService
|
|
|
- .lambdaQuery().eq(CSalesSignConfirmation::getcSalesContractManagementId, salesContractManagement.getId()).one();
|
|
|
- if(salesSignConfirmation!=null){
|
|
|
- List<CSalesSignConfirmationElectronicInfo> signElectronicInfos = signConfirmationElectronicInfoService
|
|
|
- .list(new QueryWrapper<CSalesSignConfirmationElectronicInfo>().eq("c_sales_sign_confirmation_id", salesSignConfirmation.getId()));
|
|
|
- if (CollectionUtil.isNotEmpty(signElectronicInfos)){
|
|
|
- signElectronicInfos.forEach(signElectronicInfo->{
|
|
|
- salesContract.addAll(sysAttachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
- .setChildEnum(FileModuleDict.ChildEnum.SIGN_CONFIRM_BACK_FILE).setEntityId(signElectronicInfo.getId()).build()));
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- //销售合同补充文件
|
|
|
- List<CSalesContractSupplementInfo> salesContractSupplementInfos = salesContractSupplementInfoService
|
|
|
- .list(new QueryWrapper<CSalesContractSupplementInfo>().eq("c_sales_contract_management_id", salesContractManagement.getId()));
|
|
|
- if (CollectionUtil.isNotEmpty(salesContractSupplementInfos)) {
|
|
|
- salesContractSupplementInfos.stream().forEach(s -> {
|
|
|
- if (salesContractManagement.getContractStatus().equals(ProjectInitiationStatusDict.ChildEnum.COMPLETED.getCode())) {
|
|
|
-
|
|
|
- CSalesSupplementSignConfirmation salesSupplementSignConfirmation = salesSupplementSignConfirmationService
|
|
|
- .lambdaQuery().eq(CSalesSupplementSignConfirmation::getcSalesContractSupplementInfoId, s.getId()).one();
|
|
|
- if(salesSupplementSignConfirmation!=null){
|
|
|
- List<CSalesSupplementSignConfirmationElectronicInfo> supplementSignConfirmationElectronicInfos = salesSupplementSignConfirmationElectronicInfoService
|
|
|
- .lambdaQuery().eq(CSalesSupplementSignConfirmationElectronicInfo::getcSalesSupplementSignConfirmationId, salesSupplementSignConfirmation.getId()).list();
|
|
|
- if (CollectionUtil.isNotEmpty(supplementSignConfirmationElectronicInfos)){
|
|
|
- //获取销售合同补充签署的附件
|
|
|
- supplementSignConfirmationElectronicInfos.forEach(supplementSignConfirmationElectronicInfo -> {
|
|
|
- List<FileStorage> salesContractSupplementFiles = sysAttachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
- .setChildEnum(FileModuleDict.ChildEnum.SALES_SUPPLEMENT_SIGN_CONFIRM_BACK_FILE)
|
|
|
- .setEntityId(supplementSignConfirmationElectronicInfo.getId()).build());
|
|
|
- salesContract.addAll(salesContractSupplementFiles);
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- acceptanceBasicInfo.setSaleContractFiles(salesContract);
|
|
|
-
|
|
|
- //采购合同 文件
|
|
|
- PurchContractManagement purchContractManagement = purchContractService
|
|
|
- .getOne(new QueryWrapper<PurchContractManagement>().eq("business_number", acceptanceBasicInfo.getBusinessNumber())
|
|
|
- ); //.eq("c_supplier_info_id", acceptanceBasicInfo.getcSupplierInfoId())
|
|
|
- PurchContractBasicInfo purchContractBasicInfo = purchContractBasicInfoService.lambdaQuery().eq(PurchContractBasicInfo::getPurchContractManagementId, purchContractManagement.getId()).one();
|
|
|
-
|
|
|
- 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 (CollectionUtil.isNotEmpty(contractSupplementInfos)) {
|
|
|
- contractSupplementInfos.stream().forEach(contractSupplementInfo -> {
|
|
|
- //采购合同变更已签署文件
|
|
|
- AttachmentDto attachmentDto = AttachmentDto.builder()
|
|
|
- .setEntityId(contractSupplementInfo.getId())
|
|
|
- .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_SUPPLEMENT_SIGN_FILE).build();
|
|
|
- purchaseContract.addAll(attachmentRefService.getFiles(attachmentDto));
|
|
|
-
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ autoSalesFiles(acceptanceBasicInfo);
|
|
|
+ autoPurchFiles(acceptanceBasicInfo);
|
|
|
|
|
|
acceptanceBasicInfo.setFileStorageDOList(files1);
|
|
|
acceptanceBasicInfo.setSupplementFiles(files2);
|
|
|
|
|
|
acceptanceBasicInfo.setAcceptanceUpstreamFiles(files3);
|
|
|
- acceptanceBasicInfo.setProcureContractFile(purchaseContract);
|
|
|
|
|
|
return acceptanceBasicInfo;
|
|
|
}
|
|
@@ -382,7 +309,7 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
public List<BusinessProcessingTaskVo> findAllList(SearchBusinessProcessingTask search) {
|
|
|
List<BusinessProcessingTaskVo> processingTaskVoList = baseMapper.findAllList(search);
|
|
|
processingTaskVoList.stream().forEach(p -> {
|
|
|
- // p.setStatusStr(p.getStatus().getCode());
|
|
|
+ // p.setStatusStr(p.getStatus().getCode());
|
|
|
autoButtonFlag(p);
|
|
|
autoInfo(p);
|
|
|
});
|
|
@@ -503,8 +430,6 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
// .setChildEnum(FileModuleDict.ChildEnum.ACCEPTANCE_UPSTREAM_FILE).setEntityId(acceptanceBasicInfoId).build()));
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//下游验收单
|
|
|
AcceptanceSignConfirmation acceptanceSignConfirmation = acceptanceSignConfirmationService.lambdaQuery().eq(AcceptanceSignConfirmation::getAcceptanceBasicInfoId, acceptanceBasicInfoId).one();
|
|
|
if (acceptanceSignConfirmation != null) {
|
|
@@ -514,62 +439,11 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
).collect(Collectors.toList());
|
|
|
acceptanceApproval.setSignConfirmFiles(signConfirmFiles);
|
|
|
}
|
|
|
- //销售合同
|
|
|
- AcceptanceBasicInfo acceptanceBasicInfo = getById(acceptanceBasicInfoId);
|
|
|
- CSalesContract salesContractManagement = salesContractService.getByBusinessNumber(acceptanceBasicInfo.getBusinessNumber());
|
|
|
- CSalesContractBasicInfo salesContractBasicInfo = salesContractBasicInfoService
|
|
|
- .getOne(new QueryWrapper<CSalesContractBasicInfo>().eq("c_sales_contract_management_id",salesContractManagement.getId()));
|
|
|
- List<FileStorage> salesContract = sysAttachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
- .setChildEnum(FileModuleDict.ChildEnum.SALES_CONTRACT_FILE).setEntityId(salesContractBasicInfo.getId()).build());
|
|
|
- //销售合同补充合同
|
|
|
- //销售合同补充文件
|
|
|
- List<CSalesContractSupplementInfo> salesContractSupplementInfos = salesContractSupplementInfoService
|
|
|
- .list(new QueryWrapper<CSalesContractSupplementInfo>().eq("c_sales_contract_management_id", salesContractManagement.getId()));
|
|
|
- if (CollectionUtil.isNotEmpty(salesContractSupplementInfos)) {
|
|
|
- salesContractSupplementInfos.stream().forEach(s -> {
|
|
|
- if (salesContractManagement.getContractStatus().equals(ProjectInitiationStatusDict.ChildEnum.COMPLETED.getCode())) {
|
|
|
- List<FileStorage> salesContractSupplementFiles = sysAttachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
- .setChildEnum(FileModuleDict.ChildEnum.SALES_CONTRACT_SUPPLEMENT_FILE).setEntityId(s.getId()).build());
|
|
|
- salesContract.addAll(salesContractSupplementFiles);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- acceptanceApproval.setSalesContract(salesContract);
|
|
|
- //采购合同
|
|
|
- PurchContractManagement purchContractManagement = purchContractService
|
|
|
- .getOne(new QueryWrapper<PurchContractManagement>().eq("business_number", acceptanceBasicInfo.getBusinessNumber())
|
|
|
- .eq("supplier_id", acceptanceBasicInfo.getcSupplierInfoId()));
|
|
|
- PurchContractBasicInfo purchContractBasicInfo = purchContractBasicInfoService.lambdaQuery().eq(PurchContractBasicInfo::getPurchContractManagementId, purchContractManagement.getId()).one();
|
|
|
-
|
|
|
- List<FileStorage> purchaseContract = sysAttachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
- .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_FILE).setEntityId(purchContractBasicInfo.getId()).build());
|
|
|
-
|
|
|
- //线下签署节点的附件
|
|
|
- PurchContractSignConclusion purchContractSignConclusion = purchContractSignConclusionService
|
|
|
- .getOne(new QueryWrapper<PurchContractSignConclusion>().eq("c_purch_contract_basic_info_id", purchContractBasicInfo.getId())
|
|
|
- .orderByDesc("gmt_create").last("limit 1"));
|
|
|
- if (purchContractSignConclusion != null) {
|
|
|
- purchaseContract.addAll(attachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
- .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_SIGN_UNDERLINE).setEntityId(purchContractSignConclusion.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 (CollectionUtil.isNotEmpty(contractSupplementInfos)) {
|
|
|
- contractSupplementInfos.stream().forEach(contractSupplementInfo -> {
|
|
|
- //采购合同变更已签署文件
|
|
|
- AttachmentDto attachmentDto = AttachmentDto.builder().setEntityId(contractSupplementInfo.getId())
|
|
|
- .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_SUPPLEMENT_SIGN_FILE).build();
|
|
|
- purchaseContract.addAll(attachmentRefService.getFiles(attachmentDto));
|
|
|
+ AcceptanceBasicInfo acceptanceBasicInfo = getById(acceptanceBasicInfoId);
|
|
|
+ autoSalesFiles(acceptanceBasicInfo);
|
|
|
+ autoPurchFiles(acceptanceBasicInfo);
|
|
|
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- acceptanceApproval.setPurchContract(purchaseContract);
|
|
|
return acceptanceApproval;
|
|
|
}
|
|
|
|
|
@@ -604,7 +478,7 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
CSalesContract salesManagement = salesContractService.getOne(new QueryWrapper<CSalesContract>()
|
|
|
.eq("business_number", businessNumber));
|
|
|
CSalesContractBasicInfo salesContractBasicInfo = salesContractBasicInfoService
|
|
|
- .getOne(new QueryWrapper<CSalesContractBasicInfo>().eq("c_sales_contract_management_id",salesManagement.getId()));
|
|
|
+ .getOne(new QueryWrapper<CSalesContractBasicInfo>().eq("c_sales_contract_management_id", salesManagement.getId()));
|
|
|
//采购合同供应商发货人
|
|
|
List<PurchContractBuyerSeller> purchContractSellers = purchContractBuyerSellerService.lambdaQuery()
|
|
|
.eq(PurchContractBuyerSeller::getPurchContractBasicInfoId, purchContractBasicInfo.getId()).list();
|
|
@@ -671,20 +545,20 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
String legalSpecias = legalSpecialists.stream().map(c -> c.toString()).collect(Collectors.joining(","));
|
|
|
|
|
|
if (acceptanceBasicInfo == null) {
|
|
|
- throw new ValidatorException(CodeUtil.FAIL,"验收单信息不能为空!");
|
|
|
+ throw new ValidatorException(CodeUtil.FAIL, "验收单信息不能为空!");
|
|
|
}
|
|
|
//保存历史
|
|
|
Long historyId = addHistoryAcceptanceSheet(acceptanceBasicInfo);
|
|
|
User admin = userService.getByLoginName("admin");
|
|
|
Map<String, Object> procVariables = new HashMap<>();
|
|
|
Map<String, Object> msgVariables = new HashMap<>();
|
|
|
- if (acceptanceBasicInfo.getSignConfirm().equals(1) ) {
|
|
|
+ if (acceptanceBasicInfo.getSignConfirm().equals(1)) {
|
|
|
procVariables.put(ConstantUtil.ACCEPTANCE_SIGN_CONFIRM_ASSIGNEE, admin.getId());
|
|
|
procVariables.put("result", "签署确认");
|
|
|
flowableService.completeMyTask(acceptanceBasicInfo.getTaskId(), acceptanceBasicInfo, procVariables,
|
|
|
null, historyId, msgVariables, ConstantUtil.ACCEPTANCE_SHEET);
|
|
|
} else if (acceptanceBasicInfo.getSignConfirm().equals(0)) {
|
|
|
- procVariables.put(ConstantUtil.ACCEPTANCE_SHEET_APPROVAL_CANDIDATE,legalSpecias);
|
|
|
+ procVariables.put(ConstantUtil.ACCEPTANCE_SHEET_APPROVAL_CANDIDATE, legalSpecias);
|
|
|
procVariables.put("result", "法务审核");
|
|
|
msgVariables.put(ConstantUtil.FLOWABLE_MSG_TITLE, "验收单编号:" + acceptanceBasicInfo.getAcceptanceNumber());
|
|
|
msgVariables.put(ConstantUtil.FLOWABLE_MSG_CONTENT,
|
|
@@ -797,30 +671,30 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
//模板中填充数据-c端其实已经生成了
|
|
|
//file = inputData(acceptanceBasicInfo, xmlDoc);
|
|
|
fileDOs = fileService.findByBusinessId(
|
|
|
- acceptanceApproval.getAcceptanceBasicInfoId(),
|
|
|
- FileModuleDict.ChildEnum.ACCEPTANCE_UPSTREAM_FILE.getCode());
|
|
|
+ acceptanceApproval.getAcceptanceBasicInfoId(),
|
|
|
+ FileModuleDict.ChildEnum.ACCEPTANCE_UPSTREAM_FILE.getCode());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw new BusinessException(CodeUtil.FAIL, "生成验收单据出错");
|
|
|
}
|
|
|
- for(FileStorageDO file:fileDOs){
|
|
|
+ for (FileStorageDO file : fileDOs) {
|
|
|
File f = new File(file.getAbsolutePath());
|
|
|
|
|
|
- //上传合同 TODO 调用发大大报错 为了不影响流程 先这样
|
|
|
- String contractId = UUID.randomUUID().toString().trim().replaceAll("-", "").toUpperCase();
|
|
|
- String docTitle = "上游验收单" + acceptanceBasicInfo.getAcceptanceNumber();
|
|
|
- String transactionId = UUID.randomUUID().toString().trim().replaceAll("-", "").toUpperCase();
|
|
|
- ElectronicSignatureUtil.uploadContract(contractId, docTitle, f);
|
|
|
- //采购合同自动签署
|
|
|
- Platform platform = platformService.getById(acceptanceBasicInfo.getTradingPlatformId());
|
|
|
- String signKeyword = "gz";
|
|
|
- ElectronicSignatureUtil.autoSign(transactionId, contractId, platform.getFddCustomerId(), docTitle, signKeyword);
|
|
|
- //合同下载
|
|
|
- String contDownUrl = ElectronicSignatureUtil.downloadContract(contractId);
|
|
|
- FileStorage contractSupplementFile = fileStorageService.addFileStorageWithBelongAndName(contractId, FileModuleDict.ChildEnum.ACCEPTANCE_UPSTREAM_FILE_SIGN, contDownUrl, null);
|
|
|
- fileStorageService.saveAttachmentRefByFileStorage(contractSupplementFile, FileModuleDict.ChildEnum.ACCEPTANCE_UPSTREAM_FILE_SIGN, acceptanceBasicInfo.getId());
|
|
|
- //合同归档
|
|
|
- ElectronicSignatureUtil.contractFiled(contractId);
|
|
|
+ //上传合同 TODO 调用发大大报错 为了不影响流程 先这样
|
|
|
+ String contractId = UUID.randomUUID().toString().trim().replaceAll("-", "").toUpperCase();
|
|
|
+ String docTitle = "上游验收单" + acceptanceBasicInfo.getAcceptanceNumber();
|
|
|
+ String transactionId = UUID.randomUUID().toString().trim().replaceAll("-", "").toUpperCase();
|
|
|
+ ElectronicSignatureUtil.uploadContract(contractId, docTitle, f);
|
|
|
+ //采购合同自动签署
|
|
|
+ Platform platform = platformService.getById(acceptanceBasicInfo.getTradingPlatformId());
|
|
|
+ String signKeyword = "gz";
|
|
|
+ ElectronicSignatureUtil.autoSign(transactionId, contractId, platform.getFddCustomerId(), docTitle, signKeyword);
|
|
|
+ //合同下载
|
|
|
+ String contDownUrl = ElectronicSignatureUtil.downloadContract(contractId);
|
|
|
+ FileStorage contractSupplementFile = fileStorageService.addFileStorageWithBelongAndName(contractId, FileModuleDict.ChildEnum.ACCEPTANCE_UPSTREAM_FILE_SIGN, contDownUrl, null);
|
|
|
+ fileStorageService.saveAttachmentRefByFileStorage(contractSupplementFile, FileModuleDict.ChildEnum.ACCEPTANCE_UPSTREAM_FILE_SIGN, acceptanceBasicInfo.getId());
|
|
|
+ //合同归档
|
|
|
+ ElectronicSignatureUtil.contractFiled(contractId);
|
|
|
}
|
|
|
break;
|
|
|
case ConstantConversionUtil.APPROVAL_RESULT_BACK:
|
|
@@ -882,12 +756,12 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
}
|
|
|
//合同信息
|
|
|
PurchContractManagement purchContractManagement = purchContractService.getOne(
|
|
|
- new QueryWrapper<PurchContractManagement>()
|
|
|
- .eq("business_number", acceptanceBasicInfo.getBusinessNumber()));
|
|
|
+ new QueryWrapper<PurchContractManagement>()
|
|
|
+ .eq("business_number", acceptanceBasicInfo.getBusinessNumber()));
|
|
|
PurchContractBasicInfo purchContractBasicInfo = purchContractBasicInfoService.getOne(
|
|
|
- new QueryWrapper<PurchContractBasicInfo>()
|
|
|
- .eq("c_purch_contract_management_id", purchContractManagement.getId())
|
|
|
- .orderByDesc("gmt_create").last("LIMIT 1")
|
|
|
+ new QueryWrapper<PurchContractBasicInfo>()
|
|
|
+ .eq("c_purch_contract_management_id", purchContractManagement.getId())
|
|
|
+ .orderByDesc("gmt_create").last("LIMIT 1")
|
|
|
);
|
|
|
// List<PurchContractBuyerSeller> purchContractBuyerSellers = purchContractBuyerSellerService
|
|
|
// .list(new QueryWrapper<PurchContractBuyerSeller>()
|
|
@@ -896,15 +770,15 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
|
|
|
//最后一次审核的信息
|
|
|
PurchContractApproval purchContractApproval = purchContractApprovalService.getOne(
|
|
|
- new LambdaQueryWrapper<PurchContractApproval>()
|
|
|
- .eq(PurchContractApproval::getPurchContractBasicInfoId,
|
|
|
- purchContractBasicInfo.getId())
|
|
|
- .orderByDesc(PurchContractApproval::getGmtCreate).last("LIMIT 1"));
|
|
|
+ new LambdaQueryWrapper<PurchContractApproval>()
|
|
|
+ .eq(PurchContractApproval::getPurchContractBasicInfoId,
|
|
|
+ purchContractBasicInfo.getId())
|
|
|
+ .orderByDesc(PurchContractApproval::getGmtCreate).last("LIMIT 1"));
|
|
|
|
|
|
List<PurchContractNeedUserRel> buyers = purchContractNeedUserRelService.list(
|
|
|
- new LambdaQueryWrapper<PurchContractNeedUserRel>()
|
|
|
- .eq(PurchContractNeedUserRel::getPurchContractApprovalId,
|
|
|
- purchContractApproval.getId()));
|
|
|
+ new LambdaQueryWrapper<PurchContractNeedUserRel>()
|
|
|
+ .eq(PurchContractNeedUserRel::getPurchContractApprovalId,
|
|
|
+ purchContractApproval.getId()));
|
|
|
|
|
|
|
|
|
StringBuffer names = new StringBuffer();
|
|
@@ -1048,7 +922,6 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
* @param oldAcceptanceBasicInfo
|
|
|
* @return
|
|
|
*/
|
|
@@ -1058,7 +931,7 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
Long oldId = oldAcceptanceBasicInfo.getId();
|
|
|
//保存基础信息
|
|
|
AcceptanceHisInfo acceptanceHisInfo = new AcceptanceHisInfo();
|
|
|
- BeanUtils.copyProperties(oldAcceptanceBasicInfo, acceptanceHisInfo,"id");
|
|
|
+ BeanUtils.copyProperties(oldAcceptanceBasicInfo, acceptanceHisInfo, "id");
|
|
|
//保存历史基础信息
|
|
|
acceptanceHisInfoService.save(acceptanceHisInfo);
|
|
|
//保存相关货物信息
|
|
@@ -1099,8 +972,8 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
});
|
|
|
}
|
|
|
//保存生成的验收单历史
|
|
|
- if(CollectionUtil.isNotEmpty(oldAcceptanceBasicInfo.getAcceptanceUpstreamFiles())){
|
|
|
- for(FileStorageDO f:oldAcceptanceBasicInfo.getAcceptanceUpstreamFiles()){
|
|
|
+ if (CollectionUtil.isNotEmpty(oldAcceptanceBasicInfo.getAcceptanceUpstreamFiles())) {
|
|
|
+ for (FileStorageDO f : oldAcceptanceBasicInfo.getAcceptanceUpstreamFiles()) {
|
|
|
FileStorageDO fileStorageDOHis = new FileStorageDO();
|
|
|
BeanUtils.copyProperties(f, fileStorageDOHis);
|
|
|
fileStorageDOHis.setBusinessType(FileModuleDict.ChildEnum.ACCEPTANCE_HIS_UPSTREAM_FILE.getCode());
|
|
@@ -1135,4 +1008,124 @@ public class AcceptanceBasicInfoServiceImpl extends ServiceImpl<AcceptanceBasicI
|
|
|
return acceptanceHisInfo.getId();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 填充销售合同附件
|
|
|
+ *
|
|
|
+ * @param acceptanceBasicInfo
|
|
|
+ */
|
|
|
+ void autoSalesFiles(AcceptanceBasicInfo acceptanceBasicInfo) {
|
|
|
+ //销售合同 文件
|
|
|
+ List<FileStorage> salesContract = new ArrayList<>();
|
|
|
+ CSalesContract salesContractManagement = salesContractService.getByBusinessNumber(acceptanceBasicInfo.getBusinessNumber());
|
|
|
+ CSalesContractBasicInfo salesContractBasicInfo = salesContractBasicInfoService
|
|
|
+ .getOne(new QueryWrapper<CSalesContractBasicInfo>().eq("c_sales_contract_management_id", salesContractManagement.getId()));
|
|
|
+ //销售合同原件
|
|
|
+ //合同文件
|
|
|
+ List<FileStorageDO> fileStorageDOS = fileService.findByBusinessId(salesContractBasicInfo.getId(), FileModuleDict.ChildEnum.SALES_CONTRACT_FILE.getCode());
|
|
|
+ if (CollectionUtil.isNotEmpty(fileStorageDOS)) {
|
|
|
+ fileStorageDOS.forEach(fileStorageDO -> {
|
|
|
+ FileStorage fileStorage = new FileStorage();
|
|
|
+ fileStorage.setAbsolutePath(fileStorageDO.getAbsolutePath());
|
|
|
+ fileStorage.setName(fileStorageDO.getOriginalName());
|
|
|
+ fileStorage.setPath(fileStorageDO.getPath());
|
|
|
+ fileStorage.setId(fileStorageDO.getId());
|
|
|
+ fileStorage.setOriginalName(fileStorageDO.getOriginalName());
|
|
|
+ salesContract.add(fileStorage);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //已签署的文件
|
|
|
+ CSalesSignConfirmation salesSignConfirmation = salesSignConfirmationService
|
|
|
+ .lambdaQuery().eq(CSalesSignConfirmation::getcSalesContractManagementId, salesContractManagement.getId()).one();
|
|
|
+ if (salesSignConfirmation != null) {
|
|
|
+ List<CSalesSignConfirmationElectronicInfo> signElectronicInfos = signConfirmationElectronicInfoService
|
|
|
+ .list(new QueryWrapper<CSalesSignConfirmationElectronicInfo>().eq("c_sales_sign_confirmation_id", salesSignConfirmation.getId()));
|
|
|
+ if (CollectionUtil.isNotEmpty(signElectronicInfos)) {
|
|
|
+ signElectronicInfos.forEach(signElectronicInfo -> {
|
|
|
+ salesContract.addAll(sysAttachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
+ .setChildEnum(FileModuleDict.ChildEnum.SIGN_CONFIRM_BACK_FILE).setEntityId(signElectronicInfo.getId()).build()));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //销售合同补充文件
|
|
|
+ List<CSalesContractSupplementInfo> salesContractSupplementInfos = salesContractSupplementInfoService
|
|
|
+ .list(new QueryWrapper<CSalesContractSupplementInfo>().eq("c_sales_contract_management_id", salesContractManagement.getId()));
|
|
|
+ if (CollectionUtil.isNotEmpty(salesContractSupplementInfos)) {
|
|
|
+ salesContractSupplementInfos.stream().forEach(s -> {
|
|
|
+ if (salesContractManagement.getContractStatus().equals(ProjectInitiationStatusDict.ChildEnum.COMPLETED.getCode())) {
|
|
|
+
|
|
|
+ //补充合同原件
|
|
|
+ CSalesContractSupplementBasicInfo salesContractSupplementBasicInfo = salesContractSupplementBasicInfoService.lambdaQuery()
|
|
|
+ .eq(CSalesContractSupplementBasicInfo::getcSalesContractSupplementInfoId, s.getId())
|
|
|
+ .one();
|
|
|
+ List<FileStorageDO> SupplementFileStorageDOS = fileService.findByBusinessId(salesContractSupplementBasicInfo.getId(),
|
|
|
+ FileModuleDict.ChildEnum.SALES_CONTRACT_SUPPLEMENT_CONTRACT_FILE.getCode());
|
|
|
+ if (CollectionUtil.isNotEmpty(SupplementFileStorageDOS)) {
|
|
|
+ SupplementFileStorageDOS.forEach(fileStorageDO -> {
|
|
|
+ FileStorage fileStorage = new FileStorage();
|
|
|
+ fileStorage.setAbsolutePath(fileStorageDO.getAbsolutePath());
|
|
|
+ fileStorage.setName(fileStorageDO.getOriginalName());
|
|
|
+ fileStorage.setPath(fileStorageDO.getPath());
|
|
|
+ fileStorage.setId(fileStorageDO.getId());
|
|
|
+ fileStorage.setOriginalName(fileStorageDO.getOriginalName());
|
|
|
+ salesContract.add(fileStorage);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ CSalesSupplementSignConfirmation salesSupplementSignConfirmation = salesSupplementSignConfirmationService
|
|
|
+ .lambdaQuery().eq(CSalesSupplementSignConfirmation::getcSalesContractSupplementInfoId, s.getId()).one();
|
|
|
+ if (salesSupplementSignConfirmation != null) {
|
|
|
+ List<CSalesSupplementSignConfirmationElectronicInfo> supplementSignConfirmationElectronicInfos = salesSupplementSignConfirmationElectronicInfoService
|
|
|
+ .lambdaQuery().eq(CSalesSupplementSignConfirmationElectronicInfo::getcSalesSupplementSignConfirmationId, salesSupplementSignConfirmation.getId()).list();
|
|
|
+ if (CollectionUtil.isNotEmpty(supplementSignConfirmationElectronicInfos)) {
|
|
|
+ //获取销售合同补充签署的附件
|
|
|
+ supplementSignConfirmationElectronicInfos.forEach(supplementSignConfirmationElectronicInfo -> {
|
|
|
+ List<FileStorage> salesContractSupplementFiles = sysAttachmentRefService.getFiles(AttachmentDto.builder()
|
|
|
+ .setChildEnum(FileModuleDict.ChildEnum.SALES_SUPPLEMENT_SIGN_CONFIRM_BACK_FILE)
|
|
|
+ .setEntityId(supplementSignConfirmationElectronicInfo.getId()).build());
|
|
|
+ salesContract.addAll(salesContractSupplementFiles);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ acceptanceBasicInfo.setSaleContractFiles(salesContract);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 填充采购合同附件
|
|
|
+ *
|
|
|
+ * @param acceptanceBasicInfo
|
|
|
+ */
|
|
|
+ void autoPurchFiles(AcceptanceBasicInfo acceptanceBasicInfo) {
|
|
|
+ //采购合同 文件
|
|
|
+ PurchContractManagement purchContractManagement = purchContractService
|
|
|
+ .getOne(new QueryWrapper<PurchContractManagement>().eq("business_number", acceptanceBasicInfo.getBusinessNumber())
|
|
|
+ ); //.eq("c_supplier_info_id", acceptanceBasicInfo.getcSupplierInfoId())
|
|
|
+ PurchContractBasicInfo purchContractBasicInfo = purchContractBasicInfoService.lambdaQuery().eq(PurchContractBasicInfo::getPurchContractManagementId, purchContractManagement.getId()).one();
|
|
|
+
|
|
|
+ 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 (CollectionUtil.isNotEmpty(contractSupplementInfos)) {
|
|
|
+ contractSupplementInfos.stream().forEach(contractSupplementInfo -> {
|
|
|
+ //采购合同变更已签署文件
|
|
|
+ AttachmentDto attachmentDto = AttachmentDto.builder()
|
|
|
+ .setEntityId(contractSupplementInfo.getId())
|
|
|
+ .setChildEnum(FileModuleDict.ChildEnum.PURCHASE_CONTRACT_SUPPLEMENT_SIGN_FILE).build();
|
|
|
+ purchaseContract.addAll(attachmentRefService.getFiles(attachmentDto));
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ acceptanceBasicInfo.setProcureContractFile(purchaseContract);
|
|
|
+ }
|
|
|
+
|
|
|
}
|