增强插件执行的健壮性

在多个插件的executeBusiness方法中添加了try-catch结构,以捕获和记录异常。这样可以避免因未处理的异常而导致的程序崩溃,提高了代码的健壮性。
This commit is contained in:
liuy 2024-10-18 14:55:40 +08:00
parent bb7ef33c9d
commit 7c0daa89a7
20 changed files with 497 additions and 449 deletions

View File

@ -89,30 +89,34 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("调用:" + getPluginName() + "-插件"); try {
String prod = "prod"; logger.info("调用:" + getPluginName() + "-插件");
String param = String.valueOf(requestJson.get("param")); String prod = "prod";
if (requestJson != null && ProfilesActiveConstant.TYPE_DATE.equals(requestJson.get("type"))) { String param = String.valueOf(requestJson.get("param"));
//按日期 if (requestJson != null && ProfilesActiveConstant.TYPE_DATE.equals(requestJson.get("type"))) {
if (param != null && !"".equals(param)) { //按日期
String[] split = param.split("/"); if (param != null && !"".equals(param)) {
if (!(split.length == 2)) { String[] split = param.split("/");
Assert.state(false, "时间格式传递不正确"); if (!(split.length == 2)) {
Assert.state(false, "时间格式传递不正确");
}
Assert.notNull(split[0], "开始时间不能为空");
Assert.notNull(split[1], "结束时间不能为空");
start(split[0], split[1]);
} }
Assert.notNull(split[0], "开始时间不能为空"); } else if (requestJson != null && ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
Assert.notNull(split[1], "结束时间不能为空"); if (param != null && !"".equals(param)) {
start(split[0], split[1]); start(param);
}
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
String integration_task_living_details_id = (String) requestJson.get("integration_task_living_details_id");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id);
start(integrationTaskLivingDetailsEntity.getRootAppPk());
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
start();
} }
} else if (requestJson != null && ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { } catch (Exception e) {
if (param != null && !"".equals(param)) { logger.error("executeBusiness方法抛出异常", e);
start(param);
}
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
String integration_task_living_details_id = (String) requestJson.get("integration_task_living_details_id");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id);
start(integrationTaskLivingDetailsEntity.getRootAppPk());
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
start();
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");
} }

View File

