Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/Robotaxi
6 文件已重命名
2个文件已添加
24个文件已修改
| | |
| | | import com.xiaopeng.account.service.IXpOperationsUserService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xiaopeng.account.service.IXpQualificationAuditService; |
| | | import com.xiaopeng.account.util.AliOssDownloadUtil; |
| | | import com.xiaopeng.api.feignClient.maintenance.XpClockInClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetOperationsClient; |
| | |
| | | private ISysRoleService iSysRoleService; |
| | | @Autowired |
| | | private AliOssService aliOssService; |
| | | @Autowired |
| | | private AliOssDownloadUtil aliOssDownloadUtil; |
| | | |
| | | @Override |
| | | public List<XpOperationsUser> listByName(String nickName) { |
| | |
| | | |
| | | XpOperationsUserProfileVO vo = new XpOperationsUserProfileVO(); |
| | | BeanUtils.copyProperties(user, vo); |
| | | |
| | | vo.setAvatar(aliOssDownloadUtil.getPictureJSONObject(vo.getAvatar())); |
| | | // 2. 查询关联的车队ID列表(一个运维人员只能关联一个车队) |
| | | R<List<Long>> fleetIdsResult = xpFleetOperationsClient.getFleetIdsByUserId(userId); |
| | | List<Long> fleetIds = fleetIdsResult.getData(); |
| New file |
| | |
| | | package com.xiaopeng.account.util; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.xiaopeng.evi.oss.service.AliOssService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author MiTao |
| | | * @date 2026-03-25 11:24 |
| | | * |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class AliOssDownloadUtil { |
| | | |
| | | @Autowired |
| | | private AliOssService aliOssService; |
| | | |
| | | public String getPictureJsonArray(String json) { |
| | | JSONArray res = new JSONArray(); |
| | | if (json == null || json.isEmpty()) { |
| | | return res.toJSONString(); |
| | | } |
| | | |
| | | if (json.startsWith("{")) { |
| | | JSONObject jsonObject = JSONObject.parseObject(json); |
| | | if (Objects.isNull(jsonObject)) { |
| | | return res.toJSONString(); |
| | | } |
| | | String downloadUrl = ""; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl( |
| | | jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | res.add(jsonObject); |
| | | |
| | | } else if (json.startsWith("[")) { |
| | | JSONArray jsonArray = JSONArray.parseArray(json); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | String downloadUrl = ""; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl( |
| | | jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | res = jsonArray; |
| | | } |
| | | return res.toJSONString(); |
| | | } |
| | | |
| | | /** |
| | | * JSONObject类型图片 |
| | | * @param json |
| | | * @return |
| | | */ |
| | | public String getPictureJSONObject(String json){ |
| | | JSONObject jsonObject = JSONObject.parseObject(json); |
| | | if (Objects.isNull(jsonObject)) { |
| | | return new JSONObject().toJSONString(); |
| | | } |
| | | String downloadUrl = jsonObject.getString("url"); |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl( |
| | | jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | return jsonObject.toJSONString(); |
| | | } |
| | | } |
| | |
| | | package com.xiaopeng.api.factory.operation; |
| | | |
| | | import com.xiaopeng.api.feignClient.operation.XpTestPlanClient; |
| | | import com.xiaopeng.api.model.map.XpTestPoint; |
| | | import com.xiaopeng.api.model.operation.XpTestPlan; |
| | | import com.xiaopeng.api.model.operation.XpTestPlanPoint; |
| | | import com.xiaopeng.api.model.operation.XpTestPlanVehicle; |
| | | import com.xiaopeng.api.model.operation.XpTestPoint; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | package com.xiaopeng.api.factory.operation; |
| | | |
| | | import com.xiaopeng.api.dto.map.XpPointExportExcelQuery; |
| | | import com.xiaopeng.api.dto.operation.PointAddDto; |
| | | import com.xiaopeng.api.dto.operation.PointMapQuery; |
| | | import com.xiaopeng.api.dto.operation.PointUpdateDto; |
| | | import com.xiaopeng.api.dto.operation.XpPointEnableDisableDto; |
| | | import com.xiaopeng.api.dto.order.HistoryEndPointsDto; |
| | | import com.xiaopeng.api.dto.order.HistoryStartPointsDto; |
| | | import com.xiaopeng.api.feignClient.operation.XpPointClient; |
| | | import com.xiaopeng.api.feignClient.operation.XpTestPointClient; |
| | | import com.xiaopeng.api.model.operation.XpElectronicFenceArea; |
| | | import com.xiaopeng.api.model.operation.XpTestPoint; |
| | | import com.xiaopeng.api.query.operation.PointListQuery; |
| | | import com.xiaopeng.api.query.operation.PointPageListListQuery; |
| | | import com.xiaopeng.api.vo.order.XpHistoryEndPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpHistoryStartPointsVo; |
| | | import com.xiaopeng.api.model.map.XpTestPoint; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | @Slf4j |
| | | @Component |
| | |
| | | log.error("获取点位详情失败:{}", cause.getMessage()); |
| | | return R.fail("获取点位详情失败"); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<XpTestPoint>> queryByIds(List<Long> ids) { |
| | | log.error("获取点位详情失败:{}", cause.getMessage()); |
| | | return R.fail("获取点位详情失败"); |
| | | } |
| | | |
| | | @Override |
| | | public R<Boolean> nowInTimePoint(Long pointId) { |
| | | log.error("判断点位是在有效期内失败:{}", cause.getMessage()); |
| | |
| | | package com.xiaopeng.api.feignClient.operation; |
| | | |
| | | import com.xiaopeng.api.factory.operation.XpTestPlanClientFallbackFactory; |
| | | import com.xiaopeng.api.model.map.XpTestPoint; |
| | | import com.xiaopeng.api.model.operation.XpTestPlan; |
| | | import com.xiaopeng.api.model.operation.XpTestPlanPoint; |
| | | import com.xiaopeng.api.model.operation.XpTestPlanVehicle; |
| | | import com.xiaopeng.api.model.operation.XpTestPoint; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.dto.ServiceNameConstantsEnum; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | |
| | | package com.xiaopeng.api.feignClient.operation; |
| | | |
| | | import com.xiaopeng.api.factory.operation.XpTestPointClientFallbackFactory; |
| | | import com.xiaopeng.api.model.operation.XpTestPoint; |
| | | import com.xiaopeng.api.model.map.XpTestPoint; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.dto.ServiceNameConstantsEnum; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | @FeignClient(contextId = "XpTestPointClient", value = ServiceNameConstantsEnum.XP_OPERATION_SERVICE, fallbackFactory = XpTestPointClientFallbackFactory.class) |
| | | public interface XpTestPointClient { |
| | |
| | | R<XpTestPoint> queryById(@RequestParam Long id); |
| | | |
| | | |
| | | /** |
| | | * 点位详情 |
| | | */ |
| | | @GetMapping("/api/v1/testPoint/queryPointById") |
| | | R<List<XpTestPoint>> queryByIds(@RequestParam List<Long> ids); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 判断点位是在有效期内 |
| File was renamed from xp-robotaxi-api/src/main/java/com/xiaopeng/api/model/operation/XpTestPoint.java |
| | |
| | | package com.xiaopeng.api.model.operation; |
| | | package com.xiaopeng.api.model.map; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.xiaopeng.common.core.web.domain.BaseModel; |
| | |
| | | * 总里程 |
| | | */ |
| | | private Float totalOdometer; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | private Long addTime; |
| | | } |
| | |
| | | vehiclePosition.setMileageRange(dynamicStatus.getDstBatDisp()); |
| | | vehiclePosition.setOrderId(orderId); |
| | | vehiclePosition.setTotalOdometer(dynamicStatus.getTotalOdometer()); |
| | | vehiclePosition.setAddTime(System.currentTimeMillis()); |
| | | mongoTemplate.save(vehiclePosition); |
| | | }else{ |
| | | vehiclePosition.setOrderId(orderId); |
| | |
| | | .set("mileageRange", dynamicStatus.getDstBatDisp()) |
| | | .set("hasOrder", hasOrder) |
| | | .set("orderId", orderId) |
| | | .set("totalOdometer", dynamicStatus.getTotalOdometer()); |
| | | .set("totalOdometer", dynamicStatus.getTotalOdometer() |
| | | .set("addTime", System.currentTimeMillis())); |
| | | mongoTemplate.updateFirst(new Query(Criteria.where("vin").is(vin)), update, VehiclePosition.class); |
| | | } |
| | | //调用推送服务接口 |
| | |
| | | vehicle1.setOperatingStatus(4); |
| | | vehicle1.setId(vehicle.getId()); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("车辆故障,车辆状态修改0 {}", vehicle.getPlateNumber()); |
| | | // 解绑用户与车辆关系 |
| | | CancelTaxiPassengerVo cancelTaxiPassengerVo = new CancelTaxiPassengerVo(); |
| | | cancelTaxiPassengerVo.setVin(vehicle.getVehicleVin()); |
| | |
| | | import com.xiaopeng.maintenance.model.vo.XpVehicleCleanVO; |
| | | import com.xiaopeng.maintenance.service.IXpVehicleCleanService; |
| | | import com.xiaopeng.maintenance.service.XpTaskService; |
| | | import com.xiaopeng.maintenance.utils.AliOssDownloadUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | private ThreadPoolTaskScheduler taskScheduler; |
| | | @Autowired |
| | | private AliOssService aliOssService; |
| | | @Autowired |
| | | private AliOssDownloadUtil aliOssDownloadUtil; |
| | | |
| | | /** |
| | | * 车辆运维-车辆运维-车身清洁 |
| | |
| | | |
| | | for (XpVehicleClean record : records) { |
| | | String taskImage = record.getTaskImage(); |
| | | if (StringUtils.isNotBlank(taskImage)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(taskImage); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | record.setTaskImage(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | record.setTaskImage(aliOssDownloadUtil.getPictureJsonArray(record.getTaskImage())); |
| | | data.stream().filter(xpOperationsUser -> xpOperationsUser.getId().equals(record.getOperationsUserId())).findFirst().ifPresent(xpOperationsUser -> record.setCreateBy(xpOperationsUser.getNickName())); |
| | | } |
| | | return R.ok(page); |
| | |
| | | import com.xiaopeng.maintenance.model.vo.XpVehicleDetectionVO; |
| | | import com.xiaopeng.maintenance.service.IXpVehicleDetectionService; |
| | | import com.xiaopeng.maintenance.service.XpTaskService; |
| | | import com.xiaopeng.maintenance.utils.AliOssDownloadUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | private XpOperationUserClient xpOperationUserClient; |
| | | @Autowired |
| | | private XpTaskService xpTaskService; |
| | | |
| | | @Autowired |
| | | private AliOssDownloadUtil aliOssDownloadUtil; |
| | | /** |
| | | * 车辆运维-车辆运维-开始自检 |
| | | */ |
| | |
| | | public R<PageInfo<XpVehicleDetectionVO>> queryDetectionByVehicleId(@Valid @RequestBody XpVehicleDetectionPageQuery query) throws UnsupportedEncodingException { |
| | | PageInfo<XpVehicleDetectionVO> pageInfo = xpVehicleDetectionService.queryDetectionByVehicleId(query); |
| | | for (XpVehicleDetectionVO xpVehicleDetectionVO : pageInfo.getRecords()) { |
| | | String vehiclePictures = xpVehicleDetectionVO.getVehiclePictures(); |
| | | if (vehiclePictures != null && !vehiclePictures.isEmpty()) { |
| | | JSONObject jsonObject = JSONObject.parseObject(vehiclePictures); |
| | | // 1 |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | xpVehicleDetectionVO.setVehiclePictures(jsonObject.toJSONString()); |
| | | } |
| | | xpVehicleDetectionVO.setVehiclePictures(aliOssDownloadUtil.getPictureJSONObject(xpVehicleDetectionVO.getVehiclePictures())); |
| | | |
| | | xpVehicleDetectionVO.setSensorCleaningPicture(aliOssDownloadUtil.getPictureJsonArray(xpVehicleDetectionVO.getSensorCleaningPicture())); |
| | | |
| | | String sensorCleaningPicture = xpVehicleDetectionVO.getSensorCleaningPicture(); |
| | | if (StringUtils.isNotBlank(sensorCleaningPicture)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(sensorCleaningPicture); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | // 1 |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | xpVehicleDetectionVO.setSensorCleaningPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | xpVehicleDetectionVO.setInteractiveScreenPicture(aliOssDownloadUtil.getPictureJsonArray(xpVehicleDetectionVO.getInteractiveScreenPicture())); |
| | | |
| | | xpVehicleDetectionVO.setHelpButtonPicture(aliOssDownloadUtil.getPictureJsonArray(xpVehicleDetectionVO.getHelpButtonPicture())); |
| | | |
| | | String interactiveScreenPicture = xpVehicleDetectionVO.getInteractiveScreenPicture(); |
| | | if (StringUtils.isNotBlank(interactiveScreenPicture)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(interactiveScreenPicture); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | // 1 |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | xpVehicleDetectionVO.setInteractiveScreenPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | xpVehicleDetectionVO.setPaymentFunctionPicture(aliOssDownloadUtil.getPictureJsonArray(xpVehicleDetectionVO.getPaymentFunctionPicture())); |
| | | |
| | | |
| | | String helpButtonPicture = xpVehicleDetectionVO.getHelpButtonPicture(); |
| | | if (StringUtils.isNotBlank(helpButtonPicture)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(helpButtonPicture); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | // 1 |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | xpVehicleDetectionVO.setHelpButtonPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | |
| | | String paymentFunctionPicture = xpVehicleDetectionVO.getPaymentFunctionPicture(); |
| | | if (StringUtils.isNotBlank(paymentFunctionPicture)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(paymentFunctionPicture); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | // 1 |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | xpVehicleDetectionVO.setPaymentFunctionPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | |
| | | String systemCheckPicture = xpVehicleDetectionVO.getSystemCheckPicture(); |
| | | if (StringUtils.isNotBlank(systemCheckPicture)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(systemCheckPicture); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | // 1 |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | xpVehicleDetectionVO.setSystemCheckPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | xpVehicleDetectionVO.setSystemCheckPicture(aliOssDownloadUtil.getPictureJsonArray(xpVehicleDetectionVO.getSystemCheckPicture())); |
| | | } |
| | | return R.ok(pageInfo); |
| | | } |
| | |
| | | import com.xiaopeng.maintenance.model.query.XpChargingRecordPageQuery; |
| | | import com.xiaopeng.maintenance.model.vo.XpChargingRecordVO; |
| | | import com.xiaopeng.maintenance.service.IXpChargingRecordService; |
| | | import com.xiaopeng.maintenance.utils.AliOssDownloadUtil; |
| | | import com.xiaopeng.maintenance.vo.ChargingStatusVO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | |
| | | @Autowired |
| | | private AliOssService aliOssService; |
| | | @Autowired |
| | | private AliOssDownloadUtil aliOssDownloadUtil; |
| | | |
| | | @Override |
| | | public void startCharging(XpChargingRecordStartDTO dto, Long id) { |
| | | // 创建车辆充电记录 |
| | |
| | | } |
| | | |
| | | |
| | | String vehiclePictures = vo.getVehiclePictures(); |
| | | if (StringUtils.isNotBlank(vehiclePictures)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(vehiclePictures); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | vo.setVehiclePictures(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | vo.setVehiclePictures(aliOssDownloadUtil.getPictureJSONObject(vo.getVehiclePictures())); |
| | | |
| | | |
| | | |
| | | String startChargingPicture = vo.getStartChargingPicture(); |
| | | if (StringUtils.isNotBlank(startChargingPicture)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(startChargingPicture); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | vo.setStartChargingPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | |
| | | |
| | | String endChargingPicture = vo.getEndChargingPicture(); |
| | | if (StringUtils.isNotBlank(endChargingPicture)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(endChargingPicture); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | vo.setEndChargingPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | |
| | | |
| | | vo.setStartChargingPicture(aliOssDownloadUtil.getPictureJsonArray(vo.getStartChargingPicture())); |
| | | vo.setEndChargingPicture(aliOssDownloadUtil.getPictureJsonArray(vo.getEndChargingPicture())); |
| | | records.add(vo); |
| | | } |
| | | } |
| | |
| | | import com.xiaopeng.maintenance.service.IXpTaskRuleRoleService; |
| | | import com.xiaopeng.maintenance.service.IXpTaskRuleService; |
| | | import com.xiaopeng.maintenance.service.XpTaskService; |
| | | import com.xiaopeng.maintenance.utils.AliOssDownloadUtil; |
| | | import com.xiaopeng.maintenance.utils.GDMapGeocodingUtil; |
| | | import com.xiaopeng.maintenance.utils.UUIDUtil; |
| | | import com.xiaopeng.maintenance.vo.TaskCleanDetailVO; |
| | |
| | | |
| | | @Resource |
| | | private AliOssService aliOssService; |
| | | @Autowired |
| | | private AliOssDownloadUtil aliOssDownloadUtil; |
| | | |
| | | @Override |
| | | public PageInfo<WorkBenchVO> workbench(WorkBenchQuery query) throws UnsupportedEncodingException { |
| | |
| | | PageInfo<XpTaskRecordVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | |
| | | for (XpTaskRecordVO record : records) { |
| | | |
| | | String taskImage = record.getTaskImage(); |
| | | if (StringUtils.isNotBlank(taskImage)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(taskImage); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | String downloadUrl = jsonObject.getString("url"); |
| | | ; |
| | | try { |
| | | // 1 |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | record.setTaskImage(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | record.setTaskImage(aliOssDownloadUtil.getPictureJsonArray(record.getTaskCode())); |
| | | } |
| | | |
| | | |
| | |
| | | import com.xiaopeng.maintenance.model.vo.OperationRecordsVO; |
| | | import com.xiaopeng.maintenance.model.vo.XpVehiclePreparationVO; |
| | | import com.xiaopeng.maintenance.service.IXpVehiclePreparationService; |
| | | import com.xiaopeng.maintenance.utils.AliOssDownloadUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private MongoTemplate mongoTemplate; |
| | | @Autowired |
| | | private AliOssService aliOssService; |
| | | @Autowired |
| | | private AliOssDownloadUtil aliOssDownloadUtil; |
| | | |
| | | @Override |
| | | public PageInfo<OperationRecordsVO> operationRecords(OperationRecordsQuery query) { |
| | |
| | | String userName = userNameMap.get(preparation.getOperationsUserId()); |
| | | vo.setOperationsUserName(userName); |
| | | } |
| | | preparation.setLeftFrontWheel(aliOssDownloadUtil.getPictureJsonArray(preparation.getLeftFrontWheel())); |
| | | preparation.setRightFrontWheel(aliOssDownloadUtil.getPictureJsonArray(preparation.getRightFrontWheel())); |
| | | preparation.setLeftRearWheel(aliOssDownloadUtil.getPictureJsonArray(preparation.getLeftRearWheel())); |
| | | preparation.setRightRearWheel(aliOssDownloadUtil.getPictureJsonArray(preparation.getRightRearWheel())); |
| | | preparation.setBrakeLight(aliOssDownloadUtil.getPictureJsonArray(preparation.getBrakeLight())); |
| | | preparation.setFogLight(aliOssDownloadUtil.getPictureJsonArray(preparation.getFogLight())); |
| | | preparation.setBodyEmblem(aliOssDownloadUtil.getPictureJsonArray(preparation.getBodyEmblem())); |
| | | preparation.setCabinCleaning(aliOssDownloadUtil.getPictureJsonArray(preparation.getCabinCleaning())); |
| | | preparation.setLostItems(aliOssDownloadUtil.getPictureJsonArray(preparation.getLostItems())); |
| | | |
| | | |
| | | records.add(vo); |
| | | } |
| | |
| | | import com.xiaopeng.maintenance.model.vo.XpVehicleRepairMgtVO; |
| | | import com.xiaopeng.maintenance.model.vo.XpVehicleRepairVO; |
| | | import com.xiaopeng.maintenance.service.IXpVehicleRepairService; |
| | | import com.xiaopeng.maintenance.utils.AliOssDownloadUtil; |
| | | import com.xiaopeng.maintenance.vo.ChargingStatusVO; |
| | | import com.xiaopeng.maintenance.vo.RepairStatusVO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | private AliOssService aliOssService; |
| | | |
| | | @Autowired |
| | | private AliOssDownloadUtil aliOssDownloadUtil; |
| | | |
| | | @Override |
| | | public XpVehicleRepairVO repairDetail(Long id) { |
| | | // 查询车辆充电记录 |
| | |
| | | XpVehicle xpVehicle = xpVehicleClient.queryById(xpVehicleRepair.getVehicleId()).getData(); |
| | | if (Objects.nonNull(xpVehicle)) { |
| | | xpVehicleRepairVO.setPlateNumber(xpVehicle.getPlateNumber()); |
| | | xpVehicleRepairVO.setVehiclePictures(xpVehicle.getVehiclePictures()); |
| | | xpVehicleRepairVO.setVehiclePictures(aliOssDownloadUtil.getPictureJSONObject(xpVehicle.getVehiclePictures())); |
| | | xpVehicleRepairVO.setAcceptOrTest(xpVehicle.getAcceptOrTest()); |
| | | xpVehicleRepairVO.setVehicleColor(xpVehicle.getVehicleColor()); |
| | | } |
| | |
| | | } |
| | | |
| | | String RepairMoneyDetail = vo.getRepairMoneyDetail(); |
| | | if (StringUtils.isNotBlank(RepairMoneyDetail)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(RepairMoneyDetail); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | vo.setRepairMoneyDetail(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | vo.setRepairMoneyDetail(aliOssDownloadUtil.getPictureJsonArray(RepairMoneyDetail)); |
| | | String StartRepairPicture = vo.getStartRepairPicture(); |
| | | if (StringUtils.isNotBlank(StartRepairPicture)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(StartRepairPicture); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | vo.setStartRepairPicture(JSONArray.toJSONString(jsonArray)); |
| | | } |
| | | vo.setStartRepairPicture(aliOssDownloadUtil.getPictureJsonArray(StartRepairPicture)); |
| | | |
| | | records.add(vo); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.maintenance.utils; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.xiaopeng.evi.oss.service.AliOssService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author MiTao |
| | | * @date 2026-03-25 11:24 |
| | | * |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class AliOssDownloadUtil { |
| | | |
| | | @Autowired |
| | | private AliOssService aliOssService; |
| | | |
| | | public String getPictureJsonArray(String json) { |
| | | JSONArray res = new JSONArray(); |
| | | if (json == null || json.isEmpty()) { |
| | | return res.toJSONString(); |
| | | } |
| | | |
| | | if (json.startsWith("{")) { |
| | | JSONObject jsonObject = JSONObject.parseObject(json); |
| | | if (Objects.isNull(jsonObject)) { |
| | | return res.toJSONString(); |
| | | } |
| | | String downloadUrl = ""; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl( |
| | | jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | res.add(jsonObject); |
| | | |
| | | } else if (json.startsWith("[")) { |
| | | JSONArray jsonArray = JSONArray.parseArray(json); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | String downloadUrl = ""; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl( |
| | | jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | res = jsonArray; |
| | | } |
| | | return res.toJSONString(); |
| | | } |
| | | |
| | | /** |
| | | * JSONObject类型图片 |
| | | * @param json |
| | | * @return |
| | | */ |
| | | public String getPictureJSONObject(String json){ |
| | | JSONObject jsonObject = JSONObject.parseObject(json); |
| | | if (Objects.isNull(jsonObject)) { |
| | | return new JSONObject().toJSONString(); |
| | | } |
| | | String downloadUrl = jsonObject.getString("url"); |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl( |
| | | jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | return jsonObject.toJSONString(); |
| | | } |
| | | } |
| File was renamed from xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpTestPointManagementController.java |
| | |
| | | package com.xiaopeng.operation.controller; |
| | | package com.xiaopeng.map.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | import com.xiaopeng.api.dto.operation.PointAddDto; |
| | | import com.xiaopeng.api.dto.operation.PointUpdateDto; |
| | | import com.xiaopeng.api.dto.operation.XpPointEnableDisableDto; |
| | | import com.xiaopeng.api.model.map.XpTestPoint; |
| | | import com.xiaopeng.api.model.operation.XpElectronicFence; |
| | | import com.xiaopeng.api.model.operation.XpElectronicFenceArea; |
| | | import com.xiaopeng.api.model.operation.XpTestPoint; |
| | | import com.xiaopeng.api.query.operation.PointListQuery; |
| | | import com.xiaopeng.api.query.operation.PointPageListListQuery; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.controller.BaseController; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.dto.XpPointSpecialDto; |
| | | import com.xiaopeng.operation.service.IXpElectronicFenceAreaService; |
| | | import com.xiaopeng.operation.service.IXpElectronicFenceService; |
| | | import com.xiaopeng.operation.service.XpPointService; |
| | | import com.xiaopeng.operation.service.XpTestPointService; |
| | | import com.xiaopeng.operation.vo.SpecialPointListVo; |
| | | import com.xiaopeng.operation.vo.SpecialPointVo; |
| | | import com.xiaopeng.map.dto.XpPointSpecialDto; |
| | | import com.xiaopeng.map.service.XpElectronicFenceAreaService; |
| | | import com.xiaopeng.map.service.XpElectronicFenceService; |
| | | import com.xiaopeng.map.service.XpTestPointService; |
| | | import com.xiaopeng.map.vo.SpecialPointListVo; |
| | | import com.xiaopeng.map.vo.SpecialPointVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @Resource |
| | | private XpTestPointService xpTestPointService; |
| | | @Resource |
| | | private IXpElectronicFenceAreaService xpElectronicFenceAreaService; |
| | | private XpElectronicFenceAreaService xpElectronicFenceAreaService; |
| | | @Resource |
| | | private IXpElectronicFenceService xpElectronicFenceService; |
| | | private XpElectronicFenceService xpElectronicFenceService; |
| | | |
| | | |
| | | @ApiOperation(value = "获取所有运营中的区域", response = XpElectronicFenceArea.class) |
| | |
| | | public R<Boolean> nowInTimePoint(@RequestParam Long pointId){ |
| | | return R.ok(xpTestPointService.nowInTimePoint(pointId)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 点位详情 |
| | | */ |
| | | @GetMapping("/api/v1/testPoint/queryPointById") |
| | | public R<List<XpTestPoint>> queryByIds(@RequestParam List<Long> ids){ |
| | | List<XpTestPoint> xpTestPoints = xpTestPointService.listByIds(ids); |
| | | return R.ok(xpTestPoints); |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "经度") |
| | | @NotNull(message = "经度不能为空") |
| | | private Double longitude; |
| | | |
| | | } |
| File was renamed from xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/mapper/XpTestPointMapper.java |
| | |
| | | package com.xiaopeng.operation.mapper; |
| | | package com.xiaopeng.map.mapper; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.xiaopeng.api.dto.operation.PointMapQuery; |
| | | import com.xiaopeng.api.model.operation.XpPoint; |
| | | import com.xiaopeng.api.model.operation.XpTestPoint; |
| | | import com.xiaopeng.api.model.map.XpTestPoint; |
| | | import com.xiaopeng.api.query.operation.PointListQuery; |
| | | import com.xiaopeng.api.query.operation.PointPageListListQuery; |
| | | import com.xiaopeng.api.vo.order.XpPointsListVo; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.query.PointByNameQuery; |
| | | import com.xiaopeng.map.query.PointByNameQuery; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| File was renamed from xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/XpTestPointService.java |
| | |
| | | package com.xiaopeng.operation.service; |
| | | package com.xiaopeng.map.service; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.xiaopeng.api.dto.operation.PointMapQuery; |
| | | import com.xiaopeng.api.dto.order.HistoryEndPointsDto; |
| | | import com.xiaopeng.api.dto.order.HistoryStartPointsDto; |
| | | import com.xiaopeng.api.model.operation.XpTestPoint; |
| | | import com.xiaopeng.api.model.map.XpTestPoint; |
| | | import com.xiaopeng.api.query.operation.PointListQuery; |
| | | import com.xiaopeng.api.query.operation.PointPageListListQuery; |
| | | import com.xiaopeng.api.vo.order.XpHistoryEndPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpHistoryStartPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpPointsSearchVo; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.dto.NearestDto; |
| | | import com.xiaopeng.operation.query.PointByNameQuery; |
| | | import com.xiaopeng.operation.vo.NearestVo; |
| | | import com.xiaopeng.operation.vo.OrderDistanceVo; |
| | | import com.xiaopeng.map.dto.NearestDto; |
| | | import com.xiaopeng.map.vo.NearestVo; |
| | | import com.xiaopeng.map.vo.OrderDistanceVo; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.time.LocalTime; |
| | |
| | | */ |
| | | public interface XpTestPointService extends IService<XpTestPoint> { |
| | | |
| | | /** |
| | | * 获取附近上车站点 |
| | | */ |
| | | NearestVo nearest(@Valid NearestDto dto); |
| | | |
| | | |
| | | /** |
| File was renamed from xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpTestPointServiceImpl.java |
| | |
| | | package com.xiaopeng.operation.service.impl; |
| | | package com.xiaopeng.map.service.serviceimpl; |
| | | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | |
| | | import com.xiaopeng.api.dto.operation.PointMapQuery; |
| | | import com.xiaopeng.api.dto.order.HistoryEndPointsDto; |
| | | import com.xiaopeng.api.dto.order.HistoryStartPointsDto; |
| | | import com.xiaopeng.api.model.operation.*; |
| | | import com.xiaopeng.api.model.map.XpTestPoint; |
| | | import com.xiaopeng.api.model.operation.XpElectronicFence; |
| | | import com.xiaopeng.api.model.operation.XpElectronicFenceArea; |
| | | import com.xiaopeng.api.model.operation.XpSystemSetting; |
| | | import com.xiaopeng.api.query.operation.PointListQuery; |
| | | import com.xiaopeng.api.query.operation.PointPageListListQuery; |
| | | import com.xiaopeng.api.vo.order.XpHistoryEndPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpHistoryStartPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpPointsListVo; |
| | | import com.xiaopeng.api.vo.order.XpPointsSearchVo; |
| | | import com.xiaopeng.common.core.constant.CacheConstants; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.redis.service.RedisService; |
| | | import com.xiaopeng.operation.dto.NearestDto; |
| | | import com.xiaopeng.operation.mapper.XpSystemSettingMapper; |
| | | import com.xiaopeng.operation.mapper.XpTestPointMapper; |
| | | import com.xiaopeng.operation.query.PointByNameQuery; |
| | | import com.xiaopeng.operation.service.IXpElectronicFenceAreaService; |
| | | import com.xiaopeng.operation.service.IXpElectronicFenceService; |
| | | import com.xiaopeng.operation.service.XpTestPointService; |
| | | import com.xiaopeng.operation.utils.TimeRangeChecker; |
| | | import com.xiaopeng.operation.utils.holiday.HolidayUtil; |
| | | import com.xiaopeng.operation.utils.map.FastDistanceCalculator; |
| | | import com.xiaopeng.operation.vo.NearestNextVo; |
| | | import com.xiaopeng.operation.vo.NearestVo; |
| | | import com.xiaopeng.operation.vo.OrderDistanceVo; |
| | | import com.xiaopeng.map.dto.NearestDto; |
| | | import com.xiaopeng.map.mapper.XpSystemSettingMapper; |
| | | import com.xiaopeng.map.mapper.XpTestPointMapper; |
| | | import com.xiaopeng.map.service.XpElectronicFenceAreaService; |
| | | import com.xiaopeng.map.service.XpElectronicFenceService; |
| | | import com.xiaopeng.map.service.XpTestPointService; |
| | | import com.xiaopeng.map.utils.TimeRangeChecker; |
| | | import com.xiaopeng.map.utils.holiday.HolidayUtil; |
| | | import com.xiaopeng.map.utils.map.map.FastDistanceCalculator; |
| | | import com.xiaopeng.map.vo.NearestNextVo; |
| | | import com.xiaopeng.map.vo.NearestVo; |
| | | import com.xiaopeng.map.vo.OrderDistanceVo; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | |
| | | private HolidayUtil holidayUtil; |
| | | |
| | | @Resource |
| | | private IXpElectronicFenceAreaService xpElectronicFenceAreaService; |
| | | private XpElectronicFenceAreaService xpElectronicFenceAreaService; |
| | | |
| | | @Resource |
| | | private IXpElectronicFenceService xpElectronicFenceService; |
| | | |
| | | |
| | | @Override |
| | | public NearestVo nearest(NearestDto dto) { |
| | | // 走缓存 |
| | | Object orderDistanceObj = redisService.getCacheObject(CacheConstants.NEAR_POINT_DISTANCE); |
| | | Integer orderDistance; |
| | | if (orderDistanceObj != null) { |
| | | orderDistance = Integer.valueOf(orderDistanceObj.toString()); |
| | | } else { |
| | | XpSystemSetting xpSystemSetting = xpSystemSettingMapper.selectOne(null); |
| | | orderDistance = xpSystemSetting.getNearPointDistance(); |
| | | } |
| | | |
| | | |
| | | List<XpTestPoint> list1 = list(new LambdaQueryWrapper<XpTestPoint>().eq(XpTestPoint::getOperationStatus, 2).eq(XpTestPoint::getPointType,1).isNotNull(XpTestPoint::getElectronicAreaId)); |
| | | if(list1.size()<2){ |
| | | return new NearestVo(); |
| | | } |
| | | // 获取所有的站点信息 |
| | | List<XpTestPoint> list = list(new LambdaQueryWrapper<XpTestPoint>().eq(XpTestPoint::getOperationStatus, 2).eq(XpTestPoint::getPointType,1).isNotNull(XpTestPoint::getElectronicAreaId) |
| | | // 添加距离计算字段 |
| | | .apply("ST_Distance_Sphere(point({0}, {1}), point(point_lon, point_lat)) <= {2}", |
| | | dto.getLongitude(), dto.getLatitude(), orderDistance)); |
| | | |
| | | |
| | | list = list.stream().filter(e->e.getElectronicAreaId().equals(dto.getElectronicAreaId())).collect(Collectors.toList()); |
| | | |
| | | NearestVo nearestVo = new NearestVo(); |
| | | if(list.isEmpty()){ |
| | | nearestVo.setPoints(new ArrayList<>()); |
| | | nearestVo.setTotal(0); |
| | | return nearestVo; |
| | | } |
| | | List<NearestNextVo> nearestNextVos = new ArrayList<>(); |
| | | LocalTime now = LocalTime.now(); |
| | | List<Long> areaIds = list.stream().map(XpTestPoint::getElectronicAreaId).collect(Collectors.toList()); |
| | | List<XpElectronicFenceArea> xpElectronicFenceAreas = xpElectronicFenceAreaService.listByIds(areaIds); |
| | | List<Long> fenceIds = xpElectronicFenceAreas.stream().map(XpElectronicFenceArea::getElectronicId).collect(Collectors.toList()); |
| | | List<XpElectronicFence> xpElectronicFences = new ArrayList<>(); |
| | | if (CollUtil.isNotEmpty(fenceIds)) { |
| | | xpElectronicFences = xpElectronicFenceService.listByIds(fenceIds); |
| | | } |
| | | |
| | | //判断当前点位是否在运营时间范围内 |
| | | for (XpTestPoint xpPoint : list) { |
| | | Integer operationType = xpPoint.getOperationType(); |
| | | if(1 == operationType){ |
| | | //与运营区同步 |
| | | XpElectronicFenceArea xpElectronicFenceArea = xpElectronicFenceAreas.stream().filter(s -> s.getId().equals(xpPoint.getElectronicAreaId())).findFirst().orElse(null); |
| | | if(null == xpElectronicFenceArea){ |
| | | continue; |
| | | } |
| | | XpElectronicFence xpElectronicFence = xpElectronicFences.stream().filter(s -> s.getId().equals(xpElectronicFenceArea.getElectronicId())).findFirst().orElse(null); |
| | | if(null == xpElectronicFence){ |
| | | continue; |
| | | } |
| | | //失效类型 1=永不失效 2=定时失效 |
| | | Integer failureType = xpElectronicFence.getFailureType(); |
| | | //永不失效,但是还未到开始时间 |
| | | if(1 == failureType && LocalDateTime.now().isBefore(xpElectronicFence.getEffectTime())){ |
| | | continue; |
| | | }else if(2 == failureType && (LocalDateTime.now().isBefore(xpElectronicFence.getEffectTime()) || LocalDateTime.now().isAfter(xpElectronicFence.getFailureTime()))){ |
| | | //定时失效,但是当前时间不在时间范围内 |
| | | continue; |
| | | } |
| | | }else{ |
| | | //自定义时间段 |
| | | // 判断是否在时间段内 |
| | | boolean intime = getInTime(now, xpPoint.getEffectivePeriod(), xpPoint.getEffectiveTimePeriod()); |
| | | if (!intime) { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | // 计算距离 小于的站点 |
| | | double v = FastDistanceCalculator.distanceFast(dto.getLatitude(), dto.getLongitude(), xpPoint.getPointLat(), xpPoint.getPointLon()); |
| | | |
| | | // m做判断 |
| | | if ((v) < orderDistance) { |
| | | NearestNextVo nearestNextVo = new NearestNextVo(); |
| | | nearestNextVo.setId(xpPoint.getId()); |
| | | nearestNextVo.setName(xpPoint.getPointName()); |
| | | nearestNextVo.setLatitude(xpPoint.getPointLat()); |
| | | nearestNextVo.setLongitude(xpPoint.getPointLon()); |
| | | nearestNextVo.setDistance(new BigDecimal(v).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | nearestNextVo.setAddress(xpPoint.getPointAddress()); |
| | | nearestNextVo.setTime(xpPoint.getParkingTimeLimit()); |
| | | nearestNextVo.setElectronicAreaId(xpPoint.getElectronicAreaId()); |
| | | |
| | | |
| | | nearestNextVos.add(nearestNextVo); |
| | | } |
| | | } |
| | | if (!nearestNextVos.isEmpty()) { |
| | | nearestNextVos = nearestNextVos.stream().sorted(Comparator.comparing(NearestNextVo::getDistance)).collect(Collectors.toList()); |
| | | } |
| | | nearestVo.setPoints(nearestNextVos); |
| | | nearestVo.setTotal(nearestNextVos.size()); |
| | | return nearestVo; |
| | | |
| | | } |
| | | private XpElectronicFenceService xpElectronicFenceService; |
| | | |
| | | |
| | | |
| File was renamed from xp-robotaxi-operation-boot/src/main/resources/mapper/operation/XpTestPointMapper.xml |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.xiaopeng.operation.mapper.XpTestPointMapper"> |
| | | <mapper namespace="com.xiaopeng.map.mapper.XpTestPointMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.xiaopeng.api.model.operation.XpTestPoint"> |
| | | <resultMap id="BaseResultMap" type="com.xiaopeng.api.model.map.XpTestPoint"> |
| | | <id column="id" property="id" /> |
| | | <result column="point_name" property="pointName" /> |
| | | <result column="point_poi" property="pointPoi" /> |
| | |
| | | <sql id="Base_Column_List"> |
| | | id,electronic_area_id, point_name, point_poi, point_number, operation_status, point_type, verification_status, parking_time_limit, operation_type, effective_period, effective_time_period, remarks, point_pictures, point_lon, point_lat, is_deleted, create_time, update_time, create_by, update_by |
| | | </sql> |
| | | <select id="pointMap" resultType="com.xiaopeng.api.model.operation.XpTestPoint"> |
| | | <select id="pointMap" resultType="com.xiaopeng.api.model.map.XpTestPoint"> |
| | | select t1.*, |
| | | ROUND( |
| | | 6378.138 * 2 * ASIN( |
| | |
| | | </if> |
| | | order by distance asc |
| | | </select> |
| | | <select id="listAll" resultType="com.xiaopeng.api.model.operation.XpTestPoint"> |
| | | <select id="listAll" resultType="com.xiaopeng.api.model.map.XpTestPoint"> |
| | | select t1.* |
| | | from xp_test_point t1 |
| | | where t1.is_deleted = 0 |
| | |
| | | </if> |
| | | |
| | | </select> |
| | | <select id="pageList" resultType="com.xiaopeng.api.model.operation.XpTestPoint"> |
| | | <select id="pageList" resultType="com.xiaopeng.api.model.map.XpTestPoint"> |
| | | select xp.id,xp.point_number as pointNumber,xp.point_name as pointName,xp.point_poi as pointPoi, |
| | | xp.point_address as pointAddress, |
| | | xp.point_lon as pointLon,xp.point_lat as pointLat,xp.create_time as createTime,xp.create_by as createBy |
| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | |
| | | import com.xiaopeng.api.feignClient.operation.XpTestPointClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; |
| | | import com.xiaopeng.api.model.map.XpTestPoint; |
| | | import com.xiaopeng.api.model.operation.XpTestPlan; |
| | | import com.xiaopeng.api.model.operation.XpTestPlanPoint; |
| | | import com.xiaopeng.api.model.operation.XpTestPlanVehicle; |
| | | import com.xiaopeng.api.model.operation.XpTestPoint; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.dto.XpTestPlanAddDTO; |
| | |
| | | import com.xiaopeng.operation.service.IXpTestPlanPointService; |
| | | import com.xiaopeng.operation.service.IXpTestPlanService; |
| | | import com.xiaopeng.operation.service.IXpTestPlanVehicleService; |
| | | import com.xiaopeng.operation.service.XpTestPointService; |
| | | import com.xiaopeng.operation.vo.XpTestPlanDetailVO; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | private final IXpTestPlanService xpTestPlanService; |
| | | private final XpVehicleClient xpVehicleClient; |
| | | private final IXpTestPlanPointService xpTestPlanPointService; |
| | | private final XpTestPointService xpTestPointService; |
| | | private final XpTestPointClient xpTestPointService; |
| | | private final IXpTestPlanVehicleService xpTestPlanVehicleService; |
| | | |
| | | |
| | |
| | | */ |
| | | @PostMapping("/inner/v1/xp-test-plan/getXpTestPointById") |
| | | public R<XpTestPoint> getXpTestPointById(@RequestParam Long id){ |
| | | XpTestPoint xpTestPoint = xpTestPointService.getById(id); |
| | | XpTestPoint xpTestPoint = xpTestPointService.queryById(id).getData(); |
| | | return R.ok(xpTestPoint); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.google.common.collect.Lists; |
| | | import com.xiaopeng.api.feignClient.operation.XpTestPointClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetVehicleClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; |
| | | import com.xiaopeng.api.model.map.XpTestPoint; |
| | | import com.xiaopeng.api.model.operation.XpTestPlanPoint; |
| | | import com.xiaopeng.api.model.operation.XpTestPlanVehicle; |
| | | import com.xiaopeng.api.model.operation.XpTestPoint; |
| | | import com.xiaopeng.api.model.operation.XpTestPlan; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpFleet; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; |
| | |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.constant.I18nKeyConstant; |
| | | import com.xiaopeng.operation.dto.XpCruisePlanAddDTO; |
| | | import com.xiaopeng.operation.dto.XpCruisePlanEditDTO; |
| | | import com.xiaopeng.operation.dto.XpTestPlanAddDTO; |
| | | import com.xiaopeng.operation.dto.XpTestPlanEditDTO; |
| | | import com.xiaopeng.operation.mapper.XpTestPlanMapper; |
| | | import com.xiaopeng.operation.query.CruisePlanQuery; |
| | | import com.xiaopeng.operation.query.TestPlanQuery; |
| | | import com.xiaopeng.operation.service.*; |
| | | import com.xiaopeng.operation.vo.*; |
| | |
| | | |
| | | private final IXpTestPlanPointService xpTestPlanPointService; |
| | | private final IXpTestPlanVehicleService xpTestPlanVehicleService; |
| | | private final XpTestPointService xpTestPointService; |
| | | private final XpTestPointClient testPointClient; |
| | | private final XpVehicleClient xpVehicleClient; |
| | | private final XpFleetVehicleClient xpFleetVehicleClient; |
| | | private final XpFleetClient xpFleetClient; |
| | |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | pointIds.addAll(pointIds1); |
| | | List<XpTestPoint> data = testPointClient.queryByIds(pointIds).getData(); |
| | | Map<Long, XpTestPoint> pointMap = CollUtil.isNotEmpty(pointIds) |
| | | ? xpTestPointService.listByIds(pointIds).stream() |
| | | ? data.stream() |
| | | .collect(Collectors.toMap(XpTestPoint::getId, v -> v)) |
| | | : Collections.emptyMap(); |
| | | List<XpTestPlanPointVO> pointList = planPoints.stream().map(planPoint -> { |
| | |
| | | |
| | | @ApiOperation(value = "巡游订单详情", tags = {"管理后台-巡游订单"}) |
| | | @GetMapping(value = "/api/v1/cruise-order/getDetailById/{id}") |
| | | public R<XpCruiseOrder> getDetailById(@PathVariable Long id){ |
| | | XpCruiseOrder xpCruiseOrder = xpCruiseOrderService.getById(id); |
| | | public R<XpCruiseOrderPageVO> getDetailById(@PathVariable Long id){ |
| | | XpCruiseOrderPageVO xpCruiseOrder = xpCruiseOrderService.getDetailById(id); |
| | | return R.ok(xpCruiseOrder); |
| | | } |
| | | } |
| | |
| | | vehicle1.setState(0); |
| | | vehicle1.setId(vehicle.getId()); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("定时执行到达终点后的逻辑,车辆状态修改0 {}", vehicle.getPlateNumber()); |
| | | log.info("车辆到达终点后的定时任务回滚车辆状态为空闲 {}", xpOrder.getOrderNumber()); |
| | | } |
| | | xpOrderService.addCruiseMission(vehicle.getId(), xpOrder); |
| | |
| | | vehicle1.setId(xpVehicle.getId()); |
| | | vehicle1.setState(0); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("订单定时取消,车辆状态修改0 {}", xpVehicle.getPlateNumber()); |
| | | } |
| | | |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | |
| | | */ |
| | | List<XpCruiseOrderPageVO> getExportList(XpCruiseOrderExcelQuery query); |
| | | |
| | | XpCruiseOrderPageVO getDetailById(Long id); |
| | | } |
| | |
| | | package com.xiaopeng.order.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.google.common.collect.Lists; |
| | | import com.xiaopeng.api.dto.automaticPilot.PushOrderDto; |
| | | import com.xiaopeng.api.feignClient.automaticPilot.OrderMissionClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetClient; |
| | |
| | | }).collect(Collectors.toList()); |
| | | return voList; |
| | | } |
| | | |
| | | @Override |
| | | public XpCruiseOrderPageVO getDetailById(Long id) { |
| | | XpCruiseOrder cruiseOrder = getById(id); |
| | | XpCruiseOrderPageVO xpCruiseOrderPageVO = BeanUtil.copyProperties(cruiseOrder, XpCruiseOrderPageVO.class); |
| | | if (Objects.isNull(xpCruiseOrderPageVO)) { |
| | | return new XpCruiseOrderPageVO(); |
| | | } |
| | | XpVehicle vehicle = xpVehicleClient.queryById(cruiseOrder.getVehicleId()).getData(); |
| | | if (Objects.nonNull(vehicle)) { |
| | | xpCruiseOrderPageVO.setPlateNumber(vehicle.getPlateNumber()); |
| | | } |
| | | List<XpFleet> data = xpFleetClient.listByIds(Lists.newArrayList(cruiseOrder.getFleetId())).getData(); |
| | | if (CollUtil.isNotEmpty(data)) { |
| | | XpFleet xpFleet = data.get(0); |
| | | xpCruiseOrderPageVO.setFleetName(xpFleet.getFleetName()); |
| | | } |
| | | return xpCruiseOrderPageVO; |
| | | } |
| | | } |
| | |
| | | vehicle1.setId(vehicle.getId()); |
| | | vehicle1.setState(0); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("管理后台取消订单,车辆状态修改0 {}", vehicle.getPlateNumber()); |
| | | } |
| | | } |
| | | } |
| | |
| | | vehicle1.setId(xpVehicle.getId()); |
| | | vehicle1.setState(0); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("管理后台取消订单,车辆状态修改0 {}", xpVehicle.getPlateNumber()); |
| | | } |
| | | |
| | | // 下发命令 |
| | |
| | | vehicle1.setId(oldVehicle.getId()); |
| | | vehicle1.setState(0); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("管理后台改派订单,车辆状态修改0 {}", oldVehicle.getPlateNumber()); |
| | | log.info("已将原车辆状态设为空闲,车辆ID: {}", oldVehicleId); |
| | | |
| | | // 6.1.4 为原车辆创建返程巡游订单 |
| | |
| | | vehicle1.setId(newVehicle.getId()); |
| | | vehicle1.setState(1); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("管理后台改派订单,车辆状态修改1 {}", newVehicle.getPlateNumber()); |
| | | log.info("已将新车辆状态设为已接单,车辆ID: {}", newVehicleId); |
| | | |
| | | } catch (Exception e) { |
| | |
| | | vehicle1.setId(vehicle.getId()); |
| | | vehicle1.setState(0); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("用户取消订单,车辆状态修改0 {}", vehicle.getPlateNumber()); |
| | | } |
| | | } |
| | | } |
| | |
| | | vehicle1.setId(xpVehicle.getId()); |
| | | vehicle1.setState(0); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("用户取消订单,车辆状态修改0 {}", xpVehicle.getPlateNumber()); |
| | | } |
| | | |
| | | //下发XPU报文 |
| | |
| | | vehicle1.setId(vehicle.getId()); |
| | | vehicle1.setState(1); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("推单成功后的处理逻辑,车辆状态修改1 {}", vehicle.getPlateNumber()); |
| | | |
| | | //绑定用户和车辆关系 |
| | | addTaxiPassengerVo.setUid(appUserId.toString()); |
| | |
| | | vehicle1.setId(vehicle.getId()); |
| | | vehicle1.setState(1); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("推单成功后的处理逻辑,车辆状态修改1 {}", vehicle.getPlateNumber()); |
| | | |
| | | xpTestOrder.setVehicleId(null); |
| | | xpTestOrderService.updateById(xpTestOrder); |
| | |
| | | vehicle1.setId(vehicle.getId()); |
| | | vehicle1.setState(0); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("管理后台取消订单,车辆状态修改0 {}", vehicle.getPlateNumber()); |
| | | } |
| | | } |
| | | } |
| | |
| | | vehicle1.setId(xpVehicle.getId()); |
| | | vehicle1.setState(0); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("管理后台取消订单,车辆状态修改0 {}", xpVehicle.getPlateNumber()); |
| | | } |
| | | |
| | | // 下发命令 |
| | |
| | | vehicle1.setId(oldVehicle.getId()); |
| | | vehicle1.setState(0); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("改派订单,车辆状态修改0 {}", oldVehicle.getPlateNumber()); |
| | | log.info("已将原车辆状态设为空闲,车辆ID: {}", oldVehicleId); |
| | | |
| | | } else { |
| | |
| | | vehicle1.setId(newVehicle.getId()); |
| | | vehicle1.setState(1); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | log.info("改派订单,车辆状态修改1 {}", newVehicle.getPlateNumber()); |
| | | log.info("已将新车辆状态设为已接单,车辆ID: {}", newVehicleId); |
| | | |
| | | } catch (Exception e) { |
| | |
| | | String result = vehicleControlUtil.vehiclesCommand(vehiclesCommandVo, xpOrder.getAppUserId()); |
| | | log.info("车辆控制结果:{}", result); |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (code != 0) { |
| | | String msgId = jsonObject.getString("msgId"); |
| | | if (StringUtils.isEmpty(msgId)) { |
| | | return 0; |
| | | }else { |
| | | xpOrderClient.updateOrder(xpOrder); |
| | |
| | | String result = vehicleControlUtil.vehiclesCommand(vehiclesCommandVo, xpOrder.getAppUserId()); |
| | | log.info("车辆控制结果:{}", result); |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (code != 0) { |
| | | String msgId = jsonObject.getString("msgId"); |
| | | if (StringUtils.isEmpty(msgId)) { |
| | | return 0; |
| | | }else { |
| | | return 1; |