1、修改serviceTable.properties中service为16的action;

2、调用凯歌接口时添加异常捕捉处理;
This commit is contained in:
zhangdongxu
2018-06-11 15:06:47 +08:00
parent 2984ad926e
commit c60ea96d31
3 changed files with 46 additions and 16 deletions

View File

@@ -338,8 +338,12 @@ public class ConfigSourcesController extends BaseRestController {
// 验证配置编译数据
validateConfigSource(thread, start, configSource);
Long benginTime = System.currentTimeMillis();
configSourcesService.saveMaatConfig(thread, start, configSource.getConfigCompileList(), sb);
String msg = configSourcesService.saveMaatConfig(thread, start, configSource.getConfigCompileList(), sb);
if ("error".equals(msg)) {
Exception exception = ConfigSourcesService.getMsgList().get(0);
throw new RestServiceException(thread, System.currentTimeMillis() - start,
"存储编译配置时出现异常" + exception.getMessage(), RestBusinessCode.unknow_error.getValue());
}
Long endSaveTime = System.currentTimeMillis();
Long time = (endSaveTime - benginTime) / 1000;
System.out.println("插入数据成功总共需要" + time + "");
@@ -553,8 +557,12 @@ public class ConfigSourcesController extends BaseRestController {
null);
StringBuffer sb = new StringBuffer();
configSourcesService.saveCommonSources(thread, start, jsonString, sb);
String msg = configSourcesService.saveCommonSources(thread, start, jsonString, sb);
if (msg.equals("error")) {
Exception exception = ConfigSourcesService.getMsgList().get(0);
throw new RestServiceException(thread, System.currentTimeMillis() - start,
"存储回调配置时出现异常" + exception.getMessage(), RestBusinessCode.unknow_error.getValue());
}
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "配置数据插入成功",
Constants.IS_DEBUG ? jsonString : null);
}
@@ -570,8 +578,12 @@ public class ConfigSourcesController extends BaseRestController {
jsonString);
StringBuffer sb = new StringBuffer();
configSourcesService.updateCommonSources(thread, start, jsonString, new Date(), sb);
String msg = configSourcesService.updateCommonSources(thread, start, jsonString, new Date(), sb);
if (msg.equals("error")) {
Exception exception = ConfigSourcesService.getMsgList().get(0);
throw new RestServiceException(thread, System.currentTimeMillis() - start,
"修改回调配置状态时出现异常" + exception.getMessage(), RestBusinessCode.unknow_error.getValue());
}
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "配置状态修改成功",
Constants.IS_DEBUG ? jsonString : null);
}

View File

@@ -1298,9 +1298,15 @@ public class ConfigSourcesService extends BaseService {
return "error";
}
}
configRedisService.saveMaatConfig(configMap);
logger1.info("---------------调用maat配置新增接口---------------------");
try {
logger1.info("---------------调用maat配置新增接口---------------------");
configRedisService.saveMaatConfig(configMap);
} catch (Exception e) {
// TODO: handle exception
logger1.error(e.getMessage());
msgList.add(e);
return "error";
}
return "ok";
}
private Map<String, String> convertObjectToMap(Object obj,Class clazz){
@@ -2599,8 +2605,14 @@ public class ConfigSourcesService extends BaseService {
}
}
configRedisService.saveUnMaatConfig(configMap);
try {
configRedisService.saveUnMaatConfig(configMap);
} catch (Exception e) {
// TODO: handle exception
logger1.error(e.getMessage());
msgList.add(e);
return "error";
}
return "ok";
}
@@ -2659,8 +2671,14 @@ public class ConfigSourcesService extends BaseService {
return "error";
}
}
configRedisService.delUnMaatConfig(restMap);
try {
configRedisService.delUnMaatConfig(restMap);
} catch (Exception e) {
// TODO: handle exception
logger1.error(e.getMessage());
msgList.add(e);
return "error";
}
return "ok";
}
private String checkOptForUpdate(Map<String, Object> srcMap) {