xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/config/MiniprogramConfigurer.java
@@ -10,7 +10,7 @@ import javax.annotation.Resource; @Slf4j @Configuration //@Configuration public class MiniprogramConfigurer extends WebMvcConfigurerAdapter { @Resource xp-robotaxi-api/src/main/java/com/xiaopeng/api/factory/operation/XpOpenCityClientFallbackFactory.java
@@ -35,6 +35,12 @@ log.error("获取开通城市失败"); return R.fail("获取开通城市失败"); } @Override public R<XpOpenCity> getXpOpenCityById(Long id) { log.error("获取开通城市失败"); return R.fail("获取开通城市失败"); } }; } } xp-robotaxi-api/src/main/java/com/xiaopeng/api/feignClient/map/XpMapClient.java
@@ -57,6 +57,6 @@ /** * 获取指定城市的天气 */ @GetMapping("/logan/inner/weatherInfo") R<WeatherDTO> wether(@RequestParam String cityCode); @PostMapping("/logan/inner/weatherInfo") R<WeatherDTO> wether(@RequestParam("cityCode") String cityCode); } xp-robotaxi-api/src/main/java/com/xiaopeng/api/feignClient/operation/XpOpenCityClient.java
@@ -31,4 +31,13 @@ R<XpOpenCity> getXpOpenCity(@RequestParam("provinceCode") String provinceCode, @RequestParam("cityCode") String cityCode, @RequestParam("districtCode") String districtCode); /** * 根据id查询开通城市 * @param id * @return */ @PostMapping("/logan/inner/v1/openCity/getXpOpenCityById") R<XpOpenCity> getXpOpenCityById(@RequestParam("id") Long id); } xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/config/MiniprogramConfigurer.java
@@ -10,7 +10,7 @@ import javax.annotation.Resource; @Slf4j @Configuration //@Configuration public class MiniprogramConfigurer extends WebMvcConfigurerAdapter { @Resource xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/utils/XpPricingUtil.java
@@ -7,7 +7,9 @@ import com.xiaopeng.api.dto.WeatherDTO; import com.xiaopeng.api.dto.order.GetOrderNumDto; import com.xiaopeng.api.feignClient.map.XpMapClient; import com.xiaopeng.api.feignClient.operation.XpOpenCityClient; import com.xiaopeng.api.feignClient.order.XpOrderClient; import com.xiaopeng.api.model.operation.XpOpenCity; import com.xiaopeng.api.vo.order.XpPricingCardVo; import com.xiaopeng.common.core.domain.R; import com.xiaopeng.common.redis.service.RedisService; @@ -69,6 +71,11 @@ // @Resource XpMapClient xpMapClient; @Resource private XpOpenCityClient openCityClient; /** * 计算一口价 */ @@ -106,20 +113,25 @@ // 当前费率+(费率*上升百分比) priceRate = new BigDecimal(priceRate).multiply(divide).add(new BigDecimal(priceRate)).setScale(2, RoundingMode.HALF_UP).doubleValue(); } List<WeatherDTO.Lives> lives = xpMapClient.wether(openCityId.toString()).getData().getLives(); if(lives!=null && !lives.isEmpty()){ String w = lives.get(0).getWeather(); Set<String> weather = jsonObject.getJSONObject("weather").keySet(); for (String k : weather) { if(w.contains(k)){ double floatRate = jsonObject.getDouble(k); priceRate = new BigDecimal(priceRate).add(new BigDecimal(floatRate)).doubleValue(); break; JSONObject jsonObject1 = jsonObject.getJSONObject("weather"); if(null != jsonObject1){ XpOpenCity openCity = openCityClient.getXpOpenCityById(openCityId).getData(); WeatherDTO data = xpMapClient.wether(openCity.getCityCode()).getData(); List<WeatherDTO.Lives> lives = data.getLives(); if(lives!=null && !lives.isEmpty()){ String w = lives.get(0).getWeather(); Set<String> weather = jsonObject1.keySet(); for (String k : weather) { if(w.contains(k)){ double floatRate = jsonObject.getDouble(k); priceRate = new BigDecimal(priceRate).add(new BigDecimal(floatRate)).doubleValue(); break; } } } } // 冷却时间 Integer time = getOrderNum(jsonObject, 6); // 触发调价了 xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpMapController.java
@@ -205,21 +205,23 @@ String key; @ApiOperation(value = "获取天气信息", tags = {"内部-调价"}) @GetMapping("/logan/inner/weatherInfo") public R<WeatherDTO> weather(@RequestParam String city) throws IOException { try (CloseableHttpClient httpClient = HttpClients.createDefault()) { HttpGet httpGet = new HttpGet(String.format(WEATHER_URL, key, city)); try (CloseableHttpResponse response = httpClient.execute(httpGet)) { HttpEntity entity = response.getEntity(); if (entity != null) { String resp = EntityUtils.toString(entity, StandardCharsets.UTF_8); System.out.println(resp); return R.ok(om.readValue(resp, WeatherDTO.class)); } return R.fail("获取天气信息失败"); @PostMapping("/logan/inner/weatherInfo") public R<WeatherDTO> wether(@RequestParam("cityCode") String cityCode) { try{ CloseableHttpClient httpClient = HttpClients.createDefault(); HttpGet httpGet = new HttpGet(String.format(WEATHER_URL, key, cityCode)); CloseableHttpResponse response = httpClient.execute(httpGet); HttpEntity entity = response.getEntity(); if (entity != null) { String resp = EntityUtils.toString(entity, StandardCharsets.UTF_8); log.info("天气预报查询结果:{}", resp); return R.ok(om.readValue(resp, WeatherDTO.class)); } return R.fail("获取天气信息失败"); }catch (Exception e){ e.printStackTrace(); } return R.fail("获取天气信息失败"); } } xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/config/MiniprogramConfigurer.java
@@ -10,7 +10,7 @@ import javax.annotation.Resource; @Slf4j @Configuration //@Configuration public class MiniprogramConfigurer extends WebMvcConfigurerAdapter { @Resource xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpOpenCityController.java
@@ -153,4 +153,16 @@ XpOpenCity xpOpenCity = xpOpenCityService.getXpOpenCity(provinceCode, cityCode, districtCode); return R.ok(xpOpenCity); } /** * 根据id查询开通城市 * @param id * @return */ @PostMapping("/logan/inner/v1/openCity/getXpOpenCityById") public R<XpOpenCity> getXpOpenCityById(@RequestParam("id") Long id){ XpOpenCity xpOpenCity = xpOpenCityService.getById(id); return R.ok(xpOpenCity); } } xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpTargetedServiceController.java
@@ -116,7 +116,7 @@ /** * 批量删除 */ @GetMapping("/api/v1/whitelist/deleteByIds") @GetMapping("/api/v1/targetedService/deleteByIds") @ApiOperation(value = "定向服务-批量删除", tags = {"管理后台-定向服务批量删除"}) public R deleteByIds(String ids) { SysUser sysUser = tokenService.getLoginUser().getSysUser(); xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/task/TaskUtil.java
@@ -24,10 +24,8 @@ @Resource private XpPointService xpPointService; @Resource private IXpElectronicFenceAreaService xpElectronicFenceAreaService; @Resource private IXpElectronicFenceService xpElectronicFenceService; // 每隔1分钟执行一次 如果运营区域不处于启用状态 将关联的点位状态修改为已停用 @Scheduled(fixedRate = 60 * 1000) xp-robotaxi-push-message-boot/src/main/java/com/xiaopeng/pushMessage/webSocket/handler/WebSocketTextFrameHandler.java
@@ -155,6 +155,14 @@ log.info("收到用户 {} 的业务消息: {}", appUserId, messageObj.toJSONString()); businessMsgHandlers.get(messageObj.getString("type")).handle(appUserId, messageObj.getString("message")); //判断处理用户实时位置 if ("location".equals(messageObj.getString("type"))) { log.info("收到用户 {} 的实时位置消息: {}", appUserId, messageObj.toJSONString()); Double latitude = messageObj.getDouble("latitude"); Double longitude = messageObj.getDouble("longitude"); String timestamp = messageObj.getString("timestamp"); } // 回复消息 JSONObject response = new JSONObject();