车间能级提升-智能设备管理系统
zhuguifei
2025-04-24 f0610c371668b042d36d7772cb04b49a2afc69ea
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintStServiceImpl.java
@@ -57,7 +57,37 @@
     */
    @Override
    public EimsMaintStVo queryById(Long id) {
        return baseMapper.selectVoById(id);
        EimsMaintStVo stVo = baseMapper.selectVoById(id);
        if(stVo!=null){
            fillStDataSingle(stVo);
        }
        return stVo;
    }
    private void fillStDataSingle(EimsMaintStVo stVo) {
            //1.填充设备
            EimsEqu eimsEqu = equMapper.selectById(stVo.getEquId());
            stVo.setAssetNo(eimsEqu.getAssetNo());
            //2.统计数据
            LambdaQueryWrapper<EimsMaintOrder> orderLqw = Wrappers.lambdaQuery();
            orderLqw.eq(EimsMaintOrder::getEquId, stVo.getEquId());
            LocalDate planTime = stVo.getPlanTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
            LocalDate startOfMonth = planTime.with(TemporalAdjusters.firstDayOfMonth());
            LocalDate endOfMonth = planTime.with(TemporalAdjusters.lastDayOfMonth());
            orderLqw.between(EimsMaintOrder::getPlanTime, startOfMonth, endOfMonth);
            // 执行查询
            List<EimsMaintOrderVo> orderList = orderMapper.selectVoList(orderLqw);
            // TODO 根据字典maint_order_status
            Map<String, Long> cMap = orderList.stream()
                .filter(order -> List.of("0", "1", "2", "3").contains(order.getStatus()))
                .collect(Collectors.groupingBy(EimsMaintOrderVo::getStatus, Collectors.counting()));
            stVo.setOrderCount(orderList.size());
            stVo.setDbyCount(cMap.getOrDefault("0", 0L).intValue());
            stVo.setByCount(cMap.getOrDefault("1", 0L).intValue());
            stVo.setDyzCount(cMap.getOrDefault("2", 0L).intValue());
            stVo.setWcCount(cMap.getOrDefault("3", 0L).intValue());
    }
    /**