|
|
|
@ -15,7 +15,6 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.time.YearMonth; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -51,8 +50,11 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
for (SysLogStatisticsVo sysLogStatisticsVo : sysLogStatisticsVoList) { |
|
|
|
|
if (StringUtils.isBlank(sysLogStatisticsVo.getModuleName())){ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
//查询数据
|
|
|
|
|
Statistics statistics = statisticsService.getStatisticsBydateCalculated(sysLogStatisticsVo.getOperationTime()); |
|
|
|
|
Statistics statistics = statisticsService.getStatisticsBydateCalculated(sysLogStatisticsVo); |
|
|
|
|
//如果为空保存数据,如果不为空更新数据
|
|
|
|
|
if (statistics == null) { |
|
|
|
|
statistics = new Statistics(); |
|
|
|
@ -61,16 +63,16 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist
|
|
|
|
|
statistics.setTitle(sysLogStatisticsVo.getTitle()); |
|
|
|
|
statistics.setModuleName(sysLogStatisticsVo.getModuleName()); |
|
|
|
|
statistics.setPath(sysLogStatisticsVo.getPath()); |
|
|
|
|
statistics.setTitleNum(sysLogStatisticsVo.getTitleCount()); |
|
|
|
|
statistics.setPathNum(sysLogStatisticsVo.getPathCount()); |
|
|
|
|
// statistics.setTitleNum(sysLogStatisticsVo.getTitleCount());
|
|
|
|
|
// statistics.setPathNum(sysLogStatisticsVo.getPathCount());
|
|
|
|
|
statisticsService.save(statistics); |
|
|
|
|
} else { |
|
|
|
|
statistics.setTitle(sysLogStatisticsVo.getTitle()); |
|
|
|
|
statistics.setModuleName(sysLogStatisticsVo.getModuleName()); |
|
|
|
|
statistics.setPath(sysLogStatisticsVo.getPath()); |
|
|
|
|
statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount()); |
|
|
|
|
statistics.setTitleNum(sysLogStatisticsVo.getTitleCount()); |
|
|
|
|
statistics.setPathNum(sysLogStatisticsVo.getPathCount()); |
|
|
|
|
//statistics.setTitleNum(sysLogStatisticsVo.getTitleCount());
|
|
|
|
|
//statistics.setPathNum(sysLogStatisticsVo.getPathCount());
|
|
|
|
|
statisticsService.updateById(statistics); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -79,13 +81,14 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist
|
|
|
|
|
/** |
|
|
|
|
* 根据时间查询数据 |
|
|
|
|
* |
|
|
|
|
* @param operationTime |
|
|
|
|
* @param sysLogStatistics |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public Statistics getStatisticsBydateCalculated(String operationTime) { |
|
|
|
|
public Statistics getStatisticsBydateCalculated(SysLogStatisticsVo sysLogStatistics) { |
|
|
|
|
QueryWrapper<Statistics> statisticsQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
statisticsQueryWrapper.eq("date_calculated", operationTime); |
|
|
|
|
statisticsQueryWrapper.eq("date_calculated", sysLogStatistics.getOperationTime()); |
|
|
|
|
statisticsQueryWrapper.eq("module_name", sysLogStatistics.getModuleName()); |
|
|
|
|
return baseMapper.selectOne(statisticsQueryWrapper); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -101,11 +104,10 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist
|
|
|
|
|
public IPage<Statistics> selectPage(Page<Statistics> page1, StatisticsVo statistics) { |
|
|
|
|
QueryWrapper<Statistics> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
//开始时间
|
|
|
|
|
queryWrapper.lambda().ge(StringUtils.isNotEmpty(statistics.getCreateTime()),Statistics::getDateCalculated, |
|
|
|
|
statistics.getCreateTime()); |
|
|
|
|
queryWrapper.lambda().ge(StringUtils.isNotEmpty(statistics.getCreateTime()), Statistics::getDateCalculated, statistics.getCreateTime()); |
|
|
|
|
//结束时间
|
|
|
|
|
queryWrapper.lambda().le(StringUtils.isNotEmpty(statistics.getEndTime()),Statistics::getDateCalculated, |
|
|
|
|
statistics.getEndTime()); |
|
|
|
|
queryWrapper.lambda().le(StringUtils.isNotEmpty(statistics.getEndTime()), Statistics::getDateCalculated, statistics.getEndTime()); |
|
|
|
|
queryWrapper.lambda().orderByDesc(Statistics::getDateCalculated); |
|
|
|
|
IPage<Statistics> statisticsPage = baseMapper.selectPage(page1, queryWrapper); |
|
|
|
|
return statisticsPage; |
|
|
|
|
} |
|
|
|
|