用户端根据车辆编号获取寻车铃

This commit is contained in:
yanglei 2026-01-27 11:20:30 +08:00
parent db726fe6af
commit c6de23b3fb
5 changed files with 92 additions and 12 deletions

View File

@ -148,4 +148,13 @@ public interface OperationsFeignClient {
*/
@GetMapping("/ebikeRefundReview/api/getRefundReviewByOrderId")
JsonResult<FeignEbikeRefundReviewVo> getRefundReviewByOrderId(@RequestParam("orderId") Long orderId);
/**
* 根据车辆编号获取寻车铃
*
* @param bikeCode 车辆编号
* @return true 成功 false 失败
*/
@GetMapping("/ebikeEcuInfo/api/findBikeByBikeCode")
JsonResult<?> findBikeByBikeCode(@RequestParam("bikeCode") String bikeCode);
}

View File

@ -13,7 +13,12 @@ import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
@ -178,6 +183,7 @@ public class EbikeEcuInfoController {
/**
* 上传远程升级文件
*
* @param file 文件
* @return 操作结果
*/
@ -187,4 +193,16 @@ public class EbikeEcuInfoController {
return JsonResult.success(Message.SUCCESS, result);
}
/**
* 用户端调用 根据车辆编号查询寻车铃
*
* @param bikeCode 车辆编号
* @return true 成功 false 失败
*/
@GetMapping("/api/findBikeByBikeCode")
public JsonResult<?> findBikeByBikeCode(@RequestParam("bikeCode") String bikeCode) {
boolean result = ebikeEcuInfoService.findBikeByBikeCode(bikeCode);
return JsonResult.success(result);
}
}

View File

@ -145,4 +145,11 @@ public interface EbikeEcuInfoService extends IService<EbikeEcuInfo> {
* @return 操作结果
*/
boolean upgrade(EbikeEcuUpgradeVo upgradeVoe);
/**
* 根据车辆编号查询寻车铃
*
* @param bikeCode 车辆编号
*/
boolean findBikeByBikeCode(String bikeCode);
}

View File

@ -27,6 +27,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import static com.cdzy.operations.model.entity.table.EbikeBikeInfoTableDef.EBIKE_BIKE_INFO;
@ -223,6 +224,19 @@ public class EbikeEcuInfoServiceImpl extends ServiceImpl<EbikeEcuInfoMapper, Ebi
}
}
@Override
public boolean findBikeByBikeCode(String bikeCode) {
QueryWrapper queryWrapper = QueryWrapper.create()
.select(EBIKE_ECU_INFO.ALL_COLUMNS)
.leftJoin(EBIKE_BIKE_INFO).on(EBIKE_ECU_INFO.ECU_ID.eq(EBIKE_BIKE_INFO.ECU_ID))
.where(EBIKE_BIKE_INFO.BIKE_CODE.eq(bikeCode));
EbikeEcuInfo ebikeEcuInfo = this.mapper.selectOneByQuery(queryWrapper);
if (Objects.isNull(ebikeEcuInfo)) {
throw new EbikeException("根据车辆编号获取车辆中控信息失败");
}
return commandService.findBike(ebikeEcuInfo);
}
public boolean upgradeAudio(EbikeEcuInfo ebikeEcuInfo, String url, Integer idx, Boolean fullUpgrade) {
return commandService.upgradeAudio(ebikeEcuInfo, url, idx, fullUpgrade);
}

View File

@ -0,0 +1,32 @@
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;
@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());
}
}