From c5c284896ce6428cffc5092e9cdef4fefc23409f Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期五, 18 九月 2026 17:12:49 +0800
Subject: [PATCH] feat: 石煤机客商产品查询处理 合同推送新增选商方式和是否关联交易
---
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java | 114 ++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 89 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 b2dae0a..18650c8 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
@@ -229,6 +229,24 @@
if (ObjUtil.isNotNull(subjectMatter)) {
advanceAmount = advanceAmount.add(contractOutBoundInvoiceVo.getInvoiceNum().multiply(subjectMatter.getUnitPrice()));
}
+ List<String> smjList = new ArrayList<>();
+ smjList.add(smj);
+ smjList.add(smjsc);
+ smjList.add(smjzt);
+ if (("" + SecurityUtils.getUser().getCompId()).equals(smj) || ("" + SecurityUtils.getUser().getCompId()).equals(smjsc) ||
+ ("" + SecurityUtils.getUser().getCompId()).equals(smjzt)) {
+ Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, subjectMatter.getMaterialCode())
+ .in(Product::getCompId, smjList).last("limit 1"));
+ if (ObjUtil.isNull(product) || StrUtil.isBlank(product.getTaxClass()) || StrUtil.isBlank(product.getTaxCode())) {
+ return R.failed("璇峰湪浜у搧淇℃伅涓ˉ鍏呯◣鏀跺垎绫讳俊鎭�");
+ }
+ } else {
+ Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, subjectMatter.getMaterialCode())
+ .eq(Product::getCompId, SecurityUtils.getUser().getCompId()).last("limit 1"));
+ if (ObjUtil.isNull(product) || StrUtil.isBlank(product.getTaxClass()) || StrUtil.isBlank(product.getTaxCode())) {
+ return R.failed("璇峰湪浜у搧淇℃伅涓ˉ鍏呯◣鏀跺垎绫讳俊鎭�");
+ }
+ }
}
log.info("advanceAmount:{}", advanceAmount);
log.info("schedule.getPlannedAmount:{}", schedule.getPlannedAmount());
@@ -260,6 +278,28 @@
BusinessCustomer customer = businessCustomerMapper.selectById(contract.getPartyAId());
if (ObjUtil.isNull(customer)) {
return R.failed("鑾峰彇璐柟鍗曚綅寮傚父");
+ }
+ for (ContractOutBoundInvoiceVo contractOutBoundInvoiceVo : genInvoiceInfoDTO.getOutBoundInvoiceList()) {
+ ContractOutBound contractOutBound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
+ List<String> smjList = new ArrayList<>();
+ smjList.add(smj);
+ smjList.add(smjsc);
+ smjList.add(smjzt);
+ if (("" + SecurityUtils.getUser().getCompId()).equals(smj) || ("" + SecurityUtils.getUser().getCompId()).equals(smjsc) ||
+ ("" + SecurityUtils.getUser().getCompId()).equals(smjzt)) {
+ Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractOutBound.getSubjectMatterCode())
+ .in(Product::getCompId, smjList).last("limit 1"));
+ if (ObjUtil.isNull(product) || StrUtil.isBlank(product.getTaxClass()) || StrUtil.isBlank(product.getTaxCode())) {
+ return R.failed("璇峰湪浜у搧淇℃伅涓ˉ鍏呯◣鏀跺垎绫讳俊鎭�");
+ }
+ } else {
+ Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractOutBound.getSubjectMatterCode())
+ .eq(Product::getCompId, SecurityUtils.getUser().getCompId()).last("limit 1"));
+ if (ObjUtil.isNull(product) || StrUtil.isBlank(product.getTaxClass()) || StrUtil.isBlank(product.getTaxCode())) {
+ return R.failed("璇峰湪浜у搧淇℃伅涓ˉ鍏呯◣鏀跺垎绫讳俊鎭�");
+ }
+ }
+
}
//鏈哄姩杞﹀紑绁�
if (StrUtil.equals(genInvoiceInfoDTO.getInvoiceType(), "4")) {
@@ -300,7 +340,28 @@
if (ObjUtil.isNull(customer)) {
return R.failed("鑾峰彇璐柟鍗曚綅寮傚父");
}
+ for (ContractOutBoundInvoiceVo contractOutBoundInvoiceVo : mergeInvoiceDTO.getOutBoundInvoiceList()) {
+ ContractOutBound contractOutBound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
+ List<String> smjList = new ArrayList<>();
+ smjList.add(smj);
+ smjList.add(smjsc);
+ smjList.add(smjzt);
+ if (("" + SecurityUtils.getUser().getCompId()).equals(smj) || ("" + SecurityUtils.getUser().getCompId()).equals(smjsc) ||
+ ("" + SecurityUtils.getUser().getCompId()).equals(smjzt)) {
+ Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractOutBound.getSubjectMatterCode())
+ .in(Product::getCompId, smjList).last("limit 1"));
+ if (ObjUtil.isNull(product) || StrUtil.isBlank(product.getTaxClass()) || StrUtil.isBlank(product.getTaxCode())) {
+ return R.failed("璇峰湪浜у搧淇℃伅涓ˉ鍏呯◣鏀跺垎绫讳俊鎭�");
+ }
+ } else {
+ Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractOutBound.getSubjectMatterCode())
+ .eq(Product::getCompId, SecurityUtils.getUser().getCompId()).last("limit 1"));
+ if (ObjUtil.isNull(product) || StrUtil.isBlank(product.getTaxClass()) || StrUtil.isBlank(product.getTaxCode())) {
+ return R.failed("璇峰湪浜у搧淇℃伅涓ˉ鍏呯◣鏀跺垎绫讳俊鎭�");
+ }
+ }
+ }
GenInvoiceInfoVo vo = genMergeInvoiceVo(mergeInvoiceDTO, customer, b);
vo = transBipVo(vo, b, customer);
return R.ok(vo);
@@ -532,7 +593,7 @@
List<InvoiceItemVo> invoiceItemVoList = new ArrayList<>();
List<String> erpCode = new ArrayList<>();
List<ContractOutBoundMergeVo> mergeOutBounds = new ArrayList<>();
- if (genInvoiceInfoDTO.getInvoiceType().equals("3")){
+ if (genInvoiceInfoDTO.getInvoiceType().equals("3")) {
String[] vehiclenNoList = genInvoiceInfoDTO.getVehicleNo().split(",");
for (int i = 0; i < vehiclenNoList.length; i++) {
ContractOutBound contractOutBound = contractOutBoundMapper.selectById(genInvoiceInfoDTO.getOutBoundInvoiceList().get(0).getContractOutBoundId());
@@ -856,7 +917,7 @@
}
GenInvoiceInfoVo vo = BeanUtil.copyProperties(toInvoiceDTO, GenInvoiceInfoVo.class);
//鍙戠エ淇濆瓨
- ContractInvoice invoice = saveContractInvoice(vo, contract, toInvoiceDTO.getOutBoundInvoiceList(), DateUtil.current() + "", "1",null);
+ ContractInvoice invoice = saveContractInvoice(vo, contract, toInvoiceDTO.getOutBoundInvoiceList(), DateUtil.current() + "", "1", null);
//鍚姩娴佺▼
ProcessInstanceParamDto dto = new ProcessInstanceParamDto();
Map<String, Object> map = BeanUtil.beanToMap(invoice);
@@ -876,7 +937,7 @@
}
GenInvoiceInfoVo vo = BeanUtil.copyProperties(toInvoiceDTO, GenInvoiceInfoVo.class);
//鍙戠エ淇濆瓨
- ContractInvoice invoice = saveContractInvoice(vo, contract, toInvoiceDTO.getOutBoundInvoiceList(), DateUtil.current() + "", "0",null);
+ ContractInvoice invoice = saveContractInvoice(vo, contract, toInvoiceDTO.getOutBoundInvoiceList(), DateUtil.current() + "", "0", null);
//鍚姩娴佺▼
ProcessInstanceParamDto dto = new ProcessInstanceParamDto();
Map<String, Object> map = BeanUtil.beanToMap(invoice);
@@ -1036,7 +1097,7 @@
List<ContractInvoice> invoiceList = baseMapper.selectList(Wrappers.<ContractInvoice>lambdaQuery()
.eq(ContractInvoice::getContractId, contractId)
.or()
- .like(ContractInvoice::getContractIds,contractId)
+ .like(ContractInvoice::getContractIds, contractId)
.orderByDesc(ContractInvoice::getCreateTime));
return R.ok(invoiceList);
}
@@ -1047,10 +1108,10 @@
blueInvoice.setRedReversal("2");
baseMapper.updateById(blueInvoice);
ContractInvoice invoice = new ContractInvoice();
- if (!blueInvoice.getIsMerge()){
+ if (!blueInvoice.getIsMerge()) {
invoice.setContractId(blueInvoice.getContractId());
}
- if (blueInvoice.getIsMerge()){
+ if (blueInvoice.getIsMerge()) {
invoice.setContractIds(blueInvoice.getContractIds());
invoice.setIsMerge(true);
}
@@ -1091,7 +1152,7 @@
ProcessInstanceParamDto dto = new ProcessInstanceParamDto();
Map<String, Object> map = BeanUtil.beanToMap(invoice);
dto.setParamMap(map);
- if (!blueInvoice.getIsMerge()){
+ if (!blueInvoice.getIsMerge()) {
Contract contract = contractMapper.selectById(blueInvoice.getContractId());
if (StrUtil.equals(contract.getContractCategory(), "water_house")) {
map.put("contractCategory", "water_house");
@@ -1141,7 +1202,7 @@
// invoiceDetail.put("goodsPrice", invoiceItemVo.getUnitPrice());
invoiceDetail.put("goodsTotalPrice", invoiceItemVo.getPriceNoTax());
invoiceDetail.put("goodsTotalTax", invoiceItemVo.getPriceTax());
- if (StrUtil.isNotBlank(vo.getInvoiceVehicleType())&&(vo.getInvoiceVehicleType().equals("3") || vo.getInvoiceVehicleType().equals("4"))) {
+ if (StrUtil.isNotBlank(vo.getInvoiceVehicleType()) && (vo.getInvoiceVehicleType().equals("3") || vo.getInvoiceVehicleType().equals("4"))) {
invoiceDetail.put("goodsSpecification", invoiceItemVo.getSpecification());
}
invoiceDetailsList.add(invoiceDetail);
@@ -1422,15 +1483,18 @@
item.put("taxRate", invoiceItemVo.getTaxRate());
item.put("oriTaxAmount", invoiceItemVo.getPriceTax());
item.put("oriTaxIncludedAmount", invoiceItemVo.getPriceAndTax());
+ item.put("remarks", invoiceItemVo.getZy());//鎽樿
item.put("_status", "Insert");
JSONObject freeChId = new JSONObject();
freeChId.put("GX08", invoiceItemVo.getHsdy());//鏍哥畻鍗曞厓
+ freeChId.put("YSYF14", "2");//娆鹃」绫诲瀷 1 棰勬敹娆� 2 搴旀敹娆�
freeChId.put("YSYF31", invoiceItemVo.getSfjs());//鏄惁璁$◣
freeChId.put("JT04", invoiceItemVo.getHsjylx());//鏍哥畻浜ゆ槗绫诲瀷 0101 闆嗗洟澶栭儴 01020301 涓夌骇鍒嗗瓙鍏徃闂� 01020302 涓夌骇鍒嗗叕鍙镐笌瀛愬瓙鍏徃涔嬮棿
freeChId.put("JT06", invoiceItemVo.getKxmx());//娆鹃」鏄庣粏
freeChId.put("JT32", invoiceItemVo.getZyys());//浣滀笟瑕佺礌
freeChId.put("zzbkfl", invoiceItemVo.getBkfl());//鏉垮潡鍒嗙被
freeChId.put("JT12", invoiceItemVo.getCpwlfl());//浜у搧鐗╂枡鍒嗙被
+
item.put("freeChId", freeChId);
bodyItem.add(item);
}
@@ -1547,7 +1611,7 @@
//钃濈エ
if (invoice.getInvoiceCategory().equals("1")) {
// TODO 寮�钃濈エ鎺ュ彛鏈哄姩杞﹂攢鍞�
- if (StrUtil.equals(vo.getInvoiceVehicleType(), "4")&&bwFlag) {
+ if (StrUtil.equals(vo.getInvoiceVehicleType(), "4") && bwFlag) {
JSONObject request = genBlueInvoiceVehicle(vo, invoice.getSerialNo(), dept);
String requestId = IdUtil.fastUUID();
invoice.setBwRequestId(requestId);
@@ -1573,7 +1637,7 @@
}
// TODO 寮�钃濈エ鎺ュ彛鏈哄姩杞︿笓鐢�
- if (StrUtil.equals(vo.getInvoiceVehicleType(), "3")&&bwFlag) {
+ if (StrUtil.equals(vo.getInvoiceVehicleType(), "3") && bwFlag) {
JSONObject request = genBlueInvoiceVehiclePre(vo, invoice.getSerialNo(), dept);
String requestId = IdUtil.fastUUID();
invoice.setBwRequestId(requestId);
@@ -1599,7 +1663,7 @@
}
// TODO 寮�钃濈エ鎺ュ彛 闈炴満鍔ㄨ溅
- if (!StrUtil.equals(vo.getInvoiceVehicleType(), "3") && !StrUtil.equals(vo.getInvoiceVehicleType(), "4")&&bwFlag) {
+ if (!StrUtil.equals(vo.getInvoiceVehicleType(), "3") && !StrUtil.equals(vo.getInvoiceVehicleType(), "4") && bwFlag) {
JSONObject request = genBlueInvoice(vo, invoice.getSerialNo(), dept);
String requestId = IdUtil.fastUUID();
invoice.setBwRequestId(requestId);
@@ -1833,7 +1897,7 @@
});
}
}
- }else {
+ } else {
blueInvoice.setRedReversal("1");
baseMapper.updateById(blueInvoice);
//鍚堝苟寮�绁�
@@ -1848,18 +1912,18 @@
for (ContractOutBoundInvoiceVo outBoundInvoiceVo : vo.getOutBoundInvoiceList()) {
BigDecimal contractBillAmount = new BigDecimal("0");
if (CollUtil.isNotEmpty(vo.getOutBoundInvoiceList())) {
- ContractOutBound contractOutBound = contractOutBoundMapper.selectById(outBoundInvoiceVo.getContractOutBoundId());
- if (ObjUtil.isNotNull(contractOutBound) && contractOutBound.getContractId().equals(contract.getId())) {
- ContractSubjectMatter subjectMatter = subjectMatterMapper.selectOne(Wrappers.<ContractSubjectMatter>lambdaQuery()
- .eq(ContractSubjectMatter::getMaterialCode, contractOutBound.getSubjectMatterCode())
- .eq(StrUtil.isNotBlank(contractOutBound.getLineNo()), ContractSubjectMatter::getLineNo, contractOutBound.getLineNo())
- .eq(ContractSubjectMatter::getContractId, contract.getId()).last("limit 1"));
- if (ObjUtil.isNotNull(subjectMatter) && ObjUtil.isNotNull(subjectMatter.getUnitPrice())) {
- contractBillAmount = contractBillAmount.add(outBoundInvoiceVo.getInvoiceNum().multiply(subjectMatter.getUnitPrice()));
- }
- contractOutBound.setInvoiceNum(contractOutBound.getInvoiceNum().subtract(outBoundInvoiceVo.getInvoiceNum()));
- contractOutBoundMapper.updateById(contractOutBound);
+ ContractOutBound contractOutBound = contractOutBoundMapper.selectById(outBoundInvoiceVo.getContractOutBoundId());
+ if (ObjUtil.isNotNull(contractOutBound) && contractOutBound.getContractId().equals(contract.getId())) {
+ ContractSubjectMatter subjectMatter = subjectMatterMapper.selectOne(Wrappers.<ContractSubjectMatter>lambdaQuery()
+ .eq(ContractSubjectMatter::getMaterialCode, contractOutBound.getSubjectMatterCode())
+ .eq(StrUtil.isNotBlank(contractOutBound.getLineNo()), ContractSubjectMatter::getLineNo, contractOutBound.getLineNo())
+ .eq(ContractSubjectMatter::getContractId, contract.getId()).last("limit 1"));
+ if (ObjUtil.isNotNull(subjectMatter) && ObjUtil.isNotNull(subjectMatter.getUnitPrice())) {
+ contractBillAmount = contractBillAmount.add(outBoundInvoiceVo.getInvoiceNum().multiply(subjectMatter.getUnitPrice()));
}
+ contractOutBound.setInvoiceNum(contractOutBound.getInvoiceNum().subtract(outBoundInvoiceVo.getInvoiceNum()));
+ contractOutBoundMapper.updateById(contractOutBound);
+ }
}
//鏇存柊鍚堝悓寮�绁ㄧ姸鎬� 鍓嶆彁鍑哄簱瀹屾垚
contract.setBillingStatus("2");
@@ -2160,7 +2224,7 @@
baseMapper.updateById(contractInvoice);
return R.ok();
}
- return R.failed(resultJson, "搴旀敹鍙戠エ闆嗘垚澶辫触");
+ return R.failed(result);
}
//绾㈢エ
if (StrUtil.equals(contractInvoice.getInvoiceCategory(), "2")) {
@@ -2179,7 +2243,7 @@
baseMapper.updateById(contractInvoice);
return R.ok();
}
- return R.failed(resultJson, "搴旀敹鍙戠エ鍒犻櫎澶辫触");
+ return R.failed(result);
}
return R.ok();
}
--
Gitblit v1.9.1