Commit 1bb93d1c authored by libin's avatar libin

Merge branch 'holiday-price' into dev

parents 4b063f3c ca35f2ab
package com.xxfc.platform.order.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.xxfc.platform.order.contant.enumerate.ItemTypeEnum;
......@@ -58,7 +59,7 @@ public class OrderItemBiz extends BaseBiz<OrderItemMapper,OrderItem> {
List<VehicleModelCalendarPriceDTO> overlist = vehicleFeign.findVehicleModelCalendarPriceByDate(overStart.getTime(), overEnd.getTime(), modelId, userId).getData();
for(VehicleModelCalendarPriceDTO vmcpd : overlist) {
overAmountList.add((VMCalendarPriceCostDTO) vmcpd);
overAmountList.add(BeanUtil.toBean(vmcpd, VMCalendarPriceCostDTO.class));
}
return overAmountList;
}
......
......@@ -178,7 +178,7 @@ public class OrderCalculateBiz {
if(residueDays > 0) {
//设置消耗费用列表
for(int i = 0; i < useDays; i++) {
useAmountList.add((VMCalendarPriceCostDTO) vmcpds.get(i));
useAmountList.add(BeanUtil.toBean(vmcpds.get(i), VMCalendarPriceCostDTO.class));
}
//"{}元/天 x{}天"
......
......@@ -261,7 +261,7 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
//价格重置
vehicle_price = vehicle_base_price;
//未乘以会员折扣的价格
BigDecimal no_discount_price = new BigDecimal(vehicle_price.doubleValue());
BigDecimal no_discount_price = new BigDecimal(Objects.toString(vehicle_price.doubleValue()));
//免费天数重置
Integer free_days = DEFAULT_FREE_DAYS;
//节假日对应的价格和免费天数
......@@ -275,17 +275,17 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
} else {
switch (vehicleModelCalendarPrice.getType()) {
case VehicleModelPriceType.MULTIPLE:
no_discount_price = vehicle_price.multiply(new BigDecimal(vehicleModelCalendarPrice.getMultiple().doubleValue()));
vehicle_price = no_discount_price.multiply(new BigDecimal(discount / 100.00));
no_discount_price = vehicle_price.multiply(new BigDecimal(String.valueOf(vehicleModelCalendarPrice.getMultiple().doubleValue())));
vehicle_price = no_discount_price.multiply(new BigDecimal(Objects.toString(discount / 100.00)));
break;
case VehicleModelPriceType.ABS:
no_discount_price = vehicleModelCalendarPrice.getPrice();
vehicle_price = no_discount_price.multiply(new BigDecimal(discount / 100.00));
vehicle_price = no_discount_price.multiply(new BigDecimal(Objects.toString(discount / 100.00)));
break;
case VehicleModelPriceType.MEMBER:
memberLevel = vehicleModelCalendarPrice.getLevel() > memberLevel ? vehicleModelCalendarPrice.getLevel() : memberLevel;
Integer level_discount = levelAndDiscountMap.get(memberLevel);
vehicle_price = level_discount == null ? vehicle_price : vehicle_price.multiply(new BigDecimal(level_discount / 100.00));
vehicle_price = level_discount == null ? vehicle_price : vehicle_price.multiply(new BigDecimal(Objects.toString(level_discount / 100.00)));
break;
default:
break;
......@@ -301,7 +301,7 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
no_discount_price = (BigDecimal) price_freeDays_map.get(BASE_PRICE_VAL);
}
vehicleModelCalendarPriceDTO.setNo_discount_price(no_discount_price);
vehicleModelCalendarPriceDTO.setPrice(vehicle_price.setScale(2, RoundingMode.HALF_UP));
vehicleModelCalendarPriceDTO.setPrice(vehicle_price);
vehicleModelCalendarPriceDTO.setFreeDays(free_days);
final_startLocalDate = final_startLocalDate.plusDays(1);
vehicleModelCalendarPriceVos.add(vehicleModelCalendarPriceDTO);
......@@ -330,7 +330,7 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
free_days = vehicleModelHolidayPriceDTO.getFreeDays() == null ? free_days : vehicleModelHolidayPriceDTO.getFreeDays();
}
}
vehicle_price = vehicle_price.multiply(new BigDecimal(discount / 100.00));
vehicle_price = vehicle_price.multiply(new BigDecimal(Objects.toString(discount / 100.00)));
vehicle_price_days_map.put(PRICE_VAL, vehicle_price);
vehicle_price_days_map.put(DAYS_VAL, free_days);
log.info("(节假日|非节假日未设置的)价格和免费天数 处理【{}】",vehicle_price_days_map);
......
......@@ -53,16 +53,28 @@ public class VehicleModelCalendarPriceController {
return ObjectRestResponse.succ(vehicleModelCalendarPriceVos);
}
@GetMapping(value = "/price",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@GetMapping(value = "/price", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ObjectRestResponse<List<VehicleModelCalendarPriceDTO>> findVehicleModelCalendarPriceByDate(@RequestParam(value = "startDate") Long startDate,
@RequestParam(value = "endDate") Long endDate,
@RequestParam(value = "vehicleModelId") Integer vehicleModelId,
@RequestParam(value = "userId") Integer userId) {
@RequestParam(value = "endDate") Long endDate,
@RequestParam(value = "vehicleModelId") Integer vehicleModelId,
@RequestParam(value = "userId") Integer userId) {
Date startDateDay = DateUtil.beginOfDay(DateUtil.date(startDate));
//Date.from(startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
//Date.from(startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
Date endDateDay = DateUtil.beginOfDay(DateUtil.date(endDate));
//Date.from(endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
//Date.from(endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
return ObjectRestResponse.succ(vehicleModelCalendarPriceBiz.findVehicleModelCalendarPriceByDateAndVehilceIdAndUserId(startDateDay, endDateDay, vehicleModelId, userId));
}
@GetMapping(value = "/app/price", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ObjectRestResponse<List<VehicleModelCalendarPriceDTO>> findVehicleModelCalendarPriceByDateForApp(@RequestParam(value = "startDate") Long startDate,
@RequestParam(value = "endDate") Long endDate,
@RequestParam(value = "vehicleModelId") Integer vehicleModelId,
AppUserDTO appUserDTO) {
Date startDateDay = DateUtil.beginOfDay(DateUtil.date(startDate));
Date endDateDay = DateUtil.beginOfDay(DateUtil.date(endDate));
return ObjectRestResponse.succ(vehicleModelCalendarPriceBiz.findVehicleModelCalendarPriceByDateAndVehilceIdAndUserId(startDateDay, endDateDay, vehicleModelId, appUserDTO.getUserid()));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment