停车场-白名单配置

This commit is contained in:
XinWei 2024-07-30 14:54:45 +08:00
parent 867efb2f51
commit cd80d93d6d
10 changed files with 616 additions and 1 deletions

View File

@ -13,5 +13,6 @@ public interface ErrorCodeConstants {
ErrorCode CHARGE_INFORMATION_NOT_EXISTS = new ErrorCode(1_005_001_007, "收费信息不存在"); ErrorCode CHARGE_INFORMATION_NOT_EXISTS = new ErrorCode(1_005_001_007, "收费信息不存在");
// ========== 入场记录 1_005_001_008 ========== // ========== 入场记录 1_005_001_008 ==========
ErrorCode ENTRY_RECORD_NOT_EXISTS = new ErrorCode(1_005_001_008, "入场记录不存在"); ErrorCode ENTRY_RECORD_NOT_EXISTS = new ErrorCode(1_005_001_008, "入场记录不存在");
// ========== 白名单配置 TODO 补充编号 ==========
ErrorCode WHITELIST_DELIVERY_NOT_EXISTS = new ErrorCode(1_005_001_009, "白名单配置不存在");
} }

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery;
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.whitelistdelivery.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.whitelistdelivery.WhitelistDeliveryDO;
import cn.iocoder.yudao.module.parking.service.whitelistdelivery.WhitelistDeliveryService;
@Tag(name = "管理后台 - 白名单配置")
@RestController
@RequestMapping("/parking/whitelist-delivery")
@Validated
public class WhitelistDeliveryController {
@Resource
private WhitelistDeliveryService whitelistDeliveryService;
@PostMapping("/create")
@Operation(summary = "创建白名单配置")
@PreAuthorize("@ss.hasPermission('parking:whitelist-delivery:create')")
public CommonResult<Long> createWhitelistDelivery(@Valid @RequestBody WhitelistDeliverySaveReqVO createReqVO) {
return success(whitelistDeliveryService.createWhitelistDelivery(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新白名单配置")
@PreAuthorize("@ss.hasPermission('parking:whitelist-delivery:update')")
public CommonResult<Boolean> updateWhitelistDelivery(@Valid @RequestBody WhitelistDeliverySaveReqVO updateReqVO) {
whitelistDeliveryService.updateWhitelistDelivery(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除白名单配置")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('parking:whitelist-delivery:delete')")
public CommonResult<Boolean> deleteWhitelistDelivery(@RequestParam("id") Long id) {
whitelistDeliveryService.deleteWhitelistDelivery(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得白名单配置")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('parking:whitelist-delivery:query')")
public CommonResult<WhitelistDeliveryRespVO> getWhitelistDelivery(@RequestParam("id") Long id) {
WhitelistDeliveryDO whitelistDelivery = whitelistDeliveryService.getWhitelistDelivery(id);
return success(BeanUtils.toBean(whitelistDelivery, WhitelistDeliveryRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得白名单配置分页")
@PreAuthorize("@ss.hasPermission('parking:whitelist-delivery:query')")
public CommonResult<PageResult<WhitelistDeliveryRespVO>> getWhitelistDeliveryPage(@Valid WhitelistDeliveryPageReqVO pageReqVO) {
PageResult<WhitelistDeliveryDO> pageResult = whitelistDeliveryService.getWhitelistDeliveryPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, WhitelistDeliveryRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出白名单配置 Excel")
@PreAuthorize("@ss.hasPermission('parking:whitelist-delivery:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportWhitelistDeliveryExcel(@Valid WhitelistDeliveryPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<WhitelistDeliveryDO> list = whitelistDeliveryService.getWhitelistDeliveryPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "白名单配置.xls", "数据", WhitelistDeliveryRespVO.class,
BeanUtils.toBean(list, WhitelistDeliveryRespVO.class));
}
}

View File

@ -0,0 +1,77 @@
package cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery.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 WhitelistDeliveryPageReqVO extends PageParam {
@Schema(description = "场库编号")
private String parkNumber;
@Schema(description = "白名单数量")
private Integer size;
@Schema(description = "车牌号")
private String plate;
@Schema(description = "收费类型", example = "1")
private String chargeType;
@Schema(description = "车主姓名", example = "芋艿")
private String name;
@Schema(description = "身份证信息")
private String certificate;
@Schema(description = "车主联系地址")
private String address;
@Schema(description = "车主联系电话")
private String phone;
@Schema(description = "车牌颜色")
private String plateColor;
@Schema(description = "生效日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] start;
@Schema(description = "失效日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] end;
@Schema(description = "部门")
private String dept;
@Schema(description = "车辆类型", example = "2")
private String carType;
@Schema(description = "备注", example = "你猜")
private String memo;
@Schema(description = "区域Id", example = "14435")
private Integer areaId;
@Schema(description = "生效日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] areaStart;
@Schema(description = "失效日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] areaEnd;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,92 @@
package cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery.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 WhitelistDeliveryRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3476")
@ExcelProperty("id")
private Long id;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("场库编号")
private String parkNumber;
@Schema(description = "白名单数量")
@ExcelProperty("白名单数量")
private Integer size;
@Schema(description = "车牌号")
@ExcelProperty("车牌号")
private String plate;
@Schema(description = "收费类型", example = "1")
@ExcelProperty("收费类型")
private String chargeType;
@Schema(description = "车主姓名", example = "芋艿")
@ExcelProperty("车主姓名")
private String name;
@Schema(description = "身份证信息")
@ExcelProperty("身份证信息")
private String certificate;
@Schema(description = "车主联系地址")
@ExcelProperty("车主联系地址")
private String address;
@Schema(description = "车主联系电话")
@ExcelProperty("车主联系电话")
private String phone;
@Schema(description = "车牌颜色")
@ExcelProperty("车牌颜色")
private String plateColor;
@Schema(description = "生效日期")
@ExcelProperty("生效日期")
private String start;
@Schema(description = "失效日期")
@ExcelProperty("失效日期")
private String end;
@Schema(description = "部门")
@ExcelProperty("部门")
private String dept;
@Schema(description = "车辆类型", example = "2")
@ExcelProperty("车辆类型")
private String carType;
@Schema(description = "备注", example = "你猜")
@ExcelProperty("备注")
private String memo;
@Schema(description = "区域Id", example = "14435")
@ExcelProperty("区域Id")
private Integer areaId;
@Schema(description = "生效日期")
@ExcelProperty("生效日期")
private String areaStart;
@Schema(description = "失效日期")
@ExcelProperty("失效日期")
private String areaEnd;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,67 @@
package cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery.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 WhitelistDeliverySaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3476")
private Long id;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "场库编号不能为空")
private String parkNumber;
@Schema(description = "白名单数量")
private Integer size;
@Schema(description = "车牌号")
private String plate;
@Schema(description = "收费类型", example = "1")
private String chargeType;
@Schema(description = "车主姓名", example = "芋艿")
private String name;
@Schema(description = "身份证信息")
private String certificate;
@Schema(description = "车主联系地址")
private String address;
@Schema(description = "车主联系电话")
private String phone;
@Schema(description = "车牌颜色")
private String plateColor;
@Schema(description = "生效日期")
private String start;
@Schema(description = "失效日期")
private String end;
@Schema(description = "部门")
private String dept;
@Schema(description = "车辆类型", example = "2")
private String carType;
@Schema(description = "备注", example = "你猜")
private String memo;
@Schema(description = "区域Id", example = "14435")
private Integer areaId;
@Schema(description = "生效日期")
private String areaStart;
@Schema(description = "失效日期")
private String areaEnd;
}

View File

@ -0,0 +1,99 @@
package cn.iocoder.yudao.module.parking.dal.dataobject.whitelistdelivery;
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("whitelist_delivery")
@KeySequence("whitelist_delivery_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WhitelistDeliveryDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 场库编号
*/
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;
/**
* 区域Id
*/
private Integer areaId;
/**
* 生效日期
*/
private String areaStart;
/**
* 失效日期
*/
private String areaEnd;
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.parking.dal.mysql.whitelistdelivery;
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.whitelistdelivery.WhitelistDeliveryDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery.vo.*;
/**
* 白名单配置 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface WhitelistDeliveryMapper extends BaseMapperX<WhitelistDeliveryDO> {
default PageResult<WhitelistDeliveryDO> selectPage(WhitelistDeliveryPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<WhitelistDeliveryDO>()
.eqIfPresent(WhitelistDeliveryDO::getParkNumber, reqVO.getParkNumber())
.eqIfPresent(WhitelistDeliveryDO::getSize, reqVO.getSize())
.eqIfPresent(WhitelistDeliveryDO::getPlate, reqVO.getPlate())
.eqIfPresent(WhitelistDeliveryDO::getChargeType, reqVO.getChargeType())
.likeIfPresent(WhitelistDeliveryDO::getName, reqVO.getName())
.eqIfPresent(WhitelistDeliveryDO::getCertificate, reqVO.getCertificate())
.eqIfPresent(WhitelistDeliveryDO::getAddress, reqVO.getAddress())
.eqIfPresent(WhitelistDeliveryDO::getPhone, reqVO.getPhone())
.eqIfPresent(WhitelistDeliveryDO::getPlateColor, reqVO.getPlateColor())
.betweenIfPresent(WhitelistDeliveryDO::getStart, reqVO.getStart())
.betweenIfPresent(WhitelistDeliveryDO::getEnd, reqVO.getEnd())
.eqIfPresent(WhitelistDeliveryDO::getDept, reqVO.getDept())
.eqIfPresent(WhitelistDeliveryDO::getCarType, reqVO.getCarType())
.eqIfPresent(WhitelistDeliveryDO::getMemo, reqVO.getMemo())
.eqIfPresent(WhitelistDeliveryDO::getAreaId, reqVO.getAreaId())
.betweenIfPresent(WhitelistDeliveryDO::getAreaStart, reqVO.getAreaStart())
.betweenIfPresent(WhitelistDeliveryDO::getAreaEnd, reqVO.getAreaEnd())
.betweenIfPresent(WhitelistDeliveryDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(WhitelistDeliveryDO::getId));
}
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.parking.service.whitelistdelivery;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.whitelistdelivery.WhitelistDeliveryDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 白名单配置 Service 接口
*
* @author 芋道源码
*/
public interface WhitelistDeliveryService {
/**
* 创建白名单配置
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createWhitelistDelivery(@Valid WhitelistDeliverySaveReqVO createReqVO);
/**
* 更新白名单配置
*
* @param updateReqVO 更新信息
*/
void updateWhitelistDelivery(@Valid WhitelistDeliverySaveReqVO updateReqVO);
/**
* 删除白名单配置
*
* @param id 编号
*/
void deleteWhitelistDelivery(Long id);
/**
* 获得白名单配置
*
* @param id 编号
* @return 白名单配置
*/
WhitelistDeliveryDO getWhitelistDelivery(Long id);
/**
* 获得白名单配置分页
*
* @param pageReqVO 分页查询
* @return 白名单配置分页
*/
PageResult<WhitelistDeliveryDO> getWhitelistDeliveryPage(WhitelistDeliveryPageReqVO pageReqVO);
}

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.parking.service.whitelistdelivery;
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.whitelistdelivery.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.whitelistdelivery.WhitelistDeliveryDO;
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.whitelistdelivery.WhitelistDeliveryMapper;
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 WhitelistDeliveryServiceImpl implements WhitelistDeliveryService {
@Resource
private WhitelistDeliveryMapper whitelistDeliveryMapper;
@Override
public Long createWhitelistDelivery(WhitelistDeliverySaveReqVO createReqVO) {
// 插入
WhitelistDeliveryDO whitelistDelivery = BeanUtils.toBean(createReqVO, WhitelistDeliveryDO.class);
whitelistDeliveryMapper.insert(whitelistDelivery);
// 返回
return whitelistDelivery.getId();
}
@Override
public void updateWhitelistDelivery(WhitelistDeliverySaveReqVO updateReqVO) {
// 校验存在
validateWhitelistDeliveryExists(updateReqVO.getId());
// 更新
WhitelistDeliveryDO updateObj = BeanUtils.toBean(updateReqVO, WhitelistDeliveryDO.class);
whitelistDeliveryMapper.updateById(updateObj);
}
@Override
public void deleteWhitelistDelivery(Long id) {
// 校验存在
validateWhitelistDeliveryExists(id);
// 删除
whitelistDeliveryMapper.deleteById(id);
}
private void validateWhitelistDeliveryExists(Long id) {
if (whitelistDeliveryMapper.selectById(id) == null) {
throw exception(WHITELIST_DELIVERY_NOT_EXISTS);
}
}
@Override
public WhitelistDeliveryDO getWhitelistDelivery(Long id) {
return whitelistDeliveryMapper.selectById(id);
}
@Override
public PageResult<WhitelistDeliveryDO> getWhitelistDeliveryPage(WhitelistDeliveryPageReqVO pageReqVO) {
return whitelistDeliveryMapper.selectPage(pageReqVO);
}
}

View File

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