|
@@ -465,7 +465,7 @@ public class PurchContractApprovalServiceImpl extends ServiceImpl<PurchContractA
|
|
//删除之前的审批信息
|
|
//删除之前的审批信息
|
|
PurchContractApproval oldApproval = getLatestPurchContractApproval(purch.getId(), 0);
|
|
PurchContractApproval oldApproval = getLatestPurchContractApproval(purch.getId(), 0);
|
|
|
|
|
|
- if (oldApproval != null) {
|
|
|
|
|
|
+ if (oldApproval != null && purchContractApproval.getApprovalConclusion().equals("pass")) {
|
|
//删除之前上传的合同信息
|
|
//删除之前上传的合同信息
|
|
List<UploadPurchContract> oldUploadContracts = uploadPurchContractService.lambdaQuery().eq(UploadPurchContract::getPurchContractApprovalId, oldApproval.getId()).list();
|
|
List<UploadPurchContract> oldUploadContracts = uploadPurchContractService.lambdaQuery().eq(UploadPurchContract::getPurchContractApprovalId, oldApproval.getId()).list();
|
|
if (CollectionUtil.isNotEmpty(oldUploadContracts)) {
|
|
if (CollectionUtil.isNotEmpty(oldUploadContracts)) {
|
|
@@ -544,62 +544,65 @@ public class PurchContractApprovalServiceImpl extends ServiceImpl<PurchContractA
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- //添加合同补充信息
|
|
|
|
- if (purchContractApprovalVo.getPurchContractReplenishInfo() != null) {
|
|
|
|
- PurchContractReplenishInfo replenishInfo = purchContractApprovalVo.getPurchContractReplenishInfo();
|
|
|
|
- replenishInfo.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
- purchContractReplenishInfoService.save(replenishInfo);
|
|
|
|
- }
|
|
|
|
|
|
+ if (purchContractApproval.getApprovalConclusion().equals("pass")) {
|
|
|
|
+//添加合同补充信息
|
|
|
|
+ if (purchContractApprovalVo.getPurchContractReplenishInfo() != null) {
|
|
|
|
+ PurchContractReplenishInfo replenishInfo = purchContractApprovalVo.getPurchContractReplenishInfo();
|
|
|
|
+ replenishInfo.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
+ purchContractReplenishInfoService.save(replenishInfo);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
- //添加质量与验收
|
|
|
|
- if (purchContractApprovalVo.getPurchContractQualityAccept() != null) {
|
|
|
|
- PurchContractQualityAccept qualityAccept = purchContractApprovalVo.getPurchContractQualityAccept();
|
|
|
|
- qualityAccept.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
- purchContractQualityAcceptService.save(qualityAccept);
|
|
|
|
- }
|
|
|
|
|
|
+ //添加质量与验收
|
|
|
|
+ if (purchContractApprovalVo.getPurchContractQualityAccept() != null) {
|
|
|
|
+ PurchContractQualityAccept qualityAccept = purchContractApprovalVo.getPurchContractQualityAccept();
|
|
|
|
+ qualityAccept.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
+ purchContractQualityAcceptService.save(qualityAccept);
|
|
|
|
+ }
|
|
|
|
|
|
- //结算与付款
|
|
|
|
- if (purchContractApprovalVo.getApprovalSettlePayment() != null) {
|
|
|
|
- PurchContractApprovalSettlePayment approvalSettlePayment = purchContractApprovalVo.getApprovalSettlePayment();
|
|
|
|
- approvalSettlePayment.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
- approvalSettlePaymentService.save(approvalSettlePayment);
|
|
|
|
- }
|
|
|
|
|
|
+ //结算与付款
|
|
|
|
+ if (purchContractApprovalVo.getApprovalSettlePayment() != null) {
|
|
|
|
+ PurchContractApprovalSettlePayment approvalSettlePayment = purchContractApprovalVo.getApprovalSettlePayment();
|
|
|
|
+ approvalSettlePayment.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
+ approvalSettlePaymentService.save(approvalSettlePayment);
|
|
|
|
+ }
|
|
|
|
|
|
- //添加交货规定
|
|
|
|
- if (purchContractApprovalVo.getPurchContractDeliverClause() != null) {
|
|
|
|
- PurchContractDeliverClause deliverClause = purchContractApprovalVo.getPurchContractDeliverClause();
|
|
|
|
- deliverClause.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
- purchContractDeliverClauseService.save(deliverClause);
|
|
|
|
- }
|
|
|
|
|
|
+ //添加交货规定
|
|
|
|
+ if (purchContractApprovalVo.getPurchContractDeliverClause() != null) {
|
|
|
|
+ PurchContractDeliverClause deliverClause = purchContractApprovalVo.getPurchContractDeliverClause();
|
|
|
|
+ deliverClause.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
+ purchContractDeliverClauseService.save(deliverClause);
|
|
|
|
+ }
|
|
|
|
|
|
- //结算周期
|
|
|
|
- if (purchContractApprovalVo.getApprovalSettleCycle() != null) {
|
|
|
|
- PurchContractApprovalSettleCycle approvalSettleCycle = purchContractApprovalVo.getApprovalSettleCycle();
|
|
|
|
- approvalSettleCycle.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
- approvalSettleCycleService.save(approvalSettleCycle);
|
|
|
|
- }
|
|
|
|
|
|
+ //结算周期
|
|
|
|
+ if (purchContractApprovalVo.getApprovalSettleCycle() != null) {
|
|
|
|
+ PurchContractApprovalSettleCycle approvalSettleCycle = purchContractApprovalVo.getApprovalSettleCycle();
|
|
|
|
+ approvalSettleCycle.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
+ approvalSettleCycleService.save(approvalSettleCycle);
|
|
|
|
+ }
|
|
|
|
|
|
- //需方收货人
|
|
|
|
- if (CollectionUtil.isNotEmpty(purchContractApprovalVo.getUserList())) {
|
|
|
|
- for (User user : purchContractApprovalVo.getUserList()) {
|
|
|
|
- PurchContractNeedUserRel needUserRel = new PurchContractNeedUserRel();
|
|
|
|
- needUserRel.setName(user.getName());
|
|
|
|
- needUserRel.setIdCard(user.getIdCard());
|
|
|
|
- needUserRel.setMobile(user.getMobile());
|
|
|
|
- needUserRel.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
- needUserRel.setSysUserId(user.getId());
|
|
|
|
- purchContractNeedUserRelService.save(needUserRel);
|
|
|
|
|
|
+ //需方收货人
|
|
|
|
+ if (CollectionUtil.isNotEmpty(purchContractApprovalVo.getUserList())) {
|
|
|
|
+ for (User user : purchContractApprovalVo.getUserList()) {
|
|
|
|
+ PurchContractNeedUserRel needUserRel = new PurchContractNeedUserRel();
|
|
|
|
+ needUserRel.setName(user.getName());
|
|
|
|
+ needUserRel.setIdCard(user.getIdCard());
|
|
|
|
+ needUserRel.setMobile(user.getMobile());
|
|
|
|
+ needUserRel.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
+ needUserRel.setSysUserId(user.getId());
|
|
|
|
+ purchContractNeedUserRelService.save(needUserRel);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- //增值税要求
|
|
|
|
- if (purchContractApprovalVo.getApprovalVatInfo() != null) {
|
|
|
|
- PurchContractApprovalVatInfo approvalVatInfo = purchContractApprovalVo.getApprovalVatInfo();
|
|
|
|
- approvalVatInfo.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
- approvalVatInfoService.save(approvalVatInfo);
|
|
|
|
|
|
+ //增值税要求
|
|
|
|
+ if (purchContractApprovalVo.getApprovalVatInfo() != null) {
|
|
|
|
+ PurchContractApprovalVatInfo approvalVatInfo = purchContractApprovalVo.getApprovalVatInfo();
|
|
|
|
+ approvalVatInfo.setPurchContractApprovalId(purchContractApproval.getId());
|
|
|
|
+ approvalVatInfoService.save(approvalVatInfo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
//添加其他条款
|
|
//添加其他条款
|
|
if (purchContractApprovalVo.getPurchContractOtherClause() != null && purchContractApprovalVo.getPurchContractOtherClause().size() > 0) {
|
|
if (purchContractApprovalVo.getPurchContractOtherClause() != null && purchContractApprovalVo.getPurchContractOtherClause().size() > 0) {
|
|
int i = 0;
|
|
int i = 0;
|
|
@@ -611,13 +614,12 @@ public class PurchContractApprovalServiceImpl extends ServiceImpl<PurchContractA
|
|
purchContractOtherClauseService.saveBatch(purchContractApprovalVo.getPurchContractOtherClause());
|
|
purchContractOtherClauseService.saveBatch(purchContractApprovalVo.getPurchContractOtherClause());
|
|
}
|
|
}
|
|
if (purchContractApprovalVo.getVisible().equals(1)) {
|
|
if (purchContractApprovalVo.getVisible().equals(1)) {
|
|
- if (purchContractApproval.getUpload() != null && purchContractApproval.getUpload() == 1) {
|
|
|
|
|
|
+ if (purchContractApproval.getUpload() != null && purchContractApproval.getUpload() == 1 && purchContractApproval.getApprovalConclusion().equals("pass")) {
|
|
List<UploadPurchContract> uploadPurchContracts = purchContractApprovalVo.getPurchContractApproval().getUploadPurchContracts();
|
|
List<UploadPurchContract> uploadPurchContracts = purchContractApprovalVo.getPurchContractApproval().getUploadPurchContracts();
|
|
if (CollectionUtil.isEmpty(uploadPurchContracts)) {
|
|
if (CollectionUtil.isEmpty(uploadPurchContracts)) {
|
|
throw new ValidatorException(CodeUtil.FAIL, "请上传合同文件!!!");
|
|
throw new ValidatorException(CodeUtil.FAIL, "请上传合同文件!!!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //添加历史
|
|
|
|
Map<String, Object> procVariables = new HashMap<>(1);
|
|
Map<String, Object> procVariables = new HashMap<>(1);
|
|
|
|
|
|
Dictionary firstApprovalDict = dictService.getByCode(PurchContractStatusDict.ChildEnum.FIRST_APPROVAL.getCode());
|
|
Dictionary firstApprovalDict = dictService.getByCode(PurchContractStatusDict.ChildEnum.FIRST_APPROVAL.getCode());
|
|
@@ -642,12 +644,17 @@ public class PurchContractApprovalServiceImpl extends ServiceImpl<PurchContractA
|
|
//变更货物
|
|
//变更货物
|
|
SalesContractSupplementGoodsInfo salesContractSupplementGoods =
|
|
SalesContractSupplementGoodsInfo salesContractSupplementGoods =
|
|
salesContractSupplementGoodsInfoService.getById(purchContractGoodsInfo.getSalesContractGoodsInfoId());
|
|
salesContractSupplementGoodsInfoService.getById(purchContractGoodsInfo.getSalesContractGoodsInfoId());
|
|
- salesContractSupplementGoodsInfoService.lambdaUpdate().eq(SalesContractSupplementGoodsInfo::getId, salesContractSupplementGoods.getId())
|
|
|
|
- .set(SalesContractSupplementGoodsInfo::getOccupy, 0).update();
|
|
|
|
|
|
+ if (salesContractSupplementGoods != null) {
|
|
|
|
+ salesContractSupplementGoodsInfoService.lambdaUpdate().eq(SalesContractSupplementGoodsInfo::getId, salesContractSupplementGoods.getId())
|
|
|
|
+ .set(SalesContractSupplementGoodsInfo::getOccupy, 0).update();
|
|
|
|
+ }
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
CSalesContractGoodsInfo salesContractGoods = salesContractGoodsInfoService.getById(purchContractGoodsInfo.getSalesContractGoodsInfoId());
|
|
CSalesContractGoodsInfo salesContractGoods = salesContractGoodsInfoService.getById(purchContractGoodsInfo.getSalesContractGoodsInfoId());
|
|
- salesContractGoodsInfoService.lambdaUpdate().eq(CSalesContractGoodsInfo::getId, salesContractGoods.getId())
|
|
|
|
- .set(CSalesContractGoodsInfo::getOccupy, 0).update();
|
|
|
|
|
|
+ if (salesContractGoods != null) {
|
|
|
|
+ salesContractGoodsInfoService.lambdaUpdate().eq(CSalesContractGoodsInfo::getId, salesContractGoods.getId())
|
|
|
|
+ .set(CSalesContractGoodsInfo::getOccupy, 0).update();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|