Merge branch '1.0' of http://120.76.84.145:10101/gitblit/r/java/Robotaxi into 1.0
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | |
| | | return new XpOperationUserClient() { |
| | | |
| | | @Override |
| | | public R<List<XpOperationsUser>> listByIds(List<Long> ids) { |
| | | public R<List<XpOperationsUser>> listByIds(Collection<Long> ids) { |
| | | log.error("批量查询运维人员用户信息失败,原因: {}", cause.getMessage()); |
| | | // 降级返回空列表 |
| | | return R.ok(new ArrayList<>()); |
| New file |
| | |
| | | package com.xiaopeng.api.factory.maintenance; |
| | | |
| | | import com.xiaopeng.api.feignClient.maintenance.XpVehicleModelClient; |
| | | import com.xiaopeng.api.model.maintenance.XpVehicleModel; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | public class XpVehicleModelClientFallbackFactory implements FallbackFactory<XpVehicleModelClient> { |
| | | |
| | | |
| | | @Override |
| | | public XpVehicleModelClient create(Throwable cause) { |
| | | return new XpVehicleModelClient() { |
| | | @Override |
| | | public R<List<XpVehicleModel>> listByIds(Collection<String> ids) { |
| | | |
| | | log.error("获取车型数据失败, 异常: {}",cause.getMessage(), cause); |
| | | return R.fail("获取车型数据失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | }; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.xiaopeng.api.factory.vehicleConvoy; |
| | | |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetOperationsClient; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpFleet; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpFleetOperations; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<List<XpFleet>> getFleetByUserId(Long id) { |
| | | log.error("根据人员id 获取所属车队,人员ID: {},原因: {}", id, cause.getMessage()); |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Long>> getFleetIdsByUserId(Long userId) { |
| | | log.error("根据人员ID获取车队信息失败 {}", cause.getMessage()); |
| | | return R.fail("根据人员ID获取车队信息失败"); |
| | |
| | | package com.xiaopeng.api.feignClient.account; |
| | | |
| | | import com.xiaopeng.api.dto.account.XpOperationsUserQueryDTO; |
| | | import com.xiaopeng.api.factory.account.XpAppUserClientFallbackFactory; |
| | | import com.xiaopeng.api.factory.account.XpOperationUserClientFallbackFactory; |
| | | import com.xiaopeng.api.model.account.XpOperationsRole; |
| | | import com.xiaopeng.api.model.account.XpOperationsUser; |
| | | import com.xiaopeng.api.vo.account.XpOperationsUserWithRoleVO; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.dto.ServiceNameConstantsEnum; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @return 用户列表 |
| | | */ |
| | | @PostMapping("/logan/inner/xpOperationsUser/listByIds") |
| | | R<List<XpOperationsUser>> listByIds(@RequestBody List<Long> ids); |
| | | R<List<XpOperationsUser>> listByIds(@RequestBody Collection<Long> ids); |
| | | |
| | | /** |
| | | * 根据ID查询运维用户信息 |
| | |
| | | */ |
| | | @PostMapping("/logan/inner/cancelOrder") |
| | | R<Boolean> cancelOrder(@RequestBody PushOrderDto dto); |
| | | |
| | | |
| | | |
| | | @PostMapping("/logan/inner/updateEndAddress") |
| | | R<Boolean> updateEndAddress(@RequestBody PushOrderDto dto); |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.api.feignClient.maintenance; |
| | | |
| | | |
| | | import com.xiaopeng.api.factory.maintenance.XpVehicleModelClientFallbackFactory; |
| | | import com.xiaopeng.api.model.maintenance.XpVehicleModel; |
| | | 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.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | @FeignClient(contextId = "XpVehicleModelClient", |
| | | value = ServiceNameConstantsEnum.XP_MAINTENANCE_SERVICE, |
| | | fallbackFactory = XpVehicleModelClientFallbackFactory.class) |
| | | public interface XpVehicleModelClient { |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据ID列表批量查询打卡地址 |
| | | */ |
| | | @PostMapping("/logan/inner/xpVehicleModel/listByIds") |
| | | R<List<XpVehicleModel>> listByIds(@RequestBody Collection<String> ids); |
| | | |
| | | |
| | | } |
| | |
| | | package com.xiaopeng.api.feignClient.vehicleConvoy; |
| | | |
| | | import com.xiaopeng.api.factory.vehicleConvoy.XpFleetOperationsClientFallbackFactory; |
| | | import com.xiaopeng.api.factory.vehicleConvoy.XpFleetVehicleClientFallbackFactory; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpFleet; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpFleetOperations; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.dto.ServiceNameConstantsEnum; |
| | |
| | | R<List<Long>> getVehicleByUserId(@PathVariable("id") Long id); |
| | | |
| | | /** |
| | | * 根据人员id 获取所属车队 |
| | | * |
| | | * @param id 运维人员id |
| | | * @return 车辆isd |
| | | */ |
| | | @GetMapping("/logan/inner/fleet-operations/getFleetByUserId/{id}") |
| | | R<List<XpFleet>> getFleetByUserId(@PathVariable("id") Long id); |
| | | |
| | | /** |
| | | * 根据运维人员ID查询关联的车队ID列表 |
| | | * |
| | | * @param userId 运维人员ID |
| New file |
| | |
| | | package com.xiaopeng.api.model.operation; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.xiaopeng.common.core.web.domain.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.Min; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | *免密支付策略 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("xp_password_free_policy") |
| | | @ApiModel(value="XpPasswordFreePolicy 对象", description="免密支付策略") |
| | | public class XpPasswordFreePolicy extends BaseModel { |
| | | |
| | | |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "省份名称") |
| | | private String provinceName; |
| | | @ApiModelProperty(value = "省份code") |
| | | private String provinceCode; |
| | | @ApiModelProperty(value = "城市名称") |
| | | private String cityName; |
| | | @ApiModelProperty(value = "城市code") |
| | | private String cityCode; |
| | | @ApiModelProperty(value = "最大重试次数") |
| | | @Min(value = 0L, message = "最大重试次数不能小于0") |
| | | @Max(value = 10L, message = "最大重试次数不能大于10") |
| | | private Integer maxRetriesNumber; |
| | | @ApiModelProperty(value = "重试间隔(秒)") |
| | | private Integer retriesInterval; |
| | | @ApiModelProperty(value = "重试失败后是否发送通知(0=否,1=是)") |
| | | private Boolean sendNotification; |
| | | @ApiModelProperty(value = "预估金额与实际金额差异大于x%,乘客端触发二次确认弹框") |
| | | @Min(value = 0, message = "金额差异阈值能小于0") |
| | | @Max(value = 1001L, message = "金额差异阈值不能大于1000") |
| | | private Integer differenceRatio; |
| | | |
| | | |
| | | @ApiModelProperty(value = "状态(1=启用,2=禁用)") |
| | | private Integer status; |
| | | |
| | | public String getStatusName() { |
| | | if(status != null){ |
| | | if(status == 1){ |
| | | return "启用"; |
| | | }else if(status == 2){ |
| | | return "禁用"; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | @ApiModelProperty(value = "区域id") |
| | | private String areaId; |
| | | |
| | | @ApiModelProperty(value = "区域名称") |
| | | @TableField(exist = false) |
| | | private String areaName; |
| | | |
| | | @ApiModelProperty(value = "有效期开始时间") |
| | | private LocalDateTime validTimeStart; |
| | | @ApiModelProperty(value = "有效期结束时间") |
| | | private LocalDateTime validTimeEnd; |
| | | |
| | | @ApiModelProperty(value = "长期有效") |
| | | private Boolean validTimeLong; |
| | | |
| | | } |
| | |
| | | */ |
| | | @ApiModelProperty("现场情况(1=正常,2=异常)") |
| | | @TableField("field_situation") |
| | | private String fieldSituation; |
| | | private Integer fieldSituation; |
| | | |
| | | public String getFieldSituationName() { |
| | | if(fieldSituation != null){ |
| | | if(fieldSituation == 1){ |
| | | return "正常"; |
| | | }else if(fieldSituation == 2){ |
| | | return "异常"; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 现场照片JSON数组 |
| | | */ |
| | |
| | | /** |
| | | * 现场情况上报时间 |
| | | */ |
| | | @ApiModelProperty("现场情况上报时间") |
| | | @TableField("reporting_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime reportingTime; |
| | |
| | | @TableField("vehicle_model") |
| | | private String vehicleModel; |
| | | |
| | | @ApiModelProperty(value = "车型名称") |
| | | @TableField(exist = false) |
| | | private String vehicleModelName; |
| | | |
| | | @ApiModelProperty(value = "渠道") |
| | | @TableField("channel") |
| | | private String channel; |
| | |
| | | @ApiModelProperty(value = "方向 1正2反") |
| | | @TableField("order_reverse") |
| | | private Integer orderReverse; |
| | | |
| | | @ApiModelProperty(value = "XPU行程任务id") |
| | | @TableField("xpu_task_id") |
| | | private String xpuTaskId; |
| | | } |
| | |
| | | @ApiModelProperty(value = "订单修改目的地的次数 默认0") |
| | | private Integer orderChange; |
| | | |
| | | @ApiModelProperty(value = "XPU行程任务id") |
| | | @TableField("xpu_task_id") |
| | | private String xpuTaskId; |
| | | } |
| | |
| | | private Integer num; |
| | | @ApiModelProperty(value = "是否改价标识 0-否 1-是") |
| | | private Boolean changeMoneyFlag; |
| | | |
| | | @ApiModelProperty(value = "XPU行程任务id") |
| | | @TableField("xpu_task_id") |
| | | private String xpuTaskId; |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.api.query.operation; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.xiaopeng.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class XpPasswordFreePolicyQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "城市名称") |
| | | private String cityName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "有效期开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTimeStart; |
| | | @ApiModelProperty(value = "有效期结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTimeEnd; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.api.query.operation; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.xiaopeng.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class XpPointSituationReportQuery extends BasePage { |
| | | |
| | | private Long id; |
| | | private List<Long> ids; |
| | | |
| | | @ApiModelProperty(value = "点位名称") |
| | | private String pointName; |
| | | |
| | | @ApiModelProperty(value = "点位编号唯一") |
| | | private String pointNumber; |
| | | |
| | | @ApiModelProperty(value = "点位状态值") |
| | | private String pointStatusValue; |
| | | |
| | | /** |
| | | * 现场情况(1=正常,2=异常) |
| | | */ |
| | | @ApiModelProperty("现场情况(1=正常,2=异常)") |
| | | private Integer fieldSituation; |
| | | |
| | | /** |
| | | * 上报运维id |
| | | */ |
| | | @TableField("operations_user_id") |
| | | private Long operationsUserId; |
| | | /** |
| | | * 现场情况上报时间 |
| | | */ |
| | | @TableField("reporting_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime reportingTimeStart; |
| | | |
| | | /** |
| | | * 现场情况上报时间 |
| | | */ |
| | | @TableField("reporting_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime reportingTimeEnd; |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.api.vo.operation; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.xiaopeng.api.model.operation.XpPointSituationReport; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class XpPointSituationReportVo extends XpPointSituationReport { |
| | | |
| | | |
| | | @ApiModelProperty(value = "点位名称") |
| | | private String pointName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "点位编号唯一") |
| | | private String pointNumber; |
| | | |
| | | |
| | | @ApiModelProperty(value = "运营状态 1=待启用 2=启用中 3=已停用 4=已失效") |
| | | private Integer operationStatus; |
| | | |
| | | @ApiModelProperty(value = "点位类型 1=运营点位 2=测试点位") |
| | | private Integer pointType; |
| | | |
| | | @ApiModelProperty(value = "验证状态 1=待验证、2=验证中、3=已验证 4验证失败 5待生效") |
| | | private Integer verificationStatus; |
| | | |
| | | |
| | | @ApiModelProperty(value = "点位状态名称") |
| | | private String pointStatusName; |
| | | @ApiModelProperty(value = "点位状态值") |
| | | private String pointStatusValue; |
| | | |
| | | |
| | | /** |
| | | * 上报运维名称 |
| | | */ |
| | | @ApiModelProperty(value = "上报运维名称") |
| | | private String operationsUserName; |
| | | |
| | | |
| | | /** |
| | | * 上报运维人车队名 |
| | | */ |
| | | @ApiModelProperty(value = "上报运维人车队名") |
| | | private String operationsUserFleetName; |
| | | |
| | | } |
| | |
| | | com.xiaopeng.api.factory.pushMessage.SubscribeMessageClientFallbackFactory |
| | | com.xiaopeng.api.factory.account.UserSubscribeMessageClientFallbackFactory |
| | | com.xiaopeng.api.factory.operation.XpTradingStrategyClientFallbackFactory |
| | | com.xiaopeng.api.factory.operation.XpActicityClientFallbackFactory |
| | | com.xiaopeng.api.factory.operation.XpActicityClientFallbackFactory |
| | | com.xiaopeng.api.factory.maintenance.XpVehicleModelClientFallbackFactory |
| | |
| | | if(dto.getOrderType().equals(com.xiaopeng.api.vo.OrderType.CRUISE_ORDER)){ |
| | | RtTask.Builder taskBuilder = RtTask.newBuilder(); |
| | | taskBuilder.setOrderId(dto.getOrderId().toString()); |
| | | taskBuilder.setTaskId(snowflake.nextId() + ""); |
| | | taskBuilder.setTaskId(StringUtils.isNotEmpty(dto.getTaskId()) ? dto.getTaskId() : snowflake.nextId() + ""); |
| | | taskBuilder.setTaskType(OrderType.ORDER_TYPE_CRUISE); |
| | | //构建起点坐标数据 |
| | | pointBuilderStart.setWaypointId(dto.getOrderId() + "-001"); |
| | |
| | | for (int i = 1; i < 3; i++) { |
| | | RtTask.Builder taskBuilder = RtTask.newBuilder(); |
| | | taskBuilder.setOrderId(dto.getOrderId().toString()); |
| | | taskBuilder.setTaskId(snowflake.nextId() + ""); |
| | | taskBuilder.setTaskId(StringUtils.isNotEmpty(dto.getTaskId()) ? dto.getTaskId() : snowflake.nextId() + ""); |
| | | taskBuilder.setTaskType(OrderType.ORDER_TYPE_ROBOTAXI); |
| | | if(i == 1){ |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(dto.getVin())), VehiclePosition.class); |
| | |
| | | for (int i = 1; i < 3; i++) { |
| | | RtTask.Builder taskBuilder = RtTask.newBuilder(); |
| | | taskBuilder.setOrderId(dto.getOrderId().toString()); |
| | | taskBuilder.setTaskId(snowflake.nextId() + ""); |
| | | taskBuilder.setTaskId(StringUtils.isNotEmpty(dto.getTaskId()) ? dto.getTaskId() : snowflake.nextId() + ""); |
| | | taskBuilder.setTaskType(OrderType.ORDER_TYPE_ROBOTAXI); |
| | | if(i == 1){ |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(dto.getVin())), VehiclePosition.class); |
| | |
| | | //测试单巡游单 |
| | | RtTask.Builder taskBuilder = RtTask.newBuilder(); |
| | | taskBuilder.setOrderId(dto.getOrderId().toString()); |
| | | taskBuilder.setTaskId(snowflake.nextId() + ""); |
| | | taskBuilder.setTaskId(StringUtils.isNotEmpty(dto.getTaskId()) ? dto.getTaskId() : snowflake.nextId() + ""); |
| | | taskBuilder.setTaskType(OrderType.ORDER_TYPE_CRUISE); |
| | | //构建起点坐标数据 |
| | | pointBuilderStart.setWaypointId(dto.getOrderId() + "-001"); |
| | |
| | | } |
| | | |
| | | @PostMapping("/logan/inner/cancelOrder") |
| | | R<Boolean> cancelOrder(@RequestBody PushOrderDto dto) { |
| | | public R<Boolean> cancelOrder(@RequestBody PushOrderDto dto) { |
| | | log.info("取消订单,推送XPU报文:{}", JSON.toJSONString(dto)); |
| | | String taskId = StringUtils.isNotEmpty(dto.getTaskId()) ? dto.getTaskId() : snowflake.nextId() + ""; |
| | | OrderOperation.Builder operationBuilder = OrderOperation.newBuilder(); |
| | |
| | | |
| | | |
| | | |
| | | @PostMapping("/logan/inner/updateEndAddress") |
| | | public R<Boolean> updateEndAddress(@RequestBody PushOrderDto dto){ |
| | | log.info("修改目的地,推送XPU报文:{}", JSON.toJSONString(dto)); |
| | | String taskId = StringUtils.isNotEmpty(dto.getTaskId()) ? dto.getTaskId() : snowflake.nextId() + ""; |
| | | OrderOperation.Builder operationBuilder = OrderOperation.newBuilder(); |
| | | operationBuilder.setOrderId(dto.getOrderId().toString()); |
| | | operationBuilder.setTaskId(taskId); |
| | | if (dto.getOperation_type() != null) { |
| | | operationBuilder.setOperationType(OrderOperationType.forNumber(dto.getOperation_type().getNumber())); |
| | | } |
| | | Waypoint.Builder waypointBuilder = Waypoint.newBuilder(); |
| | | waypointBuilder.setWaypointId(dto.getOrderId() + "-002"); |
| | | waypointBuilder.setPointType(PointType.END_POINT); |
| | | waypointBuilder.setActionType(ActionType.DROP_OFF); |
| | | waypointBuilder.setSequence(2); |
| | | GeoPoint.Builder geoPointBuilder = GeoPoint.newBuilder(); |
| | | geoPointBuilder.setLatitude(dto.getStartLatitude()); |
| | | geoPointBuilder.setLongitude(dto.getStartLongitude()); |
| | | waypointBuilder.setPoint(geoPointBuilder.build()); |
| | | waypointBuilder.setPoiName(dto.getEndPoiName()); |
| | | operationBuilder.setTargetPoint(waypointBuilder); |
| | | long sequence = snowflake.nextId(); |
| | | MqttPublishDto mqttPublishDto = xpuUtil.cloudOrderOperation(operationBuilder.build(), dto.getVin(), sequence); |
| | | |
| | | if (mqttPublishDto.getCode() == 200) { |
| | | if(!dto.getOrderId().contains("XU")){ |
| | | Map<String, Object> cancelContext = new HashMap<>(); |
| | | cancelContext.put("orderId", dto.getOrderId()); |
| | | cancelContext.put("vin", dto.getVin()); |
| | | cancelContext.put("cancelScene", StringUtils.isNotEmpty(dto.getCancelScene()) |
| | | ? dto.getCancelScene() |
| | | : CancelOrderSceneEnum.NORMAL_CANCEL.getCode()); |
| | | redisService.setCacheObject("CANCEL_ORDER_CONTEXT:" + taskId, |
| | | JSONObject.toJSONString(cancelContext), 30L, TimeUnit.MINUTES); |
| | | log.info("记录修改目的地订单上下文成功,orderId: {}, vin: {}, taskId: {}, cancelScene: {}", |
| | | dto.getOrderId(), dto.getVin(), taskId, cancelContext.get("cancelScene")); |
| | | } |
| | | return R.ok(true); |
| | | } |
| | | |
| | | return R.ok(false); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | newXpCruiseOrder.setStartPointName(xpCruiseOrder.getEndPointName()); |
| | | newXpCruiseOrder.setStatus(1); |
| | | newXpCruiseOrder.setLastOrderId(xpCruiseOrder.getId()); |
| | | xpCruiseOrder.setXpuTaskId(snowflake.nextId() + ""); |
| | | |
| | | // 通过车找终点id |
| | | CruisePointDto cruisePointDto = new CruisePointDto(); |
| New file |
| | |
| | | package com.xiaopeng.itinerary.config; |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Configuration |
| | | public class SnowflakeConfig { |
| | | |
| | | //初始时间戳,设为2026年1月1日0点0时0分 |
| | | public static final Date EPOCH_DATE = new Date(1767225600000L); |
| | | /** |
| | | * 如果配置为<0的值,则woker-id根据pod名的hash取模生成 |
| | | * 如果配置为>=0的值,则取配置的值 |
| | | * 如果多个pod的data-center-id和worker-id相同,同一毫秒内请求数上千的话,可能会产生碰撞,生成一样的snowflake id |
| | | */ |
| | | @Value("${snowflake.worker-id:-1}") |
| | | private long workerId; |
| | | |
| | | @Value("${snowflake.data-center-id:0}") |
| | | private long dataCenterId; |
| | | |
| | | @Bean("hutoolSnowflake") |
| | | public Snowflake snowflake() { |
| | | long resolvedWorkerId = resolveWorkerId(); |
| | | return new Snowflake(EPOCH_DATE, resolvedWorkerId, dataCenterId, false); |
| | | } |
| | | |
| | | private long resolveWorkerId() { |
| | | if (workerId >= 0 && workerId <= Snowflake.MAX_WORKER_ID) { |
| | | return workerId; |
| | | } |
| | | String podName = System.getenv("HOSTNAME"); |
| | | if (podName == null || podName.isEmpty()) { |
| | | return 0; |
| | | } |
| | | int end = podName.length() - 1; |
| | | while (end >= 0 && Character.isDigit(podName.charAt(end))) { |
| | | end--; |
| | | } |
| | | String numberPart = podName.substring(end + 1); |
| | | long candidate; |
| | | if (!numberPart.isEmpty()) { |
| | | try { |
| | | candidate = Long.parseLong(numberPart); |
| | | } catch (NumberFormatException e) { |
| | | candidate = Math.abs(podName.hashCode()); |
| | | } |
| | | } else { |
| | | candidate = Math.abs(podName.hashCode()); |
| | | } |
| | | return candidate % (Snowflake.MAX_WORKER_ID + 1); |
| | | } |
| | | } |
| | |
| | | @PostMapping("/api/v1/mini-program/order/orderChange") |
| | | @XpClientCheck(checkToken = false, checkOtpToken = true) |
| | | public R<?> orderChange(@RequestBody @Validated OrderChangeDto dto, HttpServletRequest request) { |
| | | |
| | | String uid = request.getHeader("XP-Uid"); |
| | | activeOrderService.orderChange(dto, uid); |
| | | return R.ok(); |
| | |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.xiaopeng.api.dto.automaticPilot.PushOrderDto; |
| | | import com.xiaopeng.api.dto.operation.ReassignOrderDTO; |
| | | import com.xiaopeng.api.dto.order.OrderChangeDto; |
| | | import com.xiaopeng.api.feignClient.automaticPilot.OrderMissionClient; |
| | | import com.xiaopeng.api.feignClient.map.XpMapClient; |
| | | import com.xiaopeng.api.feignClient.operation.ReassignOrderClient; |
| | | import com.xiaopeng.api.feignClient.operation.XpPointClient; |
| | | import com.xiaopeng.api.feignClient.operation.XpSystemSettingClient; |
| | | import com.xiaopeng.api.feignClient.order.XpOrderClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; |
| | | import com.xiaopeng.api.model.operation.XpElectronicFence; |
| | | import com.xiaopeng.api.model.operation.XpElectronicFenceArea; |
| | | import com.xiaopeng.api.model.operation.XpPoint; |
| | | import com.xiaopeng.api.model.operation.XpSystemSetting; |
| | | import com.xiaopeng.api.model.order.XpOrder; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; |
| | | import com.xiaopeng.api.vo.automaticPilot.protobuf.OrderOperationType; |
| | | import com.xiaopeng.api.vo.operation.RouteOptionVo; |
| | | import com.xiaopeng.api.vo.operation.RouteVo; |
| | | import com.xiaopeng.common.core.constant.CacheConstants; |
| | |
| | | private RedisService redisService; |
| | | @Resource |
| | | private XpRoutePlanMapper xpRoutePlanMapper; |
| | | @Resource |
| | | private XpVehicleClient vehicleClient; |
| | | @Resource |
| | | private OrderMissionClient orderMissionClient; |
| | | |
| | | |
| | | /* |
| | |
| | | log.info("订单推单:{} {}", key, redisService.getCacheList(key)); |
| | | xpOrder.setQueueName(key); |
| | | xpOrderClient.updateOrder(xpOrder); |
| | | //给车端推送修改目的地报文 |
| | | XpVehicle xpVehicle = vehicleClient.queryById(xpOrder.getVehicleId()).getData(); |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setOrderId(order.getId().toString()); |
| | | pushOrderDto.setTaskId(order.getXpuTaskId()); |
| | | pushOrderDto.setVin(xpVehicle.getVehicleVin()); |
| | | pushOrderDto.setOperation_type(OrderOperationType.CLOUD_CHANGE_DESTINATION); |
| | | orderMissionClient.cancelOrder(pushOrderDto); |
| | | log.info("订单下发XPU修改目的地成功 {}", order.getId()); |
| | | |
| | | |
| | | // 判断当前订单的车辆是否有连环派单,然后判断是都还满足连环派单的条件,不满足则需要重新派单 |
| | | Long nextOrderId = redisService.getCacheObject(CacheConstants.nextOrder(order.getId().toString())); |
| | |
| | | package com.xiaopeng.itinerary.service.impl; |
| | | |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | |
| | | |
| | | @Resource |
| | | private UserRoutePlanRuleClient userRoutePlanRuleClient; |
| | | |
| | | @Resource(name = "hutoolSnowflake") |
| | | private Snowflake snowflake; |
| | | |
| | | @Value("${navigation.route.stale-seconds:60}") |
| | | private int navigationStaleSeconds; |
| | |
| | | xpOrder.setEndLat(endXpPoint.getPointLat()); |
| | | xpOrder.setEndAddress(endXpPoint.getPointAddress()); |
| | | xpOrder.setEndPointName(endXpPoint.getPointName()); |
| | | xpOrder.setXpuTaskId(snowflake.nextId() + ""); |
| | | |
| | | |
| | | // 当前时段 |
| New file |
| | |
| | | package com.xiaopeng.maintenance.config; |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Configuration |
| | | public class SnowflakeConfig { |
| | | |
| | | //初始时间戳,设为2026年1月1日0点0时0分 |
| | | public static final Date EPOCH_DATE = new Date(1767225600000L); |
| | | /** |
| | | * 如果配置为<0的值,则woker-id根据pod名的hash取模生成 |
| | | * 如果配置为>=0的值,则取配置的值 |
| | | * 如果多个pod的data-center-id和worker-id相同,同一毫秒内请求数上千的话,可能会产生碰撞,生成一样的snowflake id |
| | | */ |
| | | @Value("${snowflake.worker-id:-1}") |
| | | private long workerId; |
| | | |
| | | @Value("${snowflake.data-center-id:0}") |
| | | private long dataCenterId; |
| | | |
| | | @Bean("hutoolSnowflake") |
| | | public Snowflake snowflake() { |
| | | long resolvedWorkerId = resolveWorkerId(); |
| | | return new Snowflake(EPOCH_DATE, resolvedWorkerId, dataCenterId, false); |
| | | } |
| | | |
| | | private long resolveWorkerId() { |
| | | if (workerId >= 0 && workerId <= Snowflake.MAX_WORKER_ID) { |
| | | return workerId; |
| | | } |
| | | String podName = System.getenv("HOSTNAME"); |
| | | if (podName == null || podName.isEmpty()) { |
| | | return 0; |
| | | } |
| | | int end = podName.length() - 1; |
| | | while (end >= 0 && Character.isDigit(podName.charAt(end))) { |
| | | end--; |
| | | } |
| | | String numberPart = podName.substring(end + 1); |
| | | long candidate; |
| | | if (!numberPart.isEmpty()) { |
| | | try { |
| | | candidate = Long.parseLong(numberPart); |
| | | } catch (NumberFormatException e) { |
| | | candidate = Math.abs(podName.hashCode()); |
| | | } |
| | | } else { |
| | | candidate = Math.abs(podName.hashCode()); |
| | | } |
| | | return candidate % (Snowflake.MAX_WORKER_ID + 1); |
| | | } |
| | | } |
| | |
| | | package com.xiaopeng.maintenance.controller; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.xiaopeng.api.feignClient.operation.XpPricingClient; |
| | | import com.xiaopeng.api.model.maintenance.XpVehicleModel; |
| | | import com.xiaopeng.common.core.domain.R; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | |
| | | PageInfo<XpVehicleModel> pageInfo = xpVehicleModelService.pageList(query); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/logan/inner/xpVehicleModel/listByIds") |
| | | @ApiOperation(value = "根据ID列表批量查询", tags = {"内部接口"}) |
| | | public R<List<XpVehicleModel>> listByIds(@RequestBody List<String> ids) { |
| | | if (CollUtil.isEmpty(ids)) { |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | return R.ok(xpVehicleModelService.listByIds(ids)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "根据ID查询", tags = "管理后台-车型根据ID查询") |
| | | @GetMapping("/logan/inner/xpVehicleModel/getById") |
| | | public R<XpVehicleModel> getById(@RequestParam String id) { |
| | |
| | | package com.xiaopeng.maintenance.controller; |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.xiaopeng.api.dto.automaticPilot.VehicleEventDTO; |
| | | import com.xiaopeng.api.dto.operation.NewCruiseOrderDto; |
| | |
| | | private XpCruisePlanClient xpCruisePlanClient; |
| | | @Autowired |
| | | private VehicleBuriedPointClient vehicleBuriedPointClient; |
| | | |
| | | @Resource(name = "hutoolSnowflake") |
| | | private Snowflake snowflake; |
| | | |
| | | /** |
| | | * 车辆详情-车辆调度-发车 收车 |
| | |
| | | xpCruiseOrder.setOrderReverse(1); |
| | | xpCruiseOrder.setLastOrderId(r.getData()); |
| | | xpCruiseOrder.setOrderReverse(1); |
| | | xpCruiseOrder.setXpuTaskId(snowflake.nextId() + ""); |
| | | |
| | | // 找到收车站点 |
| | | XpCruiseOrder returnCruisePoint = xpCruisePlanClient.findReturnCruisePoint(xpCruiseOrder).getData(); |
| | |
| | | package com.xiaopeng.maintenance.schedule; |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.xiaopeng.api.feignClient.automaticPilot.OrderMissionClient; |
| | | import com.xiaopeng.api.feignClient.operation.XpCruisePlanClient; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalTime; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | |
| | | |
| | | @Autowired |
| | | private XpCruisePlanClient xpCruisePlanClient; |
| | | |
| | | @Resource(name = "hutoolSnowflake") |
| | | private Snowflake snowflake; |
| | | |
| | | /** |
| | | * 每分钟检查一次是否需要执行收车任务 |
| | |
| | | xpCruiseOrder.setOrderReverse(1); |
| | | xpCruiseOrder.setLastOrderId(r.getData()); |
| | | xpCruiseOrder.setOrderReverse(1); |
| | | xpCruiseOrder.setXpuTaskId(snowflake.nextId() + ""); |
| | | |
| | | // 找到收车站点 |
| | | R<XpCruiseOrder> returnCruisePoint = xpCruisePlanClient.findReturnCruisePoint(xpCruiseOrder); |
| New file |
| | |
| | | package com.xiaopeng.operation.config; |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Configuration |
| | | public class SnowflakeConfig { |
| | | |
| | | //初始时间戳,设为2026年1月1日0点0时0分 |
| | | public static final Date EPOCH_DATE = new Date(1767225600000L); |
| | | /** |
| | | * 如果配置为<0的值,则woker-id根据pod名的hash取模生成 |
| | | * 如果配置为>=0的值,则取配置的值 |
| | | * 如果多个pod的data-center-id和worker-id相同,同一毫秒内请求数上千的话,可能会产生碰撞,生成一样的snowflake id |
| | | */ |
| | | @Value("${snowflake.worker-id:-1}") |
| | | private long workerId; |
| | | |
| | | @Value("${snowflake.data-center-id:0}") |
| | | private long dataCenterId; |
| | | |
| | | @Bean("hutoolSnowflake") |
| | | public Snowflake snowflake() { |
| | | long resolvedWorkerId = resolveWorkerId(); |
| | | return new Snowflake(EPOCH_DATE, resolvedWorkerId, dataCenterId, false); |
| | | } |
| | | |
| | | private long resolveWorkerId() { |
| | | if (workerId >= 0 && workerId <= Snowflake.MAX_WORKER_ID) { |
| | | return workerId; |
| | | } |
| | | String podName = System.getenv("HOSTNAME"); |
| | | if (podName == null || podName.isEmpty()) { |
| | | return 0; |
| | | } |
| | | int end = podName.length() - 1; |
| | | while (end >= 0 && Character.isDigit(podName.charAt(end))) { |
| | | end--; |
| | | } |
| | | String numberPart = podName.substring(end + 1); |
| | | long candidate; |
| | | if (!numberPart.isEmpty()) { |
| | | try { |
| | | candidate = Long.parseLong(numberPart); |
| | | } catch (NumberFormatException e) { |
| | | candidate = Math.abs(podName.hashCode()); |
| | | } |
| | | } else { |
| | | candidate = Math.abs(podName.hashCode()); |
| | | } |
| | | return candidate % (Snowflake.MAX_WORKER_ID + 1); |
| | | } |
| | | } |
| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.xiaopeng.api.dto.operation.CruisePointDto; |
| | |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | |
| | | private final IXpCruisePlanPointService xpCruisePlanPointService; |
| | | private final XpPointService pointService; |
| | | private final XpVehicleClient xpVehicleClient; |
| | | |
| | | @Resource(name = "hutoolSnowflake") |
| | | private Snowflake snowflake; |
| | | |
| | | @ApiOperation(value = "获取巡游计划分页列表", tags = {"管理后台-巡游计划"}) |
| | | @PostMapping(value = {"/api/v1/xp-cruise-plan/pageList"}) |
| | |
| | | newXpCruiseOrder.setMissionId(plan.getCruisePlanId()); |
| | | newXpCruiseOrder.setStatus(1); |
| | | newXpCruiseOrder.setOrderReverse(1); |
| | | newXpCruiseOrder.setXpuTaskId(snowflake.nextId() + ""); |
| | | |
| | | GeoJsonPoint point = dto.getPoint(); |
| | | |
| | | // 起点 |
| New file |
| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | import com.xiaopeng.api.model.operation.XpPasswordFreePolicy; |
| | | import com.xiaopeng.api.query.operation.XpPasswordFreePolicyQuery; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.operation.service.XpPasswordFreePolicyService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("") |
| | | @Api(tags = "免密支付策略") |
| | | public class XpPasswordFreePolicyController { |
| | | |
| | | |
| | | @Resource |
| | | private XpPasswordFreePolicyService xpPasswordFreePolicyService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 分页查询路线规划配置列表 |
| | | */ |
| | | @ApiOperation(value = "免密支付策略分页列表", tags = {"管理后台-交易定价-免密支付策略"}, response = XpPasswordFreePolicy.class) |
| | | @PostMapping("/api/v1/passwordFreePolicy/pageList") |
| | | public R<PageInfo<XpPasswordFreePolicy>> pageList(@RequestBody XpPasswordFreePolicyQuery query) { |
| | | PageInfo<XpPasswordFreePolicy> pageInfo = xpPasswordFreePolicyService.pageList(query); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | /** |
| | | * 新增路线规划配置 |
| | | */ |
| | | @ApiOperation(value = "新增免密支付策略", tags = {"管理后台-交易定价-免密支付策略"}) |
| | | @PostMapping("/api/v1/passwordFreePolicy/add") |
| | | public R<?> add(@Valid @RequestBody XpPasswordFreePolicy dto) { |
| | | |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | |
| | | dto.setCreateBy(loginUser.getUsername()); |
| | | dto.setCreateTime(LocalDateTime.now()); |
| | | |
| | | xpPasswordFreePolicyService.save(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 编辑路线规划配置 |
| | | */ |
| | | @ApiOperation(value = "编辑免密支付策略", tags = {"管理后台-交易定价-免密支付策略"}) |
| | | @PostMapping("/api/v1/passwordFreePolicy/edit") |
| | | public R<?> edit(@Valid @RequestBody XpPasswordFreePolicy dto) { |
| | | // 1. 查询原记录是否存在 |
| | | XpPasswordFreePolicy routePlan = xpPasswordFreePolicyService.getById(dto.getId()); |
| | | if (routePlan == null) { |
| | | throw new ServiceException("数据不存在"); |
| | | } |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | |
| | | dto.setUpdateBy(loginUser.getUsername()); |
| | | dto.setUpdateTime(LocalDateTime.now()); |
| | | xpPasswordFreePolicyService.updateById(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除路线规划配置 |
| | | */ |
| | | @ApiOperation(value = "删除免密支付策略", tags = {"管理后台-管理后台-交易定价-免密支付策略"}) |
| | | @DeleteMapping("/api/v1/passwordFreePolicy/deleteById/{id}") |
| | | public R<?> deleteById(@PathVariable Long id) { |
| | | xpPasswordFreePolicyService.deleteById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.xiaopeng.api.model.account.SysUser; |
| | | import com.xiaopeng.api.model.operation.XpPasswordFreePolicy; |
| | | import com.xiaopeng.api.model.operation.XpPointSituationReport; |
| | | import com.xiaopeng.api.query.operation.XpPointSituationReportQuery; |
| | | import com.xiaopeng.api.vo.account.LoginOperationUser; |
| | | import com.xiaopeng.api.vo.operation.XpPointSituationReportVo; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.utils.WebUtils; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.operation.exportExcle.XpPointSituationReportExportExcel; |
| | | import com.xiaopeng.operation.service.IXpPointSituationReportService; |
| | | import com.xiaopeng.operation.vo.XpAgreementVo; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("") |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 分页查询路线规划配置列表 |
| | | */ |
| | | @ApiOperation(value = "现场情况上报分页列表", tags = {"管理后台-运维-现场情况上报"}, response = XpPasswordFreePolicy.class) |
| | | @PostMapping("/api/v1/pointSituationReport/pageList") |
| | | public R<PageInfo<XpPointSituationReportVo>> pageList(@RequestBody XpPointSituationReportQuery query) { |
| | | PageInfo<XpPointSituationReportVo> pageInfo = xpPointSituationReportService.pageList(query); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除路线规划配置 |
| | | */ |
| | | @ApiOperation(value = "详情现场情况上报", tags = {"管理后台-运维-现场情况上报"}) |
| | | @DeleteMapping("/api/v1/pointSituationReport/getdetail/{id}") |
| | | public R<?> getdetail(@PathVariable Long id) { |
| | | xpPointSituationReportService.getdetail(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除路线规划配置 |
| | | */ |
| | | @ApiOperation(value = "删除现场情况上报", tags = {"管理后台-运维-现场情况上报"}) |
| | | @DeleteMapping("/api/v1/pointSituationReport/deleteById/{id}") |
| | | public R<?> deleteById(@PathVariable Long id) { |
| | | xpPointSituationReportService.deleteById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "导出现场情况上报", tags = {"管理后台-运维-现场情况上报"}) |
| | | @PostMapping(value = "/api/v1/pointSituationReport/exportExcels") |
| | | public void exportExcels(@RequestBody XpPointSituationReportQuery query) { |
| | | List<XpPointSituationReportVo> exportList = xpPointSituationReportService.exportList(query); |
| | | List<XpPointSituationReportExportExcel> exportExcels = new ArrayList<>(); |
| | | long sequence = 1L; |
| | | for (XpPointSituationReportVo bean : exportList) { |
| | | XpPointSituationReportExportExcel exportExcel = new XpPointSituationReportExportExcel(); |
| | | BeanUtils.copyProperties(bean,exportExcel); |
| | | exportExcel.setId(sequence++); |
| | | LocalDateTime time = bean.getReportingTime(); |
| | | exportExcel.setReportingTimeStr(time.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))); |
| | | exportExcels.add(exportExcel); |
| | | } |
| | | SysUser sysUser = tokenService.getLoginUser().getSysUser(); |
| | | //1.获取excel模板 |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), XpPointSituationReportExportExcel.class, exportExcels); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("现场情况上报列表.xls", "utf-8"); |
| | | response.setHeader("Content-dispodition", "attachment;filename=" + fileName); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "现场情况上报", tags = {"运维APP-站点管理"}, response = XpPointSituationReport.class) |
| | | @PostMapping("/maintenance-app/api/v1/pointSituationReport/addPointSituationReport") |
| | |
| | | import com.xiaopeng.api.dto.map.RouteAndFareDto; |
| | | import com.xiaopeng.api.dto.operation.LonLatDto; |
| | | import com.xiaopeng.api.feignClient.account.UserResourcesClient; |
| | | import com.xiaopeng.api.feignClient.maintenance.XpVehicleModelClient; |
| | | import com.xiaopeng.api.model.maintenance.XpVehicleModel; |
| | | import com.xiaopeng.api.model.operation.XpPricing; |
| | | import com.xiaopeng.api.model.operation.XpWhitelist; |
| | | import com.xiaopeng.api.vo.operation.RouteAndFareVo; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private final IXpWhitelistService xpWhitelistService; |
| | | private final XpOpenCityService xpOpenCityService; |
| | | private final ImageTagProcessor imageTagProcessor; |
| | | |
| | | @Resource |
| | | private XpVehicleModelClient xpVehicleModelClient; |
| | | |
| | | public XpPricingController(XpPricingService xpPricingService, IXpGeoQueryEntityService xpGeoQueryEntityService, UserResourcesClient userResourcesClient, IXpWhitelistService xpWhitelistService, XpRegionService xpRegionService, XpOpenCityService xpOpenCityService, ImageTagProcessor imageTagProcessor) { |
| | | this.xpPricingService = xpPricingService; |
| | |
| | | String cityName = xpOpenCityService.getNameWithCityName(pricing.getCityId()); |
| | | pricing.setCityName(cityName); |
| | | |
| | | R<List<XpVehicleModel>> listR = xpVehicleModelClient.listByIds(new ArrayList<String>(){{add(pricing.getVehicleModel());}}); |
| | | if(listR != null && listR.getData() != null) { |
| | | XpVehicleModel xpVehicleModel = listR.getData().get(0); |
| | | pricing.setVehicleModelName(xpVehicleModel.getName()); |
| | | } |
| | | |
| | | String priceRule = pricing.getPriceRule(); |
| | | if (priceRule != null && priceRule.contains("<img")) { |
| New file |
| | |
| | | package com.xiaopeng.operation.exportExcle; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value="现场情况上报导出") |
| | | public class XpPointSituationReportExportExcel { |
| | | |
| | | |
| | | @ApiModelProperty(value = "序号") |
| | | @Excel(name = "序号",width = 20) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "点位ID") |
| | | @Excel(name = "点位ID",width = 20) |
| | | private String pointNumber; |
| | | @ApiModelProperty(value = "点位名称") |
| | | @Excel(name = "点位名称",width = 20) |
| | | private String pointName; |
| | | @ApiModelProperty(value = "点位状态名称") |
| | | @Excel(name = "状态",width = 20) |
| | | private String pointStatusName; |
| | | |
| | | @ApiModelProperty(value = "现场情况(1=正常,2=异常)") |
| | | @Excel(name = "现场情况",width = 20) |
| | | private String fieldSituationName; |
| | | /** |
| | | * 现场情况说明 |
| | | */ |
| | | @ApiModelProperty("现场情况说明") |
| | | @Excel(name = "现场情况说明",width = 20) |
| | | private String sceneDescription; |
| | | |
| | | |
| | | @ApiModelProperty(value = "上报运维名称") |
| | | @Excel(name = "上报人",width = 20) |
| | | private String operationsUserName; |
| | | |
| | | @ApiModelProperty("上报时间") |
| | | @Excel(name = "序号",width = 20) |
| | | private String reportingTimeStr; |
| | | |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.operation.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.xiaopeng.api.model.operation.XpPasswordFreePolicy; |
| | | import com.xiaopeng.api.query.operation.XpPasswordFreePolicyQuery; |
| | | import com.xiaopeng.api.query.operation.XpPointSituationReportQuery; |
| | | import com.xiaopeng.api.vo.operation.XpPointSituationReportVo; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface XpPasswordFreePolicyMapper extends BaseMapper<XpPasswordFreePolicy> { |
| | | |
| | | |
| | | |
| | | /** |
| | | * 分页查询路线规划配置列表 |
| | | * |
| | | * @param pageInfo 分页信息 |
| | | * @param query 查询条件 |
| | | * @return 路线规划配置列表 |
| | | */ |
| | | List<XpPasswordFreePolicy> pageList(@Param("pageInfo") PageInfo<XpPasswordFreePolicy> pageInfo, |
| | | @Param("query") XpPasswordFreePolicyQuery query); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.xiaopeng.api.model.operation.XpPointSituationReport; |
| | | import com.xiaopeng.api.query.operation.XpPointSituationReportQuery; |
| | | import com.xiaopeng.api.vo.operation.XpPointSituationReportVo; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface XpPointSituationReportMapper extends BaseMapper<XpPointSituationReport> { |
| | | |
| | | |
| | | |
| | | /** |
| | | * 分页查询路线规划配置列表 |
| | | * |
| | | * @param pageInfo 分页信息 |
| | | * @param query 查询条件 |
| | | * @return 路线规划配置列表 |
| | | */ |
| | | List<XpPointSituationReportVo> pageList(@Param("pageInfo") PageInfo<XpPointSituationReportVo> pageInfo, |
| | | @Param("query") XpPointSituationReportQuery query); |
| | | |
| | | List<XpPointSituationReportVo> pageList(@Param("query") XpPointSituationReportQuery query); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.xiaopeng.api.model.operation.XpPointSituationReport; |
| | | import com.xiaopeng.api.query.operation.XpPointSituationReportQuery; |
| | | import com.xiaopeng.api.vo.operation.XpPointSituationReportVo; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface IXpPointSituationReportService extends IService<XpPointSituationReport> { |
| | | PageInfo<XpPointSituationReportVo> pageList(XpPointSituationReportQuery query); |
| | | |
| | | XpPointSituationReportVo getdetail(Long id); |
| | | |
| | | List<XpPointSituationReportVo> exportList(XpPointSituationReportQuery query); |
| | | |
| | | void deleteById(Long id); |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.operation.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.xiaopeng.api.model.operation.XpPasswordFreePolicy; |
| | | import com.xiaopeng.api.query.operation.XpPasswordFreePolicyQuery; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | |
| | | public interface XpPasswordFreePolicyService extends IService<XpPasswordFreePolicy> { |
| | | |
| | | |
| | | PageInfo<XpPasswordFreePolicy> pageList(XpPasswordFreePolicyQuery query); |
| | | |
| | | void deleteById(Long id); |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.operation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xiaopeng.api.model.operation.XpPasswordFreePolicy; |
| | | import com.xiaopeng.api.query.operation.XpPasswordFreePolicyQuery; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.mapper.XpPasswordFreePolicyMapper; |
| | | import com.xiaopeng.operation.service.XpPasswordFreePolicyService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | | public class XpPasswordFreePolicyServiceImpl extends ServiceImpl<XpPasswordFreePolicyMapper, XpPasswordFreePolicy> implements XpPasswordFreePolicyService { |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<XpPasswordFreePolicy> pageList(XpPasswordFreePolicyQuery query) { |
| | | // 创建分页对象 |
| | | PageInfo<XpPasswordFreePolicy> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | // 调用Mapper查询 |
| | | List<XpPasswordFreePolicy> list = this.baseMapper.pageList(pageInfo, query); |
| | | // 设置结果 |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void deleteById(Long id) { |
| | | // 1. 检查记录是否存在 |
| | | XpPasswordFreePolicy bean = this.getById(id); |
| | | if (bean == null) { |
| | | throw new ServiceException("密支付策略配置不存在"); |
| | | } |
| | | |
| | | // 2. 逻辑删除(MyBatis-Plus自动处理) |
| | | this.removeById(id); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.xiaopeng.operation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xiaopeng.api.feignClient.account.XpOperationUserClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetOperationsClient; |
| | | import com.xiaopeng.api.model.account.XpOperationsUser; |
| | | import com.xiaopeng.api.model.operation.XpPointSituationReport; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpFleet; |
| | | import com.xiaopeng.api.query.operation.XpPointSituationReportQuery; |
| | | import com.xiaopeng.api.vo.operation.XpPointSituationReportVo; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.mapper.XpPointSituationReportMapper; |
| | | import com.xiaopeng.operation.service.IXpPointSituationReportService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | @Service |
| | | public class XpPointSituationReportServiceImpl extends ServiceImpl<XpPointSituationReportMapper, XpPointSituationReport> implements IXpPointSituationReportService { |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private XpOperationUserClient xpOperationUserClient; |
| | | @Resource |
| | | private XpFleetOperationsClient xpFleetOperationsClient; |
| | | |
| | | @Override |
| | | public PageInfo<XpPointSituationReportVo> pageList(XpPointSituationReportQuery query) { |
| | | // 创建分页对象 |
| | | PageInfo<XpPointSituationReportVo> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | // 调用Mapper查询 |
| | | List<XpPointSituationReportVo> list = this.baseMapper.pageList(pageInfo, query); |
| | | extracted(list); |
| | | // 设置结果 |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | private void extracted(List<XpPointSituationReportVo> list) { |
| | | if(!list.isEmpty()){ |
| | | // 收集所有运维人员ID |
| | | Set<Long> operationsUserIds = list.stream() |
| | | .map(XpPointSituationReportVo::getOperationsUserId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | // 批量查询操作人信息 |
| | | Map<Long, String> userNameMap = new HashMap<>(); |
| | | if (!CollectionUtils.isEmpty(operationsUserIds)) { |
| | | R<List<XpOperationsUser>> userResult = xpOperationUserClient.listByIds(operationsUserIds); |
| | | List<XpOperationsUser> users = userResult.getData(); |
| | | if (!CollectionUtils.isEmpty(users)) { |
| | | userNameMap = users.stream() |
| | | .collect(Collectors.toMap(XpOperationsUser::getId, XpOperationsUser::getNickName)); |
| | | } |
| | | } |
| | | |
| | | for (XpPointSituationReportVo bean : list) { |
| | | if (userNameMap.containsKey(bean.getOperationsUserId())){ |
| | | bean.setOperationsUserName(userNameMap.get(bean.getOperationsUserId())); |
| | | } |
| | | if(bean.getOperationStatus() != null){//运营状态 1=待启用 2=启用中 3=已停用 4=已失效 |
| | | if(bean.getOperationStatus() == 1){ |
| | | bean.setPointStatusName("待启用"); |
| | | }else if(bean.getOperationStatus() == 2){ |
| | | bean.setPointStatusName("启用中"); |
| | | }else if(bean.getOperationStatus() == 3){ |
| | | bean.setPointStatusName("已停用"); |
| | | }else if(bean.getOperationStatus() == 4){ |
| | | bean.setPointStatusName("已失效"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public XpPointSituationReportVo getdetail(Long id) { |
| | | XpPointSituationReportQuery query = new XpPointSituationReportQuery(); |
| | | query.setId(id); |
| | | List<XpPointSituationReportVo> list = this.baseMapper.pageList(query); |
| | | if(list.isEmpty()){ |
| | | throw new ServiceException("未查询该数据"); |
| | | } |
| | | XpPointSituationReportVo bean = list.get(0); |
| | | |
| | | // 批量查询操作人信息 |
| | | R<List<XpOperationsUser>> userResult = xpOperationUserClient.listByIds(new ArrayList<Long>(){{ |
| | | add(bean.getOperationsUserId()); |
| | | }} ); |
| | | List<XpOperationsUser> users = userResult.getData(); |
| | | if (CollectionUtils.isEmpty(users)) { |
| | | throw new ServiceException("未查询该运维人员"); |
| | | } |
| | | Map<Long, String> userNameMap = users.stream() |
| | | .collect(Collectors.toMap(XpOperationsUser::getId, XpOperationsUser::getNickName)); |
| | | |
| | | bean.setOperationsUserName(userNameMap.get(bean.getOperationsUserId())); |
| | | |
| | | R<List<XpFleet>> fleetByUserId = xpFleetOperationsClient.getFleetByUserId(bean.getOperationsUserId()); |
| | | if(fleetByUserId.getCode() != R.SUCCESS || fleetByUserId.getData().isEmpty()){ |
| | | throw new ServiceException("未查询该车队"); |
| | | } |
| | | |
| | | bean.setOperationsUserFleetName(fleetByUserId.getData().get(0).getFleetName()); |
| | | |
| | | return bean; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<XpPointSituationReportVo> exportList(XpPointSituationReportQuery query) { |
| | | List<XpPointSituationReportVo> list = this.baseMapper.pageList(query); |
| | | extracted(list); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void deleteById(Long id) { |
| | | // 1. 检查记录是否存在 |
| | | XpPointSituationReport bean = this.getById(id); |
| | | if (bean == null) { |
| | | throw new ServiceException("密支付策略配置不存在"); |
| | | } |
| | | // 2. 逻辑删除(MyBatis-Plus自动处理) |
| | | this.removeById(id); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.xiaopeng.operation.service.impl; |
| | | |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | |
| | | import com.xiaopeng.api.dto.operation.LonLatDto; |
| | | import com.xiaopeng.api.feignClient.account.XpAppUserClient; |
| | | import com.xiaopeng.api.feignClient.account.XpAppUserCouponClient; |
| | | import com.xiaopeng.api.feignClient.maintenance.XpVehicleModelClient; |
| | | import com.xiaopeng.api.feignClient.map.XpMapClient; |
| | | import com.xiaopeng.api.feignClient.order.XpOrderClient; |
| | | import com.xiaopeng.api.model.account.XpAppUser; |
| | | import com.xiaopeng.api.model.maintenance.XpVehicleModel; |
| | | import com.xiaopeng.api.model.operation.*; |
| | | import com.xiaopeng.api.model.order.XpOrder; |
| | | import com.xiaopeng.api.vo.account.UserCouponVo; |
| | |
| | | import com.xiaopeng.common.redis.service.RedisService; |
| | | import com.xiaopeng.operation.constant.I18nKeyConstant; |
| | | import com.xiaopeng.operation.dto.*; |
| | | import com.xiaopeng.operation.job.base.QuartzManager; |
| | | import com.xiaopeng.operation.job.base.TimeJobType; |
| | | import com.xiaopeng.operation.job.jobs.DynamicPricingCheckJob; |
| | | import com.xiaopeng.operation.mapper.*; |
| | | import com.xiaopeng.operation.query.PricingPageListQuery; |
| | | import com.xiaopeng.operation.service.IXpGeoQueryEntityService; |
| | | import com.xiaopeng.operation.service.XpPointService; |
| | | import com.xiaopeng.operation.service.XpPricingService; |
| | | import com.xiaopeng.operation.job.base.QuartzManager; |
| | | import com.xiaopeng.operation.job.base.TimeJobType; |
| | | import com.xiaopeng.operation.job.jobs.DynamicPricingCheckJob; |
| | | import com.xiaopeng.operation.utils.XpPricingUtil; |
| | | import com.xiaopeng.operation.utils.holiday.HolidayUtil; |
| | | import com.xiaopeng.operation.utils.map.FastDistanceCalculator; |
| | |
| | | |
| | | |
| | | @Resource |
| | | private XpVehicleModelClient xpVehicleModelClient; |
| | | @Resource |
| | | private XpWhitelistMapper xpWhitelistMapper; |
| | | |
| | | @Resource |
| | |
| | | |
| | | @Autowired |
| | | private XpPointService xpPointService; |
| | | |
| | | @Resource(name = "hutoolSnowflake") |
| | | private Snowflake snowflake; |
| | | |
| | | |
| | | // 自定义线程池用于并行执行任务 |
| | |
| | | xpOrder.setEndPointId(dto.getEndPointId()); |
| | | xpOrder.setStartPointName(xpPoint.getPointName()); |
| | | xpOrder.setEndPointName(endXpPoint.getPointName()); |
| | | xpOrder.setXpuTaskId(snowflake.nextId() + ""); |
| | | |
| | | // 当前时段 |
| | | String currentTimeSlot = DateUtils.getCurrentTimeSlot(); |
| | |
| | | Page<PricingPageListVO> page = this.baseMapper.pageList(pageInfo, query); |
| | | pageInfo.setRecords(page.getRecords()); |
| | | pageInfo.setTotal(page.getTotal()); |
| | | if(page.getRecords() != null){ |
| | | Set<String> vehicleModelIds = page.getRecords().stream().map(PricingPageListVO::getVehicleModel).collect(Collectors.toSet()); |
| | | R<List<XpVehicleModel>> listR = xpVehicleModelClient.listByIds(vehicleModelIds); |
| | | if(listR != null && listR.getData() != null){ |
| | | List<XpVehicleModel> vehicleModels = listR.getData(); |
| | | Map<String, XpVehicleModel> vehicleModelMap = new HashMap<>(); |
| | | for (XpVehicleModel vehicleModel : vehicleModels) { |
| | | vehicleModelMap.put(vehicleModel.getId().toString(), vehicleModel); |
| | | } |
| | | for (PricingPageListVO record : page.getRecords()) { |
| | | XpVehicleModel xpVehicleModel = vehicleModelMap.get(record.getVehicleModel()); |
| | | if(xpVehicleModel != null){ |
| | | record.setVehicleModelName(xpVehicleModel.getName()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return pageInfo; |
| | | } |
| | | |
| | |
| | | // 下发XPU命令 |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setVin(priorityVin); |
| | | pushOrderDto.setTaskId(orderCheck.getData().getXpuTaskId()); |
| | | pushOrderDto.setOrderId(orderCheck.getData().getId().toString()); |
| | | pushOrderDto.setStartLatitude(orderCheck.getData().getStartLat()); |
| | | pushOrderDto.setStartLongitude(orderCheck.getData().getStartLon()); |
| | |
| | | log.info("关闭巡游单成功 {} {}", vehiclePosition.getPlateNumber(), orderNo); |
| | | // 下发命令 |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setTaskId(xpOrder.getXpuTaskId()); |
| | | pushOrderDto.setVin(vehiclePosition.getVehicleVin()); |
| | | pushOrderDto.setOrderId(xpOrder.getId().toString()); |
| | | pushOrderDto.setStartLatitude(xpOrder.getStartLat()); |
| | |
| | | log.info("关闭巡游单成功 {} {}", vehicleId1.getPlateNumber(), orderNo); |
| | | PushOrderDto pushOrderDto = buildPushOrderDto(xpOrder); |
| | | pushOrderDto.setVin(vehiclePosition.getVin()); |
| | | pushOrderDto.setTaskId(xpOrder.getXpuTaskId()); |
| | | // 调用推送服务 orderId + carVin |
| | | orderMissionClient.pushOrder(pushOrderDto); |
| | | log.info("开始推送 {} 订单到XPU", xpOrder.getOrderNumber()); |
| | |
| | | routeToOrigin.setDistance(routeToOrigin.getDistance() + routeRemain.getDistance()); |
| | | PushOrderDto pushOrderDto = buildPushOrderDto(xpOrder); |
| | | pushOrderDto.setVin(xpVehicle.getVehicleVin()); |
| | | pushOrderDto.setTaskId(xpOrder.getXpuTaskId()); |
| | | // 订单流转 |
| | | orderMissionClient.pushOrder(pushOrderDto); |
| | | redisService.setCacheObject(CacheConstants.nextOrder(luckyOder.getId().toString()), xpOrder.getId()); |
| | |
| | | } |
| | | |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setTaskId(data.getXpuTaskId()); |
| | | pushOrderDto.setVin(vehiclePosition.getVin()); |
| | | pushOrderDto.setOrderId(data.getId().toString()); |
| | | pushOrderDto.setStartLatitude(data.getStartLat()); |
| | |
| | | @ApiModelProperty(value = "车型") |
| | | private String vehicleModel; |
| | | |
| | | @ApiModelProperty(value = "车型名称") |
| | | private String vehicleModelName; |
| | | |
| | | @ApiModelProperty(value = "使用城市") |
| | | private String useCity; |
| | | |
| New file |
| | |
| | | <?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.XpPasswordFreePolicyMapper"> |
| | | |
| | | |
| | | <!-- 分页查询路线规划配置列表 --> |
| | | <select id="pageList" resultType="com.xiaopeng.api.model.operation.XpPasswordFreePolicy"> |
| | | SELECT a.* |
| | | FROM xp_password_free_policy as a |
| | | WHERE a.is_deleted = 0 |
| | | <if test="query.cityName != null and query.cityName != ''"> |
| | | AND a.city_name LIKE CONCAT('%', #{query.cityName}, '%') |
| | | </if> |
| | | <if test="query.createTimeStart != null"> |
| | | AND a.create_time >= #{query.createTimeStart} |
| | | </if> |
| | | <if test="query.createTimeEnd != null"> |
| | | AND a.create_time <= #{query.createTimeEnd} |
| | | </if> |
| | | ORDER BY a.create_time DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.xiaopeng.operation.mapper.XpPointSituationReportMapper"> |
| | | |
| | | |
| | | |
| | | |
| | | <!-- 分页查询路线规划配置列表 --> |
| | | <select id="pageList" resultType="com.xiaopeng.api.vo.operation.XpPointSituationReportVo"> |
| | | SELECT a.*,b.point_name,b.point_number,b.point_type,b.operation_status,b.verification_status |
| | | FROM xp_point_situation_report as a |
| | | inner join xp_point as b on a.point_id = b.id |
| | | WHERE a.is_deleted = 0 |
| | | <if test="query.id != null and query.id != ''"> |
| | | AND b.point_name = #{query.id} |
| | | </if> |
| | | <if test="query.ids != null and query.ids.size() > 0"> |
| | | AND a.id IN |
| | | <foreach collection="query.ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="query.pointName != null and query.pointName != ''"> |
| | | AND b.point_name LIKE CONCAT('%', #{query.pointName}, '%') |
| | | </if> |
| | | <if test="query.pointNumber != null and query.pointNumber != ''"> |
| | | AND b.point_number LIKE CONCAT('%', #{query.pointNumber}, '%') |
| | | </if> |
| | | <if test="query.fieldSituation != null and query.fieldSituation != ''"> |
| | | AND a.field_situation = #{query.fieldSituation} |
| | | </if> |
| | | <if test="query.operationsUserId != null and query.operationsUserId != ''"> |
| | | AND a.operations_user_id = #{query.operationsUserId} |
| | | </if> |
| | | <if test="query.reportingTimeStart != null"> |
| | | AND a.reporting_time >= #{query.reportingTimeStart} |
| | | </if> |
| | | <if test="query.reportingTimeEnd != null"> |
| | | AND a.reporting_time <= #{query.reportingTimeEnd} |
| | | </if> |
| | | ORDER BY a.create_time DESC |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | </mapper> |
| New file |
| | |
| | | package com.xiaopeng.order.config; |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Configuration |
| | | public class SnowflakeConfig { |
| | | |
| | | //初始时间戳,设为2026年1月1日0点0时0分 |
| | | public static final Date EPOCH_DATE = new Date(1767225600000L); |
| | | /** |
| | | * 如果配置为<0的值,则woker-id根据pod名的hash取模生成 |
| | | * 如果配置为>=0的值,则取配置的值 |
| | | * 如果多个pod的data-center-id和worker-id相同,同一毫秒内请求数上千的话,可能会产生碰撞,生成一样的snowflake id |
| | | */ |
| | | @Value("${snowflake.worker-id:-1}") |
| | | private long workerId; |
| | | |
| | | @Value("${snowflake.data-center-id:0}") |
| | | private long dataCenterId; |
| | | |
| | | @Bean("hutoolSnowflake") |
| | | public Snowflake snowflake() { |
| | | long resolvedWorkerId = resolveWorkerId(); |
| | | return new Snowflake(EPOCH_DATE, resolvedWorkerId, dataCenterId, false); |
| | | } |
| | | |
| | | private long resolveWorkerId() { |
| | | if (workerId >= 0 && workerId <= Snowflake.MAX_WORKER_ID) { |
| | | return workerId; |
| | | } |
| | | String podName = System.getenv("HOSTNAME"); |
| | | if (podName == null || podName.isEmpty()) { |
| | | return 0; |
| | | } |
| | | int end = podName.length() - 1; |
| | | while (end >= 0 && Character.isDigit(podName.charAt(end))) { |
| | | end--; |
| | | } |
| | | String numberPart = podName.substring(end + 1); |
| | | long candidate; |
| | | if (!numberPart.isEmpty()) { |
| | | try { |
| | | candidate = Long.parseLong(numberPart); |
| | | } catch (NumberFormatException e) { |
| | | candidate = Math.abs(podName.hashCode()); |
| | | } |
| | | } else { |
| | | candidate = Math.abs(podName.hashCode()); |
| | | } |
| | | return candidate % (Snowflake.MAX_WORKER_ID + 1); |
| | | } |
| | | } |
| | |
| | | } |
| | | List<ServiceVehicleListVo> collect = serviceVehicleList.getData().stream().map(xpVehicle -> { |
| | | ServiceVehicleListVo vo = new ServiceVehicleListVo(); |
| | | vo.setVim(xpVehicle.getVehicleVin()); |
| | | vo.setVin(xpVehicle.getVehicleVin()); |
| | | vo.setPlateNumber(xpVehicle.getPlateNumber()); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | |
| | | |
| | | // 下发命令 |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setTaskId(order.getXpuTaskId()); |
| | | pushOrderDto.setVin(order.getVehicleVin()); |
| | | pushOrderDto.setOrderId("XU" + order.getId()); |
| | | pushOrderDto.setStartLatitude(order.getStartLat()); |
| | |
| | | log.info("完成连环单用户车辆绑定关系 {}", xpOrder.getOrderNumber()); |
| | | //开始将新订单推送给车端 |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setTaskId(xpOrder.getXpuTaskId()); |
| | | pushOrderDto.setOrderId(xpOrder.getId().toString()); |
| | | pushOrderDto.setStartLatitude(xpOrder.getStartLat()); |
| | | pushOrderDto.setStartLongitude(xpOrder.getStartLon()); |
| | |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | |
| | | |
| | | @Value("${robotaxi.appId:xp_robotaxi_api}") |
| | | private String appid; |
| | | |
| | | @Resource(name = "hutoolSnowflake") |
| | | private Snowflake snowflake; |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | // 11.2 下发订单到新车辆 |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setTaskId(order.getXpuTaskId()); |
| | | pushOrderDto.setVin(newVehicle.getVehicleVin()); |
| | | pushOrderDto.setOrderId(order.getId().toString()); |
| | | pushOrderDto.setStartLatitude(order.getStartLat()); |
| | |
| | | returnOrder.setLastOrderId(lastCruise.getId()); |
| | | returnOrder.setCreateTime(LocalDateTime.now()); |
| | | returnOrder.setMissionId(lastCruise.getMissionId()); |
| | | returnOrder.setXpuTaskId(snowflake.nextId() + ""); |
| | | |
| | | // 返程起点 = 当前订单的终点(车辆当前位置附近) |
| | | returnOrder.setStartPointId(order.getEndPointId()); |
| | |
| | | |
| | | // 下发巡游订单到原车辆 |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setTaskId(returnOrder.getXpuTaskId()); |
| | | pushOrderDto.setVin(oldVehicle.getVehicleVin()); |
| | | pushOrderDto.setOrderId("XU" + returnOrder.getId()); |
| | | pushOrderDto.setStartLatitude(returnOrder.getStartLat()); |
| | |
| | | xpCruiseOrder.setStartPointName(order.getEndPointName()); |
| | | xpCruiseOrder.setStartLon(order.getEndLon()); |
| | | xpCruiseOrder.setStartLat(order.getEndLat()); |
| | | xpCruiseOrder.setXpuTaskId(snowflake.nextId() + ""); |
| | | |
| | | // 完成的直接走终点 终止的走起点 |
| | | if(null != xpCruiseOrders){ |
| | |
| | | log.info("添加巡游单成功 {}", xpCruiseOrder.getId()); |
| | | //下发XUP巡游订单报文 |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setTaskId(xpCruiseOrder.getXpuTaskId()); |
| | | pushOrderDto.setVin(xpCruiseOrder.getVehicleVin()); |
| | | pushOrderDto.setOrderId("XU" + xpCruiseOrder.getId()); |
| | | pushOrderDto.setStartLatitude(xpCruiseOrder.getStartLat()); |
| | |
| | | xpCruiseOrder.setFleetId(vehicle.getFleetId()); |
| | | xpCruiseOrder.setVehicleVin(vehicle.getVehicleVin()); |
| | | xpCruiseOrder.setOrderType(2); |
| | | xpCruiseOrder.setXpuTaskId(snowflake.nextId() + ""); |
| | | // 返程起点是当前正常订单的终点 |
| | | xpCruiseOrder.setStartPointId(null); |
| | | xpCruiseOrder.setStartPointName(null); |
| | |
| | | |
| | | //下发XPU消息报文 |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setTaskId(xpCruiseOrder.getXpuTaskId()); |
| | | pushOrderDto.setVin(xpCruiseOrder.getVehicleVin()); |
| | | pushOrderDto.setOrderId("XU" + xpCruiseOrder.getId()); |
| | | pushOrderDto.setStartLatitude(xpCruiseOrder.getStartLat()); |
| | |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | |
| | | @Resource |
| | | private BootCommonService bootCommonService; |
| | | |
| | | @Resource(name = "hutoolSnowflake") |
| | | private Snowflake snowflake; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | xpOrder.setStatus(1); |
| | | xpOrder.setOrderSource(1); |
| | | xpOrder.setOpenTrunk(2); |
| | | xpOrder.setXpuTaskId(snowflake.nextId() + ""); |
| | | |
| | | // 当前时段 |
| | | String currentTimeSlot = DateUtils.getCurrentTimeSlot(); |
| | |
| | | redisService.setCacheObject("TEST_ORDER_NAVIGATION_END_DATA:" + vehicleId, JSON.toJSONString(routeVo), 24L, TimeUnit.HOURS); |
| | | //下发XPU消息 |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setTaskId(xpOrder.getXpuTaskId()); |
| | | pushOrderDto.setVin(xpVehicle.getVehicleVin()); |
| | | pushOrderDto.setOrderId("TEST" + xpOrder.getId()); |
| | | pushOrderDto.setStartLatitude(xpOrder.getStartLat()); |
| | |
| | | try { |
| | | // 11.2 下发订单到新车辆 |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setTaskId(order.getXpuTaskId()); |
| | | pushOrderDto.setVin(newVehicle.getVehicleVin()); |
| | | pushOrderDto.setOrderId("TEST" + order.getId()); |
| | | pushOrderDto.setStartLatitude(order.getStartLat()); |
| | |
| | | @Data |
| | | @ApiModel |
| | | public class ServiceVehicleListVo { |
| | | @ApiModelProperty("vim码") |
| | | private String vim; |
| | | @ApiModelProperty("vin码") |
| | | private String vin; |
| | | @ApiModelProperty("车牌号") |
| | | private String plateNumber; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据人员id 获取所属车队 |
| | | * |
| | | * @param id 运维人员id |
| | | * @return 车辆isd |
| | | */ |
| | | @GetMapping("/logan/inner/fleet-operations/getFleetByUserId/{id}") |
| | | public R<List<XpFleet>> getFleetByUserId(@PathVariable("id") Long id){ |
| | | List<Long> fleetIds = xpFleetOperationsService.lambdaQuery().eq(XpFleetOperations::getOperationsUserId, id) |
| | | .list().stream().map(XpFleetOperations::getFleetId).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(fleetIds)){ |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | |
| | | List<XpFleet> xpFleets = xpFleetService.listByIds(fleetIds); |
| | | return R.ok(xpFleets); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据运维人员ID查询关联的车队ID列表(内部接口) |
| | | * |
| | | * @param userId 运维人员ID |