定时删除日志

yun-zuoyi
汪云昊 6 years ago
parent 79b36a30a4
commit 0041ce328e

@ -109,7 +109,6 @@ public class BsonPackTool {
return list; return list;
} }
/** /**
* *
* @param startDate * @param startDate
@ -161,7 +160,7 @@ public class BsonPackTool {
* @param showToday true:false: * @param showToday true:false:
* @param isShowTime * @param isShowTime
*/ */
public static Bson timeBuilder( String date, String columnName, Bson bson, Boolean showToday,boolean isShowTime) { public static Bson timeBuilder( String date, String columnName, Bson bson, boolean showToday,boolean isShowTime) {
if(date != null && !"null".equals(date) && date.trim().length() > 0){ if(date != null && !"null".equals(date) && date.trim().length() > 0){
date = getSafeParam(date); date = getSafeParam(date);
@ -249,6 +248,68 @@ public class BsonPackTool {
} }
/** /**
*
* @param dateTime
* @param columnName HQL
* @param bson bson
* @param isShowTime
*/
public static Bson timeMore( String dateTime, String columnName, Bson bson, boolean isShowTime) {
if (dateTime == null || dateTime.trim().length() == 0) {
dateTime = "1900-01-01";
} else {
dateTime = getSafeParam(dateTime);
dateTime = dateTime.trim();
}
if (isShowTime && dateTime.trim().length()<=11) {
dateTime+= " 00:00:00";
}
if(bson == null) {
bson = Filters.and(
Filters.gte(columnName, dateTime) //大于等于开始日期
);
}else{
bson = Filters.and(
bson,
Filters.gte(columnName, dateTime) //大于等于开始日期
);
}
return bson;
}
/**
*
* @param dateTime
* @param columnName HQL
* @param bson bson
* @param isShowTime
*/
public static Bson timeLess( String dateTime, String columnName, Bson bson, boolean isShowTime) {
if (dateTime == null || dateTime.trim().length() == 0) {
dateTime = "2100-01-01";
} else {
dateTime = getSafeParam(dateTime);
dateTime = dateTime.trim();
}
if (isShowTime&& dateTime.trim().length()<=11) {
dateTime+= " 23:59:59";
}
if(bson == null) {
bson = Filters.and(
Filters.lte(columnName, dateTime) //小于等于结束日期
);
}else{
bson = Filters.and(
bson,
Filters.lte(columnName, dateTime) //小于等于结束日期
);
}
return bson;
}
/**
* Stringlike * Stringlike
* @param str * @param str
* @param columnName * @param columnName

@ -50,6 +50,15 @@ public interface BaseRedis {
Object getObject(Object key); Object getObject(Object key);
/** /**
*
* @param key
* @param start
* @param end 0 -1
* @return
*/
Object getObject(Object key, long start, long end);
/**
* *
* @param key * @param key
* @param value * @param value

@ -9,6 +9,7 @@ import lombok.EqualsAndHashCode;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
@ -55,7 +56,8 @@ public class SysLocaleResource extends BaseBean {
@ApiParam(value = "资源KEY",example = "格式A.B全部大写参考命名规范开发文档") @ApiParam(value = "资源KEY",example = "格式A.B全部大写参考命名规范开发文档")
private String resourceKey; private String resourceKey;
@Column(name="resource_value",columnDefinition="TEXT") @Lob
@Column(name="resource_value")
@ApiParam(value = "资源Value",example = "通过resourceTypelanguageId和key获取") @ApiParam(value = "资源Value",example = "通过resourceTypelanguageId和key获取")
private String resourceValue; private String resourceValue;

@ -1,6 +1,7 @@
package cn.estsh.i3plus.pojo.platform.sqlpack; package cn.estsh.i3plus.pojo.platform.sqlpack;
import cn.estsh.i3plus.pojo.base.tool.BsonPackTool; import cn.estsh.i3plus.pojo.base.tool.BsonPackTool;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.platform.platbean.SysLogException; import cn.estsh.i3plus.pojo.platform.platbean.SysLogException;
import cn.estsh.i3plus.pojo.platform.platbean.SysLogOperate; import cn.estsh.i3plus.pojo.platform.platbean.SysLogOperate;
import cn.estsh.i3plus.pojo.platform.platbean.SysLogSystem; import cn.estsh.i3plus.pojo.platform.platbean.SysLogSystem;
@ -19,6 +20,7 @@ public class CoreBsonPack {
/** /**
* *
*
* @param logSystem * @param logSystem
* @return * @return
*/ */
@ -37,6 +39,7 @@ public class CoreBsonPack {
/** /**
* *
*
* @param logOperate * @param logOperate
* @return * @return
*/ */
@ -55,6 +58,7 @@ public class CoreBsonPack {
/** /**
* *
*
* @param sysLogException * @param sysLogException
* @return * @return
*/ */
@ -70,6 +74,7 @@ public class CoreBsonPack {
/** /**
* *
*
* @param sysLogTaskTime * @param sysLogTaskTime
* @return * @return
*/ */
@ -85,6 +90,7 @@ public class CoreBsonPack {
/** /**
* *
*
* @param colName * @param colName
* @param min * @param min
* @param max * @param max
@ -97,4 +103,14 @@ public class CoreBsonPack {
bson = BsonPackTool.getNumSmallerPack(max, colName, bson); bson = BsonPackTool.getNumSmallerPack(max, colName, bson);
return bson; return bson;
}} }
/**
*
* @param dateTime
* @return
*/
public static Bson packBsonByDateTimeAfter(String dateTime){
return BsonPackTool.timeLess(dateTime, "createDatetime", null, true);
}
}

Loading…
Cancel
Save