Merge remote-tracking branch 'origin/master'
| | |
| | | } |
| | | // 角色名称匹配 |
| | | for (ExportOperationsUserVo xpOperationsUserVO : list) { |
| | | xpOperationsUserVO.setRoleName(map.get(xpOperationsUserVO.getId()).stream().map(SysRole::getRoleName).collect(Collectors.joining(";"))); |
| | | List<SysRole> sysRoles1 = map.get(xpOperationsUserVO.getId()); |
| | | if(null != sysRoles1){ |
| | | xpOperationsUserVO.setRoleName(sysRoles1.stream().map(SysRole::getRoleName).collect(Collectors.joining(";"))); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | <select id="exportOperationsUser" resultType="com.xiaopeng.api.vo.account.ExportOperationsUserVo"> |
| | | SELECT xou.id, xou.nick_name, xou.unique_number, xou.avatar, xou.password, xou.phone_number, xou.remarks, xou.status, |
| | | xou.id_card_front, xou.id_card_back, xou.driver_license, xou.certificate_of_no_criminal_record, |
| | | xou.training_graduation_certificate, xou.is_deleted, xou.create_time, xou.update_time, xou.create_by |
| | | from xp_operations_user xou |
| | | left join xp_operations_role xor on xou.id = xor.operations_user_id |
| | | SELECT |
| | | xou.id, |
| | | xou.nick_name, |
| | | xou.unique_number, |
| | | xou.avatar, |
| | | xou.`password`, |
| | | xou.phone_number, |
| | | xou.remarks, |
| | | xou.`status`, |
| | | xou.id_card_front, |
| | | xou.id_card_back, |
| | | xou.driver_license, |
| | | xou.certificate_of_no_criminal_record, |
| | | xou.training_graduation_certificate, |
| | | xou.is_deleted, |
| | | xou.create_time, |
| | | xou.update_time, |
| | | xou.create_by |
| | | FROM |
| | | xp_operations_user xou |
| | | LEFT JOIN xp_operations_role a ON xou.id = a.operations_user_id |
| | | <where> |
| | | <if test="query.nickName != null and query.nickName != ''"> |
| | | and xou.nick_name like concat('%',#{query.nickName},'%') |
| | |
| | | private Integer isOpen=0; |
| | | |
| | | |
| | | private String china; |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "队列名称") |
| | | @TableField("queue_name") |
| | | private String queueName; |
| | | |
| | | // 用于计数 |
| | | @TableField(exist = false) |
| | | private Integer num; |
| | | } |
| | |
| | | private Integer currentElectricity; |
| | | |
| | | @ApiModelProperty(value = "续航公里") |
| | | private Double mileageRange; |
| | | private Float mileageRange; |
| | | |
| | | @ApiModelProperty(value = "车辆接单状态 1接单中 0空闲") |
| | | private Integer state; |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime qualificationExpireTime; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | private Long electronicAreaId; |
| | | |
| | | |
| | | private Integer num; |
| | | } |
| | |
| | | |
| | | |
| | | private Long electronicAreaId; |
| | | |
| | | private Integer num; |
| | | } |
| | |
| | | dto.setRouteType(1); |
| | | dto.setLongitude(longitude); |
| | | dto.setLatitude(latitude); |
| | | //TODO 这两个字段现在拿不到 |
| | | // dto.setDuration(rtTripInfo.getRemaining_time()); |
| | | // dto.setDistance(rtTripInfo.getRemaining_distance().intValue()); |
| | | dto.setDuration(10); |
| | | dto.setDistance(2); |
| | | xpPushMessageClient.pushOrderRoute(dto); |
| | | } |
| | | |
| | |
| | | if (null != orderId) { |
| | | PushOrderRouteDTO dto = new PushOrderRouteDTO(); |
| | | dto.setOrderId(orderId); |
| | | dto.setRouteType(1); |
| | | dto.setRouteType(2); |
| | | dto.setLongitude(longitude); |
| | | dto.setLatitude(latitude); |
| | | //TODO 这两个字段现在拿不到 |
| | | // dto.setDuration(rtTripInfo.getRemaining_time()); |
| | | // dto.setDistance(rtTripInfo.getRemaining_distance().intValue()); |
| | | dto.setDuration(20); |
| | | dto.setDistance(10); |
| | | xpPushMessageClient.pushOrderRoute(dto); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | // // 算距离 |
| | | R<RouteVo> distanceAndDuration = xpMapClient.getDistanceAndDuration(routeAndFareDto); |
| | | if(distanceAndDuration.getCode()!=200){ |
| | | if (distanceAndDuration.getCode() != 200) { |
| | | throw new ServiceException("未找到路径", I18nKeyConstant.PATH_NOT_FOUND); |
| | | } |
| | | |
| | |
| | | xpPricingCardVo = xpPricingUtil.calculationFixedPrice(userId, |
| | | JSON.parseObject(xpPricing.getBasicPricingJson()), |
| | | JSON.parseArray(xpPricing.getStartingFareJson()), |
| | | routeVo.getDistance(), routeVo.getDuration(),0, 0.0, xpPricing.getIsDynamicPrice(), routeAndFareDto.getOpenCityId(), xpPricing.getDynamicPricingJson() |
| | | routeVo.getDistance(), routeVo.getDuration(), 0, 0.0, xpPricing.getIsDynamicPrice(), routeAndFareDto.getOpenCityId(), xpPricing.getDynamicPricingJson() |
| | | ); |
| | | } |
| | | |
| | |
| | | () -> { |
| | | // 优惠券 |
| | | return xpAppUserCouponClient.getUserCoupon( |
| | | new GetUserCouponDto(Long.valueOf(userId), finalXpPricingCardVo.getTotalPrice(),routeAndFareDto.getOpenCityId()) |
| | | new GetUserCouponDto(Long.valueOf(userId), finalXpPricingCardVo.getTotalPrice(), routeAndFareDto.getOpenCityId()) |
| | | // new GetUserCouponDto(Long.valueOf(userId), 1d, routeAndFareDto.getOpenCityId()) |
| | | ); |
| | | }, |
| | |
| | | if (userCouponVo != null) { |
| | | Double money = userCouponVo.getMoney(); |
| | | xpPricingCardVo.setCoupon(String.valueOf(userCouponVo.getMoney())); |
| | | if(xpPricingCardVo.getTotalPrice()> money){ |
| | | if (xpPricingCardVo.getTotalPrice() > money) { |
| | | xpPricingCardVo.setSystemDiscount(xpPricingCardVo.getTotalPrice() - money); |
| | | } |
| | | |
| | |
| | | throw new ServiceException("订单生成失败", I18nKeyConstant.ORDER_CREATE_FAIL); |
| | | } |
| | | Long orderId = addOrderR.getData(); |
| | | |
| | | xpOrder.setId(orderId); |
| | | // 静默处理 不推单 |
| | | if (isSilent) { |
| | | // todo 用于测试流程,正式联调需要删除此代码 |
| | |
| | | * 测试阶段用于自动完成小程序的整个流程数据状态流转 |
| | | * @param orderId |
| | | */ |
| | | public void testOrder(Long orderId, Integer status){ |
| | | public void testOrder(Long orderId, Integer status) { |
| | | XpOrder xpOrder = xpOrderClient.queryOrderById(orderId).getData(); |
| | | Long appUserId = xpOrder.getAppUserId(); |
| | | if(2 == status){ |
| | | if(xpOrder.getStatus() == 0){ |
| | | if (2 == status) { |
| | | if (xpOrder.getStatus() == 0) { |
| | | return; |
| | | } |
| | | xpOrder.setAppUserId(null); |
| | |
| | | xpOrder.setFleetId(2L); |
| | | xpOrderClient.updateOrder(xpOrder); |
| | | } |
| | | if(3 == status){ |
| | | if (3 == status) { |
| | | //修改状态为接驾中 |
| | | xpOrder = xpOrderClient.queryOrderById(orderId).getData(); |
| | | if(xpOrder.getStatus() == 0){ |
| | | if (xpOrder.getStatus() == 0) { |
| | | return; |
| | | } |
| | | xpOrder.setAppUserId(null); |
| | |
| | | route.put("duration", routeVo.getDuration()); |
| | | route.put("routeID", routeVo.getRouteID()); |
| | | |
| | | List<com.alibaba.fastjson2.JSONObject> collect = routeVo.getPolyline().stream().map(item->{ |
| | | List<com.alibaba.fastjson2.JSONObject> collect = routeVo.getPolyline().stream().map(item -> { |
| | | com.alibaba.fastjson2.JSONObject point = new com.alibaba.fastjson2.JSONObject(); |
| | | point.put("latitude", item.getLatitude()); |
| | | point.put("longitude", item.getLongitude()); |
| | |
| | | messageDTO.setMessage(jsonObject.toJSONString()); |
| | | xpPushMessageClient.sendRoute(messageDTO); |
| | | } |
| | | if(4 == status){ |
| | | if (4 == status) { |
| | | //司机到达起点 |
| | | xpOrder = xpOrderClient.queryOrderById(orderId).getData(); |
| | | if(xpOrder.getStatus() == 0){ |
| | | if (xpOrder.getStatus() == 0) { |
| | | return; |
| | | } |
| | | xpOrder.setAppUserId(null); |
| | |
| | | dto.setMessage("{\"type\":\"VEHICLE_LOCATION\",\"content\":\"{\\\"orderId\\\":\\\"" + orderId + "\\\",\\\"lon\\\":" + xpOrder.getStartLon() + ",\\\"lat\\\":" + xpOrder.getStartLat() + "}\",\"timestamp\":\"176569945845456\"}"); |
| | | xpPushMessageClient.sendVehicleLocation(dto); |
| | | } |
| | | if(5 == status){ |
| | | if (5 == status) { |
| | | //乘客上车 |
| | | xpOrder = xpOrderClient.queryOrderById(orderId).getData(); |
| | | if(xpOrder.getStatus() == 0){ |
| | | if (xpOrder.getStatus() == 0) { |
| | | return; |
| | | } |
| | | xpOrder.setAppUserId(null); |
| | |
| | | route.put("distance", routeVo.getDistance()); |
| | | route.put("duration", routeVo.getDuration()); |
| | | route.put("routeID", routeVo.getRouteID()); |
| | | List<com.alibaba.fastjson2.JSONObject> collect = routeVo.getPolyline().stream().map(item->{ |
| | | List<com.alibaba.fastjson2.JSONObject> collect = routeVo.getPolyline().stream().map(item -> { |
| | | com.alibaba.fastjson2.JSONObject point = new com.alibaba.fastjson2.JSONObject(); |
| | | point.put("latitude", item.getLatitude()); |
| | | point.put("longitude", item.getLongitude()); |
| | |
| | | messageDTO.setMessage(jsonObject.toJSONString()); |
| | | xpPushMessageClient.sendRoute(messageDTO); |
| | | } |
| | | if(6 == status){ |
| | | if (6 == status) { |
| | | //开始服务中 |
| | | xpOrder.setAppUserId(null); |
| | | xpOrder.setStatus(6); |
| | |
| | | xpPushMessageClient.sendStatus(dto); |
| | | } |
| | | |
| | | if(7 == status){ |
| | | if (7 == status) { |
| | | //乘客待下车 |
| | | xpOrder.setAppUserId(null); |
| | | xpOrder.setStatus(7); |
| | |
| | | // xpOrder |
| | | |
| | | |
| | | if(8 == status){ |
| | | if (8 == status) { |
| | | //乘客待支付 |
| | | xpOrder.setAppUserId(null); |
| | | xpOrder.setStatus(8); |
| | |
| | | xpPushMessageClient.sendStatus(dto); |
| | | } |
| | | |
| | | if(9 == status){ |
| | | if (9 == status) { |
| | | //乘客支付成功 |
| | | xpOrder.setAppUserId(null); |
| | | xpOrder.setStatus(9); |
| | |
| | | PageInfo<TaskPageListVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TaskPageListVO> list = this.baseMapper.pageList(pageInfo, query); |
| | | XpTaskRule xpTaskRule = xpTaskRuleMapper.selectOne(new LambdaQueryWrapper<XpTaskRule>().last("limit 1")); |
| | | if (Objects.nonNull(xpTaskRule)) { |
| | | list.stream().filter(item -> item.getTaskCategory().equals(2)).forEach(item -> { |
| | | item.setCanArriveRange(xpTaskRule.getCanArriveRange()); |
| | | }); |
| | | } |
| | | // if (Objects.nonNull(xpTaskRule)) { |
| | | // list.stream().filter(item -> item.getTaskCategory().equals(2)).forEach(item -> { |
| | | // item.setCanArriveRange(xpTaskRule.getCanArriveRange()); |
| | | // }); |
| | | // } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | xpTask.setTaskCode(code); |
| | | xpTask.setTaskCategory(2); |
| | | xpTask.setTaskTypeId(dto.getTaskTypeId()); |
| | | String[] split = dto.getTaskTypeId().split(","); |
| | | List<String> typeIds = new ArrayList<>(); |
| | | for (String s : split) { |
| | | typeIds.add(s.trim()); |
| | | } |
| | | StringBuilder temp = new StringBuilder(dto.getTaskTypeId()); |
| | | List<Long> children = typeIds.stream().map(Long::parseLong).collect(Collectors.toList()); |
| | | List<Long> parentIds = errorTypeMapper.selectList(new LambdaQueryWrapper<XpErrorType>() |
| | | .in(XpErrorType::getId, children)).stream().map(XpErrorType::getParentId).distinct().collect(Collectors.toList()); |
| | | for (Long parentId : parentIds) { |
| | | temp.append(",").append(parentId); |
| | | } |
| | | xpTask.setTaskTypeId(temp.toString()); |
| | | xpTask.setTaskUrgencyLevel(dto.getTaskUrgencyLevel()); |
| | | xpTask.setTaskDescription(dto.getTaskDescription()); |
| | | XpVehicle vehicle = xpVehicleClient.queryById(xpTask.getVehicleId()).getData(); |
| | | if (vehicle!=null){ |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(vehicle.getVehicleVin())), VehiclePosition.class); |
| | | if (vehiclePosition != null) { |
| | | double x = vehiclePosition.getPoint().getX(); |
| | | double y = vehiclePosition.getPoint().getY(); |
| | | xpTask.setVehicleLon(new BigDecimal(x)); |
| | | xpTask.setVehicleLat(new BigDecimal(y)); |
| | | } |
| | | } |
| | | |
| | | // if (vehicle!=null){ |
| | | // VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(vehicle.getVehicleVin())), VehiclePosition.class); |
| | | // if (vehiclePosition != null) { |
| | | // double x = vehiclePosition.getPoint().getX(); |
| | | // double y = vehiclePosition.getPoint().getY(); |
| | | // xpTask.setVehicleLon(new BigDecimal(x)); |
| | | // xpTask.setVehicleLat(new BigDecimal(y)); |
| | | // } |
| | | // } |
| | | // 临时处理 |
| | | xpTask.setVehicleLon(new BigDecimal("104.055683")); |
| | | xpTask.setVehicleLat(new BigDecimal("30.585991")); |
| | | xpTask.setVehicleLocation("四川省成都市武侯区石羊街道天府新谷"); |
| | | xpTask.setVehicleId(dto.getId()); |
| | | xpTask.setReportUserId(xpOperationsUser.getId()); |
| | | xpTask.setReportTime(LocalDateTime.now()); |
| | |
| | | namespace: 5185ac4b-6369-48eb-a21b-a7cbc441c5f1 |
| | | username: nacos |
| | | password: nacos |
| | | ip: 192.168.110.85 |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 192.168.110.80:8848 |
| | |
| | | } |
| | | } |
| | | @ApiOperation(value = "邀请码导入") |
| | | @PostMapping("/api/v1/invitation/importExcel") |
| | | @PostMapping("/base/v1/invitation/importExcel") |
| | | public R<String> importExcel(@RequestPart("file") MultipartFile file) { |
| | | System.out.println("文件名 = " + file.getOriginalFilename()); |
| | | System.out.println("文件大小 = " + file.getSize()); |
| | |
| | | .map(item -> (XpRegion) item) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if(query.getCityName()!=null){ |
| | | list = list.stream().filter(item -> item.getName().contains(query.getCityName()) || item.getInitial().contains(query.getCityName())).collect(Collectors.toList()); |
| | | } |
| | | } catch (ClassCastException e) { |
| | | // 缓存数据结构异常,重新加载 |
| | | redisService.deleteObject(CacheConstants.XP_REGION); |
| | | } |
| | | }else { |
| | | list = regionService.list(Wrappers.lambdaQuery(XpRegion.class).ne(XpRegion::getParentId, 0).and(w->w.like(query.getCityName()!=null , XpRegion::getInitial, query.getCityName()).or().like(query.getCityName()!=null , XpRegion::getInitial, query.getCityName())).like(query.getCityName()!=null , XpRegion::getName, query.getCityName()).isNotNull(XpRegion::getInitial).orderByAsc(XpRegion::getInitial)); |
| | | list = regionService.list(Wrappers.lambdaQuery(XpRegion.class).ne(XpRegion::getParentId, 0).isNotNull(XpRegion::getInitial).orderByAsc(XpRegion::getInitial)); |
| | | redisService.setCacheList(CacheConstants.XP_REGION_CITY, list); |
| | | } |
| | | List<XpOpenCity> openCities = openCityService.list(new LambdaQueryWrapper<XpOpenCity>().eq(XpOpenCity::getStatus,1)); |
| | |
| | | } |
| | | |
| | | if (query.getCityName() != null) { |
| | | list = list.stream().filter(item -> item.getName().contains(query.getCityName())).collect(Collectors.toList()); |
| | | list = list.stream().filter(item -> item.getName().contains(query.getCityName()) || item.getInitial().equals(query.getCityName()) || item.getChina().contains(query.getCityName().toLowerCase())).collect(Collectors.toList()); |
| | | } |
| | | if (query.getIsOpen() != null) { |
| | | list = list.stream().filter(item -> item.getIsOpen().equals(query.getIsOpen())).collect(Collectors.toList()); |
| | |
| | | * @author mitao |
| | | * @since 2026-02-03 |
| | | */ |
| | | @RequestMapping("/api/v1/whitelist") |
| | | @RequestMapping("") |
| | | @RestController |
| | | @Api(tags = "白名单管理") |
| | | @Slf4j |
| | |
| | | * 获取所有白名单手机号 |
| | | * @return |
| | | */ |
| | | @PostMapping("/inner/getAllWhiteList") |
| | | @PostMapping("/api/v1/whitelist/inner/getAllWhiteList") |
| | | public R<List<String>> getAllWhiteList(){ |
| | | return R.ok(xpWhitelistService.getAllWhiteList()); |
| | | } |
| | | |
| | | @ApiOperation(value = "白名单管理分页列表", response = XpWhitelist.class) |
| | | @PostMapping("/pageList") |
| | | @PostMapping("/api/v1/whitelist/pageList") |
| | | public R<PageInfo<XpWhitelist>> pageList(@RequestBody WhitelistPageListQuery query) { |
| | | PageInfo<XpWhitelist> pageList = xpWhitelistService.pageList(query); |
| | | return R.ok(pageList); |
| | |
| | | /** |
| | | * 新增白名单 |
| | | */ |
| | | @PostMapping("/add") |
| | | @PostMapping("/api/v1/whitelist/add") |
| | | @ResponseBody |
| | | @ApiOperation(value = "新增白名单") |
| | | @Transactional |
| | |
| | | /** |
| | | * 编辑白名单 |
| | | */ |
| | | @PostMapping("/edit") |
| | | @PostMapping("/api/v1/whitelist/edit") |
| | | @ResponseBody |
| | | @ApiOperation(value = "编辑白名单") |
| | | @Transactional |
| | |
| | | /** |
| | | * 冻结解冻 |
| | | */ |
| | | @GetMapping("/freezeUnfreeze") |
| | | @GetMapping("/api/v1/whitelist/freezeUnfreeze") |
| | | @ResponseBody |
| | | @ApiOperation(value = "冻结解冻") |
| | | @Transactional |
| | |
| | | /** |
| | | * 批量删除 |
| | | */ |
| | | @GetMapping("/deleteByIds") |
| | | @GetMapping("/api/v1/whitelist/deleteByIds") |
| | | @ResponseBody |
| | | @ApiOperation(value = "批量删除") |
| | | public R deleteByIds(String ids) { |
| | |
| | | /** |
| | | * 批量冻结 |
| | | */ |
| | | @GetMapping("/freezeByIds") |
| | | @GetMapping("/api/v1/whitelist/freezeByIds") |
| | | @ResponseBody |
| | | @ApiOperation(value = "批量冻结") |
| | | public R freezeByIds(String ids) { |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "白名单导入模板下载") |
| | | @GetMapping("/import-template") |
| | | @GetMapping("/api/v1/whitelist/import-template") |
| | | public void importTemplate() { |
| | | List<WhitelistImportExcel> whitelistImportExcels = new ArrayList<>(); |
| | | WhitelistImportExcel whitelistImportExcel = new WhitelistImportExcel(); |
| | |
| | | @Log(title = "白名单导入", businessType = BusinessType.IMPORT) |
| | | @ApiOperation(value = "白名单导入") |
| | | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) |
| | | @PostMapping("/importExcel") |
| | | @PostMapping("/base/v1/whitelist/importExcel") |
| | | public AjaxResult<String> importExcel(@RequestPart("file") MultipartFile file) { |
| | | |
| | | ImportParams params = new ImportParams(); |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "白名单导出") |
| | | @PostMapping(value = "/exportExcel") |
| | | @PostMapping(value = "/api/v1/whitelist/exportExcel") |
| | | public void exportExcel(@RequestBody WhitelistPageListQuery query) { |
| | | List<XpWhitelist> exportList = xpWhitelistService.exportList(query); |
| | | List<XpWhitelistExportExcel> xpWhitelistExportExcels = new ArrayList<>(); |
| | |
| | | */ |
| | | @PostMapping("/inner/order/updateOrder") |
| | | public R<?> updateOrder(@RequestBody XpOrder xpOrder){ |
| | | xpOrder.setAppUserId(null); |
| | | return xpOrderService.updateById(xpOrder)?R.ok():R.fail(); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<XpOrderHistoryListVO> getHistoryOrderList(@Param("page") Page<XpOrderHistoryListVO> page, @Param("query") XpHistoryOrderListQuery query, @Param("uid") Long uid); |
| | | |
| | | List<XpOrder> getHistoryStartPoints(@Param("uid") Long uid); |
| | | |
| | | |
| | | List<XpOrder> getHistoryEndPoints(@Param("uid") Long uid); |
| | | |
| | | |
| | | } |
| | |
| | | wrapper.ge(XpOrder::getCreateTime, LocalDateTime.of(query.getStartTime(), LocalTime.MIN)); |
| | | } |
| | | if (Objects.nonNull(query.getEndTime())) { |
| | | wrapper.ge(XpOrder::getCreateTime, LocalDateTime.of(query.getEndTime(), LocalTime.MAX)); |
| | | wrapper.le(XpOrder::getCreateTime, LocalDateTime.of(query.getEndTime(), LocalTime.MAX)); |
| | | } |
| | | wrapper.orderByDesc(XpOrder::getCreateTime); |
| | | return wrapper; |
| | |
| | | @Override |
| | | public List<XpHistoryStartPointsVo> getHistoryStartPoints(String uid, double lon, double lat) { |
| | | // |
| | | List<XpOrder> xpOrders = this.baseMapper.selectList(new LambdaQueryWrapper<XpOrder>().eq(XpOrder::getAppUserId, Long.parseLong(uid)).orderByDesc(BaseModel::getCreateTime).last("LIMIT 10")); |
| | | List<XpOrder> xpOrders = this.baseMapper.getHistoryStartPoints(Long.valueOf(uid)); |
| | | // selectList(new LambdaQueryWrapper<XpOrder>().eq(XpOrder::getAppUserId, Long.parseLong(uid)).orderByDesc(BaseModel::getCreateTime).last("LIMIT 10")); |
| | | if (xpOrders.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | |
| | | List<Long> startPointsIds = xpOrders.stream().map(XpOrder::getStartPointId).collect(Collectors.toList()); |
| | | |
| | | R<List<XpHistoryStartPointsVo>> r = xpPointClient.getHistoryStartPoints(new HistoryStartPointsDto(startPointsIds, lon, lat)); |
| | | return r.getData(); |
| | | |
| | | |
| | | List<XpHistoryStartPointsVo> data = r.getData(); |
| | | |
| | | for (XpHistoryStartPointsVo datum : data) { |
| | | xpOrders.stream().filter(e->e.getEndPointId().equals(datum.getId())).findFirst().ifPresent( |
| | | order->{ |
| | | datum.setNum(order.getNum()); |
| | | } |
| | | ); |
| | | } |
| | | data = data.stream().sorted(Comparator.comparingInt(XpHistoryStartPointsVo::getNum).reversed()).collect(Collectors.toList()); |
| | | |
| | | return data; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<XpHistoryEndPointsVo> getHistoryEndPoints(String uid, double lon, double lat) { |
| | | // |
| | | List<XpOrder> xpOrders = this.baseMapper.selectList(new LambdaQueryWrapper<XpOrder>().eq(XpOrder::getAppUserId, Long.parseLong(uid)).orderByDesc(BaseModel::getCreateTime).last("LIMIT 10")); |
| | | List<XpOrder> xpOrders = this.baseMapper.getHistoryEndPoints(Long.valueOf(uid)); |
| | | // selectList(new LambdaQueryWrapper<XpOrder>().eq(XpOrder::getAppUserId, Long.parseLong(uid)).orderByDesc(BaseModel::getCreateTime).last("LIMIT 10")); |
| | | if (xpOrders.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | |
| | | List<Long> endPointsIds = xpOrders.stream().map(XpOrder::getEndPointId).collect(Collectors.toList()); |
| | | |
| | | R<List<XpHistoryEndPointsVo>> r = xpPointClient.getHistoryEndPoints(new HistoryEndPointsDto(endPointsIds, lon, lat)); |
| | | return r.getData(); |
| | | |
| | | List<XpHistoryEndPointsVo> data = r.getData(); |
| | | |
| | | for (XpHistoryEndPointsVo datum : data) { |
| | | xpOrders.stream().filter(e->e.getEndPointId().equals(datum.getId())).findFirst().ifPresent( |
| | | order->{ |
| | | datum.setNum(order.getNum()); |
| | | } |
| | | ); |
| | | } |
| | | data = data.stream().sorted(Comparator.comparingInt(XpHistoryEndPointsVo::getNum).reversed()).collect(Collectors.toList()); |
| | | |
| | | return data; |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | if (order.getStatus() > 5 || order.getStatus() < 1) { |
| | | throw new ServiceException("订单状态错误",I18nKeyConstant.ORDER_STATUS_ERROR); |
| | | } |
| | | if(order.getStatus()==1){ |
| | | order.setStatus(0); |
| | | order.setAppUserId(null); |
| | | baseMapper.updateById(order); |
| | | return; |
| | | } |
| | | order.setStatus(0); |
| | | |
| | |
| | | ); |
| | | break; |
| | | } |
| | | xpOrder.setAppUserId(null); |
| | | this.updateById(xpOrder); |
| | | return R.ok(); |
| | | } |
| | |
| | | xpGeoQueryEntity.setOrderId(split[0]); |
| | | // 存mongo数据 |
| | | xpPricingClient.updateXpGeoQueryEntity(split[0]); |
| | | order.setAppUserId(null); |
| | | this.updateById(order); |
| | | |
| | | // 修改车辆信息 |
| | |
| | | </if> |
| | | order by create_time desc |
| | | </select> |
| | | <select id="getHistoryStartPoints" resultType="com.xiaopeng.api.model.order.XpOrder" |
| | | parameterType="java.lang.Long"> |
| | | SELECT |
| | | start_point_id, |
| | | COUNT(*) AS num |
| | | FROM xp_order where app_user_id = #{uid} |
| | | GROUP BY start_point_id |
| | | ORDER BY num DESC,create_time desc |
| | | LIMIT 10; |
| | | </select> |
| | | <select id="getHistoryEndPoints" resultType="com.xiaopeng.api.model.order.XpOrder" |
| | | parameterType="java.lang.Long"> |
| | | SELECT |
| | | end_point_id, |
| | | COUNT(*) AS num |
| | | FROM xp_order where app_user_id = #{uid} |
| | | GROUP BY end_point_id |
| | | ORDER BY num DESC,create_time desc |
| | | LIMIT 10; |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpFleetVehicle; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicleAnnualRecord; |
| | | import com.xiaopeng.api.vo.automaticPilot.VehiclePosition; |
| | | import com.xiaopeng.api.vo.vehicleConvoy.VehiclesCommandCallbackVo; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | private final XpChargingRecordClient xpChargingRecordClient; |
| | | private final XpTaskClient xpTaskClient; |
| | | private final XpTaskRuleClient xpTaskRuleClient; |
| | | private final MongoTemplate mongoTemplate; |
| | | /** |
| | | * 根据ID列表批量查询车辆信息(内部接口) |
| | | * |
| | |
| | | /** |
| | | * 导出在库车辆列表 |
| | | * |
| | | * @param query 查询参数 |
| | | */ |
| | | @ApiOperation(value = "下载导入模板", tags = {"管理后台-车辆管理-在库车辆管理"}) |
| | | @PostMapping("/api/v1/vehicle/importTemplate") |
| | |
| | | } |
| | | } |
| | | } |
| | | // 查询车辆的续航里程 |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(xpVehicleVO.getVehicleVin())), VehiclePosition.class); |
| | | if(Objects.nonNull(vehiclePosition)){ |
| | | xpVehicleVO.setMileageRange(vehiclePosition.getMileageRange()); |
| | | xpVehicleVO.setCurrentElectricity(vehiclePosition.getCurrentElectricity()); |
| | | }else { |
| | | xpVehicleVO.setMileageRange(0F); |
| | | xpVehicleVO.setCurrentElectricity(0); |
| | | } |
| | | return R.ok(xpVehicleVO); |
| | | } |
| | | |