| | |
| | | package com.iailab.module.model.mcs.sche.service.impl; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | |
| | | import com.iailab.module.model.common.utils.DateUtils; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemResultService; |
| | | import com.iailab.module.model.mcs.sche.dao.StSuggestSnapshotRecordDao; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSuggestEntity; |
| | | import com.iailab.module.model.mcs.sche.entity.StSuggestSnapshotRecordEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleSuggestService; |
| | | import com.iailab.module.model.mcs.sche.service.StSuggestSnapshotConfDetService; |
| | | import com.iailab.module.model.mcs.sche.service.StSuggestSnapshotConfMainService; |
| | | import com.iailab.module.model.mcs.sche.service.StSuggestSnapshotRecordService; |
| | |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | import java.util.*; |
| | | |
| | | import static com.iailab.module.model.common.utils.DateUtils.DATE_TIME_PATTERN; |
| | | |
| | |
| | | @Autowired |
| | | private MmItemResultService mmItemResultService; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private StSuggestSnapshotConfMainService stSuggestSnapshotConfMainService; |
| | | |
| | | @Autowired |
| | | private StSuggestSnapshotConfDetService stSuggestSnapshotConfDetService; |
| | | |
| | | @Autowired |
| | | private StScheduleSuggestService stScheduleSuggestService; |
| | | |
| | | @Override |
| | | @DSTransactional(rollbackFor = Exception.class) |
| | |
| | | |
| | | @Override |
| | | public List<StSuggestSnapshotRecordRespVO> getListBySuggestId(String suggestId) { |
| | | return ConvertUtils.sourceToTarget(baseDao.selectList("suggest_id", suggestId), StSuggestSnapshotRecordRespVO.class); |
| | | QueryWrapper<StSuggestSnapshotRecordEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("suggest_id", suggestId); |
| | | queryWrapper.orderByAsc("sort"); |
| | | return ConvertUtils.sourceToTarget(baseDao.selectList(queryWrapper), StSuggestSnapshotRecordRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | |
| | | snapshotRecordSaveReqVO.setDataType(confDet.getDataType()); |
| | | snapshotRecordSaveReqVO.setDataName(confDet.getDataName()); |
| | | snapshotRecordSaveReqVO.setScheduleTime(scheduleTime); |
| | | snapshotRecordSaveReqVO.setSort(confDet.getSort()); |
| | | snapshotRecordSaveReqVO.setLimitH(confDet.getLimitH()); |
| | | snapshotRecordSaveReqVO.setLimitL(confDet.getLimitL()); |
| | | snapshotRecordSaveReqVO.setSort(confDet.getSort()); |
| | | //计算开始时间,开始时间为当前调度时间减去快照配置表配置的左侧时间长度 |
| | | LocalDateTime localStartDateTime = scheduleTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().minusMinutes(confDet.getLeftLength() == null ? 60 : confDet.getLeftLength()); |
| | | Date startTime = Date.from(localStartDateTime.atZone(ZoneId.systemDefault()).toInstant()); |
| | |
| | | |
| | | @Override |
| | | public List<StSuggestSnapshotRecordRespVO> getChartData(List<StSuggestSnapshotRecordRespVO> reqList) { |
| | | Map<String,StScheduleSuggestEntity> suggestInfos = new HashMap<>(reqList.size()); |
| | | reqList.forEach(item -> { |
| | | List<Object[]> dataList = new ArrayList<>(); |
| | | if(DataCategoryEnum.DATAPOINT.getCode().equals(item.getDataType())){ |
| | |
| | | } |
| | | item.setDataList(dataList); |
| | | |
| | | // 越界时间 |
| | | // if (!CollectionUtils.isEmpty(dataList)) { |
| | | // List<String> overLimitTimes = new ArrayList<>(); |
| | | // dataList.forEach(data -> { |
| | | // BigDecimal value = new BigDecimal(data[1].toString()); |
| | | // if ((item.getLimitH() != null &&value.compareTo(item.getLimitH()) >= 0) || (item.getLimitL() != null && value.compareTo(item.getLimitL()) <= 0)) { |
| | | // overLimitTimes.add(data[0].toString()); |
| | | // } |
| | | // }); |
| | | // item.setOverLimitTimes(overLimitTimes); |
| | | // } |
| | | |
| | | // 建议处理时间 |
| | | String suggestId = item.getSuggestId(); |
| | | StScheduleSuggestEntity suggestInfo; |
| | | if (suggestInfos.containsKey(suggestId)) { |
| | | suggestInfo = suggestInfos.get(suggestId); |
| | | }else { |
| | | suggestInfo = stScheduleSuggestService.getInfo(suggestId); |
| | | suggestInfos.put(suggestId,suggestInfo); |
| | | } |
| | | item.setStatus(suggestInfo.getStatus()); |
| | | item.setHandleTime(suggestInfo.getHandleTime()); |
| | | }); |
| | | return reqList; |
| | | } |