refactor(webapp): 优化代码格式和日志输出
-调整代码缩进和空格,提高可读性 - 优化日志输出,移除冗余信息 - 统一异常处理方式
This commit is contained in:
parent
c1786b7cb8
commit
14a21b3168
|
@ -70,7 +70,7 @@ public class EntranceServiceImpl implements IEntranceService {
|
|||
String body = ServletUtil.getBody(servletRequest);
|
||||
//获取类
|
||||
Object object = null;
|
||||
if(service == null || "".equals(service) || serviceMethod == null || "".equals(serviceMethod)){
|
||||
if (service == null || "".equals(service) || serviceMethod == null || "".equals(serviceMethod)) {
|
||||
return BaseResult.getFailureMessageEntity("非法请求,请检查");
|
||||
}
|
||||
try {
|
||||
|
@ -81,7 +81,7 @@ public class EntranceServiceImpl implements IEntranceService {
|
|||
//获取类下面的方法
|
||||
Method[] methods = object.getClass().getMethods();
|
||||
if (methods == null || methods.length == 0) {
|
||||
logger.error("当前service:" + service + "serviceMethod = " + serviceMethod+"未找到");
|
||||
logger.error("当前service:" + service + "serviceMethod = " + serviceMethod + "未找到");
|
||||
return BaseResult.getFailureMessageEntity(service + "未找到" + serviceMethod + "方法");
|
||||
}
|
||||
for (Method m : methods) {
|
||||
|
@ -89,7 +89,7 @@ public class EntranceServiceImpl implements IEntranceService {
|
|||
if (m.getName().equals(serviceMethod.trim())) {
|
||||
if (m.getName().startsWith("thirdInterface")) {//TODO 后续可能要加强校验规则
|
||||
logger.info("第三方接口,不校验是否登陆");
|
||||
}else if (!"doLogin".equals(m.getName())) {
|
||||
} else if (!"doLogin".equals(m.getName())) {
|
||||
try {
|
||||
StpUtil.checkLogin();
|
||||
//校验当前登陆人是否有权限
|
||||
|
@ -138,7 +138,8 @@ public class EntranceServiceImpl implements IEntranceService {
|
|||
}
|
||||
JsonResultEntity jsonResultEntity;
|
||||
try {
|
||||
logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>请求的参数:jsonObject:" + jsonObject.toJSONString());
|
||||
// logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>请求的参数:jsonObject:" + jsonObject.toJSONString());
|
||||
logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
jsonResultEntity = (JsonResultEntity) m.invoke(object, jsonObject);
|
||||
logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
return jsonResultEntity;
|
||||
|
@ -227,26 +228,27 @@ public class EntranceServiceImpl implements IEntranceService {
|
|||
@Override
|
||||
public JsonResultEntity fileUpload(MultipartFile file, FileUploadDto entity, ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
||||
StpUtil.checkLogin();
|
||||
FileUploadEntity fileUploadEntity = fileUploadService.fileUpload(file,entity);
|
||||
return BaseResult.getSuccessMessageEntity("附件上传成功",fileUploadEntity);
|
||||
FileUploadEntity fileUploadEntity = fileUploadService.fileUpload(file, entity);
|
||||
return BaseResult.getSuccessMessageEntity("附件上传成功", fileUploadEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonResultEntity pluginfileUpload(MultipartFile file, FileUploadDto entity,String pluginPackageName, ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
||||
public JsonResultEntity pluginfileUpload(MultipartFile file, FileUploadDto entity, String pluginPackageName, ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
||||
StpUtil.checkLogin();
|
||||
FileUploadEntity fileUploadEntity = fileUploadService.pluginfileUpload(file,entity,pluginPackageName);
|
||||
return BaseResult.getSuccessMessageEntity("附件上传成功",fileUploadEntity);
|
||||
FileUploadEntity fileUploadEntity = fileUploadService.pluginfileUpload(file, entity, pluginPackageName);
|
||||
return BaseResult.getSuccessMessageEntity("附件上传成功", fileUploadEntity);
|
||||
}
|
||||
|
||||
public JsonResultEntity pluginZipUpate(FileUploadDto fileUploadDto) throws Exception{
|
||||
public JsonResultEntity pluginZipUpate(FileUploadDto fileUploadDto) throws Exception {
|
||||
StpUtil.checkLogin();
|
||||
FileDownloadEntity fileDownloadEntity = fileDownloadService.pluginZipUpate(fileUploadDto);
|
||||
return BaseResult.getSuccessMessageEntity("插件更新成功",fileDownloadEntity);
|
||||
return BaseResult.getSuccessMessageEntity("插件更新成功", fileDownloadEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonResultEntity fileUpload(MultipartFile file, FileResultEntity entity, ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
||||
entity = fileUploadService.fileUpload(file,entity);
|
||||
return BaseResult.getSuccessMessageEntity("附件上传成功",entity);
|
||||
entity = fileUploadService.fileUpload(file, entity);
|
||||
return BaseResult.getSuccessMessageEntity("附件上传成功", entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -259,7 +261,7 @@ public class EntranceServiceImpl implements IEntranceService {
|
|||
String body = ServletUtil.getBody(servletRequest);
|
||||
//获取类
|
||||
Object object = null;
|
||||
if(service == null || "".equals(service) || serviceMethod == null || "".equals(serviceMethod)){
|
||||
if (service == null || "".equals(service) || serviceMethod == null || "".equals(serviceMethod)) {
|
||||
return BaseResult.getFailureMessageEntity("非法请求,请检查");
|
||||
}
|
||||
try {
|
||||
|
@ -288,7 +290,7 @@ public class EntranceServiceImpl implements IEntranceService {
|
|||
try {
|
||||
logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info("请求的参数:jsonObject:" + jsonObject.toJSONString());
|
||||
Object result = m.invoke(object, jsonObject);
|
||||
Object result = m.invoke(object, jsonObject);
|
||||
logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
|
@ -308,7 +310,7 @@ public class EntranceServiceImpl implements IEntranceService {
|
|||
}
|
||||
}
|
||||
}
|
||||
throw new BaseSystemException( service + "未找到" + serviceMethod + "方法") ;
|
||||
throw new BaseSystemException(service + "未找到" + serviceMethod + "方法");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue