From 0735a44297d62ac23fbeccb828baae2cafc106a7 Mon Sep 17 00:00:00 2001 From: XinWei <2718030729@qq.com> Date: Wed, 31 Jul 2024 10:31:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=9C=BA-=E8=BF=9B=E5=87=BA?= =?UTF-8?q?=E8=AE=B0=E5=BD=95-=E8=BD=A6=E8=BE=86=E8=BF=9B=E5=87=BA?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parking/enums/ErrorCodeConstants.java | 6 +- .../vo/VehicleRecordPageReqVO.java | 35 +++++++++ .../vehiclerecord/vo/VehicleRecordRespVO.java | 40 ++++++++++ .../vo/VehicleRecordSaveReqVO.java | 31 ++++++++ .../vehiclerecord/VehicleRecordMapper.java | 30 ++++++++ .../vehiclerecord/VehicleRecordService.java | 55 ++++++++++++++ .../VehicleRecordServiceImpl.java | 74 +++++++++++++++++++ .../vehiclerecord/VehicleRecordMapper.xml | 12 +++ 8 files changed, 281 insertions(+), 2 deletions(-) create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/vehiclerecord/vo/VehicleRecordPageReqVO.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/vehiclerecord/vo/VehicleRecordRespVO.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/vehiclerecord/vo/VehicleRecordSaveReqVO.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/vehiclerecord/VehicleRecordMapper.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/vehiclerecord/VehicleRecordService.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/vehiclerecord/VehicleRecordServiceImpl.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/vehiclerecord/VehicleRecordMapper.xml diff --git a/ludu-module-parking/ludu-module-parking-api/src/main/java/cn/iocoder/yudao/module/parking/enums/ErrorCodeConstants.java b/ludu-module-parking/ludu-module-parking-api/src/main/java/cn/iocoder/yudao/module/parking/enums/ErrorCodeConstants.java index 11df5bb7d..89163761e 100644 --- a/ludu-module-parking/ludu-module-parking-api/src/main/java/cn/iocoder/yudao/module/parking/enums/ErrorCodeConstants.java +++ b/ludu-module-parking/ludu-module-parking-api/src/main/java/cn/iocoder/yudao/module/parking/enums/ErrorCodeConstants.java @@ -27,6 +27,8 @@ public interface ErrorCodeConstants { ErrorCode SYNCHRONIZATION_OF_WHITELIST_INFORMATION_NOT_EXISTS = new ErrorCode(1_005_001_014, "同步白名单不存在"); // ========== 进出记录图片 1_005_001_015 ========== ErrorCode ACCESS_RECORD_PICTURE_NOT_EXISTS = new ErrorCode(1_005_001_015, "进出记录图片不存在"); - - + // ========== 车辆进出记录数据 1_005_001_016 ========== + ErrorCode VEHICLE_RECORD_NOT_EXISTS = new ErrorCode(1_005_001_016, "车辆进出记录数据不存在"); + // ========== 车辆营收数据 1_005_001_017 ========== + ErrorCode REVENUE_NOT_EXISTS = new ErrorCode(1_005_001_017, "车辆营收数据不存在"); } diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/vehiclerecord/vo/VehicleRecordPageReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/vehiclerecord/vo/VehicleRecordPageReqVO.java new file mode 100644 index 000000000..43f822666 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/vehiclerecord/vo/VehicleRecordPageReqVO.java @@ -0,0 +1,35 @@ +package cn.iocoder.yudao.module.parking.controller.admin.vehiclerecord.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 VehicleRecordPageReqVO extends PageParam { + + @Schema(description = "进或出") + private String intoOrOut; + + @Schema(description = "车牌号") + private String licenseNumber; + + @Schema(description = "时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] time; + + @Schema(description = "图片") + private String picture; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/vehiclerecord/vo/VehicleRecordRespVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/vehiclerecord/vo/VehicleRecordRespVO.java new file mode 100644 index 000000000..8956c3ef3 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/vehiclerecord/vo/VehicleRecordRespVO.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.parking.controller.admin.vehiclerecord.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 VehicleRecordRespVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10787") + @ExcelProperty("编号") + private Long id; + + @Schema(description = "进或出", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("进或出") + private String intoOrOut; + + @Schema(description = "车牌号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("车牌号") + private String licenseNumber; + + @Schema(description = "时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("时间") + private String time; + + @Schema(description = "图片", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("图片") + private String picture; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/vehiclerecord/vo/VehicleRecordSaveReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/vehiclerecord/vo/VehicleRecordSaveReqVO.java new file mode 100644 index 000000000..cd68fb065 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/vehiclerecord/vo/VehicleRecordSaveReqVO.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.parking.controller.admin.vehiclerecord.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 VehicleRecordSaveReqVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10787") + private Long id; + + @Schema(description = "进或出", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "进或出不能为空") + private String intoOrOut; + + @Schema(description = "车牌号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "车牌号不能为空") + private String licenseNumber; + + @Schema(description = "时间", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "时间不能为空") + private String time; + + @Schema(description = "图片", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "图片不能为空") + private String picture; + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/vehiclerecord/VehicleRecordMapper.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/vehiclerecord/VehicleRecordMapper.java new file mode 100644 index 000000000..b6768e5ff --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/vehiclerecord/VehicleRecordMapper.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.parking.dal.mysql.vehiclerecord; + +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.vehiclerecord.VehicleRecordDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.parking.controller.admin.vehiclerecord.vo.*; + +/** + * 车辆进出记录数据 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface VehicleRecordMapper extends BaseMapperX { + + default PageResult selectPage(VehicleRecordPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(VehicleRecordDO::getIntoOrOut, reqVO.getIntoOrOut()) + .eqIfPresent(VehicleRecordDO::getLicenseNumber, reqVO.getLicenseNumber()) + .betweenIfPresent(VehicleRecordDO::getTime, reqVO.getTime()) + .eqIfPresent(VehicleRecordDO::getPicture, reqVO.getPicture()) + .betweenIfPresent(VehicleRecordDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(VehicleRecordDO::getId)); + } + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/vehiclerecord/VehicleRecordService.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/vehiclerecord/VehicleRecordService.java new file mode 100644 index 000000000..7a1c15dcc --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/vehiclerecord/VehicleRecordService.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.parking.service.vehiclerecord; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.parking.controller.admin.vehiclerecord.vo.*; +import cn.iocoder.yudao.module.parking.dal.dataobject.vehiclerecord.VehicleRecordDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +/** + * 车辆进出记录数据 Service 接口 + * + * @author 芋道源码 + */ +public interface VehicleRecordService { + + /** + * 创建车辆进出记录数据 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createVehicleRecord(@Valid VehicleRecordSaveReqVO createReqVO); + + /** + * 更新车辆进出记录数据 + * + * @param updateReqVO 更新信息 + */ + void updateVehicleRecord(@Valid VehicleRecordSaveReqVO updateReqVO); + + /** + * 删除车辆进出记录数据 + * + * @param id 编号 + */ + void deleteVehicleRecord(Long id); + + /** + * 获得车辆进出记录数据 + * + * @param id 编号 + * @return 车辆进出记录数据 + */ + VehicleRecordDO getVehicleRecord(Long id); + + /** + * 获得车辆进出记录数据分页 + * + * @param pageReqVO 分页查询 + * @return 车辆进出记录数据分页 + */ + PageResult getVehicleRecordPage(VehicleRecordPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/vehiclerecord/VehicleRecordServiceImpl.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/vehiclerecord/VehicleRecordServiceImpl.java new file mode 100644 index 000000000..70dd99db5 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/vehiclerecord/VehicleRecordServiceImpl.java @@ -0,0 +1,74 @@ +package cn.iocoder.yudao.module.parking.service.vehiclerecord; + +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.vehiclerecord.vo.*; +import cn.iocoder.yudao.module.parking.dal.dataobject.vehiclerecord.VehicleRecordDO; +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.vehiclerecord.VehicleRecordMapper; + +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 VehicleRecordServiceImpl implements VehicleRecordService { + + @Resource + private VehicleRecordMapper vehicleRecordMapper; + + @Override + public Long createVehicleRecord(VehicleRecordSaveReqVO createReqVO) { + // 插入 + VehicleRecordDO vehicleRecord = BeanUtils.toBean(createReqVO, VehicleRecordDO.class); + vehicleRecordMapper.insert(vehicleRecord); + // 返回 + return vehicleRecord.getId(); + } + + @Override + public void updateVehicleRecord(VehicleRecordSaveReqVO updateReqVO) { + // 校验存在 + validateVehicleRecordExists(updateReqVO.getId()); + // 更新 + VehicleRecordDO updateObj = BeanUtils.toBean(updateReqVO, VehicleRecordDO.class); + vehicleRecordMapper.updateById(updateObj); + } + + @Override + public void deleteVehicleRecord(Long id) { + // 校验存在 + validateVehicleRecordExists(id); + // 删除 + vehicleRecordMapper.deleteById(id); + } + + private void validateVehicleRecordExists(Long id) { + if (vehicleRecordMapper.selectById(id) == null) { + throw exception(VEHICLE_RECORD_NOT_EXISTS); + } + } + + @Override + public VehicleRecordDO getVehicleRecord(Long id) { + return vehicleRecordMapper.selectById(id); + } + + @Override + public PageResult getVehicleRecordPage(VehicleRecordPageReqVO pageReqVO) { + return vehicleRecordMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/vehiclerecord/VehicleRecordMapper.xml b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/vehiclerecord/VehicleRecordMapper.xml new file mode 100644 index 000000000..c89e53e5e --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/vehiclerecord/VehicleRecordMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file