Merge branch 'master' of http://101.43.112.107:3000/root/ludu-cloud into xinwei
This commit is contained in:
commit
e2ccdbd4c4
@ -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<List<Object>> getFlightData(){
|
||||
|
||||
List<Object> listCommonResult = todayFlightService.todayFlightData();
|
||||
|
||||
return CommonResult.success(listCommonResult);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
@ -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> datas = new ArrayList<>();
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<BlueCardHeartbeat> 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<BlueCardHeartbeat> latestHeartbeat = blueCardHeartbeatRepository.findTopByOrderByCreateTimeDesc();
|
||||
Optional<BlueCardHeartbeat> 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<EntryRecord> entryRecords = entryRecordRepository.findByCreateTimeBetween(startOfDay, endOfDay);
|
||||
parkingLotDataVO.setIntoNum(entryRecords.size());//车辆进入数
|
||||
//固定车临时车
|
||||
|
@ -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 大屏服务-天气接口
|
||||
*/
|
||||
|
@ -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;
|
||||
|
||||
}
|
@ -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<BlueCardHeartbeat,String> {
|
||||
@ -10,5 +12,7 @@ public interface BlueCardHeartbeatRepository extends MongoRepository<BlueCardHea
|
||||
|
||||
Optional<BlueCardHeartbeat> findTopByOrderByCreateTimeDesc();
|
||||
|
||||
Optional<BlueCardHeartbeat> findFirstByCreateTimeBetweenOrderByCreateTimeDesc(LocalDateTime startOfDay, LocalDateTime endOfDay);
|
||||
|
||||
|
||||
}
|
||||
|
@ -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<TodayFlightDO> {
|
||||
|
||||
|
||||
@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<TodayFlightDO> todayFlightData();
|
||||
|
||||
@Select("select ship_route_id,classes,start_time from today_flight where ship_route_id = #{id} ORDER BY start_time ASC")
|
||||
List<TodayFlightDO> byRouteId(String id);
|
||||
|
||||
}
|
@ -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<Object> todayFlightData();
|
||||
|
||||
}
|
@ -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<Object> todayFlightData() {
|
||||
List<Object> flightVO = new ArrayList<>();//所有航班集合
|
||||
List<TodayFlightDO> 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<TodayFlightDO> todayFlightDOS1 = todayFlightMapper.byRouteId("2"); //石城至南日
|
||||
List<TodayFlightDO> 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<TodayFlightDO> todayFlightDOS1 = todayFlightMapper.byRouteId("3"); //筶杯出岛
|
||||
List<TodayFlightDO> 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<TodayFlightDO> todayFlightDOS1 = todayFlightMapper.byRouteId("5"); //黄瓜出岛
|
||||
List<TodayFlightDO> 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<TodayFlightDO> todayFlightDOS1 = todayFlightMapper.byRouteId("7"); // 小日出岛
|
||||
List<TodayFlightDO> 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<TodayFlightDO> todayFlightDOS1 = todayFlightMapper.byRouteId("11"); //罗盘出岛
|
||||
List<TodayFlightDO> 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<TodayFlightDO> todayFlightDOS1 = todayFlightMapper.byRouteId("9"); //鳌屿出岛
|
||||
List<TodayFlightDO> 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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<String> 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<Boolean> synBlack(BlackDO blackDO) {
|
||||
public CommonResult<Boolean> synBlack(BlackSaveReqVO blackSaveReqVO) {
|
||||
//设置请求参数
|
||||
BlackVO blackVO = new BlackVO();
|
||||
blackVO.setParkNumber(blackDO.getParkNumber());
|
||||
blackVO.setSource(blackDO.getSource());
|
||||
blackVO.setParkNumber(blackSaveReqVO.getParkNumber());
|
||||
blackVO.setSource(blackSaveReqVO.getSource());
|
||||
List<Datas> 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<Long> createBlack(@Valid @RequestBody BlackSaveReqVO createReqVO) {
|
||||
CommonResult<Boolean> booleanCommonResult = synBlack(createReqVO);
|
||||
return success(blackService.createBlack(createReqVO));
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,16 @@ public class WhiteController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增白名单
|
||||
* @param createReqVO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建白名单管理")
|
||||
@PreAuthorize("@ss.hasPermission('parking:white:create')")
|
||||
public CommonResult<Integer> createWhite(@Valid @RequestBody WhiteSaveReqVO createReqVO) {
|
||||
return success(whiteService.createWhite(createReqVO));
|
||||
public CommonResult<Integer> createWhite(@Valid @RequestBody WhiteAddVO whiteAddVO) {
|
||||
return success(whiteService.createWhite(whiteAddVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
|
@ -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;
|
||||
}
|
@ -22,7 +22,7 @@ public interface WhiteService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createWhite(@Valid WhiteSaveReqVO createReqVO);
|
||||
Integer createWhite(@Valid WhiteAddVO whiteAddVO);
|
||||
|
||||
/**
|
||||
* 更新白名单管理
|
||||
|
@ -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) {
|
||||
|
@ -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, "今日航班不存在");
|
||||
|
||||
}
|
||||
|
@ -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<List<FlightDO>> flightNameOption(){
|
||||
return success(flightService.flightNameOption());
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建航班")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:flight:create')")
|
||||
public CommonResult<Long> createFlight(@Valid @RequestBody FlightSaveReqVO createReqVO) {
|
||||
return success(flightService.createFlight(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新航班")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:flight:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<FlightRespVO> 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<PageResult<FlightRespVO>> getFlightPage(@Valid FlightPageReqVO pageReqVO) {
|
||||
PageResult<FlightDO> 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<FlightDO> list = flightService.getFlightPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "航班.xls", "数据", FlightRespVO.class,
|
||||
BeanUtils.toBean(list, FlightRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<List<ShipRouteDO>> routeNameOption(){
|
||||
return success(shipRouteService.routeNameOption());
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建航线")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:ship-route:create')")
|
||||
public CommonResult<Long> createShipRoute(@Valid @RequestBody ShipRouteSaveReqVO createReqVO) {
|
||||
return success(shipRouteService.createShipRoute(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新航线")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:ship-route:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<ShipRouteRespVO> 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<PageResult<ShipRouteRespVO>> getShipRoutePage(@Valid ShipRoutePageReqVO pageReqVO) {
|
||||
PageResult<ShipRouteDO> 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<ShipRouteDO> list = shipRouteService.getShipRoutePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "航线.xls", "数据", ShipRouteRespVO.class,
|
||||
BeanUtils.toBean(list, ShipRouteRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
}
|
@ -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<Long> createTodayFlight(@Valid @RequestBody TodayFlightSaveReqVO createReqVO) {
|
||||
return success(todayFlightService.createTodayFlight(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新今日航班")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:today-flight:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<TodayFlightRespVO> 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<PageResult<TodayFlightRespVO>> getTodayFlightPage(@Valid TodayFlightPageReqVO pageReqVO) {
|
||||
PageResult<TodayFlightDO> 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<TodayFlightDO> list = todayFlightService.getTodayFlightPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "今日航班.xls", "数据", TodayFlightRespVO.class,
|
||||
BeanUtils.toBean(list, TodayFlightRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<FlightDO> {
|
||||
|
||||
default PageResult<FlightDO> selectPage(FlightPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<FlightDO>()
|
||||
.likeIfPresent(FlightDO::getFlightName, reqVO.getFlightName())
|
||||
.betweenIfPresent(FlightDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(FlightDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -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<ShipRouteDO> {
|
||||
|
||||
default PageResult<ShipRouteDO> selectPage(ShipRoutePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ShipRouteDO>()
|
||||
.eqIfPresent(ShipRouteDO::getFlightId, reqVO.getFlightId())
|
||||
.likeIfPresent(ShipRouteDO::getRouteName, reqVO.getRouteName())
|
||||
.betweenIfPresent(ShipRouteDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ShipRouteDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -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<TodayFlightDO> {
|
||||
|
||||
default PageResult<TodayFlightDO> selectPage(TodayFlightPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TodayFlightDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
}
|
@ -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<FlightDO> getFlightPage(FlightPageReqVO pageReqVO);
|
||||
|
||||
List<FlightDO> flightNameOption();
|
||||
|
||||
}
|
@ -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<FlightDO> getFlightPage(FlightPageReqVO pageReqVO) {
|
||||
return flightMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlightDO> flightNameOption() {
|
||||
return flightMapper.selectList();
|
||||
}
|
||||
|
||||
}
|
@ -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<ShipRouteDO> getShipRoutePage(ShipRoutePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 下拉框数据
|
||||
*/
|
||||
List<ShipRouteDO> routeNameOption();
|
||||
|
||||
}
|
@ -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<ShipRouteDO> getShipRoutePage(ShipRoutePageReqVO pageReqVO) {
|
||||
return shipRouteMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShipRouteDO> routeNameOption() {
|
||||
return shipRouteMapper.selectList();
|
||||
}
|
||||
|
||||
}
|
@ -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<TodayFlightDO> getTodayFlightPage(TodayFlightPageReqVO pageReqVO);
|
||||
|
||||
|
||||
|
||||
}
|
@ -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<TodayFlightDO> getTodayFlightPage(TodayFlightPageReqVO pageReqVO) {
|
||||
return todayFlightMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user