| | |
| | | package com.qianwen.smartman.modules.mdc.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.qianwen.smartman.common.cache.cps.WorkstationCache; |
| | | import com.qianwen.smartman.common.constant.DateConstant; |
| | | import com.qianwen.smartman.common.enums.GlobalWcsTypeEnum; |
| | | import com.qianwen.smartman.common.utils.LocalDateTimeUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.mp.support.Condition; |
| | | import com.qianwen.core.mp.support.Query; |
| | | import com.qianwen.core.tool.utils.CollectionUtil; |
| | | import com.qianwen.core.tool.utils.DateUtil; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.cache.cps.WorkstationCache; |
| | | import com.qianwen.smartman.common.constant.DateConstant; |
| | | import com.qianwen.smartman.common.enums.GlobalWcsTypeEnum; |
| | | import com.qianwen.smartman.common.utils.LocalDateTimeUtils; |
| | | import com.qianwen.smartman.modules.cps.dto.WorkstationWcsDmpDTO; |
| | | import com.qianwen.smartman.modules.cps.entity.GlobalWcs; |
| | | import com.qianwen.smartman.modules.cps.entity.Workstation; |
| | |
| | | import com.qianwen.smartman.modules.mdc.vo.StatusAnalysisWorkstationVO; |
| | | import com.qianwen.smartman.modules.mdc.vo.StatusTimeTotalDetailVO; |
| | | import com.qianwen.smartman.modules.mdc.vo.StatusTimeTotalVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/mdc/service/impl/WorkstationAnalysisServiceImpl.class */ |
| | |
| | | private final SuperProcessParameterMapper superProcessParameterMapper; |
| | | private final IWorkstationService workstationService; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -75106384: |
| | | if (implMethodName.equals("getType")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | case 803533544: |
| | | if (implMethodName.equals("getStatus")) { |
| | | z = true; |
| | | 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/modules/cps/entity/Workstation") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getType(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | 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 WorkstationAnalysisServiceImpl(final SuperAggregateStateMapper superAggregateStateMapper, final SuperAlarmMapper superAlarmMapper, final IGlobalWcsService globalWcsService, final WorkstationMapper workstationMapper, final SuperProcessParameterMapper superProcessParameterMapper, final IWorkstationService workstationService) { |
| | | this.superAggregateStateMapper = superAggregateStateMapper; |
| | |
| | | result.setGroupId(groupId); |
| | | result.setGroupName(groupName); |
| | | List<Workstation> workstationList = this.workstationMapper.listWorkStationByGroupId(Arrays.asList(groupId)); |
| | | List<Long> workstationIdList = (List) workstationList.stream().map((v0) -> { |
| | | List<Long> workstationIdList = workstationList.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | Long totalTime = Long.valueOf(new BigDecimal(DateUtil.toDate(LocalDateTime.now()).getTime()).subtract(new BigDecimal(DateUtil.toDate(LocalDateTime.of(LocalDate.now(), LocalTime.MIN)).getTime())).multiply(new BigDecimal(workstationIdList.size())).longValue()); |
| | | List<GlobalWcs> list = this.globalWcsService.getGlobalWcsList(GlobalWcsTypeEnum.DEFAULT); |
| | | Map<String, String> dictBizMap = (Map) list.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, String> dictBizMap = list.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getCode(); |
| | | }, (v0) -> { |
| | | return v0.getName(); |
| | |
| | | @Override // org.springblade.modules.mdc.service.IWorkstationAnalysisService |
| | | public List<DeviceStatusStatisticsVO> deviceStatusStatistics() { |
| | | List<GlobalWcs> wcsList = WorkstationCache.getDefaultWcs(); |
| | | List<Workstation> workstationList = this.workstationService.list(Wrappers.<Workstation>lambdaQuery() |
| | | .eq(Workstation::getType, WorkstationTypeEnum.MACHINE.getCode()) |
| | | .eq(Workstation::getStatus, TrayEnum.StatusEnum.ACTIVATING.getStatus())); |
| | | /* |
| | | List<Workstation> workstationList = this.workstationService.list((Wrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getType(); |
| | | }, WorkstationTypeEnum.MACHINE.getCode())).eq((v0) -> { |
| | | return v0.getStatus(); |
| | | }, TrayEnum.StatusEnum.ACTIVATING.getStatus())); |
| | | }, TrayEnum.StatusEnum.ACTIVATING.getStatus()));*/ |
| | | if (Func.isEmpty(workstationList)) { |
| | | return (List) wcsList.stream().map(c -> { |
| | | return wcsList.stream().map(c -> { |
| | | return DeviceStatusStatisticsVO.builder().status(c.getCode()).statusName(c.getName()).deviceNum(0L).build(); |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | Set<String> wIds = (Set) workstationList.stream().map((v0) -> { |
| | | Set<String> wIds = workstationList.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).map((v0) -> { |
| | | return String.valueOf(v0); |
| | | }).collect(Collectors.toSet()); |
| | | Map<String, Long> deviceMap = (Map) wIds.stream().map(wId -> { |
| | | Map<String, Long> deviceMap = wIds.stream().map(wId -> { |
| | | Map<String, Object> realTimeData = WorkstationCache.getWorkstationAllCollect(wId); |
| | | WorkstationWcsDmpDTO dmpDTO = WorkstationCache.getDmpStatus(wId); |
| | | if (Func.isNotEmpty(realTimeData) && Func.notNull(dmpDTO) && realTimeData.containsKey(dmpDTO.getName())) { |
| | |
| | | } |
| | | List<WorkstationCollectData> workstationCollectData = this.superProcessParameterMapper.queryLastParameter(wId); |
| | | if (Func.isNotEmpty(workstationCollectData)) { |
| | | Map<String, Object> resultMapping = (Map) workstationCollectData.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, Object> resultMapping = workstationCollectData.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getN(); |
| | | }, item -> { |
| | | TelemetryDataResponseDTO result = new TelemetryDataResponseDTO(); |
| | |
| | | }).collect(Collectors.groupingBy(c2 -> { |
| | | return c2; |
| | | }, Collectors.counting())); |
| | | return (List) wcsList.stream().map(w -> { |
| | | return wcsList.stream().map(w -> { |
| | | return DeviceStatusStatisticsVO.builder().status(w.getCode()).statusName(w.getName()).deviceNum((Long) deviceMap.getOrDefault(w.getCode(), 0L)).build(); |
| | | }).collect(Collectors.toList()); |
| | | } |