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 dd42cfe28..d89111bf5 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 @@ -8,5 +8,12 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; public interface ErrorCodeConstants { // ========== 进出记录图片 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, "区域列表不存在"); } diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/area/AreaController.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/area/AreaController.java new file mode 100644 index 000000000..0b2f3fada --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/area/AreaController.java @@ -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 createArea(@Valid @RequestBody AreaSaveReqVO createReqVO) { + return success(areaService.createArea(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新区域列表") + @PreAuthorize("@ss.hasPermission('parking:area:update')") + public CommonResult 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 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 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> getAreaPage(@Valid AreaPageReqVO pageReqVO) { + PageResult 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 list = areaService.getAreaPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "区域列表.xls", "数据", AreaRespVO.class, + BeanUtils.toBean(list, AreaRespVO.class)); + } + +} \ 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/area/vo/AreaPageReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/area/vo/AreaPageReqVO.java new file mode 100644 index 000000000..a789186d3 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/area/vo/AreaPageReqVO.java @@ -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; + +} \ 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/area/vo/AreaRespVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/area/vo/AreaRespVO.java new file mode 100644 index 000000000..9a05c16ce --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/area/vo/AreaRespVO.java @@ -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; + +} \ 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/area/vo/AreaSaveReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/area/vo/AreaSaveReqVO.java new file mode 100644 index 000000000..d6be91c46 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/area/vo/AreaSaveReqVO.java @@ -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; + +} \ 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/heartbeat/HeartbeatController.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/heartbeat/HeartbeatController.java new file mode 100644 index 000000000..ac02b455e --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/heartbeat/HeartbeatController.java @@ -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 createHeartbeat(@Valid @RequestBody HeartbeatSaveReqVO createReqVO) { + return success(heartbeatService.createHeartbeat(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新心跳管理") + @PreAuthorize("@ss.hasPermission('parking:heartbeat:update')") + public CommonResult 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 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 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> getHeartbeatPage(@Valid HeartbeatPageReqVO pageReqVO) { + PageResult 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 list = heartbeatService.getHeartbeatPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "心跳管理.xls", "数据", HeartbeatRespVO.class, + BeanUtils.toBean(list, HeartbeatRespVO.class)); + } + +} \ 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/heartbeat/vo/HeartbeatPageReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/heartbeat/vo/HeartbeatPageReqVO.java new file mode 100644 index 000000000..21c6b3643 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/heartbeat/vo/HeartbeatPageReqVO.java @@ -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; + +} \ 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/heartbeat/vo/HeartbeatReqDataVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/heartbeat/vo/HeartbeatReqDataVO.java new file mode 100644 index 000000000..e6a6f10fe --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/heartbeat/vo/HeartbeatReqDataVO.java @@ -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 areaList; +} diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/heartbeat/vo/HeartbeatRespVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/heartbeat/vo/HeartbeatRespVO.java new file mode 100644 index 000000000..9a284fa37 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/heartbeat/vo/HeartbeatRespVO.java @@ -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; + +} \ 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/heartbeat/vo/HeartbeatSaveReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/heartbeat/vo/HeartbeatSaveReqVO.java new file mode 100644 index 000000000..6492c6ef8 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/heartbeat/vo/HeartbeatSaveReqVO.java @@ -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; + +} \ 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/park/ParkController.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/park/ParkController.java new file mode 100644 index 000000000..e8ac1ea77 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/park/ParkController.java @@ -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 createPark(@Valid @RequestBody ParkSaveReqVO createReqVO) { + return success(parkService.createPark(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新场库列表") + @PreAuthorize("@ss.hasPermission('parking:park:update')") + public CommonResult 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 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 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> getParkPage(@Valid ParkPageReqVO pageReqVO) { + PageResult 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 list = parkService.getParkPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "场库列表.xls", "数据", ParkRespVO.class, + BeanUtils.toBean(list, ParkRespVO.class)); + } + +} \ 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/park/vo/ParkPageReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/park/vo/ParkPageReqVO.java new file mode 100644 index 000000000..0bf45e4c9 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/park/vo/ParkPageReqVO.java @@ -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; + +} \ 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/park/vo/ParkRespVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/park/vo/ParkRespVO.java new file mode 100644 index 000000000..164f7ef95 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/park/vo/ParkRespVO.java @@ -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; + +} \ 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/park/vo/ParkSaveReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/park/vo/ParkSaveReqVO.java new file mode 100644 index 000000000..2f18e14f8 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/park/vo/ParkSaveReqVO.java @@ -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; + +} \ 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/passageway/PassagewayController.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/PassagewayController.java new file mode 100644 index 000000000..919ba6a10 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/PassagewayController.java @@ -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 createPassageway(@Valid @RequestBody PassagewaySaveReqVO createReqVO) { + return success(passagewayService.createPassageway(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新通道信息") + @PreAuthorize("@ss.hasPermission('parking:passageway:update')") + public CommonResult 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 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 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> getPassagewayPage(@Valid PassagewayPageReqVO pageReqVO) { + PageResult 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 list = passagewayService.getPassagewayPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "通道信息.xls", "数据", PassagewayRespVO.class, + BeanUtils.toBean(list, PassagewayRespVO.class)); + } + +} \ 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/passageway/vo/PassagewayPageReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayPageReqVO.java new file mode 100644 index 000000000..b9c284ede --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayPageReqVO.java @@ -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; + +} \ 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/passageway/vo/PassagewayReqDataVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayReqDataVO.java new file mode 100644 index 000000000..633ab7d04 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayReqDataVO.java @@ -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 datas; +} diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayRespVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayRespVO.java new file mode 100644 index 000000000..6fc934cf8 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayRespVO.java @@ -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; + +} \ 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/passageway/vo/PassagewaySaveReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewaySaveReqVO.java new file mode 100644 index 000000000..95988e110 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewaySaveReqVO.java @@ -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; + +} \ 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/dataobject/area/AreaDO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/area/AreaDO.java new file mode 100644 index 000000000..b33a71acc --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/area/AreaDO.java @@ -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") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 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; + +} \ 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/dataobject/heartbeat/HeartbeatDO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/heartbeat/HeartbeatDO.java new file mode 100644 index 000000000..299eeec61 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/heartbeat/HeartbeatDO.java @@ -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") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 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; + +} \ 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/dataobject/park/ParkDO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/park/ParkDO.java new file mode 100644 index 000000000..e76f8bdc3 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/park/ParkDO.java @@ -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") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 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; + +} \ 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/dataobject/passageway/PassagewayDO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/passageway/PassagewayDO.java new file mode 100644 index 000000000..495b09cd5 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/passageway/PassagewayDO.java @@ -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") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 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; + +} \ 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/area/AreaMapper.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/area/AreaMapper.java new file mode 100644 index 000000000..ef506e92a --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/area/AreaMapper.java @@ -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 { + + default PageResult selectPage(AreaPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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)); + } + +} \ 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/heartbeat/HeartbeatMapper.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/heartbeat/HeartbeatMapper.java new file mode 100644 index 000000000..6dc133ba7 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/heartbeat/HeartbeatMapper.java @@ -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 { + + default PageResult selectPage(HeartbeatPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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)); + } + +} \ 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/park/ParkMapper.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/park/ParkMapper.java new file mode 100644 index 000000000..e290e6bdc --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/park/ParkMapper.java @@ -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 { + + default PageResult selectPage(ParkPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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)); + } + +} \ 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/passageway/PassagewayMapper.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/passageway/PassagewayMapper.java new file mode 100644 index 000000000..e58ac1ea3 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/passageway/PassagewayMapper.java @@ -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 { + + default PageResult selectPage(PassagewayPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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)); + } + +} \ 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/area/AreaService.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/area/AreaService.java new file mode 100644 index 000000000..355dc4239 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/area/AreaService.java @@ -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 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 getAreaPage(AreaPageReqVO pageReqVO); + + /** + * 创建或更新区域(批量) + * @param areaList + * @return java.lang.Boolean + */ + Boolean createOrUpdateAreaBatch(ArrayList areaList); +} \ 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/area/AreaServiceImpl.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/area/AreaServiceImpl.java new file mode 100644 index 000000000..fd93f4aa3 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/area/AreaServiceImpl.java @@ -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 areaSaveReqVOList) { + // 插入 + List 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 getAreaPage(AreaPageReqVO pageReqVO) { + return areaMapper.selectPage(pageReqVO); + } + + @Override + public Boolean createOrUpdateAreaBatch(ArrayList areaList) { + return areaMapper.insertOrUpdateBatch(BeanUtils.toBean(areaList, AreaDO.class)); + } + +} \ 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/heartbeat/HeartbeatService.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/heartbeat/HeartbeatService.java new file mode 100644 index 000000000..cd9190dba --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/heartbeat/HeartbeatService.java @@ -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 getHeartbeatPage(HeartbeatPageReqVO pageReqVO); + + /** + * 接收并解析心跳数据 + * @param blueCardHeartbeat + * @return cn.iocoder.yudao.module.parking.util.BlueCardResult + */ + BlueCardResult doHeartbeat(HeartbeatReqDataVO blueCardHeartbeat); +} \ 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/heartbeat/HeartbeatServiceImpl.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/heartbeat/HeartbeatServiceImpl.java new file mode 100644 index 000000000..de337778d --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/heartbeat/HeartbeatServiceImpl.java @@ -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 getHeartbeatPage(HeartbeatPageReqVO pageReqVO) { + return heartbeatMapper.selectPage(pageReqVO); + } + + @Override + @Transactional + public BlueCardResult doHeartbeat(HeartbeatReqDataVO blueCardHeartbeat) { + try { + ArrayList 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(); + } + +} \ 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/park/ParkService.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/park/ParkService.java new file mode 100644 index 000000000..17d7424db --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/park/ParkService.java @@ -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 getParkPage(ParkPageReqVO 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/park/ParkServiceImpl.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/park/ParkServiceImpl.java new file mode 100644 index 000000000..64ee70e78 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/park/ParkServiceImpl.java @@ -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 getParkPage(ParkPageReqVO pageReqVO) { + return parkMapper.selectPage(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/passageway/PassagewayService.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/passageway/PassagewayService.java new file mode 100644 index 000000000..ea3bd10f4 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/passageway/PassagewayService.java @@ -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 getPassagewayPage(PassagewayPageReqVO pageReqVO); + + /** + * 通道信息创建或更新 + * @param passagewayReqDataVO + * @return cn.iocoder.yudao.module.parking.util.BlueCardResult + */ + BlueCardResult passagewayUpload(PassagewayReqDataVO passagewayReqDataVO); +} \ 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/passageway/PassagewayServiceImpl.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/passageway/PassagewayServiceImpl.java new file mode 100644 index 000000000..5da9e3eb9 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/passageway/PassagewayServiceImpl.java @@ -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 getPassagewayPage(PassagewayPageReqVO pageReqVO) { + return passagewayMapper.selectPage(pageReqVO); + } + + @Override + public BlueCardResult passagewayUpload(PassagewayReqDataVO passagewayReqDataVO) { + List passagewaySaveReqVOList = passagewayReqDataVO.getDatas(); + // TODO 判断重复覆盖 + return null; + } + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/area/AreaMapper.xml b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/area/AreaMapper.xml new file mode 100644 index 000000000..2ef761ea2 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/area/AreaMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/heartbeat/HeartbeatMapper.xml b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/heartbeat/HeartbeatMapper.xml new file mode 100644 index 000000000..273e4fb0d --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/heartbeat/HeartbeatMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/park/ParkMapper.xml b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/park/ParkMapper.xml new file mode 100644 index 000000000..892526104 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/park/ParkMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/passageway/PassagewayMapper.xml b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/passageway/PassagewayMapper.xml new file mode 100644 index 000000000..08edff42f --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/passageway/PassagewayMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file