diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.java index 3e42b584..e8b7836a 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.java @@ -11,7 +11,6 @@ import lombok.Data; */ @Data public class TocofsReturngoodsDetailedEntity extends BaseEntity { - /** * 81159 */ 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 c787310f..c7de3c01 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 @@ -33,11 +33,11 @@ public class TocofsSaleoutDetailedEntity extends BaseEntity { /** * 22814582 主键 */ - private Long reforderid; + private String reforderid; /** * 54604811 */ - private Long reforderdetailid; + private String reforderdetailid; /** * LETS-SO2024031900000002 */ @@ -45,7 +45,7 @@ public class TocofsSaleoutDetailedEntity extends BaseEntity { /** * 30766 */ - private Long allocinvid; + private String allocinvid; /** * 6973391732215 */ @@ -66,15 +66,15 @@ public class TocofsSaleoutDetailedEntity extends BaseEntity { /** * 0 */ - private Long isgift; + private String isgift; /** * 10 */ - private Long requestqty; + private String requestqty; /** * 0 */ - private Long shipqty; + private String shipqty; private String shipat; /** * EA @@ -83,27 +83,27 @@ public class TocofsSaleoutDetailedEntity extends BaseEntity { /** * 64 */ - private Long listprice; + private String listprice; /** * 640 */ - private Long itemtotalamount; + private String itemtotalamount; /** * 640 */ - private Long totalpayamount; + private String totalpayamount; /** * 0 */ - private Long totalweight; + private String totalweight; /** * 0 */ - private Long totalvolume; + private String totalvolume; /** * 0 */ - private Long totalvolumeweight; + private String totalvolumeweight; /** * G */ 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 0e006175..12981c31 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 @@ -2,31 +2,31 @@ - + - - + + - + - - - + + + - - - - - - + + + + + + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.java index ba70d018..28f60d1d 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.java @@ -3,6 +3,8 @@ package com.hzya.frame.plugin.lets.ofs.entity; import com.hzya.frame.web.entity.BaseEntity; import lombok.Data; +import java.math.BigDecimal; + /** * O出库单表头(TOC、TOB业务底表)(TocofsSaleout)实体类 * @@ -11,7 +13,6 @@ import lombok.Data; */ @Data public class TocofsSaleoutEntity extends BaseEntity { - /** * LETS */ @@ -35,7 +36,7 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 22814582 */ - private Long reforderid; + private String reforderid; /** * LETS-SO2024031900000002 */ @@ -47,11 +48,11 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 510 */ - private Long status; + private String status; /** * 0 */ - private Long consolidated; + private String consolidated; /** * SALES */ @@ -71,7 +72,7 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 0 */ - private Long sourceorderid; + private String sourceorderid; /** * LETS-SO2024031900000002 */ @@ -111,31 +112,31 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 1 */ - private Long totallines; + private String totallines; /** * 10 */ - private Long totalqty; + private String totalqty; /** * 0 */ - private Long totalcontainers; + private String totalcontainers; /** * 0 */ - private Long totalcases; + private String totalcases; /** * 0 */ - private Long totalweight; + private String totalweight; /** * 0 */ - private Long totalvolume; + private String totalvolume; /** * 0 */ - private Long totalvolumeweight; + private String totalvolumeweight; /** * G */ @@ -147,19 +148,19 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 640 */ - private Long totalamount; + private String totalamount; /** * 640 */ - private Long totalpayamount; + private String totalpayamount; /** * 0 */ - private Long postageamount; + private String postageamount; /** * 640 */ - private Long itemtotalamount; + private String itemtotalamount; private String totalfulfillqty; private String totalfulfillweight; private String totalfulfillvolume; @@ -176,7 +177,7 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 1 */ - private Long paymentstatus; + private String paymentstatus; /** * 0 */ @@ -215,15 +216,15 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 0 */ - private Long codamount; + private String codamount; /** * 0 */ - private Long tax; + private String tax; /** * 1 */ - private Long taxpaid; + private String taxpaid; /** * 交易成功时间 */ diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.xml index 55f5edd6..d0525a2e 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.xml @@ -2,22 +2,22 @@ - + - + - - + + - + @@ -27,19 +27,19 @@ - - - - - - - + + + + + + + - - - - + + + + @@ -47,7 +47,7 @@ - + @@ -62,9 +62,9 @@ - - - + + + @@ -112,6 +112,7 @@ + id diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java index 08785334..6c784b0e 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java @@ -137,41 +137,56 @@ public class ConsignmachiningIn extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { - long startMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + long startMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); - try { - String param = String.valueOf(requestJson.get("param")); - if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { - //按单号推送 - if (param != null && !"".equals(param)) { - startImplement(param); - } - } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { - //前台页面功能日期推送,或者接口调用也行 - String craeteDateStr = offsetTimeTime.computingTime(param); - if (craeteDateStr != null && !"".equals(craeteDateStr)) { - splitDateAndPush(craeteDateStr); - } - } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { - String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id")); - Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); - if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { - startImplement(integrationTaskLivingDetailsEntity.getRootAppBill()); - } - } else { - if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { - //默认被定时器执行,实时执行,计算时间偏移量 - StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); - startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + try { + String param = String.valueOf(requestJson.get("param")); + if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { + //按单号推送 + if (param != null && !"".equals(param)) { + startImplement(param); + } + } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { + //前台页面功能日期推送,或者接口调用也行 + String craeteDateStr = offsetTimeTime.computingTime(param); + if (craeteDateStr != null && !"".equals(craeteDateStr)) { + splitDateAndPush(craeteDateStr); + } + } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id")); + Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); + if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { + startImplement(integrationTaskLivingDetailsEntity.getRootAppBill()); + } + } else { + if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { + //默认被定时器执行,实时执行,计算时间偏移量 + StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); + startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + } + } + } catch (Exception e) { + logger.error("executeBusiness-方法异常", e); } + long endMillis = System.currentTimeMillis(); + logger.info("executeBusiness-方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); +// return null; + } + }, "执行插件:" + getPluginName()); + thread.start(); + + if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + try { + thread.join(); + } catch (Exception e) { + logger.error("thread.join();抛出异常", e); } - } catch (Exception e) { - logger.error("executeBusiness-方法异常", e); } - long endMillis = System.currentTimeMillis(); - logger.info("executeBusiness-方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); return null; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java index 93f2a8dc..9fd2592f 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java @@ -139,41 +139,56 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { - long startMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + long startMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); - try { - String param = String.valueOf(requestJson.get("param")); - if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { - //按单号推送 - if (param != null && !"".equals(param)) { - startImplement(param); - } - } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { - //前台页面功能日期推送,或者接口调用也行 - String craeteDateStr = offsetTimeTime.computingTime(param); - if (craeteDateStr != null && !"".equals(craeteDateStr)) { - splitDateAndPush(craeteDateStr); - } - } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { - String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id")); - Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); - if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { - startImplement(integrationTaskLivingDetailsEntity.getRootAppBill()); - } - } else { - if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { - //默认被定时器执行,实时执行,计算时间偏移量 - StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); - startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + try { + String param = String.valueOf(requestJson.get("param")); + if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { + //按单号推送 + if (param != null && !"".equals(param)) { + startImplement(param); + } + } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { + //前台页面功能日期推送,或者接口调用也行 + String craeteDateStr = offsetTimeTime.computingTime(param); + if (craeteDateStr != null && !"".equals(craeteDateStr)) { + splitDateAndPush(craeteDateStr); + } + } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id")); + Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); + if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { + startImplement(integrationTaskLivingDetailsEntity.getRootAppBill()); + } + } else { + if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { + //默认被定时器执行,实时执行,计算时间偏移量 + StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); + startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + } + } + } catch (Exception e) { + logger.error("executeBusiness-方法异常", e); } + long endMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); +// return null; + } + }, "执行插件:" + getPluginName()); + thread.start(); + + if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + try { + thread.join(); + } catch (Exception e) { + logger.error("thread.join();抛出异常", e); } - } catch (Exception e) { - logger.error("executeBusiness-方法异常", e); } - long endMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); return null; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java index c788eae6..c623fce3 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java @@ -136,41 +136,55 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { - long startMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); - - try { - String param = String.valueOf(requestJson.get("param")); - if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { - //按单号推送 - if (param != null && !"".equals(param)) { - startImplement(param); - } - } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { - //前台页面功能日期推送,或者接口调用也行 - String craeteDateStr = offsetTimeTime.computingTime(param); - if (craeteDateStr != null && !"".equals(craeteDateStr)) { - splitDateAndPush(craeteDateStr); - } - } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { - String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id")); - Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); - if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { - startImplement(integrationTaskLivingDetailsEntity.getRootAppBill()); - } - } else { - if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { - //默认被定时器执行,实时执行,计算时间偏移量 - StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); - startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + long startMillis = System.currentTimeMillis(); + try { + logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); + String param = String.valueOf(requestJson.get("param")); + if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { + //按单号推送 + if (param != null && !"".equals(param)) { + startImplement(param); + } + } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { + //前台页面功能日期推送,或者接口调用也行 + String craeteDateStr = offsetTimeTime.computingTime(param); + if (craeteDateStr != null && !"".equals(craeteDateStr)) { + splitDateAndPush(craeteDateStr); + } + } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id")); + Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); + if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { + startImplement(integrationTaskLivingDetailsEntity.getRootAppBill()); + } + } else { + if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { + //默认被定时器执行,实时执行,计算时间偏移量 + StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); + startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + } + } + } catch (Exception e) { + logger.error("executeBusiness-方法异常", e); } + long endMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); +// return null; + } + }, "执行插件:" + getPluginName()); + thread.start(); + + if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + try { + thread.join(); + } catch (Exception e) { + logger.error("thread.join();抛出异常", e); } - } catch (Exception e) { - logger.error("executeBusiness-方法异常", e); } - long endMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); return null; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousOrder.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousOrder.java index 7ccbb49b..5660e4e3 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousOrder.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousOrder.java @@ -130,41 +130,56 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { - long startMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + long startMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); - try { - String param = String.valueOf(requestJson.get("param")); - if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { - //按单号推送 - if (param != null && !"".equals(param)) { - startImplementByCode(param); - } - } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { - //前台页面功能日期推送,或者接口调用也行 - String craeteDateStr = offsetTimeTime.computingTime(param); - if (craeteDateStr != null && !"".equals(craeteDateStr)) { - splitDateAndPush(craeteDateStr); - } - } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { - String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id")); - Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); - if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { - startImplementByCode(integrationTaskLivingDetailsEntity.getRootAppBill()); - } - } else { - if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { - //默认被定时器执行,实时执行,计算时间偏移量 - StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); - startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + try { + String param = String.valueOf(requestJson.get("param")); + if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { + //按单号推送 + if (param != null && !"".equals(param)) { + startImplementByCode(param); + } + } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { + //前台页面功能日期推送,或者接口调用也行 + String craeteDateStr = offsetTimeTime.computingTime(param); + if (craeteDateStr != null && !"".equals(craeteDateStr)) { + splitDateAndPush(craeteDateStr); + } + } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id")); + Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); + if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { + startImplementByCode(integrationTaskLivingDetailsEntity.getRootAppBill()); + } + } else { + if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { + //默认被定时器执行,实时执行,计算时间偏移量 + StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); + startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + } + } + } catch (Exception e) { + logger.error("executeBusiness-方法抛出异常", e); } + long endMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); +// return null; + } + }, "执行插件:" + getPluginName()); + thread.start(); + + if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + try { + thread.join(); + } catch (Exception e) { + logger.error("thread.join();抛出异常", e); } - } catch (Exception e) { - logger.error("executeBusiness-方法抛出异常", e); } - long endMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); return null; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java index 6225de4f..2b9130a0 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java @@ -133,41 +133,56 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { - long startMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + long startMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); - try { - String param = String.valueOf(requestJson.get("param")); - if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { - //按单号推送 - if (param != null && !"".equals(param)) { - startImplementByCode(param); - } - } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { - //前台页面功能日期推送,或者接口调用也行 - String craeteDateStr = offsetTimeTime.computingTime(param); - if (craeteDateStr != null && !"".equals(craeteDateStr)) { - splitDateAndPush(craeteDateStr); - } - } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { - String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id")); - Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); - if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { - startImplementByCode(integrationTaskLivingDetailsEntity.getRootAppBill()); - } - } else { - if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { - //默认被定时器执行,实时执行,计算时间偏移量 - StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); - startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + try { + String param = String.valueOf(requestJson.get("param")); + if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { + //按单号推送 + if (param != null && !"".equals(param)) { + startImplementByCode(param); + } + } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { + //前台页面功能日期推送,或者接口调用也行 + String craeteDateStr = offsetTimeTime.computingTime(param); + if (craeteDateStr != null && !"".equals(craeteDateStr)) { + splitDateAndPush(craeteDateStr); + } + } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id")); + Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); + if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { + startImplementByCode(integrationTaskLivingDetailsEntity.getRootAppBill()); + } + } else { + if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { + //默认被定时器执行,实时执行,计算时间偏移量 + StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); + startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + } + } + } catch (Exception e) { + logger.error("executeBusiness方法异常", e); } + long endMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); +// return null; + } + }, "执行插件:" + getPluginName()); + thread.start(); + + if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + try { + thread.join(); + } catch (Exception e) { + logger.error("thread.join();抛出异常", e); } - } catch (Exception e) { - logger.error("executeBusiness方法异常", e); } - long endMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); return null; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java index 26bfdab6..aeb2ec9e 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java @@ -111,40 +111,55 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { - long startMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + long startMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); - try { - String param = String.valueOf(requestJson.get("param")); - String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneType:stock、tran - if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { - //按单号 - Assert.notNull(sceneType, "sceneType参数不能为空"); - Assert.notNull(!"".equals(sceneType), "sceneType参数不能为空"); - if (param != null && !"".equals(param)) { - startImplementByCode(param, sceneType); - } - } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { - //前台页面功能日期推送,或者接口调用也行 - Assert.notNull(sceneType, "sceneType参数不能为空"); - Assert.notNull(!"".equals(sceneType), "sceneType参数不能为空"); - String craeteDateStr = computingTime(param); - if (craeteDateStr != null && !"".equals(craeteDateStr)) { - splitDateAndPush(craeteDateStr, sceneType); - } - } else { - if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { - //实时执行,每1分钟调度一次 - StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); - startImplementByStockTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); - startImplementByTranTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + try { + String param = String.valueOf(requestJson.get("param")); + String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneType:stock、tran + if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { + //按单号 + Assert.notNull(sceneType, "sceneType参数不能为空"); + Assert.notNull(!"".equals(sceneType), "sceneType参数不能为空"); + if (param != null && !"".equals(param)) { + startImplementByCode(param, sceneType); + } + } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { + //前台页面功能日期推送,或者接口调用也行 + Assert.notNull(sceneType, "sceneType参数不能为空"); + Assert.notNull(!"".equals(sceneType), "sceneType参数不能为空"); + String craeteDateStr = computingTime(param); + if (craeteDateStr != null && !"".equals(craeteDateStr)) { + splitDateAndPush(craeteDateStr, sceneType); + } + } else { + if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { + //实时执行,每1分钟调度一次 + StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); + startImplementByStockTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + startImplementByTranTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + } + } + } catch (Exception e) { + logger.error("executeBusiness-方法异常", e); } + long endMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); +// return null; + } + }, "执行插件:" + getPluginName()); + thread.start(); + + if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + try { + thread.join(); + } catch (Exception e) { + logger.error("thread.join();抛出异常", e); } - } catch (Exception e) { - logger.error("executeBusiness-方法异常", e); } - long endMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); return null; } @@ -219,51 +234,37 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { * * @author liuyang */ - public void startImplementByStockTime(String startTime, String endTime) { + public void startImplementByStockTime(String startTime, String endTime) throws Exception { long startMillis = System.currentTimeMillis(); String threadNameStr = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单开始 同步日期:{} 汇总维度:{}", startTime, endTime); logger.info(threadNameStr); - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - try { - Assert.notNull(startTime, "出库开始时间不能为空"); - Assert.notNull(endTime, "出库结束时间不能为空"); + Assert.notNull(startTime, "出库开始时间不能为空"); + Assert.notNull(endTime, "出库结束时间不能为空"); // CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); - String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); + String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); - List headerDetailsDtoList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setShipAt_start(startTime); - queryOfsSoSaleOutVo.setShipAt_end(endTime); - queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); + List headerDetailsDtoList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setShipAt_start(startTime); + queryOfsSoSaleOutVo.setShipAt_end(endTime); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); // queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); - queryOfsSoSaleOutVo.setStatus(900L); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(50L); - queryOfsSoSaleOutVo.setStoreCode(tobShop); + queryOfsSoSaleOutVo.setStatus(900L); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setStoreCode(tobShop); // queryOfsSoSaleOutVo.setCode("LETS-SH2024010200000004"); - ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); - logger.info("插件:{} (库存)O接口返回行数:{} 时间段:{} {}", getPluginName(), headerDetailsDtoList.size(), startTime, endTime); - if (headerDetailsDtoList.size() > 0) { - getSetStock(headerDetailsDtoList); - } else { - logger.info("没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplementByStockTime-方法抛出异常", e); - } - } - }, threadNameStr); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); + ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); + logger.info("插件:{} (库存)O接口返回行数:{} 时间段:{} {}", getPluginName(), headerDetailsDtoList.size(), startTime, endTime); + if (headerDetailsDtoList.size() > 0) { + getSetStock(headerDetailsDtoList); + } else { + logger.info("没有查询到任何数据!不需要同步"); } + long endMillis = System.currentTimeMillis(); String threadNameEnd = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单结束 同步日期:{} 汇总维度:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); logger.info(threadNameEnd); @@ -274,51 +275,37 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { * * @author liuyang */ - public void startImplementByTranTime(String startTime, String endTime) { + public void startImplementByTranTime(String startTime, String endTime) throws Exception { long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("OFS销售出库(TOB交易成功)同步U8C销售发票开始 开始时间:{} 结束时间:{}", startTime, endTime); logger.info(threadNameStrStart); - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - try { - Assert.notNull(startTime, "交易开始时间不能为空"); - Assert.notNull(endTime, "交易结束时间不能为空"); + Assert.notNull(startTime, "交易开始时间不能为空"); + Assert.notNull(endTime, "交易结束时间不能为空"); - String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); + String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); - List headerDetailsDtoList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + List headerDetailsDtoList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); // queryOfsSoSaleOutVo.setShipAt_start(startTime); // queryOfsSoSaleOutVo.setShipAt_end(endTime); - queryOfsSoSaleOutVo.setTradeSuccessAt_start(startTime); - queryOfsSoSaleOutVo.setTradeSuccessAt_end(endTime); - queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); - queryOfsSoSaleOutVo.setSourceOrderStatus("TRADE_FINISHED");//交易成功状态 + queryOfsSoSaleOutVo.setTradeSuccessAt_start(startTime); + queryOfsSoSaleOutVo.setTradeSuccessAt_end(endTime); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); + queryOfsSoSaleOutVo.setSourceOrderStatus("TRADE_FINISHED");//交易成功状态 // queryOfsSoSaleOutVo.setStatus(900L); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(50L); - queryOfsSoSaleOutVo.setStoreCode(tobShop); - ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); - logger.info("插件:{} (确认收入)O接口返回行数:{} 时间段:{} {}", getPluginName(), headerDetailsDtoList.size(), startTime, endTime); - if (headerDetailsDtoList.size() > 0) { - getSetStockTran(headerDetailsDtoList); - } else { - logger.info("没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplementByTranTime-方法抛出异常", e); - } - } - }, threadNameStrStart); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setStoreCode(tobShop); + ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); + logger.info("插件:{} (确认收入)O接口返回行数:{} 时间段:{} {}", getPluginName(), headerDetailsDtoList.size(), startTime, endTime); + if (headerDetailsDtoList.size() > 0) { + getSetStockTran(headerDetailsDtoList); + } else { + logger.info("没有查询到任何数据!不需要同步"); } + long endMillis = System.currentTimeMillis(); String threadNameStrEnd = StrUtil.format("OFS销售出库(TOB交易成功)同步U8C销售发票结束 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); logger.info(threadNameStrEnd); @@ -329,51 +316,37 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { * * @author liuyang */ - public void startImplementByCode(String code, String sceneType) { + public void startImplementByCode(String code, String sceneType) throws Exception { long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单开始 出库单单号:{}", code); logger.info(threadNameStrStart); - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - try { - Assert.notNull(code, "出库单单不能为空"); - String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); - logger.info("TOB-OFS店铺编码:{}", tobShop); + Assert.notNull(code, "出库单单不能为空"); + String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); + logger.info("TOB-OFS店铺编码:{}", tobShop); - List headerDetailsDtoList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); - //2024年8月30日 10:41:55 如果按编码查询,是否应该考虑仅查询已发货的数据? - queryOfsSoSaleOutVo.setStatus(900L); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(50L); - queryOfsSoSaleOutVo.setStoreCode(tobShop); - queryOfsSoSaleOutVo.setCode(code); - ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); - logger.info("根据单据号查询:数据返回行数:{}", headerDetailsDtoList.size()); - if (headerDetailsDtoList.size() > 0) { - if (sceneType.equals("stock")) { - getSetStock(headerDetailsDtoList); - } else if (sceneType.equals("tran")) { - getSetStockTran(headerDetailsDtoList); - } - } else { - logger.info("没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplementByCode方法抛出异常", e); - } + List headerDetailsDtoList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); + //2024年8月30日 10:41:55 如果按编码查询,是否应该考虑仅查询已发货的数据? + queryOfsSoSaleOutVo.setStatus(900L); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setStoreCode(tobShop); + queryOfsSoSaleOutVo.setCode(code); + ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); + logger.info("根据单据号查询:数据返回行数:{}", headerDetailsDtoList.size()); + if (headerDetailsDtoList.size() > 0) { + if (sceneType.equals("stock")) { + getSetStock(headerDetailsDtoList); + } else if (sceneType.equals("tran")) { + getSetStockTran(headerDetailsDtoList); } - }, threadNameStrStart); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); + } else { + logger.info("没有查询到任何数据!不需要同步"); } + long endMillis = System.currentTimeMillis(); String threadNameStrEnd = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单结束 出库单单号:{} 耗时:{}", code, (endMillis - startMillis)); logger.info(threadNameStrEnd); 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 d2bcc507..e1808124 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 @@ -103,41 +103,57 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { - long startMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); + + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + 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")); - String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneType:stock、tran - if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { - //按单号 - if (param != null && !"".equals(param)) { - startImplementStockByCode(param, sceneType); - } - } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { - //前台页面功能日期推送,或者接口调用也行 - String craeteDateStr = computingTime(param); - if (craeteDateStr != null && !"".equals(craeteDateStr)) { - splitDateAndPush(craeteDateStr, sceneType); - } - } else { - if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { - //默认被定时器执行,每天晚上凌晨0点5分 - //暂定先同步TOC销售库存、再推送TOC销售确认收入 - 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()); + try { + String param = String.valueOf(requestJson.get("param")); + String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneType:stock、tran + if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { + //按单号 + if (param != null && !"".equals(param)) { + startImplementStockByCode(param, sceneType); + } + } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { + //前台页面功能日期推送,或者接口调用也行 + String craeteDateStr = computingTime(param); + if (craeteDateStr != null && !"".equals(craeteDateStr)) { + splitDateAndPush(craeteDateStr, sceneType); + } + } else { + if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { + //默认被定时器执行,每天晚上凌晨0点5分 + //暂定先同步TOC销售库存、再推送TOC销售确认收入 + 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; + } + }, "执行插件:" + getPluginName()); + thread.start(); + + if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + try { + thread.join(); + } catch (Exception e) { + logger.error("thread.join();抛出异常", e); } - } catch (Exception e) { - logger.error("executeBusiness方法异常", e); } - long endMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); return null; } @@ -176,60 +192,38 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { * @param endTime O出库结束时间 * @author liuyang */ - public void startImplementStockByTime(String startTime, String endTime) { + public void startImplementStockByTime(String startTime, String endTime) throws Exception { long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("开始 OFS销售出库(TOC)同步U8C销售订单 开始 开始时间:{} 结束时间:{}", startTime, endTime); logger.info(threadNameStrStart); - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - LOCK.lock(); - try { - Assert.notNull(startTime, "查询条件,开始时间不能为空!"); - Assert.notNull(endTime, "查询条件,结束时间不能为空!"); + Assert.notNull(startTime, "查询条件,开始时间不能为空!"); + Assert.notNull(endTime, "查询条件,结束时间不能为空!"); // CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); - String tobShop = shopTobOrToCUtil.getCommaShop("TOC"); + String tobShop = shopTobOrToCUtil.getCommaShop("TOC"); - List headerDetailsDtoList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + List headerDetailsDtoList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); // queryOfsSoSaleOutVo.setShipAt_start(calculateDateVo.getStart_time()); // queryOfsSoSaleOutVo.setShipAt_end(calculateDateVo.getEnd_time()); - queryOfsSoSaleOutVo.setShipAt_start(startTime); - queryOfsSoSaleOutVo.setShipAt_end(endTime); - queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); - queryOfsSoSaleOutVo.setStatus(900L); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(100L); - queryOfsSoSaleOutVo.setStoreCode(tobShop); + queryOfsSoSaleOutVo.setShipAt_start(startTime); + queryOfsSoSaleOutVo.setShipAt_end(endTime); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); + queryOfsSoSaleOutVo.setStatus(900L); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(100L); + queryOfsSoSaleOutVo.setStoreCode(tobShop); // queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003"); - ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); - logger.info("数据返回行数:{}", headerDetailsDtoList.size()); - if (headerDetailsDtoList.size() > 0) { - getSetStock(headerDetailsDtoList); - } else { - logger.info("TOC没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplement方法抛出异常", e); - } finally { -// try { -// basicArchivesCacheUtil.clearCache(); -// } catch (Exception e) { -// logger.info("清理档案缓存失败", e); -// } - LOCK.unlock(); - } - } - }, threadNameStrStart); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); + ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); + logger.info("数据返回行数:{}", headerDetailsDtoList.size()); + if (headerDetailsDtoList.size() > 0) { + getSetStock(headerDetailsDtoList); + } else { + logger.info("TOC没有查询到任何数据!不需要同步"); } + long endMillis = System.currentTimeMillis(); String threadNameStrEnd = StrUtil.format("结束 OFS销售出库(TOC)同步U8C销售订单 结束 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); logger.info(threadNameStrEnd); @@ -241,58 +235,36 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { * @param code O销售出库单编码 * @author liuyang */ - public void startImplementStockByCode(String code, String sceneType) { + public void startImplementStockByCode(String code, String sceneType) throws Exception { long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("OFS销售出库(TOC)同步U8C销售订单 开始 出库单单据号:{}", code); logger.info(threadNameStrStart); - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - LOCK.lock(); - try { - Assert.notNull(code, "O出库单编码不能为空!code is null!"); - Assert.notNull(sceneType, "场景类型不能为空!"); + Assert.notNull(code, "O出库单编码不能为空!code is null!"); + Assert.notNull(sceneType, "场景类型不能为空!"); - String tobShop = shopTobOrToCUtil.getCommaShop("TOC"); - List headerDetailsDtoList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); + String tobShop = shopTobOrToCUtil.getCommaShop("TOC"); + List headerDetailsDtoList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); // queryOfsSoSaleOutVo.setStatus(900L); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(100L); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(100L); // queryOfsSoSaleOutVo.setStoreCode(tobShop); - queryOfsSoSaleOutVo.setCode(code); - ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); - logger.info("数据返回行数:{}", headerDetailsDtoList.size()); - if (headerDetailsDtoList.size() > 0) { - if (sceneType.equals("stock")) { - getSetStock(headerDetailsDtoList); - } else if (sceneType.equals("tran")) { - getSetTran(headerDetailsDtoList); - } - } else { - logger.info("没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplementStockByCode-方法抛出异常", e); - } finally { -// try { -// basicArchivesCacheUtil.clearCache(); -// } catch (Exception e) { -// logger.info("清理档案缓存失败", e); -// } - LOCK.unlock(); - } + queryOfsSoSaleOutVo.setCode(code); + ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); + logger.info("数据返回行数:{}", headerDetailsDtoList.size()); + if (headerDetailsDtoList.size() > 0) { + if (sceneType.equals("stock")) { + getSetStock(headerDetailsDtoList); + } else if (sceneType.equals("tran")) { + getSetTran(headerDetailsDtoList); } - }, threadNameStrStart); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); + } else { + logger.info("没有查询到任何数据!不需要同步"); } + long endMillis = System.currentTimeMillis(); String threadNameStrEnd = StrUtil.format("OFS销售出库(TOC)同步U8C销售订单 结束 出库单单据号:{} 耗时:{}", code, (endMillis - startMillis)); logger.info(threadNameStrEnd); @@ -305,61 +277,39 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { * @param endTime O交易完成结束时间 * @author liuyang */ - public void startImplementTranByTime(String startTime, String endTime) { + public void startImplementTranByTime(String startTime, String endTime) throws Exception { long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("开始OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{}", startTime, endTime); logger.info(threadNameStrStart); - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - LOCK.lock(); - try { - Assert.notNull(startTime, "查询条件,开始时间不能为空!"); - Assert.notNull(endTime, "查询条件,结束时间不能为空!"); + Assert.notNull(startTime, "查询条件,开始时间不能为空!"); + Assert.notNull(endTime, "查询条件,结束时间不能为空!"); // CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); - String tocShop = shopTobOrToCUtil.getCommaShop("TOC"); + String tocShop = shopTobOrToCUtil.getCommaShop("TOC"); - List headerDetailsDtoList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + List headerDetailsDtoList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); // queryOfsSoSaleOutVo.setShipAt_start(calculateDateVo.getStart_time()); // queryOfsSoSaleOutVo.setShipAt_end(calculateDateVo.getEnd_time()); - queryOfsSoSaleOutVo.setTradeSuccessAt_start(startTime); - queryOfsSoSaleOutVo.setTradeSuccessAt_end(endTime); - queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); - queryOfsSoSaleOutVo.setSourceOrderStatus("TRADE_FINISHED");//交易成功状态 + queryOfsSoSaleOutVo.setTradeSuccessAt_start(startTime); + queryOfsSoSaleOutVo.setTradeSuccessAt_end(endTime); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); + queryOfsSoSaleOutVo.setSourceOrderStatus("TRADE_FINISHED");//交易成功状态 // queryOfsSoSaleOutVo.setStatus(900L); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(100L); - queryOfsSoSaleOutVo.setStoreCode(tocShop); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(100L); + queryOfsSoSaleOutVo.setStoreCode(tocShop); // queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003"); - ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); - logger.info("TOC数据返回行数:{}", headerDetailsDtoList.size()); - if (headerDetailsDtoList.size() > 0) { - getSetTran(headerDetailsDtoList); - } else { - logger.info("TOC没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplementTranByTime-方法抛出异常", e); - } finally { -// try { -// basicArchivesCacheUtil.clearCache(); -// } catch (Exception e) { -// logger.info("清理档案缓存失败", e); -// } - LOCK.unlock(); - } - } - }, threadNameStrStart); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); + ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); + logger.info("TOC数据返回行数:{}", headerDetailsDtoList.size()); + if (headerDetailsDtoList.size() > 0) { + getSetTran(headerDetailsDtoList); + } else { + logger.info("TOC没有查询到任何数据!不需要同步"); } + long endMillis = System.currentTimeMillis(); String threadNameStrEnd = StrUtil.format("结束OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); logger.info(threadNameStrEnd); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java index 0b65503b..45c40e9c 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java @@ -103,38 +103,53 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { - long startMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + long startMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); - try { - String param = String.valueOf(requestJson.get("param")); - String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneType:stock、tran - if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { - //按单号 - if (param != null && !"".equals(param)) { - startImplementByCode(param, sceneType); - } - } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { - //前台页面功能日期推送,或者接口调用也行 - Assert.notNull(sceneType, "sceneType参数不能为空"); - Assert.notNull(!"".equals(sceneType), "sceneType参数不能为空"); - String craeteDateStr = computingTime(param); - if (craeteDateStr != null && !"".equals(craeteDateStr)) { - splitDateAndPush(craeteDateStr, sceneType); - } - } else { - if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { - //实时执行,每1分钟调度一次 - StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); - startImplementByStockTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); - startImplementByTradeTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + try { + String param = String.valueOf(requestJson.get("param")); + String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneType:stock、tran + if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { + //按单号 + if (param != null && !"".equals(param)) { + startImplementByCode(param, sceneType); + } + } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { + //前台页面功能日期推送,或者接口调用也行 + Assert.notNull(sceneType, "sceneType参数不能为空"); + Assert.notNull(!"".equals(sceneType), "sceneType参数不能为空"); + String craeteDateStr = computingTime(param); + if (craeteDateStr != null && !"".equals(craeteDateStr)) { + splitDateAndPush(craeteDateStr, sceneType); + } + } else { + if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { + //实时执行,每1分钟调度一次 + StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); + startImplementByStockTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + startImplementByTradeTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); + } + } + } catch (Exception e) { + logger.error("executeBusiness方法异常", e); } + long endMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); +// return null; + } + }, "执行插件:" + getPluginName()); + thread.start(); + + if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + try { + thread.join(); + } catch (Exception e) { + logger.error("thread.join();抛出异常", e); } - } catch (Exception e) { - logger.error("executeBusiness方法异常", e); } - long endMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); return null; } @@ -220,50 +235,36 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { * * @author liuyang */ - public void startImplementByStockTime(String startTime, String endTime) { + public void startImplementByStockTime(String startTime, String endTime) throws Exception { long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime); logger.info(threadNameStrStart); - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - try { - Assert.notNull(startTime, "startTime不能为空"); - Assert.notNull(endTime, "endTime不能为空"); - //生成一个时间范围 + Assert.notNull(startTime, "startTime不能为空"); + Assert.notNull(endTime, "endTime不能为空"); + //生成一个时间范围 // StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); - //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 - String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); + //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 + String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); - List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setClosedAt_start(startTime); - queryOfsSoSaleOutVo.setClosedAt_end(endTime); - queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(50L); - queryOfsSoSaleOutVo.setStoreCode(tobShop); - queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); + List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setClosedAt_start(startTime); + queryOfsSoSaleOutVo.setClosedAt_end(endTime); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setStoreCode(tobShop); + queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); // queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001"); - ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); - logger.info("插件:{} (库存)O接口返回行数:{} 时间段:{} {}", getPluginName(), returnGoodHeaderDetailsDataDtoArrayList.size(), startTime, endTime); - if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { - getSetStock(returnGoodHeaderDetailsDataDtoArrayList); - } else { - logger.info("没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplementByStockTime-方法抛出异常", e); - } - } - }, threadNameStrStart); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); + ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); + logger.info("插件:{} (库存)O接口返回行数:{} 时间段:{} {}", getPluginName(), returnGoodHeaderDetailsDataDtoArrayList.size(), startTime, endTime); + if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + getSetStock(returnGoodHeaderDetailsDataDtoArrayList); + } else { + logger.info("没有查询到任何数据!不需要同步"); } + long endMillis = System.currentTimeMillis(); String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); logger.info(threadNameStrEnd); @@ -274,52 +275,38 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { * * @author liuyang */ - public void startImplementByTradeTime(String startTime, String endTime) { + public void startImplementByTradeTime(String startTime, String endTime) throws Exception { long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime); logger.info(threadNameStrStart); - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - try { - Assert.notNull(startTime, "startTime不能为空"); - Assert.notNull(endTime, "endTime不能为空"); + Assert.notNull(startTime, "startTime不能为空"); + Assert.notNull(endTime, "endTime不能为空"); - //生成一个时间范围 + //生成一个时间范围 // StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); - //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 - String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); + //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 + String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); - List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setRefundedAt_start(startTime); - queryOfsSoSaleOutVo.setRefundedAt_end(endTime); - queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(50L); - queryOfsSoSaleOutVo.setStoreCode(tobShop); - queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); - queryOfsSoSaleOutVo.setRefundStatus("900"); + List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setRefundedAt_start(startTime); + queryOfsSoSaleOutVo.setRefundedAt_end(endTime); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setStoreCode(tobShop); + queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); + queryOfsSoSaleOutVo.setRefundStatus("900"); // queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001"); - ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); - logger.info("插件:{} (确认收入)O接口返回行数:{} 时间段:{} {}", getPluginName(), returnGoodHeaderDetailsDataDtoArrayList.size(), startTime, endTime); - if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { - getSetTrade(returnGoodHeaderDetailsDataDtoArrayList); - } else { - logger.info("没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplementByTradeTime-方法抛出异常", e); - } - } - }, threadNameStrStart); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); + ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); + logger.info("插件:{} (确认收入)O接口返回行数:{} 时间段:{} {}", getPluginName(), returnGoodHeaderDetailsDataDtoArrayList.size(), startTime, endTime); + if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + getSetTrade(returnGoodHeaderDetailsDataDtoArrayList); + } else { + logger.info("没有查询到任何数据!不需要同步"); } + long endMillis = System.currentTimeMillis(); String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); logger.info(threadNameStrEnd); @@ -330,54 +317,40 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { * * @author liuyang */ - public void startImplementByCode(String code, String sceneType) { + public void startImplementByCode(String code, String sceneType) throws Exception { long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 售后入库单号:{}", code); logger.info(threadNameStrStart); - - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - try { - Assert.notNull(code, "code不能为空"); - //生成一个时间范围 + + Assert.notNull(code, "code不能为空"); + //生成一个时间范围 // StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); - //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 - String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); + //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 + String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); - List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); // 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.setClientCode("LETS"); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(50L); - //测试 - queryOfsSoSaleOutVo.setStoreCode(tobShop); - queryOfsSoSaleOutVo.setCode(code); - queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); - ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); - logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); - if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { - if (sceneType.equals("stock")) { - getSetStock(returnGoodHeaderDetailsDataDtoArrayList); - } else if (sceneType.equals("tran")) { - getSetTrade(returnGoodHeaderDetailsDataDtoArrayList); - } - } else { - logger.info("没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplementByCode-方法抛出异常", e); - } + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + //测试 + queryOfsSoSaleOutVo.setStoreCode(tobShop); + queryOfsSoSaleOutVo.setCode(code); + queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); + ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); + logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); + if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + if (sceneType.equals("stock")) { + getSetStock(returnGoodHeaderDetailsDataDtoArrayList); + } else if (sceneType.equals("tran")) { + getSetTrade(returnGoodHeaderDetailsDataDtoArrayList); } - }, threadNameStrStart); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); + } else { + logger.info("没有查询到任何数据!不需要同步"); } + long endMillis = System.currentTimeMillis(); String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 售后入库单号:{} 耗时:{}", code, (endMillis - startMillis)); logger.info(threadNameStrEnd); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java index 0f6efa30..e32e9ecf 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java @@ -99,37 +99,52 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { - long startMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + long startMillis = System.currentTimeMillis(); + logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件"); - try { - String param = String.valueOf(requestJson.get("param")); - String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneType:stock、tran - if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { - //按单号 - if (param != null && !"".equals(param)) { - startImplementByCode(param, sceneType); - } - } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { - //前台页面功能日期推送,或者接口调用也行 - String craeteDateStr = computingTime(param); - if (craeteDateStr != null && !"".equals(craeteDateStr)) { - splitDateAndPush(craeteDateStr, sceneType); - } - } else { - if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { - //默认被定时器执行,每天晚上凌晨0点5分 - //暂定先同步TOC销售库存、再推送TOC销售确认收入 - List startAndEndVos = calculateCalculateEntireDayPeriod(null); - startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time()); - startImplementByTradeTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time()); + try { + String param = String.valueOf(requestJson.get("param")); + String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneType:stock、tran + if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { + //按单号 + if (param != null && !"".equals(param)) { + startImplementByCode(param, sceneType); + } + } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { + //前台页面功能日期推送,或者接口调用也行 + String craeteDateStr = computingTime(param); + if (craeteDateStr != null && !"".equals(craeteDateStr)) { + splitDateAndPush(craeteDateStr, sceneType); + } + } else { + if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { + //默认被定时器执行,每天晚上凌晨0点5分 + //暂定先同步TOC销售库存、再推送TOC销售确认收入 + List startAndEndVos = calculateCalculateEntireDayPeriod(null); + startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time()); + startImplementByTradeTime(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; + } + }, "执行插件:" + getPluginName()); + thread.start(); + + if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { + try { + thread.join(); + } catch (Exception e) { + logger.error("thread.join();抛出异常", e); } - } catch (Exception e) { - logger.error("executeBusiness方法异常", e); } - long endMillis = System.currentTimeMillis(); - logger.info("executeBusiness方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis)); return null; } @@ -169,61 +184,39 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { * * @author liuyang */ - public void startImplementStockByTime(String startTime, String endTime) { + public void startImplementStockByTime(String startTime, String endTime) throws Exception { long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("开始-OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{}", startTime, endTime); logger.info(threadNameStrStart); - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - LOCK.lock(); - try { - Assert.notNull(startTime, "开始时间不能为空"); - Assert.notNull(endTime, "结束时间不能为空"); + Assert.notNull(startTime, "开始时间不能为空"); + Assert.notNull(endTime, "结束时间不能为空"); - String tocShop = shopTobOrToCUtil.getCommaShop("TOC"); + String tocShop = shopTobOrToCUtil.getCommaShop("TOC"); // CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); - List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setClosedAt_start(startTime); - queryOfsSoSaleOutVo.setClosedAt_end(endTime); - queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); - //2024年8月22日 14:02:13 已经和O确认,这个字段取消传递! + List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setClosedAt_start(startTime); + queryOfsSoSaleOutVo.setClosedAt_end(endTime); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); + //2024年8月22日 14:02:13 已经和O确认,这个字段取消传递! // queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); - queryOfsSoSaleOutVo.setStatus(900L); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(50L); - queryOfsSoSaleOutVo.setStoreCode(tocShop); - queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); + queryOfsSoSaleOutVo.setStatus(900L); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setStoreCode(tocShop); + queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); // queryOfsSoSaleOutVo.setCode("LETS-RE2024071600000001"); - ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); - logger.info("TOC退货数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); - if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { - getSetStock(returnGoodHeaderDetailsDataDtoArrayList); - } else { - logger.info("没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplementStockByTime-方法抛出异常", e); - } finally { -// try { -// tocReturnBasicArchivesCacheUtil.clearCache(); -// } catch (Exception e) { -// logger.info("清理档案缓存失败", e); -// } - LOCK.unlock(); - } - } - }, threadNameStrStart); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); + ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); + logger.info("TOC退货数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); + if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + getSetStock(returnGoodHeaderDetailsDataDtoArrayList); + } else { + logger.info("没有查询到任何数据!不需要同步"); } + long endMillis = System.currentTimeMillis(); String threadNameStrEnd = StrUtil.format("结束-OFS销售出库(TOC)同步U8C销售订单 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); logger.info(threadNameStrEnd); @@ -236,60 +229,38 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { * @param sceneType 场景类型 * @author liuyang */ - public void startImplementByCode(String code, String sceneType) { + public void startImplementByCode(String code, String sceneType) throws Exception { long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("开始-OFS销售出库(TOC)同步U8C销售订单 同步单据号:{} 业务场景:{}", code, sceneType); logger.info(threadNameStrStart); - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - LOCK.lock(); - try { - Assert.notNull(code, "code不能为空"); - Assert.notNull(sceneType, "sceneType不能为空"); + Assert.notNull(code, "code不能为空"); + Assert.notNull(sceneType, "sceneType不能为空"); - String tocShop = shopTobOrToCUtil.getCommaShop("TOC"); + String tocShop = shopTobOrToCUtil.getCommaShop("TOC"); - List returnGoodHeaderDetailsDataDtoList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); - queryOfsSoSaleOutVo.setStatus(900L); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(50L); - queryOfsSoSaleOutVo.setStoreCode(tocShop); - queryOfsSoSaleOutVo.setCode(code); - queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); - ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoList, 1L, "ofs.receipt.search"); - logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoList.size()); - if (returnGoodHeaderDetailsDataDtoList.size() > 0) { - if (sceneType.equals("stock")) { - getSetStock(returnGoodHeaderDetailsDataDtoList); - } else if (sceneType.equals("tran")) { - getSetTran(returnGoodHeaderDetailsDataDtoList); - } - } else { - logger.info("没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplementByCode-方法抛出异常", e); - } finally { -// try { -// tocReturnBasicArchivesCacheUtil.clearCache(); -// } catch (Exception e) { -// logger.info("清理档案缓存失败", e); -// } - LOCK.unlock(); - } + List returnGoodHeaderDetailsDataDtoList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); + queryOfsSoSaleOutVo.setStatus(900L); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setStoreCode(tocShop); + queryOfsSoSaleOutVo.setCode(code); + queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); + ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoList, 1L, "ofs.receipt.search"); + logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoList.size()); + if (returnGoodHeaderDetailsDataDtoList.size() > 0) { + if (sceneType.equals("stock")) { + getSetStock(returnGoodHeaderDetailsDataDtoList); + } else if (sceneType.equals("tran")) { + getSetTran(returnGoodHeaderDetailsDataDtoList); } - }, threadNameStrStart); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); + } else { + logger.info("没有查询到任何数据!不需要同步"); } + long endMillis = System.currentTimeMillis(); String threadNameStrEnd = StrUtil.format("结束-OFS销售出库(TOC)同步U8C销售订单 同步单据号:{} 业务场景:{} 耗时:{}", code, sceneType, (endMillis - startMillis)); logger.info(threadNameStrEnd); @@ -300,51 +271,37 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { * * @author liuyang */ - public void startImplementByTradeTime(String startTime, String endTime) { + public void startImplementByTradeTime(String startTime, String endTime) throws Exception { long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime); logger.info(threadNameStrStart); - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - try { - Assert.notNull(startTime, "startTime不能为空"); - Assert.notNull(endTime, "endTime不能为空"); - //生成一个时间范围 + Assert.notNull(startTime, "startTime不能为空"); + Assert.notNull(endTime, "endTime不能为空"); + //生成一个时间范围 // StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); - //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 - String tocShop = shopTobOrToCUtil.getCommaShop("TOC"); + //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 + String tocShop = shopTobOrToCUtil.getCommaShop("TOC"); - List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setRefundedAt_start(startTime); - queryOfsSoSaleOutVo.setRefundedAt_end(endTime); - queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(50L); - queryOfsSoSaleOutVo.setStoreCode(tocShop); - queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); - queryOfsSoSaleOutVo.setRefundStatus("900"); + List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setRefundedAt_start(startTime); + queryOfsSoSaleOutVo.setRefundedAt_end(endTime); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setStoreCode(tocShop); + queryOfsSoSaleOutVo.setInternalInstructionType("RETURN"); + queryOfsSoSaleOutVo.setRefundStatus("900"); // queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001"); - ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); - logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); - if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { - getSetTran(returnGoodHeaderDetailsDataDtoArrayList); - } else { - logger.info("没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplementByTradeTime-方法抛出异常", e); - } - } - }, threadNameStrStart); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); + ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); + logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); + if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + getSetTran(returnGoodHeaderDetailsDataDtoArrayList); + } else { + logger.info("没有查询到任何数据!不需要同步"); } + long endMillis = System.currentTimeMillis(); String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); logger.info(threadNameStrEnd); 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 17ccbcfa..7f911004 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 @@ -78,7 +78,9 @@ class SoSaleOutPluginInitializerToCTest { // soSaleOutPluginInitializerToC.splitDateAndPush(computingTime, "tran"); - String s = "LETS-SH2024073100000004"; - soSaleOutPluginInitializerToC.startImplementStockByCode(s, "stock"); +// String s = "LETS-SH2024073100000004"; +// soSaleOutPluginInitializerToC.startImplementStockByCode(s, "stock"); + + soSaleOutPluginInitializerToC.startImplementStockByTime("2024-09-24 16:35:43","2024-09-24 16:35:45"); } } \ No newline at end of file diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToBTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToBTest.java index e7389f77..29ec740b 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToBTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToBTest.java @@ -36,7 +36,9 @@ public class SoSaleReturnPluginInitializerToBTest { // soSaleReturnPluginInitializerToB.startImplementByTradeTime("2024-08-30 15:54:41", "2024-08-30 15:54:43"); - soSaleReturnPluginInitializerToB.startImplementByCode("LETS-RE2024091400000001", "tran"); +// soSaleReturnPluginInitializerToB.startImplementByCode("LETS-RE2024091400000001", "tran"); + + soSaleReturnPluginInitializerToB.startImplementByStockTime("2024-09-24 16:52:49", "2024-09-24 16:52:52"); } catch (Exception e) { e.printStackTrace(); } diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java index c9a58f7a..dd9d1500 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java @@ -28,15 +28,14 @@ public class SoSaleReturnPluginInitializerToCTest { @Test public void startImplement() { // soSaleReturnPluginInitializerToC.startImplement(null, null); -// try { -// String code = "LETS-RE2024091400000001"; -// soSaleReturnPluginInitializerToC.startImplementByCode(code, "tran"); -// } catch (Exception e) { -// e.printStackTrace(); -// } + try { + String code = "LETS-RE2024091400000001"; + soSaleReturnPluginInitializerToC.startImplementByCode(code, "stock"); + } catch (Exception e) { + e.printStackTrace(); + } - - List startAndEndVos = soSaleReturnPluginInitializerToC.calculateCalculateEntireDayPeriod(null); - soSaleReturnPluginInitializerToC.startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time()); +// List startAndEndVos = soSaleReturnPluginInitializerToC.calculateCalculateEntireDayPeriod(null); +// soSaleReturnPluginInitializerToC.startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time()); } } \ No newline at end of file diff --git a/common/src/main/java/com/hzya/frame/beanutil/BeanUtil.java b/common/src/main/java/com/hzya/frame/beanutil/BeanUtil.java index 4f3e25fd..ab14361c 100644 --- a/common/src/main/java/com/hzya/frame/beanutil/BeanUtil.java +++ b/common/src/main/java/com/hzya/frame/beanutil/BeanUtil.java @@ -77,6 +77,7 @@ public class BeanUtil { try { // 忽略 null if (field.get(source) != null) { + logger.info("xxx:{}", field.getName()); if ("java.lang.Long".equals(it.getType().getName())) { it.set(target, Long.valueOf(field.get(source) + "")); } else { diff --git a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsReturngoodsDetailedEntity.java b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsReturngoodsDetailedEntity.java index 9b57fe2f..cc4dfd9f 100644 --- a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsReturngoodsDetailedEntity.java +++ b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsReturngoodsDetailedEntity.java @@ -11,7 +11,6 @@ import lombok.Data; */ @Data public class TocofsReturngoodsDetailedEntity extends BaseEntity { - /** * 81159 */ diff --git a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsReturngoodsEntity.xml b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsReturngoodsEntity.xml index 51fa6b33..9ad059ad 100644 --- a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsReturngoodsEntity.xml +++ b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsReturngoodsEntity.xml @@ -176,10 +176,10 @@ and returnCarrier = #{returncarrier} and refundedAt = #{refundedat} and refundStatus = #{refundstatus} - and sts='Y' +-- and sts='Y' - order by sorts asc - order by ${sort} ${order} + + diff --git a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutDetailedEntity.java b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutDetailedEntity.java index 60c1f893..b5d38445 100644 --- a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutDetailedEntity.java +++ b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutDetailedEntity.java @@ -33,11 +33,11 @@ public class TocofsSaleoutDetailedEntity extends BaseEntity { /** * 22814582 主键 */ - private Long reforderid; + private String reforderid; /** * 54604811 */ - private Long reforderdetailid; + private String reforderdetailid; /** * LETS-SO2024031900000002 */ @@ -45,7 +45,7 @@ public class TocofsSaleoutDetailedEntity extends BaseEntity { /** * 30766 */ - private Long allocinvid; + private String allocinvid; /** * 6973391732215 */ @@ -66,15 +66,15 @@ public class TocofsSaleoutDetailedEntity extends BaseEntity { /** * 0 */ - private Long isgift; + private String isgift; /** * 10 */ - private Long requestqty; + private String requestqty; /** * 0 */ - private Long shipqty; + private String shipqty; private String shipat; /** * EA @@ -83,27 +83,27 @@ public class TocofsSaleoutDetailedEntity extends BaseEntity { /** * 64 */ - private Long listprice; + private String listprice; /** * 640 */ - private Long itemtotalamount; + private String itemtotalamount; /** * 640 */ - private Long totalpayamount; + private String totalpayamount; /** * 0 */ - private Long totalweight; + private String totalweight; /** * 0 */ - private Long totalvolume; + private String totalvolume; /** * 0 */ - private Long totalvolumeweight; + private String totalvolumeweight; /** * G */ diff --git a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutDetailedEntity.xml b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutDetailedEntity.xml index d1007b8e..2354b0c4 100644 --- a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutDetailedEntity.xml +++ b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutDetailedEntity.xml @@ -290,31 +290,31 @@ ,b.code headCode from tocofs_saleout_detailed a left join tocofs_saleout b on a.mainTableId = b.id - and a.id = #{id} + and a.id = #{id} and a.clientCode = #{clientcode} and a.companyCode = #{companycode} and a.facilityCode = #{facilitycode} and a.shipmentCode = #{shipmentcode} - and a.refOrderId = #{reforderid} - and a.refOrderDetailId = #{reforderdetailid} + and a.refOrderId = #{reforderid} + and a.refOrderDetailId = #{reforderdetailid} and a.refOrderCode = #{refordercode} - and a.allocInvId = #{allocinvid} + and a.allocInvId = #{allocinvid} and a.skuCode = #{skucode} and a.skuName = #{skuname} and a.sourceOrderCode = #{sourceordercode} and a.sourceLineNum = #{sourcelinenum} and a.inventorySts = #{inventorysts} - and a.isGift = #{isgift} - and a.requestQty = #{requestqty} - and a.shipQty = #{shipqty} + and a.isGift = #{isgift} + and a.requestQty = #{requestqty} + and a.shipQty = #{shipqty} and a.shipAt = #{shipat} and a.quantityUM = #{quantityum} - and a.listPrice = #{listprice} - and a.itemTotalAmount = #{itemtotalamount} - and a.totalPayAmount = #{totalpayamount} - and a.totalWeight = #{totalweight} - and a.totalVolume = #{totalvolume} - and a.totalVolumeWeight = #{totalvolumeweight} + and a.listPrice = #{listprice} + and a.itemTotalAmount = #{itemtotalamount} + and a.totalPayAmount = #{totalpayamount} + and a.totalWeight = #{totalweight} + and a.totalVolume = #{totalvolume} + and a.totalVolumeWeight = #{totalvolumeweight} and a.weightUM = #{weightum} and a.volumeUM = #{volumeum} and a.created = #{created} diff --git a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutEntity.java b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutEntity.java index 767b7c82..fadd7d86 100644 --- a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutEntity.java +++ b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutEntity.java @@ -34,7 +34,7 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 22814582 */ - private Long reforderid; + private String reforderid; /** * LETS-SO2024031900000002 */ @@ -46,11 +46,11 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 510 */ - private Long status; + private String status; /** * 0 */ - private Long consolidated; + private String consolidated; /** * SALES */ @@ -70,7 +70,7 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 0 */ - private Long sourceorderid; + private String sourceorderid; /** * LETS-SO2024031900000002 */ @@ -110,31 +110,31 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 1 */ - private Long totallines; + private String totallines; /** * 10 */ - private Long totalqty; + private String totalqty; /** * 0 */ - private Long totalcontainers; + private String totalcontainers; /** * 0 */ - private Long totalcases; + private String totalcases; /** * 0 */ - private Long totalweight; + private String totalweight; /** * 0 */ - private Long totalvolume; + private String totalvolume; /** * 0 */ - private Long totalvolumeweight; + private String totalvolumeweight; /** * G */ @@ -146,19 +146,19 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 640 */ - private Long totalamount; + private String totalamount; /** * 640 */ - private Long totalpayamount; + private String totalpayamount; /** * 0 */ - private Long postageamount; + private String postageamount; /** * 640 */ - private Long itemtotalamount; + private String itemtotalamount; private String totalfulfillqty; private String totalfulfillweight; private String totalfulfillvolume; @@ -175,7 +175,7 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 1 */ - private Long paymentstatus; + private String paymentstatus; /** * 0 */ @@ -214,15 +214,15 @@ public class TocofsSaleoutEntity extends BaseEntity { /** * 0 */ - private Long codamount; + private String codamount; /** * 0 */ - private Long tax; + private String tax; /** * 1 */ - private Long taxpaid; + private String taxpaid; /** * 交易成功时间 */ diff --git a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutEntity.xml b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutEntity.xml index 9042a8a4..6aae1190 100644 --- a/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutEntity.xml +++ b/service/src/main/java/com/hzya/frame/report/lets/entity/TocofsSaleoutEntity.xml @@ -230,22 +230,22 @@ from tocofs_saleout - and id = #{id} + and id = #{id} and clientCode = #{clientcode} and companyCode = #{companycode} and storeCode = #{storecode} and facilityCode = #{facilitycode} and code = #{code} - and refOrderId = #{reforderid} + and refOrderId = #{reforderid} and refOrderCode = #{refordercode} and refOrderType = #{refordertype} - and status = #{status} - and consolidated = #{consolidated} + and status = #{status} + and consolidated = #{consolidated} and internalInstructionType = #{internalinstructiontype} and bizChannel = #{bizchannel} and sourcePlatformCode = #{sourceplatformcode} and processType = #{processtype} - and sourceOrderId = #{sourceorderid} + and sourceOrderId = #{sourceorderid} and sourceOrderCode = #{sourceordercode} and shipToAttentionTo = #{shiptoattentionto} and sourceUserAccount = #{sourceuseraccount} @@ -255,19 +255,19 @@ and shipToCity = #{shiptocity} and shipToDistrict = #{shiptodistrict} and shipToMobile = #{shiptomobile} - and totalLines = #{totallines} - and totalQty = #{totalqty} - and totalContainers = #{totalcontainers} - and totalCases = #{totalcases} - and totalWeight = #{totalweight} - and totalVolume = #{totalvolume} - and totalVolumeWeight = #{totalvolumeweight} + and totalLines = #{totallines} + and totalQty = #{totalqty} + and totalContainers = #{totalcontainers} + and totalCases = #{totalcases} + and totalWeight = #{totalweight} + and totalVolume = #{totalvolume} + and totalVolumeWeight = #{totalvolumeweight} and weightUM = #{weightum} and volumeUM = #{volumeum} - and totalAmount = #{totalamount} - and totalPayAmount = #{totalpayamount} - and postageAmount = #{postageamount} - and itemTotalAmount = #{itemtotalamount} + and totalAmount = #{totalamount} + and totalPayAmount = #{totalpayamount} + and postageAmount = #{postageamount} + and itemTotalAmount = #{itemtotalamount} and totalFulfillQty = #{totalfulfillqty} and totalFulfillWeight = #{totalfulfillweight} and totalFulfillVolume = #{totalfulfillvolume} @@ -275,7 +275,7 @@ and shipAt = #{shipat} and carrierCode = #{carriercode} and primaryWaybillCode = #{primarywaybillcode} - and paymentStatus = #{paymentstatus} + and paymentStatus = #{paymentstatus} and codRequired = #{codrequired} and invoiceRequired = #{invoicerequired} and paidAt = #{paidat} @@ -290,9 +290,9 @@ and shipFromMobile = #{shipfrommobile} and shipFromFax = #{shipfromfax} and shipFromEmail = #{shipfromemail} - and codAmount = #{codamount} - and tax = #{tax} - and taxPaid = #{taxpaid} + and codAmount = #{codamount} + and tax = #{tax} + and taxPaid = #{taxpaid} and tradeSuccessAt = #{tradesuccessat} and sourceOrderStatus = #{sourceorderstatus} and shipToStateName = #{shiptostatename}