package com.zteits.park.biz; import java.util.Calendar; import org.springframework.beans.factory.annotation.Autowired; import com.zteits.clouds.api.apibase.bean.BizResult; import com.zteits.clouds.api.dto.park.param.CommonPlnosQueryRequest; import com.zteits.clouds.api.dto.park.param.RealTimeVehicleFlowQueryRequest; import com.zteits.clouds.api.service.park.IInOutParkingService; import com.zteits.park.dao.InParkLogDao; import com.zteits.park.dao.OutParkLogDao; import com.zteits.park.domain.InparkLogExample; import com.zteits.park.domain.OutparkLogExample; import org.springframework.stereotype.Service; @Service("com.zteits.park.biz.IInOutParkingServiceImpl") public class IInOutParkingServiceImpl implements IInOutParkingService { @Autowired private InParkLogDao inParkLogDao; @Autowired private OutParkLogDao outParkLogDao; @Override public BizResult QueryRealTimeVehicleFlow(RealTimeVehicleFlowQueryRequest request) { InparkLogExample example = new InparkLogExample(); Calendar beginTime = Calendar.getInstance(); beginTime.set(Calendar.HOUR_OF_DAY, 0); beginTime.set(Calendar.MINUTE, 0); beginTime.set(Calendar.SECOND, 0); Calendar endTime = Calendar.getInstance(); example.createCriteria() .andInTimeGreaterThanOrEqualTo(beginTime.getTime()) .andInTimeLessThanOrEqualTo(endTime.getTime()) .andPlNoIn(request.getPlNos()); Long inCount = this.inParkLogDao.countByExample(example); OutparkLogExample outExample = new OutparkLogExample(); beginTime.set(Calendar.HOUR_OF_DAY, 0); beginTime.set(Calendar.MINUTE, 0); beginTime.set(Calendar.SECOND, 0); outExample.createCriteria() .andInTimeGreaterThanOrEqualTo(beginTime.getTime()) .andInTimeLessThanOrEqualTo(endTime.getTime()) .andPlNoIn(request.getPlNos()); Long outCount = this.outParkLogDao.countByExample(outExample); Long count = inCount + outCount; return new BizResult(count); } @Override public BizResult queryRealTimeOutParkNumOfPlNos(CommonPlnosQueryRequest request) { Calendar beginTime = Calendar.getInstance(); beginTime.set(Calendar.HOUR_OF_DAY, 0); beginTime.set(Calendar.MINUTE, 0); beginTime.set(Calendar.SECOND, 0); Calendar endTime = Calendar.getInstance(); OutparkLogExample outExample = new OutparkLogExample(); beginTime.set(Calendar.HOUR_OF_DAY, 0); beginTime.set(Calendar.MINUTE, 0); beginTime.set(Calendar.SECOND, 0); outExample.createCriteria() .andInTimeGreaterThanOrEqualTo(beginTime.getTime()) .andInTimeLessThanOrEqualTo(endTime.getTime()) .andPlNoIn(request.getPlNos()); Long outCount = this.outParkLogDao.countByExample(outExample); return new BizResult<>(outCount); } @Override public BizResult queryRealTimeInParkNumOfPlNos(CommonPlnosQueryRequest request) { Calendar beginTime = Calendar.getInstance(); beginTime.set(Calendar.HOUR_OF_DAY, 0); beginTime.set(Calendar.MINUTE, 0); beginTime.set(Calendar.SECOND, 0); Calendar endTime = Calendar.getInstance(); InparkLogExample inExample = new InparkLogExample(); beginTime.set(Calendar.HOUR_OF_DAY, 0); beginTime.set(Calendar.MINUTE, 0); beginTime.set(Calendar.SECOND, 0); inExample.createCriteria() .andInTimeGreaterThanOrEqualTo(beginTime.getTime()) .andInTimeLessThanOrEqualTo(endTime.getTime()) .andPlNoIn(request.getPlNos()); Long outCount = inParkLogDao.countByExample(inExample); return new BizResult<>(outCount); } }