预约车

This commit is contained in:
XinWei 2024-08-29 09:05:41 +08:00
parent 1dc70860a6
commit b209a002fb
6 changed files with 107 additions and 0 deletions

View File

@ -38,6 +38,20 @@ public class BookCarController {
@Resource
private BookCarService bookCarService;
@PostMapping("/sendBookingCar")
@Operation(summary = "预约车下发")
@PreAuthorize("@ss.hasPermission('parking:book-car:create')")
public CommonResult<String> sendBookingCar(@RequestBody BookCarReqDataVO bookCarReqDataVO){
return success(bookCarService.sendBookingCar(bookCarReqDataVO));
}
@PostMapping("/queryBookingCar")
@Operation(summary = "预约车查询")
@PreAuthorize("@ss.hasPermission('parking:book-car:query')")
public CommonResult<String> queryBookingCar(@RequestBody BookCarQueryDataVO bookCarQueryDataVO){
return success(bookCarService.queryBookingCar(bookCarQueryDataVO));
}
@PostMapping("/create")
@Operation(summary = "创建预约车")
@PreAuthorize("@ss.hasPermission('parking:book-car:create')")

View File

@ -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;
}

View File

@ -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<String> plateList;
@Schema(description = "开始时间")
private String start;
@Schema(description = "结束时间")
private String end;
}

View File

@ -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<BookCarSaveReqVO> datas;
}

View File

@ -52,4 +52,17 @@ public interface BookCarService {
*/
PageResult<BookCarDO> getBookCarPage(BookCarPageReqVO pageReqVO);
/**
* 预约车下发和记录
* @param bookCarReqDataVO
* @return java.lang.String
*/
String sendBookingCar(BookCarReqDataVO bookCarReqDataVO);
/**
* 预约车查询和记录
* @param bookCarQueryDataVO
* @return java.lang.Object
*/
String queryBookingCar(BookCarQueryDataVO bookCarQueryDataVO);
}

View File

@ -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<String> result = blueCarRequestUtil.doBlueCarPost(bookCarReqDataVO, "out/synBookingCa");
if (result.getCode() == 0) {
List<BookCarSaveReqVO> 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<String> result = blueCarRequestUtil.doBlueCarPost(bookCarQueryDataVO, "out/queryBookingCar");
if (result.getCode() == 0){
Object object = JSON.parse(result.getData());
// TODO 保存操作暂时没想好
return "success";
}
return "error";
}
}