|  |  | 
 |  |  | import com.dy.common.webUtil.QueryResultVo; | 
 |  |  | import com.dy.pipIrrGlobal.daoRm.*; | 
 |  |  | import com.dy.pipIrrGlobal.voRm.VoOnHour; | 
 |  |  | import com.dy.pipIrrRemote.report.qo.ReportQO; | 
 |  |  | import com.dy.pipIrrGlobal.voRm.VoOpenCloseValve; | 
 |  |  | import com.dy.pipIrrGlobal.voRm.VoTiming; | 
 |  |  | import com.dy.pipIrrGlobal.voRm.VoWork; | 
 |  |  | import com.dy.pipIrrRemote.report.qo.OnHourQO; | 
 |  |  | import com.dy.pipIrrRemote.report.qo.OpenCloseValveQO; | 
 |  |  | import lombok.RequiredArgsConstructor; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.apache.dubbo.common.utils.PojoUtils; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | import java.time.LocalDate; | 
 |  |  | import java.time.LocalDateTime; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  |  | 
 |  |  | 
 |  |  |      * @param qo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public QueryResultVo<List<VoOnHour>> getOnHourReportsHistory(ReportQO qo) { | 
 |  |  |     public QueryResultVo<List<VoOnHour>> getOnHourReportsHistory(OnHourQO qo) { | 
 |  |  |         String timeStart = qo.getTimeStart(); | 
 |  |  |         String timeStop = qo.getTimeStop(); | 
 |  |  |         if(timeStart != null) { | 
 |  |  | 
 |  |  |         return rsVo ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据指定条件获取整点报最新记录 | 
 |  |  |      * @param qo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public QueryResultVo<List<VoOnHour>> getOnHourReportsLast(OnHourQO qo) { | 
 |  |  |         String timeStart = qo.getTimeStart(); | 
 |  |  |         String timeStop = qo.getTimeStop(); | 
 |  |  |         if(timeStart != null) { | 
 |  |  |             timeStart = timeStart + " 00:00:00"; | 
 |  |  |             qo.setTimeStart(timeStart); | 
 |  |  |         } | 
 |  |  |         if(timeStop != null) { | 
 |  |  |             timeStop = timeStop + " 23:59:59"; | 
 |  |  |             qo.setTimeStop(timeStop); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); | 
 |  |  |         Long itemTotal = rmOnHourReportLastMapper.getOnHourReportsCount_last(params); | 
 |  |  |  | 
 |  |  |         QueryResultVo<List<VoOnHour>> rsVo = new QueryResultVo<>() ; | 
 |  |  |         rsVo.pageSize = qo.pageSize ; | 
 |  |  |         rsVo.pageCurr = qo.pageCurr ; | 
 |  |  |  | 
 |  |  |         rsVo.calculateAndSet(itemTotal, params); | 
 |  |  |         rsVo.obj = rmOnHourReportLastMapper.getOnHourReports_last(params); | 
 |  |  |         return rsVo ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据指定条件获取开关阀报历史记录 | 
 |  |  |      * @param qo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public QueryResultVo<List<VoOpenCloseValve>> getOpenCloseValveReports_history(OpenCloseValveQO qo) { | 
 |  |  |         String timeStart_open = qo.getTimeStart_open(); | 
 |  |  |         String timeStop_open = qo.getTimeStop_open(); | 
 |  |  |         if(timeStart_open != null && timeStart_open != "") { | 
 |  |  |             timeStart_open = timeStart_open + " 00:00:00"; | 
 |  |  |         } else { | 
 |  |  |             timeStart_open = LocalDateTime.now().minusDays(30) + " 00:00:00"; | 
 |  |  |         } | 
 |  |  |         qo.setTimeStart_open(timeStart_open); | 
 |  |  |  | 
 |  |  |         if(timeStop_open != null && timeStop_open != "") { | 
 |  |  |             timeStop_open = timeStop_open + " 23:59:59"; | 
 |  |  |         }else { | 
 |  |  |             timeStop_open = LocalDate.now() + " 23:59:59"; | 
 |  |  |         } | 
 |  |  |         qo.setTimeStop_open(timeStop_open); | 
 |  |  |  | 
 |  |  |         String timeStart_close = qo.getTimeStart_close(); | 
 |  |  |         String timeStop_close = qo.getTimeStop_close(); | 
 |  |  |         if(timeStart_close != null && timeStart_close != "") { | 
 |  |  |             timeStart_close = timeStart_close + " 00:00:00"; | 
 |  |  |         } else { | 
 |  |  |             timeStart_close = LocalDate.now().minusDays(30) + " 00:00:00"; | 
 |  |  |         } | 
 |  |  |         qo.setTimeStart_close(timeStart_close); | 
 |  |  |  | 
 |  |  |         if(timeStop_close != null && timeStop_close != "") { | 
 |  |  |             timeStop_close = timeStop_close + " 23:59:59"; | 
 |  |  |         }else { | 
 |  |  |             timeStop_close = LocalDate.now() + " 23:59:59"; | 
 |  |  |         } | 
 |  |  |         qo.setTimeStop_close(timeStop_close); | 
 |  |  |  | 
 |  |  |         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); | 
 |  |  |         Long itemTotal = rmOpenCloseValveHistoryMapper.getOpenCloseValveReportsCount_history(params); | 
 |  |  |  | 
 |  |  |         QueryResultVo<List<VoOpenCloseValve>> rsVo = new QueryResultVo<>() ; | 
 |  |  |         rsVo.pageSize = qo.pageSize ; | 
 |  |  |         rsVo.pageCurr = qo.pageCurr ; | 
 |  |  |  | 
 |  |  |         rsVo.calculateAndSet(itemTotal, params); | 
 |  |  |         rsVo.obj = rmOpenCloseValveHistoryMapper.getOpenCloseValveReports_history(params); | 
 |  |  |         return rsVo ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据指定条件获取开关阀报最新记录 | 
 |  |  |      * @param qo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public QueryResultVo<List<VoOpenCloseValve>> getOpenCloseValveReports_last(OpenCloseValveQO qo) { | 
 |  |  |         String timeStart_open = qo.getTimeStart_open(); | 
 |  |  |         String timeStop_open = qo.getTimeStop_open(); | 
 |  |  |         if(timeStart_open != null) { | 
 |  |  |             timeStart_open = timeStart_open + " 00:00:00"; | 
 |  |  |             qo.setTimeStart_open(timeStart_open); | 
 |  |  |         } | 
 |  |  |         if(timeStop_open != null) { | 
 |  |  |             timeStop_open = timeStop_open + " 23:59:59"; | 
 |  |  |             qo.setTimeStop_open(timeStop_open); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         String timeStart_close = qo.getTimeStart_close(); | 
 |  |  |         String timeStop_close = qo.getTimeStop_close(); | 
 |  |  |         if(timeStart_close != null) { | 
 |  |  |             timeStart_close = timeStart_close + " 00:00:00"; | 
 |  |  |             qo.setTimeStart_close(timeStart_close); | 
 |  |  |         } | 
 |  |  |         if(timeStop_close != null) { | 
 |  |  |             timeStop_close = timeStop_close + " 23:59:59"; | 
 |  |  |             qo.setTimeStop_close(timeStop_close); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); | 
 |  |  |         Long itemTotal = rmOpenCloseValveLastMapper.getOpenCloseValveReportsCount_last(params); | 
 |  |  |  | 
 |  |  |         QueryResultVo<List<VoOpenCloseValve>> rsVo = new QueryResultVo<>() ; | 
 |  |  |         rsVo.pageSize = qo.pageSize ; | 
 |  |  |         rsVo.pageCurr = qo.pageCurr ; | 
 |  |  |  | 
 |  |  |         rsVo.calculateAndSet(itemTotal, params); | 
 |  |  |         rsVo.obj = rmOpenCloseValveLastMapper.getOpenCloseValveReports_last(params); | 
 |  |  |         return rsVo ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据指定条件获取定时报历史记录 | 
 |  |  |      * @param qo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public QueryResultVo<List<VoTiming>> getTimingReportsHistory(OnHourQO qo) { | 
 |  |  |         String timeStart = qo.getTimeStart(); | 
 |  |  |         String timeStop = qo.getTimeStop(); | 
 |  |  |         if(timeStart != null) { | 
 |  |  |             timeStart = timeStart + " 00:00:00"; | 
 |  |  |             qo.setTimeStart(timeStart); | 
 |  |  |         } | 
 |  |  |         if(timeStop != null) { | 
 |  |  |             timeStop = timeStop + " 23:59:59"; | 
 |  |  |             qo.setTimeStop(timeStop); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); | 
 |  |  |         Long itemTotal = rmTimingReportHistoryMapper.getTimingReportsCount_history(params); | 
 |  |  |  | 
 |  |  |         QueryResultVo<List<VoTiming>> rsVo = new QueryResultVo<>() ; | 
 |  |  |         rsVo.pageSize = qo.pageSize ; | 
 |  |  |         rsVo.pageCurr = qo.pageCurr ; | 
 |  |  |  | 
 |  |  |         rsVo.calculateAndSet(itemTotal, params); | 
 |  |  |         rsVo.obj = rmTimingReportHistoryMapper.getTimingReports_history(params); | 
 |  |  |         return rsVo ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据指定条件获取定时报最新记录 | 
 |  |  |      * @param qo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public QueryResultVo<List<VoTiming>> getTimingReportsLast(OnHourQO qo) { | 
 |  |  |         String timeStart = qo.getTimeStart(); | 
 |  |  |         String timeStop = qo.getTimeStop(); | 
 |  |  |         if(timeStart != null) { | 
 |  |  |             timeStart = timeStart + " 00:00:00"; | 
 |  |  |             qo.setTimeStart(timeStart); | 
 |  |  |         } | 
 |  |  |         if(timeStop != null) { | 
 |  |  |             timeStop = timeStop + " 23:59:59"; | 
 |  |  |             qo.setTimeStop(timeStop); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); | 
 |  |  |         Long itemTotal = rmTimingReportLastMapper.getTimingReportsCount_last(params); | 
 |  |  |  | 
 |  |  |         QueryResultVo<List<VoTiming>> rsVo = new QueryResultVo<>() ; | 
 |  |  |         rsVo.pageSize = qo.pageSize ; | 
 |  |  |         rsVo.pageCurr = qo.pageCurr ; | 
 |  |  |  | 
 |  |  |         rsVo.calculateAndSet(itemTotal, params); | 
 |  |  |         rsVo.obj = rmTimingReportLastMapper.getTimingReports_last(params); | 
 |  |  |         return rsVo ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据指定条件获取工作报历史记录 | 
 |  |  |      * @param qo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public QueryResultVo<List<VoWork>> getWorkReportsHistory(OnHourQO qo) { | 
 |  |  |         String timeStart = qo.getTimeStart(); | 
 |  |  |         String timeStop = qo.getTimeStop(); | 
 |  |  |         if(timeStart != null) { | 
 |  |  |             timeStart = timeStart + " 00:00:00"; | 
 |  |  |             qo.setTimeStart(timeStart); | 
 |  |  |         } | 
 |  |  |         if(timeStop != null) { | 
 |  |  |             timeStop = timeStop + " 23:59:59"; | 
 |  |  |             qo.setTimeStop(timeStop); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); | 
 |  |  |         Long itemTotal = rmWorkReportHistoryMapper.getWorkReportsCount_history(params); | 
 |  |  |  | 
 |  |  |         QueryResultVo<List<VoWork>> rsVo = new QueryResultVo<>() ; | 
 |  |  |         rsVo.pageSize = qo.pageSize ; | 
 |  |  |         rsVo.pageCurr = qo.pageCurr ; | 
 |  |  |  | 
 |  |  |         rsVo.calculateAndSet(itemTotal, params); | 
 |  |  |         rsVo.obj = rmWorkReportHistoryMapper.getWorkReports_history(params); | 
 |  |  |         return rsVo ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据指定条件获取工作报最新记录 | 
 |  |  |      * @param qo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public QueryResultVo<List<VoWork>> getWorkReportsLast(OnHourQO qo) { | 
 |  |  |         String timeStart = qo.getTimeStart(); | 
 |  |  |         String timeStop = qo.getTimeStop(); | 
 |  |  |         if(timeStart != null) { | 
 |  |  |             timeStart = timeStart + " 00:00:00"; | 
 |  |  |             qo.setTimeStart(timeStart); | 
 |  |  |         } | 
 |  |  |         if(timeStop != null) { | 
 |  |  |             timeStop = timeStop + " 23:59:59"; | 
 |  |  |             qo.setTimeStop(timeStop); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); | 
 |  |  |         Long itemTotal = rmWorkReportLastMapper.getWorkReportsCount_last(params); | 
 |  |  |  | 
 |  |  |         QueryResultVo<List<VoWork>> rsVo = new QueryResultVo<>() ; | 
 |  |  |         rsVo.pageSize = qo.pageSize ; | 
 |  |  |         rsVo.pageCurr = qo.pageCurr ; | 
 |  |  |  | 
 |  |  |         rsVo.calculateAndSet(itemTotal, params); | 
 |  |  |         rsVo.obj = rmWorkReportLastMapper.getWorkReports_last(params); | 
 |  |  |         return rsVo ; | 
 |  |  |     } | 
 |  |  | } |