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