fix(配置文件)增加开发环境,清除中文空格问题
This commit is contained in:
@@ -29,6 +29,7 @@ import com.nis.restful.RestServiceException;
|
||||
import com.nis.restful.ServiceRuntimeException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.MinioUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseRestController;
|
||||
@@ -289,16 +290,20 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
throw new RestServiceException("checksum与文件MD5值不一致", RestBusinessCode.CheckSumIsWrong.getValue());
|
||||
}
|
||||
String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
|
||||
FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext);
|
||||
// NameValuePair[] meta_list = new NameValuePair[5];
|
||||
// meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename());
|
||||
// meta_list[1] = new NameValuePair("fileLength",
|
||||
// String.valueOf(file.getSize()));
|
||||
// meta_list[2] = new NameValuePair("fileExt", ext);
|
||||
// meta_list[3] = new NameValuePair("fileAuthor", "rkg");
|
||||
// meta_list[4] = new NameValuePair("fileMd5", md5);
|
||||
logger.info("-----------------调用接口上传文件---------------");
|
||||
filePath = FileManager.upload(fdsfile, null);
|
||||
if(Constants.IS_USE_MINIO){
|
||||
filePath = MinioUtil.uploadFile(file.getInputStream(), file.getOriginalFilename(), ext);
|
||||
}else{
|
||||
FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext);
|
||||
// NameValuePair[] meta_list = new NameValuePair[5];
|
||||
// meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename());
|
||||
// meta_list[1] = new NameValuePair("fileLength",
|
||||
// String.valueOf(file.getSize()));
|
||||
// meta_list[2] = new NameValuePair("fileExt", ext);
|
||||
// meta_list[3] = new NameValuePair("fileAuthor", "rkg");
|
||||
// meta_list[4] = new NameValuePair("fileMd5", md5);
|
||||
filePath = FileManager.upload(fdsfile, null);
|
||||
}
|
||||
}
|
||||
}catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
@@ -337,6 +342,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
|
||||
file, null);
|
||||
JSONObject resultObject = new JSONObject();
|
||||
String filePath="";
|
||||
try {
|
||||
if (file == null) {
|
||||
throw new RestServiceException("请上传获取摘要的文件到file参数", RestBusinessCode.FileIsNull.getValue());
|
||||
@@ -353,9 +359,20 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
RestBusinessCode.CheckSumIsWrong.getValue());
|
||||
}
|
||||
String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
|
||||
FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext);
|
||||
logger.info("-----------------调用接口上传文件---------------");
|
||||
String filePath = FileManager.upload(fdsfile, null);
|
||||
if(Constants.IS_USE_MINIO){
|
||||
filePath = MinioUtil.uploadFile(file.getInputStream(), file.getOriginalFilename(), ext);
|
||||
}else{
|
||||
FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext);
|
||||
// NameValuePair[] meta_list = new NameValuePair[5];
|
||||
// meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename());
|
||||
// meta_list[1] = new NameValuePair("fileLength",
|
||||
// String.valueOf(file.getSize()));
|
||||
// meta_list[2] = new NameValuePair("fileExt", ext);
|
||||
// meta_list[3] = new NameValuePair("fileAuthor", "rkg");
|
||||
// meta_list[4] = new NameValuePair("fileMd5", md5);
|
||||
filePath = FileManager.upload(fdsfile, null);
|
||||
}
|
||||
resultObject.put("accessUrl", filePath);
|
||||
}
|
||||
}catch (IOException e) {
|
||||
|
||||
@@ -11,7 +11,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.nis.domain.restful.TrafficNmsServerStatistic;
|
||||
import com.nis.domain.restful.NmsDiRuleList;
|
||||
import com.nis.domain.restful.TrafficNetflowPortInfoList;
|
||||
import com.nis.domain.restful.TrafficNmsServerStatisticList;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
@@ -19,6 +20,8 @@ import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseRestController;
|
||||
import com.nis.web.service.AuditLogThread;
|
||||
import com.nis.web.service.ServicesRequestLogService;
|
||||
import com.nis.web.service.restful.NmsDiRuleService;
|
||||
import com.nis.web.service.restful.TrafficNetflowPortInfoService;
|
||||
import com.nis.web.service.restful.TrafficNmsServerStatisticService;
|
||||
import com.wordnik.swagger.annotations.Api;
|
||||
import com.wordnik.swagger.annotations.ApiOperation;
|
||||
@@ -32,6 +35,10 @@ public class NmsInfoController extends BaseRestController {
|
||||
protected ServicesRequestLogService servicesRequestLogService;
|
||||
@Autowired
|
||||
TrafficNmsServerStatisticService trafficNmsServerStatisticService;
|
||||
@Autowired
|
||||
NmsDiRuleService nmsDiRuleService;
|
||||
@Autowired
|
||||
TrafficNetflowPortInfoService trafficNetflowPortInfoService;
|
||||
|
||||
@RequestMapping(value = "/nms/v1/saveServerStatus", method = RequestMethod.POST)
|
||||
@ApiOperation(value = "存储NMS系统上报的服务器状态接口", httpMethod = "POST", response = Map.class, notes = "接收NMS系统上报的服务器状态信息")
|
||||
@@ -60,4 +67,55 @@ public class NmsInfoController extends BaseRestController {
|
||||
Constants.IS_DEBUG ? trafficNmsServerStatisticList : null);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/nms/v1/saveNmsDiRule", method = RequestMethod.POST)
|
||||
@ApiOperation(value = "存储NmsDiRule接口", httpMethod = "POST", response = Map.class, notes = "接收NMS系统上报的di信息")
|
||||
@ApiParam(value = "存储NmsDiRule接口", name = "saveServerStatus", required = true)
|
||||
public Map<String, Object> saveNmsDiRule(@RequestBody NmsDiRuleList nmsDiRuleList, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
long start = System.currentTimeMillis();
|
||||
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
|
||||
nmsDiRuleList);
|
||||
try {
|
||||
if (nmsDiRuleList != null && nmsDiRuleList.getNmsDiRuleList() != null
|
||||
&& nmsDiRuleList.getNmsDiRuleList().size() > 0) {
|
||||
nmsDiRuleService.saveNmsDiRuleInfo(nmsDiRuleList.getNmsDiRuleList());
|
||||
} else {
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "参数nmsDiRuleList不能为空",
|
||||
RestBusinessCode.missing_args.getValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||
"上报NmsDiRule信息异常:" + e.getMessage(), RestBusinessCode.unknow_error.getValue());
|
||||
}
|
||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "上报NmsDiRule信息成功",
|
||||
Constants.IS_DEBUG ? nmsDiRuleList : null);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/nms/v1/rafficNetflowPortInfo", method = RequestMethod.POST)
|
||||
@ApiOperation(value = "存储trafficNetflowPortInfo接口", httpMethod = "POST", response = Map.class, notes = "接收NMS系统上报的trafficNetflowPort信息")
|
||||
@ApiParam(value = "存储trafficNetflowPortInfo接口", name = "saveTrafficNetflowPortInfo", required = true)
|
||||
public Map<String, Object> saveTrafficNetflowPortInfo(
|
||||
@RequestBody TrafficNetflowPortInfoList trafficNetflowPortInfoList, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
long start = System.currentTimeMillis();
|
||||
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
|
||||
trafficNetflowPortInfoList);
|
||||
try {
|
||||
if (trafficNetflowPortInfoList != null && trafficNetflowPortInfoList.getTrafficNetflowPortInfoList() != null
|
||||
&& trafficNetflowPortInfoList.getTrafficNetflowPortInfoList().size() > 0) {
|
||||
trafficNetflowPortInfoService
|
||||
.saveTrafficNetflowPortInfo(trafficNetflowPortInfoList.getTrafficNetflowPortInfoList());
|
||||
} else {
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||
"参数trafficNetflowPortInfoList不能为空", RestBusinessCode.missing_args.getValue());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||
"上报trafficNetflowPort信息异常:" + e.getMessage(), RestBusinessCode.unknow_error.getValue());
|
||||
}
|
||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response,
|
||||
"上报trafficNetflowPort信息成功", Constants.IS_DEBUG ? trafficNetflowPortInfoList : null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user