车辆筛选
This commit is contained in:
parent
b4a1349813
commit
d3a2882c99
@ -283,8 +283,8 @@ public class EbikeBikeOrderController {
|
|||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
@GetMapping("bikeList")
|
@GetMapping("bikeList")
|
||||||
public JsonResult<List<EbikeOrderBikeListDto>> bikeList(@RequestParam("regionId") Long regionId) throws IOException {
|
public JsonResult<List<EbikeOrderBikeListDto>> bikeList(@RequestParam("regionId") Long regionId,String bikeCode,Integer bikeStatus,Boolean acceptOrder) throws IOException {
|
||||||
List<EbikeOrderBikeListDto> list = ebikeBikeOrderService.bikeList(regionId);
|
List<EbikeOrderBikeListDto> list = ebikeBikeOrderService.bikeList(regionId,bikeCode,bikeStatus,acceptOrder);
|
||||||
return JsonResult.success(list);
|
return JsonResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,7 @@ public interface EbikeBikeOrderService extends IService<EbikeBikeOrder> {
|
|||||||
* @param regionId 运营区ID
|
* @param regionId 运营区ID
|
||||||
* @return 列表
|
* @return 列表
|
||||||
*/
|
*/
|
||||||
List<EbikeOrderBikeListDto> bikeList(Long regionId) throws IOException;
|
List<EbikeOrderBikeListDto> bikeList(Long regionId,String bikeCode,Integer bikeStatus,Boolean acceptOrder) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 完成调度
|
* 完成调度
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import com.mybatisflex.core.keygen.impl.SnowFlakeIDKeyGenerator;
|
|||||||
import com.mybatisflex.core.query.QueryMethods;
|
import com.mybatisflex.core.query.QueryMethods;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.core.update.UpdateChain;
|
import com.mybatisflex.core.update.UpdateChain;
|
||||||
|
import com.mybatisflex.core.util.StringUtil;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -505,7 +506,7 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EbikeOrderBikeListDto> bikeList(Long regionId) throws IOException {
|
public List<EbikeOrderBikeListDto> bikeList(Long regionId,String bikeCode,Integer bikeStatus,Boolean acceptOrder) throws IOException {
|
||||||
|
|
||||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
.select(
|
.select(
|
||||||
@ -585,7 +586,14 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
|||||||
.select("EXTRACT(EPOCH FROM (NOW() - ebike_bike_info.latest_cycling_time)) / 3600 AS hours_since_last_cycling")
|
.select("EXTRACT(EPOCH FROM (NOW() - ebike_bike_info.latest_cycling_time)) / 3600 AS hours_since_last_cycling")
|
||||||
.where(EBIKE_BIKE_INFO.REGION_ID.eq(regionId))
|
.where(EBIKE_BIKE_INFO.REGION_ID.eq(regionId))
|
||||||
.where(EBIKE_BIKE_INFO.STATUS.eq(BikeStatus.LAUNCH))
|
.where(EBIKE_BIKE_INFO.STATUS.eq(BikeStatus.LAUNCH))
|
||||||
|
.where(EBIKE_BIKE_INFO.BIKE_CODE.eq(bikeCode, StringUtil.hasText(bikeCode)))
|
||||||
|
.where(EBIKE_BIKE_INFO.USAGE_STATUS.eq(bikeStatus, Objects.nonNull(bikeStatus)))
|
||||||
.leftJoin(EBIKE_ECU_INFO).on(EBIKE_ECU_INFO.ECU_ID.eq(EBIKE_BIKE_INFO.ECU_ID));
|
.leftJoin(EBIKE_ECU_INFO).on(EBIKE_ECU_INFO.ECU_ID.eq(EBIKE_BIKE_INFO.ECU_ID));
|
||||||
|
if (acceptOrder!=null && acceptOrder){
|
||||||
|
queryWrapper.leftJoin(EBIKE_BIKE_ORDER).on(EBIKE_BIKE_ORDER.BIKE_CODE.eq(EBIKE_BIKE_INFO.BIKE_CODE))
|
||||||
|
.where(EBIKE_BIKE_ORDER.HANDLE_STATE.eq(OrderHandleState.UNPROCESSED).or(EBIKE_BIKE_ORDER.HANDLE_STATE.eq(OrderHandleState.ACCEPTED)))
|
||||||
|
.where(EBIKE_BIKE_ORDER.RECEIVER_ID.eq(StpUtil.getLoginIdAsLong()));
|
||||||
|
}
|
||||||
List<EbikeOrderBikeListDto> list = bikeInfoMapper.selectListByQueryAs(queryWrapper, EbikeOrderBikeListDto.class);
|
List<EbikeOrderBikeListDto> list = bikeInfoMapper.selectListByQueryAs(queryWrapper, EbikeOrderBikeListDto.class);
|
||||||
List<String> snList = list.stream().map(EbikeOrderBikeListDto::getEcuSn).toList();
|
List<String> snList = list.stream().map(EbikeOrderBikeListDto::getEcuSn).toList();
|
||||||
Map<String, Object> objectMap = redisUtil.batchGetEcuWithMap(snList);
|
Map<String, Object> objectMap = redisUtil.batchGetEcuWithMap(snList);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user