| | |
| | | || CollUtil.isNotEmpty(delPointIds) |
| | | || CollUtil.isNotEmpty(disablePointIds); |
| | | boolean needFenceAreaIds = needPointHandling || needAutoDisableByUnion; |
| | | XpElectronicFenceArea operationArea = needFenceAreaIds |
| | | ? xpElectronicFenceAreaService.lambdaQuery() |
| | | XpElectronicFenceArea operationArea = xpElectronicFenceAreaService.lambdaQuery() |
| | | .eq(XpElectronicFenceArea::getElectronicId, dto.getId()) |
| | | .eq(XpElectronicFenceArea::getAreaType, 1) |
| | | .orderByDesc(XpElectronicFenceArea::getId) |
| | | .last("limit 1") |
| | | .one() |
| | | : null; |
| | | .one(); |
| | | Long operationAreaId = operationArea == null ? null : operationArea.getId(); |
| | | if (needPointHandling && operationAreaId == null) { |
| | | throw new ServiceException("运营区域不存在", I18nKeyConstant.POINT_ELECTRONIC_AREA_NOT_EXIST); |
| | |
| | | } |
| | | |
| | | // 围栏运营时间缩短校验:若缩短后点位时间段不在新范围内,则更新为已停用(operation_status=3) |
| | | if (needAutoDisableByUnion && operationAreaId != null) { |
| | | if (true) { |
| | | LambdaQueryWrapper<XpPoint> pointQuery = new LambdaQueryWrapper<>(); |
| | | pointQuery.eq(XpPoint::getElectronicAreaId, operationAreaId) |
| | | .eq(XpPoint::getPointType, 1) |
| | |
| | | } |
| | | } |
| | | if (!disablePointIdList.isEmpty()) { |
| | | XpPoint updatePoint = new XpPoint(); |
| | | updatePoint.setOperationStatus(3); |
| | | UpdateWrapper<XpPoint> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.in("id", disablePointIdList); |
| | | updateWrapper.and(w -> w.isNull("operation_status").or().ne("operation_status", 4)); |
| | | xpPointMapper.update(updatePoint, updateWrapper); |
| | | log.info("围栏运营时间缩短停用点位完成 fenceId={}, disableCount={}", dto.getId(), disablePointIdList.size()); |
| | | for (Long l : disablePointIdList) { |
| | | XpPoint xpPoint = xpPointMapper.selectById(l); |
| | | if(xpPoint.getOperationStatus()!=4){ |
| | | xpPoint.setOperationStatus(3); |
| | | xpPoint.setVerificationStatus(5); |
| | | xpPointMapper.updateById(xpPoint); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | * main 自测:使用固定样例打印 old/new Union、是否修改/缩短,以及点位在旧/新范围内判断结果。 |
| | | */ |
| | | public static void main(String[] args) { |
| | | String pointJson = "[\"05:00-12:00\", \"13:00-23:59\"]"; |
| | | String strategyJson = "[{\"name\": \"策略组1\", \"time\": [\"06:00-12:00\", \"13:00-23:59\"], \"type\": 0, \"typeStr\": []}, {\"name\": \"策略组2\", \"time\": [\"05:00-12:00\", \"12:00-23:00\"], \"type\": 2, \"typeStr\": \"\"}, {\"name\": \"策略组3\", \"time\": [\"09:00-23:59\"], \"type\": 1, \"typeStr\": \"\"}]"; |
| | | String pointJson = "[\"05:00-12:00\", \"13:00-21:59\"]"; |
| | | String strategyJson = "[{\"name\": \"策略组1\", \"time\": [\"06:00-22:00\", \"22:00-23:59\"], \"type\": 0, \"typeStr\": []}, {\"name\": \"策略组2\", \"time\": [\"06:00-12:00\", \"12:00-23:00\"], \"type\": 2, \"typeStr\": \"\"}, {\"name\": \"策略组3\", \"time\": [\"09:00-23:59\"], \"type\": 1, \"typeStr\": \"\"}]"; |
| | | |
| | | OperationStrategyIndex index = OperationStrategyIndex.parse(strategyJson); |
| | | List<TimeInterval> pointIntervals = OperationStrategyIndex.parsePointEffectiveTimePeriod(pointJson); |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | |
| | | public R<OrderDetailVo> orderDetail(@PathVariable("orderId") Long orderId, HttpServletRequest request) { |
| | | // uid已通过拦截器otp校验,可以直接使用 |
| | | String uid = request.getHeader("XP-Uid"); |
| | | return R.ok(xpOrderService.orderDetail(orderId, uid)); |
| | | OrderDetailVo orderDetailVo = xpOrderService.orderDetail(orderId, uid); |
| | | BigDecimal orderMoney = orderDetailVo.getOrderMoney(); |
| | | orderDetailVo.setOrderMoneyStr(orderMoney.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | private Double totalMileage; |
| | | @ApiModelProperty(value = "轨迹") |
| | | private List<OrderTrajectory> trajectories; |
| | | |
| | | |
| | | @ApiModelProperty(value = "订单金额Str") |
| | | private String orderMoneyStr; |
| | | } |