| | |
| | | import org.dromara.eims.service.IEimsInspectStService; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.ZoneId; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.*; |
| | |
| | | */ |
| | | @Override |
| | | public TableDataInfo<EimsInspectStVo> queryPageList(EimsInspectStBo bo, PageQuery pageQuery) { |
| | | bo.setType(bo.getViewMode()); |
| | | // 月视图 |
| | | if(bo.getViewMode().equals("Month")){ |
| | | // if(bo.getViewMode().equals("Month")){ |
| | | QueryWrapper<EimsInspectSt> qw = buildWrapper(bo); |
| | | Page<EimsInspectStVo> result = baseMapper.selectInspStList(pageQuery.build(), qw); |
| | | // 填充数据 |
| | | fillStData(result); |
| | | fillStData(result,bo.getViewMode()); |
| | | return TableDataInfo.build(result); |
| | | // 日视图 |
| | | }else if(bo.getViewMode().equals("Day")){ |
| | | Page<EimsInspectStVo> result = recordMapper.selectInspRecordDayList(pageQuery.build(), buildGroupWrapper(bo)); |
| | | return TableDataInfo.build(result); |
| | | } |
| | | // }else if(bo.getViewMode().equals("Day")){ |
| | | // Page<EimsInspectStVo> result = recordMapper.selectInspRecordDayList(pageQuery.build(), buildGroupWrapper(bo)); |
| | | // return TableDataInfo.build(result); |
| | | // } |
| | | |
| | | return null; |
| | | // return null; |
| | | } |
| | | |
| | | private void fillStData(Page<EimsInspectStVo> result) { |
| | | /** |
| | | * |
| | | * @param result |
| | | * @param type Day-日视图 Month-月视图 |
| | | */ |
| | | private void fillStData(Page<EimsInspectStVo> result,String type) { |
| | | List<EimsInspectStVo> records = result.getRecords(); |
| | | for (int i = 0; i < records.size(); i++) { |
| | | EimsInspectStVo stVo = records.get(i); |
| | |
| | | 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()); |
| | | recordLqw.between(EimsInspectRecord::getPlanTime, startOfMonth, endOfMonth); |
| | | |
| | | // 日视图查询范围 |
| | | 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 |
| | |
| | | // 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::getStatus, Collectors.counting())); |
| | | .collect(Collectors.groupingBy(EimsInspectRecordVo::getInspResult, Collectors.counting())); |
| | | |
| | | stVo.setRecordCount(recordList.size()); |
| | | stVo.setUnCheckCount(cMap.getOrDefault("0", 0L).intValue()); |
| | |
| | | qw.like(StringUtils.isNotBlank(bo.getTitle()), "st.title", bo.getTitle()); |
| | | qw.like(StringUtils.isNotBlank(bo.getEquName()), "equ.equ_name", bo.getEquName()); |
| | | qw.like(StringUtils.isNotBlank(bo.getAssetNo()), "equ.asset_no", bo.getAssetNo()); |
| | | qw.eq( "st.type", bo.getType()); |
| | | qw.between(params.get("beginPlanTime") != null && params.get("endPlanTime") != null, |
| | | "st.plan_time", params.get("beginPlanTime"), params.get("endPlanTime")); |
| | | qw.eq(bo.getInspUser() != null, "st.maint_user", bo.getInspUser()); |