@ -116,7 +116,7 @@ public class GoodsAutoAllotPluginInitializer extends PluginBaseEntity {
start(); start();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
logger.error("executeBusiness方法抛出异常", e); logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");

View File

@ -127,7 +127,7 @@ public class KitPluginInitializer extends PluginBaseEntity {
start(); start();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
logger.error("executeBusiness方法抛出异常", e); logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");

View File

@ -136,7 +136,7 @@ public class SKUClassPluginInitializer extends PluginBaseEntity {
start(); start();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
logger.error("executeBusiness方法抛出异常", e); logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");

View File

@ -128,7 +128,7 @@ public class SKUPluginInitializer extends PluginBaseEntity {
start(); start();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
logger.error("executeBusiness方法抛出异常", e); logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");

View File

@ -124,7 +124,7 @@ public class SKUSealPluginInitializer extends PluginBaseEntity {
start(); start();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
logger.error("executeBusiness方法抛出异常", e); logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");

View File

@ -102,30 +102,34 @@ public class ShopPluginInitializer extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("调用:" + getPluginName() + "-插件"); try {
String prod = "prod"; logger.info("调用:" + getPluginName() + "-插件");
String param = String.valueOf(requestJson.get("param")); String prod = "prod";
if (requestJson != null && ProfilesActiveConstant.TYPE_DATE.equals(requestJson.get("type"))) { String param = String.valueOf(requestJson.get("param"));
//按日期 if (requestJson != null && ProfilesActiveConstant.TYPE_DATE.equals(requestJson.get("type"))) {
if (param != null && !"".equals(param)) { //按日期
String[] split = param.split("/"); if (param != null && !"".equals(param)) {
if (!(split.length == 2)) { String[] split = param.split("/");
Assert.state(false, "时间格式传递不正确"); if (!(split.length == 2)) {
Assert.state(false, "时间格式传递不正确");
}
Assert.notNull(split[0], "开始时间不能为空");
Assert.notNull(split[1], "结束时间不能为空");
startImplement(split[0], split[1]);
} }
Assert.notNull(split[0], "开始时间不能为空"); } else if (requestJson != null && ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
Assert.notNull(split[1], "结束时间不能为空"); if (param != null && !"".equals(param)) {
startImplement(split[0], split[1]); startImplement(param);
}
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
String integration_task_living_details_id = (String) requestJson.get("integration_task_living_details_id");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id);
startImplement(integrationTaskLivingDetailsEntity.getRootAppPk());
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
startImplement();
} }
} else if (requestJson != null && ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { } catch (Exception e) {
if (param != null && !"".equals(param)) { logger.error("executeBusiness", e);
startImplement(param);
}
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
String integration_task_living_details_id = (String) requestJson.get("integration_task_living_details_id");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id);
startImplement(integrationTaskLivingDetailsEntity.getRootAppPk());
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
startImplement();
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");
} }

View File

@ -100,31 +100,35 @@ public class SupplierPluginInitializer extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("调用:" + getPluginName() + "-插件"); try {
String prod = "prod"; logger.info("调用:" + getPluginName() + "-插件");
String prod = "prod";
String param = String.valueOf(requestJson.get("param")); String param = String.valueOf(requestJson.get("param"));
if (requestJson != null && ProfilesActiveConstant.TYPE_DATE.equals(requestJson.get("type"))) { if (requestJson != null && ProfilesActiveConstant.TYPE_DATE.equals(requestJson.get("type"))) {
//按日期 //按日期
if (param != null && !"".equals(param)) { if (param != null && !"".equals(param)) {
String[] split = param.split("/"); String[] split = param.split("/");
if (!(split.length == 2)) { if (!(split.length == 2)) {
Assert.state(false, "时间格式传递不正确"); Assert.state(false, "时间格式传递不正确");
}
Assert.notNull(split[0], "开始时间不能为空");
Assert.notNull(split[1], "结束时间不能为空");
startImplement(split[0], split[1]);
} }
Assert.notNull(split[0], "开始时间不能为空"); } else if (requestJson != null && ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
Assert.notNull(split[1], "结束时间不能为空"); if (param != null && !"".equals(param)) {
startImplement(split[0], split[1]); startImplement(param);
}
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
String integration_task_living_details_id = (String) requestJson.get("integration_task_living_details_id");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id);
startImplement(integrationTaskLivingDetailsEntity.getRootAppPk());
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
startImplement();
} }
} else if (requestJson != null && ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { } catch (Exception e) {
if (param != null && !"".equals(param)) { logger.error("executeBusiness方法抛出异常", e);
startImplement(param);
}
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
String integration_task_living_details_id = (String) requestJson.get("integration_task_living_details_id");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id);
startImplement(integrationTaskLivingDetailsEntity.getRootAppPk());
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
startImplement();
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");
} }

View File

@ -138,55 +138,59 @@ public class ConsignmachiningIn extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
Thread thread = new Thread(new Runnable() { try {
@Override Thread thread = new Thread(new Runnable() {
public void run() { @Override
long startMillis = System.currentTimeMillis(); public void run() {
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件"); long startMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件");
try { try {
String param = String.valueOf(requestJson.get("param")); String param = String.valueOf(requestJson.get("param"));
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
//按单号推送 //按单号推送
if (param != null && !"".equals(param)) { if (param != null && !"".equals(param)) {
startImplement(param); startImplement(param);
} }
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
//前台页面功能日期推送或者接口调用也行 //前台页面功能日期推送或者接口调用也行
String craeteDateStr = offsetTimeTime.computingTime(param); String craeteDateStr = offsetTimeTime.computingTime(param);
if (craeteDateStr != null && !"".equals(craeteDateStr)) { if (craeteDateStr != null && !"".equals(craeteDateStr)) {
splitDateAndPush(craeteDateStr); splitDateAndPush(craeteDateStr);
} }
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { } 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")); String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id"));
Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id);
if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) {
startImplement(integrationTaskLivingDetailsEntity.getRootAppBill()); startImplement(integrationTaskLivingDetailsEntity.getRootAppBill());
} }
} else { } else {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//默认被定时器执行实时执行计算时间偏移量 //默认被定时器执行实时执行计算时间偏移量
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
}
} }
} catch (Exception e) {
logger.error("executeBusiness-方法异常", e);
} }
} catch (Exception e) { long endMillis = System.currentTimeMillis();
logger.error("executeBusiness-方法异常", e); logger.info("executeBusiness-方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
}
long endMillis = System.currentTimeMillis();
logger.info("executeBusiness-方法调用结束:" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
// return null; // return null;
} }
}, "执行插件:" + getPluginName()); }, "执行插件:" + getPluginName());
thread.start(); thread.start();
if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
try { try {
thread.join(); thread.join();
} catch (Exception e) { } catch (Exception e) {
logger.error("thread.join();抛出异常", e); logger.error("thread.join();抛出异常", e);
}
} }
} catch (Exception e) {
logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");
} }

