From a96b03a0604a307c11acd91fc42ca35ae9c04e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Thu, 23 Jul 2026 14:49:19 +0800 Subject: [PATCH 01/63] =?UTF-8?q?nc=E6=8E=A8=E9=80=81=E6=94=B9=E9=80=A0(?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=B8=AD);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/mapper/BillManageMapper.java | 2 + .../persistence/BillManageImpl.java | 763 ++++++++++++++++-- .../resources/mapper/BillManageMapper.xml | 4 + 3 files changed, 688 insertions(+), 81 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillManageMapper.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillManageMapper.java index 1a075701b..5a4edf3f3 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillManageMapper.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillManageMapper.java @@ -44,4 +44,6 @@ public interface BillManageMapper extends BaseMapper String getDeptName(@Param("dictCode") String dictCode); String getOrgCodeNc(@Param("organizationId") Long organizationId); + + Long getShipperId(@Param("userId") Long userId, @Param("organizationId") Long organizationId); } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java index 014e611f8..01fa77070 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java @@ -9,7 +9,9 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.mhd.bms.domain.billManage.entity.BillDetail; import com.mhd.bms.domain.billManage.entity.BillManage; +import com.mhd.bms.domain.billManage.repository.facade.IBillDetailService; import com.mhd.bms.domain.billManage.repository.facade.IBillManageService; import com.mhd.bms.domain.billManage.repository.mapper.BillManageMapper; import com.mhd.bms.domain.billManage.repository.po.BillManagePO; @@ -24,6 +26,8 @@ import com.mhd.bms.domain.ncDataPushConfig.entity.NcDataPushConfig; import com.mhd.bms.domain.ncDataPushConfig.repository.mapper.NcDataPushConfigMapper; import com.mhd.bms.domain.ncLog.entity.NcLog; import com.mhd.bms.domain.ncLog.repository.mapper.NcLogMapper; +import com.mhd.bms.domain.settlementCustomers.entity.SettlementCustomers; +import com.mhd.bms.domain.settlementCustomers.repository.facade.ISettlementCustomersService; import com.mhd.bms.interfaces.dto.billManage.BillManageDTO; import com.mhd.common.core.domain.dto.ReconciliationDTO; import com.mhd.common.core.domain.dto.nc.*; @@ -83,6 +87,8 @@ public class BillManageImpl extends ServiceImpl im @Autowired private BillManageMapper billManageMapper; @Autowired + private IBillDetailService billDetailService; + @Autowired private BmsInvoiceListMapper bmsInvoiceListMapper; //nc测试环境地址 @@ -103,6 +109,8 @@ public class BillManageImpl extends ServiceImpl im private BmsMakeOutInvoiceMapper bmsMakeOutInvoiceMapper; @Resource private BmsMakeOutInvoiceItemMapper bmsMakeOutInvoiceItemMapper; + @Autowired + private ISettlementCustomersService settlementCustomersService; /** * 查询账单管理列表 */ @@ -177,7 +185,6 @@ public class BillManageImpl extends ServiceImpl im return true; } - public boolean synchronousNc_TY(String businessDocumentDetaliId) { BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId); if(reconciliation.getSynchronousStatus()==1){ @@ -190,10 +197,13 @@ public class BillManageImpl extends ServiceImpl im SimpleDateFormat sdf2 = new SimpleDateFormat("MM"); String dateString = sdf.format(date); String invoiceId = reconciliation.getInvoiceId(); - List bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId)); - if (bmsMakeOutInvoices != null && bmsMakeOutInvoices.size() > 0){ +// List bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId)); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, businessDocumentDetaliId) + .eq(BillDetail::getDelFlag, 1)); + if (billDetails!=null && billDetails.size()>0){ int count = 0; - for (BmsMakeOutInvoice make : bmsMakeOutInvoices) { + for (BillDetail make : billDetails) { count++; List ysitemList=new ArrayList(); String url = ""; @@ -213,8 +223,19 @@ public class BillManageImpl extends ServiceImpl im String deptName = billManageMapper.getDeptName(customerUserDept); String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId); String salesmanCodeNc=salespersonNcCode; - String appointShipper=make.getActualInvoiceCustomerName(); - String actualInvoiceCustomerId = make.getActualInvoiceCustomerId(); + + Long settlementCustomersId = reconciliation.getSettlementCustomersId(); + SettlementCustomers settlementCustomers = settlementCustomersService.getById(settlementCustomersId); + if (settlementCustomers==null){ + throw new ServiceException("结算对象未找到!"); + } + Long settlementEntityId = settlementCustomers.getSettlementEntityId(); + Long shipperId = billManageMapper.getShipperId(settlementEntityId, organizationId); + if (shipperId==null||shipperId==0){ + throw new ServiceException("结算对象未找到!"); + } + String appointShipper=settlementCustomers.getSettlementEntity(); + String actualInvoiceCustomerId = String.valueOf(shipperId); String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId); String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId); if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) { @@ -241,85 +262,82 @@ public class BillManageImpl extends ServiceImpl im String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId); String makerCodeNc = documentPreparerNcCode; String settlementCurrencyNcCode = settlementCurrency; - String invoiceNumber=make.getInvoiceNumber(); - List bmsMakeOutInvoiceItems = bmsMakeOutInvoiceItemMapper.selectList(new LambdaQueryWrapper().eq(BmsMakeOutInvoiceItem::getMakeId, make.getId())); - if (bmsMakeOutInvoiceItems != null && bmsMakeOutInvoiceItems.size() > 0) { - for (BmsMakeOutInvoiceItem item1 : bmsMakeOutInvoiceItems) { - if(item1.getInvoiceValue().compareTo(BigDecimal.ZERO)>0){ - Ysitem item=new Ysitem(); - if (deptValue != null && !deptValue.isEmpty()) { - item.setSo_deptid(deptValue); - } else { - item.setSo_deptid("NG0408"); - } - if (deptValue != null && !deptValue.isEmpty()) { - item.setPk_deptid(deptValue); - } else { - item.setPk_deptid("NG0408"); - } - //业务员nc - item.setPk_psndoc(salesmanCodeNc); - //客户nc - item.setCustomer(customerCodeNc); - item.setObjtype("0"); - item.setDirection("1"); - String invoiceItem = item1.getInvoiceItem(); - List names = new ArrayList<>(); - List nccodes = new ArrayList<>(); - if (invoiceItem != null && !invoiceItem.isEmpty()) { - String[] items = invoiceItem.split(","); - for (String s : items) { - String invoiceItemName1 = billManageMapper.getInvoiceItemName(s); - String invoiceItemNcCode1 = billManageMapper.getInvoiceItemNcCode(s); - names.add(invoiceItemName1); - nccodes.add(invoiceItemNcCode1); - } - } - String invoiceItemName = String.join(",", names); - //item.setDef29(invoiceItemName); - if (deptName != null && !deptName.isEmpty()) { - item.setScomment(deptName+":应收"+appointShipper+invoiceItemName+invoiceNumber); - } else { - item.setScomment("业务部:应收"+appointShipper+invoiceItemName+invoiceNumber); - } - // item.setPk_currtype("CNY"); - item.setPk_currtype(settlementCurrencyNcCode); - item.setPurchaseorder(""); - item.setTaxrate(String.valueOf(item1.getTaxRate())); - item.setQuantity_de("0"); - item.setMoney_de(String.valueOf(item1.getInvoiceValue())); - item.setMoney_bal(String.valueOf(item1.getInvoiceValue())); - BigDecimal tax_de=item1.getTaxAmount(); - BigDecimal notax_de=item1.getTaxFreeFee(); - item.setNotax_de(String.valueOf(notax_de)); - item.setLocal_tax_de(String.valueOf(tax_de)); - item.setTax_de(String.valueOf(tax_de)); - item.setPrice(String.valueOf(item1.getInvoiceValue())); - item.setTaxprice(String.valueOf(item1.getInvoiceValue())); -// 费用类别 - String feeType = item1.getFeeType(); - String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType); - if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) { - item.setDef75(serviceItemsCodeNc); - } else { - item.setDef75("T04"); - } - String invoiceItem1 = item1.getInvoiceItem(); - if (invoiceItem1 != null && !invoiceItem1.isEmpty()) { - String[] split = invoiceItem1.split(","); - item.setDef29(split[0]); - //item.setDef29(invoiceItem1); - } - if (nccodes != null && !nccodes.isEmpty()&&nccodes.size()>0) { - item.setDef29(nccodes.get(0)); - } - item.setTaxcodeid("ZL01"); - item.setInvoiceno(invoiceNumber); - ysitemList.add(item); + + if(make.getBillingAmount().compareTo(BigDecimal.ZERO)>0){ + Ysitem item=new Ysitem(); + if (deptValue != null && !deptValue.isEmpty()) { + item.setSo_deptid(deptValue); + } else { + item.setSo_deptid("NG0408"); + } + if (deptValue != null && !deptValue.isEmpty()) { + item.setPk_deptid(deptValue); + } else { + item.setPk_deptid("NG0408"); + } + //业务员nc + item.setPk_psndoc(salesmanCodeNc); + //客户nc + item.setCustomer(customerCodeNc); + item.setObjtype("0"); + item.setDirection("1"); + String invoiceItem = make.getInvoiceItem(); + List names = new ArrayList<>(); + List nccodes = new ArrayList<>(); + if (invoiceItem != null && !invoiceItem.isEmpty()) { + String[] items = invoiceItem.split(","); + for (String s : items) { + String invoiceItemName1 = billManageMapper.getInvoiceItemName(s); + String invoiceItemNcCode1 = billManageMapper.getInvoiceItemNcCode(s); + names.add(invoiceItemName1); + nccodes.add(invoiceItemNcCode1); } } + String invoiceItemName = String.join(",", names); + //item.setDef29(invoiceItemName); + if (deptName != null && !deptName.isEmpty()) { + item.setScomment(deptName+":应收"+appointShipper+invoiceItemName); + } else { + item.setScomment("业务部:应收"+appointShipper+invoiceItemName); + } + // item.setPk_currtype("CNY"); + item.setPk_currtype(settlementCurrencyNcCode); + item.setPurchaseorder(""); + item.setTaxrate(String.valueOf(make.getTaxRate())); + item.setQuantity_de("0"); + item.setMoney_de(String.valueOf(make.getBillingAmount())); + item.setMoney_bal(String.valueOf(make.getBillingAmount())); + BigDecimal tax_de=make.getTaxAmount(); + BigDecimal notax_de=make.getTaxFreeFee(); + item.setNotax_de(String.valueOf(notax_de)); + item.setLocal_tax_de(String.valueOf(tax_de)); + item.setTax_de(String.valueOf(tax_de)); + item.setPrice(String.valueOf(make.getBillingAmount())); + item.setTaxprice(String.valueOf(make.getBillingAmount())); +// 费用类别 + String feeType = make.getFeeType(); + String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType); + if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) { + item.setDef75(serviceItemsCodeNc); + } else { + item.setDef75("T04"); + } + String invoiceItem1 = make.getInvoiceItem(); + if (invoiceItem1 != null && !invoiceItem1.isEmpty()) { + String[] split = invoiceItem1.split(","); + item.setDef29(split[0]); + //item.setDef29(invoiceItem1); + } + if (nccodes != null && !nccodes.isEmpty()&&nccodes.size()>0) { + item.setDef29(nccodes.get(0)); + } + item.setTaxcodeid("ZL01"); +// item.setInvoiceno(invoiceNumber); + ysitemList.add(item); } + + Ysbodys bodys=new Ysbodys(); bodys.setItem(ysitemList); Ysbillhead billhead=new Ysbillhead(); @@ -469,6 +487,298 @@ public class BillManageImpl extends ServiceImpl im return true; } + //按发票推送版本 +// public boolean synchronousNc_TY(String businessDocumentDetaliId) { +// BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId); +// if(reconciliation.getSynchronousStatus()==1){ +// throw new ServiceException("该记录已同步,不需要再次同步"); +// } +// try { +// Date date = reconciliation.getCreateTime(); +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy"); +// SimpleDateFormat sdf2 = new SimpleDateFormat("MM"); +// String dateString = sdf.format(date); +// String invoiceId = reconciliation.getInvoiceId(); +// List bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId)); +// if (bmsMakeOutInvoices != null && bmsMakeOutInvoices.size() > 0){ +// int count = 0; +// for (BmsMakeOutInvoice make : bmsMakeOutInvoices) { +// count++; +// List ysitemList=new ArrayList(); +// String url = ""; +// Long organizationId = reconciliation.getOrganizationId(); +// String organizationName = reconciliation.getOrganizationName(); +// String ncUrl = billManageMapper.getNcUrl("nc", organizationName, organizationId); +// if (ncUrl!=null&&ncUrl!="") { +// url = ncUrl; +// } else { +// reconciliation.setSynchronousStatus(2); +// billManageMapper.updateById(reconciliation); +// throw new ServiceException("未找到该组织的推送地址!"); +// } +// String salesmanId = reconciliation.getSalesmanId(); +// String customerUserDept = billManageMapper.getCustomerUserDept(salesmanId); +// String deptValue = billManageMapper.getDeptValue(customerUserDept); +// String deptName = billManageMapper.getDeptName(customerUserDept); +// String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId); +// String salesmanCodeNc=salespersonNcCode; +// String appointShipper=make.getActualInvoiceCustomerName(); +// String actualInvoiceCustomerId = make.getActualInvoiceCustomerId(); +// String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId); +// String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId); +// if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) { +// ObjectMapper objectMapper = new ObjectMapper(); +// List> listNc = objectMapper.readValue( +// customerCodeNcJson, +// new TypeReference>>() {} +// ); +// if (listNc != null && listNc.size() > 0) { +// Map targetMap = listNc.stream() +// .filter(map -> { +// Object codeObj = map.get("code"); +// return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString()); +// }) +// .findFirst() +// .orElse(null); +// if (targetMap != null) { +// customerCodeNc = (String) targetMap.get("ncCustomer"); +// } +// } +// } +// String settlementCurrency=reconciliation.getSettlementCurrency(); +// String orgCodeNc = billManageMapper.getOrgCodeNc(organizationId); +// String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId); +// String makerCodeNc = documentPreparerNcCode; +// String settlementCurrencyNcCode = settlementCurrency; +// String invoiceNumber=make.getInvoiceNumber(); +// List bmsMakeOutInvoiceItems = bmsMakeOutInvoiceItemMapper.selectList(new LambdaQueryWrapper().eq(BmsMakeOutInvoiceItem::getMakeId, make.getId())); +// if (bmsMakeOutInvoiceItems != null && bmsMakeOutInvoiceItems.size() > 0) { +// for (BmsMakeOutInvoiceItem item1 : bmsMakeOutInvoiceItems) { +// if(item1.getInvoiceValue().compareTo(BigDecimal.ZERO)>0){ +// Ysitem item=new Ysitem(); +// if (deptValue != null && !deptValue.isEmpty()) { +// item.setSo_deptid(deptValue); +// } else { +// item.setSo_deptid("NG0408"); +// } +// if (deptValue != null && !deptValue.isEmpty()) { +// item.setPk_deptid(deptValue); +// } else { +// item.setPk_deptid("NG0408"); +// } +// //业务员nc +// item.setPk_psndoc(salesmanCodeNc); +// //客户nc +// item.setCustomer(customerCodeNc); +// item.setObjtype("0"); +// item.setDirection("1"); +// String invoiceItem = item1.getInvoiceItem(); +// List names = new ArrayList<>(); +// List nccodes = new ArrayList<>(); +// if (invoiceItem != null && !invoiceItem.isEmpty()) { +// String[] items = invoiceItem.split(","); +// for (String s : items) { +// String invoiceItemName1 = billManageMapper.getInvoiceItemName(s); +// String invoiceItemNcCode1 = billManageMapper.getInvoiceItemNcCode(s); +// names.add(invoiceItemName1); +// nccodes.add(invoiceItemNcCode1); +// } +// } +// String invoiceItemName = String.join(",", names); +// //item.setDef29(invoiceItemName); +// if (deptName != null && !deptName.isEmpty()) { +// item.setScomment(deptName+":应收"+appointShipper+invoiceItemName+invoiceNumber); +// } else { +// item.setScomment("业务部:应收"+appointShipper+invoiceItemName+invoiceNumber); +// } +// // item.setPk_currtype("CNY"); +// item.setPk_currtype(settlementCurrencyNcCode); +// item.setPurchaseorder(""); +// item.setTaxrate(String.valueOf(item1.getTaxRate())); +// item.setQuantity_de("0"); +// item.setMoney_de(String.valueOf(item1.getInvoiceValue())); +// item.setMoney_bal(String.valueOf(item1.getInvoiceValue())); +// BigDecimal tax_de=item1.getTaxAmount(); +// BigDecimal notax_de=item1.getTaxFreeFee(); +// item.setNotax_de(String.valueOf(notax_de)); +// item.setLocal_tax_de(String.valueOf(tax_de)); +// item.setTax_de(String.valueOf(tax_de)); +// item.setPrice(String.valueOf(item1.getInvoiceValue())); +// item.setTaxprice(String.valueOf(item1.getInvoiceValue())); +//// 费用类别 +// String feeType = item1.getFeeType(); +// String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType); +// if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) { +// item.setDef75(serviceItemsCodeNc); +// } else { +// item.setDef75("T04"); +// } +// String invoiceItem1 = item1.getInvoiceItem(); +// if (invoiceItem1 != null && !invoiceItem1.isEmpty()) { +// String[] split = invoiceItem1.split(","); +// item.setDef29(split[0]); +// //item.setDef29(invoiceItem1); +// } +// if (nccodes != null && !nccodes.isEmpty()&&nccodes.size()>0) { +// item.setDef29(nccodes.get(0)); +// } +// item.setTaxcodeid("ZL01"); +// item.setInvoiceno(invoiceNumber); +// ysitemList.add(item); +// } +// } +// } +// +// Ysbodys bodys=new Ysbodys(); +// bodys.setItem(ysitemList); +// Ysbillhead billhead=new Ysbillhead(); +// billhead.setPk_group("CNK"); +// if (orgCodeNc != null && !orgCodeNc.isEmpty()) { +// billhead.setPk_org(orgCodeNc); +// billhead.setSett_org(orgCodeNc); +// } else { +// billhead.setPk_org("NG04"); +// billhead.setSett_org("NG04"); +// } +// billhead.setCreationtime(dateString); +// billhead.setCreator(makerCodeNc); +// billhead.setPk_billtype("F0"); +// billhead.setPk_tradetype("D0"); +// billhead.setBillclass("ys"); +// billhead.setIsinit("N"); +// date=reconciliation.getCreateTime(); +// dateString = sdf.format(date); +// billhead.setBilldate(dateString); +// billhead.setSyscode("0"); +// billhead.setBillno(""); +// billhead.setDef59(""); +// billhead.setSrc_syscode("0"); +// billhead.setBillstatus("0"); +// billhead.setBillmaker(makerCodeNc); +// billhead.setPk_busitype(""); +// billhead.setBillyear(sdf1.format(date)); +// billhead.setBillperiod(sdf2.format(date)); +// billhead.setEffectstatus("0"); +// billhead.setDef28("nqyw"); +// billhead.setDef29(reconciliation.getBillNumber()); +// billhead.setBodys(bodys); +// Ysbill bill=new Ysbill(); +// bill.setId("ys"+String.valueOf(reconciliation.getBillManageId())+"_"+count); +// bill.setBillhead(billhead); +// Ysufinterface ufinterface=new Ysufinterface(); +// ufinterface.setAccount("NKNC"); +// ufinterface.setBilltype("F0"); +// ufinterface.setBusinessunitcode(""); +// ufinterface.setFilename(""); +// ufinterface.setIsexchange("Y"); +// if (orgCodeNc != null && !orgCodeNc.isEmpty()) { +// ufinterface.setOrgcode(orgCodeNc); +// ufinterface.setReceiver(orgCodeNc); +// } else { +// ufinterface.setOrgcode("NG04"); +// ufinterface.setReceiver("NG04"); +// } +// ufinterface.setReplace("Y"); +// ufinterface.setRoottag(""); +// ufinterface.setSender("nqyw"); +// ufinterface.setBill(bill); +// JAXBContext jaxbContext = JAXBContext.newInstance(Ysufinterface.class); +// Marshaller marshaller = jaxbContext.createMarshaller(); +// marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); +// marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // 格式化输出,可选 +// StringWriter sw = new StringWriter(); +// marshaller.marshal(ufinterface, sw); +// String xmlString = sw.toString(); // 这是要发送的XML字符串 +// System.out.println(xmlString); +// NcLog ncLog=new NcLog(); +// ncLog.setOrderId(reconciliation.getBillManageId()); +// ncLog.setRequestBody(xmlString); +// ncLog.setResponeBody(""); +// ncLog.setType(0L); +// ncLog.setSendTime(new Date()); +// ncLog.setOrganizationId(reconciliation.getOrganizationId()); +// ncLog.setOrganizationName(reconciliation.getOrganizationName()); +// ncLog.setTopOrganizationId(reconciliation.getTopOrganizationId()); +// ncLogMapper.insert(ncLog); +// reconciliation.setSynchronousStatus(1); +// reconciliation.setSynchronousTime(new Date()); +// reconciliation.setNcId("ys"+String.valueOf(reconciliation.getBillManageId())); +// //reconciliationMapper.updateById(reconciliation); +// CloseableHttpClient httpClient = HttpClients.createDefault(); +// HttpPost httpPost = new HttpPost(url); +// StringEntity postingString = new StringEntity(xmlString, "UTF-8"); +// httpPost.setEntity(postingString); +// httpPost.setHeader("Content-type", "application/xml"); +// try { +// CloseableHttpResponse response = httpClient.execute(httpPost); +// String responseString = EntityUtils.toString(response.getEntity()); +// System.out.println(responseString); +// ncLog.setResponeBody(responseString); +// // 创建DOM解析器 +// DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); +// DocumentBuilder builder = factory.newDocumentBuilder(); +// Document document = builder.parse(new InputSource(new StringReader(responseString))); +// +// // 获取根元素 +// Element root = document.getDocumentElement(); +// +// // 获取ufinterface元素的属性 +// String billtype = root.getAttribute("billtype"); +// String filename = root.getAttribute("filename"); +// System.out.println("billtype: " + billtype); +// System.out.println("filename: " + filename); +// +// // 获取sendresult节点 +// NodeList sendResultList = root.getElementsByTagName("sendresult"); +// if (sendResultList.getLength() > 0) { +// Element sendResult = (Element) sendResultList.item(0); +// +// // 获取子元素内容 +// String bdocid = sendResult.getElementsByTagName("bdocid").item(0).getTextContent(); +// String resultcode = sendResult.getElementsByTagName("resultcode").item(0).getTextContent(); +// String content = sendResult.getElementsByTagName("content").item(0).getTextContent(); +// +// System.out.println("bdocid: " + bdocid); +// System.out.println("resultcode: " + resultcode); +// System.out.println("content: " + content); +// if(resultcode.equals("1")){ +// reconciliation.setSynchronousStatus(1); +// }else{ +// reconciliation.setSynchronousStatus(2); +// } +// } +// ncLogMapper.updateById(ncLog); +// billManageMapper.updateById(reconciliation); +// response.close(); +// } catch (Exception e) { +// reconciliation.setSynchronousStatus(2); +// billManageMapper.updateById(reconciliation); +// e.printStackTrace(); +// } finally { +// try { +// httpClient.close(); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } +// } +// } else { +// reconciliation.setSynchronousStatus(2); +// billManageMapper.updateById(reconciliation); +// } +// } catch (JAXBException e) { +// reconciliation.setSynchronousStatus(2); +// billManageMapper.updateById(reconciliation); +// e.printStackTrace(); +// } catch (JsonMappingException e) { +// throw new RuntimeException(e); +// } catch (JsonProcessingException e) { +// throw new RuntimeException(e); +// } +// return true; +// } + @Override public boolean synchronousNcSK(String businessDocumentDetaliIds) { String [] businessDocumentDetaliIdArray=businessDocumentDetaliIds.split(","); @@ -778,6 +1088,297 @@ public class BillManageImpl extends ServiceImpl im } return true; } + + //按发票推送版本 +// public boolean synchronousNcSK_TY(String businessDocumentDetaliId) { +// BillManage reconciliation=billManageMapper.selectById(businessDocumentDetaliId); +// if(reconciliation.getSkSynchronousStatus()==1){ +// throw new ServiceException("该记录已同步,不需要再次同步"); +// } +// try { +// Date date = reconciliation.getCreateTime(); +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy"); +// SimpleDateFormat sdf2 = new SimpleDateFormat("MM"); +// String dateString = sdf.format(date); +// String invoiceId = reconciliation.getInvoiceId(); +// ReconciliationDTO makeQuery=new ReconciliationDTO(); +// makeQuery.setInnerNumber(invoiceId); +// List bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId)); +// if (bmsMakeOutInvoices != null && bmsMakeOutInvoices.size() > 0) { +// int count= 0; +// for (BmsMakeOutInvoice make : bmsMakeOutInvoices) { +// count++; +// List ysitemList=new ArrayList(); +// ReconciliationDTO reconciliationDTO=new ReconciliationDTO(); +// reconciliationDTO.setInnerNumber(reconciliation.getBillNumber()); +// String url = ""; +// Long organizationId = reconciliation.getOrganizationId(); +// String orgCodeNc = billManageMapper.getOrgCodeNc(organizationId); +// String organizationName = reconciliation.getOrganizationName(); +// String ncUrl = billManageMapper.getNcUrl("nc", organizationName, organizationId); +// if (ncUrl!=null&&ncUrl!="") { +// url = ncUrl; +// } else { +// reconciliation.setSkSynchronousStatus(2); +// billManageMapper.updateById(reconciliation); +// throw new ServiceException("未找到该组织的推送地址!"); +// } +// List bmsMakeOutInvoiceItems = bmsMakeOutInvoiceItemMapper.selectList(new LambdaQueryWrapper().eq(BmsMakeOutInvoiceItem::getMakeId, make.getId())); +// String makerCodeNc = ""; +// if(bmsMakeOutInvoiceItems != null && bmsMakeOutInvoiceItems.size() > 0){ +// if(ObjectUtil.isNotNull(bmsMakeOutInvoiceItems)){ +// // 汇总 list 中 invoiceValue 的总值 +// BigDecimal totalInvoiceValue = bmsMakeOutInvoiceItems.stream() +// .map(BmsMakeOutInvoiceItem::getInvoiceValue) +// .filter(java.util.Objects::nonNull) +// .reduce(BigDecimal.ZERO, BigDecimal::add); +// +// // 将 feeType 用、拼接起来 +// String feeTypes = bmsMakeOutInvoiceItems.stream() +// .map(BmsMakeOutInvoiceItem::getFeeType) +// .filter(java.util.Objects::nonNull) +// .collect(java.util.stream.Collectors.joining("、")); +// +// // 按 createTime 倒序排序并获取第一条记录 +// BmsMakeOutInvoiceItem firstItem = bmsMakeOutInvoiceItems.stream() +// .sorted((a, b) -> { +// if (a.getCreateTime() == null) return 1; +// if (b.getCreateTime() == null) return -1; +// return b.getCreateTime().compareTo(a.getCreateTime()); +// }) +// .findFirst() +// .orElse(null); +// String salesmanId = reconciliation.getSalesmanId(); +// String customerUserDept = billManageMapper.getCustomerUserDept(salesmanId); +// String deptValue = billManageMapper.getDeptValue(customerUserDept); +// String deptName = billManageMapper.getDeptName(customerUserDept); +// String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId); +// String salesmanCodeNc=salespersonNcCode; +// String appointShipper=make.getActualInvoiceCustomerName(); +// String actualInvoiceCustomerId = make.getActualInvoiceCustomerId(); +// String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId); +// String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId); +// if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) { +// ObjectMapper objectMapper = new ObjectMapper(); +// List> listNc = objectMapper.readValue( +// customerCodeNcJson, +// new TypeReference>>() {} +// ); +// if (listNc != null && listNc.size() > 0) { +// Map targetMap = listNc.stream() +// .filter(map -> { +// Object codeObj = map.get("code"); +// return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString()); +// }) +// .findFirst() +// .orElse(null); +// if (targetMap != null) { +// customerCodeNc = (String) targetMap.get("ncCustomer"); +// } +// } +// } +// String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId); +// String settlementCurrency=reconciliation.getSettlementCurrency(); +// String settlementCurrencyNcCode = settlementCurrency; +// makerCodeNc=documentPreparerNcCode; +// SKitem item=new SKitem(); +// if (deptValue != null && !deptValue.isEmpty()) { +// item.setSo_deptid(deptValue); +// } else { +// item.setSo_deptid("NG0408"); +// } +// if (deptValue != null && !deptValue.isEmpty()) { +// item.setPk_deptid(deptValue); +// } else { +// item.setPk_deptid("NG0408"); +// } +// item.setCheckdirection("ar"); +// item.setPk_psndoc(salesmanCodeNc); +// item.setCustomer(customerCodeNc); +// item.setPurchaseorder(""); +// item.setObjtype("0"); +// item.setDirection("1"); +// if (deptName != null && !deptName.isEmpty()) { +// if (feeTypes != null && !feeTypes.isEmpty()) { +// item.setScomment(deptName+":"+appointShipper+feeTypes); +// } else { +// item.setScomment(deptName+":"+appointShipper+feeTypes); +// } +// } else { +// if (feeTypes != null && !feeTypes.isEmpty()) { +// item.setScomment("业务部:"+appointShipper+feeTypes); +// } else { +// item.setScomment("业务部:"+appointShipper+feeTypes); +// } +// } +// // 费用类别 +// String feeType = firstItem.getFeeType(); +// String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType); +// if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) { +// item.setDef75(serviceItemsCodeNc); +// } else { +// item.setDef75("T10"); +// } +// String invoiceItem1 = firstItem.getInvoiceItem(); +// if (invoiceItem1 != null && !invoiceItem1.isEmpty()) { +// String[] split = invoiceItem1.split(","); +// item.setDef29(split[0]); +// } +// item.setPk_currtype(settlementCurrencyNcCode); +// item.setMoney_cr(String.valueOf(totalInvoiceValue)); +// item.setMoney_bal(String.valueOf(totalInvoiceValue)); +// ysitemList.add(item); +// } +// } +// SKbodys bodys=new SKbodys(); +// bodys.setItem(ysitemList); +// SKbillhead billhead=new SKbillhead(); +// billhead.setPk_group("CNK"); +// if (orgCodeNc != null && !orgCodeNc.isEmpty()) { +// billhead.setPk_org(orgCodeNc); +// billhead.setSett_org(orgCodeNc); +// } else { +// billhead.setPk_org("NG04"); +// billhead.setSett_org("NG04"); +// } +// billhead.setCreationtime(dateString); +// billhead.setPk_billtype("F2"); +// billhead.setCreator(makerCodeNc); +// billhead.setPk_tradetype("D2"); +// billhead.setBillclass("sk"); +// billhead.setBilldate(dateString); +// billhead.setSyscode("0"); +// billhead.setBillno(""); +// billhead.setDef59(""); +// billhead.setSrc_syscode("0"); +// billhead.setBillstatus("0"); +// billhead.setBillmaker(makerCodeNc); +// billhead.setPk_busitype(""); +// billhead.setBillyear(sdf1.format(date)); +// billhead.setBillperiod(sdf2.format(date)); +// billhead.setEffectstatus("0"); +// billhead.setDef28("nqyw"); +// billhead.setDef29(reconciliation.getBillNumber()); +// billhead.setBodys(bodys); +// SKbill bill=new SKbill(); +// bill.setId("sk"+String.valueOf(reconciliation.getBillManageId())+"_"+count); +// bill.setBillhead(billhead); +// SKufinterface ufinterface=new SKufinterface(); +// ufinterface.setAccount("NKNC"); +// ufinterface.setBilltype("F2"); +// ufinterface.setBusinessunitcode(""); +// ufinterface.setFilename(""); +// ufinterface.setIsexchange("Y"); +// if (orgCodeNc != null && !orgCodeNc.isEmpty()) { +// ufinterface.setOrgcode(orgCodeNc); +// ufinterface.setReceiver(orgCodeNc); +// } else { +// ufinterface.setOrgcode("NG04"); +// ufinterface.setReceiver("NG04"); +// } +// ufinterface.setReplace("Y"); +// ufinterface.setRoottag(""); +// ufinterface.setSender("nqyw"); +// ufinterface.setBill(bill); +// JAXBContext jaxbContext = null; +// //String xmlString =""; +// jaxbContext = JAXBContext.newInstance(SKufinterface.class); +// Marshaller marshaller = jaxbContext.createMarshaller(); +// marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); +// marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // 格式化输出,可选 +// StringWriter sw = new StringWriter(); +// marshaller.marshal(ufinterface, sw); +// String xmlString = sw.toString(); // 这是要发送的XML字符串 +// System.out.println(xmlString); +// NcLog ncLog=new NcLog(); +// ncLog.setOrderId(reconciliation.getBillManageId()); +// ncLog.setRequestBody(xmlString); +// ncLog.setResponeBody(""); +// ncLog.setType(1L); +// ncLog.setSendTime(new Date()); +// ncLog.setOrganizationId(reconciliation.getOrganizationId()); +// ncLog.setOrganizationName(reconciliation.getOrganizationName()); +// ncLog.setTopOrganizationId(reconciliation.getTopOrganizationId()); +// ncLogMapper.insert(ncLog); +// reconciliation.setSkSynchronousStatus(1); +// reconciliation.setSkSynchronousTime(new Date()); +// reconciliation.setSkNcId("sk"+String.valueOf(reconciliation.getBillManageId())); +// //reconciliationMapper.updateById(reconciliation); +// CloseableHttpClient httpClient = HttpClients.createDefault(); +// HttpPost httpPost = new HttpPost(url); +// StringEntity postingString = new StringEntity(xmlString, "UTF-8"); +// httpPost.setEntity(postingString); +// httpPost.setHeader("Content-type", "application/xml"); +// try { +// CloseableHttpResponse response = httpClient.execute(httpPost); +// String responseString = EntityUtils.toString(response.getEntity()); +// System.out.println(responseString); +// ncLog.setResponeBody(responseString); +// // 创建DOM解析器 +// DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); +// DocumentBuilder builder = factory.newDocumentBuilder(); +// Document document = builder.parse(new InputSource(new StringReader(responseString))); +// +// // 获取根元素 +// Element root = document.getDocumentElement(); +// +// // 获取ufinterface元素的属性 +// String billtype = root.getAttribute("billtype"); +// String filename = root.getAttribute("filename"); +// System.out.println("billtype: " + billtype); +// System.out.println("filename: " + filename); +// +// // 获取sendresult节点 +// NodeList sendResultList = root.getElementsByTagName("sendresult"); +// if (sendResultList.getLength() > 0) { +// Element sendResult = (Element) sendResultList.item(0); +// +// // 获取子元素内容 +// String bdocid = sendResult.getElementsByTagName("bdocid").item(0).getTextContent(); +// String resultcode = sendResult.getElementsByTagName("resultcode").item(0).getTextContent(); +// String content = sendResult.getElementsByTagName("content").item(0).getTextContent(); +// +// System.out.println("bdocid: " + bdocid); +// System.out.println("resultcode: " + resultcode); +// System.out.println("content: " + content); +// if(resultcode.equals("1")){ +// reconciliation.setSkSynchronousStatus(1); +// }else{ +// reconciliation.setSkSynchronousStatus(2); +// } +// } +// ncLogMapper.updateById(ncLog); +// billManageMapper.updateById(reconciliation); +// response.close(); +// } catch (Exception e) { +// reconciliation.setSkSynchronousStatus(2); +// billManageMapper.updateById(reconciliation); +// e.printStackTrace(); +// } finally { +// try { +// httpClient.close(); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } +// +// } +// } else { +// reconciliation.setSkSynchronousStatus(2); +// billManageMapper.updateById(reconciliation); +// } +// } catch (JAXBException e) { +// reconciliation.setSkSynchronousStatus(2); +// billManageMapper.updateById(reconciliation); +// e.printStackTrace(); +// } catch (JsonMappingException e) { +// throw new RuntimeException(e); +// } catch (JsonProcessingException e) { +// throw new RuntimeException(e); +// } +// return true; +// } @Override diff --git a/mhd_bms/src/main/resources/mapper/BillManageMapper.xml b/mhd_bms/src/main/resources/mapper/BillManageMapper.xml index 6be84c7ad..398e298ce 100644 --- a/mhd_bms/src/main/resources/mapper/BillManageMapper.xml +++ b/mhd_bms/src/main/resources/mapper/BillManageMapper.xml @@ -162,4 +162,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT NC_CODE FROM NGWL_TEST_PRODUCT."SYS_ORGANIZATION" where DEL_FLAG = 1 and organization_id = #{organizationId} limit 1 + + \ No newline at end of file From 914a751d965d1a310f48df50905f5512be53deff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Thu, 23 Jul 2026 17:46:32 +0800 Subject: [PATCH 02/63] =?UTF-8?q?bms2.0=E5=BA=94=E6=94=B6=E5=8D=95?= =?UTF-8?q?=E5=92=8C=E6=94=B6=E6=AC=BE=E5=8D=95=E6=8E=A8=E9=80=81nc?= =?UTF-8?q?=E4=BF=AE=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/facade/IBillDetailService.java | 4 +- .../repository/mapper/BillDetailMapper.java | 4 +- .../persistence/BillDetailImpl.java | 7 +- .../persistence/BillManageImpl.java | 927 +++++++++--------- .../resources/mapper/BillDetailMapper.xml | 22 +- 5 files changed, 491 insertions(+), 473 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/facade/IBillDetailService.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/facade/IBillDetailService.java index f2cbe3d43..192395468 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/facade/IBillDetailService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/facade/IBillDetailService.java @@ -38,4 +38,6 @@ public interface IBillDetailService extends IService public BillDetailPO getInfo(Long billDetailId); List getDetailsByBillManageId(Long billManageId); -} + + List getDetailsByBillManageIdAndGroup(Long billManageId); +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillDetailMapper.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillDetailMapper.java index 1ea7709f4..b8fcdd9c5 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillDetailMapper.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillDetailMapper.java @@ -17,4 +17,6 @@ public interface BillDetailMapper extends BaseMapper { List getDetailsByBillManageId(@Param("billManageId") Long billManageId); -} + + List getDetailsByBillManageIdAndGroup(@Param("billManageId") Long billManageId); +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillDetailImpl.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillDetailImpl.java index cf62504d6..2aa419a1f 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillDetailImpl.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillDetailImpl.java @@ -75,4 +75,9 @@ public class BillDetailImpl extends ServiceImpl im public List getDetailsByBillManageId(Long billManageId) { return billDetailMapper.getDetailsByBillManageId(billManageId); } -} + + @Override + public List getDetailsByBillManageIdAndGroup(Long billManageId) { + return billDetailMapper.getDetailsByBillManageIdAndGroup(billManageId); + } +} \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java index 01fa77070..17872b7f1 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java @@ -197,72 +197,68 @@ public class BillManageImpl extends ServiceImpl im SimpleDateFormat sdf2 = new SimpleDateFormat("MM"); String dateString = sdf.format(date); String invoiceId = reconciliation.getInvoiceId(); -// List bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId)); - List billDetails = billDetailService.list(new LambdaQueryWrapper() - .eq(BillDetail::getBillManageId, businessDocumentDetaliId) - .eq(BillDetail::getDelFlag, 1)); - if (billDetails!=null && billDetails.size()>0){ - int count = 0; + List billDetails = billDetailService.getDetailsByBillManageIdAndGroup(Long.parseLong(businessDocumentDetaliId)); + + List ysitemList=new ArrayList(); + String url = ""; + Long organizationId = reconciliation.getOrganizationId(); + String organizationName = reconciliation.getOrganizationName(); + String ncUrl = billManageMapper.getNcUrl("nc", organizationName, organizationId); + if (ncUrl!=null&&ncUrl!="") { + url = ncUrl; + } else { + reconciliation.setSynchronousStatus(2); + billManageMapper.updateById(reconciliation); + throw new ServiceException("未找到该组织的推送地址!"); + } + String salesmanId = reconciliation.getSalesmanId(); + String customerUserDept = billManageMapper.getCustomerUserDept(salesmanId); + String deptValue = billManageMapper.getDeptValue(customerUserDept); + String deptName = billManageMapper.getDeptName(customerUserDept); + String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId); + String salesmanCodeNc=salespersonNcCode; + + Long settlementCustomersId = reconciliation.getSettlementCustomersId(); + SettlementCustomers settlementCustomers = settlementCustomersService.getById(settlementCustomersId); + if (settlementCustomers==null){ + throw new ServiceException("结算对象未找到!"); + } + Long settlementEntityId = settlementCustomers.getSettlementEntityId(); + Long shipperId = billManageMapper.getShipperId(settlementEntityId, organizationId); + if (shipperId==null||shipperId==0){ + throw new ServiceException("结算对象未找到!"); + } + String appointShipper=settlementCustomers.getSettlementEntity(); + String actualInvoiceCustomerId = String.valueOf(shipperId); + String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId); + String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId); + if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) { + ObjectMapper objectMapper = new ObjectMapper(); + List> listNc = objectMapper.readValue( + customerCodeNcJson, + new TypeReference>>() {} + ); + if (listNc != null && listNc.size() > 0) { + Map targetMap = listNc.stream() + .filter(map -> { + Object codeObj = map.get("code"); + return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString()); + }) + .findFirst() + .orElse(null); + if (targetMap != null) { + customerCodeNc = (String) targetMap.get("ncCustomer"); + } + } + } + String settlementCurrency=reconciliation.getSettlementCurrency(); + String orgCodeNc = billManageMapper.getOrgCodeNc(organizationId); + String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId); + String makerCodeNc = documentPreparerNcCode; + String settlementCurrencyNcCode = settlementCurrency; + + if (billDetails!=null&&billDetails.size()>0){ for (BillDetail make : billDetails) { - count++; - List ysitemList=new ArrayList(); - String url = ""; - Long organizationId = reconciliation.getOrganizationId(); - String organizationName = reconciliation.getOrganizationName(); - String ncUrl = billManageMapper.getNcUrl("nc", organizationName, organizationId); - if (ncUrl!=null&&ncUrl!="") { - url = ncUrl; - } else { - reconciliation.setSynchronousStatus(2); - billManageMapper.updateById(reconciliation); - throw new ServiceException("未找到该组织的推送地址!"); - } - String salesmanId = reconciliation.getSalesmanId(); - String customerUserDept = billManageMapper.getCustomerUserDept(salesmanId); - String deptValue = billManageMapper.getDeptValue(customerUserDept); - String deptName = billManageMapper.getDeptName(customerUserDept); - String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId); - String salesmanCodeNc=salespersonNcCode; - - Long settlementCustomersId = reconciliation.getSettlementCustomersId(); - SettlementCustomers settlementCustomers = settlementCustomersService.getById(settlementCustomersId); - if (settlementCustomers==null){ - throw new ServiceException("结算对象未找到!"); - } - Long settlementEntityId = settlementCustomers.getSettlementEntityId(); - Long shipperId = billManageMapper.getShipperId(settlementEntityId, organizationId); - if (shipperId==null||shipperId==0){ - throw new ServiceException("结算对象未找到!"); - } - String appointShipper=settlementCustomers.getSettlementEntity(); - String actualInvoiceCustomerId = String.valueOf(shipperId); - String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId); - String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId); - if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) { - ObjectMapper objectMapper = new ObjectMapper(); - List> listNc = objectMapper.readValue( - customerCodeNcJson, - new TypeReference>>() {} - ); - if (listNc != null && listNc.size() > 0) { - Map targetMap = listNc.stream() - .filter(map -> { - Object codeObj = map.get("code"); - return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString()); - }) - .findFirst() - .orElse(null); - if (targetMap != null) { - customerCodeNc = (String) targetMap.get("ncCustomer"); - } - } - } - String settlementCurrency=reconciliation.getSettlementCurrency(); - String orgCodeNc = billManageMapper.getOrgCodeNc(organizationId); - String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId); - String makerCodeNc = documentPreparerNcCode; - String settlementCurrencyNcCode = settlementCurrency; - if(make.getBillingAmount().compareTo(BigDecimal.ZERO)>0){ Ysitem item=new Ysitem(); if (deptValue != null && !deptValue.isEmpty()) { @@ -285,22 +281,18 @@ public class BillManageImpl extends ServiceImpl im List names = new ArrayList<>(); List nccodes = new ArrayList<>(); if (invoiceItem != null && !invoiceItem.isEmpty()) { - String[] items = invoiceItem.split(","); - for (String s : items) { - String invoiceItemName1 = billManageMapper.getInvoiceItemName(s); - String invoiceItemNcCode1 = billManageMapper.getInvoiceItemNcCode(s); - names.add(invoiceItemName1); - nccodes.add(invoiceItemNcCode1); - } + String invoiceItemName1 = billManageMapper.getInvoiceItemName(invoiceItem); + String invoiceItemNcCode1 = billManageMapper.getInvoiceItemNcCode(invoiceItem); + names.add(invoiceItemName1); + nccodes.add(invoiceItemNcCode1); } - String invoiceItemName = String.join(",", names); + String invoiceItemName = make.getInvoiceItemName(); //item.setDef29(invoiceItemName); if (deptName != null && !deptName.isEmpty()) { item.setScomment(deptName+":应收"+appointShipper+invoiceItemName); } else { item.setScomment("业务部:应收"+appointShipper+invoiceItemName); } - // item.setPk_currtype("CNY"); item.setPk_currtype(settlementCurrencyNcCode); item.setPurchaseorder(""); item.setTaxrate(String.valueOf(make.getTaxRate())); @@ -314,7 +306,7 @@ public class BillManageImpl extends ServiceImpl im item.setTax_de(String.valueOf(tax_de)); item.setPrice(String.valueOf(make.getBillingAmount())); item.setTaxprice(String.valueOf(make.getBillingAmount())); -// 费用类别 + //费用类别 String feeType = make.getFeeType(); String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType); if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) { @@ -324,157 +316,152 @@ public class BillManageImpl extends ServiceImpl im } String invoiceItem1 = make.getInvoiceItem(); if (invoiceItem1 != null && !invoiceItem1.isEmpty()) { - String[] split = invoiceItem1.split(","); - item.setDef29(split[0]); - //item.setDef29(invoiceItem1); + item.setDef29(invoiceItem1); } if (nccodes != null && !nccodes.isEmpty()&&nccodes.size()>0) { item.setDef29(nccodes.get(0)); } item.setTaxcodeid("ZL01"); -// item.setInvoiceno(invoiceNumber); + item.setInvoiceno(""); ysitemList.add(item); } + } + } + Ysbodys bodys=new Ysbodys(); + bodys.setItem(ysitemList); + Ysbillhead billhead=new Ysbillhead(); + billhead.setPk_group("CNK"); + if (orgCodeNc != null && !orgCodeNc.isEmpty()) { + billhead.setPk_org(orgCodeNc); + billhead.setSett_org(orgCodeNc); + } else { + billhead.setPk_org("NG04"); + billhead.setSett_org("NG04"); + } + billhead.setCreationtime(dateString); + billhead.setCreator(makerCodeNc); + billhead.setPk_billtype("F0"); + billhead.setPk_tradetype("D0"); + billhead.setBillclass("ys"); + billhead.setIsinit("N"); + date=reconciliation.getCreateTime(); + dateString = sdf.format(date); + billhead.setBilldate(dateString); + billhead.setSyscode("0"); + billhead.setBillno(""); + billhead.setDef59(""); + billhead.setSrc_syscode("0"); + billhead.setBillstatus("0"); + billhead.setBillmaker(makerCodeNc); + billhead.setPk_busitype(""); + billhead.setBillyear(sdf1.format(date)); + billhead.setBillperiod(sdf2.format(date)); + billhead.setEffectstatus("0"); + billhead.setDef28("nqyw"); + billhead.setDef29(reconciliation.getBillNumber()); + billhead.setBodys(bodys); + Ysbill bill=new Ysbill(); + bill.setId("ys"+String.valueOf(reconciliation.getBillManageId())+"_"+1); + bill.setBillhead(billhead); + Ysufinterface ufinterface=new Ysufinterface(); + ufinterface.setAccount("NKNC"); + ufinterface.setBilltype("F0"); + ufinterface.setBusinessunitcode(""); + ufinterface.setFilename(""); + ufinterface.setIsexchange("Y"); + if (orgCodeNc != null && !orgCodeNc.isEmpty()) { + ufinterface.setOrgcode(orgCodeNc); + ufinterface.setReceiver(orgCodeNc); + } else { + ufinterface.setOrgcode("NG04"); + ufinterface.setReceiver("NG04"); + } + ufinterface.setReplace("Y"); + ufinterface.setRoottag(""); + ufinterface.setSender("nqyw"); + ufinterface.setBill(bill); + JAXBContext jaxbContext = JAXBContext.newInstance(Ysufinterface.class); + Marshaller marshaller = jaxbContext.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // 格式化输出,可选 + StringWriter sw = new StringWriter(); + marshaller.marshal(ufinterface, sw); + String xmlString = sw.toString(); // 这是要发送的XML字符串 + System.out.println(xmlString); + NcLog ncLog=new NcLog(); + ncLog.setOrderId(reconciliation.getBillManageId()); + ncLog.setRequestBody(xmlString); + ncLog.setResponeBody(""); + ncLog.setType(0L); + ncLog.setSendTime(new Date()); + ncLog.setOrganizationId(reconciliation.getOrganizationId()); + ncLog.setOrganizationName(reconciliation.getOrganizationName()); + ncLog.setTopOrganizationId(reconciliation.getTopOrganizationId()); + ncLogMapper.insert(ncLog); + reconciliation.setSynchronousStatus(1); + reconciliation.setSynchronousTime(new Date()); + reconciliation.setNcId("ys"+String.valueOf(reconciliation.getBillManageId())); + //reconciliationMapper.updateById(reconciliation); + CloseableHttpClient httpClient = HttpClients.createDefault(); + HttpPost httpPost = new HttpPost(url); + StringEntity postingString = new StringEntity(xmlString, "UTF-8"); + httpPost.setEntity(postingString); + httpPost.setHeader("Content-type", "application/xml"); + try { + CloseableHttpResponse response = httpClient.execute(httpPost); + String responseString = EntityUtils.toString(response.getEntity()); + System.out.println(responseString); + ncLog.setResponeBody(responseString); + // 创建DOM解析器 + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document document = builder.parse(new InputSource(new StringReader(responseString))); + // 获取根元素 + Element root = document.getDocumentElement(); - Ysbodys bodys=new Ysbodys(); - bodys.setItem(ysitemList); - Ysbillhead billhead=new Ysbillhead(); - billhead.setPk_group("CNK"); - if (orgCodeNc != null && !orgCodeNc.isEmpty()) { - billhead.setPk_org(orgCodeNc); - billhead.setSett_org(orgCodeNc); - } else { - billhead.setPk_org("NG04"); - billhead.setSett_org("NG04"); - } - billhead.setCreationtime(dateString); - billhead.setCreator(makerCodeNc); - billhead.setPk_billtype("F0"); - billhead.setPk_tradetype("D0"); - billhead.setBillclass("ys"); - billhead.setIsinit("N"); - date=reconciliation.getCreateTime(); - dateString = sdf.format(date); - billhead.setBilldate(dateString); - billhead.setSyscode("0"); - billhead.setBillno(""); - billhead.setDef59(""); - billhead.setSrc_syscode("0"); - billhead.setBillstatus("0"); - billhead.setBillmaker(makerCodeNc); - billhead.setPk_busitype(""); - billhead.setBillyear(sdf1.format(date)); - billhead.setBillperiod(sdf2.format(date)); - billhead.setEffectstatus("0"); - billhead.setDef28("nqyw"); - billhead.setDef29(reconciliation.getBillNumber()); - billhead.setBodys(bodys); - Ysbill bill=new Ysbill(); - bill.setId("ys"+String.valueOf(reconciliation.getBillManageId())+"_"+count); - bill.setBillhead(billhead); - Ysufinterface ufinterface=new Ysufinterface(); - ufinterface.setAccount("NKNC"); - ufinterface.setBilltype("F0"); - ufinterface.setBusinessunitcode(""); - ufinterface.setFilename(""); - ufinterface.setIsexchange("Y"); - if (orgCodeNc != null && !orgCodeNc.isEmpty()) { - ufinterface.setOrgcode(orgCodeNc); - ufinterface.setReceiver(orgCodeNc); - } else { - ufinterface.setOrgcode("NG04"); - ufinterface.setReceiver("NG04"); - } - ufinterface.setReplace("Y"); - ufinterface.setRoottag(""); - ufinterface.setSender("nqyw"); - ufinterface.setBill(bill); - JAXBContext jaxbContext = JAXBContext.newInstance(Ysufinterface.class); - Marshaller marshaller = jaxbContext.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // 格式化输出,可选 - StringWriter sw = new StringWriter(); - marshaller.marshal(ufinterface, sw); - String xmlString = sw.toString(); // 这是要发送的XML字符串 - System.out.println(xmlString); - NcLog ncLog=new NcLog(); - ncLog.setOrderId(reconciliation.getBillManageId()); - ncLog.setRequestBody(xmlString); - ncLog.setResponeBody(""); - ncLog.setType(0L); - ncLog.setSendTime(new Date()); - ncLog.setOrganizationId(reconciliation.getOrganizationId()); - ncLog.setOrganizationName(reconciliation.getOrganizationName()); - ncLog.setTopOrganizationId(reconciliation.getTopOrganizationId()); - ncLogMapper.insert(ncLog); - reconciliation.setSynchronousStatus(1); - reconciliation.setSynchronousTime(new Date()); - reconciliation.setNcId("ys"+String.valueOf(reconciliation.getBillManageId())); - //reconciliationMapper.updateById(reconciliation); - CloseableHttpClient httpClient = HttpClients.createDefault(); - HttpPost httpPost = new HttpPost(url); - StringEntity postingString = new StringEntity(xmlString, "UTF-8"); - httpPost.setEntity(postingString); - httpPost.setHeader("Content-type", "application/xml"); - try { - CloseableHttpResponse response = httpClient.execute(httpPost); - String responseString = EntityUtils.toString(response.getEntity()); - System.out.println(responseString); - ncLog.setResponeBody(responseString); - // 创建DOM解析器 - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - Document document = builder.parse(new InputSource(new StringReader(responseString))); + // 获取ufinterface元素的属性 + String billtype = root.getAttribute("billtype"); + String filename = root.getAttribute("filename"); + System.out.println("billtype: " + billtype); + System.out.println("filename: " + filename); - // 获取根元素 - Element root = document.getDocumentElement(); + // 获取sendresult节点 + NodeList sendResultList = root.getElementsByTagName("sendresult"); + if (sendResultList.getLength() > 0) { + Element sendResult = (Element) sendResultList.item(0); - // 获取ufinterface元素的属性 - String billtype = root.getAttribute("billtype"); - String filename = root.getAttribute("filename"); - System.out.println("billtype: " + billtype); - System.out.println("filename: " + filename); + // 获取子元素内容 + String bdocid = sendResult.getElementsByTagName("bdocid").item(0).getTextContent(); + String resultcode = sendResult.getElementsByTagName("resultcode").item(0).getTextContent(); + String content = sendResult.getElementsByTagName("content").item(0).getTextContent(); - // 获取sendresult节点 - NodeList sendResultList = root.getElementsByTagName("sendresult"); - if (sendResultList.getLength() > 0) { - Element sendResult = (Element) sendResultList.item(0); - - // 获取子元素内容 - String bdocid = sendResult.getElementsByTagName("bdocid").item(0).getTextContent(); - String resultcode = sendResult.getElementsByTagName("resultcode").item(0).getTextContent(); - String content = sendResult.getElementsByTagName("content").item(0).getTextContent(); - - System.out.println("bdocid: " + bdocid); - System.out.println("resultcode: " + resultcode); - System.out.println("content: " + content); - if(resultcode.equals("1")){ - reconciliation.setSynchronousStatus(1); - }else{ - reconciliation.setSynchronousStatus(2); - } - } - ncLogMapper.updateById(ncLog); - billManageMapper.updateById(reconciliation); - response.close(); - } catch (Exception e) { + System.out.println("bdocid: " + bdocid); + System.out.println("resultcode: " + resultcode); + System.out.println("content: " + content); + if(resultcode.equals("1")){ + reconciliation.setSynchronousStatus(1); + }else{ reconciliation.setSynchronousStatus(2); - billManageMapper.updateById(reconciliation); - e.printStackTrace(); - } finally { - try { - httpClient.close(); - } catch (IOException e) { - e.printStackTrace(); - } } } - } else { + ncLogMapper.updateById(ncLog); + billManageMapper.updateById(reconciliation); + response.close(); + } catch (Exception e) { reconciliation.setSynchronousStatus(2); billManageMapper.updateById(reconciliation); + e.printStackTrace(); + } finally { + try { + httpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } } + + } catch (JAXBException e) { reconciliation.setSynchronousStatus(2); billManageMapper.updateById(reconciliation); @@ -810,273 +797,275 @@ public class BillManageImpl extends ServiceImpl im SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy"); SimpleDateFormat sdf2 = new SimpleDateFormat("MM"); String dateString = sdf.format(date); - String invoiceId = reconciliation.getInvoiceId(); - ReconciliationDTO makeQuery=new ReconciliationDTO(); - makeQuery.setInnerNumber(invoiceId); - List bmsMakeOutInvoices = bmsMakeOutInvoiceMapper.selectList(new LambdaQueryWrapper().eq(BmsMakeOutInvoice::getInvoiceId, invoiceId)); - if (bmsMakeOutInvoices != null && bmsMakeOutInvoices.size() > 0) { - int count= 0; - for (BmsMakeOutInvoice make : bmsMakeOutInvoices) { - count++; - List ysitemList=new ArrayList(); - ReconciliationDTO reconciliationDTO=new ReconciliationDTO(); - reconciliationDTO.setInnerNumber(reconciliation.getBillNumber()); - String url = ""; - Long organizationId = reconciliation.getOrganizationId(); - String orgCodeNc = billManageMapper.getOrgCodeNc(organizationId); - String organizationName = reconciliation.getOrganizationName(); - String ncUrl = billManageMapper.getNcUrl("nc", organizationName, organizationId); - if (ncUrl!=null&&ncUrl!="") { - url = ncUrl; - } else { - reconciliation.setSkSynchronousStatus(2); - billManageMapper.updateById(reconciliation); - throw new ServiceException("未找到该组织的推送地址!"); - } - List bmsMakeOutInvoiceItems = bmsMakeOutInvoiceItemMapper.selectList(new LambdaQueryWrapper().eq(BmsMakeOutInvoiceItem::getMakeId, make.getId())); - String makerCodeNc = ""; - if(bmsMakeOutInvoiceItems != null && bmsMakeOutInvoiceItems.size() > 0){ - if(ObjectUtil.isNotNull(bmsMakeOutInvoiceItems)){ - // 汇总 list 中 invoiceValue 的总值 - BigDecimal totalInvoiceValue = bmsMakeOutInvoiceItems.stream() - .map(BmsMakeOutInvoiceItem::getInvoiceValue) - .filter(java.util.Objects::nonNull) - .reduce(BigDecimal.ZERO, BigDecimal::add); + List billDetails = billDetailService.list(new LambdaQueryWrapper() + .eq(BillDetail::getBillManageId, reconciliation.getBillManageId()) + .eq(BillDetail::getDelFlag, 1)); - // 将 feeType 用、拼接起来 - String feeTypes = bmsMakeOutInvoiceItems.stream() - .map(BmsMakeOutInvoiceItem::getFeeType) - .filter(java.util.Objects::nonNull) - .collect(java.util.stream.Collectors.joining("、")); - - // 按 createTime 倒序排序并获取第一条记录 - BmsMakeOutInvoiceItem firstItem = bmsMakeOutInvoiceItems.stream() - .sorted((a, b) -> { - if (a.getCreateTime() == null) return 1; - if (b.getCreateTime() == null) return -1; - return b.getCreateTime().compareTo(a.getCreateTime()); - }) - .findFirst() - .orElse(null); - String salesmanId = reconciliation.getSalesmanId(); - String customerUserDept = billManageMapper.getCustomerUserDept(salesmanId); - String deptValue = billManageMapper.getDeptValue(customerUserDept); - String deptName = billManageMapper.getDeptName(customerUserDept); - String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId); - String salesmanCodeNc=salespersonNcCode; - String appointShipper=make.getActualInvoiceCustomerName(); - String actualInvoiceCustomerId = make.getActualInvoiceCustomerId(); - String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId); - String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId); - if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) { - ObjectMapper objectMapper = new ObjectMapper(); - List> listNc = objectMapper.readValue( - customerCodeNcJson, - new TypeReference>>() {} - ); - if (listNc != null && listNc.size() > 0) { - Map targetMap = listNc.stream() - .filter(map -> { - Object codeObj = map.get("code"); - return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString()); - }) - .findFirst() - .orElse(null); - if (targetMap != null) { - customerCodeNc = (String) targetMap.get("ncCustomer"); - } - } - } - String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId); - String settlementCurrency=reconciliation.getSettlementCurrency(); - String settlementCurrencyNcCode = settlementCurrency; - makerCodeNc=documentPreparerNcCode; - SKitem item=new SKitem(); - if (deptValue != null && !deptValue.isEmpty()) { - item.setSo_deptid(deptValue); - } else { - item.setSo_deptid("NG0408"); - } - if (deptValue != null && !deptValue.isEmpty()) { - item.setPk_deptid(deptValue); - } else { - item.setPk_deptid("NG0408"); - } - item.setCheckdirection("ar"); - item.setPk_psndoc(salesmanCodeNc); - item.setCustomer(customerCodeNc); - item.setPurchaseorder(""); - item.setObjtype("0"); - item.setDirection("1"); - if (deptName != null && !deptName.isEmpty()) { - if (feeTypes != null && !feeTypes.isEmpty()) { - item.setScomment(deptName+":"+appointShipper+feeTypes); - } else { - item.setScomment(deptName+":"+appointShipper+feeTypes); - } - } else { - if (feeTypes != null && !feeTypes.isEmpty()) { - item.setScomment("业务部:"+appointShipper+feeTypes); - } else { - item.setScomment("业务部:"+appointShipper+feeTypes); - } - } - // 费用类别 - String feeType = firstItem.getFeeType(); - String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType); - if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) { - item.setDef75(serviceItemsCodeNc); - } else { - item.setDef75("T10"); - } - String invoiceItem1 = firstItem.getInvoiceItem(); - if (invoiceItem1 != null && !invoiceItem1.isEmpty()) { - String[] split = invoiceItem1.split(","); - item.setDef29(split[0]); - } - item.setPk_currtype(settlementCurrencyNcCode); - item.setMoney_cr(String.valueOf(totalInvoiceValue)); - item.setMoney_bal(String.valueOf(totalInvoiceValue)); - ysitemList.add(item); - } - } - SKbodys bodys=new SKbodys(); - bodys.setItem(ysitemList); - SKbillhead billhead=new SKbillhead(); - billhead.setPk_group("CNK"); - if (orgCodeNc != null && !orgCodeNc.isEmpty()) { - billhead.setPk_org(orgCodeNc); - billhead.setSett_org(orgCodeNc); - } else { - billhead.setPk_org("NG04"); - billhead.setSett_org("NG04"); - } - billhead.setCreationtime(dateString); - billhead.setPk_billtype("F2"); - billhead.setCreator(makerCodeNc); - billhead.setPk_tradetype("D2"); - billhead.setBillclass("sk"); - billhead.setBilldate(dateString); - billhead.setSyscode("0"); - billhead.setBillno(""); - billhead.setDef59(""); - billhead.setSrc_syscode("0"); - billhead.setBillstatus("0"); - billhead.setBillmaker(makerCodeNc); - billhead.setPk_busitype(""); - billhead.setBillyear(sdf1.format(date)); - billhead.setBillperiod(sdf2.format(date)); - billhead.setEffectstatus("0"); - billhead.setDef28("nqyw"); - billhead.setDef29(reconciliation.getBillNumber()); - billhead.setBodys(bodys); - SKbill bill=new SKbill(); - bill.setId("sk"+String.valueOf(reconciliation.getBillManageId())+"_"+count); - bill.setBillhead(billhead); - SKufinterface ufinterface=new SKufinterface(); - ufinterface.setAccount("NKNC"); - ufinterface.setBilltype("F2"); - ufinterface.setBusinessunitcode(""); - ufinterface.setFilename(""); - ufinterface.setIsexchange("Y"); - if (orgCodeNc != null && !orgCodeNc.isEmpty()) { - ufinterface.setOrgcode(orgCodeNc); - ufinterface.setReceiver(orgCodeNc); - } else { - ufinterface.setOrgcode("NG04"); - ufinterface.setReceiver("NG04"); - } - ufinterface.setReplace("Y"); - ufinterface.setRoottag(""); - ufinterface.setSender("nqyw"); - ufinterface.setBill(bill); - JAXBContext jaxbContext = null; - //String xmlString =""; - jaxbContext = JAXBContext.newInstance(SKufinterface.class); - Marshaller marshaller = jaxbContext.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // 格式化输出,可选 - StringWriter sw = new StringWriter(); - marshaller.marshal(ufinterface, sw); - String xmlString = sw.toString(); // 这是要发送的XML字符串 - System.out.println(xmlString); - NcLog ncLog=new NcLog(); - ncLog.setOrderId(reconciliation.getBillManageId()); - ncLog.setRequestBody(xmlString); - ncLog.setResponeBody(""); - ncLog.setType(1L); - ncLog.setSendTime(new Date()); - ncLog.setOrganizationId(reconciliation.getOrganizationId()); - ncLog.setOrganizationName(reconciliation.getOrganizationName()); - ncLog.setTopOrganizationId(reconciliation.getTopOrganizationId()); - ncLogMapper.insert(ncLog); - reconciliation.setSkSynchronousStatus(1); - reconciliation.setSkSynchronousTime(new Date()); - reconciliation.setSkNcId("sk"+String.valueOf(reconciliation.getBillManageId())); - //reconciliationMapper.updateById(reconciliation); - CloseableHttpClient httpClient = HttpClients.createDefault(); - HttpPost httpPost = new HttpPost(url); - StringEntity postingString = new StringEntity(xmlString, "UTF-8"); - httpPost.setEntity(postingString); - httpPost.setHeader("Content-type", "application/xml"); - try { - CloseableHttpResponse response = httpClient.execute(httpPost); - String responseString = EntityUtils.toString(response.getEntity()); - System.out.println(responseString); - ncLog.setResponeBody(responseString); - // 创建DOM解析器 - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - Document document = builder.parse(new InputSource(new StringReader(responseString))); - - // 获取根元素 - Element root = document.getDocumentElement(); - - // 获取ufinterface元素的属性 - String billtype = root.getAttribute("billtype"); - String filename = root.getAttribute("filename"); - System.out.println("billtype: " + billtype); - System.out.println("filename: " + filename); - - // 获取sendresult节点 - NodeList sendResultList = root.getElementsByTagName("sendresult"); - if (sendResultList.getLength() > 0) { - Element sendResult = (Element) sendResultList.item(0); - - // 获取子元素内容 - String bdocid = sendResult.getElementsByTagName("bdocid").item(0).getTextContent(); - String resultcode = sendResult.getElementsByTagName("resultcode").item(0).getTextContent(); - String content = sendResult.getElementsByTagName("content").item(0).getTextContent(); - - System.out.println("bdocid: " + bdocid); - System.out.println("resultcode: " + resultcode); - System.out.println("content: " + content); - if(resultcode.equals("1")){ - reconciliation.setSkSynchronousStatus(1); - }else{ - reconciliation.setSkSynchronousStatus(2); - } - } - ncLogMapper.updateById(ncLog); - billManageMapper.updateById(reconciliation); - response.close(); - } catch (Exception e) { - reconciliation.setSkSynchronousStatus(2); - billManageMapper.updateById(reconciliation); - e.printStackTrace(); - } finally { - try { - httpClient.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - } + List ysitemList=new ArrayList(); + ReconciliationDTO reconciliationDTO=new ReconciliationDTO(); + reconciliationDTO.setInnerNumber(reconciliation.getBillNumber()); + String url = ""; + Long organizationId = reconciliation.getOrganizationId(); + String orgCodeNc = billManageMapper.getOrgCodeNc(organizationId); + String organizationName = reconciliation.getOrganizationName(); + String ncUrl = billManageMapper.getNcUrl("nc", organizationName, organizationId); + if (ncUrl!=null&&ncUrl!="") { + url = ncUrl; } else { reconciliation.setSkSynchronousStatus(2); billManageMapper.updateById(reconciliation); + throw new ServiceException("未找到该组织的推送地址!"); } + String makerCodeNc = ""; + if(billDetails != null && billDetails.size() > 0){ + if(ObjectUtil.isNotNull(billDetails)){ + // 汇总 list 中 invoiceValue 的总值 + BigDecimal totalInvoiceValue = billDetails.stream() + .map(BillDetail::getBillingAmount) + .filter(java.util.Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + + // 将 feeType 用、拼接起来 + String feeTypes = billDetails.stream() + .map(BillDetail::getInvoiceItemName) + .filter(java.util.Objects::nonNull) + .collect(java.util.stream.Collectors.joining("、")); + + // 按 createTime 倒序排序并获取第一条记录 + BillDetail firstItem = billDetails.stream() + .sorted((a, b) -> { + if (a.getCreateTime() == null) return 1; + if (b.getCreateTime() == null) return -1; + return b.getCreateTime().compareTo(a.getCreateTime()); + }) + .findFirst() + .orElse(null); + String salesmanId = reconciliation.getSalesmanId(); + String customerUserDept = billManageMapper.getCustomerUserDept(salesmanId); + String deptValue = billManageMapper.getDeptValue(customerUserDept); + String deptName = billManageMapper.getDeptName(customerUserDept); + String salespersonNcCode = billManageMapper.getsalespersonNcCode(salesmanId); + String salesmanCodeNc=salespersonNcCode; + Long settlementCustomersId = reconciliation.getSettlementCustomersId(); + SettlementCustomers settlementCustomers = settlementCustomersService.getById(settlementCustomersId); + if (settlementCustomers==null){ + throw new ServiceException("结算对象未找到!"); + } + Long settlementEntityId = settlementCustomers.getSettlementEntityId(); + Long shipperId = billManageMapper.getShipperId(settlementEntityId, organizationId); + if (shipperId==null||shipperId==0){ + throw new ServiceException("结算对象未找到!"); + } + String appointShipper=settlementCustomers.getSettlementEntity(); + String actualInvoiceCustomerId = String.valueOf(shipperId); + String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId); + String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId); + if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) { + ObjectMapper objectMapper = new ObjectMapper(); + List> listNc = objectMapper.readValue( + customerCodeNcJson, + new TypeReference>>() {} + ); + if (listNc != null && listNc.size() > 0) { + Map targetMap = listNc.stream() + .filter(map -> { + Object codeObj = map.get("code"); + return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString()); + }) + .findFirst() + .orElse(null); + if (targetMap != null) { + customerCodeNc = (String) targetMap.get("ncCustomer"); + } + } + } + String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId); + String settlementCurrency=reconciliation.getSettlementCurrency(); + String settlementCurrencyNcCode = settlementCurrency; + makerCodeNc=documentPreparerNcCode; + SKitem item=new SKitem(); + if (deptValue != null && !deptValue.isEmpty()) { + item.setSo_deptid(deptValue); + } else { + item.setSo_deptid("NG0408"); + } + if (deptValue != null && !deptValue.isEmpty()) { + item.setPk_deptid(deptValue); + } else { + item.setPk_deptid("NG0408"); + } + item.setCheckdirection("ar"); + item.setPk_psndoc(salesmanCodeNc); + item.setCustomer(customerCodeNc); + item.setPurchaseorder(""); + item.setObjtype("0"); + item.setDirection("1"); + if (deptName != null && !deptName.isEmpty()) { + if (feeTypes != null && !feeTypes.isEmpty()) { + item.setScomment(deptName+":"+appointShipper+feeTypes); + } else { + item.setScomment(deptName+":"+appointShipper+feeTypes); + } + } else { + if (feeTypes != null && !feeTypes.isEmpty()) { + item.setScomment("业务部:"+appointShipper+feeTypes); + } else { + item.setScomment("业务部:"+appointShipper+feeTypes); + } + } + // 费用类别 + String feeType = firstItem.getFeeType(); + String serviceItemsCodeNc = billManageMapper.getServiceItemsCodeNc(feeType); + if (serviceItemsCodeNc != null && !serviceItemsCodeNc.isEmpty()) { + item.setDef75(serviceItemsCodeNc); + } else { + item.setDef75("T10"); + } + String invoiceItem1 = firstItem.getInvoiceItem(); + if (invoiceItem1 != null && !invoiceItem1.isEmpty()) { + String[] split = invoiceItem1.split(","); + item.setDef29(split[0]); + } + item.setPk_currtype(settlementCurrencyNcCode); + item.setMoney_cr(String.valueOf(totalInvoiceValue)); + item.setMoney_bal(String.valueOf(totalInvoiceValue)); + ysitemList.add(item); + } + } + SKbodys bodys=new SKbodys(); + bodys.setItem(ysitemList); + SKbillhead billhead=new SKbillhead(); + billhead.setPk_group("CNK"); + if (orgCodeNc != null && !orgCodeNc.isEmpty()) { + billhead.setPk_org(orgCodeNc); + billhead.setSett_org(orgCodeNc); + } else { + billhead.setPk_org("NG04"); + billhead.setSett_org("NG04"); + } + billhead.setCreationtime(dateString); + billhead.setPk_billtype("F2"); + billhead.setCreator(makerCodeNc); + billhead.setPk_tradetype("D2"); + billhead.setBillclass("sk"); + billhead.setBilldate(dateString); + billhead.setSyscode("0"); + billhead.setBillno(""); + billhead.setDef59(""); + billhead.setSrc_syscode("0"); + billhead.setBillstatus("0"); + billhead.setBillmaker(makerCodeNc); + billhead.setPk_busitype(""); + billhead.setBillyear(sdf1.format(date)); + billhead.setBillperiod(sdf2.format(date)); + billhead.setEffectstatus("0"); + billhead.setDef28("nqyw"); + billhead.setDef29(reconciliation.getBillNumber()); + billhead.setBodys(bodys); + SKbill bill=new SKbill(); + bill.setId("sk"+String.valueOf(reconciliation.getBillManageId())+"_"+1); + bill.setBillhead(billhead); + SKufinterface ufinterface=new SKufinterface(); + ufinterface.setAccount("NKNC"); + ufinterface.setBilltype("F2"); + ufinterface.setBusinessunitcode(""); + ufinterface.setFilename(""); + ufinterface.setIsexchange("Y"); + if (orgCodeNc != null && !orgCodeNc.isEmpty()) { + ufinterface.setOrgcode(orgCodeNc); + ufinterface.setReceiver(orgCodeNc); + } else { + ufinterface.setOrgcode("NG04"); + ufinterface.setReceiver("NG04"); + } + ufinterface.setReplace("Y"); + ufinterface.setRoottag(""); + ufinterface.setSender("nqyw"); + ufinterface.setBill(bill); + JAXBContext jaxbContext = null; + //String xmlString =""; + jaxbContext = JAXBContext.newInstance(SKufinterface.class); + Marshaller marshaller = jaxbContext.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // 格式化输出,可选 + StringWriter sw = new StringWriter(); + marshaller.marshal(ufinterface, sw); + String xmlString = sw.toString(); // 这是要发送的XML字符串 + System.out.println(xmlString); + NcLog ncLog=new NcLog(); + ncLog.setOrderId(reconciliation.getBillManageId()); + ncLog.setRequestBody(xmlString); + ncLog.setResponeBody(""); + ncLog.setType(1L); + ncLog.setSendTime(new Date()); + ncLog.setOrganizationId(reconciliation.getOrganizationId()); + ncLog.setOrganizationName(reconciliation.getOrganizationName()); + ncLog.setTopOrganizationId(reconciliation.getTopOrganizationId()); + ncLogMapper.insert(ncLog); + reconciliation.setSkSynchronousStatus(1); + reconciliation.setSkSynchronousTime(new Date()); + reconciliation.setSkNcId("sk"+String.valueOf(reconciliation.getBillManageId())); + //reconciliationMapper.updateById(reconciliation); + CloseableHttpClient httpClient = HttpClients.createDefault(); + HttpPost httpPost = new HttpPost(url); + StringEntity postingString = new StringEntity(xmlString, "UTF-8"); + httpPost.setEntity(postingString); + httpPost.setHeader("Content-type", "application/xml"); + try { + CloseableHttpResponse response = httpClient.execute(httpPost); + String responseString = EntityUtils.toString(response.getEntity()); + System.out.println(responseString); + ncLog.setResponeBody(responseString); + // 创建DOM解析器 + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document document = builder.parse(new InputSource(new StringReader(responseString))); + + // 获取根元素 + Element root = document.getDocumentElement(); + + // 获取ufinterface元素的属性 + String billtype = root.getAttribute("billtype"); + String filename = root.getAttribute("filename"); + System.out.println("billtype: " + billtype); + System.out.println("filename: " + filename); + + // 获取sendresult节点 + NodeList sendResultList = root.getElementsByTagName("sendresult"); + if (sendResultList.getLength() > 0) { + Element sendResult = (Element) sendResultList.item(0); + + // 获取子元素内容 + String bdocid = sendResult.getElementsByTagName("bdocid").item(0).getTextContent(); + String resultcode = sendResult.getElementsByTagName("resultcode").item(0).getTextContent(); + String content = sendResult.getElementsByTagName("content").item(0).getTextContent(); + + System.out.println("bdocid: " + bdocid); + System.out.println("resultcode: " + resultcode); + System.out.println("content: " + content); + if(resultcode.equals("1")){ + reconciliation.setSkSynchronousStatus(1); + }else{ + reconciliation.setSkSynchronousStatus(2); + } + } + ncLogMapper.updateById(ncLog); + billManageMapper.updateById(reconciliation); + response.close(); + } catch (Exception e) { + reconciliation.setSkSynchronousStatus(2); + billManageMapper.updateById(reconciliation); + e.printStackTrace(); + } finally { + try { + httpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + } catch (JAXBException e) { reconciliation.setSkSynchronousStatus(2); billManageMapper.updateById(reconciliation); diff --git a/mhd_bms/src/main/resources/mapper/BillDetailMapper.xml b/mhd_bms/src/main/resources/mapper/BillDetailMapper.xml index e56269307..5c4d156ed 100644 --- a/mhd_bms/src/main/resources/mapper/BillDetailMapper.xml +++ b/mhd_bms/src/main/resources/mapper/BillDetailMapper.xml @@ -27,5 +27,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND bd.bill_manage_id = #{billManageId} + - + + \ No newline at end of file From 895c8d6a4b5536f4e5282f413d1932c4a3836565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Thu, 23 Jul 2026 17:48:19 +0800 Subject: [PATCH 03/63] =?UTF-8?q?=E5=8F=91=E6=B5=8B=E8=AF=95;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd_bms/src/main/resources/bootstrap.yml | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 8cc8bfd57..91f2f8a11 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 560febea1..03d48d2f4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index d976fcc98..ba9a45148 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 653f44d4b..688e5ea7c 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 238ec5f81..48d76d01e 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_bms/src/main/resources/bootstrap.yml b/mhd_bms/src/main/resources/bootstrap.yml index 1b1edd68f..5532be09f 100644 --- a/mhd_bms/src/main/resources/bootstrap.yml +++ b/mhd_bms/src/main/resources/bootstrap.yml @@ -18,15 +18,15 @@ spring: discovery: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.33.0.129:6010 +# server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.33.0.129:6010 +# server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置 From 8b9cd8c749f4c650770dd6e8bdd098c13976df1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 29 Jul 2026 14:57:31 +0800 Subject: [PATCH 04/63] =?UTF-8?q?=E5=A4=8D=E5=88=B6=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillManageApplicationService.java | 118 +++++------------- .../interfaces/facadeApi/BillManageApi.java | 6 +- 2 files changed, 35 insertions(+), 89 deletions(-) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java index bb1fc6170..e858436a1 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java @@ -476,105 +476,51 @@ public class BillManageApplicationService { } /** - * 复制账单 + * 复制账单-获取原账单数据供前端回显 + * 前端拿到数据后跳转到类似修改/新增账单的页面,用户修改后通过addBill接口提交新增 */ - @Transactional - public Boolean copyBill(BillManageDTO billManageDTO) { - LoginUser loginUser = SecurityUtils.getLoginUser(); - if (ObjectUtil.isNull(loginUser)) { - throw new DigitalLogisticsException(UserError.TIMEOUT); - } + public BillManagePO copyBill(BillManageDTO billManageDTO) { if (billManageDTO.getBillManageId() == null) { throw new ServiceException("原账单id不能为空"); } - // 1. 获取原账单信息 + // 获取原账单信息 BillManagePO originalBill = billManageDomainService.getInfo(billManageDTO.getBillManageId()); if (null == originalBill) { throw new ServiceException("原账单信息未找到"); } - // 2. 获取原账单明细 + // 获取原账单明细 List originalDetails = billDetailDomainService.getDetailsByBillManageId(billManageDTO.getBillManageId()); if (originalDetails == null || originalDetails.isEmpty()) { throw new ServiceException("原账单明细为空,无法复制"); } - // 3. 创建新账单,除账单编号外完全复制原账单 - String newBillNumber = OrderSequence.getOrderCode("ZD"); - BillManage newBill = new BillManage(); - BeanUtils.copyProperties(originalBill, newBill); - newBill.setBillManageId(null); - newBill.setBillNumber(newBillNumber); - newBill.setCreateBy(loginUser.getUserPo().getUserId()); - newBill.setCreateByName(loginUser.getUserPo().getUserName()); - newBill.setCreateTime(new Date()); - newBill.setUpdateBy(loginUser.getUserPo().getUserId()); - newBill.setUpdateByName(loginUser.getUserPo().getUserName()); - newBill.setUpdateTime(new Date()); - newBill.setDelFlag(1); - // 复制后重置状态字段为初始值 - // 账单状态、对账状态、发票状态重置 - newBill.setBillState(1); // 1-未确认 - newBill.setBillStep(1); // 1-发起对账 - newBill.setReconciliationStatus(0); // 1-暂未确认 - newBill.setIsInvoice(0); // 0-未索取 - // 实收=0,未收=账单金额 - newBill.setActualReceivedAmount(BigDecimal.ZERO); - newBill.setBillAmountUnsettled(newBill.getBillAmount()); - newBill.setBillAmountSettlement(BigDecimal.ZERO); - // NC同步状态重置 - newBill.setSynchronousStatus(0); // 0-未同步 - newBill.setSkSynchronousStatus(0); // 0-未同步 - // 清空发票、收款、推送相关字段 - newBill.setApplyNumber(null); // 发票申请单号 - newBill.setSettlementTime(null); // 收款时间 - newBill.setSynchronousTime(null); // 应收单推送时间 - newBill.setSkSynchronousTime(null); // 收款单推送时间 - newBill.setInvoiceId(null); // 发票表ID - newBill.setInvoiceMakeTime(null); // 开票时间 - newBill.setNcId(null); // nc唯一标识(应收) - newBill.setSkNcId(null); // nc唯一标识(收款) - // 保存新账单 - boolean flag = billManageDomainService.saveEntity(newBill); - if (!flag) { - throw new ServiceException("复制账单失败,请重试"); + // 重置关键字段为初始值,清空id等,方便前端回显后直接提交新增 + originalBill.setBillManageId(null); + originalBill.setBillNumber(null); + originalBill.setBillState(1); + originalBill.setBillStep(1); + originalBill.setReconciliationStatus(0); + originalBill.setIsInvoice(0); + originalBill.setActualReceivedAmount(BigDecimal.ZERO); + originalBill.setBillAmountUnsettled(originalBill.getBillAmount()); + originalBill.setBillAmountSettlement(BigDecimal.ZERO); + originalBill.setSynchronousStatus(0); + originalBill.setSkSynchronousStatus(0); + originalBill.setApplyNumber(null); + originalBill.setSettlementTime(null); + originalBill.setSynchronousTime(null); + originalBill.setSkSynchronousTime(null); + originalBill.setInvoiceId(null); + originalBill.setInvoiceMakeTime(null); + originalBill.setNcId(null); + originalBill.setSkNcId(null); + // 明细也清空id + for (BillDetailPO detail : originalDetails) { + detail.setBillDetailId(null); + detail.setBillManageId(null); + detail.setBillNumber(null); } - // 4. 复制账单明细 - List newDetailList = new ArrayList<>(); - for (BillDetailPO originalDetail : originalDetails) { - BillDetail newDetail = new BillDetail(); - BeanUtils.copyProperties(originalDetail, newDetail); - newDetail.setBillDetailId(null); - newDetail.setBillManageId(newBill.getBillManageId()); - newDetail.setBillNumber(newBillNumber); - newDetail.setCreateBy(loginUser.getUserPo().getUserId()); - newDetail.setCreateByName(loginUser.getUserPo().getUserName()); - newDetail.setCreateTime(new Date()); - newDetailList.add(newDetail); - } - Boolean flagTwo = billDetailDomainService.insertBatch(newDetailList); - // 5. 复制计费流水(billing_statement) - List originalStatements = billingStatementDomainService.getDetailsByManageId(billManageDTO.getBillManageId()); - boolean flagThree = true; - if (originalStatements != null && !originalStatements.isEmpty()) { - List newStatementList = new ArrayList<>(); - for (BillingStatementPO originalStatement : originalStatements) { - BillingStatement newStatement = new BillingStatement(); - BeanUtils.copyProperties(originalStatement, newStatement); - newStatement.setBillingStatementId(null); - newStatement.setBillManageId(newBill.getBillManageId()); - newStatement.setCreateBy(loginUser.getUserPo().getUserId()); - newStatement.setCreateByName(loginUser.getUserPo().getUserName()); - newStatement.setCreateTime(new Date()); - newStatementList.add(newStatement); - } - flagThree = billingStatementDomainService.saveEntityBatch(newStatementList); - } - // 6. 保存操作日志 - BillOperationLogDO billOperationLogDO = new BillOperationLogDO(); - billOperationLogDO.setBillManageId(newBill.getBillManageId()); - billOperationLogDO.setOperationInfo(StringUtils.format(BillLogsConstants.copy_bill_text, originalBill.getBillNumber(), newBillNumber)); - billOperationLogDO.setOperationType(1); - boolean three = billOperationLogDomainService.saveBillOperationLog(billOperationLogDO); - return flag && flagTwo && flagThree && three; + originalBill.setBillDetailPOList(originalDetails); + return originalBill; } /** diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java index bef4396b4..435d9499e 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java @@ -258,7 +258,7 @@ public class BillManageApi extends BaseController{ } - @ApiOperation("复制账单") + @ApiOperation("复制账单-获取原账单数据用于回显") @PostMapping("/copyBill") public AjaxResult copyBill(@RequestBody BillManageDTO billManageDTO) { @@ -266,8 +266,8 @@ public class BillManageApi extends BaseController{ throw new ServiceException("原账单id不能为空"); } try { - Boolean result = billManageApplicationService.copyBill(billManageDTO); - return toAjax(result); + BillManagePO result = billManageApplicationService.copyBill(billManageDTO); + return AjaxResult.success(result); }catch (Exception e){ return AjaxResult.error("复制账单失败:"+e.getMessage()); } From 92d53ad90d9c3523ca78824786def7ff5c96fb6d Mon Sep 17 00:00:00 2001 From: zhaoqing <3160641494@qq.com> Date: Wed, 29 Jul 2026 15:21:36 +0800 Subject: [PATCH 05/63] =?UTF-8?q?fix(bms):=E6=96=B0=E5=A2=9E=E5=90=88?= =?UTF-8?q?=E5=90=8C(=E8=B4=B9=E7=94=A8=E7=B1=BB=E5=88=AB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contractManageDetail/entity/ContractManageDetail.java | 6 ++++++ .../repository/po/ContractManageDetailPO.java | 6 ++++++ .../repository/todo/ContractManageDetailDO.java | 6 ++++++ .../dto/contractManageDetail/ContractManageDetailDTO.java | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/entity/ContractManageDetail.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/entity/ContractManageDetail.java index 8af878e6e..aafb47a9e 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/entity/ContractManageDetail.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/entity/ContractManageDetail.java @@ -98,4 +98,10 @@ public class ContractManageDetail extends BaseVOEntity{ @ApiModelProperty("单据类型") private String documentType; + @ApiModelProperty("费用类别编码") + private String serviceItemsCode; + + @ApiModelProperty("费用类别名称") + private String serviceItemsName; + } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/repository/po/ContractManageDetailPO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/repository/po/ContractManageDetailPO.java index a67500951..14f9c68fc 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/repository/po/ContractManageDetailPO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/repository/po/ContractManageDetailPO.java @@ -97,4 +97,10 @@ public class ContractManageDetailPO extends BaseVOEntity{ @ApiModelProperty("单据类型") private String documentType; + @ApiModelProperty("费用类别编码") + private String serviceItemsCode; + + @ApiModelProperty("费用类别名称") + private String serviceItemsName; + } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/repository/todo/ContractManageDetailDO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/repository/todo/ContractManageDetailDO.java index 0691d5915..57e2b6ac6 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/repository/todo/ContractManageDetailDO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/repository/todo/ContractManageDetailDO.java @@ -102,4 +102,10 @@ public class ContractManageDetailDO extends BaseVOEntity{ @ApiModelProperty("单据类型") private String documentType; + + @ApiModelProperty("费用类别编码") + private String serviceItemsCode; + + @ApiModelProperty("费用类别名称") + private String serviceItemsName; } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManageDetail/ContractManageDetailDTO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManageDetail/ContractManageDetailDTO.java index 92d2b4400..53ba7b99d 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManageDetail/ContractManageDetailDTO.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManageDetail/ContractManageDetailDTO.java @@ -102,4 +102,10 @@ public class ContractManageDetailDTO extends BaseVOEntity{ @ApiModelProperty("单据类型") private String documentType; + + @ApiModelProperty("费用类别编码") + private String serviceItemsCode; + + @ApiModelProperty("费用类别名称") + private String serviceItemsName; } \ No newline at end of file From 6c6649368cf37ebb3253be0316da8b0cc55af4a9 Mon Sep 17 00:00:00 2001 From: zhaoqing <3160641494@qq.com> Date: Wed, 29 Jul 2026 15:24:41 +0800 Subject: [PATCH 06/63] sql(bms) --- sql/bms20260729.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 sql/bms20260729.sql diff --git a/sql/bms20260729.sql b/sql/bms20260729.sql new file mode 100644 index 000000000..6d6613f12 --- /dev/null +++ b/sql/bms20260729.sql @@ -0,0 +1,6 @@ +ALTER TABLE NGWL_TEST_SYSTEM.CONTRACT_MANAGE_DETAIL + ADD (SERVICE_ITEMS_CODE VARCHAR(100), + SERVICE_ITEMS_NAME VARCHAR(200)); + +COMMENT ON COLUMN NGWL_TEST_SYSTEM.CONTRACT_MANAGE_DETAIL.SERVICE_ITEMS_CODE IS '费用类别编码(服务项编码)'; + COMMENT ON COLUMN NGWL_TEST_SYSTEM.CONTRACT_MANAGE_DETAIL.SERVICE_ITEMS_NAME IS '费用类别名称(服务项名称)'; \ No newline at end of file From 0d70450997021fe37979ca3775b0088ac015b854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 29 Jul 2026 15:51:11 +0800 Subject: [PATCH 07/63] =?UTF-8?q?=E8=B4=B9=E7=94=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillManageApplicationService.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java index e858436a1..ed933fa7c 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java @@ -360,6 +360,19 @@ public class BillManageApplicationService { billDetailDTO1.setFeeType(billDetailDTO1.getServiceItemsName()); }); } + //同步更新已有计费流水(调整账单时可修改已有费用) + List billDetailDTOListHasBillingStatementId = billDetailDTOList.stream() + .filter(billDetailDTO -> billDetailDTO.getBillingStatementId() != null) + .collect(Collectors.toList()); + for (BillDetailDTO billDetailDTO : billDetailDTOListHasBillingStatementId) { + BillingStatementDO billingStatementDO = new BillingStatementDO(); + BeanUtils.copyProperties(billDetailDTO, billingStatementDO); + billingStatementDO.setBillingStatementId(billDetailDTO.getBillingStatementId()); + billingStatementDO.setBillManageId(billManagePO.getBillManageId()); + billingStatementDO.setBillingState(3); + billingStatementDO.setAccountExpenseType(billDetailDTO.getBillType()); + billingStatementApplicationService.update(billingStatementDO); + } //保存账单明细 Boolean flag = billDetailDomainService.saveBatch(billDetailDTOList); //更新账单金额 @@ -464,6 +477,19 @@ public class BillManageApplicationService { item.setFeeType(item.getServiceItemsName()); }); } + //同步更新已有计费流水(新增账单时可修改已有费用) + List billDetailDTOListHasBillingStatementId = billDetailDTOList.stream() + .filter(item -> item.getBillingStatementId() != null) + .collect(Collectors.toList()); + for (BillDetailDTO billDetailDTO : billDetailDTOListHasBillingStatementId) { + BillingStatementDO billingStatementDO = new BillingStatementDO(); + BeanUtils.copyProperties(billDetailDTO, billingStatementDO); + billingStatementDO.setBillingStatementId(billDetailDTO.getBillingStatementId()); + billingStatementDO.setBillManageId(billManageDO.getBillManageId()); + billingStatementDO.setBillingState(3); + billingStatementDO.setAccountExpenseType(billDetailDTO.getBillType()); + billingStatementApplicationService.update(billingStatementDO); + } //保存账单明细 Boolean flagTwo = billDetailDomainService.saveBatch(billDetailDTOList); //保存操作记录 From fa6ccad9658bfcdae1e3286a707dc1e8d50bfeeb Mon Sep 17 00:00:00 2001 From: zhaoqing <3160641494@qq.com> Date: Wed, 29 Jul 2026 18:29:54 +0800 Subject: [PATCH 08/63] =?UTF-8?q?feat(bms):=E5=AF=BC=E5=87=BA=E5=BA=94?= =?UTF-8?q?=E6=94=B6=E8=B4=A6=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillManageApplicationService.java | 4 ++ .../interfaces/facadeApi/BillManageApi.java | 54 +++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java index ed933fa7c..3d90a5b76 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java @@ -133,8 +133,12 @@ public class BillManageApplicationService { List billManagePOS = billManageDomainService.queryList(billManageDO); for (BillManagePO billManagePO : billManagePOS) { String billNumber = billManagePO.getBillNumber(); // 获取账单编号 + // 原有 - 前端列表用,不变 List billDetails = billDetailMapper.selectList(new LambdaQueryWrapper().eq(BillDetail::getBillNumber, billNumber)); billManagePO.setBillDetailList(billDetails); + // 新增 - 导出用,LEFT JOIN billing_statement 拿到费用科目 + List billDetailPOs = billDetailMapper.getDetailsByBillManageId(billManagePO.getBillManageId()); + billManagePO.setBillDetailPOList(billDetailPOs); } return billManagePOS; } diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java index 435d9499e..f2816b63e 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/facadeApi/BillManageApi.java @@ -6,6 +6,8 @@ import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; +import java.io.IOException; +import java.net.URLEncoder; import com.mhd.bms.application.server.billManage.BillManageApplicationService; import com.mhd.bms.domain.billManage.repository.po.BillDetailPO; @@ -13,7 +15,9 @@ import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementDO; import com.mhd.bms.domain.ncLog.entity.NcLog; import com.mhd.bms.infrastructure.utils.UniqueKeyUtil; import com.mhd.bms.interfaces.dto.billingStatement.BillingStatementDTO; +import com.mhd.bms.interfaces.dto.billManage.BillManageExportVO; import com.mhd.common.core.exception.ServiceException; +import com.mhd.common.core.utils.poi.ExcelUtil; import com.mhd.common.log.annotation.Log; import com.mhd.common.log.enums.BusinessType; import com.mhd.common.redis.enums.RedisLockTypeEnum; @@ -31,6 +35,7 @@ import com.mhd.bms.domain.billManage.repository.todo.BillManageDO; import com.mhd.bms.domain.billManage.repository.po.BillManagePO; import com.mhd.bms.interfaces.assembler.billManage.BillManageAssembler; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; import com.mhd.common.core.web.controller.BaseController; import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.common.core.web.page.TableDataInfo; @@ -79,6 +84,55 @@ public class BillManageApi extends BaseController{ return AjaxResult.success(billManageApplicationService.listCount(billManageDO)); } + @ApiOperation("导出应收账单") + @GetMapping(value = "/exportReceivableList", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") + public void exportReceivableList(BillManageDTO billManageDTO, HttpServletResponse response) throws IOException + { + //转换实体 + BillManageDO billManageDO = new BillManageDO(); + BeanUtils.copyProperties(billManageDTO,billManageDO); + billManageDO.setBillType(1); + //查全部(不分页) + List list = billManageApplicationService.queryList(billManageDO); + + //扁平化处理:一条明细生成一行 + List exportList = new ArrayList<>(); + for (BillManagePO bill : list) { + List details = bill.getBillDetailPOList(); + if (details != null && !details.isEmpty()) { + for (BillDetailPO detail : details) { + BillManageExportVO vo = new BillManageExportVO(); + //复制全部账单头字段 + BeanUtils.copyProperties(bill, vo); + //覆盖明细字段 + vo.setFeeType(detail.getFeeType()); + vo.setServiceItemsCode(detail.getServiceItemsCode()); + vo.setServiceItemsName(detail.getServiceItemsName()); + vo.setFirstSubjectCode(detail.getFirstSubjectCode()); + vo.setFirstSubjectName(detail.getFirstSubjectName()); + vo.setSecondSubjectCode(detail.getSecondSubjectCode()); + vo.setSecondSubjectName(detail.getSecondSubjectName()); + vo.setBillingAmount(detail.getBillingAmount()); + exportList.add(vo); + } + } else { + //没有明细也要有一行 + BillManageExportVO vo = new BillManageExportVO(); + BeanUtils.copyProperties(bill, vo); + exportList.add(vo); + } + } + + //设置下载头,防止浏览器乱码 + String fileName = URLEncoder.encode("应收账单", "UTF-8").replaceAll("\\+", "%20"); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + + ExcelUtil util = new ExcelUtil<>(BillManageExportVO.class); + util.exportExcel(response, exportList, "应收账单"); + } + @ApiOperation("获取nc推送日志") @GetMapping(value = "/getNcLog") public AjaxResult getNcLog(@RequestParam(name = "billManageId") Long billManageId, @RequestParam(name = "type") Long type) From 5890660fe45ae3f411b16968113fc88818f6523f Mon Sep 17 00:00:00 2001 From: zhaoqing <3160641494@qq.com> Date: Wed, 29 Jul 2026 18:39:05 +0800 Subject: [PATCH 09/63] =?UTF-8?q?feat(bms):=E5=AF=BC=E5=87=BA=E5=BA=94?= =?UTF-8?q?=E6=94=B6=E8=B4=A6=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/billManage/BillManageExportVO.java | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageExportVO.java diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageExportVO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageExportVO.java new file mode 100644 index 000000000..e7ce56b74 --- /dev/null +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billManage/BillManageExportVO.java @@ -0,0 +1,145 @@ +package com.mhd.bms.interfaces.dto.billManage; + +import com.mhd.common.core.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +@ApiModel(value = "应收账单导出对象") +public class BillManageExportVO { + + /** ====== 原有账单头字段(与 BillManagePO 的 @Excel 一致) ====== */ + @Excel(name = "一级组织表ID") + private Long topOrganizationId; + + @Excel(name = "组织表ID") + private Long organizationId; + + @Excel(name = "组织名称") + private String organizationName; + + @Excel(name = "账单编号") + private String billNumber; + + @Excel(name = "账单类型", readConverterExp = "1=-应收,2-应付") + private Integer billType; + + @Excel(name = "账单状态", readConverterExp = "1=-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款") + private Integer billState; + + @Excel(name = "账单流程节点", readConverterExp = "1=-发起对账,2-客户确认,3-财务审核,4-收款/付款") + private Integer billStep; + + @Excel(name = "系统来源") + private String belongModule; + + @Excel(name = "系统来源code") + private String belongModuleCode; + + @Excel(name = "结算对象id") + private Long settlementCustomersId; + + @Excel(name = "结算对象code") + private String settlementCustomersCode; + + @Excel(name = "结算对象") + private String settlementEntity; + + @Excel(name = "账单总金额") + private BigDecimal billTotalAmount; + + @Excel(name = "优惠金额") + private BigDecimal billDiscountAmount; + + @Excel(name = "账单金额") + private BigDecimal billAmount; + + @Excel(name = "已收/付金额") + private BigDecimal billAmountSettlement; + + @Excel(name = "未收/付金额") + private BigDecimal billAmountUnsettled; + + @Excel(name = "期望金额") + private BigDecimal billExpectedAmount; + + @Excel(name = "对账状态", readConverterExp = "1=-暂未确认,2-申请调账,3-财务调账,4-核对无误") + private Integer reconciliationStatus; + + @Excel(name = "对账意见描述") + private String reconciliationOpinion; + + @Excel(name = "客户凭证地址") + private String voucherAddress; + + @Excel(name = "财务审核结果(1-同意,2-拒绝)") + private Integer financialReviewFlag; + + @Excel(name = "审核意见描述") + private String financialReviewOpinion; + + @Excel(name = "周期开始时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date cycleBeginTime; + + @Excel(name = "周期结束时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date cycleEndTime; + + @Excel(name = "收款/付款时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date settlementTime; + + @Excel(name = "备注") + private String billRemark; + + @Excel(name = "折扣百分比") + private BigDecimal billDiscount; + + @Excel(name = "折扣上限金额") + private BigDecimal billDiscountLimit; + + @Excel(name = "费用计算精度code") + private String costAccuracyCode; + + @Excel(name = "费用计算精度name") + private String costAccuracyName; + + @Excel(name = "尾数计算code") + private String tailCalculationCode; + + @Excel(name = "尾数计算name") + private String tailCalculationName; + + @Excel(name = "账单金额精度code") + private String amountAccuracyCode; + + @Excel(name = "账单金额精度name") + private String amountAccuracyName; + + /** ====== 新增明细字段(来源于 bill_detail + billing_statement) ====== */ + @Excel(name = "费用类别") + private String feeType; + + @Excel(name = "费用类型code") + private String serviceItemsCode; + + @Excel(name = "费用类型") + private String serviceItemsName; + + @Excel(name = "一级费用科目code") + private String firstSubjectCode; + + @Excel(name = "一级费用科目") + private String firstSubjectName; + + @Excel(name = "二级费用科目code") + private String secondSubjectCode; + + @Excel(name = "二级费用科目") + private String secondSubjectName; + + @Excel(name = "明细金额") + private BigDecimal billingAmount; +} From 1297f920be46ce860619dcbdec6e2f4f50ff318b Mon Sep 17 00:00:00 2001 From: zhaoqing <1670883518@qq.com> Date: Fri, 31 Jul 2026 14:59:20 +0800 Subject: [PATCH 10/63] =?UTF-8?q?fix(bms):=E5=8D=95=E6=8D=AE=E8=AE=A1?= =?UTF-8?q?=E8=B4=B9=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/BusinessDocumentMapper.xml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mhd_bms/src/main/resources/mapper/BusinessDocumentMapper.xml b/mhd_bms/src/main/resources/mapper/BusinessDocumentMapper.xml index 9c6f2ffcc..7e6608fe0 100644 --- a/mhd_bms/src/main/resources/mapper/BusinessDocumentMapper.xml +++ b/mhd_bms/src/main/resources/mapper/BusinessDocumentMapper.xml @@ -166,12 +166,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND contract_name like concat('%', #{businessDocumentDO.contractName}, '%') + + + - AND bill_amount like concat('%', #{businessDocumentDO.billAmount}, '%') + and bill_amount = #{businessDocumentDO.billAmount} - AND estimated_cost like concat('%', #{businessDocumentDO.estimatedCost}, '%') + AND estimated_cost = #{businessDocumentDO.estimatedCost} + + + AND first_subject_name like concat('%', #{businessDocumentDO.firstSubjectName}, '%') @@ -193,6 +199,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND document_type_code = #{businessDocumentDO.documentTypeCode} + + AND document_type_code = #{businessDocumentDO.salesmanId} + and business_document_id in From c5babe103e555261f6c71c3b97ec016dda6b8117 Mon Sep 17 00:00:00 2001 From: zhaoqing <3160641494@qq.com> Date: Fri, 31 Jul 2026 23:57:48 +0800 Subject: [PATCH 11/63] =?UTF-8?q?feat(sys):=E5=90=88=E5=90=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/basic/ExpenseAccountMapper.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/mhd-modules/mhd-system/src/main/resources/mapper/basic/ExpenseAccountMapper.xml b/mhd-modules/mhd-system/src/main/resources/mapper/basic/ExpenseAccountMapper.xml index 5b9d6288e..d34d5d030 100644 --- a/mhd-modules/mhd-system/src/main/resources/mapper/basic/ExpenseAccountMapper.xml +++ b/mhd-modules/mhd-system/src/main/resources/mapper/basic/ExpenseAccountMapper.xml @@ -148,6 +148,7 @@ AND a.top_organization_id = #{expenseAccountDO.topOrganizationId} AND a.subject_code = #{expenseAccountDO.subjectCode} AND a.status = 1 + LIMIT 1 From 55c958bde52bde5b21038d9623c68f547aa5ebea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 3 Aug 2026 16:13:10 +0800 Subject: [PATCH 12/63] =?UTF-8?q?=E5=8F=9130?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mhd-user-center/src/main/resources/bootstrap.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mhd-user-center/src/main/resources/bootstrap.yml b/mhd-user-center/src/main/resources/bootstrap.yml index 7b6baaea4..6bf4ff00a 100644 --- a/mhd-user-center/src/main/resources/bootstrap.yml +++ b/mhd-user-center/src/main/resources/bootstrap.yml @@ -20,15 +20,15 @@ spring: discovery: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 - server-addr: 10.33.0.129:6010 -# server-addr: 10.102.192.30:6848 +# server-addr: 10.33.0.129:6010 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 - server-addr: 10.33.0.129:6010 -# server-addr: 10.102.192.30:6848 +# server-addr: 10.33.0.129:6010 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置 From 076c915a4ce45e4211734ac422823381c8fbf021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Mon, 3 Aug 2026 16:23:38 +0800 Subject: [PATCH 13/63] =?UTF-8?q?=E5=8F=9131?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd-user-center/src/main/resources/bootstrap.yml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index e18484e8d..8cc8bfd57 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index e34bb9cd4..560febea1 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index e4a817238..d976fcc98 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 743be7c29..653f44d4b 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index dfac7337f..238ec5f81 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd-user-center/src/main/resources/bootstrap.yml b/mhd-user-center/src/main/resources/bootstrap.yml index 6bf4ff00a..dd13bfba5 100644 --- a/mhd-user-center/src/main/resources/bootstrap.yml +++ b/mhd-user-center/src/main/resources/bootstrap.yml @@ -21,14 +21,14 @@ spring: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置 From 9283cc9df869dd5569d95fdf739ed5ba5f85bc1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Mon, 3 Aug 2026 18:23:21 +0800 Subject: [PATCH 14/63] =?UTF-8?q?BI=E6=8A=A5=E8=A1=A8=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biReport/support/BiReportSnapshotMapperSupport.java | 2 ++ .../support/BiSnapshotWeeklyRandomDataBuilder.java | 4 ++++ .../biReport/vo/WarehouseTransportSituationVO.java | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java index 435c6108f..08ea5f912 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java @@ -53,6 +53,8 @@ public final class BiReportSnapshotMapperSupport { public static WarehouseTransportSituationVO emptyWarehouseTransportSituation() { return WarehouseTransportSituationVO.builder() .warehouseDistributionOnTimeRate(0d) + .appointmentTime("") + .workFloor("") .currentYearOrders(0L) .currentQuarterOrders(0) .currentMonthOrders(0) diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java index cb72d7b6a..2c4a3c24d 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java @@ -97,6 +97,8 @@ public final class BiSnapshotWeeklyRandomDataBuilder { } return WarehouseTransportSituationVO.builder() .warehouseDistributionOnTimeRate(jitterPercentDouble(Baseline.W_WH_RATE, r)) + .appointmentTime(Baseline.W_APPOINTMENT_TIME) + .workFloor(Baseline.W_WORK_FLOOR) .currentYearOrders(jitterLong(Baseline.W_YEAR_ORD, r)) .currentQuarterOrders(Math.max(0, jitterInt(Baseline.W_Q_ORD, r))) .currentMonthOrders(Math.max(0, jitterInt(Baseline.W_M_ORD, r))) @@ -373,6 +375,8 @@ public final class BiSnapshotWeeklyRandomDataBuilder { static final int[] COMP_INCOME_TREND = {195, 248, 302, 415, 366, 488}; static final double W_WH_RATE = 96.8; + static final String W_APPOINTMENT_TIME = "2026-08-03 09:30:00"; + static final String W_WORK_FLOOR = "一楼"; static final long W_YEAR_ORD = 612_800L; static final int W_Q_ORD = 198_600; static final int W_M_ORD = 28_440; diff --git a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/WarehouseTransportSituationVO.java b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/WarehouseTransportSituationVO.java index 01a6e8711..869dae950 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/WarehouseTransportSituationVO.java +++ b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/WarehouseTransportSituationVO.java @@ -19,6 +19,12 @@ public class WarehouseTransportSituationVO { @ApiModelProperty("仓配衔接准时率,单位:%") private Double warehouseDistributionOnTimeRate; + @ApiModelProperty("预约申请时间") + private String appointmentTime; + + @ApiModelProperty("作业楼层") + private String workFloor; + @ApiModelProperty("本年度订单,单位:单") private Long currentYearOrders; From a4a29c7c8e0bc3e51bccf92970b4be9c10f7a606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Mon, 3 Aug 2026 20:33:23 +0800 Subject: [PATCH 15/63] =?UTF-8?q?=E6=AD=A3=E5=BC=8F30?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mhd-bi/src/main/resources/bootstrap.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mhd-bi/src/main/resources/bootstrap.yml b/mhd-bi/src/main/resources/bootstrap.yml index fa1d95e1a..376c66f95 100644 --- a/mhd-bi/src/main/resources/bootstrap.yml +++ b/mhd-bi/src/main/resources/bootstrap.yml @@ -16,17 +16,17 @@ spring: # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 # server-addr: 10.102.192.5:6848 -# username: nacos -# password: manhuoda@2023 - #线上正式环境 - server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 + #线上正式环境 + server-addr: 10.102.192.30:6848 +# username: nacos +# password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From c58112a719fb4b598efdbf1a4ceefe6004d26fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Mon, 3 Aug 2026 20:43:22 +0800 Subject: [PATCH 16/63] =?UTF-8?q?=E6=AD=A3=E5=BC=8F31?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mhd-bi/src/main/resources/bootstrap.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mhd-bi/src/main/resources/bootstrap.yml b/mhd-bi/src/main/resources/bootstrap.yml index 376c66f95..b949b746f 100644 --- a/mhd-bi/src/main/resources/bootstrap.yml +++ b/mhd-bi/src/main/resources/bootstrap.yml @@ -19,14 +19,14 @@ spring: username: nacos password: manhuoda@2023 #线上正式环境 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 # username: nacos # password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 From d1ce20abae8eb8e079b272ae7b97e9dcb8b39328 Mon Sep 17 00:00:00 2001 From: zhaoqing <3160641494@qq.com> Date: Tue, 4 Aug 2026 10:29:48 +0800 Subject: [PATCH 17/63] =?UTF-8?q?feat(sys):=E5=90=88=E5=90=8C=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContractManageApplicationService.java | 47 ++++++++ .../ContractManageDetailDomainService.java | 25 +++++ .../ContractManageExportVO.java | 102 ++++++++++++++++++ .../contractManage/ContractManageApi.java | 22 ++++ 4 files changed, 196 insertions(+) create mode 100644 mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManage/ContractManageExportVO.java diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManage/ContractManageApplicationService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManage/ContractManageApplicationService.java index 96e150e9f..9013a1f84 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManage/ContractManageApplicationService.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/application/service/contractManage/ContractManageApplicationService.java @@ -1124,4 +1124,51 @@ public class ContractManageApplicationService { public ContractManagePO getGeneralContract() { return contractManageDomainService.getGeneralContract(); } + + /** + * 合同导出(合同头字段 + 明细拍平成一行一条明细) + */ + public List buildExportList(ContractManageDO contractManageDO) { + List contractList = this.queryList(contractManageDO); + List exportList = new ArrayList<>(); + if (contractList == null || contractList.isEmpty()) { + return exportList; + } + List contractManageIds = contractList.stream() + .map(ContractManagePO::getContractManageId) + .collect(Collectors.toList()); + Map> detailMap = contractManageDetailDomainService + .queryListByManageIds(contractManageIds).stream() + .collect(Collectors.groupingBy(ContractManageDetailPO::getContractManageId)); + + for (ContractManagePO contract : contractList) { + List details = detailMap.get(contract.getContractManageId()); + if (details != null && !details.isEmpty()) { + for (ContractManageDetailPO detail : details) { + ContractManageExportVO vo = new ContractManageExportVO(); + // 合同头字段整体复制 + BeanUtils.copyProperties(contract, vo); + // 明细字段显式赋值(合同头/明细存在同名字段,避免互相覆盖) + vo.setSubjectType(detail.getSubjectType()); + vo.setFirstSubjectCode(detail.getFirstSubjectCode()); + vo.setFirstSubjectName(detail.getFirstSubjectName()); + vo.setSecondSubjectCode(detail.getSecondSubjectCode()); + vo.setSecondSubjectName(detail.getSecondSubjectName()); + vo.setAccountingStrategy(detail.getAccountingStrategy()); + vo.setBillingAttributes(detail.getBillingAttributes()); + vo.setSubjectEffectiveDate(detail.getSubjectEffectiveDate()); + vo.setSubjectExpirationDate(detail.getSubjectExpirationDate()); + vo.setDocumentType(detail.getDocumentType()); + vo.setServiceItemsName(detail.getServiceItemsName()); + exportList.add(vo); + } + } else { + // 无明细的合同也保留一行头字段 + ContractManageExportVO vo = new ContractManageExportVO(); + BeanUtils.copyProperties(contract, vo); + exportList.add(vo); + } + } + return exportList; + } } \ No newline at end of file diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/service/ContractManageDetailDomainService.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/service/ContractManageDetailDomainService.java index 31a5a2ffa..5e5a14585 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/service/ContractManageDetailDomainService.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/domain/contractManageDetail/service/ContractManageDetailDomainService.java @@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Collection; import java.util.List; /** * 合同管理详情 @@ -95,5 +96,29 @@ public class ContractManageDetailDomainService { return resultList; } + /** + * 根据多个合同管理id批量查询合同科目详情(一次SQL查询,避免逐合同N+1) + * @param contractManageIds 合同管理id集合 + * @return 合同科目详情列表 + */ + public List queryListByManageIds(Collection contractManageIds) { + List resultList = new ArrayList<>(); + if (contractManageIds == null || contractManageIds.isEmpty()) { + return resultList; + } + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(ContractManageDetail::getContractManageId, contractManageIds); + queryWrapper.eq(ContractManageDetail::getDelFlag, 1); + List contractManageDetails = contractManageDetailService.list(queryWrapper); + if (contractManageDetails != null && contractManageDetails.size() > 0) { + for (ContractManageDetail contractManageDetail : contractManageDetails) { + ContractManageDetailPO contractManageDetailPO = new ContractManageDetailPO(); + BeanUtils.copyProperties(contractManageDetail, contractManageDetailPO); + resultList.add(contractManageDetailPO); + } + } + return resultList; + } + } diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManage/ContractManageExportVO.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManage/ContractManageExportVO.java new file mode 100644 index 000000000..dde51f867 --- /dev/null +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/dto/contractManage/ContractManageExportVO.java @@ -0,0 +1,102 @@ +package com.mhd.basic.interfaces.dto.contractManage; + +import com.mhd.common.core.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * 合同管理导出对象(合同头字段 + 科目明细字段,拍平为一行一条明细) + * + * @author gen + * @date 2024-06-07 + */ +@Data +@ApiModel(value = "合同管理导出对象", description = "合同管理导出对象(含明细)") +public class ContractManageExportVO { + + /** ====== 合同头字段(与 ContractManagePO 的 @Excel 一致) ====== */ + @Excel(name = "合同编号") + private String contractNumber; + + @Excel(name = "合同名称") + private String contractName; + + @Excel(name = "是否通用合同", readConverterExp = "1=是,2=否") + private Integer commonContractFlag; + + @Excel(name = "合同类型", readConverterExp = "1=仓储,2=运输,3=其他") + private Integer contractType; + + @Excel(name = "合同状态", readConverterExp = "1=未生效,2=使用中,3=已过期,4=已作废") + private Integer contractState; + + @Excel(name = "签订单位") + private String signingUnit; + + @Excel(name = "结算主体") + private String settlementCustomers; + + @Excel(name = "我司身份", readConverterExp = "1=甲方,2=乙方") + private Integer ourIdentity; + + @Excel(name = "账期", readConverterExp = "1=每月,2=双月,3=季度") + private Integer accountingPeriod; + + @Excel(name = "合同签订日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date signingDate; + + @Excel(name = "合同生效日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date effectiveDate; + + @Excel(name = "合同到期日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date expirationDate; + + @Excel(name = "组织名称") + private String organizationName; + + @Excel(name = "客户类型") + private String customerType; + + @Excel(name = "是否自动出账", readConverterExp = "1=是,2=否") + private Integer automaticFlag; + + @Excel(name = "备注") + private String remark; + + /** ====== 明细字段(来源于 contract_manage_detail) ====== */ + @Excel(name = "结算科目类型", readConverterExp = "1=通用,2=临时") + private Integer subjectType; + + @Excel(name = "一级费用科目code") + private String firstSubjectCode; + + @Excel(name = "一级费用科目") + private String firstSubjectName; + + @Excel(name = "二级费用科目code") + private String secondSubjectCode; + + @Excel(name = "二级费用科目") + private String secondSubjectName; + + @Excel(name = "计费策略") + private String accountingStrategy; + + @Excel(name = "计费周期") + private String billingAttributes; + + @Excel(name = "科目生效日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date subjectEffectiveDate; + + @Excel(name = "科目到期日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date subjectExpirationDate; + + @Excel(name = "单据类型") + private String documentType; + + @Excel(name = "费用类别") + private String serviceItemsName; +} diff --git a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/facade/contractManage/ContractManageApi.java b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/facade/contractManage/ContractManageApi.java index c48ef479b..139de36e1 100644 --- a/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/facade/contractManage/ContractManageApi.java +++ b/mhd-modules/mhd-system/src/main/java/com/mhd/basic/interfaces/facade/contractManage/ContractManageApi.java @@ -1,8 +1,11 @@ package com.mhd.basic.interfaces.facade.contractManage; +import java.io.IOException; +import java.net.URLEncoder; import java.util.List; import com.mhd.basic.interfaces.assember.contractManage.ContractManageAssembler; +import com.mhd.basic.interfaces.dto.contractManage.ContractManageExportVO; import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceDTO; import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceReturn; import io.swagger.annotations.ApiOperation; @@ -14,9 +17,11 @@ import com.mhd.basic.domain.contractManage.repository.todo.ContractManageDO; import com.mhd.basic.domain.contractManage.repository.po.ContractManagePO; import com.mhd.basic.application.service.contractManage.ContractManageApplicationService; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; import com.mhd.common.core.web.controller.BaseController; import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.common.core.web.page.TableDataInfo; +import com.mhd.common.core.utils.poi.ExcelUtil; /** * 合同管理Api @@ -205,7 +210,24 @@ public class ContractManageApi extends BaseController{ return AjaxResult.success(list); } + @ApiOperation("导出合同(含明细)") + @GetMapping(value = "/export", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") + public void export(ContractManageDTO contractManageDTO, HttpServletResponse response) throws IOException + { + //转换实体 + ContractManageDO contractManageDO = new ContractManageDO(); + BeanUtils.copyProperties(contractManageDTO, contractManageDO); + //查询全量(不分页)并拍平明细 + List list = contractManageApplicationService.buildExportList(contractManageDO); + //设置下载头,防止浏览器乱码 + String fileName = URLEncoder.encode("合同导出", "UTF-8").replaceAll("\\+", "%20"); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + ExcelUtil util = new ExcelUtil<>(ContractManageExportVO.class); + util.exportExcel(response, list, "合同导出"); + } } \ No newline at end of file From 38a04d6d3028f5c02cab45a5b9756d5f25e417f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Tue, 4 Aug 2026 14:12:00 +0800 Subject: [PATCH 18/63] =?UTF-8?q?BI=E6=9C=88=E5=8F=B0=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biReport/support/BiReportSnapshotMapperSupport.java | 4 ++-- .../support/BiSnapshotWeeklyRandomDataBuilder.java | 8 ++++---- .../biReport/vo/WarehouseTransportSituationVO.java | 6 ------ .../biReport/vo/platform/PlatformSurveillanceVO.java | 6 ++++++ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java index 08ea5f912..c1ecfcaf4 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java @@ -53,8 +53,6 @@ public final class BiReportSnapshotMapperSupport { public static WarehouseTransportSituationVO emptyWarehouseTransportSituation() { return WarehouseTransportSituationVO.builder() .warehouseDistributionOnTimeRate(0d) - .appointmentTime("") - .workFloor("") .currentYearOrders(0L) .currentQuarterOrders(0) .currentMonthOrders(0) @@ -82,6 +80,8 @@ public final class BiReportSnapshotMapperSupport { public static PlatformSurveillanceVO emptyPlatformSurveillance() { return PlatformSurveillanceVO.builder() + .appointmentTime("") + .workFloor("") .vehicles(Collections.emptyList()) .efficiencyStatistics(EfficiencyStatisticsVO.builder() .entryOvertimeRate(0).overtimeCount(0).platformOnTimeRate(0) diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java index 2c4a3c24d..07cc92b52 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java @@ -97,8 +97,6 @@ public final class BiSnapshotWeeklyRandomDataBuilder { } return WarehouseTransportSituationVO.builder() .warehouseDistributionOnTimeRate(jitterPercentDouble(Baseline.W_WH_RATE, r)) - .appointmentTime(Baseline.W_APPOINTMENT_TIME) - .workFloor(Baseline.W_WORK_FLOOR) .currentYearOrders(jitterLong(Baseline.W_YEAR_ORD, r)) .currentQuarterOrders(Math.max(0, jitterInt(Baseline.W_Q_ORD, r))) .currentMonthOrders(Math.max(0, jitterInt(Baseline.W_M_ORD, r))) @@ -215,6 +213,8 @@ public final class BiSnapshotWeeklyRandomDataBuilder { } return PlatformSurveillanceVO.builder() + .appointmentTime(Baseline.P_APPOINTMENT_TIME) + .workFloor(Baseline.P_WORK_FLOOR) .vehicles(vehicles) .efficiencyStatistics(eff) .platformOverview(overview) @@ -375,8 +375,6 @@ public final class BiSnapshotWeeklyRandomDataBuilder { static final int[] COMP_INCOME_TREND = {195, 248, 302, 415, 366, 488}; static final double W_WH_RATE = 96.8; - static final String W_APPOINTMENT_TIME = "2026-08-03 09:30:00"; - static final String W_WORK_FLOOR = "一楼"; static final long W_YEAR_ORD = 612_800L; static final int W_Q_ORD = 198_600; static final int W_M_ORD = 28_440; @@ -398,6 +396,8 @@ public final class BiSnapshotWeeklyRandomDataBuilder { static final String[] W_CUST_NAMES = {"华东冷链", "华南汽配", "西南快消", "华北家电", "跨境达"}; static final int[] W_CUST_AMT = {198, 172, 205, 189, 221}; + static final String P_APPOINTMENT_TIME = "2026-08-03 09:30:00"; + static final String P_WORK_FLOOR = "一楼"; static final String[][] P_PLATES = { {"粤A12345", "待入场", "#12", "88"}, {"闽D99887", "作业中", "#07", "142"}, diff --git a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/WarehouseTransportSituationVO.java b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/WarehouseTransportSituationVO.java index 869dae950..01a6e8711 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/WarehouseTransportSituationVO.java +++ b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/WarehouseTransportSituationVO.java @@ -19,12 +19,6 @@ public class WarehouseTransportSituationVO { @ApiModelProperty("仓配衔接准时率,单位:%") private Double warehouseDistributionOnTimeRate; - @ApiModelProperty("预约申请时间") - private String appointmentTime; - - @ApiModelProperty("作业楼层") - private String workFloor; - @ApiModelProperty("本年度订单,单位:单") private Long currentYearOrders; diff --git a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/PlatformSurveillanceVO.java b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/PlatformSurveillanceVO.java index 0efd4039f..07ec3d657 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/PlatformSurveillanceVO.java +++ b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/PlatformSurveillanceVO.java @@ -16,6 +16,12 @@ import java.util.List; @ApiModel("月台监测指标") public class PlatformSurveillanceVO { + @ApiModelProperty("预约申请时间") + private String appointmentTime; + + @ApiModelProperty("作业楼层") + private String workFloor; + @ApiModelProperty("作业车辆状态列表") private List vehicles; From 3feb3851e4d3fbf523f756c716c8543fa6bd3c5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Tue, 4 Aug 2026 14:27:17 +0800 Subject: [PATCH 19/63] 30 --- mhd-bi/src/main/resources/bootstrap.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mhd-bi/src/main/resources/bootstrap.yml b/mhd-bi/src/main/resources/bootstrap.yml index b949b746f..376c66f95 100644 --- a/mhd-bi/src/main/resources/bootstrap.yml +++ b/mhd-bi/src/main/resources/bootstrap.yml @@ -19,14 +19,14 @@ spring: username: nacos password: manhuoda@2023 #线上正式环境 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 # username: nacos # password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.31:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 From f84c7b0843cb024d9e7c832ff1d81e5d8c34b3b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Tue, 4 Aug 2026 16:34:41 +0800 Subject: [PATCH 20/63] =?UTF-8?q?BI=E6=9C=88=E5=8F=B0=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biReport/support/BiReportSnapshotMapperSupport.java | 2 -- .../support/BiSnapshotWeeklyRandomDataBuilder.java | 4 ++-- .../biReport/vo/platform/PlatformSurveillanceVO.java | 6 ------ .../biReport/vo/platform/PlatformVehicleItemVO.java | 6 ++++++ 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java index c1ecfcaf4..435c6108f 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biReport/support/BiReportSnapshotMapperSupport.java @@ -80,8 +80,6 @@ public final class BiReportSnapshotMapperSupport { public static PlatformSurveillanceVO emptyPlatformSurveillance() { return PlatformSurveillanceVO.builder() - .appointmentTime("") - .workFloor("") .vehicles(Collections.emptyList()) .efficiencyStatistics(EfficiencyStatisticsVO.builder() .entryOvertimeRate(0).overtimeCount(0).platformOnTimeRate(0) diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java index 07cc92b52..e34d40d82 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java @@ -127,6 +127,8 @@ public final class BiSnapshotWeeklyRandomDataBuilder { for (String[] row : Baseline.P_PLATES) { int dur = jitterInt(Integer.parseInt(row[3]), r); vehicles.add(PlatformVehicleItemVO.builder() + .appointmentTime(Baseline.P_APPOINTMENT_TIME) + .workFloor(Baseline.P_WORK_FLOOR) .plateNumber(row[0]) .status(row[1]) .platformId(row[2]) @@ -213,8 +215,6 @@ public final class BiSnapshotWeeklyRandomDataBuilder { } return PlatformSurveillanceVO.builder() - .appointmentTime(Baseline.P_APPOINTMENT_TIME) - .workFloor(Baseline.P_WORK_FLOOR) .vehicles(vehicles) .efficiencyStatistics(eff) .platformOverview(overview) diff --git a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/PlatformSurveillanceVO.java b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/PlatformSurveillanceVO.java index 07ec3d657..0efd4039f 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/PlatformSurveillanceVO.java +++ b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/PlatformSurveillanceVO.java @@ -16,12 +16,6 @@ import java.util.List; @ApiModel("月台监测指标") public class PlatformSurveillanceVO { - @ApiModelProperty("预约申请时间") - private String appointmentTime; - - @ApiModelProperty("作业楼层") - private String workFloor; - @ApiModelProperty("作业车辆状态列表") private List vehicles; diff --git a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/PlatformVehicleItemVO.java b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/PlatformVehicleItemVO.java index 8ec4ebc49..f98561c13 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/PlatformVehicleItemVO.java +++ b/mhd-bi/src/main/java/com/mhd/bi/interfaces/facadeApi/biReport/vo/platform/PlatformVehicleItemVO.java @@ -14,6 +14,12 @@ import lombok.NoArgsConstructor; @ApiModel("月台监测-作业车辆") public class PlatformVehicleItemVO { + @ApiModelProperty("预约申请时间") + private String appointmentTime; + + @ApiModelProperty("作业楼层") + private String workFloor; + @ApiModelProperty("车牌号码") private String plateNumber; From 93dd653ca9e700bdc3774978b5a6d4d38a330326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Tue, 4 Aug 2026 16:35:35 +0800 Subject: [PATCH 21/63] 31 --- mhd-bi/src/main/resources/bootstrap.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mhd-bi/src/main/resources/bootstrap.yml b/mhd-bi/src/main/resources/bootstrap.yml index 376c66f95..b949b746f 100644 --- a/mhd-bi/src/main/resources/bootstrap.yml +++ b/mhd-bi/src/main/resources/bootstrap.yml @@ -19,14 +19,14 @@ spring: username: nacos password: manhuoda@2023 #线上正式环境 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 # username: nacos # password: manhuoda@2023 config: # server-addr: 127.0.0.1:8848 # 线上测试环境配置 容器名+端口号 # server-addr: 10.33.0.129:6010 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 476d7c8b0e149626e5bae10612a5e57a6b294b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Tue, 4 Aug 2026 17:18:22 +0800 Subject: [PATCH 22/63] =?UTF-8?q?=E5=8F=91=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- .../domain/reviewOrder/repository/po/ReviewOrderPO.java | 9 +++++++++ 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 8cc8bfd57..91f2f8a11 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 560febea1..03d48d2f4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index d976fcc98..ba9a45148 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 653f44d4b..688e5ea7c 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 238ec5f81..48d76d01e 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/reviewOrder/repository/po/ReviewOrderPO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/reviewOrder/repository/po/ReviewOrderPO.java index 6317e37ea..719ac71c3 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/reviewOrder/repository/po/ReviewOrderPO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/reviewOrder/repository/po/ReviewOrderPO.java @@ -2,6 +2,8 @@ package com.mhd.wms.domain.reviewOrder.repository.po; import com.mhd.common.core.web.domain.BaseVOEntity; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -18,24 +20,28 @@ import java.util.List; @ApiModel(value = "复核单主表", description = "复核单主表展示") public class ReviewOrderPO extends BaseVOEntity { + @JsonSerialize(using = ToStringSerializer.class) @ApiModelProperty("复核单主键") private Long reviewOrderId; @ApiModelProperty("复核单号") private String reviewOrderNumber; + @JsonSerialize(using = ToStringSerializer.class) @ApiModelProperty("出库单ID") private Long outOrderId; @ApiModelProperty("出库单号") private String outOrderNumber; + @JsonSerialize(using = ToStringSerializer.class) @ApiModelProperty("组织ID") private Long organizationId; @ApiModelProperty("组织名称") private String organizationName; + @JsonSerialize(using = ToStringSerializer.class) @ApiModelProperty("一级组织ID") private Long topOrganizationId; @@ -50,6 +56,7 @@ public class ReviewOrderPO extends BaseVOEntity { @ApiModelProperty("复核下发时间") private Date issuedTime; + @JsonSerialize(using = ToStringSerializer.class) @ApiModelProperty("仓库ID") private Long warehouseId; @@ -59,6 +66,7 @@ public class ReviewOrderPO extends BaseVOEntity { @ApiModelProperty("仓库名称") private String warehouseName; + @JsonSerialize(using = ToStringSerializer.class) @ApiModelProperty("客户ID") private Long customerId; @@ -68,6 +76,7 @@ public class ReviewOrderPO extends BaseVOEntity { @ApiModelProperty("客户名称") private String customerName; + @JsonSerialize(using = ToStringSerializer.class) @ApiModelProperty("货主ID") private Long shipperId; From b80668145a440b7ec28e88233859f0510a63c4d3 Mon Sep 17 00:00:00 2001 From: hjx <577364224@qq.com> Date: Wed, 5 Aug 2026 09:49:19 +0800 Subject: [PATCH 23/63] =?UTF-8?q?feat=EF=BC=9A=E5=8F=82=E7=85=A7=20WMS=20?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E5=8D=95=E8=A7=84=E5=88=99=EF=BC=8C=E9=80=9A?= =?UTF-8?q?=E5=AE=87=E3=80=8C=E5=85=A5=E4=BB=93=E5=A7=94=E6=89=98=E5=8D=95?= =?UTF-8?q?=E3=80=8D=E9=9C=80=E6=96=B0=E5=A2=9E=E3=80=8C=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E3=80=8D=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BA=E5=BF=85=E5=A1=AB=E9=A1=B9=EF=BC=8C?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E3=80=8C=E5=85=A5=E5=BA=93=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E3=80=8D=E6=A0=A1=E9=AA=8C=E5=85=B7=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix:修复【入库管理-收货管理】中批量设置货物参数(数量/面积/体积/尺寸)时,部分字段留空导致已有数据被重置丢失的问题。 --- ...rvationStockInOrderApplicationService.java | 12 +- .../StatementStatisticsService.java | 12 ++ .../StockReceiptOrderApplicationService.java | 21 ++- .../ReceiptMaterialDetailImpl.java | 176 ++++++++++++++++-- 4 files changed, 188 insertions(+), 33 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderApplicationService.java index c0bb0bcce..348f3b829 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/service/ReservationStockInOrderApplicationService.java @@ -181,17 +181,9 @@ public class ReservationStockInOrderApplicationService { * 新增入库单 */ public Boolean insert(ReservationStockInOrderDO stockInOrderDO) { -// 如果仓库ID为空,从当前登录用户的关联仓库中获取 + // 仓库为必填项,前端必须选择入库仓库 if (stockInOrderDO.getWarehouseId() == null) { - LoginUser loginUser = SecurityUtils.getLoginUser(); - if (loginUser == null) { - throw new ServiceException("登录已失效,请重新登录"); - } - AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid()); - if (associationWarehouseCacheDO == null || associationWarehouseCacheDO.getWarehouseId() == null) { - throw new ServiceException("当前用户未配置关联仓库,请先配置仓库"); - } - stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId()); + throw new ServiceException("请选择入库仓库"); } //设置仓库 setWarehouseInfo(stockInOrderDO); diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/statementStatistics/StatementStatisticsService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/statementStatistics/StatementStatisticsService.java index 367e97829..f358a9a11 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/statementStatistics/StatementStatisticsService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/statementStatistics/StatementStatisticsService.java @@ -25,6 +25,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.lang.reflect.Field; +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -127,6 +128,17 @@ public class StatementStatisticsService { } } List immediateInventoryPOS = materialInventoryDomainService.queryImmediateInventoryList(immediateInventoryDO); + + // 库存数量合计:与列表同筛选条件、不分页统计全部库存数量,回填到每行 + if (!CollectionUtils.isEmpty(immediateInventoryPOS)) { + BigDecimal totalInventoryQuantity = materialInventoryDomainService.sumImmediateInventoryQuantity(immediateInventoryDO); + if (totalInventoryQuantity == null) { + totalInventoryQuantity = BigDecimal.ZERO; + } + BigDecimal finalTotal = totalInventoryQuantity; + immediateInventoryPOS.forEach(po -> po.setTotalInventoryQuantity(finalTotal)); + } + // 性能优化:批量获取批次属性,避免N+1查询问题 // 1. 收集所有唯一的materialBaseInfoId Set materialBaseInfoIdSet = immediateInventoryPOS.stream() diff --git a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockReceiptOrder/StockReceiptOrderApplicationService.java b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockReceiptOrder/StockReceiptOrderApplicationService.java index 355dc57d2..4cbf4c4cc 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/application/service/stockReceiptOrder/StockReceiptOrderApplicationService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/application/service/stockReceiptOrder/StockReceiptOrderApplicationService.java @@ -2220,24 +2220,31 @@ public class StockReceiptOrderApplicationService { } /** - * PDA 抄码收货不采集毛重、体积、面积:在装配前将对应请求字段置 0,避免 getInfo 带回的累计展示值被当作本次增量。 + * PDA 抄码收货不采集毛重、体积、面积:在装配前将对应请求字段置 null, + * 利用 MyBatis-Plus NOT_NULL 策略跳过这些字段,避免覆盖已有累计数据。 + * @param lines 收货明细列表 */ private static void normalizePdaCopyReceiptGrossVolumeAreaToZero(List lines) { + // 没有明细时,直接返回 if (CollectionUtils.isEmpty(lines)) { return; } + // 有明细时,遍历 for (ReceiptMaterialDetailDO line : lines) { + // 跳过 line 为 null if (line == null) { continue; } + // 在装配之前将字段置为 null if (isPdaCopyReceiptLine(line)) { - line.setReceiptGrossWeight(BigDecimal.ZERO); - line.setTotalGrossWeight(BigDecimal.ZERO); - line.setReceiptVolume(BigDecimal.ZERO); - line.setTotalVolume(BigDecimal.ZERO); - line.setReceiptArea(BigDecimal.ZERO); - line.setTotalArea(BigDecimal.ZERO); + line.setReceiptGrossWeight(null); + line.setTotalGrossWeight(null); + line.setReceiptVolume(null); + line.setTotalVolume(null); + line.setReceiptArea(null); + line.setTotalArea(null); } + // 递归,确保每一个子行都会独立通过 isPdaCopyReceiptLine 判断是否需要清字段 normalizePdaCopyReceiptGrossVolumeAreaToZero(line.getChildren()); } } diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/receiptMaterialDetail/repository/persistence/ReceiptMaterialDetailImpl.java b/mhd_wms/src/main/java/com/mhd/wms/domain/receiptMaterialDetail/repository/persistence/ReceiptMaterialDetailImpl.java index c9c533d42..5226eb019 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/receiptMaterialDetail/repository/persistence/ReceiptMaterialDetailImpl.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/receiptMaterialDetail/repository/persistence/ReceiptMaterialDetailImpl.java @@ -459,6 +459,7 @@ public class ReceiptMaterialDetailImpl extends ServiceImpl uniqueIds = collectReceiptDetailUniqueIds(receiptMaterialDetailDOList); - if (!uniqueIds.isEmpty()) { - IMaterialMoreDetailService.remove(new QueryWrapper() - .eq("order_number", receiptOrderNumber) - .in("material_detail_unique_id", uniqueIds) - .eq("del_flag", 1)); - } - } - IMaterialMoreDetailService.saveBatch(materialMoreDetailList); - } +// if (!CollectionUtils.isEmpty(materialMoreDetailList)){ +// String receiptOrderNumber = stockReceiptOrderDO.getReceiptOrderNumber(); +// if (StringUtils.isBlank(receiptOrderNumber) && !CollectionUtils.isEmpty(receiptMaterialDetailDOList)) { +// receiptOrderNumber = receiptMaterialDetailDOList.get(0).getReceiptOrderNumber(); +// } +// if (StringUtils.isNotBlank(receiptOrderNumber)) { +// java.util.Set uniqueIds = collectReceiptDetailUniqueIds(receiptMaterialDetailDOList); +// if (!uniqueIds.isEmpty()) { +// IMaterialMoreDetailService.remove(new QueryWrapper() +// .eq("order_number", receiptOrderNumber) +// .in("material_detail_unique_id", uniqueIds) +// .eq("del_flag", 1)); +// } +// } +// IMaterialMoreDetailService.saveBatch(materialMoreDetailList); +// } //批量新增序列号 if (!CollectionUtils.isEmpty(materialDetailSerialNumberList)){ inMaterialDetailSerialNumberService.saveBatch(materialDetailSerialNumberList); @@ -513,6 +519,144 @@ public class ReceiptMaterialDetailImpl extends ServiceImpl materialMoreDetailList, + StockReceiptOrderDO stockReceiptOrderDO, + List receiptMaterialDetailDOList) { + // 无批次属性则直接返回 + if (CollectionUtils.isEmpty(materialMoreDetailList)) { + return; + } + // 无收货单号无法做增量更新,退回全量插入 + String receiptOrderNumber = stockReceiptOrderDO.getReceiptOrderNumber(); + if (StringUtils.isBlank(receiptOrderNumber) && !CollectionUtils.isEmpty(receiptMaterialDetailDOList)) { + receiptOrderNumber = receiptMaterialDetailDOList.get(0).getReceiptOrderNumber(); + } + // 无收货单号无法做增量更新,退回全量插入 + if (StringUtils.isBlank(receiptOrderNumber)) { + IMaterialMoreDetailService.saveBatch(materialMoreDetailList); + return; + } + // 无明细唯一ID无法做增量更新,退回全量插入 + java.util.Set uniqueIds = collectReceiptDetailUniqueIds(receiptMaterialDetailDOList); + if (uniqueIds.isEmpty()) { + IMaterialMoreDetailService.saveBatch(materialMoreDetailList); + return; + } + // 查询已存在的批次属性记录 + List existingList = IMaterialMoreDetailService.list( + new QueryWrapper() + .eq("order_number", receiptOrderNumber) // 收货单号 + .in("material_detail_unique_id", uniqueIds) // 明细唯一ID + .eq("del_flag", 1)); // 删除标志 + // 按 materialDetailUniqueId + batchDetailId 构建索引 + Map existingMap = new HashMap<>(); + for (MaterialMoreDetail existing : existingList) { + String key = buildMaterialMoreDetailKey(existing.getMaterialDetailUniqueId(), existing.getBatchDetailId()); + existingMap.put(key, existing); + } + // 分离:需要更新的 以及 需要新增的;跳过空值(保留旧数据) + List toUpdate = new ArrayList<>(); + List toInsert = new ArrayList<>(); + for (MaterialMoreDetail incoming : materialMoreDetailList) { + // attributeValue 为空/空白时跳过,不覆盖已有数据 + if (StringUtils.isBlank(incoming.getAttributeValue())) { + continue; + } + // 按 materialDetailUniqueId + batchDetailId 构建索引 + String key = buildMaterialMoreDetailKey(incoming.getMaterialDetailUniqueId(), incoming.getBatchDetailId()); + // 已存在的批次属性记录 + MaterialMoreDetail existing = existingMap.get(key); + // 存在则更新 ,不存在则新增 + if (existing != null) { + // 设置主键走 update,保留已有记录的 id + incoming.setMaterialMoreDetailId(existing.getMaterialMoreDetailId()); + // 更新现有记录 + toUpdate.add(incoming); + } else { + // 插入新的记录 + toInsert.add(incoming); + } + } + // 判断需更新的记录是否存在,存在则更新 + if (!toUpdate.isEmpty()) { + IMaterialMoreDetailService.updateBatchById(toUpdate); + } + // 判断是否存在需新增的记录,存在则批量插入 + if (!toInsert.isEmpty()) { + IMaterialMoreDetailService.saveBatch(toInsert); + } + } + + /** + * 构建批次属性索引 + * @param materialDetailUniqueId 明细唯一ID + * @param batchDetailId 批次属性ID + * @return 批次属性索引 + */ + private static String buildMaterialMoreDetailKey(Long materialDetailUniqueId, Long batchDetailId) { + return (materialDetailUniqueId != null ? materialDetailUniqueId : "null") + "_" + + (batchDetailId != null ? batchDetailId : "null"); + } + + /** + * 将 total* 指标字段中值为 0 的置为 null。 + * MyBatis-Plus 默认 NOT_NULL 策略下,null 不参与 SET 子句,已有数据得以保留。 + * 注意:仅对「未填写」场景生效;用户确实需要填 0 的极端场景不受影响(因前端通常传 null 表示未填)。 + * @param receiptMaterialDetail 收货明细 + * 需保证 total* 字段已赋值。 + * 需保证 alreadyReceipt* 字段已赋值。 + * 静态方法修改 receiptMaterialDetail 参数 + **/ + private static void normalizeZeroMetricsToNull(ReceiptMaterialDetail receiptMaterialDetail) { + // entity 为 null 时直接返回 + if (receiptMaterialDetail == null) { + return; + } + // receiptMaterialDetail totalNetWeight 字段为 0 时置为 null + if (isZeroBigDecimal(receiptMaterialDetail.getTotalNetWeight())) { + receiptMaterialDetail.setTotalNetWeight(null); + } + // receiptMaterialDetail totalGrossWeight 字段为 0 时置为 null + if (isZeroBigDecimal(receiptMaterialDetail.getTotalGrossWeight())) { + receiptMaterialDetail.setTotalGrossWeight(null); + } + // receiptMaterialDetail totalVolume 字段为 0 时置为 null + if (isZeroBigDecimal(receiptMaterialDetail.getTotalVolume())) { + receiptMaterialDetail.setTotalVolume(null); + } + // receiptMaterialDetail totalArea 字段为 0 时置为 null + if (isZeroBigDecimal(receiptMaterialDetail.getTotalArea())) { + receiptMaterialDetail.setTotalArea(null); + } + // receiptMaterialDetail alreadyReceiptNetWeight 字段为 0 时置为 null + if (isZeroBigDecimal(receiptMaterialDetail.getAlreadyReceiptNetWeight())) { + receiptMaterialDetail.setAlreadyReceiptNetWeight(null); + } + // receiptMaterialDetail alreadyReceiptGrossWeight 字段为 0 时置为 null + if (isZeroBigDecimal(receiptMaterialDetail.getAlreadyReceiptGrossWeight())) { + receiptMaterialDetail.setAlreadyReceiptGrossWeight(null); + } + // receiptMaterialDetail alreadyReceiptVolume 字段为 0 时置为 null + if (isZeroBigDecimal(receiptMaterialDetail.getAlreadyReceiptVolume())) { + receiptMaterialDetail.setAlreadyReceiptVolume(null); + } + // receiptMaterialDetail alreadyReceiptArea 字段为 0 时置为 null + if (isZeroBigDecimal(receiptMaterialDetail.getAlreadyReceiptArea())) { + receiptMaterialDetail.setAlreadyReceiptArea(null); + } + } + + private static boolean isZeroBigDecimal(BigDecimal val) { + return val != null && val.compareTo(BigDecimal.ZERO) == 0; + } + private void setMore(ReceiptMaterialDetailDO receiptMaterialDetailDO) { List materialMoreDetailList = receiptMaterialDetailDO.getMaterialMoreDetailList(); if (!CollectionUtils.isEmpty(materialMoreDetailList)) { From 885d38565c800a30cc5738d228c393177d3ebeef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Wed, 5 Aug 2026 14:45:32 +0800 Subject: [PATCH 24/63] =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E5=8D=95=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E6=B7=BB=E5=8A=A0=E6=89=A7=E8=A1=8C=E5=8D=95=E4=BF=A1?= =?UTF-8?q?=E6=81=AF;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/SettlementCustomersMapper.xml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml b/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml index 54d6b7a3a..6bff7db29 100644 --- a/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml +++ b/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml @@ -200,10 +200,7 @@ AND ( a.organization_id = #{settlementCustomersDO.organizationId} - OR b.org_code LIKE concat('%"code":"', #{settlementCustomersDO.organizationId}, '"%') - OR b.org_code LIKE concat('%code:', #{settlementCustomersDO.organizationId}, '%') - OR b.org_code LIKE concat('%code: ', #{settlementCustomersDO.organizationId}, '%') - OR b.org_code LIKE concat('%"code":', #{settlementCustomersDO.organizationId}, '%') + OR b.org_code LIKE concat('%', #{settlementCustomersDO.organizationId}, '%') ) @@ -216,4 +213,4 @@ and a.customer_type_code = #{settlementCustomersDO.customerTypeCode} - + \ No newline at end of file From f1567eb81e31a6bb56c9b732ecda29060537e8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Wed, 5 Aug 2026 14:48:09 +0800 Subject: [PATCH 25/63] =?UTF-8?q?=E6=9F=A5=E8=B4=A7=E4=B8=BB=E5=8D=A1?= =?UTF-8?q?=E6=AD=BB;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/SettlementCustomersMapper.xml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml b/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml index 54d6b7a3a..6bff7db29 100644 --- a/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml +++ b/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml @@ -200,10 +200,7 @@ AND ( a.organization_id = #{settlementCustomersDO.organizationId} - OR b.org_code LIKE concat('%"code":"', #{settlementCustomersDO.organizationId}, '"%') - OR b.org_code LIKE concat('%code:', #{settlementCustomersDO.organizationId}, '%') - OR b.org_code LIKE concat('%code: ', #{settlementCustomersDO.organizationId}, '%') - OR b.org_code LIKE concat('%"code":', #{settlementCustomersDO.organizationId}, '%') + OR b.org_code LIKE concat('%', #{settlementCustomersDO.organizationId}, '%') ) @@ -216,4 +213,4 @@ and a.customer_type_code = #{settlementCustomersDO.customerTypeCode} - + \ No newline at end of file From 7a6c570a88aab20e81e8ab44cbefdc2cc2e50eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Wed, 5 Aug 2026 15:17:00 +0800 Subject: [PATCH 26/63] =?UTF-8?q?=E6=9F=A5=E8=B4=A7=E4=B8=BB=E5=8D=A1?= =?UTF-8?q?=E6=AD=BB;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml b/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml index 6bff7db29..e2fd28e11 100644 --- a/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml +++ b/mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml @@ -200,7 +200,6 @@ AND ( a.organization_id = #{settlementCustomersDO.organizationId} - OR b.org_code LIKE concat('%', #{settlementCustomersDO.organizationId}, '%') ) From b9fe4bc4d25580398d83e1c3e0c1003e6ea40268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Wed, 5 Aug 2026 17:01:52 +0800 Subject: [PATCH 27/63] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BA=94=E6=94=B6?= =?UTF-8?q?=E8=B4=A6=E5=8D=95=E6=8E=A8=E9=80=81nc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BillManageApplicationService.java | 27 ++++++++++++ .../repository/mapper/BillDetailMapper.java | 3 ++ .../persistence/BillManageImpl.java | 41 +++++++++++++++++++ .../resources/mapper/BillDetailMapper.xml | 10 +++++ 4 files changed, 81 insertions(+) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java index bb1fc6170..ee8b50793 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java @@ -7,6 +7,7 @@ import com.mhd.bms.application.server.receiptManage.ReceiptManageApplicationServ import com.mhd.bms.domain.billManage.entity.BillDetail; import com.mhd.bms.domain.billManage.entity.BillManage; import com.mhd.bms.domain.billManage.repository.facade.IBillDetailService; +import com.mhd.bms.domain.billManage.repository.facade.IBillManageService; import com.mhd.bms.domain.billManage.repository.mapper.BillDetailMapper; import com.mhd.bms.domain.billManage.repository.po.BillDetailPO; import com.mhd.bms.domain.billManage.repository.po.BillManagePO; @@ -78,6 +79,8 @@ public class BillManageApplicationService { private BillDetailMapper billDetailMapper; @Autowired private NcLogMapper ncLogMapper; + @Autowired + private IBillManageService billManageService; /** @@ -465,6 +468,30 @@ public class BillManageApplicationService { }); } //保存账单明细 + double allTaxRate = 0.0d; + BigDecimal allTaxAmount = BigDecimal.ZERO; + BigDecimal allTaxFreeFee = BigDecimal.ZERO; + for (BillDetailDTO item : billDetailDTOList) { + String firstSubjectCode = item.getFirstSubjectCode(); + Double taxRate = billDetailMapper.getTaxRate(firstSubjectCode); + BigDecimal amount = item.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))),10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + item.setTaxAmount(taxAmount); + item.setTaxFreeFee(taxFreeFee); + item.setTaxRate(taxRate); + allTaxRate += taxRate; + allTaxAmount = allTaxAmount.add(taxAmount); + allTaxFreeFee = allTaxFreeFee.add(taxFreeFee); + } + + BillManage billManage = billManageService.getById(billManageDO.getBillManageId()); + if (billManage != null) { + billManage.setTaxRate(allTaxRate); + billManage.setTaxAmount(allTaxAmount); + billManage.setTaxFreeFee(allTaxFreeFee); + billManageService.updateById(billManage); + } Boolean flagTwo = billDetailDomainService.saveBatch(billDetailDTOList); //保存操作记录 BillOperationLogDO billOperationLogDO = new BillOperationLogDO(); diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillDetailMapper.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillDetailMapper.java index b8fcdd9c5..044e5565c 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillDetailMapper.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/mapper/BillDetailMapper.java @@ -5,6 +5,7 @@ import com.mhd.bms.domain.billManage.entity.BillDetail; import com.mhd.bms.domain.billManage.repository.po.BillDetailPO; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.List; /** @@ -19,4 +20,6 @@ public interface BillDetailMapper extends BaseMapper List getDetailsByBillManageId(@Param("billManageId") Long billManageId); List getDetailsByBillManageIdAndGroup(@Param("billManageId") Long billManageId); + + Double getTaxRate(@Param("code") String code); } \ No newline at end of file diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java index 17872b7f1..4cb9549dc 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java @@ -13,6 +13,7 @@ import com.mhd.bms.domain.billManage.entity.BillDetail; import com.mhd.bms.domain.billManage.entity.BillManage; import com.mhd.bms.domain.billManage.repository.facade.IBillDetailService; import com.mhd.bms.domain.billManage.repository.facade.IBillManageService; +import com.mhd.bms.domain.billManage.repository.mapper.BillDetailMapper; import com.mhd.bms.domain.billManage.repository.mapper.BillManageMapper; import com.mhd.bms.domain.billManage.repository.po.BillManagePO; import com.mhd.bms.domain.billManage.repository.todo.BillManageDO; @@ -28,6 +29,7 @@ import com.mhd.bms.domain.ncLog.entity.NcLog; import com.mhd.bms.domain.ncLog.repository.mapper.NcLogMapper; import com.mhd.bms.domain.settlementCustomers.entity.SettlementCustomers; import com.mhd.bms.domain.settlementCustomers.repository.facade.ISettlementCustomersService; +import com.mhd.bms.interfaces.dto.billManage.BillDetailDTO; import com.mhd.bms.interfaces.dto.billManage.BillManageDTO; import com.mhd.common.core.domain.dto.ReconciliationDTO; import com.mhd.common.core.domain.dto.nc.*; @@ -89,6 +91,10 @@ public class BillManageImpl extends ServiceImpl im @Autowired private IBillDetailService billDetailService; @Autowired + private IBillManageService billManageService; + @Autowired + private BillDetailMapper billDetailMapper; + @Autowired private BmsInvoiceListMapper bmsInvoiceListMapper; //nc测试环境地址 @@ -199,6 +205,41 @@ public class BillManageImpl extends ServiceImpl im String invoiceId = reconciliation.getInvoiceId(); List billDetails = billDetailService.getDetailsByBillManageIdAndGroup(Long.parseLong(businessDocumentDetaliId)); + //保存税额等 + double allTaxRate = 0.0d; + BigDecimal allTaxAmount = BigDecimal.ZERO; + BigDecimal allTaxFreeFee = BigDecimal.ZERO; + for (BillDetail item : billDetails) { + String firstSubjectCode = item.getInvoiceItem(); + Double taxRate = billDetailMapper.getTaxRate(firstSubjectCode); + BigDecimal amount = item.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))),10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + if (item.getTaxAmount() == null) { + item.setTaxAmount(taxAmount); + } + if (item.getTaxFreeFee() == null) { + item.setTaxFreeFee(taxFreeFee); + } + if (item.getTaxRate() == null) { + item.setTaxRate(taxRate); + } + allTaxRate += taxRate; + allTaxAmount = allTaxAmount.add(taxAmount); + allTaxFreeFee = allTaxFreeFee.add(taxFreeFee); + } + + if (reconciliation.getTaxRate() == null) { + reconciliation.setTaxRate(allTaxRate); + } + if (reconciliation.getTaxAmount() == null) { + reconciliation.setTaxAmount(allTaxAmount); + } + if (reconciliation.getTaxFreeFee() == null) { + reconciliation.setTaxFreeFee(allTaxFreeFee); + } + + List ysitemList=new ArrayList(); String url = ""; Long organizationId = reconciliation.getOrganizationId(); diff --git a/mhd_bms/src/main/resources/mapper/BillDetailMapper.xml b/mhd_bms/src/main/resources/mapper/BillDetailMapper.xml index 5c4d156ed..0fc27b019 100644 --- a/mhd_bms/src/main/resources/mapper/BillDetailMapper.xml +++ b/mhd_bms/src/main/resources/mapper/BillDetailMapper.xml @@ -47,5 +47,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND bill_manage_id = #{billManageId} GROUP BY INVOICE_ITEM,INVOICE_ITEM_NAME,FEE_TYPE + + \ No newline at end of file From 2787f7651e0532deff499815a9dfae2fd3f010e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Wed, 5 Aug 2026 17:14:03 +0800 Subject: [PATCH 28/63] 30 --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd_wms/src/main/resources/bootstrap.yml | 8 ++++---- .../resources/mapper/reviewOrder/ReviewOrderMapper.xml | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index 91f2f8a11..e18484e8d 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index 03d48d2f4..e34bb9cd4 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index ba9a45148..e4a817238 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 688e5ea7c..743be7c29 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index 48d76d01e..dfac7337f 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index 39eb710cb..fc7380c20 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -14,18 +14,18 @@ spring: nacos: discovery: # server-addr: 127.0.0.1:8848 - server-addr: 10.33.0.129:6010 +# server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 # server-addr: 10.102.192.105:6848 config: # server-addr: 127.0.0.1:8848 - server-addr: 10.33.0.129:6010 +# server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 -# server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.30:6848 username: nacos password: manhuoda@2023 #线上正式环境 diff --git a/mhd_wms/src/main/resources/mapper/reviewOrder/ReviewOrderMapper.xml b/mhd_wms/src/main/resources/mapper/reviewOrder/ReviewOrderMapper.xml index 86a8a0466..d03ce31fc 100644 --- a/mhd_wms/src/main/resources/mapper/reviewOrder/ReviewOrderMapper.xml +++ b/mhd_wms/src/main/resources/mapper/reviewOrder/ReviewOrderMapper.xml @@ -4,7 +4,7 @@ - + @@ -84,7 +84,7 @@ - a.review_order_id, + a.review_order_id AS review_order_id, a.review_order_number, a.out_order_id, a.out_order_number, From 0f4da97358513fbd984c380e82a6bf8151a5fb9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Wed, 5 Aug 2026 17:30:17 +0800 Subject: [PATCH 29/63] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BA=94=E6=94=B6?= =?UTF-8?q?=E8=B4=A6=E5=8D=95=E6=8E=A8=E9=80=81nc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/billManage/BillManageApplicationService.java | 2 ++ .../mhd/bms/domain/billManage/repository/todo/BillManageDO.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java index ee8b50793..532c7219e 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java @@ -431,6 +431,7 @@ public class BillManageApplicationService { billManageDO.setReconciliationStatus(1); billManageDO.setCreateTime(new Date()); billManageDO.setCreateBy(loginUser.getUserid()); + billManageDO.setSalesmanId(String.valueOf(loginUser.getUserid())); billManageDO.setCreateByName(loginUser.getUserPo().getUserName()); billManageDO.setUpdateTime(new Date()); billManageDO.setUpdateBy(loginUser.getUserid()); @@ -490,6 +491,7 @@ public class BillManageApplicationService { billManage.setTaxRate(allTaxRate); billManage.setTaxAmount(allTaxAmount); billManage.setTaxFreeFee(allTaxFreeFee); + billManage.setSalesmanId(String.valueOf(loginUser.getUserid())); billManageService.updateById(billManage); } Boolean flagTwo = billDetailDomainService.saveBatch(billDetailDTOList); diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillManageDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillManageDO.java index 399ad44c4..cfb053614 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillManageDO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/todo/BillManageDO.java @@ -264,4 +264,6 @@ public class BillManageDO extends BaseVOEntity{ private String paymentAccountId; @ApiModelProperty("收款帐户名称") private String paymentAccountName; + @ApiModelProperty("业务员ID") + private String salesmanId; } \ No newline at end of file From 18c8c4d18da1a7158ada863b8f4c347c977c7870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Wed, 5 Aug 2026 17:32:17 +0800 Subject: [PATCH 30/63] =?UTF-8?q?=E5=8F=9131?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mhd/system/api/BmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/OmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WlhyServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/WmsServiceFeign.java | 2 +- .../src/main/java/com/mhd/system/api/YmsServiceFeign.java | 2 +- mhd_wms/src/main/resources/bootstrap.yml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java index e18484e8d..8cc8bfd57 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java @@ -18,7 +18,7 @@ import java.util.Set; /** * bms财务结算系统feign调用接口 */ -@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface BmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java index e34bb9cd4..560febea1 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.concurrent.CompletableFuture; -@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface OmsServiceFeign { diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java index e4a817238..d976fcc98 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; -@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class) public interface WlhyServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 743be7c29..653f44d4b 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -21,7 +21,7 @@ import java.util.Map; * @description: TODO * @date 2024/5/10 8:58 **/ -@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.3:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class) public interface WmsServiceFeign { /** diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java index dfac7337f..238ec5f81 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java @@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; -@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.4:8018", configuration = FeignAutoConfiguration.class) +@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class) public interface YmsServiceFeign { /** diff --git a/mhd_wms/src/main/resources/bootstrap.yml b/mhd_wms/src/main/resources/bootstrap.yml index fc7380c20..e8f169bf2 100644 --- a/mhd_wms/src/main/resources/bootstrap.yml +++ b/mhd_wms/src/main/resources/bootstrap.yml @@ -16,7 +16,7 @@ spring: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 @@ -25,7 +25,7 @@ spring: # server-addr: 127.0.0.1:8848 # server-addr: 10.33.0.129:6010 # 线上测试环境配置 容器名+端口号 - server-addr: 10.102.192.30:6848 + server-addr: 10.102.192.31:6848 username: nacos password: manhuoda@2023 #线上正式环境 From 987a7c564d2f540642ed4f3e4d3476364b92c0d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Wed, 5 Aug 2026 17:54:11 +0800 Subject: [PATCH 31/63] =?UTF-8?q?=E5=8F=9131?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../billManage/BillManageApplicationService.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java index 532c7219e..50f706d8d 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billManage/BillManageApplicationService.java @@ -453,6 +453,16 @@ public class BillManageApplicationService { for (BillDetailDTO billDetailDTO : billDetailDTOListNoBillingStatementId) { BillingStatementDTO billingStatementDTO = new BillingStatementDTO(); BeanUtils.copyProperties(billDetailDTO, billingStatementDTO); + + String firstSubjectCode = billDetailDTO.getFirstSubjectCode(); + Double taxRate = billDetailMapper.getTaxRate(firstSubjectCode); + BigDecimal amount = billingStatementDTO.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))),10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + billingStatementDTO.setTaxAmount(taxAmount); + billingStatementDTO.setTaxFreeFee(taxFreeFee); + billingStatementDTO.setTaxRate(taxRate); + billingStatementDTO.setBillingAmount(amount); billingStatementDTO.setAccountExpenseType(billDetailDTO.getBillType()); billingStatementDTO.setBillManageId(billManageDO.getBillManageId()); billingStatementDTO.setBillingState(3); From 7842ceaf71d673ebe0148bdc8bec818d014cd6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Wed, 5 Aug 2026 18:13:30 +0800 Subject: [PATCH 32/63] =?UTF-8?q?=E5=9B=9E=E6=98=BE=E5=BA=94=E6=94=B6?= =?UTF-8?q?=E5=BA=94=E4=BB=98;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../billingStatement/BillingStatementApplicationService.java | 2 ++ .../billingStatement/repository/po/BillingStatementPO.java | 4 ++++ .../billingStatement/repository/todo/BillingStatementDO.java | 4 ++++ .../interfaces/dto/billingStatement/BillingStatementDTO.java | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java index 9e56458e6..0f553dc75 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java +++ b/mhd_bms/src/main/java/com/mhd/bms/application/server/billingStatement/BillingStatementApplicationService.java @@ -585,6 +585,8 @@ public class BillingStatementApplicationService { 此方法只进行实体返回,并不进行数据保存 */ LoginUser loginUser = SecurityUtils.getLoginUser(); + + billingStatementDO.setAccountExpenseType(billingStatementDO.getAccountExpenseType()); if (ObjectUtil.isNull(loginUser)) { throw new DigitalLogisticsException(UserError.TIMEOUT); } diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementPO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementPO.java index 447b38446..6a5d308c7 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementPO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/po/BillingStatementPO.java @@ -100,6 +100,10 @@ public class BillingStatementPO extends BaseVOEntity{ @Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付") private Integer accountExpenseType; + @ApiModelProperty("收支类型(1-应收,2-应付)") + @Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付") + private Integer billType; + @ApiModelProperty("流水备注") @Excel(name = "流水备注") private String billingRemark; diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementDO.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementDO.java index af1576753..23fc1d687 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementDO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billingStatement/repository/todo/BillingStatementDO.java @@ -101,6 +101,10 @@ public class BillingStatementDO extends BaseVOEntity{ @Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付") private Integer accountExpenseType; + @ApiModelProperty("收支类型(1-应收,2-应付)") + @Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付") + private Integer billType; + @ApiModelProperty("流水备注") @Excel(name = "流水备注") private String billingRemark; diff --git a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementDTO.java b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementDTO.java index 48e195c69..855e5040b 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementDTO.java +++ b/mhd_bms/src/main/java/com/mhd/bms/interfaces/dto/billingStatement/BillingStatementDTO.java @@ -102,6 +102,10 @@ public class BillingStatementDTO extends BaseVOEntity{ @Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付") private Integer accountExpenseType; + @ApiModelProperty("收支类型(1-应收,2-应付)") + @Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付") + private Integer billType; + @ApiModelProperty("流水备注") @Excel(name = "流水备注") private String billingRemark; From 0ee27d796fcc23fd5a78b5649cdd1a1f80e3d2d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Wed, 5 Aug 2026 18:16:25 +0800 Subject: [PATCH 33/63] =?UTF-8?q?=E5=9B=9E=E6=98=BE=E5=BA=94=E6=94=B6?= =?UTF-8?q?=E5=BA=94=E4=BB=98;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../persistence/BillManageImpl.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java index 4cb9549dc..8f5a7b64c 100644 --- a/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java +++ b/mhd_bms/src/main/java/com/mhd/bms/domain/billManage/repository/persistence/BillManageImpl.java @@ -842,6 +842,41 @@ public class BillManageImpl extends ServiceImpl im .eq(BillDetail::getBillManageId, reconciliation.getBillManageId()) .eq(BillDetail::getDelFlag, 1)); + + //保存税额等 + double allTaxRate = 0.0d; + BigDecimal allTaxAmount = BigDecimal.ZERO; + BigDecimal allTaxFreeFee = BigDecimal.ZERO; + for (BillDetail item : billDetails) { + String firstSubjectCode = item.getInvoiceItem(); + Double taxRate = billDetailMapper.getTaxRate(firstSubjectCode); + BigDecimal amount = item.getBillingAmount(); + BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))),10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP); + BigDecimal taxFreeFee = amount.subtract(taxAmount); + if (item.getTaxAmount() == null) { + item.setTaxAmount(taxAmount); + } + if (item.getTaxFreeFee() == null) { + item.setTaxFreeFee(taxFreeFee); + } + if (item.getTaxRate() == null) { + item.setTaxRate(taxRate); + } + allTaxRate += taxRate; + allTaxAmount = allTaxAmount.add(taxAmount); + allTaxFreeFee = allTaxFreeFee.add(taxFreeFee); + } + + if (reconciliation.getTaxRate() == null) { + reconciliation.setTaxRate(allTaxRate); + } + if (reconciliation.getTaxAmount() == null) { + reconciliation.setTaxAmount(allTaxAmount); + } + if (reconciliation.getTaxFreeFee() == null) { + reconciliation.setTaxFreeFee(allTaxFreeFee); + } + List ysitemList=new ArrayList(); ReconciliationDTO reconciliationDTO=new ReconciliationDTO(); reconciliationDTO.setInnerNumber(reconciliation.getBillNumber()); From 56b39702b559bfc001b0c96820228c0b4bf79bd2 Mon Sep 17 00:00:00 2001 From: rcx <3084692334@qq.com> Date: Wed, 5 Aug 2026 18:18:08 +0800 Subject: [PATCH 34/63] =?UTF-8?q?feat=EF=BC=9AWMS=20=E6=A8=A1=E5=9D=97=20?= =?UTF-8?q?=E3=80=8C=E5=BA=93=E5=AD=98=E6=9F=A5=E8=AF=A2=E3=80=8D-?= =?UTF-8?q?=E3=80=8C=E5=8D=B3=E6=97=B6=E5=BA=93=E5=AD=98=E3=80=8D=20=20=20?= =?UTF-8?q?=20=20=201.=20=E5=AE=8C=E6=88=90=E5=8D=B3=E6=97=B6=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=E6=94=B9=E9=80=A0?= =?UTF-8?q?=EF=BC=9AJSON=20=E8=BF=94=E5=9B=9E=E6=AF=8F=E4=B8=AA=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E4=B8=AD=E8=A1=A5=E5=85=85=E8=A7=84=E6=A0=BC=E5=9E=8B?= =?UTF-8?q?=E5=8F=B7=E4=B8=8E=E5=BA=93=E5=AD=98=E6=95=B0=E9=87=8F=E5=90=88?= =?UTF-8?q?=E8=AE=A1=E5=AD=97=E6=AE=B5=E3=80=82=20=20=20=20=20=202.=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=89=8D=E7=AB=AF=E5=9F=BA=E4=BA=8E=E8=A7=84?= =?UTF-8?q?=E6=A0=BC=E5=9E=8B=E5=8F=B7=E8=BF=9B=E8=A1=8C=E5=8D=B3=E6=97=B6?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E7=9A=84=E7=BB=84=E5=90=88=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facade/IMaterialInventoryService.java | 6 + .../mapper/MaterialInventoryMapper.java | 6 + .../persistence/MaterialInventoryImpl.java | 18 + .../MaterialInventoryDomainService.java | 14 + .../po/ImmediateInventoryPO.java | 8 + .../todo/ImmediateInventoryDO.java | 4 + .../ImmediateInventoryDTO.java | 4 + .../MaterialInventoryMapper.xml | 548 +++++++++--------- 8 files changed, 341 insertions(+), 267 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/facade/IMaterialInventoryService.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/facade/IMaterialInventoryService.java index a3000dca6..d21794b81 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/facade/IMaterialInventoryService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/facade/IMaterialInventoryService.java @@ -71,6 +71,12 @@ public interface IMaterialInventoryService extends IService */ public List queryImmediateInventoryList(ImmediateInventoryDO immediateInventoryDO); + /** + * 查询即时库存合计数量 + */ + public BigDecimal sumImmediateInventoryQuantity(ImmediateInventoryDO immediateInventoryDO); + + /** * @description 增加指定库存 * @author ZhouGY diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java index a609f19c0..2cb15e4f0 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/mapper/MaterialInventoryMapper.java @@ -91,6 +91,12 @@ public interface MaterialInventoryMapper extends BaseMapper */ public List queryImmediateInventoryList(ImmediateInventoryDO immediateInventoryDO); + /** + * 查询即时库存合计数量(与列表相同筛选条件,返回库存数量总和) + */ + public BigDecimal sumImmediateInventoryQuantity(ImmediateInventoryDO immediateInventoryDO); + + @Select("SELECT SUM(inventory_quantity) FROM material_inventory a LEFT JOIN material_base_info b ON a.material_base_info_id = b.material_base_info_id WHERE a.del_flag = 1 AND b.shipper_id = #{shipperId} AND b.material_base_info_id = #{materialBaseInfoId}") public BigDecimal sumInventoryQuantityByShipperAndMaterialCode(@Param("shipperId") Long shipperId, @Param("materialBaseInfoId") Long materialBaseInfoId); diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java index 8b25a0600..4b1e1b14e 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/persistence/MaterialInventoryImpl.java @@ -464,11 +464,29 @@ public class MaterialInventoryImpl extends ServiceImpl queryImmediateInventoryList(ImmediateInventoryDO immediateInventoryDO) { return materialInventoryMapper.queryImmediateInventoryList(immediateInventoryDO); } + /** + * 查询即时库存合计数量 + *

