From c05ddf57634572b43869e00d426efe05d2df5077 Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期三, 10 六月 2026 08:16:23 +0800
Subject: [PATCH] feat:模版合同加备注、水电房屋租赁执行次数改为合同有效期、合同履约列表新增双方履约、开票新增拟开票数量
---
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java | 60 +++++++++++++++++++++++++++++++++++-------------------------
1 files changed, 35 insertions(+), 25 deletions(-)
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java
index fa9c7b6..328c86d 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java
@@ -25,10 +25,7 @@
import com.by4cloud.platformx.business.mapper.*;
import com.by4cloud.platformx.business.service.ContractInvoiceService;
import com.by4cloud.platformx.business.service.PaymentConfirmService;
-import com.by4cloud.platformx.business.vo.ContractInvoiceOutBoundVo;
-import com.by4cloud.platformx.business.vo.ContractOutBoundMergeVo;
-import com.by4cloud.platformx.business.vo.GenInvoiceInfoVo;
-import com.by4cloud.platformx.business.vo.InvoiceItemVo;
+import com.by4cloud.platformx.business.vo.*;
import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.data.mybatis.BaseModel;
import com.by4cloud.platformx.common.security.util.SecurityUtils;
@@ -88,15 +85,21 @@
.selectAll(ContractOutBound.class)
.eq(ContractOutBound::getContractId, contractId);
List<ContractInvoiceOutBoundVo> invoiceOutBoundVoList = contractOutBoundMapper.selectJoinList(ContractInvoiceOutBoundVo.class, wrapper);
+ if (ArrayUtil.isNotEmpty(invoiceOutBoundVoList.toArray())){
+ invoiceOutBoundVoList.stream().forEach(contractInvoiceOutBoundVo -> {
+ contractInvoiceOutBoundVo.setInvoiceNum(contractInvoiceOutBoundVo.getOutBoundNum().subtract(contractInvoiceOutBoundVo.getInvoiceNum()));
+ contractInvoiceOutBoundVo.setToInvoiceNum(contractInvoiceOutBoundVo.getInvoiceNum());
+ });
+ }
return R.ok(invoiceOutBoundVoList);
}
@Override
public R genInvoiceInfo(GenInvoiceInfoDTO genInvoiceInfoDTO) {
- if (ArrayUtil.isEmpty(genInvoiceInfoDTO.getContractOutBoundIds())) {
+ if (ArrayUtil.isEmpty(genInvoiceInfoDTO.getOutBoundInvoiceList())) {
return R.failed("璇烽�夋嫨寮�绁ㄥ嚭搴撳崟鍚庡啀鎿嶄綔");
}
- ContractOutBound outBound = contractOutBoundMapper.selectById(genInvoiceInfoDTO.getContractOutBoundIds().get(0));
+ ContractOutBound outBound = contractOutBoundMapper.selectById(genInvoiceInfoDTO.getOutBoundInvoiceList().get(0).getContractOutBoundId());
Contract contract = contractMapper.selectById(outBound.getContractId());
if (ObjUtil.isNull(contract)) {
return R.failed("鍚堝悓淇℃伅寮傚父锛岃鑱旂郴鎶�鏈汉鍛�");
@@ -125,16 +128,18 @@
List<InvoiceItemVo> invoiceItemVoList = new ArrayList<>();
List<String> erpCode = new ArrayList<>();
List<ContractOutBoundMergeVo> mergeOutBounds = new ArrayList<>();
- List<ContractOutBound> outBounds = contractOutBoundMapper.selectList(Wrappers.<ContractOutBound>lambdaQuery()
- .in(ContractOutBound::getId, genInvoiceInfoDTO.getContractOutBoundIds()));
- if (ArrayUtil.isNotEmpty(outBounds.toArray())) {
- outBounds.stream().forEach(contractOutBound -> {
+// List<ContractOutBound> outBounds = contractOutBoundMapper.selectList(Wrappers.<ContractOutBound>lambdaQuery()
+// .in(ContractOutBound::getId, genInvoiceInfoDTO.getOutBoundInvoiceList().stream().map(item->item.getContractOutBoundId()).collect(Collectors.toList())));
+ if (ArrayUtil.isNotEmpty(genInvoiceInfoDTO.getOutBoundInvoiceList().toArray())) {
+ genInvoiceInfoDTO.getOutBoundInvoiceList().stream().forEach(contractOutBoundInvoiceVo -> {
+ ContractOutBound contractOutBound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
+
if (!ArrayUtil.contains(erpCode.toArray(), contractOutBound.getSubjectMatterCode())) {
erpCode.add(contractOutBound.getSubjectMatterCode());
ContractOutBoundMergeVo mergeVo = new ContractOutBoundMergeVo();
mergeVo.setMaterialCode(contractOutBound.getSubjectMatterCode());
mergeVo.setMaterialInternalName(contractOutBound.getSubjectMatterName());
- mergeVo.setQuantity(contractOutBound.getOutBoundNum());
+ mergeVo.setQuantity(contractOutBoundInvoiceVo.getInvoiceNum());
Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractOutBound.getSubjectMatterCode())
.eq(Product::getCompId, SecurityUtils.getUser().getCompId()).last("limit 1"));
if (ObjUtil.isNotNull(product)) {
@@ -183,10 +188,10 @@
@Override
public R toInvoice(GenInvoiceInfoDTO genInvoiceInfoDTO) {
- if (ArrayUtil.isEmpty(genInvoiceInfoDTO.getContractOutBoundIds().toArray())) {
+ if (ArrayUtil.isEmpty(genInvoiceInfoDTO.getOutBoundInvoiceList().toArray())) {
return R.failed("璇烽�夋嫨寮�绁ㄥ嚭搴撳崟鍚庡啀鎿嶄綔");
}
- ContractOutBound outBound = contractOutBoundMapper.selectById(genInvoiceInfoDTO.getContractOutBoundIds().get(0));
+ ContractOutBound outBound = contractOutBoundMapper.selectById(genInvoiceInfoDTO.getOutBoundInvoiceList().get(0).getContractOutBoundId());
Contract contract = contractMapper.selectById(outBound.getContractId());
if (ObjUtil.isNull(contract)) {
return R.failed("鍚堝悓淇℃伅寮傚父锛岃鑱旂郴鎶�鏈汉鍛�");
@@ -198,7 +203,7 @@
SysDept b = r.getData();
GenInvoiceInfoVo vo = genInvoiceInfoVo(genInvoiceInfoDTO, contract, b);
//鍙戠エ淇濆瓨
- ContractInvoice invoice = saveContractInvoice(vo, contract, genInvoiceInfoDTO.getContractOutBoundIds(), DateUtil.current() + "");
+ ContractInvoice invoice = saveContractInvoice(vo, contract, genInvoiceInfoDTO.getOutBoundInvoiceList(), DateUtil.current() + "");
//鍚姩娴佺▼
ProcessInstanceParamDto dto = new ProcessInstanceParamDto();
Map<String, Object> map = BeanUtil.beanToMap(invoice);
@@ -209,9 +214,10 @@
return R.failed("娴佺▼鍚姩澶辫触");
}
//鏇存柊鍚堝悓鍑哄簱鍗曠姸鎬�
- genInvoiceInfoDTO.getContractOutBoundIds().stream().forEach(outBoundId -> {
- ContractOutBound bound = contractOutBoundMapper.selectById(outBoundId);
+ genInvoiceInfoDTO.getOutBoundInvoiceList().stream().forEach(contractOutBoundInvoiceVo -> {
+ ContractOutBound bound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
bound.setInvoiceStatus("1");
+ bound.setInvoiceNum(bound.getInvoiceNum().add(contractOutBoundInvoiceVo.getInvoiceNum()));
contractOutBoundMapper.updateById(bound);
});
return R.ok();
@@ -271,7 +277,7 @@
return jsonObject;
}
- private ContractInvoice saveContractInvoice(GenInvoiceInfoVo genInvoiceInfoVo, Contract contract, List<Long> outBoundIds, String serialNo) {
+ private ContractInvoice saveContractInvoice(GenInvoiceInfoVo genInvoiceInfoVo, Contract contract, List<ContractOutBoundInvoiceVo> outBoundInvoiceVoList, String serialNo) {
ContractInvoice invoice = new ContractInvoice();
invoice.setContractId(contract.getId());
invoice.setInvoiceCategory("1");
@@ -286,9 +292,10 @@
invoice.setInvoicePreview(JSONObject.toJSONString(genInvoiceInfoVo));
invoice.setInvoiceStatus("1");
invoice.setApprovalStatus("0");
- invoice.setOutBoundId(outBoundIds.stream()
- .map(String::valueOf) // 鎴栬�� .map(Object::toString)
+ invoice.setOutBoundId(outBoundInvoiceVoList.stream()
+ .map(item-> String.valueOf(item.getContractOutBoundId())) // 鎴栬�� .map(Object::toString)
.collect(Collectors.joining(",")));
+ invoice.setInvoicePreviewParam(JSONObject.toJSONString(outBoundInvoiceVoList));
baseMapper.insert(invoice);
return invoice;
}
@@ -327,6 +334,7 @@
invoice.setSerialNo(DateUtil.current() + "");
invoice.setBlueInvoiceId(invoiceId);
invoice.setApprovalStatus("0");
+ invoice.setInvoicePreviewParam(blueInvoice.getInvoicePreviewParam());
baseMapper.insert(invoice);
//鍚姩娴佺▼
ProcessInstanceParamDto dto = new ProcessInstanceParamDto();
@@ -625,12 +633,14 @@
contractMapper.updateById(contract);
//鏇存柊鍚堝悓鍑哄簱鍗曠姸鎬�
- String[] outBoundIds = blueInvoice.getOutBoundId().split(",");
- Arrays.stream(outBoundIds).forEach(outBoundId -> {
- ContractOutBound bound = contractOutBoundMapper.selectById(outBoundId);
- bound.setInvoiceStatus("0");
- contractOutBoundMapper.updateById(bound);
- });
+ List<ContractOutBoundInvoiceVo> outBoundInvoiceVoList = BeanUtil.copyToList(JSONArray.parseArray(blueInvoice.getInvoicePreviewParam()),ContractOutBoundInvoiceVo.class);
+ if (ArrayUtil.isNotEmpty(outBoundInvoiceVoList.toArray())){
+ outBoundInvoiceVoList.stream().forEach(contractOutBoundInvoiceVo -> {
+ ContractOutBound contractOutBound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
+ contractOutBound.setInvoiceNum(contractOutBound.getInvoiceNum().subtract(contractOutBoundInvoiceVo.getInvoiceNum()));
+ contractOutBoundMapper.updateById(contractOutBound);
+ });
+ }
}
invoice.setApprovalStatus("1");
baseMapper.updateById(invoice);
--
Gitblit v1.9.1