From 4083c58dda8f1b2687d5e1ede4f0fe403fc63190 Mon Sep 17 00:00:00 2001 From: liuy <37787198+LiuyCodes@users.noreply.github.com> Date: Mon, 9 Sep 2024 13:38:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96TOC=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lets/constant/ProfilesActiveConstant.java | 1 + .../plugin/lets/ofs/dao/ITocofsSaleoutDao.bak | 21 - .../ofs/dao/ITocofsSaleoutDetailedDao.java | 29 +- .../impl/TocofsSaleoutDetailedDaoImpl.java | 20 + .../entity/TocofsSaleoutDetailedEntity.java | 4 + .../entity/TocofsSaleoutDetailedEntity.xml | 104 +- .../sales/SoSaleOutPluginInitializerToC.java | 1071 ++++++++++++++--- .../lets/u8cdto/ErrorHeaderDetailsDtoDto.java | 22 + .../util/SaveOrUpdateBusinessLogUtil.java | 4 +- .../SoSaleOutPluginInitializerToCTest.java | 38 +- .../dto/ofssaleorderoutsearch/DetailsDto.java | 17 +- .../HeaderDetailsDto.java | 21 +- 12 files changed, 1113 insertions(+), 239 deletions(-) delete mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDao.bak create mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ErrorHeaderDetailsDtoDto.java diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/ProfilesActiveConstant.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/ProfilesActiveConstant.java index ab1dbabe..1d7b558c 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/ProfilesActiveConstant.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/ProfilesActiveConstant.java @@ -6,6 +6,7 @@ package com.hzya.frame.plugin.lets.constant; public class ProfilesActiveConstant { public static final String LETS_DATE_SOURCE = "lets_u8c"; + public static final String LETS_PROFILES_ACTIVE = "dev"; public static final String LOG_STATUS_Y = "Y"; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDao.bak b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDao.bak deleted file mode 100644 index 4dfb3e30..00000000 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDao.bak +++ /dev/null @@ -1,21 +0,0 @@ -package com.hzya.frame.plugin.lets.ofs.dao; - -import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutEntity; -import com.hzya.frame.basedao.dao.IBaseDao; - -import java.util.List; - -/** - * root(tocofs_saleout: table)表数据库访问层 - * - * @author makejava - * @since 2024-08-01 17:01:32 - */ -public interface ITocofsSaleoutDao extends IBaseDao { - /** - * 批量插入主表信息 - * - * @author liuyang - */ - void entityInsertBatchV2(List tocofsSaleoutEntityList) throws Exception; -} \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDetailedDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDetailedDao.java index 34e563f0..fdc848e2 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDetailedDao.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsSaleoutDetailedDao.java @@ -12,12 +12,39 @@ import java.util.List; * @since 2024-09-04 17:48:28 */ public interface ITocofsSaleoutDetailedDao extends IBaseDao { - /** * 批量插入或者更新 * * @author liuyang */ void entityInsertOrUpdateBatch(List tocofsSaleoutDetailedEntities) throws Exception; + + /** + * 更新出库状态的日志(适合档案转换部分的日志处理) + * + * @author liuyang + */ + void entityInsertOrUpdateBatchStock1(List tocofsSaleoutDetailedEntities) throws Exception; + + /** + * 更新出库状态的日志(适用库存推送) + * + * @author liuyang + */ + void entityInsertOrUpdateBatchStock2(List tocofsSaleoutDetailedEntities) throws Exception; + + /** + * 更新出库状态的日志(适用库存推送) + * + * @author liuyang + */ + void entityInsertOrUpdateBatchStock3(List tocofsSaleoutDetailedEntities) throws Exception; + + /** + * 更新出库状态的日志(适用库存推送) + * + * @author liuyang + */ + void entityInsertOrUpdateBatchStock4(List tocofsSaleoutDetailedEntities) throws Exception; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsSaleoutDetailedDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsSaleoutDetailedDaoImpl.java index a80da4a7..2986fb9d 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsSaleoutDetailedDaoImpl.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsSaleoutDetailedDaoImpl.java @@ -18,4 +18,24 @@ public class TocofsSaleoutDetailedDaoImpl extends MybatisGenericDao tocofsSaleoutDetailedEntities) throws Exception { insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDetailedDaoImpl.entityInsertOrUpdateBatch", tocofsSaleoutDetailedEntities); } + + @Override + public void entityInsertOrUpdateBatchStock1(List tocofsSaleoutDetailedEntities) throws Exception { + insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDetailedDaoImpl.entityInsertOrUpdateBatchStock", tocofsSaleoutDetailedEntities); + } + + @Override + public void entityInsertOrUpdateBatchStock2(List tocofsSaleoutDetailedEntities) throws Exception { + insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDetailedDaoImpl.entityInsertOrUpdateBatchStock2", tocofsSaleoutDetailedEntities); + } + + @Override + public void entityInsertOrUpdateBatchStock3(List tocofsSaleoutDetailedEntities) throws Exception { + insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDetailedDaoImpl.entityInsertOrUpdateBatchStock3", tocofsSaleoutDetailedEntities); + } + + @Override + public void entityInsertOrUpdateBatchStock4(List tocofsSaleoutDetailedEntities) throws Exception { + insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDetailedDaoImpl.entityInsertOrUpdateBatchStock4", tocofsSaleoutDetailedEntities); + } } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.java index eb3f0a79..c787310f 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.java @@ -360,4 +360,8 @@ public class TocofsSaleoutDetailedEntity extends BaseEntity { * 自定义项 */ private String def40; + /** + * 额外参数:查询条件 + */ + private String ids; } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml index 53ce04d7..d6cfdec9 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml @@ -279,10 +279,11 @@ and def38 = #{def38} and def39 = #{def39} and def40 = #{def40} - and sts='Y' + and id in (${ids}) +-- and sts='Y' - order by sorts asc - order by ${sort} ${order} + + @@ -882,7 +883,102 @@ def37 = values(def37), def38 = values(def38), def39 = values(def39), - def40 = values(def40) + def40 = values(def40) + + + + + + insert into tocofs_saleout_detailed(id,newPushDate,newTransmitInfo,newState) + values + + ( + #{entity.id}, + #{entity.newpushdate}, + #{entity.newtransmitinfo}, + #{entity.newstate} + ) + + on duplicate key update + id = values(id), + newPushDate = values(newPushDate), + newTransmitInfo = values(newTransmitInfo), + newState = values(newState) + + + + + + insert into tocofs_saleout_detailed(id,newPushDate,newTransmitInfo,newState,newSystemNumber,newSystemPrimary) + values + + ( + #{entity.id}, + #{entity.newpushdate}, + #{entity.newtransmitinfo}, + #{entity.newstate}, + #{entity.newsystemnumber}, + #{entity.newsystemprimary} + ) + + on duplicate key update + id = values(id), + newPushDate = values(newPushDate), + newTransmitInfo = values(newTransmitInfo), + newState = values(newState), + newSystemNumber = values(newSystemNumber), + newSystemPrimary = values(newSystemPrimary) + + + + + + insert into tocofs_saleout_detailed(id,def1,def2,newState2,newSystemNumber2,newSystemPrimary2) + values + + ( + #{entity.id}, + #{entity.def1}, + #{entity.def2}, + #{entity.newstate2}, + #{entity.newsystemnumber2}, + #{entity.newsystemprimary2} + ) + + on duplicate key update + id = values(id), + def1 = values(def1), + def2 = values(def2), + newState2 = values(newState2), + newSystemNumber2 = values(newSystemNumber2), + newSystemPrimary2 = values(newSystemPrimary2) + + + + + + insert into tocofs_saleout_detailed(id,def3,def4,newState3,newSystemNumber3,newSystemPrimary3) + values + + ( + #{entity.id}, + #{entity.def3}, + #{entity.def4}, + #{entity.newstate3}, + #{entity.newsystemnumber3}, + #{entity.newsystemprimary3} + ) + + on duplicate key update + id = values(id), + def3 = values(def3), + def4 = values(def4), + newState3 = values(newState3), + newSystemNumber3 = values(newSystemNumber3), + newSystemPrimary3 = values(newSystemPrimary3) + + + update tocofs_saleout_detailed set diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java index 6503c4e9..92d99b8b 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java @@ -1,5 +1,6 @@ package com.hzya.frame.plugin.lets.plugin.sales; +import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; @@ -16,6 +17,7 @@ import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity; import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutEntity; import com.hzya.frame.plugin.lets.ofs.service.ITocofsSaleoutService; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; +import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo; import com.hzya.frame.plugin.lets.resultvo.CacheTocMapVo; import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo; import com.hzya.frame.plugin.lets.u8cdto.*; @@ -28,11 +30,15 @@ import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto; import com.hzya.frame.ttxofs.service.OfsUnifiedService; import com.hzya.frame.web.entity.JsonResultEntity; +import com.hzya.frame.web.exception.BaseSystemException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; @@ -49,6 +55,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { private static final ReentrantLock LOCK = new ReentrantLock(true); + private static final String PROD_FILED = "prod"; + @Override public void initialize() { logger.info(getPluginLabel() + "執行初始化方法initialize()"); @@ -81,6 +89,37 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + long startMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); + + if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + throw new BaseSystemException("TOC退货业务,无法按单行推送!需要根据天的维度推送"); + } + + try { + String param = String.valueOf(requestJson.get("param")); + if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { + //按单号 + if (param != null && !"".equals(param)) { + startImplementStockByCode(param); + } + } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { + //前台页面功能日期推送,或者接口调用也行 + String craeteDateStr = computingTime(param); + if (craeteDateStr != null && !"".equals(craeteDateStr)) { + splitDateAndPush(craeteDateStr); + } + } else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { + //默认被定时器执行,每天晚上凌晨0点5分 + List startAndEndVos = calculateCalculateEntireDayPeriod(null); + startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time()); + startImplementTranByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time()); + } + } catch (Exception e) { + logger.error("executeBusiness方法异常", e); + } + long endMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); return null; } @@ -113,7 +152,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { private RdclUtil rdclUtil; /** - * 按指定时间拉取 + * 库存同步,按指定时间拉取 * * @param startTime O出库开始时间 * @param endTime O出库结束时间 @@ -179,7 +218,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { } /** - * 按指定时间拉取 + * 根据出库单编码拉取 * * @param code O销售出库单编码 * @author liuyang @@ -304,7 +343,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { } /** - * 触发数据转换之前的预备逻辑 + * 库存同步:触发数据转换之前的预备逻辑 * * @author liuyang */ @@ -312,13 +351,13 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { //保存到mysql底表 batchInsert(headerDetailsDtoList); //过滤成功的数据 -// List headerDetailsDtos = filterDataStock(headerDetailsDtoList); + List headerDetailsDtos = filterDataStock(headerDetailsDtoList); //执行推送主逻辑 -// implementStock(headerDetailsDtos); + implementStock(headerDetailsDtos); } /** - * 触发数据转换之前的预备逻辑 + * 交易成功:触发数据转换之前的预备逻辑 * * @author liuyang */ @@ -326,9 +365,10 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { //保存到mysql底表 batchInsert(headerDetailsDtoList); //过滤成功的数据 - List headerDetailsDtos = filterDataSTran(headerDetailsDtoList); - //执行推送主逻辑 - implementStock(headerDetailsDtos); + //headerDetailsDtos携带红、蓝单据推送成功与否的明细行 + List headerDetailsDtos = filterDataTran(headerDetailsDtoList); + //执行推送采购主逻辑 + implementTran(headerDetailsDtos); } /** @@ -336,13 +376,191 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { * * @author liuyang */ - private List filterDataStock(List headerDetailsDtoList) { - List headerDetailsDtoList1 = new ArrayList<>(); + private List filterDataStock(List headerDetailsDtoList) throws Exception { +// List headerDetailsDtoList1 = new ArrayList<>(); + List allTocofsSaleoutDetailedEntityList = new ArrayList<>(); if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { - //TODO 出库单明细主键,需要O返回,目前没有,已经提需求 - headerDetailsDtoList1.addAll(headerDetailsDtoList); + 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 headerDetailsDtoList1; + if (allTocofsSaleoutDetailedEntityList.size() > 0) { + return filterDataRowsAsPushOrFailedStock(allTocofsSaleoutDetailedEntityList, headerDetailsDtoList); + } + return null; + } + + /** + * 交易成功业务:过滤掉成功的数据 + * + * @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); + } + } + if (allTocofsSaleoutDetailedEntityList.size() > 0) { + return filterDataRowsAsPushOrFailedTran(allTocofsSaleoutDetailedEntityList, headerDetailsDtoList); + } + return null; + } + + /** + * 逗号拼接字符串主键,作为批处理的一部分,方便下一步的批量查询操作 + * + * @author liuyang + */ + private String commaConcatenatedPrimaryKeyStock(List headerDetailsDtoList2) throws Exception { + StringBuffer idStr = new StringBuffer(); + if (headerDetailsDtoList2 != null && headerDetailsDtoList2.size() > 0) { + for (int i = 0; i < headerDetailsDtoList2.size(); i++) { + HeaderDetailsDto headerDetailsDto = headerDetailsDtoList2.get(i); + HeaderDto header = headerDetailsDto.getHeader(); + List details = headerDetailsDto.getDetails(); + for (int j = 0; j < details.size(); j++) { + DetailsDto detailsDto = details.get(j); + Assert.notNull(detailsDto.getId(), "O明细主键不能为空!"); + Assert.state(!"".equals(detailsDto.getId()), "O明细主键不能为空!"); + idStr.append(detailsDto.getId()); + idStr.append(","); + } + } + } + if (idStr.length() > 0) { + return idStr.substring(0, idStr.length()); + } + return null; + } + + /** + * 批查询toc出库日志,查询的量由splitListByCount方法控制 + * + * @author liuyang + */ + private List queryStockTocOutLog(String idStr) throws Exception { + List tocofsSaleoutDetailedEntityList = null; + if (idStr != null && !"".equals(idStr.trim())) { + TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity(); + tocofsSaleoutDetailedEntity.setIds(idStr); + tocofsSaleoutDetailedEntityList = iTocofsSaleoutDetailedDao.query(tocofsSaleoutDetailedEntity); + } else { + logger.error("idStr为空,无法查询数据!"); + } + return tocofsSaleoutDetailedEntityList; + } + + /** + * 筛选出未推送、或者失败的数据行 + * + * @param allTocofsSaleoutDetailedEntityList 日志行状态 + * @param headerDetailsDtoList 返回结果 + * @author liuyang + */ + private List filterDataRowsAsPushOrFailedStock(List allTocofsSaleoutDetailedEntityList, List headerDetailsDtoList) throws Exception { + List targetHeaderDetailsDtoList = new ArrayList<>(); + if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0 && headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + //字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行 + String succeseeY = "Y"; + String succeseeH = "H"; + for (int i = 0; i < headerDetailsDtoList.size(); i++) { + HeaderDetailsDto headerDetailsDto = headerDetailsDtoList.get(i); + HeaderDto header = headerDetailsDto.getHeader(); + List details = headerDetailsDto.getDetails(); + + List targetDetails = new ArrayList<>(); + for (int j = 0; j < details.size(); j++) { + DetailsDto detailsDto = details.get(j); + Boolean isSuccess = false; + String newstate = null; + for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) { + TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k); + if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) { + newstate = tocofsSaleoutDetailedEntity.getNewstate(); + if (succeseeY.equals(newstate) || succeseeH.equals(newstate)) { + isSuccess = true; + } + } + } + if (!isSuccess) { + detailsDto.setNewState(newstate); + targetDetails.add(detailsDto); + } + } + if (targetDetails.size() > 0) { + //如果明细行中,还存在未推送或者失败的数据,则需要更新明细行 + headerDetailsDto.setDetails(targetDetails); + targetHeaderDetailsDtoList.add(headerDetailsDto); + } + } + } + return targetHeaderDetailsDtoList; + } + + /** + * 筛选出未推送、或者失败的数据行 + * + * @param allTocofsSaleoutDetailedEntityList 日志行状态 + * @param headerDetailsDtoList 返回结果 + * @author liuyang + */ + private List filterDataRowsAsPushOrFailedTran(List allTocofsSaleoutDetailedEntityList, List headerDetailsDtoList) throws Exception { + List targetHeaderDetailsDtoList = new ArrayList<>(); + if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0 && headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + //字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行 + String succeseeY = "Y"; + String succeseeH = "H"; + for (int i = 0; i < headerDetailsDtoList.size(); i++) { + HeaderDetailsDto headerDetailsDto = headerDetailsDtoList.get(i); + HeaderDto header = headerDetailsDto.getHeader(); + List details = headerDetailsDto.getDetails(); + + List targetDetails = new ArrayList<>(); + for (int j = 0; j < details.size(); j++) { + DetailsDto detailsDto = details.get(j); + + Boolean isSuccess = false; + String newstate2 = null; + String newstate3 = null; +// TocofsSaleoutDetailedEntity targetTocofsSaleoutDetailedEntity = null; + for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) { + TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k); + if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) { + newstate2 = tocofsSaleoutDetailedEntity.getNewstate2(); + newstate3 = tocofsSaleoutDetailedEntity.getNewstate3(); +// targetTocofsSaleoutDetailedEntity = tocofsSaleoutDetailedEntity; + //验证交易成功(红)是否成功、(销售)交易成功(蓝)是否成功 两者如果都成功,则过滤掉,如果其中一个不能成功,则还是需要进行补推! + //验证红或蓝单据是否推送成功的代码,在implementTran中实现 + if ((succeseeY.equals(newstate2) || succeseeH.equals(newstate2)) && (succeseeY.equals(newstate3) || succeseeH.equals(newstate3))) { + isSuccess = true; + } + } + } + if (!isSuccess) { + //拷贝推送状态参数,方便推送是进行判断 + detailsDto.setNewState2(newstate2); + detailsDto.setNewState3(newstate3); + targetDetails.add(detailsDto); + } + } + if (targetDetails.size() > 0) { + //如果明细行中,还存在未推送或者失败的数据,则需要更新明细行 + headerDetailsDto.setDetails(targetDetails); + targetHeaderDetailsDtoList.add(headerDetailsDto); + } + } + } + return targetHeaderDetailsDtoList; } /** @@ -365,6 +583,15 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { * @param headerDetailsDtoList 数据行 */ private void batchInsert(List headerDetailsDtoList) throws Exception { + if (headerDetailsDtoList != null) { + logger.error("需要保存或者更新到mysql底表的数量为:{}", headerDetailsDtoList.size()); + } + // 测试对象字段更新 +// headerDetailsDtoList.get(0).getHeader().setClientCode("LETS2"); +// headerDetailsDtoList.get(0).getHeader().setInternalInstructionType("SALES22"); +// headerDetailsDtoList.get(0).getDetails().get(0).setSkuName("22222"); +// headerDetailsDtoList.get(0).getDetails().get(0).setIsGift("11111"); +// headerDetailsDtoList.get(0).getDetails().get(0).setQuantityUM("33333"); if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { try { List headerDetailsDtoList1 = new ArrayList<>(); @@ -407,7 +634,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { } } } catch (Exception e) { - logger.error("TOC业务保存到Mysql底表失败!", e); + logger.error("TOC业务保存到Mysql底表失败!TocofsSaleoutEntity、TocofsSaleoutDetailedEntity保存失败", e); } } } @@ -472,7 +699,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { * @author liuyang */ private void implementStock(List headerDetailsDtos) throws Exception { - logger.info("TOC销售库存业务:{}行需要进行数据转换", headerDetailsDtos.size()); + if (headerDetailsDtos != null) { + logger.info("TOC销售库存业务:{}行需要进行数据转换", headerDetailsDtos.size()); + } if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) { try { // 查询基本档案 @@ -622,11 +851,28 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { Map> stringStringMap = new HashMap<>(); stringStringMap.put("saleorder", saleorderRequestDtoList); SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap)); - logger.info("销售订单编号:{} 销售公司:{}", soSaleResultRootDto.getParentvo().getVreceiptcode(), soSaleResultRootDto.getParentvo().getPk_corp()); + String vreceiptcode = null; + String pk_corp = null; + String csaleid = null; + if (soSaleResultRootDto != null && soSaleResultRootDto.getParentvo() != null) { + vreceiptcode = soSaleResultRootDto.getParentvo().getVreceiptcode(); + pk_corp = soSaleResultRootDto.getParentvo().getPk_corp(); + csaleid = soSaleResultRootDto.getParentvo().getCsaleid(); + } + logger.info("销售订单编号:{} 主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp); //记录成功 + //日志推送的详情,两种方法,是推送U8C成功之后记录,还是整理推送完毕后再记录? + //护童项目之前是整体推送之前记录,后来抛出链接失效的异常,而且只有程序执行完毕后,才能体现结果,执行过程中无法发现结果 + //所以还是需要等待U8C接口推送成功之后,马上发生信息的记录,时间下来这样足够稳定,同步速度上没有大的问题 + updateSuccessOrFail1(oldValue, "Y", "success", vreceiptcode, csaleid); } catch (Exception e) { logger.error("TOC业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e); //记录失败 + String message = e.getMessage(); + if (message == null) { + message = "未知错误"; + } + updateSuccessOrFail1(oldValue, "N", message, null, null); } } } else { @@ -703,6 +949,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { */ private List queryBasicArchivesStock(List headerDetailsDtoList) { List sonDetailsDtoList = new ArrayList<>(); + List errorHeaderDetailsDtoDtoList = new ArrayList<>(); if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { try { @@ -713,107 +960,128 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { HeaderDetailsDto headerDetailsDto = headerDetailsDtoList.get(i); HeaderDto header = headerDetailsDto.getHeader(); List details = headerDetailsDto.getDetails(); - - //表头公司:通过名称匹配U8C公司 + try { + //表头公司:通过名称匹配U8C公司 // String corpName = "上海丽知品牌管理有限公司"; - String companyCode = header.getCompanyCode(); - Assert.notNull(companyCode, "O出库单表头货主不能为空!"); - BdCorpEntity bdCorpEntity = cacheTocMapVo.getStringBdCorpEntityMap().get(companyCode); - Assert.notNull(bdCorpEntity, "根据公司编码({})没有匹配到U8C公司档案(公司编码=O货主)", companyCode); + String companyCode = header.getCompanyCode(); + Assert.notNull(companyCode, "O出库单表头货主不能为空!"); + BdCorpEntity bdCorpEntity = cacheTocMapVo.getStringBdCorpEntityMap().get(companyCode); + Assert.notNull(bdCorpEntity, "根据公司编码({})没有匹配到U8C公司档案(公司编码=O货主)", companyCode); - //发货库存组织 - BdCalbodyEntity bdCalbodyEntity = cacheTocMapVo.getStringBdCalbodyEntityMap().get(bdCorpEntity.getPkCorp()); - Assert.notNull(bdCalbodyEntity, "根据公司主键没有查询到发货库存组织 公司主键:{}", bdCorpEntity.getPkCorp()); + //发货库存组织 + BdCalbodyEntity bdCalbodyEntity = cacheTocMapVo.getStringBdCalbodyEntityMap().get(bdCorpEntity.getPkCorp()); + Assert.notNull(bdCalbodyEntity, "根据公司主键没有查询到发货库存组织 公司主键:{}", bdCorpEntity.getPkCorp()); - //发货公司,暂时把O表头公司作为发货公司,正常情况下需要把O库存地点对于的公司作为发货公司 + //发货公司,暂时把O表头公司作为发货公司,正常情况下需要把O库存地点对于的公司作为发货公司 - //发货仓库 - //2024年8月5日 15:06:38 仓库O与U两边仓库编码是一致的,和妮姐确认过了 - String facilityCode = header.getFacilityCode(); - Assert.notNull(facilityCode, "O仓库编码不能为空"); - BdStordocEntity bdStordocEntity = cacheTocMapVo.getStringBdStordocEntityMap().get(facilityCode + bdCalbodyEntity.getPkCalbody()); - Assert.notNull(bdStordocEntity, "没有匹配到发货仓库 发货库存组织主键:{} O库存地点编码:{}", facilityCode, bdCalbodyEntity.getPkCalbody()); + //发货仓库 + //2024年8月5日 15:06:38 仓库O与U两边仓库编码是一致的,和妮姐确认过了 + String facilityCode = header.getFacilityCode(); + Assert.notNull(facilityCode, "O仓库编码不能为空"); + BdStordocEntity bdStordocEntity = cacheTocMapVo.getStringBdStordocEntityMap().get(facilityCode + bdCalbodyEntity.getPkCalbody()); + Assert.notNull(bdStordocEntity, "没有匹配到发货仓库 发货库存组织主键:{} O库存地点编码:{}", facilityCode, bdCalbodyEntity.getPkCalbody()); - //2024年8月5日 15:25:07 收货库存组织、收货仓库、默认和发货库存组织、发货仓库一致,已经和佳妮确认 - //收货库存组织:速网来看收货库存组织对应表头工具 - //收货仓库:通过收货库存组织+仓库编码,确定收货仓库 + //2024年8月5日 15:25:07 收货库存组织、收货仓库、默认和发货库存组织、发货仓库一致,已经和佳妮确认 + //收货库存组织:速网来看收货库存组织对应表头工具 + //收货仓库:通过收货库存组织+仓库编码,确定收货仓库 - //销售组织2024年8月5日 15:33:40 和妮姐确认,销售组织和表头公司,作为一对一的关系, - BdSalestruEntity bdSalestruEntity = cacheTocMapVo.getStringBdSalestruEntityMap().get(bdCorpEntity.getUnitname()); - Assert.notNull(bdSalestruEntity, "无匹配到销售组织 表头公司名称:{}", bdCorpEntity.getUnitname()); + //销售组织2024年8月5日 15:33:40 和妮姐确认,销售组织和表头公司,作为一对一的关系, + BdSalestruEntity bdSalestruEntity = cacheTocMapVo.getStringBdSalestruEntityMap().get(bdCorpEntity.getUnitname()); + Assert.notNull(bdSalestruEntity, "无匹配到销售组织 表头公司名称:{}", bdCorpEntity.getUnitname()); - //业务部门:暂定的部门名称:其他,2024年8月5日 15:39:42 已经和妮姐确认 - BdDeptdocEntity bdDeptdocEntity = cacheTocMapVo.getStringBdDeptdocEntityMap().get(bdCorpEntity.getPkCorp()); - Assert.notNull(bdDeptdocEntity, "无法匹配到业务部门 部门名称:其他 对应公司名称:{}", bdCorpEntity.getPkCorp()); + //业务部门:暂定的部门名称:其他,2024年8月5日 15:39:42 已经和妮姐确认 + BdDeptdocEntity bdDeptdocEntity = cacheTocMapVo.getStringBdDeptdocEntityMap().get(bdCorpEntity.getPkCorp()); + Assert.notNull(bdDeptdocEntity, "无法匹配到业务部门 部门名称:其他 对应公司名称:{}", bdCorpEntity.getPkCorp()); - //客商基本档案 - // 2024年8月8日 12:05:10 O店铺的业务编码=U8C客商自定义项1,O没有店铺信息查询接口,因此无法通过出库单的店铺编码,查询到O店铺档案对应的业务编码,接口上线之后需要补充这一部分逻辑 + //客商基本档案 + // 2024年8月8日 12:05:10 O店铺的业务编码=U8C客商自定义项1,O没有店铺信息查询接口,因此无法通过出库单的店铺编码,查询到O店铺档案对应的业务编码,接口上线之后需要补充这一部分逻辑 // String custName = "天猫intoyou旗舰店-自营"; - String storeCode = header.getStoreCode(); - Assert.notNull(storeCode, "O店铺编码不能为空,没有办法完成业务逻辑!"); - Assert.state(!"".equals(storeCode.trim()), "O店铺编码不能为空,没有办法完成业务逻辑!"); - BdCubasdocEntity bdCubasdocEntity = cacheTocMapVo.getStringBdCubasdocEntityMap().get(storeCode); - Assert.notNull(bdCubasdocEntity, "根据U8C客商基本档案def1(记录o店铺编码),无法匹配到客户档案 o店铺编码:{}", storeCode); + String storeCode = header.getStoreCode(); + Assert.notNull(storeCode, "O店铺编码不能为空,没有办法完成业务逻辑!"); + Assert.state(!"".equals(storeCode.trim()), "O店铺编码不能为空,没有办法完成业务逻辑!"); + BdCubasdocEntity bdCubasdocEntity = cacheTocMapVo.getStringBdCubasdocEntityMap().get(storeCode); + Assert.notNull(bdCubasdocEntity, "根据U8C客商基本档案def1(记录o店铺编码),无法匹配到客户档案 o店铺编码:{}", storeCode); - //客商管理档案:2024年8月5日 15:41:54 TOC店铺名称查询U8C客商档案,已经和妮姐确认 - //2024年8月5日 15:49:49 先根据O店铺编码,得到店铺档案信息,取到名称,通过U8C接口查询出来 - //目前O店铺信息查询接口还没有,等待开发,所以我这里先写所一个名字 - BdCumandocEntity bdCumandocEntity = cacheTocMapVo.getStringBdCumandocEntityMap().get(bdCubasdocEntity.getPkCubasdoc() + bdCorpEntity.getPkCorp()); - Assert.notNull(bdCumandocEntity, "无法匹配到客商档案 店铺名称:{}", "天猫intoyou旗舰店-自营"); + //客商管理档案:2024年8月5日 15:41:54 TOC店铺名称查询U8C客商档案,已经和妮姐确认 + //2024年8月5日 15:49:49 先根据O店铺编码,得到店铺档案信息,取到名称,通过U8C接口查询出来 + //目前O店铺信息查询接口还没有,等待开发,所以我这里先写所一个名字 + BdCumandocEntity bdCumandocEntity = cacheTocMapVo.getStringBdCumandocEntityMap().get(bdCubasdocEntity.getPkCubasdoc() + bdCorpEntity.getPkCorp()); + Assert.notNull(bdCumandocEntity, "无法匹配到客商档案 店铺名称:{}", "天猫intoyou旗舰店-自营"); - //查找平台 - BdDefdocEntity bdDefdocEntity = cacheTocMapVo.getStringBdDefdocPlatformEntityMap().get(header.getSourcePlatformCode()); - Assert.notNull(bdDefdocEntity, "根据O平台编码({})无法匹配到U8C平台自定义档案", header.getSourcePlatformCode()); + //查找平台 + BdDefdocEntity bdDefdocEntity = cacheTocMapVo.getStringBdDefdocPlatformEntityMap().get(header.getSourcePlatformCode()); + Assert.notNull(bdDefdocEntity, "根据O平台编码({})无法匹配到U8C平台自定义档案", header.getSourcePlatformCode()); - //查找店铺 - BdDefdocEntity bdDefdocEntity1 = cacheTocMapVo.getStringBdDefdocShopEntityMap().get(header.getStoreCode()); - Assert.notNull(bdDefdocEntity1, "根据O店铺编码({})无法匹配到U8C店铺自定义档案", header.getStoreCode()); + //查找店铺 + BdDefdocEntity bdDefdocEntity1 = cacheTocMapVo.getStringBdDefdocShopEntityMap().get(header.getStoreCode()); + Assert.notNull(bdDefdocEntity1, "根据O店铺编码({})无法匹配到U8C店铺自定义档案", header.getStoreCode()); - //字段拷贝 - for (int j = 0; j < details.size(); j++) { - DetailsDto detailsDto = details.get(j); + //字段拷贝 + for (int j = 0; j < details.size(); j++) { + DetailsDto detailsDto = details.get(j); - //存货管理档案,是发货公司的存货档案 - BdInvmandocEntity bdInvmandocEntity = cacheTocMapVo.getStringBdInvmandocEntityMap().get(detailsDto.getSkuCode() + bdCorpEntity.getPkCorp()); - //存货基本档案 - BdInvbasdocEntity bdInvbasdocEntity = cacheTocMapVo.getStringBdInvbasdocEntityMap().get(bdInvmandocEntity.getPkInvmandoc() + bdCorpEntity.getPkCorp()); - //存货税率 - BdTaxitemsEntity bdTaxitemsEntity = cacheTocMapVo.getStringBdTaxitemsEntityMap().get(bdInvmandocEntity.getInvcode()); + //存货管理档案,是发货公司的存货档案 + BdInvmandocEntity bdInvmandocEntity = cacheTocMapVo.getStringBdInvmandocEntityMap().get(detailsDto.getSkuCode() + bdCorpEntity.getPkCorp()); + Assert.notNull(bdInvmandocEntity, "无法匹配到存货管理档案 货品sku:{} 公司:{}", detailsDto.getSkuCode(), bdCorpEntity.getPkCorp()); + //存货基本档案 + BdInvbasdocEntity bdInvbasdocEntity = cacheTocMapVo.getStringBdInvbasdocEntityMap().get(bdInvmandocEntity.getPkInvmandoc() + bdCorpEntity.getPkCorp()); + Assert.notNull(bdInvbasdocEntity, "无法匹配到存货基本档案 存货管理主键:{} 公司:{}", bdInvmandocEntity.getPkInvmandoc(), bdCorpEntity.getPkCorp()); + //存货税率 + BdTaxitemsEntity bdTaxitemsEntity = cacheTocMapVo.getStringBdTaxitemsEntityMap().get(bdInvmandocEntity.getInvcode()); + Assert.notNull(bdTaxitemsEntity, "无法匹配到存货税率 存货编码:{}", bdInvmandocEntity.getInvcode()); + //2024年8月6日 10:16:22 通过O出库单的表头,查询得出U8C档案,放在表体的原因是方便分组汇总 + //下一个步骤的分组汇总,是通过表体明细完成的 + SonDetailsDto sonDetailsDto = new SonDetailsDto(); + sonDetailsDto.setHeader(header); + sonDetailsDto.setBdCorpEntity(bdCorpEntity); + sonDetailsDto.setDeliverGoodsCorp(bdCorpEntity); + sonDetailsDto.setBdCalbodyEntity(bdCalbodyEntity); + sonDetailsDto.setBdStordocEntity(bdStordocEntity); + sonDetailsDto.setBdCalbodyEntity1(bdCalbodyEntity); + sonDetailsDto.setBdStordocEntity1(bdStordocEntity); + sonDetailsDto.setBdSalestruEntity(bdSalestruEntity); + sonDetailsDto.setBdDeptdocEntity(bdDeptdocEntity); + sonDetailsDto.setBdCumandocEntity(bdCumandocEntity); + sonDetailsDto.setBdCubasdocEntity(bdCubasdocEntity); + sonDetailsDto.setPlatformArchives(bdDefdocEntity); + sonDetailsDto.setShopArchives(bdDefdocEntity1); + sonDetailsDto.setBdInvmandocEntity(bdInvmandocEntity); + sonDetailsDto.setBdInvbasdocEntity(bdInvbasdocEntity); + sonDetailsDto.setBdTaxitemsEntity(bdTaxitemsEntity); - //2024年8月6日 10:16:22 通过O出库单的表头,查询得出U8C档案,放在表体的原因是方便分组汇总 - //下一个步骤的分组汇总,是通过表体明细完成的 - SonDetailsDto sonDetailsDto = new SonDetailsDto(); - sonDetailsDto.setHeader(header); - sonDetailsDto.setBdCorpEntity(bdCorpEntity); - sonDetailsDto.setDeliverGoodsCorp(bdCorpEntity); - sonDetailsDto.setBdCalbodyEntity(bdCalbodyEntity); - sonDetailsDto.setBdStordocEntity(bdStordocEntity); - sonDetailsDto.setBdCalbodyEntity1(bdCalbodyEntity); - sonDetailsDto.setBdStordocEntity1(bdStordocEntity); - sonDetailsDto.setBdSalestruEntity(bdSalestruEntity); - sonDetailsDto.setBdDeptdocEntity(bdDeptdocEntity); - sonDetailsDto.setBdCumandocEntity(bdCumandocEntity); - sonDetailsDto.setBdCubasdocEntity(bdCubasdocEntity); - sonDetailsDto.setPlatformArchives(bdDefdocEntity); - sonDetailsDto.setShopArchives(bdDefdocEntity1); - sonDetailsDto.setBdInvmandocEntity(bdInvmandocEntity); - sonDetailsDto.setBdInvbasdocEntity(bdInvbasdocEntity); - sonDetailsDto.setBdTaxitemsEntity(bdTaxitemsEntity); - - - BeanUtil.copyPropertiesV2(detailsDto, sonDetailsDto); - sonDetailsDtoList.add(sonDetailsDto); + BeanUtil.copyPropertiesV2(detailsDto, sonDetailsDto); + sonDetailsDtoList.add(sonDetailsDto); + } + } catch (Exception e) { + logger.error("档案转换抛出异常", e); + String message = e.getMessage(); + if (message == null) { + message = "未知错误"; + } + //失败 + ErrorHeaderDetailsDtoDto errorHeaderDetailsDtoDto = new ErrorHeaderDetailsDtoDto(); + errorHeaderDetailsDtoDto.setNewPushDate(getNewDateStr()); + errorHeaderDetailsDtoDto.setNewTransmitInfo(message); + errorHeaderDetailsDtoDto.setNewstate("N"); + errorHeaderDetailsDtoDto.setHeader(header); + errorHeaderDetailsDtoDto.setDetails(details); + errorHeaderDetailsDtoDtoList.add(errorHeaderDetailsDtoDto); } } //成功 } catch (Exception e) { + //失败,这一块逻辑,前期稳定后,不需要太关注,主要是一些基础档案的查询生成Map logger.error("OFS销售出库单关联查询U8C档案失败", e); - //失败 } } else { logger.info("queryBasicArchives方法headerDetailsDtoList.size为0"); } + + //批量把错误写入到日志信息表 + if (errorHeaderDetailsDtoDtoList.size() > 0) { + updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiry(errorHeaderDetailsDtoDtoList); + } return sonDetailsDtoList; } @@ -860,10 +1128,20 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { /** * 分组汇总:公司+店铺+仓库+SKU+出库类型,数量合并相加 * + * @param sonDetailsDtoList 整理好的数据 + * filterType 0或者其他、不过滤,1 过滤交易成功红、2过滤交易成功蓝 * @author liuyang */ private Map> groupSummaryStock(List sonDetailsDtoList) { if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) { +// switch (filterType) { +// case "1": +// sonDetailsDtoList = sonDetailsDtoList.stream().filter(sonDetailsDto -> "Y".equals(sonDetailsDto.getNewState2())).collect(Collectors.toList()); +// break; +// case "2": +// sonDetailsDtoList = sonDetailsDtoList.stream().filter(sonDetailsDto -> "Y".equals(sonDetailsDto.getNewState3())).collect(Collectors.toList()); +// break; +// } for (int i = 0; i < sonDetailsDtoList.size(); i++) { SonDetailsDto sonDetailsDto = sonDetailsDtoList.get(i); //2024年8月6日 10:35:25表头对象用于带出表头相关的分组汇总信息 @@ -1154,8 +1432,11 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { try { //查询基本档案 List sonDetailsDtoList = queryBasicArchivesStock(headerDetailsDtos); - //分组汇总 + //分组汇总:红蓝 Map> summaryDimensionMap = groupSummaryStock(sonDetailsDtoList); + //分组汇总:蓝 +// Map> summaryDimensionMap2 = groupSummaryStock(sonDetailsDtoList, "2"); + //TOC业务流程-TOC冲回发出商品 BdBusitypeEntity bdBusitypeEntity = u8cOperationFlowV2(); //TOC业务流程-TOC确认收入 @@ -1163,7 +1444,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { //查询销售收发类别 BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("202"); - if (bdBusitypeEntity != null && bdBusitypeEntity2 != null && summaryDimensionMap != null) { + if (bdBusitypeEntity != null && summaryDimensionMap != null) { Iterator>> iterator = summaryDimensionMap.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry> entry = iterator.next(); @@ -1182,6 +1463,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { BdCubasdocEntity bdCubasdocEntity = oldValue.get(0).getBdCubasdocEntity();//客商基本档案 BdDefdocEntity platformArchives = oldValue.get(0).getPlatformArchives();//U8C平台档案 BdDefdocEntity shopArchives = oldValue.get(0).getShopArchives();//U8C店铺档案 + String newState2 = oldValue.get(0).getNewState2();//交易成功-红 是否成功 + String newState3 = oldValue.get(0).getNewState3();//交易成功-蓝 是否成功 SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue);//把汇总好的出库单明细行合并成一行 // BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(sonDetailsDto, bdCalbodyEntity.getPkCorp()); BdInvmandocEntity bdInvmandocEntity = sonDetailsDto.getBdInvmandocEntity();//存货管理档案:取发货公司的存货管理档案 @@ -1190,128 +1473,147 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { // BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvbasdocEntity.getInvcode()); BdTaxitemsEntity bdTaxitemsEntity1 = sonDetailsDto.getBdTaxitemsEntity();//根据存货基础档案编码,查询当前存货的税率 + /** + * 先要确保红字销售订单生成后再生成蓝字销售订单,否则很有可能出现库存不足的问题,所以才共用了同一个summaryDimensionMap, + * 这样导致的问题是不好独立判断newState2、newState3的状态,独立判断这个状态有利于防止单据重新推送 + */ logger.info("开始第一阶段:负数销售订单->(自动生成) 负数销售出库单"); Boolean isOneSuccess = false; try { - //验证数据完整性 + //如果这个汇总集合,已经全部推送成功,那么就不需要推送红字销售订单,把isOneSuccess标识修改为true即可 + if (!"Y".equals(newState2)) { + //验证数据完整性 // checkArchives(oldValue.get(0)); - //取交易成功时间,生成业务日期 - String generateBusinessDate = createGenerateBusinessDateTran(header); + checkAllFail(oldValue, newState2, "1"); + //取交易成功时间,生成业务日期 + String generateBusinessDate = createGenerateBusinessDateTran(header); - SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto(); - SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto(); - saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期 - saleorderRequestParentDto.setBretinvflag("Y");//退货标记 - saleorderRequestParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程 - saleorderRequestParentDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());//库存组织 - saleorderRequestParentDto.setCcustomerid(bdCumandocEntity.getPkCumandoc());//客户=开票单位=收货单位=表体收货单位=收货单位 - saleorderRequestParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门 - saleorderRequestParentDto.setCemployeeid(null);//业务员 - saleorderRequestParentDto.setCoperatorid("0001A110000000000U3D");//制单人 - saleorderRequestParentDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//开票单位 - saleorderRequestParentDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位 - saleorderRequestParentDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());//销售组织 - saleorderRequestParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库 - saleorderRequestParentDto.setDapprovedate(generateBusinessDate);//审核日期 - saleorderRequestParentDto.setNdiscountrate("100.000000");//整单折扣 - saleorderRequestParentDto.setPk_corp(bdCorpEntity.getPkCorp());//公司id - saleorderRequestParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统 - saleorderRequestParentDto.setVdef18(keyGroup);//汇总单号=汇总维度 + SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto(); + SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto(); + saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期 + saleorderRequestParentDto.setBretinvflag("Y");//退货标记 + saleorderRequestParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程 + saleorderRequestParentDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());//库存组织 + saleorderRequestParentDto.setCcustomerid(bdCumandocEntity.getPkCumandoc());//客户=开票单位=收货单位=表体收货单位=收货单位 + saleorderRequestParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门 + saleorderRequestParentDto.setCemployeeid(null);//业务员 + saleorderRequestParentDto.setCoperatorid("0001A110000000000U3D");//制单人 + saleorderRequestParentDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//开票单位 + saleorderRequestParentDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位 + saleorderRequestParentDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());//销售组织 + saleorderRequestParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库 + saleorderRequestParentDto.setDapprovedate(generateBusinessDate);//审核日期 + saleorderRequestParentDto.setNdiscountrate("100.000000");//整单折扣 + saleorderRequestParentDto.setPk_corp(bdCorpEntity.getPkCorp());//公司id + saleorderRequestParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统 + saleorderRequestParentDto.setVdef18(keyGroup);//汇总单号=汇总维度 // saleorderRequestParentDto.setVdef19(); 这两个值TOC传递不了的 // saleorderRequestParentDto.setVdef20(); - saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc()); - saleorderRequestParentDto.setVdef2(platformArchives.getDocname());//平台,2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传! - saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc()); - saleorderRequestParentDto.setVdef1(shopArchives.getDocname());//店铺 - saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());//收发类别 - saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname()); - saleorderRequestDto.setParentvo(saleorderRequestParentDto); + saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc()); + saleorderRequestParentDto.setVdef2(platformArchives.getDocname());//平台,2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传! + saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc()); + saleorderRequestParentDto.setVdef1(shopArchives.getDocname());//店铺 + saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());//收发类别 + saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname()); + saleorderRequestDto.setParentvo(saleorderRequestParentDto); - List saleorderRequestChildrenDtoList = new ArrayList<>(); - saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList); + List saleorderRequestChildrenDtoList = new ArrayList<>(); + saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList); - String tax = "0." + new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString(); - BigDecimal noriginalcurprice = null;//无税单价 - BigDecimal noriginalcurmny = null;//无税金额 - BigDecimal noriginalcurtaxprice = null;//含税单价 - BigDecimal noriginalcursummny = null;//价税合计 - BigDecimal noriginalcurtaxmny = null;//税额 - try { - noriginalcurtaxprice = sonDetailsDto.getGroupTotalPayAmount().divide(sonDetailsDto.getGroupShipQty(), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); - noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); - noriginalcurmny = noriginalcurprice.multiply(sonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); - noriginalcursummny = noriginalcurtaxprice.multiply(sonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); - noriginalcurtaxmny = noriginalcursummny.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP); - } catch (Exception e) { - logger.error("TOC金额计算错误", e); - Assert.state(false, "金额计算错误,原因:{}" + e.getMessage()); - } - //判断是否为赠品 - Boolean isblargessflag = false; - if (noriginalcursummny.longValue() == 0) { - isblargessflag = true; - } + String tax = "0." + new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString(); + BigDecimal noriginalcurprice = null;//无税单价 + BigDecimal noriginalcurmny = null;//无税金额 + BigDecimal noriginalcurtaxprice = null;//含税单价 + BigDecimal noriginalcursummny = null;//价税合计 + BigDecimal noriginalcurtaxmny = null;//税额 + try { + noriginalcurtaxprice = sonDetailsDto.getGroupTotalPayAmount().divide(sonDetailsDto.getGroupShipQty(), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); + noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); + noriginalcurmny = noriginalcurprice.multiply(sonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); + noriginalcursummny = noriginalcurtaxprice.multiply(sonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); + noriginalcurtaxmny = noriginalcursummny.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP); + } catch (Exception e) { + logger.error("TOC金额计算错误", e); + Assert.state(false, "金额计算错误,原因:{}" + e.getMessage()); + } + //判断是否为赠品 + Boolean isblargessflag = false; + if (noriginalcursummny.longValue() == 0) { + isblargessflag = true; + } - SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto(); - saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品 - saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织 - saleorderRequestChildrenDto.setCbodywarehouseid(bdStordocEntity.getPkStordoc());//发货仓库 - saleorderRequestChildrenDto.setCbodywarehousecode(bdStordocEntity.getStorcode());//发货仓库编码:这个字段不需要给openapi接口,而是提供给下游方法使用 - saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司 - saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种 - saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id - saleorderRequestChildrenDto.setCinventorycode(bdInvbasdocEntity.getInvcode());//存货编码 - saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位 - saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期 - saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);//要求收货日期 - saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率 - saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣 - saleorderRequestChildrenDto.setNnumber("-" + String.valueOf(sonDetailsDto.getGroupShipQty()));//数量 - saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额 - saleorderRequestChildrenDto.setNoriginalcurmny("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//无税金额 + SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto(); + saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品 + saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织 + saleorderRequestChildrenDto.setCbodywarehouseid(bdStordocEntity.getPkStordoc());//发货仓库 + saleorderRequestChildrenDto.setCbodywarehousecode(bdStordocEntity.getStorcode());//发货仓库编码:这个字段不需要给openapi接口,而是提供给下游方法使用 + saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司 + saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种 + saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id + saleorderRequestChildrenDto.setCinventorycode(bdInvbasdocEntity.getInvcode());//存货编码 + saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位 + saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期 + saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);//要求收货日期 + saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率 + saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣 + saleorderRequestChildrenDto.setNnumber("-" + String.valueOf(sonDetailsDto.getGroupShipQty()));//数量 + saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额 + saleorderRequestChildrenDto.setNoriginalcurmny("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//无税金额 // saleorderRequestChildrenDto.setNoriginalcurnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税净价 // saleorderRequestChildrenDto.setNoriginalcurprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税单价 - saleorderRequestChildrenDto.setNoriginalcursummny("-" + noriginalcursummny.stripTrailingZeros().toPlainString());//价税合计 - saleorderRequestChildrenDto.setNoriginalcurtaxmny("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//税额 - saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价 - saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价 - saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率 + saleorderRequestChildrenDto.setNoriginalcursummny("-" + noriginalcursummny.stripTrailingZeros().toPlainString());//价税合计 + saleorderRequestChildrenDto.setNoriginalcurtaxmny("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//税额 + saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价 + saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价 + saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率 // saleorderRequestChildrenDto.setCreccalbodyid(bdCalbodyEntity1.getPkCalbody());//收货库存组织:2024年8月7日 16:21:48 和佳妮、道品一起测试,收货库存组织、收货仓库 是不需要传递的 // saleorderRequestChildrenDto.setCrecwareid(bdStordocEntity1.getPkStordoc());//收货仓库 - saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto); + saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto); - //销售订单单据推送到u8c - List saleorderRequestDtoList = new ArrayList<>(); - saleorderRequestDtoList.add(saleorderRequestDto); + //销售订单单据推送到u8c + List saleorderRequestDtoList = new ArrayList<>(); + saleorderRequestDtoList.add(saleorderRequestDto); - Map> stringStringMap = new HashMap<>(); - stringStringMap.put("saleorder", saleorderRequestDtoList); - SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap)); + Map> stringStringMap = new HashMap<>(); + stringStringMap.put("saleorder", saleorderRequestDtoList); + SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap)); - String vreceiptcode = null; - String pk_corp = null; - String csaleid = null; - if (soSaleResultRootDto != null && soSaleResultRootDto.getParentvo() != null) { - SoSaleResultHeadDto parentvo = soSaleResultRootDto.getParentvo(); - vreceiptcode = parentvo.getVreceiptcode(); - pk_corp = parentvo.getPk_corp(); - csaleid = parentvo.getCsaleid(); + String vreceiptcode = null; + String pk_corp = null; + String csaleid = null; + if (soSaleResultRootDto != null && soSaleResultRootDto.getParentvo() != null) { + SoSaleResultHeadDto parentvo = soSaleResultRootDto.getParentvo(); + vreceiptcode = parentvo.getVreceiptcode(); + pk_corp = parentvo.getPk_corp(); + csaleid = parentvo.getCsaleid(); + } else { + logger.error("第一阶段推送,令人匪夷所思的错误,正常来说是不可能执行到这里的,sendU8CTOCOrder方法的错误会向上抛出! json:{}", JSON.toJSON(soSaleResultRootDto)); + } + logger.info("第一阶段:负数销售订单->(自动生成) 负数销售出库单抛出成功,销售订单编号:{} 销售订单主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp); + isOneSuccess = true; + //第一阶段记录成功! + updateSuccessOrFail2(oldValue, "Y", "success", vreceiptcode, csaleid); } else { - logger.error("第一阶段推送,令人匪夷所思的错误,正常来说是不可能执行到这里的,sendU8CTOCOrder方法的错误会向上抛出! json:{}", JSON.toJSON(soSaleResultRootDto)); + isOneSuccess = true; + logger.info("交易成功-红 业务日期:{} 汇总维度:{} 已经推送成功,不需要重新推送", header.getTradeSuccessAt(), keyGroup); } - logger.info("第一阶段:负数销售订单->(自动生成) 负数销售出库单抛出成功,销售订单编号:{} 销售订单主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp); - isOneSuccess = true; - //第一阶段记录成功 } catch (Exception e) { logger.error("第一阶段:负数销售订单->(自动生成) 负数销售出库单抛出异常", e); - //第一阶段记录失败 + //第一阶段记录失败! + String message = e.getMessage(); + if (message == null) { + message = "未知异常"; + } + updateSuccessOrFail2(oldValue, "N", message, null, null); } logger.info("结束第一阶段:负数销售订单->(自动生成) 负数销售出库单"); - if (isOneSuccess) { + if (isOneSuccess && !"Y".equals(newState3)) { //2024年9月4日 14:30:31 第一阶段推送成功,才能执行第二阶段,否则不能执行以下代码 logger.info("开始第二阶段:销售订单 ->(自动生成) 销售出库单 ->(自动生成) 销售发票"); try { + //验证数据完整性 + checkAllFail(oldValue, newState3, "2"); //取交易成功时间,生成业务日期 String generateBusinessDate = createGenerateBusinessDateTran(header); @@ -1416,11 +1718,19 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { } logger.info("第二阶段:负数销售订单->(自动生成) 负数销售出库单抛出成功,销售订单编号:{} 销售订单主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp); //第二阶段记录成功 + updateSuccessOrFail3(oldValue, "Y", "success", vreceiptcode, csaleid); } catch (Exception e) { logger.error("第二阶段:销售订单 ->(自动生成) 销售出库单 ->(自动生成) 销售发票失败", e); + String message = e.getMessage(); + if (message == null) { + message = "未知错误"; + } //第二阶段记录失败 + updateSuccessOrFail3(oldValue, "N", message, null, null); } logger.info("结束第二阶段:销售订单 ->(自动生成) 销售出库单 ->(自动生成) 销售发票"); + } else { + logger.info("交易成功-蓝 业务日期:{} 汇总维度:{}", header.getTradeSuccessAt(), keyGroup); } } } else { @@ -1433,4 +1743,385 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { } } } + + /** + * 批量修改成功、或者失败,适合档案查询的部分 + * + * @author liuyang + */ + private void updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiry(List errorHeaderDetailsDtoDtoList) { + + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + if (errorHeaderDetailsDtoDtoList != null && errorHeaderDetailsDtoDtoList.size() > 0) { + List tocofsSaleoutDetailedEntityList = new ArrayList<>(); + for (int i = 0; i < errorHeaderDetailsDtoDtoList.size(); i++) { + ErrorHeaderDetailsDtoDto errorHeaderDetailsDtoDto = errorHeaderDetailsDtoDtoList.get(i); + HeaderDto header = errorHeaderDetailsDtoDto.getHeader(); + List details = errorHeaderDetailsDtoDto.getDetails(); + String newstate = errorHeaderDetailsDtoDto.getNewstate(); + String newPushDate = errorHeaderDetailsDtoDto.getNewPushDate(); + String newTransmitInfo = errorHeaderDetailsDtoDto.getNewTransmitInfo(); + + //如果报错内容太长了,则仅保留500个长度 + if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) { + newTransmitInfo = newTransmitInfo.substring(0, 400); + } + + for (int j = 0; j < details.size(); j++) { + DetailsDto detailsDto = details.get(j); + + TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity(); + tocofsSaleoutDetailedEntity.setId(detailsDto.getId()); + tocofsSaleoutDetailedEntity.setNewpushdate(newPushDate); + tocofsSaleoutDetailedEntity.setNewtransmitinfo(newTransmitInfo); + tocofsSaleoutDetailedEntity.setNewstate(newstate); + tocofsSaleoutDetailedEntityList.add(tocofsSaleoutDetailedEntity); + } + } + + //以50行为一个批次更新状态 + if (tocofsSaleoutDetailedEntityList.size() > 0) { + List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsSaleoutDetailedEntityList, 50); + for (int i = 0; i < splitListByCount.size(); i++) { + List tocofsSaleoutDetailedEntityList1 = splitListByCount.get(i); + iTocofsSaleoutDetailedDao.entityInsertOrUpdateBatchStock1(tocofsSaleoutDetailedEntityList1); + } + } + } + } catch (Exception e) { + logger.error("填充出库明细日志抛出异常", e); + } + } + }); + thread.start(); + try { + thread.join(); + } catch (Exception e) { + logger.error("updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiry方法现场抛出异常", e); + } + } + + /** + * 处理调用U8C接口,抛出的异常,或者调用成功的记录 + * + * @author liuyang + */ + private void updateSuccessOrFail1(List sonDetailsDtoList, String newstate, String newTransmitInfo, String newsystemnumber, String newsystemprimary) { + if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) { + newTransmitInfo = newTransmitInfo.substring(0, 400); + } + + String finalNewTransmitInfo = newTransmitInfo; + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + String successY = "Y"; + if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) { + List tocofsSaleoutDetailedEntityList = new ArrayList<>(); + for (int i = 0; i < sonDetailsDtoList.size(); i++) { + SonDetailsDto sonDetailsDto = sonDetailsDtoList.get(i); + TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity(); + tocofsSaleoutDetailedEntity.setId(sonDetailsDto.getId()); + tocofsSaleoutDetailedEntity.setNewpushdate(getNewDateStr()); + tocofsSaleoutDetailedEntity.setNewtransmitinfo(finalNewTransmitInfo); + tocofsSaleoutDetailedEntity.setNewstate(newstate); + if (successY.equals(newstate)) { + tocofsSaleoutDetailedEntity.setNewsystemnumber(newsystemnumber); + tocofsSaleoutDetailedEntity.setNewsystemprimary(newsystemprimary); + } + tocofsSaleoutDetailedEntityList.add(tocofsSaleoutDetailedEntity); + } + + //以50行为一个批次,推送到Mysql + if (tocofsSaleoutDetailedEntityList.size() > 0) { + List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsSaleoutDetailedEntityList, 50); + for (int i = 0; i < splitListByCount.size(); i++) { + List tocofsSaleoutDetailedEntityList1 = splitListByCount.get(i); + iTocofsSaleoutDetailedDao.entityInsertOrUpdateBatchStock2(tocofsSaleoutDetailedEntityList1); + } + } + } + } catch (Exception e) { + logger.error("处理调用U8C接口,抛出的异常,或者调用成功的记录对应的方法抛出异常", e); + } + } + }); + thread.start(); + try { + thread.join(); + } catch (Exception e) { + logger.error("updateSuccessOrFail1方法现场抛出异常", e); + } + } + + /** + * 处理调用U8C接口,抛出的异常,或者调用成功的记录 + * + * @author liuyang + */ + private void updateSuccessOrFail2(List sonDetailsDtoList, String newstate, String newTransmitInfo, String newsystemnumber, String newsystemprimary) { + if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) { + newTransmitInfo = newTransmitInfo.substring(0, 400); + } + + String finalNewTransmitInfo = newTransmitInfo; + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + String successY = "Y"; + if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) { + List tocofsSaleoutDetailedEntityList = new ArrayList<>(); + for (int i = 0; i < sonDetailsDtoList.size(); i++) { + SonDetailsDto sonDetailsDto = sonDetailsDtoList.get(i); + TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity(); + tocofsSaleoutDetailedEntity.setId(sonDetailsDto.getId()); + tocofsSaleoutDetailedEntity.setDef1(getNewDateStr()); + tocofsSaleoutDetailedEntity.setDef2(finalNewTransmitInfo); + tocofsSaleoutDetailedEntity.setNewstate2(newstate); + if (successY.equals(newstate)) { + tocofsSaleoutDetailedEntity.setNewsystemnumber2(newsystemnumber); + tocofsSaleoutDetailedEntity.setNewsystemprimary2(newsystemprimary); + } + tocofsSaleoutDetailedEntityList.add(tocofsSaleoutDetailedEntity); + } + + //以50行为一个批次,推送到Mysql + if (tocofsSaleoutDetailedEntityList.size() > 0) { + List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsSaleoutDetailedEntityList, 50); + for (int i = 0; i < splitListByCount.size(); i++) { + List tocofsSaleoutDetailedEntityList1 = splitListByCount.get(i); + iTocofsSaleoutDetailedDao.entityInsertOrUpdateBatchStock3(tocofsSaleoutDetailedEntityList1); + } + } + } + } catch (Exception e) { + logger.error("处理调用U8C接口,抛出的异常,或者调用成功的记录对应的方法抛出异常", e); + } + } + }); + thread.start(); + try { + thread.join(); + } catch (Exception e) { + logger.error("updateSuccessOrFail2方法抛出异常", e); + } + } + + /** + * 处理调用U8C接口,抛出的异常,或者调用成功的记录 + * + * @author liuyang + */ + private void updateSuccessOrFail3(List sonDetailsDtoList, String newstate, String newTransmitInfo, String newsystemnumber, String newsystemprimary) { + if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) { + newTransmitInfo = newTransmitInfo.substring(0, 400); + } + + String finalNewTransmitInfo = newTransmitInfo; + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + String successY = "Y"; + if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) { + List tocofsSaleoutDetailedEntityList = new ArrayList<>(); + for (int i = 0; i < sonDetailsDtoList.size(); i++) { + SonDetailsDto sonDetailsDto = sonDetailsDtoList.get(i); + TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity(); + tocofsSaleoutDetailedEntity.setId(sonDetailsDto.getId()); + tocofsSaleoutDetailedEntity.setDef3(getNewDateStr()); + tocofsSaleoutDetailedEntity.setDef4(finalNewTransmitInfo); + tocofsSaleoutDetailedEntity.setNewstate3(newstate); + if (successY.equals(newstate)) { + tocofsSaleoutDetailedEntity.setNewsystemnumber3(newsystemnumber); + tocofsSaleoutDetailedEntity.setNewsystemprimary3(newsystemprimary); + } + tocofsSaleoutDetailedEntityList.add(tocofsSaleoutDetailedEntity); + } + + //以50行为一个批次,推送到Mysql + if (tocofsSaleoutDetailedEntityList.size() > 0) { + List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsSaleoutDetailedEntityList, 50); + for (int i = 0; i < splitListByCount.size(); i++) { + List tocofsSaleoutDetailedEntityList1 = splitListByCount.get(i); + iTocofsSaleoutDetailedDao.entityInsertOrUpdateBatchStock4(tocofsSaleoutDetailedEntityList1); + } + } + } + } catch (Exception e) { + logger.error("updateSuccessOrFail3:处理调用U8C接口,抛出的异常,或者调用成功的记录对应的方法抛出异常", e); + } + } + }); + thread.start(); + try { + thread.join(); + } catch (Exception e) { + logger.error("updateSuccessOrFail3方法抛出异常", e); + } + } + + /** + * 生成当前日期 + * + * @author liuyang + */ + private String getNewDateStr() { + LocalDateTime now = LocalDateTime.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + return now.format(formatter); + } + + /** + * 判断是否全部失败、或者全部成功 + * + * @author liuyang + */ + private void checkAllFail(List oldValue, String newstate, String type) { + if (oldValue != null && oldValue.size() > 0) { + if (newstate == null || "".equals(newstate)) { + newstate = "N"; + } + for (int i = 0; i < oldValue.size(); i++) { + SonDetailsDto sonDetailsDto = oldValue.get(i); + String newstate2 = sonDetailsDto.getNewState2(); + String newState3 = sonDetailsDto.getNewState3(); + if (newstate2 == null) { + newstate2 = "N"; + } + if (newState3 == null) { + newState3 = "N"; + } + if (type.equals("1")) {//红 + if (!newstate2.equals(newstate)) { + Assert.state(false, "业务逻辑错误,标识为:{} 出库明细主键为:{}的数据行存在异常!", newstate2, sonDetailsDto.getId()); + } + } + if (type.equals("2")) {//蓝 + if (!newState3.equals(newstate)) { + Assert.state(false, "业务逻辑错误,标识为:{} 出库明细主键为:{}的数据行存在异常!", newState3, sonDetailsDto.getId()); + } + } + } + } + } + + /** + * 计算时间间隔 + * + * @author liuyang + */ + public String computingTime(String param) { + if (param != null && !"".equals(param)) { + String[] split = param.split("/"); + if (!(split.length == 2)) { + Assert.state(false, "传递的日期格式不完整 格式参考:2024-04-01/2024-04-30"); + } + + LocalDate startDate = LocalDate.parse(split[0]); + LocalDate endDate = LocalDate.parse(split[1]); + + List stringArrayList = new ArrayList<>(); + List dateRange = getDateRange(startDate, endDate); + if (dateRange != null && dateRange.size() > 0) { + for (int i = 0; i < dateRange.size(); i++) { + String dateStr = dateRange.get(i); + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append(dateStr); + stringBuffer.append(" 00:00:00"); + stringBuffer.append(","); + stringBuffer.append(dateStr); + stringBuffer.append(" 23:59:59"); + stringArrayList.add(stringBuffer.toString()); + } + } + String collectDateStr = stringArrayList.stream().collect(Collectors.joining("*")); + logger.info("类型:time_frame 生成的日期范围:" + collectDateStr); + return collectDateStr; + } + return null; + } + + private List getDateRange(LocalDate startDate, LocalDate endDate) { + List dateRange = new ArrayList<>(); + LocalDate currentDate = startDate; + while (!currentDate.isAfter(endDate)) { + dateRange.add(currentDate.format(DateTimeFormatter.ISO_DATE)); + currentDate = currentDate.plusDays(1); + } + return dateRange; + } + + /** + * 计算全天时间段 + * + * @author liuyang + */ + public List calculateCalculateEntireDayPeriod(String dateStr) { + List startAndEnd = new ArrayList<>(); + + String calculateYesterdayStr = null; + if (dateStr != null) { + calculateYesterdayStr = dateStr; + } else { + calculateYesterdayStr = calculateYesterdayDate();//拉取'昨天'的日期 + } + logger.info("OFS销售出库单同步U8C销售订单,目标拉取时间:" + calculateYesterdayStr); + + for (int i = 0; i <= 23; i++) { + String iStr = null; + if (i <= 9) { + iStr = "0" + i; + } else { + iStr = String.valueOf(i); + } + String startTime = calculateYesterdayStr + " " + iStr + ":00:00"; + String endTime = calculateYesterdayStr + " " + iStr + ":59:59"; + + StartAndEndVo startAndEndVo = new StartAndEndVo(); + startAndEndVo.setStart_time(startTime); + startAndEndVo.setEnd_time(endTime); + startAndEnd.add(startAndEndVo); + } + return startAndEnd; + } + + /** + * 计算昨天的单据日期,基于定时器在凌晨5分执行的情况下 + * + * @author liuyang + */ + public String calculateYesterdayDate() { + DateTime yesterdayDate = DateUtil.yesterday(); + return DateUtil.format(yesterdayDate, "yyyy-MM-dd"); + } + + /** + * 分割日期之后,再进行推送 + * + * @author liuyang + */ + private void splitDateAndPush(String param) throws Exception { + Assert.notNull(param, "param不能为空!"); + Assert.state(!"".equals(param), "param不能为空!"); + + if (param.contains("*")) { + String[] params = param.split("\\*"); + if (params.length > 0) { + for (int i = 0; i < params.length; i++) { + String indexStr = params[i]; + String[] split = indexStr.split(","); + startImplementStockByTime(split[0], split[1]); + } + } + } else { + String[] split = param.split(","); + startImplementStockByTime(split[0], split[1]); + } + } } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ErrorHeaderDetailsDtoDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ErrorHeaderDetailsDtoDto.java new file mode 100644 index 00000000..6ec2b7f0 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ErrorHeaderDetailsDtoDto.java @@ -0,0 +1,22 @@ +package com.hzya.frame.plugin.lets.u8cdto; + +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto; +import lombok.Data; + +/** + * @Author:liuyang + * @Package:com.hzya.frame.plugin.lets.u8cdto + * @Project:kangarooDataCenterV3 + * @name:ErrorHeaderDetailsDtoDto + * @Date:2024/9/5 15:48 + * @Filename:ErrorHeaderDetailsDtoDto + */ +@Data +public class ErrorHeaderDetailsDtoDto extends HeaderDetailsDto { + //(销售)推送时间 + private String newPushDate; + //(销售)报错详情 + private String newTransmitInfo; + //(销售)出库同步是否成功 + private String newstate; +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/SaveOrUpdateBusinessLogUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/SaveOrUpdateBusinessLogUtil.java index 14f57bf5..874c579f 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/SaveOrUpdateBusinessLogUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/SaveOrUpdateBusinessLogUtil.java @@ -95,11 +95,11 @@ public class SaveOrUpdateBusinessLogUtil { //2024年9月2日 17:09:07 如果失败,仅保留500个字符,用于平衡数据库性能 //2024年9月2日 17:15:19 如果该单据判断为失败,则integration_task_living_details表的root_app_new_data、new_transmit_info字段,仅保留500个长度的字符,用于平衡性能,速网、珍视名项目这一块性能很差 String rootAppNewData = integrationTaskLivingDetailsEntity.getRootAppNewData(); - if (integrationTaskLivingDetailsEntity.getRootAppNewData() != null && !integrationTaskLivingDetailsEntity.getRootAppNewData().trim().equals("") && integrationTaskLivingDetailsEntity.getRootAppNewData().length()>=500) { + if (integrationTaskLivingDetailsEntity.getRootAppNewData() != null && !integrationTaskLivingDetailsEntity.getRootAppNewData().trim().equals("") && integrationTaskLivingDetailsEntity.getRootAppNewData().length() >= 500) { rootAppNewData = integrationTaskLivingDetailsEntity.getRootAppNewData().substring(0, 500); } String newTransmitInfo = integrationTaskLivingDetailsEntity.getNewTransmitInfo(); - if (integrationTaskLivingDetailsEntity.getNewTransmitInfo() != null && !integrationTaskLivingDetailsEntity.getNewTransmitInfo().trim().equals("") && integrationTaskLivingDetailsEntity.getNewTransmitInfo().length()>=500) { + if (integrationTaskLivingDetailsEntity.getNewTransmitInfo() != null && !integrationTaskLivingDetailsEntity.getNewTransmitInfo().trim().equals("") && integrationTaskLivingDetailsEntity.getNewTransmitInfo().length() >= 500) { newTransmitInfo = integrationTaskLivingDetailsEntity.getNewTransmitInfo().substring(0, 500); } integrationTaskLivingDetailsEntity.setRootAppNewData(rootAppNewData); diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java index cf3d54ce..49783c00 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java @@ -1,13 +1,19 @@ package com.hzya.frame.plugin.lets.plugin.sales; import com.hzya.frame.WebappApplication; +import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDetailedDao; +import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; +import com.hzya.frame.plugin.lets.u8cdto.ErrorHeaderDetailsDtoDto; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; +import java.util.ArrayList; +import java.util.List; + import static org.junit.jupiter.api.Assertions.*; /** @@ -25,6 +31,9 @@ class SoSaleOutPluginInitializerToCTest { @Autowired private SoSaleOutPluginInitializerToC soSaleOutPluginInitializerToC; + @Autowired + private ITocofsSaleoutDetailedDao iTocofsSaleoutDetailedDao; + @Test void startImplement() throws Exception { // soSaleOutPluginInitializerToC.startImplement(null, null); @@ -32,12 +41,39 @@ class SoSaleOutPluginInitializerToCTest { try { // QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024081500000001"); +// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024081500000001"); // soSaleOutPluginInitializerToC.getOfsOrder(queryOfsSoSaleOutVo, 1L); // soSaleOutPluginInitializerToC.startImplement("2024-04-28 00:00:00", "2024-04-28 23:59:59"); + +// ErrorHeaderDetailsDtoDto errorHeaderDetailsDtoDto = new ErrorHeaderDetailsDtoDto(); +// errorHeaderDetailsDtoDto.setNewPushDate(getNewDateStr()); +// errorHeaderDetailsDtoDto.setNewTransmitInfo(message); +// errorHeaderDetailsDtoDto.setNewstate("N"); +// errorHeaderDetailsDtoDto.setHeader(header); +// errorHeaderDetailsDtoDto.setDetails(details); +// errorHeaderDetailsDtoDto. } catch (Exception e) { e.printStackTrace(); } + +// try { +// List tocofsSaleoutDetailedEntities = new ArrayList<>(); +// TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity(); +// tocofsSaleoutDetailedEntity.setNewpushdate("2024-09-05 00:00:03"); +// tocofsSaleoutDetailedEntity.setNewtransmitinfo("错误消息22"); +// tocofsSaleoutDetailedEntity.setNewstate("Y"); +// tocofsSaleoutDetailedEntity.setId("80822338"); +// tocofsSaleoutDetailedEntities.add(tocofsSaleoutDetailedEntity); +// iTocofsSaleoutDetailedDao.entityInsertOrUpdateBatchStock1(tocofsSaleoutDetailedEntities); +// } catch (Exception e) { +// e.printStackTrace(); +// } + +// String aaa = "{\"barcode\":\"01031000084\",\"brand_name\":\"护童\",\"brand_no\":\"1\",\"cost_price\":\"0.00\",\"discount\":\"0.00\",\"from_mask\":\"0\",\"gift_type\":\"1\",\"good_prop1\":\"\",\"good_prop2\":\"\",\"good_prop3\":\"\",\"good_prop4\":\"\",\"good_prop5\":\"\",\"good_prop6\":\"\",\"goods_amount\":\"0.0000\",\"goods_count\":\"1.0000\",\"goods_id\":\"4662\",\"goods_name\":\"G501_椅套_奶油桃\",\"goods_no\":\"01031000084\",\"goods_type\":\"1\",\"is_package\":\"false\",\"market_price\":\"0.00\",\"paid\":\"0.00\",\"platform_id\":\"0\",\"position_details_list\":[{\"batch_no\":\"\",\"expire_date\":\"\",\"position_goods_count\":\"1.0000\",\"position_id\":\"-6\",\"position_no\":\"其它未上架\",\"rec_id\":\"644060\",\"stockout_detail_id\":\"830189\"}],\"prop1\":\"\",\"prop2\":\"\",\"prop3\":\"\",\"prop4\":\"\",\"prop5\":\"\",\"prop6\":\"\",\"rec_id\":\"830189\",\"refund_status\":\"0\",\"remark\":\"赠品策略编号:ZP24080204,规则名称:G501 奶油桃,原始单号:4032308235772095218\",\"sale_order_id\":\"1251671\",\"sell_price\":\"0.00\",\"share_amount\":\"0.00\",\"share_post_amount\":\"0.00\",\"share_price\":\"0.00\",\"spec_code\":\"\",\"spec_id\":\"4526\",\"spec_name\":\"G501_椅套_奶油桃\",\"spec_no\":\"01031000084\",\"src_oid\":\"AD202409050010\",\"src_order_detail_id\":\"1251671\",\"src_tid\":\"4032308235772095218\",\"stockout_id\":\"630492\",\"suite_no\":\"\",\"tax_rate\":\"0.00\",\"total_amount\":\"0.00\",\"weight\":\"0.0000\"}"; +// System.out.println(aaa.length()); + + + soSaleOutPluginInitializerToC.computingTime("2024-01-01/2024-01-25"); } } \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/DetailsDto.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/DetailsDto.java index d7ec85fa..cc4379de 100755 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/DetailsDto.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/DetailsDto.java @@ -4,7 +4,6 @@ import lombok.Data; @Data public class DetailsDto { - private String id; private String clientCode; private String companyCode; @@ -34,6 +33,20 @@ public class DetailsDto { private String createdBy; private String lastUpdated; private String lastUpdatedBy; - //表头对象 + /** + * 额外参数:表头对象 + */ private HeaderDto headerDto; + /** + * 额外参数:(销售)出库同步是否成功 + */ + private String newState; + /** + * 额外参数:(销售)交易成功(红)是否成功 + */ + private String newState2; + /** + * 额外参数:(销售)交易成功(蓝)是否成功 + */ + private String newState3; } \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/HeaderDetailsDto.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/HeaderDetailsDto.java index 5198d350..342cb425 100755 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/HeaderDetailsDto.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/HeaderDetailsDto.java @@ -1,5 +1,7 @@ package com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch; +import lombok.Data; + import java.util.List; /** @@ -8,25 +10,8 @@ import java.util.List; * @author lzltool.com * @website https://www.lzltool.com/JsonToJava */ - +@Data public class HeaderDetailsDto { - private HeaderDto header; private List details; - - public void setHeader(HeaderDto header) { - this.header = header; - } - - public HeaderDto getHeader() { - return this.header; - } - - public void setDetails(List details) { - this.details = details; - } - - public List getDetails() { - return this.details; - } } \ No newline at end of file