Compare commits
No commits in common. "46c1445737a1e7d1a0a7b26ed5e764dd64608a31" and "86affc44370233bf923dce50b80dcd3c8d24e016" have entirely different histories.
46c1445737
...
86affc4437
@ -106,30 +106,6 @@ public class EbikeUserOrdersController {
|
|||||||
return JsonResult.success(orderId);
|
return JsonResult.success(orderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查车辆是否在运营区内。
|
|
||||||
*
|
|
||||||
* @param bikeCode 车辆编号
|
|
||||||
* @ {@code 200} 添加成功,{@code 500} 添加失败
|
|
||||||
*/
|
|
||||||
@GetMapping("checkBikeInOperation")
|
|
||||||
public JsonResult<?> checkBikeInOperation(@RequestParam("bikeCode")String bikeCode) {
|
|
||||||
boolean inOperation = userOrdersService.checkBikeInOperation(bikeCode);
|
|
||||||
return JsonResult.success(inOperation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查车辆是否在停车区内。
|
|
||||||
*
|
|
||||||
* @param bikeCode 车辆编号
|
|
||||||
* @ {@code 200} 添加成功,{@code 500} 添加失败
|
|
||||||
*/
|
|
||||||
@GetMapping("checkBikeInParking")
|
|
||||||
public JsonResult<?> checkBikeInParking(@RequestParam("bikeCode")String bikeCode) {
|
|
||||||
boolean inParking = userOrdersService.checkBikeInParking(bikeCode);
|
|
||||||
return JsonResult.success(inParking);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户订单表主键获取详细信。
|
* 根据用户订单表主键获取详细信。
|
||||||
|
|||||||
@ -58,18 +58,4 @@ public interface UserOrdersService extends IService<UserOrders> {
|
|||||||
* @param orderDto 订单信息
|
* @param orderDto 订单信息
|
||||||
*/
|
*/
|
||||||
void continueCycling(ReqOrderDto orderDto);
|
void continueCycling(ReqOrderDto orderDto);
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断车辆当前位置是否在运营区内
|
|
||||||
* @param bikeCode 车辆编号
|
|
||||||
* @return true/false
|
|
||||||
*/
|
|
||||||
boolean checkBikeInOperation(String bikeCode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断车辆当前位置是否在停车区内
|
|
||||||
* @param bikeCode 车辆编号
|
|
||||||
* @return true/false
|
|
||||||
*/
|
|
||||||
boolean checkBikeInParking(String bikeCode);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -238,42 +238,6 @@ public class UserOrdersServiceImpl extends ServiceImpl<UserOrdersMapper, UserOrd
|
|||||||
userOrdersMapper.update(userOrders);
|
userOrdersMapper.update(userOrders);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkBikeInOperation(String bikeCode) {
|
|
||||||
JsonResult<FeignEbikeBikeInfoDto> jsonResult = maintenanceFeignClient.getEbikeInfoByCode(bikeCode);
|
|
||||||
if (jsonResult.getCode() != Code.SUCCESS) {
|
|
||||||
throw new RuntimeException("获取车辆信息失败");
|
|
||||||
}
|
|
||||||
FeignEbikeBikeInfoDto bikeInfoDto = jsonResult.getData();
|
|
||||||
FeignEbikeEcuInfo ecuInfo = bikeInfoDto.getEbikeEcuInfo();
|
|
||||||
JsonResult<FeignEbikeRegionDto> regionResult = operateFeignClient.getOperationById(bikeInfoDto.getReginId());
|
|
||||||
if (regionResult.getCode() != Code.SUCCESS) {
|
|
||||||
throw new RuntimeException("获取运营区信息失败");
|
|
||||||
}
|
|
||||||
FeignEbikeRegionDto regionDto = regionResult.getData();
|
|
||||||
String jsonString = JSONObject.toJSONString(redisUtil.get(ecuInfo.getEcuSn()));
|
|
||||||
ResGPSDto resGpsDto = JSONObject.parseObject(jsonString, ResGPSDto.class);
|
|
||||||
return bikeInOperation(resGpsDto.getLongitude(),resGpsDto.getLatitude(),regionDto.getOrgId(),bikeInfoDto.getReginId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkBikeInParking(String bikeCode) {
|
|
||||||
JsonResult<FeignEbikeBikeInfoDto> jsonResult = maintenanceFeignClient.getEbikeInfoByCode(bikeCode);
|
|
||||||
if (jsonResult.getCode() != Code.SUCCESS) {
|
|
||||||
throw new RuntimeException("获取车辆信息失败");
|
|
||||||
}
|
|
||||||
FeignEbikeBikeInfoDto bikeInfoDto = jsonResult.getData();
|
|
||||||
FeignEbikeEcuInfo ecuInfo = bikeInfoDto.getEbikeEcuInfo();
|
|
||||||
JsonResult<FeignEbikeRegionDto> regionResult = operateFeignClient.getOperationById(bikeInfoDto.getReginId());
|
|
||||||
if (regionResult.getCode() != Code.SUCCESS) {
|
|
||||||
throw new RuntimeException("获取运营区信息失败");
|
|
||||||
}
|
|
||||||
FeignEbikeRegionDto regionDto = regionResult.getData();
|
|
||||||
String jsonString = JSONObject.toJSONString(redisUtil.get(ecuInfo.getEcuSn()));
|
|
||||||
ResGPSDto resGpsDto = JSONObject.parseObject(jsonString, ResGPSDto.class);
|
|
||||||
return redisUtil.isPointInParking(resGpsDto.getLongitude(),resGpsDto.getLatitude(),regionDto.getOrgId());
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean bikeInOperation(double lng, double lat, Long orgId, Long regionId) {
|
boolean bikeInOperation(double lng, double lat, Long orgId, Long regionId) {
|
||||||
return redisUtil.isPointInOperation(lng, lat, orgId, regionId);
|
return redisUtil.isPointInOperation(lng, lat, orgId, regionId);
|
||||||
}
|
}
|
||||||
@ -290,8 +254,8 @@ public class UserOrdersServiceImpl extends ServiceImpl<UserOrdersMapper, UserOrd
|
|||||||
BigDecimal totalAmount = new BigDecimal(0);
|
BigDecimal totalAmount = new BigDecimal(0);
|
||||||
//是否在运营区内
|
//是否在运营区内
|
||||||
boolean pointInOperation = bikeInOperation(resGpsDto.getLongitude(), resGpsDto.getLatitude(), regionDto.getOrgId(), regionDto.getRegionId());
|
boolean pointInOperation = bikeInOperation(resGpsDto.getLongitude(), resGpsDto.getLatitude(), regionDto.getOrgId(), regionDto.getRegionId());
|
||||||
//是否在停车区内
|
|
||||||
boolean pointInParking = redisUtil.isPointInParking(resGpsDto.getLongitude(), resGpsDto.getLatitude(), regionDto.getOrgId());
|
boolean pointInParking = redisUtil.isPointInParking(resGpsDto.getLongitude(), resGpsDto.getLatitude(), regionDto.getOrgId());
|
||||||
|
//是否在停车区内
|
||||||
long minutes = TimeUtils.betweenMinutes(userOrders.getStartTime(), userOrders.getEndTime());
|
long minutes = TimeUtils.betweenMinutes(userOrders.getStartTime(), userOrders.getEndTime());
|
||||||
//是否取消订单
|
//是否取消订单
|
||||||
if (pointInOperation && pointInParking && minutes < feignEbikeSysRcostsetDto.getFreeDuration()){
|
if (pointInOperation && pointInParking && minutes < feignEbikeSysRcostsetDto.getFreeDuration()){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user