perf(controller):去掉之前mysql数据源,合成一个;多service与configSourcesController 去掉无用信息
This commit is contained in:
@@ -15,9 +15,9 @@ public class DataSourceAInterceptor implements HandlerInterceptor {
|
|||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
logger.info("开启数据源日志操作库---" + System.currentTimeMillis());
|
logger.debug("开启数据源DATA_SOURCE_A---" + System.currentTimeMillis());
|
||||||
CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_A);// 开启数据源A
|
CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_A);// 开启数据源A
|
||||||
logger.info("日志数据源开启成功---" + System.currentTimeMillis());
|
logger.debug("数据DATA_SOURCE_A源开启成功---" + System.currentTimeMillis());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ public class BaseRestController {
|
|||||||
|
|
||||||
protected SaveRequestLogThread saveRequestLog(ServicesRequestLogService service, int opAction,
|
protected SaveRequestLogThread saveRequestLog(ServicesRequestLogService service, int opAction,
|
||||||
HttpServletRequest request, Object data) {
|
HttpServletRequest request, Object data) {
|
||||||
logger.info("SaveRequestLogThread初始化开始----" + System.currentTimeMillis());
|
logger.debug("SaveRequestLogThread初始化开始----" + System.currentTimeMillis());
|
||||||
SaveRequestLogThread thread = SaveRequestLogThread.getNewSaveRequestLogThread(request);
|
SaveRequestLogThread thread = SaveRequestLogThread.getNewSaveRequestLogThread(request);
|
||||||
thread.setService(service);
|
thread.setService(service);
|
||||||
thread.setOpAction(opAction);
|
thread.setOpAction(opAction);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ import com.wordnik.swagger.annotations.ApiParam;
|
|||||||
@RequestMapping("${servicePath}")
|
@RequestMapping("${servicePath}")
|
||||||
@Api(value = "ConfigSourcesController", description = "配置存储服务,包括管控、监测、白名单的控制类")
|
@Api(value = "ConfigSourcesController", description = "配置存储服务,包括管控、监测、白名单的控制类")
|
||||||
public class ConfigSourcesController extends BaseRestController {
|
public class ConfigSourcesController extends BaseRestController {
|
||||||
protected final Logger logger = Logger.getLogger(this.getClass());
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected ConfigSourcesService configSourcesService;
|
protected ConfigSourcesService configSourcesService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -67,258 +67,9 @@ public class ConfigSourcesController extends BaseRestController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
ConfigRedisService configRedisService;
|
ConfigRedisService configRedisService;
|
||||||
|
|
||||||
@RequestMapping(value = "/cfg/v1/saveUnMaat", method = RequestMethod.GET)
|
|
||||||
@ApiOperation(value = "test redis", httpMethod = "GET", response = Map.class, notes = "测试redis事务的crontroller")
|
|
||||||
@ApiParam(value = "test redis", name = "测试redis事务的crontroller", required = true)
|
|
||||||
public String saveUnMaat(Integer type) {
|
|
||||||
try {
|
|
||||||
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
|
|
||||||
if (type == 1) {
|
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
|
||||||
Integer service = 261;
|
|
||||||
long id = configRedisService.getIncrId("seq_compileid");
|
|
||||||
// int id=2;
|
|
||||||
map.put("cfg_id", id + "");
|
|
||||||
map.put("is_valid", "1");
|
|
||||||
map.put("dst_file", "home");
|
|
||||||
map.put("dst_file_md5", "fasdfdasfsdafdsafadsf");
|
|
||||||
map.put("op_time", new Date().getTime() + "");
|
|
||||||
map.put("level", "20");
|
|
||||||
map.put("file_id", id + "");
|
|
||||||
map.put("service", service + "");
|
|
||||||
listMap.add(map);
|
|
||||||
|
|
||||||
Map<Integer, List<Map<String, String>>> configMap = new HashMap<Integer, List<Map<String, String>>>();
|
|
||||||
configMap.put(1, listMap);
|
|
||||||
configRedisService.saveUnMaatConfig(configMap);
|
|
||||||
} else {
|
|
||||||
Integer service = 265;
|
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
|
||||||
long id = configRedisService.getIncrId("seq_compileid");
|
|
||||||
// int id=2;
|
|
||||||
map.put("cfg_id", id + "");
|
|
||||||
map.put("is_valid", "1");
|
|
||||||
map.put("service", "100");
|
|
||||||
map.put("description", "123" + id);
|
|
||||||
map.put("level", "20");
|
|
||||||
listMap.add(map);
|
|
||||||
map.put("service", service + "");
|
|
||||||
|
|
||||||
Map<Integer, List<Map<String, String>>> configMap = new HashMap<Integer, List<Map<String, String>>>();
|
|
||||||
configMap.put(1, listMap);
|
|
||||||
configRedisService.saveUnMaatConfig(configMap);
|
|
||||||
}
|
|
||||||
return "ok";
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return "false";
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/cfg/v1/delUnMaat", method = RequestMethod.GET)
|
|
||||||
@ApiOperation(value = "test redis", httpMethod = "GET", response = Map.class, notes = "测试redis事务的crontroller")
|
|
||||||
@ApiParam(value = "test redis", name = "测试redis事务的crontroller", required = true)
|
|
||||||
public String delUnMaat(int redisDB, int service, long id) {
|
|
||||||
try {
|
|
||||||
Map<Integer, List<Long>> map = new HashMap<Integer, List<Long>>();
|
|
||||||
ArrayList<Long> arrayList = new ArrayList<Long>();
|
|
||||||
arrayList.add(id);
|
|
||||||
map.put(service, arrayList);
|
|
||||||
Map<Integer, Map<Integer, List<Long>>> idMap = new HashMap<Integer, Map<Integer, List<Long>>>();
|
|
||||||
idMap.put(redisDB, map);
|
|
||||||
configRedisService.delUnMaatConfig(idMap);
|
|
||||||
// configRedisService.saveMaatConfig(listMap, service);
|
|
||||||
// new ConfigRedisServiceimpl().GETMaatConfig(listMap);
|
|
||||||
return "ok";
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return "false";
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/cfg/v1/delMaat", method = RequestMethod.GET)
|
|
||||||
@ApiOperation(value = "test redis", httpMethod = "GET", response = Map.class, notes = "测试redis事务的crontroller")
|
|
||||||
@ApiParam(value = "test redis", name = "测试redis事务的crontroller", required = true)
|
|
||||||
public String delMaat(int redisDB, int service, long id) {
|
|
||||||
try {
|
|
||||||
Map<Integer, List<Long>> map = new HashMap<Integer, List<Long>>();
|
|
||||||
ArrayList<Long> arrayList = new ArrayList<Long>();
|
|
||||||
arrayList.add(id);
|
|
||||||
map.put(service, arrayList);
|
|
||||||
Map<Integer, Map<Integer, List<Long>>> idMap = new HashMap<Integer, Map<Integer, List<Long>>>();
|
|
||||||
idMap.put(redisDB, map);
|
|
||||||
|
|
||||||
boolean delMaatConfig = configRedisService.delMaatConfig(idMap);
|
|
||||||
return "ok";
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return "false";
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/cfg/v1/saveMaat", method = RequestMethod.GET)
|
|
||||||
@ApiOperation(value = "test redis", httpMethod = "GET", response = Map.class, notes = "测试redis事务的crontroller")
|
|
||||||
@ApiParam(value = "test redis", name = "测试redis事务的crontroller", required = true)
|
|
||||||
public String saveMaat(Integer service) {
|
|
||||||
try {
|
|
||||||
Map<Integer, List<MaatConfig>> configMap = new HashMap<Integer, List<MaatConfig>>();
|
|
||||||
List<Integer> redisDBByService = ServiceAndRDBIndexReal.getRedisDBByService(service);
|
|
||||||
long seq_groupid = configRedisService.getIncrId("SEQ_GROUPID");
|
|
||||||
List<MaatConfig> listMap = new ArrayList<MaatConfig>();
|
|
||||||
long seq_regionid2 = configRedisService.getIncrId("SEQ_REGIONID");
|
|
||||||
listMap.add(getMaatConfig1(service, seq_groupid,seq_regionid2));
|
|
||||||
//listMap.add(getMaatConfig2(service, seq_groupid,seq_regionid2));
|
|
||||||
|
|
||||||
for (Integer db : redisDBByService) {
|
|
||||||
configMap.put(db, listMap);
|
|
||||||
}
|
|
||||||
configRedisService.saveMaatConfig(configMap);
|
|
||||||
// configRedisService.saveMaatConfig(listMap, service);
|
|
||||||
// new ConfigRedisServiceimpl().GETMaatConfig(listMap);
|
|
||||||
return "ok";
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return "false";
|
|
||||||
}
|
|
||||||
|
|
||||||
public MaatConfig getMaatConfig1(Integer service, long seq_groupid,long seq_regionid2) {
|
|
||||||
String time = new Date().getTime() + "";
|
|
||||||
Map<String, String> configMap1 = new HashMap<String, String>();
|
|
||||||
long seq_compileid = configRedisService.getIncrId("SEQ_COMPILEID");
|
|
||||||
long seq_regionid1 = configRedisService.getIncrId("SEQ_REGIONID");
|
|
||||||
// int id=2;
|
|
||||||
configMap1.put("compile_id", seq_compileid + "");
|
|
||||||
configMap1.put("service", service + "");
|
|
||||||
configMap1.put("action", "0");
|
|
||||||
configMap1.put("do_blacklist", "1");
|
|
||||||
configMap1.put("do_log", "1");
|
|
||||||
configMap1.put("effective_range", "0");
|
|
||||||
configMap1.put("user_region", "0");
|
|
||||||
configMap1.put("is_valid", "1");
|
|
||||||
configMap1.put("group_num", "1");
|
|
||||||
configMap1.put("father_cfg_id", "0");
|
|
||||||
configMap1.put("op_time", time);
|
|
||||||
|
|
||||||
List<Map<String, String>> groupMapList = new ArrayList<Map<String, String>>();
|
|
||||||
Map<String, String> groupMap1 = new HashMap<String, String>();
|
|
||||||
groupMap1.put("group_id", seq_groupid + "");
|
|
||||||
groupMap1.put("compile_id", seq_compileid + "");
|
|
||||||
groupMap1.put("is_valid", "1");
|
|
||||||
groupMap1.put("op_time", time);
|
|
||||||
groupMap1.put("service", service + "");
|
|
||||||
groupMapList.add(groupMap1);
|
|
||||||
Long incrId = configRedisService.getIncrId("SEQ_GROUPID");
|
|
||||||
Map<String, String> groupMap2 = new HashMap<String, String>();
|
|
||||||
groupMap2.put("group_id", incrId + "");
|
|
||||||
groupMap2.put("compile_id", seq_compileid + "");
|
|
||||||
groupMap2.put("is_valid", "1");
|
|
||||||
groupMap2.put("op_time", time);
|
|
||||||
groupMap2.put("service", service + "");
|
|
||||||
groupMapList.add(groupMap2);
|
|
||||||
List<Map<String, String>> ipRegionMapList = new ArrayList<Map<String, String>>();
|
|
||||||
Map<String, String> strMap = new HashMap<String, String>();
|
|
||||||
strMap.put("group_id", incrId + "");
|
|
||||||
strMap.put("region_id", seq_regionid1 + "");
|
|
||||||
strMap.put("addr_type", "4");
|
|
||||||
strMap.put("src_ip", "0.0.0.0");
|
|
||||||
strMap.put("mask_src_ip", "255.255.255.255");
|
|
||||||
strMap.put("src_port", "0");
|
|
||||||
strMap.put("mask_src_port", "0");
|
|
||||||
strMap.put("dst_ip", "0.0.0.0");
|
|
||||||
strMap.put("mask_dst_ip", "255.255.255.255");
|
|
||||||
strMap.put("dst_port", "0");
|
|
||||||
strMap.put("mask_dst_port", "0");
|
|
||||||
strMap.put("protocol", "0");
|
|
||||||
strMap.put("direction", "0");
|
|
||||||
strMap.put("is_valid", "1");
|
|
||||||
strMap.put("op_time", time);
|
|
||||||
strMap.put("service", service + "");
|
|
||||||
|
|
||||||
ipRegionMapList.add(strMap);
|
|
||||||
|
|
||||||
strMap = new HashMap<String, String>();
|
|
||||||
strMap.put("group_id", seq_groupid + "");
|
|
||||||
strMap.put("region_id", seq_regionid2 + "");
|
|
||||||
strMap.put("addr_type", "4");
|
|
||||||
strMap.put("src_ip", "0.0.0.0");
|
|
||||||
strMap.put("mask_src_ip", "255.255.255.255");
|
|
||||||
strMap.put("src_port", "0");
|
|
||||||
strMap.put("mask_src_port", "0");
|
|
||||||
strMap.put("dst_ip", "0.0.0.0");
|
|
||||||
strMap.put("mask_dst_ip", "255.255.255.255");
|
|
||||||
strMap.put("dst_port", "0");
|
|
||||||
strMap.put("mask_dst_port", "0");
|
|
||||||
strMap.put("protocol", "0");
|
|
||||||
strMap.put("direction", "0");
|
|
||||||
strMap.put("is_valid", "1");
|
|
||||||
strMap.put("op_time", time);
|
|
||||||
strMap.put("service", service + "");
|
|
||||||
ipRegionMapList.add(strMap);
|
|
||||||
|
|
||||||
MaatConfig maatConfig = new MaatConfig();
|
|
||||||
maatConfig.setCompileMap(configMap1);
|
|
||||||
maatConfig.setGroupMapList(groupMapList);
|
|
||||||
maatConfig.setService(service);
|
|
||||||
maatConfig.setIpRegionMapList(ipRegionMapList);
|
|
||||||
return maatConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MaatConfig getMaatConfig2(Integer service, long seq_groupid,long seq_regionid2) {
|
|
||||||
String time = new Date().getTime() + "";
|
|
||||||
Map<String, String> configMap = new HashMap<String, String>();
|
|
||||||
long seq_compileid = configRedisService.getIncrId("SEQ_COMPILEID");
|
|
||||||
|
|
||||||
// int id=2;
|
|
||||||
configMap.put("compile_id", seq_compileid + "");
|
|
||||||
configMap.put("service", service + "");
|
|
||||||
configMap.put("action", "0");
|
|
||||||
configMap.put("do_blacklist", "1");
|
|
||||||
configMap.put("do_log", "1");
|
|
||||||
configMap.put("effective_range", "0");
|
|
||||||
configMap.put("user_region", "0");
|
|
||||||
configMap.put("is_valid", "1");
|
|
||||||
configMap.put("group_num", "1");
|
|
||||||
configMap.put("father_cfg_id", "0");
|
|
||||||
configMap.put("op_time", time);
|
|
||||||
|
|
||||||
List<Map<String, String>> groupMapList = new ArrayList<Map<String, String>>();
|
|
||||||
Map<String, String> groupMap = new HashMap<String, String>();
|
|
||||||
groupMap.put("group_id", seq_groupid + "");
|
|
||||||
groupMap.put("compile_id", seq_compileid + "");
|
|
||||||
groupMap.put("is_valid", "1");
|
|
||||||
groupMap.put("op_time", time);
|
|
||||||
groupMap.put("service", service + "");
|
|
||||||
groupMapList.add(groupMap);
|
|
||||||
|
|
||||||
List<Map<String, String>> ipRegionMapList = new ArrayList<Map<String, String>>();
|
|
||||||
Map<String, String> strMap = new HashMap<String, String>();
|
|
||||||
strMap = new HashMap<String, String>();
|
|
||||||
strMap.put("group_id", seq_groupid + "");
|
|
||||||
strMap.put("region_id", seq_regionid2 + "");
|
|
||||||
strMap.put("addr_type", "4");
|
|
||||||
strMap.put("src_ip", "0.0.0.0");
|
|
||||||
strMap.put("mask_src_ip", "255.255.255.255");
|
|
||||||
strMap.put("src_port", "0");
|
|
||||||
strMap.put("mask_src_port", "0");
|
|
||||||
strMap.put("dst_ip", "0.0.0.0");
|
|
||||||
strMap.put("mask_dst_ip", "255.255.255.255");
|
|
||||||
strMap.put("dst_port", "0");
|
|
||||||
strMap.put("mask_dst_port", "0");
|
|
||||||
strMap.put("protocol", "0");
|
|
||||||
strMap.put("direction", "0");
|
|
||||||
strMap.put("is_valid", "1");
|
|
||||||
strMap.put("op_time", time);
|
|
||||||
strMap.put("service", service + "");
|
|
||||||
ipRegionMapList.add(strMap);
|
|
||||||
|
|
||||||
MaatConfig maatConfig = new MaatConfig();
|
|
||||||
maatConfig.setCompileMap(configMap);
|
|
||||||
maatConfig.setGroupMapList(groupMapList);
|
|
||||||
maatConfig.setService(service);
|
|
||||||
maatConfig.setIpRegionMapList(ipRegionMapList);
|
|
||||||
return maatConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/cfg/v1/configSources", method = RequestMethod.POST)
|
@RequestMapping(value = "/cfg/v1/configSources", method = RequestMethod.POST)
|
||||||
@ApiOperation(value = "业务配置存储", httpMethod = "POST", response = Map.class, notes = "对有效的配置(封堵|监测|白名单)存储")
|
@ApiOperation(value = "业务配置存储", httpMethod = "POST", response = Map.class, notes = "对有效的配置(封堵|监测|白名单)存储")
|
||||||
@@ -334,20 +85,19 @@ public class ConfigSourcesController extends BaseRestController {
|
|||||||
if (null != configSource && null != configSource.getConfigCompileList()
|
if (null != configSource && null != configSource.getConfigCompileList()
|
||||||
&& configSource.getConfigCompileList().size() > 0) {
|
&& configSource.getConfigCompileList().size() > 0) {
|
||||||
int opAction = configSource.getOpAction();
|
int opAction = configSource.getOpAction();
|
||||||
|
|
||||||
checkOpAction(thread, System.currentTimeMillis() - start, opAction, 1);
|
checkOpAction(thread, System.currentTimeMillis() - start, opAction, 1);
|
||||||
// 验证配置编译数据
|
// 验证配置编译数据
|
||||||
validateConfigSource(thread, start, configSource);
|
validateConfigSource(thread, start, configSource);
|
||||||
Long benginTime = System.currentTimeMillis();
|
|
||||||
String msg = configSourcesService.saveMaatConfig(thread, start, configSource.getConfigCompileList(), sb);
|
String msg = configSourcesService.saveMaatConfig(thread, start, configSource.getConfigCompileList(), sb);
|
||||||
// String msg = "";
|
|
||||||
if ("error".equals(msg)) {
|
if ("error".equals(msg)) {
|
||||||
Exception exception = ConfigSourcesService.getMsgList().get(0);
|
Exception exception = ConfigSourcesService.getMsgList().get(0);
|
||||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||||
"存储编译配置时出现异常" + exception.getMessage(),CompileVal.getBusinessCode());
|
"存储编译配置时出现异常" + exception.getMessage(),CompileVal.getBusinessCode());
|
||||||
}
|
}
|
||||||
Long endSaveTime = System.currentTimeMillis();
|
|
||||||
Long time = (endSaveTime - benginTime) / 1000;
|
|
||||||
System.out.println("插入数据成功总共需要" + time + "秒");
|
|
||||||
} else {
|
} else {
|
||||||
thread.setExceptionInfo("编译配置数据不能为空");
|
thread.setExceptionInfo("编译配置数据不能为空");
|
||||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置数据不能为空",
|
throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置数据不能为空",
|
||||||
@@ -358,6 +108,8 @@ public class ConfigSourcesController extends BaseRestController {
|
|||||||
"编译配置数据插入成功" + sb.toString(), Constants.IS_DEBUG ? configSource : null);
|
"编译配置数据插入成功" + sb.toString(), Constants.IS_DEBUG ? configSource : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/cfg/v1/configSources", method = RequestMethod.PUT)
|
@RequestMapping(value = "/cfg/v1/configSources", method = RequestMethod.PUT)
|
||||||
@ApiOperation(value = "业务配置状态更新", httpMethod = "PUT", response = Map.class, notes = "对有效的配置(封堵|监测|白名单)进行配置失效")
|
@ApiOperation(value = "业务配置状态更新", httpMethod = "PUT", response = Map.class, notes = "对有效的配置(封堵|监测|白名单)进行配置失效")
|
||||||
@ApiParam(value = "业务配置数据源", name = "configSource", required = true)
|
@ApiParam(value = "业务配置数据源", name = "configSource", required = true)
|
||||||
|
|||||||
@@ -9,18 +9,13 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import com.nis.domain.restful.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.nis.domain.restful.ConfigCompile;
|
|
||||||
import com.nis.domain.restful.ConfigGroupRelation;
|
|
||||||
import com.nis.domain.restful.DigestRegion;
|
|
||||||
import com.nis.domain.restful.IpRegion;
|
|
||||||
import com.nis.domain.restful.NumRegion;
|
|
||||||
import com.nis.domain.restful.StrRegion;
|
|
||||||
import com.nis.util.Configurations;
|
import com.nis.util.Configurations;
|
||||||
import com.nis.util.ExceptionUtil;
|
import com.nis.util.ExceptionUtil;
|
||||||
import com.nis.util.FileUtils;
|
import com.nis.util.FileUtils;
|
||||||
@@ -36,7 +31,7 @@ import com.wordnik.swagger.annotations.ApiOperation;
|
|||||||
import com.wordnik.swagger.annotations.ApiParam;
|
import com.wordnik.swagger.annotations.ApiParam;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("${servicePath}")
|
@RequestMapping("test")
|
||||||
@Api(value = "ConfigSourcesController", description = "测试maat及非maat配置入库,取消功能")
|
@Api(value = "ConfigSourcesController", description = "测试maat及非maat配置入库,取消功能")
|
||||||
public class MaatTestController {
|
public class MaatTestController {
|
||||||
// private static Logger logger =
|
// private static Logger logger =
|
||||||
@@ -51,6 +46,263 @@ public class MaatTestController {
|
|||||||
ServicesRequestLogService servicesRequestLogService;
|
ServicesRequestLogService servicesRequestLogService;
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
@RequestMapping(value = "/cfg/v1/saveUnMaat", method = RequestMethod.GET)
|
||||||
|
@ApiOperation(value = "test redis", httpMethod = "GET", response = Map.class, notes = "测试redis事务的crontroller")
|
||||||
|
@ApiParam(value = "test redis", name = "测试redis事务的crontroller", required = true)
|
||||||
|
public String saveUnMaat(Integer type) {
|
||||||
|
try {
|
||||||
|
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
|
||||||
|
if (type == 1) {
|
||||||
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
Integer service = 261;
|
||||||
|
long id = configRedisService.getIncrId("seq_compileid");
|
||||||
|
// int id=2;
|
||||||
|
map.put("cfg_id", id + "");
|
||||||
|
map.put("is_valid", "1");
|
||||||
|
map.put("dst_file", "home");
|
||||||
|
map.put("dst_file_md5", "fasdfdasfsdafdsafadsf");
|
||||||
|
map.put("op_time", new Date().getTime() + "");
|
||||||
|
map.put("level", "20");
|
||||||
|
map.put("file_id", id + "");
|
||||||
|
map.put("service", service + "");
|
||||||
|
listMap.add(map);
|
||||||
|
|
||||||
|
Map<Integer, List<Map<String, String>>> configMap = new HashMap<Integer, List<Map<String, String>>>();
|
||||||
|
configMap.put(1, listMap);
|
||||||
|
configRedisService.saveUnMaatConfig(configMap);
|
||||||
|
} else {
|
||||||
|
Integer service = 265;
|
||||||
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
long id = configRedisService.getIncrId("seq_compileid");
|
||||||
|
// int id=2;
|
||||||
|
map.put("cfg_id", id + "");
|
||||||
|
map.put("is_valid", "1");
|
||||||
|
map.put("service", "100");
|
||||||
|
map.put("description", "123" + id);
|
||||||
|
map.put("level", "20");
|
||||||
|
listMap.add(map);
|
||||||
|
map.put("service", service + "");
|
||||||
|
|
||||||
|
Map<Integer, List<Map<String, String>>> configMap = new HashMap<Integer, List<Map<String, String>>>();
|
||||||
|
configMap.put(1, listMap);
|
||||||
|
configRedisService.saveUnMaatConfig(configMap);
|
||||||
|
}
|
||||||
|
return "ok";
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/cfg/v1/delUnMaat", method = RequestMethod.GET)
|
||||||
|
@ApiOperation(value = "test redis", httpMethod = "GET", response = Map.class, notes = "测试redis事务的crontroller")
|
||||||
|
@ApiParam(value = "test redis", name = "测试redis事务的crontroller", required = true)
|
||||||
|
public String delUnMaat(int redisDB, int service, long id) {
|
||||||
|
try {
|
||||||
|
Map<Integer, List<Long>> map = new HashMap<Integer, List<Long>>();
|
||||||
|
ArrayList<Long> arrayList = new ArrayList<Long>();
|
||||||
|
arrayList.add(id);
|
||||||
|
map.put(service, arrayList);
|
||||||
|
Map<Integer, Map<Integer, List<Long>>> idMap = new HashMap<Integer, Map<Integer, List<Long>>>();
|
||||||
|
idMap.put(redisDB, map);
|
||||||
|
configRedisService.delUnMaatConfig(idMap);
|
||||||
|
// configRedisService.saveMaatConfig(listMap, service);
|
||||||
|
// new ConfigRedisServiceimpl().GETMaatConfig(listMap);
|
||||||
|
return "ok";
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/cfg/v1/delMaat", method = RequestMethod.GET)
|
||||||
|
@ApiOperation(value = "test redis", httpMethod = "GET", response = Map.class, notes = "测试redis事务的crontroller")
|
||||||
|
@ApiParam(value = "test redis", name = "测试redis事务的crontroller", required = true)
|
||||||
|
public String delMaat(int redisDB, int service, long id) {
|
||||||
|
try {
|
||||||
|
Map<Integer, List<Long>> map = new HashMap<Integer, List<Long>>();
|
||||||
|
ArrayList<Long> arrayList = new ArrayList<Long>();
|
||||||
|
arrayList.add(id);
|
||||||
|
map.put(service, arrayList);
|
||||||
|
Map<Integer, Map<Integer, List<Long>>> idMap = new HashMap<Integer, Map<Integer, List<Long>>>();
|
||||||
|
idMap.put(redisDB, map);
|
||||||
|
|
||||||
|
boolean delMaatConfig = configRedisService.delMaatConfig(idMap);
|
||||||
|
return "ok";
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/cfg/v1/saveMaat", method = RequestMethod.GET)
|
||||||
|
@ApiOperation(value = "test redis", httpMethod = "GET", response = Map.class, notes = "测试redis事务的crontroller")
|
||||||
|
@ApiParam(value = "test redis", name = "测试redis事务的crontroller", required = true)
|
||||||
|
public String saveMaat(Integer service) {
|
||||||
|
try {
|
||||||
|
Map<Integer, List<MaatConfig>> configMap = new HashMap<Integer, List<MaatConfig>>();
|
||||||
|
List<Integer> redisDBByService = ServiceAndRDBIndexReal.getRedisDBByService(service);
|
||||||
|
long seq_groupid = configRedisService.getIncrId("SEQ_GROUPID");
|
||||||
|
List<MaatConfig> listMap = new ArrayList<MaatConfig>();
|
||||||
|
long seq_regionid2 = configRedisService.getIncrId("SEQ_REGIONID");
|
||||||
|
listMap.add(getMaatConfig1(service, seq_groupid,seq_regionid2));
|
||||||
|
//listMap.add(getMaatConfig2(service, seq_groupid,seq_regionid2));
|
||||||
|
|
||||||
|
for (Integer db : redisDBByService) {
|
||||||
|
configMap.put(db, listMap);
|
||||||
|
}
|
||||||
|
configRedisService.saveMaatConfig(configMap);
|
||||||
|
// configRedisService.saveMaatConfig(listMap, service);
|
||||||
|
// new ConfigRedisServiceimpl().GETMaatConfig(listMap);
|
||||||
|
return "ok";
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
public MaatConfig getMaatConfig1(Integer service, long seq_groupid,long seq_regionid2) {
|
||||||
|
String time = new Date().getTime() + "";
|
||||||
|
Map<String, String> configMap1 = new HashMap<String, String>();
|
||||||
|
long seq_compileid = configRedisService.getIncrId("SEQ_COMPILEID");
|
||||||
|
long seq_regionid1 = configRedisService.getIncrId("SEQ_REGIONID");
|
||||||
|
// int id=2;
|
||||||
|
configMap1.put("compile_id", seq_compileid + "");
|
||||||
|
configMap1.put("service", service + "");
|
||||||
|
configMap1.put("action", "0");
|
||||||
|
configMap1.put("do_blacklist", "1");
|
||||||
|
configMap1.put("do_log", "1");
|
||||||
|
configMap1.put("effective_range", "0");
|
||||||
|
configMap1.put("user_region", "0");
|
||||||
|
configMap1.put("is_valid", "1");
|
||||||
|
configMap1.put("group_num", "1");
|
||||||
|
configMap1.put("father_cfg_id", "0");
|
||||||
|
configMap1.put("op_time", time);
|
||||||
|
|
||||||
|
List<Map<String, String>> groupMapList = new ArrayList<Map<String, String>>();
|
||||||
|
Map<String, String> groupMap1 = new HashMap<String, String>();
|
||||||
|
groupMap1.put("group_id", seq_groupid + "");
|
||||||
|
groupMap1.put("compile_id", seq_compileid + "");
|
||||||
|
groupMap1.put("is_valid", "1");
|
||||||
|
groupMap1.put("op_time", time);
|
||||||
|
groupMap1.put("service", service + "");
|
||||||
|
groupMapList.add(groupMap1);
|
||||||
|
Long incrId = configRedisService.getIncrId("SEQ_GROUPID");
|
||||||
|
Map<String, String> groupMap2 = new HashMap<String, String>();
|
||||||
|
groupMap2.put("group_id", incrId + "");
|
||||||
|
groupMap2.put("compile_id", seq_compileid + "");
|
||||||
|
groupMap2.put("is_valid", "1");
|
||||||
|
groupMap2.put("op_time", time);
|
||||||
|
groupMap2.put("service", service + "");
|
||||||
|
groupMapList.add(groupMap2);
|
||||||
|
List<Map<String, String>> ipRegionMapList = new ArrayList<Map<String, String>>();
|
||||||
|
Map<String, String> strMap = new HashMap<String, String>();
|
||||||
|
strMap.put("group_id", incrId + "");
|
||||||
|
strMap.put("region_id", seq_regionid1 + "");
|
||||||
|
strMap.put("addr_type", "4");
|
||||||
|
strMap.put("src_ip", "0.0.0.0");
|
||||||
|
strMap.put("mask_src_ip", "255.255.255.255");
|
||||||
|
strMap.put("src_port", "0");
|
||||||
|
strMap.put("mask_src_port", "0");
|
||||||
|
strMap.put("dst_ip", "0.0.0.0");
|
||||||
|
strMap.put("mask_dst_ip", "255.255.255.255");
|
||||||
|
strMap.put("dst_port", "0");
|
||||||
|
strMap.put("mask_dst_port", "0");
|
||||||
|
strMap.put("protocol", "0");
|
||||||
|
strMap.put("direction", "0");
|
||||||
|
strMap.put("is_valid", "1");
|
||||||
|
strMap.put("op_time", time);
|
||||||
|
strMap.put("service", service + "");
|
||||||
|
|
||||||
|
ipRegionMapList.add(strMap);
|
||||||
|
|
||||||
|
strMap = new HashMap<String, String>();
|
||||||
|
strMap.put("group_id", seq_groupid + "");
|
||||||
|
strMap.put("region_id", seq_regionid2 + "");
|
||||||
|
strMap.put("addr_type", "4");
|
||||||
|
strMap.put("src_ip", "0.0.0.0");
|
||||||
|
strMap.put("mask_src_ip", "255.255.255.255");
|
||||||
|
strMap.put("src_port", "0");
|
||||||
|
strMap.put("mask_src_port", "0");
|
||||||
|
strMap.put("dst_ip", "0.0.0.0");
|
||||||
|
strMap.put("mask_dst_ip", "255.255.255.255");
|
||||||
|
strMap.put("dst_port", "0");
|
||||||
|
strMap.put("mask_dst_port", "0");
|
||||||
|
strMap.put("protocol", "0");
|
||||||
|
strMap.put("direction", "0");
|
||||||
|
strMap.put("is_valid", "1");
|
||||||
|
strMap.put("op_time", time);
|
||||||
|
strMap.put("service", service + "");
|
||||||
|
ipRegionMapList.add(strMap);
|
||||||
|
|
||||||
|
MaatConfig maatConfig = new MaatConfig();
|
||||||
|
maatConfig.setCompileMap(configMap1);
|
||||||
|
maatConfig.setGroupMapList(groupMapList);
|
||||||
|
maatConfig.setService(service);
|
||||||
|
maatConfig.setIpRegionMapList(ipRegionMapList);
|
||||||
|
return maatConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MaatConfig getMaatConfig2(Integer service, long seq_groupid,long seq_regionid2) {
|
||||||
|
String time = new Date().getTime() + "";
|
||||||
|
Map<String, String> configMap = new HashMap<String, String>();
|
||||||
|
long seq_compileid = configRedisService.getIncrId("SEQ_COMPILEID");
|
||||||
|
|
||||||
|
// int id=2;
|
||||||
|
configMap.put("compile_id", seq_compileid + "");
|
||||||
|
configMap.put("service", service + "");
|
||||||
|
configMap.put("action", "0");
|
||||||
|
configMap.put("do_blacklist", "1");
|
||||||
|
configMap.put("do_log", "1");
|
||||||
|
configMap.put("effective_range", "0");
|
||||||
|
configMap.put("user_region", "0");
|
||||||
|
configMap.put("is_valid", "1");
|
||||||
|
configMap.put("group_num", "1");
|
||||||
|
configMap.put("father_cfg_id", "0");
|
||||||
|
configMap.put("op_time", time);
|
||||||
|
|
||||||
|
List<Map<String, String>> groupMapList = new ArrayList<Map<String, String>>();
|
||||||
|
Map<String, String> groupMap = new HashMap<String, String>();
|
||||||
|
groupMap.put("group_id", seq_groupid + "");
|
||||||
|
groupMap.put("compile_id", seq_compileid + "");
|
||||||
|
groupMap.put("is_valid", "1");
|
||||||
|
groupMap.put("op_time", time);
|
||||||
|
groupMap.put("service", service + "");
|
||||||
|
groupMapList.add(groupMap);
|
||||||
|
|
||||||
|
List<Map<String, String>> ipRegionMapList = new ArrayList<Map<String, String>>();
|
||||||
|
Map<String, String> strMap = new HashMap<String, String>();
|
||||||
|
strMap = new HashMap<String, String>();
|
||||||
|
strMap.put("group_id", seq_groupid + "");
|
||||||
|
strMap.put("region_id", seq_regionid2 + "");
|
||||||
|
strMap.put("addr_type", "4");
|
||||||
|
strMap.put("src_ip", "0.0.0.0");
|
||||||
|
strMap.put("mask_src_ip", "255.255.255.255");
|
||||||
|
strMap.put("src_port", "0");
|
||||||
|
strMap.put("mask_src_port", "0");
|
||||||
|
strMap.put("dst_ip", "0.0.0.0");
|
||||||
|
strMap.put("mask_dst_ip", "255.255.255.255");
|
||||||
|
strMap.put("dst_port", "0");
|
||||||
|
strMap.put("mask_dst_port", "0");
|
||||||
|
strMap.put("protocol", "0");
|
||||||
|
strMap.put("direction", "0");
|
||||||
|
strMap.put("is_valid", "1");
|
||||||
|
strMap.put("op_time", time);
|
||||||
|
strMap.put("service", service + "");
|
||||||
|
ipRegionMapList.add(strMap);
|
||||||
|
|
||||||
|
MaatConfig maatConfig = new MaatConfig();
|
||||||
|
maatConfig.setCompileMap(configMap);
|
||||||
|
maatConfig.setGroupMapList(groupMapList);
|
||||||
|
maatConfig.setService(service);
|
||||||
|
maatConfig.setIpRegionMapList(ipRegionMapList);
|
||||||
|
return maatConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/cfg/v1/testDelMaat", method = RequestMethod.GET)
|
@RequestMapping(value = "/cfg/v1/testDelMaat", method = RequestMethod.GET)
|
||||||
@ApiOperation(value = "测试批量删除maat配置", httpMethod = "GET", response = String.class, notes = "测试批量删除maat配置,configId为配置id,多个配置id用逗号分隔")
|
@ApiOperation(value = "测试批量删除maat配置", httpMethod = "GET", response = String.class, notes = "测试批量删除maat配置,configId为配置id,多个配置id用逗号分隔")
|
||||||
@ApiParam(value = "测试批量删除maat配置", name = "testDelMaat", required = true)
|
@ApiParam(value = "测试批量删除maat配置", name = "testDelMaat", required = true)
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
ConfigSourcesService.msgList = msgList;
|
ConfigSourcesService.msgList = msgList;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Logger logger1 = Logger.getLogger(this.getClass());
|
|
||||||
private Map<Integer, Map<String, String>> map;
|
private Map<Integer, Map<String, String>> map;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ConfigCompileDao configCompileDao;
|
private ConfigCompileDao configCompileDao;
|
||||||
@@ -349,7 +348,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
* 保存异常信息入库对象
|
* 保存异常信息入库对象
|
||||||
* @param start
|
* @param start
|
||||||
* 进入controller的时间
|
* 进入controller的时间
|
||||||
* @param compileList
|
* @param configSource
|
||||||
* 编译配置集合
|
* 编译配置集合
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@@ -383,21 +382,21 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
+ sb.toString(),
|
+ sb.toString(),
|
||||||
CompileVal.getBusinessCode());
|
CompileVal.getBusinessCode());
|
||||||
}
|
}
|
||||||
logger1.info("数据保存到数据库提交事务开始");
|
logger.info("数据保存到数据库提交事务开始");
|
||||||
batchSqlSession.commit();
|
batchSqlSession.commit();
|
||||||
logger1.info("数据保存到数据库成功");
|
logger.info("数据保存到数据库成功");
|
||||||
} catch (RestServiceException e) {
|
} catch (RestServiceException e) {
|
||||||
logger1.error(e);
|
logger.error("RestServiceException", e);
|
||||||
thread.setExceptionInfo(e.getMessage() + " " + e.getCause()
|
thread.setExceptionInfo(e.getMessage() + " " + e.getCause()
|
||||||
+ sb.toString());
|
+ sb.toString());
|
||||||
throw new RestServiceException(thread, System.currentTimeMillis()
|
throw new RestServiceException(thread, System.currentTimeMillis()
|
||||||
- start, e.getMessage() + sb.toString(), e.getErrorCode());
|
- start, e.getMessage() + sb.toString(), e.getErrorCode());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
logger1.error(e);
|
logger.error("Exception", e);
|
||||||
String errorCode = OracleErrorCodeUtil.getOraCode(e);
|
String errorCode = OracleErrorCodeUtil.getOraCode(e);
|
||||||
if (!StringUtils.isEmpty(errorCode)) {
|
if (!StringUtils.isEmpty(errorCode)) {
|
||||||
logger1.error("数据更新发生异常!");
|
logger.error("数据更新发生异常!");
|
||||||
thread.setExceptionInfo(e.getMessage() + " " + e.getCause()
|
thread.setExceptionInfo(e.getMessage() + " " + e.getCause()
|
||||||
+ sb.toString());
|
+ sb.toString());
|
||||||
OracleErrorCodeUtil.throwExceptionInfo(thread,
|
OracleErrorCodeUtil.throwExceptionInfo(thread,
|
||||||
@@ -432,8 +431,8 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
* 保存异常信息入库对象
|
* 保存异常信息入库对象
|
||||||
* @param start
|
* @param start
|
||||||
* 进入controller的时间
|
* 进入controller的时间
|
||||||
* @param compileList
|
* @param config
|
||||||
* 编译配置集合
|
* 编译配置
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@@ -888,22 +887,22 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
List<ConfigCompile> compileList = configSource.subList(start,
|
List<ConfigCompile> compileList = configSource.subList(start,
|
||||||
end);
|
end);
|
||||||
insertConfigComLileData(thread, _start, compileList, sb);
|
insertConfigComLileData(thread, _start, compileList, sb);
|
||||||
// logger1.info(insertConfigComLile);
|
// logger.info(insertConfigComLile);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger1.info("数据保存到数据库提交事务开始");
|
logger.info("数据保存到数据库提交事务开始");
|
||||||
batchSqlSession.commit();
|
batchSqlSession.commit();
|
||||||
logger1.info("数据保存到数据库成功");
|
logger.info("数据保存到数据库成功");
|
||||||
|
|
||||||
} catch (RestServiceException e) {
|
} catch (RestServiceException e) {
|
||||||
logger1.error(e);
|
logger.error("RestServiceException", e);
|
||||||
thread.setExceptionInfo(e.getMessage() + " " + e.getCause()
|
thread.setExceptionInfo(e.getMessage() + " " + e.getCause()
|
||||||
+ sb.toString());
|
+ sb.toString());
|
||||||
throw new RestServiceException(thread, System.currentTimeMillis()
|
throw new RestServiceException(thread, System.currentTimeMillis()
|
||||||
- _start, e.getMessage() + sb.toString(), e.getErrorCode());
|
- _start, e.getMessage() + sb.toString(), e.getErrorCode());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger1.error(e);
|
logger.error("Exception", e);
|
||||||
String errorCode = OracleErrorCodeUtil.getOraCode(e);
|
String errorCode = OracleErrorCodeUtil.getOraCode(e);
|
||||||
if (!StringUtils.isEmpty(errorCode)) {
|
if (!StringUtils.isEmpty(errorCode)) {
|
||||||
thread.setExceptionInfo("数据保存发生异常" + sb.toString());
|
thread.setExceptionInfo("数据保存发生异常" + sb.toString());
|
||||||
@@ -929,7 +928,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
* 验证数据是否符合要求 插入编译配置数据 验证分组配置数据 验证域配置数据 方法二 数据库中循环
|
* 验证数据是否符合要求 插入编译配置数据 验证分组配置数据 验证域配置数据 方法二 数据库中循环
|
||||||
*
|
*
|
||||||
* @param configCompileList
|
* @param configCompileList
|
||||||
* @param batchSqlSession
|
* @param configCompileList
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@@ -946,7 +945,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
for (ConfigCompile configCompile : configCompileList) {
|
for (ConfigCompile configCompile : configCompileList) {
|
||||||
String msg = CompileVal.compileIsOk(configCompile, false, sb);
|
String msg = CompileVal.compileIsOk(configCompile, false, sb);
|
||||||
if (!"ok".equals(msg)) {
|
if (!"ok".equals(msg)) {
|
||||||
logger1.error(msg);
|
logger.error(msg);
|
||||||
thread.setExceptionInfo(msg + sb.toString());
|
thread.setExceptionInfo(msg + sb.toString());
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start,
|
System.currentTimeMillis() - start,
|
||||||
@@ -957,7 +956,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
&& configCompile.getGroupRelationList().size() > 0) {
|
&& configCompile.getGroupRelationList().size() > 0) {
|
||||||
groupRelationList.addAll(configCompile.getGroupRelationList());
|
groupRelationList.addAll(configCompile.getGroupRelationList());
|
||||||
} else {
|
} else {
|
||||||
logger1.error("配置分组数量不能为空" + sb.toString());
|
logger.error("配置分组数量不能为空" + sb.toString());
|
||||||
thread.setExceptionInfo("配置分组数量不能为空" + sb.toString());
|
thread.setExceptionInfo("配置分组数量不能为空" + sb.toString());
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start, "配置分组数量不能为空"
|
System.currentTimeMillis() - start, "配置分组数量不能为空"
|
||||||
@@ -972,7 +971,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
String errorMsg = "字符类域配置id不能为空 ,表名---"
|
String errorMsg = "字符类域配置id不能为空 ,表名---"
|
||||||
+ strRegion.getTableName() + ""
|
+ strRegion.getTableName() + ""
|
||||||
+ sb.toString();
|
+ sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start,
|
System.currentTimeMillis() - start,
|
||||||
@@ -993,7 +992,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
String errorMsg = "增强字符类域配置id不能为空 ,表名---"
|
String errorMsg = "增强字符类域配置id不能为空 ,表名---"
|
||||||
+ strRegion.getTableName() + ""
|
+ strRegion.getTableName() + ""
|
||||||
+ sb.toString();
|
+ sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start,
|
System.currentTimeMillis() - start,
|
||||||
@@ -1026,7 +1025,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
if (ipRegion.getRegionId() == null) {
|
if (ipRegion.getRegionId() == null) {
|
||||||
String errorMsg = "ip类域配置id不能为空 ,表名---"
|
String errorMsg = "ip类域配置id不能为空 ,表名---"
|
||||||
+ ipRegion.getTableName() + "" + sb.toString();
|
+ ipRegion.getTableName() + "" + sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start, errorMsg,
|
System.currentTimeMillis() - start, errorMsg,
|
||||||
@@ -1049,7 +1048,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
if (numRegion.getRegionId() == null) {
|
if (numRegion.getRegionId() == null) {
|
||||||
String errorMsg = "数值类域配置id不能为空 ,表名---"
|
String errorMsg = "数值类域配置id不能为空 ,表名---"
|
||||||
+ numRegion.getTableName() + "" + sb.toString();
|
+ numRegion.getTableName() + "" + sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start, errorMsg,
|
System.currentTimeMillis() - start, errorMsg,
|
||||||
@@ -1244,7 +1243,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
MaatConfig maatConfig = new MaatConfig();
|
MaatConfig maatConfig = new MaatConfig();
|
||||||
String msg = CompileVal.compileIsOk(configCompile, false, sb);
|
String msg = CompileVal.compileIsOk(configCompile, false, sb);
|
||||||
if (!"ok".equals(msg)) {
|
if (!"ok".equals(msg)) {
|
||||||
logger1.error(msg);
|
logger.error(msg);
|
||||||
thread.setExceptionInfo(msg + sb.toString());
|
thread.setExceptionInfo(msg + sb.toString());
|
||||||
thread.setBusinessCode(CompileVal.getBusinessCode());
|
thread.setBusinessCode(CompileVal.getBusinessCode());
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
@@ -1255,7 +1254,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
|
|
||||||
if (!(null != configCompile.getGroupRelationList() && configCompile
|
if (!(null != configCompile.getGroupRelationList() && configCompile
|
||||||
.getGroupRelationList().size() > 0)) {
|
.getGroupRelationList().size() > 0)) {
|
||||||
logger1.error("配置分组列表不能为空" + sb.toString());
|
logger.error("配置分组列表不能为空" + sb.toString());
|
||||||
thread.setExceptionInfo("配置分组数量不能为空" + sb.toString());
|
thread.setExceptionInfo("配置分组数量不能为空" + sb.toString());
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start, "配置分组列表不能为空"
|
System.currentTimeMillis() - start, "配置分组列表不能为空"
|
||||||
@@ -1269,7 +1268,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
String errorMsg = "字符类域配置id不能为空 ,表名---"
|
String errorMsg = "字符类域配置id不能为空 ,表名---"
|
||||||
+ strRegion.getTableName() + ""
|
+ strRegion.getTableName() + ""
|
||||||
+ sb.toString();
|
+ sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start,
|
System.currentTimeMillis() - start,
|
||||||
@@ -1286,7 +1285,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
String errorMsg = "ip类域配置id不能为空 ,表名---"
|
String errorMsg = "ip类域配置id不能为空 ,表名---"
|
||||||
+ ipRegion.getTableName() + ""
|
+ ipRegion.getTableName() + ""
|
||||||
+ sb.toString();
|
+ sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start,
|
System.currentTimeMillis() - start,
|
||||||
@@ -1303,7 +1302,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
String errorMsg = "数值类域配置id不能为空 ,表名---"
|
String errorMsg = "数值类域配置id不能为空 ,表名---"
|
||||||
+ numRegion.getTableName() + ""
|
+ numRegion.getTableName() + ""
|
||||||
+ sb.toString();
|
+ sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start,
|
System.currentTimeMillis() - start,
|
||||||
@@ -1320,7 +1319,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
String errorMsg = "摘要类域配置id不能为空 ,表名---"
|
String errorMsg = "摘要类域配置id不能为空 ,表名---"
|
||||||
+ digestRegion.getTableName() + ""
|
+ digestRegion.getTableName() + ""
|
||||||
+ sb.toString();
|
+ sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start,
|
System.currentTimeMillis() - start,
|
||||||
@@ -1338,7 +1337,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
String errorMsg = "生效范围IP域类域配置id不能为空 ,表名---"
|
String errorMsg = "生效范围IP域类域配置id不能为空 ,表名---"
|
||||||
+ ipRegion.getTableName() + ""
|
+ ipRegion.getTableName() + ""
|
||||||
+ sb.toString();
|
+ sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start,
|
System.currentTimeMillis() - start,
|
||||||
@@ -1555,7 +1554,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
logger1.info("---------------调用maat配置新增接口---------------------");
|
logger.info("---------------调用maat配置新增接口---------------------");
|
||||||
configRedisService.saveMaatConfig(configMap);
|
configRedisService.saveMaatConfig(configMap);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
@@ -1563,7 +1562,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
if (e.getMessage().startsWith("后台错误:")) {
|
if (e.getMessage().startsWith("后台错误:")) {
|
||||||
CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue());
|
CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue());
|
||||||
}
|
}
|
||||||
logger1.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
msgList.add(e);
|
msgList.add(e);
|
||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
@@ -1665,7 +1664,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
logger1.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
CompileVal.setBusinessCode(RestBusinessCode.unknow_error.getValue());
|
CompileVal.setBusinessCode(RestBusinessCode.unknow_error.getValue());
|
||||||
if (e.getMessage().startsWith("后台错误:")) {
|
if (e.getMessage().startsWith("后台错误:")) {
|
||||||
CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue());
|
CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue());
|
||||||
@@ -1688,7 +1687,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
for (ConfigCompile configCompile : configCompileList) {
|
for (ConfigCompile configCompile : configCompileList) {
|
||||||
String msg = CompileVal.compileIsOk(configCompile, false, sb);
|
String msg = CompileVal.compileIsOk(configCompile, false, sb);
|
||||||
if (!"ok".equals(msg)) {
|
if (!"ok".equals(msg)) {
|
||||||
logger1.error(msg);
|
logger.error(msg);
|
||||||
thread.setExceptionInfo(msg + sb.toString());
|
thread.setExceptionInfo(msg + sb.toString());
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start,
|
System.currentTimeMillis() - start,
|
||||||
@@ -1699,7 +1698,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
&& configCompile.getGroupRelationList().size() > 0) {
|
&& configCompile.getGroupRelationList().size() > 0) {
|
||||||
groupRelationList.addAll(configCompile.getGroupRelationList());
|
groupRelationList.addAll(configCompile.getGroupRelationList());
|
||||||
} else {
|
} else {
|
||||||
logger1.error("配置分组数量不能为空" + sb.toString());
|
logger.error("配置分组数量不能为空" + sb.toString());
|
||||||
thread.setExceptionInfo("配置分组数量不能为空" + sb.toString());
|
thread.setExceptionInfo("配置分组数量不能为空" + sb.toString());
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start, "配置分组数量不能为空"
|
System.currentTimeMillis() - start, "配置分组数量不能为空"
|
||||||
@@ -1714,7 +1713,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
String errorMsg = "字符类域配置id不能为空 ,表名---"
|
String errorMsg = "字符类域配置id不能为空 ,表名---"
|
||||||
+ strRegion.getTableName() + ""
|
+ strRegion.getTableName() + ""
|
||||||
+ sb.toString();
|
+ sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start,
|
System.currentTimeMillis() - start,
|
||||||
@@ -1735,7 +1734,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
String errorMsg = "增强字符类域配置id不能为空 ,表名---"
|
String errorMsg = "增强字符类域配置id不能为空 ,表名---"
|
||||||
+ strRegion.getTableName() + ""
|
+ strRegion.getTableName() + ""
|
||||||
+ sb.toString();
|
+ sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start,
|
System.currentTimeMillis() - start,
|
||||||
@@ -1768,7 +1767,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
if (ipRegion.getRegionId() == null) {
|
if (ipRegion.getRegionId() == null) {
|
||||||
String errorMsg = "ip类域配置id不能为空 ,表名---"
|
String errorMsg = "ip类域配置id不能为空 ,表名---"
|
||||||
+ ipRegion.getTableName() + "" + sb.toString();
|
+ ipRegion.getTableName() + "" + sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start, errorMsg,
|
System.currentTimeMillis() - start, errorMsg,
|
||||||
@@ -1791,7 +1790,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
if (numRegion.getRegionId() == null) {
|
if (numRegion.getRegionId() == null) {
|
||||||
String errorMsg = "数值类域配置id不能为空 ,表名---"
|
String errorMsg = "数值类域配置id不能为空 ,表名---"
|
||||||
+ numRegion.getTableName() + "" + sb.toString();
|
+ numRegion.getTableName() + "" + sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start, errorMsg,
|
System.currentTimeMillis() - start, errorMsg,
|
||||||
@@ -1818,7 +1817,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
String errorMsg = "摘要类域配置id不能为空 ,表名---"
|
String errorMsg = "摘要类域配置id不能为空 ,表名---"
|
||||||
+ digestRegion.getTableName() + ""
|
+ digestRegion.getTableName() + ""
|
||||||
+ sb.toString();
|
+ sb.toString();
|
||||||
logger1.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
thread.setExceptionInfo(errorMsg);
|
thread.setExceptionInfo(errorMsg);
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start, errorMsg,
|
System.currentTimeMillis() - start, errorMsg,
|
||||||
@@ -1950,7 +1949,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
thread.setExceptionInfo(e.toString());
|
thread.setExceptionInfo(e.toString());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger1.error(e);
|
logger.error("Exception", e);
|
||||||
if (!(e instanceof RestServiceException)) {
|
if (!(e instanceof RestServiceException)) {
|
||||||
e = new RestServiceException(thread,
|
e = new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start, "编译配置数据插入失败",
|
System.currentTimeMillis() - start, "编译配置数据插入失败",
|
||||||
@@ -2363,7 +2362,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
thread.setExceptionInfo(e.toString());
|
thread.setExceptionInfo(e.toString());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger1.error(e);
|
logger.error("Exception" ,e);
|
||||||
if (!(e instanceof RestServiceException)) {
|
if (!(e instanceof RestServiceException)) {
|
||||||
e = new RestServiceException(thread,
|
e = new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start, "编译配置数据修改失败",
|
System.currentTimeMillis() - start, "编译配置数据修改失败",
|
||||||
@@ -2612,7 +2611,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
thread.setExceptionInfo(e.toString());
|
thread.setExceptionInfo(e.toString());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger1.error(e);
|
logger.error("Exception" ,e);
|
||||||
if (!(e instanceof RestServiceException)) {
|
if (!(e instanceof RestServiceException)) {
|
||||||
e = new RestServiceException(thread,
|
e = new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start, "编译配置数据修改失败",
|
System.currentTimeMillis() - start, "编译配置数据修改失败",
|
||||||
@@ -2702,7 +2701,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
thread.setExceptionInfo(e.toString());
|
thread.setExceptionInfo(e.toString());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger1.error(e);
|
logger.error("Exception" ,e);
|
||||||
if (!(e instanceof RestServiceException)) {
|
if (!(e instanceof RestServiceException)) {
|
||||||
e = new RestServiceException(thread,
|
e = new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start, "编译配置数据修改失败",
|
System.currentTimeMillis() - start, "编译配置数据修改失败",
|
||||||
@@ -2938,7 +2937,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
.getCommonSourceCfgByService(srcMap.get("service")
|
.getCommonSourceCfgByService(srcMap.get("service")
|
||||||
.toString().trim());
|
.toString().trim());
|
||||||
if (StringUtil.isEmpty(commonSourceFieldCfgList)) {
|
if (StringUtil.isEmpty(commonSourceFieldCfgList)) {
|
||||||
logger1.error(RestBusinessCode.ServiceIsWrong.getErrorReason()+",请检查service配置是否正确");
|
logger.error(RestBusinessCode.ServiceIsWrong.getErrorReason()+",请检查service配置是否正确");
|
||||||
thread.setExceptionInfo("请检查service配置是否正确");
|
thread.setExceptionInfo("请检查service配置是否正确");
|
||||||
throw new RestServiceException(thread,
|
throw new RestServiceException(thread,
|
||||||
System.currentTimeMillis() - start,
|
System.currentTimeMillis() - start,
|
||||||
@@ -2965,7 +2964,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
valFlag = valFlag & matcher.matches();
|
valFlag = valFlag & matcher.matches();
|
||||||
}
|
}
|
||||||
if (!valFlag) {
|
if (!valFlag) {
|
||||||
logger1.error(RestBusinessCode.IpTypeIsWrong
|
logger.error(RestBusinessCode.IpTypeIsWrong
|
||||||
.getErrorReason());
|
.getErrorReason());
|
||||||
thread.setExceptionInfo(RestBusinessCode.IpTypeIsWrong
|
thread.setExceptionInfo(RestBusinessCode.IpTypeIsWrong
|
||||||
.getErrorReason());
|
.getErrorReason());
|
||||||
@@ -2984,7 +2983,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
commonSourceFieldCfg.getSrcName()).toString().trim();
|
commonSourceFieldCfg.getSrcName()).toString().trim();
|
||||||
if (Integer.valueOf(dstVal).compareTo(ServiceAndRDBIndexReal.getActionByService(Integer.valueOf(srcMap.get("service")
|
if (Integer.valueOf(dstVal).compareTo(ServiceAndRDBIndexReal.getActionByService(Integer.valueOf(srcMap.get("service")
|
||||||
.toString().trim())))!=0) {
|
.toString().trim())))!=0) {
|
||||||
logger1.error(RestBusinessCode.ServiceUnmatchAction
|
logger.error(RestBusinessCode.ServiceUnmatchAction
|
||||||
.getErrorReason());
|
.getErrorReason());
|
||||||
thread.setExceptionInfo(RestBusinessCode.ServiceUnmatchAction
|
thread.setExceptionInfo(RestBusinessCode.ServiceUnmatchAction
|
||||||
.getErrorReason());
|
.getErrorReason());
|
||||||
@@ -3005,7 +3004,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
if (commonSourceFieldCfg.getIsRequired()
|
if (commonSourceFieldCfg.getIsRequired()
|
||||||
&& !srcMap.containsKey(commonSourceFieldCfg
|
&& !srcMap.containsKey(commonSourceFieldCfg
|
||||||
.getSrcName())) {
|
.getSrcName())) {
|
||||||
logger1.error(commonSourceFieldCfg.getSrcName()
|
logger.error(commonSourceFieldCfg.getSrcName()
|
||||||
+ "参数不能为空");
|
+ "参数不能为空");
|
||||||
thread.setExceptionInfo(commonSourceFieldCfg
|
thread.setExceptionInfo(commonSourceFieldCfg
|
||||||
.getSrcName() + "参数不能为空");
|
.getSrcName() + "参数不能为空");
|
||||||
@@ -3028,7 +3027,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
switch (commonSourceFieldCfg.getFieldType()) {
|
switch (commonSourceFieldCfg.getFieldType()) {
|
||||||
case "Number":
|
case "Number":
|
||||||
if (!StringUtil.isNumeric(dstStr)) {
|
if (!StringUtil.isNumeric(dstStr)) {
|
||||||
logger1.error(commonSourceFieldCfg.getSrcName()
|
logger.error(commonSourceFieldCfg.getSrcName()
|
||||||
+ "参数不能格式不正确,必需是数值型");
|
+ "参数不能格式不正确,必需是数值型");
|
||||||
thread.setExceptionInfo(commonSourceFieldCfg
|
thread.setExceptionInfo(commonSourceFieldCfg
|
||||||
.getSrcName() + "参数不能格式不正确,必需是数值型");
|
.getSrcName() + "参数不能格式不正确,必需是数值型");
|
||||||
@@ -3048,7 +3047,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
dstStr = date.getTime() + "000";
|
dstStr = date.getTime() + "000";
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
logger1.error(commonSourceFieldCfg.getSrcName()
|
logger.error(commonSourceFieldCfg.getSrcName()
|
||||||
+ "参数格式不正确,必须是日期型");
|
+ "参数格式不正确,必须是日期型");
|
||||||
thread.setExceptionInfo(commonSourceFieldCfg
|
thread.setExceptionInfo(commonSourceFieldCfg
|
||||||
.getSrcName() + "参数格式不正确,必须是日期型");
|
.getSrcName() + "参数格式不正确,必须是日期型");
|
||||||
@@ -3061,7 +3060,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
break;
|
break;
|
||||||
case "IP":
|
case "IP":
|
||||||
if (!BasicProvingUtil.isIpOrIpMask(dstStr, ipType)) {
|
if (!BasicProvingUtil.isIpOrIpMask(dstStr, ipType)) {
|
||||||
logger1.error(commonSourceFieldCfg.getSrcName()
|
logger.error(commonSourceFieldCfg.getSrcName()
|
||||||
+ "参数格式不正确或与" + ipTypeName + "不一致");
|
+ "参数格式不正确或与" + ipTypeName + "不一致");
|
||||||
thread.setExceptionInfo(commonSourceFieldCfg
|
thread.setExceptionInfo(commonSourceFieldCfg
|
||||||
.getSrcName()
|
.getSrcName()
|
||||||
@@ -3077,7 +3076,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
break;
|
break;
|
||||||
case "Port":
|
case "Port":
|
||||||
if (!BasicProvingUtil.isPortOrPortMask(dstStr)) {
|
if (!BasicProvingUtil.isPortOrPortMask(dstStr)) {
|
||||||
logger1.error(commonSourceFieldCfg.getSrcName()
|
logger.error(commonSourceFieldCfg.getSrcName()
|
||||||
+ "参数格式不正确,不是合法的Port");
|
+ "参数格式不正确,不是合法的Port");
|
||||||
thread.setExceptionInfo(commonSourceFieldCfg
|
thread.setExceptionInfo(commonSourceFieldCfg
|
||||||
.getSrcName() + "参数格式不正确,不是合法的Port");
|
.getSrcName() + "参数格式不正确,不是合法的Port");
|
||||||
@@ -3116,7 +3115,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flag) {
|
if (flag) {
|
||||||
logger1.error(commonSourceFieldCfg.getSrcName()
|
logger.error(commonSourceFieldCfg.getSrcName()
|
||||||
+ "参数不在有效范围("
|
+ "参数不在有效范围("
|
||||||
+ commonSourceFieldCfg.getRange() + ")");
|
+ commonSourceFieldCfg.getRange() + ")");
|
||||||
thread.setExceptionInfo(commonSourceFieldCfg
|
thread.setExceptionInfo(commonSourceFieldCfg
|
||||||
@@ -3143,7 +3142,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
if (valFlag) {
|
if (valFlag) {
|
||||||
dstMap.put(commonSourceFieldCfg.getDstName(), dstStr);
|
dstMap.put(commonSourceFieldCfg.getDstName(), dstStr);
|
||||||
} else {
|
} else {
|
||||||
logger1.error(commonSourceFieldCfg.getSrcName()
|
logger.error(commonSourceFieldCfg.getSrcName()
|
||||||
+ "参数格式与正则(" + commonSourceFieldCfg.getRegexp()
|
+ "参数格式与正则(" + commonSourceFieldCfg.getRegexp()
|
||||||
+ ")不匹配");
|
+ ")不匹配");
|
||||||
thread.setExceptionInfo(commonSourceFieldCfg
|
thread.setExceptionInfo(commonSourceFieldCfg
|
||||||
@@ -3178,7 +3177,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
RestBusinessCode.ServiceIsNull.getValue());
|
RestBusinessCode.ServiceIsNull.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger1.info("------------------调用非maat配置新增接口-------------------");
|
logger.info("------------------调用非maat配置新增接口-------------------");
|
||||||
// 按service分库
|
// 按service分库
|
||||||
Map<Integer, List<Map<String, String>>> configMap = new HashMap<Integer, List<Map<String, String>>>();
|
Map<Integer, List<Map<String, String>>> configMap = new HashMap<Integer, List<Map<String, String>>>();
|
||||||
Iterator serviceIterator = dstMaps.keySet().iterator();
|
Iterator serviceIterator = dstMaps.keySet().iterator();
|
||||||
@@ -3210,7 +3209,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
configRedisService.saveUnMaatConfig(configMap);
|
configRedisService.saveUnMaatConfig(configMap);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
logger1.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
CompileVal.setBusinessCode(RestBusinessCode.unknow_error.getValue());
|
CompileVal.setBusinessCode(RestBusinessCode.unknow_error.getValue());
|
||||||
if (e.getMessage().startsWith("后台错误:")) {
|
if (e.getMessage().startsWith("后台错误:")) {
|
||||||
CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue());
|
CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue());
|
||||||
@@ -3230,7 +3229,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
.getAsJsonArray();
|
.getAsJsonArray();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
logger1.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue());
|
CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue());
|
||||||
thread.setExceptionInfo(e.getMessage() + sb.toString());
|
thread.setExceptionInfo(e.getMessage() + sb.toString());
|
||||||
throw new RestServiceException(thread, System.currentTimeMillis()
|
throw new RestServiceException(thread, System.currentTimeMillis()
|
||||||
@@ -3291,7 +3290,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
configRedisService.delUnMaatConfig(restMap);
|
configRedisService.delUnMaatConfig(restMap);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
logger1.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
CompileVal.setBusinessCode(RestBusinessCode.unknow_error.getValue());
|
CompileVal.setBusinessCode(RestBusinessCode.unknow_error.getValue());
|
||||||
if (e.getMessage().startsWith("后台错误:")) {
|
if (e.getMessage().startsWith("后台错误:")) {
|
||||||
CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue());
|
CompileVal.setBusinessCode(RestBusinessCode.service_runtime_error.getValue());
|
||||||
|
|||||||
@@ -31,31 +31,9 @@
|
|||||||
<bean id="parentDataSource"
|
<bean id="parentDataSource"
|
||||||
class="org.springframework.jdbc.datasource.DriverManagerDataSource"></bean>
|
class="org.springframework.jdbc.datasource.DriverManagerDataSource"></bean>
|
||||||
|
|
||||||
<!-- 数据源定义,采用BoneCP连接池 ,用户管理数据源 -->
|
|
||||||
<bean id="DevlopDataSource" parent="parentDataSource"
|
|
||||||
class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close">
|
|
||||||
<property name="driverClass" value="${jdbc.devlop.driver}"></property>
|
|
||||||
<property name="jdbcUrl" value="${jdbc.devlop.url}"></property>
|
|
||||||
<property name="username" value="${jdbc.devlop.username}"></property>
|
|
||||||
<property name="password" value="${jdbc.devlop.password}"></property>
|
|
||||||
<!-- 检查数据库连接池中空闲连接的间隔时间,单位是分,默认值:240,如果要取消则设置为0 -->
|
|
||||||
<property name="idleConnectionTestPeriodInMinutes" value="${bonecp.idleConnectionTestPeriodInMinutes}"></property>
|
|
||||||
<!-- 连接池中未使用的链接最大存活时间,单位是分,默认值:60,如果要永远存活设置为0 -->
|
|
||||||
<property name="idleMaxAgeInMinutes" value="${bonecp.idleMaxAgeInMinutes}" />
|
|
||||||
<!-- 每个分区最大的连接数 -->
|
|
||||||
<property name="maxConnectionsPerPartition" value="${bonecp.maxConnectionsPerPartition}" />
|
|
||||||
<!-- 每个分区最小的连接数 -->
|
|
||||||
<property name="minConnectionsPerPartition" value="${bonecp.minConnectionsPerPartition}" />
|
|
||||||
<!-- 分区数 ,默认值2,最小1,推荐3-4,视应用而定 -->
|
|
||||||
<property name="partitionCount" value="${bonecp.partitionCount}" />
|
|
||||||
<!-- 每次去拿数据库连接的时候一次性要拿几个,默认值:2 -->
|
|
||||||
<property name="acquireIncrement" value="${bonecp.acquireIncrement}" />
|
|
||||||
<!-- 缓存prepared statements的大小,默认值:0 -->
|
|
||||||
<property name="statementsCacheSize" value="${bonecp.statementsCacheSize}" />
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!--数据源定义,采用BoneCP连接池 ,业务配置服务数据库 -->
|
<!--数据源定义,采用BoneCP连接池 ,业务配置服务数据库 -->
|
||||||
<bean id="LogDataSource" parent="parentDataSource"
|
<bean id="ProductDataSource" parent="parentDataSource"
|
||||||
class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close">
|
class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close">
|
||||||
<property name="driverClass" value="${jdbc.log.driver}"></property>
|
<property name="driverClass" value="${jdbc.log.driver}"></property>
|
||||||
<property name="jdbcUrl" value="${jdbc.log.url}"></property>
|
<property name="jdbcUrl" value="${jdbc.log.url}"></property>
|
||||||
@@ -106,11 +84,11 @@
|
|||||||
<bean id="dynamicDataSource" class="com.nis.datasource.DynamicDataSource">
|
<bean id="dynamicDataSource" class="com.nis.datasource.DynamicDataSource">
|
||||||
<property name="targetDataSources">
|
<property name="targetDataSources">
|
||||||
<map key-type="java.lang.String">
|
<map key-type="java.lang.String">
|
||||||
<entry value-ref="DevlopDataSource" key="dataSourceA"></entry>
|
<entry value-ref="ProductDataSource" key="dataSourceA"></entry>
|
||||||
<entry value-ref="LogDataSource" key="dataSourceB"></entry>
|
|
||||||
</map>
|
</map>
|
||||||
</property>
|
</property>
|
||||||
<property name="defaultTargetDataSource" ref="DevlopDataSource"></property>
|
<property name="defaultTargetDataSource" ref="ProductDataSource"></property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- mybatis 配置,扫描相关mapper文件 -->
|
<!-- mybatis 配置,扫描相关mapper文件 -->
|
||||||
|
|||||||
@@ -191,7 +191,7 @@
|
|||||||
<mvc:mapping path="/service/cfg/**" />
|
<mvc:mapping path="/service/cfg/**" />
|
||||||
<mvc:mapping path="/service/log/**" />
|
<mvc:mapping path="/service/log/**" />
|
||||||
<mvc:mapping path="/log/**"/>
|
<mvc:mapping path="/log/**"/>
|
||||||
<bean class="com.nis.interceptor.DataSourceBInterceptor"></bean>
|
<bean class="com.nis.interceptor.DataSourceAInterceptor"></bean>
|
||||||
</mvc:interceptor>
|
</mvc:interceptor>
|
||||||
|
|
||||||
</mvc:interceptors>
|
</mvc:interceptors>
|
||||||
|
|||||||
Reference in New Issue
Block a user