|
|
|
@ -1,13 +1,17 @@
|
|
|
|
|
package com.shxy.xymanager_service.impl;
|
|
|
|
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.shxy.xymanager_common.bean.PermissionDetail;
|
|
|
|
|
import com.shxy.xymanager_common.entity.*;
|
|
|
|
|
import com.shxy.xymanager_common.model.StatTerm;
|
|
|
|
|
import com.shxy.xymanager_dao.dao.*;
|
|
|
|
|
import com.shxy.xymanager_service.service.NewCacheService;
|
|
|
|
|
import com.shxy.xymanager_service.service.PermissionService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
@ -28,6 +32,8 @@ public class NewCacheServiceImpl implements NewCacheService {
|
|
|
|
|
TowerDao towerDao;
|
|
|
|
|
@Resource
|
|
|
|
|
TerminalsDao terminalsDao;
|
|
|
|
|
@Resource
|
|
|
|
|
MntnRawReportsMapper rawReportsMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -217,4 +223,35 @@ public class NewCacheServiceImpl implements NewCacheService {
|
|
|
|
|
Terminals terminal = terminalsDao.selectByPrimaryKey(termId);
|
|
|
|
|
return terminal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Cacheable(value = "cacheStatTerm", key = "#termId + #start")
|
|
|
|
|
public StatTerm getOneDayStat(Integer termId, Long start) {
|
|
|
|
|
StatTerm stat = null;
|
|
|
|
|
Long end = start + 60 * 60 * 24;
|
|
|
|
|
|
|
|
|
|
MntnRawReportsExample example = new MntnRawReportsExample();
|
|
|
|
|
MntnRawReportsExample.Criteria criteria = example.createCriteria();
|
|
|
|
|
criteria.andTermIdEqualTo(termId);
|
|
|
|
|
criteria.andCreateTimeGreaterThanOrEqualTo(start);
|
|
|
|
|
criteria.andCreateTimeLessThan(end);
|
|
|
|
|
example.setOrderByClause("create_time desc");
|
|
|
|
|
PageHelper.startPage(1, 1);
|
|
|
|
|
List<MntnRawReports> reportsList = rawReportsMapper.selectByExample(example);
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(reportsList)) {
|
|
|
|
|
MntnRawReports reports = reportsList.get(0);
|
|
|
|
|
reports.makeRawReport();
|
|
|
|
|
|
|
|
|
|
stat = new StatTerm();
|
|
|
|
|
stat.setTermId(termId);
|
|
|
|
|
stat.setUploads(reports.getReportMap().get("uploads"));
|
|
|
|
|
}
|
|
|
|
|
return stat;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@CacheEvict(cacheNames = {"cacheStatTerm"}, allEntries = true)
|
|
|
|
|
public void clearOneDayStat() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|