55 lines
1.8 KiB
Java
55 lines
1.8 KiB
Java
package com.cdzy.user.controller;
|
|
|
|
import com.cdzy.common.enums.Code;
|
|
import com.cdzy.common.ex.EbikeException;
|
|
import com.cdzy.common.model.response.JsonResult;
|
|
import com.ebike.feign.clients.OperationsFeignClient;
|
|
import jakarta.annotation.Resource;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
/**
|
|
* 用户端车辆基本信息 控制层
|
|
*
|
|
* @author yanglei
|
|
* @since 2026-01-27 10:52
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/ebikeBikeInfo")
|
|
public class EbikeBikeInfoController {
|
|
|
|
@Resource
|
|
private OperationsFeignClient operationsFeignClient;
|
|
|
|
/**
|
|
* 根据车辆编码获取寻车铃
|
|
*
|
|
* @param bikeCode 车辆编码
|
|
* @return true 成功 false 失败
|
|
*/
|
|
@GetMapping("/findBikeByBikeCode")
|
|
public JsonResult<?> findBikeByBikeCode(@RequestParam("bikeCode") String bikeCode) {
|
|
JsonResult<?> jsonResult = operationsFeignClient.findBikeByBikeCode(bikeCode);
|
|
if (jsonResult.getCode() != Code.SUCCESS) {
|
|
throw new EbikeException(jsonResult.getMessage());
|
|
}
|
|
return JsonResult.success(jsonResult.getData());
|
|
}
|
|
|
|
/**
|
|
* 根据车辆编号获取所属运营区的所有站点
|
|
* @param bikeCode 车辆编号
|
|
* @return 站点列表
|
|
*/
|
|
@GetMapping("/getAllSiteByBikeCode")
|
|
public JsonResult<?> getAllSiteByBikeCode(@RequestParam("bikeCode") String bikeCode) {
|
|
JsonResult<?> jsonResult = operationsFeignClient.getAllSiteByBikeCode(bikeCode);
|
|
if (jsonResult.getCode() != Code.SUCCESS) {
|
|
throw new EbikeException(jsonResult.getMessage());
|
|
}
|
|
return JsonResult.success(jsonResult.getData());
|
|
}
|
|
}
|