Merge pull request 'xinwei' (#4) from xinwei into master

Reviewed-on: #4
This commit is contained in:
root 2024-08-19 09:48:44 +08:00
commit 206760cf93
84 changed files with 3220 additions and 60 deletions

View File

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

View File

@ -29,12 +29,12 @@ public class AssetApi {
private AssetService assetService;
@GetMapping("/type")
@Operation(summary = "获得所有设备名称和数量")
public CommonResult<List<Map<String, String>>> countAsset() {
return success(assetService.countAsset());
public List<Map<String, String>> countAsset() {
return assetService.countAsset();
}
@GetMapping("/name/{assettypename}")
@Operation(summary = "获取符合设备类型名的所有设备")
public CommonResult<List<AssetRespVO>> nameAsset(@PathVariable("assettypename") String assettypename) {
return success(assetService.nameAsset(assettypename));
public List<AssetRespVO> nameAsset(@PathVariable("assettypename") String assettypename) {
return assetService.nameAsset(assettypename);
}
}

View File

@ -25,13 +25,13 @@ public class CheckTicketApi {
private CheckTicketService checkTicketService;
@GetMapping("/{day}")
@Operation(summary = "获得日期当天的检票人数")
public CommonResult<Long> checkTicketTotal(@PathVariable("day") String day) {
return success(checkTicketService.checkTicketTotal(day));
public Long checkTicketTotal(@PathVariable("day") String day) {
return checkTicketService.checkTicketTotal(day);
}
@GetMapping("/qushi/{day}")
@Operation(summary = "获取日期当天各个时段的检票人数")
public CommonResult<List<Map<String, String>>> findbytimetemp(@PathVariable("day") String day) {
return success(checkTicketService.findbytimetemp(day));
public List<Map<String, String>> findbytimetemp(@PathVariable("day") String day) {
return checkTicketService.findbytimetemp(day);
}
}

View File

@ -27,87 +27,87 @@ public class SaleDataApi {
@GetMapping("/{day}")
@Operation(summary = "获得输入日期的当天总售票数")
public CommonResult<Long> checkTicketTotal(@PathVariable("day") String day) {
return success(saleDataService.countBySddate(day));
public Long checkTicketTotal(@PathVariable("day") String day) {
return saleDataService.countBySddate(day);
}
@GetMapping("/thisyear/{startTime}")
@Operation(summary = "获得今年日期往前十天内的数据")
public CommonResult<List<Map<String, String>>> thisyearNum(@PathVariable("startTime") String startTime) {
return success(saleDataService.findCheckticketcountBytime(startTime));
public List<Map<String, String>> thisyearNum(@PathVariable("startTime") String startTime) {
return saleDataService.findCheckticketcountBytime(startTime);
}
@GetMapping("/lastyear/{startTime}")
@Operation(summary = "获得去年日期往前推十天的数据")
public CommonResult<List<Map<String, String>>> lastyearNum(@PathVariable("startTime") String startTime) {
return success(saleDataService.findCheckticketcountBytime(startTime));
public List<Map<String, String>> lastyearNum(@PathVariable("startTime") String startTime) {
return saleDataService.findCheckticketcountBytime(startTime);
}
@GetMapping("/gender")
@Operation(summary = "获得所有数据的男女数量")
public CommonResult<List<Map<String, String>>> findByGender() {
return success(saleDataService.findByGender());
public List<Map<String, String>> findByGender() {
return saleDataService.findByGender();
}
@GetMapping("/age")
@Operation(summary = "获得所有数据的年龄分段和数量")
public CommonResult<List<Map<String, String>>> findByage() {
return success(saleDataService.findByAge());
public List<Map<String, String>> findByage() {
return saleDataService.findByAge();
}
@GetMapping("/lastyear/region")
@Operation(summary = "查询去年各个省份的人数")
public CommonResult<List<Map<String, String>>> lastyearfindByregion() {
return success(saleDataService.findByregion(saleDataService.findEventsLastYear()));
public List<Map<String, String>> lastyearfindByregion() {
return saleDataService.findByregion(saleDataService.findEventsLastYear());
}
@GetMapping("/thisyear/region")
@Operation(summary = "查询今年各个省份的人数")
public CommonResult<List<Map<String, String>>> thisyearfindByregion() {
return success(saleDataService.findByregion(saleDataService.findEventsThisYear()));
public List<Map<String, String>> thisyearfindByregion() {
return saleDataService.findByregion(saleDataService.findEventsThisYear());
}
@GetMapping("/salemethod")
@Operation(summary = "查询各个销售渠道的购票人数")
public CommonResult<List<Map<String, String>>> findBysaleMethod() {
return success(saleDataService.findBySaleMethod());
public List<Map<String, String>> findBysaleMethod() {
return saleDataService.findBySaleMethod();
}
@GetMapping("/wuyi/{x}")
@Operation(summary = "查询最近前几年当年的五一期间的数据")
public CommonResult<List<Map<String, String>>> findByWuyi(@PathVariable("x") int x) {
return success(saleDataService.findWuyi(x));
public List<Map<String, String>> findByWuyi(@PathVariable("x") int x) {
return saleDataService.findWuyi(x);
}
@GetMapping("/guoqing/{x}")
@Operation(summary = "查询最近前几年当年的国庆期间的数据")
public CommonResult<List<Map<String, String>>> findByGuoqing(@PathVariable("x") int x) {
return success(saleDataService.findGuoqing(x));
public List<Map<String, String>> findByGuoqing(@PathVariable("x") int x) {
return saleDataService.findGuoqing(x);
}
@GetMapping("/rijunthisyear/{startTime}")
@Operation(summary = "查询今年对应日期的近三十天日均售票数量")
public CommonResult<String> findThisyearRijun(@PathVariable("startTime") String startTime) {
return success(saleDataService.findrijun(startTime));
public String findThisyearRijun(@PathVariable("startTime") String startTime) {
return saleDataService.findrijun(startTime);
}
@GetMapping("/rijunlastyear/{startTime}")
@Operation(summary = "查询去年对应日期的近三十天日均售票数量")
public CommonResult<String> findLastyearRijun(@PathVariable("startTime") String startTime) {
return success(saleDataService.findrijun(startTime));
public String findLastyearRijun(@PathVariable("startTime") String startTime) {
return saleDataService.findrijun(startTime);
}
// TODO 年度平均什么并没有说清楚原代码是直接计算一年的总金额
@GetMapping("/thisyear/nianjun")
@Operation(summary = "查询今年年度售票平均金额")
public CommonResult<BigDecimal> findmoneythisyear() {
return success(saleDataService.findyearJun(saleDataService.findEventsThisYear()));
public BigDecimal findmoneythisyear() {
return saleDataService.findyearJun(saleDataService.findEventsThisYear());
}
@GetMapping("/lastyear/nianjun")
@Operation(summary = "查询去年年度售票平均金额")
public CommonResult<BigDecimal> findmoneylastyear() {
return success(saleDataService.findyearJun(saleDataService.findEventsLastYear()));
public BigDecimal findmoneylastyear() {
return saleDataService.findyearJun(saleDataService.findEventsLastYear());
}
}

View File

@ -1,16 +1,143 @@
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 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.RestController;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* @Description 车辆过渡情况
*/
@Tag(name = "大屏服务 - 车辆过渡情况")
@RestController
@RequestMapping("/h5/transitionFlight")
@RequestMapping("/datacenter/h5/transitionFlight")
@Validated
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);
Page<VehicleRecord> recordOfAccessList = vehicleRecordRepository.findAll(pageable); // TODO 暂时获取全部数据分页
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.module.datacenter.controller.admin.weather.vo.WeatherInfoVO;
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.tags.Tag;
import org.springframework.validation.annotation.Validated;
@ -15,14 +16,14 @@ import org.springframework.web.bind.annotation.RestController;
*/
@Tag(name = "大屏服务 - 天气接口")
@RestController
@RequestMapping("/h5/weather")
@RequestMapping("/datacenter/h5/weather")
@Validated
public class WeatherApi {
@GetMapping(value = "/getWeather")
@Operation(summary = "获得输入城市的天气")
public CommonResult<WeatherInfoVO> getWeather(String cityCode) {
public ResponseVO getWeather(String cityCode) {
String weatherData = GoodWeatherUtil.getWeatherData(cityCode);
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

@ -19,8 +19,7 @@ public class SecurityConfiguration {
@Override
public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) {
// Swagger 接口文档
registry.antMatchers("/v3/api-docs/**").permitAll() // 元数据
.antMatchers("/swagger-ui.html").permitAll(); // Swagger UI
registry.antMatchers("/**").permitAll(); // 放行所有接口
// Spring Boot Actuator 的安全配置
registry.antMatchers("/actuator").anonymous()
.antMatchers("/actuator/**").anonymous();

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;
}
}

View File

@ -91,7 +91,7 @@ yudao:
captcha:
enable: true # 验证码的开关,默认为 true
tenant: # 多租户相关配置项
enable: true
enable: false
ignore-urls:
ignore-tables:

View File

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

View File

@ -8,5 +8,12 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants {
// ========== 进出记录图片 1_005_001_015 ==========
ErrorCode ACCESS_RECORD_PICTURE_NOT_EXISTS = new ErrorCode(1_005_001_015, "进出记录图片不存在");
// ========== 心跳管理 1_005_001_025 ==========
ErrorCode HEARTBEAT_NOT_EXISTS = new ErrorCode(1_005_001_025, "心跳管理不存在");
// ========== 通道信息 1_005_001_026 ==========
ErrorCode PASSAGEWAY_NOT_EXISTS = new ErrorCode(1_005_001_026, "通道信息不存在");
// ========== 场库列表 1_005_001_027 ==========
ErrorCode PARK_NOT_EXISTS = new ErrorCode(1_005_001_027, "场库列表不存在");
// ========== 区域列表 1_005_001_028 ==========
ErrorCode AREA_NOT_EXISTS = new ErrorCode(1_005_001_028, "区域列表不存在");
}

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.parking.controller.admin.area;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.parking.controller.admin.area.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.module.parking.service.area.AreaService;
@Tag(name = "管理后台 - 区域列表")
@RestController
@RequestMapping("/parking/area")
@Validated
public class AreaController {
@Resource
private AreaService areaService;
@PostMapping("/create")
@Operation(summary = "创建区域列表")
@PreAuthorize("@ss.hasPermission('parking:area:create')")
public CommonResult<Integer> createArea(@Valid @RequestBody AreaSaveReqVO createReqVO) {
return success(areaService.createArea(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新区域列表")
@PreAuthorize("@ss.hasPermission('parking:area:update')")
public CommonResult<Boolean> updateArea(@Valid @RequestBody AreaSaveReqVO updateReqVO) {
areaService.updateArea(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除区域列表")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('parking:area:delete')")
public CommonResult<Boolean> deleteArea(@RequestParam("id") Long id) {
areaService.deleteArea(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得区域列表")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('parking:area:query')")
public CommonResult<AreaRespVO> getArea(@RequestParam("id") Long id) {
AreaDO area = areaService.getArea(id);
return success(BeanUtils.toBean(area, AreaRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得区域列表分页")
@PreAuthorize("@ss.hasPermission('parking:area:query')")
public CommonResult<PageResult<AreaRespVO>> getAreaPage(@Valid AreaPageReqVO pageReqVO) {
PageResult<AreaDO> pageResult = areaService.getAreaPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, AreaRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出区域列表 Excel")
@PreAuthorize("@ss.hasPermission('parking:area:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportAreaExcel(@Valid AreaPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<AreaDO> list = areaService.getAreaPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "区域列表.xls", "数据", AreaRespVO.class,
BeanUtils.toBean(list, AreaRespVO.class));
}
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.parking.controller.admin.area.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 区域列表分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class AreaPageReqVO extends PageParam {
@Schema(description = "区域Id", example = "27272")
private Integer areaId;
@Schema(description = "场库编号")
private String parkNumber;
@Schema(description = "区域名称", example = "李四")
private String areaName;
@Schema(description = "区域车位数", example = "24356")
private Integer spaceCount;
@Schema(description = "区域空位数", example = "4332")
private Integer lastSpaceCount;
@Schema(description = "区域可预约车位数", example = "10031")
private Integer bookSpaceCount;
@Schema(description = "区域在场预约数", example = "7772")
private Integer bookInParkCount;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,51 @@
package cn.iocoder.yudao.module.parking.controller.admin.area.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 区域列表 Response VO")
@Data
@ExcelIgnoreUnannotated
public class AreaRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9513")
@ExcelProperty("id")
private Long id;
@Schema(description = "区域Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "32029")
@ExcelProperty("区域Id")
private Integer areaId;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("场库编号")
private String parkNumber;
@Schema(description = "区域名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("区域名称")
private String areaName;
@Schema(description = "区域车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "24356")
@ExcelProperty("区域车位数")
private Integer spaceCount;
@Schema(description = "区域空位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "4332")
@ExcelProperty("区域空位数")
private Integer lastSpaceCount;
@Schema(description = "区域可预约车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "10031")
@ExcelProperty("区域可预约车位数")
private Integer bookSpaceCount;
@Schema(description = "区域在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "7772")
@ExcelProperty("区域在场预约数")
private Integer bookInParkCount;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.parking.controller.admin.area.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 区域列表新增/修改 Request VO")
@Data
public class AreaSaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9513")
private Long id;
@Schema(description = "区域Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "32029")
private Integer areaId;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "场库编号不能为空")
private String parkNumber;
@Schema(description = "区域名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@NotEmpty(message = "区域名称不能为空")
private String areaName;
@Schema(description = "区域车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "24356")
@NotNull(message = "区域车位数不能为空")
private Integer spaceCount;
@Schema(description = "区域空位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "4332")
@NotNull(message = "区域空位数不能为空")
private Integer lastSpaceCount;
@Schema(description = "区域可预约车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "10031")
@NotNull(message = "区域可预约车位数不能为空")
private Integer bookSpaceCount;
@Schema(description = "区域在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "7772")
@NotNull(message = "区域在场预约数不能为空")
private Integer bookInParkCount;
}

View File

@ -0,0 +1,101 @@
package cn.iocoder.yudao.module.parking.controller.admin.heartbeat;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.time.LocalDateTime;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.parking.controller.admin.heartbeat.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.heartbeat.HeartbeatDO;
import cn.iocoder.yudao.module.parking.service.heartbeat.HeartbeatService;
@Tag(name = "管理后台 - 心跳管理")
@RestController
@RequestMapping("/parking/heartbeat")
@Validated
public class HeartbeatController {
@Resource
private HeartbeatService heartbeatService;
@PostMapping("/doHeartbeat")
public BlueCardResult doHeartbeat(@RequestBody HeartbeatReqDataVO blueCardHeartbeat){
return heartbeatService.doHeartbeat(blueCardHeartbeat);
}
@PostMapping("/create")
@Operation(summary = "创建心跳管理")
@PreAuthorize("@ss.hasPermission('parking:heartbeat:create')")
public CommonResult<Long> createHeartbeat(@Valid @RequestBody HeartbeatSaveReqVO createReqVO) {
return success(heartbeatService.createHeartbeat(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新心跳管理")
@PreAuthorize("@ss.hasPermission('parking:heartbeat:update')")
public CommonResult<Boolean> updateHeartbeat(@Valid @RequestBody HeartbeatSaveReqVO updateReqVO) {
heartbeatService.updateHeartbeat(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除心跳管理")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('parking:heartbeat:delete')")
public CommonResult<Boolean> deleteHeartbeat(@RequestParam("id") Long id) {
heartbeatService.deleteHeartbeat(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得心跳管理")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('parking:heartbeat:query')")
public CommonResult<HeartbeatRespVO> getHeartbeat(@RequestParam("id") Long id) {
HeartbeatDO heartbeat = heartbeatService.getHeartbeat(id);
return success(BeanUtils.toBean(heartbeat, HeartbeatRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得心跳管理分页")
@PreAuthorize("@ss.hasPermission('parking:heartbeat:query')")
public CommonResult<PageResult<HeartbeatRespVO>> getHeartbeatPage(@Valid HeartbeatPageReqVO pageReqVO) {
PageResult<HeartbeatDO> pageResult = heartbeatService.getHeartbeatPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, HeartbeatRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出心跳管理 Excel")
@PreAuthorize("@ss.hasPermission('parking:heartbeat:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportHeartbeatExcel(@Valid HeartbeatPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<HeartbeatDO> list = heartbeatService.getHeartbeatPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "心跳管理.xls", "数据", HeartbeatRespVO.class,
BeanUtils.toBean(list, HeartbeatRespVO.class));
}
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.parking.controller.admin.heartbeat.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 心跳管理分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class HeartbeatPageReqVO extends PageParam {
@Schema(description = "场库编号")
private String parkNumber;
@Schema(description = "场库名称", example = "李四")
private String parkName;
@Schema(description = "场库总车位数", example = "12040")
private Integer spaceCount;
@Schema(description = "场库空车位数", example = "724")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", example = "6686")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", example = "15197")
private Integer bookInParkCount;
@Schema(description = "区域属性")
private String areaList;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,41 @@
package cn.iocoder.yudao.module.parking.controller.admin.heartbeat.vo;
import cn.iocoder.yudao.module.parking.controller.admin.area.vo.AreaSaveReqVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.ArrayList;
/**
* @Description 蓝卡心跳请求参数
*/
@Data
public class HeartbeatReqDataVO {
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
private String parkNumber;
@Schema(description = "场库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@NotEmpty(message = "场库名称不能为空")
private String parkName;
@Schema(description = "场库总车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "21057")
@NotNull(message = "场库总车位数不能为空")
private Integer spaceCount;
@Schema(description = "场库空车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "7657")
@NotNull(message = "场库空车位数不能为空")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "17569")
@NotNull(message = "场库可预约数不能为空")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "13935")
@NotNull(message = "场库在场预约数不能为空")
private Integer bookInParkCount;
@Schema(description = "区域属性")
private ArrayList<AreaSaveReqVO> areaList;
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.parking.controller.admin.heartbeat.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 心跳管理 Response VO")
@Data
@ExcelIgnoreUnannotated
public class HeartbeatRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17692")
@ExcelProperty("编号")
private Long id;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("场库编号")
private String parkNumber;
@Schema(description = "场库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("场库名称")
private String parkName;
@Schema(description = "场库总车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "12040")
@ExcelProperty("场库总车位数")
private Integer spaceCount;
@Schema(description = "场库空车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "724")
@ExcelProperty("场库空车位数")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "6686")
@ExcelProperty("场库可预约数")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "15197")
@ExcelProperty("场库在场预约数")
private Integer bookInParkCount;
@Schema(description = "区域属性", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("区域属性")
private String areaList;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.parking.controller.admin.heartbeat.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 心跳管理新增/修改 Request VO")
@Data
public class HeartbeatSaveReqVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17692")
private Long id;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "场库编号不能为空")
private String parkNumber;
@Schema(description = "场库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@NotEmpty(message = "场库名称不能为空")
private String parkName;
@Schema(description = "场库总车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "12040")
@NotNull(message = "场库总车位数不能为空")
private Integer spaceCount;
@Schema(description = "场库空车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "724")
@NotNull(message = "场库空车位数不能为空")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "6686")
@NotNull(message = "场库可预约数不能为空")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "15197")
@NotNull(message = "场库在场预约数不能为空")
private Integer bookInParkCount;
@Schema(description = "区域属性", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "区域属性不能为空")
private String areaList;
}

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.parking.controller.admin.park;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.parking.controller.admin.park.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.park.ParkDO;
import cn.iocoder.yudao.module.parking.service.park.ParkService;
@Tag(name = "管理后台 - 场库列表")
@RestController
@RequestMapping("/parking/park")
@Validated
public class ParkController {
@Resource
private ParkService parkService;
@PostMapping("/create")
@Operation(summary = "创建场库列表")
@PreAuthorize("@ss.hasPermission('parking:park:create')")
public CommonResult<String> createPark(@Valid @RequestBody ParkSaveReqVO createReqVO) {
return success(parkService.createPark(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新场库列表")
@PreAuthorize("@ss.hasPermission('parking:park:update')")
public CommonResult<Boolean> updatePark(@Valid @RequestBody ParkSaveReqVO updateReqVO) {
parkService.updatePark(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除场库列表")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('parking:park:delete')")
public CommonResult<Boolean> deletePark(@RequestParam("id") String id) {
parkService.deletePark(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得场库列表")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('parking:park:query')")
public CommonResult<ParkRespVO> getPark(@RequestParam("id") String id) {
ParkDO park = parkService.getPark(id);
return success(BeanUtils.toBean(park, ParkRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得场库列表分页")
@PreAuthorize("@ss.hasPermission('parking:park:query')")
public CommonResult<PageResult<ParkRespVO>> getParkPage(@Valid ParkPageReqVO pageReqVO) {
PageResult<ParkDO> pageResult = parkService.getParkPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ParkRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出场库列表 Excel")
@PreAuthorize("@ss.hasPermission('parking:park:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportParkExcel(@Valid ParkPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ParkDO> list = parkService.getParkPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "场库列表.xls", "数据", ParkRespVO.class,
BeanUtils.toBean(list, ParkRespVO.class));
}
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.parking.controller.admin.park.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 场库列表分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ParkPageReqVO extends PageParam {
@Schema(description = "场库名称", example = "张三")
private String parkName;
@Schema(description = "场库总车位数", example = "21057")
private Integer spaceCount;
@Schema(description = "场库空车位数", example = "7657")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", example = "17569")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", example = "13935")
private Integer bookInParkCount;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.parking.controller.admin.park.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 场库列表 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ParkRespVO {
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("场库编号")
private String parkNumber;
@Schema(description = "场库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("场库名称")
private String parkName;
@Schema(description = "场库总车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "21057")
@ExcelProperty("场库总车位数")
private Integer spaceCount;
@Schema(description = "场库空车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "7657")
@ExcelProperty("场库空车位数")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "17569")
@ExcelProperty("场库可预约数")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "13935")
@ExcelProperty("场库在场预约数")
private Integer bookInParkCount;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.parking.controller.admin.park.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 场库列表新增/修改 Request VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ParkSaveReqVO {
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
private String parkNumber;
@Schema(description = "场库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@NotEmpty(message = "场库名称不能为空")
private String parkName;
@Schema(description = "场库总车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "21057")
@NotNull(message = "场库总车位数不能为空")
private Integer spaceCount;
@Schema(description = "场库空车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "7657")
@NotNull(message = "场库空车位数不能为空")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "17569")
@NotNull(message = "场库可预约数不能为空")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "13935")
@NotNull(message = "场库在场预约数不能为空")
private Integer bookInParkCount;
}

View File

@ -0,0 +1,101 @@
package cn.iocoder.yudao.module.parking.controller.admin.passageway;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.parking.controller.admin.passageway.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.passageway.PassagewayDO;
import cn.iocoder.yudao.module.parking.service.passageway.PassagewayService;
@Tag(name = "管理后台 - 通道信息")
@RestController
@RequestMapping("/parking/passageway")
@Validated
public class PassagewayController {
@Resource
private PassagewayService passagewayService;
@PostMapping("/passagewayUpload")
public BlueCardResult passagewayUpload(@RequestBody PassagewayReqDataVO passagewayReqDataVO){
return passagewayService.passagewayUpload(passagewayReqDataVO);
}
@PostMapping("/create")
@Operation(summary = "创建通道信息")
@PreAuthorize("@ss.hasPermission('parking:passageway:create')")
public CommonResult<String> createPassageway(@Valid @RequestBody PassagewaySaveReqVO createReqVO) {
return success(passagewayService.createPassageway(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新通道信息")
@PreAuthorize("@ss.hasPermission('parking:passageway:update')")
public CommonResult<Boolean> updatePassageway(@Valid @RequestBody PassagewaySaveReqVO updateReqVO) {
passagewayService.updatePassageway(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除通道信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('parking:passageway:delete')")
public CommonResult<Boolean> deletePassageway(@RequestParam("id") String id) {
passagewayService.deletePassageway(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得通道信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('parking:passageway:query')")
public CommonResult<PassagewayRespVO> getPassageway(@RequestParam("id") String id) {
PassagewayDO passageway = passagewayService.getPassageway(id);
return success(BeanUtils.toBean(passageway, PassagewayRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得通道信息分页")
@PreAuthorize("@ss.hasPermission('parking:passageway:query')")
public CommonResult<PageResult<PassagewayRespVO>> getPassagewayPage(@Valid PassagewayPageReqVO pageReqVO) {
PageResult<PassagewayDO> pageResult = passagewayService.getPassagewayPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, PassagewayRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出通道信息 Excel")
@PreAuthorize("@ss.hasPermission('parking:passageway:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportPassagewayExcel(@Valid PassagewayPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<PassagewayDO> list = passagewayService.getPassagewayPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "通道信息.xls", "数据", PassagewayRespVO.class,
BeanUtils.toBean(list, PassagewayRespVO.class));
}
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.parking.controller.admin.passageway.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 通道信息分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PassagewayPageReqVO extends PageParam {
@Schema(description = "场库编号")
private String parkNumber;
@Schema(description = "通道名称", example = "李四")
private String passagewayName;
@Schema(description = "源区域 Id", example = "7412")
private String sourceAreaId;
@Schema(description = "目标区域 Id", example = "10505")
private String targetAreaId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.parking.controller.admin.passageway.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @Description 通道信息上传请求参数
*/
@Data
public class PassagewayReqDataVO {
@Schema(description = "停车场编号", requiredMode = Schema.RequiredMode.REQUIRED)
private String parkNumber;
@Schema(description = "datas数据条数", requiredMode = Schema.RequiredMode.REQUIRED)
private Integer size;
@Schema(description = "区域属性", requiredMode = Schema.RequiredMode.REQUIRED)
private List<PassagewaySaveReqVO> datas;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.parking.controller.admin.passageway.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 通道信息 Response VO")
@Data
@ExcelIgnoreUnannotated
public class PassagewayRespVO {
@Schema(description = "通道 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7099")
@ExcelProperty("通道 Id")
private String passagewayId;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("场库编号")
private String parkNumber;
@Schema(description = "通道名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("通道名称")
private String passagewayName;
@Schema(description = "源区域 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7412")
@ExcelProperty("源区域 Id")
private String sourceAreaId;
@Schema(description = "目标区域 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "10505")
@ExcelProperty("目标区域 Id")
private String targetAreaId;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.parking.controller.admin.passageway.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 通道信息新增/修改 Request VO")
@Data
public class PassagewaySaveReqVO {
@Schema(description = "通道 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7099")
private String passagewayId;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "场库编号不能为空")
private String parkNumber;
@Schema(description = "通道名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@NotEmpty(message = "通道名称不能为空")
private String passagewayName;
@Schema(description = "源区域 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7412")
@NotEmpty(message = "源区域 Id不能为空")
private String sourceAreaId;
@Schema(description = "目标区域 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "10505")
@NotEmpty(message = "目标区域 Id不能为空")
private String targetAreaId;
}

View File

@ -0,0 +1,58 @@
package cn.iocoder.yudao.module.parking.dal.dataobject.area;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 区域列表 DO
*
* @author 芋道源码
*/
@TableName("area")
@KeySequence("area_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AreaDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 区域Id
*/
private Integer areaId;
/**
* 场库编号
*/
private String parkNumber;
/**
* 区域名称
*/
private String areaName;
/**
* 区域车位数
*/
private Integer spaceCount;
/**
* 区域空位数
*/
private Integer lastSpaceCount;
/**
* 区域可预约车位数
*/
private Integer bookSpaceCount;
/**
* 区域在场预约数
*/
private Integer bookInParkCount;
}

View File

@ -0,0 +1,59 @@
package cn.iocoder.yudao.module.parking.dal.dataobject.heartbeat;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 心跳管理 DO
*
* @author 芋道源码
*/
@TableName("heartbeat")
@KeySequence("heartbeat_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HeartbeatDO extends BaseDO {
/**
* 编号
*/
@TableId
private Long id;
/**
* 场库编号
*/
private String parkNumber;
/**
* 场库名称
*/
private String parkName;
/**
* 场库总车位数
*/
private Integer spaceCount;
/**
* 场库空车位数
*/
private Integer freeSpaceCount;
/**
* 场库可预约数
*/
private Integer bookSpaceCount;
/**
* 场库在场预约数
*/
private Integer bookInParkCount;
/**
* 区域属性
*/
private String areaList;
}

View File

@ -0,0 +1,51 @@
package cn.iocoder.yudao.module.parking.dal.dataobject.park;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 场库列表 DO
*
* @author 芋道源码
*/
@TableName("park")
@KeySequence("park_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ParkDO extends BaseDO {
/**
* 场库编号
*/
@TableId(type = IdType.INPUT)
private String parkNumber;
/**
* 场库名称
*/
private String parkName;
/**
* 场库总车位数
*/
private Integer spaceCount;
/**
* 场库空车位数
*/
private Integer freeSpaceCount;
/**
* 场库可预约数
*/
private Integer bookSpaceCount;
/**
* 场库在场预约数
*/
private Integer bookInParkCount;
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.parking.dal.dataobject.passageway;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 通道信息 DO
*
* @author 芋道源码
*/
@TableName("passageway")
@KeySequence("passageway_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PassagewayDO extends BaseDO {
/**
* 通道 Id
*/
@TableId(type = IdType.INPUT)
private String passagewayId;
/**
* 场库编号
*/
private String parkNumber;
/**
* 通道名称
*/
private String passagewayName;
/**
* 源区域 Id
*/
private String sourceAreaId;
/**
* 目标区域 Id
*/
private String targetAreaId;
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.module.parking.dal.mysql.area;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.parking.dal.dataobject.area.AreaDO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.parking.controller.admin.area.vo.*;
import org.apache.ibatis.annotations.Param;
/**
* 区域列表 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface AreaMapper extends BaseMapperX<AreaDO> {
default PageResult<AreaDO> selectPage(AreaPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<AreaDO>()
.eqIfPresent(AreaDO::getParkNumber, reqVO.getParkNumber())
.likeIfPresent(AreaDO::getAreaName, reqVO.getAreaName())
.eqIfPresent(AreaDO::getSpaceCount, reqVO.getSpaceCount())
.eqIfPresent(AreaDO::getLastSpaceCount, reqVO.getLastSpaceCount())
.eqIfPresent(AreaDO::getBookSpaceCount, reqVO.getBookSpaceCount())
.eqIfPresent(AreaDO::getBookInParkCount, reqVO.getBookInParkCount())
.betweenIfPresent(AreaDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(AreaDO::getAreaId, reqVO.getAreaId())
.orderByDesc(AreaDO::getId));
}
@Delete("DELETE FROM `area` WHERE `park_number` = #{parkNumber}")
int physicalDeleteByParkNumber(@Param("parkNumber") String parkNumber);
}

View File

@ -0,0 +1,33 @@
package cn.iocoder.yudao.module.parking.dal.mysql.heartbeat;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.parking.dal.dataobject.heartbeat.HeartbeatDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.parking.controller.admin.heartbeat.vo.*;
/**
* 心跳管理 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface HeartbeatMapper extends BaseMapperX<HeartbeatDO> {
default PageResult<HeartbeatDO> selectPage(HeartbeatPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<HeartbeatDO>()
.eqIfPresent(HeartbeatDO::getParkNumber, reqVO.getParkNumber())
.likeIfPresent(HeartbeatDO::getParkName, reqVO.getParkName())
.eqIfPresent(HeartbeatDO::getSpaceCount, reqVO.getSpaceCount())
.eqIfPresent(HeartbeatDO::getFreeSpaceCount, reqVO.getFreeSpaceCount())
.eqIfPresent(HeartbeatDO::getBookSpaceCount, reqVO.getBookSpaceCount())
.eqIfPresent(HeartbeatDO::getBookInParkCount, reqVO.getBookInParkCount())
.eqIfPresent(HeartbeatDO::getAreaList, reqVO.getAreaList())
.betweenIfPresent(HeartbeatDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(HeartbeatDO::getId));
}
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.parking.dal.mysql.park;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.parking.dal.dataobject.park.ParkDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.parking.controller.admin.park.vo.*;
/**
* 场库列表 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ParkMapper extends BaseMapperX<ParkDO> {
default PageResult<ParkDO> selectPage(ParkPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ParkDO>()
.likeIfPresent(ParkDO::getParkName, reqVO.getParkName())
.eqIfPresent(ParkDO::getSpaceCount, reqVO.getSpaceCount())
.eqIfPresent(ParkDO::getFreeSpaceCount, reqVO.getFreeSpaceCount())
.eqIfPresent(ParkDO::getBookSpaceCount, reqVO.getBookSpaceCount())
.eqIfPresent(ParkDO::getBookInParkCount, reqVO.getBookInParkCount())
.betweenIfPresent(ParkDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ParkDO::getParkNumber));
}
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.parking.dal.mysql.passageway;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.parking.dal.dataobject.passageway.PassagewayDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.parking.controller.admin.passageway.vo.*;
/**
* 通道信息 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface PassagewayMapper extends BaseMapperX<PassagewayDO> {
default PageResult<PassagewayDO> selectPage(PassagewayPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<PassagewayDO>()
.eqIfPresent(PassagewayDO::getParkNumber, reqVO.getParkNumber())
.likeIfPresent(PassagewayDO::getPassagewayName, reqVO.getPassagewayName())
.eqIfPresent(PassagewayDO::getSourceAreaId, reqVO.getSourceAreaId())
.eqIfPresent(PassagewayDO::getTargetAreaId, reqVO.getTargetAreaId())
.betweenIfPresent(PassagewayDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(PassagewayDO::getPassagewayId));
}
}

View File

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.parking.service.area;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.parking.controller.admin.area.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 区域列表 Service 接口
*
* @author 芋道源码
*/
public interface AreaService {
/**
* 创建区域列表
*
* @param createReqVO 创建信息
* @return 编号
*/
Integer createArea(@Valid AreaSaveReqVO createReqVO);
/**
* 创建区域列表批处理
* @param areaSaveReqVOList
* @return java.lang.Integer
*/
Boolean createAreaBatch(@Valid List<AreaSaveReqVO> areaSaveReqVOList);
/**
* 更新区域列表
*
* @param updateReqVO 更新信息
*/
void updateArea(@Valid AreaSaveReqVO updateReqVO);
/**
* 删除区域列表
*
* @param id 编号
*/
void deleteArea(Long id);
/**
* 获得区域列表
*
* @param id 编号
* @return 区域列表
*/
AreaDO getArea(Long id);
/**
* 获得区域列表分页
*
* @param pageReqVO 分页查询
* @return 区域列表分页
*/
PageResult<AreaDO> getAreaPage(AreaPageReqVO pageReqVO);
/**
* 根据场库编号创建或更新区域批量
* @param areaList
* @return java.lang.Boolean
*/
Boolean updateAreaBatchByParkNumber(ArrayList<AreaSaveReqVO> areaList);
}

View File

@ -0,0 +1,94 @@
package cn.iocoder.yudao.module.parking.service.area;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.parking.controller.admin.area.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.parking.dal.mysql.area.AreaMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.parking.enums.ErrorCodeConstants.*;
/**
* 区域列表 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class AreaServiceImpl implements AreaService {
@Resource
private AreaMapper areaMapper;
@Override
public Integer createArea(AreaSaveReqVO createReqVO) {
// 插入
AreaDO area = BeanUtils.toBean(createReqVO, AreaDO.class);
areaMapper.insert(area);
// 返回
return area.getAreaId();
}
@Override
public Boolean createAreaBatch(List<AreaSaveReqVO> areaSaveReqVOList) {
// 插入
List<AreaDO> areaDOList = BeanUtils.toBean(areaSaveReqVOList, AreaDO.class);
return areaMapper.insertBatch(areaDOList);
}
@Override
public void updateArea(AreaSaveReqVO updateReqVO) {
// 校验存在
validateAreaExists(updateReqVO.getId());
// 更新
AreaDO updateObj = BeanUtils.toBean(updateReqVO, AreaDO.class);
areaMapper.updateById(updateObj);
}
@Override
public void deleteArea(Long id) {
// 校验存在
validateAreaExists(id);
// 删除
areaMapper.deleteById(id);
}
private void validateAreaExists(Long id) {
if (areaMapper.selectById(id) == null) {
throw exception(AREA_NOT_EXISTS);
}
}
@Override
public AreaDO getArea(Long id) {
return areaMapper.selectById(id);
}
@Override
public PageResult<AreaDO> getAreaPage(AreaPageReqVO pageReqVO) {
return areaMapper.selectPage(pageReqVO);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateAreaBatchByParkNumber(ArrayList<AreaSaveReqVO> areaList) {
if (areaList == null || areaList.isEmpty()){
return false;
}
areaMapper.physicalDeleteByParkNumber(areaList.get(0).getParkNumber());
areaMapper.insertBatch(BeanUtils.toBean(areaList, AreaDO.class));
return true;
}
}

View File

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.parking.service.heartbeat;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.parking.controller.admin.heartbeat.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.heartbeat.HeartbeatDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
/**
* 心跳管理 Service 接口
*
* @author 芋道源码
*/
public interface HeartbeatService {
/**
* 创建心跳管理
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createHeartbeat(@Valid HeartbeatSaveReqVO createReqVO);
/**
* 更新心跳管理
*
* @param updateReqVO 更新信息
*/
void updateHeartbeat(@Valid HeartbeatSaveReqVO updateReqVO);
/**
* 删除心跳管理
*
* @param id 编号
*/
void deleteHeartbeat(Long id);
/**
* 获得心跳管理
*
* @param id 编号
* @return 心跳管理
*/
HeartbeatDO getHeartbeat(Long id);
/**
* 获得心跳管理分页
*
* @param pageReqVO 分页查询
* @return 心跳管理分页
*/
PageResult<HeartbeatDO> getHeartbeatPage(HeartbeatPageReqVO pageReqVO);
/**
* 接收并解析心跳数据
* @param blueCardHeartbeat
* @return cn.iocoder.yudao.module.parking.util.BlueCardResult
*/
BlueCardResult doHeartbeat(HeartbeatReqDataVO blueCardHeartbeat);
}

View File

@ -0,0 +1,119 @@
package cn.iocoder.yudao.module.parking.service.heartbeat;
import cn.iocoder.yudao.module.parking.controller.admin.area.vo.AreaSaveReqVO;
import cn.iocoder.yudao.module.parking.controller.admin.park.vo.ParkSaveReqVO;
import cn.iocoder.yudao.module.parking.service.area.AreaService;
import cn.iocoder.yudao.module.parking.service.park.ParkService;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.parking.controller.admin.heartbeat.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.heartbeat.HeartbeatDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.parking.dal.mysql.heartbeat.HeartbeatMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.parking.enums.ErrorCodeConstants.*;
/**
* 心跳管理 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class HeartbeatServiceImpl implements HeartbeatService {
@Resource
private HeartbeatMapper heartbeatMapper;
@Resource
private ParkService parkService;
@Resource
private AreaService areaService;
@Override
public Long createHeartbeat(HeartbeatSaveReqVO createReqVO) {
// 插入
HeartbeatDO heartbeat = BeanUtils.toBean(createReqVO, HeartbeatDO.class);
heartbeatMapper.insert(heartbeat);
// 返回
return heartbeat.getId();
}
@Override
public void updateHeartbeat(HeartbeatSaveReqVO updateReqVO) {
// 校验存在
validateHeartbeatExists(updateReqVO.getId());
// 更新
HeartbeatDO updateObj = BeanUtils.toBean(updateReqVO, HeartbeatDO.class);
heartbeatMapper.updateById(updateObj);
}
@Override
public void deleteHeartbeat(Long id) {
// 校验存在
validateHeartbeatExists(id);
// 删除
heartbeatMapper.deleteById(id);
}
private void validateHeartbeatExists(Long id) {
if (heartbeatMapper.selectById(id) == null) {
throw exception(HEARTBEAT_NOT_EXISTS);
}
}
@Override
public HeartbeatDO getHeartbeat(Long id) {
return heartbeatMapper.selectById(id);
}
@Override
public PageResult<HeartbeatDO> getHeartbeatPage(HeartbeatPageReqVO pageReqVO) {
return heartbeatMapper.selectPage(pageReqVO);
}
@Override
@Transactional(rollbackFor = Exception.class)
public BlueCardResult doHeartbeat(HeartbeatReqDataVO blueCardHeartbeat) {
try {
ArrayList<AreaSaveReqVO> areaList = blueCardHeartbeat.getAreaList();
HeartbeatDO heartbeatDO = new HeartbeatDO();
heartbeatDO.setParkNumber(blueCardHeartbeat.getParkNumber());
heartbeatDO.setParkName(blueCardHeartbeat.getParkName());
heartbeatDO.setSpaceCount(blueCardHeartbeat.getSpaceCount());
heartbeatDO.setFreeSpaceCount(blueCardHeartbeat.getFreeSpaceCount());
heartbeatDO.setBookSpaceCount(blueCardHeartbeat.getBookSpaceCount());
heartbeatDO.setBookInParkCount(blueCardHeartbeat.getBookInParkCount());
heartbeatDO.setAreaList(areaList.toString());
// 写入心跳日志
heartbeatMapper.insert(heartbeatDO);
// 写入停车场信息
parkService.createOrUpdatePark(new ParkSaveReqVO(blueCardHeartbeat.getParkNumber(), blueCardHeartbeat.getParkName(), blueCardHeartbeat.getSpaceCount(), blueCardHeartbeat.getFreeSpaceCount(), blueCardHeartbeat.getBookSpaceCount(), blueCardHeartbeat.getBookInParkCount()));
if (!areaList.isEmpty()){
// 对区域都添加停车场库编号
areaList.forEach(item -> item.setParkNumber(blueCardHeartbeat.getParkNumber()));
// 更新区域信息
areaService.updateAreaBatchByParkNumber(areaList);
}
} catch (Exception e) {
// 手动设置回滚
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return BlueCardResult.error("数据写入失败:" + e.getMessage());
}
return BlueCardResult.success();
}
}

View File

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.parking.service.park;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.parking.controller.admin.park.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.park.ParkDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 场库列表 Service 接口
*
* @author 芋道源码
*/
public interface ParkService {
/**
* 创建场库列表
*
* @param createReqVO 创建信息
* @return 编号
*/
String createPark(@Valid ParkSaveReqVO createReqVO);
/**
* 创建或更新场库
* @param parkSaveReqVO
* @return java.lang.Boolean
*/
Boolean createOrUpdatePark(@Valid ParkSaveReqVO parkSaveReqVO);
/**
* 更新场库列表
*
* @param updateReqVO 更新信息
*/
void updatePark(@Valid ParkSaveReqVO updateReqVO);
/**
* 删除场库列表
*
* @param id 编号
*/
void deletePark(String id);
/**
* 获得场库列表
*
* @param id 编号
* @return 场库列表
*/
ParkDO getPark(String id);
/**
* 获得场库列表分页
*
* @param pageReqVO 分页查询
* @return 场库列表分页
*/
PageResult<ParkDO> getParkPage(ParkPageReqVO pageReqVO);
}

View File

@ -0,0 +1,79 @@
package cn.iocoder.yudao.module.parking.service.park;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.parking.controller.admin.park.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.park.ParkDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.parking.dal.mysql.park.ParkMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.parking.enums.ErrorCodeConstants.*;
/**
* 场库列表 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class ParkServiceImpl implements ParkService {
@Resource
private ParkMapper parkMapper;
@Override
public String createPark(ParkSaveReqVO createReqVO) {
// 插入
ParkDO park = BeanUtils.toBean(createReqVO, ParkDO.class);
parkMapper.insert(park);
// 返回
return park.getParkNumber();
}
@Override
public Boolean createOrUpdatePark(ParkSaveReqVO parkSaveReqVO) {
return parkMapper.insertOrUpdate(BeanUtils.toBean(parkSaveReqVO, ParkDO.class));
}
@Override
public void updatePark(ParkSaveReqVO updateReqVO) {
// 校验存在
validateParkExists(updateReqVO.getParkNumber());
// 更新
ParkDO updateObj = BeanUtils.toBean(updateReqVO, ParkDO.class);
parkMapper.updateById(updateObj);
}
@Override
public void deletePark(String id) {
// 校验存在
validateParkExists(id);
// 删除
parkMapper.deleteById(id);
}
private void validateParkExists(String id) {
if (parkMapper.selectById(id) == null) {
throw exception(PARK_NOT_EXISTS);
}
}
@Override
public ParkDO getPark(String id) {
return parkMapper.selectById(id);
}
@Override
public PageResult<ParkDO> getParkPage(ParkPageReqVO pageReqVO) {
return parkMapper.selectPage(pageReqVO);
}
}

View File

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.parking.service.passageway;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.parking.controller.admin.passageway.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.passageway.PassagewayDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
/**
* 通道信息 Service 接口
*
* @author 芋道源码
*/
public interface PassagewayService {
/**
* 创建通道信息
*
* @param createReqVO 创建信息
* @return 编号
*/
String createPassageway(@Valid PassagewaySaveReqVO createReqVO);
/**
* 更新通道信息
*
* @param updateReqVO 更新信息
*/
void updatePassageway(@Valid PassagewaySaveReqVO updateReqVO);
/**
* 删除通道信息
*
* @param id 编号
*/
void deletePassageway(String id);
/**
* 获得通道信息
*
* @param id 编号
* @return 通道信息
*/
PassagewayDO getPassageway(String id);
/**
* 获得通道信息分页
*
* @param pageReqVO 分页查询
* @return 通道信息分页
*/
PageResult<PassagewayDO> getPassagewayPage(PassagewayPageReqVO pageReqVO);
/**
* 通道信息创建或更新
* @param passagewayReqDataVO
* @return cn.iocoder.yudao.module.parking.util.BlueCardResult
*/
BlueCardResult passagewayUpload(PassagewayReqDataVO passagewayReqDataVO);
}

View File

@ -0,0 +1,82 @@
package cn.iocoder.yudao.module.parking.service.passageway;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.parking.controller.admin.passageway.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.passageway.PassagewayDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.parking.dal.mysql.passageway.PassagewayMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.parking.enums.ErrorCodeConstants.*;
/**
* 通道信息 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class PassagewayServiceImpl implements PassagewayService {
@Resource
private PassagewayMapper passagewayMapper;
@Override
public String createPassageway(PassagewaySaveReqVO createReqVO) {
// 插入
PassagewayDO passageway = BeanUtils.toBean(createReqVO, PassagewayDO.class);
passagewayMapper.insert(passageway);
// 返回
return passageway.getPassagewayId();
}
@Override
public void updatePassageway(PassagewaySaveReqVO updateReqVO) {
// 校验存在
validatePassagewayExists(updateReqVO.getPassagewayId());
// 更新
PassagewayDO updateObj = BeanUtils.toBean(updateReqVO, PassagewayDO.class);
passagewayMapper.updateById(updateObj);
}
@Override
public void deletePassageway(String id) {
// 校验存在
validatePassagewayExists(id);
// 删除
passagewayMapper.deleteById(id);
}
private void validatePassagewayExists(String id) {
if (passagewayMapper.selectById(id) == null) {
throw exception(PASSAGEWAY_NOT_EXISTS);
}
}
@Override
public PassagewayDO getPassageway(String id) {
return passagewayMapper.selectById(id);
}
@Override
public PageResult<PassagewayDO> getPassagewayPage(PassagewayPageReqVO pageReqVO) {
return passagewayMapper.selectPage(pageReqVO);
}
@Override
public BlueCardResult passagewayUpload(PassagewayReqDataVO passagewayReqDataVO) {
List<PassagewaySaveReqVO> passagewaySaveReqVOList = passagewayReqDataVO.getDatas();
// TODO 判断重复覆盖
return null;
}
}

View File

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

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.parking.dal.mysql.area.AreaMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.parking.dal.mysql.heartbeat.HeartbeatMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.parking.dal.mysql.park.ParkMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.parking.dal.mysql.passageway.PassagewayMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

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

View File

@ -3,7 +3,7 @@
spring:
cloud:
nacos:
server-addr: crm.fjptzykj.com:8849
server-addr: 127.0.0.1:8848
discovery:
namespace: dev
@ -14,7 +14,7 @@ spring:
nacos:
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
config:
server-addr: crm.fjptzykj.com:8849 # Nacos 服务器地址
server-addr: 127.0.0.1:8848 # Nacos 服务器地址
namespace: dev
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
name: # 使用的 Nacos 配置集的 dataId默认为 spring.application.name

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.infra.job.ticketing;
import cn.hutool.core.date.DatePattern;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.util.date.TickingDateUtils;
@ -26,6 +27,9 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -190,6 +194,114 @@ public class TicketDataMigration {
XxlJobHelper.log("抽数服务:检票数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!", totalRows, duplicatesCount, successCount);
}
@XxlJob("getCheckTicketByMongoDBLastMonthToNow")
public void getCheckTicketByMongoDBLastMonthToNow() throws Exception {
XxlJobHelper.log("抽数服务mongodb检票数据开始抽数...");
int successCount;
int duplicatesCount;
int pageNumber;
// 获取当前日期
Calendar startDate = Calendar.getInstance();
// 设置开始日期为上一个月的第一天
startDate.set(Calendar.DAY_OF_MONTH, 1); // 先将日期设置为当前月的第一天
startDate.add(Calendar.MONTH, -1); // 然后减去一个月
// 设置结束日期为今天
Calendar endDate = Calendar.getInstance();
// 循环从开始日期到结束日期
while (!startDate.after(endDate)) {
successCount = 0;
duplicatesCount = 0;
String dateString = TickingDateUtils.format(startDate.getTime());
pageNumber = 1;
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, dateString, pageNumber);
if (ticketingSamplingRespVO == null) {
startDate.add(Calendar.DAY_OF_MONTH, 1);
continue;
}
int totalRows = ticketingSamplingRespVO.getTotalRows();
List<Map<String, Object>> mapList;
// 获得总页数
int totalPages = ticketingSamplingRespVO.getTotalPages();
// 处理剩余页的数据
for (; pageNumber <= totalPages; pageNumber++) {
ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, dateString, pageNumber);
mapList = ticketingSamplingRespVO.getDataMapList();
List<Integer> resultNum = checkTicketService.insertByMongoDB(BeanUtils.toBean(mapList, CheckTicket.class));
if (resultNum == null) {
XxlJobHelper.log("数据批量插入异常!", pageNumber);
} else {
successCount += resultNum.get(0);
duplicatesCount += resultNum.get(1);
}
}
int currentMonth = startDate.get(Calendar.MONTH) + 1; // 加1以得到1-12的月份
int currentDay = startDate.get(Calendar.DAY_OF_MONTH);
XxlJobHelper.log("抽数服务:{}月{}日:检票数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!",currentMonth,currentDay ,totalRows, duplicatesCount, successCount);
// 日期递增一天
startDate.add(Calendar.DAY_OF_MONTH, 1);
}
XxlJobHelper.log("抽数结束!!!");
}
@XxlJob("getSaleDataByMongoDBLastMonthToNow")
public void getSaleDataByMongoDBLastMonthToNow() throws Exception {
XxlJobHelper.log("抽数服务mongodb售票数据开始抽数...");
int successCount;
int duplicatesCount;
int pageNumber;
// 获取当前日期
Calendar startDate = Calendar.getInstance();
// 设置开始日期为上一个月的第一天
startDate.set(Calendar.DAY_OF_MONTH, 1); // 先将日期设置为当前月的第一天
startDate.add(Calendar.MONTH, -1); // 然后减去一个月
// 设置结束日期为今天
Calendar endDate = Calendar.getInstance();
// 循环从开始日期到结束日期
while (!startDate.after(endDate)) {
successCount = 0;
duplicatesCount = 0;
String dateString = TickingDateUtils.format(startDate.getTime());
pageNumber = 1;
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, dateString, pageNumber);
if (ticketingSamplingRespVO == null) {
startDate.add(Calendar.DAY_OF_MONTH, 1);
continue;
}
int totalRows = ticketingSamplingRespVO.getTotalRows();
List<Map<String, Object>> mapList;
// 获得总页数
int totalPages = ticketingSamplingRespVO.getTotalPages();
// 处理剩余页的数据
for (; pageNumber <= totalPages; pageNumber++) {
ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, dateString, pageNumber);
mapList = ticketingSamplingRespVO.getDataMapList();
List<Integer> resultNum = saleDataService.insertByMongoDB(BeanUtils.toBean(mapList, SaleData.class));
if (resultNum == null) {
XxlJobHelper.log("数据批量插入异常!", pageNumber);
} else {
successCount += resultNum.get(0);
duplicatesCount += resultNum.get(1);
}
}
int currentMonth = startDate.get(Calendar.MONTH) + 1; // 加1以得到1-12的月份
int currentDay = startDate.get(Calendar.DAY_OF_MONTH);
XxlJobHelper.log("抽数服务:{}月{}日:售票数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!",currentMonth,currentDay ,totalRows, duplicatesCount, successCount);
// 日期递增一天
startDate.add(Calendar.DAY_OF_MONTH, 1);
}
XxlJobHelper.log("抽数结束!!!");
}
/**
* 插入销售数据的方法mysql
*
@ -262,9 +374,12 @@ public class TicketDataMigration {
// TODO 需要再优化
if (ticketingSamplingRespVO != null && !ticketingSamplingRespVO.isPassflag()) {
// 让调度中心重新调用
XxlJobHelper.log("抽数服务:检票数据抽数失败,返回消息:" + ticketingSamplingRespVO.getRtnMsg());
XxlJobHelper.handleFail("销售数据抽数失败,请重试");
XxlJobHelper.log("数据抽数失败,返回消息:" + ticketingSamplingRespVO.getRtnMsg());
XxlJobHelper.handleFail("数据抽数失败,请重试");
throw new RuntimeException();
}else if (ticketingSamplingRespVO.getPageNumber() == null || ticketingSamplingRespVO.getPageSize() == null || ticketingSamplingRespVO.getTotalPages() == null || ticketingSamplingRespVO.getTotalRows() == null || ticketingSamplingRespVO.getDataMapList().isEmpty()){
XxlJobHelper.log("{},请求抽数成功,但返回参数值存在问题:{}", date, ticketingSamplingRespVO);
return null;
}
return ticketingSamplingRespVO;
}

View File

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

View File

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