2025-11-11 17:31:14 +08:00

139 lines
3.8 KiB
Java

package com.cdzy.operations.controller;
import com.cdzy.common.model.request.PageParam;
import com.cdzy.common.model.response.JsonResult;
import com.cdzy.operations.model.dto.EbikeBikeInfoDto;
import com.cdzy.operations.model.dto.EbikeDto;
import com.cdzy.operations.model.dto.EbikeUserBikeInfo;
import com.cdzy.operations.model.dto.EbikeUserLockDto;
import com.cdzy.operations.model.vo.EbikeBatchLaunchVo;
import com.cdzy.operations.model.vo.EbikeBatchUnLaunchVo;
import com.cdzy.operations.model.vo.EbikeBikeBindVo;
import com.cdzy.operations.model.vo.EbikeBikeRadiusVo;
import com.cdzy.operations.service.EbikeBikeInfoService;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 车辆基本信息 控制层。
*
* @author attiya
* @since 2025-10-17
*/
@Validated
@RestController
@RequestMapping("/ebikeBikeInfo")
public class EbikeBikeInfoController {
@Resource
private EbikeBikeInfoService ebikeBikeInfoService;
/**
* 整车绑定
*
* @param bindVo 绑定信息
* @return 绑定结果
*/
@PostMapping("bind")
public JsonResult<?> bind(@Validated @RequestBody EbikeBikeBindVo bindVo) {
ebikeBikeInfoService.bind(bindVo);
return JsonResult.success();
}
/**
* 未上架车辆分页查询
*
* @param pageParam 分页参数
* @return 结果
*/
@GetMapping("unLaunchPage")
public JsonResult<?> unLaunchPage(PageParam pageParam) {
Page<EbikeBikeInfoDto> page = ebikeBikeInfoService.unLaunchPage(pageParam);
return JsonResult.success(page);
}
/**
* 上架车辆分页查询
*
* @param pageParam 分页参数
* @return 结果
*/
@GetMapping("launchPage")
public JsonResult<?> launchPage(PageParam pageParam) {
Page<EbikeBikeInfoDto> page = ebikeBikeInfoService.launchPage(pageParam);
return JsonResult.success(page);
}
/**
* 批量上架
*
* @return 结果
*/
@PostMapping("batchLaunch")
public JsonResult<?> batchLaunch(@Validated @RequestBody EbikeBatchLaunchVo launchVo) {
ebikeBikeInfoService.batchLaunch(launchVo);
return JsonResult.success();
}
/**
* 批量下架
*
* @return 结果
*/
@PostMapping("batchUnLaunch")
public JsonResult<?> batchUnLaunch(@Validated @RequestBody EbikeBatchUnLaunchVo launchVo) {
ebikeBikeInfoService.batchUnLaunch(launchVo);
return JsonResult.success();
}
/**
* 用户半径范围内车辆
*
* @return 结果
*/
@PostMapping("/api/userRadiusList")
public JsonResult<?> userRadiusList(@Validated @RequestBody EbikeBikeRadiusVo radiusVo) {
List<EbikeDto> list = ebikeBikeInfoService.userRadiusList(radiusVo);
return JsonResult.success(list);
}
/**
* 用户开锁
*
* @return 结果
*/
@GetMapping("/api/openLock")
public JsonResult<?> openLock(@RequestParam("bikeCode") String bikeCode) {
ebikeBikeInfoService.openLock(bikeCode);
return JsonResult.success();
}
/**
* 用户关锁
*
* @return 结果
*/
@GetMapping("/api/lock")
public JsonResult<?> lock(@RequestParam("bikeCode") String bikeCode) {
EbikeUserLockDto result = ebikeBikeInfoService.lock(bikeCode);
return JsonResult.success(result);
}
/**
* 用户获取车辆详情
*
* @return 结果
*/
@GetMapping("/api/bikeInfo")
public JsonResult<?> bikeInfo(@RequestParam("bikeCode") String bikeCode) {
EbikeUserBikeInfo info = ebikeBikeInfoService.bikeInfo(bikeCode);
return JsonResult.success(info);
}
}