| | |
| | | */ |
| | | @Override |
| | | public EimsInspectStVo queryById(Long id){ |
| | | return baseMapper.selectVoById(id); |
| | | EimsInspectStVo stVo = baseMapper.selectVoById(id); |
| | | return stVo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @param stVo |
| | | * @param type Day-日视图 Month-月视图 |
| | | */ |
| | | private void fillStDataSingle(EimsInspectStVo stVo,String type) { |
| | | |
| | | LambdaQueryWrapper<EimsInspectRecord> recordLqw = Wrappers.lambdaQuery(); |
| | | recordLqw.eq(EimsInspectRecord::getEquId, stVo.getEquId()); |
| | | LocalDate planTime = stVo.getPlanTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | // 月视图查询范围 |
| | | LocalDate startOfMonth = planTime.with(TemporalAdjusters.firstDayOfMonth()); |
| | | LocalDate endOfMonth = planTime.with(TemporalAdjusters.lastDayOfMonth()); |
| | | |
| | | // 日视图查询范围 |
| | | if(type.equals("Day")){ |
| | | recordLqw.between(EimsInspectRecord::getPlanTime, planTime, planTime); |
| | | }else { |
| | | // 月视图查询范围 |
| | | recordLqw.between(EimsInspectRecord::getPlanTime, startOfMonth, endOfMonth); |
| | | } |
| | | |
| | | |
| | | // 执行查询 |
| | | List<EimsInspectRecordVo> recordList = recordMapper.selectVoList(recordLqw); |
| | | // TODO 根据字典eims_inspect_status |
| | | Map<String, Long> cMap = recordList.stream() |
| | | .filter(order -> List.of("0", "1").contains(order.getStatus())) |
| | | .collect(Collectors.groupingBy(EimsInspectRecordVo::getStatus, Collectors.counting())); |
| | | // TODO 根据字典eims_inspect_result |
| | | Map<String, Long> rMap = recordList.stream() |
| | | .filter(order ->order.getInspResult()!=null && List.of("1", "2").contains(order.getInspResult())) |
| | | .collect(Collectors.groupingBy(EimsInspectRecordVo::getInspResult, Collectors.counting())); |
| | | |
| | | stVo.setRecordCount(recordList.size()); |
| | | stVo.setUnCheckCount(cMap.getOrDefault("0", 0L).intValue()); |
| | | stVo.setCheckCount(cMap.getOrDefault("1", 0L).intValue()); |
| | | |
| | | stVo.setNormalNum(rMap.getOrDefault("1", 0L).intValue()); |
| | | stVo.setAbNormalNum(rMap.getOrDefault("2", 0L).intValue()); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |