From aa4cf58e69064cec38b9b70533d3d9f1c2c109d3 Mon Sep 17 00:00:00 2001 From: liuy <37787198+LiuyCodes@users.noreply.github.com> Date: Wed, 11 Sep 2024 14:54:05 +0800 Subject: [PATCH] =?UTF-8?q?refactor(buildpackage):=20=E4=BC=98=E5=8C=96OFS?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=90=8C=E6=AD=A5=E9=80=BB=E8=BE=91=E4=B8=8E?= =?UTF-8?q?=E6=94=B6=E5=8F=91=E7=B1=BB=E5=88=AB=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 重构销售退货插件初始化类,删除无效代码行。 - 引入收发类别实体以支持不同业务类型。- 在U8C销售退货插件中集成店铺档案和收发类别。 - 更新档案缓存工具以包含收发类别初始化。 - 扩展售后订单工具以支持批量查询OFS售后订单。 - 优化OFS订单同步流程,包括匹配售后和销售订单。 - 为 GoodsRertunSonDetailsDto 添加店铺和收发类别属性。 以上改动旨在提升订单处理效率及扩展系统对多样订单类型的适配能力。 --- .../SoSaleReturnPluginInitializerToB.java | 2 +- .../SoSaleReturnPluginInitializerToC.java | 239 +++++++++++++++++- .../lets/u8cdto/GoodsRertunSonDetailsDto.java | 10 + .../plugin/lets/util/AfterSalesOrderUtil.java | 58 +++++ .../util/TocReturnBasicArchivesCacheUtil.java | 24 ++ .../RerturnGoodsOrderSearchData.java | 4 +- .../dto/stock/StockinOrderSearchResponse.java | 7 +- 7 files changed, 327 insertions(+), 17 deletions(-) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java index 74ab11c5..3d24ced4 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java @@ -545,7 +545,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { //收发类别 saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname()); - + saleorderRequestDto.setParentvo(saleorderRequestParentDto); List saleorderRequestChildrenDtoList = new ArrayList<>(); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java index 39b773c0..58c0b02a 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java @@ -14,6 +14,7 @@ import com.hzya.frame.plugin.lets.ofs.dao.ITocofsReturngoodsDao; import com.hzya.frame.plugin.lets.ofs.dao.ITocofsReturngoodsDetailedDao; import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity; import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity; +import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo; import com.hzya.frame.plugin.lets.u8cdto.*; @@ -21,6 +22,10 @@ import com.hzya.frame.plugin.lets.util.*; import com.hzya.frame.split.SplitListByCountUtil; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto; +import com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto; +import com.hzya.frame.ttxofs.dto.returngoodordersearch.RerturnGoodsOrderSearchData; +import com.hzya.frame.ttxofs.dto.returngoodordersearch.RerturnGoodsOrderSearchDetails; +import com.hzya.frame.ttxofs.dto.returngoodordersearch.RerturnGoodsOrderSearchHeader; import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse; import com.hzya.frame.ttxofs.service.OfsUnifiedService; import com.hzya.frame.web.entity.JsonResultEntity; @@ -105,6 +110,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { @Autowired private OfsStandardUtil ofsStandardUtil; + @Autowired + private AfterSalesOrderUtil afterSalesOrderUtil; + @Autowired private RdclUtil rdclUtil; @@ -367,7 +375,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { // 查询U8C业务流程 BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); // 查询销售收发类别 - BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("202"); +// BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("202"); if (bdBusitypeEntity != null && summaryDimensionMap != null) { Iterator>> iterator = summaryDimensionMap.entrySet().iterator(); @@ -388,6 +396,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { BdCumandocEntity bdCumandocEntity = oldValue.get(0).getBdCumandocEntity();//客商管理档案 BdCubasdocEntity bdCubasdocEntity = oldValue.get(0).getBdCubasdocEntity();//客商基本档案 BdDefdocEntity platformArchives = oldValue.get(0).getPlatformArchives();//U8C平台档案 + BdDefdocEntity shopArchives = oldValue.get(0).getShopArchives();//U8C店铺档案 + BdRdclEntity bdRdclEntity = oldValue.get(0).getBdRdclEntity();//U8C收发类别 try { checkArchives(oldValue.get(0)); @@ -422,7 +432,10 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname()); - //TODO 2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传! + //2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传! + //店铺 + saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc()); + saleorderRequestParentDto.setVdef1(shopArchives.getDocname()); saleorderRequestDto.setParentvo(saleorderRequestParentDto); @@ -431,13 +444,10 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { //把汇总好的出库单明细行合并成一行 GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = groupMergeDetailedRows(oldValue); - //存货管理档案:取发货公司的存货管理档案 BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(goodsRertunSonDetailsDto, bdCalbodyEntity.getPkCorp()); - //存货基础档案 BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp()); - //根据存货基础档案编码,查询当前存货的税率 BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvbasdocEntity.getInvcode()); @@ -552,12 +562,34 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { try { //初始化档案缓存 tocReturnBasicArchivesCacheUtil.initCache(); + //查询OFS售后入库单对应的售后订单 + List rerturnGoodsOrderSearchData = queryBatchAfterSalesOrder(returnGoodHeaderDetailsDataDtoList1); + findAfterSalesOrder(rerturnGoodsOrderSearchData, returnGoodHeaderDetailsDataDtoList1); + //查询OFS售后订单对应的OFS销售订单 + List headerDetailsDtos = queryBatchOfsOrder(rerturnGoodsOrderSearchData); + findOfsOrder(headerDetailsDtos, returnGoodHeaderDetailsDataDtoList1); for (int i = 0; i < returnGoodHeaderDetailsDataDtoList1.size(); i++) { StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList1.get(i); StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); List details = stockinOrder.getDetails(); + //OFS售后订单 + RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData1 = header.getRerturnGoodsOrderSearchData(); + Assert.notNull(rerturnGoodsOrderSearchData1, "无法关联到OFS售后订单 售后入库单号:{}", header.getCode()); + //OFS销售订单 + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = header.getHeaderDetailsDto(); + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = headerDetailsDto.getHeader(); + List details1 = headerDetailsDto.getDetails(); + Assert.notNull(headerDetailsDto, "无法关联到OFS销售订单 售后入库单号:{}", header.getCode()); + + //如果不存在,则默认一个 + if (header1.getSubOrderType() == null || "".equals(header1.getSubOrderType())) { + header1.setSubOrderType("SALES"); + } + BdRdclEntity bdRdclEntity = TocReturnBasicArchivesCacheUtil.stringBdRdclEntityHashMap.get(header1.getSubOrderType()); + Assert.notNull(bdRdclEntity, "根据业务类型({})没有匹配到U8C业务类型", header1.getSubOrderType()); + //表头公司:通过名称匹配U8C公司 // String corpName = "上海丽知品牌管理有限公司"; Assert.notNull(header.getCompanyCode(), "O货主编码不能为空"); @@ -632,6 +664,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { goodsRertunSonDetailsDto.setBdCumandocEntity(bdCumandocEntity); goodsRertunSonDetailsDto.setBdCubasdocEntity(bdCubasdocEntity); goodsRertunSonDetailsDto.setPlatformArchives(bdDefdocEntity); + goodsRertunSonDetailsDto.setBdRdclEntity(bdRdclEntity); + goodsRertunSonDetailsDto.setShopArchives(bdDefdocEntity1); BeanUtil.copyPropertiesV2(stockinB, goodsRertunSonDetailsDto); sonDetailsDtoList.add(goodsRertunSonDetailsDto); @@ -694,6 +728,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { /** * 分组汇总:公司+店铺+仓库+SKU+出库类型,数量合并相加 + * 修改为:公司+店铺+仓库+SKU+收发类别+部门,数量合并相加 * * @author liuyang */ @@ -703,6 +738,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = goodsRertunSonDetailsDtos.get(i); //2024年8月6日 10:35:25表头对象用于带出表头相关的分组汇总信息 StockinOrderSearchResponse.StockinOrder.StockinH header = goodsRertunSonDetailsDto.getHeader(); + RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData = header.getRerturnGoodsOrderSearchData();//OFS售后订单 + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = header.getHeaderDetailsDto();//OFS销售订单 //公司 BdCorpEntity bdCorpEntity = goodsRertunSonDetailsDto.getBdCorpEntity(); @@ -713,7 +750,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { //SKU String skuCode = goodsRertunSonDetailsDto.getSkuCode(); //出库类型 - String refOrderType = header.getRefOrderType(); +// String refOrderType = header.getRefOrderType(); + //收发类别 + BdRdclEntity bdRdclEntity = goodsRertunSonDetailsDto.getBdRdclEntity(); StringBuffer summaryDimensionStr = new StringBuffer(); if (bdCorpEntity != null && bdCorpEntity.getPkCorp() != null) { @@ -744,12 +783,20 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { } summaryDimensionStr.append(ADD); - if (refOrderType != null && !"".equals(refOrderType)) { - summaryDimensionStr.append(refOrderType); +// if (refOrderType != null && !"".equals(refOrderType)) { +// summaryDimensionStr.append(refOrderType); +// } else { +// summaryDimensionStr.append(NOTHING); +// } + + if (bdRdclEntity != null && bdRdclEntity.getRdcode() != null) { + summaryDimensionStr.append(bdRdclEntity.getRdcode()); } else { summaryDimensionStr.append(NOTHING); } + //TODO 部门?O还未开发好,待定 + goodsRertunSonDetailsDto.setSummaryDimensionStr(summaryDimensionStr.toString()); } logger.info("TOC:{} 个出库单对象需要汇总", goodsRertunSonDetailsDtos.size()); @@ -823,11 +870,16 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { for (int i = 0; i < sonDetailsDtoList.size(); i++) { GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = sonDetailsDtoList.get(i); + StockinOrderSearchResponse.StockinOrder.StockinH header = goodsRertunSonDetailsDto.getHeader(); + RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData = header.getRerturnGoodsOrderSearchData(); + + //取对应的售后订单明细,主要是取这个价格 + RerturnGoodsOrderSearchDetails afterSalesOrder = findAfterSalesOrderV2(goodsRertunSonDetailsDto, rerturnGoodsOrderSearchData); //实付金额/实发数量 - Assert.notNull(goodsRertunSonDetailsDto.getTotalAmount(), "退货入库单总金额不能为空 明细行对象:{}", JSON.toJSONString(goodsRertunSonDetailsDto)); + Assert.notNull(afterSalesOrder.getTotalAmount(), "退货入库单总金额不能为空 明细行对象:{}", JSON.toJSONString(goodsRertunSonDetailsDto)); Assert.notNull(goodsRertunSonDetailsDto.getReceivedQty(), "实收数量不能为空 明细行对象:{}", JSON.toJSONString(goodsRertunSonDetailsDto)); - BigDecimal totalPayAmountBigDecimal = new BigDecimal(goodsRertunSonDetailsDto.getTotalAmount()); + BigDecimal totalPayAmountBigDecimal = new BigDecimal(afterSalesOrder.getTotalAmount()); BigDecimal shipQtyBigDecimal = new BigDecimal(goodsRertunSonDetailsDto.getReceivedQty()); groupTotalPayAmount = groupTotalPayAmount.add(totalPayAmountBigDecimal); @@ -836,7 +888,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = sonDetailsDtoList.get(0); goodsRertunSonDetailsDto.setGroupShipQty(groupShipQty); goodsRertunSonDetailsDto.setGroupTotalPayAmount(groupTotalPayAmount); - logger.info("{}个明细行发生了合并!", sonDetailsDtoList.size()); + logger.info("TOB{}个明细行发生了合并!", sonDetailsDtoList.size()); return goodsRertunSonDetailsDto; } else { logger.info("sonDetailsDtoList集合是空的!"); @@ -984,4 +1036,169 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { } return allHeaderDetailsDtoArrayList; } + + /** + * 批量查询售后订单 + * + * @param returnGoodHeaderDetailsDataDtoList1 OFS售后入库单 + * @author liuyang + */ + private List queryBatchAfterSalesOrder(List returnGoodHeaderDetailsDataDtoList1) { + List rerturnGoodsOrderSearchDataList = new ArrayList<>(); + if (returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) { + try { + List> splitListByCount = SplitListByCountUtil.splitListByCount(returnGoodHeaderDetailsDataDtoList1, 50); + for (int i = 0; i < splitListByCount.size(); i++) { + List stockinOrderList = splitListByCount.get(i); + //50个原始一个批次进行分割 + StringBuffer idStr = new StringBuffer(); + for (int j = 0; j < stockinOrderList.size(); j++) { + StockinOrderSearchResponse.StockinOrder stockinOrder = stockinOrderList.get(j); + StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); + List details = stockinOrder.getDetails(); + + idStr.append(header.getRefOrderCode()); + idStr.append(","); + } + String idsStr = idStr.substring(0, idStr.length() - 1); + + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setCode(idsStr); + afterSalesOrderUtil.getBatchOfsRertunOrder(queryOfsSoSaleOutVo, rerturnGoodsOrderSearchDataList, 1L); + } + } catch (Exception e) { + logger.error("批量查询售后订单", e); + } + } + return rerturnGoodsOrderSearchDataList; + } + + /** + * 匹配售后订单 + * + * @param rerturnGoodsOrderSearchDataList OFS售后订单集合 + * @param returnGoodHeaderDetailsDataDtoList1 OFS售后入库单集合 + * @author liuyang + */ + private void findAfterSalesOrder(List rerturnGoodsOrderSearchDataList, List returnGoodHeaderDetailsDataDtoList1) throws Exception { + if (rerturnGoodsOrderSearchDataList != null && rerturnGoodsOrderSearchDataList.size() > 0 && returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) { + try { + for (int i = 0; i < returnGoodHeaderDetailsDataDtoList1.size(); i++) { + StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList1.get(i); + StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); + List details = stockinOrder.getDetails(); + + Assert.notNull(header.getId(), "OFS售后入库单主键不能为空!"); + for (int j = 0; j < rerturnGoodsOrderSearchDataList.size(); j++) { + RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData = rerturnGoodsOrderSearchDataList.get(j); + RerturnGoodsOrderSearchHeader header1 = rerturnGoodsOrderSearchData.getHeader(); + List details1 = rerturnGoodsOrderSearchData.getDetails(); + if (header.getId().equals(header1.getRefOrderId())) { + header.setRerturnGoodsOrderSearchData(rerturnGoodsOrderSearchData); + } + } + } + } catch (Exception e) { + logger.error("findAfterSalesOrder方法抛出异常", e); + } + } + } + + /** + * 通过售后入库单明细行,查找售后订单明细行 + * + * @param stockinB 售后订单明细行 + * @param ofsRertunOrder OFS售后订单 + * @author liuyang + */ + private RerturnGoodsOrderSearchDetails findAfterSalesOrderV2(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, RerturnGoodsOrderSearchData ofsRertunOrder) { + Assert.notNull(stockinB, "stockinB不能为空!"); + Assert.notNull(ofsRertunOrder, "saleOrderMessageDto不能为空!"); + + Assert.notNull(ofsRertunOrder.getHeader(), "售后订表头不能为空!"); + Assert.notNull(ofsRertunOrder.getDetails(), "售后订单表头"); + RerturnGoodsOrderSearchHeader header = ofsRertunOrder.getHeader(); + List details1 = ofsRertunOrder.getDetails(); + if (details1 == null || details1.size() == 0) { + Assert.state(false, "售后订单明细行不能为空,size不能为0!"); + } + for (int i = 0; i < details1.size(); i++) { + RerturnGoodsOrderSearchDetails rerturnGoodsOrderSearchDetails = details1.get(i); + if (rerturnGoodsOrderSearchDetails.getId().equals(stockinB.getRefOrderDetailId())) { + return rerturnGoodsOrderSearchDetails; + } + } + Assert.state(false, "通过售后入库单号({})无法匹配到售后订单", stockinB.getId()); + return null; + } + + /** + * 通过售后订单,匹配OFS销售订单 + * + * @author liuyang + */ + private List queryBatchOfsOrder(List rerturnGoodsOrderSearchData) throws Exception { + List headerDetailsDtoArrayList = new ArrayList<>(); + + if (rerturnGoodsOrderSearchData != null && rerturnGoodsOrderSearchData.size() > 0) { + try { + //每50个作为一批,拆分 + List> lists = SplitListByCountUtil.splitListByCount(rerturnGoodsOrderSearchData, 50); + for (int i = 0; i < lists.size(); i++) { + List rerturnGoodsOrderSearchData1 = lists.get(i); + StringBuffer codes = new StringBuffer(); + for (int j = 0; j < rerturnGoodsOrderSearchData.size(); j++) { + RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData2 = rerturnGoodsOrderSearchData.get(j); + RerturnGoodsOrderSearchHeader header = rerturnGoodsOrderSearchData2.getHeader(); + List details = rerturnGoodsOrderSearchData2.getDetails(); + + codes.append(header.getCode()); + codes.append(","); + } + String codesStr = codes.substring(0, codes.length() - 1); + + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setCode(codesStr); + ofsStandardUtil.getOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoArrayList, 1L); + } + } catch (Exception e) { + logger.error("queryBatchOfsOrder方法抛出异常", e); + } + } + return headerDetailsDtoArrayList; + } + + /** + * 匹配OFS销售订单 + * + * @param headerDetailsDtoList OFS销售订单 + * @param returnGoodHeaderDetailsDataDtoList1 ofs售后入库单 + * @author liuyang + */ + private void findOfsOrder(List headerDetailsDtoList, List returnGoodHeaderDetailsDataDtoList1) { + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0 && returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) { + try { + for (int i = 0; i < returnGoodHeaderDetailsDataDtoList1.size(); i++) { + StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList1.get(i); + StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); + List details = stockinOrder.getDetails(); + + RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData = header.getRerturnGoodsOrderSearchData();//OFS售后订单 + RerturnGoodsOrderSearchHeader header2 = rerturnGoodsOrderSearchData.getHeader(); + List details2 = rerturnGoodsOrderSearchData.getDetails(); + + for (int j = 0; j < headerDetailsDtoList.size(); j++) { + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = headerDetailsDtoList.get(j); + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = headerDetailsDto.getHeader(); + List details1 = headerDetailsDto.getDetails(); + if (header2.getRefOrderId().equals(header1.getId())) { + header.setHeaderDetailsDto(headerDetailsDto); + } + } + } + } catch (Exception e) { + logger.error("findOfsOrder方法抛出异常", e); + } + } + } } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GoodsRertunSonDetailsDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GoodsRertunSonDetailsDto.java index 05c735b5..f78aff0c 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GoodsRertunSonDetailsDto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GoodsRertunSonDetailsDto.java @@ -94,4 +94,14 @@ public class GoodsRertunSonDetailsDto extends StockinOrderSearchResponse.Stockin * U8C平台档案 */ private BdDefdocEntity platformArchives; + + /** + * U8C店铺档案 + */ + private BdDefdocEntity shopArchives; + + /** + * OFS收发类别 + */ + private BdRdclEntity bdRdclEntity; } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/AfterSalesOrderUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/AfterSalesOrderUtil.java index d2f510f7..3af0e39c 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/AfterSalesOrderUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/AfterSalesOrderUtil.java @@ -56,6 +56,24 @@ public class AfterSalesOrderUtil { return null; } + /** + * 批量查询OFS售后订单 + * + * @author liuyang + */ +// public List queryAfterSalesOrder(StockinOrderSearchResponse.StockinOrder.StockinH header) throws Exception { +// if (header != null && !"".equals(header.getCode())) { +// //根据售后入库单、查询销售订单 +// RerturnGoodsOrderSearchData ofsRertunOrder = getOfsRertunOrder(header.getRefOrderCode()); +// if (ofsRertunOrder == null || ofsRertunOrder.getHeader() == null || ofsRertunOrder.getDetails() == null) { +// Assert.state(false, "根据OFS售后订单编码{},无法查询到售后订单信息!", header.getRefOrderCode()); +// } +// } else { +// logger.error("queryAfterSalesOrder方法入参为null(header为null!)"); +// } +// return null; +// } + /** * 根据售后订单号,查询售后订单 * @@ -91,6 +109,46 @@ public class AfterSalesOrderUtil { return null; } + /** + * 根据售后订单号,查询售后订单 + * + * @param queryOfsSoSaleOutVo 查询条件 + * @param rerturnGoodsOrderSearchDataList 需要填充原始的数组集合 + * @param pageNo 页码 + * @author liuyang + */ + public void getBatchOfsRertunOrder(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List rerturnGoodsOrderSearchDataList, Long pageNo) throws Exception { + Assert.notNull(queryOfsSoSaleOutVo, "queryOfsSoSaleOutVo不能为空"); + Assert.notNull(rerturnGoodsOrderSearchDataList, "rerturnGoodsOrderSearchDataList不能为空"); + Assert.notNull(pageNo, "pageNo不能为空"); + + Long pageSize = 200L; +// Long pageNo = 1L; + +// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setPageNo(pageNo); + queryOfsSoSaleOutVo.setPageSize(pageSize); +// queryOfsSoSaleOutVo.setCode(refOrderCode); + + InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); + interfaceParamDto.setApi("ofs.returnOrder.search"); + interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); + RerturnGoodsOrderSearchJsonRootBean rerturnGoodsOrderSearchJsonRootBean = (RerturnGoodsOrderSearchJsonRootBean) ofsUnifiedService.unified(interfaceParamDto); + if (rerturnGoodsOrderSearchJsonRootBean != null) { + if ("false".equals(rerturnGoodsOrderSearchJsonRootBean.getError()) && "0".equals(rerturnGoodsOrderSearchJsonRootBean.getCode()) && "Success".equals(rerturnGoodsOrderSearchJsonRootBean.getMsg())) { + List rerturnGoodsOrderSearchJsonRootBeanData = rerturnGoodsOrderSearchJsonRootBean.getData(); + if (rerturnGoodsOrderSearchJsonRootBeanData != null && rerturnGoodsOrderSearchJsonRootBeanData.size() > 0) { + rerturnGoodsOrderSearchDataList.addAll(rerturnGoodsOrderSearchJsonRootBeanData); + getBatchOfsRertunOrder(queryOfsSoSaleOutVo, rerturnGoodsOrderSearchDataList, ++pageNo); + } + } else { + logger.error("查询售后订单失败,接口返回结果:{}", JSON.toJSON(rerturnGoodsOrderSearchJsonRootBean)); + } + } else { + logger.error("rerturnGoodsOrderSearchJsonRootBean为空(返回结果为空),查询入参条件:{}!", JSON.toJSON(queryOfsSoSaleOutVo)); + } + } + /** * 查询OFS销售订单 * diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocReturnBasicArchivesCacheUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocReturnBasicArchivesCacheUtil.java index 5cd6a2f1..383c1f47 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocReturnBasicArchivesCacheUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocReturnBasicArchivesCacheUtil.java @@ -55,6 +55,9 @@ public class TocReturnBasicArchivesCacheUtil { @Autowired private IBdDefdocDao iBdDefdocDao; + @Autowired + private IBdRdclDao iBdRdclDao; + /** * 初始化公司档案-表头公司 * 2024年7月31日 11:16:23 @@ -289,6 +292,25 @@ public class TocReturnBasicArchivesCacheUtil { } } + public static Map stringBdRdclEntityHashMap = new HashMap<>(); + + /** + * 初始化收发类别 + */ + private Map initBdRdcl() { + BdRdclEntity bdRdclEntity = new BdRdclEntity(); + bdRdclEntity.setDr(0); + bdRdclEntity.setDataSourceCode("lets_u8c"); + List bdRdclEntityList = iBdRdclDao.query(bdRdclEntity); + if (bdRdclEntityList != null && bdRdclEntityList.size() > 0) { + for (int i = 0; i < bdRdclEntityList.size(); i++) { + BdRdclEntity bdRdclEntity1 = bdRdclEntityList.get(i); + stringBdRdclEntityHashMap.put(bdRdclEntity1.getRdcode(), bdRdclEntity1); + } + } + return stringBdRdclEntityHashMap; + } + /** * 清理缓存 * @@ -307,6 +329,7 @@ public class TocReturnBasicArchivesCacheUtil { stringBdCubasdocEntityHashMap.clear(); stringBdDefdocEntityHashMap.clear(); shopDefdocEntityHashMap.clear(); + stringBdRdclEntityHashMap.clear(); } /** @@ -329,5 +352,6 @@ public class TocReturnBasicArchivesCacheUtil { initBdCubasdoc(); initSourcePlatform(); initShopDiy(); + initBdRdcl(); } } \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/returngoodordersearch/RerturnGoodsOrderSearchData.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/returngoodordersearch/RerturnGoodsOrderSearchData.java index 6c9e8cc1..7b0ab705 100755 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/returngoodordersearch/RerturnGoodsOrderSearchData.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/returngoodordersearch/RerturnGoodsOrderSearchData.java @@ -1,5 +1,7 @@ package com.hzya.frame.ttxofs.dto.returngoodordersearch; +import lombok.Data; + import java.util.List; /** @@ -8,7 +10,7 @@ import java.util.List; * @author bejson.com (i@bejson.com) * @website http://www.bejson.com/java2pojo/ */ -@lombok.Data +@Data public class RerturnGoodsOrderSearchData { private RerturnGoodsOrderSearchHeader header; private List details; diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/stock/StockinOrderSearchResponse.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/stock/StockinOrderSearchResponse.java index 8eea4925..f476c406 100644 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/stock/StockinOrderSearchResponse.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/stock/StockinOrderSearchResponse.java @@ -1,6 +1,7 @@ package com.hzya.frame.ttxofs.dto.stock; import com.hzya.frame.ttxofs.basics.ReturnMessageBasics; +import com.hzya.frame.ttxofs.dto.returngoodordersearch.RerturnGoodsOrderSearchData; import lombok.Data; import java.util.List; @@ -19,7 +20,6 @@ public class StockinOrderSearchResponse extends ReturnMessageBasics { @Data public static class StockinH { - private String id; private String clientCode; private String companyCode; @@ -68,11 +68,12 @@ public class StockinOrderSearchResponse extends ReturnMessageBasics { private String tradeSuccessAt; private String refundedAt;//OFS退款完成时间 private String refundStatus;//OFS退款完成状态 + private RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData;//OFS售后订单 + private com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto;//OFS销售订单 } @Data public static class StockinB { - private String id; private String receiptId; private String receiptCode; @@ -101,10 +102,8 @@ public class StockinOrderSearchResponse extends ReturnMessageBasics { private String lastUpdated; private String lastUpdatedBy; private String discountPrice; - //表头对象 private StockinH returnGoodSearchHeaderDto; } - } }