xinwei #33
351
.drone.yml
351
.drone.yml
@ -1,180 +1,225 @@
|
||||
kind: pipeline # 定义对象类型,还有secret和signature两种类型
|
||||
|
||||
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
||||
|
||||
name: ludu-system-drone # 定义流水线名称
|
||||
|
||||
|
||||
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||
|
||||
- name: package # 流水线名称
|
||||
|
||||
image: maven:3-jdk-8 # 定义创建容器的Docker镜像
|
||||
|
||||
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: ludu-system-drone
|
||||
|
||||
steps:
|
||||
- name: package
|
||||
image: maven:3-jdk-8
|
||||
volumes:
|
||||
- name: maven-cache
|
||||
|
||||
path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
|
||||
|
||||
path: /root/.m2
|
||||
- name: maven-build
|
||||
path: /app/build
|
||||
commands:
|
||||
- mvn package -Dmaven.test.skip=true
|
||||
- |
|
||||
if [ "$serverName" = "yudao-gateway" ] || [ "$serverName" = "all" ]; then
|
||||
mkdir -p /app/build/yudao-gateway/target
|
||||
cp ./yudao-gateway/target/yudao-gateway.jar /app/build/yudao-gateway/target
|
||||
cp ./yudao-gateway/Dockerfile /app/build/yudao-gateway
|
||||
cp ./yudao-gateway/run.sh /app/build/yudao-gateway
|
||||
fi
|
||||
|
||||
path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
|
||||
# 判断是否处理 yudao-module-system
|
||||
- |
|
||||
if [ "$serverName" = "yudao-module-system" ] || [ "$serverName" = "all" ]; then
|
||||
mkdir -p /app/build/yudao-module-system/target
|
||||
cp ./yudao-module-system/yudao-module-system-biz/target/yudao-module-system-biz.jar /app/build/yudao-module-system/target
|
||||
cp ./yudao-module-system/yudao-module-system-biz/Dockerfile /app/build/yudao-module-system
|
||||
cp ./yudao-module-system/yudao-module-system-biz/run.sh /app/build/yudao-module-system
|
||||
fi
|
||||
|
||||
commands: # 定义在Docker容器中执行的shell命令
|
||||
# 判断是否处理 yudao-module-infra
|
||||
- |
|
||||
if [ "$serverName" = "yudao-module-infra" ] || [ "$serverName" = "all" ]; then
|
||||
mkdir -p /app/build/yudao-module-infra/target
|
||||
cp ./yudao-module-infra/yudao-module-infra-biz/target/yudao-module-infra-biz.jar /app/build/yudao-module-infra/target
|
||||
cp ./yudao-module-infra/yudao-module-infra-biz/Dockerfile /app/build/yudao-module-infra
|
||||
cp ./yudao-module-infra/yudao-module-infra-biz/run.sh /app/build/yudao-module-infra
|
||||
fi
|
||||
|
||||
- mvn package -Dmaven.test.skip=true # 应用打包命令
|
||||
# 判断是否处理 ludu-module-ticketing
|
||||
- |
|
||||
if [ "$serverName" = "ludu-module-ticketing" ] || [ "$serverName" = "all" ]; then
|
||||
mkdir -p /app/build/ludu-module-ticketing/target
|
||||
cp ./ludu-module-ticketing/ludu-module-ticketing-biz/target/ludu-module-ticketing-biz.jar /app/build/ludu-module-ticketing/target
|
||||
cp ./ludu-module-ticketing/ludu-module-ticketing-biz/Dockerfile /app/build/ludu-module-ticketing
|
||||
cp ./ludu-module-ticketing/ludu-module-ticketing-biz/run.sh /app/build/ludu-module-ticketing
|
||||
fi
|
||||
|
||||
# - mkdir -p /app/build/yudao-gateway/target
|
||||
# - cp ./yudao-gateway/target/yudao-gateway.jar /app/build/yudao-gateway/target
|
||||
# - cp ./yudao-gateway/Dockerfile /app/build/yudao-gateway
|
||||
# - cp ./yudao-gateway/run.sh /app/build/yudao-gateway
|
||||
#
|
||||
# - mkdir -p /app/build/yudao-module-system/target
|
||||
# - cp ./yudao-module-system/yudao-module-system-biz/target/yudao-module-system-biz.jar /app/build/yudao-module-system/target
|
||||
# - cp ./yudao-module-system/yudao-module-system-biz/Dockerfile /app/build/yudao-module-system
|
||||
# - cp ./yudao-module-system/yudao-module-system-biz/run.sh /app/build/yudao-module-system
|
||||
#
|
||||
# - mkdir -p /app/build/yudao-module-infra/target
|
||||
# - cp ./yudao-module-infra/yudao-module-infra-biz/target/yudao-module-infra-biz.jar /app/build/yudao-module-infra/target
|
||||
# - cp ./yudao-module-infra/yudao-module-infra-biz/Dockerfile /app/build/yudao-module-infra
|
||||
# - cp ./yudao-module-infra/yudao-module-infra-biz/run.sh /app/build/yudao-module-infra
|
||||
#
|
||||
# - mkdir -p /app/build/ludu-job-admin/target
|
||||
# - cp ./ludu-job-admin/ludu-job-admin-biz/target/ludu-job-admin-biz.jar /app/build/ludu-job-admin/target
|
||||
# - cp ./ludu-job-admin/ludu-job-admin-biz/Dockerfile /app/build/ludu-job-admin
|
||||
# - cp ./ludu-job-admin/ludu-job-admin-biz/run.sh /app/build/ludu-job-admin
|
||||
#
|
||||
# - mkdir -p /app/build/ludu-module-ticketing/target
|
||||
# - cp ./ludu-module-ticketing/ludu-module-ticketing-biz/target/ludu-module-ticketing-biz.jar /app/build/ludu-module-ticketing/target
|
||||
# - cp ./ludu-module-ticketing/ludu-module-ticketing-biz/Dockerfile /app/build/ludu-module-ticketing
|
||||
# - cp ./ludu-module-ticketing/ludu-module-ticketing-biz/run.sh /app/build/ludu-module-ticketing
|
||||
#
|
||||
# - mkdir -p /app/build/ludu-module-parking/target
|
||||
# - cp ./ludu-module-parking/ludu-module-parking-biz/target/ludu-module-parking-biz.jar /app/build/ludu-module-parking/target
|
||||
# - cp ./ludu-module-parking/ludu-module-parking-biz/Dockerfile /app/build/ludu-module-parking
|
||||
# - cp ./ludu-module-parking/ludu-module-parking-biz/run.sh /app/build/ludu-module-parking
|
||||
# 判断是否处理 ludu-module-parking
|
||||
- |
|
||||
if [ "$serverName" = "ludu-module-parking" ] || [ "$serverName" = "all" ]; then
|
||||
mkdir -p /app/build/ludu-module-parking/target
|
||||
cp ./ludu-module-parking/ludu-module-parking-biz/target/ludu-module-parking-biz.jar /app/build/ludu-module-parking/target
|
||||
cp ./ludu-module-parking/ludu-module-parking-biz/Dockerfile /app/build/ludu-module-parking
|
||||
cp ./ludu-module-parking/ludu-module-parking-biz/run.sh /app/build/ludu-module-parking
|
||||
fi
|
||||
|
||||
- mkdir -p /app/build/ludu-module-datacenter/target
|
||||
- cp ./ludu-module-datacenter/ludu-module-datacenter-biz/target/ludu-module-datacenter-biz.jar /app/build/ludu-module-datacenter/target
|
||||
- cp ./ludu-module-datacenter/ludu-module-datacenter-biz/Dockerfile /app/build/ludu-module-datacenter
|
||||
- cp ./ludu-module-datacenter/ludu-module-datacenter-biz/run.sh /app/build/ludu-module-datacenter
|
||||
# 判断是否处理 ludu-module-datacenter
|
||||
- |
|
||||
if [ "$serverName" = "ludu-module-datacenter" ] || [ "$serverName" = "all" ]; then
|
||||
mkdir -p /app/build/ludu-module-datacenter/target
|
||||
cp ./ludu-module-datacenter/ludu-module-datacenter-biz/target/ludu-module-datacenter-biz.jar /app/build/ludu-module-datacenter/target
|
||||
cp ./ludu-module-datacenter/ludu-module-datacenter-biz/Dockerfile /app/build/ludu-module-datacenter
|
||||
cp ./ludu-module-datacenter/ludu-module-datacenter-biz/run.sh /app/build/ludu-module-datacenter
|
||||
fi
|
||||
|
||||
- name: copy-to-object # 构建基础模块和复制票务停车场到轮渡服务器
|
||||
|
||||
image: appleboy/drone-ssh # SSH工具镜像
|
||||
# 判断是否处理 ludu-job-admin
|
||||
- |
|
||||
if [ "$serverName" = "ludu-job-admin" ] || [ "$serverName" = "all" ]; then
|
||||
mkdir -p /app/build/ludu-job-admin/target
|
||||
cp ./ludu-job-admin/ludu-job-admin-biz/target/ludu-job-admin-biz.jar /app/build/ludu-job-admin/target
|
||||
cp ./ludu-job-admin/ludu-job-admin-biz/Dockerfile /app/build/ludu-job-admin
|
||||
cp ./ludu-job-admin/ludu-job-admin-biz/run.sh /app/build/ludu-job-admin
|
||||
fi
|
||||
|
||||
- name: copy-to-object
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
|
||||
host: 101.43.112.107 # 远程连接地址
|
||||
|
||||
username: root # 远程连接账号
|
||||
|
||||
host: 101.43.112.107
|
||||
username: root
|
||||
password:
|
||||
|
||||
from_secret: ssh_password # 从Secret中读取SSH密码
|
||||
|
||||
port: 22 # 远程连接端口
|
||||
|
||||
command_timeout: 15m # 远程执行命令超时时间
|
||||
|
||||
from_secret: ssh_password
|
||||
port: 22
|
||||
command_timeout: 15m
|
||||
script:
|
||||
|
||||
- echo "start copy"
|
||||
# - cd /ludu/maven
|
||||
# - tar -cf ludu-build.tar ./build
|
||||
# - scp ludu-build.tar root@121.36.203.133:/ludu/maven
|
||||
# - scp -r /ludu/maven/build/yudao-gateway root@121.36.203.133:/ludu/maven/build
|
||||
# - echo "gateway done"
|
||||
# - scp -r /ludu/maven/build/yudao-module-system root@121.36.203.133:/ludu/maven/build
|
||||
# - echo "system done"
|
||||
# - scp -r /ludu/maven/build/ludu-module-ticketing root@121.36.203.133:/ludu/maven/build
|
||||
# - echo "ticketing done"
|
||||
# - scp -r /ludu/maven/build/ludu-module-parking root@121.36.203.133:/ludu/maven/build
|
||||
# - echo "parking done"
|
||||
# - scp -r /ludu/maven/build/yudao-module-infra root@121.36.203.133:/ludu/maven/build
|
||||
# - echo "infra done"
|
||||
# - scp -r /ludu/maven/build/ludu-job-admin root@121.36.203.133:/ludu/maven/build
|
||||
# - echo "job done"
|
||||
- scp -r /ludu/maven/build/ludu-module-datacenter root@120.46.37.243:/ludu/maven/build
|
||||
- echo "datacenter done"
|
||||
- |
|
||||
if [ "$serverName" = "yudao-gateway" ] || [ "$serverName" = "all" ]; then
|
||||
scp -r /ludu/maven/build/yudao-gateway root@121.36.203.133:/ludu/maven/build
|
||||
echo "gateway done"
|
||||
fi
|
||||
# 判断是否处理 yudao-module-system
|
||||
- |
|
||||
if [ "$serverName" = "yudao-module-system" ] || [ "$serverName" = "all" ]; then
|
||||
scp -r /ludu/maven/build/yudao-module-system root@121.36.203.133:/ludu/maven/build
|
||||
echo "system done"
|
||||
fi
|
||||
|
||||
# 判断是否处理 yudao-module-infra
|
||||
- |
|
||||
if [ "$serverName" = "yudao-module-infra" ] || [ "$serverName" = "all" ]; then
|
||||
scp -r /ludu/maven/build/yudao-module-infra root@121.36.203.133:/ludu/maven/build
|
||||
echo "infra done"
|
||||
fi
|
||||
|
||||
# 判断是否处理 ludu-module-ticketing
|
||||
- |
|
||||
if [ "$serverName" = "ludu-module-ticketing" ] || [ "$serverName" = "all" ]; then
|
||||
scp -r /ludu/maven/build/ludu-module-ticketing root@121.36.203.133:/ludu/maven/build
|
||||
echo "ticketing done"
|
||||
fi
|
||||
|
||||
# 判断是否处理 ludu-module-parking
|
||||
- |
|
||||
if [ "$serverName" = "ludu-module-parking" ] || [ "$serverName" = "all" ]; then
|
||||
scp -r /ludu/maven/build/ludu-module-parking root@121.36.203.133:/ludu/maven/build
|
||||
echo "parking done"
|
||||
fi
|
||||
|
||||
# 判断是否处理 ludu-module-datacenter
|
||||
- |
|
||||
if [ "$serverName" = "ludu-module-datacenter" ] || [ "$serverName" = "all" ]; then
|
||||
scp -r /ludu/maven/build/ludu-module-datacenter root@120.46.37.243:/ludu/maven/build
|
||||
echo "datacenter done"
|
||||
fi
|
||||
|
||||
# 判断是否处理 ludu-job-admin
|
||||
- |
|
||||
if [ "$serverName" = "ludu-job-admin" ] || [ "$serverName" = "all" ]; then
|
||||
scp -r /ludu/maven/build/ludu-job-admin root@121.36.203.133:/ludu/maven/build
|
||||
echo "job done"
|
||||
fi
|
||||
|
||||
- name: build-other-service
|
||||
|
||||
image: appleboy/drone-ssh # SSH工具镜像
|
||||
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
|
||||
host: 120.46.37.243 # 远程连接地址
|
||||
|
||||
username: root # 远程连接账号
|
||||
|
||||
host: 120.46.37.243
|
||||
username: root
|
||||
password:
|
||||
from_secret: ssh_password2
|
||||
port: 22
|
||||
command_timeout: 5m
|
||||
script:
|
||||
- |
|
||||
if [ "$serverName" = "ludu-module-datacenter" ] || [ "$serverName" = "all" ]; then
|
||||
cd /ludu/maven/build/ludu-module-datacenter/
|
||||
chmod +x ./run.sh
|
||||
./run.sh || echo "ludu-module-datacenter build failed"
|
||||
fi
|
||||
|
||||
from_secret: ssh_password2 # 从Secret中读取SSH密码
|
||||
|
||||
port: 22 # 远程连接端口
|
||||
|
||||
command_timeout: 5m # 远程执行命令超时时间
|
||||
|
||||
- name: object-build
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host: 121.36.203.133
|
||||
username: root
|
||||
password:
|
||||
from_secret: ssh_password3
|
||||
port: 22
|
||||
command_timeout: 20m
|
||||
script:
|
||||
|
||||
- cd /ludu/maven/build/ludu-module-datacenter/
|
||||
- chmod +x ./run.sh # 更改为可执行脚本
|
||||
- ./run.sh || echo "ludu-module-datacenter build failed" # 运行脚本打包应用镜像并运行
|
||||
# - name: object-build
|
||||
#
|
||||
# image: appleboy/drone-ssh # SSH工具镜像
|
||||
#
|
||||
# settings:
|
||||
#
|
||||
# host: 121.36.203.133 # 远程连接地址
|
||||
#
|
||||
# username: root # 远程连接账号
|
||||
#
|
||||
# password:
|
||||
#
|
||||
# from_secret: ssh_password3 # 从Secret中读取SSH密码
|
||||
#
|
||||
# port: 22 # 远程连接端口
|
||||
#
|
||||
# command_timeout: 20m # 远程执行命令超时时间
|
||||
#
|
||||
# script:
|
||||
# - cd /ludu/maven
|
||||
# - rm -rf ./build
|
||||
# - tar -xf ludu-build.tar -C ./
|
||||
#
|
||||
# - cd /ludu/maven/build/yudao-gateway/
|
||||
# - chmod +x ./run.sh # 更改为可执行脚本
|
||||
# - ./run.sh || echo "ludu-module-ticketing build failed" # 运行脚本打包应用镜像并运行
|
||||
#
|
||||
# - cd /ludu/maven/build/yudao-module-system/
|
||||
# - chmod +x ./run.sh # 更改为可执行脚本
|
||||
# - ./run.sh || echo "ludu-module-datacenter build failed" # 运行脚本打包应用镜像并运行
|
||||
#
|
||||
# - cd /ludu/maven/build/ludu-module-ticketing/
|
||||
# - chmod +x ./run.sh # 更改为可执行脚本
|
||||
# - ./run.sh || echo "ludu-module-ticketing build failed" # 运行脚本打包应用镜像并运行
|
||||
#
|
||||
# - cd /ludu/maven/build/ludu-module-parking/
|
||||
# - chmod +x ./run.sh # 更改为可执行脚本
|
||||
# - ./run.sh || echo "ludu-module-parking build failed" # 运行脚本打包应用镜像并运行
|
||||
#
|
||||
# - cd /ludu/maven/build/yudao-module-infra/
|
||||
# - chmod +x ./run.sh # 更改为可执行脚本
|
||||
# - ./run.sh || echo "yudao-module-infra build failed" # 运行脚本打包应用镜像并运行
|
||||
#
|
||||
# - cd /ludu/maven/build/ludu-job-admin/
|
||||
# - chmod +x ./run.sh # 更改为可执行脚本
|
||||
# - ./run.sh || echo "ludu-job-admin build failed" # 运行脚本打包应用镜像并运行
|
||||
# 判断是否处理 yudao-gateway
|
||||
- |
|
||||
if [ "$serverName" = "yudao-gateway" ] || [ "$serverName" = "all" ]; then
|
||||
cd /ludu/maven/build/yudao-gateway/
|
||||
chmod +x ./run.sh
|
||||
./run.sh || echo "yudao-gateway build failed"
|
||||
fi
|
||||
|
||||
volumes: # 定义流水线挂载目录,用于共享数据
|
||||
# 判断是否处理 yudao-module-system
|
||||
- |
|
||||
if [ "$serverName" = "yudao-module-system" ] || [ "$serverName" = "all" ]; then
|
||||
cd /ludu/maven/build/yudao-module-system/
|
||||
chmod +x ./run.sh
|
||||
./run.sh || echo "yudao-module-system build failed"
|
||||
fi
|
||||
|
||||
# 判断是否处理 yudao-module-infra
|
||||
- |
|
||||
if [ "$serverName" = "yudao-module-infra" ] || [ "$serverName" = "all" ]; then
|
||||
cd /ludu/maven/build/yudao-module-infra/
|
||||
chmod +x ./run.sh
|
||||
./run.sh || echo "yudao-module-infra build failed"
|
||||
fi
|
||||
|
||||
# 判断是否处理 ludu-module-ticketing
|
||||
- |
|
||||
if [ "$serverName" = "ludu-module-ticketing" ] || [ "$serverName" = "all" ]; then
|
||||
cd /ludu/maven/build/ludu-module-ticketing/
|
||||
chmod +x ./run.sh
|
||||
./run.sh || echo "ludu-module-ticketing build failed"
|
||||
fi
|
||||
|
||||
# 判断是否处理 ludu-module-parking
|
||||
- |
|
||||
if [ "$serverName" = "ludu-module-parking" ] || [ "$serverName" = "all" ]; then
|
||||
cd /ludu/maven/build/ludu-module-parking/
|
||||
chmod +x ./run.sh
|
||||
./run.sh || echo "ludu-module-parking build failed"
|
||||
fi
|
||||
|
||||
# 判断是否处理 ludu-module-datacenter
|
||||
- |
|
||||
if [ "$serverName" = "ludu-module-datacenter" ] || [ "$serverName" = "all" ]; then
|
||||
cd /ludu/maven/build/ludu-module-datacenter/
|
||||
chmod +x ./run.sh
|
||||
./run.sh || echo "ludu-module-datacenter build failed"
|
||||
fi
|
||||
|
||||
# 判断是否处理 ludu-job-admin
|
||||
- |
|
||||
if [ "$serverName" = "ludu-job-admin" ] || [ "$serverName" = "all" ]; then
|
||||
cd /ludu/maven/build/ludu-job-admin/
|
||||
chmod +x ./run.sh
|
||||
./run.sh || echo "ludu-job-admin build failed"
|
||||
fi
|
||||
|
||||
volumes:
|
||||
- name: maven-build
|
||||
host:
|
||||
path: /ludu/maven/build # 从宿主机中挂载的目录
|
||||
|
||||
path: /ludu/maven/build
|
||||
- name: maven-cache
|
||||
host:
|
||||
path: /ludu/maven/cache # 从宿主机中挂载的目录
|
||||
path: /ludu/maven/cache
|
||||
|
@ -24,6 +24,8 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode CHARGE_INFO_NOT_EXISTS = new ErrorCode(1_005_001_029, "收费信息不存在");
|
||||
// ========== 远程抬杠日志 1_005_001_030 ==========
|
||||
ErrorCode LIFTING_ROD_NOT_EXISTS = new ErrorCode(1_005_001_030, "远程抬杠日志不存在");
|
||||
// ========== 预约车 1_005_001_031 ==========
|
||||
ErrorCode BOOK_CAR_NOT_EXISTS = new ErrorCode(1_005_001_031, "预约车不存在");
|
||||
ErrorCode ENTRY_RECORD_NOT_EXISTS = new ErrorCode(666666, "入场记录不存在");
|
||||
ErrorCode APPEARANCE_RECORD_NOT_EXISTS = new ErrorCode(77777, "出场记录不存在");
|
||||
}
|
||||
|
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.bookcar;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.parking.controller.admin.bookcar.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.bookcar.BookCarDO;
|
||||
import cn.iocoder.yudao.module.parking.service.bookcar.BookCarService;
|
||||
|
||||
@Tag(name = "管理后台 - 预约车")
|
||||
@RestController
|
||||
@RequestMapping("/parking/book-car")
|
||||
@Validated
|
||||
public class BookCarController {
|
||||
|
||||
@Resource
|
||||
private BookCarService bookCarService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建预约车")
|
||||
@PreAuthorize("@ss.hasPermission('parking:book-car:create')")
|
||||
public CommonResult<Long> createBookCar(@Valid @RequestBody BookCarSaveReqVO createReqVO) {
|
||||
return success(bookCarService.createBookCar(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新预约车")
|
||||
@PreAuthorize("@ss.hasPermission('parking:book-car:update')")
|
||||
public CommonResult<Boolean> updateBookCar(@Valid @RequestBody BookCarSaveReqVO updateReqVO) {
|
||||
bookCarService.updateBookCar(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除预约车")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('parking:book-car:delete')")
|
||||
public CommonResult<Boolean> deleteBookCar(@RequestParam("id") Long id) {
|
||||
bookCarService.deleteBookCar(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得预约车")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('parking:book-car:query')")
|
||||
public CommonResult<BookCarRespVO> getBookCar(@RequestParam("id") Long id) {
|
||||
BookCarDO bookCar = bookCarService.getBookCar(id);
|
||||
return success(BeanUtils.toBean(bookCar, BookCarRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得预约车分页")
|
||||
@PreAuthorize("@ss.hasPermission('parking:book-car:query')")
|
||||
public CommonResult<PageResult<BookCarRespVO>> getBookCarPage(@Valid BookCarPageReqVO pageReqVO) {
|
||||
PageResult<BookCarDO> pageResult = bookCarService.getBookCarPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, BookCarRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出预约车 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('parking:book-car:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportBookCarExcel(@Valid BookCarPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<BookCarDO> list = bookCarService.getBookCarPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "预约车.xls", "数据", BookCarRespVO.class,
|
||||
BeanUtils.toBean(list, BookCarRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.bookcar.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 BookCarPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "场库编号")
|
||||
private String parkNumber;
|
||||
|
||||
@Schema(description = "预约车牌号")
|
||||
private String plate;
|
||||
|
||||
@Schema(description = "预约开始时间")
|
||||
private String start;
|
||||
|
||||
@Schema(description = "预约结束时间")
|
||||
private String end;
|
||||
|
||||
@Schema(description = "区域号", example = "17211")
|
||||
private String areaId;
|
||||
|
||||
@Schema(description = "操作")
|
||||
private String flag;
|
||||
|
||||
@Schema(description = "金额")
|
||||
private String charge;
|
||||
|
||||
@Schema(description = "预约订单号", example = "8375")
|
||||
private String bookOrderId;
|
||||
|
||||
@Schema(description = "入场时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] inTime;
|
||||
|
||||
@Schema(description = "下发场库时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] downTime;
|
||||
|
||||
@Schema(description = "订单下单时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] bookOrderTime;
|
||||
|
||||
@Schema(description = "准入开始时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] letInStartTime;
|
||||
|
||||
@Schema(description = "准入结束时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] letInEndTime;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String memo;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.bookcar.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 BookCarRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23401")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("场库编号")
|
||||
private String parkNumber;
|
||||
|
||||
@Schema(description = "预约车牌号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("预约车牌号")
|
||||
private String plate;
|
||||
|
||||
@Schema(description = "预约开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("预约开始时间")
|
||||
private String start;
|
||||
|
||||
@Schema(description = "预约结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("预约结束时间")
|
||||
private String end;
|
||||
|
||||
@Schema(description = "区域号", example = "17211")
|
||||
@ExcelProperty("区域号")
|
||||
private String areaId;
|
||||
|
||||
@Schema(description = "操作")
|
||||
@ExcelProperty("操作")
|
||||
private String flag;
|
||||
|
||||
@Schema(description = "金额")
|
||||
@ExcelProperty("金额")
|
||||
private String charge;
|
||||
|
||||
@Schema(description = "预约订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8375")
|
||||
@ExcelProperty("预约订单号")
|
||||
private String bookOrderId;
|
||||
|
||||
@Schema(description = "入场时间")
|
||||
@ExcelProperty("入场时间")
|
||||
private String inTime;
|
||||
|
||||
@Schema(description = "下发场库时间")
|
||||
@ExcelProperty("下发场库时间")
|
||||
private String downTime;
|
||||
|
||||
@Schema(description = "订单下单时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("订单下单时间")
|
||||
private String bookOrderTime;
|
||||
|
||||
@Schema(description = "准入开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("准入开始时间")
|
||||
private String letInStartTime;
|
||||
|
||||
@Schema(description = "准入结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("准入结束时间")
|
||||
private String letInEndTime;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
@ExcelProperty("备注")
|
||||
private String memo;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.bookcar.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 BookCarSaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23401")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "场库编号不能为空")
|
||||
private String parkNumber;
|
||||
|
||||
@Schema(description = "预约车牌号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "预约车牌号不能为空")
|
||||
private String plate;
|
||||
|
||||
@Schema(description = "预约开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "预约开始时间不能为空")
|
||||
private String start;
|
||||
|
||||
@Schema(description = "预约结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "预约结束时间不能为空")
|
||||
private String end;
|
||||
|
||||
@Schema(description = "区域号", example = "17211")
|
||||
private String areaId;
|
||||
|
||||
@Schema(description = "操作")
|
||||
private String flag;
|
||||
|
||||
@Schema(description = "金额")
|
||||
private String charge;
|
||||
|
||||
@Schema(description = "预约订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8375")
|
||||
@NotEmpty(message = "预约订单号不能为空")
|
||||
private String bookOrderId;
|
||||
|
||||
@Schema(description = "入场时间")
|
||||
private String inTime;
|
||||
|
||||
@Schema(description = "下发场库时间")
|
||||
private String downTime;
|
||||
|
||||
@Schema(description = "订单下单时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "订单下单时间不能为空")
|
||||
private String bookOrderTime;
|
||||
|
||||
@Schema(description = "准入开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "准入开始时间不能为空")
|
||||
private String letInStartTime;
|
||||
|
||||
@Schema(description = "准入结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "准入结束时间不能为空")
|
||||
private String letInEndTime;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String memo;
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package cn.iocoder.yudao.module.parking.dal.dataobject.bookcar;
|
||||
|
||||
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("book_car")
|
||||
@KeySequence("book_car_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BookCarDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 场库编号
|
||||
*/
|
||||
private String parkNumber;
|
||||
/**
|
||||
* 预约车牌号
|
||||
*/
|
||||
private String plate;
|
||||
/**
|
||||
* 预约开始时间
|
||||
*/
|
||||
private String start;
|
||||
/**
|
||||
* 预约结束时间
|
||||
*/
|
||||
private String end;
|
||||
/**
|
||||
* 区域号
|
||||
*/
|
||||
private String areaId;
|
||||
/**
|
||||
* 操作
|
||||
*/
|
||||
private String flag;
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
private String charge;
|
||||
/**
|
||||
* 预约订单号
|
||||
*/
|
||||
private String bookOrderId;
|
||||
/**
|
||||
* 入场时间
|
||||
*/
|
||||
private String inTime;
|
||||
/**
|
||||
* 下发场库时间
|
||||
*/
|
||||
private String downTime;
|
||||
/**
|
||||
* 订单下单时间
|
||||
*/
|
||||
private String bookOrderTime;
|
||||
/**
|
||||
* 准入开始时间
|
||||
*/
|
||||
private String letInStartTime;
|
||||
/**
|
||||
* 准入结束时间
|
||||
*/
|
||||
private String letInEndTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String memo;
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.parking.dal.mysql.bookcar;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.bookcar.BookCarDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.parking.controller.admin.bookcar.vo.*;
|
||||
|
||||
/**
|
||||
* 预约车 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface BookCarMapper extends BaseMapperX<BookCarDO> {
|
||||
|
||||
default PageResult<BookCarDO> selectPage(BookCarPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<BookCarDO>()
|
||||
.eqIfPresent(BookCarDO::getParkNumber, reqVO.getParkNumber())
|
||||
.eqIfPresent(BookCarDO::getPlate, reqVO.getPlate())
|
||||
.eqIfPresent(BookCarDO::getStart, reqVO.getStart())
|
||||
.eqIfPresent(BookCarDO::getEnd, reqVO.getEnd())
|
||||
.eqIfPresent(BookCarDO::getAreaId, reqVO.getAreaId())
|
||||
.eqIfPresent(BookCarDO::getFlag, reqVO.getFlag())
|
||||
.eqIfPresent(BookCarDO::getCharge, reqVO.getCharge())
|
||||
.eqIfPresent(BookCarDO::getBookOrderId, reqVO.getBookOrderId())
|
||||
.betweenIfPresent(BookCarDO::getInTime, reqVO.getInTime())
|
||||
.betweenIfPresent(BookCarDO::getDownTime, reqVO.getDownTime())
|
||||
.betweenIfPresent(BookCarDO::getBookOrderTime, reqVO.getBookOrderTime())
|
||||
.betweenIfPresent(BookCarDO::getLetInStartTime, reqVO.getLetInStartTime())
|
||||
.betweenIfPresent(BookCarDO::getLetInEndTime, reqVO.getLetInEndTime())
|
||||
.eqIfPresent(BookCarDO::getMemo, reqVO.getMemo())
|
||||
.betweenIfPresent(BookCarDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(BookCarDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.parking.service.bookcar;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.parking.controller.admin.bookcar.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.bookcar.BookCarDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 预约车 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface BookCarService {
|
||||
|
||||
/**
|
||||
* 创建预约车
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createBookCar(@Valid BookCarSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新预约车
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateBookCar(@Valid BookCarSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除预约车
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteBookCar(Long id);
|
||||
|
||||
/**
|
||||
* 获得预约车
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 预约车
|
||||
*/
|
||||
BookCarDO getBookCar(Long id);
|
||||
|
||||
/**
|
||||
* 获得预约车分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 预约车分页
|
||||
*/
|
||||
PageResult<BookCarDO> getBookCarPage(BookCarPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.parking.service.bookcar;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.parking.controller.admin.bookcar.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.bookcar.BookCarDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.parking.dal.mysql.bookcar.BookCarMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.parking.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 预约车 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class BookCarServiceImpl implements BookCarService {
|
||||
|
||||
@Resource
|
||||
private BookCarMapper bookCarMapper;
|
||||
|
||||
@Override
|
||||
public Long createBookCar(BookCarSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
BookCarDO bookCar = BeanUtils.toBean(createReqVO, BookCarDO.class);
|
||||
bookCarMapper.insert(bookCar);
|
||||
// 返回
|
||||
return bookCar.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBookCar(BookCarSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateBookCarExists(updateReqVO.getId());
|
||||
// 更新
|
||||
BookCarDO updateObj = BeanUtils.toBean(updateReqVO, BookCarDO.class);
|
||||
bookCarMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBookCar(Long id) {
|
||||
// 校验存在
|
||||
validateBookCarExists(id);
|
||||
// 删除
|
||||
bookCarMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateBookCarExists(Long id) {
|
||||
if (bookCarMapper.selectById(id) == null) {
|
||||
throw exception(BOOK_CAR_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BookCarDO getBookCar(Long id) {
|
||||
return bookCarMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<BookCarDO> getBookCarPage(BookCarPageReqVO pageReqVO) {
|
||||
return bookCarMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.parking.dal.mysql.bookcar.BookCarMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user