Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/Robotaxi
# Conflicts:
# xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/utils/TaskOrderUtil.java
3 文件已复制
1个文件已删除
9 文件已重命名
1个文件已添加
15个文件已修改
| | |
| | | package com.xiaopeng.account.controller; |
| | | |
| | | import com.xiaopeng.account.constant.I18nKeyConstant; |
| | | import com.xiaopeng.account.service.ISysUserService; |
| | | import com.xiaopeng.account.service.IXpOperationsUserService; |
| | | import com.xiaopeng.account.service.impl.SysLoginService; |
| | |
| | | import com.xiaopeng.api.model.account.XpOperationsUser; |
| | | import com.xiaopeng.api.vo.account.LoginOperationUser; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.api.vo.operation.SmsVo; |
| | | import com.xiaopeng.common.core.constant.VerificationCodeConstants; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.utils.JwtUtils; |
| | | import com.xiaopeng.common.core.utils.StringUtils; |
| | | import com.xiaopeng.common.redis.service.RedisService; |
| | |
| | | if (!xpOperationsUser.getStatus()) { |
| | | return R.fail("账号已禁用!"); |
| | | } |
| | | // todo 后续补充验证码 |
| | | // 生成6位数短信验证码 |
| | | String code = String.valueOf((int) (Math.random() * 1000000)); |
| | | String codeType = ""; |
| | |
| | | codeType = VerificationCodeConstants.UPDATE_PASSWORD_CODE; |
| | | break; |
| | | } |
| | | //TODO 短信服务开通后再开启 |
| | | // SmsVo vo = new SmsVo(); |
| | | // vo.setAppId(sms_appid); |
| | | // vo.setPushType(1); |
| | | // vo.setReceivers(appLoginPasswordDTO.getPhoneNumber()); |
| | | // vo.setTemplateCode("RobotaxiVerifyCodeSmsTpl"); |
| | | // vo.setAppPushConfigCode("RobotaxiVerifyCodeSms"); |
| | | // vo.setParams(new HashMap<>()); |
| | | // vo.getParams().put("code", code); |
| | | // SmsDto smsDto = smsClient.pushSms(vo); |
| | | // if(null == smsDto || smsDto.getCode() != 200){ |
| | | // throw new ServiceException("短信发送失败", I18nKeyConstant.SMS_PUSH_FAILED); |
| | | // } |
| | | SmsVo vo = new SmsVo(); |
| | | vo.setAppId(sms_appid); |
| | | vo.setPushType(1); |
| | | vo.setReceivers(appLoginPasswordDTO.getPhoneNumber()); |
| | | vo.setTemplateCode("RobotaxiVerifyCodeSmsTpl"); |
| | | vo.setAppPushConfigCode("RobotaxiVerifyCodeSms"); |
| | | vo.setParams(new HashMap<>()); |
| | | vo.getParams().put("code", code); |
| | | SmsDto smsDto = smsClient.pushSms(vo); |
| | | if(null == smsDto || smsDto.getCode() != 200){ |
| | | throw new ServiceException("短信发送失败", I18nKeyConstant.SMS_PUSH_FAILED); |
| | | } |
| | | redisService.setCacheObject(codeType+appLoginPasswordDTO.getPhoneNumber(), code, 60L, TimeUnit.SECONDS); |
| | | return R.ok(); |
| | | } |
| | |
| | | ur.operations_user_id AS operationsUserId, |
| | | ur.role_id AS roleId |
| | | FROM xp_operations_role ur |
| | | WHERE ur.operations_user_id = #{operationsUserId} |
| | | WHERE ur.operations_user_id = #{userId} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | @Excel(name = "状态", sort = 5) |
| | | @Excel(name = "状态", sort = 5,readConverterExp = "0=禁用,1=启用") |
| | | private String status; |
| | | /** |
| | | * 创建时间 |
copy from xp-robotaxi-map-boot/xp-modules-account.iml
copy to xp-robotaxi-gateway-boot/xp-robotaxi-gateway-boot.iml
| | |
| | | } |
| | | |
| | | // 10. 检查等待时间 |
| | | Integer waitTime = getWaitTime(routeAndFareDto.getOrigin().getLongitude(), routeAndFareDto.getOrigin().getLatitude()); |
| | | if (waitTime > 3) { |
| | | throw new ServiceException("当前区域正在等待中,请耐心等待", I18nKeyConstant.WAITING_TIME); |
| | | } |
| | | fareVo.setWaitingTime(waitTime); |
| | | // Integer waitTime = getWaitTime(routeAndFareDto.getOrigin().getLongitude(), routeAndFareDto.getOrigin().getLatitude()); |
| | | // if (waitTime > 3) { |
| | | // throw new ServiceException("当前区域正在等待中,请耐心等待", I18nKeyConstant.WAITING_TIME); |
| | | // } |
| | | // fareVo.setWaitingTime(waitTime); |
| | | |
| | | |
| | | // 11. 生成订单ID并缓存 |
| | |
| | | } |
| | | |
| | | // 判断当天取消的次数 后台配置 redis 查询 |
| | | Object cancelOrder = redisService.getCacheObject("CANCEL_ORDER_" + uid); |
| | | log.info("取消次数:{}", cancelOrder); |
| | | // 静默处理 |
| | | boolean isSilent = false; |
| | | if (cancelOrder != null) { |
| | | Integer num = Integer.valueOf(cancelOrder.toString()); |
| | | if (num >= cancelCount) { |
| | | isSilent = true; |
| | | } |
| | | } |
| | | // Object cancelOrder = redisService.getCacheObject("CANCEL_ORDER_" + uid); |
| | | // log.info("取消次数:{}", cancelOrder); |
| | | // // 静默处理 |
| | | // boolean isSilent = false; |
| | | // if (cancelOrder != null) { |
| | | // Integer num = Integer.valueOf(cancelOrder.toString()); |
| | | // if (num >= cancelCount) { |
| | | // isSilent = true; |
| | | // } |
| | | // } |
| | | |
| | | |
| | | // 获取起步里程 |
| | |
| | | Long orderId = addOrderR.getData(); |
| | | xpOrder.setId(orderId); |
| | | // 静默处理 不推单 |
| | | if (isSilent) { |
| | | log.info("订单取消次数达到上限,执行静默处理,不推单。"); |
| | | return orderId.toString(); |
| | | } |
| | | // if (isSilent) { |
| | | // log.info("订单取消次数达到上限,执行静默处理,不推单。"); |
| | | // return orderId.toString(); |
| | | // } |
| | | |
| | | // 最大距离 |
| | | Object maxPushDistanceObj = redisService.getCacheObject(CacheConstants.MAX_PUSH_DISTANCE); |
| | |
| | | String value = orderId + "_" + xpPoint.getPointLon() + "," + xpPoint.getPointLat() + "_0" + "_" + uid + "_" + xpOrder.getOrderNumber() + "_" + distance + "_" + duration + "_" + routeAndFareDto.getRoutePlanRule(); |
| | | if (isPriorityDispatch) { |
| | | // 头部 value 订单_经纬度_状态_用户id_订单编号_距离_时间 |
| | | // redisService.addToHead(s, orderId + "_" + xpPoint.getPointLon() + "," + xpPoint.getPointLat() + "_0" + "_" + uid + "_" + xpOrder.getOrderNumber() + "_" + distance + "_" + duration + "_" + routeAndFareDto.getRoutePlanRule()); |
| | | redisService.addToHead(s, value); |
| | | log.info("添加到队列头部:{} {}", s, value); |
| | | } else { |
| | | // 尾部 |
| | | redisService.addToTail(s, value); |
| | | log.info("添加到队列头部:{} {}", s, value); |
| | | log.info("添加到队列尾部:{} {}", s, value); |
| | | } |
| | | xpOrder.setQueueName(s); |
| | | xpOrderClient.updateOrder(xpOrder); |
copy from xp-robotaxi-map-boot/xp-modules-account.iml
copy to xp-robotaxi-job-boot/xp-robotaxi-job-boot.iml
| | |
| | | xpClockIn.setClockOutLat(dto.getUserLat()); |
| | | xpClockIn.setClockOutAddress(dto.getClockOutAddress()); |
| | | if (xpClockIn.getClockOutTime().isBefore(endLocalDateTime)) { |
| | | xpClockIn.setClockInResult(2); |
| | | xpClockIn.setClockOutResult(2); |
| | | } else { |
| | | xpClockIn.setClockInResult(1); |
| | | xpClockIn.setClockOutResult(1); |
| | | } |
| | | xpClockIn.setAppUserId(null); |
| | | this.updateById(xpClockIn); |
| File was renamed from xp-robotaxi-maintenance-boot/xp-modules-account.iml |
| | |
| | | <content url="file://$MODULE_DIR$" dumb="true"> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> |
| | | </content> |
| | | </component> |
| | | </module> |
| | |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.log.annotation.Log; |
| | | import com.xiaopeng.common.log.enums.BusinessType; |
| | | import com.xiaopeng.operation.dto.InvitationAddDto; |
| | | import com.xiaopeng.operation.exportExcle.XpInvitationCodeExportExcel; |
| | | import com.xiaopeng.operation.exportExcle.XpWhitelistExportExcel; |
| | | import com.xiaopeng.operation.importExcel.InvitationCodeImportExcel; |
| | |
| | | /** |
| | | * 生成邀请码 |
| | | */ |
| | | @PutMapping("/api/v1/invitation/add") |
| | | @PostMapping("/api/v1/invitation/add") |
| | | @ResponseBody |
| | | @ApiOperation(value = "生成邀请码") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "手机号 多个逗号隔开", name = "phones", dataType = "String", required = true) |
| | | }) |
| | | @Transactional |
| | | public R add(@RequestParam("phones") String phones){ |
| | | return xpInvitationCodeService.add(phones); |
| | | public R add(@RequestBody InvitationAddDto dto){ |
| | | return xpInvitationCodeService.add(dto.getPhones()); |
| | | } |
| | | /** |
| | | * 解绑 |
| | |
| | | @ApiOperation(value = "编辑白名单") |
| | | @Transactional |
| | | public R edit(@Validated @RequestBody WhitelistEditDto dto) { |
| | | if (!StringUtils.hasLength(dto.getAccount())) { |
| | | return R.fail("请输入账号"); |
| | | } |
| | | SysUser sysUser = tokenService.getLoginUser().getSysUser(); |
| | | XpWhitelist xpWhitelist = new XpWhitelist(); |
| | | BeanUtils.copyProperties(dto, xpWhitelist); |
| New file |
| | |
| | | package com.xiaopeng.operation.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "邀请码生成InvitationAddDto") |
| | | public class InvitationAddDto implements Serializable { |
| | | |
| | | @NotBlank(message = "手机号不能为空") |
| | | @ApiModelProperty(value = "手机号") |
| | | private String phones; |
| | | |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "邀请码管理列表查询query") |
| | | public class InvitationPageListQuery extends BasePage { |
| | |
| | | private String status; |
| | | @ApiModelProperty(value = "绑定账号") |
| | | private String bindAccount; |
| | | |
| | | @ApiModelProperty(value = "选择的id集合") |
| | | private List<Long> ids; |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "白名单管理列表查询query") |
| | | public class WhitelistPageListQuery extends BasePage { |
| | |
| | | private Boolean status; |
| | | @ApiModelProperty(value = "来源 1=添加 2=邀请码") |
| | | private Integer whitelistSource; |
| | | @ApiModelProperty(value = "选中的记录id集合") |
| | | private List<Long> ids; |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | // 10. 检查等待时间 |
| | | Integer waitTime = getWaitTime(routeAndFareDto.getOrigin().getLongitude(), routeAndFareDto.getOrigin().getLatitude()); |
| | | if (waitTime > 3) { |
| | | throw new ServiceException("当前区域正在等待中,请耐心等待", I18nKeyConstant.WAITING_TIME); |
| | | } |
| | | fareVo.setWaitingTime(waitTime); |
| | | // Integer waitTime = getWaitTime(routeAndFareDto.getOrigin().getLongitude(), routeAndFareDto.getOrigin().getLatitude()); |
| | | // if (waitTime > 3) { |
| | | // throw new ServiceException("当前区域正在等待中,请耐心等待", I18nKeyConstant.WAITING_TIME); |
| | | // } |
| | | // fareVo.setWaitingTime(waitTime); |
| | | |
| | | |
| | | // 11. 生成订单ID并缓存 |
| | |
| | | @Override |
| | | public List<XpWhitelist> exportList(WhitelistPageListQuery query) { |
| | | List<XpWhitelist> list = this.baseMapper.exportList(query); |
| | | |
| | | return list; |
| | | } |
| | | |
| | |
| | | if (!PhoneUtil.isPhone(dto.getAccount())) { |
| | | throw new ServiceException("以下帐号格式不正确:", I18nKeyConstant.ACCOUNT_FORMAT_ERROR, new Object[]{dto.getAccount()}); |
| | | } |
| | | XpWhitelist old = this.lambdaQuery() |
| | | .eq(XpWhitelist::getAccount, dto.getAccount()) |
| | | .ne(XpWhitelist::getId, dto.getId()) |
| | | .last("limit 1").one(); |
| | | if (old != null) { |
| | | return R.fail("该账号已存在"); |
| | | } |
| | | XpWhitelist whitelist = this.getById(dto.getId()); |
| | | |
| | | StringBuilder operationContent = new StringBuilder("编辑账号:"); |
| | |
| | | // 更改 暂不限制数量 |
| | | |
| | | List<VehiclePosition> positionList = vehiclePositionService.findAvailableVehiclesNearby(Double.parseDouble(split[0]), Double.parseDouble(split[1]), xpTradingStrategy.getOnePushDistance(), xpTradingStrategy.getSimultaneouslyOrderCount()); |
| | | |
| | | log.info("根据距离找车 {}", positionList); |
| | | // 获取车辆的区域信息 |
| | | if (positionList.isEmpty()) { |
| | | continue; |
| | |
| | | |
| | | // 获取车辆的信息 筛选出可用车辆 |
| | | R<List<String>> vehiclePositionVos = xpVehicleClient.queryVehiclePositionByVin(new VehiclePositionByVinDto(xpElectronicFence.getId(), vinList, xpTradingStrategy.getSimultaneouslyOrderCount())); |
| | | log.info("筛选可用车辆结果 {}", vehiclePositionVos); |
| | | if (vehiclePositionVos.getCode() != 200) { |
| | | continue; |
| | | } |
| | | |
| | | List<VehiclePositionVo> availableVehiclesNearby = BeanUtil.copyToList(positionList, VehiclePositionVo.class); |
| | | List<String> data = vehiclePositionVos.getData(); |
| | | |
| | |
| | | |
| | | if (!availableVehiclesNearby.isEmpty()) { |
| | | if (availableVehiclesNearby.size() > 1) { |
| | | log.info("附近有 {} 辆车,进入权重按断流程", availableVehiclesNearby.size()); |
| | | // 走权重 |
| | | |
| | | // 订单价值 |
| | |
| | | continue; |
| | | } |
| | | XpVehicle vehiclePosition = vehiclePositionR.getData(); |
| | | if (vehiclePosition.getStatus() != 1 || vehiclePosition.getState() != 0 || vehiclePosition.getVehicleType() == 1) { |
| | | lock.unlock(); |
| | | log.info("符合条件的车辆 {} ,直接推单XPU", vehiclePosition.getPlateNumber()); |
| | | log.info("当前车辆状态 {}", vehiclePosition.getStatus()); |
| | | if (vehiclePosition.getStatus() != 1 || vehiclePosition.getState() != 0 || vehiclePosition.getVehicleType()==1) { |
| | | continue; |
| | | } |
| | | // 关闭巡游单子 |
| | |
| | | pushOrderDto.setOrderType(OrderType.USER_ORDER); |
| | | pushOrderDto.setStage(1); |
| | | // 调用推送服务 orderId + carVin |
| | | orderMissionClient.pushOrder(pushOrderDto); |
| | | // orderMissionClient.pushOrder(pushOrderDto); |
| | | log.info("开始推送 {} 订单到XPU", xpOrder.getOrderNumber()); |
| | | |
| | | redisService.popFirstElement(quoteName); |
| | | log.info("将订单 {} 从队列 {} 弹出去", xpOrder.getOrderNumber(), quoteName); |
| | | return; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | continue; |
| | | } |
| | | XpVehicle vehicleId1 = vehicleR.getData(); |
| | | if (vehicleId1.getStatus() != 1 || vehicleId1.getState() != 0 || vehicleId1.getVehicleType() == 1) { |
| | | log.info("附近只有一个车辆 {} ,直接推单XPU", vehicleId1.getPlateNumber()); |
| | | log.info("当前车辆状态 {}", vehicleId1.getStatus()); |
| | | if (vehicleId1.getStatus() != 1 || vehicleId1.getState() != 0 || vehicleId1.getVehicleType()==1) { |
| | | lock.unlock(); |
| | | continue; |
| | | } |
| | |
| | | pushOrderDto.setOrderType(OrderType.USER_ORDER); |
| | | pushOrderDto.setStage(1); |
| | | // 调用推送服务 orderId + carVin |
| | | orderMissionClient.pushOrder(pushOrderDto); |
| | | // orderMissionClient.pushOrder(pushOrderDto); |
| | | log.info("开始推送 {} 订单到XPU", xpOrder.getOrderNumber()); |
| | | redisService.popFirstElement(quoteName); |
| | | log.info("将订单 {} 从队列 {} 弹出去", xpOrder.getOrderNumber(), quoteName); |
| | | return; |
| | | |
| | | } catch (Exception e) { |
| | |
| | | <if test="query.bindAccount != null and query.bindAccount != ''"> |
| | | and bind_account like concat('%',#{query.bindAccount},'%') |
| | | </if> |
| | | <if test="query.ids != null and query.ids.size()>0"> |
| | | and id in |
| | | <foreach item="item" collection="query.ids" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | | |
| | |
| | | <if test="query.whitelistSource != null"> |
| | | and whitelist_source = #{query.source} |
| | | </if> |
| | | <if test="query.ids != null and query.ids.size()>0"> |
| | | and id in |
| | | <foreach item="item" collection="query.ids" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | order by create_time desc |
| | | </select> |
| | | |
copy from xp-robotaxi-maintenance-boot/xp-modules-account.iml
copy to xp-robotaxi-payment-boot/xp-robotaxi-payment-boot.iml
| File was copied from xp-robotaxi-maintenance-boot/xp-modules-account.iml |
| | |
| | | <component name="AdditionalModuleElements"> |
| | | <content url="file://$MODULE_DIR$" dumb="true"> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> |
| | | </content> |
| | | </component> |
| | | </module> |
| | |
| | | }).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(vehicleList)) { |
| | | xpFleetVehicleService.saveBatch(vehicleList); |
| | | //推送车辆和区域的绑定关系个车端 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | return R.ok(); |