From 67ca8b45a975a41093c0e52d8129624657089b44 Mon Sep 17 00:00:00 2001 From: yangys <y_ys79@sina.com> Date: 星期一, 04 十一月 2024 13:24:36 +0800 Subject: [PATCH] 状态和绩效时间设置,修改值后清空缓存的key修正,修改位与collect一致 --- smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateStateServiceImpl.java | 26 +++++++------------------- 1 files changed, 7 insertions(+), 19 deletions(-) diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateStateServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateStateServiceImpl.java index 8a987b7..3c91cd0 100644 --- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateStateServiceImpl.java +++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/SuperAggregateStateServiceImpl.java @@ -104,25 +104,19 @@ @Override public List<StatusTimeTopVO> getStatusTimeByWcs(List<Long> workstationIds, LocalDateTime startTime, LocalDateTime endTime, Integer status, Integer top) { List<StatusTimeTopVO> voList = new ArrayList<>(); - + //鏌ヨ闄ゆ墍鏈夌姸鎬佹椂鍙敤鐨勫伐浣嶏紝杞崲浣� 宸ヤ綅id -> 宸ヤ綅 鐨刴ap 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); + //鏌ヨ鍑烘椂闂存鍐厀cs=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);//杩囨护鏁版嵁锛孴IME_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)); @@ -195,20 +189,14 @@ 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<>(); -- Gitblit v1.9.3