增强插件执行的健壮性
在多个插件的executeBusiness方法中添加了try-catch结构,以捕获和记录异常。这样可以避免因未处理的异常而导致的程序崩溃,提高了代码的健壮性。
This commit is contained in:
parent
bb7ef33c9d
commit
7c0daa89a7
|
@ -89,6 +89,7 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
try {
|
||||||
logger.info("调用:" + getPluginName() + "-插件");
|
logger.info("调用:" + getPluginName() + "-插件");
|
||||||
String prod = "prod";
|
String prod = "prod";
|
||||||
String param = String.valueOf(requestJson.get("param"));
|
String param = String.valueOf(requestJson.get("param"));
|
||||||
|
@ -114,6 +115,9 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity {
|
||||||
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
|
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("executeBusiness方法抛出异常", e);
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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("插件执行成功");
|
||||||
|
|
|
@ -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("插件执行成功");
|
||||||
|
|
|
@ -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("插件执行成功");
|
||||||
|
|
|
@ -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("插件执行成功");
|
||||||
|
|
|
@ -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("插件执行成功");
|
||||||
|
|
|
@ -102,6 +102,7 @@ public class ShopPluginInitializer extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
try {
|
||||||
logger.info("调用:" + getPluginName() + "-插件");
|
logger.info("调用:" + getPluginName() + "-插件");
|
||||||
String prod = "prod";
|
String prod = "prod";
|
||||||
String param = String.valueOf(requestJson.get("param"));
|
String param = String.valueOf(requestJson.get("param"));
|
||||||
|
@ -127,6 +128,9 @@ public class ShopPluginInitializer extends PluginBaseEntity {
|
||||||
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
|
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
|
||||||
startImplement();
|
startImplement();
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("executeBusiness", e);
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ public class SupplierPluginInitializer extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
try {
|
||||||
logger.info("调用:" + getPluginName() + "-插件");
|
logger.info("调用:" + getPluginName() + "-插件");
|
||||||
String prod = "prod";
|
String prod = "prod";
|
||||||
|
|
||||||
|
@ -126,6 +127,9 @@ public class SupplierPluginInitializer extends PluginBaseEntity {
|
||||||
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
|
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
|
||||||
startImplement();
|
startImplement();
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("executeBusiness方法抛出异常", e);
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,7 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
try {
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -188,6 +189,9 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
||||||
logger.error("thread.join();抛出异常", e);
|
logger.error("thread.join();抛出异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("executeBusiness方法抛出异常", e);
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,6 +140,7 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
try {
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -190,6 +191,9 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
|
||||||
logger.error("thread.join();抛出异常", e);
|
logger.error("thread.join();抛出异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("executeBusiness方法抛出异常", e);
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,7 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
try {
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -186,6 +187,9 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
|
||||||
logger.error("thread.join();抛出异常", e);
|
logger.error("thread.join();抛出异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("executeBusiness方法抛出异常", e);
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
try {
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -181,6 +182,9 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
|
||||||
logger.error("thread.join();抛出异常", e);
|
logger.error("thread.join();抛出异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("executeBusiness方法抛出异常", e);
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
try {
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -184,6 +185,9 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
|
||||||
logger.error("thread.join();抛出异常", e);
|
logger.error("thread.join();抛出异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("executeBusiness方法抛出异常", e);
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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("插件执行成功");
|
||||||
|
|
|
@ -115,6 +115,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
try {
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -164,6 +165,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
||||||
logger.error("thread.join();抛出异常", e);
|
logger.error("thread.join();抛出异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("executeBusiness方法抛出异常", e);
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
try {
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -152,6 +153,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
||||||
logger.error("thread.join();抛出异常", e);
|
logger.error("thread.join();抛出异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("executeBusiness方法抛出异常", e);
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
try {
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -151,6 +152,9 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
logger.error("thread.join();抛出异常", e);
|
logger.error("thread.join();抛出异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("executeBusiness方法抛出异常", e);
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
|
try {
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -146,6 +147,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
logger.error("thread.join();抛出异常", e);
|
logger.error("thread.join();抛出异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("executeBusiness方法抛出异常", e);
|
||||||
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
return BaseResult.getSuccessMessageEntity("插件执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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("插件执行成功");
|
||||||
|
|
|
@ -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("插件执行成功");
|
||||||
|
|
Loading…
Reference in New Issue