View File

@ -140,55 +140,59 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
Thread thread = new Thread(new Runnable() { try {
@Override Thread thread = new Thread(new Runnable() {
public void run() { @Override
long startMillis = System.currentTimeMillis(); public void run() {
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件"); long startMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件");
try { try {
String param = String.valueOf(requestJson.get("param")); String param = String.valueOf(requestJson.get("param"));
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
//按单号推送 //按单号推送
if (param != null && !"".equals(param)) { if (param != null && !"".equals(param)) {
startImplement(param); startImplement(param);
} }
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
//前台页面功能日期推送或者接口调用也行 //前台页面功能日期推送或者接口调用也行
String craeteDateStr = offsetTimeTime.computingTime(param); String craeteDateStr = offsetTimeTime.computingTime(param);
if (craeteDateStr != null && !"".equals(craeteDateStr)) { if (craeteDateStr != null && !"".equals(craeteDateStr)) {
splitDateAndPush(craeteDateStr); splitDateAndPush(craeteDateStr);
} }
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { } 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")); String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id"));
Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id);
if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) {
startImplement(integrationTaskLivingDetailsEntity.getRootAppBill()); startImplement(integrationTaskLivingDetailsEntity.getRootAppBill());
} }
} else { } else {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//默认被定时器执行实时执行计算时间偏移量 //默认被定时器执行实时执行计算时间偏移量
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
}
} }
} catch (Exception e) {
logger.error("executeBusiness-方法异常", e);
} }
} catch (Exception e) { long endMillis = System.currentTimeMillis();
logger.error("executeBusiness-方法异常", e); logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
}
long endMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
// return null; // return null;
} }
}, "执行插件:" + getPluginName()); }, "执行插件:" + getPluginName());
thread.start(); thread.start();
if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
try { try {
thread.join(); thread.join();
} catch (Exception e) { } catch (Exception e) {
logger.error("thread.join();抛出异常", e); logger.error("thread.join();抛出异常", e);
}
} }
} catch (Exception e) {
logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");
} }

View File

