| | |
| | | package com.qianwen.smartman.modules.mdc.service.impl; |
| | | |
| | | import cn.hutool.core.date.LocalDateTimeUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.sql.Timestamp; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.tool.utils.DateUtil; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.DateConstant; |
| | | import com.qianwen.smartman.common.utils.LocalDateTimeUtils; |
| | | import com.qianwen.core.tool.utils.DateUtil; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.modules.cps.entity.Workstation; |
| | | import com.qianwen.smartman.modules.cps.service.IWorkstationService; |
| | | import com.qianwen.smartman.modules.mdc.entity.SuperAggregate; |
| | | import com.qianwen.smartman.modules.mdc.entity.SuperAggregateState; |
| | | import com.qianwen.smartman.modules.mdc.enums.OpenTypeEnums; |
| | | import com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum; |
| | |
| | | import com.qianwen.smartman.modules.mdc.service.ISuperAggregateStateService; |
| | | import com.qianwen.smartman.modules.mdc.utils.FilterOffUtils; |
| | | import com.qianwen.smartman.modules.mdc.vo.StatusTimeTopVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import cn.hutool.core.date.LocalDateTimeUtil; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/mdc/service/impl/SuperAggregateStateServiceImpl.class */ |
| | | public class SuperAggregateStateServiceImpl implements ISuperAggregateStateService { |
| | | private static final Logger log = LoggerFactory.getLogger(SuperAggregateStateServiceImpl.class); |
| | | private final SuperAggregateStateMapper baseMapper; |
| | | private final SuperAggregateStateFeedbackMapper aggregateStateFeedbackMapper; |
| | | private final IWorkstationService workstationService; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case 803533544: |
| | | if (implMethodName.equals("getStatus")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | switch (z) { |
| | | case false: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getStatus(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | public SuperAggregateStateServiceImpl(final SuperAggregateStateMapper baseMapper, final SuperAggregateStateFeedbackMapper aggregateStateFeedbackMapper, final IWorkstationService workstationService) { |
| | | this.baseMapper = baseMapper; |
| | |
| | | @Override // org.springblade.modules.mdc.service.ISuperAggregateStateService |
| | | public List<StatusTimeTopVO> getStatusTimeByWcs(List<Long> workstationIds, LocalDateTime startTime, LocalDateTime endTime, Integer status, Integer top) { |
| | | List<StatusTimeTopVO> voList = new ArrayList<>(); |
| | | 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())); |
| | | }, Function.identity()));*/ |
| | | List<SuperAggregateState> equipmentStatusDuration = this.baseMapper.getEquipmentStatusDuration(workstationIds, LocalDateTimeUtil.format(startTime, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endTime, DateConstant.PATTERN_DATE_TIME), status); |
| | | Map<Long, Long> timeMap = (Map) ((Map) buildDuration(startTime, FilterOffUtils.filterOffDay(equipmentStatusDuration, OpenTypeEnums.TIME_USED_ANALYSIS)).stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Long, Long> timeMap = buildDuration(startTime, equipmentStatusDuration).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)); |
| | | /* |
| | | Map<Long, Long> timeMap = (buildDuration(startTime, FilterOffUtils.filterOffDay(equipmentStatusDuration, OpenTypeEnums.TIME_USED_ANALYSIS)).stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | }, Collectors.summingLong((v0) -> { |
| | | return v0.getDurationCollect(); |
| | |
| | | return v0.getKey(); |
| | | }, (v0) -> { |
| | | return v0.getValue(); |
| | | }, oldValue, newValue -> { |
| | | }, (oldValue, newValue) -> { |
| | | return oldValue; |
| | | }, LinkedHashMap::new)); |
| | | timeMap.forEach(k, v -> { |
| | | }, LinkedHashMap::new));*/ |
| | | timeMap.forEach((k, v) -> { |
| | | StatusTimeTopVO statusTimeTopVO = new StatusTimeTopVO(); |
| | | statusTimeTopVO.setValue(Double.valueOf(secondToHour(v))); |
| | | statusTimeTopVO.setWorkstation((Workstation) workstationMap.get(k)); |
| | |
| | | |
| | | @Override // org.springblade.modules.mdc.service.ISuperAggregateStateService |
| | | public void saveState(List<SuperAggregateState> collect) { |
| | | Map<Long, List<SuperAggregateState>> map = (Map) collect.stream().collect(Collectors.groupingBy((v0) -> { |
| | | 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); |
| | | map.forEach(this::saveState);*/ |
| | | } |
| | | |
| | | @Override // org.springblade.modules.mdc.service.ISuperAggregateStateService |