diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bookcar/BookCarController.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bookcar/BookCarController.java index 5335f3298..34bb25a8d 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bookcar/BookCarController.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bookcar/BookCarController.java @@ -38,6 +38,20 @@ public class BookCarController { @Resource private BookCarService bookCarService; + @PostMapping("/sendBookingCar") + @Operation(summary = "预约车下发") + @PreAuthorize("@ss.hasPermission('parking:book-car:create')") + public CommonResult sendBookingCar(@RequestBody BookCarReqDataVO bookCarReqDataVO){ + return success(bookCarService.sendBookingCar(bookCarReqDataVO)); + } + @PostMapping("/queryBookingCar") + @Operation(summary = "预约车查询") + @PreAuthorize("@ss.hasPermission('parking:book-car:query')") + public CommonResult queryBookingCar(@RequestBody BookCarQueryDataVO bookCarQueryDataVO){ + return success(bookCarService.queryBookingCar(bookCarQueryDataVO)); + } + + @PostMapping("/create") @Operation(summary = "创建预约车") @PreAuthorize("@ss.hasPermission('parking:book-car:create')") diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bookcar/vo/BookCarQueryDataVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bookcar/vo/BookCarQueryDataVO.java new file mode 100644 index 000000000..794f6a6c8 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bookcar/vo/BookCarQueryDataVO.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.module.parking.controller.admin.bookcar.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 预约车查询 Request VO") +@Data +public class BookCarQueryDataVO { + @Schema(description = "场库编号") + private String parkNumber; + @Schema(description = "车牌列表") + private BookCarRespVO datas; +} diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bookcar/vo/BookCarQueryVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bookcar/vo/BookCarQueryVO.java new file mode 100644 index 000000000..25e6915ad --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bookcar/vo/BookCarQueryVO.java @@ -0,0 +1,17 @@ +package cn.iocoder.yudao.module.parking.controller.admin.bookcar.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +@Schema(description = "管理后台 - 预约车查询 Request VO") +@Data +public class BookCarQueryVO { + @Schema(description = "车牌列表") + private List plateList; + @Schema(description = "开始时间") + private String start; + @Schema(description = "结束时间") + private String end; +} diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bookcar/vo/BookCarReqDataVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bookcar/vo/BookCarReqDataVO.java new file mode 100644 index 000000000..343831435 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bookcar/vo/BookCarReqDataVO.java @@ -0,0 +1,15 @@ +package cn.iocoder.yudao.module.parking.controller.admin.bookcar.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +@Schema(description = "管理后台 - 预约车下发 Request VO") +@Data +public class BookCarReqDataVO { + @Schema(description = "场库编号") + private String parkNumber; + @Schema(description = "预约数据") + private List datas; +} diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/bookcar/BookCarService.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/bookcar/BookCarService.java index 2e0afb5d2..ae89afc17 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/bookcar/BookCarService.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/bookcar/BookCarService.java @@ -52,4 +52,17 @@ public interface BookCarService { */ PageResult getBookCarPage(BookCarPageReqVO pageReqVO); + /** + * 预约车下发和记录 + * @param bookCarReqDataVO + * @return java.lang.String + */ + String sendBookingCar(BookCarReqDataVO bookCarReqDataVO); + + /** + * 预约车查询和记录 + * @param bookCarQueryDataVO + * @return java.lang.Object + */ + String queryBookingCar(BookCarQueryDataVO bookCarQueryDataVO); } \ 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/bookcar/BookCarServiceImpl.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/bookcar/BookCarServiceImpl.java index a2f345084..3c8028448 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/bookcar/BookCarServiceImpl.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/bookcar/BookCarServiceImpl.java @@ -1,11 +1,19 @@ package cn.iocoder.yudao.module.parking.service.bookcar; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.parking.util.BlueCarRequestUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + import javax.annotation.Resource; + import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; import java.util.*; + import cn.iocoder.yudao.module.parking.controller.admin.bookcar.vo.*; import cn.iocoder.yudao.module.parking.dal.dataobject.bookcar.BookCarDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -28,6 +36,8 @@ public class BookCarServiceImpl implements BookCarService { @Resource private BookCarMapper bookCarMapper; + @Resource + private BlueCarRequestUtil blueCarRequestUtil; @Override public Long createBookCar(BookCarSaveReqVO createReqVO) { @@ -71,4 +81,29 @@ public class BookCarServiceImpl implements BookCarService { return bookCarMapper.selectPage(pageReqVO); } + @Override + public String sendBookingCar(BookCarReqDataVO bookCarReqDataVO) { + CommonResult result = blueCarRequestUtil.doBlueCarPost(bookCarReqDataVO, "out/synBookingCa"); + if (result.getCode() == 0) { + List datas = bookCarReqDataVO.getDatas(); + for (BookCarSaveReqVO data : datas) { + data.setParkNumber(bookCarReqDataVO.getParkNumber()); + } + bookCarMapper.insertBatch(BeanUtils.toBean(datas, BookCarDO.class)); + return "success"; + } + return "error"; + } + + @Override + public String queryBookingCar(BookCarQueryDataVO bookCarQueryDataVO) { + CommonResult result = blueCarRequestUtil.doBlueCarPost(bookCarQueryDataVO, "out/queryBookingCar"); + if (result.getCode() == 0){ + Object object = JSON.parse(result.getData()); + // TODO 保存操作,暂时没想好 + return "success"; + } + return "error"; + } + } \ No newline at end of file