Merge remote-tracking branch 'origin/1.0' into 1.0
| | |
| | | for (Map.Entry<Long, List<XpAppUserCoupon>> entry : groupedByUserId.entrySet()) { |
| | | Long appUserId = entry.getKey(); |
| | | RLock lock = redissonClient.getLock("app_user_coupon_expired_" + appUserId ); |
| | | if(lock.tryLock(0, 10, TimeUnit.SECONDS)){ |
| | | try { |
| | | try { |
| | | if(lock.tryLock(0, 10, TimeUnit.SECONDS)){ |
| | | List<Long> ids = new ArrayList<>(); |
| | | BigDecimal money = BigDecimal.ZERO; |
| | | String couponName = ""; |
| | |
| | | |
| | | xpAppUserCouponService.updateExpirationTime(ids); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("优惠券过期发送微信通知失败", e); |
| | | } finally { |
| | | lock.unlock(); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("优惠券过期发送微信通知失败", e); |
| | | } finally { |
| | | lock.unlock(); |
| | | } |
| | | } |
| | | } |
| | |
| | | @ApiModel("路线/价格过期校验") |
| | | public class RouteStaleCheckDto { |
| | | |
| | | @NotNull |
| | | @NotNull(message = "snapshotId不能为空") |
| | | @ApiModelProperty(value = "multi-route 返回的 snapshotId", required = true) |
| | | private String snapshotId; |
| | | |
| | | @ApiModelProperty("当前选中的路径标识") |
| | | private String pathFingerprint; |
| | | |
| | | @NotNull |
| | | @NotNull(message = "clientSnapshotMillis不能为空") |
| | | @ApiModelProperty(value = "快照生成时间(与 multi 返回的 generatedAtMillis 一致)", required = true) |
| | | private Long clientSnapshotMillis; |
| | | |
| | |
| | | * @return 车辆 |
| | | */ |
| | | @GetMapping("/logan/inner/vehicle/queryById") |
| | | R<XpVehicle> queryById(@RequestParam Long id); |
| | | R<XpVehicle> queryById(@RequestParam("id") Long id); |
| | | /** |
| | | * 修改车辆信息 |
| | | * |
| | |
| | | @PostMapping("/base/v1/mini-program/navigation/select-route") |
| | | @ApiOperation(value = "选中某条路线并写入导航缓存", tags = {"小程序-路线选择"}) |
| | | @XpClientCheck(checkToken = false, checkOtpToken = true) |
| | | public R<Void> selectNavigationRoute(@RequestBody @Valid SelectNavigationRouteDto dto, HttpServletRequest request) { |
| | | public R selectNavigationRoute(@RequestBody @Valid SelectNavigationRouteDto dto, HttpServletRequest request) { |
| | | String uid = request.getHeader("XP-Uid"); |
| | | xpPricingService.selectNavigationRoute(dto, uid); |
| | | return R.ok(); |
| | |
| | | @PostMapping("/base/v1/mini-program/navigation/route-stale-check") |
| | | @ApiOperation(value = "路线/价格过期静默校验", tags = {"小程序-路线选择"}, response = RouteStaleCheckVo.class) |
| | | @XpClientCheck(checkToken = false, checkOtpToken = true) |
| | | public R<RouteStaleCheckVo> checkRouteStale(@RequestBody @Valid RouteStaleCheckDto dto, HttpServletRequest request) { |
| | | public R<RouteStaleCheckVo> checkRouteStale( @Valid @RequestBody RouteStaleCheckDto dto, HttpServletRequest request) { |
| | | String uid = request.getHeader("XP-Uid"); |
| | | return R.ok(xpPricingService.checkRouteStale(dto, uid)); |
| | | } |
| | |
| | | if(order.getOrderChange() > orderChange){ |
| | | throw new ServiceException("目的地修改次数已超上限"); |
| | | } |
| | | if(order.getVehicleId() == null){ |
| | | throw new ServiceException("行驶中的车辆信息错误"); |
| | | } |
| | | |
| | | XpVehicle xpVehicle = vehicleClient.queryById(order.getVehicleId()).getData(); |
| | | if(xpVehicle== null){ |
| | | throw new ServiceException("获取行驶中的车辆信息错误"); |
| | | } |
| | | |
| | | // 是否在运营区域时间内 |
| | | XpElectronicFenceArea xpElectronicFenceArea = xpElectronicFenceAreaMapper.selectById(order.getXpElectronicFenceAreaId()); |
| | |
| | | xpOrder.setQueueName(key); |
| | | xpOrderClient.updateOrder(xpOrder); |
| | | //给车端推送修改目的地报文 |
| | | XpVehicle xpVehicle = vehicleClient.queryById(xpOrder.getVehicleId()).getData(); |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setOrderId(order.getId().toString()); |
| | | pushOrderDto.setStartTaskId(order.getXpuStartTaskId()); |
| | |
| | | pushOrderDto.setOperation_type(OrderOperationType.CLOUD_CHANGE_DESTINATION); |
| | | orderMissionClient.updateEndAddress(pushOrderDto); |
| | | log.info("订单下发XPU修改目的地成功 {}", order.getId()); |
| | | |
| | | |
| | | // 判断当前订单的车辆是否有连环派单,然后判断是都还满足连环派单的条件,不满足则需要重新派单 |
| | | String json = redisService.getCacheObject(CacheConstants.nextOrder(order.getId().toString())); |
| | |
| | | package com.xiaopeng.itinerary.service.impl; |
| | | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import com.alibaba.fastjson2.JSON; |
| | |
| | | private UserRoutePlanRuleClient userRoutePlanRuleClient; |
| | | @Resource |
| | | private XpTargetedServiceClient xpTargetedServiceClient; |
| | | @Resource |
| | | private XpTradingStrategyClient xpTradingStrategyClient; |
| | | |
| | | @Resource(name = "hutoolSnowflake") |
| | | private Snowflake snowflake; |
| | |
| | | // 判断是否有进行的订单 |
| | | R<Long> r = xpOrderClient.hasUnPaodOrder(uid); |
| | | if (r.getData() > 0) { |
| | | throw new RuntimeException("有正在进行的订单"); |
| | | throw new ServiceException("有正在进行的订单"); |
| | | } |
| | | |
| | | // 获取起点经纬度 |
| | |
| | | |
| | | int targetedVal = 0; |
| | | R<List<XpTargetedServiceVehicleVo>> targetedServiceUserR = xpTargetedServiceClient.findListByUserIdAndCityCode(xpOrder.getAppUserId(), xpOrder.getCityCode()); |
| | | if(targetedServiceUserR.getCode() == R.SUCCESS && !targetedServiceUserR.getData().isEmpty()){ |
| | | if(targetedServiceUserR.getCode() == R.SUCCESS && CollUtil.isNotEmpty(targetedServiceUserR.getData()) ){ |
| | | targetedVal = targetedServiceUserR.getData().get(0).getWeight(); |
| | | } |
| | | //String key = CacheConstants.QUEUE_POINT_ID + "-" + xpPoint.getId() + "-" + xpPoint.getPointLon() + "," + xpPoint.getPointLat(); |
| | |
| | | payload.setUserCouponId(routeAndFareDto.getUserCouponId()); |
| | | payload.setRoutes(options); |
| | | |
| | | XpTradingStrategyDetailVO strategyDetailVO = xpTradingStrategyClient.queryById().getData(); |
| | | R<XpTradingStrategyDetailVO> strategyDetailVOR = xpTradingStrategyClient.queryById(); |
| | | XpTradingStrategyDetailVO strategyDetailVO = strategyDetailVOR.getData(); |
| | | redisService.setCacheObject(CacheConstants.ORDER_MULTI_ROUTE_SNAPSHOT + userId + ":" + snapshotId, JSON.toJSONString(payload), Long.valueOf(strategyDetailVO.getMaxStandingTiming()), TimeUnit.SECONDS); |
| | | |
| | | MultiRouteAndFareVo vo = new MultiRouteAndFareVo(); |
| | |
| | | redisService.setCacheObject("ORDER_NAVIGATION_END_DATA:" + userId, JSON.toJSONString(first.getRoute()), 24L, TimeUnit.HOURS); |
| | | return vo; |
| | | } |
| | | XpTradingStrategyClient xpTradingStrategyClient; |
| | | @Override |
| | | public void selectNavigationRoute(SelectNavigationRouteDto dto, String userId) { |
| | | String json = redisService.getCacheObject(CacheConstants.ORDER_MULTI_ROUTE_SNAPSHOT + userId + ":" + dto.getSnapshotId()); |
| | |
| | | LocalDateTime endTime = LocalDateTimeUtil.parse(endTimeStr, DatePattern.NORM_DATETIME_PATTERN); |
| | | if(!now.isBefore(startTime) && !now.isAfter(endTime)){ |
| | | flag = true; |
| | | }else{ |
| | | stationNumbers.setPendingLaunch(stationNumbers.getPendingLaunch() + 1); |
| | | } |
| | | } |
| | | if (flag){ |
| | |
| | | xpElectronicFenceAreaService.updateBatchById(electronicFenceAreaList); |
| | | } |
| | | |
| | | //点位失效 |
| | | xpStationService.setStatusFailure(electronicId);//场站失效 |
| | | |
| | | // 删除旧的区域数据,然后保存新的区域数据 |
| | |
| | | import com.xiaopeng.api.dto.operation.XpActivityDto; |
| | | import com.xiaopeng.api.model.operation.XpActivity; |
| | | import com.xiaopeng.api.query.operation.XpActivityPageListQuery; |
| | | import com.xiaopeng.api.vo.operation.XpActivityVo; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | |
| | | import java.util.List; |
| | |
| | | import com.xiaopeng.api.dto.operation.XpActivityDto; |
| | | import com.xiaopeng.api.model.operation.XpActivity; |
| | | import com.xiaopeng.api.query.operation.XpActivityPageListQuery; |
| | | import com.xiaopeng.api.vo.operation.XpActivityVo; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | |
| | | import java.util.List; |
| | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | @Nullable |
| | | |
| | | private R<XpOrder> getOrderTripEnd(String orderId) { |
| | | XpOrder xpOrder = xpOrderService.getById(orderId); |
| | | if(xpOrder == null){ |
| File was renamed from xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/BootCommonService.java |
| | |
| | | package com.xiaopeng.order.service; |
| | | package com.xiaopeng.order.service.impl; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.xiaopeng.api.feignClient.operation.XpPricingClient; |
| | |
| | | import com.xiaopeng.common.core.enums.OrderStatusEnum; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.redis.service.RedisService; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import com.xiaopeng.order.service.IXpOrderService; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Service |
| | | @Component |
| | | public class BootCommonService { |
| | | |
| | | @Resource |
| | |
| | | @Resource |
| | | private XpVehicleClient xpVehicleClient; |
| | | @Resource |
| | | @Lazy |
| | | private IXpOrderService xpOrderService; |
| | | @Resource |
| | | private RedisService redisService; |
| | |
| | | if(order == null){ |
| | | order = xpOrderService.getById(xpOrderId); |
| | | } |
| | | redisService.setCacheObject("ORDER_STATUS:" + xpOrderId, status.getCode(), 24L, TimeUnit.HOURS); |
| | | redisService.setCacheObject("ORDER_STATUS:" + xpOrderId, order.getStatus(), 24L, TimeUnit.HOURS); |
| | | |
| | | SendSubscribeMessageVo vo = new SendSubscribeMessageVo(); |
| | | vo.setUserId(order.getAppUserId()); |
| | |
| | | vo.setTemplateId(MessageTemplateEnum.A.getTemplateId()); |
| | | json = MessageTemplateEnum.A.getRemarks(); |
| | | json = json.replace("订单编号", order.getOrderNumber()); |
| | | json = json.replace("订单状态", status.getDesc() ); |
| | | json = json.replace("订单状态", OrderStatusEnum.getDescByCode(order.getStatus())); |
| | | json = json.replace("备注", bz); |
| | | json = json.replace("时间", LocalDateTime.now().toString()); |
| | |
| | | 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; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | |
| | | import com.xiaopeng.api.model.order.XpOrder; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; |
| | | import com.xiaopeng.api.vo.vehicleConvoy.BluetoothDeliverVo; |
| | | import com.xiaopeng.common.core.enums.OrderStatusEnum; |
| | | import com.xiaopeng.common.core.utils.StringUtils; |
| | | import com.xiaopeng.common.redis.service.RedisService; |
| | | import com.xiaopeng.order.service.BootCommonService; |
| | | import com.xiaopeng.order.service.impl.BootCommonService; |
| | | import com.xiaopeng.order.service.IXpOrderService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Slf4j |
| | | @Component |
| | |
| | | package com.xiaopeng.pushMessage.controller; |
| | | |
| | | |
| | | import com.aliyun.core.annotation.Path; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.xiaopeng.api.feignClient.account.UserSubscribeMessageClient; |
| | | import com.xiaopeng.api.vo.pushMessage.SendSubscribeMessageVo; |
| | | import com.xiaopeng.common.core.domain.R; |
| | |
| | | @PostMapping("/logan/inner/v1/subscribeMessage/sendSubscribeMessage") |
| | | public R<?> sendSubscribeMessage(@RequestBody SendSubscribeMessageVo vo){ |
| | | String openid = userSubscribeMessageClient.getUserOpenId(vo.getUserId().intValue()).getData(); |
| | | if(StrUtil.isEmpty(openid)){ |
| | | return R.ok(); |
| | | } |
| | | return subscribeMessageUtil.send(vo.getTemplateId(), vo.getPage(), openid, vo.getJson(), "developer", "zh_CN"); |
| | | } |
| | | } |