@ -137,54 +137,58 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
Thread thread = new Thread(new Runnable() { try {
@Override Thread thread = new Thread(new Runnable() {
public void run() { @Override
long startMillis = System.currentTimeMillis(); public void run() {
try { long startMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件"); try {
String param = String.valueOf(requestJson.get("param")); logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件");
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { String param = String.valueOf(requestJson.get("param"));
//按单号推送 if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
if (param != null && !"".equals(param)) { //按单号推送
startImplement(param); if (param != null && !"".equals(param)) {
} startImplement(param);
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { }
//前台页面功能日期推送或者接口调用也行 } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
String craeteDateStr = offsetTimeTime.computingTime(param); //前台页面功能日期推送或者接口调用也行
if (craeteDateStr != null && !"".equals(craeteDateStr)) { String craeteDateStr = offsetTimeTime.computingTime(param);
splitDateAndPush(craeteDateStr); 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")); } else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id"));
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!");
if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id);
startImplement(integrationTaskLivingDetailsEntity.getRootAppBill()); if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) {
} startImplement(integrationTaskLivingDetailsEntity.getRootAppBill());
} else { }
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { } else {
//默认被定时器执行实时执行计算时间偏移量 if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); //默认被定时器执行实时执行计算时间偏移量
startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
startImplement(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
}
} }
} catch (Exception e) {
logger.error("executeBusiness-方法异常", e);
} }
} catch (Exception e) { long endMillis = System.currentTimeMillis();
logger.error("executeBusiness-方法异常", e); logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
}
long endMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
// return null; // return null;
} }
}, "执行插件:" + getPluginName()); }, "执行插件:" + getPluginName());
thread.start(); thread.start();
if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
try { try {
thread.join(); thread.join();
} catch (Exception e) { } catch (Exception e) {
logger.error("thread.join();抛出异常", e); logger.error("thread.join();抛出异常", e);
}
} }
} catch (Exception e) {
logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");
} }

View File

@ -131,55 +131,59 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
Thread thread = new Thread(new Runnable() { try {
@Override Thread thread = new Thread(new Runnable() {
public void run() { @Override
long startMillis = System.currentTimeMillis(); public void run() {
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件"); long startMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件");
try { try {
String param = String.valueOf(requestJson.get("param")); String param = String.valueOf(requestJson.get("param"));
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
//按单号推送 //按单号推送
if (param != null && !"".equals(param)) { if (param != null && !"".equals(param)) {
startImplementByCode(param); startImplementByCode(param);
} }
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
//前台页面功能日期推送或者接口调用也行 //前台页面功能日期推送或者接口调用也行
String craeteDateStr = offsetTimeTime.computingTime(param); String craeteDateStr = offsetTimeTime.computingTime(param);
if (craeteDateStr != null && !"".equals(craeteDateStr)) { if (craeteDateStr != null && !"".equals(craeteDateStr)) {
splitDateAndPush(craeteDateStr); splitDateAndPush(craeteDateStr);
} }
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { } 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")); String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id"));
Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id);
if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) {
startImplementByCode(integrationTaskLivingDetailsEntity.getRootAppBill()); startImplementByCode(integrationTaskLivingDetailsEntity.getRootAppBill());
} }
} else { } else {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//默认被定时器执行实时执行计算时间偏移量 //默认被定时器执行实时执行计算时间偏移量
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
}
} }
} catch (Exception e) {
logger.error("executeBusiness-方法抛出异常", e);
} }
} catch (Exception e) { long endMillis = System.currentTimeMillis();
logger.error("executeBusiness-方法抛出异常", e); logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
}
long endMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
// return null; // return null;
} }
}, "执行插件:" + getPluginName()); }, "执行插件:" + getPluginName());
thread.start(); thread.start();
if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
try { try {
thread.join(); thread.join();
} catch (Exception e) { } catch (Exception e) {
logger.error("thread.join();抛出异常", e); logger.error("thread.join();抛出异常", e);
}
} }
} catch (Exception e) {
logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");
} }

View File

