出行配置
This commit is contained in:
parent
5af88a3884
commit
eb4d016f0d
|
@ -334,7 +334,6 @@ public class ArtificerController {
|
|||
}
|
||||
|
||||
// @Scheduled(cron = "0 */1 * * * ?")
|
||||
@Scheduled(cron = "0 2/5 * * * ?")
|
||||
public void endOrders(){
|
||||
ordersService.endOrders();
|
||||
}
|
||||
|
|
|
@ -1011,6 +1011,11 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
orders.setIsSupplement(1);
|
||||
orders.setOldMassageMoney(oldOrders.getMassageMoney());
|
||||
orders.setOldOrdersId(oldOrders.getOrdersId());
|
||||
orders.setTechnicianType(artificer.getTechnicianType());
|
||||
orders.setVipRate(oldOrders.getVipRate());
|
||||
orders.setMassagePrice(oldOrders.getMassagePrice());
|
||||
orders.setMassageNum(oldOrders.getMassageNum());
|
||||
orders.setOrdersNo(getGeneralOrder());
|
||||
baseMapper.insert(orders);
|
||||
|
||||
ordersMassageService.removeByOrdersId(orders.getOrdersId());
|
||||
|
@ -2602,7 +2607,9 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
Orders ordersOld = new Orders();
|
||||
ordersOld.setOrdersId(orders.getOldOrdersId());
|
||||
if(orders.getIsSupplement() != null){
|
||||
if(orders.getIsSupplement() == 2){
|
||||
if(orders.getIsSupplement() == 1){
|
||||
orders.setStatus(10);
|
||||
}else if(orders.getIsSupplement() == 2){
|
||||
orders.setStatus(6);
|
||||
}else if(orders.getIsSupplement() == 3){
|
||||
orders.setStatus(2);
|
||||
|
@ -3928,7 +3935,9 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
// }
|
||||
|
||||
if(orders.getIsSupplement() != null){
|
||||
if(orders.getIsSupplement() == 2){
|
||||
if(orders.getIsSupplement() == 1){
|
||||
orders.setStatus(10);
|
||||
}else if(orders.getIsSupplement() == 2){
|
||||
orders.setStatus(6);
|
||||
}else if(orders.getIsSupplement() == 3){
|
||||
orders.setStatus(2);
|
||||
|
@ -5526,6 +5535,24 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
couponUserService.updateById(couponUser);
|
||||
}
|
||||
}
|
||||
if(orders.getOldOrdersId()!=null && orders.getOldOrdersId() !=0){
|
||||
Orders ordersOld = new Orders();
|
||||
ordersOld.setOrdersId(orders.getOldOrdersId());
|
||||
if(orders.getIsSupplement() != null){
|
||||
if(orders.getIsSupplement() == 1){
|
||||
ordersOld.setStatus(10);
|
||||
}else if(orders.getIsSupplement() == 2){
|
||||
ordersOld.setStatus(6);
|
||||
}else if(orders.getIsSupplement() == 3){
|
||||
ordersOld.setStatus(2);
|
||||
}else{
|
||||
ordersOld.setStatus(9);//用户已支付技师待接单
|
||||
}
|
||||
}else{
|
||||
ordersOld.setStatus(9);//用户已支付技师待接单
|
||||
}
|
||||
baseMapper.updateById(ordersOld);//原单暂变成挂单状态
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,9 @@ public enum CommonEnum {
|
|||
/**夜间时段从n开始~n结束(留空自动计算)*/
|
||||
V3_TRAVEL_CONF_NIGHT(446, "v3_travel_conf", "夜间时段从n开始~n结束(留空自动计算)", ","),
|
||||
|
||||
V3_TRAVEL_CONF_IS_FIXED(447, "v3_travel_conf", "出行配置使用动态价格", "true");
|
||||
V3_TRAVEL_CONF_IS_PRICING(447, "v3_travel_conf", "出行配置使用动态价格", "true"),
|
||||
|
||||
V3_TRAVEL_CONF_IS_FIXED(450, "v3_travel_conf", "出行配置固定价格是否往返", "false");
|
||||
|
||||
private final Integer key;
|
||||
|
||||
|
@ -130,6 +132,7 @@ public enum CommonEnum {
|
|||
V3_TRAVEL_CONF_WINTER_TIME.getKey(),
|
||||
V3_TRAVEL_CONF_DAY.getKey(),
|
||||
V3_TRAVEL_CONF_NIGHT.getKey(),
|
||||
V3_TRAVEL_CONF_IS_PRICING.getKey(),
|
||||
V3_TRAVEL_CONF_IS_FIXED.getKey()
|
||||
});
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.travelconf.entity.TravelConf;
|
||||
import com.sqx.modules.travelconf.service.TravelConfService;
|
||||
import com.sqx.modules.travelconf.vo.TravelPriceVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -86,4 +87,11 @@ public class TravelConfController {
|
|||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getTaxiMoney")
|
||||
@ApiOperation("测试获取价格")
|
||||
public Result getTaxiMoney(Long artificerId, String toLongitude, String toLatitude){
|
||||
TravelPriceVo travelPriceVo = service.calcTravelPrice(artificerId, toLongitude, toLatitude);
|
||||
return Result.success().put("data", travelPriceVo);
|
||||
}
|
||||
|
||||
}
|
|
@ -26,7 +26,7 @@ public interface TravelConfService extends IService<TravelConf> {
|
|||
* @param timeIntervalType 时段(1:白天,2:夜间)
|
||||
* @return 配置对象
|
||||
*/
|
||||
TravelConf getConfByAccordingCondition(Integer pricingType, Integer travelType, Integer seasonsType, Integer timeIntervalType);
|
||||
TravelConf getConfByAccordingCondition(Integer pricingType, Integer travelType, Integer seasonsType, Integer timeIntervalType, Integer fixedType);
|
||||
|
||||
/**
|
||||
* 按ID获取出行价格
|
||||
|
|
|
@ -45,6 +45,8 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
|
||||
//价格类型
|
||||
Integer pricingType;
|
||||
//往返类型
|
||||
Integer fixedType;
|
||||
//时令
|
||||
Integer seasonsType;
|
||||
//时段
|
||||
|
@ -54,7 +56,7 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
Map<Integer,CommonInfo> commonInfoMap = commonInfoService.getMapByCondition(CommonEnum.GroupConditionEnum.V3_TRAVEL_CONF.getValue());
|
||||
|
||||
//价格类型
|
||||
CommonInfo pricingTypeConfig = commonInfoMap.get(CommonEnum.V3_TRAVEL_CONF_IS_FIXED.getKey());
|
||||
CommonInfo pricingTypeConfig = commonInfoMap.get(CommonEnum.V3_TRAVEL_CONF_IS_PRICING.getKey());
|
||||
|
||||
if(pricingTypeConfig == null) {
|
||||
//throw new SqxException("无法找到出行配置,请联系管理员!");
|
||||
|
@ -65,6 +67,16 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
pricingType = TravelEnum.PricingType.FIXED.getValue();
|
||||
}
|
||||
|
||||
//往返类型
|
||||
CommonInfo fixedTypeConfig = commonInfoMap.get(CommonEnum.V3_TRAVEL_CONF_IS_FIXED.getKey());
|
||||
if(pricingTypeConfig == null) {
|
||||
fixedType = TravelEnum.FixedType.ONE_WAY.getValue();
|
||||
}else if(CommonConfigUtil.getBooleanValue(fixedTypeConfig.getValue())){
|
||||
fixedType = TravelEnum.FixedType.RETURN.getValue();
|
||||
}else{
|
||||
fixedType = TravelEnum.FixedType.ONE_WAY.getValue();
|
||||
}
|
||||
|
||||
//夏令时段
|
||||
CommonInfo daylightSavingTime = commonInfoMap.get(CommonEnum.V3_TRAVEL_CONF_DAYLIGHT_SAVING_TIME.getKey());
|
||||
//冬令时段
|
||||
|
@ -119,8 +131,6 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
} else {
|
||||
throw new SqxException("无法找到行配置,请联系管理员!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(nightValues.length == 0){
|
||||
|
@ -138,7 +148,7 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
//前台无法创建 23:00:00-12:00:00的数据,直接甩出错误或者忽略
|
||||
throw new SqxException("请清空夜间时间配置,请联系管理员!");
|
||||
}
|
||||
return getConfByAccordingCondition(pricingType, travelType, seasonsType, timeIntervalType);
|
||||
return getConfByAccordingCondition(pricingType, travelType, seasonsType, timeIntervalType, fixedType);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -165,16 +175,21 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
}
|
||||
|
||||
@Override
|
||||
public TravelConf getConfByAccordingCondition(Integer pricingType, Integer travelType, Integer seasonsType, Integer timeIntervalType) {
|
||||
public TravelConf getConfByAccordingCondition(Integer pricingType, Integer travelType, Integer seasonsType, Integer timeIntervalType, Integer fixedType) {
|
||||
if(TravelEnum.PricingType.FIXED.getValue().equals(pricingType)){
|
||||
seasonsType = null;
|
||||
timeIntervalType = null;
|
||||
}
|
||||
if(TravelEnum.PricingType.TRENDS.getValue().equals(pricingType)){
|
||||
fixedType = null;
|
||||
}
|
||||
QueryWrapper<TravelConf> qw = new QueryWrapper<>();
|
||||
//价格类型
|
||||
qw.lambda().eq(pricingType != null, TravelConf::getPricingType, pricingType);
|
||||
//出行方式
|
||||
qw.lambda().eq(travelType != null, TravelConf::getTravelType, travelType);
|
||||
//往返类型
|
||||
qw.lambda().eq(fixedType != null, TravelConf::getFixedType, fixedType);
|
||||
//时令
|
||||
qw.lambda().eq(seasonsType != null, TravelConf::getSeasonsType, seasonsType);
|
||||
//时段
|
||||
|
@ -242,11 +257,12 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
|
||||
if(TravelEnum.PricingType.FIXED.getValue().equals(pricingType)) {
|
||||
//固定的
|
||||
BigDecimal fixedPrice = conf.getFixedPrice();//单程
|
||||
if(TravelEnum.FixedType.RETURN.getValue().equals(fixedType)) {
|
||||
//往返
|
||||
fixedPrice = NumberUtil.mul(fixedPrice, 2);
|
||||
}
|
||||
BigDecimal fixedPrice = conf.getFixedPrice();
|
||||
// BigDecimal fixedPrice = conf.getFixedPrice();//单程
|
||||
// if(TravelEnum.FixedType.RETURN.getValue().equals(fixedType)) {
|
||||
// //往返
|
||||
// fixedPrice = NumberUtil.mul(fixedPrice, 2);
|
||||
// }
|
||||
//最终价格
|
||||
vo.setTravelPrice(NumberUtil.decimalFormat("0.00", fixedPrice));
|
||||
}else if(TravelEnum.PricingType.TRENDS.getValue().equals(pricingType)){
|
||||
|
@ -257,16 +273,16 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
nightTravelExpenses = conf.getNightTravelExpenses();
|
||||
}
|
||||
|
||||
//免费公里数
|
||||
//freeKilometers
|
||||
//起步公里数
|
||||
BigDecimal startKilometers = conf.getFreeKilometers();
|
||||
//起步价
|
||||
BigDecimal startingPrice = conf.getStartingPrice();
|
||||
//每公里价格
|
||||
BigDecimal pricePerKilometer = conf.getPricePerKilometer();
|
||||
|
||||
//最终价格
|
||||
//计算公式为【起步价 + 夜间出行费 + ((公里数 - 免费公里数) * 每公里价格)= 最终价格】
|
||||
BigDecimal travelPrice = NumberUtil.add(startingPrice, nightTravelExpenses, NumberUtil.mul(NumberUtil.sub(kilometerNum, freeKilometers), pricePerKilometer));
|
||||
//计算公式为【起步价 + 夜间出行费 + ((公里数 -起步公里数 - 免费公里数) * 每公里价格)= 最终价格】
|
||||
BigDecimal travelPrice = NumberUtil.add(startingPrice, nightTravelExpenses, NumberUtil.mul(NumberUtil.sub(NumberUtil.sub(kilometerNum,startKilometers), freeKilometers), pricePerKilometer));
|
||||
vo.setTravelPrice(NumberUtil.decimalFormat("0.00", travelPrice));
|
||||
}
|
||||
return vo;
|
||||
|
|
Loading…
Reference in New Issue