用户端根据车辆编号获取寻车铃
This commit is contained in:
parent
db726fe6af
commit
c6de23b3fb
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -41,8 +46,8 @@ public class EbikeEcuInfoController {
|
||||
*/
|
||||
@PostMapping("save")
|
||||
public JsonResult<?> saveEcu(@Validated @RequestBody EbikeEcuInfoVo ebikeEcuInfo) {
|
||||
ebikeEcuInfoService.saveEcu(ebikeEcuInfo);
|
||||
return JsonResult.success();
|
||||
ebikeEcuInfoService.saveEcu(ebikeEcuInfo);
|
||||
return JsonResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,7 +69,7 @@ public class EbikeEcuInfoController {
|
||||
* @return {@code true} 删除成功,{@code false} 删除失败
|
||||
*/
|
||||
@GetMapping("remove")
|
||||
public JsonResult<?> remove(@RequestParam("ecuId") Long ecuId) {
|
||||
public JsonResult<?> remove(@RequestParam("ecuId") Long ecuId) {
|
||||
ebikeEcuInfoService.removeById(ecuId);
|
||||
return JsonResult.success();
|
||||
}
|
||||
@ -136,8 +141,8 @@ public class EbikeEcuInfoController {
|
||||
* @return 执行结构
|
||||
*/
|
||||
@GetMapping("checkSnOrBikeCode")
|
||||
public JsonResult<?> checkSnOrBikeCode(String ecuSn,String bikeCode) {
|
||||
boolean result = ebikeEcuInfoService.checkSnOrBikeCode(ecuSn,bikeCode);
|
||||
public JsonResult<?> checkSnOrBikeCode(String ecuSn, String bikeCode) {
|
||||
boolean result = ebikeEcuInfoService.checkSnOrBikeCode(ecuSn, bikeCode);
|
||||
return JsonResult.success(result);
|
||||
}
|
||||
|
||||
@ -148,8 +153,8 @@ public class EbikeEcuInfoController {
|
||||
* @return 执行结构
|
||||
*/
|
||||
@GetMapping("online")
|
||||
public JsonResult<?> online(String ecuSn,String bikeCode) throws IOException {
|
||||
boolean online = ebikeEcuInfoService.online(ecuSn,bikeCode);
|
||||
public JsonResult<?> online(String ecuSn, String bikeCode) throws IOException {
|
||||
boolean online = ebikeEcuInfoService.online(ecuSn, bikeCode);
|
||||
return JsonResult.success(online);
|
||||
}
|
||||
|
||||
@ -160,8 +165,8 @@ public class EbikeEcuInfoController {
|
||||
* @return 执行结构
|
||||
*/
|
||||
@GetMapping("executeCommand")
|
||||
public JsonResult<?> executeCommand(String ecuSn,String bikeCode,@NotNull(message = "命令编码不能为空") String commandCode) {
|
||||
boolean result = ebikeEcuInfoService.executeCommand(ecuSn,bikeCode,commandCode,null);
|
||||
public JsonResult<?> executeCommand(String ecuSn, String bikeCode, @NotNull(message = "命令编码不能为空") String commandCode) {
|
||||
boolean result = ebikeEcuInfoService.executeCommand(ecuSn, bikeCode, commandCode, null);
|
||||
return JsonResult.success(result);
|
||||
}
|
||||
|
||||
@ -178,13 +183,26 @@ public class EbikeEcuInfoController {
|
||||
|
||||
/**
|
||||
* 上传远程升级文件
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping("upload")
|
||||
public JsonResult<?> upload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
String result = ebikeEcuInfoService.upload(file);
|
||||
return JsonResult.success(Message.SUCCESS,result);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,4 +145,11 @@ public interface EbikeEcuInfoService extends IService<EbikeEcuInfo> {
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean upgrade(EbikeEcuUpgradeVo upgradeVoe);
|
||||
|
||||
/**
|
||||
* 根据车辆编号查询寻车铃
|
||||
*
|
||||
* @param bikeCode 车辆编号
|
||||
*/
|
||||
boolean findBikeByBikeCode(String bikeCode);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user