@ -134,55 +134,59 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
Thread thread = new Thread(new Runnable() { try {
@Override Thread thread = new Thread(new Runnable() {
public void run() { @Override
long startMillis = System.currentTimeMillis(); public void run() {
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件"); long startMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件");
try { try {
String param = String.valueOf(requestJson.get("param")); String param = String.valueOf(requestJson.get("param"));
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
//按单号推送 //按单号推送
if (param != null && !"".equals(param)) { if (param != null && !"".equals(param)) {
startImplementByCode(param); startImplementByCode(param);
} }
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
//前台页面功能日期推送或者接口调用也行 //前台页面功能日期推送或者接口调用也行
String craeteDateStr = offsetTimeTime.computingTime(param); String craeteDateStr = offsetTimeTime.computingTime(param);
if (craeteDateStr != null && !"".equals(craeteDateStr)) { if (craeteDateStr != null && !"".equals(craeteDateStr)) {
splitDateAndPush(craeteDateStr); splitDateAndPush(craeteDateStr);
} }
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { } 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")); String integration_task_living_details_id = String.valueOf(requestJson.get("integration_task_living_details_id"));
Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!"); Assert.notNull(integration_task_living_details_id, "明细行主键不能为空!");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id); IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integration_task_living_details_id);
if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) { if (integrationTaskLivingDetailsEntity != null && integrationTaskLivingDetailsEntity.getRootAppBill() != null) {
startImplementByCode(integrationTaskLivingDetailsEntity.getRootAppBill()); startImplementByCode(integrationTaskLivingDetailsEntity.getRootAppBill());
} }
} else { } else {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//默认被定时器执行实时执行计算时间偏移量 //默认被定时器执行实时执行计算时间偏移量
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); startImplementByTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
}
} }
} catch (Exception e) {
logger.error("executeBusiness方法异常", e);
} }
} catch (Exception e) { long endMillis = System.currentTimeMillis();
logger.error("executeBusiness方法异常", e); logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
}
long endMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
// return null; // return null;
} }
}, "执行插件:" + getPluginName()); }, "执行插件:" + getPluginName());
thread.start(); thread.start();
if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
try { try {
thread.join(); thread.join();
} catch (Exception e) { } catch (Exception e) {
logger.error("thread.join();抛出异常", e); logger.error("thread.join();抛出异常", e);
}
} }
} catch (Exception e) {
logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");
} }

View File

@ -143,7 +143,7 @@ public class RefundOnlyPluginInitializer extends PluginBaseEntity {
start(); start();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
logger.error("executeBusiness方法抛出异常", e); logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");

View File

@ -115,54 +115,58 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
Thread thread = new Thread(new Runnable() { try {
@Override Thread thread = new Thread(new Runnable() {
public void run() { @Override
long startMillis = System.currentTimeMillis(); public void run() {
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件"); long startMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件");
try { try {
String param = String.valueOf(requestJson.get("param")); String param = String.valueOf(requestJson.get("param"));
String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneTypestocktran String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneTypestocktran
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
//按单号 //按单号
Assert.notNull(sceneType, "sceneType参数不能为空"); Assert.notNull(sceneType, "sceneType参数不能为空");
Assert.notNull(!"".equals(sceneType), "sceneType参数不能为空"); Assert.notNull(!"".equals(sceneType), "sceneType参数不能为空");
if (param != null && !"".equals(param)) { if (param != null && !"".equals(param)) {
startImplementByCode(param, sceneType); startImplementByCode(param, sceneType);
} }
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
//前台页面功能日期推送或者接口调用也行 //前台页面功能日期推送或者接口调用也行
Assert.notNull(sceneType, "sceneType参数不能为空"); Assert.notNull(sceneType, "sceneType参数不能为空");
Assert.notNull(!"".equals(sceneType), "sceneType参数不能为空"); Assert.notNull(!"".equals(sceneType), "sceneType参数不能为空");
String craeteDateStr = computingTime(param); String craeteDateStr = computingTime(param);
if (craeteDateStr != null && !"".equals(craeteDateStr)) { if (craeteDateStr != null && !"".equals(craeteDateStr)) {
splitDateAndPush(craeteDateStr, sceneType); splitDateAndPush(craeteDateStr, sceneType);
} }
} else { } else {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//实时执行每1分钟调度一次 //实时执行每1分钟调度一次
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
startImplementByStockTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); startImplementByStockTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
startImplementByTranTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); startImplementByTranTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
}
} }
} catch (Exception e) {
logger.error("executeBusiness-方法异常", e);
} }
} catch (Exception e) { long endMillis = System.currentTimeMillis();
logger.error("executeBusiness-方法异常", e); logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
}
long endMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
// return null; // return null;
} }
}, "执行插件:" + getPluginName()); }, "执行插件:" + getPluginName());
thread.start(); thread.start();
if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
try { try {
thread.join(); thread.join();
} catch (Exception e) { } catch (Exception e) {
logger.error("thread.join();抛出异常", e); logger.error("thread.join();抛出异常", e);
}
} }
} catch (Exception e) {
logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");
} }

