骑行状态
This commit is contained in:
parent
e09711e844
commit
7a4fe2272b
@ -135,4 +135,20 @@ public interface MaintenanceFeignClient {
|
||||
*/
|
||||
@PostMapping("ebikeBikeInfo/checkEcuSn")
|
||||
JsonResult<List<String>> checkEcuSnWithBikeInOperate(@RequestBody EcuSnDto ecuSnDto);
|
||||
|
||||
/**
|
||||
* 根据车辆id将其设置为骑行中状态
|
||||
* @param bikeId 车辆id
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("ebikeBikeInfo/riding")
|
||||
JsonResult<?> riding(String bikeId);
|
||||
|
||||
/**
|
||||
* 根据车辆id将车辆设置为待使用状态
|
||||
* @param bikeId 车辆id
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("ebikeBikeInfo/used")
|
||||
JsonResult<?> used(String bikeId);
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import com.ebike.feign.model.rsp.EbikeBikeBaseInfo;
|
||||
import com.ebike.feign.model.rsp.RspBikeInfo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.core.update.UpdateChain;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@ -879,4 +880,32 @@ public class EbikeBikeInfoController {
|
||||
List<String> list = ebikeBikeInfoService.checkEcuSn(ecuSnDto);
|
||||
return JsonResult.success(list);
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据车辆id将车辆设置为骑行中状态
|
||||
* @param bikeId 车辆id
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("riding")
|
||||
JsonResult<?> riding(@RequestParam("bikeId")String bikeId){
|
||||
UpdateChain.of(EbikeBikeInfo.class)
|
||||
.set(EbikeBikeInfo::getState, "3")
|
||||
.where(EbikeBikeInfo::getBikeId).eq(bikeId)
|
||||
.update();
|
||||
return JsonResult.success();
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据车辆id将车辆设置为待使用状态
|
||||
* @param bikeId 车辆id
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("used")
|
||||
JsonResult<?> used(@RequestParam("bikeId")String bikeId){
|
||||
UpdateChain.of(EbikeBikeInfo.class)
|
||||
.set(EbikeBikeInfo::getState, "2")
|
||||
.where(EbikeBikeInfo::getBikeId).eq(bikeId)
|
||||
.update();
|
||||
return JsonResult.success();
|
||||
};
|
||||
}
|
||||
|
||||
@ -94,13 +94,13 @@ public class UserOrdersServiceImpl extends ServiceImpl<UserOrdersMapper, EbikeUs
|
||||
throw new RuntimeException("获取车辆信息失败");
|
||||
}
|
||||
FeignEbikeBikeInfoDto bikeInfoDto = jsonResult.getData();
|
||||
// TODO:判断车辆状态
|
||||
// if (bikeInfoDto.getUsageStatus() == 1) {
|
||||
// throw new RuntimeException("车辆使用中");
|
||||
// }
|
||||
// if (bikeInfoDto.getUsageStatus() == 1) {
|
||||
// throw new RuntimeException("车辆故障,暂不可用");
|
||||
// }
|
||||
// 判断车辆状态
|
||||
if ("3".equals(bikeInfoDto.getState())) {
|
||||
throw new RuntimeException("车辆使用中");
|
||||
}
|
||||
if ("4".equals(bikeInfoDto.getState())) {
|
||||
throw new RuntimeException("车辆故障,暂不可用");
|
||||
}
|
||||
FeignEbikeEcuInfo ecuInfo = bikeInfoDto.getEbikeEcuInfo();
|
||||
JsonResult<FeignEbikeRegionDto> operationResult = operateFeignClient.getOperationById(bikeInfoDto.getReginId());
|
||||
if (operationResult.getCode() != Code.SUCCESS) {
|
||||
@ -127,7 +127,8 @@ public class UserOrdersServiceImpl extends ServiceImpl<UserOrdersMapper, EbikeUs
|
||||
//添加借车单量
|
||||
Long siteRegionId = redisUtil.isPointInSiteWithSiteRegionId(resGpsDto.getLongitude(), resGpsDto.getLatitude(), regionDto.getOperationRegionId());
|
||||
operateFeignClient.addBorrowing(siteRegionId);
|
||||
//TODO:改变骑行状态-骑行中
|
||||
//改变骑行状态-骑行中
|
||||
maintenanceFeignClient.riding(bikeInfoDto.getBikeId());
|
||||
userOrders.setBikeId(bikeInfoDto.getBikeId());
|
||||
String stringBuilder = resGpsDto.getLongitude() + "," + resGpsDto.getLatitude();
|
||||
userOrders.setRidePoint(stringBuilder);
|
||||
@ -183,7 +184,8 @@ public class UserOrdersServiceImpl extends ServiceImpl<UserOrdersMapper, EbikeUs
|
||||
//添加还车单量
|
||||
Long siteRegionId = redisUtil.isPointInSiteWithSiteRegionId(resGpsDto.getLongitude(), resGpsDto.getLatitude(), regionDto.getOperationRegionId());
|
||||
operateFeignClient.addReturn(siteRegionId);
|
||||
//TODO:改变骑行状态-待使用
|
||||
//改变骑行状态-待使用
|
||||
maintenanceFeignClient.used(bikeInfoDto.getBikeId());
|
||||
return userOrders.getOrderId();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user