diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java index d2aa580..87115c3 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java @@ -252,7 +252,13 @@ public class AppController extends BaseController @GetMapping("/fee/list") public AjaxResult feeList(EtFeeRule etFeeRule) { - List list = etFeeRuleService.selectEtFeeRuleListByAreaId(etFeeRule.getAreaId()); + List list = null; + Long modelId = etFeeRule.getModelId(); + if(modelId != null){ + list = etFeeRuleService.selectRuleInfoListByModelId(etFeeRule.getModelId()); + }else{ + list = etFeeRuleService.selectEtFeeRuleListByAreaId(etFeeRule.getAreaId()); + } return success(list); } diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java index 0b2942b..980e10a 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java @@ -1450,4 +1450,32 @@ public class AppVerifyController extends BaseController } return toAjax(1); } + + /** + * 根据用户获取最后一个订单所属的运营区客服电话 latestServicePhone + * 1. 查询用户 + * 2. 最后一个订单 + * 3. 查询订单所属运营区 + * 4. 查询运营区客服电话 + */ + @Log(title = "", businessType = BusinessType.ZEROORDER) + @GetMapping("/latestServicePhone") + public AjaxResult latestServicePhone(Long userId) + { + logger.info("根据用户获取最后一个订单所属的运营区客服电话:【userId="+userId+"】"); + if (ObjectUtil.isNull(userId)){ + throw new ServiceException("未传userId"); + } + EtOrder etOrder =new EtOrder(); + etOrder.setUserId(userId); + EtOrder etOrder1 = etOrderService.latestOrder2(etOrder); + if(ObjectUtil.isNotNull(etOrder1)){ + EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(etOrder1.getAreaId()); + if(ObjectUtil.isNull(area)){ + return error("未查询到运营区域信息"); + } + return success(area); + } + return error(); + } } diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java index b3bc295..45c3203 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java @@ -258,6 +258,11 @@ public interface EtOrderMapper */ EtOrder selectLatestOrder(EtOrder etOrder); + /** + * 最近一笔订单(包含押金订单) + */ + EtOrder selectLatestOrder2(EtOrder etOrder); + /** * 最近一笔订单 */ diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/IEtOrderService.java b/electripper-system/src/main/java/com/ruoyi/system/service/IEtOrderService.java index cf58abc..18713c4 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/IEtOrderService.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/IEtOrderService.java @@ -159,6 +159,11 @@ public interface IEtOrderService */ EtOrder latestOrder(EtOrder etOrder); + /** + * 最近一笔订单(包含押金订单) + */ + EtOrder latestOrder2(EtOrder etOrder); + /** * 订单退款 */ diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java index c2a2740..eae58b8 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java @@ -731,10 +731,28 @@ public class AsDeviceServiceImpl extends ServiceImpl i asDevice.setRemainingPower(electricQuantity.toString()); } } + // 根据sn获取redis中的最新定位 + getLatestLocation(asDevice); } return asDevices; } + private void getLatestLocation(AsDevice asDevice) { + String msg = redisCache.getCacheObject(CacheConstants.CACHE_DEVICE_KEY + asDevice.getSn()); + if(StrUtil.isNotBlank(msg)){ + log.info("【根据sn号查询车辆实时信息】-========redis缓存中的数据:" + msg); + LogEntry logEntry = JSONObject.parseObject(msg, LogEntry.class); + log.info("【根据sn号查询车辆实时信息】============logEntry转换后的对象: logEntry---【{}】" , JSON.toJSONString(logEntry)); + LogEntry.LocationValue value = logEntry.getValue(); + // 坐标转换 WGS84 转 GCJ02 + double[] doubles = CommonUtil.coordinateConvert(value.getLon(),value.getLat()); + BigDecimal lon = new BigDecimal(doubles[1]).setScale(8, RoundingMode.HALF_UP); + BigDecimal lat = new BigDecimal(doubles[0]).setScale(8, RoundingMode.HALF_UP); + asDevice.setLongitude(lon.toString()); + asDevice.setLatitude(lat.toString()); + } + } + /** * 查询车辆数量 */ diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java index ea6d507..b991725 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java @@ -1716,6 +1716,15 @@ public class EtOrderServiceImpl implements IEtOrderService return order; } + /** + * 最近一笔订单 + */ + @Override + public EtOrder latestOrder2(EtOrder etOrder) { + EtOrder order = etOrderMapper.selectLatestOrder2(etOrder); + return order; + } + /** * 退款 */ diff --git a/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml b/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml index c0cc2c2..1a4bfab 100644 --- a/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml @@ -324,7 +324,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" o.return_type, o.pay_channel, AsText(o.trip_route) trip_route, - o.trip_route_str from et_order o + o.trip_route_str, + o.rental_unit, + o.riding_rule, + o.riding_rule_json, + o.charging_cycle, + o.charging_cycle_value, + o.capped_amount, + o.handling_charge, + o.platform_service_fee, + o.operator_dividend + from et_order o LEFT JOIN et_user u ON u.user_id = o.user_id LEFT JOIN et_operating_area oa ON o.area_id = oa.area_id where order_id = #{orderId} @@ -724,6 +734,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LIMIT 1 + +