大屏数据-停车场迁移

This commit is contained in:
XinWei 2024-08-16 13:46:03 +08:00
parent 8b5c9e12c1
commit f75b826a55
33 changed files with 1076 additions and 6 deletions

View File

@ -3,7 +3,7 @@
spring: spring:
cloud: cloud:
nacos: nacos:
server-addr: crm.fjptzykj.com:8849 server-addr: 127.0.0.1:8848
discovery: discovery:
namespace: dev # 命名空间。这里使用 dev 开发环境 namespace: dev # 命名空间。这里使用 dev 开发环境
metadata: metadata:
@ -16,7 +16,7 @@ spring:
nacos: nacos:
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类 # Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
config: config:
server-addr: crm.fjptzykj.com:8849 # Nacos 服务器地址 server-addr: 127.0.0.1:8848 # Nacos 服务器地址
namespace: dev # 命名空间 dev 的ID不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev这里使用 dev 开发环境 namespace: dev # 命名空间 dev 的ID不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev这里使用 dev 开发环境
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId默认为 spring.application.name name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId默认为 spring.application.name

View File

@ -1,16 +1,143 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.transitionflight; package cn.iocoder.yudao.module.datacenter.controller.admin.transitionflight;
import cn.iocoder.yudao.module.datacenter.controller.admin.transitionflight.vo.FerryData;
import cn.iocoder.yudao.module.datacenter.utlis.ResponseVO;
import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
/** /**
* @Description 车辆过渡情况 * @Description 车辆过渡情况
*/ */
@Tag(name = "大屏服务 - 车辆过渡情况") @Tag(name = "大屏服务 - 车辆过渡情况")
@RestController @RestController
@RequestMapping("/h5/transitionFlight") @RequestMapping("/datacenter/h5/transitionFlight")
@Validated @Validated
public class TransitionFlightApi { public class TransitionFlightApi {
//智慧票务检票系统车辆过渡情况(南日)
@GetMapping("/getPageInfo")
public ResponseVO getPageInfo(){
try {
// 定义接口地址
String apiUrl = "http://scld.ptzyKjgs.com/camera/vehicleInOutRecord/getPageInfo";
// 创建 URL 对象
URL url = new URL(apiUrl);
// 创建 HttpURLConnection 对象
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// 设置请求方法
connection.setRequestMethod("POST");
// 获取响应码
int responseCode = connection.getResponseCode();
// 如果响应码为 200表示请求成功
if (responseCode == HttpURLConnection.HTTP_OK) {
// 创建 BufferedReader 读取响应内容
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuilder response = new StringBuilder();
String line;
// 读取响应内容
while ((line = reader.readLine()) != null) {
response.append(line);
}
// 关闭 BufferedReader
reader.close();
String responseData = response.toString();
// 使用 Gson 解析 JSON 数据
Gson gson = new Gson();
JsonObject jsonObject = gson.fromJson(responseData, JsonObject.class);
// 提取 data 字段
JsonObject dataObject = jsonObject.getAsJsonObject("data");
FerryData ferryData = new FerryData();
ferryData.setOtherLotsNR(dataObject.get("otherLots").getAsInt());
ferryData.setTotalLotsNR(dataObject.get("totalLots").getAsInt());
ferryData.setCurrentLotsNR(dataObject.get("currentLots").getAsInt());
return ResponseVO.success(200,"请求成功",ferryData,0);
} else {
System.out.println("请求失败,响应码:" + responseCode);
}
// 断开连接
connection.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
return ResponseVO.error(500,"请求失败");
}
//智慧票务检票系统车辆过渡情况(石城)
@GetMapping("/getCurrent")
public ResponseVO getCurrent(){
try {
// 定义接口地址
String apiUrl = "http://scld.ptzyKjgs.com/camera/vehicleInOutRecord/getCurrent";
// 创建 URL 对象
URL url = new URL(apiUrl);
// 创建 HttpURLConnection 对象
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// 设置请求方法
connection.setRequestMethod("POST");
// 获取响应码
int responseCode = connection.getResponseCode();
// 如果响应码为 200表示请求成功
if (responseCode == HttpURLConnection.HTTP_OK) {
// 创建 BufferedReader 读取响应内容
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuilder response = new StringBuilder();
String line;
// 读取响应内容
while ((line = reader.readLine()) != null) {
response.append(line);
}
// 关闭 BufferedReader
reader.close();
String responseData = response.toString();
// 使用 Gson 解析 JSON 数据
Gson gson = new Gson();
JsonObject jsonObject = gson.fromJson(responseData, JsonObject.class);
// 提取 data 字段
JsonObject dataObject = jsonObject.getAsJsonObject("data");
FerryData ferryData = new FerryData();
ferryData.setOtherLotsSC(dataObject.get("otherLots").getAsInt());
ferryData.setTotalLotsSC(dataObject.get("totalLots").getAsInt());
ferryData.setCurrentLotsSC(dataObject.get("currentLots").getAsInt());
return ResponseVO.success(200,"请求成功",ferryData,0);
} else {
System.out.println("请求失败,响应码:" + responseCode);
}
// 断开连接
connection.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
return ResponseVO.error(500,"请求失败");
}
} }

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.transitionflight.vo;
import lombok.Data;
/**
* 轮渡车辆过度数据
*/
@Data
public class FerryData {
private int otherLotsSC;//已进岛数
private int totalLotsSC;//计划进岛数
private int currentLotsSC;//剩余进岛数
private int otherLotsNR;
private int totalLotsNR;
private int currentLotsNR;
}

View File

@ -0,0 +1,339 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess;
import cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo.AreaDataVO;
import cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo.ParkingLotDataVO;
import cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo.RevenueVO;
import cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess.*;
import cn.iocoder.yudao.module.datacenter.dal.mongodb.vehicleaccess.*;
import cn.iocoder.yudao.module.datacenter.utlis.ResponseVO;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;
import java.util.Optional;
@Tag(name = "大屏服务 - 停车场接口")
@RestController
@RequestMapping("/datacenter/h5/vehicleAccess")
public class VehicleAccessApi {
@Autowired
private BlueCardHeartbeatRepository blueCardHeartbeatRepository;
@Autowired
AppearanceRecordRepository appearanceRecordRepository;
@Autowired
EntryRecordRepository entryRecordRepository;
@Autowired
AccessRecordPictureRepository accessRecordPictureRepository;
@Autowired
VehicleRecordRepository vehicleRecordRepository;
@Autowired
RevenueRepository revenueRepository;
@GetMapping("/list")
public ResponseVO list(){
// 获取今天的日期
LocalDate today = LocalDate.now();
LocalDateTime startOfDay = LocalDateTime.of(today, LocalTime.MIN);
LocalDateTime endOfDay = LocalDateTime.of(today, LocalTime.MAX);
Revenue revenue = new Revenue();
revenue.setAreaName("中关村软件园一号院");
revenue.setCreateTime(LocalDateTime.now());
revenue.setGetTime("2024.05.14 12:15:36");
revenue.setMemo("");
revenue.setPayCharge("30");
revenue.setPayKind("微信");
revenue.setPlate("京A 88888");
revenueRepository.insert(revenue);
return ResponseVO.success(200,"添加成功",null,0);
}
//获取实时车辆进出数据和今日车位统计
@GetMapping("/parkingLotData")
public ResponseVO parkAndVacancy(){
//时间最新的一条数据
Optional<BlueCardHeartbeat> latestHeartbeat = blueCardHeartbeatRepository.findTopByOrderByCreateTimeDesc();
if (latestHeartbeat.isPresent()) {
BlueCardHeartbeat heartbeat = latestHeartbeat.get();
ParkingLotDataVO parkingLotDataVO = new ParkingLotDataVO();
int parkingNum = heartbeat.getSpaceCount() - heartbeat.getFreeSpaceCount();
int residualStopNum = heartbeat.getSpaceCount() - parkingNum ;
//车辆进出实时数据
parkingLotDataVO.setParkingNum(parkingNum);//实时停车数
parkingLotDataVO.setResidualStopNum(residualStopNum);//剩余车位数
// 获取今天的日期
LocalDate today = LocalDate.now();
// 计算今天的起始时间和结束时间
LocalDateTime startOfDay = LocalDateTime.of(today, LocalTime.MIN);
LocalDateTime endOfDay = LocalDateTime.of(today, LocalTime.MAX);
List<EntryRecord> entryRecords = entryRecordRepository.findByCreateTimeBetween(startOfDay, endOfDay);
parkingLotDataVO.setIntoNum(entryRecords.size());//车辆进入数
List<AppearanceRecord> appearanceRecords = appearanceRecordRepository.findByCreateTimeBetween(startOfDay, endOfDay);
parkingLotDataVO.setOutNum(appearanceRecords.size());//车辆出入数
//今日车位统计
parkingLotDataVO.setTotalParkingSpace(heartbeat.getSpaceCount());//车位总数
parkingLotDataVO.setResidualTotal(residualStopNum);//余位总数
// 计算利用率
int useRatio = (parkingNum / residualStopNum) * 100;
parkingLotDataVO.setUseRatio(useRatio);//总利用率
//设置区域停车场数据
for (int i = 0; i < heartbeat.getAreaList().size(); i++) {
AreaDataVO areaDataVO = new AreaDataVO();
areaDataVO.setAreaName(heartbeat.getAreaList().get(i).getAreaName());
areaDataVO.setParkingCount(heartbeat.getAreaList().get(i).getSpaceCount());
areaDataVO.setLastSpaceCount(heartbeat.getAreaList().get(i).getLastSpaceCount());
areaDataVO.setUseRatio((heartbeat.getAreaList().get(i).getLastSpaceCount() / heartbeat.getAreaList().get(i).getSpaceCount()) * 100);
parkingLotDataVO.getAreaDataVOList().add(areaDataVO);
}
return ResponseVO.success(200,"",parkingLotDataVO,0);
}
return ResponseVO.error(500,"");
}
//车辆进出趋势数据
@GetMapping("/tendencyChart")
public ResponseVO tendencyChart(){
ParkingLotDataVO parkingLotDataVO = new ParkingLotDataVO();
LocalDate today = LocalDate.now();
LocalDateTime startOfDay = LocalDateTime.of(today, LocalTime.MIN);
LocalDateTime endOfDay = LocalDateTime.of(today, LocalTime.MAX);
//进入数据
List<EntryRecord> entryRecordList = entryRecordRepository.findByCreateTimeBetween(startOfDay, endOfDay);
//出入数据
List<AppearanceRecord> appearanceRecordList = appearanceRecordRepository.findByCreateTimeBetween(startOfDay, endOfDay);
int count = 0;
int count1 = 0;
int count2 = 0;
int count3 = 0;
int count4 = 0;
int count5 = 0;
int count6 = 0;
LocalDateTime startTime1 = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0);
LocalDateTime endTime1 = LocalDateTime.now().withHour(3).withMinute(59).withSecond(59).withNano(999999999);
LocalDateTime startTime2 = LocalDateTime.now().withHour(4).withMinute(0).withSecond(0).withNano(0);
LocalDateTime endTime2 = LocalDateTime.now().withHour(7).withMinute(59).withSecond(59).withNano(999999999);
LocalDateTime startTime3 = LocalDateTime.now().withHour(8).withMinute(0).withSecond(0).withNano(0);
LocalDateTime endTime3 = LocalDateTime.now().withHour(11).withMinute(59).withSecond(59).withNano(999999999);
LocalDateTime startTime4 = LocalDateTime.now().withHour(12).withMinute(0).withSecond(0).withNano(0);
LocalDateTime endTime4 = LocalDateTime.now().withHour(15).withMinute(59).withSecond(59).withNano(999999999);
LocalDateTime startTime5 = LocalDateTime.now().withHour(16).withMinute(0).withSecond(0).withNano(0);
LocalDateTime endTime5 = LocalDateTime.now().withHour(19).withMinute(59).withSecond(59).withNano(999999999);
LocalDateTime startTime6 = LocalDateTime.now().withHour(20).withMinute(0).withSecond(0).withNano(0);
LocalDateTime endTime6 = LocalDateTime.now().withHour(23).withMinute(59).withSecond(59).withNano(999999999);
for (int i = 0; i < entryRecordList.size(); i++) {
EntryRecord entryRecord = entryRecordList.get(i);
if (entryRecord.getCreateTime().isAfter(startTime1) && entryRecord.getCreateTime().isBefore(endTime1)){
count1++;
continue;
}
if (entryRecord.getCreateTime().isAfter(startTime2) && entryRecord.getCreateTime().isBefore(endTime2)){
count2++;
continue;
}
if (entryRecord.getCreateTime().isAfter(startTime3) && entryRecord.getCreateTime().isBefore(endTime3)){
count3++;
continue;
}
if (entryRecord.getCreateTime().isAfter(startTime4) && entryRecord.getCreateTime().isBefore(endTime4)){
count4++;
continue;
}
if (entryRecord.getCreateTime().isAfter(startTime5) && entryRecord.getCreateTime().isBefore(endTime5)){
count5++;
continue;
}
if (entryRecord.getCreateTime().isAfter(startTime6) && entryRecord.getCreateTime().isBefore(endTime6)){
count6++;
}
}
parkingLotDataVO.getIntoCount().add(count);
parkingLotDataVO.getIntoCount().add(count1);
parkingLotDataVO.getIntoCount().add(count2);
parkingLotDataVO.getIntoCount().add(count3);
parkingLotDataVO.getIntoCount().add(count4);
parkingLotDataVO.getIntoCount().add(count5);
parkingLotDataVO.getIntoCount().add(count6);
count1 = 0;
count2 = 0;
count3 = 0;
count4 = 0;
count5 = 0;
count6 = 0;
for (int i = 0; i < appearanceRecordList.size(); i++) {
AppearanceRecord appearanceRecord = appearanceRecordList.get(i);
if (appearanceRecord.getCreateTime().isAfter(startTime1) && appearanceRecord.getCreateTime().isBefore(endTime1)){
count1++;
continue;
}
if (appearanceRecord.getCreateTime().isAfter(startTime2) && appearanceRecord.getCreateTime().isBefore(endTime2)){
count2++;
continue;
}
if (appearanceRecord.getCreateTime().isAfter(startTime3) && appearanceRecord.getCreateTime().isBefore(endTime3)){
count3++;
continue;
}
if (appearanceRecord.getCreateTime().isAfter(startTime4) && appearanceRecord.getCreateTime().isBefore(endTime4)){
count4++;
continue;
}
if (appearanceRecord.getCreateTime().isAfter(startTime5) && appearanceRecord.getCreateTime().isBefore(endTime5)){
count5++;
continue;
}
if (appearanceRecord.getCreateTime().isAfter(startTime6) && appearanceRecord.getCreateTime().isBefore(endTime6)){
count6++;
}
}
parkingLotDataVO.getOutCount().add(count);
parkingLotDataVO.getOutCount().add(count1);
parkingLotDataVO.getOutCount().add(count2);
parkingLotDataVO.getOutCount().add(count3);
parkingLotDataVO.getOutCount().add(count4);
parkingLotDataVO.getOutCount().add(count5);
parkingLotDataVO.getOutCount().add(count6);
return ResponseVO.success(200,"",parkingLotDataVO,0);
}
//车辆出入实时记录图
@GetMapping("/recordOfAccess")
public ResponseVO recordOfAccess(int page){
// 获取今天的日期
LocalDate today = LocalDate.now();
LocalDateTime startOfDay = LocalDateTime.of(today, LocalTime.MIN);
LocalDateTime endOfDay = LocalDateTime.of(today, LocalTime.MAX);
long total = vehicleRecordRepository.countByCreateTimeBetween(startOfDay, endOfDay);
// 创建分页请求
Pageable pageable = PageRequest.of(page, 4);
Page<VehicleRecord> recordOfAccessList = vehicleRecordRepository.findByCreateTimeBetweenOrderByCreateTimeAsc(startOfDay, endOfDay, pageable);
return ResponseVO.success(200,"",recordOfAccessList,total);
}
//车辆营收统计
@GetMapping("/revenue")
public ResponseVO revenue(String date,String areaName){
List<Revenue> revenueList;
LocalDateTime startOfDay = null;
LocalDateTime endOfDay = null;
if (date.equals("今日")){
// 获取今天的日期
LocalDate today = LocalDate.now();
startOfDay = LocalDateTime.of(today, LocalTime.MIN);
endOfDay = LocalDateTime.of(today, LocalTime.MAX);
}
if (date.equals("近一周")){
endOfDay = LocalDateTime.now(); // 结束时间为当前时间
startOfDay = endOfDay.minusDays(7); // 开始时间为当前时间的前7天
}
if (date.equals("近一月")){
endOfDay = LocalDateTime.now(); // 结束时间为当前时间
startOfDay = endOfDay.minusMonths(1); // 开始时间为当前时间的前一个月
}
if (areaName.equals("全部")){
revenueList = revenueRepository.findByCreateTimeBetween(startOfDay, endOfDay);
}else {
revenueList = revenueRepository.findByCreateTimeAndAreaName(startOfDay, endOfDay, areaName);
}
// 声明 BigDecimal 对象来保存金额
BigDecimal sum = BigDecimal.ZERO;
BigDecimal zfb = BigDecimal.ZERO;
BigDecimal wx = BigDecimal.ZERO;
BigDecimal yl = BigDecimal.ZERO;
BigDecimal xj = BigDecimal.ZERO;
BigDecimal gjk = BigDecimal.ZERO;
// 循环计算金额
for (int i = 0; i < revenueList.size(); i++) {
Revenue revenue = revenueList.get(i);
BigDecimal charge = new BigDecimal(revenue.getPayCharge());
if (revenue.getPayKind().equals("现金")){
xj = xj.add(charge);
} else if (revenue.getPayKind().equals("微信")){
wx = wx.add(charge);
} else if (revenue.getPayKind().equals("支付宝")){
zfb = zfb.add(charge);
} else if (revenue.getPayKind().equals("银联")){
yl = yl.add(charge);
} else if (revenue.getPayKind().equals("公交卡")){
gjk = gjk.add(charge);
}
}
// 计算总和
sum = sum.add(xj).add(wx).add(zfb).add(yl).add(gjk);
RevenueVO revenueVO = new RevenueVO();
revenueVO.setSum(sum);
revenueVO.setGjk(gjk);
revenueVO.setWx(wx);
revenueVO.setXj(xj);
revenueVO.setYl(yl);
revenueVO.setZfb(zfb);
return ResponseVO.success(200,"",revenueVO ,0);
}
//预警信息栏
@GetMapping("/warning_information_bar")
public ResponseVO warningInformation(){
return ResponseVO.success(200,"今日实时客流人数125同比上月实时人数提升12%。今日车辆数量135同比上月实时人数提升13%。今日沿海阵风3级.....",null ,0);
}
}

View File

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
@Data
public class AppearanceRecordCarInfoVo {
private String plate;
private String plateColor;
private String ticketCode;
private String carType;
private Integer confidence;
}

View File

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
@Data
public class AppearanceRecordChargeListVo {
private String payNo;
private String getTime;
private String payCharge;
private String payKind;
private String payChannel;
private String memo;
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
@Data
public class AppearanceRecordChargeStatisticsVo {
private String charge;
private String onLineCharge;
private String offLineCharge;
private String profitChargeTotal;
private String onLineProfitChargeNum;
private String onLineProfitChargeValue;
private String offLineProfitChargeNum;
private String offLineProfitChargeValue;
private String onLineProfitTimeNum;
private String onLineProfitTimeValue;
private String offLineProfitTimeNum;
private String offLineProfitTimeValue;
}

View File

@ -0,0 +1,15 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
@Data
public class AppearanceRecordPassInfoVo {
private String inTime;
private String outTime;//出场时间
private String inImage;
private String outImage;
private String inChannel;
private String outChannel;
private String openGateMode;
private String matchMode;
}

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
@Data
public class AppearanceRecordPlaceInfoVo {
private String areaId;
private String areaName;
private String placeNumber;
private String memo;
}

View File

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
@Data
public class AppearanceRecordProfitListVo {
private String profitCode;
private String getTime;
private String profitTime;
private String profitCharge;
private String profitChargeValue;
private String memo;
}

View File

@ -0,0 +1,8 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
@Data
public class AppearanceRecordUserInfoVo {
private String idCard;
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
import java.util.ArrayList;
@Data
public class AppearanceRecordVo {
private String orderId;
private String operatorId;
private String operatorName;
private String invoiceNo;
private AppearanceRecordCarInfoVo carInfo;
private AppearanceRecordUserInfoVo userInfo;
private AppearanceRecordPassInfoVo passInfo;
private AppearanceRecordChargeStatisticsVo chargeStatistics;
private ArrayList<AppearanceRecordChargeListVo> chargeList;
private ArrayList<AppearanceRecordProfitListVo> profitList;
private ArrayList<AppearanceRecordPlaceInfoVo> placeInfo;
private String costTime;
private String plate;
private String plateColor;
private String ticketCode;
private String carType;
private Integer confidence;
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
@Data
public class AreaDataVO {
//区域停车场名称
private String areaName;
//区域停车总数
private int parkingCount;
//区域余位总数
private int lastSpaceCount;
//区域利用率
private int useRatio;
}

View File

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
@Data
public class BlueCardHeartbeatVo {
private String areaName;
private Integer spaceCount;
private Integer lastSpaceCount;
private Integer bookSpaceCount;
private Integer bookInParkCount;
private Integer areaId;
}

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
@Data
public class EntryRecordPlaceInfoVo {
private String areaId;
private String areaName;
private String placeNumber;
private String memo;
}

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
@Data
public class EntryRecordUserInfoVo {
private String idCard;
private String userName;
private String phone;
private String address;
}

View File

@ -0,0 +1,26 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
import java.util.ArrayList;
@Data
public class EntryRecordVo {
private String plate;
private String ticketCode;
private String plateColor;
private String inTime;//入场时间
private String inChannel;
private String inImage;
private String orderId;
private String visitReason;
private String openGateMode;
private String matchMode;
private String idCard;
private Integer confidence;
private String carType;
private EntryRecordUserInfoVo userInfo;
private ArrayList<EntryRecordPlaceInfoVo> placeInfo;
private String barriorOpen;
private String costTime;
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
/**
* 停车场数据
*/
public class ParkingLotDataVO {
//实时停车数
private int parkingNum;
//剩余停车位
private int residualStopNum;
//车辆进入数
private int intoNum;
//车辆出入数
private int outNum;
//车位总数
private int totalParkingSpace;
//余位总数
private int residualTotal;
//总利用率
private int useRatio;
//区域停车场数据集合
private List<AreaDataVO> areaDataVOList = new ArrayList<>();
//车辆进出趋势时间
private String[] timeList;
//车辆进出趋势进入车辆数量集合
private List<Integer> intoCount = new ArrayList<>();
//车辆进出趋势出入车辆数量集合
private List<Integer> outCount = new ArrayList<>();
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 车辆营收统计数据
*/
@Data
public class RevenueVO {
//支付宝
private BigDecimal zfb;
//微信
private BigDecimal wx;
//银联
private BigDecimal yl;
//现金
private BigDecimal xj;
//公交卡
private BigDecimal gjk;
//总金额
private BigDecimal sum;
}

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.datacenter.controller.admin.weather;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.datacenter.controller.admin.weather.vo.WeatherInfoVO; import cn.iocoder.yudao.module.datacenter.controller.admin.weather.vo.WeatherInfoVO;
import cn.iocoder.yudao.module.datacenter.utlis.GoodWeatherUtil; import cn.iocoder.yudao.module.datacenter.utlis.GoodWeatherUtil;
import cn.iocoder.yudao.module.datacenter.utlis.ResponseVO;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -15,14 +16,14 @@ import org.springframework.web.bind.annotation.RestController;
*/ */
@Tag(name = "大屏服务 - 天气接口") @Tag(name = "大屏服务 - 天气接口")
@RestController @RestController
@RequestMapping("/h5/weather") @RequestMapping("/datacenter/h5/weather")
@Validated @Validated
public class WeatherApi { public class WeatherApi {
@GetMapping(value = "/getWeather") @GetMapping(value = "/getWeather")
@Operation(summary = "获得输入城市的天气") @Operation(summary = "获得输入城市的天气")
public CommonResult<WeatherInfoVO> getWeather(String cityCode) { public ResponseVO getWeather(String cityCode) {
String weatherData = GoodWeatherUtil.getWeatherData(cityCode); String weatherData = GoodWeatherUtil.getWeatherData(cityCode);
WeatherInfoVO weatherInfo = GoodWeatherUtil.GetWeather(weatherData); WeatherInfoVO weatherInfo = GoodWeatherUtil.GetWeather(weatherData);
return CommonResult.success(weatherInfo); return new ResponseVO(200,"",weatherInfo,0);
} }
} }

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@Document("access_record_picture")
@Data
@XmlRootElement(name = "root")
@XmlAccessorType(XmlAccessType.FIELD)
public class AccessRecordPicture {
@XmlElement
private String id;
@XmlElement
private String parkNumber;
@XmlElement
private String imageName;
@XmlElement
private String image;
@XmlElement
private String imgAddress;
@XmlElement
private byte[] resource;
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess;
import cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo.AppearanceRecordVo;
import lombok.Data;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import java.time.LocalDateTime;
import java.util.ArrayList;
@Document("appearance_record")
@Data
public class AppearanceRecord {
private String id;
private String parkNumber;
private Integer size;
@Indexed
private LocalDateTime createTime;
private ArrayList<AppearanceRecordVo> datas;
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess;
import cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo.BlueCardHeartbeatVo;
import lombok.Data;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import java.time.LocalDateTime;
import java.util.ArrayList;
@Document("blue_card_heartbeat")
@Data
public class BlueCardHeartbeat {
private String id;
private String parkNumber;
private String parkName;
private Integer spaceCount;//场库总车位数
private Integer freeSpaceCount;//场库空车位数
private Integer bookSpaceCount;
private Integer bookInParkCount;
@Indexed
private LocalDateTime createTime;
private ArrayList<BlueCardHeartbeatVo> areaList;
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess;
import cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo.EntryRecordVo;
import lombok.Data;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import java.time.LocalDateTime;
import java.util.ArrayList;
@Document("entry_record")
@Data
public class EntryRecord {
private String id;
private String parkNumber;
private Integer size;
@Indexed
private LocalDateTime createTime;
private ArrayList<EntryRecordVo> datas;
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;
import java.time.LocalDateTime;
/**
* 车辆营收数据
*/
@Data
@Document("revenue")
public class Revenue {
private String id;
private String plate;//车牌
private String getTime;//结算时间
private String payCharge;//支付金额
private String PayKind;//支付类型
private String areaName;//停车所在区域
private String memo;//备注
private LocalDateTime createTime;
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;
import java.time.LocalDateTime;
/**
*车辆进出记录数据
*/
@Data
@Document("vehicle_record")
public class VehicleRecord {
private String id;
//进出
private String intoOrOut;
//车牌号
private String licenseNumber;
//时间
private String time;
//图片
private String picture;
private LocalDateTime createTime;
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.datacenter.dal.mongodb.vehicleaccess;
import cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess.AccessRecordPicture;
import org.springframework.data.mongodb.repository.MongoRepository;
import java.util.List;
public interface AccessRecordPictureRepository extends MongoRepository<AccessRecordPicture,String> {
// 根据给定的 imageName 数组查询记录
List<AccessRecordPicture> findByImageNameIn(List<String> imageNames);
AccessRecordPicture findByImageName(String imageName);
}

View File

@ -0,0 +1,15 @@
package cn.iocoder.yudao.module.datacenter.dal.mongodb.vehicleaccess;
import cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess.AppearanceRecord;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import java.time.LocalDateTime;
import java.util.List;
public interface AppearanceRecordRepository extends MongoRepository<AppearanceRecord,String> {
@Query("{'createTime': {$gte: ?0, $lte: ?1}}")
List<AppearanceRecord> findByCreateTimeBetween (LocalDateTime startOfDay, LocalDateTime endOfDay);
}

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.datacenter.dal.mongodb.vehicleaccess;
import cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess.BlueCardHeartbeat;
import org.springframework.data.mongodb.repository.MongoRepository;
import java.util.Optional;
public interface BlueCardHeartbeatRepository extends MongoRepository<BlueCardHeartbeat,String> {
Optional<BlueCardHeartbeat> findTopByOrderByCreateTimeDesc();
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.datacenter.dal.mongodb.vehicleaccess;
import cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess.EntryRecord;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import java.time.LocalDateTime;
import java.util.List;
public interface EntryRecordRepository extends MongoRepository<EntryRecord,String> {
@Query("{ 'createTime' : { $gte: ?0, $lt: ?1 } }")
List<EntryRecord> findByCreateTimeBetween(LocalDateTime startDate, LocalDateTime endDate);
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.datacenter.dal.mongodb.vehicleaccess;
import cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess.Revenue;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import java.time.LocalDateTime;
import java.util.List;
public interface RevenueRepository extends MongoRepository<Revenue,String> {
@Query("{'createTime': {$gte: ?0, $lte: ?1}}")
List<Revenue> findByCreateTimeBetween (LocalDateTime startOfDay, LocalDateTime endOfDay);
@Query(value = "{ 'areaName': { $regex: ?2, $options: 'i' }, 'createTime': { $gte: ?0, $lte: ?1 } }")
List<Revenue> findByCreateTimeAndAreaName(LocalDateTime startTime, LocalDateTime endTime, String areaName);
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.datacenter.dal.mongodb.vehicleaccess;
import cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess.VehicleRecord;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import java.time.LocalDateTime;
import java.util.List;
public interface VehicleRecordRepository extends MongoRepository<VehicleRecord,String> {
@Query("{ 'createTime' : { $gte: ?0, $lt: ?1 } }")
List<VehicleRecord> findByCreateTimeBetween(LocalDateTime startDate, LocalDateTime endDate);
// 根据时间字段查询今天的数据并根据时间排序并分页
Page<VehicleRecord> findByCreateTimeBetweenOrderByCreateTimeAsc(LocalDateTime startOfDay, LocalDateTime endOfDay, Pageable pageable);
// 根据 createTime 字段查询今天的数据条数
long countByCreateTimeBetween(LocalDateTime startOfDay, LocalDateTime endOfDay);
}

View File

@ -0,0 +1,68 @@
package cn.iocoder.yudao.module.datacenter.utlis;
import lombok.Data;
@Data
public class ResponseVO {
int code;// 返回编码
String msg;// 返回消息
Object data;// 返回数据
long total;
public ResponseVO(int code, String msg, Object data, long total) {
this.code = code;
this.msg = msg;
this.data = data;
this.total = total;
}
public ResponseVO(int code, String msg) {
this.code = code;
this.msg = msg;
}
public static ResponseVO success(int code,String msg, Object data,long total) {
return new ResponseVO(code,msg,data,total);
}
public static ResponseVO error(int code,String msg) {
ResponseVO serverRsp = new ResponseVO(code,msg);
serverRsp.setMsg(msg);
return serverRsp;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public long getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
}