新增 用户行为统计查询服务 接口

This commit is contained in:
zhangdongxu
2018-10-31 19:33:04 +08:00
parent adaa53ebd1
commit 5e66868e13
6 changed files with 415 additions and 11 deletions

View File

@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.nis.domain.LogEntity;
import com.nis.domain.Page;
import com.nis.domain.restful.NtcRadiusReport;
import com.nis.domain.restful.NtcReportEntity;
import com.nis.restful.RestBusinessCode;
import com.nis.restful.RestServiceException;
@@ -294,14 +295,6 @@ public abstract class BaseLogService {
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportEndTime参数错误");
}
if (!StringUtil.isBlank(entity.getSearchBusinessType())&&!StringUtil.isNumeric(entity.getSearchBusinessType())) {
logger.error(RestBusinessCode.param_formate_error.getErrorReason()+",searchBusinessType参数格式错误");
thread.setExceptionInfo("searchBusinessType参数格式错误");
throw new RestServiceException(thread,
System.currentTimeMillis() - start,
"searchBusinessType参数格式错误",
RestBusinessCode.param_formate_error.getValue());
}
logger.info("实时报表统计查询参数校验结束----" + System.currentTimeMillis());
@@ -339,6 +332,90 @@ public abstract class BaseLogService {
}
}
}
/**
* @Description:验证用户行为日志统计查询条件
* @author(zdx)
* @date 2018年10月31日 下午4:53:27
* @param thread
* @param start
* @param entity
*/
public void checkNtcRadiusReportCondition(AuditLogThread thread, long start, NtcRadiusReport entity) {
logger.info("用户行为日志统计参数校验开始----" + System.currentTimeMillis());
if (!StringUtil.isBlank(entity.getSearchBusinessType())&&!StringUtil.isNumeric(entity.getSearchBusinessType())) {
logger.error(RestBusinessCode.param_formate_error.getErrorReason()+",searchBusinessType参数格式错误");
thread.setExceptionInfo("searchBusinessType参数格式错误");
throw new RestServiceException(thread,
System.currentTimeMillis() - start,
"searchBusinessType参数格式错误",
RestBusinessCode.param_formate_error.getValue());
}
int timeCount = 0;
try {
if (!StringUtil.isBlank(entity.getSearchReportStartTime())) {
sdf.parse(entity.getSearchReportStartTime());
timeCount++;
}
} catch (ParseException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportStartTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportStartTime参数错误");
}
try {
if (!StringUtil.isBlank(entity.getSearchReportEndTime())) {
sdf.parse(entity.getSearchReportEndTime());
timeCount++;
}
} catch (ParseException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportEndTime参数格式错误",
RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportEndTime参数错误");
}
if (timeCount!=2) {
logger.error(RestBusinessCode.config_integrity_error.getErrorReason()+",searchReportStartTime和searchReportEndTime参数必须同时填写");
thread.setExceptionInfo("searchReportStartTime和searchReportEndTime参数必须同时填写");
throw new RestServiceException(thread,
System.currentTimeMillis() - start,
"searchReportStartTime和searchReportEndTime参数必须同时填写",
RestBusinessCode.config_integrity_error.getValue());
}
//根据用户查看IP趋势时(searchBusinessType=2),用户名必需填写
if ("2".equals(entity.getSearchBusinessType())&&StringUtil.isEmpty(entity.getSearchAccount())) {
logger.error(RestBusinessCode.config_integrity_error.getErrorReason()+",searchBusinessType=2时searchAccount参数必须填写");
thread.setExceptionInfo("searchBusinessType=2时searchAccount参数必须填写");
throw new RestServiceException(thread,
System.currentTimeMillis() - start,
"searchBusinessType=2时searchAccount参数必须填写",
RestBusinessCode.config_integrity_error.getValue());
}
//根据用户查看IP趋势时(searchBusinessType=3),用户名必需填写
if ("3".equals(entity.getSearchBusinessType())&&StringUtil.isEmpty(entity.getSearchNasIp())) {
logger.error(RestBusinessCode.config_integrity_error.getErrorReason()+",searchBusinessType=3时searchNasIp参数必须填写");
thread.setExceptionInfo("searchBusinessType=3时searchNasIp参数必须填写");
throw new RestServiceException(thread,
System.currentTimeMillis() - start,
"searchBusinessType=3时searchNasIp参数必须填写",
RestBusinessCode.config_integrity_error.getValue());
}
logger.info("用户行为日志统计参数校验结束----" + System.currentTimeMillis());
}
/**
*