车辆筛选
This commit is contained in:
parent
d03e995a37
commit
60c45b2f25
@ -0,0 +1,19 @@
|
||||
package com.cdzy.common.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author attiya
|
||||
* @since 2025-03-12
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class EcuSnDto {
|
||||
|
||||
private List<String> list;
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.ebike.feign.clients;
|
||||
|
||||
import com.cdzy.common.model.EcuSnDto;
|
||||
import com.cdzy.common.model.JsonResult;
|
||||
import com.ebike.feign.component.FeignTokenInterceptor;
|
||||
import com.ebike.feign.config.ExampleFeignConfiguration;
|
||||
@ -125,4 +126,13 @@ public interface MaintenanceFeignClient {
|
||||
*/
|
||||
@PostMapping("system/location2Address2")
|
||||
JsonResult<?> location2AddressDetails(@RequestBody ReqLocationDto location);
|
||||
|
||||
/**
|
||||
* 从EcuSn列表筛选出在运营中车辆的EcuSn
|
||||
* @param ecuSnDto EcuSn列表
|
||||
* @return 筛选后结果
|
||||
*
|
||||
*/
|
||||
@PostMapping("ebikeBikeInfo/checkEcuSn")
|
||||
JsonResult<List<String>> checkEcuSnWithBikeInOperate(@RequestBody EcuSnDto ecuSnDto);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.cdzy.ebikemaintenance.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.cdzy.common.model.EcuSnDto;
|
||||
import com.cdzy.common.model.JsonResult;
|
||||
import com.cdzy.common.model.ResGPSDto;
|
||||
import com.cdzy.ebikemaintenance.model.dto.request.*;
|
||||
@ -872,4 +873,10 @@ public class EbikeBikeInfoController {
|
||||
// 调用服务层方法,获取工单列表数据
|
||||
return ebikeBikeInfoService.getVehicleDetailsByRegionId(regionId);
|
||||
}
|
||||
|
||||
@PostMapping("checkEcuSn")
|
||||
JsonResult<?> checkEcuSnWithBikeInOperate(@RequestBody EcuSnDto ecuSnDto){
|
||||
List<String> list = ebikeBikeInfoService.checkEcuSn(ecuSnDto);
|
||||
return JsonResult.success(list);
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.cdzy.ebikemaintenance.service;
|
||||
|
||||
import com.cdzy.common.model.EcuSnDto;
|
||||
import com.cdzy.common.model.JsonResult;
|
||||
import com.cdzy.ebikemaintenance.model.dto.request.*;
|
||||
import com.cdzy.ebikemaintenance.model.dto.response.*;
|
||||
@ -304,4 +305,11 @@ public interface EbikeBikeInfoService extends IService<EbikeBikeInfo> {
|
||||
* @return
|
||||
*/
|
||||
JsonResult<?> getVehicleDetailsByRegionId(String regionId);
|
||||
|
||||
/**
|
||||
* 筛选EcuSn
|
||||
* @param ecuSnDto 列表
|
||||
* @return 列表
|
||||
*/
|
||||
List<String> checkEcuSn(EcuSnDto ecuSnDto);
|
||||
}
|
||||
|
||||
@ -1522,6 +1522,19 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
||||
return JsonResult.success(resEbikeInfoReginIdDtos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> checkEcuSn(EcuSnDto ecuSnDto) {
|
||||
if (ecuSnDto.getList() == null || ecuSnDto.getList().isEmpty()){
|
||||
return List.of();
|
||||
}
|
||||
QueryWrapper query = QueryWrapper.create()
|
||||
.select(EBIKE_ECU_INFO.ECU_SN)
|
||||
.leftJoin(EBIKE_ECU_INFO).on(EBIKE_ECU_INFO.ECU_ID.eq(EBIKE_BIKE_INFO.ECU_ID))
|
||||
.where(EBIKE_ECU_INFO.ECU_SN.in(ecuSnDto.getList()))
|
||||
.where(EBIKE_BIKE_INFO.IS_IN_WAREHOUSE.eq("0"));
|
||||
return ebikeBikeInfoMapper.selectListByQueryAs(query, String.class);
|
||||
}
|
||||
|
||||
private void modifyMaintenanceStatus(String bikeCode) {
|
||||
//是否存在维修中的订单数据
|
||||
int i = ebikeBikeInfoMapper.selectOrderCount(bikeCode);
|
||||
|
||||
@ -2,6 +2,7 @@ package com.cdzy.orders.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.cdzy.common.enums.Code;
|
||||
import com.cdzy.common.model.EcuSnDto;
|
||||
import com.cdzy.common.model.JsonResult;
|
||||
import com.cdzy.common.model.ReqBatchRegionDto;
|
||||
import com.cdzy.common.model.ResGPSDto;
|
||||
@ -213,7 +214,16 @@ public class UserOrdersServiceImpl extends ServiceImpl<UserOrdersMapper, EbikeUs
|
||||
public List<RspBikeDto> bikeList(ReqBikeDto bikeDto) {
|
||||
List<RedisPoint> nearbyMembers = redisUtil.findNearbyMembers(bikeDto.getLongitude(), bikeDto.getLatitude(), bikeDto.getRadius() == null ? 3.0 : bikeDto.getRadius());
|
||||
List<String> list = nearbyMembers.stream().map(RedisPoint::getMember).toList();
|
||||
List<Object> objects = redisUtil.multiGet(list);
|
||||
//获取运营中的车辆
|
||||
JsonResult<List<String>> jsonResult = maintenanceFeignClient.checkEcuSnWithBikeInOperate(new EcuSnDto(list));
|
||||
if (jsonResult.getCode() != Code.SUCCESS) {
|
||||
throw new RuntimeException("车辆筛选错误");
|
||||
}
|
||||
List<String> data = jsonResult.getData();
|
||||
if (data == null || data.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
List<Object> objects = redisUtil.multiGet(data);
|
||||
return objects.stream().map(object -> {
|
||||
String jsonString = JSONObject.toJSONString(object);
|
||||
ResGPSDto resGpsDto = JSONObject.parseObject(jsonString, ResGPSDto.class);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user