xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/controller/XpAppUserCouponController.java
@@ -99,20 +99,28 @@ } } // 优先用满足条件且抵扣金额最大的 List<XpAppUserCoupon> discountUserCoupons = couponList.stream().filter(e -> e.getCouponType() == 1).sorted(Comparator.comparing(XpAppUserCoupon::getMoney).reversed()).collect(Collectors.toList()); if(!discountUserCoupons.isEmpty()){ userCouponVo.setId(discountUserCoupons.get(0).getId()); userCouponVo.setMoney(discountUserCoupons.get(0).getMoney().doubleValue()); if(dto.getUserCouponId()!=null){ XpAppUserCoupon coupon = couponList.get(0); userCouponVo.setId(coupon.getId()); userCouponVo.setMoney(coupon.getMoney().doubleValue()); return R.ok(userCouponVo); }else { // 优先用满足条件且抵扣金额最大的 List<XpAppUserCoupon> discountUserCoupons = couponList.stream().filter(e -> e.getCouponType() == 1).sorted(Comparator.comparing(XpAppUserCoupon::getMoney).reversed()).collect(Collectors.toList()); if(!discountUserCoupons.isEmpty()){ userCouponVo.setId(discountUserCoupons.get(0).getId()); userCouponVo.setMoney(discountUserCoupons.get(0).getMoney().doubleValue()); return R.ok(userCouponVo); } List<XpAppUserCoupon> fullUserCoupons = couponList.stream().filter(e -> e.getCouponType() == 2 && e.getFullMoney().doubleValue()>dto.getTotalAmount()).sorted(Comparator.comparing(XpAppUserCoupon::getMoney).reversed()).collect(Collectors.toList()); if(!fullUserCoupons.isEmpty()){ userCouponVo.setId(fullUserCoupons.get(0).getId()); userCouponVo.setMoney(fullUserCoupons.get(0).getMoney().doubleValue()); return R.ok(userCouponVo); } return R.ok(userCouponVo); } List<XpAppUserCoupon> fullUserCoupons = couponList.stream().filter(e -> e.getCouponType() == 2 && e.getFullMoney().doubleValue()>dto.getTotalAmount()).sorted(Comparator.comparing(XpAppUserCoupon::getMoney).reversed()).collect(Collectors.toList()); if(!fullUserCoupons.isEmpty()){ userCouponVo.setId(fullUserCoupons.get(0).getId()); userCouponVo.setMoney(fullUserCoupons.get(0).getMoney().doubleValue()); return R.ok(userCouponVo); } return R.ok(userCouponVo); } @PostMapping("/inner/appUserCoupon/useUserCoupon") public R<BigDecimal> useUserCoupon(@RequestBody UseUserCouponDto dto) { xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/XpAppUserCouponServiceImpl.java
@@ -140,7 +140,7 @@ R<XpCoupon> coupon = xpCouponClient.getCouponById(dto.getCouponId()); if (coupon != null) { XpCoupon xpCoupon = coupon.getData(); if (dto.getPhone() == null) { if (dto.getPhone() == null || dto.getPhone().isEmpty()) { // 全部发放 R<List<String>> allWhiteList = xpWhiteListClient.getAllWhiteList(); if (allWhiteList != null) { xp-robotaxi-api/src/main/java/com/xiaopeng/api/feignClient/operation/XpWhiteListClient.java
@@ -23,7 +23,7 @@ * 获取所有白名单手机号 * @return */ @PostMapping("/inner/getAllWhiteList") @PostMapping("/api/v1/whitelist/inner/getAllWhiteList") R<List<String>> getAllWhiteList(); } xp-robotaxi-api/src/main/java/com/xiaopeng/api/model/order/XpOrder.java
@@ -231,4 +231,6 @@ // 用于计数 @TableField(exist = false) private Integer num; @ApiModelProperty(value = "是否改价标识 0-否 1-是") private Boolean changeMoneyFlag; } xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/service/impl/XpPricingServiceImpl.java
@@ -186,7 +186,7 @@ // 判断是否5分钟内进行了查询 相同站点的起始点 并且是同时段 String key = "xp-map-query-" + routeAndFareDto.getOpenCityId() + "-" + routeAndFareDto.getOrigin().getLongitude() + "-" + routeAndFareDto.getOrigin().getLatitude() + "-" + routeAndFareDto.getDestination().getLongitude() + "-" + routeAndFareDto.getDestination().getLatitude() + "-" + getCurrentTimeSlot() + "-" + userId; + "-" + routeAndFareDto.getDestination().getLongitude() + "-" + routeAndFareDto.getDestination().getLatitude() + "-" + getCurrentTimeSlot() + "-" + userId+routeAndFareDto.getUserCouponId(); if (redisService.hasKey(key)) { String jsonStr = Objects.requireNonNull(redisService.getCacheObject(key)).toString(); @@ -565,7 +565,7 @@ distance = routeVo.getDistance(); duration = routeVo.getDuration(); } xpOrder.setCouponId(dto.getUserCouponId()); // 产生订单 R<Long> addOrderR = xpOrderClient.addOrder(xpOrder); if (addOrderR.getCode() != R.SUCCESS) { @@ -573,7 +573,7 @@ } Long orderId = addOrderR.getData(); xpOrder.setId(orderId); xpOrder.setCouponId(dto.getUserCouponId()); // 静默处理 不推单 // if (isSilent) { // log.info("订单取消次数达到上限,执行静默处理,不推单。"); @@ -626,7 +626,12 @@ } String key = CacheConstants.QUEUE_POINT_ID + "-" + xpPoint.getId() + "-" + xpPoint.getPointLon() + "," + xpPoint.getPointLat(); redisService.setCacheList(key, Arrays.asList(orderId + "_" + xpPoint.getPointLon() + "," + xpPoint.getPointLat() + "_0" + "_" + uid + "_" + xpOrder.getOrderNumber() + "_" + distance + "_" + duration + "_" + xpRoutePlan.getRoutePlanRule())); if(xpRoutePlan==null){ redisService.setCacheList(key, Arrays.asList(orderId + "_" + xpPoint.getPointLon() + "," + xpPoint.getPointLat() + "_0" + "_" + uid + "_" + xpOrder.getOrderNumber() + "_" + distance + "_" + duration + "_" + null)); }else { redisService.setCacheList(key, Arrays.asList(orderId + "_" + xpPoint.getPointLon() + "," + xpPoint.getPointLat() + "_0" + "_" + uid + "_" + xpOrder.getOrderNumber() + "_" + distance + "_" + duration + "_" + xpRoutePlan.getRoutePlanRule())); } log.info("订单推单:{} {}", key, redisService.getCacheList(key)); xpOrder.setQueueName(key); xpOrderClient.updateOrder(xpOrder); xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpPointManagementController.java
@@ -108,7 +108,7 @@ List<XpPoint> list = xpPointService.lambdaQuery().in(XpPoint::getId, query.getPointIds()).list(); return R.ok(list); } // "2029885249115987970" "2029883649798512642" @ApiOperation(value = "点位导出") @PostMapping("/exportExcel") public void exportExcel(@RequestBody XpPointExportExcelQuery query) { xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpElectronicFenceServiceImpl.java
@@ -427,7 +427,7 @@ res.add(updatedArea.getAreaName()); res.add(existingArea.getAreaName()); throw new ServiceException( "运营区域{}与现有运营区域{}发生重叠", "运营区域{}与现有运营区域{}发生重叠,请编辑已有的运营区域", I18nKeyConstant.AREA_OVERLAP_ERROR, res.toArray() ); xp-robotaxi-map-boot/src/main/resources/i18n/messages.properties
@@ -7,7 +7,7 @@ welcome.message=欢迎来到我们的应用程序! edit.electronic.error=编辑电子围栏失败; add.electronic.error=添加电子围栏失败; area.overlap.error=运营区域{0}与现有运营区域{1}发生重叠; area.overlap.error=运营区域{0}与现有运营区域{1}发生重叠,请编辑已有的运营区域; fence.structure.not.exist=围栏构成不存在 fence.not.exist=围栏不存在 fence.status.cannot.copied=围栏启用状态不可复制; xp-robotaxi-map-boot/src/main/resources/i18n/messages_en_US.properties
@@ -7,7 +7,7 @@ welcome.message=Welcome to our application! edit.electronic.error=Failed to edit the electronic fence add.electronic.error=Failed to add electronic fence; area.overlap.error=The operational area {0} overlaps with the existing operational area {1}; area.overlap.error=The operational area {0} overlaps with the existing operational area {1},Please edit the existing operation area fence.structure.not.exist=The fence composition does not exist\ fence.status.cannot.copied=The enabled state of the fence cannot be copied; fence.not.exist=The fence does not exist. xp-robotaxi-map-boot/src/main/resources/i18n/messages_zh_CN.properties
@@ -7,7 +7,7 @@ welcome.message=欢迎来到我们的应用程序! edit.electronic.error=编辑电子围栏失败; add.electronic.error=添加电子围栏失败; area.overlap.error=运营区域{0}与现有运营区域{1}发生重叠; area.overlap.error=运营区域{0}与现有运营区域{1}发生重叠,请编辑已有的运营区域; fence.structure.not.exist=围栏构成不存在 fence.not.exist=围栏不存在 fence.status.cannot.copied=围栏启用状态不可复制 xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpPointManagementController.java
@@ -43,11 +43,11 @@ public class XpPointManagementController extends BaseController { @Resource private XpPointService xpPointService; private XpPointService xpPointService; @Resource private IXpElectronicFenceAreaService xpElectronicFenceAreaService; private IXpElectronicFenceAreaService xpElectronicFenceAreaService; @Resource private IXpElectronicFenceService xpElectronicFenceService; private IXpElectronicFenceService xpElectronicFenceService; @ApiOperation(value = "获取所有运营中的区域", response = XpElectronicFenceArea.class) @@ -56,7 +56,7 @@ // 获取所有启用的电子围栏 List<XpElectronicFence> electronicFences = xpElectronicFenceService.lambdaQuery().eq(XpElectronicFence::getStatus, 2).list(); List<Long> electronicFenceIds = electronicFences.stream().map(XpElectronicFence::getId).collect(Collectors.toList()); if (electronicFenceIds.isEmpty()){ if (electronicFenceIds.isEmpty()) { return R.ok(new ArrayList<XpElectronicFenceArea>()); } // 获取电子围栏下启用的运营区域 @@ -64,36 +64,41 @@ .eq(XpElectronicFenceArea::getAreaStatus, 1).list(); return R.ok(electronicFenceAreaList); } @ApiOperation(value = "点位管理列表", response = XpPoint.class) @PostMapping("/listPoint") public R<List<XpPoint>> list(@RequestBody PointListQuery query) { List<XpPoint> pageList = xpPointService.listAll(query); return R.ok(pageList); } @ApiOperation(value = "点位管理分页列表", response = XpPoint.class) @PostMapping("/pageList") public R<PageInfo<XpPoint>> pageList(@RequestBody PointPageListListQuery query) { PageInfo<XpPoint> pageList = xpPointService.pageList(query); return R.ok(pageList); } @PostMapping("/getByIds") public R<List<XpPoint>> getByIds(@RequestBody XpPointExportExcelQuery query){ public R<List<XpPoint>> getByIds(@RequestBody XpPointExportExcelQuery query) { List<XpPoint> list = xpPointService.lambdaQuery().in(XpPoint::getId, query.getPointIds()).list(); return R.ok(list); } /** * 新增点位 */ @PostMapping("/addPoint") @ResponseBody @ApiOperation(value = "新增点位") public R add(@Validated @RequestBody PointAddDto pointAddDto) { public R add(@Validated @RequestBody PointAddDto pointAddDto) { XpPoint xpPoint = new XpPoint(); BeanUtils.copyProperties(pointAddDto, xpPoint); xpPoint.setFpElectronicAreaId(xpPoint.getElectronicAreaId()); xpPointService.save(xpPoint); return R.ok(); } /** * 批量删除点位 */ @@ -101,21 +106,24 @@ @ResponseBody @ApiOperation(value = "删除点位") public R deletePoint(@RequestParam("ids") String ids) { xpPointService.removeBatchByIds(Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList())); xpPointService.removeBatchByIds(Arrays.stream(ids.split(",")) .map(Long::parseLong).collect(Collectors.toList())); return R.ok(); } /** * 编辑点位 */ @PostMapping("/editPoint") @ApiOperation(value = "编辑点位") public R edit(@Validated@RequestBody PointUpdateDto pointAddDto) { public R edit(@Validated @RequestBody PointUpdateDto pointAddDto) { XpPoint xpPoint = new XpPoint(); BeanUtils.copyProperties(pointAddDto, xpPoint); xpPoint.setFpElectronicAreaId(null); xpPointService.updateById(xpPoint); return R.ok(); } /** * 点位详情 */ @@ -124,6 +132,7 @@ public R<XpPoint> queryById(@RequestParam Long id) { return R.ok(xpPointService.getById(id)); } /** * 启用/禁用 */ @@ -142,17 +151,20 @@ * 设置特殊点位 */ @PostMapping("/setSpecialPoint") @ApiOperation(value = "设置特殊点位",tags = "后台管理-特殊点位") @ApiOperation(value = "设置特殊点位", tags = "后台管理-特殊点位") public R setSpecialPoint(@RequestBody XpPointSpecialDto dto) { xpPointService.update(new LambdaUpdateWrapper<XpPoint>().set(XpPoint::getChargePoint, 0).set(XpPoint::getParkingPoint,0)); List<XpPoint> list = xpPointService.list(new LambdaQueryWrapper<XpPoint>().in(XpPoint::getId, dto.getChargePoints())); list.forEach(e->{ xpPointService.update(new LambdaUpdateWrapper<XpPoint>().set(XpPoint::getChargePoint, 0) .set(XpPoint::getParkingPoint, 0)); List<XpPoint> list = xpPointService.list(new LambdaQueryWrapper<XpPoint>() .in(XpPoint::getId, dto.getChargePoints())); list.forEach(e -> { e.setChargePoint(1); e.setFpElectronicAreaId(null); }); xpPointService.updateBatchById(list); List<XpPoint> list1 = xpPointService.list(new LambdaQueryWrapper<XpPoint>().in(XpPoint::getId, dto.getParkingPoints())); list1.forEach(e->{ List<XpPoint> list1 = xpPointService.list(new LambdaQueryWrapper<XpPoint>() .in(XpPoint::getId, dto.getParkingPoints())); list1.forEach(e -> { e.setParkingPoint(1); e.setFpElectronicAreaId(null); }); @@ -162,7 +174,7 @@ @GetMapping("/listSpecialPoint") @ApiOperation(value = "获取特殊点位",tags = "后台管理-特殊点位") @ApiOperation(value = "获取特殊点位", tags = "后台管理-特殊点位") public R<SpecialPointVo> getSpecialPoint() { List<XpPoint> chargePoints = xpPointService.list(new LambdaQueryWrapper<XpPoint>().eq(XpPoint::getChargePoint, 1)); List<XpPoint> parkingPoints = xpPointService.list(new LambdaQueryWrapper<XpPoint>().eq(XpPoint::getParkingPoint, 1)); xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/dto/NearestDto.java
@@ -18,5 +18,8 @@ @NotNull(message = "经度不能为空") private Double longitude; @ApiModelProperty(value = "区域id") private Long electronicAreaId; } xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpBannerServiceImpl.java
@@ -2,10 +2,12 @@ import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject;import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.xiaopeng.api.model.operation.XpWhitelist; import com.xiaopeng.common.core.web.page.PageInfo; import com.xiaopeng.evi.oss.service.AliOssService; import com.xiaopeng.operation.mapper.XpBannerMapper; import com.xiaopeng.api.model.operation.XpBanner; import com.xiaopeng.operation.query.BannerPageListQuery; @@ -14,6 +16,8 @@ import com.xiaopeng.operation.vo.XpBannerListVo; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.UnsupportedEncodingException; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -29,10 +33,13 @@ @Service public class XpBannerServiceImpl extends ServiceImpl<XpBannerMapper, XpBanner> implements XpBannerService { @Resource private AliOssService aliOssService; @Override public List<XpBannerListVo> getXpBannerList() { LambdaQueryWrapper<XpBanner> wrapper = new LambdaQueryWrapper<>(); wrapper.eq(XpBanner::getBannerStatus,1); wrapper.eq(XpBanner::getBannerStatus, 1); // 当前时间在开始和结束时间范围内 List<XpBanner> list = list(wrapper.last(" and now() between start_time and end_time")); @@ -44,18 +51,23 @@ vo.setJumpType(item.getJumpType()); vo.setJumpUrl(item.getJumpUrl()); JSONObject jsonObject = JSON.parseArray(item.getBannerPictures()).getJSONObject(0); vo.setImageUrl(jsonObject.getString("url")); String downloadUrl = null; try { downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } vo.setImageUrl(downloadUrl); return vo; }).collect(Collectors.toList()); } return Collections.emptyList(); } @Override public PageInfo<XpBanner> pageList(BannerPageListQuery query) { PageInfo<XpBanner> pageInfo = new PageInfo<>(query.getPageNum(),query.getPageSize()); List<XpBanner> list = this.baseMapper.pageList(pageInfo,query); PageInfo<XpBanner> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); List<XpBanner> list = this.baseMapper.pageList(pageInfo, query); pageInfo.setRecords(list); return pageInfo; } xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpPointServiceImpl.java
@@ -94,6 +94,10 @@ // 添加距离计算字段 .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<>()); xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java
@@ -1615,7 +1615,7 @@ config.holiday = new TaxiPricingDemoService.PricingRule("节假日", "00:00", "23:59", Double.parseDouble(basicPricingJson.getString("num29")), paramNum4, paramNum5, Double.parseDouble(basicPricingJson.getString("num30")), Double.parseDouble(basicPricingJson.getString("num31"))); // --- 远途加价区间配置 (关键修改) --- // 1. 超过 num1(12) 不足 num2(20), 加收 num3(1.2) config.longSteps.add(new TaxiPricingDemoService.LongRangeStep(Double.parseDouble(basicPricingJson.getString("num6")), Double.parseDouble(basicPricingJson.getString("num7")), Double.parseDouble(basicPricingJson.getString("num8")))); config.longSteps.add(new TaxiPricingDemoService.LongRangeStep(paramNum4, Double.parseDouble(basicPricingJson.getString("num7")), Double.parseDouble(basicPricingJson.getString("num8")))); // 2. 超过 num4(20) 不足 num5(35), 加收 num6(2.0) config.longSteps.add(new TaxiPricingDemoService.LongRangeStep(Double.parseDouble(basicPricingJson.getString("num9")), Double.parseDouble(basicPricingJson.getString("num10")), Double.parseDouble(basicPricingJson.getString("num11")))); // 3. 超过 num7(35) 以后, 加收 num8(3.5) -> numEnd 传个极大值 @@ -2801,6 +2801,7 @@ boolean updated = this.lambdaUpdate() .set(XpOrder::getOrderMoney, amount) .set(XpOrder::getChangeMoneyFlag, Boolean.TRUE) .eq(XpOrder::getId, id) .eq(XpOrder::getStatus, pendingPaymentStatus) .update();