1:为日志查询cfgid查询条件添加最大输入10个id的判断
2:删除系统中的System.out.print
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
*/
|
||||
package com.nis.persistence.dialect;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Cluster方言的实现[神通数据库]
|
||||
@@ -13,6 +15,7 @@ package com.nis.persistence.dialect;
|
||||
*/
|
||||
public class ClusterDialect implements Dialect {
|
||||
|
||||
protected Logger logger = LoggerFactory.getLogger(ClusterDialect.class);
|
||||
|
||||
@Override
|
||||
public String getLimitString(String sql, int offset, int limit) {
|
||||
@@ -46,7 +49,7 @@ public class ClusterDialect implements Dialect {
|
||||
stringBuilder.append(" offset ");
|
||||
stringBuilder.append(offsetPlaceholder);
|
||||
}
|
||||
System.out.println("cluster分页sql:"+stringBuilder.toString());
|
||||
logger.info("cluster分页sql:"+stringBuilder.toString());
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package com.nis.persistence.interceptor;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.ibatis.executor.ErrorContext;
|
||||
import org.apache.ibatis.executor.ExecutorException;
|
||||
import org.apache.ibatis.logging.Log;
|
||||
@@ -13,7 +21,8 @@ import org.apache.ibatis.scripting.xmltags.ForEachSqlNode;
|
||||
import org.apache.ibatis.session.Configuration;
|
||||
import org.apache.ibatis.type.TypeHandler;
|
||||
import org.apache.ibatis.type.TypeHandlerRegistry;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.nis.datasource.CustomerContextHolder;
|
||||
import com.nis.domain.Page;
|
||||
@@ -28,19 +37,9 @@ import com.nis.persistence.dialect.OracleDialect;
|
||||
import com.nis.persistence.dialect.PostgreSQLDialect;
|
||||
import com.nis.persistence.dialect.SQLServer2005Dialect;
|
||||
import com.nis.persistence.dialect.SybaseDialect;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Reflections;
|
||||
import com.nis.util.StringUtils;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* SQL工具类
|
||||
*
|
||||
@@ -48,7 +47,7 @@ import java.util.regex.Pattern;
|
||||
* @version 2013-8-28
|
||||
*/
|
||||
public class SQLHelper {
|
||||
static final Logger logger = Logger.getLogger(SQLHelper.class);
|
||||
protected static Logger logger = LoggerFactory.getLogger(SQLHelper.class);
|
||||
/**
|
||||
* 对SQL参数(?)设值,参考org.apache.ibatis.executor.parameter.DefaultParameterHandler
|
||||
*
|
||||
@@ -165,7 +164,7 @@ public class SQLHelper {
|
||||
countSql = "select count(*) from (" + removeOrders(sql) + ") tmp_count";
|
||||
}
|
||||
}
|
||||
System.out.println("countSql:"+countSql);
|
||||
logger.info("countSql:"+countSql);
|
||||
Connection conn = connection;
|
||||
PreparedStatement ps = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
@@ -11,12 +11,6 @@ import java.util.List;
|
||||
*/
|
||||
public class AsciiJudge {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String str = "fdsf你说说你发的是佛山东方啥的飞sdf 啥打法是否(\\&)";
|
||||
boolean bool = asciiControlChar(str);
|
||||
System.out.println(bool);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串是否包含控制字符
|
||||
*
|
||||
|
||||
@@ -7,12 +7,6 @@ import java.net.UnknownHostException;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class BasicProvingUtil {
|
||||
public static void main(String[] args) {
|
||||
// String ip = "::";
|
||||
String ip = " fe80::d025:864c:3151:daa0";
|
||||
System.out.println(ip + "=" + isIpv6(ip));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是Integer类型
|
||||
|
||||
@@ -1020,26 +1020,4 @@ public class CompileVal {
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
long x = 2;
|
||||
int count = 0;
|
||||
for (int i = 1; i < 32; i++) {
|
||||
count++;
|
||||
x = x * 2;
|
||||
}
|
||||
|
||||
System.out.println(count + " " + x);
|
||||
|
||||
long maxValue = Long.MAX_VALUE;
|
||||
System.out.println(maxValue);
|
||||
|
||||
String key = "中\\&国\\&人&民共和&国中央&中央人民政府";
|
||||
String[] split = key.split("(?<=[^\\\\])&");
|
||||
for (String str : split) {
|
||||
System.out.println(str);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -261,18 +261,5 @@ public class ElasticsearchSqlDao {
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* main(这里用一句话描述这个方法的作用)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param args
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
StringBuffer sf=new StringBuffer(" AND 1=1");
|
||||
System.out.println(sf.delete(0, " AND".length()).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ public class LoginController extends BaseController {
|
||||
try {
|
||||
|
||||
if (StringUtils.isNotBlank(roleId)){
|
||||
System.out.println("*****************");
|
||||
logger.info("*****************");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -46,10 +46,8 @@ public abstract class BaseLogService {
|
||||
*
|
||||
* @param clazz
|
||||
* @param page
|
||||
* @throws Exception
|
||||
* void
|
||||
* @exception @since
|
||||
* 1.0.0
|
||||
* @throws Exception void
|
||||
* @exception @since 1.0.0
|
||||
*/
|
||||
public void checkCloumnIsExist(AuditLogThread thread, long start, Class clazz, Page page) throws Exception {
|
||||
String[] fieldsColoumn = null;
|
||||
@@ -100,7 +98,8 @@ public abstract class BaseLogService {
|
||||
}
|
||||
if (!StringUtil.isBlank(notExistColumn)) {
|
||||
notExistColumn = notExistColumn.substring(1);
|
||||
throw new RestServiceException("fields中" + notExistColumn + "的字段不存在!", RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("fields中" + notExistColumn + "的字段不存在!",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
}
|
||||
if (orderByColoumn != null) {
|
||||
@@ -118,7 +117,8 @@ public abstract class BaseLogService {
|
||||
}
|
||||
if (!StringUtil.isBlank(notExistColumn)) {
|
||||
notExistColumn = notExistColumn.substring(1);
|
||||
throw new RestServiceException("orderBy中" + notExistColumn + "的字段不存在!", RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("orderBy中" + notExistColumn + "的字段不存在!",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,24 +127,30 @@ public abstract class BaseLogService {
|
||||
|
||||
/**
|
||||
* 验证日志查询条件格式是否正确
|
||||
*
|
||||
* @param thread
|
||||
* @param start
|
||||
* @param entity
|
||||
* @param clazz
|
||||
* @param page
|
||||
*/
|
||||
public void queryConditionCheck(AuditLogThread thread, long start, LogEntity<?> entity, Class clazz,
|
||||
Page page) {
|
||||
public void queryConditionCheck(AuditLogThread thread, long start, LogEntity<?> entity, Class clazz, Page page) {
|
||||
logger.info("请求参数校验开始----" + System.currentTimeMillis());
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getSearchCfgId())) {
|
||||
Long.parseLong(entity.getSearchCfgId());
|
||||
|
||||
if (!StringUtil.isBlank(entity.getSearchCfgId())) {
|
||||
String[] split = org.apache.commons.lang.StringUtils.split(entity.getSearchCfgId(), ",");
|
||||
if (split.length > 10) {
|
||||
throw new RestServiceException("searchCfgId参数个数不能超过10个",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
for (String cfgId : split) {
|
||||
try {
|
||||
Long.parseLong(cfgId);
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchCfgId参数错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
throw new RestServiceException("searchCfgId参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchCfgId参数错误",RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -152,10 +158,9 @@ public abstract class BaseLogService {
|
||||
Integer.parseInt(entity.getSearchDirection());
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
throw new RestServiceException("getSearchDirection参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("getSearchDirection参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("getSearchDirection参数错误",RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("getSearchDirection参数错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -163,10 +168,9 @@ public abstract class BaseLogService {
|
||||
Long.parseLong(entity.getSearchEntranceId());
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
throw new RestServiceException("searchEntranceId参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchEntranceId参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchEntranceId参数错误",RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchEntranceId参数错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -175,10 +179,9 @@ public abstract class BaseLogService {
|
||||
sdf.parse(entity.getSearchFoundEndTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
throw new RestServiceException("searchFoundEndTime参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchFoundEndTime参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchFoundEndTime参数错误",RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchFoundEndTime参数错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -190,7 +193,7 @@ public abstract class BaseLogService {
|
||||
throw new RestServiceException("searchFoundStartTime参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchFoundStartTime参数错误",RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchFoundStartTime参数错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -198,23 +201,25 @@ public abstract class BaseLogService {
|
||||
Integer.parseInt(entity.getSearchService());
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
throw new RestServiceException("searchService参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchService参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchService参数错误",RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchService参数错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
try {
|
||||
checkCloumnIsExist(thread, start, clazz, page);
|
||||
} catch (RestServiceException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new ServiceRuntimeException(ExceptionUtil.getExceptionMsg(e),RestBusinessCode.service_runtime_error.getValue());
|
||||
throw new ServiceRuntimeException(ExceptionUtil.getExceptionMsg(e),
|
||||
RestBusinessCode.service_runtime_error.getValue());
|
||||
}
|
||||
logger.info("请求参数校验结束----" + System.currentTimeMillis());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证日志查询条件格式是否正确
|
||||
*
|
||||
* @param thread
|
||||
* @param start
|
||||
* @param entity
|
||||
@@ -222,7 +227,7 @@ public abstract class BaseLogService {
|
||||
* @param page
|
||||
*/
|
||||
public void collectConditionCheck(AuditLogThread thread, long start, NtcCollectVoipLog entity, Class clazz,
|
||||
Page page) {
|
||||
Page page) {
|
||||
logger.info("请求参数校验开始----" + System.currentTimeMillis());
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getSearchFoundEndTime())) {
|
||||
@@ -230,10 +235,9 @@ public abstract class BaseLogService {
|
||||
sdf.parse(entity.getSearchFoundEndTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
throw new RestServiceException("searchFoundEndTime参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchFoundEndTime参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchFoundEndTime参数格式格式",RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchFoundEndTime参数格式格式", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -245,7 +249,7 @@ public abstract class BaseLogService {
|
||||
throw new RestServiceException("searchFoundStartTime参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchFoundStartTime参数错误",RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchFoundStartTime参数错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -253,11 +257,13 @@ public abstract class BaseLogService {
|
||||
} catch (RestServiceException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new ServiceRuntimeException(ExceptionUtil.getExceptionMsg(e),RestBusinessCode.service_runtime_error.getValue());
|
||||
throw new ServiceRuntimeException(ExceptionUtil.getExceptionMsg(e),
|
||||
RestBusinessCode.service_runtime_error.getValue());
|
||||
}
|
||||
logger.info("请求参数校验结束----" + System.currentTimeMillis());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @Description:
|
||||
@@ -270,12 +276,13 @@ public abstract class BaseLogService {
|
||||
* @param page
|
||||
*/
|
||||
public void queryReportConditionCheck(AuditLogThread thread, long start, NtcReportEntity<?> entity, Class clazz,
|
||||
Page page) {
|
||||
Page page) {
|
||||
logger.info("实时报表统计查询参数校验开始----" + System.currentTimeMillis());
|
||||
if (!StringUtil.isBlank(entity.getSearchBusinessType())&&!StringUtil.isNumeric(entity.getSearchBusinessType())) {
|
||||
throw new RestServiceException("searchBusinessType参数格式错误",RestBusinessCode.param_formate_error.getValue());
|
||||
if (!StringUtil.isBlank(entity.getSearchBusinessType())
|
||||
&& !StringUtil.isNumeric(entity.getSearchBusinessType())) {
|
||||
throw new RestServiceException("searchBusinessType参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
//searchService
|
||||
// searchService
|
||||
checkNumericCondition(thread, start, entity.getSearchService(), "searchService");
|
||||
|
||||
try {
|
||||
@@ -283,9 +290,11 @@ public abstract class BaseLogService {
|
||||
sdf.parse(entity.getSearchReportStartTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
throw new RestServiceException("searchReportStartTime参数格式错误",RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchReportStartTime参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchReportStartTime参数错误",RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchReportStartTime参数错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -293,18 +302,20 @@ public abstract class BaseLogService {
|
||||
sdf.parse(entity.getSearchReportEndTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
throw new RestServiceException("searchReportEndTime参数格式错误",RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchReportEndTime参数错误",RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
if (!StringUtil.isBlank(entity.getSearchBusinessType())&&!StringUtil.isNumeric(entity.getSearchBusinessType())) {
|
||||
throw new RestServiceException("searchBusinessType参数格式错误",
|
||||
throw new RestServiceException("searchReportEndTime参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchReportEndTime参数错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
if (!StringUtil.isBlank(entity.getSearchBusinessType())
|
||||
&& !StringUtil.isNumeric(entity.getSearchBusinessType())) {
|
||||
throw new RestServiceException("searchBusinessType参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
logger.info("实时报表统计查询参数校验结束----" + System.currentTimeMillis());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description:用于验证数值类型格式,多个值以","分隔
|
||||
* @author (zdx)
|
||||
@@ -315,38 +326,37 @@ public abstract class BaseLogService {
|
||||
* @param condName
|
||||
*/
|
||||
public void checkNumericCondition(AuditLogThread thread, long start, String condition, String condName) {
|
||||
if (!StringUtil.isEmpty(condition)){
|
||||
if (!StringUtil.isEmpty(condition)) {
|
||||
Boolean flag = false;
|
||||
if (condition.contains(",")) {
|
||||
String services[] =condition.split(",");
|
||||
String services[] = condition.split(",");
|
||||
for (String service : services) {
|
||||
if(!StringUtil.isNumeric(service)) {
|
||||
if (!StringUtil.isNumeric(service)) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else if(!StringUtil.isNumeric(condition)) {
|
||||
} else if (!StringUtil.isNumeric(condition)) {
|
||||
flag = true;
|
||||
}
|
||||
if (flag) {
|
||||
throw new RestServiceException(condName+"参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException(condName + "参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description:验证用户行为日志统计查询条件
|
||||
* @author(zdx)
|
||||
* @date 2018年10月31日 下午4:53:27
|
||||
* @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())) {
|
||||
throw new RestServiceException("searchBusinessType参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
if (!StringUtil.isBlank(entity.getSearchBusinessType())
|
||||
&& !StringUtil.isNumeric(entity.getSearchBusinessType())) {
|
||||
throw new RestServiceException("searchBusinessType参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
int timeCount = 0;
|
||||
@@ -359,7 +369,8 @@ public abstract class BaseLogService {
|
||||
throw new RestServiceException("searchReportStartTime参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchReportStartTime参数错误",RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchReportStartTime参数错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -371,22 +382,21 @@ public abstract class BaseLogService {
|
||||
throw new RestServiceException("searchReportEndTime参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException("searchReportEndTime参数错误",RestBusinessCode.param_formate_error.getValue());
|
||||
throw new RestServiceException("searchReportEndTime参数错误", RestBusinessCode.param_formate_error.getValue());
|
||||
}
|
||||
if (timeCount==1) {
|
||||
if (timeCount == 1) {
|
||||
throw new RestServiceException("searchReportStartTime和searchReportEndTime参数必须同时填写",
|
||||
RestBusinessCode.config_integrity_error.getValue());
|
||||
}
|
||||
|
||||
|
||||
//根据用户查看IP趋势时(searchBusinessType=2),用户名必需填写
|
||||
if ("2".equals(entity.getSearchBusinessType())&&StringUtil.isEmpty(entity.getSearchAccount())) {
|
||||
// 根据用户查看IP趋势时(searchBusinessType=2),用户名必需填写
|
||||
if ("2".equals(entity.getSearchBusinessType()) && StringUtil.isEmpty(entity.getSearchAccount())) {
|
||||
throw new RestServiceException("searchBusinessType=2时searchAccount参数必须填写",
|
||||
RestBusinessCode.config_integrity_error.getValue());
|
||||
}
|
||||
|
||||
//根据用户查看IP趋势时(searchBusinessType=3),用户名必需填写
|
||||
if ("3".equals(entity.getSearchBusinessType())&&StringUtil.isEmpty(entity.getSearchNasIp())) {
|
||||
// 根据用户查看IP趋势时(searchBusinessType=3),用户名必需填写
|
||||
if ("3".equals(entity.getSearchBusinessType()) && StringUtil.isEmpty(entity.getSearchNasIp())) {
|
||||
throw new RestServiceException("searchBusinessType=3时searchNasIp参数必须填写",
|
||||
RestBusinessCode.config_integrity_error.getValue());
|
||||
}
|
||||
@@ -399,10 +409,8 @@ public abstract class BaseLogService {
|
||||
*
|
||||
* @Title: getJedisKey
|
||||
* @Description: (日志查询/报表记录,"接口名称+查询条件"作为key,将结果存入redis中)
|
||||
* @param @param
|
||||
* request
|
||||
* @param @param
|
||||
* bool 查询数据中心缓存还是oracle缓存,false是oracle缓存
|
||||
* @param @param request
|
||||
* @param @param bool 查询数据中心缓存还是oracle缓存,false是oracle缓存
|
||||
* @param @return
|
||||
* @return Map 返回类型
|
||||
* @author (DDM)
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.nis.web.service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -248,8 +247,8 @@ public class LogDataService {
|
||||
}
|
||||
// clickhouse写法
|
||||
String type = filedsType.get(key).trim();
|
||||
String field = filedAndColumnMap.get(key).toLowerCase();
|
||||
if (type.equals("java.lang.String")) {
|
||||
String field = filedAndColumnMap.get(key).toLowerCase();
|
||||
if (field.equals("url") || field.equals("website")) {
|
||||
whereSB.append(" and " + field + " like '" + value.toString().trim() + "%'");
|
||||
} else {
|
||||
@@ -258,8 +257,15 @@ public class LogDataService {
|
||||
}
|
||||
} else if (type.equals("java.lang.Integer") || type.equals("int")
|
||||
|| type.equals("java.lang.Long") || type.equals("long")) {
|
||||
whereSB.append(" and " + filedAndColumnMap.get(key).toLowerCase() + "="
|
||||
+ value.toString().trim());
|
||||
if(field.equals("cfg_id")) {
|
||||
whereSB.append(" and " + filedAndColumnMap.get(key).toLowerCase() + " in("
|
||||
+ value.toString().trim()+")");
|
||||
}else {
|
||||
whereSB.append(" and " + filedAndColumnMap.get(key).toLowerCase() + "="
|
||||
+ value.toString().trim());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,14 +11,9 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.JedisPoolConfig;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -45,9 +40,11 @@ import com.nis.util.GroupReuseVal;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.ReadCommSourceXmlUtil;
|
||||
import com.nis.util.ServiceAndRDBIndexReal;
|
||||
import com.zdjizhi.utils.StringUtil;
|
||||
import com.nis.web.service.AuditLogThread;
|
||||
import com.nis.web.service.BaseService;
|
||||
import com.zdjizhi.utils.StringUtil;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* @ClassName: ControlService
|
||||
|
||||
@@ -141,9 +141,6 @@ public class GetIpRangeTask {
|
||||
String[] ipAddr = str.split("-");
|
||||
if (ipAddr.length > 1) {
|
||||
String startIp = ipAddr[0];
|
||||
if(startIp.toString().length()>11) {
|
||||
System.out.println("1");
|
||||
}
|
||||
String endIp = ipAddr[1];
|
||||
NtcIpRangeReport ntcIpRangeReport = new NtcIpRangeReport();
|
||||
String startIpStr = map.get(Long.parseLong(startIp));
|
||||
@@ -165,11 +162,6 @@ public class GetIpRangeTask {
|
||||
System.out.print(list.get(i) + "[" + map.get(list.get(i)) + "]");
|
||||
if (i < list.size() - 1) {
|
||||
Long startIp = list.get(i);
|
||||
|
||||
if(startIp.toString().length()>11) {
|
||||
System.out.println("1");
|
||||
}
|
||||
|
||||
Long endIp = list.get(i + 1);
|
||||
NtcIpRangeReport ntcIpRangeReport = new NtcIpRangeReport();
|
||||
String startIpStr = map.get(startIp);
|
||||
|
||||
@@ -75,7 +75,6 @@ public class SyncRedisToCluster {
|
||||
@Scheduled(cron = "${syncRedisToClusterCron}")
|
||||
public void syncRedisToCluster() {
|
||||
JedisCluster jedisCluster = getResource();
|
||||
System.out.println(jedisCluster);
|
||||
String requestId = UUID.randomUUID().toString();
|
||||
try {
|
||||
if (lock(jedisCluster, requestId)) {// 避免集群环境下同一秒钟所有的机器都执行这个定时任务
|
||||
@@ -180,7 +179,7 @@ public class SyncRedisToCluster {
|
||||
}
|
||||
}
|
||||
for (String string : keys) {
|
||||
System.out.println(string);
|
||||
// System.out.println(string);
|
||||
}
|
||||
logger.debug("Keys gotten!");
|
||||
return keys;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class HelloWorldController extends BaseController{
|
||||
|
||||
@RequestMapping("/testPathVariable/{id}")
|
||||
public String testPathVariable(@PathVariable("id") int id){
|
||||
System.out.println(id);
|
||||
logger.info(id);
|
||||
return "success";
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class HelloWorldController extends BaseController{
|
||||
*/
|
||||
@RequestMapping(value="/testRequestParam")
|
||||
public String testRequestParam(@RequestParam(value="username",required=true) String username,@RequestParam(required=false,defaultValue="0") int age){
|
||||
System.out.println(username+":"+age);
|
||||
logger.info(username+":"+age);
|
||||
return "success";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user