异常处理:为销售和退货同步方法添加try-catch块

为销售和退货同步方法(startImplement...)添加try-catch块,以处理可能的异常并记录错误。改进了方法
的健壮性,确保在遇到异常时能够优雅地处理,避免程序崩溃。
This commit is contained in:
liuy 2024-09-25 16:58:30 +08:00
parent 683593724d
commit 34097c86b1
5 changed files with 354 additions and 300 deletions

View File

@ -236,39 +236,43 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
* @author liuyang * @author liuyang
*/ */
public void startImplementByStockTime(String startTime, String endTime) throws Exception { public void startImplementByStockTime(String startTime, String endTime) throws Exception {
long startMillis = System.currentTimeMillis(); try {
String threadNameStr = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单开始 同步日期:{} 汇总维度:{}", startTime, endTime); long startMillis = System.currentTimeMillis();
logger.info(threadNameStr); String threadNameStr = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单开始 同步日期:{} 汇总维度:{}", startTime, endTime);
logger.info(threadNameStr);
Assert.notNull(startTime, "出库开始时间不能为空"); Assert.notNull(startTime, "出库开始时间不能为空");
Assert.notNull(endTime, "出库结束时间不能为空"); Assert.notNull(endTime, "出库结束时间不能为空");
// CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); // CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); String tobShop = shopTobOrToCUtil.getCommaShop("TOB");
List<HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>(); List<HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setShipAt_start(startTime); queryOfsSoSaleOutVo.setShipAt_start(startTime);
queryOfsSoSaleOutVo.setShipAt_end(endTime); queryOfsSoSaleOutVo.setShipAt_end(endTime);
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
// queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); // queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
queryOfsSoSaleOutVo.setStatus(900L); queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop); queryOfsSoSaleOutVo.setStoreCode(tobShop);
// queryOfsSoSaleOutVo.setCode("LETS-SH2024010200000004"); // queryOfsSoSaleOutVo.setCode("LETS-SH2024010200000004");
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
logger.info("插件:{} (库存)O接口返回行数{} 时间段:{} {}", getPluginName(), headerDetailsDtoList.size(), startTime, endTime); logger.info("插件:{} (库存)O接口返回行数{} 时间段:{} {}", getPluginName(), headerDetailsDtoList.size(), startTime, endTime);
if (headerDetailsDtoList.size() > 0) { if (headerDetailsDtoList.size() > 0) {
getSetStock(headerDetailsDtoList); getSetStock(headerDetailsDtoList);
} else { } else {
logger.info("没有查询到任何数据!不需要同步"); logger.info("没有查询到任何数据!不需要同步");
} }
long endMillis = System.currentTimeMillis(); long endMillis = System.currentTimeMillis();
String threadNameEnd = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单结束 同步日期:{} 汇总维度:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); String threadNameEnd = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单结束 同步日期:{} 汇总维度:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
logger.info(threadNameEnd); logger.info(threadNameEnd);
} catch (Exception e) {
logger.error("startImplementByStockTime方法抛出异常", e);
}
} }
/** /**
@ -277,39 +281,43 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
* @author liuyang * @author liuyang
*/ */
public void startImplementByTranTime(String startTime, String endTime) throws Exception { public void startImplementByTranTime(String startTime, String endTime) throws Exception {
long startMillis = System.currentTimeMillis(); try {
String threadNameStrStart = StrUtil.format("OFS销售出库(TOB交易成功)同步U8C销售发票开始 开始时间:{} 结束时间:{}", startTime, endTime); long startMillis = System.currentTimeMillis();
logger.info(threadNameStrStart); String threadNameStrStart = StrUtil.format("OFS销售出库(TOB交易成功)同步U8C销售发票开始 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrStart);
Assert.notNull(startTime, "交易开始时间不能为空"); Assert.notNull(startTime, "交易开始时间不能为空");
Assert.notNull(endTime, "交易结束时间不能为空"); Assert.notNull(endTime, "交易结束时间不能为空");
String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); String tobShop = shopTobOrToCUtil.getCommaShop("TOB");
List<HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>(); List<HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
// queryOfsSoSaleOutVo.setShipAt_start(startTime); // queryOfsSoSaleOutVo.setShipAt_start(startTime);
// queryOfsSoSaleOutVo.setShipAt_end(endTime); // queryOfsSoSaleOutVo.setShipAt_end(endTime);
queryOfsSoSaleOutVo.setTradeSuccessAt_start(startTime); queryOfsSoSaleOutVo.setTradeSuccessAt_start(startTime);
queryOfsSoSaleOutVo.setTradeSuccessAt_end(endTime); queryOfsSoSaleOutVo.setTradeSuccessAt_end(endTime);
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
queryOfsSoSaleOutVo.setSourceOrderStatus("TRADE_FINISHED");//交易成功状态 queryOfsSoSaleOutVo.setSourceOrderStatus("TRADE_FINISHED");//交易成功状态
// queryOfsSoSaleOutVo.setStatus(900L); // queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop); queryOfsSoSaleOutVo.setStoreCode(tobShop);
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
logger.info("插件:{} (确认收入)O接口返回行数{} 时间段:{} {}", getPluginName(), headerDetailsDtoList.size(), startTime, endTime); logger.info("插件:{} (确认收入)O接口返回行数{} 时间段:{} {}", getPluginName(), headerDetailsDtoList.size(), startTime, endTime);
if (headerDetailsDtoList.size() > 0) { if (headerDetailsDtoList.size() > 0) {
getSetStockTran(headerDetailsDtoList); getSetStockTran(headerDetailsDtoList);
} else { } else {
logger.info("没有查询到任何数据!不需要同步"); logger.info("没有查询到任何数据!不需要同步");
} }
long endMillis = System.currentTimeMillis(); long endMillis = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("OFS销售出库(TOB交易成功)同步U8C销售发票结束 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); String threadNameStrEnd = StrUtil.format("OFS销售出库(TOB交易成功)同步U8C销售发票结束 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
logger.info(threadNameStrEnd); logger.info(threadNameStrEnd);
} catch (Exception e) {
logger.error("startImplementByTranTime方法不能为空", e);
}
} }
/** /**
@ -318,39 +326,43 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
* @author liuyang * @author liuyang
*/ */
public void startImplementByCode(String code, String sceneType) throws Exception { public void startImplementByCode(String code, String sceneType) throws Exception {
long startMillis = System.currentTimeMillis(); try {
String threadNameStrStart = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单开始 出库单单号:{}", code); long startMillis = System.currentTimeMillis();
logger.info(threadNameStrStart); String threadNameStrStart = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单开始 出库单单号:{}", code);
logger.info(threadNameStrStart);
Assert.notNull(code, "出库单单不能为空"); Assert.notNull(code, "出库单单不能为空");
String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); String tobShop = shopTobOrToCUtil.getCommaShop("TOB");
logger.info("TOB-OFS店铺编码{}", tobShop); logger.info("TOB-OFS店铺编码{}", tobShop);
List<HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>(); List<HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
//2024年8月30日 10:41:55 如果按编码查询是否应该考虑仅查询已发货的数据 //2024年8月30日 10:41:55 如果按编码查询是否应该考虑仅查询已发货的数据
queryOfsSoSaleOutVo.setStatus(900L); queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop); queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setCode(code); queryOfsSoSaleOutVo.setCode(code);
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
logger.info("根据单据号查询:数据返回行数:{}", headerDetailsDtoList.size()); logger.info("根据单据号查询:数据返回行数:{}", headerDetailsDtoList.size());
if (headerDetailsDtoList.size() > 0) { if (headerDetailsDtoList.size() > 0) {
if (sceneType.equals("stock")) { if (sceneType.equals("stock")) {
getSetStock(headerDetailsDtoList); getSetStock(headerDetailsDtoList);
} else if (sceneType.equals("tran")) { } else if (sceneType.equals("tran")) {
getSetStockTran(headerDetailsDtoList); getSetStockTran(headerDetailsDtoList);
}
} else {
logger.info("没有查询到任何数据!不需要同步");
} }
} else {
logger.info("没有查询到任何数据!不需要同步");
}
long endMillis = System.currentTimeMillis(); long endMillis = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单结束 出库单单号:{} 耗时:{}", code, (endMillis - startMillis)); String threadNameStrEnd = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单结束 出库单单号:{} 耗时:{}", code, (endMillis - startMillis));
logger.info(threadNameStrEnd); logger.info(threadNameStrEnd);
} catch (Exception e) {
logger.error("startImplementByCode方法抛出异常", e);
}
} }
/** /**

View File

@ -194,40 +194,44 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
* @author liuyang * @author liuyang
*/ */
public void startImplementStockByTime(String startTime, String endTime) throws Exception { public void startImplementStockByTime(String startTime, String endTime) throws Exception {
long startMillis = System.currentTimeMillis(); try {
String threadNameStrStart = StrUtil.format("开始 OFS销售出库(TOC)同步U8C销售订单 开始 开始时间:{} 结束时间:{}", startTime, endTime); long startMillis = System.currentTimeMillis();
logger.info(threadNameStrStart); String threadNameStrStart = StrUtil.format("开始 OFS销售出库(TOC)同步U8C销售订单 开始 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrStart);
Assert.notNull(startTime, "查询条件,开始时间不能为空!"); Assert.notNull(startTime, "查询条件,开始时间不能为空!");
Assert.notNull(endTime, "查询条件,结束时间不能为空!"); Assert.notNull(endTime, "查询条件,结束时间不能为空!");
// CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); // CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
String tobShop = shopTobOrToCUtil.getCommaShop("TOC"); String tobShop = shopTobOrToCUtil.getCommaShop("TOC");
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>(); List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
// queryOfsSoSaleOutVo.setShipAt_start(calculateDateVo.getStart_time()); // queryOfsSoSaleOutVo.setShipAt_start(calculateDateVo.getStart_time());
// queryOfsSoSaleOutVo.setShipAt_end(calculateDateVo.getEnd_time()); // queryOfsSoSaleOutVo.setShipAt_end(calculateDateVo.getEnd_time());
queryOfsSoSaleOutVo.setShipAt_start(startTime); queryOfsSoSaleOutVo.setShipAt_start(startTime);
queryOfsSoSaleOutVo.setShipAt_end(endTime); queryOfsSoSaleOutVo.setShipAt_end(endTime);
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
queryOfsSoSaleOutVo.setStatus(900L); queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(100L); queryOfsSoSaleOutVo.setPageSize(100L);
queryOfsSoSaleOutVo.setStoreCode(tobShop); queryOfsSoSaleOutVo.setStoreCode(tobShop);
// queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003"); // queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003");
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
logger.info("数据返回行数:{}", headerDetailsDtoList.size()); logger.info("数据返回行数:{}", headerDetailsDtoList.size());
if (headerDetailsDtoList.size() > 0) { if (headerDetailsDtoList.size() > 0) {
getSetStock(headerDetailsDtoList); getSetStock(headerDetailsDtoList);
} else { } else {
logger.info("TOC没有查询到任何数据不需要同步"); logger.info("TOC没有查询到任何数据不需要同步");
} }
long endMillis = System.currentTimeMillis(); long endMillis = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("结束 OFS销售出库(TOC)同步U8C销售订单 结束 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); String threadNameStrEnd = StrUtil.format("结束 OFS销售出库(TOC)同步U8C销售订单 结束 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
logger.info(threadNameStrEnd); logger.info(threadNameStrEnd);
} catch (Exception e) {
logger.error("startImplementStockByTime方法抛出异常", e);
}
} }
/** /**
@ -237,38 +241,42 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
* @author liuyang * @author liuyang
*/ */
public void startImplementStockByCode(String code, String sceneType) throws Exception { public void startImplementStockByCode(String code, String sceneType) throws Exception {
long startMillis = System.currentTimeMillis(); try {
String threadNameStrStart = StrUtil.format("OFS销售出库(TOC)同步U8C销售订单 开始 出库单单据号:{}", code); long startMillis = System.currentTimeMillis();
logger.info(threadNameStrStart); String threadNameStrStart = StrUtil.format("OFS销售出库(TOC)同步U8C销售订单 开始 出库单单据号:{}", code);
logger.info(threadNameStrStart);
Assert.notNull(code, "O出库单编码不能为空code is null"); Assert.notNull(code, "O出库单编码不能为空code is null");
Assert.notNull(sceneType, "场景类型不能为空!"); Assert.notNull(sceneType, "场景类型不能为空!");
String tobShop = shopTobOrToCUtil.getCommaShop("TOC"); String tobShop = shopTobOrToCUtil.getCommaShop("TOC");
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>(); List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
// queryOfsSoSaleOutVo.setStatus(900L); // queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(100L); queryOfsSoSaleOutVo.setPageSize(100L);
// queryOfsSoSaleOutVo.setStoreCode(tobShop); // queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setCode(code); queryOfsSoSaleOutVo.setCode(code);
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
logger.info("数据返回行数:{}", headerDetailsDtoList.size()); logger.info("数据返回行数:{}", headerDetailsDtoList.size());
if (headerDetailsDtoList.size() > 0) { if (headerDetailsDtoList.size() > 0) {
if (sceneType.equals("stock")) { if (sceneType.equals("stock")) {
getSetStock(headerDetailsDtoList); getSetStock(headerDetailsDtoList);
} else if (sceneType.equals("tran")) { } else if (sceneType.equals("tran")) {
getSetTran(headerDetailsDtoList); getSetTran(headerDetailsDtoList);
}
} else {
logger.info("没有查询到任何数据!不需要同步");
} }
} else {
logger.info("没有查询到任何数据!不需要同步");
}
long endMillis = System.currentTimeMillis(); long endMillis = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("OFS销售出库(TOC)同步U8C销售订单 结束 出库单单据号:{} 耗时:{}", code, (endMillis - startMillis)); String threadNameStrEnd = StrUtil.format("OFS销售出库(TOC)同步U8C销售订单 结束 出库单单据号:{} 耗时:{}", code, (endMillis - startMillis));
logger.info(threadNameStrEnd); logger.info(threadNameStrEnd);
} catch (Exception e) {
logger.error("startImplementStockByCode不能为空", e);
}
} }
/** /**
@ -279,41 +287,45 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
* @author liuyang * @author liuyang
*/ */
public void startImplementTranByTime(String startTime, String endTime) throws Exception { public void startImplementTranByTime(String startTime, String endTime) throws Exception {
long startMillis = System.currentTimeMillis(); try {
String threadNameStrStart = StrUtil.format("开始OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{}", startTime, endTime); long startMillis = System.currentTimeMillis();
logger.info(threadNameStrStart); String threadNameStrStart = StrUtil.format("开始OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrStart);
Assert.notNull(startTime, "查询条件,开始时间不能为空!"); Assert.notNull(startTime, "查询条件,开始时间不能为空!");
Assert.notNull(endTime, "查询条件,结束时间不能为空!"); Assert.notNull(endTime, "查询条件,结束时间不能为空!");
// CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); // CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
String tocShop = shopTobOrToCUtil.getCommaShop("TOC"); String tocShop = shopTobOrToCUtil.getCommaShop("TOC");
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>(); List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
// queryOfsSoSaleOutVo.setShipAt_start(calculateDateVo.getStart_time()); // queryOfsSoSaleOutVo.setShipAt_start(calculateDateVo.getStart_time());
// queryOfsSoSaleOutVo.setShipAt_end(calculateDateVo.getEnd_time()); // queryOfsSoSaleOutVo.setShipAt_end(calculateDateVo.getEnd_time());
queryOfsSoSaleOutVo.setTradeSuccessAt_start(startTime); queryOfsSoSaleOutVo.setTradeSuccessAt_start(startTime);
queryOfsSoSaleOutVo.setTradeSuccessAt_end(endTime); queryOfsSoSaleOutVo.setTradeSuccessAt_end(endTime);
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
queryOfsSoSaleOutVo.setSourceOrderStatus("TRADE_FINISHED");//交易成功状态 queryOfsSoSaleOutVo.setSourceOrderStatus("TRADE_FINISHED");//交易成功状态
// queryOfsSoSaleOutVo.setStatus(900L); // queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(100L); queryOfsSoSaleOutVo.setPageSize(100L);
queryOfsSoSaleOutVo.setStoreCode(tocShop); queryOfsSoSaleOutVo.setStoreCode(tocShop);
// queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003"); // queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003");
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
logger.info("TOC数据返回行数{}", headerDetailsDtoList.size()); logger.info("TOC数据返回行数{}", headerDetailsDtoList.size());
if (headerDetailsDtoList.size() > 0) { if (headerDetailsDtoList.size() > 0) {
getSetTran(headerDetailsDtoList); getSetTran(headerDetailsDtoList);
} else { } else {
logger.info("TOC没有查询到任何数据不需要同步"); logger.info("TOC没有查询到任何数据不需要同步");
} }
long endMillis = System.currentTimeMillis(); long endMillis = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("结束OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); String threadNameStrEnd = StrUtil.format("结束OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
logger.info(threadNameStrEnd); logger.info(threadNameStrEnd);
} catch (Exception e) {
logger.error("startImplementTranByTime方法抛出异常", e);
}
} }
/** /**

View File

@ -237,38 +237,42 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
* @author liuyang * @author liuyang
*/ */
public void startImplementByStockTime(String startTime, String endTime) throws Exception { public void startImplementByStockTime(String startTime, String endTime) throws Exception {
long startMillis = System.currentTimeMillis(); try {
String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime); long startMillis = System.currentTimeMillis();
logger.info(threadNameStrStart); String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrStart);
Assert.notNull(startTime, "startTime不能为空"); Assert.notNull(startTime, "startTime不能为空");
Assert.notNull(endTime, "endTime不能为空"); Assert.notNull(endTime, "endTime不能为空");
//生成一个时间范围 //生成一个时间范围
// StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); // StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
//2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性
String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); String tobShop = shopTobOrToCUtil.getCommaShop("TOB");
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClosedAt_start(startTime); queryOfsSoSaleOutVo.setClosedAt_start(startTime);
queryOfsSoSaleOutVo.setClosedAt_end(endTime); queryOfsSoSaleOutVo.setClosedAt_end(endTime);
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop); queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
// queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001"); // queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001");
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
logger.info("插件:{} (库存)O接口返回行数{} 时间段:{} {}", getPluginName(), returnGoodHeaderDetailsDataDtoArrayList.size(), startTime, endTime); logger.info("插件:{} (库存)O接口返回行数{} 时间段:{} {}", getPluginName(), returnGoodHeaderDetailsDataDtoArrayList.size(), startTime, endTime);
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSetStock(returnGoodHeaderDetailsDataDtoArrayList); getSetStock(returnGoodHeaderDetailsDataDtoArrayList);
} else { } else {
logger.info("没有查询到任何数据!不需要同步"); logger.info("没有查询到任何数据!不需要同步");
} }
long endMillis = System.currentTimeMillis(); long endMillis = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
logger.info(threadNameStrEnd); logger.info(threadNameStrEnd);
} catch (Exception e) {
logger.error("startImplementByStockTime方法抛出异常", e);
}
} }
/** /**
@ -277,40 +281,44 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
* @author liuyang * @author liuyang
*/ */
public void startImplementByTradeTime(String startTime, String endTime) throws Exception { public void startImplementByTradeTime(String startTime, String endTime) throws Exception {
long startMillis = System.currentTimeMillis(); try {
String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime); long startMillis = System.currentTimeMillis();
logger.info(threadNameStrStart); String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrStart);
Assert.notNull(startTime, "startTime不能为空"); Assert.notNull(startTime, "startTime不能为空");
Assert.notNull(endTime, "endTime不能为空"); Assert.notNull(endTime, "endTime不能为空");
//生成一个时间范围 //生成一个时间范围
// StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); // StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
//2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性
String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); String tobShop = shopTobOrToCUtil.getCommaShop("TOB");
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setRefundedAt_start(startTime); queryOfsSoSaleOutVo.setRefundedAt_start(startTime);
queryOfsSoSaleOutVo.setRefundedAt_end(endTime); queryOfsSoSaleOutVo.setRefundedAt_end(endTime);
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop); queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
queryOfsSoSaleOutVo.setRefundStatus("900"); queryOfsSoSaleOutVo.setRefundStatus("900");
// queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001"); // queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001");
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
logger.info("插件:{} (确认收入)O接口返回行数{} 时间段:{} {}", getPluginName(), returnGoodHeaderDetailsDataDtoArrayList.size(), startTime, endTime); logger.info("插件:{} (确认收入)O接口返回行数{} 时间段:{} {}", getPluginName(), returnGoodHeaderDetailsDataDtoArrayList.size(), startTime, endTime);
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSetTrade(returnGoodHeaderDetailsDataDtoArrayList); getSetTrade(returnGoodHeaderDetailsDataDtoArrayList);
} else { } else {
logger.info("没有查询到任何数据!不需要同步"); logger.info("没有查询到任何数据!不需要同步");
} }
long endMillis = System.currentTimeMillis(); long endMillis = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
logger.info(threadNameStrEnd); logger.info(threadNameStrEnd);
} catch (Exception e) {
logger.error("startImplementByTradeTime方法抛出异常", e);
}
} }
/** /**
@ -319,42 +327,46 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
* @author liuyang * @author liuyang
*/ */
public void startImplementByCode(String code, String sceneType) throws Exception { public void startImplementByCode(String code, String sceneType) throws Exception {
long startMillis = System.currentTimeMillis(); try {
String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 售后入库单号:{}", code); long startMillis = System.currentTimeMillis();
logger.info(threadNameStrStart); String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 售后入库单号:{}", code);
logger.info(threadNameStrStart);
Assert.notNull(code, "code不能为空"); Assert.notNull(code, "code不能为空");
//生成一个时间范围 //生成一个时间范围
// StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); // StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
//2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性
String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); String tobShop = shopTobOrToCUtil.getCommaShop("TOB");
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
// queryOfsSoSaleOutVo.setClosedAt_start("2002-01-01 00:00:00");// 2024年8月19日 17:13:35 仅作为接口参数验证O口头反馈根据单号查询不会启用时间范围搜索 // queryOfsSoSaleOutVo.setClosedAt_start("2002-01-01 00:00:00");// 2024年8月19日 17:13:35 仅作为接口参数验证O口头反馈根据单号查询不会启用时间范围搜索
// queryOfsSoSaleOutVo.setClosedAt_end("2002-01-01 23:59:59"); // queryOfsSoSaleOutVo.setClosedAt_end("2002-01-01 23:59:59");
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setPageSize(50L);
//测试 //测试
queryOfsSoSaleOutVo.setStoreCode(tobShop); queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setCode(code); queryOfsSoSaleOutVo.setCode(code);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
if (sceneType.equals("stock")) { if (sceneType.equals("stock")) {
getSetStock(returnGoodHeaderDetailsDataDtoArrayList); getSetStock(returnGoodHeaderDetailsDataDtoArrayList);
} else if (sceneType.equals("tran")) { } else if (sceneType.equals("tran")) {
getSetTrade(returnGoodHeaderDetailsDataDtoArrayList); getSetTrade(returnGoodHeaderDetailsDataDtoArrayList);
}
} else {
logger.info("没有查询到任何数据!不需要同步");
} }
} else {
logger.info("没有查询到任何数据!不需要同步");
}
long endMillis = System.currentTimeMillis(); long endMillis = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 售后入库单号:{} 耗时:{}", code, (endMillis - startMillis)); String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 售后入库单号:{} 耗时:{}", code, (endMillis - startMillis));
logger.info(threadNameStrEnd); logger.info(threadNameStrEnd);
} catch (Exception e) {
logger.error("startImplementByCode方法抛出异常", e);
}
} }
/** /**

View File

@ -186,41 +186,45 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
* @author liuyang * @author liuyang
*/ */
public void startImplementStockByTime(String startTime, String endTime) throws Exception { public void startImplementStockByTime(String startTime, String endTime) throws Exception {
long startMillis = System.currentTimeMillis(); try {
String threadNameStrStart = StrUtil.format("开始-OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{}", startTime, endTime); long startMillis = System.currentTimeMillis();
logger.info(threadNameStrStart); String threadNameStrStart = StrUtil.format("开始-OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrStart);
Assert.notNull(startTime, "开始时间不能为空"); Assert.notNull(startTime, "开始时间不能为空");
Assert.notNull(endTime, "结束时间不能为空"); Assert.notNull(endTime, "结束时间不能为空");
String tocShop = shopTobOrToCUtil.getCommaShop("TOC"); String tocShop = shopTobOrToCUtil.getCommaShop("TOC");
// CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); // CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClosedAt_start(startTime); queryOfsSoSaleOutVo.setClosedAt_start(startTime);
queryOfsSoSaleOutVo.setClosedAt_end(endTime); queryOfsSoSaleOutVo.setClosedAt_end(endTime);
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
//2024年8月22日 14:02:13 已经和O确认这个字段取消传递 //2024年8月22日 14:02:13 已经和O确认这个字段取消传递
// queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); // queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
queryOfsSoSaleOutVo.setStatus(900L); queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tocShop); queryOfsSoSaleOutVo.setStoreCode(tocShop);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
// queryOfsSoSaleOutVo.setCode("LETS-RE2024071600000001"); // queryOfsSoSaleOutVo.setCode("LETS-RE2024071600000001");
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
logger.info("TOC退货数据返回行数{}", returnGoodHeaderDetailsDataDtoArrayList.size()); logger.info("TOC退货数据返回行数{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSetStock(returnGoodHeaderDetailsDataDtoArrayList); getSetStock(returnGoodHeaderDetailsDataDtoArrayList);
} else { } else {
logger.info("没有查询到任何数据!不需要同步"); logger.info("没有查询到任何数据!不需要同步");
} }
long endMillis = System.currentTimeMillis(); long endMillis = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("结束-OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); String threadNameStrEnd = StrUtil.format("结束-OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
logger.info(threadNameStrEnd); logger.info(threadNameStrEnd);
} catch (Exception e) {
logger.error("startImplementStockByTime方法抛出异常", e);
}
} }
/** /**
@ -273,39 +277,43 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
* @author liuyang * @author liuyang
*/ */
public void startImplementByTradeTime(String startTime, String endTime) throws Exception { public void startImplementByTradeTime(String startTime, String endTime) throws Exception {
long startMillis = System.currentTimeMillis(); try {
String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime); long startMillis = System.currentTimeMillis();
logger.info(threadNameStrStart); String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrStart);
Assert.notNull(startTime, "startTime不能为空"); Assert.notNull(startTime, "startTime不能为空");
Assert.notNull(endTime, "endTime不能为空"); Assert.notNull(endTime, "endTime不能为空");
//生成一个时间范围 //生成一个时间范围
// StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); // StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
//2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性
String tocShop = shopTobOrToCUtil.getCommaShop("TOC"); String tocShop = shopTobOrToCUtil.getCommaShop("TOC");
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setRefundedAt_start(startTime); queryOfsSoSaleOutVo.setRefundedAt_start(startTime);
queryOfsSoSaleOutVo.setRefundedAt_end(endTime); queryOfsSoSaleOutVo.setRefundedAt_end(endTime);
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tocShop); queryOfsSoSaleOutVo.setStoreCode(tocShop);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
queryOfsSoSaleOutVo.setRefundStatus("900"); queryOfsSoSaleOutVo.setRefundStatus("900");
// queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001"); // queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001");
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSetTran(returnGoodHeaderDetailsDataDtoArrayList); getSetTran(returnGoodHeaderDetailsDataDtoArrayList);
} else { } else {
logger.info("没有查询到任何数据!不需要同步"); logger.info("没有查询到任何数据!不需要同步");
} }
long endMillis = System.currentTimeMillis(); long endMillis = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
logger.info(threadNameStrEnd); logger.info(threadNameStrEnd);
} catch (Exception e) {
logger.error("startImplementByTradeTime方法抛出异常", e);
}
} }
/** /**

View File

@ -5,6 +5,7 @@ import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDetailedDao;
import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity; import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
import com.hzya.frame.plugin.lets.u8cdto.ErrorHeaderDetailsDtoDto; import com.hzya.frame.plugin.lets.u8cdto.ErrorHeaderDetailsDtoDto;
import com.hzya.frame.plugin.lets.util.OfsStandardUtil;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -34,6 +35,9 @@ class SoSaleOutPluginInitializerToCTest {
@Autowired @Autowired
private ITocofsSaleoutDetailedDao iTocofsSaleoutDetailedDao; private ITocofsSaleoutDetailedDao iTocofsSaleoutDetailedDao;
@Autowired
private OfsStandardUtil ofsStandardUtil;
@Test @Test
void startImplement() throws Exception { void startImplement() throws Exception {
// soSaleOutPluginInitializerToC.startImplement(null, null); // soSaleOutPluginInitializerToC.startImplement(null, null);
@ -81,6 +85,12 @@ class SoSaleOutPluginInitializerToCTest {
// String s = "LETS-SH2024073100000004"; // String s = "LETS-SH2024073100000004";
// soSaleOutPluginInitializerToC.startImplementStockByCode(s, "stock"); // soSaleOutPluginInitializerToC.startImplementStockByCode(s, "stock");
soSaleOutPluginInitializerToC.startImplementStockByTime("2024-09-24 16:35:43","2024-09-24 16:35:45"); // soSaleOutPluginInitializerToC.startImplementStockByTime("2024-09-24 16:35:43","2024-09-24 16:35:45");
List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setCode("LETS-SO2024092500000018");
ofsStandardUtil.getOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoArrayList, 1L);
System.out.println(headerDetailsDtoArrayList.get(0).getHeader().getDepartmentType());
} }
} }