1:为实时统计配置中jediscluster改为每次使用都获取一个新的
2:添加根据配置id获取编译,组,域等信息的接口 3:修改获取或释放redis分布式锁后,将redis连接释放 4:解决冲突
This commit is contained in:
@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -30,6 +31,7 @@ import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
import com.nis.restful.ServiceRuntimeException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.ExceptionUtil;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.MinioUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
@@ -81,9 +83,10 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
if (getLock(requestId)) {
|
||||
if (null != configSource && null != configSource.getConfigCompileList()
|
||||
&& configSource.getConfigCompileList().size() > 0) {
|
||||
if (configSource.getConfigCompileList()!=null&&configSource.getConfigCompileList().size()>Constants.MAX_LIST_SIZE) {
|
||||
thread.setContent("批量提交数量超过"+Constants.MAX_LIST_SIZE+"条,不记录请求内容");
|
||||
}
|
||||
if (configSource.getConfigCompileList() != null
|
||||
&& configSource.getConfigCompileList().size() > Constants.MAX_LIST_SIZE) {
|
||||
thread.setContent("批量提交数量超过" + Constants.MAX_LIST_SIZE + "条,不记录请求内容");
|
||||
}
|
||||
checkOpAction(thread, System.currentTimeMillis() - start, configSource.getOpAction(),
|
||||
Constants.OPACTION_POST);
|
||||
// 验证配置编译数据
|
||||
@@ -134,8 +137,9 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
if (null != configSource && null != configSource.getConfigCompileList()
|
||||
&& configSource.getConfigCompileList().size() > 0) {
|
||||
int opAction = configSource.getOpAction();
|
||||
if (configSource.getConfigCompileList()!=null&&configSource.getConfigCompileList().size()>Constants.MAX_LIST_SIZE) {
|
||||
thread.setContent("批量提交数量超过"+Constants.MAX_LIST_SIZE+"条,不记录请求内容");
|
||||
if (configSource.getConfigCompileList() != null
|
||||
&& configSource.getConfigCompileList().size() > Constants.MAX_LIST_SIZE) {
|
||||
thread.setContent("批量提交数量超过" + Constants.MAX_LIST_SIZE + "条,不记录请求内容");
|
||||
}
|
||||
checkOpAction(thread, System.currentTimeMillis() - start, opAction, 2);
|
||||
configSourcesService.updateConfigSources(thread, start, configSource.getConfigCompileList(),
|
||||
@@ -551,6 +555,28 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
"MAAT规则分组复用域配置删除成功" + sb.toString(), Constants.IS_DEBUG ? groupReuseSource : null);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/cfg/v1/getAllKVByCompileId", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "根据配置id获取对应的编译,组,域等信息", httpMethod = "GET", response = Map.class, notes = "根据配置id获取对应的编译,组,域等信息")
|
||||
@ApiParam(value = "配置id", name = "getAllKVByCompileId", required = true)
|
||||
public Map getAllKVByCompileId(@RequestParam Long compileId, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
long start = System.currentTimeMillis();
|
||||
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
|
||||
compileId);
|
||||
Map map=null;
|
||||
try {
|
||||
map=configRedisService.getAllKVByCompileId(compileId);
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo("根据配置id获取对应的编译,组,域等信息时出现异常:" + e.getMessage());
|
||||
logger.error("根据配置id获取对应的编译,组,域等信息时出现异常:" +ExceptionUtil.getExceptionMsg(e));
|
||||
throw new RestServiceException("根据配置id获取对应的编译,组,域等信息失败",
|
||||
RestBusinessCode.ConfigSourceIsNull.getValue());
|
||||
|
||||
}
|
||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response,
|
||||
"根据配置id获取对应的编译,组,域等信息成功", map);
|
||||
}
|
||||
|
||||
private void validateGroupReuseSource(AuditLogThread thread, long start, GroupReuseSource groupReuseSource) {
|
||||
String errorInfo = "";
|
||||
|
||||
|
||||
@@ -166,12 +166,12 @@ public class DashboardServiceController extends BaseRestController {
|
||||
*/
|
||||
@RequestMapping(value="trafficProtocolList", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "协议统计占比与报表", httpMethod = "GET", notes = "对应协议统计详情占比与报表")
|
||||
public Map<String,?> trafficProtocolList(Model model, HttpServletRequest request, HttpServletResponse response){
|
||||
public Map<String,?> trafficProtocolList(String searchFoundStartTime,String searchFoundEndTime,Model model, HttpServletRequest request, HttpServletResponse response){
|
||||
long start = System.currentTimeMillis();
|
||||
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
|
||||
List<HashMap> list = new ArrayList<HashMap>();
|
||||
try {
|
||||
List<Map> ipActiveList = dashboardService.getProtocolList();
|
||||
List<Map> ipActiveList = dashboardService.getProtocolList(searchFoundStartTime,searchFoundEndTime);
|
||||
if (ipActiveList!=null&&ipActiveList.size() > 0) {
|
||||
String jsonString = JsonMapper.toJsonString(ipActiveList);
|
||||
list = (java.util.List<HashMap>) JsonMapper.fromJsonList(jsonString,HashMap.class);
|
||||
@@ -289,12 +289,12 @@ public class DashboardServiceController extends BaseRestController {
|
||||
*/
|
||||
@RequestMapping(value="trafficAppList", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "App统计占比与报表", httpMethod = "GET", notes = "对应App统计详情占比与报表")
|
||||
public Map<String,?> trafficAppList(Model model, HttpServletRequest request, HttpServletResponse response){
|
||||
public Map<String,?> trafficAppList(String searchFoundStartTime,String searchFoundEndTime,Model model, HttpServletRequest request, HttpServletResponse response){
|
||||
long start = System.currentTimeMillis();
|
||||
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
|
||||
List<HashMap> list = new ArrayList<HashMap>();
|
||||
try {
|
||||
List<Map> appList = dashboardService.getAppList();
|
||||
List<Map> appList = dashboardService.getAppList(searchFoundStartTime,searchFoundEndTime);
|
||||
if (appList!=null&&appList.size() > 0) {
|
||||
String jsonString = JsonMapper.toJsonString(appList);
|
||||
list = (java.util.List<HashMap>) JsonMapper.fromJsonList(jsonString,HashMap.class);
|
||||
|
||||
@@ -55,6 +55,7 @@ public class NmsInfoController extends BaseRestController {
|
||||
|
||||
if (trafficNmsServerStatisticList != null && trafficNmsServerStatisticList.getTrafficNmsServerList() != null
|
||||
&& trafficNmsServerStatisticList.getTrafficNmsServerList().size() > 0) {
|
||||
thread.setContent("NMS系统上报服务器数量为"+trafficNmsServerStatisticList.getTrafficNmsServerList().size());
|
||||
trafficNmsServerStatisticService.saveNmsInfo(trafficNmsServerStatisticList.getTrafficNmsServerList());
|
||||
} else {
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "参数trafficNmsServerList不能为空",
|
||||
@@ -71,7 +72,8 @@ public class NmsInfoController extends BaseRestController {
|
||||
}
|
||||
|
||||
}
|
||||
return testServiceResponse(System.currentTimeMillis() - start, request, response, "上报服务器状态信息成功",
|
||||
|
||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "上报服务器状态信息成功",
|
||||
Constants.IS_DEBUG ? trafficNmsServerStatisticList : null);
|
||||
}
|
||||
|
||||
@@ -86,6 +88,7 @@ public class NmsInfoController extends BaseRestController {
|
||||
try {
|
||||
if (nmsDiRuleList != null && nmsDiRuleList.getNmsDiRuleList() != null
|
||||
&& nmsDiRuleList.getNmsDiRuleList().size() > 0) {
|
||||
thread.setContent("NMS系统上报的di信息数量为"+nmsDiRuleList.getNmsDiRuleList().size());
|
||||
nmsDiRuleService.saveNmsDiRuleInfo(nmsDiRuleList.getNmsDiRuleList());
|
||||
} else {
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "参数nmsDiRuleList不能为空",
|
||||
@@ -100,7 +103,7 @@ public class NmsInfoController extends BaseRestController {
|
||||
"上报NmsDiRule信息异常:" + e.getMessage(), RestBusinessCode.unknow_error.getValue());
|
||||
}
|
||||
}
|
||||
return testServiceResponse(System.currentTimeMillis() - start, request, response, "上报NmsDiRule信息成功",
|
||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "上报NmsDiRule信息成功",
|
||||
Constants.IS_DEBUG ? nmsDiRuleList : null);
|
||||
}
|
||||
|
||||
@@ -116,6 +119,7 @@ public class NmsInfoController extends BaseRestController {
|
||||
try {
|
||||
if (trafficNetflowPortInfoList != null && trafficNetflowPortInfoList.getTrafficNetflowPortInfoList() != null
|
||||
&& trafficNetflowPortInfoList.getTrafficNetflowPortInfoList().size() > 0) {
|
||||
thread.setContent("NMS系统上报上报trafficNetflowPort信息数量为"+trafficNetflowPortInfoList.getTrafficNetflowPortInfoList().size());
|
||||
trafficNetflowPortInfoService
|
||||
.saveTrafficNetflowPortInfo(trafficNetflowPortInfoList.getTrafficNetflowPortInfoList());
|
||||
} else {
|
||||
@@ -131,7 +135,7 @@ public class NmsInfoController extends BaseRestController {
|
||||
"上报trafficNetflowPort信息异常:" + e.getMessage(), RestBusinessCode.unknow_error.getValue());
|
||||
}
|
||||
}
|
||||
return testServiceResponse(System.currentTimeMillis() - start, request, response,
|
||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response,
|
||||
"上报trafficNetflowPort信息成功", Constants.IS_DEBUG ? trafficNetflowPortInfoList : null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user