与列表查询使用相同筛选条件但不分页,统计筛选条件下所有库存数量之和

+ * + * @param immediateInventoryDO 即时库存查询条件(与列表查询保持一致,保证合计口径一致) + * @return 库存数量合计值,无数据时为 0 + */ + @Override + public BigDecimal sumImmediateInventoryQuantity(ImmediateInventoryDO immediateInventoryDO) { + return materialInventoryMapper.sumImmediateInventoryQuantity(immediateInventoryDO); + } + /** * @description 增加指定库存 * @author ZhouGY diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/service/MaterialInventoryDomainService.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/service/MaterialInventoryDomainService.java index 46d5d1d11..30eba9147 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/service/MaterialInventoryDomainService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/service/MaterialInventoryDomainService.java @@ -103,6 +103,20 @@ public class MaterialInventoryDomainService { return materialInventoryService.queryImmediateInventoryList(immediateInventoryDO); } + /** + * 查询即时库存合计数量 + */ + public BigDecimal sumImmediateInventoryQuantity(ImmediateInventoryDO immediateInventoryDO) { + return materialInventoryService.sumImmediateInventoryQuantity(immediateInventoryDO); + } + + /** + * 根据查询条件获取物料库存信息 + *

按货主、组织、物料、仓库、库位等条件查询,返回汇总后的库存信息(含库存数量合计)

+ * + * @param materialInventoryDO 物料库存查询条件(含货主、顶级组织、物料基础信息、仓库、库位等) + * @return 匹配条件的物料库存信息,无匹配数据时返回 null + */ public MaterialInventoryPO selectOneByWhere(MaterialInventoryDO materialInventoryDO) { return materialInventoryService.selectOneByWhere(materialInventoryDO); } diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/statementStatistics/po/ImmediateInventoryPO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/statementStatistics/po/ImmediateInventoryPO.java index db0d45dd8..8d9f51786 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/statementStatistics/po/ImmediateInventoryPO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/statementStatistics/po/ImmediateInventoryPO.java @@ -42,10 +42,18 @@ public class ImmediateInventoryPO { @Excel(name = "物料条形码") private String barCode; + @ApiModelProperty("规格型号") + @Excel(name = "规格型号") + private String specificationModel; + @ApiModelProperty("库存数量") @Excel(name = "库存数量") private BigDecimal inventoryQuantity; + @ApiModelProperty("库存数量合计(当前查询条件下所有库存数量之和)") + @Excel(name = "库存数量合计") + private BigDecimal totalInventoryQuantity; + @ApiModelProperty("可用数量 ") @Excel(name = "可用数量 ") private BigDecimal allocationQuantity; diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/statementStatistics/todo/ImmediateInventoryDO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/statementStatistics/todo/ImmediateInventoryDO.java index 326891292..17049ffc4 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/statementStatistics/todo/ImmediateInventoryDO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/statementStatistics/todo/ImmediateInventoryDO.java @@ -44,6 +44,10 @@ public class ImmediateInventoryDO extends BaseVOEntity { @Excel(name = "物料条形码") private String barCode; + @ApiModelProperty("规格型号") + @Excel(name = "规格型号") + private String specificationModel; + @ApiModelProperty("仓库id") @Excel(name = "仓库id") private Long warehouseId; diff --git a/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/statementStatistics/ImmediateInventoryDTO.java b/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/statementStatistics/ImmediateInventoryDTO.java index 8310831b6..34fa01360 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/statementStatistics/ImmediateInventoryDTO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/statementStatistics/ImmediateInventoryDTO.java @@ -45,6 +45,10 @@ public class ImmediateInventoryDTO { @Excel(name = "物料条形码") private String barCode; + @ApiModelProperty("规格型号") + @Excel(name = "规格型号") + private String specificationModel; + @ApiModelProperty("仓库id") @Excel(name = "仓库id") private Long warehouseId; diff --git a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml index 484fcf602..5a5708903 100644 --- a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml +++ b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml @@ -162,7 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and a.material_base_info_id = #{materialBaseInfoId}
- and a.material_detail_id, = #{materialDetailId} + and a.material_detail_id = #{materialDetailId} @@ -313,7 +313,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and mi.material_base_info_id = #{materialBaseInfoId}
- and mi.material_detail_id, = #{materialDetailId} + and mi.material_detail_id = #{materialDetailId} @@ -781,12 +781,280 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and container_id = #{containerId} + + + and a.organization_id = #{organizationId} + + + + and a.top_organization_id = #{topOrganizationId} + + + + and (a.shipper_name = #{shipperName} OR b.shipper_name = #{shipperName}) + + + + and a.shipper_id = #{shipperId} + + + + and a.warehouse_id = #{warehouseId} + + + + and a.warehouse_code = #{warehouseCode} + + + + and a.warehouse_name like concat('%', #{warehouseName}, '%') + + + + and b.material_name = #{materialName} + + + + and b.material_code = #{materialCode} + + + + and b.bar_code = #{barCode} + + + + and b.specification_model = #{specificationModel} + + + + and a.batch_number = #{batchNumber} + + + + and ifnull( + ( + SELECT + sum( c.receipt_quantity ) + FROM + receipt_material_detail c + LEFT JOIN stock_receipt_order d ON c.receipt_order_number = d.receipt_order_number + AND d.del_flag = 1 + LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1 + WHERE + c.del_flag = 1 and d.STATUS = 3 + AND e.warehouse_id = a.warehouse_id + AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id) + AND c.material_base_info_id = a.material_base_info_id + and (c.BATCH_REF_NO = a.batch_ref_no or (c.BATCH_REF_NO is null and a.BATCH_REF_NO is null)) + and (c.SHEET_REF_NO = a.sheet_ref_no or (c.SHEET_REF_NO is null and a.SHEET_REF_NO is null)) + and (c.BOX_PALLET_NO = a.BOX_PALLET_NO or (c.BOX_PALLET_NO is null and a.BOX_PALLET_NO is null)) + and (c.EXT_ATTR_1 = a.EXT_ATTR_1 or (c.EXT_ATTR_1 is null and a.EXT_ATTR_1 is null)) + and (c.EXT_ATTR_2 = a.EXT_ATTR_2 or (c.EXT_ATTR_2 is null and a.EXT_ATTR_2 is null)) + and (c.EXT_ATTR_3 = a.EXT_ATTR_3 or (c.EXT_ATTR_3 is null and a.EXT_ATTR_3 is null)) + and (c.EXT_ATTR_4 = a.EXT_ATTR_4 or (c.EXT_ATTR_4 is null and a.EXT_ATTR_4 is null)) + and (c.PRODUCTION_DATE = a.PRODUCTION_DATE or (c.PRODUCTION_DATE is null and a.PRODUCTION_DATE is null)) + and (c.EXPIRY_DATE = a.EXPIRY_DATE or (c.EXPIRY_DATE is null and a.EXPIRY_DATE is null)) + and (c.INVENTORY_DATE = a.INVENTORY_DATE or (c.INVENTORY_DATE is null and a.INVENTORY_DATE is null)) + ), + 0 + )> #{receivedQuantityStart} + + + + and ifnull( + ( + SELECT + sum( c.receipt_quantity ) + FROM + receipt_material_detail c + LEFT JOIN stock_receipt_order d ON c.receipt_order_number = d.receipt_order_number + AND d.del_flag = 1 + LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1 + WHERE + c.del_flag = 1 and d.STATUS = 3 + AND e.warehouse_id = a.warehouse_id + AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id) + AND c.material_base_info_id = a.material_base_info_id + and (c.BATCH_REF_NO = a.batch_ref_no or (c.BATCH_REF_NO is null and a.BATCH_REF_NO is null)) + and (c.SHEET_REF_NO = a.sheet_ref_no or (c.SHEET_REF_NO is null and a.SHEET_REF_NO is null)) + and (c.BOX_PALLET_NO = a.BOX_PALLET_NO or (c.BOX_PALLET_NO is null and a.BOX_PALLET_NO is null)) + and (c.EXT_ATTR_1 = a.EXT_ATTR_1 or (c.EXT_ATTR_1 is null and a.EXT_ATTR_1 is null)) + and (c.EXT_ATTR_2 = a.EXT_ATTR_2 or (c.EXT_ATTR_2 is null and a.EXT_ATTR_2 is null)) + and (c.EXT_ATTR_3 = a.EXT_ATTR_3 or (c.EXT_ATTR_3 is null and a.EXT_ATTR_3 is null)) + and (c.EXT_ATTR_4 = a.EXT_ATTR_4 or (c.EXT_ATTR_4 is null and a.EXT_ATTR_4 is null)) + and (c.PRODUCTION_DATE = a.PRODUCTION_DATE or (c.PRODUCTION_DATE is null and a.PRODUCTION_DATE is null)) + and (c.EXPIRY_DATE = a.EXPIRY_DATE or (c.EXPIRY_DATE is null and a.EXPIRY_DATE is null)) + and (c.INVENTORY_DATE = a.INVENTORY_DATE or (c.INVENTORY_DATE is null and a.INVENTORY_DATE is null)) + ), + 0 + ) < #{receivedQuantityEnd} + + + + and ifnull( + ( + SELECT + sum( c.shelves_quantity ) + FROM + shelf_material_detail c + LEFT JOIN stock_shelf_order d ON c.shelf_order_number = d.shelf_order_number + AND d.del_flag = 1 + LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1 + WHERE + c.del_flag = 1 + AND e.warehouse_id = a.warehouse_id + AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id) + AND c.material_base_info_id = a.material_base_info_id + ), + 0 + ) > #{shelvesQuantityStart} + + + + and ifnull( + ( + SELECT + sum( c.shelves_quantity ) + FROM + shelf_material_detail c + LEFT JOIN stock_shelf_order d ON c.shelf_order_number = d.shelf_order_number + AND d.del_flag = 1 + LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1 + WHERE + c.del_flag = 1 + AND e.warehouse_id = a.warehouse_id + AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id) + AND c.material_base_info_id = a.material_base_info_id + ), + 0 + ) < #{shelvesQuantityEnd} + + + + and ifnull( + ( + SELECT + sum( c.picking_quantity ) + FROM + picking_material_detail c + LEFT JOIN picking_order d ON c.picking_order_number = d.PICKING_ORDER_NUMBER and c.del_flag = 1 and d.del_flag=1 + left join STOCK_OUT_ORDER e ON d.ORDER_NUMBER = e.OUT_ORDER_NUMBER and e.del_flag = 1 + WHERE + c.del_flag = 1 and d.STATUS = 3 and e.STATUS = 7 + AND d.warehouse_id = a.warehouse_id + AND (a.shipper_id IS NULL OR d.shipper_id = a.shipper_id) + AND c.material_base_info_id = a.material_base_info_id + AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID + ), + 0 + ) > #{pickQuantityStart} + + + + and ifnull( + ( + SELECT + sum( c.picking_quantity ) + FROM + picking_material_detail c + LEFT JOIN picking_order d ON c.picking_order_number = d.PICKING_ORDER_NUMBER and c.del_flag = 1 and d.del_flag=1 + left join STOCK_OUT_ORDER e ON d.ORDER_NUMBER = e.OUT_ORDER_NUMBER and e.del_flag = 1 + WHERE + c.del_flag = 1 and d.STATUS = 3 and e.STATUS = 7 + AND d.warehouse_id = a.warehouse_id + AND (a.shipper_id IS NULL OR d.shipper_id = a.shipper_id) + AND c.material_base_info_id = a.material_base_info_id + AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID + ), + 0 + ) < #{pickQuantityEnd} + + + + and + ifnull( + ( + SELECT + SUM(c.CHECK_QUANTITY) AS CHECK_QUANTITY + FROM + OUT_MATERIAL_DETAIL c + LEFT JOIN STOCK_OUT_ORDER d ON c.OUT_ORDER_NUMBER = d.OUT_ORDER_NUMBER and c.del_flag = 1 and d.del_flag = 1 + LEFT JOIN HANDOVER_TASK_ORDER e ON d.OUT_ORDER_NUMBER = e.ORDER_NUMBER + WHERE + d.CHECK_STATUS in (2,3) and e.STATUS = 1 and d.STATUS in (8,12) + AND d.DEL_FLAG = 1 + AND c.DEL_FLAG = 1 + and e.del_flag = 1 + AND d.warehouse_id = a.warehouse_id + AND (a.shipper_id IS NULL OR d.shipper_id = a.shipper_id) + AND c.material_base_info_id = a.material_base_info_id + AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID + ), + 0 + ) > #{checkQuantityBegin} + + + + and + ifnull( + ( + SELECT + SUM(c.CHECK_QUANTITY) AS CHECK_QUANTITY + FROM + OUT_MATERIAL_DETAIL c + LEFT JOIN STOCK_OUT_ORDER d ON c.OUT_ORDER_NUMBER = d.OUT_ORDER_NUMBER and c.del_flag = 1 and d.del_flag = 1 + LEFT JOIN HANDOVER_TASK_ORDER e ON d.OUT_ORDER_NUMBER = e.ORDER_NUMBER + WHERE + d.CHECK_STATUS in (2,3) and e.STATUS = 1 and d.STATUS in (8,12) + AND d.DEL_FLAG = 1 + AND c.DEL_FLAG = 1 + and e.del_flag = 1 + AND d.warehouse_id = a.warehouse_id + AND (a.shipper_id IS NULL OR d.shipper_id = a.shipper_id) + AND c.material_base_info_id = a.material_base_info_id + AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID + ), + 0 + ) < #{checkQuantityEnd} + + + + and a.inventory_quantity = #{inventoryQuantity} + + + + and a.inventory_quantity > #{inventoryQuantityStart} + + + + and a.inventory_quantity < #{inventoryQuantityEnd} + + + + and a.allocation_quantity > #{allocationQuantityStart} + + + + and a.allocation_quantity < #{allocationQuantityEnd} + + + + and a.freeze_quantity > #{freezeQuantityStart} + + + + and a.freeze_quantity < #{freezeQuantityEnd} + + + + + @@ -826,6 +1094,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" b.material_name, b.material_code, b.bar_code, + b.specification_model, @@ -995,271 +1264,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE a.del_flag = 1 - - and a.organization_id = #{organizationId} - - - - and a.top_organization_id = #{topOrganizationId} - - - - and (a.shipper_name = #{shipperName} OR b.shipper_name = #{shipperName}) - - - - and a.shipper_id = #{shipperId} - - - - and a.warehouse_id = #{warehouseId} - - - - and a.warehouse_code = #{warehouseCode} - - - - and a.warehouse_name like concat('%', #{warehouseName}, '%') - - - - and b.material_name = #{materialName} - - - - and b.material_code = #{materialCode} - - - - and b.bar_code = #{barCode} - - - - and a.batch_number = #{batchNumber} - - - - and ifnull( - ( - SELECT - sum( c.receipt_quantity ) - FROM - receipt_material_detail c - LEFT JOIN stock_receipt_order d ON c.receipt_order_number = d.receipt_order_number - AND d.del_flag = 1 - LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1 - WHERE - c.del_flag = 1 and d.STATUS = 3 - AND e.warehouse_id = a.warehouse_id - AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id) - AND c.material_base_info_id = a.material_base_info_id - and (c.BATCH_REF_NO = a.batch_ref_no or (c.BATCH_REF_NO is null and a.BATCH_REF_NO is null)) - and (c.SHEET_REF_NO = a.sheet_ref_no or (c.SHEET_REF_NO is null and a.SHEET_REF_NO is null)) - and (c.BOX_PALLET_NO = a.BOX_PALLET_NO or (c.BOX_PALLET_NO is null and a.BOX_PALLET_NO is null)) - and (c.EXT_ATTR_1 = a.EXT_ATTR_1 or (c.EXT_ATTR_1 is null and a.EXT_ATTR_1 is null)) - and (c.EXT_ATTR_2 = a.EXT_ATTR_2 or (c.EXT_ATTR_2 is null and a.EXT_ATTR_2 is null)) - and (c.EXT_ATTR_3 = a.EXT_ATTR_3 or (c.EXT_ATTR_3 is null and a.EXT_ATTR_3 is null)) - and (c.EXT_ATTR_4 = a.EXT_ATTR_4 or (c.EXT_ATTR_4 is null and a.EXT_ATTR_4 is null)) - and (c.PRODUCTION_DATE = a.PRODUCTION_DATE or (c.PRODUCTION_DATE is null and a.PRODUCTION_DATE is null)) - and (c.EXPIRY_DATE = a.EXPIRY_DATE or (c.EXPIRY_DATE is null and a.EXPIRY_DATE is null)) - and (c.INVENTORY_DATE = a.INVENTORY_DATE or (c.INVENTORY_DATE is null and a.INVENTORY_DATE is null)) - ), - 0 - )> #{receivedQuantityStart} - - - - and ifnull( - ( - SELECT - sum( c.receipt_quantity ) - FROM - receipt_material_detail c - LEFT JOIN stock_receipt_order d ON c.receipt_order_number = d.receipt_order_number - AND d.del_flag = 1 - LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1 - WHERE - c.del_flag = 1 and d.STATUS = 3 - AND e.warehouse_id = a.warehouse_id - AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id) - AND c.material_base_info_id = a.material_base_info_id - and (c.BATCH_REF_NO = a.batch_ref_no or (c.BATCH_REF_NO is null and a.BATCH_REF_NO is null)) - and (c.SHEET_REF_NO = a.sheet_ref_no or (c.SHEET_REF_NO is null and a.SHEET_REF_NO is null)) - and (c.BOX_PALLET_NO = a.BOX_PALLET_NO or (c.BOX_PALLET_NO is null and a.BOX_PALLET_NO is null)) - and (c.EXT_ATTR_1 = a.EXT_ATTR_1 or (c.EXT_ATTR_1 is null and a.EXT_ATTR_1 is null)) - and (c.EXT_ATTR_2 = a.EXT_ATTR_2 or (c.EXT_ATTR_2 is null and a.EXT_ATTR_2 is null)) - and (c.EXT_ATTR_3 = a.EXT_ATTR_3 or (c.EXT_ATTR_3 is null and a.EXT_ATTR_3 is null)) - and (c.EXT_ATTR_4 = a.EXT_ATTR_4 or (c.EXT_ATTR_4 is null and a.EXT_ATTR_4 is null)) - and (c.PRODUCTION_DATE = a.PRODUCTION_DATE or (c.PRODUCTION_DATE is null and a.PRODUCTION_DATE is null)) - and (c.EXPIRY_DATE = a.EXPIRY_DATE or (c.EXPIRY_DATE is null and a.EXPIRY_DATE is null)) - and (c.INVENTORY_DATE = a.INVENTORY_DATE or (c.INVENTORY_DATE is null and a.INVENTORY_DATE is null)) - ), - 0 - ) < #{receivedQuantityEnd} - - - - and ifnull( - ( - SELECT - sum( c.shelves_quantity ) - FROM - shelf_material_detail c - LEFT JOIN stock_shelf_order d ON c.shelf_order_number = d.shelf_order_number - AND d.del_flag = 1 - LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1 - WHERE - c.del_flag = 1 - AND e.warehouse_id = a.warehouse_id - AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id) - AND c.material_base_info_id = a.material_base_info_id - ), - 0 - ) > #{shelvesQuantityStart} - - - - and ifnull( - ( - SELECT - sum( c.shelves_quantity ) - FROM - shelf_material_detail c - LEFT JOIN stock_shelf_order d ON c.shelf_order_number = d.shelf_order_number - AND d.del_flag = 1 - LEFT JOIN stock_in_order e ON d.in_order_number = e.in_order_number and e.DEL_FLAG = 1 and d.DEL_FLAG = 1 - WHERE - c.del_flag = 1 - AND e.warehouse_id = a.warehouse_id - AND (a.shipper_id IS NULL OR e.shipper_id = a.shipper_id) - AND c.material_base_info_id = a.material_base_info_id - ), - 0 - ) < #{shelvesQuantityEnd} - - - - and ifnull( - ( - SELECT - sum( c.picking_quantity ) - FROM - picking_material_detail c - LEFT JOIN picking_order d ON c.picking_order_number = d.PICKING_ORDER_NUMBER and c.del_flag = 1 and d.del_flag=1 - left join STOCK_OUT_ORDER e ON d.ORDER_NUMBER = e.OUT_ORDER_NUMBER and e.del_flag = 1 - WHERE - c.del_flag = 1 and d.STATUS = 3 and e.STATUS = 7 - AND d.warehouse_id = a.warehouse_id - AND (a.shipper_id IS NULL OR d.shipper_id = a.shipper_id) - AND c.material_base_info_id = a.material_base_info_id - AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID - ), - 0 - ) > #{pickQuantityStart} - - - - and ifnull( - ( - SELECT - sum( c.picking_quantity ) - FROM - picking_material_detail c - LEFT JOIN picking_order d ON c.picking_order_number = d.PICKING_ORDER_NUMBER and c.del_flag = 1 and d.del_flag=1 - left join STOCK_OUT_ORDER e ON d.ORDER_NUMBER = e.OUT_ORDER_NUMBER and e.del_flag = 1 - WHERE - c.del_flag = 1 and d.STATUS = 3 and e.STATUS = 7 - AND d.warehouse_id = a.warehouse_id - AND (a.shipper_id IS NULL OR d.shipper_id = a.shipper_id) - AND c.material_base_info_id = a.material_base_info_id - AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID - ), - 0 - ) < #{pickQuantityEnd} - - - - - and - ifnull( - ( - SELECT - SUM(c.CHECK_QUANTITY) AS CHECK_QUANTITY - FROM - OUT_MATERIAL_DETAIL c - LEFT JOIN STOCK_OUT_ORDER d ON c.OUT_ORDER_NUMBER = d.OUT_ORDER_NUMBER and c.del_flag = 1 and d.del_flag = 1 - LEFT JOIN HANDOVER_TASK_ORDER e ON d.OUT_ORDER_NUMBER = e.ORDER_NUMBER - WHERE - d.CHECK_STATUS in (2,3) and e.STATUS = 1 and d.STATUS in (8,12) - AND d.DEL_FLAG = 1 - AND c.DEL_FLAG = 1 - and e.del_flag = 1 - AND d.warehouse_id = a.warehouse_id - AND (a.shipper_id IS NULL OR d.shipper_id = a.shipper_id) - AND c.material_base_info_id = a.material_base_info_id - AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID - ), - 0 - ) > #{checkQuantityBegin} - - - - and - ifnull( - ( - SELECT - SUM(c.CHECK_QUANTITY) AS CHECK_QUANTITY - FROM - OUT_MATERIAL_DETAIL c - LEFT JOIN STOCK_OUT_ORDER d ON c.OUT_ORDER_NUMBER = d.OUT_ORDER_NUMBER and c.del_flag = 1 and d.del_flag = 1 - LEFT JOIN HANDOVER_TASK_ORDER e ON d.OUT_ORDER_NUMBER = e.ORDER_NUMBER - WHERE - d.CHECK_STATUS in (2,3) and e.STATUS = 1 and d.STATUS in (8,12) - AND d.DEL_FLAG = 1 - AND c.DEL_FLAG = 1 - and e.del_flag = 1 - AND d.warehouse_id = a.warehouse_id - AND (a.shipper_id IS NULL OR d.shipper_id = a.shipper_id) - AND c.material_base_info_id = a.material_base_info_id - AND c.MATERIAL_INVENTORY_ID = a.MATERIAL_INVENTORY_ID - ), - 0 - ) < #{checkQuantityEnd} - - - - and a.inventory_quantity = #{inventoryQuantity} - - - - and a.inventory_quantity > #{inventoryQuantityStart} - - - - and a.inventory_quantity < #{inventoryQuantityEnd} - - - - and a.allocation_quantity > #{allocationQuantityStart} - - - - and a.allocation_quantity < #{allocationQuantityEnd} - - - - and a.freeze_quantity > #{freezeQuantityStart} - - - - and a.freeze_quantity < #{freezeQuantityEnd} - + ORDER BY GREATEST( IFNULL(a.update_time, '1970-01-01 00:00:00'), IFNULL(( @@ -1330,6 +1335,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + select + + from material_inventory a + left join material_base_info b on a.material_base_info_id = b.material_base_info_id + + a.del_flag = 1 + + + + and IFNULL(a.inventory_quantity, 0) > 0 + + + GROUP BY a.shipper_id, a.shipper_code, a.shipper_name, + b.material_base_info_id, b.material_code, b.material_name, b.SPECIFICATION_MODEL, + a.warehouse_id, a.warehouse_code, a.warehouse_name, + a.organization_id, a.organization_name, a.top_organization_id + ORDER BY sort_order, MAX(a.update_time) DESC + +