|
|
|
@ -6,12 +6,8 @@ import com.shxy.xymanager_common.bean.PermissionDetail;
|
|
|
|
|
import com.shxy.xymanager_common.entity.*;
|
|
|
|
|
import com.shxy.xymanager_common.enums.CommonStatus;
|
|
|
|
|
import com.shxy.xymanager_common.exception.ApiException;
|
|
|
|
|
import com.shxy.xymanager_common.model.StatDay;
|
|
|
|
|
import com.shxy.xymanager_common.model.StatMaintain;
|
|
|
|
|
import com.shxy.xymanager_common.model.StatTerm;
|
|
|
|
|
import com.shxy.xymanager_common.model.UploadModel;
|
|
|
|
|
import com.shxy.xymanager_common.model.*;
|
|
|
|
|
import com.shxy.xymanager_common.page.PageUtils;
|
|
|
|
|
import com.shxy.xymanager_common.util.DateUtil;
|
|
|
|
|
import com.shxy.xymanager_common.util.xinyin.TerminalUtils;
|
|
|
|
|
import com.shxy.xymanager_common.vo.TerminalSelectVo;
|
|
|
|
|
import com.shxy.xymanager_dao.dao.*;
|
|
|
|
@ -54,6 +50,8 @@ public class TerminalExtServiceImpl implements TerminalExtService {
|
|
|
|
|
NewCacheService newCacheService;
|
|
|
|
|
@Resource
|
|
|
|
|
TerminalChannelMapperDao channelMapperDao;
|
|
|
|
|
@Resource
|
|
|
|
|
MntnDayStatService mntnDayStatService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -289,49 +287,37 @@ public class TerminalExtServiceImpl implements TerminalExtService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StatMaintain statMaintain(TerminalSelectVo vo) throws Exception {
|
|
|
|
|
public List<StatMaintain> statMaintain(StatModel model) throws Exception {
|
|
|
|
|
List<StatMaintain> result = new ArrayList<>();
|
|
|
|
|
for (Integer lineId : model.getLineIds()) {
|
|
|
|
|
StatMaintain stat = this.statOneLine(lineId, model.getStart(), model.getEnd());
|
|
|
|
|
result.add(stat);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private StatMaintain statOneLine(Integer lineId, Long start, Long end) throws Exception {
|
|
|
|
|
Lines line = newCacheService.getLine(lineId);
|
|
|
|
|
StatMaintain stat = new StatMaintain();
|
|
|
|
|
stat.initDayList(vo.getStart(), vo.getEnd());
|
|
|
|
|
stat.initDayList(start, end);
|
|
|
|
|
stat.setLine(line);
|
|
|
|
|
|
|
|
|
|
TerminalSelectVo vo = new TerminalSelectVo();
|
|
|
|
|
vo.setPageindex(1);
|
|
|
|
|
vo.setPagesize(10000);
|
|
|
|
|
vo.setLineId(lineId);
|
|
|
|
|
PageInfo<View_Dy_Line_Tower_Terminals> page = this.getTerminalList(vo);
|
|
|
|
|
stat.setTermList(page.getList());
|
|
|
|
|
if (!CollectionUtils.isEmpty(stat.getTermList())) {
|
|
|
|
|
List<Integer> idList = new ArrayList<>();
|
|
|
|
|
for (View_Dy_Line_Tower_Terminals term : stat.getTermList()) {
|
|
|
|
|
idList.add(term.getId());
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(idList)) {
|
|
|
|
|
for (StatDay item : stat.getDayList()) {
|
|
|
|
|
this.statOneDay(item, stat.getTermList());
|
|
|
|
|
List<MntnDayStat> list = mntnDayStatService.list(item.getDay(), idList);
|
|
|
|
|
item.setTermList(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return stat;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void statOneDay(StatDay item, List<View_Dy_Line_Tower_Terminals> list) throws Exception {
|
|
|
|
|
long today = DateUtil.getTodayZero().getTime() / 1000;
|
|
|
|
|
for (View_Dy_Line_Tower_Terminals term : list) {
|
|
|
|
|
Long start = item.getDay().getTime() / 1000;
|
|
|
|
|
if (start < today) {
|
|
|
|
|
StatTerm statTerm = newCacheService.getOneDayStat(term.getId(), start);
|
|
|
|
|
if (statTerm != null) {
|
|
|
|
|
item.getTermList().add(statTerm);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Long end = start + 60 * 60 * 24;
|
|
|
|
|
MntnRawReportsExample example = new MntnRawReportsExample();
|
|
|
|
|
MntnRawReportsExample.Criteria criteria = example.createCriteria();
|
|
|
|
|
criteria.andTermIdEqualTo(term.getId());
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
StatTerm statTerm = new StatTerm();
|
|
|
|
|
statTerm.setTermId(term.getId());
|
|
|
|
|
statTerm.setUploads(reports.getReportMap().get("uploads"));
|
|
|
|
|
item.getTermList().add(statTerm);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|