添加 Mongo DB 开关
parent
922e715807
commit
560678f21c
@ -0,0 +1,133 @@
|
||||
package cn.estsh.i3plus.core.api.iservice.base;
|
||||
|
||||
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
import cn.estsh.i3plus.pojo.platform.platbean.SysLogException;
|
||||
import cn.estsh.i3plus.pojo.platform.platbean.SysLogOperate;
|
||||
import cn.estsh.i3plus.pojo.platform.platbean.SysLogSystem;
|
||||
import cn.estsh.i3plus.pojo.platform.platbean.SysLogTaskTime;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description :
|
||||
* @Reference :
|
||||
* @Author : wei.peng
|
||||
* @CreateDate : 20-2-13 下午3:43
|
||||
* @Modify:
|
||||
**/
|
||||
public interface ISysLogService {
|
||||
|
||||
/********************************************************* 系统异常日志 Start *********************************************************/
|
||||
|
||||
@ApiOperation(value = "系统异常日志复杂查询,分页,排序")
|
||||
ListPager<SysLogException> querySysLogExceptionByPager(SysLogException sysLogException, Pager pager);
|
||||
|
||||
@ApiOperation(value = "删除指定日期之后的日志")
|
||||
long deleteSysLogExceptionByDateTimeAfter(String dateTime);
|
||||
|
||||
/******************************************************* 系统异常日志 End *********************************************************/
|
||||
|
||||
|
||||
/********************************************************* 操作日志 Start *********************************************************/
|
||||
|
||||
@ApiOperation(value = "添加操作日志",notes = "添加操作日志")
|
||||
SysLogOperate insertSysLogOperate(SysLogOperate logOperate);
|
||||
|
||||
@ApiOperation(value = "根据id删除日志",notes = "根据id删除日志")
|
||||
void deleteSysLogOperateById(Long id);
|
||||
|
||||
@ApiOperation(value = "查询全部操作日志",notes = "查询全部操作日志")
|
||||
List listSysLogOperate();
|
||||
|
||||
@ApiOperation(value = "批量删除日志",notes = "批量删除日志")
|
||||
void deleteSysLogOperateByIds(Long[] ids);
|
||||
|
||||
@ApiOperation(value = "根据id查询操作日志",notes = "根据id查询操作日志")
|
||||
SysLogOperate getSysLogOperateById(Long id);
|
||||
|
||||
@ApiOperation(value = "根据操作人姓名模糊查询日志",notes = "根据操作人姓名模糊查询日志")
|
||||
List<SysLogOperate> listSysLogOperateByOperateUserName(String operateUserName);
|
||||
|
||||
@ApiOperation(value = "查询所有日志数量")
|
||||
long countAllSysLogOperate();
|
||||
|
||||
@ApiOperation(value = "操作日志复杂查询,分页,排序",notes = "操作日志复杂查询,分页,排序")
|
||||
ListPager<SysLogOperate> querySysLogOperateByPager(SysLogOperate logOperate, Pager pager);
|
||||
|
||||
@ApiOperation(value = "查询最新的操作日志")
|
||||
List<SysLogOperate> findNewSysLogOperate(Integer num);
|
||||
|
||||
@ApiOperation(value = "删除指定日期之后的日志")
|
||||
long deleteSysLogOperateByDateTimeAfter(String dateTime);
|
||||
|
||||
@ApiOperation(value = "操作日志数量")
|
||||
long countSysLogOperate();
|
||||
|
||||
/******************************************************* 操作日志 End *********************************************************/
|
||||
|
||||
|
||||
/******************************************************* 系统日志 Start *********************************************************/
|
||||
|
||||
@ApiOperation(value = "添加系统日志",notes = "添加系统日志")
|
||||
void insertSysLogSystem(SysLogSystem logSystem);
|
||||
|
||||
@ApiOperation(value = "造数据系统日志",notes = "造数据")
|
||||
void insertSysLogBatch(int num,int waitTime);
|
||||
|
||||
@ApiOperation(value = "删除日志",notes = "删除日志")
|
||||
long deleteSysLogSystemById(Long id);
|
||||
|
||||
@ApiOperation(value = "查询全部日志",notes = "查询全部日志")
|
||||
List<SysLogSystem> listSysLogSystem();
|
||||
|
||||
@ApiOperation(value = "根据id查询系统日志",notes = "根据id查询系统日志")
|
||||
SysLogSystem getSysLogSystemById(long id);
|
||||
|
||||
@ApiOperation(value = "系统日志分页复杂查询",notes = "系统日志分页复杂查询")
|
||||
ListPager querySysLogSystemByPager(SysLogSystem logSystem, Pager pager);
|
||||
|
||||
@ApiOperation(value = "系统日志批量删除",notes = "系统日志批量删除")
|
||||
long deleteSysLogSystemByIds(Long[] ids);
|
||||
|
||||
@ApiOperation(value = "系统日志按id区间查询",notes = "系统日志按id区间查询")
|
||||
List<SysLogSystem> findSysLogSystemByIdInterval(long min, long max);
|
||||
|
||||
@ApiOperation(value = "删除指定日期之后的日志",notes = "系统日志按id区间查询")
|
||||
long deleteSysLogSystemByDateTimeAfter(String dateTime);
|
||||
|
||||
/******************************************************* 系统日志 End *********************************************************/
|
||||
|
||||
|
||||
/******************************************************* 定时任务日志 Start *********************************************************/
|
||||
@ApiOperation(value = "添加定时任务日志",notes = "添加定时任务日志")
|
||||
void insertSysLogTaskTime(SysLogTaskTime sysLogTaskTime);
|
||||
|
||||
@ApiOperation(value = "删除定时任务日志",notes = "删除定时任务日志")
|
||||
void deleteSysLogTaskTimeById(Long id);
|
||||
|
||||
@ApiOperation(value = "根据id查询定时任务日志",notes = "根据id查询定时任务日志")
|
||||
SysLogTaskTime getSysLogTaskTimeById(Long id);
|
||||
|
||||
@ApiOperation(value = "定时任务日志分页复杂查询",notes = "定时任务日志分页复杂查询")
|
||||
ListPager querySysLogTaskTimeByPager(SysLogTaskTime sysLogTaskTime, Pager pager);
|
||||
|
||||
@ApiOperation(value = "删除指定日期之后的日志",notes = "删除指定日期之后的日志")
|
||||
long deleteSysLogTaskTimeByDateTimeAfter(String dateTime);
|
||||
|
||||
/******************************************************* 定时任务日志 End *********************************************************/
|
||||
|
||||
|
||||
/********************************************************* 操作日志 Start *********************************************************/
|
||||
|
||||
@ApiOperation(value = "查询时间段内平均请求耗时",notes = "查询时间段内平均请求耗时")
|
||||
Map<String, Object> querySysLogSystemAvgExecuteTime(String startTime, String endTime);
|
||||
|
||||
@ApiOperation(value = "查询时间段内各等级日志数量",notes = "查询时间段内各等级日志数量")
|
||||
Map<String, Object> querySysLogSystemByLevel(String startTime, String endTime);
|
||||
|
||||
/******************************************************* 系统异常日志 End *********************************************************/
|
||||
|
||||
}
|
@ -1,54 +1,54 @@
|
||||
package cn.estsh.i3plus.core.api.iservice.busi;
|
||||
|
||||
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
import cn.estsh.i3plus.pojo.platform.platbean.SysLogSystem;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 系统日志服务接口
|
||||
* @Reference :
|
||||
* @Author : yunhao
|
||||
* @Date : 2018-10-25 10:36
|
||||
* @Modify :
|
||||
**/
|
||||
public interface ISysLogSystemService {
|
||||
|
||||
@ApiOperation(value = "添加系统日志",notes = "添加系统日志")
|
||||
void insertSysLogSystem(SysLogSystem logSystem);
|
||||
|
||||
@ApiOperation(value = "造数据系统日志",notes = "造数据")
|
||||
void insertSysLogBatch(int num,int waitTime);
|
||||
|
||||
@ApiOperation(value = "删除日志",notes = "删除日志")
|
||||
long deleteSysLogSystemById(Long id);
|
||||
|
||||
@ApiOperation(value = "查询全部日志",notes = "查询全部日志")
|
||||
List<SysLogSystem> listSysLogSystem();
|
||||
|
||||
@ApiOperation(value = "根据id查询系统日志",notes = "根据id查询系统日志")
|
||||
SysLogSystem getSysLogSystemById(long id);
|
||||
|
||||
@ApiOperation(value = "系统日志分页复杂查询",notes = "系统日志分页复杂查询")
|
||||
ListPager querySysLogSystemByPager(SysLogSystem logSystem, Pager pager);
|
||||
|
||||
@ApiOperation(value = "系统日志批量删除",notes = "系统日志批量删除")
|
||||
long deleteSysLogSystemByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 压力测试
|
||||
* @param min
|
||||
* @param max
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统日志按id区间查询",notes = "系统日志按id区间查询")
|
||||
List<SysLogSystem> findSysLogSystemByIdInterval(long min, long max);
|
||||
|
||||
/**
|
||||
* 删除指定日期之后的日志
|
||||
* @param dateTime 日期
|
||||
*/
|
||||
long deleteSysLogSystemByDateTimeAfter(String dateTime);
|
||||
}
|
||||
//package cn.estsh.i3plus.core.api.iservice.busi;
|
||||
//
|
||||
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
//import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
//import cn.estsh.i3plus.pojo.platform.platbean.SysLogSystem;
|
||||
//import io.swagger.annotations.ApiOperation;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @Description : 系统日志服务接口
|
||||
// * @Reference :
|
||||
// * @Author : yunhao
|
||||
// * @Date : 2018-10-25 10:36
|
||||
// * @Modify :
|
||||
// **/
|
||||
//public interface ISysLogSystemService {
|
||||
//
|
||||
// @ApiOperation(value = "添加系统日志",notes = "添加系统日志")
|
||||
// void insertSysLogSystem(SysLogSystem logSystem);
|
||||
//
|
||||
// @ApiOperation(value = "造数据系统日志",notes = "造数据")
|
||||
// void insertSysLogBatch(int num,int waitTime);
|
||||
//
|
||||
// @ApiOperation(value = "删除日志",notes = "删除日志")
|
||||
// long deleteSysLogSystemById(Long id);
|
||||
//
|
||||
// @ApiOperation(value = "查询全部日志",notes = "查询全部日志")
|
||||
// List<SysLogSystem> listSysLogSystem();
|
||||
//
|
||||
// @ApiOperation(value = "根据id查询系统日志",notes = "根据id查询系统日志")
|
||||
// SysLogSystem getSysLogSystemById(long id);
|
||||
//
|
||||
// @ApiOperation(value = "系统日志分页复杂查询",notes = "系统日志分页复杂查询")
|
||||
// ListPager querySysLogSystemByPager(SysLogSystem logSystem, Pager pager);
|
||||
//
|
||||
// @ApiOperation(value = "系统日志批量删除",notes = "系统日志批量删除")
|
||||
// long deleteSysLogSystemByIds(Long[] ids);
|
||||
//
|
||||
// /**
|
||||
// * 压力测试
|
||||
// * @param min
|
||||
// * @param max
|
||||
// * @return
|
||||
// */
|
||||
// @ApiOperation(value = "系统日志按id区间查询",notes = "系统日志按id区间查询")
|
||||
// List<SysLogSystem> findSysLogSystemByIdInterval(long min, long max);
|
||||
//
|
||||
// /**
|
||||
// * 删除指定日期之后的日志
|
||||
// * @param dateTime 日期
|
||||
// */
|
||||
// long deleteSysLogSystemByDateTimeAfter(String dateTime);
|
||||
//}
|
||||
|
@ -1,53 +1,53 @@
|
||||
package cn.estsh.i3plus.core.api.iservice.busi;
|
||||
|
||||
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
import cn.estsh.i3plus.pojo.platform.platbean.SysLogTaskTime;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* @Description : 定时任务日志服务接口
|
||||
* @Reference :
|
||||
* @Author : yunhao
|
||||
* @CreateDate : 2019-01-04 15:06
|
||||
* @Modify:
|
||||
**/
|
||||
public interface ISysLogTaskTimeService {
|
||||
|
||||
/**
|
||||
* 添加定时任务日志
|
||||
* @param sysLogTaskTime
|
||||
*/
|
||||
@ApiOperation(value = "添加定时任务日志",notes = "添加定时任务日志")
|
||||
void insertSysLogTaskTime(SysLogTaskTime sysLogTaskTime);
|
||||
|
||||
/**
|
||||
* 根据id删除定时任务日志
|
||||
* @param id
|
||||
*/
|
||||
@ApiOperation(value = "删除定时任务日志",notes = "删除定时任务日志")
|
||||
void deleteSysLogTaskTimeById(Long id);
|
||||
|
||||
/**
|
||||
* 根据id查询定时任务日志
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "根据id查询定时任务日志",notes = "根据id查询定时任务日志")
|
||||
SysLogTaskTime getSysLogTaskTimeById(Long id);
|
||||
|
||||
/**
|
||||
* 定时任务日志复杂查询
|
||||
* @param sysLogTaskTime
|
||||
* @param pager
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "定时任务日志分页复杂查询",notes = "定时任务日志分页复杂查询")
|
||||
ListPager querySysLogTaskTimeByPager(SysLogTaskTime sysLogTaskTime, Pager pager);
|
||||
|
||||
/**
|
||||
* 删除指定日期之后的日志
|
||||
* @param dateTime 日期
|
||||
*/
|
||||
long deleteSysLogTaskTimeByDateTimeAfter(String dateTime);
|
||||
}
|
||||
//package cn.estsh.i3plus.core.api.iservice.busi;
|
||||
//
|
||||
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
//import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
//import cn.estsh.i3plus.pojo.platform.platbean.SysLogTaskTime;
|
||||
//import io.swagger.annotations.ApiOperation;
|
||||
//
|
||||
///**
|
||||
// * @Description : 定时任务日志服务接口
|
||||
// * @Reference :
|
||||
// * @Author : yunhao
|
||||
// * @CreateDate : 2019-01-04 15:06
|
||||
// * @Modify:
|
||||
// **/
|
||||
//public interface ISysLogTaskTimeService {
|
||||
//
|
||||
// /**
|
||||
// * 添加定时任务日志
|
||||
// * @param sysLogTaskTime
|
||||
// */
|
||||
// @ApiOperation(value = "添加定时任务日志",notes = "添加定时任务日志")
|
||||
// void insertSysLogTaskTime(SysLogTaskTime sysLogTaskTime);
|
||||
//
|
||||
// /**
|
||||
// * 根据id删除定时任务日志
|
||||
// * @param id
|
||||
// */
|
||||
// @ApiOperation(value = "删除定时任务日志",notes = "删除定时任务日志")
|
||||
// void deleteSysLogTaskTimeById(Long id);
|
||||
//
|
||||
// /**
|
||||
// * 根据id查询定时任务日志
|
||||
// * @param id
|
||||
// * @return
|
||||
// */
|
||||
// @ApiOperation(value = "根据id查询定时任务日志",notes = "根据id查询定时任务日志")
|
||||
// SysLogTaskTime getSysLogTaskTimeById(Long id);
|
||||
//
|
||||
// /**
|
||||
// * 定时任务日志复杂查询
|
||||
// * @param sysLogTaskTime
|
||||
// * @param pager
|
||||
// * @return
|
||||
// */
|
||||
// @ApiOperation(value = "定时任务日志分页复杂查询",notes = "定时任务日志分页复杂查询")
|
||||
// ListPager querySysLogTaskTimeByPager(SysLogTaskTime sysLogTaskTime, Pager pager);
|
||||
//
|
||||
// /**
|
||||
// * 删除指定日期之后的日志
|
||||
// * @param dateTime 日期
|
||||
// */
|
||||
// long deleteSysLogTaskTimeByDateTimeAfter(String dateTime);
|
||||
//}
|
||||
|
@ -0,0 +1,34 @@
|
||||
package cn.estsh.i3plus.core.apiservice.configuration;
|
||||
|
||||
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
||||
import cn.estsh.i3plus.pojo.base.jpa.factory.BaseMongoRepositoryFactoryBean;
|
||||
import cn.estsh.i3plus.pojo.base.jpa.factory.BaseRepositoryFactoryBean;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||
|
||||
/**
|
||||
* @Description : 需要扫描其他包的配置文件
|
||||
* 此类专门添加需要单独加载的其他模块的包
|
||||
* @Reference :
|
||||
* @Author : alwaysfrin
|
||||
* @CreateDate : 2018-12-12 20:49
|
||||
* @Modify:
|
||||
**/
|
||||
@Configuration
|
||||
@ConditionalOnExpression("'${" + CommonConstWords.PROP_SWITCH_MONGO + ":false}' == 'true'")
|
||||
//扫描需要单独处理的持久化包
|
||||
@EnableMongoRepositories(basePackages = {
|
||||
"cn.estsh.i3plus.**.platrepositorymongo"
|
||||
},repositoryFactoryBeanClass = BaseMongoRepositoryFactoryBean.class)
|
||||
public class ScanMongoPackageConfiguration {
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(CommonConstWords.SYSTEM_LOG);
|
||||
|
||||
public ScanMongoPackageConfiguration(){
|
||||
LOGGER.info("【扫描关联包...】");
|
||||
}
|
||||
}
|
@ -1,31 +1,31 @@
|
||||
package cn.estsh.i3plus.core.apiservice.dao;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description : 操作日志
|
||||
* @Reference :
|
||||
* @Author : yunhao
|
||||
* @CreateDate : 2018-12-11 13:22
|
||||
* @Modify:
|
||||
**/
|
||||
public interface ISysLogSystemDao {
|
||||
|
||||
/**
|
||||
* 查询时间段内平均请求耗时
|
||||
*
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 查询结果
|
||||
*/
|
||||
Map<String, Object> querySysLogSystemAvgExecuteTime(String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 查询时间段内各等级日志数量
|
||||
*
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 查询结果
|
||||
*/
|
||||
Map<String, Object> querySysLogSystemByLevel(String startTime, String endTime);
|
||||
}
|
||||
//package cn.estsh.i3plus.core.apiservice.dao;
|
||||
//
|
||||
//import java.util.Map;
|
||||
//
|
||||
///**
|
||||
// * @Description : 操作日志
|
||||
// * @Reference :
|
||||
// * @Author : yunhao
|
||||
// * @CreateDate : 2018-12-11 13:22
|
||||
// * @Modify:
|
||||
// **/
|
||||
//public interface ISysLogSystemDao {
|
||||
//
|
||||
// /**
|
||||
// * 查询时间段内平均请求耗时
|
||||
// *
|
||||
// * @param startTime 开始时间
|
||||
// * @param endTime 结束时间
|
||||
// * @return 查询结果
|
||||
// */
|
||||
// Map<String, Object> querySysLogSystemAvgExecuteTime(String startTime, String endTime);
|
||||
//
|
||||
// /**
|
||||
// * 查询时间段内各等级日志数量
|
||||
// *
|
||||
// * @param startTime 开始时间
|
||||
// * @param endTime 结束时间
|
||||
// * @return 查询结果
|
||||
// */
|
||||
// Map<String, Object> querySysLogSystemByLevel(String startTime, String endTime);
|
||||
//}
|
||||
|
@ -1,100 +1,102 @@
|
||||
package cn.estsh.i3plus.core.apiservice.daoimpl;
|
||||
|
||||
import cn.estsh.i3plus.core.apiservice.dao.ISysLogSystemDao;
|
||||
import cn.estsh.i3plus.platform.common.tool.MathOperation;
|
||||
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.platform.platbean.SysLogSystem;
|
||||
import com.mongodb.client.AggregateIterable;
|
||||
import com.mongodb.client.MongoCursor;
|
||||
import org.bson.Document;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.mongodb.MongoDbFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description :
|
||||
* @Reference :
|
||||
* @Author : yunhao
|
||||
* @CreateDate : 2018-12-11 13:24
|
||||
* @Modify:
|
||||
**/
|
||||
@Service
|
||||
public class SysLogSystemDaoImpl implements ISysLogSystemDao {
|
||||
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(SysLogSystemDaoImpl.class);
|
||||
|
||||
@Autowired
|
||||
private MongoDbFactory mongoDbFactory;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> querySysLogSystemAvgExecuteTime(String startTime, String endTime) {
|
||||
// 筛选
|
||||
Document sub_match = new Document();
|
||||
sub_match.put("createDatetime", new Document("$gte", startTime).append("$lte", endTime));
|
||||
// 分组
|
||||
Document sub_group = new Document();
|
||||
sub_group.put("_id", "$createDatetime");
|
||||
sub_group.put("avg", new Document("$avg", "$executeTime"));
|
||||
|
||||
|
||||
Document match = new Document("$match", sub_match);
|
||||
Document group = new Document("$group", sub_group);
|
||||
Document sort = new Document("$sort", new Document("_id", -1));
|
||||
|
||||
List<Document> aggregateList = new ArrayList<>();
|
||||
aggregateList.add(match);
|
||||
aggregateList.add(group);
|
||||
aggregateList.add(sort);
|
||||
|
||||
AggregateIterable<Document> findIter = mongoDbFactory.getDb()
|
||||
.getCollection(StringTool.toLowerCaseFirstOne(SysLogSystem.class.getSimpleName()))
|
||||
.aggregate(aggregateList);
|
||||
MongoCursor<Document> cursor = findIter.iterator();
|
||||
|
||||
Map resultData = new LinkedHashMap();
|
||||
Document item_doc;
|
||||
while (cursor.hasNext()) {
|
||||
item_doc = cursor.next();
|
||||
resultData.put(item_doc.getString("_id"),MathOperation.round(item_doc.getDouble("avg"),0));
|
||||
}
|
||||
return resultData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Object> querySysLogSystemByLevel(String startTime, String endTime){
|
||||
// 筛选
|
||||
Document sub_match = new Document();
|
||||
sub_match.put("createDatetime", new Document("$gte", startTime).append("$lte", endTime));
|
||||
// 分组
|
||||
Document sub_group = new Document();
|
||||
sub_group.put("_id", "$logLevel");
|
||||
sub_group.put("count", new Document("$sum", 1));
|
||||
|
||||
Document match = new Document("$match", sub_match);
|
||||
Document group = new Document("$group", sub_group);
|
||||
|
||||
List<Document> aggregateList = new ArrayList<>();
|
||||
aggregateList.add(match);
|
||||
aggregateList.add(group);
|
||||
|
||||
AggregateIterable<Document> findIter = mongoDbFactory.getDb()
|
||||
.getCollection(StringTool.toLowerCaseFirstOne(SysLogSystem.class.getSimpleName()))
|
||||
.aggregate(aggregateList);
|
||||
MongoCursor<Document> cursor = findIter.iterator();
|
||||
|
||||
Map resultData = new LinkedHashMap();
|
||||
Document item_doc;
|
||||
while (cursor.hasNext()) {
|
||||
item_doc = cursor.next();
|
||||
resultData.put(ImppEnumUtil.LOG_LEVEL.valueOfName(item_doc.getInteger("_id")),MathOperation.round(item_doc.getInteger("count"),0));
|
||||
}
|
||||
|
||||
return resultData;
|
||||
}
|
||||
|
||||
}
|
||||
//package cn.estsh.i3plus.core.apiservice.daoimpl;
|
||||
//
|
||||
//import cn.estsh.i3plus.core.apiservice.dao.ISysLogSystemDao;
|
||||
//import cn.estsh.i3plus.platform.common.tool.MathOperation;
|
||||
//import cn.estsh.i3plus.platform.common.tool.StringTool;
|
||||
//import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
|
||||
//import cn.estsh.i3plus.pojo.platform.platbean.SysLogSystem;
|
||||
//import com.mongodb.client.AggregateIterable;
|
||||
//import com.mongodb.client.MongoCursor;
|
||||
//import org.bson.Document;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.data.mongodb.MongoDbFactory;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//import java.util.*;
|
||||
//
|
||||
///**
|
||||
// * @Description :
|
||||
// * @Reference :
|
||||
// * @Author : yunhao
|
||||
// * @CreateDate : 2018-12-11 13:24
|
||||
// * @Modify:
|
||||
// **/
|
||||
//@Service
|
||||
//public class SysLogSystemDaoImpl implements ISysLogSystemDao {
|
||||
//
|
||||
// public static final Logger LOGGER = LoggerFactory.getLogger(SysLogSystemDaoImpl.class);
|
||||
//
|
||||
//// @Autowired
|
||||
//// private MongoDbFactory mongoDbFactory;
|
||||
//
|
||||
// @Override
|
||||
// public Map<String, Object> querySysLogSystemAvgExecuteTime(String startTime, String endTime) {
|
||||
// // 筛选
|
||||
//// Document sub_match = new Document();
|
||||
//// sub_match.put("createDatetime", new Document("$gte", startTime).append("$lte", endTime));
|
||||
//// // 分组
|
||||
//// Document sub_group = new Document();
|
||||
//// sub_group.put("_id", "$createDatetime");
|
||||
//// sub_group.put("avg", new Document("$avg", "$executeTime"));
|
||||
////
|
||||
////
|
||||
//// Document match = new Document("$match", sub_match);
|
||||
//// Document group = new Document("$group", sub_group);
|
||||
//// Document sort = new Document("$sort", new Document("_id", -1));
|
||||
////
|
||||
//// List<Document> aggregateList = new ArrayList<>();
|
||||
//// aggregateList.add(match);
|
||||
//// aggregateList.add(group);
|
||||
//// aggregateList.add(sort);
|
||||
////
|
||||
//// AggregateIterable<Document> findIter = mongoDbFactory.getDb()
|
||||
//// .getCollection(StringTool.toLowerCaseFirstOne(SysLogSystem.class.getSimpleName()))
|
||||
//// .aggregate(aggregateList);
|
||||
//// MongoCursor<Document> cursor = findIter.iterator();
|
||||
////
|
||||
//// Map resultData = new LinkedHashMap();
|
||||
//// Document item_doc;
|
||||
//// while (cursor.hasNext()) {
|
||||
//// item_doc = cursor.next();
|
||||
//// resultData.put(item_doc.getString("_id"),MathOperation.round(item_doc.getDouble("avg"),0));
|
||||
//// }
|
||||
//// return resultData;
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Map<String,Object> querySysLogSystemByLevel(String startTime, String endTime){
|
||||
//// // 筛选
|
||||
//// Document sub_match = new Document();
|
||||
//// sub_match.put("createDatetime", new Document("$gte", startTime).append("$lte", endTime));
|
||||
//// // 分组
|
||||
//// Document sub_group = new Document();
|
||||
//// sub_group.put("_id", "$logLevel");
|
||||
//// sub_group.put("count", new Document("$sum", 1));
|
||||
////
|
||||
//// Document match = new Document("$match", sub_match);
|
||||
//// Document group = new Document("$group", sub_group);
|
||||
////
|
||||
//// List<Document> aggregateList = new ArrayList<>();
|
||||
//// aggregateList.add(match);
|
||||
//// aggregateList.add(group);
|
||||
////
|
||||
//// AggregateIterable<Document> findIter = mongoDbFactory.getDb()
|
||||
//// .getCollection(StringTool.toLowerCaseFirstOne(SysLogSystem.class.getSimpleName()))
|
||||
//// .aggregate(aggregateList);
|
||||
//// MongoCursor<Document> cursor = findIter.iterator();
|
||||
////
|
||||
//// Map resultData = new LinkedHashMap();
|
||||
//// Document item_doc;
|
||||
//// while (cursor.hasNext()) {
|
||||
//// item_doc = cursor.next();
|
||||
//// resultData.put(ImppEnumUtil.LOG_LEVEL.valueOfName(item_doc.getInteger("_id")),MathOperation.round(item_doc.getInteger("count"),0));
|
||||
//// }
|
||||
////
|
||||
//// return resultData;
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
@ -1,50 +1,52 @@
|
||||
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.core.api.iservice.busi.ISysLogExceptionService;
|
||||
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
||||
import cn.estsh.i3plus.pojo.platform.platbean.SysLogException;
|
||||
import cn.estsh.i3plus.pojo.platform.platrepositorymongo.SysLogExceptionRepository;
|
||||
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreBsonPack;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.bson.conversions.Bson;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description :异常日志服务接口实现
|
||||
* @Reference :
|
||||
* @Author : yunhao
|
||||
* @CreateDate : 2018-11-19 17:30
|
||||
* @Modify:
|
||||
**/
|
||||
@Service
|
||||
public class SysLogExceptionService implements ISysLogExceptionService {
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(SysLogExceptionService.class);
|
||||
|
||||
@Autowired
|
||||
private SysLogExceptionRepository sysLogExceptionRDao;
|
||||
|
||||
@Override
|
||||
@ApiOperation(value = "系统异常日志复杂查询,分页,排序")
|
||||
public ListPager<SysLogException> querySysLogExceptionByPager(SysLogException sysLogException, Pager pager) {
|
||||
if(sysLogException == null) {
|
||||
pager = PagerHelper.getPager(pager, (int) sysLogExceptionRDao.count());
|
||||
return new ListPager(sysLogExceptionRDao.findAll(),pager);
|
||||
}else{
|
||||
Bson bson = CoreBsonPack.packBsonBySysLogException(sysLogException);
|
||||
pager = PagerHelper.getPager(pager,sysLogExceptionRDao.findByBsonCount(bson));
|
||||
//分页,排序
|
||||
return new ListPager(sysLogExceptionRDao.findByBsonPager(bson,pager,sysLogException.getOrderByParam()
|
||||
,sysLogException.getAscOrDesc()),pager);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long deleteSysLogExceptionByDateTimeAfter(String dateTime) {
|
||||
return sysLogExceptionRDao.deleteByProperty(CoreBsonPack.packBsonByDateTimeAfter(dateTime));
|
||||
}
|
||||
}
|
||||
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||
//
|
||||
//import cn.estsh.i3plus.core.api.iservice.busi.ISysLogExceptionService;
|
||||
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
//import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
//import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
||||
//import cn.estsh.i3plus.pojo.platform.platbean.SysLogException;
|
||||
//import cn.estsh.i3plus.pojo.platform.platrepositorymongo.SysLogExceptionRepository;
|
||||
//import cn.estsh.i3plus.pojo.platform.sqlpack.CoreBsonPack;
|
||||
//import io.swagger.annotations.ApiOperation;
|
||||
//import org.bson.conversions.Bson;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
///**
|
||||
// * @Description :异常日志服务接口实现
|
||||
// * @Reference :
|
||||
// * @Author : yunhao
|
||||
// * @CreateDate : 2018-11-19 17:30
|
||||
// * @Modify:
|
||||
// **/
|
||||
//@Service
|
||||
//public class SysLogExceptionService implements ISysLogExceptionService {
|
||||
// public static final Logger LOGGER = LoggerFactory.getLogger(SysLogExceptionService.class);
|
||||
//
|
||||
//// @Autowired
|
||||
//// private SysLogExceptionRepository sysLogExceptionRDao;
|
||||
//
|
||||
// @Override
|
||||
// @ApiOperation(value = "系统异常日志复杂查询,分页,排序")
|
||||
// public ListPager<SysLogException> querySysLogExceptionByPager(SysLogException sysLogException, Pager pager) {
|
||||
//// if(sysLogException == null) {
|
||||
//// pager = PagerHelper.getPager(pager, (int) sysLogExceptionRDao.count());
|
||||
//// return new ListPager(sysLogExceptionRDao.findAll(),pager);
|
||||
//// }else{
|
||||
//// Bson bson = CoreBsonPack.packBsonBySysLogException(sysLogException);
|
||||
//// pager = PagerHelper.getPager(pager,sysLogExceptionRDao.findByBsonCount(bson));
|
||||
//// //分页,排序
|
||||
//// return new ListPager(sysLogExceptionRDao.findByBsonPager(bson,pager,sysLogException.getOrderByParam()
|
||||
//// ,sysLogException.getAscOrDesc()),pager);
|
||||
//// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public long deleteSysLogExceptionByDateTimeAfter(String dateTime) {
|
||||
//// return sysLogExceptionRDao.deleteByProperty(CoreBsonPack.packBsonByDateTimeAfter(dateTime));
|
||||
// return 0;
|
||||
// }
|
||||
//}
|
||||
|
@ -1,107 +1,115 @@
|
||||
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.core.api.iservice.busi.ISysLogOperateService;
|
||||
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.platform.platbean.SysLogOperate;
|
||||
import cn.estsh.i3plus.pojo.platform.platrepositorymongo.SysLogOperateRepository;
|
||||
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreBsonPack;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.bson.conversions.Bson;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 操作日志服务接口实现
|
||||
* @Reference :
|
||||
* @Author : yunhao
|
||||
* @Date : 2018-10-25 13:54
|
||||
* @Modify :
|
||||
**/
|
||||
@Service
|
||||
public class SysLogOperateService implements ISysLogOperateService {
|
||||
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(SysLogOperateService.class);
|
||||
|
||||
@Autowired
|
||||
public SysLogOperateRepository logOperateRDao;
|
||||
|
||||
@Override
|
||||
@ApiOperation(value = "添加操作日志",notes = "添加操作日志")
|
||||
public SysLogOperate insertSysLogOperate(SysLogOperate logOperate) {
|
||||
return logOperateRDao.insert(logOperate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ApiOperation(value = "根据id删除日志",notes = "根据id删除日志")
|
||||
public void deleteSysLogOperateById(Long id) {
|
||||
logOperateRDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ApiOperation(value = "查询全部操作日志",notes = "查询全部操作日志")
|
||||
public List listSysLogOperate() {
|
||||
return logOperateRDao.listPager(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSysLogOperateByIds(Long[] ids) {
|
||||
for(Long id : ids){
|
||||
logOperateRDao.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ApiOperation(value = "根据id查询操作日志",notes = "根据id查询操作日志")
|
||||
public SysLogOperate getSysLogOperateById(Long id) {
|
||||
return logOperateRDao.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ApiOperation(value = "根据操作人姓名模糊查询日志",notes = "根据操作人姓名模糊查询日志")
|
||||
public List<SysLogOperate> listSysLogOperateByOperateUserName(String operateUserName) {
|
||||
return logOperateRDao.findByProperty("operateUserName",operateUserName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ApiOperation(value = "查询所有日志数量")
|
||||
public long countAllSysLogOperate() {
|
||||
return logOperateRDao.listCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ApiOperation(value = "操作日志复杂查询,分页,排序",notes = "操作日志复杂查询,分页,排序")
|
||||
public ListPager<SysLogOperate> querySysLogOperateByPager(SysLogOperate logOperate, Pager pager) {
|
||||
if(logOperate == null) {
|
||||
pager = PagerHelper.getPager(pager, (int) logOperateRDao.count());
|
||||
return new ListPager(logOperateRDao.findAll(),pager);
|
||||
}else{
|
||||
Bson bson = CoreBsonPack.packBsonByLogOperate(logOperate);
|
||||
pager = PagerHelper.getPager(pager,logOperateRDao.findByBsonCount(bson));
|
||||
//分页,排序
|
||||
return new ListPager(logOperateRDao.findByBsonPager(bson,pager,logOperate.getOrderByParam(),logOperate.getAscOrDesc()),pager);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysLogOperate> findNewSysLogOperate(Integer num) {
|
||||
Pager page = new Pager();
|
||||
page.setCurrentPage(1);
|
||||
page.setPageSize(num);
|
||||
SysLogOperate sysLogOperate = new SysLogOperate();
|
||||
sysLogOperate.setOrderByParam("createDatetime");
|
||||
sysLogOperate.setAscOrDesc(CommonEnumUtil.ASC_OR_DESC.DESC.getValue());
|
||||
return logOperateRDao.findByBsonPager(null,page,sysLogOperate.getOrderByParam(),sysLogOperate.getAscOrDesc());
|
||||
}
|
||||
|
||||
@Override
|
||||
public long deleteSysLogOperateByDateTimeAfter(String dateTime) {
|
||||
return logOperateRDao.deleteByProperty(CoreBsonPack.packBsonByDateTimeAfter(dateTime));
|
||||
}
|
||||
}
|
||||
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||
//
|
||||
//import cn.estsh.i3plus.core.api.iservice.busi.ISysLogOperateService;
|
||||
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
//import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
//import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
||||
//import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
//import cn.estsh.i3plus.pojo.platform.platbean.SysLogOperate;
|
||||
//import cn.estsh.i3plus.pojo.platform.platrepositorymongo.SysLogOperateRepository;
|
||||
//import cn.estsh.i3plus.pojo.platform.sqlpack.CoreBsonPack;
|
||||
//import io.swagger.annotations.ApiOperation;
|
||||
//import org.bson.conversions.Bson;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @Description : 操作日志服务接口实现
|
||||
// * @Reference :
|
||||
// * @Author : yunhao
|
||||
// * @Date : 2018-10-25 13:54
|
||||
// * @Modify :
|
||||
// **/
|
||||
//@Service
|
||||
//public class SysLogOperateService implements ISysLogOperateService {
|
||||
//
|
||||
// public static final Logger LOGGER = LoggerFactory.getLogger(SysLogOperateService.class);
|
||||
//
|
||||
//// @Autowired
|
||||
//// public SysLogOperateRepository logOperateRDao;
|
||||
//
|
||||
// @Override
|
||||
// @ApiOperation(value = "添加操作日志",notes = "添加操作日志")
|
||||
// public SysLogOperate insertSysLogOperate(SysLogOperate logOperate) {
|
||||
//// return logOperateRDao.insert(logOperate);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @ApiOperation(value = "根据id删除日志",notes = "根据id删除日志")
|
||||
// public void deleteSysLogOperateById(Long id) {
|
||||
//// logOperateRDao.deleteById(id);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @ApiOperation(value = "查询全部操作日志",notes = "查询全部操作日志")
|
||||
// public List listSysLogOperate() {
|
||||
//// return logOperateRDao.listPager(null);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void deleteSysLogOperateByIds(Long[] ids) {
|
||||
// for(Long id : ids){
|
||||
//// logOperateRDao.deleteById(id);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @ApiOperation(value = "根据id查询操作日志",notes = "根据id查询操作日志")
|
||||
// public SysLogOperate getSysLogOperateById(Long id) {
|
||||
//// return logOperateRDao.getById(id);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @ApiOperation(value = "根据操作人姓名模糊查询日志",notes = "根据操作人姓名模糊查询日志")
|
||||
// public List<SysLogOperate> listSysLogOperateByOperateUserName(String operateUserName) {
|
||||
//// return logOperateRDao.findByProperty("operateUserName",operateUserName);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @ApiOperation(value = "查询所有日志数量")
|
||||
// public long countAllSysLogOperate() {
|
||||
//// return logOperateRDao.listCount();
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @ApiOperation(value = "操作日志复杂查询,分页,排序",notes = "操作日志复杂查询,分页,排序")
|
||||
// public ListPager<SysLogOperate> querySysLogOperateByPager(SysLogOperate logOperate, Pager pager) {
|
||||
//// if(logOperate == null) {
|
||||
//// pager = PagerHelper.getPager(pager, (int) logOperateRDao.count());
|
||||
//// return new ListPager(logOperateRDao.findAll(),pager);
|
||||
//// }else{
|
||||
//// Bson bson = CoreBsonPack.packBsonByLogOperate(logOperate);
|
||||
//// pager = PagerHelper.getPager(pager,logOperateRDao.findByBsonCount(bson));
|
||||
//// //分页,排序
|
||||
//// return new ListPager(logOperateRDao.findByBsonPager(bson,pager,logOperate.getOrderByParam(),logOperate.getAscOrDesc()),pager);
|
||||
//// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<SysLogOperate> findNewSysLogOperate(Integer num) {
|
||||
// Pager page = new Pager();
|
||||
// page.setCurrentPage(1);
|
||||
// page.setPageSize(num);
|
||||
// SysLogOperate sysLogOperate = new SysLogOperate();
|
||||
// sysLogOperate.setOrderByParam("createDatetime");
|
||||
// sysLogOperate.setAscOrDesc(CommonEnumUtil.ASC_OR_DESC.DESC.getValue());
|
||||
//// return logOperateRDao.findByBsonPager(null,page,sysLogOperate.getOrderByParam(),sysLogOperate.getAscOrDesc());
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public long deleteSysLogOperateByDateTimeAfter(String dateTime) {
|
||||
//// return logOperateRDao.deleteByProperty(CoreBsonPack.packBsonByDateTimeAfter(dateTime));
|
||||
// return 0;
|
||||
// }
|
||||
//}
|
||||
|
@ -1,68 +1,71 @@
|
||||
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.core.api.iservice.busi.ISysLogTaskTimeService;
|
||||
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
||||
import cn.estsh.i3plus.pojo.platform.platbean.SysLogSystem;
|
||||
import cn.estsh.i3plus.pojo.platform.platbean.SysLogTaskTime;
|
||||
import cn.estsh.i3plus.pojo.platform.platrepositorymongo.SysLogTaskTimeRepository;
|
||||
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreBsonPack;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.bson.conversions.Bson;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description : 定时任务服务接口实现
|
||||
* @Reference :
|
||||
* @Author : yunhao
|
||||
* @CreateDate : 2019-01-04 15:10
|
||||
* @Modify:
|
||||
**/
|
||||
@Service
|
||||
public class SysLogTaskTimeService implements ISysLogTaskTimeService {
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(SysLogTaskTimeService.class);
|
||||
|
||||
@Autowired
|
||||
private SysLogTaskTimeRepository sysLogTaskTimeRDao;
|
||||
|
||||
@Override
|
||||
@ApiOperation(value = "添加定时任务日志",notes = "添加定时任务日志")
|
||||
public void insertSysLogTaskTime(SysLogTaskTime sysLogTaskTime) {
|
||||
sysLogTaskTimeRDao.insert(sysLogTaskTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ApiOperation(value = "删除定时任务日志",notes = "删除定时任务日志")
|
||||
public void deleteSysLogTaskTimeById(Long id) {
|
||||
sysLogTaskTimeRDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ApiOperation(value = "根据id查询定时任务日志",notes = "根据id查询定时任务日志")
|
||||
public SysLogTaskTime getSysLogTaskTimeById(Long id) {
|
||||
return sysLogTaskTimeRDao.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ApiOperation(value = "定时任务日志分页复杂查询",notes = "定时任务日志分页复杂查询")
|
||||
public ListPager querySysLogTaskTimeByPager(SysLogTaskTime sysLogTaskTime, Pager pager) {
|
||||
if (sysLogTaskTime == null) {
|
||||
pager = PagerHelper.getPager(pager,sysLogTaskTimeRDao.listCount());
|
||||
return new ListPager(sysLogTaskTimeRDao.listPager(pager),pager);
|
||||
} else {
|
||||
Bson bson = CoreBsonPack.packBsonByLogTaskTime(sysLogTaskTime);
|
||||
pager = PagerHelper.getPager(pager,sysLogTaskTimeRDao.findByBsonCount(bson));
|
||||
return new ListPager(sysLogTaskTimeRDao.findByBsonPager(bson,pager,sysLogTaskTime.getOrderByParam()
|
||||
,sysLogTaskTime.getAscOrDesc()),pager);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long deleteSysLogTaskTimeByDateTimeAfter(String dateTime) {
|
||||
return sysLogTaskTimeRDao.deleteByProperty(CoreBsonPack.packBsonByDateTimeAfter(dateTime));
|
||||
}
|
||||
}
|
||||
//package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||
//
|
||||
//import cn.estsh.i3plus.core.api.iservice.busi.ISysLogTaskTimeService;
|
||||
//import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
//import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
//import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
||||
//import cn.estsh.i3plus.pojo.platform.platbean.SysLogSystem;
|
||||
//import cn.estsh.i3plus.pojo.platform.platbean.SysLogTaskTime;
|
||||
//import cn.estsh.i3plus.pojo.platform.platrepositorymongo.SysLogTaskTimeRepository;
|
||||
//import cn.estsh.i3plus.pojo.platform.sqlpack.CoreBsonPack;
|
||||
//import io.swagger.annotations.ApiOperation;
|
||||
//import org.bson.conversions.Bson;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
///**
|
||||
// * @Description : 定时任务服务接口实现
|
||||
// * @Reference :
|
||||
// * @Author : yunhao
|
||||
// * @CreateDate : 2019-01-04 15:10
|
||||
// * @Modify:
|
||||
// **/
|
||||
//@Service
|
||||
//public class SysLogTaskTimeService implements ISysLogTaskTimeService {
|
||||
// public static final Logger LOGGER = LoggerFactory.getLogger(SysLogTaskTimeService.class);
|
||||
//
|
||||
//// @Autowired
|
||||
//// private SysLogTaskTimeRepository sysLogTaskTimeRDao;
|
||||
//
|
||||
// @Override
|
||||
// @ApiOperation(value = "添加定时任务日志",notes = "添加定时任务日志")
|
||||
// public void insertSysLogTaskTime(SysLogTaskTime sysLogTaskTime) {
|
||||
//// sysLogTaskTimeRDao.insert(sysLogTaskTime);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @ApiOperation(value = "删除定时任务日志",notes = "删除定时任务日志")
|
||||
// public void deleteSysLogTaskTimeById(Long id) {
|
||||
//// sysLogTaskTimeRDao.deleteById(id);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @ApiOperation(value = "根据id查询定时任务日志",notes = "根据id查询定时任务日志")
|
||||
// public SysLogTaskTime getSysLogTaskTimeById(Long id) {
|
||||
//// return sysLogTaskTimeRDao.getById(id);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @ApiOperation(value = "定时任务日志分页复杂查询",notes = "定时任务日志分页复杂查询")
|
||||
// public ListPager querySysLogTaskTimeByPager(SysLogTaskTime sysLogTaskTime, Pager pager) {
|
||||
//// if (sysLogTaskTime == null) {
|
||||
//// pager = PagerHelper.getPager(pager,sysLogTaskTimeRDao.listCount());
|
||||
//// return new ListPager(sysLogTaskTimeRDao.listPager(pager),pager);
|
||||
//// } else {
|
||||
//// Bson bson = CoreBsonPack.packBsonByLogTaskTime(sysLogTaskTime);
|
||||
//// pager = PagerHelper.getPager(pager,sysLogTaskTimeRDao.findByBsonCount(bson));
|
||||
//// return new ListPager(sysLogTaskTimeRDao.findByBsonPager(bson,pager,sysLogTaskTime.getOrderByParam()
|
||||
//// ,sysLogTaskTime.getAscOrDesc()),pager);
|
||||
//// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public long deleteSysLogTaskTimeByDateTimeAfter(String dateTime) {
|
||||
//// return sysLogTaskTimeRDao.deleteByProperty(CoreBsonPack.packBsonByDateTimeAfter(dateTime));
|
||||
// return 0;
|
||||
// }
|
||||
//}
|
||||
|
Loading…
Reference in New Issue