Blame view

parking-module-park/src/main/java/com/zteits/park/biz/IInOutParkingServiceImpl.java 3.73 KB
9af4a544   王彪总   新项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
  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<Long> 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<Long>(count);
      }
  
      @Override
      public BizResult<Long> 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<Long> 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);
  
      }
  }