xinwei #4

Merged
root merged 9 commits from xinwei into master 2024-08-19 09:48:44 +08:00
39 changed files with 1962 additions and 1 deletions
Showing only changes of commit 4a1c2def16 - Show all commits

View File

@ -8,5 +8,12 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants { public interface ErrorCodeConstants {
// ========== 进出记录图片 1_005_001_015 ========== // ========== 进出记录图片 1_005_001_015 ==========
ErrorCode ACCESS_RECORD_PICTURE_NOT_EXISTS = new ErrorCode(1_005_001_015, "进出记录图片不存在"); ErrorCode ACCESS_RECORD_PICTURE_NOT_EXISTS = new ErrorCode(1_005_001_015, "进出记录图片不存在");
// ========== 心跳管理 1_005_001_025 ==========
ErrorCode HEARTBEAT_NOT_EXISTS = new ErrorCode(1_005_001_025, "心跳管理不存在");
// ========== 通道信息 1_005_001_026 ==========
ErrorCode PASSAGEWAY_NOT_EXISTS = new ErrorCode(1_005_001_026, "通道信息不存在");
// ========== 场库列表 1_005_001_027 ==========
ErrorCode PARK_NOT_EXISTS = new ErrorCode(1_005_001_027, "场库列表不存在");
// ========== 区域列表 1_005_001_028 ==========
ErrorCode AREA_NOT_EXISTS = new ErrorCode(1_005_001_028, "区域列表不存在");
} }

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.parking.controller.admin.area;
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.area.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.module.parking.service.area.AreaService;
@Tag(name = "管理后台 - 区域列表")
@RestController
@RequestMapping("/parking/area")
@Validated
public class AreaController {
@Resource
private AreaService areaService;
@PostMapping("/create")
@Operation(summary = "创建区域列表")
@PreAuthorize("@ss.hasPermission('parking:area:create')")
public CommonResult<Integer> createArea(@Valid @RequestBody AreaSaveReqVO createReqVO) {
return success(areaService.createArea(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新区域列表")
@PreAuthorize("@ss.hasPermission('parking:area:update')")
public CommonResult<Boolean> updateArea(@Valid @RequestBody AreaSaveReqVO updateReqVO) {
areaService.updateArea(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除区域列表")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('parking:area:delete')")
public CommonResult<Boolean> deleteArea(@RequestParam("id") Integer id) {
areaService.deleteArea(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得区域列表")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('parking:area:query')")
public CommonResult<AreaRespVO> getArea(@RequestParam("id") Integer id) {
AreaDO area = areaService.getArea(id);
return success(BeanUtils.toBean(area, AreaRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得区域列表分页")
@PreAuthorize("@ss.hasPermission('parking:area:query')")
public CommonResult<PageResult<AreaRespVO>> getAreaPage(@Valid AreaPageReqVO pageReqVO) {
PageResult<AreaDO> pageResult = areaService.getAreaPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, AreaRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出区域列表 Excel")
@PreAuthorize("@ss.hasPermission('parking:area:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportAreaExcel(@Valid AreaPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<AreaDO> list = areaService.getAreaPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "区域列表.xls", "数据", AreaRespVO.class,
BeanUtils.toBean(list, AreaRespVO.class));
}
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.parking.controller.admin.area.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 AreaPageReqVO extends PageParam {
@Schema(description = "场库编号")
private String parkNumber;
@Schema(description = "区域名称", example = "李四")
private String areaName;
@Schema(description = "区域车位数", example = "24356")
private Integer spaceCount;
@Schema(description = "区域空位数", example = "4332")
private Integer lastSpaceCount;
@Schema(description = "区域可预约车位数", example = "10031")
private Integer bookSpaceCount;
@Schema(description = "区域在场预约数", example = "7772")
private Integer bookInParkCount;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,51 @@
package cn.iocoder.yudao.module.parking.controller.admin.area.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 AreaRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9513")
@ExcelProperty("id")
private Long id;
@Schema(description = "区域Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "32029")
@ExcelProperty("区域Id")
private Integer areaId;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("场库编号")
private String parkNumber;
@Schema(description = "区域名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("区域名称")
private String areaName;
@Schema(description = "区域车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "24356")
@ExcelProperty("区域车位数")
private Integer spaceCount;
@Schema(description = "区域空位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "4332")
@ExcelProperty("区域空位数")
private Integer lastSpaceCount;
@Schema(description = "区域可预约车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "10031")
@ExcelProperty("区域可预约车位数")
private Integer bookSpaceCount;
@Schema(description = "区域在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "7772")
@ExcelProperty("区域在场预约数")
private Integer bookInParkCount;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.parking.controller.admin.area.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 AreaSaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9513")
private Long id;
@Schema(description = "区域Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "32029")
private Integer areaId;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "场库编号不能为空")
private String parkNumber;
@Schema(description = "区域名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@NotEmpty(message = "区域名称不能为空")
private String areaName;
@Schema(description = "区域车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "24356")
@NotNull(message = "区域车位数不能为空")
private Integer spaceCount;
@Schema(description = "区域空位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "4332")
@NotNull(message = "区域空位数不能为空")
private Integer lastSpaceCount;
@Schema(description = "区域可预约车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "10031")
@NotNull(message = "区域可预约车位数不能为空")
private Integer bookSpaceCount;
@Schema(description = "区域在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "7772")
@NotNull(message = "区域在场预约数不能为空")
private Integer bookInParkCount;
}

View File

@ -0,0 +1,101 @@
package cn.iocoder.yudao.module.parking.controller.admin.heartbeat;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
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.time.LocalDateTime;
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.heartbeat.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.heartbeat.HeartbeatDO;
import cn.iocoder.yudao.module.parking.service.heartbeat.HeartbeatService;
@Tag(name = "管理后台 - 心跳管理")
@RestController
@RequestMapping("/parking/heartbeat")
@Validated
public class HeartbeatController {
@Resource
private HeartbeatService heartbeatService;
@PostMapping("/doHeartbeat")
public BlueCardResult doHeartbeat(@RequestBody HeartbeatReqDataVO blueCardHeartbeat){
return heartbeatService.doHeartbeat(blueCardHeartbeat);
}
@PostMapping("/create")
@Operation(summary = "创建心跳管理")
@PreAuthorize("@ss.hasPermission('parking:heartbeat:create')")
public CommonResult<Long> createHeartbeat(@Valid @RequestBody HeartbeatSaveReqVO createReqVO) {
return success(heartbeatService.createHeartbeat(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新心跳管理")
@PreAuthorize("@ss.hasPermission('parking:heartbeat:update')")
public CommonResult<Boolean> updateHeartbeat(@Valid @RequestBody HeartbeatSaveReqVO updateReqVO) {
heartbeatService.updateHeartbeat(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除心跳管理")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('parking:heartbeat:delete')")
public CommonResult<Boolean> deleteHeartbeat(@RequestParam("id") Long id) {
heartbeatService.deleteHeartbeat(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得心跳管理")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('parking:heartbeat:query')")
public CommonResult<HeartbeatRespVO> getHeartbeat(@RequestParam("id") Long id) {
HeartbeatDO heartbeat = heartbeatService.getHeartbeat(id);
return success(BeanUtils.toBean(heartbeat, HeartbeatRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得心跳管理分页")
@PreAuthorize("@ss.hasPermission('parking:heartbeat:query')")
public CommonResult<PageResult<HeartbeatRespVO>> getHeartbeatPage(@Valid HeartbeatPageReqVO pageReqVO) {
PageResult<HeartbeatDO> pageResult = heartbeatService.getHeartbeatPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, HeartbeatRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出心跳管理 Excel")
@PreAuthorize("@ss.hasPermission('parking:heartbeat:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportHeartbeatExcel(@Valid HeartbeatPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<HeartbeatDO> list = heartbeatService.getHeartbeatPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "心跳管理.xls", "数据", HeartbeatRespVO.class,
BeanUtils.toBean(list, HeartbeatRespVO.class));
}
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.parking.controller.admin.heartbeat.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 HeartbeatPageReqVO extends PageParam {
@Schema(description = "场库编号")
private String parkNumber;
@Schema(description = "场库名称", example = "李四")
private String parkName;
@Schema(description = "场库总车位数", example = "12040")
private Integer spaceCount;
@Schema(description = "场库空车位数", example = "724")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", example = "6686")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", example = "15197")
private Integer bookInParkCount;
@Schema(description = "区域属性")
private String areaList;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,41 @@
package cn.iocoder.yudao.module.parking.controller.admin.heartbeat.vo;
import cn.iocoder.yudao.module.parking.controller.admin.area.vo.AreaSaveReqVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.ArrayList;
/**
* @Description 蓝卡心跳请求参数
*/
@Data
public class HeartbeatReqDataVO {
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
private String parkNumber;
@Schema(description = "场库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@NotEmpty(message = "场库名称不能为空")
private String parkName;
@Schema(description = "场库总车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "21057")
@NotNull(message = "场库总车位数不能为空")
private Integer spaceCount;
@Schema(description = "场库空车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "7657")
@NotNull(message = "场库空车位数不能为空")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "17569")
@NotNull(message = "场库可预约数不能为空")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "13935")
@NotNull(message = "场库在场预约数不能为空")
private Integer bookInParkCount;
@Schema(description = "区域属性")
private ArrayList<AreaSaveReqVO> areaList;
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.parking.controller.admin.heartbeat.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 HeartbeatRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17692")
@ExcelProperty("编号")
private Long id;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("场库编号")
private String parkNumber;
@Schema(description = "场库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("场库名称")
private String parkName;
@Schema(description = "场库总车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "12040")
@ExcelProperty("场库总车位数")
private Integer spaceCount;
@Schema(description = "场库空车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "724")
@ExcelProperty("场库空车位数")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "6686")
@ExcelProperty("场库可预约数")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "15197")
@ExcelProperty("场库在场预约数")
private Integer bookInParkCount;
@Schema(description = "区域属性", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("区域属性")
private String areaList;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.parking.controller.admin.heartbeat.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 HeartbeatSaveReqVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17692")
private Long id;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "场库编号不能为空")
private String parkNumber;
@Schema(description = "场库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@NotEmpty(message = "场库名称不能为空")
private String parkName;
@Schema(description = "场库总车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "12040")
@NotNull(message = "场库总车位数不能为空")
private Integer spaceCount;
@Schema(description = "场库空车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "724")
@NotNull(message = "场库空车位数不能为空")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "6686")
@NotNull(message = "场库可预约数不能为空")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "15197")
@NotNull(message = "场库在场预约数不能为空")
private Integer bookInParkCount;
@Schema(description = "区域属性", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "区域属性不能为空")
private String areaList;
}

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.parking.controller.admin.park;
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.park.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.park.ParkDO;
import cn.iocoder.yudao.module.parking.service.park.ParkService;
@Tag(name = "管理后台 - 场库列表")
@RestController
@RequestMapping("/parking/park")
@Validated
public class ParkController {
@Resource
private ParkService parkService;
@PostMapping("/create")
@Operation(summary = "创建场库列表")
@PreAuthorize("@ss.hasPermission('parking:park:create')")
public CommonResult<String> createPark(@Valid @RequestBody ParkSaveReqVO createReqVO) {
return success(parkService.createPark(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新场库列表")
@PreAuthorize("@ss.hasPermission('parking:park:update')")
public CommonResult<Boolean> updatePark(@Valid @RequestBody ParkSaveReqVO updateReqVO) {
parkService.updatePark(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除场库列表")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('parking:park:delete')")
public CommonResult<Boolean> deletePark(@RequestParam("id") String id) {
parkService.deletePark(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得场库列表")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('parking:park:query')")
public CommonResult<ParkRespVO> getPark(@RequestParam("id") String id) {
ParkDO park = parkService.getPark(id);
return success(BeanUtils.toBean(park, ParkRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得场库列表分页")
@PreAuthorize("@ss.hasPermission('parking:park:query')")
public CommonResult<PageResult<ParkRespVO>> getParkPage(@Valid ParkPageReqVO pageReqVO) {
PageResult<ParkDO> pageResult = parkService.getParkPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ParkRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出场库列表 Excel")
@PreAuthorize("@ss.hasPermission('parking:park:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportParkExcel(@Valid ParkPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ParkDO> list = parkService.getParkPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "场库列表.xls", "数据", ParkRespVO.class,
BeanUtils.toBean(list, ParkRespVO.class));
}
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.parking.controller.admin.park.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 ParkPageReqVO extends PageParam {
@Schema(description = "场库名称", example = "张三")
private String parkName;
@Schema(description = "场库总车位数", example = "21057")
private Integer spaceCount;
@Schema(description = "场库空车位数", example = "7657")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", example = "17569")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", example = "13935")
private Integer bookInParkCount;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.module.parking.controller.admin.park.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 ParkRespVO {
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("场库编号")
private String parkNumber;
@Schema(description = "场库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("场库名称")
private String parkName;
@Schema(description = "场库总车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "21057")
@ExcelProperty("场库总车位数")
private Integer spaceCount;
@Schema(description = "场库空车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "7657")
@ExcelProperty("场库空车位数")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "17569")
@ExcelProperty("场库可预约数")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "13935")
@ExcelProperty("场库在场预约数")
private Integer bookInParkCount;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.parking.controller.admin.park.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 场库列表新增/修改 Request VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ParkSaveReqVO {
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
private String parkNumber;
@Schema(description = "场库名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@NotEmpty(message = "场库名称不能为空")
private String parkName;
@Schema(description = "场库总车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "21057")
@NotNull(message = "场库总车位数不能为空")
private Integer spaceCount;
@Schema(description = "场库空车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "7657")
@NotNull(message = "场库空车位数不能为空")
private Integer freeSpaceCount;
@Schema(description = "场库可预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "17569")
@NotNull(message = "场库可预约数不能为空")
private Integer bookSpaceCount;
@Schema(description = "场库在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "13935")
@NotNull(message = "场库在场预约数不能为空")
private Integer bookInParkCount;
}

View File

@ -0,0 +1,101 @@
package cn.iocoder.yudao.module.parking.controller.admin.passageway;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
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.passageway.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.passageway.PassagewayDO;
import cn.iocoder.yudao.module.parking.service.passageway.PassagewayService;
@Tag(name = "管理后台 - 通道信息")
@RestController
@RequestMapping("/parking/passageway")
@Validated
public class PassagewayController {
@Resource
private PassagewayService passagewayService;
@PostMapping("/passagewayUpload")
public BlueCardResult passagewayUpload(@RequestBody PassagewayReqDataVO passagewayReqDataVO){
return passagewayService.passagewayUpload(passagewayReqDataVO);
}
@PostMapping("/create")
@Operation(summary = "创建通道信息")
@PreAuthorize("@ss.hasPermission('parking:passageway:create')")
public CommonResult<String> createPassageway(@Valid @RequestBody PassagewaySaveReqVO createReqVO) {
return success(passagewayService.createPassageway(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新通道信息")
@PreAuthorize("@ss.hasPermission('parking:passageway:update')")
public CommonResult<Boolean> updatePassageway(@Valid @RequestBody PassagewaySaveReqVO updateReqVO) {
passagewayService.updatePassageway(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除通道信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('parking:passageway:delete')")
public CommonResult<Boolean> deletePassageway(@RequestParam("id") String id) {
passagewayService.deletePassageway(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得通道信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('parking:passageway:query')")
public CommonResult<PassagewayRespVO> getPassageway(@RequestParam("id") String id) {
PassagewayDO passageway = passagewayService.getPassageway(id);
return success(BeanUtils.toBean(passageway, PassagewayRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得通道信息分页")
@PreAuthorize("@ss.hasPermission('parking:passageway:query')")
public CommonResult<PageResult<PassagewayRespVO>> getPassagewayPage(@Valid PassagewayPageReqVO pageReqVO) {
PageResult<PassagewayDO> pageResult = passagewayService.getPassagewayPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, PassagewayRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出通道信息 Excel")
@PreAuthorize("@ss.hasPermission('parking:passageway:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportPassagewayExcel(@Valid PassagewayPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<PassagewayDO> list = passagewayService.getPassagewayPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "通道信息.xls", "数据", PassagewayRespVO.class,
BeanUtils.toBean(list, PassagewayRespVO.class));
}
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.parking.controller.admin.passageway.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 PassagewayPageReqVO extends PageParam {
@Schema(description = "场库编号")
private String parkNumber;
@Schema(description = "通道名称", example = "李四")
private String passagewayName;
@Schema(description = "源区域 Id", example = "7412")
private String sourceAreaId;
@Schema(description = "目标区域 Id", example = "10505")
private String targetAreaId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.parking.controller.admin.passageway.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @Description 通道信息上传请求参数
*/
@Data
public class PassagewayReqDataVO {
@Schema(description = "停车场编号", requiredMode = Schema.RequiredMode.REQUIRED)
private String parkNumber;
@Schema(description = "datas数据条数", requiredMode = Schema.RequiredMode.REQUIRED)
private Integer size;
@Schema(description = "区域属性", requiredMode = Schema.RequiredMode.REQUIRED)
private List<PassagewaySaveReqVO> datas;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.parking.controller.admin.passageway.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 PassagewayRespVO {
@Schema(description = "通道 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7099")
@ExcelProperty("通道 Id")
private String passagewayId;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("场库编号")
private String parkNumber;
@Schema(description = "通道名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("通道名称")
private String passagewayName;
@Schema(description = "源区域 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7412")
@ExcelProperty("源区域 Id")
private String sourceAreaId;
@Schema(description = "目标区域 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "10505")
@ExcelProperty("目标区域 Id")
private String targetAreaId;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.parking.controller.admin.passageway.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 PassagewaySaveReqVO {
@Schema(description = "通道 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7099")
private String passagewayId;
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "场库编号不能为空")
private String parkNumber;
@Schema(description = "通道名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@NotEmpty(message = "通道名称不能为空")
private String passagewayName;
@Schema(description = "源区域 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7412")
@NotEmpty(message = "源区域 Id不能为空")
private String sourceAreaId;
@Schema(description = "目标区域 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "10505")
@NotEmpty(message = "目标区域 Id不能为空")
private String targetAreaId;
}

View File

@ -0,0 +1,58 @@
package cn.iocoder.yudao.module.parking.dal.dataobject.area;
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("area")
@KeySequence("area_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AreaDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 区域Id
*/
private Integer areaId;
/**
* 场库编号
*/
private String parkNumber;
/**
* 区域名称
*/
private String areaName;
/**
* 区域车位数
*/
private Integer spaceCount;
/**
* 区域空位数
*/
private Integer lastSpaceCount;
/**
* 区域可预约车位数
*/
private Integer bookSpaceCount;
/**
* 区域在场预约数
*/
private Integer bookInParkCount;
}

View File

@ -0,0 +1,59 @@
package cn.iocoder.yudao.module.parking.dal.dataobject.heartbeat;
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("heartbeat")
@KeySequence("heartbeat_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HeartbeatDO extends BaseDO {
/**
* 编号
*/
@TableId
private Long id;
/**
* 场库编号
*/
private String parkNumber;
/**
* 场库名称
*/
private String parkName;
/**
* 场库总车位数
*/
private Integer spaceCount;
/**
* 场库空车位数
*/
private Integer freeSpaceCount;
/**
* 场库可预约数
*/
private Integer bookSpaceCount;
/**
* 场库在场预约数
*/
private Integer bookInParkCount;
/**
* 区域属性
*/
private String areaList;
}

View File

@ -0,0 +1,51 @@
package cn.iocoder.yudao.module.parking.dal.dataobject.park;
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("park")
@KeySequence("park_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ParkDO extends BaseDO {
/**
* 场库编号
*/
@TableId(type = IdType.INPUT)
private String parkNumber;
/**
* 场库名称
*/
private String parkName;
/**
* 场库总车位数
*/
private Integer spaceCount;
/**
* 场库空车位数
*/
private Integer freeSpaceCount;
/**
* 场库可预约数
*/
private Integer bookSpaceCount;
/**
* 场库在场预约数
*/
private Integer bookInParkCount;
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.parking.dal.dataobject.passageway;
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("passageway")
@KeySequence("passageway_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PassagewayDO extends BaseDO {
/**
* 通道 Id
*/
@TableId(type = IdType.INPUT)
private String passagewayId;
/**
* 场库编号
*/
private String parkNumber;
/**
* 通道名称
*/
private String passagewayName;
/**
* 源区域 Id
*/
private String sourceAreaId;
/**
* 目标区域 Id
*/
private String targetAreaId;
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.parking.dal.mysql.area;
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.area.AreaDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.parking.controller.admin.area.vo.*;
/**
* 区域列表 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface AreaMapper extends BaseMapperX<AreaDO> {
default PageResult<AreaDO> selectPage(AreaPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<AreaDO>()
.eqIfPresent(AreaDO::getParkNumber, reqVO.getParkNumber())
.likeIfPresent(AreaDO::getAreaName, reqVO.getAreaName())
.eqIfPresent(AreaDO::getSpaceCount, reqVO.getSpaceCount())
.eqIfPresent(AreaDO::getLastSpaceCount, reqVO.getLastSpaceCount())
.eqIfPresent(AreaDO::getBookSpaceCount, reqVO.getBookSpaceCount())
.eqIfPresent(AreaDO::getBookInParkCount, reqVO.getBookInParkCount())
.betweenIfPresent(AreaDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(AreaDO::getAreaId));
}
}

View File

@ -0,0 +1,33 @@
package cn.iocoder.yudao.module.parking.dal.mysql.heartbeat;
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.heartbeat.HeartbeatDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.parking.controller.admin.heartbeat.vo.*;
/**
* 心跳管理 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface HeartbeatMapper extends BaseMapperX<HeartbeatDO> {
default PageResult<HeartbeatDO> selectPage(HeartbeatPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<HeartbeatDO>()
.eqIfPresent(HeartbeatDO::getParkNumber, reqVO.getParkNumber())
.likeIfPresent(HeartbeatDO::getParkName, reqVO.getParkName())
.eqIfPresent(HeartbeatDO::getSpaceCount, reqVO.getSpaceCount())
.eqIfPresent(HeartbeatDO::getFreeSpaceCount, reqVO.getFreeSpaceCount())
.eqIfPresent(HeartbeatDO::getBookSpaceCount, reqVO.getBookSpaceCount())
.eqIfPresent(HeartbeatDO::getBookInParkCount, reqVO.getBookInParkCount())
.eqIfPresent(HeartbeatDO::getAreaList, reqVO.getAreaList())
.betweenIfPresent(HeartbeatDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(HeartbeatDO::getId));
}
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.parking.dal.mysql.park;
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.park.ParkDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.parking.controller.admin.park.vo.*;
/**
* 场库列表 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ParkMapper extends BaseMapperX<ParkDO> {
default PageResult<ParkDO> selectPage(ParkPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ParkDO>()
.likeIfPresent(ParkDO::getParkName, reqVO.getParkName())
.eqIfPresent(ParkDO::getSpaceCount, reqVO.getSpaceCount())
.eqIfPresent(ParkDO::getFreeSpaceCount, reqVO.getFreeSpaceCount())
.eqIfPresent(ParkDO::getBookSpaceCount, reqVO.getBookSpaceCount())
.eqIfPresent(ParkDO::getBookInParkCount, reqVO.getBookInParkCount())
.betweenIfPresent(ParkDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ParkDO::getParkNumber));
}
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.parking.dal.mysql.passageway;
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.passageway.PassagewayDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.parking.controller.admin.passageway.vo.*;
/**
* 通道信息 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface PassagewayMapper extends BaseMapperX<PassagewayDO> {
default PageResult<PassagewayDO> selectPage(PassagewayPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<PassagewayDO>()
.eqIfPresent(PassagewayDO::getParkNumber, reqVO.getParkNumber())
.likeIfPresent(PassagewayDO::getPassagewayName, reqVO.getPassagewayName())
.eqIfPresent(PassagewayDO::getSourceAreaId, reqVO.getSourceAreaId())
.eqIfPresent(PassagewayDO::getTargetAreaId, reqVO.getTargetAreaId())
.betweenIfPresent(PassagewayDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(PassagewayDO::getPassagewayId));
}
}

View File

@ -0,0 +1,68 @@
package cn.iocoder.yudao.module.parking.service.area;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.parking.controller.admin.area.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 区域列表 Service 接口
*
* @author 芋道源码
*/
public interface AreaService {
/**
* 创建区域列表
*
* @param createReqVO 创建信息
* @return 编号
*/
Integer createArea(@Valid AreaSaveReqVO createReqVO);
/**
* 创建区域列表批处理
* @param areaSaveReqVOList
* @return java.lang.Integer
*/
Boolean createAreaBatch(@Valid List<AreaSaveReqVO> areaSaveReqVOList);
/**
* 更新区域列表
*
* @param updateReqVO 更新信息
*/
void updateArea(@Valid AreaSaveReqVO updateReqVO);
/**
* 删除区域列表
*
* @param id 编号
*/
void deleteArea(Integer id);
/**
* 获得区域列表
*
* @param id 编号
* @return 区域列表
*/
AreaDO getArea(Integer id);
/**
* 获得区域列表分页
*
* @param pageReqVO 分页查询
* @return 区域列表分页
*/
PageResult<AreaDO> getAreaPage(AreaPageReqVO pageReqVO);
/**
* 创建或更新区域批量
* @param areaList
* @return java.lang.Boolean
*/
Boolean createOrUpdateAreaBatch(ArrayList<AreaSaveReqVO> areaList);
}

View File

@ -0,0 +1,86 @@
package cn.iocoder.yudao.module.parking.service.area;
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.area.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.area.AreaDO;
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.area.AreaMapper;
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 AreaServiceImpl implements AreaService {
@Resource
private AreaMapper areaMapper;
@Override
public Integer createArea(AreaSaveReqVO createReqVO) {
// 插入
AreaDO area = BeanUtils.toBean(createReqVO, AreaDO.class);
areaMapper.insert(area);
// 返回
return area.getAreaId();
}
@Override
public Boolean createAreaBatch(List<AreaSaveReqVO> areaSaveReqVOList) {
// 插入
List<AreaDO> areaDOList = BeanUtils.toBean(areaSaveReqVOList, AreaDO.class);
return areaMapper.insertBatch(areaDOList);
}
@Override
public void updateArea(AreaSaveReqVO updateReqVO) {
// 校验存在
validateAreaExists(updateReqVO.getAreaId());
// 更新
AreaDO updateObj = BeanUtils.toBean(updateReqVO, AreaDO.class);
areaMapper.updateById(updateObj);
}
@Override
public void deleteArea(Integer id) {
// 校验存在
validateAreaExists(id);
// 删除
areaMapper.deleteById(id);
}
private void validateAreaExists(Integer id) {
if (areaMapper.selectById(id) == null) {
throw exception(AREA_NOT_EXISTS);
}
}
@Override
public AreaDO getArea(Integer id) {
return areaMapper.selectById(id);
}
@Override
public PageResult<AreaDO> getAreaPage(AreaPageReqVO pageReqVO) {
return areaMapper.selectPage(pageReqVO);
}
@Override
public Boolean createOrUpdateAreaBatch(ArrayList<AreaSaveReqVO> areaList) {
return areaMapper.insertOrUpdateBatch(BeanUtils.toBean(areaList, AreaDO.class));
}
}

View File

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.parking.service.heartbeat;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.parking.controller.admin.heartbeat.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.heartbeat.HeartbeatDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
/**
* 心跳管理 Service 接口
*
* @author 芋道源码
*/
public interface HeartbeatService {
/**
* 创建心跳管理
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createHeartbeat(@Valid HeartbeatSaveReqVO createReqVO);
/**
* 更新心跳管理
*
* @param updateReqVO 更新信息
*/
void updateHeartbeat(@Valid HeartbeatSaveReqVO updateReqVO);
/**
* 删除心跳管理
*
* @param id 编号
*/
void deleteHeartbeat(Long id);
/**
* 获得心跳管理
*
* @param id 编号
* @return 心跳管理
*/
HeartbeatDO getHeartbeat(Long id);
/**
* 获得心跳管理分页
*
* @param pageReqVO 分页查询
* @return 心跳管理分页
*/
PageResult<HeartbeatDO> getHeartbeatPage(HeartbeatPageReqVO pageReqVO);
/**
* 接收并解析心跳数据
* @param blueCardHeartbeat
* @return cn.iocoder.yudao.module.parking.util.BlueCardResult
*/
BlueCardResult doHeartbeat(HeartbeatReqDataVO blueCardHeartbeat);
}

View File

@ -0,0 +1,120 @@
package cn.iocoder.yudao.module.parking.service.heartbeat;
import cn.iocoder.yudao.module.parking.controller.admin.area.vo.AreaSaveReqVO;
import cn.iocoder.yudao.module.parking.controller.admin.park.vo.ParkSaveReqVO;
import cn.iocoder.yudao.module.parking.service.area.AreaService;
import cn.iocoder.yudao.module.parking.service.park.ParkService;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.parking.controller.admin.heartbeat.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.heartbeat.HeartbeatDO;
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.heartbeat.HeartbeatMapper;
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 HeartbeatServiceImpl implements HeartbeatService {
@Resource
private HeartbeatMapper heartbeatMapper;
@Resource
private ParkService parkService;
@Resource
private AreaService areaService;
@Override
public Long createHeartbeat(HeartbeatSaveReqVO createReqVO) {
// 插入
HeartbeatDO heartbeat = BeanUtils.toBean(createReqVO, HeartbeatDO.class);
heartbeatMapper.insert(heartbeat);
// 返回
return heartbeat.getId();
}
@Override
public void updateHeartbeat(HeartbeatSaveReqVO updateReqVO) {
// 校验存在
validateHeartbeatExists(updateReqVO.getId());
// 更新
HeartbeatDO updateObj = BeanUtils.toBean(updateReqVO, HeartbeatDO.class);
heartbeatMapper.updateById(updateObj);
}
@Override
public void deleteHeartbeat(Long id) {
// 校验存在
validateHeartbeatExists(id);
// 删除
heartbeatMapper.deleteById(id);
}
private void validateHeartbeatExists(Long id) {
if (heartbeatMapper.selectById(id) == null) {
throw exception(HEARTBEAT_NOT_EXISTS);
}
}
@Override
public HeartbeatDO getHeartbeat(Long id) {
return heartbeatMapper.selectById(id);
}
@Override
public PageResult<HeartbeatDO> getHeartbeatPage(HeartbeatPageReqVO pageReqVO) {
return heartbeatMapper.selectPage(pageReqVO);
}
@Override
@Transactional
public BlueCardResult doHeartbeat(HeartbeatReqDataVO blueCardHeartbeat) {
try {
ArrayList<AreaSaveReqVO> areaList = blueCardHeartbeat.getAreaList();
HeartbeatDO heartbeatDO = new HeartbeatDO();
heartbeatDO.setParkNumber(blueCardHeartbeat.getParkNumber());
heartbeatDO.setParkName(blueCardHeartbeat.getParkName());
heartbeatDO.setSpaceCount(blueCardHeartbeat.getSpaceCount());
heartbeatDO.setFreeSpaceCount(blueCardHeartbeat.getFreeSpaceCount());
heartbeatDO.setBookSpaceCount(blueCardHeartbeat.getBookSpaceCount());
heartbeatDO.setBookInParkCount(blueCardHeartbeat.getBookInParkCount());
heartbeatDO.setAreaList(areaList.toString());
// 写入心跳日志
heartbeatMapper.insert(heartbeatDO);
// 写入停车场信息
parkService.createOrUpdatePark(new ParkSaveReqVO(blueCardHeartbeat.getParkNumber(), blueCardHeartbeat.getParkName(), blueCardHeartbeat.getSpaceCount(), blueCardHeartbeat.getFreeSpaceCount(), blueCardHeartbeat.getBookSpaceCount(), blueCardHeartbeat.getBookInParkCount()));
if (!areaList.isEmpty()){
// 对区域都添加停车场库编号
areaList.forEach(item -> item.setParkNumber(blueCardHeartbeat.getParkNumber()));
// 写入区域信息
// TODO 判断重复及处理方式
areaService.createOrUpdateAreaBatch(areaList);
}
} catch (Exception e) {
// 手动设置回滚
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return BlueCardResult.error("数据写入失败:" + e.getMessage());
}
return BlueCardResult.success();
}
}

View File

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.parking.service.park;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.parking.controller.admin.park.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.park.ParkDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 场库列表 Service 接口
*
* @author 芋道源码
*/
public interface ParkService {
/**
* 创建场库列表
*
* @param createReqVO 创建信息
* @return 编号
*/
String createPark(@Valid ParkSaveReqVO createReqVO);
/**
* 创建或更新场库
* @param parkSaveReqVO
* @return java.lang.Boolean
*/
Boolean createOrUpdatePark(@Valid ParkSaveReqVO parkSaveReqVO);
/**
* 更新场库列表
*
* @param updateReqVO 更新信息
*/
void updatePark(@Valid ParkSaveReqVO updateReqVO);
/**
* 删除场库列表
*
* @param id 编号
*/
void deletePark(String id);
/**
* 获得场库列表
*
* @param id 编号
* @return 场库列表
*/
ParkDO getPark(String id);
/**
* 获得场库列表分页
*
* @param pageReqVO 分页查询
* @return 场库列表分页
*/
PageResult<ParkDO> getParkPage(ParkPageReqVO pageReqVO);
}

View File

@ -0,0 +1,79 @@
package cn.iocoder.yudao.module.parking.service.park;
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.park.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.park.ParkDO;
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.park.ParkMapper;
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 ParkServiceImpl implements ParkService {
@Resource
private ParkMapper parkMapper;
@Override
public String createPark(ParkSaveReqVO createReqVO) {
// 插入
ParkDO park = BeanUtils.toBean(createReqVO, ParkDO.class);
parkMapper.insert(park);
// 返回
return park.getParkNumber();
}
@Override
public Boolean createOrUpdatePark(ParkSaveReqVO parkSaveReqVO) {
return parkMapper.insertOrUpdate(BeanUtils.toBean(parkSaveReqVO, ParkDO.class));
}
@Override
public void updatePark(ParkSaveReqVO updateReqVO) {
// 校验存在
validateParkExists(updateReqVO.getParkNumber());
// 更新
ParkDO updateObj = BeanUtils.toBean(updateReqVO, ParkDO.class);
parkMapper.updateById(updateObj);
}
@Override
public void deletePark(String id) {
// 校验存在
validateParkExists(id);
// 删除
parkMapper.deleteById(id);
}
private void validateParkExists(String id) {
if (parkMapper.selectById(id) == null) {
throw exception(PARK_NOT_EXISTS);
}
}
@Override
public ParkDO getPark(String id) {
return parkMapper.selectById(id);
}
@Override
public PageResult<ParkDO> getParkPage(ParkPageReqVO pageReqVO) {
return parkMapper.selectPage(pageReqVO);
}
}

View File

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.parking.service.passageway;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.parking.controller.admin.passageway.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.passageway.PassagewayDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
/**
* 通道信息 Service 接口
*
* @author 芋道源码
*/
public interface PassagewayService {
/**
* 创建通道信息
*
* @param createReqVO 创建信息
* @return 编号
*/
String createPassageway(@Valid PassagewaySaveReqVO createReqVO);
/**
* 更新通道信息
*
* @param updateReqVO 更新信息
*/
void updatePassageway(@Valid PassagewaySaveReqVO updateReqVO);
/**
* 删除通道信息
*
* @param id 编号
*/
void deletePassageway(String id);
/**
* 获得通道信息
*
* @param id 编号
* @return 通道信息
*/
PassagewayDO getPassageway(String id);
/**
* 获得通道信息分页
*
* @param pageReqVO 分页查询
* @return 通道信息分页
*/
PageResult<PassagewayDO> getPassagewayPage(PassagewayPageReqVO pageReqVO);
/**
* 通道信息创建或更新
* @param passagewayReqDataVO
* @return cn.iocoder.yudao.module.parking.util.BlueCardResult
*/
BlueCardResult passagewayUpload(PassagewayReqDataVO passagewayReqDataVO);
}

View File

@ -0,0 +1,82 @@
package cn.iocoder.yudao.module.parking.service.passageway;
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
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.passageway.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.passageway.PassagewayDO;
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.passageway.PassagewayMapper;
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 PassagewayServiceImpl implements PassagewayService {
@Resource
private PassagewayMapper passagewayMapper;
@Override
public String createPassageway(PassagewaySaveReqVO createReqVO) {
// 插入
PassagewayDO passageway = BeanUtils.toBean(createReqVO, PassagewayDO.class);
passagewayMapper.insert(passageway);
// 返回
return passageway.getPassagewayId();
}
@Override
public void updatePassageway(PassagewaySaveReqVO updateReqVO) {
// 校验存在
validatePassagewayExists(updateReqVO.getPassagewayId());
// 更新
PassagewayDO updateObj = BeanUtils.toBean(updateReqVO, PassagewayDO.class);
passagewayMapper.updateById(updateObj);
}
@Override
public void deletePassageway(String id) {
// 校验存在
validatePassagewayExists(id);
// 删除
passagewayMapper.deleteById(id);
}
private void validatePassagewayExists(String id) {
if (passagewayMapper.selectById(id) == null) {
throw exception(PASSAGEWAY_NOT_EXISTS);
}
}
@Override
public PassagewayDO getPassageway(String id) {
return passagewayMapper.selectById(id);
}
@Override
public PageResult<PassagewayDO> getPassagewayPage(PassagewayPageReqVO pageReqVO) {
return passagewayMapper.selectPage(pageReqVO);
}
@Override
public BlueCardResult passagewayUpload(PassagewayReqDataVO passagewayReqDataVO) {
List<PassagewaySaveReqVO> passagewaySaveReqVOList = passagewayReqDataVO.getDatas();
// TODO 判断重复覆盖
return null;
}
}

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.area.AreaMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

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.heartbeat.HeartbeatMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

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.park.ParkMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

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.passageway.PassagewayMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>