View File

@ -104,53 +104,57 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
Thread thread = new Thread(new Runnable() { try {
@Override Thread thread = new Thread(new Runnable() {
public void run() { @Override
long startMillis = System.currentTimeMillis(); public void run() {
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件"); long startMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件");
// if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { // if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
// throw new BaseSystemException("TOC退货业务无法按单行推送需要根据天的维度推送"); // throw new BaseSystemException("TOC退货业务无法按单行推送需要根据天的维度推送");
// } // }
try { try {
String param = String.valueOf(requestJson.get("param")); String param = String.valueOf(requestJson.get("param"));
String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneTypestocktran String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneTypestocktran
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
//按单号 //按单号
if (param != null && !"".equals(param)) { if (param != null && !"".equals(param)) {
startImplementStockByCode(param, sceneType); startImplementStockByCode(param, sceneType);
} }
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
//前台页面功能日期推送或者接口调用也行 //前台页面功能日期推送或者接口调用也行
String craeteDateStr = computingTime(param); String craeteDateStr = computingTime(param);
if (craeteDateStr != null && !"".equals(craeteDateStr)) { if (craeteDateStr != null && !"".equals(craeteDateStr)) {
splitDateAndPush(craeteDateStr, sceneType); splitDateAndPush(craeteDateStr, sceneType);
} }
} else { } else {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//默认被定时器执行每天晚上凌晨0点5分 //默认被定时器执行每天晚上凌晨0点5分
//暂定先同步TOC销售库存再推送TOC销售确认收入 //暂定先同步TOC销售库存再推送TOC销售确认收入
List<StartAndEndVo> startAndEndVos = calculateCalculateEntireDayPeriod(null); List<StartAndEndVo> startAndEndVos = calculateCalculateEntireDayPeriod(null);
startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time()); startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
startImplementTranByTime(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);
} }
} catch (Exception e) { long endMillis = System.currentTimeMillis();
logger.error("executeBusiness方法异常", e); logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
}
long endMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
// return null; // return null;
} }
}, "执行插件:" + getPluginName()); }, "执行插件:" + getPluginName());
thread.start(); thread.start();
if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
try { try {
thread.join(); thread.join();
} catch (Exception e) { } catch (Exception e) {
logger.error("thread.join();抛出异常", e); logger.error("thread.join();抛出异常", e);
}
} }
} catch (Exception e) {
logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");
} }

View File

@ -104,52 +104,56 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
Thread thread = new Thread(new Runnable() { try {
@Override Thread thread = new Thread(new Runnable() {
public void run() { @Override
long startMillis = System.currentTimeMillis(); public void run() {
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件"); long startMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件");
try { try {
String param = String.valueOf(requestJson.get("param")); String param = String.valueOf(requestJson.get("param"));
String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneTypestocktran String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneTypestocktran
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
//按单号 //按单号
if (param != null && !"".equals(param)) { if (param != null && !"".equals(param)) {
startImplementByCode(param, sceneType); startImplementByCode(param, sceneType);
} }
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
//前台页面功能日期推送或者接口调用也行 //前台页面功能日期推送或者接口调用也行
Assert.notNull(sceneType, "sceneType参数不能为空"); Assert.notNull(sceneType, "sceneType参数不能为空");
Assert.notNull(!"".equals(sceneType), "sceneType参数不能为空"); Assert.notNull(!"".equals(sceneType), "sceneType参数不能为空");
String craeteDateStr = computingTime(param); String craeteDateStr = computingTime(param);
if (craeteDateStr != null && !"".equals(craeteDateStr)) { if (craeteDateStr != null && !"".equals(craeteDateStr)) {
splitDateAndPush(craeteDateStr, sceneType); splitDateAndPush(craeteDateStr, sceneType);
} }
} else { } else {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//实时执行每1分钟调度一次 //实时执行每1分钟调度一次
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
startImplementByStockTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); startImplementByStockTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
startImplementByTradeTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time()); startImplementByTradeTime(startAndEndVo.getStart_time(), startAndEndVo.getEnd_time());
}
} }
} catch (Exception e) {
logger.error("executeBusiness方法异常", e);
} }
} catch (Exception e) { long endMillis = System.currentTimeMillis();
logger.error("executeBusiness方法异常", e); logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
}
long endMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
// return null; // return null;
} }
}, "执行插件:" + getPluginName()); }, "执行插件:" + getPluginName());
thread.start(); thread.start();
if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
try { try {
thread.join(); thread.join();
} catch (Exception e) { } catch (Exception e) {
logger.error("thread.join();抛出异常", e); logger.error("thread.join();抛出异常", e);
}
} }
} catch (Exception e) {
logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");
} }

