Commit 64edbb1f authored by 周健威's avatar 周健威

Merge branch 'feature_chw_zjw' into dev-chw

parents 311cb8b5 44bbdd2a
......@@ -8,6 +8,7 @@ public enum ItemTypeEnum {
VEHICLE_MODEL(101, "租车车型"),
DAMAGE_SAFE(102, "车损免赔"),
DRIVER(103, "司机"),
PERSON_INSURANCE(104, "人身保险"),
TOUR_ADULT(201, "旅游成人"),
TOUR_CHILD(202, "旅游儿童"),
TOUR_INSURE(203, "旅游保险"),
......
......@@ -45,6 +45,11 @@ public class InProgressVO {
*/
Integer usedDays = 0;
/**
* 已使用小时数
*/
Integer usedHours = 0;
/**
* 已使用的金额
*/
......
package com.xxfc.platform.order.pojo.order.add;
import com.xxfc.platform.order.entity.OrderPersonInsurance;
import com.xxfc.platform.order.pojo.OrderAccompanyDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -12,8 +13,7 @@ import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.DATE_TIME_LINE_FORMATTER;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.YMR_SLASH_FORMATTER;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.*;
@Data
public class AddRentVehicleDTO extends AddOrderCommonDTO{
......@@ -137,6 +137,9 @@ public class AddRentVehicleDTO extends AddOrderCommonDTO{
public static final int GOODS_DEPOSIT_TYPE_UP = 1;
public static final int GOODS_DEPOSIT_TYPE_DOWN = 2;
private Integer needPersonInsurance = SYS_FALSE;
private List<OrderPersonInsurance> insurances;
public void setStartTime(Long startTime) {
this.startTime = startTime;
this.bookStartDate = YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startTime), ZoneOffset.ofHours(8)));
......@@ -164,4 +167,5 @@ public class AddRentVehicleDTO extends AddOrderCommonDTO{
}).collect(Collectors.toList());
}
}
}
......@@ -52,6 +52,7 @@ import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_
import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_ORDER_DEPOSIT;
import static com.xxfc.platform.order.pojo.pay.NotifyUrlDTO.PAY_WAY_ALI;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
import static com.xxfc.platform.universal.constant.DictionaryKey.RENT_PERSON_INSURANCE;
/**
* 订单帐目
......@@ -342,6 +343,31 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
return deductGoodsAmount;
}
public BigDecimal calculatePersonInsurance(Long timeLag) {
BigDecimal amount = BigDecimal.ZERO;
//获取天
Integer remainder = Long.valueOf(timeLag%(1000L * 60L * 60L * 24L)).intValue();
Integer dayLag = Long.valueOf(timeLag/(1000L * 60L * 60L * 24L)).intValue() + remainder > 0? 1: 0;
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Set<Dictionary> personInsurances = dictionaryMap.get(RENT_PERSON_INSURANCE).getChildrens();
for(com.xxfc.platform.universal.entity.Dictionary dic : personInsurances) {
if(StrUtil.isBlank(dic.getName())) {
continue;
}
//符合范围
if(IntervalUtil.staticIsInTheInterval(dayLag.toString(), dic.getName())){
amount = new BigDecimal(dic.getDetail());
break;
}
}
return amount;
}
/**
* 初始化deduction
* @param subtract
......
......@@ -456,6 +456,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
OrderItem driverOrderItem = orderItemBiz.initOrderItem(DRIVER_PRICE, detail.getDayNum(), "平台司机", null, ItemTypeEnum.DRIVER);
OrderItem damageSafeOrderItem = orderItemBiz.initOrderItem(DAMAGE_SAFE, detail.getDayNum(), "免赔费用", null, ItemTypeEnum.DAMAGE_SAFE);
//OrderItem personInsuranceOrderItem = orderItemBiz.initOrderItem(DAMAGE_SAFE, detail.getDayNum(), "免赔费用", null, ItemTypeEnum.PERSON_INSURANCE);
detail.setItems(new ArrayList<OrderItem>());
detail.getItems().add(vehicleOrderItem);
......
......@@ -62,6 +62,8 @@ public class DictionaryKey {
public static final String DAMAGE_SAFE = "DAMAGE_SAFE";
public static final String ILLEGAL_RESERVE = "ILLEGAL_RESERVE";
public static final String RENT_TIME_BUFFER = "RENT_TIME_BUFFER";
public static final String RENT_TIME_HOUR_BUFFER = "RENT_TIME_HOUR_BUFFER";
public static final String RENT_PERSON_INSURANCE = "RENT_PERSON_INSURANCE";
/**
* 旅游:保险费用
......
......@@ -58,7 +58,7 @@ public interface CalculateInterface {
Map<String, Dictionary> dictionaryMap = getThirdFeign().dictionaryGetAll4Map().getData();
Long hourLong = (60L * 60L * 1000L);
//Long dayLong = hourLong * 24;
Long bufferLong = 0L;
Long bufferLong = Long.valueOf(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_TIME_HOUR_BUFFER).getDetail()) * hourLong;
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long bookTimeLag = endLong - startLong;
......
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