Merge remote-tracking branch 'origin/master'
| | |
| | | String msg; |
| | | |
| | | if (ex instanceof NotFoundException) { |
| | | msg = "服务未找到"; |
| | | msg = "系统繁忙,请稍后重试"; |
| | | } else if (ex instanceof ResponseStatusException) { |
| | | ResponseStatusException responseStatusException = (ResponseStatusException) ex; |
| | | msg = responseStatusException.getMessage(); |
| | | } else { |
| | | msg = "内部服务器错误"; |
| | | msg = "系统繁忙,请稍后重试"; |
| | | } |
| | | |
| | | log.error("[网关异常处理]请求路径:{},异常信息:{}", exchange.getRequest().getPath(), ex.getMessage()); |
| | |
| | | return R.fail(longR.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | }else if(dto.getDepartureStatus()==3){ |
| | | // 收车 关闭当前巡游单子 生成新的返程单子 找到收车站点 |
| | | R<Long> r = xpCruiseOrderClient.updateCruiseOrder(xpVehicle.getVehicleVin()); |
| | |
| | | @Param("appUserId") Long appUserId, |
| | | @Param("startTime") String startTime, |
| | | @Param("endTime") String endTime); |
| | | |
| | | |
| | | Long getClockInStatisticsDetailsCount(@Param("state") Integer state, @Param("appUserId") Long appUserId, |
| | | @Param("startTime") String startTime, |
| | | @Param("endTime") String endTime); |
| | | } |
| | |
| | | clockInStatistic.setRoleName(roleName); |
| | | } |
| | | } |
| | | Integer shouldClockInDays = clockInStatistic.getShouldClockInDays(); |
| | | Integer clockInDays = clockInStatistic.getClockInDays(); |
| | | Integer lateEarly = clockInStatistic.getLateEarly(); |
| | | clockInStatistic.setNotClockInDays(shouldClockInDays - clockInDays - lateEarly); |
| | | } |
| | | pageInfo.setRecords(clockInStatistics); |
| | | return pageInfo; |
| | |
| | | clockInStatistic.setRoleName(roleName); |
| | | } |
| | | } |
| | | Integer shouldClockInDays = clockInStatistic.getShouldClockInDays(); |
| | | Integer clockInDays = clockInStatistic.getClockInDays(); |
| | | Integer lateEarly = clockInStatistic.getLateEarly(); |
| | | clockInStatistic.setNotClockInDays(shouldClockInDays - clockInDays - lateEarly); |
| | | } |
| | | |
| | | ExcelUtil<ClockInStatisticsDto> excel = new ExcelUtil<ClockInStatisticsDto>(ClockInStatisticsDto.class); |
| | |
| | | dto.setList(pageInfo); |
| | | XpOperationsUser xpOperationsUser = xpOperationUserClient.queryById(query.getAppUserId()).getData(); |
| | | List<Long> longList = fleetOperationsClient.getFleetIdsByUserId(xpOperationsUser.getId()).getData(); |
| | | List<XpSchedulingDetail> list = xpSchedulingDetailService.list(new QueryWrapper<XpSchedulingDetail>().eq("fleetId", longList.get(0)).between(StringUtils.isNotEmpty(startTime), "plan_time", startTime, endTime)); |
| | | QueryWrapper<XpClockIn> last1 = new QueryWrapper<XpClockIn>().eq("app_user_id", query.getAppUserId()).last(" and (clock_in_result = 1 or clock_out_result = 1)" |
| | | + (StringUtils.isNotEmpty(startTime) ? " and (DATE_FORMAT(clock_in_time, '%Y-%m-%d') between '" + startTime + "' and '" + endTime + "' or DATE_FORMAT(clock_out_time, '%Y-%m-%d') between '" + startTime + "' and '" + endTime + "'))" : "")); |
| | | QueryWrapper<XpClockIn> last2 = new QueryWrapper<XpClockIn>().eq("app_user_id", query.getAppUserId()).last(" and (clock_in_result = 2 or clock_out_result = 2)" |
| | | + (StringUtils.isNotEmpty(startTime) ? " and (DATE_FORMAT(clock_in_time, '%Y-%m-%d') between '" + startTime + "' and '" + endTime + "' or DATE_FORMAT(clock_out_time, '%Y-%m-%d') between '" + startTime + "' and '" + endTime + "'))" : "")); |
| | | QueryWrapper<XpClockIn> last3 = new QueryWrapper<XpClockIn>().eq("app_user_id", query.getAppUserId()).last(" and (clock_in_result = 3 or clock_out_result = 3)" |
| | | + (StringUtils.isNotEmpty(startTime) ? " and (DATE_FORMAT(clock_in_time, '%Y-%m-%d') between '" + startTime + "' and '" + endTime + "' or DATE_FORMAT(clock_out_time, '%Y-%m-%d') between '" + startTime + "' and '" + endTime + "'))" : "")); |
| | | List<XpSchedulingDetail> list = xpSchedulingDetailService.list(new QueryWrapper<XpSchedulingDetail>().eq("fleet_id", longList.get(0)).between(StringUtils.isNotEmpty(startTime), "plan_time", startTime, endTime)); |
| | | dto.setShouldClockInCount(list.size() * 2); |
| | | dto.setNormalClockInCount(this.count(last1)); |
| | | dto.setLateClockInCount(this.count(last2)); |
| | | dto.setMissingClockInCount(this.count(last3)); |
| | | dto.setNormalClockInCount(this.baseMapper.getClockInStatisticsDetailsCount(1, query.getAppUserId(), startTime, endTime)); |
| | | dto.setLateClockInCount(this.baseMapper.getClockInStatisticsDetailsCount(2, query.getAppUserId(), startTime, endTime)); |
| | | dto.setMissingClockInCount(this.baseMapper.getClockInStatisticsDetailsCount(3, query.getAppUserId(), startTime, endTime)); |
| | | return dto; |
| | | } |
| | | |
| | |
| | | cc.fleet_name as teamName, |
| | | ifnull(sum(aa.num1), 0) as clockInDays, |
| | | ifnull(sum(aa.num2), 0) as lateEarly, |
| | | ifnull(sum(aa.num3), 0) as notClockInDays, |
| | | ifnull(dd.num1, 0) as shouldClockInDays |
| | | from ( |
| | | select app_user_id, count(id) as num1, 0 as num2 from xp_clock_in where is_deleted = 0 and |
| | | select app_user_id, count(id) as num1, 0 as num2, 0 as num3 from xp_clock_in where is_deleted = 0 and |
| | | clock_in_result = 1 and clock_out_result = 1 |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and app_user_id in |
| | |
| | | </if> |
| | | group by app_user_id |
| | | union all |
| | | select app_user_id, 0 as num1, count(id) as num2 from xp_clock_in where is_deleted = 0 and |
| | | (clock_in_result != 1 or clock_out_result != 1) |
| | | select app_user_id, 0 as num1, count(id) as num2, 0 as num3 from xp_clock_in where is_deleted = 0 and |
| | | (clock_in_result = 2 or clock_out_result = 2) |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and app_user_id in |
| | | <foreach item="item" collection="appUserIds" separator="," open="(" close=")" index="index"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and DATE_FORMAT(clock_in_time, '%Y-%m-%d') between #{startTime} and #{endTime} |
| | | </if> |
| | | group by app_user_id |
| | | union all |
| | | select app_user_id, 0 as num1, 0 as num2, count(id) as num3 from xp_clock_in where is_deleted = 0 and |
| | | (clock_in_result = 3 or clock_out_result = 3) |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and app_user_id in |
| | | <foreach item="item" collection="appUserIds" separator="," open="(" close=")" index="index"> |
| | |
| | | left join xp_fleet_operations b on (a.app_user_id = b.operations_user_id) |
| | | left join xp_fleet c on (b.fleet_id = c.id) |
| | | left join xp_shift d on (a.shift_id = d.id) |
| | | WHERE a.app_user_id = #{appUserId} |
| | | WHERE a.app_user_id = #{appUserId} and a.is_deleted = 0 |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and DATE_FORMAT(clock_in_time, '%Y-%m-%d') between #{startTime} and #{endTime} |
| | | </if> |
| | | order by a.clock_in_time desc |
| | | </select> |
| | | |
| | | <select id="getClockInStatisticsDetailsCount" resultType="long"> |
| | | select count(id) from ( |
| | | select id from xp_clock_in where is_deleted = 0 and app_user_id = #{appUserId} and clock_out_result = #{state} |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and DATE_FORMAT(clock_out_time, '%Y-%m-%d') between #{startTime} and #{endTime} |
| | | </if>union ALL |
| | | select id from xp_clock_in where is_deleted = 0 and app_user_id = #{appUserId} and clock_in_result = #{state} |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and DATE_FORMAT(clock_in_time, '%Y-%m-%d') between #{startTime} and #{endTime} |
| | | </if> |
| | | ) as aa |
| | | </select> |
| | | </mapper> |
| | |
| | | } |
| | | |
| | | // 计算距离 小于的站点 |
| | | double v = FastDistanceCalculator.distanceFastKm(dto.getLatitude(), dto.getLongitude(), xpPoint.getPointLat(), xpPoint.getPointLon()); |
| | | double v = FastDistanceCalculator.distanceFast(dto.getLatitude(), dto.getLongitude(), xpPoint.getPointLat(), xpPoint.getPointLon()); |
| | | |
| | | // m做判断 |
| | | if ((v*1000) < orderDistance) { |
| | |
| | | String ORDER_REASSIGN_NEW_VEHICLE_NOT_START_ACCEPT = "order.reassign.new.vehicle.not.start.accept"; |
| | | String ORDER_REASSIGN_NEW_VEHICLE_NOT_FREE = "order.reassign.new.vehicle.not.free"; |
| | | String ORDER_STATUS_ERROR = "order.status.error"; |
| | | String ORDER_CHANGE_AMOUNT_ID_REQUIRED = "order.change.amount.id.required"; |
| | | String ORDER_CHANGE_AMOUNT_AMOUNT_REQUIRED = "order.change.amount.amount.required"; |
| | | String ORDER_CHANGE_AMOUNT_AMOUNT_INVALID = "order.change.amount.amount.invalid"; |
| | | String ORDER_CHANGE_AMOUNT_STATUS_INVALID = "order.change.amount.status.invalid"; |
| | | String ORDER_CHANGE_AMOUNT_FAILED = "order.change.amount.failed"; |
| | | String VEHICLE_NOT_EXISTS = "vehicle.not.exists"; |
| | | } |
| | | |
| | |
| | | import com.xiaopeng.order.service.IXpOrderService; |
| | | import com.xiaopeng.order.vo.OrderDetailVo; |
| | | import com.xiaopeng.unifiedverification.interceptor.XpClientCheck; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import io.swagger.annotations.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | ); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "订单改价", tags = {"管理后台-交易管理-订单管理"}) |
| | | @PostMapping("/api/v1/order/changeAmount") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "订单ID", required = true, dataType = "Long"), |
| | | @ApiImplicitParam(name = "amount", value = "新的订单金额", required = true, dataType = "BigDecimal") |
| | | }) |
| | | public R<?> changeAmount(@RequestParam("id") Long id ,@RequestParam("amount") BigDecimal amount) { |
| | | xpOrderService.changeAmount(id, amount); |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 获取用户快捷胶囊 历史 时段 终点高点 |
| | | */ |
| | |
| | | import com.xiaopeng.order.model.vo.XpOrderPageVO; |
| | | import com.xiaopeng.order.vo.OrderDetailVo; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | OrderDetailVo orderDetail(Long orderId, String uid); |
| | | |
| | | R<String> feeDescription(Long orderId, String uid); |
| | | |
| | | /** |
| | | * 订单改价 |
| | | * @param id |
| | | * @param amount |
| | | */ |
| | | void changeAmount(Long id, BigDecimal amount); |
| | | } |
| | |
| | | pushOrderDto.setOperation_type(OrderOperationType.CLOUD_CANCEL_ORDER); |
| | | R<Boolean> booleanR = orderMissionClient.cancelOrder(pushOrderDto); |
| | | if(booleanR==null || !booleanR.getData()){ |
| | | log.error("XPU取消巡游订单失败"); |
| | | log.info("XPU取消巡游订单失败"); |
| | | return null; |
| | | } |
| | | return xpCruiseOrder.getId(); |
| | |
| | | |
| | | return xpOrderDetailVO; |
| | | } |
| | | |
| | | @Override |
| | | public void changeAmount(Long id, BigDecimal amount) { |
| | | if (Objects.isNull(id)) { |
| | | throw new ServiceException("订单ID不能为空", I18nKeyConstant.ORDER_CHANGE_AMOUNT_ID_REQUIRED); |
| | | } |
| | | if (Objects.isNull(amount)) { |
| | | throw new ServiceException("订单金额不能为空", I18nKeyConstant.ORDER_CHANGE_AMOUNT_AMOUNT_REQUIRED); |
| | | } |
| | | if (amount.compareTo(BigDecimal.ZERO) < 0) { |
| | | throw new ServiceException("订单金额不能小于0", I18nKeyConstant.ORDER_CHANGE_AMOUNT_AMOUNT_INVALID); |
| | | } |
| | | |
| | | XpOrder order = this.getById(id); |
| | | if (Objects.isNull(order)) { |
| | | throw new ServiceException("订单不存在", I18nKeyConstant.ORDER_NOT_EXISTS); |
| | | } |
| | | |
| | | final Integer pendingPaymentStatus = 8; |
| | | if (!Objects.equals(order.getStatus(), pendingPaymentStatus)) { |
| | | throw new ServiceException("当前订单状态不允许改价,只有待付款状态的订单可以改价", I18nKeyConstant.ORDER_CHANGE_AMOUNT_STATUS_INVALID); |
| | | } |
| | | |
| | | if (Objects.nonNull(order.getOrderMoney()) && order.getOrderMoney().compareTo(amount) == 0) { |
| | | return; |
| | | } |
| | | |
| | | boolean updated = this.lambdaUpdate() |
| | | .set(XpOrder::getOrderMoney, amount) |
| | | .eq(XpOrder::getId, id) |
| | | .eq(XpOrder::getStatus, pendingPaymentStatus) |
| | | .update(); |
| | | if (!updated) { |
| | | throw new ServiceException("订单改价失败,请稍后重试", I18nKeyConstant.ORDER_CHANGE_AMOUNT_FAILED); |
| | | } |
| | | } |
| | | } |
| | |
| | | order.reassign.new.vehicle.not.free=新车辆已接单,请重新选择 |
| | | order.pricing.not.exists=当前城市未配置定价规则 |
| | | order.order.status.error=订单状态错误 |
| | | vehicle.not.exists=车辆不存在 |
| | | vehicle.not.exists=车辆不存在 |
| | | order.change.amount.id.required=订单ID不能为空 |
| | | order.change.amount.amount.required=订单金额不能为空 |
| | | order.change.amount.amount.invalid=订单金额不能小于0 |
| | | order.change.amount.status.invalid=当前订单状态不允许改价,只有待付款状态的订单可以改价 |
| | | order.change.amount.failed=订单改价失败,请稍后重试 |
| | |
| | | welcome.message=Welcome to our application! |
| | | order.pricing.not.exists=The current city has not been configured with pricing rules |
| | | order.order.status.error=Order status error |
| | | vehicle.not.exists=The vehicle does not exist. |
| | | vehicle.not.exists=The vehicle does not exist. |
| | | order.change.amount.id.required=Order ID is required. |
| | | order.change.amount.amount.required=Order amount is required. |
| | | order.change.amount.amount.invalid=Order amount must be greater than or equal to 0. |
| | | order.change.amount.status.invalid=The current order status does not allow price changes. Only pending payment orders can be changed. |
| | | order.change.amount.failed=Failed to change order amount. Please try again later. |
| | |
| | | welcome.message=欢迎来到我们的应用程序! |
| | | order.pricing.not.exists=当前城市未配置定价规则 |
| | | order.order.status.error=订单状态错误 |
| | | vehicle.not.exists=车辆不存在 |
| | | vehicle.not.exists=车辆不存在 |
| | | order.change.amount.id.required=订单ID不能为空 |
| | | order.change.amount.amount.required=订单金额不能为空 |
| | | order.change.amount.amount.invalid=订单金额不能小于0 |
| | | order.change.amount.status.invalid=当前订单状态不允许改价,只有待付款状态的订单可以改价 |
| | | order.change.amount.failed=订单改价失败,请稍后重试 |
| | |
| | | } |
| | | |
| | | for (XpVehicleVO xpVehicleVO : list) { |
| | | // List<Point> positionList = redisTemplate.opsForGeo().position("vehiclePosition:" + xpVehicleVO.getVehicleVin(), xpVehicleVO.getVehicleVin()); |
| | | // if (!CollectionUtils.isEmpty(positionList)) { |
| | | // Point geoJsonPoint = positionList.get(0); |
| | | // // 获取经纬度 |
| | | // xpVehicleVO.setLongitude(geoJsonPoint.getX()); |
| | | // xpVehicleVO.setLatitude(geoJsonPoint.getY()); |
| | | // } |
| | | // 查询车辆的续航里程 |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(xpVehicleVO.getVehicleVin())), VehiclePosition.class); |
| | | if (Objects.nonNull(vehiclePosition)) { |
| | |
| | | } else { |
| | | xpVehicleVO.setMileageRange(0F); |
| | | xpVehicleVO.setCurrentElectricity(0); |
| | | xpVehicleVO.setLongitude(0D); |
| | | xpVehicleVO.setLatitude(0D); |
| | | } |
| | | } |
| | | |