|
|
@ -3,6 +3,7 @@ package com.hnac.hzims.middle.systemlog.service.impl; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.hnac.hzims.middle.systemlog.entity.Statistics; |
|
|
|
import com.hnac.hzims.middle.systemlog.entity.Statistics; |
|
|
|
import com.hnac.hzims.middle.systemlog.mapper.StatisticsMapper; |
|
|
|
import com.hnac.hzims.middle.systemlog.mapper.StatisticsMapper; |
|
|
|
import com.hnac.hzims.middle.systemlog.service.StatisticsService; |
|
|
|
import com.hnac.hzims.middle.systemlog.service.StatisticsService; |
|
|
@ -17,7 +18,10 @@ import org.apache.xmlbeans.StringEnumAbstractBase; |
|
|
|
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.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
@ -56,11 +60,13 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist |
|
|
|
//如果为空保存数据,如果不为空更新数据
|
|
|
|
//如果为空保存数据,如果不为空更新数据
|
|
|
|
if (statistics == null) { |
|
|
|
if (statistics == null) { |
|
|
|
statistics = new Statistics(); |
|
|
|
statistics = new Statistics(); |
|
|
|
|
|
|
|
statistics.setSort(getModuleName(sysLogStatisticsVo.getModuleName())); |
|
|
|
statistics.setDateCalculated(sysLogStatisticsVo.getOperationTime()); |
|
|
|
statistics.setDateCalculated(sysLogStatisticsVo.getOperationTime()); |
|
|
|
statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount()); |
|
|
|
statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount()); |
|
|
|
statistics.setModuleName(sysLogStatisticsVo.getModuleName()); |
|
|
|
statistics.setModuleName(sysLogStatisticsVo.getModuleName()); |
|
|
|
this.save(statistics); |
|
|
|
this.save(statistics); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
statistics.setSort(getModuleName(sysLogStatisticsVo.getModuleName())); |
|
|
|
statistics.setModuleName(sysLogStatisticsVo.getModuleName()); |
|
|
|
statistics.setModuleName(sysLogStatisticsVo.getModuleName()); |
|
|
|
statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount()); |
|
|
|
statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount()); |
|
|
|
this.updateById(statistics); |
|
|
|
this.updateById(statistics); |
|
|
@ -94,7 +100,33 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist |
|
|
|
public IPage<StatisticsResponseVo> selectPage(Page<StatisticsResponseVo> page1, StatisticsVo statistics) { |
|
|
|
public IPage<StatisticsResponseVo> selectPage(Page<StatisticsResponseVo> page1, StatisticsVo statistics) { |
|
|
|
statistics.setCreateTime(statistics.getCreateTime().substring(0, 10)); |
|
|
|
statistics.setCreateTime(statistics.getCreateTime().substring(0, 10)); |
|
|
|
statistics.setEndTime(statistics.getEndTime().substring(0, 10)); |
|
|
|
statistics.setEndTime(statistics.getEndTime().substring(0, 10)); |
|
|
|
return baseMapper.selectPages(page1, statistics); |
|
|
|
IPage<StatisticsResponseVo> statisticsResponseVoIPage = baseMapper.selectPages(page1, statistics); |
|
|
|
|
|
|
|
// List<StatisticsResponseVo> records = statisticsResponseVoIPage.getRecords();
|
|
|
|
|
|
|
|
// List<StatisticsResponseVo> collect = records.stream().sorted(Comparator.comparing(StatisticsResponseVo::getSort)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
// statisticsResponseVoIPage.setRecords(collect);
|
|
|
|
|
|
|
|
return statisticsResponseVoIPage; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 排序 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static int getModuleName(String moduleName) { |
|
|
|
|
|
|
|
List<String> moduleNames = Lists.newArrayList("集中监控", |
|
|
|
|
|
|
|
"综合调度", "视频集中监控", "实时监控", "视频监控", "演示大屏", "生态监控", |
|
|
|
|
|
|
|
"数据分析", "数据查询", "通讯告警统计", "气象监测", "我的事务", "值班管理", |
|
|
|
|
|
|
|
"缺陷管理", "两票管理", "巡检管理", "日常维护", "检修管理", "数据填报", "安全管理", "设备管理", |
|
|
|
|
|
|
|
"资产管理", "智能诊断", "生产月报", "告警配置","电站安全标准", "站点管理", "实时画面", "资源配置", "消息管理", |
|
|
|
|
|
|
|
"移动端配置", "水电站管理", "告警配置"); |
|
|
|
|
|
|
|
int result = 0; |
|
|
|
|
|
|
|
for (int i = 0; i < moduleNames.size(); i++) { |
|
|
|
|
|
|
|
String name = moduleNames.get(i); |
|
|
|
|
|
|
|
if (name.equals(moduleName)) { |
|
|
|
|
|
|
|
result = i + 1; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|