1:删除一下业务0x421,0x422
action:1057:64;1058:64; #0x421 IP限流 20180824虎哥群里面发的需要删除这个业务 1057=10:LIMIT_COMPILE;11:LIMIT_GROUP;12:LIMIT_IP;14:APP_SUBSCRIBE_ID;18:NTC_IP_RANGE #0x422 域名限流20180824虎哥群里面发的需要删除这个业务 1058=10:LIMIT_COMPILE;11:LIMIT_GROUP;14:LIMIT_DOMAIN,APP_SUBSCRIBE_ID;18:NTC_IP_RANGE 1057:ipRegion@ACTION&SERVICE&USER_REGION;1058:strRegion@ACTION&SERVICE&USER_REGION; 2:扩展编译,分组,域等对应关系,以支持分组复用业务的下发和取消 3:修改#0x208(520)表PXY_OBJ_KEYRING中crl字段为字符串类型
This commit is contained in:
@@ -2,7 +2,6 @@ package com.nis.web.controller.restful;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -10,7 +9,8 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.nis.web.service.AuditLogThread;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -22,16 +22,17 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import com.nis.domain.restful.ConfigCompile;
|
||||
import com.nis.domain.restful.ConfigSource;
|
||||
import com.nis.domain.restful.FileDesc;
|
||||
import com.nis.domain.restful.GroupReuse;
|
||||
import com.nis.domain.restful.GroupReuseSource;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
import com.nis.restful.ServiceRuntimeException;
|
||||
import com.nis.util.CompileVal;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.OracleErrorCodeUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseRestController;
|
||||
import com.nis.web.service.AuditLogThread;
|
||||
import com.nis.web.service.ServicesRequestLogService;
|
||||
import com.nis.web.service.fdfs.FastDFSFile;
|
||||
import com.nis.web.service.fdfs.FileManager;
|
||||
@@ -41,8 +42,6 @@ import com.wordnik.swagger.annotations.Api;
|
||||
import com.wordnik.swagger.annotations.ApiOperation;
|
||||
import com.wordnik.swagger.annotations.ApiParam;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* @ClassName: ConfigSourcesController
|
||||
* @Description: 配置存储服务
|
||||
@@ -177,7 +176,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/cfg/v1/commonSources", method = RequestMethod.POST, produces = org.springframework.http.MediaType.APPLICATION_JSON_VALUE)
|
||||
@ApiOperation(value = "回调(通用)规则存储接口", httpMethod = "POST", response = Map.class, notes = "接收回调规则数据,格式为结构化行列式JSON,存储到流量处理平台配置线中")
|
||||
public Map createCommonConfigSource(@RequestBody String jsonString, HttpServletRequest request,
|
||||
@@ -208,7 +207,6 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
Constants.IS_DEBUG ? jsonString : null);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/cfg/v1/commonSources", method = RequestMethod.PUT)
|
||||
@ApiOperation(value = "回调(通用)规则状态更新接口", httpMethod = "PUT", response = Map.class, notes = "接收回调规则,对其状态置为失效")
|
||||
public Map updateCommonConfigSource(@RequestBody String jsonString, HttpServletRequest request,
|
||||
@@ -376,6 +374,119 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "摘要获取成功", resultObject);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/cfg/v1/groupReuseSources", method = RequestMethod.POST)
|
||||
@ApiOperation(value = "分组复用域配置新增接口", httpMethod = "POST", response = Map.class, notes = "接收分组复用域配置,增加到对应的分组中")
|
||||
@ApiParam(value = "分组复用域配置对象", name = "configSource", required = true)
|
||||
public Map addGroupReuseSources(@RequestBody GroupReuseSource groupReuseSource, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
|
||||
groupReuseSource);
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
try {
|
||||
if (null != groupReuseSource && null != groupReuseSource.getGroupReuseList()
|
||||
&& groupReuseSource.getGroupReuseList().size() > 0) {
|
||||
checkOpAction(thread, System.currentTimeMillis() - start, groupReuseSource.getOpAction(), Constants.OPACTION_POST);
|
||||
// 验证配置编译数据
|
||||
validateGroupReuseSource(thread, start, groupReuseSource);
|
||||
configSourcesService.addGroupReuseSources(thread, start, groupReuseSource.getGroupReuseList(), sb);
|
||||
} else {
|
||||
throw new RestServiceException("Maat规则不能为空",
|
||||
RestBusinessCode.ConfigSourceIsNull.getValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
thread.setExceptionInfo("Maat 分组复用规则存储异常:" + e.getMessage());
|
||||
logger.error("Maat 分组复用规则存储异常:" + e.getMessage());
|
||||
if (e instanceof RestServiceException) {
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||
"Maat 分组复用规则存储异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode());
|
||||
}else if(e instanceof ServiceRuntimeException) {
|
||||
throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start,
|
||||
"Maat 分组复用规则存储异常:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode());
|
||||
}else{
|
||||
throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start,
|
||||
"Maat 分组复用规则存储异常:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response,
|
||||
"Maat分组复用规则添加成功" + sb.toString(), Constants.IS_DEBUG ? groupReuseSource : null);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/cfg/v1/groupReuseSources", method = RequestMethod.PUT)
|
||||
@ApiOperation(value = "分组复用域配置删除接口", httpMethod = "PUT", response = Map.class, notes = "接收分组复用域配置,并从对应分组中删除")
|
||||
@ApiParam(value = "分组复用域配置对象", name = "configSource", required = true)
|
||||
public Map delGroupReuseSources(@RequestBody GroupReuseSource groupReuseSource, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
long start = System.currentTimeMillis();
|
||||
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request,
|
||||
groupReuseSource);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
try {
|
||||
if (null == groupReuseSource.getOpTime()) {
|
||||
groupReuseSource.setOpTime(new Date());
|
||||
}
|
||||
if (null != groupReuseSource && null != groupReuseSource.getGroupReuseList()
|
||||
&& groupReuseSource.getGroupReuseList().size() > 0) {
|
||||
int opAction = groupReuseSource.getOpAction();
|
||||
checkOpAction(thread, System.currentTimeMillis() - start, opAction, 2);
|
||||
configSourcesService.deleteGroupReuseSources(thread, start,groupReuseSource.getGroupReuseList(),
|
||||
groupReuseSource.getOpTime(), sb);
|
||||
|
||||
} else {
|
||||
throw new RestServiceException("分组复用信息不能为空" + sb.toString(),
|
||||
RestBusinessCode.ConfigSourceIsNull.getValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
thread.setExceptionInfo("MAAT规则状态更新时出现异常:" + e.getMessage());
|
||||
logger.error("删除MAAT规则分组复用域配置时出现异常:" + e.getMessage());
|
||||
if (e instanceof RestServiceException) {
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||
"删除MAAT规则分组复用域配置时出现异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode());
|
||||
}else if(e instanceof ServiceRuntimeException) {
|
||||
throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start,
|
||||
"删除MAAT规则分组复用域配置时出现异常:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode());
|
||||
}else{
|
||||
throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start,
|
||||
"删除MAAT规则分组复用域配置时出现异常:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response,
|
||||
"MAAT规则分组复用域配置删除成功" + sb.toString(), Constants.IS_DEBUG ?groupReuseSource : null);
|
||||
}
|
||||
|
||||
private void validateGroupReuseSource(AuditLogThread thread, long start, GroupReuseSource groupReuseSource) {
|
||||
String errorInfo = "";
|
||||
|
||||
List<GroupReuse> groupReuseSourceList = groupReuseSource.getGroupReuseList();
|
||||
|
||||
if (StringUtils.isEmpty(groupReuseSource.getOperator())) {
|
||||
errorInfo = "get operator is Empty";
|
||||
}
|
||||
if (StringUtils.isEmpty(groupReuseSource.getVersion())) {
|
||||
errorInfo = "get version is Empty";
|
||||
}
|
||||
|
||||
if (!isBlank(groupReuseSource.getOpTime())) {
|
||||
errorInfo = "get OpTime is Empty";
|
||||
}
|
||||
|
||||
if (groupReuseSourceList.size() <= 0) {
|
||||
errorInfo = "分组复用的域配置列表不能为空";
|
||||
}
|
||||
if (!errorInfo.equals("")) {
|
||||
thread.setExceptionInfo(errorInfo);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, errorInfo,
|
||||
RestBusinessCode.missing_args.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
private boolean isBlank(Date datetime) {
|
||||
if (null != datetime) {
|
||||
return true;
|
||||
|
||||
@@ -188,7 +188,9 @@ public class MaatTestController {
|
||||
maatTestServiceimpl.getMaatKeys(configCompileList);
|
||||
map.put(service, "http://127.0.0.1:8080/galaxy/service/test/cfg/v1/testDelMaat?serviceType="
|
||||
+ service + "&configId=" + compileIdList.toString().replace("[", "").replace("]", ""));
|
||||
testDelMaat(compileIdList.toString().replace("[", "").replace("]", ""), service);
|
||||
if(!testDelMaat(compileIdList.toString().replace("[", "").replace("]", ""), service).equals("ok")) {
|
||||
map.put(-4, "del config error");
|
||||
}
|
||||
} else {
|
||||
|
||||
map.put(-2, "is not maat service");
|
||||
@@ -592,7 +594,9 @@ public class MaatTestController {
|
||||
// 验证数据是否在正确
|
||||
maatTestServiceimpl.getUnMaatKeys(jsonStr, service);
|
||||
// 删除配置
|
||||
testDelUnMaat(compileIdList.toString().replace("[", "").replace("]", ""), service);
|
||||
if(!testDelUnMaat(compileIdList.toString().replace("[", "").replace("]", ""), service).equals("ok")){
|
||||
map.put(-4, "del unmaat error");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String exceptionMsg = ExceptionUtil.getExceptionMsg(e);
|
||||
|
||||
Reference in New Issue
Block a user