From 7578ab49fd1a1d16ec0afcf04f2b511c739ca113 Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Thu, 26 Sep 2024 08:58:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E7=AE=97=E4=BB=B7=E6=A0=BC=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=E8=BF=98=E8=BD=A6=E6=97=B6=E5=85=88=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=98=AF=E6=89=8B=E6=9C=BA=E5=AE=9A=E4=BD=8D=EF=BC=8C?= =?UTF-8?q?=E5=86=8D=E5=88=A4=E6=96=AD=E8=BD=A6=E8=BE=86=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/app/AppVerifyController.java | 24 +++ .../ruoyi/common/utils/onenet/LocationVo.java | 21 +++ .../ruoyi/system/domain/order/RlOrder.java | 2 +- .../system/domain/order/RlOrderQuery.java | 11 ++ .../ruoyi/system/domain/rule/RlFeeRule.java | 4 - .../com/ruoyi/system/domain/vo/PriceVO.java | 21 +++ .../system/service/IRlDeviceService.java | 5 + .../ruoyi/system/service/IRlOrderService.java | 6 + .../service/impl/RlDeviceServiceImpl.java | 174 ++++++++++++++++-- .../service/impl/RlOrderServiceImpl.java | 74 +++++++- .../mapper/system/RlFeeRuleMapper.xml | 7 +- .../resources/mapper/system/RlOrderMapper.xml | 2 +- 12 files changed, 318 insertions(+), 33 deletions(-) create mode 100644 ridelease-common/src/main/java/com/ruoyi/common/utils/onenet/LocationVo.java create mode 100644 ridelease-system/src/main/java/com/ruoyi/system/domain/vo/PriceVO.java diff --git a/ridelease-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java b/ridelease-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java index 98a58cd..21da23f 100644 --- a/ridelease-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java +++ b/ridelease-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java @@ -15,6 +15,7 @@ import com.ruoyi.system.domain.deviceAccessory.RlDeviceAccessory; import com.ruoyi.system.domain.order.RlOrderQuery; import com.ruoyi.system.domain.order.RlOrderVO; import com.ruoyi.system.domain.query.AuthenticationQuery; +import com.ruoyi.system.domain.vo.PriceVO; import com.ruoyi.system.service.IRlDeviceAccessoryService; import com.ruoyi.system.service.IRlDeviceService; import com.ruoyi.system.service.IRlOrderService; @@ -293,4 +294,27 @@ public class AppVerifyController extends BaseController return error(); } + /** + * 计算价格 + */ + @GetMapping("/calculatePrice") + public AjaxResult calculatePrice(@RequestBody RlOrderQuery order) + { + logger.info("【计算价格】请求参数:order={}", JSON.toJSONString(order)); + if(order.getModelId() == null){ + return error("车型id不能为空"); + } + if(order.getRuleId() == null){ + return error("计费规则id不能为空"); + } + if(order.getAgentId() == null){ + return error("代理商id不能为空"); + } + if(order.getDeliveryMethod() == null){ + return error("配送方式不能为空"); + } + PriceVO priceVO = orderService.calculatePrice(order); + return AjaxResult.success(priceVO); + } + } diff --git a/ridelease-common/src/main/java/com/ruoyi/common/utils/onenet/LocationVo.java b/ridelease-common/src/main/java/com/ruoyi/common/utils/onenet/LocationVo.java new file mode 100644 index 0000000..91d3d40 --- /dev/null +++ b/ridelease-common/src/main/java/com/ruoyi/common/utils/onenet/LocationVo.java @@ -0,0 +1,21 @@ +package com.ruoyi.common.utils.onenet; + +import lombok.Data; + +@Data +public class LocationVo { + + private String lon;//经度 + + private String lat;//纬度 + + private Integer status;//电动车状态 0断电,1上电运行 2轮动抱死 3超出区域断电(远程下发了qlose) 解析参数 + + private Integer bat;//电池电压 "bat":571 ==> 57.1V + + private Integer csq;//信号强度 + + private Integer s;//卫星数量 + + private Integer q;//质量 +} diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/order/RlOrder.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/order/RlOrder.java index 766b2ee..1072d28 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/domain/order/RlOrder.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/order/RlOrder.java @@ -48,7 +48,7 @@ public class RlOrder extends BaseEntity private String sn; @Excel(name = "车型id") - private String modelId; + private Long modelId; /** 支付时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/order/RlOrderQuery.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/order/RlOrderQuery.java index 414d6a6..3e2bfaa 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/domain/order/RlOrderQuery.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/order/RlOrderQuery.java @@ -7,9 +7,20 @@ public class RlOrderQuery extends RlOrder{ /** 开始时间*/ private String startTime; + /** 结束时间*/ private String endTime; + /** 手机号*/ private String phone; + /** 还车经度*/ + private String lon; + + /** 还车纬度*/ + private String lat; + + /** 店铺id (还车店铺)*/ + private Long returnStoreId; + } diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/rule/RlFeeRule.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/rule/RlFeeRule.java index c41b91d..1daac36 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/domain/rule/RlFeeRule.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/rule/RlFeeRule.java @@ -22,10 +22,6 @@ public class RlFeeRule extends BaseEntity /** id */ private Long ruleId; - /** 数量 */ - @Excel(name = "数量") - private Integer num; - /** 租赁单位 */ @Excel(name = "租赁单位") private String rentalUnit; diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/vo/PriceVO.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/vo/PriceVO.java new file mode 100644 index 0000000..419d74a --- /dev/null +++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/vo/PriceVO.java @@ -0,0 +1,21 @@ +package com.ruoyi.system.domain.vo; + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class PriceVO { + + /** 总金额 */ + private BigDecimal totalFee = BigDecimal.ZERO; + + /** 押金 */ + private BigDecimal deposit = BigDecimal.ZERO; + + /** 租金 */ + private BigDecimal rent = BigDecimal.ZERO; + + /** 配送费 */ + private BigDecimal deliveryFee = BigDecimal.ZERO; +} diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/IRlDeviceService.java b/ridelease-system/src/main/java/com/ruoyi/system/service/IRlDeviceService.java index 2b2a0f8..8856546 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/service/IRlDeviceService.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/service/IRlDeviceService.java @@ -278,6 +278,11 @@ public interface IRlDeviceService extends IService * 车辆下线 */ Boolean offline(String sn,String status); + + /** + * 判断是否在店铺附近 + */ + Boolean isNearStore(RlOrderQuery orderQuery, RlDevice device); // // /** // * 根据条件模糊查询车辆信息 diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/IRlOrderService.java b/ridelease-system/src/main/java/com/ruoyi/system/service/IRlOrderService.java index 024929d..a45142c 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/service/IRlOrderService.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/service/IRlOrderService.java @@ -4,6 +4,7 @@ import com.ruoyi.common.utils.wx.vo.PrepayResponseVO; import com.ruoyi.system.domain.order.RlOrder; import com.ruoyi.system.domain.order.RlOrderQuery; import com.ruoyi.system.domain.order.RlOrderVO; +import com.ruoyi.system.domain.vo.PriceVO; import java.math.BigDecimal; import java.util.List; @@ -109,4 +110,9 @@ public interface IRlOrderService * 押金退款 */ Boolean depositRefund(String orderNo); + + /** + * 计算价格 + */ + PriceVO calculatePrice(RlOrderQuery order); } diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlDeviceServiceImpl.java b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlDeviceServiceImpl.java index 2ab5fb0..bafae33 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlDeviceServiceImpl.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlDeviceServiceImpl.java @@ -15,6 +15,7 @@ import com.ruoyi.common.utils.CommonUtil; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.http.HttpUtils; +import com.ruoyi.common.utils.map.GeoUtils; import com.ruoyi.common.utils.onenet.*; import com.ruoyi.system.domain.RlCommandLog; import com.ruoyi.system.domain.accessory.RlAccessoryVO; @@ -22,6 +23,7 @@ import com.ruoyi.system.domain.device.RlDevice; import com.ruoyi.system.domain.RlOnlineLog; import com.ruoyi.system.domain.device.RlDeviceQuery; import com.ruoyi.system.domain.device.RlDeviceVO; +import com.ruoyi.system.domain.model.RlModelVO; import com.ruoyi.system.domain.order.RlOrder; import com.ruoyi.system.domain.order.RlOrderQuery; import com.ruoyi.system.domain.order.RlOrderVO; @@ -79,6 +81,9 @@ public class RlDeviceServiceImpl extends ServiceImpl i @Autowired private RlStoreService storeService; + + @Autowired + private ISysConfigService sysConfigService; // // @Autowired // private IEtFeeRuleService etFeeRuleService; @@ -91,10 +96,10 @@ public class RlDeviceServiceImpl extends ServiceImpl i @Resource private IRlTripLogService tripLogService; -// -// @Resource -// private IEtModelService etModelService; -// + + @Resource + private IRlModelService modelService; + @Autowired private ScheduledExecutorService scheduledExecutorService; @@ -1372,6 +1377,12 @@ public class RlDeviceServiceImpl extends ServiceImpl i log.info("【还车关锁】远程关锁失败"); throw new ServiceException("远程关锁失败"); } + + /** 8.判断是否在店铺附近 先根据手机定位判断,再跟进车辆定位判断,如果两个都不在,则提示不在附近*/ + boolean nearStore = isNearStore(orderQuery, device); + if(!nearStore){ + throw new ServiceException("不在附近"); + } }else{ ResponseVo responseVo = sendCommandWithResp(device.getMac(), token, IotConstants.COMMAND_CLOSE + IotConstants.COMMAND_FREQUENCY_3600, "辅助还车关锁",orderNo); if(responseVo.getCode()!=0){ @@ -1394,6 +1405,9 @@ public class RlDeviceServiceImpl extends ServiceImpl i } BigDecimal overdueFee= BigDecimal.ZERO; /** 6.计算逾期费用 */ + if(ObjectUtil.isNull(order.getExpiryTime())){ + throw new ServiceException("订单没有到期时间"); + } if (order.getExpiryTime().before(DateUtils.getNowDate())) { overdueFee = computeOverdueFee(order, updateOrder); } @@ -1402,20 +1416,6 @@ public class RlDeviceServiceImpl extends ServiceImpl i if(i==0){ throw new ServiceException("更新订单状态失败"); } - BigDecimal remainingDeposit = order.getDeposit(); - /** 7.退押金 */ - if (order.getDeposit().compareTo(BigDecimal.ZERO) > 0) { - // 如果 overdueFee 为 0,直接跳过退押金 - if (overdueFee.compareTo(BigDecimal.ZERO) > 0) { - // 获取剩余押金 - remainingDeposit = remainingDeposit.subtract(overdueFee); - - // 判断剩余押金是否为负数,如果为负数,则剩余押金为 0 - if (remainingDeposit.compareTo(BigDecimal.ZERO) < 0) { - remainingDeposit = BigDecimal.ZERO; - } - } - } log.info("还车成功"); return Boolean.TRUE; }else{ @@ -1423,6 +1423,144 @@ public class RlDeviceServiceImpl extends ServiceImpl i } } + /** + * 判断是否在店铺附近 + */ + @Override + public Boolean isNearStore(RlOrderQuery orderQuery, RlDevice device) { + if (device.getStoreId() != null) { + StoreVo store = storeService.selectSmStoreById(orderQuery.getReturnStoreId()); + if (store != null) { + BigDecimal lng = store.getLng(); + BigDecimal lat = store.getLat(); + String lon2 = orderQuery.getLon(); // 手机位置 + String lat2 = orderQuery.getLat(); + // 获取可还车的最大距离 + double storeDistance = Double.parseDouble(sysConfigService.selectConfigByKey("store.distance")); + + // 计算手机与店铺的距离 + double distance = GeoUtils.calculateDistance(lat.doubleValue(), lng.doubleValue(), Double.valueOf(lat2), Double.valueOf(lon2)); + log.info("【还车】手机与店铺距离: {} 米", distance); + + if (distance <= storeDistance) { + return true; + } + // 获取车辆的最新定位 + double[] latestLocation = getLatestLocation(device.getMac()); + if (ObjectUtil.isNotNull(latestLocation)) { + double longitude1 = latestLocation[1]; + double latitude1 = latestLocation[0]; + + log.info("【还车时根据车辆定位判断是否在停车区】,车辆经度: {},纬度: {}", longitude1, latitude1); + + // 计算车辆与店铺的距离 + double distanceToStore = GeoUtils.calculateDistance(lat.doubleValue(), lng.doubleValue(), latitude1, longitude1); + log.info("【还车】车辆与店铺距离: {} 米", distanceToStore); + + return distanceToStore <= storeDistance; + } + } + } + return false; + } + + + @SneakyThrows + private double[] getLatestLocation(String mac) { + RlDevice device = deviceMapper.selectDeviceByMac(mac); + String token = Token.getToken(); + DataPointRes datapoints = historyDatapoints(mac, token); + if(datapoints.getCode() == 0){ + Data data = datapoints.getData(); + List datastreams = data.getDevices(); + for (Datastream datastream: datastreams) { + List datapointList = datastream.getDatastreams(); + if(ObjectUtil.isNotNull(datapointList)){ + for (Datapoint datapoint:datapointList) { + if(datapoint.getId().equals(IotConstants.ONENET_LOCATION)){ + String string = JSON.toJSONString(datapoint.getValue()); + String at = datapoint.getAt(); + if(StrUtil.isNotBlank(string)){ + LocationVo locationVo = JSONObject.parseObject(string, LocationVo.class); + log.info("【手动更新】: locationVo---【{}】" , JSON.toJSONString(locationVo)); + double[] doubles = CommonUtil.coordinateConvert(locationVo.getLon(), locationVo.getLat()); + BigDecimal lat = new BigDecimal(doubles[0]).setScale(8, RoundingMode.HALF_UP); + BigDecimal lon = new BigDecimal(doubles[1]).setScale(8, RoundingMode.HALF_UP); + log.info("转换后的GCJ02经纬度:" + lon + "---" + lat); + if(BigDecimal.ZERO.compareTo(lon) != 0 && BigDecimal.ZERO.compareTo(lat) != 0){ + /** 计算电量和里程后更新设备*/ + int i = updateDevice(at,locationVo, device, lon, lat); + return doubles; + }else{ + noLocationUpdateDevice(at,locationVo,device); + } + } + } + } + } + } + } + return null; + } + + /** 计算电量和里程后更新设备*/ + public int updateDevice(String at,LocationVo locationVo, RlDevice device, BigDecimal lon, BigDecimal lat) { + device.setLatitude(lat.toString()); + device.setLongitude(lon.toString()); + Integer bat = locationVo.getBat(); + BigDecimal divide = new BigDecimal(bat).divide(new BigDecimal(10)); + log.info("保存电压:" + divide); + device.setVoltage(divide.toString());//电压 + // 根据电压计算续航里程 + RlModelVO model = modelService.selectEModelByModelId(device.getModelId()); + if(ObjectUtil.isNotNull(model)){ + Integer remainingMileage = 0; + if(StrUtil.isNotBlank(device.getVoltage())){ + remainingMileage = CommonUtil.getRemainingMileage(device.getVoltage(), model.getFullVoltage(), model.getLowVoltage(), model.getFullEndurance()); + } + Integer electricQuantity = CommonUtil.getElectricQuantity(device.getVoltage(), model.getFullVoltage(), model.getLowVoltage());//电量百分百 +// device.setRemainingMileage(remainingMileage); + device.setRemainingPower(electricQuantity.toString()); + } + device.setLastTime(DateUtils.parseDate(at)); + device.setLastLocationTime(DateUtils.parseDate(at)); + device.setGps("1"); + // 信号强度 + device.setSignalStrength(locationVo.getCsq()); + device.setSatellites(locationVo.getS()); + device.setQuality(locationVo.getQ()); + int i = updateLocation(device); + return i; + } + + /** 无定位更新设备 */ + private void noLocationUpdateDevice(String at,LocationVo locationVo, RlDevice device) { + Integer bat = locationVo.getBat(); + BigDecimal divide = new BigDecimal(bat).divide(new BigDecimal(10)); + log.info("保存电压:" + divide); + device.setVoltage(divide.toString());//电压 + RlModelVO model = modelService.selectEModelByModelId(device.getModelId()); + // 根据电压计算续航里程 + if(ObjectUtil.isNotNull(model)){ + Integer remainingMileage = 0; + if(StrUtil.isNotBlank(device.getVoltage())){ + remainingMileage = CommonUtil.getRemainingMileage(device.getVoltage(), model.getFullVoltage(), model.getLowVoltage(), model.getFullEndurance()); + } + Integer electricQuantity = CommonUtil.getElectricQuantity(device.getVoltage(), model.getFullVoltage(), model.getLowVoltage());//电量百分百 +// device.setRemainingMileage(remainingMileage); + device.setRemainingPower(electricQuantity.toString()); + } + device.setLastTime(DateUtils.parseDate(at)); + device.setGps("0"); + device.setSignalStrength(locationVo.getCsq()); + device.setSatellites(0); + device.setQuality(locationVo.getQ()); + int i = updateLocation(device); + if(i>0){ + log.info("未获取到定位===============保存电压等数值成功===========>" + device.getSn()); + } + } + /** 计算逾期费用 */ private BigDecimal computeOverdueFee(RlOrderVO order, RlOrder updateOrder) { String outUnit = order.getOutUnit(); diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlOrderServiceImpl.java b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlOrderServiceImpl.java index d6d85bb..34ca49c 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlOrderServiceImpl.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlOrderServiceImpl.java @@ -10,11 +10,14 @@ import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.common.utils.wx.vo.PrepayResponseVO; import com.ruoyi.system.domain.accessory.RlAccessoryVO; +import com.ruoyi.system.domain.agent.RlAgent; import com.ruoyi.system.domain.device.RlDevice; +import com.ruoyi.system.domain.model.RlModelVO; import com.ruoyi.system.domain.order.RlOrder; import com.ruoyi.system.domain.order.RlOrderQuery; import com.ruoyi.system.domain.order.RlOrderVO; import com.ruoyi.system.domain.rule.RlFeeRule; +import com.ruoyi.system.domain.vo.PriceVO; import com.ruoyi.system.mapper.RlOrderMapper; import com.ruoyi.system.service.*; import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse; @@ -54,6 +57,12 @@ public class RlOrderServiceImpl implements IRlOrderService @Autowired private IRlDeviceService deviceService; + @Resource + private IRlAgentService agentService; + + @Autowired + private IRlModelService modelService; + /** * 查询订单 * @@ -208,7 +217,7 @@ public class RlOrderServiceImpl implements IRlOrderService } private void setFeeRule(RlOrderQuery order, RlFeeRule feeRule) { - order.setNum(feeRule.getNum()); + order.setNum(order.getNum()); order.setPrice(feeRule.getPrice()); order.setExplain(feeRule.getExplain()); order.setInstructions(feeRule.getInstructions()); @@ -223,7 +232,7 @@ public class RlOrderServiceImpl implements IRlOrderService }else{ startTime = order.getExpiryTime(); } - Date expiryTime = DateUtils.getTimeAfterXUnit(startTime, feeRule.getNum(), feeRule.getRentalUnit()); + Date expiryTime = DateUtils.getTimeAfterXUnit(startTime, order.getNum(), feeRule.getRentalUnit()); order.setExpiryTime(expiryTime); } @@ -254,6 +263,9 @@ public class RlOrderServiceImpl implements IRlOrderService */ @Override public PrepayResponseVO relet(String orderNo, Long ruleId) { + if(StrUtil.isBlank(orderNo)){ + throw new RuntimeException("订单号不能为空"); + } RlOrderVO order = orderMapper.selectRlOrderByOrderNo(orderNo); RlOrderQuery orderQuery = new RlOrderQuery(); BeanUtils.copyBeanProp(orderQuery,order); @@ -320,7 +332,8 @@ public class RlOrderServiceImpl implements IRlOrderService RlOrderVO order = orderMapper.selectRlOrderByOrderNo(orderNo); BigDecimal deposit = order.getDeposit(); BigDecimal overdueFee = order.getOverdueFee(); - BigDecimal remainingDeposit = deposit.subtract(overdueFee); + BigDecimal deductionAmount = order.getDeductionAmount(); + BigDecimal remainingDeposit = deposit.subtract(overdueFee).subtract(deductionAmount); if(remainingDeposit.compareTo(BigDecimal.ZERO) <= 0){ return true; } @@ -335,5 +348,60 @@ public class RlOrderServiceImpl implements IRlOrderService return null; } + /** + * 计算价格 + */ + @Override + public PriceVO calculatePrice(RlOrderQuery order) { + PriceVO priceVO = new PriceVO(); + BigDecimal totalFee = BigDecimal.ZERO; + // 押金 + deposit(order.getModelId(), priceVO, totalFee); + // 租金 + rentFee(order, priceVO, totalFee); + // 配送费 + deliveryFee(order.getAgentId(), priceVO, totalFee); + priceVO.setTotalFee(totalFee); + return priceVO; + } + + private void deposit(Long modelId, PriceVO priceVO, BigDecimal totalFee) { + RlModelVO rlModelVO = modelService.selectEModelByModelId(modelId); + if(rlModelVO == null){ + throw new ServiceException("车型不存在"); + } + BigDecimal deposit = rlModelVO.getDeposit(); + if(rlModelVO == null){ + throw new ServiceException("车型不存在"); + } + priceVO.setDeposit(deposit); + totalFee.add(deposit); + } + + private void deliveryFee(Long agentId, PriceVO priceVO, BigDecimal totalFee) { + RlAgent agent = agentService.selectRlAgentByAgentId(agentId); + if(agent == null){ + throw new ServiceException("代理商不存在"); + } + if(!agent.getIsFreeCar()){ + BigDecimal deliveryFee = agent.getDeliveryFee(); + totalFee.add(deliveryFee); + priceVO.setDeliveryFee(deliveryFee); + } + } + + private void rentFee(RlOrderQuery order, PriceVO priceVO, BigDecimal totalFee) { + RlFeeRule feeRule = feeRuleService.selectRlFeeRuleByRuleId(order.getRuleId()); + if(feeRule == null){ + throw new ServiceException("租赁规则不存在"); + } + Integer num = order.getNum(); + if(num != null){ + BigDecimal rent = feeRule.getPrice().multiply(new BigDecimal(num)); + priceVO.setRent(rent); + totalFee.add(rent); + } + } + } diff --git a/ridelease-system/src/main/resources/mapper/system/RlFeeRuleMapper.xml b/ridelease-system/src/main/resources/mapper/system/RlFeeRuleMapper.xml index 70f7fef..868bd32 100644 --- a/ridelease-system/src/main/resources/mapper/system/RlFeeRuleMapper.xml +++ b/ridelease-system/src/main/resources/mapper/system/RlFeeRuleMapper.xml @@ -6,7 +6,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - @@ -18,13 +17,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select rule_id, num, rental_unit, price, `explain`, instructions, out_unit, out_price, is_deleted, model_id from rl_fee_rule + select rule_id, rental_unit, price, `explain`, instructions, out_unit, out_price, is_deleted, model_id from rl_fee_rule