ParkingLotDaoImpl.java
24.8 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
package com.zteits.park.dao.impl;
import com.clouds.common.cache.park.ParkingLotCacheUtil;
import com.clouds.common.constants.pagequery.PageSizeEnum;
import com.clouds.common.utils.ListPageHelper;
import com.clouds.common.utils.page.PageUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.xiaoleilu.hutool.util.CollectionUtil;
import com.zteits.clouds.api.apibase.bean.BizResult;
import com.zteits.clouds.api.apibase.constants.DataStatusEnum;
import com.zteits.clouds.api.apibase.constants.ErrorType;
import com.zteits.clouds.api.apibase.exception.BizException;
import com.zteits.clouds.api.dto.park.dto.ParkNumInfoDTO;
import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO;
import com.zteits.clouds.api.dto.park.dto.parksource.ParkDeviceStaForEveryDTO;
import com.zteits.clouds.api.dto.park.param.*;
import com.zteits.clouds.api.dto.park.param.parklot.QueryOrgIdsByCityIdsRequest;
import com.zteits.clouds.api.dto.park.param.parksource.QueryParkSourceByOrgIdsRequest;
import com.zteits.clouds.api.dto.pay.PlNameDTO;
import com.zteits.clouds.api.dto.pay.TdBTempParklotDTO;
import com.zteits.clouds.api.dto.pay.param.ChangeBlockForParkLotRequest;
import com.zteits.clouds.api.dto.pay.param.CheckUniqueForPlNameRequest;
import com.zteits.clouds.api.dto.pay.param.ParkTempInfoPageQueryRequest;
import com.zteits.clouds.api.dto.sys.QueryProvinceCityAreaByBlockIdsDTO;
import com.zteits.clouds.api.dto.sys.param.QueryProvinceCityAreaByBlockIdsRequest;
import com.zteits.clouds.api.dto.tool.dto.ParkDutyInfoDTO;
import com.zteits.clouds.api.dto.tool.param.ParkDutyInfoQueryReq;
import com.zteits.clouds.api.service.sys.TbAreaService;
import com.zteits.park.constant.ParkConstant;
import com.zteits.park.dao.ParkFreeBerthDao;
import com.zteits.park.dao.ParkingLotDao;
import com.zteits.park.dao.ParkingLotGeoDao;
import com.zteits.park.dao.TpPRegionAreaDao;
import com.zteits.park.domain.ParkingLot;
import com.zteits.park.domain.*;
import com.zteits.park.domain.ParkingLotExample.Criteria;
import com.zteits.park.mapper.ParkingLotMapper;
import com.zteits.park.mapper.smapper.ParkingLotSMapper;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.*;
@Component
public class ParkingLotDaoImpl implements ParkingLotDao {
@Autowired
private ParkingLotMapper parkingLotMapper;
@Autowired
private ParkingLotSMapper parkingLotSMapper;
@Autowired
private ParkingLotGeoDao parkingLotGeoDao;
@Autowired
private TpPRegionAreaDao tpPRegionAreaDao;
@Autowired
private ParkFreeBerthDao parkFreeBerthDao;
@Autowired
private TbAreaService tbAreaService;
/**
* 每一页大小.
*/
private static final Integer PAGE_SIZE = 500;
@Override
public int insertSelective(ParkingLot record) {
if (record == null) {
return 0;
}
if (record.getDataStatus() == null) {
record.setDataStatus(DataStatusEnum.DATA_STATUS_VALID.value());
}
return parkingLotMapper.insertSelective(record);
}
@Override
public ParkingLot selectByPrimaryKey(Long plId) {
return parkingLotMapper.selectByPrimaryKey(plId);
}
@Override
public int updateByPrimaryKeySelective(ParkingLot record) {
return parkingLotMapper.updateByPrimaryKeySelective(record);
}
@Override
public String countByPlCountryId(Long plCountryId, Integer state) {
return parkingLotSMapper.queryMaxPlNoByPlCountryId(plCountryId, state);
}
@Override
public List<ParkingLotAndGeoInfo> queryParkLotByGeoHashs(Set<String> geoHashs) {
return parkingLotSMapper.queryParkingLotByGeoHash(geoHashs);
}
@Override
public Long queryTabParkCountByDistance(Set<String> geoHashs) {
return parkingLotSMapper.queryTabParkCountByDistance(geoHashs);
}
@Override
public List<ParkingLotAndGeoInfo> queryParkingLotAndGeo(ParkingLot record) {
return parkingLotSMapper.queryParkingLotAndGeo(record);
}
@Override
public long countByExample(ParkingLotExample example) {
return parkingLotMapper.countByExample(example);
}
@Override
@Transactional
public Boolean deleteParkingLotByPlNos(List<String> plNos, Long opId) {
//判断停车场下面是否有泊位区间
Map<String, Long> areaNums = tpPRegionAreaDao.queryParkAreaNum(plNos);
Long allAreaNums = areaNums.values().stream().mapToLong(e -> e).sum();
if (allAreaNums != null && allAreaNums > 0) {
throw new BizException(ErrorType.NOT_ALLOW_DEL_PARK);
}
//删除停车场表
ParkingLotExample example = new ParkingLotExample();
ParkingLot record = new ParkingLot();
record.setModifyTime(new Date());
record.setModifyOp(opId);
record.setDataStatus(DataStatusEnum.DATA_STATUS_NO_VALID.value());
example.createCriteria().andPlNoIn(plNos);
parkingLotMapper.updateByExampleSelective(record, example);
//删除停车场相关缓存
plNos.forEach(plNo -> ParkingLotCacheUtil.deleteParkLotByPlNo(plNo));
//删除经纬度
parkingLotGeoDao.deleteParkingLotGeoByPlNos(plNos, opId);
//删除空闲车位
parkFreeBerthDao.deleteParkFreeBerth(plNos, opId);
return true;
}
@Override
public List<ParkingLot> queryParkingLotByPlOutNos(List<String> plOutNos) {
ParkingLotExample record = new ParkingLotExample();
record.createCriteria().andPlOutNoIn(plOutNos).andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
//查询停车场泊位信息
List<ParkingLot> parkinglots = parkingLotMapper.selectByExample(record);
return parkinglots;
}
@Override
public ParkingLotDTO queryParkingLotInfoByPlOutNo(String plOutNo) {
//查询缓存
ParkingLotDTO dto = ParkingLotCacheUtil.getParkLotByPlOutNo(plOutNo);
if (dto == null) {
dto = new ParkingLotDTO();
//查询数据库
ParkingLot parkingLot = new ParkingLot();
List<String> plOutNos = Lists.newArrayList();
plOutNos.add(plOutNo);
List<ParkingLot> parkingLots = this.queryParkingLotByPlOutNos(plOutNos);
parkingLot = CollectionUtils.isEmpty(parkingLots) ? null : parkingLots.get(0);
if (parkingLot != null) {
BeanUtils.copyProperties(parkingLot, dto);
//放入缓存
ParkingLotCacheUtil.setParkLotByPlOutNo(plOutNo, dto);
}
}
return dto;
}
@Override
public ParkingLot queryParkingLotInfoByPlNo(String plNo) {
ParkingLotExample record = new ParkingLotExample();
record.createCriteria().andPlNoEqualTo(plNo).andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
//查询停车场泊位信息
List<ParkingLot> parkinglots = parkingLotMapper.selectByExample(record);
if (!CollectionUtils.isEmpty(parkinglots)) {
return parkinglots.get(0);
}
return null;
}
@Override
public List<ParkingLotCountStatisticByCountryDO> StatisticParkLotCountByCountry(Long cityId, Integer state) {
return parkingLotSMapper.statisticParkLotCountByCountry(cityId, state);
}
@Override
public List<ParkingLot> queryParkLotByCountry(Long cityId, Integer state) {
return parkingLotSMapper.queryParkLotByCountry(cityId, state);
}
@Override
public List<ParkingLot> queryParkLotByProvAndCity(Long provId, Long cityId, Integer state) {
return parkingLotSMapper.queryParkLotByProvAndCity(provId, cityId, state);
}
@Override
public PageInfo<ParkingLot> queryParkLotByCountryAndParkName(List<String> plNos, Long cityId, List<Long> countryIds,
String parkNameOrAddress,
Integer pageNum, Integer pageSize, Integer state, List<Integer> plTypes) {
// 1.设置分页信息
PageHelper.startPage(pageNum, pageSize);
//2.查询数据
List<ParkingLot> list = parkingLotSMapper.queryParkLotByCountryAndParkName(plNos, cityId, countryIds,
parkNameOrAddress, state, plTypes);
return new PageInfo<ParkingLot>(list);
}
@Override
public List<ParkingLot> queryParkLotByCountryAndParkNameOfNoPage(Long cityId, List<Long> countryIds,
String parkNameOrAddress, Integer state) {
List<ParkingLot> list = parkingLotSMapper.queryParkLotByCountryAndParkName(null, cityId, countryIds,
parkNameOrAddress, state, null);
return list;
}
@Override
public List<ParkinglotHeatmapHour> queryParkingLotAndGeoInfo(ParkingLotAndGeoDO parkingLotAndGeoDO) {
return parkingLotSMapper.queryParkingLotAndGeoInfo(parkingLotAndGeoDO);
}
@Override
public List<String> queryPlNoCountryAndParkNameAndAddress(List<Long> countryIds, String parkNameOrAddres,
Integer state) {
if (CollectionUtil.isEmpty(countryIds)) {
return new ArrayList<>();
}
return parkingLotSMapper.queryPlNoCountryAndParkNameAndAddress(countryIds, parkNameOrAddres, state);
}
@Override
public PageInfo<ParkingLot> queryParkingLotByPark(ParkingLotQueryPageDO parkingLot, Integer pageNum,
Integer pageSize) {
// 1.设置分页信息
PageHelper.startPage(pageNum, pageSize);
// 2、查询数据
List<ParkingLot> list = parkingLotSMapper.queryParkingLotByPark(parkingLot);
return new PageInfo<ParkingLot>(list);
}
@Override
public long queryBerthNoByPlnos(List<String> plNos) {
if (CollectionUtil.isEmpty(plNos)) {
return 0;
}
return parkingLotSMapper.queryBerthNoByPlnos(plNos);
}
@Override
public Integer updateParkInfoByPlOutNo(ParkingLot parkingLot) {
ParkingLotExample example = new ParkingLotExample();
example.createCriteria().andPlOutNoEqualTo(parkingLot.getPlOutNo());
return parkingLotMapper.updateByExampleSelective(parkingLot, example);
}
@Override
public List<AreaTreeDO> queryParkInfoByAreaBlockIds(ParkInfoByAreaBlockIdsRequest parkInfoByAreaBlockIdsRequest) {
List<AreaTreeDO> areaTreeList = new ArrayList<AreaTreeDO>();
List<Long> list = parkInfoByAreaBlockIdsRequest.getAreaBlockIds();
if (!CollectionUtils.isEmpty(list)) {
//500条分一页查询停车场
ListPageHelper<Long> pageInfo = new ListPageHelper<Long>(list, PAGE_SIZE);
for (int i = 1; i <= pageInfo.getTotalPages(); i++) {
List<AreaTreeDO> listDO = parkingLotSMapper.queryParkInfoByAreaBlockIds(pageInfo.getPagedList(i),
ParkConstant.state.USED);
if (!CollectionUtils.isEmpty(listDO)) {
areaTreeList.addAll(listDO);
}
}
}
return areaTreeList;
}
@Override
public List<ParkingLotCountStatisticByCountryDO> statisticParkLotCountByCountryForPlType(Long cityId,
Integer state) {
return parkingLotSMapper.statisticParkLotCountByCountryForPlType(cityId, state);
}
@Override
public List<String> queryAllPlNo(Integer state) {
return parkingLotSMapper.queryAllPlNo(state);
}
@Override
public PageInfo<TdBTempParklotDTO> queryParkTempInfoPage(ParkTempInfoPageQueryRequest request) {
PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
List<TdBTempParklotDTO> dtos = parkingLotSMapper.queryParkTempInfoPage();
return new PageInfo<>(dtos);
}
@Override
public List<ParkingLot> queryParkListByPark(QueryParkListByParkRequest request) {
return parkingLotSMapper.queryParkListByPark(request);
}
@Override
public List<ParkingLot> queryParkListAll() {
return parkingLotSMapper.queryParkListAll();
}
@Override
public List<ParkingLot> queryParkingLotByPlNos(List<String> plNos) {
if (CollectionUtil.isEmpty(plNos)) {
return null;
}
ParkingLotExample example = new ParkingLotExample();
example.createCriteria().andPlNoIn(plNos);
return parkingLotMapper.selectByExample(example);
}
/**
* 通过服务点id查询停车场-分页
*
* @param request
* @return
* @throws Exception 2017年12月28日 wangfs.<br/>
*/
@Override
public PageInfo<ParkingLot> queryParkingLotForPageByAreaBlockId(QueryParkingLotByAreaBlockRequest request) {
//1.设置分页
PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
//2.设置分页
List<ParkingLot> list = parkingLotSMapper.queryParkingLotByAreaBlockId(request);
return new PageInfo<ParkingLot>(list);
}
/**
* 通过服务点id查询停车场
*
* @param request
* @return
* @throws Exception 2017年12月28日 wangfs.<br/>
*/
@Override
public List<ParkingLot> queryParkingLotListByAreaBlockId(QueryParkingLotByAreaBlockRequest request) {
List<ParkingLot> list = parkingLotSMapper.queryParkingLotByAreaBlockId(request);
return list;
}
/**
* 校验停车场名称唯一性.<br/>
*
* @param request
* @return 2018年1月4日 wangfs.<br/>
*/
@Override
public Boolean checkUniqueForPlName(CheckUniqueForPlNameRequest request) {
int selectCounts = parkingLotSMapper.checkUniqueForPlName(request);
return selectCounts > 0 ? true : false;
}
/**
* 更新停车场块信息.<br/>
*
* @param request
* @return 2018年1月4日 wangfs.<br/>
*/
@Transactional(rollbackFor = Exception.class)
@Override
public Boolean updateBlockForParkLot(ChangeBlockForParkLotRequest request) {
int updateCount = parkingLotSMapper.updateBlockForParkLot(request);
if (updateCount > 0) {
// 更新缓存中的停车场对应的块信息
if (!CollectionUtils.isEmpty(request.getPlNos())) {
ParkingLotExample example = new ParkingLotExample();
example.createCriteria().andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value())
.andPlNoIn(request.getPlNos());
final List<ParkingLot> parkingLots = parkingLotMapper.selectByExample(example);
if (!CollectionUtil.isEmpty(parkingLots)) {
//更新缓存中的块信息
for (ParkingLot parkingLot : parkingLots) {
ParkingLotDTO parkLotByPlNo = ParkingLotCacheUtil.getParkLotByPlNo(parkingLot.getPlNo());
parkLotByPlNo.setPlAreaBlockName(request.getPlAreaBlockName());
ParkingLotCacheUtil.setParkLotByPlNo(parkingLot.getPlNo(), parkLotByPlNo);
}
}
}
}
return updateCount > 0 ? true : false;
}
/**
* 更新停车场块信息.<br/>
*
* @param request
* @return 2018年1月4日 wangfs.<br/>
*/
@Transactional(rollbackFor = Exception.class)
@Override
public Boolean updateAreaBlockForParkLot(ChangeBlockForParkLotRequest request) {
/**
* 更新停车场省份、地市、区县、块信息
*/
ParkingLot parkingLotUpdate = new ParkingLot();
List<Long> list = new ArrayList<>();
list.add(request.getPlAreaBlockId());
QueryProvinceCityAreaByBlockIdsRequest req = new QueryProvinceCityAreaByBlockIdsRequest();
req.setBlockIds(list);
req.setSysCode("1001");
BizResult<List<QueryProvinceCityAreaByBlockIdsDTO>> listBizResult = tbAreaService.queryProvinceCityAreaByBlockIdsRequest(req);
if(null != listBizResult && !CollectionUtils.isEmpty(listBizResult.getData())){
for(QueryProvinceCityAreaByBlockIdsDTO dto:listBizResult.getData()){
if(null == dto){
continue;
}
parkingLotUpdate.setPlProvinceId(dto.getProvinceId());
parkingLotUpdate.setPlProvinceName(dto.getProvinceName());
parkingLotUpdate.setPlCityId(dto.getCityId());
parkingLotUpdate.setPlCityName(dto.getCityName());
parkingLotUpdate.setPlCountryId(dto.getAreaId());
parkingLotUpdate.setPlCountryName(dto.getAreaName());
}
}
parkingLotUpdate.setPlAreaBlockId(request.getPlAreaBlockId());
parkingLotUpdate.setPlAreaBlockName(request.getPlAreaBlockName());
ParkingLotExample exampleUpdate = new ParkingLotExample();
exampleUpdate.createCriteria().andPlNoIn(request.getPlNos());
int updateCount = parkingLotMapper.updateByExampleSelective(parkingLotUpdate,exampleUpdate);
if (updateCount > 0) {
// 更新缓存中的停车场对应的块信息
if (!CollectionUtils.isEmpty(request.getPlNos())) {
ParkingLotExample example = new ParkingLotExample();
example.createCriteria().andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value())
.andPlNoIn(request.getPlNos());
final List<ParkingLot> parkingLots = parkingLotMapper.selectByExample(example);
if (!CollectionUtil.isEmpty(parkingLots)) {
//更新缓存中的块信息
for (ParkingLot parkingLot : parkingLots) {
ParkingLotDTO parkLotByPlNo = ParkingLotCacheUtil.getParkLotByPlNo(parkingLot.getPlNo());
parkLotByPlNo.setPlAreaBlockName(request.getPlAreaBlockName());
ParkingLotCacheUtil.setParkLotByPlNo(parkingLot.getPlNo(), parkLotByPlNo);
}
}
}
}
return updateCount > 0 ? true : false;
}
/**
* 通过办事处id更新停车场块信息.<br/>
*
* @param request
* @return 2018年1月4日 wangfs.<br/>
*/
@Override
public Boolean updateParkLotBlockNameByBlockId(ChangeBlockForParkLotRequest request) {
int updateCount = parkingLotSMapper.updateParkLotBlockNameByBlockId(request);
if (updateCount > 0) {
//查询该块下面的停车场,修改车场缓存中的块信息
ParkingLotExample example = new ParkingLotExample();
example.createCriteria().andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value())
.andPlAreaBlockIdEqualTo(request.getPlAreaBlockId());
final List<ParkingLot> parkingLots = parkingLotMapper.selectByExample(example);
if (CollectionUtil.isEmpty(parkingLots)) {
return true;
}
//更新缓存中的块信息
for (ParkingLot parkingLot : parkingLots) {
ParkingLotDTO parkLotByPlNo = ParkingLotCacheUtil.getParkLotByPlNo(parkingLot.getPlNo());
parkLotByPlNo.setPlAreaBlockName(request.getPlAreaBlockName());
ParkingLotCacheUtil.setParkLotByPlNo(parkingLot.getPlNo(), parkLotByPlNo);
}
}
return updateCount > 0 ? true : false;
}
@Override
public PageInfo<ParkingLotExtDO> queryParkLotExtByState(List<Integer> states, Integer pageNum, Integer pageSize) {
pageNum = pageNum == null || pageNum == 0 ? 1 : pageNum;
pageSize = PageUtil.pageSizeValidate(PageSizeEnum.PAGE_SIZE_BASE, pageSize);
PageHelper.startPage(pageNum, pageSize);
List<ParkingLotExtDO> parkingLotExtDOS = parkingLotSMapper.queryParkLotExtByState(states);
return new PageInfo<>(parkingLotExtDOS);
}
@Override
public String queryPlNoByPlOutNo(String plOutNo) {
return parkingLotSMapper.queryPlNoByPlOutNo(plOutNo);
}
@Override
public Integer queryPlBerthNumByPlOutNo(String plOutNo) {
return parkingLotSMapper.queryPlBerthNumByPlOutNo(plOutNo);
}
@Override
public List<ParkingLot> queryParkLotByOrgIdAndPlNos(Long orgId, List<String> plNos, Integer plType) {
ParkingLotExample example = new ParkingLotExample();
Criteria sql = example.createCriteria().andOrgIdEqualTo(orgId).andDataStatusEqualTo(
DataStatusEnum.DATA_STATUS_VALID.value());
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(plNos)) {
sql.andPlNoIn(plNos);
}
if (null != plType) {
sql.andPlTypeEqualTo(plType);
}
return parkingLotMapper.selectByExample(example);
}
@Override
public List<Long> getOrgIdsByCityIds(QueryOrgIdsByCityIdsRequest request) {
return parkingLotSMapper.getOrgIdsByCityIds(request);
}
@Override
public List<ParkDeviceStaForEveryDTO> queryDeviceStatistic(QueryParkSourceByOrgIdsRequest request) {
return parkingLotSMapper.queryDeviceStatistic(request);
}
@Override
public Integer queryParkNumStatisticByOrgIds(QueryParkSourceByOrgIdsRequest request) {
return parkingLotSMapper.queryParkNumStatisticByOrgIds(request);
}
@Override
public ParkNumInfoDTO queryParkNumInfoStatisticByOrgIds(QueryParkSourceByOrgIdsRequest request) {
return parkingLotSMapper.queryParkNumInfoStatisticByOrgIds(request);
}
@Override
public List<ParkDutyInfoDTO> queryParkDutyInfo(ParkDutyInfoQueryReq req) {
return parkingLotSMapper.queryParkDutyInfo(req);
}
@Override
public List<ParkingLot> qyeryAllParkingLotByOrgId(ParkDutyInfoQueryReq req) {
ParkingLotExample example = new ParkingLotExample();
Criteria sql = example.createCriteria();
sql.andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value())
.andOrgIdEqualTo(req.getOrgId())
.andStateEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
if (req.getPlBusiType() != null && !("3".equals(req.getPlBusiType()))) {
//判断是否自营 营业类型:1:自营,2:非自营 3:全部
sql.andPlBusiTypeEqualTo(req.getPlBusiType());
}
if(!CollectionUtils.isEmpty(req.getAreaCardTypes())){
sql.andAreaTypeIn(req.getAreaCardTypes());
}
if(!CollectionUtils.isEmpty(req.getPlTypes())){
sql.andPlTypeIn(req.getPlTypes());
}
if(!StringUtils.isEmpty(req.getPlName())){
sql.andPlNameLike("%"+req.getPlName()+"%");
}
List<ParkingLot> parkingLots = parkingLotMapper.selectByExample(example);
return parkingLots;
}
@Override
public List<String> queryBusiPlNameByOrgIds(QueryParkSourceByOrgIdsRequest req) {
List<String> plNos = parkingLotSMapper.queryBusiPlNameByOrgIds(req.getOrgIds());
List<String> realPlNos = new ArrayList<>();
realPlNos.add("-1");
if(CollectionUtils.isEmpty(plNos)){
return realPlNos;
}
return plNos;
}
@Override
public List<PlNameDTO> queryPlNameByPlNo(QueryPlNameRequest request) {
return parkingLotSMapper.queryPlNameByPlNo(request);
}
@Override
public List<ParkingLot> queryETCParkingLot(QueryETCParkLotRequest req) {
ParkingLotExample example = new ParkingLotExample();
example.createCriteria().andSupportEtcEqualTo(1)
.andOrgIdEqualTo(req.getOrgId())
.andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
return parkingLotMapper.selectByExample(example);
}
/**
* 停车场最大编码获取:以 PL 或者 TL 开头的
* @param prefixStr
* @return
*/
@Override
public String selectMaxPlNO(String prefixStr) {
return parkingLotSMapper.selectMaxPlNO(prefixStr);
}
@Override
public List<ParkingLot> queryParkListByOrgId(QueryParkListByParkRequest request) {
ParkingLotExample example = new ParkingLotExample();
if(!StringUtils.isEmpty(request.getPushState())){
example.createCriteria()
.andPushStateEqualTo(request.getPushState());
}
if(!StringUtils.isEmpty(request.getPlType())){
example.createCriteria()
.andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value())
.andOrgIdEqualTo(request.getOrgId())
.andPlTypeEqualTo(NumberUtils.toInt(request.getPlType()));
}else{
example.createCriteria()
.andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value())
.andOrgIdEqualTo(request.getOrgId())
.andSourceTypeIn(request.getSourceTypes());
}
List<ParkingLot> parkingLots = this.parkingLotMapper.selectByExample(example);
return parkingLots;
}
}