View File

@ -100,51 +100,55 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
Thread thread = new Thread(new Runnable() { try {
@Override Thread thread = new Thread(new Runnable() {
public void run() { @Override
long startMillis = System.currentTimeMillis(); public void run() {
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件"); long startMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用开始" + getPluginName() + "-插件");
try { try {
String param = String.valueOf(requestJson.get("param")); String param = String.valueOf(requestJson.get("param"));
String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneTypestocktran String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneTypestocktran
if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
//按单号 //按单号
if (param != null && !"".equals(param)) { if (param != null && !"".equals(param)) {
startImplementByCode(param, sceneType); startImplementByCode(param, sceneType);
} }
} else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) {
//前台页面功能日期推送或者接口调用也行 //前台页面功能日期推送或者接口调用也行
String craeteDateStr = computingTime(param); String craeteDateStr = computingTime(param);
if (craeteDateStr != null && !"".equals(craeteDateStr)) { if (craeteDateStr != null && !"".equals(craeteDateStr)) {
splitDateAndPush(craeteDateStr, sceneType); splitDateAndPush(craeteDateStr, sceneType);
} }
} else { } else {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) { if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//默认被定时器执行每天晚上凌晨0点5分 //默认被定时器执行每天晚上凌晨0点5分
//暂定先同步TOC销售库存再推送TOC销售确认收入 //暂定先同步TOC销售库存再推送TOC销售确认收入
List<StartAndEndVo> startAndEndVos = calculateCalculateEntireDayPeriod(null); List<StartAndEndVo> startAndEndVos = calculateCalculateEntireDayPeriod(null);
startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time()); startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
startImplementByTradeTime(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);
} }
} catch (Exception e) { long endMillis = System.currentTimeMillis();
logger.error("executeBusiness方法异常", e); logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
}
long endMillis = System.currentTimeMillis();
logger.info("executeBusiness方法调用结束" + getPluginName() + "-插件 执行耗时:{}", (endMillis - startMillis));
// return null; // return null;
} }
}, "执行插件:" + getPluginName()); }, "执行插件:" + getPluginName());
thread.start(); thread.start();
if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
try { try {
thread.join(); thread.join();
} catch (Exception e) { } catch (Exception e) {
logger.error("thread.join();抛出异常", e); logger.error("thread.join();抛出异常", e);
}
} }
} catch (Exception e) {
logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");
} }

View File

@ -135,7 +135,7 @@ public class TransferInPluginInitializer extends PluginBaseEntity {
start(); start();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
logger.error("executeBusiness方法抛出异常", e); logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");

View File

@ -139,7 +139,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity {
start(); start();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
logger.error("executeBusiness方法抛出异常", e); logger.error("executeBusiness方法抛出异常", e);
} }
return BaseResult.getSuccessMessageEntity("插件执行成功"); return BaseResult.getSuccessMessageEntity("插件执行成功");