From 9c0636ee453ffb9accb27c4f6082f190876ba0b2 Mon Sep 17 00:00:00 2001 From: sonjinyon <2476687577@qq.com> Date: Tue, 3 Sep 2024 15:06:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=88=AA=E7=8F=AD=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/flight/TodayFlightController.java | 28 ++++ .../controller/app/flight/vo/Datas.java | 10 ++ .../app/flight/vo/FlightDataDO.java | 12 ++ .../app/flight/vo/TodayFlightPageReqVO.java | 33 ++++ .../app/flight/vo/TodayFlightRespVO.java | 39 +++++ .../app/flight/vo/TodayFlightSaveReqVO.java | 22 +++ .../app/vehicleaccess/VehicleAccessApi.java | 35 ++--- .../controller/app/weather/WeatherApi.java | 2 + .../dal/dataobject/flight/TodayFlightDO.java | 55 +++++++ .../BlueCardHeartbeatRepository.java | 4 + .../dal/mysql/flight/TodayFlightMapper.java | 27 ++++ .../service/flight/TodayFlightService.java | 18 +++ .../flight/TodayFlightServiceImpl.java | 144 ++++++++++++++++++ .../admin/black/BlackController.java | 80 ++-------- .../admin/white/WhiteController.java | 9 +- .../controller/admin/white/vo/WhiteAddVO.java | 26 ++++ .../parking/service/white/WhiteService.java | 2 +- .../service/white/WhiteServiceImpl.java | 88 ++++++++--- .../ticket/enums/ErrorCodeConstants.java | 3 + .../admin/flight/FlightController.java | 109 +++++++++++++ .../admin/flight/vo/FlightPageReqVO.java | 25 +++ .../admin/flight/vo/FlightRespVO.java | 28 ++++ .../admin/flight/vo/FlightSaveReqVO.java | 19 +++ .../admin/shiproute/ShipRouteController.java | 114 ++++++++++++++ .../shiproute/vo/ShipRoutePageReqVO.java | 28 ++++ .../admin/shiproute/vo/ShipRouteRespVO.java | 36 +++++ .../shiproute/vo/ShipRouteSaveReqVO.java | 22 +++ .../todayflight/TodayFlightController.java | 107 +++++++++++++ .../todayflight/vo/TodayFlightPageReqVO.java | 33 ++++ .../todayflight/vo/TodayFlightRespVO.java | 42 +++++ .../todayflight/vo/TodayFlightSaveReqVO.java | 28 ++++ .../dal/dataobject/flight/FlightDO.java | 35 +++++ .../dal/dataobject/shiproute/ShipRouteDO.java | 43 ++++++ .../dataobject/todayflight/TodayFlightDO.java | 59 +++++++ .../ticket/dal/mysql/flight/FlightMapper.java | 27 ++++ .../dal/mysql/shiproute/ShipRouteMapper.java | 28 ++++ .../mysql/todayflight/TodayFlightMapper.java | 31 ++++ .../ticket/service/flight/FlightService.java | 57 +++++++ .../service/flight/FlightServiceImpl.java | 79 ++++++++++ .../service/shiproute/ShipRouteService.java | 60 ++++++++ .../shiproute/ShipRouteServiceImpl.java | 79 ++++++++++ .../todayflight/TodayFlightService.java | 59 +++++++ .../todayflight/TodayFlightServiceImpl.java | 77 ++++++++++ 43 files changed, 1753 insertions(+), 109 deletions(-) create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/TodayFlightController.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/Datas.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/FlightDataDO.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/TodayFlightPageReqVO.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/TodayFlightRespVO.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/TodayFlightSaveReqVO.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/flight/TodayFlightDO.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mysql/flight/TodayFlightMapper.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/flight/TodayFlightService.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/flight/TodayFlightServiceImpl.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/white/vo/WhiteAddVO.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/FlightController.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/vo/FlightPageReqVO.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/vo/FlightRespVO.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/vo/FlightSaveReqVO.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/ShipRouteController.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/vo/ShipRoutePageReqVO.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/vo/ShipRouteRespVO.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/vo/ShipRouteSaveReqVO.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/TodayFlightController.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/vo/TodayFlightPageReqVO.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/vo/TodayFlightRespVO.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/vo/TodayFlightSaveReqVO.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/flight/FlightDO.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/shiproute/ShipRouteDO.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/todayflight/TodayFlightDO.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mysql/flight/FlightMapper.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mysql/shiproute/ShipRouteMapper.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mysql/todayflight/TodayFlightMapper.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/flight/FlightService.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/flight/FlightServiceImpl.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/shiproute/ShipRouteService.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/shiproute/ShipRouteServiceImpl.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/todayflight/TodayFlightService.java create mode 100644 ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/todayflight/TodayFlightServiceImpl.java diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/TodayFlightController.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/TodayFlightController.java new file mode 100644 index 000000000..1075689df --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/TodayFlightController.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.datacenter.controller.app.flight; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.datacenter.dal.dataobject.flight.TodayFlightDO; +import cn.iocoder.yudao.module.datacenter.service.flight.TodayFlightService; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import java.util.List; + + +@RestController +@RequestMapping("/flight") +public class TodayFlightController { + + @Resource + private TodayFlightService todayFlightService; + + @GetMapping("/getFlightData") + public CommonResult> getFlightData(){ + + List listCommonResult = todayFlightService.todayFlightData(); + + return CommonResult.success(listCommonResult); + } + + + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/Datas.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/Datas.java new file mode 100644 index 000000000..dd5e4d891 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/Datas.java @@ -0,0 +1,10 @@ +package cn.iocoder.yudao.module.datacenter.controller.app.flight.vo; + +import lombok.Data; + +@Data +public class Datas { + private String classes; + private String timeOne; + private String timeTwo; +} diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/FlightDataDO.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/FlightDataDO.java new file mode 100644 index 000000000..8b47dc003 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/FlightDataDO.java @@ -0,0 +1,12 @@ +package cn.iocoder.yudao.module.datacenter.controller.app.flight.vo; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class FlightDataDO { + private String name; + private List datas = new ArrayList<>(); +} diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/TodayFlightPageReqVO.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/TodayFlightPageReqVO.java new file mode 100644 index 000000000..644ce9df3 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/TodayFlightPageReqVO.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.module.datacenter.controller.app.flight.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +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 TodayFlightPageReqVO extends PageParam { + + @Schema(description = "航线", example = "19067") + private Long shipRouteId; + + @Schema(description = "班次") + private String classes; + + @Schema(description = "开始时间") + private String startTime; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/TodayFlightRespVO.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/TodayFlightRespVO.java new file mode 100644 index 000000000..a34088350 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/TodayFlightRespVO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.datacenter.controller.app.flight.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 今日航班 Response VO") +@Data +@ExcelIgnoreUnannotated +public class TodayFlightRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12418") + @ExcelProperty("id") + private Long id; + + @Schema(description = "航线", example = "19067") + @ExcelProperty("航线") + private Long shipRouteId; + + @Schema(description = "班次") + @ExcelProperty("班次") + private String classes; + + @Schema(description = "开始时间") + @ExcelProperty("开始时间") + private String startTime; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "航线") + @ExcelProperty("航线") + private String shipRouteName; + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/TodayFlightSaveReqVO.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/TodayFlightSaveReqVO.java new file mode 100644 index 000000000..cee5bfe89 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/flight/vo/TodayFlightSaveReqVO.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.datacenter.controller.app.flight.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 今日航班新增/修改 Request VO") +@Data +public class TodayFlightSaveReqVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12418") + private Long id; + + @Schema(description = "航线", example = "19067") + private Long shipRouteId; + + @Schema(description = "班次") + private String classes; + + @Schema(description = "开始时间") + private String startTime; + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/vehicleaccess/VehicleAccessApi.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/vehicleaccess/VehicleAccessApi.java index 9f83cf441..80c168876 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/vehicleaccess/VehicleAccessApi.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/vehicleaccess/VehicleAccessApi.java @@ -53,27 +53,33 @@ public class VehicleAccessApi { 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); + Optional topByCreateTimeBetween = blueCardHeartbeatRepository.findFirstByCreateTimeBetweenOrderByCreateTimeDesc(startOfDay, endOfDay); - return ResponseVO.success(200, "添加成功", null, 0); +// 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, "添加成功", topByCreateTimeBetween, 0); } //获取实时车辆进出数据和今日车位统计 @GetMapping("/parkingLotData") public ResponseVO parkAndVacancy() { - + // 获取今天的日期 + LocalDate today = LocalDate.now(); + // 计算今天的起始时间和结束时间 + LocalDateTime startOfDay = LocalDateTime.of(today, LocalTime.MIN); + LocalDateTime endOfDay = LocalDateTime.of(today, LocalTime.MAX); //时间最新的一条数据 - Optional latestHeartbeat = blueCardHeartbeatRepository.findTopByOrderByCreateTimeDesc(); + Optional latestHeartbeat = blueCardHeartbeatRepository.findFirstByCreateTimeBetweenOrderByCreateTimeDesc(startOfDay,endOfDay); if (latestHeartbeat.isPresent()) { BlueCardHeartbeat heartbeat = latestHeartbeat.get(); @@ -87,11 +93,6 @@ public class VehicleAccessApi { 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 entryRecords = entryRecordRepository.findByCreateTimeBetween(startOfDay, endOfDay); parkingLotDataVO.setIntoNum(entryRecords.size());//车辆进入数 //固定车临时车 diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/weather/WeatherApi.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/weather/WeatherApi.java index c52002098..2b0a5a418 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/weather/WeatherApi.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/app/weather/WeatherApi.java @@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.annotation.Resource; + /** * @Description 大屏服务-天气接口 */ diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/flight/TodayFlightDO.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/flight/TodayFlightDO.java new file mode 100644 index 000000000..f03521d3c --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/flight/TodayFlightDO.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.datacenter.dal.dataobject.flight; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 今日航班 DO + * + * @author 管理员 + */ +@TableName("today_flight") +@KeySequence("today_flight_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TodayFlightDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 航线 + */ + private Long shipRouteId; + /** + * 班次 + */ + private String classes; + /** + * 开始时间 + */ + private String startTime; + + @TableField(exist = false) + private String shipRouteName; + + @TableField(exist = false) + private String routeName; + + @TableField(exist = false) + private String flightName; + + @TableField(exist = false) + private String flightId; + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/vehicleaccess/BlueCardHeartbeatRepository.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/vehicleaccess/BlueCardHeartbeatRepository.java index 7a93b3fa5..3aef1aa60 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/vehicleaccess/BlueCardHeartbeatRepository.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/vehicleaccess/BlueCardHeartbeatRepository.java @@ -2,7 +2,9 @@ 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 org.springframework.data.mongodb.repository.Query; +import java.time.LocalDateTime; import java.util.Optional; public interface BlueCardHeartbeatRepository extends MongoRepository { @@ -10,5 +12,7 @@ public interface BlueCardHeartbeatRepository extends MongoRepository findTopByOrderByCreateTimeDesc(); + Optional findFirstByCreateTimeBetweenOrderByCreateTimeDesc(LocalDateTime startOfDay, LocalDateTime endOfDay); + } diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mysql/flight/TodayFlightMapper.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mysql/flight/TodayFlightMapper.java new file mode 100644 index 000000000..6793dde08 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mysql/flight/TodayFlightMapper.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.datacenter.dal.mysql.flight; + +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.datacenter.dal.dataobject.flight.TodayFlightDO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * 今日航班 Mapper + * + * @author 管理员 + */ +@Mapper +public interface TodayFlightMapper extends BaseMapperX { + + + @Select(" select count(c.id),c.id as flight_id from today_flight a " + + " inner join ship_route b on a.ship_route_id = b.id " + + " inner join flight c on b.flight_id = c.id GROUP BY c.id ") + List todayFlightData(); + + @Select("select ship_route_id,classes,start_time from today_flight where ship_route_id = #{id} ORDER BY start_time ASC") + List byRouteId(String id); + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/flight/TodayFlightService.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/flight/TodayFlightService.java new file mode 100644 index 000000000..459fd6ae1 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/flight/TodayFlightService.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.datacenter.service.flight; + + +import cn.iocoder.yudao.module.datacenter.dal.dataobject.flight.TodayFlightDO; + +import java.util.List; + +/** + * 今日航班 Service 接口 + * + * @author 管理员 + */ +public interface TodayFlightService { + + + List todayFlightData(); + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/flight/TodayFlightServiceImpl.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/flight/TodayFlightServiceImpl.java new file mode 100644 index 000000000..5932c9e3a --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/flight/TodayFlightServiceImpl.java @@ -0,0 +1,144 @@ +package cn.iocoder.yudao.module.datacenter.service.flight; + +import cn.iocoder.yudao.module.datacenter.controller.app.flight.vo.Datas; +import cn.iocoder.yudao.module.datacenter.controller.app.flight.vo.FlightDataDO; +import cn.iocoder.yudao.module.datacenter.dal.dataobject.flight.TodayFlightDO; +import cn.iocoder.yudao.module.datacenter.dal.mysql.flight.TodayFlightMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + + +/** + * 今日航班 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class TodayFlightServiceImpl implements TodayFlightService { + + @Resource + private TodayFlightMapper todayFlightMapper; + + + @Override + public List todayFlightData() { + List flightVO = new ArrayList<>();//所有航班集合 + List todayFlightDOS = todayFlightMapper.todayFlightData(); + for (int i = 0; i < todayFlightDOS.size(); i++) { + TodayFlightDO todayFlightDO = todayFlightDOS.get(i); + if (todayFlightDO.getFlightId().equals("1")){ //石南航班信息 + FlightDataDO flightDataDO = new FlightDataDO(); + flightDataDO.setName("石南航班信息"); + List todayFlightDOS1 = todayFlightMapper.byRouteId("2"); //石城至南日 + List todayFlightDOS2 = todayFlightMapper.byRouteId("1");//南日至石城 + for (int j = 0; j < todayFlightDOS1.size(); j++) { + Datas datas = new Datas(); + datas.setClasses(todayFlightDOS1.get(j).getClasses()); + datas.setTimeOne(todayFlightDOS1.get(j).getStartTime()); + if (j <= todayFlightDOS2.size() - 1){ + datas.setTimeTwo(todayFlightDOS2.get(j).getStartTime()); + } + flightDataDO.getDatas().add(datas); + } + flightVO.add(flightDataDO); + } + + if (todayFlightDO.getFlightId().equals("2")){ //筶杯航班信息 + FlightDataDO flightDataDO = new FlightDataDO(); + flightDataDO.setName("筶杯航班信息"); + List todayFlightDOS1 = todayFlightMapper.byRouteId("3"); //筶杯出岛 + List todayFlightDOS2 = todayFlightMapper.byRouteId("4");//鹅头进岛 + for (int j = 0; j < todayFlightDOS1.size(); j++) { + Datas datas = new Datas(); + datas.setClasses(todayFlightDOS1.get(j).getClasses()); + datas.setTimeOne(todayFlightDOS1.get(j).getStartTime()); + if (j <= todayFlightDOS2.size() - 1){ + datas.setTimeTwo(todayFlightDOS2.get(j).getStartTime()); + } + flightDataDO.getDatas().add(datas); + } + flightVO.add(flightDataDO); + } + + if (todayFlightDO.getFlightId().equals("3")){ //黄瓜航班信息 + FlightDataDO flightDataDO = new FlightDataDO(); + flightDataDO.setName("黄瓜航班信息"); + List todayFlightDOS1 = todayFlightMapper.byRouteId("5"); //黄瓜出岛 + List todayFlightDOS2 = todayFlightMapper.byRouteId("6");//淇泸进岛 + for (int j = 0; j < todayFlightDOS1.size(); j++) { + Datas datas = new Datas(); + datas.setClasses(todayFlightDOS1.get(j).getClasses()); + datas.setTimeOne(todayFlightDOS1.get(j).getStartTime()); + if (j <= todayFlightDOS2.size() - 1){ + datas.setTimeTwo(todayFlightDOS2.get(j).getStartTime()); + } + flightDataDO.getDatas().add(datas); + } + flightVO.add(flightDataDO); + } + + + if (todayFlightDO.getFlightId().equals("4")){ //小日 + FlightDataDO flightDataDO = new FlightDataDO(); + flightDataDO.setName("小日航班信息"); + List todayFlightDOS1 = todayFlightMapper.byRouteId("7"); // 小日出岛 + List todayFlightDOS2 = todayFlightMapper.byRouteId("8");//坑口进岛 + for (int j = 0; j < todayFlightDOS1.size(); j++) { + Datas datas = new Datas(); + datas.setClasses(todayFlightDOS1.get(j).getClasses()); + datas.setTimeOne(todayFlightDOS1.get(j).getStartTime()); + if (j <= todayFlightDOS2.size() - 1){ + datas.setTimeTwo(todayFlightDOS2.get(j).getStartTime()); + } + flightDataDO.getDatas().add(datas); + } + flightVO.add(flightDataDO); + } + + if (todayFlightDO.getFlightId().equals("5")){ //罗盘航班信息 + FlightDataDO flightDataDO = new FlightDataDO(); + flightDataDO.setName("罗盘航班信息"); + List todayFlightDOS1 = todayFlightMapper.byRouteId("11"); //罗盘出岛 + List todayFlightDOS2 = todayFlightMapper.byRouteId("12");//东岱进岛 + for (int j = 0; j < todayFlightDOS1.size(); j++) { + Datas datas = new Datas(); + datas.setClasses(todayFlightDOS1.get(j).getClasses()); + datas.setTimeOne(todayFlightDOS1.get(j).getStartTime()); + if (j <= todayFlightDOS2.size() - 1){ + datas.setTimeTwo(todayFlightDOS2.get(j).getStartTime()); + } + flightDataDO.getDatas().add(datas); + } + flightVO.add(flightDataDO); + } + + if (todayFlightDO.getFlightId().equals("6")){ //鳌屿航班信息 + FlightDataDO flightDataDO = new FlightDataDO(); + flightDataDO.setName("鳌屿航班信息"); + List todayFlightDOS1 = todayFlightMapper.byRouteId("9"); //鳌屿出岛 + List todayFlightDOS2 = todayFlightMapper.byRouteId("10");//东岱进岛 + for (int j = 0; j < todayFlightDOS1.size(); j++) { + Datas datas = new Datas(); + datas.setClasses(todayFlightDOS1.get(j).getClasses()); + datas.setTimeOne(todayFlightDOS1.get(j).getStartTime()); + if (j <= todayFlightDOS2.size() - 1){ + datas.setTimeTwo(todayFlightDOS2.get(j).getStartTime()); + } + flightDataDO.getDatas().add(datas); + } + flightVO.add(flightDataDO); + } + + + } + + return flightVO; + } + + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/black/BlackController.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/black/BlackController.java index 2bda351df..36dbe1698 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/black/BlackController.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/black/BlackController.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.parking.controller.admin.black; +import cn.iocoder.yudao.module.parking.util.BlueCarRequestUtil; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -42,6 +44,9 @@ public class BlackController { @Resource private BlackService blackService; + @Resource + private BlueCarRequestUtil blueCarRequestUtil; + /** * 删除黑名单 @@ -61,26 +66,7 @@ public class BlackController { datasList.add(datas); blackVO.setDatas(datasList); //调用蓝卡接口 - try { - String url = "http://蓝卡云 ip:端口/bcopenapi/out/delBlack"; - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - // 请求方式 - con.setRequestMethod("GET"); - // 获取响应 - int responseCode = con.getResponseCode(); - System.out.println("Response Code : " + responseCode); - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - StringBuilder response = new StringBuilder(); - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - System.out.println(response.toString()); - } catch (Exception e) { - e.printStackTrace(); - } + CommonResult stringCommonResult = blueCarRequestUtil.doBlueCarPost(blackVO, "bcopenapi/out/delBlack"); return success(true); } @@ -101,26 +87,7 @@ public class BlackController { datasList.add(datas); blackVO.setDatas(datasList); //调用蓝卡接口 - try { - String url = " http://蓝卡云 ip:端口/bcopenapi/out/queryBlack"; - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - // 请求方式 - con.setRequestMethod("GET"); - // 获取响应 - int responseCode = con.getResponseCode(); - System.out.println("Response Code : " + responseCode); - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - StringBuilder response = new StringBuilder(); - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - System.out.println(response.toString()); - } catch (Exception e) { - e.printStackTrace(); - } + blueCarRequestUtil.doBlueCarPost(blackVO,"bcopenapi/out/queryBlack"); return success(true); } @@ -130,39 +97,19 @@ public class BlackController { * @param * @return */ - @PostMapping("/synBlack") - public CommonResult synBlack(BlackDO blackDO) { + public CommonResult synBlack(BlackSaveReqVO blackSaveReqVO) { //设置请求参数 BlackVO blackVO = new BlackVO(); - blackVO.setParkNumber(blackDO.getParkNumber()); - blackVO.setSource(blackDO.getSource()); + blackVO.setParkNumber(blackSaveReqVO.getParkNumber()); + blackVO.setSource(blackSaveReqVO.getSource()); List datasList = new ArrayList<>(); Datas datas = new Datas(); - datas.setPlate(blackDO.getPlate()); - datas.setMemo(blackDO.getMemo()); + datas.setPlate(blackSaveReqVO.getPlate()); + datas.setMemo(blackSaveReqVO.getMemo()); datasList.add(datas); blackVO.setDatas(datasList); //调用蓝卡接口 - try { - String url = "http://蓝卡云 ip:端口/bcopenapi/out/synBlack"; - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - // 请求方式 - con.setRequestMethod("GET"); - // 获取响应 - int responseCode = con.getResponseCode(); - System.out.println("Response Code : " + responseCode); - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - StringBuilder response = new StringBuilder(); - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - System.out.println(response.toString()); - } catch (Exception e) { - e.printStackTrace(); - } + blueCarRequestUtil.doBlueCarPost(blackVO,"bcopenapi/out/synBlack"); return success(true); } @@ -172,6 +119,7 @@ public class BlackController { @Operation(summary = "创建黑名单") @PreAuthorize("@ss.hasPermission('parking:black:create')") public CommonResult createBlack(@Valid @RequestBody BlackSaveReqVO createReqVO) { + CommonResult booleanCommonResult = synBlack(createReqVO); return success(blackService.createBlack(createReqVO)); } diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/white/WhiteController.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/white/WhiteController.java index b180e3e5b..1be8ee0fe 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/white/WhiteController.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/white/WhiteController.java @@ -52,11 +52,16 @@ public class WhiteController { } + /** + * 新增白名单 + * @param createReqVO + * @return + */ @PostMapping("/create") @Operation(summary = "创建白名单管理") @PreAuthorize("@ss.hasPermission('parking:white:create')") - public CommonResult createWhite(@Valid @RequestBody WhiteSaveReqVO createReqVO) { - return success(whiteService.createWhite(createReqVO)); + public CommonResult createWhite(@Valid @RequestBody WhiteAddVO whiteAddVO) { + return success(whiteService.createWhite(whiteAddVO)); } @PutMapping("/update") diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/white/vo/WhiteAddVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/white/vo/WhiteAddVO.java new file mode 100644 index 000000000..31b7a2cab --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/white/vo/WhiteAddVO.java @@ -0,0 +1,26 @@ +package cn.iocoder.yudao.module.parking.controller.admin.white.vo; + +import lombok.Data; + +@Data +public class WhiteAddVO { + private Integer fixedId; + private String parkNumber; + private Integer size; + private String plate; + private String chargeType; + private String name; + private String certificate; + private String address; + private String phone; + private String plateColor; + private String start; + private String end; + private String dept; + private String carType; + private String memo; + private Integer areaId; + private String areaStart; + private String areaEnd; + private String source; +} diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/white/WhiteService.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/white/WhiteService.java index d54dd5fde..2dc43fd1d 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/white/WhiteService.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/white/WhiteService.java @@ -22,7 +22,7 @@ public interface WhiteService { * @param createReqVO 创建信息 * @return 编号 */ - Integer createWhite(@Valid WhiteSaveReqVO createReqVO); + Integer createWhite(@Valid WhiteAddVO whiteAddVO); /** * 更新白名单管理 diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/white/WhiteServiceImpl.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/white/WhiteServiceImpl.java index a9cb0406d..17755b076 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/white/WhiteServiceImpl.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/white/WhiteServiceImpl.java @@ -6,9 +6,12 @@ import cn.iocoder.yudao.module.parking.dal.dataobject.userinfo.UserInfoDO; import cn.iocoder.yudao.module.parking.dal.mysql.areasandvalidity.AreasAndValidityMapper; import cn.iocoder.yudao.module.parking.dal.mysql.carinfo.CarInfoMapper; import cn.iocoder.yudao.module.parking.dal.mysql.userinfo.UserInfoMapper; +import cn.iocoder.yudao.module.parking.util.BlueCarRequestUtil; import cn.iocoder.yudao.module.parking.util.BlueCardResult; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import javax.validation.Valid; + import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; @@ -49,15 +52,74 @@ public class WhiteServiceImpl implements WhiteService { @Resource private AreasAndValidityMapper areasAndValidityMapper; + @Resource + private BlueCarRequestUtil blueCarRequestUtil; + @Override - public Integer createWhite(WhiteSaveReqVO createReqVO) { + public Integer createWhite(WhiteAddVO whiteAddVO) { // 插入 - WhiteDO white = BeanUtils.toBean(createReqVO, WhiteDO.class); + WhiteDO white = BeanUtils.toBean(whiteAddVO, WhiteDO.class); whiteMapper.insert(white); + + WhiteDO whiteDO = new WhiteDO(); + whiteDO.setFixedId(whiteAddVO.getFixedId()); + whiteDO.setParkNumber(whiteAddVO.getParkNumber()); + whiteDO.setPlate(whiteAddVO.getPlate()); + whiteDO.setChargeType(whiteAddVO.getChargeType()); + whiteDO.setCertificate(whiteAddVO.getCertificate()); + whiteDO.setStart(whiteAddVO.getStart()); + whiteDO.setEnd(whiteAddVO.getEnd()); + whiteDO.setDept(whiteAddVO.getDept()); + whiteDO.setMemo(whiteAddVO.getMemo()); + whiteDO.setSource(whiteAddVO.getSource()); + WhiteDO whiteDO1 = whiteMapper.selectOne("fixed_id", whiteAddVO.getFixedId()); + if (whiteDO1 != null){ + whiteMapper.updateById(whiteDO); + }else { + whiteMapper.insert(whiteDO); + } + + + UserInfoDO userInfoDO = new UserInfoDO(); + userInfoDO.setIdCard(whiteAddVO.getCertificate()); + userInfoDO.setUserName(whiteAddVO.getName()); + userInfoDO.setPhone(whiteAddVO.getPhone()); + userInfoDO.setAddress(whiteAddVO.getAddress()); + UserInfoDO userInfoDOOne = userInfoMapper.selectOne("id_card", whiteAddVO.getCertificate()); + if (userInfoDOOne == null){ + userInfoMapper.insert(userInfoDO); + }else { + userInfoMapper.updateById(userInfoDO); + } + + CarInfoDO carInfoDO = new CarInfoDO(); + carInfoDO.setPlate(whiteAddVO.getPlate()); + carInfoDO.setPlateColor(whiteAddVO.getPlateColor()); +// carInfoDO.setTicketCode(whiteDatasDO.get) + carInfoDO.setCarType(whiteAddVO.getCarType()); +// carInfoDO.setConfidence(whiteDatasDO.ge) + CarInfoDO carInfoDO1 = carInfoMapper.selectOne("plate", whiteAddVO.getPlate()); + if (carInfoDO1 == null){ + carInfoMapper.insert(carInfoDO); + }else { + carInfoDO.setId(carInfoDO1.getId()); + carInfoMapper.updateById(carInfoDO); + } + + AreasAndValidityDO areasAndValidityDOs = new AreasAndValidityDO(); + areasAndValidityDOs.setAreaId(whiteAddVO.getAreaId()); + areasAndValidityDOs.setStart(whiteAddVO.getStart()); + areasAndValidityDOs.setEnd(whiteAddVO.getEnd()); + areasAndValidityDOs.setFixedId(whiteAddVO.getFixedId()); + areasAndValidityMapper.insert(areasAndValidityDOs); + + // 返回 + blueCarRequestUtil.doBlueCarPost(whiteAddVO,"/bcopenapi/out/synWhite"); return white.getFixedId(); } + @Override public void updateWhite(WhiteSaveReqVO updateReqVO) { // 校验存在 @@ -86,27 +148,7 @@ public class WhiteServiceImpl implements WhiteService { areasAndValidityDOS.add(areasAndValidityDO); whiteDeleteDO.setAreasAndValidity(areasAndValidityDOS); //调用蓝卡接口白名单删除 - try { - String url = "http://蓝卡云 ip:端口/bcopenapi/out/delWhite"; - URL obj = new URL(url); - HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - // 请求方式 - con.setRequestMethod("GET"); - // 获取响应 - int responseCode = con.getResponseCode(); - System.out.println("Response Code : " + responseCode); - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - StringBuilder response = new StringBuilder(); - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - System.out.println(response.toString()); - } catch (Exception e) { - e.printStackTrace(); - } - + blueCarRequestUtil.doBlueCarPost(whiteDeleteDO,"bcopenapi/out/delWhite"); } private void validateWhiteExists(Integer id) { diff --git a/ludu-module-ticketing/ludu-module-ticketing-api/src/main/java/cn/iocoder/yudao/module/ticket/enums/ErrorCodeConstants.java b/ludu-module-ticketing/ludu-module-ticketing-api/src/main/java/cn/iocoder/yudao/module/ticket/enums/ErrorCodeConstants.java index 1276597fe..611b94003 100644 --- a/ludu-module-ticketing/ludu-module-ticketing-api/src/main/java/cn/iocoder/yudao/module/ticket/enums/ErrorCodeConstants.java +++ b/ludu-module-ticketing/ludu-module-ticketing-api/src/main/java/cn/iocoder/yudao/module/ticket/enums/ErrorCodeConstants.java @@ -12,5 +12,8 @@ public interface ErrorCodeConstants { ErrorCode INFORMATION_NOT_EXISTS = new ErrorCode(1_005_002_001, "旅客信息不存在"); ErrorCode ALL_NOT_EXISTS = new ErrorCode(1_005_003_001, "设备登录日志不存在"); ErrorCode UM_NOT_EXISTS = new ErrorCode(1_005_004_001, "上行报文不存在"); + ErrorCode FLIGHT_NOT_EXISTS = new ErrorCode(1_005_005_001, "航班不存在"); + ErrorCode SHIP_ROUTE_NOT_EXISTS = new ErrorCode(1_005_006_001, "航线不存在"); + ErrorCode TODAY_FLIGHT_NOT_EXISTS = new ErrorCode(1_005_007_001, "今日航班不存在"); } diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/FlightController.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/FlightController.java new file mode 100644 index 000000000..bef6a27c9 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/FlightController.java @@ -0,0 +1,109 @@ +package cn.iocoder.yudao.module.ticket.controller.admin.flight; + +import cn.iocoder.yudao.module.ticket.dal.dataobject.todayflight.TodayFlightDO; +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.ticket.controller.admin.flight.vo.*; +import cn.iocoder.yudao.module.ticket.dal.dataobject.flight.FlightDO; +import cn.iocoder.yudao.module.ticket.service.flight.FlightService; + +@Tag(name = "管理后台 - 航班") +@RestController +@RequestMapping("/ticket/flight") +@Validated +public class FlightController { + + @Resource + private FlightService flightService; + + /** + * 下拉框数据 + * @return + */ + @GetMapping("/flightNameOption") + public CommonResult> flightNameOption(){ + return success(flightService.flightNameOption()); + } + + + @PostMapping("/create") + @Operation(summary = "创建航班") + @PreAuthorize("@ss.hasPermission('ticket:flight:create')") + public CommonResult createFlight(@Valid @RequestBody FlightSaveReqVO createReqVO) { + return success(flightService.createFlight(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新航班") + @PreAuthorize("@ss.hasPermission('ticket:flight:update')") + public CommonResult updateFlight(@Valid @RequestBody FlightSaveReqVO updateReqVO) { + flightService.updateFlight(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除航班") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('ticket:flight:delete')") + public CommonResult deleteFlight(@RequestParam("id") Long id) { + flightService.deleteFlight(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得航班") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('ticket:flight:query')") + public CommonResult getFlight(@RequestParam("id") Long id) { + FlightDO flight = flightService.getFlight(id); + return success(BeanUtils.toBean(flight, FlightRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得航班分页") + @PreAuthorize("@ss.hasPermission('ticket:flight:query')") + public CommonResult> getFlightPage(@Valid FlightPageReqVO pageReqVO) { + PageResult pageResult = flightService.getFlightPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, FlightRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出航班 Excel") + @PreAuthorize("@ss.hasPermission('ticket:flight:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportFlightExcel(@Valid FlightPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = flightService.getFlightPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "航班.xls", "数据", FlightRespVO.class, + BeanUtils.toBean(list, FlightRespVO.class)); + } + + + + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/vo/FlightPageReqVO.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/vo/FlightPageReqVO.java new file mode 100644 index 000000000..9efad8699 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/vo/FlightPageReqVO.java @@ -0,0 +1,25 @@ +package cn.iocoder.yudao.module.ticket.controller.admin.flight.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 FlightPageReqVO extends PageParam { + + @Schema(description = "航班名称", example = "芋艿") + private String flightName; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/vo/FlightRespVO.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/vo/FlightRespVO.java new file mode 100644 index 000000000..e9c76a14d --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/vo/FlightRespVO.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.ticket.controller.admin.flight.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 FlightRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26858") + @ExcelProperty("id") + private Long id; + + @Schema(description = "航班名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @ExcelProperty("航班名称") + private String flightName; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/vo/FlightSaveReqVO.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/vo/FlightSaveReqVO.java new file mode 100644 index 000000000..380edf6a2 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/flight/vo/FlightSaveReqVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.ticket.controller.admin.flight.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 FlightSaveReqVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26858") + private Long id; + + @Schema(description = "航班名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @NotEmpty(message = "航班名称不能为空") + private String flightName; + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/ShipRouteController.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/ShipRouteController.java new file mode 100644 index 000000000..78360cf1d --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/ShipRouteController.java @@ -0,0 +1,114 @@ +package cn.iocoder.yudao.module.ticket.controller.admin.shiproute; + +import cn.iocoder.yudao.module.ticket.dal.dataobject.flight.FlightDO; +import cn.iocoder.yudao.module.ticket.dal.mysql.flight.FlightMapper; +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.ticket.controller.admin.shiproute.vo.*; +import cn.iocoder.yudao.module.ticket.dal.dataobject.shiproute.ShipRouteDO; +import cn.iocoder.yudao.module.ticket.service.shiproute.ShipRouteService; + +@Tag(name = "管理后台 - 航线") +@RestController +@RequestMapping("/ticket/ship-route") +@Validated +public class ShipRouteController { + + @Resource + private ShipRouteService shipRouteService; + + @Resource + private FlightMapper flightMapper; + + /** + * 下拉框数据 + * @return + */ + @GetMapping("/routeNameOption") + public CommonResult> routeNameOption(){ + return success(shipRouteService.routeNameOption()); + } + + @PostMapping("/create") + @Operation(summary = "创建航线") + @PreAuthorize("@ss.hasPermission('ticket:ship-route:create')") + public CommonResult createShipRoute(@Valid @RequestBody ShipRouteSaveReqVO createReqVO) { + return success(shipRouteService.createShipRoute(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新航线") + @PreAuthorize("@ss.hasPermission('ticket:ship-route:update')") + public CommonResult updateShipRoute(@Valid @RequestBody ShipRouteSaveReqVO updateReqVO) { + shipRouteService.updateShipRoute(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除航线") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('ticket:ship-route:delete')") + public CommonResult deleteShipRoute(@RequestParam("id") Long id) { + shipRouteService.deleteShipRoute(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得航线") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('ticket:ship-route:query')") + public CommonResult getShipRoute(@RequestParam("id") Long id) { + ShipRouteDO shipRoute = shipRouteService.getShipRoute(id); + return success(BeanUtils.toBean(shipRoute, ShipRouteRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得航线分页") + @PreAuthorize("@ss.hasPermission('ticket:ship-route:query')") + public CommonResult> getShipRoutePage(@Valid ShipRoutePageReqVO pageReqVO) { + PageResult pageResult = shipRouteService.getShipRoutePage(pageReqVO); + for (int i = 0; i < pageResult.getList().size(); i++) { + ShipRouteDO shipRouteDO = pageResult.getList().get(i); + FlightDO flightDO = flightMapper.selectOne("id", shipRouteDO.getFlightId()); + shipRouteDO.setFlightName(flightDO.getFlightName()); + } + return success(BeanUtils.toBean(pageResult, ShipRouteRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出航线 Excel") + @PreAuthorize("@ss.hasPermission('ticket:ship-route:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportShipRouteExcel(@Valid ShipRoutePageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = shipRouteService.getShipRoutePage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "航线.xls", "数据", ShipRouteRespVO.class, + BeanUtils.toBean(list, ShipRouteRespVO.class)); + } + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/vo/ShipRoutePageReqVO.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/vo/ShipRoutePageReqVO.java new file mode 100644 index 000000000..b3346f532 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/vo/ShipRoutePageReqVO.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.ticket.controller.admin.shiproute.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 ShipRoutePageReqVO extends PageParam { + + @Schema(description = "航班", example = "4836") + private Long flightId; + + @Schema(description = "航线名称", example = "王五") + private String routeName; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/vo/ShipRouteRespVO.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/vo/ShipRouteRespVO.java new file mode 100644 index 000000000..7672fde00 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/vo/ShipRouteRespVO.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.module.ticket.controller.admin.shiproute.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 ShipRouteRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19757") + @ExcelProperty("id") + private Long id; + + @Schema(description = "航班", example = "4836") + @ExcelProperty("航班") + private Long flightId; + + @Schema(description = "航线名称", example = "王五") + @ExcelProperty("航线名称") + private String routeName; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @ExcelProperty("航班") + private String flightName; + + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/vo/ShipRouteSaveReqVO.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/vo/ShipRouteSaveReqVO.java new file mode 100644 index 000000000..2a62227f8 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/shiproute/vo/ShipRouteSaveReqVO.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.ticket.controller.admin.shiproute.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 ShipRouteSaveReqVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19757") + private Long id; + + @Schema(description = "航班", example = "4836") + private Long flightId; + + @Schema(description = "航线名称", example = "王五") + private String routeName; + + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/TodayFlightController.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/TodayFlightController.java new file mode 100644 index 000000000..9a83ed68c --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/TodayFlightController.java @@ -0,0 +1,107 @@ +package cn.iocoder.yudao.module.ticket.controller.admin.todayflight; + +import cn.iocoder.yudao.module.ticket.dal.dataobject.shiproute.ShipRouteDO; +import cn.iocoder.yudao.module.ticket.dal.mysql.shiproute.ShipRouteMapper; +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.ticket.controller.admin.todayflight.vo.*; +import cn.iocoder.yudao.module.ticket.dal.dataobject.todayflight.TodayFlightDO; +import cn.iocoder.yudao.module.ticket.service.todayflight.TodayFlightService; + +@Tag(name = "管理后台 - 今日航班") +@RestController +@RequestMapping("/ticket/today-flight") +@Validated +public class TodayFlightController { + + @Resource + private TodayFlightService todayFlightService; + + @Resource + private ShipRouteMapper shipRouteMapper; + + @PostMapping("/create") + @Operation(summary = "创建今日航班") + @PreAuthorize("@ss.hasPermission('ticket:today-flight:create')") + public CommonResult createTodayFlight(@Valid @RequestBody TodayFlightSaveReqVO createReqVO) { + return success(todayFlightService.createTodayFlight(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新今日航班") + @PreAuthorize("@ss.hasPermission('ticket:today-flight:update')") + public CommonResult updateTodayFlight(@Valid @RequestBody TodayFlightSaveReqVO updateReqVO) { + todayFlightService.updateTodayFlight(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除今日航班") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('ticket:today-flight:delete')") + public CommonResult deleteTodayFlight(@RequestParam("id") Long id) { + todayFlightService.deleteTodayFlight(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得今日航班") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('ticket:today-flight:query')") + public CommonResult getTodayFlight(@RequestParam("id") Long id) { + TodayFlightDO todayFlight = todayFlightService.getTodayFlight(id); + return success(BeanUtils.toBean(todayFlight, TodayFlightRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得今日航班分页") + @PreAuthorize("@ss.hasPermission('ticket:today-flight:query')") + public CommonResult> getTodayFlightPage(@Valid TodayFlightPageReqVO pageReqVO) { + PageResult pageResult = todayFlightService.getTodayFlightPage(pageReqVO); + for (int i = 0; i < pageResult.getList().size(); i++) { + TodayFlightDO todayFlightDO = pageResult.getList().get(i); + ShipRouteDO shipRouteDO = shipRouteMapper.selectOne("id", todayFlightDO.getShipRouteId()); + todayFlightDO.setShipRouteName(shipRouteDO.getRouteName()); + } + return success(BeanUtils.toBean(pageResult, TodayFlightRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出今日航班 Excel") + @PreAuthorize("@ss.hasPermission('ticket:today-flight:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportTodayFlightExcel(@Valid TodayFlightPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = todayFlightService.getTodayFlightPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "今日航班.xls", "数据", TodayFlightRespVO.class, + BeanUtils.toBean(list, TodayFlightRespVO.class)); + } + + + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/vo/TodayFlightPageReqVO.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/vo/TodayFlightPageReqVO.java new file mode 100644 index 000000000..afed54323 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/vo/TodayFlightPageReqVO.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.module.ticket.controller.admin.todayflight.vo; + +import lombok.*; + +import java.time.LocalTime; +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 TodayFlightPageReqVO extends PageParam { + + @Schema(description = "航线", example = "19067") + private Long shipRouteId; + + @Schema(description = "班次") + private String classes; + + @Schema(description = "开始时间") + private String startTime; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/vo/TodayFlightRespVO.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/vo/TodayFlightRespVO.java new file mode 100644 index 000000000..760955347 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/vo/TodayFlightRespVO.java @@ -0,0 +1,42 @@ +package cn.iocoder.yudao.module.ticket.controller.admin.todayflight.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalTime; +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 TodayFlightRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12418") + @ExcelProperty("id") + private Long id; + + @Schema(description = "航线", example = "19067") + @ExcelProperty("航线") + private Long shipRouteId; + + @Schema(description = "班次") + @ExcelProperty("班次") + private String classes; + + @Schema(description = "开始时间") + @ExcelProperty("开始时间") + private String startTime; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "航线") + @ExcelProperty("航线") + private String shipRouteName; + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/vo/TodayFlightSaveReqVO.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/vo/TodayFlightSaveReqVO.java new file mode 100644 index 000000000..0df6ff42d --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/controller/admin/todayflight/vo/TodayFlightSaveReqVO.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.ticket.controller.admin.todayflight.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalTime; +import java.util.*; +import javax.validation.constraints.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 今日航班新增/修改 Request VO") +@Data +public class TodayFlightSaveReqVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12418") + private Long id; + + @Schema(description = "航线", example = "19067") + private Long shipRouteId; + + @Schema(description = "班次") + private String classes; + + @Schema(description = "开始时间") + private String startTime; + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/flight/FlightDO.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/flight/FlightDO.java new file mode 100644 index 000000000..80085e777 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/flight/FlightDO.java @@ -0,0 +1,35 @@ +package cn.iocoder.yudao.module.ticket.dal.dataobject.flight; + +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("flight") +@KeySequence("flight_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class FlightDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 航班名称 + */ + private String flightName; + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/shiproute/ShipRouteDO.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/shiproute/ShipRouteDO.java new file mode 100644 index 000000000..1ec226695 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/shiproute/ShipRouteDO.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.module.ticket.dal.dataobject.shiproute; + +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("ship_route") +@KeySequence("ship_route_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ShipRouteDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 航班 + */ + private Long flightId; + /** + * 航线名称 + */ + private String routeName; + + @TableField(exist = false) + private String flightName; + + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/todayflight/TodayFlightDO.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/todayflight/TodayFlightDO.java new file mode 100644 index 000000000..201583c55 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/todayflight/TodayFlightDO.java @@ -0,0 +1,59 @@ +package cn.iocoder.yudao.module.ticket.dal.dataobject.todayflight; + +import lombok.*; + +import java.sql.Time; +import java.time.LocalTime; +import java.util.*; +import java.time.LocalDateTime; +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("today_flight") +@KeySequence("today_flight_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TodayFlightDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 航线 + */ + private Long shipRouteId; + /** + * 班次 + */ + private String classes; + /** + * 开始时间 + */ + private String startTime; + + @TableField(exist = false) + private String shipRouteName; + + @TableField(exist = false) + private String routeName; + + @TableField(exist = false) + private String flightName; + + @TableField + private String flightId; + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mysql/flight/FlightMapper.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mysql/flight/FlightMapper.java new file mode 100644 index 000000000..ca43a64cc --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mysql/flight/FlightMapper.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.ticket.dal.mysql.flight; + +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.ticket.dal.dataobject.flight.FlightDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.ticket.controller.admin.flight.vo.*; + +/** + * 航班 Mapper + * + * @author 管理员 + */ +@Mapper +public interface FlightMapper extends BaseMapperX { + + default PageResult selectPage(FlightPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(FlightDO::getFlightName, reqVO.getFlightName()) + .betweenIfPresent(FlightDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(FlightDO::getId)); + } + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mysql/shiproute/ShipRouteMapper.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mysql/shiproute/ShipRouteMapper.java new file mode 100644 index 000000000..7af36d8c3 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mysql/shiproute/ShipRouteMapper.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.ticket.dal.mysql.shiproute; + +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.ticket.dal.dataobject.shiproute.ShipRouteDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.ticket.controller.admin.shiproute.vo.*; + +/** + * 航线 Mapper + * + * @author 管理员 + */ +@Mapper +public interface ShipRouteMapper extends BaseMapperX { + + default PageResult selectPage(ShipRoutePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ShipRouteDO::getFlightId, reqVO.getFlightId()) + .likeIfPresent(ShipRouteDO::getRouteName, reqVO.getRouteName()) + .betweenIfPresent(ShipRouteDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(ShipRouteDO::getId)); + } + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mysql/todayflight/TodayFlightMapper.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mysql/todayflight/TodayFlightMapper.java new file mode 100644 index 000000000..2b2e06021 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mysql/todayflight/TodayFlightMapper.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.ticket.dal.mysql.todayflight; + +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.ticket.dal.dataobject.todayflight.TodayFlightDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.ticket.controller.admin.todayflight.vo.*; +import org.apache.ibatis.annotations.Select; + +/** + * 今日航班 Mapper + * + * @author 管理员 + */ +@Mapper +public interface TodayFlightMapper extends BaseMapperX { + + default PageResult selectPage(TodayFlightPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(TodayFlightDO::getShipRouteId, reqVO.getShipRouteId()) + .eqIfPresent(TodayFlightDO::getClasses, reqVO.getClasses()) +// .betweenIfPresent(TodayFlightDO::getFlightDate, reqVO.getFlightDate()) +// .betweenIfPresent(TodayFlightDO::getStartTime, reqVO.getStartTime()) + .betweenIfPresent(TodayFlightDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(TodayFlightDO::getId)); + } + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/flight/FlightService.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/flight/FlightService.java new file mode 100644 index 000000000..67c4233f0 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/flight/FlightService.java @@ -0,0 +1,57 @@ +package cn.iocoder.yudao.module.ticket.service.flight; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.ticket.controller.admin.flight.vo.*; +import cn.iocoder.yudao.module.ticket.dal.dataobject.flight.FlightDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +/** + * 航班 Service 接口 + * + * @author 管理员 + */ +public interface FlightService { + + /** + * 创建航班 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createFlight(@Valid FlightSaveReqVO createReqVO); + + /** + * 更新航班 + * + * @param updateReqVO 更新信息 + */ + void updateFlight(@Valid FlightSaveReqVO updateReqVO); + + /** + * 删除航班 + * + * @param id 编号 + */ + void deleteFlight(Long id); + + /** + * 获得航班 + * + * @param id 编号 + * @return 航班 + */ + FlightDO getFlight(Long id); + + /** + * 获得航班分页 + * + * @param pageReqVO 分页查询 + * @return 航班分页 + */ + PageResult getFlightPage(FlightPageReqVO pageReqVO); + + List flightNameOption(); + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/flight/FlightServiceImpl.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/flight/FlightServiceImpl.java new file mode 100644 index 000000000..74686edc5 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/flight/FlightServiceImpl.java @@ -0,0 +1,79 @@ +package cn.iocoder.yudao.module.ticket.service.flight; + +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.ticket.controller.admin.flight.vo.*; +import cn.iocoder.yudao.module.ticket.dal.dataobject.flight.FlightDO; +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.ticket.dal.mysql.flight.FlightMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*; + +/** + * 航班 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class FlightServiceImpl implements FlightService { + + @Resource + private FlightMapper flightMapper; + + @Override + public Long createFlight(FlightSaveReqVO createReqVO) { + // 插入 + FlightDO flight = BeanUtils.toBean(createReqVO, FlightDO.class); + flightMapper.insert(flight); + // 返回 + return flight.getId(); + } + + @Override + public void updateFlight(FlightSaveReqVO updateReqVO) { + // 校验存在 + validateFlightExists(updateReqVO.getId()); + // 更新 + FlightDO updateObj = BeanUtils.toBean(updateReqVO, FlightDO.class); + flightMapper.updateById(updateObj); + } + + @Override + public void deleteFlight(Long id) { + // 校验存在 + validateFlightExists(id); + // 删除 + flightMapper.deleteById(id); + } + + private void validateFlightExists(Long id) { + if (flightMapper.selectById(id) == null) { + throw exception(FLIGHT_NOT_EXISTS); + } + } + + @Override + public FlightDO getFlight(Long id) { + return flightMapper.selectById(id); + } + + @Override + public PageResult getFlightPage(FlightPageReqVO pageReqVO) { + return flightMapper.selectPage(pageReqVO); + } + + @Override + public List flightNameOption() { + return flightMapper.selectList(); + } + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/shiproute/ShipRouteService.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/shiproute/ShipRouteService.java new file mode 100644 index 000000000..b21f1405e --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/shiproute/ShipRouteService.java @@ -0,0 +1,60 @@ +package cn.iocoder.yudao.module.ticket.service.shiproute; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.ticket.controller.admin.shiproute.vo.*; +import cn.iocoder.yudao.module.ticket.dal.dataobject.shiproute.ShipRouteDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +/** + * 航线 Service 接口 + * + * @author 管理员 + */ +public interface ShipRouteService { + + /** + * 创建航线 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createShipRoute(@Valid ShipRouteSaveReqVO createReqVO); + + /** + * 更新航线 + * + * @param updateReqVO 更新信息 + */ + void updateShipRoute(@Valid ShipRouteSaveReqVO updateReqVO); + + /** + * 删除航线 + * + * @param id 编号 + */ + void deleteShipRoute(Long id); + + /** + * 获得航线 + * + * @param id 编号 + * @return 航线 + */ + ShipRouteDO getShipRoute(Long id); + + /** + * 获得航线分页 + * + * @param pageReqVO 分页查询 + * @return 航线分页 + */ + PageResult getShipRoutePage(ShipRoutePageReqVO pageReqVO); + + /** + * 下拉框数据 + */ + List routeNameOption(); + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/shiproute/ShipRouteServiceImpl.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/shiproute/ShipRouteServiceImpl.java new file mode 100644 index 000000000..b6994815b --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/shiproute/ShipRouteServiceImpl.java @@ -0,0 +1,79 @@ +package cn.iocoder.yudao.module.ticket.service.shiproute; + +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.ticket.controller.admin.shiproute.vo.*; +import cn.iocoder.yudao.module.ticket.dal.dataobject.shiproute.ShipRouteDO; +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.ticket.dal.mysql.shiproute.ShipRouteMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*; + +/** + * 航线 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class ShipRouteServiceImpl implements ShipRouteService { + + @Resource + private ShipRouteMapper shipRouteMapper; + + @Override + public Long createShipRoute(ShipRouteSaveReqVO createReqVO) { + // 插入 + ShipRouteDO shipRoute = BeanUtils.toBean(createReqVO, ShipRouteDO.class); + shipRouteMapper.insert(shipRoute); + // 返回 + return shipRoute.getId(); + } + + @Override + public void updateShipRoute(ShipRouteSaveReqVO updateReqVO) { + // 校验存在 + validateShipRouteExists(updateReqVO.getId()); + // 更新 + ShipRouteDO updateObj = BeanUtils.toBean(updateReqVO, ShipRouteDO.class); + shipRouteMapper.updateById(updateObj); + } + + @Override + public void deleteShipRoute(Long id) { + // 校验存在 + validateShipRouteExists(id); + // 删除 + shipRouteMapper.deleteById(id); + } + + private void validateShipRouteExists(Long id) { + if (shipRouteMapper.selectById(id) == null) { + throw exception(SHIP_ROUTE_NOT_EXISTS); + } + } + + @Override + public ShipRouteDO getShipRoute(Long id) { + return shipRouteMapper.selectById(id); + } + + @Override + public PageResult getShipRoutePage(ShipRoutePageReqVO pageReqVO) { + return shipRouteMapper.selectPage(pageReqVO); + } + + @Override + public List routeNameOption() { + return shipRouteMapper.selectList(); + } + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/todayflight/TodayFlightService.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/todayflight/TodayFlightService.java new file mode 100644 index 000000000..f7a8bdacd --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/todayflight/TodayFlightService.java @@ -0,0 +1,59 @@ +package cn.iocoder.yudao.module.ticket.service.todayflight; + +import java.util.*; +import javax.validation.*; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.ticket.controller.admin.todayflight.vo.*; +import cn.iocoder.yudao.module.ticket.dal.dataobject.todayflight.TodayFlightDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +/** + * 今日航班 Service 接口 + * + * @author 管理员 + */ +public interface TodayFlightService { + + /** + * 创建今日航班 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createTodayFlight(@Valid TodayFlightSaveReqVO createReqVO); + + /** + * 更新今日航班 + * + * @param updateReqVO 更新信息 + */ + void updateTodayFlight(@Valid TodayFlightSaveReqVO updateReqVO); + + /** + * 删除今日航班 + * + * @param id 编号 + */ + void deleteTodayFlight(Long id); + + /** + * 获得今日航班 + * + * @param id 编号 + * @return 今日航班 + */ + TodayFlightDO getTodayFlight(Long id); + + /** + * 获得今日航班分页 + * + * @param pageReqVO 分页查询 + * @return 今日航班分页 + */ + PageResult getTodayFlightPage(TodayFlightPageReqVO pageReqVO); + + + +} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/todayflight/TodayFlightServiceImpl.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/todayflight/TodayFlightServiceImpl.java new file mode 100644 index 000000000..e11ee6bf3 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/todayflight/TodayFlightServiceImpl.java @@ -0,0 +1,77 @@ +package cn.iocoder.yudao.module.ticket.service.todayflight; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +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.ticket.controller.admin.todayflight.vo.*; +import cn.iocoder.yudao.module.ticket.dal.dataobject.todayflight.TodayFlightDO; +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.ticket.dal.mysql.todayflight.TodayFlightMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*; + +/** + * 今日航班 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class TodayFlightServiceImpl implements TodayFlightService { + + @Resource + private TodayFlightMapper todayFlightMapper; + + @Override + public Long createTodayFlight(TodayFlightSaveReqVO createReqVO) { + // 插入 + TodayFlightDO todayFlight = BeanUtils.toBean(createReqVO, TodayFlightDO.class); + todayFlightMapper.insert(todayFlight); + // 返回 + return todayFlight.getId(); + } + + @Override + public void updateTodayFlight(TodayFlightSaveReqVO updateReqVO) { + // 校验存在 + validateTodayFlightExists(updateReqVO.getId()); + // 更新 + TodayFlightDO updateObj = BeanUtils.toBean(updateReqVO, TodayFlightDO.class); + todayFlightMapper.updateById(updateObj); + } + + @Override + public void deleteTodayFlight(Long id) { + // 校验存在 + validateTodayFlightExists(id); + // 删除 + todayFlightMapper.deleteById(id); + } + + private void validateTodayFlightExists(Long id) { + if (todayFlightMapper.selectById(id) == null) { + throw exception(TODAY_FLIGHT_NOT_EXISTS); + } + } + + @Override + public TodayFlightDO getTodayFlight(Long id) { + return todayFlightMapper.selectById(id); + } + + @Override + public PageResult getTodayFlightPage(TodayFlightPageReqVO pageReqVO) { + return todayFlightMapper.selectPage(pageReqVO); + } + + + +} \ No newline at end of file