diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/RefundOnlyPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/RefundOnlyPluginInitializer.java index 100359e6..c228dbac 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/RefundOnlyPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/RefundOnlyPluginInitializer.java @@ -172,7 +172,7 @@ public class RefundOnlyPluginInitializer extends PluginBaseEntity { saveData(refundOnlyData); //过滤日志 - List filterReturnGoodsOrders = filterData(returnGoodsOrders); + List filterReturnGoodsOrders = filterData(refundOnlyData); if (filterReturnGoodsOrders == null || filterReturnGoodsOrders.size() == 0) { return; } @@ -217,6 +217,12 @@ public class RefundOnlyPluginInitializer extends PluginBaseEntity { } } + /** + * 退款时间区间 + * + * @param startTime + * @param endTime + */ public void start(String startTime, String endTime) { try { Date business_start = DateUtil.parse(startTime); @@ -238,7 +244,7 @@ public class RefundOnlyPluginInitializer extends PluginBaseEntity { saveData(refundOnlyData); //过滤日志 - List filterReturnGoodsOrders = filterData(returnGoodsOrders); + List filterReturnGoodsOrders = filterData(refundOnlyData); if (filterReturnGoodsOrders == null || filterReturnGoodsOrders.size() == 0) { return; } @@ -254,7 +260,7 @@ public class RefundOnlyPluginInitializer extends PluginBaseEntity { /** * 保存数据 */ - public void saveData(List refundOnlyData){ + public void saveData(List refundOnlyData) { //过滤原始表 List filterOriginalOrders = filterOriginal(refundOnlyData); //底表存数据库 @@ -262,6 +268,7 @@ public class RefundOnlyPluginInitializer extends PluginBaseEntity { save(filterOriginalOrders); } } + /** * 过滤元数据底表,只过滤表头 * @@ -285,14 +292,15 @@ public class RefundOnlyPluginInitializer extends PluginBaseEntity { /** * returnType:0 不退货、exchangeType:0 不换货、refundInd:1 退款 + * * @param rerturnGoodsOrderSearchData * @return */ - public List filterRefundOnly(List rerturnGoodsOrderSearchData){ + public List filterRefundOnly(List rerturnGoodsOrderSearchData) { List filterRefundOnly = new ArrayList<>(); for (RerturnGoodsOrderSearchData rerturnGoodsOrderSearchDatum : rerturnGoodsOrderSearchData) { RerturnGoodsOrderSearchHeader header = rerturnGoodsOrderSearchDatum.getHeader(); - if("0".equals(header.getReturnType())&&"0".equals(header.getExchangeType())&&"1".equals(header.getRefundInd())){ + if ("0".equals(header.getReturnType()) && "0".equals(header.getExchangeType()) && "1".equals(header.getRefundInd())) { filterRefundOnly.add(rerturnGoodsOrderSearchDatum); } } @@ -390,7 +398,7 @@ public class RefundOnlyPluginInitializer extends PluginBaseEntity { ArapDjzbVO.Parentt parentvo = new ArapDjzbVO.Parentt(); //djrq 单据日期 format = split[3];//暂时取创建时间,refundAt没返回 - format = "2024-09-25"; + format = "2024-09-29"; parentvo.setDjrq(format); //dwbm 公司 parentvo.setDwbm(split[0]); @@ -415,6 +423,9 @@ public class RefundOnlyPluginInitializer extends PluginBaseEntity { parentvo.setDjlxbm("D0"); //xslxbm 业务流程 parentvo.setXslxbm("JTK");//TOC仅退款 + //feinvstatus 开票状态 + parentvo.setFeinvstatus("0"); + //zyx1店铺 parentvo.setZyx1(split[1]); @@ -422,9 +433,10 @@ public class RefundOnlyPluginInitializer extends PluginBaseEntity { parentvo.setZyx2(v.get(0).getSourcePlatformCode()); //zyx3 收发类别 销售出库,写死:SALES parentvo.setZyx3("SALES"); + //zyx16 单据红字标识 1Y 2N + parentvo.setZyx16("1"); //子表,需要通过多个主表的id找到多个子表,且退货金额==0的不要 - List children = new ArrayList<>(); List ofsDetails = new ArrayList<>(); for (RerturnGoodsOrderSearchHeader rerturnGoodsOrderSearchHeader : v) { allDetail.stream().forEach(index -> { @@ -435,94 +447,153 @@ public class RefundOnlyPluginInitializer extends PluginBaseEntity { } logDetails.addAll(ofsDetails); + List children = new ArrayList<>(); - for (RerturnGoodsOrderSearchDetails ofsDetail : ofsDetails) { - ArapDjzbVO.Childrenn childrenn = new ArapDjzbVO.Childrenn(); + //按sku分组 + Map> collectSKU = ofsDetails.stream().collect(Collectors.groupingBy(index -> index.getSkuCode())); - //ddh 订单号 - childrenn.setDdh(ofsDetail.getReturnOrderCode()); + Set>> entries = collectSKU.entrySet(); + for (Map.Entry> entry : entries) { + children.clear(); + String kk = entry.getKey(); + List vv = entry.getValue(); + //kk是sku编码,vv是sku相同的子表 + try { + ArapDjzbVO.Childrenn childrenn = new ArapDjzbVO.Childrenn(); + //cinventoryid 存货 + childrenn.setCinventoryid(kk); + + //sum:jfbbje jfybje 借方本币金额/借方原币金额 + BigDecimal sum_jfbbje = new BigDecimal(0); + //sum:jfbbsj jfybsj 借方本币税金/借方原币税金 默认(0.13) + BigDecimal sum_jfbbsj = new BigDecimal(0); + //sum:wbfbbje jfybwsje 借方本币无税金额/借方原币无税金额 + BigDecimal sum_wbfbbje = new BigDecimal(0); + //sum:zyx4 平台优惠 + BigDecimal sum_zyx4 = new BigDecimal(0); + //sum:zyx5 支付优惠 + BigDecimal sum_zyx5 = new BigDecimal(0); + //sum:zyx6 达人优惠 + BigDecimal sum_zyx6 = new BigDecimal(0); + //sum:zyx7 商家优惠 + BigDecimal sum_zyx7 = new BigDecimal(0); + + //金额计算 + for (RerturnGoodsOrderSearchDetails detail : vv) { + sum_jfbbje = sum_jfbbje.add(new BigDecimal(detail.getTotalAmount())); + + BigDecimal sj = new BigDecimal(detail.getTotalAmount()).multiply(new BigDecimal(0.13)).setScale(2, RoundingMode.FLOOR); + sum_jfbbsj = sum_jfbbsj.add(sj); + + BigDecimal ws = new BigDecimal(detail.getTotalAmount()).subtract(sj); + sum_wbfbbje = sum_wbfbbje.add(ws); + + if (detail.getShareTargetPlatformDiscounts() != null) { + sum_zyx4 = sum_zyx4.add(detail.getShareTargetPlatformDiscounts()); + } + if (detail.getShareTargetMerchantDiscounts() != null) { + sum_zyx5 = sum_zyx5.add(detail.getShareTargetMerchantDiscounts()); + } + if (detail.getShareTargetExpertDiscounts() != null) { + sum_zyx6 = sum_zyx6.add(detail.getShareTargetExpertDiscounts()); + } + if (detail.getShareTargetPayDiscounts() != null) { + sum_zyx7 = sum_zyx7.add(detail.getShareTargetPayDiscounts()); + } + } + childrenn.setJfbbje("-" + sum_jfbbje); + childrenn.setJfybje("-" + sum_jfbbje); + childrenn.setJfbbsj("-" + sum_jfbbsj); + childrenn.setJfybsj("-" + sum_jfbbsj); + childrenn.setWbfbbje("-" + sum_wbfbbje); + childrenn.setJfybwsje("-" + sum_wbfbbje); + childrenn.setZyx4(String.valueOf(sum_zyx4)); + childrenn.setZyx5(String.valueOf(sum_zyx5)); + childrenn.setZyx6(String.valueOf(sum_zyx6)); + childrenn.setZyx7(String.valueOf(sum_zyx7)); + children.add(childrenn); + + //推送 + arapDjzbVO.setParentvo(parentvo); + arapDjzbVO.setChildren(children); + System.out.println(arapDjzbVO); + mapStr = "{\"djzbvo\":[" + JSONUtil.toJsonStr(arapDjzbVO) + "]}"; + System.out.println(mapStr); + //推送 + ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("arapYsInsertApproveCode"), mapStr); + //两层判断,一层中台转发,一层u8c返回 + if ("false".equals(ztResult.getFlag())) { + //转发失败 + response = JSONUtil.toJsonStr(ztResult.getAttribute()); + Assert.state(false, "丽知:售后订单(仅退款)--->U8C红字应收单,中台转发失败,失败原因:{}", ztResult.getAttribute()); + } + Attribute attribute = ztResult.getAttribute(); + System.out.println(attribute); + boolean isSuccess = false; + String djbh = ""; + String vouchid = ""; + if ("success".equals(attribute.getStatus())) { + isSuccess = true; + String data = attribute.getData(); + ArapDjzb arapDj = resultDataHandle(data); + System.out.println(arapDj); + djbh = arapDj.getParentvo().getDjbh(); + vouchid = arapDj.getParentvo().getVouchid(); + } + if (!isSuccess) { + Assert.state(false, "推送U8C--> 丽知:售后订单(仅退款)--->U8C红字应收单 失败 接口返回结果:{} 接口入参:{}", response, mapStr); + } + + //成功 + for (RerturnGoodsOrderSearchDetails ofsDetail : vv) { + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); + integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(response); + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(format); + integrationTaskLivingDetailsEntity.setRootAppPk(ofsDetail.getReturnOrderCode() + "_" + ofsDetail.getSkuCode()); + integrationTaskLivingDetailsEntity.setRootAppBill(ofsDetail.getReturnOrderCode());//仅退款单号 + integrationTaskLivingDetailsEntity.setNewSystemNumber(djbh); + integrationTaskLivingDetailsEntity.setNewSystemPrimary(vouchid); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); + } + } catch (Exception e) { + logger.error("推送U8C,丽知:售后订单(仅退款)--->U8C红字应收单失败,失败原因:" + e); + //失败,则该k下的所有子表记录失败 + ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class); + String ErrMessage = ""; + if (reusltStrDto != null) { + ErrMessage = "推送U8C,丽知:售后订单(仅退款)--->U8C红字应收单失败,失败原因:" + reusltStrDto.getErrormsg(); + } else { + ErrMessage = "推送U8C,丽知:售后订单(仅退款)--->U8C红字应收单失败,失败原因:" + e.getMessage(); + } + //失败 批量新增 ofsDetails + for (RerturnGoodsOrderSearchDetails logDetail : vv) { + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); + integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage); + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(format); + integrationTaskLivingDetailsEntity.setRootAppPk(logDetail.getReturnOrderCode() + "_" + logDetail.getSkuCode()); + integrationTaskLivingDetailsEntity.setRootAppBill(logDetail.getReturnOrderCode()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); + } + } - //cinventoryid 存货 - childrenn.setCinventoryid(ofsDetail.getSkuCode()); - //jfbbje jfybje 借方本币金额/借方原币金额 - childrenn.setJfbbje("-" + ofsDetail.getTotalAmount()); - childrenn.setJfybje("-" + ofsDetail.getTotalAmount()); - //jfbbsj jfybsj 借方本币税金/借方原币税金 默认(0.13) - BigDecimal sj = new BigDecimal(ofsDetail.getTotalAmount()).multiply(new BigDecimal(0.13)).setScale(2, RoundingMode.FLOOR); - childrenn.setJfbbsj("-" + String.valueOf(sj)); - childrenn.setJfybsj("-" + String.valueOf(sj)); - //wbfbbje jfybwsje 借方本币无税金额/借方原币无税金额 - BigDecimal ws = new BigDecimal(ofsDetail.getTotalAmount()).subtract(sj); - childrenn.setWbfbbje("-" + ws); - childrenn.setJfybwsje("-" + ws); - //zyx4 平台优惠 - childrenn.setZyx4(String.valueOf(ofsDetail.getShareTargetPlatformDiscounts())); - //zyx5 支付优惠 - childrenn.setZyx5(String.valueOf(ofsDetail.getShareTargetPlatformDiscounts())); - //zyx6 达人优惠 - childrenn.setZyx6(String.valueOf(ofsDetail.getShareTargetPlatformDiscounts())); - //zyx7 商家优惠 - childrenn.setZyx7(String.valueOf(ofsDetail.getShareTargetPlatformDiscounts())); - children.add(childrenn); } - - arapDjzbVO.setParentvo(parentvo); - arapDjzbVO.setChildren(children); - System.out.println(arapDjzbVO); - mapStr = "{\"djzbvo\":[" + JSONUtil.toJsonStr(arapDjzbVO) + "]}"; - System.out.println(mapStr); - - //推送 - ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("arapYsInsertApproveCode"), mapStr); - //两层判断,一层中台转发,一层u8c返回 - if ("false".equals(ztResult.getFlag())) { - //转发失败 - response = JSONUtil.toJsonStr(ztResult.getAttribute()); - Assert.state(false, "丽知:售后订单(仅退款)--->U8C红字应收单,中台转发失败,失败原因:{}", ztResult.getAttribute()); - } - Attribute attribute = ztResult.getAttribute(); - System.out.println(attribute); - boolean isSuccess = false; - String djbh = ""; - String vouchid = ""; - if ("success".equals(attribute.getStatus())) { - isSuccess = true; - String data = attribute.getData(); - ArapDjzb arapDj = resultDataHandle(data); - System.out.println(arapDj); - djbh = arapDj.getParentvo().getDjbh(); - vouchid = arapDj.getParentvo().getVouchid(); - } - if (!isSuccess) { - Assert.state(false, "推送U8C--> 丽知:售后订单(仅退款)--->U8C红字应收单 失败 接口返回结果:{} 接口入参:{}", response, mapStr); - } - - //成功 批量新增 ofsDetails - for (RerturnGoodsOrderSearchDetails ofsDetail : ofsDetails) { - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); - integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); - integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr); - integrationTaskLivingDetailsEntity.setNewTransmitInfo(response); - integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); - integrationTaskLivingDetailsEntity.setBusinessDate(format); - integrationTaskLivingDetailsEntity.setRootAppPk(ofsDetail.getReturnOrderCode() + "_" + ofsDetail.getSkuCode()); - integrationTaskLivingDetailsEntity.setRootAppBill(ofsDetail.getReturnOrderCode());//仅退款单号 - integrationTaskLivingDetailsEntity.setNewSystemNumber(djbh); - integrationTaskLivingDetailsEntity.setNewSystemPrimary(vouchid); - integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); - saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); - } - } catch (Exception e) { - logger.error("推送U8C,丽知:售后订单(仅退款)--->U8C红字应收单失败,失败原因:" + e); - //失败 - + logger.error("推送U8C,丽知:售后订单(仅退款)--->U8C红字应收单最外层失败,失败原因:" + e); + //失败,最外层,则该k下的所有子表记录失败 ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class); String ErrMessage = ""; if (reusltStrDto != null) { - ErrMessage = "推送U8C,丽知:OFS调整入库(组装入库)--->U8C组装订单失败,失败原因:" + reusltStrDto.getErrormsg(); + ErrMessage = "推送U8C,丽知:售后订单(仅退款)--->U8C红字应收单最外层失败,失败原因:" + reusltStrDto.getErrormsg(); } else { - ErrMessage = "推送U8C,丽知:OFS调整入库(组装入库)--->U8C组装订单失败,失败原因:" + e.getMessage(); + ErrMessage = "推送U8C,丽知:售后订单(仅退款)--->U8C红字应收单最外层失败,失败原因:" + e.getMessage(); } //失败 批量新增 ofsDetails for (RerturnGoodsOrderSearchDetails logDetail : logDetails) { @@ -537,70 +608,8 @@ public class RefundOnlyPluginInitializer extends PluginBaseEntity { integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); } - - } }); - -// //分摊后的明细 -// List ofsDetailsAll=new ArrayList<>(); -// -// -// for (RerturnGoodsOrderSearchData returnGoodsOrder : filterReturnGoodsOrders) { -// -// RerturnGoodsOrderSearchHeader ofsHeader = returnGoodsOrder.getHeader(); -// -// //平台优惠 platformDiscounts -// BigDecimal platform = new BigDecimal(ofsHeader.getPlatformDiscounts()); -// //商家优惠 merchantDiscounts -// BigDecimal merchant = new BigDecimal(ofsHeader.getMerchantDiscounts()); -// //达人优惠 expertDiscounts -// BigDecimal expert = new BigDecimal(ofsHeader.getExpertDiscounts()); -// //支付优惠 payDiscounts -// BigDecimal pay = new BigDecimal(ofsHeader.getPayDiscounts()); -// -// List ofsDetails = returnGoodsOrder.getDetails(); -// ofsDetails.stream().forEach(detail->{//表头的四个优惠放到表体 -//// detail.setOriginalTargetPlatformDiscounts(platform); -//// detail.setOriginalTargetMerchantDiscounts(merchant); -//// detail.setOriginalTargetExpertDiscounts(expert); -//// detail.setOriginalTargetPayDiscounts(pay); -// detail.setOriginalTargetPlatformDiscounts(BigDecimal.valueOf(4)); -// detail.setOriginalTargetMerchantDiscounts(BigDecimal.valueOf(5)); -// detail.setOriginalTargetExpertDiscounts(BigDecimal.valueOf(6)); -// detail.setOriginalTargetPayDiscounts(BigDecimal.valueOf(7)); -// }); -// -// //总金额 -// BigDecimal totalCount = new BigDecimal(0); -// for (RerturnGoodsOrderSearchDetails ofsDetail : ofsDetails) { -// //请求数量*商品零售价 -// BigDecimal count=new BigDecimal(ofsDetail.getRequestQty()).multiply(new BigDecimal(ofsDetail.getMsrPrice())); -// totalCount.add(count); -// } -// -// //分摊,总比重1,最后货品时,分摊比例= 1-之前的 -// BigDecimal ratioSurplus= new BigDecimal(1); -// for (int i = 0; i < ofsDetails.size(); i++) { -// if(i!=ofsDetails.size()){//最后一个直接取 -// //给存货分摊比例,总金额/(数量*单价) -// BigDecimal ratio -// = totalCount.divide(new BigDecimal(ofsDetails.get(i).getRequestQty()).multiply(new BigDecimal(ofsDetails.get(i).getMsrPrice()))); -// ratioSurplus.subtract(ratio); -// } -// //四个分摊优惠 按零售价摊 -// //shareTargetPlatformDiscounts 分摊平台优惠 -//// ofsDetails.get(i).setShareTargetPlatformDiscounts(); -// //shareTargetMerchantDiscounts 分摊商家优惠 -// //shareTargetExpertDiscounts 分摊达人优惠 -// //shareTargetPayDiscounts 分摊支付优惠 -// -// -// } -// } -// - - System.out.println(1); } /** diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java index f65464f0..896305d0 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java @@ -395,18 +395,20 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { * @author liuyang */ private List filterDataStock(List headerDetailsDtoList) throws Exception { - // List headerDetailsDtoList1 = new ArrayList<>(); - List allTocofsSaleoutDetailedEntityList = new ArrayList<>(); - if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { - List> splitListByCount = SplitListByCountUtil.splitListByCount(headerDetailsDtoList, 100); - for (int i = 0; i < splitListByCount.size(); i++) { - List headerDetailsDtoList2 = splitListByCount.get(i); - String idStr = commaConcatenatedPrimaryKeyStock(headerDetailsDtoList2); - List tocofsSaleoutDetailedEntityList = queryStockTocOutLog(idStr); - allTocofsSaleoutDetailedEntityList.addAll(tocofsSaleoutDetailedEntityList); + synchronized (PUSH_LOCK1) { + // List headerDetailsDtoList1 = new ArrayList<>(); + List allTocofsSaleoutDetailedEntityList = new ArrayList<>(); + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + List> splitListByCount = SplitListByCountUtil.splitListByCount(headerDetailsDtoList, 100); + for (int i = 0; i < splitListByCount.size(); i++) { + List headerDetailsDtoList2 = splitListByCount.get(i); + String idStr = commaConcatenatedPrimaryKeyStock(headerDetailsDtoList2); + List tocofsSaleoutDetailedEntityList = queryStockTocOutLog(idStr); + allTocofsSaleoutDetailedEntityList.addAll(tocofsSaleoutDetailedEntityList); + } } + return filterDataRowsAsPushOrFailedStock(allTocofsSaleoutDetailedEntityList, headerDetailsDtoList); } - return filterDataRowsAsPushOrFailedStock(allTocofsSaleoutDetailedEntityList, headerDetailsDtoList); } /** @@ -509,17 +511,19 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { * @author liuyang */ private List filterDataTran(List headerDetailsDtoList) throws Exception { - List allTocofsSaleoutDetailedEntityList = new ArrayList<>(); - if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { - List> splitListByCount = SplitListByCountUtil.splitListByCount(headerDetailsDtoList, 100); - for (int i = 0; i < splitListByCount.size(); i++) { - List headerDetailsDtoList2 = splitListByCount.get(i); - String idStr = commaConcatenatedPrimaryKeyStock(headerDetailsDtoList2); - List tocofsSaleoutDetailedEntityList = queryStockTocOutLog(idStr); - allTocofsSaleoutDetailedEntityList.addAll(tocofsSaleoutDetailedEntityList); + synchronized (PUSH_LOCK2) { + List allTocofsSaleoutDetailedEntityList = new ArrayList<>(); + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + List> splitListByCount = SplitListByCountUtil.splitListByCount(headerDetailsDtoList, 100); + for (int i = 0; i < splitListByCount.size(); i++) { + List headerDetailsDtoList2 = splitListByCount.get(i); + String idStr = commaConcatenatedPrimaryKeyStock(headerDetailsDtoList2); + List tocofsSaleoutDetailedEntityList = queryStockTocOutLog(idStr); + allTocofsSaleoutDetailedEntityList.addAll(tocofsSaleoutDetailedEntityList); + } } + return filterDataRowsAsPushOrFailedTran(allTocofsSaleoutDetailedEntityList, headerDetailsDtoList); } - return filterDataRowsAsPushOrFailedTran(allTocofsSaleoutDetailedEntityList, headerDetailsDtoList); } /** @@ -1894,7 +1898,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { Map> stringListMap = new HashMap<>(); stringListMap.put("billvos", salesInvoiceDtoList); - + //推送到U8C之前,再次验证,在U8C是否已经存在 synchronized (PUSH_LOCK2) { Boolean aBoolean = checkTobSalesInvoice(header.getId(), header.getCode()); @@ -2062,9 +2066,10 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { * @author liuyang */ private Boolean checkTobOrder(String ofsId, String ofsCode) throws Exception { - Assert.notNull(ofsId, "ofsId不能为空"); - Assert.notNull(ofsCode, "ofsCode不能为空"); synchronized (checkTobOrderLock) { + Assert.notNull(ofsId, "ofsId不能为空"); + Assert.notNull(ofsCode, "ofsCode不能为空"); + SoSaleEntity soSaleEntity = new SoSaleEntity(); soSaleEntity.setDr(0L); soSaleEntity.setDataSourceCode("lets_u8c"); 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 36d8ce55..af9dff51 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 @@ -403,18 +403,20 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { * @author liuyang */ private List filterDataStock(List returnGoodHeaderDetailsDataDtoArrayList) throws Exception { - // List headerDetailsDtoList1 = new ArrayList<>(); - List tocofsReturngoodsDetailedEntityList = new ArrayList<>(); - if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { - List> splitListByCount = SplitListByCountUtil.splitListByCount(returnGoodHeaderDetailsDataDtoArrayList, 100); - for (int i = 0; i < splitListByCount.size(); i++) { - List stockinOrderList = splitListByCount.get(i); - String idStr = commaConcatenatedPrimaryKeyStock(stockinOrderList); - List tocofsReturngoodsDetailedEntities = queryStockTocOutLog(idStr); - tocofsReturngoodsDetailedEntityList.addAll(tocofsReturngoodsDetailedEntities); + synchronized (PUSH_LOCK1) { + // List headerDetailsDtoList1 = new ArrayList<>(); + List tocofsReturngoodsDetailedEntityList = new ArrayList<>(); + if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + List> splitListByCount = SplitListByCountUtil.splitListByCount(returnGoodHeaderDetailsDataDtoArrayList, 100); + for (int i = 0; i < splitListByCount.size(); i++) { + List stockinOrderList = splitListByCount.get(i); + String idStr = commaConcatenatedPrimaryKeyStock(stockinOrderList); + List tocofsReturngoodsDetailedEntities = queryStockTocOutLog(idStr); + tocofsReturngoodsDetailedEntityList.addAll(tocofsReturngoodsDetailedEntities); + } } + return filterDataRowsAsPushOrFailedStock(tocofsReturngoodsDetailedEntityList, returnGoodHeaderDetailsDataDtoArrayList); } - return filterDataRowsAsPushOrFailedStock(tocofsReturngoodsDetailedEntityList, returnGoodHeaderDetailsDataDtoArrayList); } /** @@ -567,18 +569,20 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { * @author liuyang */ private List filterDataTran(List returnGoodHeaderDetailsDataDtoArrayList) throws Exception { - // List headerDetailsDtoList1 = new ArrayList<>(); - List tocofsReturngoodsDetailedEntityList = new ArrayList<>(); - if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { - List> splitListByCount = SplitListByCountUtil.splitListByCount(returnGoodHeaderDetailsDataDtoArrayList, 100); - for (int i = 0; i < splitListByCount.size(); i++) { - List stockinOrderList = splitListByCount.get(i); - String idStr = commaConcatenatedPrimaryKeyStock(stockinOrderList); - List tocofsReturngoodsDetailedEntities = queryStockTocOutLog(idStr); - tocofsReturngoodsDetailedEntityList.addAll(tocofsReturngoodsDetailedEntities); + synchronized (PUSH_LOCK2) { + // List headerDetailsDtoList1 = new ArrayList<>(); + List tocofsReturngoodsDetailedEntityList = new ArrayList<>(); + if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + List> splitListByCount = SplitListByCountUtil.splitListByCount(returnGoodHeaderDetailsDataDtoArrayList, 100); + for (int i = 0; i < splitListByCount.size(); i++) { + List stockinOrderList = splitListByCount.get(i); + String idStr = commaConcatenatedPrimaryKeyStock(stockinOrderList); + List tocofsReturngoodsDetailedEntities = queryStockTocOutLog(idStr); + tocofsReturngoodsDetailedEntityList.addAll(tocofsReturngoodsDetailedEntities); + } } + return filterDataRowsAsPushOrFailedTran(tocofsReturngoodsDetailedEntityList, returnGoodHeaderDetailsDataDtoArrayList); } - return filterDataRowsAsPushOrFailedTran(tocofsReturngoodsDetailedEntityList, returnGoodHeaderDetailsDataDtoArrayList); } /** 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 5d916aa9..e66ba88f 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 @@ -202,7 +202,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { queryOfsSoSaleOutVo.setClosedAt_start(startTime); queryOfsSoSaleOutVo.setClosedAt_end(endTime); queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); +// queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); //2024年8月22日 14:02:13 已经和O确认,这个字段取消传递! // queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); queryOfsSoSaleOutVo.setStatus(900L); @@ -247,7 +247,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { List returnGoodHeaderDetailsDataDtoList = new ArrayList<>(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); +// queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); queryOfsSoSaleOutVo.setStatus(900L); queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageSize(50L); diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java index b6b2126d..8dae366a 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java @@ -62,7 +62,9 @@ public class SoSaleOutPluginInitializerToBTest { try { // soSaleOutPluginInitializerToB.startImplementByTranTime("2024-09-12 14:04:00","2024-09-12 14:12:00"); - soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024092000000003", "stock"); +// soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024092000000003", "stock"); + + soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024092600000009","stock"); } catch (Exception e) { e.printStackTrace(); } diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferTest.java index 983784a2..61c919ca 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferTest.java @@ -135,6 +135,11 @@ public class TransferTest { // refundOnlyPluginInitializer.start("LETS-RO2023060900005007"); refundOnlyPluginInitializer.start("LETS-RO2023082300000045"); } + + @Test + public void t81(){ + refundOnlyPluginInitializer.start("2023-08-20","2023-08-25"); + } ////////////////////////////////////////////////////////////////////////////////////仅退款 }