|
|
@@ -35,8 +35,6 @@ import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
-import org.springblade.smartapplication.carenterrecord.entity.CarEnterRecord;
|
|
|
-import org.springblade.smartapplication.carenterrecord.service.ICarEnterRecordService;
|
|
|
import org.springframework.util.Assert;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
@@ -47,10 +45,9 @@ import org.springblade.community.tdcarrecord.wrapper.TdCarRecordWrapper;
|
|
|
import org.springblade.community.tdcarrecord.service.ITdCarRecordService;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
-import java.lang.reflect.Array;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 控制器
|
|
|
@@ -66,7 +63,6 @@ public class TdCarRecordController extends BladeController {
|
|
|
|
|
|
private final ITdCarRecordService carRecordService;
|
|
|
private final IParkingLotService parkingLotService;
|
|
|
- private final ICarEnterRecordService ankuaiCarEnterRecordService;
|
|
|
|
|
|
/**
|
|
|
* 详情
|
|
|
@@ -88,24 +84,27 @@ public class TdCarRecordController extends BladeController {
|
|
|
public R<IPage<TdCarRecordVO>> list(TdTdCarRecordDTO tdCarRecord, Query query, BladeUser bladeUser) {
|
|
|
String tenantId = bladeUser.getTenantId();
|
|
|
LambdaQueryWrapper<TdCarRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- ParkingLot parkingLot = null;
|
|
|
+ List<String> parkingLotKey = null;
|
|
|
if(tenantId.equals("000000")){
|
|
|
if(tdCarRecord.getResidentialId() == null){
|
|
|
return R.data(null);
|
|
|
}
|
|
|
- parkingLot = parkingLotService.getByResidentialId(tdCarRecord.getResidentialId());
|
|
|
- Assert.notNull(parkingLot, "该小区下没有创建车场");
|
|
|
+ List<ParkingLot> lotList = parkingLotService.getByResidentialId(tdCarRecord.getResidentialId());
|
|
|
+ Assert.isTrue(lotList.size() > 0, "该小区下没有创建车场");
|
|
|
+ parkingLotKey = lotList.stream().map(lot -> lot.getParkKey()).collect(Collectors.toList());
|
|
|
}else{
|
|
|
if(tdCarRecord.getAgencyId() == null){
|
|
|
return R.data(null);
|
|
|
}
|
|
|
- parkingLot = parkingLotService.getByAgencyId(tdCarRecord.getAgencyId());
|
|
|
- Assert.notNull(parkingLot, "该园区下没有创建车场");
|
|
|
+ List<ParkingLot> lotList = parkingLotService.getByAgencyId(tdCarRecord.getAgencyId());
|
|
|
+ Assert.isTrue(lotList.size() > 0, "该园区下没有创建车场");
|
|
|
+ parkingLotKey = lotList.stream().map(lot -> lot.getParkKey()).collect(Collectors.toList());
|
|
|
}
|
|
|
+
|
|
|
if(tdCarRecord.getInOrOut() == 1){
|
|
|
- lambdaQueryWrapper.eq(TdCarRecord::getInMac, parkingLot.getParkKey());
|
|
|
+ lambdaQueryWrapper.in(TdCarRecord::getInMac, parkingLotKey);
|
|
|
}else{
|
|
|
- lambdaQueryWrapper.eq(TdCarRecord::getOutMac, parkingLot.getParkKey());
|
|
|
+ lambdaQueryWrapper.in(TdCarRecord::getOutMac, parkingLotKey);
|
|
|
}
|
|
|
lambdaQueryWrapper.orderByDesc(TdCarRecord::getCreateTime);
|
|
|
IPage<TdCarRecord> pages = carRecordService.page(Condition.getPage(query), lambdaQueryWrapper);
|
|
|
@@ -121,48 +120,30 @@ public class TdCarRecordController extends BladeController {
|
|
|
public R<IPage<TdCarRecordVO>> getRecord(TdTdCarRecordDTO tdCarRecord, Query query, BladeUser bladeUser) {
|
|
|
String tenantId = bladeUser.getTenantId();
|
|
|
LambdaQueryWrapper<TdCarRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- ParkingLot parkingLot = null;
|
|
|
+ List<String> parkingLotKey = new ArrayList<>();
|
|
|
if(tenantId.equals("000000")){
|
|
|
if(tdCarRecord.getResidentialId() == null){
|
|
|
return R.data(null);
|
|
|
}
|
|
|
- parkingLot = parkingLotService.getByResidentialId(tdCarRecord.getResidentialId());
|
|
|
- if(parkingLot == null){
|
|
|
+ List<ParkingLot> lotList = parkingLotService.getByResidentialId(tdCarRecord.getResidentialId());
|
|
|
+ if(lotList == null || lotList.size() == 0){
|
|
|
return R.data(new Page<TdCarRecordVO>());
|
|
|
}
|
|
|
- }else if(tenantId.equals("804981")){
|
|
|
- LambdaQueryWrapper<CarEnterRecord> lambda = new LambdaQueryWrapper<>();
|
|
|
- lambda.orderByDesc(CarEnterRecord::getCreateTime);
|
|
|
- lambda.eq(CarEnterRecord::getTenantId, tenantId);
|
|
|
- IPage<CarEnterRecord> page = ankuaiCarEnterRecordService.page(Condition.getPage(query), lambda);
|
|
|
- IPage<TdCarRecord> pages = new Page<>();
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- List<TdCarRecord> list = new ArrayList();
|
|
|
- for(CarEnterRecord carEnterRecord : page.getRecords()){
|
|
|
- TdCarRecord tdCarRecord1 = new TdCarRecord();
|
|
|
- tdCarRecord1.setPlateNumber(carEnterRecord.getCarNo());
|
|
|
- tdCarRecord1.setEntrance(carEnterRecord.getEnterGateName());
|
|
|
- tdCarRecord1.setEnterTime(sdf.format(carEnterRecord.getEnterTime()));
|
|
|
- tdCarRecord1.setInMac("ak923784322134");
|
|
|
- tdCarRecord1.setEnterPic(carEnterRecord.getEnterImgPath());
|
|
|
- list.add(tdCarRecord1);
|
|
|
- }
|
|
|
- pages.setRecords(list);
|
|
|
- pages.setTotal(list.size());
|
|
|
- return R.data(TdCarRecordWrapper.build().pageVO(pages));
|
|
|
- } else{
|
|
|
+ parkingLotKey = lotList.stream().map(lot -> lot.getParkKey()).collect(Collectors.toList());
|
|
|
+ }else{
|
|
|
LambdaQueryWrapper<ParkingLot> parkLogWrapper = new LambdaQueryWrapper<>();
|
|
|
parkLogWrapper.eq(ParkingLot::getTenantId, bladeUser.getTenantId());
|
|
|
- parkingLot = parkingLotService.getOne(parkLogWrapper);
|
|
|
+ ParkingLot parkingLot = parkingLotService.getOne(parkLogWrapper);
|
|
|
if(parkingLot == null){
|
|
|
return R.data(new Page<TdCarRecordVO>());
|
|
|
}
|
|
|
+ parkingLotKey.add(parkingLot.getParkKey());
|
|
|
}
|
|
|
if(tdCarRecord.getInOrOut() != null){
|
|
|
if(tdCarRecord.getInOrOut() == 1){
|
|
|
- lambdaQueryWrapper.eq(TdCarRecord::getInMac, parkingLot.getParkKey());
|
|
|
+ lambdaQueryWrapper.in(TdCarRecord::getInMac, parkingLotKey);
|
|
|
}else{
|
|
|
- lambdaQueryWrapper.eq(TdCarRecord::getOutMac, parkingLot.getParkKey());
|
|
|
+ lambdaQueryWrapper.in(TdCarRecord::getOutMac, parkingLotKey);
|
|
|
}
|
|
|
}
|
|
|
lambdaQueryWrapper.orderByDesc(TdCarRecord::getCreateTime);
|