Merge branch 'Release-1.1' into develop
This commit is contained in:
@@ -73,9 +73,7 @@ public class Page<T> {
|
||||
* @param response 用于设置 Cookie,记住页码
|
||||
*/
|
||||
public Page(HttpServletRequest request, HttpServletResponse response){
|
||||
|
||||
//this(request, response,Integer.valueOf(Configurations.getIntProperty("page.pageSize", 30)));
|
||||
|
||||
this(request, response,Integer.valueOf(Configurations.getIntProperty("page.pageSize", 30)));
|
||||
}
|
||||
/**
|
||||
* 构造方法
|
||||
|
||||
154
src/main/java/com/nis/domain/SwaggerLog.java
Normal file
154
src/main/java/com/nis/domain/SwaggerLog.java
Normal file
@@ -0,0 +1,154 @@
|
||||
package com.nis.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class SwaggerLog extends BaseEntity<SwaggerLog> {
|
||||
private static final long serialVersionUID = 5351369774420087482L;
|
||||
private Long id;
|
||||
private String operator;
|
||||
private String version;
|
||||
private Integer opAction;
|
||||
private Date opTime;
|
||||
private String requestContent;
|
||||
private Date requestTime;
|
||||
private Long consumerTime;
|
||||
private String requestIp;
|
||||
private Integer businessCode;
|
||||
private String exceptionInfo;
|
||||
private String serverIp;
|
||||
private String traceCode;
|
||||
|
||||
private String exception;// 界面的异常信息框
|
||||
|
||||
private Date beginDate; // 开始日期
|
||||
private Date endDate; // 结束日期
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public Integer getOpAction() {
|
||||
return opAction;
|
||||
}
|
||||
|
||||
public void setOpAction(Integer opAction) {
|
||||
this.opAction = opAction;
|
||||
}
|
||||
|
||||
public Date getOpTime() {
|
||||
return opTime;
|
||||
}
|
||||
|
||||
public void setOpTime(Date opTime) {
|
||||
this.opTime = opTime;
|
||||
}
|
||||
|
||||
public String getRequestContent() {
|
||||
return requestContent;
|
||||
}
|
||||
|
||||
public void setRequestContent(String requestContent) {
|
||||
this.requestContent = requestContent;
|
||||
}
|
||||
|
||||
public Date getRequestTime() {
|
||||
return requestTime;
|
||||
}
|
||||
|
||||
public void setRequestTime(Date requestTime) {
|
||||
this.requestTime = requestTime;
|
||||
}
|
||||
|
||||
public Long getConsumerTime() {
|
||||
return consumerTime;
|
||||
}
|
||||
|
||||
public void setConsumerTime(Long consumerTime) {
|
||||
this.consumerTime = consumerTime;
|
||||
}
|
||||
|
||||
public String getRequestIp() {
|
||||
return requestIp;
|
||||
}
|
||||
|
||||
public void setRequestIp(String requestIp) {
|
||||
this.requestIp = requestIp;
|
||||
}
|
||||
|
||||
public Integer getBusinessCode() {
|
||||
return businessCode;
|
||||
}
|
||||
|
||||
public void setBusinessCode(Integer businessCode) {
|
||||
this.businessCode = businessCode;
|
||||
}
|
||||
|
||||
public String getExceptionInfo() {
|
||||
return exceptionInfo;
|
||||
}
|
||||
|
||||
public void setExceptionInfo(String exceptionInfo) {
|
||||
this.exceptionInfo = exceptionInfo;
|
||||
}
|
||||
|
||||
public String getServerIp() {
|
||||
return serverIp;
|
||||
}
|
||||
|
||||
public void setServerIp(String serverIp) {
|
||||
this.serverIp = serverIp;
|
||||
}
|
||||
|
||||
public String getTraceCode() {
|
||||
return traceCode;
|
||||
}
|
||||
|
||||
public void setTraceCode(String traceCode) {
|
||||
this.traceCode = traceCode;
|
||||
}
|
||||
|
||||
public String getException() {
|
||||
return exception;
|
||||
}
|
||||
|
||||
public void setException(String exception) {
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
public Date getBeginDate() {
|
||||
return beginDate;
|
||||
}
|
||||
|
||||
public void setBeginDate(Date beginDate) {
|
||||
this.beginDate = beginDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public class SQLHelper {
|
||||
*/
|
||||
public static Long getCount(final String sql, final Connection connection, final MappedStatement mappedStatement,
|
||||
final Object parameterObject, final BoundSql boundSql, Log log) throws SQLException {
|
||||
logger.info("count查询开始----"+System.currentTimeMillis());
|
||||
logger.info("开始count查询----"+System.currentTimeMillis());
|
||||
String dbName = getDBType();
|
||||
final String countSql;
|
||||
if ("oracle".equals(dbName)) {
|
||||
@@ -194,7 +194,7 @@ public class SQLHelper {
|
||||
}
|
||||
return count;
|
||||
} finally {
|
||||
logger.info("oracle查询count结束----"+System.currentTimeMillis());
|
||||
logger.info("count查询结束----"+System.currentTimeMillis());
|
||||
if (rs != null) {
|
||||
rs.close();
|
||||
}
|
||||
|
||||
@@ -151,12 +151,11 @@ public class HiveJDBC {
|
||||
for (int i = 1; i <= metaData.getColumnCount(); i++) {
|
||||
Object value = rs.getObject(i);
|
||||
String filedName = filedAndColumnMap.get(metaData.getColumnName(i).toString().toLowerCase());
|
||||
if (null != value) {
|
||||
if (!StringUtil.isEmpty(value)) {
|
||||
//如果是日期类型的属性需要把时间戳转换成日期,如果时间戳为0直接把值设置为null
|
||||
if (null != columnList && columnList.contains(filedName.toLowerCase())) {
|
||||
long time = 0l;
|
||||
if (null != value && !value.toString().equals("")) {
|
||||
time = Long.parseLong(value.toString());
|
||||
}
|
||||
time = Long.parseLong(value.toString());
|
||||
map.put(filedName, time==0l?null:new Date(time * 1000));
|
||||
// map.put(filedName, new
|
||||
// Date(Long.parseLong("1476583810000")));
|
||||
@@ -236,7 +235,7 @@ public class HiveJDBC {
|
||||
String fieldTypeName = propertyDescriptor.getPropertyType().getName();
|
||||
if (map.containsKey(name)) {
|
||||
Object value = map.get(name);
|
||||
if (null != value && !value.equals("")) {
|
||||
if (!StringUtil.isEmpty(value)) {
|
||||
if (fieldTypeName.equals("java.lang.String")) {
|
||||
propertyDescriptor.getWriteMethod().invoke(obj, new String[] { value.toString() });
|
||||
} else if (fieldTypeName.equals("java.lang.Integer")) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.nis.web.service.LogService;
|
||||
import com.nis.web.service.MenuService;
|
||||
import com.nis.web.service.OfficeService;
|
||||
import com.nis.web.service.RoleService;
|
||||
import com.nis.web.service.SwaggerLogService;
|
||||
import com.nis.web.service.SystemService;
|
||||
import com.nis.web.service.UserService;
|
||||
|
||||
@@ -50,6 +51,9 @@ public class BaseController {
|
||||
@Autowired
|
||||
protected LogService logService;
|
||||
|
||||
@Autowired
|
||||
protected SwaggerLogService swaggerLogService;
|
||||
|
||||
@Autowired
|
||||
protected ArchiveServcie archiveServcie;
|
||||
|
||||
|
||||
@@ -9,19 +9,28 @@ import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SwaggerLog;
|
||||
import com.nis.domain.SysLog;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/sys/log")
|
||||
public class SysLogController extends BaseController {
|
||||
|
||||
|
||||
@RequiresPermissions("sys:log:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
@RequestMapping(value = "list")
|
||||
public String list(SysLog sysLog, HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
Page<SysLog> page = logService.findPage(new Page<SysLog>(request, response), sysLog);
|
||||
model.addAttribute("page", page);
|
||||
Page<SysLog> page = logService.findPage(new Page<SysLog>(request, response), sysLog);
|
||||
model.addAttribute("page", page);
|
||||
return "/sys/logList";
|
||||
}
|
||||
|
||||
@RequiresPermissions("sys:swaggerLogList:view")
|
||||
@RequestMapping(value = "swaggerLogList")
|
||||
public String swaggerLogList(SwaggerLog sysLog, HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
Page<SwaggerLog> page = swaggerLogService.findSwaggerLogPage(new Page<SwaggerLog>(request, response), sysLog);
|
||||
model.addAttribute("page", page);
|
||||
return "/sys/swaggerLogList";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
7
src/main/java/com/nis/web/dao/SwaggerLogDao.java
Normal file
7
src/main/java/com/nis/web/dao/SwaggerLogDao.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package com.nis.web.dao;
|
||||
|
||||
import com.nis.domain.SwaggerLog;
|
||||
@MyBatisDao
|
||||
public interface SwaggerLogDao extends CrudDao<SwaggerLog>{
|
||||
|
||||
}
|
||||
49
src/main/java/com/nis/web/dao/SwaggerLogDao.xml
Normal file
49
src/main/java/com/nis/web/dao/SwaggerLogDao.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.nis.web.dao.SwaggerLogDao">
|
||||
|
||||
<select id="findList" resultType="swaggerLog">
|
||||
SELECT
|
||||
a.*
|
||||
FROM services_request_log a
|
||||
WHERE a.request_time BETWEEN
|
||||
#{beginDate} AND #{endDate}
|
||||
|
||||
<if test="requestContent != null and requestContent != ''">
|
||||
AND a.request_Content LIKE
|
||||
<if test="dbName == 'oracle'">'%'||#{requestContent}||'%'</if>
|
||||
<if test="dbName == 'mssql'">'%'+#{requestContent}+'%'</if>
|
||||
<if test="dbName == 'mysql'">CONCAT('%', #{requestContent}, '%')</if>
|
||||
</if>
|
||||
<if test="traceCode != null and traceCode != ''">
|
||||
AND a.trace_Code=#{traceCode}
|
||||
</if>
|
||||
|
||||
<if test="exceptionInfo != null and exceptionInfo != ''">
|
||||
AND a.exception_Info LIKE
|
||||
<if test="dbName == 'oracle'">'%'||#{exceptionInfo}||'%'</if>
|
||||
<if test="dbName == 'mssql'">'%'+#{exceptionInfo}+'%'</if>
|
||||
<if test="dbName == 'mysql'">CONCAT('%', #{exceptionInfo}, '%')</if>
|
||||
</if>
|
||||
|
||||
<if test="requestIp != null and requestIp != ''">
|
||||
AND a.request_ip like
|
||||
<if test="dbName == 'oracle'">'%'||#{requestIp}||'%'</if>
|
||||
<if test="dbName == 'mssql'">'%'+#{requestIp}+'%'</if>
|
||||
<if test="dbName == 'mysql'">CONCAT('%', #{requestIp}, '%')</if>
|
||||
</if>
|
||||
<if test="serverIp != null and serverIp != ''">
|
||||
AND a.server_Ip like
|
||||
<if test="dbName == 'oracle'">'%'||#{serverIp}||'%'</if>
|
||||
<if test="dbName == 'mssql'">'%'+#{serverIp}+'%'</if>
|
||||
<if test="dbName == 'mysql'">CONCAT('%', #{serverIp}, '%')</if>
|
||||
</if>
|
||||
<if test="exception != null and exception != ''">
|
||||
AND a.exception_Info!=''
|
||||
</if>
|
||||
ORDER BY a.request_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -49,7 +49,7 @@ public class HiveSqlService {
|
||||
}
|
||||
sql.setLength(0);
|
||||
sql.append(" select " + sqlTrim + " from " + tableName + " t where 1=1 ");
|
||||
if (bean != null) {
|
||||
if (!StringUtil.isEmpty(bean)) {
|
||||
Class<?> clazz = bean.getClass();
|
||||
for (; clazz != Object.class; clazz = clazz.getSuperclass()) {
|
||||
// 获取所有的字段包括public,private,protected,private
|
||||
@@ -64,7 +64,7 @@ public class HiveSqlService {
|
||||
String typeName = f.getType().getName();
|
||||
if (f.getType().getName().equals("java.lang.String") && key.startsWith("search")) {
|
||||
Object value = getFieldValue(bean, key);
|
||||
if (value != null) {
|
||||
if (!StringUtil.isEmpty(value)) {
|
||||
setFieldValue(bean, key, value.toString().trim());
|
||||
if (key.endsWith("Time")) {// 日期开始或结束的字段
|
||||
if (col2col.containsKey(key)) {
|
||||
@@ -159,7 +159,7 @@ public class HiveSqlService {
|
||||
String typeName = f.getType().getName();
|
||||
if (f.getType().getName().equals("java.lang.String") && key.startsWith("search")) {
|
||||
Object value = getFieldValue(bean, key);
|
||||
if (value != null) {
|
||||
if (!StringUtil.isEmpty(value)) {
|
||||
setFieldValue(bean, key, value.toString().trim());
|
||||
if (key.endsWith("Time")) {// 日期开始或结束的字段
|
||||
if (col2col.containsKey(key)) {
|
||||
|
||||
25
src/main/java/com/nis/web/service/SwaggerLogService.java
Normal file
25
src/main/java/com/nis/web/service/SwaggerLogService.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.nis.web.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SwaggerLog;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.web.dao.SwaggerLogDao;
|
||||
|
||||
@Service
|
||||
public class SwaggerLogService extends CrudService<SwaggerLogDao, SwaggerLog> {
|
||||
|
||||
|
||||
public Page<SwaggerLog> findSwaggerLogPage(Page<SwaggerLog> page, SwaggerLog sysLog) {
|
||||
// 设置默认时间范围,默认当前月
|
||||
if (sysLog.getBeginDate() == null) {
|
||||
sysLog.setBeginDate(DateUtils.setDays(DateUtils.parseDate(DateUtils.getDate()), 1));
|
||||
}
|
||||
if (sysLog.getEndDate() == null) {
|
||||
sysLog.setEndDate(DateUtils.addMonths(sysLog.getBeginDate(), 1));
|
||||
}
|
||||
return super.findPage(page, sysLog);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user