1、删除无用类和方法;

2、修改异常处理方式,一直往上抛在controller里记录日志并返回给客户端;
3、回调类配置新增时isValid只能为1
This commit is contained in:
zhangdongxu
2018-08-10 15:14:12 +08:00
parent 329b79607e
commit eb49689c55
83 changed files with 627 additions and 14591 deletions

View File

@@ -17,11 +17,8 @@ import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import com.nis.domain.DfJitLogEntity;
import com.nis.domain.DfReportEntity;
import com.nis.domain.LogEntity;
import com.nis.domain.Page;
import com.nis.domain.StatLogEntity;
import com.nis.domain.restful.NtcReportEntity;
import com.nis.restful.RestBusinessCode;
import com.nis.restful.RestServiceException;
@@ -342,259 +339,7 @@ public abstract class BaseLogService {
}
}
}
/**
* wx 报表查询条件检查
*
* @param clazz
* 需要检验的实体名称[需要保证resultMap的id命名方式为[className]Map]
* @param page
* 需要校验的page对象
*/
public void queryConditionCheck(AuditLogThread thread, long start, StatLogEntity entity, Class clazz,
Page page) {
try {
if (!StringUtil.isBlank(entity.getSearchStatStartTime())) {
sdf.parse(entity.getSearchStatStartTime());
}
} catch (ParseException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchStatStartTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchStatStartTime参数格式错误");
}
try {
if (!StringUtil.isBlank(entity.getSearchStatEndTime())) {
sdf.parse(entity.getSearchStatEndTime());
}
} catch (ParseException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchStatEndTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchStatEndTime参数错误");
}
try {
if (!StringUtil.isBlank(entity.getSearchService())) {
Integer.parseInt(entity.getSearchService());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchService参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchService参数错误");
}
try {
checkCloumnIsExist(thread, start, clazz, page);
} catch (RestServiceException e) {
logger.error(e);
throw e;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请求参数错误");
}
}
/**
* 管控实时统计公共查询字段验证
*
* @param entity
*/
public void queryConditionCheck(AuditLogThread thread, long start, DfJitLogEntity<?> entity, Class clazz,
Page page) {
try {
if (!StringUtil.isBlank(entity.getSearchReportEndTime())) {
sdf.parse(entity.getSearchReportEndTime());
}
} catch (ParseException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportEndTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportEndTime参数格式格式");
}
try {
if (!StringUtil.isBlank(entity.getSearchReportStartTime())) {
sdf.parse(entity.getSearchReportStartTime());
}
} catch (ParseException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportStartTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportStartTime参数错误");
}
try {
if (!StringUtil.isBlank(entity.getSearchService())) {
Integer.parseInt(entity.getSearchService());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchService参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchService参数错误");
}
try {
String searchAttrType = getSearchField(clazz, entity, "searchAttrType");
if (!StringUtil.isBlank(searchAttrType)) {
Integer.parseInt(searchAttrType);
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchAttrType参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchAttrType参数错误");
}
try {
String searchLwhh = getSearchField(clazz, entity, "searchLwhh");
if (!StringUtil.isBlank(searchLwhh)) {
Integer.parseInt(searchLwhh);
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchLwhh参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchLwhh参数错误");
}
try {
checkCloumnIsExist(thread, start, clazz, page);
} catch (RestServiceException e) {
logger.error(e);
throw e;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请求参数错误");
}
}
/**
* 实时统计公共查询字段验证
*
* @param entity
*/
public void queryConditionCheck(AuditLogThread thread, long start, DfReportEntity entity, Class clazz,
Page page) {
try {
if (!StringUtil.isBlank(entity.getSearchReportEndTime())) {
sdf.parse(entity.getSearchReportEndTime());
}
} catch (ParseException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchReportEndTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchReportEndTime参数格式格式");
}
try {
if (!StringUtil.isBlank(entity.getSearchReportStartTime())) {
sdf.parse(entity.getSearchReportStartTime());
}
} catch (ParseException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchReportStartTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchReportStartTime参数错误");
}
try {
String searchAttrType = getSearchField(clazz, entity, "searchAttrType");
if (!StringUtil.isBlank(searchAttrType)) {
Integer.parseInt(searchAttrType);
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchAttrType参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchAttrType参数错误");
}
try {
String searchLwhh = getSearchField(clazz, entity, "searchLwhh");
if (!StringUtil.isBlank(searchLwhh)) {
Integer.parseInt(searchLwhh);
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchLwhh参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchLwhh参数错误");
}
try {
String searchId = getSearchField(clazz, entity, "searchId");
if (!StringUtil.isBlank(searchId)) {
Integer.parseInt(searchId);
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchId参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchId参数错误");
}
try {
String searchService = getSearchField(clazz, entity, "searchService");
if (!StringUtil.isBlank(searchService)) {
Integer.parseInt(searchService);
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchService参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
throw new RestServiceException(thread, start, "searchService参数错误");
}
try {
checkCloumnIsExist(thread, start, clazz, page);
} catch (RestServiceException e) {
logger.error(e);
throw e;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, start, "请求参数错误");
}
}
/**
*
* @Title: getJedisKey