| | |
| | | @Override |
| | | public List<StatusTimeTopVO> getStatusTimeByWcs(List<Long> workstationIds, LocalDateTime startTime, LocalDateTime endTime, Integer status, Integer top) { |
| | | List<StatusTimeTopVO> voList = new ArrayList<>(); |
| | | |
| | | //查询除所有状态时可用的工位,转换位 工位id -> 工位 的map |
| | | Map<Long, Workstation> workstationMap = this.workstationService.list(Wrappers.<Workstation>lambdaQuery() |
| | | .eq(Workstation::getStatus, CommonConstant.ENABLE)).stream().collect(Collectors.toMap(Workstation::getId, Function.identity())); |
| | | /* |
| | | Map<Long, Workstation> workstationMap = (Map) this.workstationService.list((Wrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getStatus(); |
| | | }, CommonConstant.ENABLE)).stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getId(); |
| | | }, Function.identity()));*/ |
| | | //List<SuperAggregateState> equipmentStatusDuration = this.baseMapper.getEquipmentStatusDuration(workstationIds, LocalDateTimeUtil.format(startTime, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endTime, DateConstant.PATTERN_DATE_TIME), status); |
| | | |
| | | |
| | | // Date startTimeD = LocalDateUtil.localDateTimeToDate(startTime); |
| | | //startTimeD = new Date(124,8,2); |
| | | //Date endTimeD = LocalDateUtil.localDateTimeToDate(endTime); |
| | | //endTimeD = new Date(124,8,3); |
| | | |
| | | //查询出时间段内wcs=status的所有数据 |
| | | List<SuperAggregateState> equipmentStatusDuration = this.baseMapper.getEquipmentStatusDuration(workstationIds, DateTimeUtil.toDate(startTime), DateTimeUtil.toDate(endTime), status); |
| | | |
| | | List<SuperAggregateState> equipmentStatusDuration2 = FilterOffUtils.filterOffDay(equipmentStatusDuration, OpenTypeEnums.TIME_USED_ANALYSIS); |
| | | List<SuperAggregateState> equipmentStatusDuration2 = FilterOffUtils.filterOffDay(equipmentStatusDuration, OpenTypeEnums.TIME_USED_ANALYSIS);//过滤数据,TIME_USED_ANALYSIS open =1则过滤 |
| | | Map<Long, Long> timeMap = buildDuration(startTime, equipmentStatusDuration2).stream().collect(Collectors.groupingBy(SuperAggregate::getWorkstationId, Collectors.summingLong(SuperAggregateState::getDurationCollect))).entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(top.intValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, java.util.LinkedHashMap::new)); |
| | | //yangys改了buildDuration,去掉了startTime参数 |
| | | //Map<Long, Long> timeMap = buildDuration(equipmentStatusDuration2,ChronoUnit.SECONDS).stream().collect(Collectors.groupingBy(SuperAggregate::getWorkstationId, Collectors.summingLong(SuperAggregateState::getDurationCollect))).entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(top.intValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, java.util.LinkedHashMap::new)); |
| | |
| | | List<SuperAggregateState> res = this.baseMapper.listCrossDay(startTime, endTime); |
| | | return buildDuration(res); |
| | | } |
| | | |
| | | /* |
| | | @Override |
| | | public void saveState(List<SuperAggregateState> collect) { |
| | | Map<Long, List<SuperAggregateState>> map = collect.stream().collect(Collectors.groupingBy(SuperAggregate::getWorkstationId)); |
| | | map.forEach(this.baseMapper::saveState); |
| | | /* |
| | | Map<Long, List<SuperAggregateState>> map = collect.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | })); |
| | | SuperAggregateStateMapper superAggregateStateMapper = this.baseMapper; |
| | | superAggregateStateMapper.getClass(); |
| | | map.forEach(this::saveState);*/ |
| | | |
| | | } |
| | | |
| | | */ |
| | | @Override |
| | | public List<SuperAggregateState> getStatusDataByTime(List<Long> workstationIdList, LocalDateTime start, LocalDateTime end) { |
| | | List<SuperAggregateState> superAggregateStateList = new ArrayList<>(); |