车费按服务时间计算
This commit is contained in:
parent
46d6bb23f1
commit
c8086c3498
|
@ -788,7 +788,9 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
return Result.error("预约时间正忙,请更换其他时间!");
|
||||
}
|
||||
|
||||
TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude());
|
||||
//计算车费
|
||||
TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude(),orders.getServeTime());
|
||||
// TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude());
|
||||
if (travelPriceVo == null) {
|
||||
return Result.error("暂不支持当前地址,请更换其他地址!");
|
||||
}
|
||||
|
@ -1013,8 +1015,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
if(map.get("code").toString().equals("1")){
|
||||
return Result.error("预约时间正忙,请更换其他时间!");
|
||||
}
|
||||
|
||||
TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude());
|
||||
TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude(),orders.getServeTime());
|
||||
// TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude());
|
||||
if (travelPriceVo == null) {
|
||||
return Result.error("暂不支持当前地址,请更换其他地址!");
|
||||
}
|
||||
|
@ -1242,7 +1244,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
return Result.error("预约时间正忙,请更换其他时间!");
|
||||
}
|
||||
|
||||
TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude());
|
||||
TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude(),orders.getServeTime());
|
||||
// TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude());
|
||||
if (travelPriceVo == null) {
|
||||
return Result.error("暂不支持当前地址,请更换其他地址!");
|
||||
}
|
||||
|
@ -1587,8 +1590,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
if(map.get("code").toString().equals("1")){
|
||||
return Result.error("预约时间正忙,请更换其他时间!");
|
||||
}
|
||||
|
||||
TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude());
|
||||
TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude(),orders.getServeTime());
|
||||
// TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude());
|
||||
if (travelPriceVo == null) {
|
||||
return Result.error("暂不支持当前地址,请更换其他地址!");
|
||||
}
|
||||
|
@ -1818,8 +1821,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
if(map.get("code").toString().equals("1")){
|
||||
return Result.error("预约时间正忙,请更换其他时间!");
|
||||
}
|
||||
|
||||
TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude());
|
||||
TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude(),orders.getServeTime());
|
||||
// TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude());
|
||||
if (travelPriceVo == null) {
|
||||
return Result.error("暂不支持当前地址,请更换其他地址!");
|
||||
}
|
||||
|
@ -2021,7 +2024,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
//项目差价
|
||||
BigDecimal xmchajia = orders.getMassageMoney().subtract(oldOrders.getMassageMoney());
|
||||
|
||||
TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude());
|
||||
TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude(),orders.getServeTime());
|
||||
// TravelPriceVo travelPriceVo = travelConfService.calcTravelPrice(orders.getArtificerId(), orders.getLongitude(), orders.getLatitude());
|
||||
if (travelPriceVo == null) {
|
||||
return Result.error("暂不支持当前地址,请更换其他地址!");
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.travelconf.entity.TravelConf;
|
||||
import com.sqx.modules.travelconf.service.TravelConfService;
|
||||
|
@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author bai
|
||||
|
@ -90,7 +92,7 @@ public class TravelConfController {
|
|||
@GetMapping(value = "/getTaxiMoney")
|
||||
@ApiOperation("测试获取价格")
|
||||
public Result getTaxiMoney(Long artificerId, String toLongitude, String toLatitude){
|
||||
TravelPriceVo travelPriceVo = service.calcTravelPrice(artificerId, toLongitude, toLatitude);
|
||||
TravelPriceVo travelPriceVo = service.calcTravelPrice(artificerId, toLongitude, toLatitude, DateUtils.format(new Date()));
|
||||
return Result.success().put("data", travelPriceVo);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.sqx.modules.travelconf.controller.app;
|
||||
|
||||
import com.sqx.common.exception.SqxException;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.Result2;
|
||||
import com.sqx.modules.travelconf.service.TravelConfService;
|
||||
import com.sqx.modules.travelconf.vo.TravelPriceVo;
|
||||
|
@ -13,6 +14,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author bai
|
||||
* @date 2024/06/08
|
||||
|
@ -33,7 +36,7 @@ public class AppTravelConfController {
|
|||
@ApiParam(value = "纬度 示例:43.887282", required = true, example = "43.887282") String toLatitude){
|
||||
Result2<TravelPriceVo> res = new Result2<>();
|
||||
try {
|
||||
res.setData(service.calcTravelPrice(artificerId, toLongitude, toLatitude));
|
||||
res.setData(service.calcTravelPrice(artificerId, toLongitude, toLatitude, DateUtils.format(new Date())));
|
||||
}catch (SqxException e) {
|
||||
//业务错误
|
||||
log.error(e.getMsg(),e);
|
||||
|
|
|
@ -35,7 +35,8 @@ public interface TravelConfService extends IService<TravelConf> {
|
|||
* @param toLatitude
|
||||
* @return
|
||||
*/
|
||||
TravelPriceVo calcTravelPrice(Long artificerId, String toLongitude, String toLatitude);
|
||||
TravelPriceVo calcTravelPrice(Long artificerId, String toLongitude, String toLatitude, String serveTime);
|
||||
// TravelPriceVo calcTravelPrice(Long artificerId, String toLongitude, String toLatitude);
|
||||
|
||||
/**
|
||||
* 最终获取出行价格
|
||||
|
@ -47,5 +48,5 @@ public interface TravelConfService extends IService<TravelConf> {
|
|||
* @param toLatitude
|
||||
* @return
|
||||
*/
|
||||
TravelPriceVo calcTravelPrice(Integer _travelType, BigDecimal freeKilometers, String longitude, String latitude, String toLongitude, String toLatitude);
|
||||
TravelPriceVo calcTravelPrice(Integer _travelType, BigDecimal freeKilometers, String longitude, String latitude, String toLongitude, String toLatitude, String serveTime);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.exception.SqxException;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.map.CommonMapUtils;
|
||||
import com.sqx.modules.artificer.entity.Artificer;
|
||||
import com.sqx.modules.artificer.service.ArtificerService;
|
||||
|
@ -202,7 +203,7 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
}
|
||||
|
||||
@Override
|
||||
public TravelPriceVo calcTravelPrice(Long artificerId, String toLongitude, String toLatitude) {
|
||||
public TravelPriceVo calcTravelPrice(Long artificerId, String toLongitude, String toLatitude, String serveTime) {
|
||||
Artificer artificerInfo = artificerService.getById(artificerId);
|
||||
|
||||
Integer cxfs = artificerInfo.getTripWay();//1公交 2免费 3出租
|
||||
|
@ -218,15 +219,17 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
BigDecimal freeKilometers = new BigDecimal(mfgls);//
|
||||
String longitude = artificerInfo.getLongitude();
|
||||
String latitude = artificerInfo.getLatitude();
|
||||
return calcTravelPrice(travelType, freeKilometers, longitude, latitude, toLongitude, toLatitude);
|
||||
return calcTravelPrice(travelType, freeKilometers, longitude, latitude, toLongitude, toLatitude,serveTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TravelPriceVo calcTravelPrice(Integer _travelType, BigDecimal freeKilometers, String longitude, String latitude, String toLongitude, String toLatitude){
|
||||
public TravelPriceVo calcTravelPrice(Integer _travelType, BigDecimal freeKilometers, String longitude, String latitude, String toLongitude, String toLatitude, String serveTime){
|
||||
TravelPriceVo vo = new TravelPriceVo();
|
||||
vo.setFreeKilometers(NumberUtil.decimalFormat("0.00",freeKilometers));
|
||||
|
||||
Date now = DateTime.now();
|
||||
// Date now = DateTime.now();
|
||||
DateUtils.stringToDate(serveTime,"yyyy-MM-dd HH:mm");
|
||||
Date now = DateUtils.stringToDate(serveTime,"yyyy-MM-dd HH:mm");;
|
||||
//按条件取配置,
|
||||
TravelConf conf = getConfByAccordingCondition(_travelType, now);
|
||||
vo.setConf(conf);
|
||||
|
|
Loading…
Reference in New Issue