Commit d6170f18 authored by 周健威's avatar 周健威

修改保险

parent c94394b0
...@@ -376,4 +376,7 @@ public class BaseOrder implements Serializable { ...@@ -376,4 +376,7 @@ public class BaseOrder implements Serializable {
@Column(name = "insure_status") @Column(name = "insure_status")
private Integer insureStatus; private Integer insureStatus;
@Column(name = "insure_amount")
private BigDecimal insureAmount;
} }
...@@ -126,6 +126,10 @@ public class OrderItem implements Serializable { ...@@ -126,6 +126,10 @@ public class OrderItem implements Serializable {
@ApiModelProperty(value = "真实的总价") @ApiModelProperty(value = "真实的总价")
private BigDecimal realAmount; private BigDecimal realAmount;
public void setRealAmount(BigDecimal realAmount) {
this.realAmount = realAmount;
}
/** /**
* 订单id * 订单id
*/ */
......
...@@ -51,6 +51,7 @@ import java.util.*; ...@@ -51,6 +51,7 @@ import java.util.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.order.entity.BaseOrder.INSURE_STATUS_CNL;
import static com.xxfc.platform.order.entity.OrderPersonInsurance.*; import static com.xxfc.platform.order.entity.OrderPersonInsurance.*;
import static com.xxfc.platform.order.contant.enumerate.AccountTypeEnum.OUT_RESIDUE_ORDER; import static com.xxfc.platform.order.contant.enumerate.AccountTypeEnum.OUT_RESIDUE_ORDER;
import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_DEPOSIT; import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_DEPOSIT;
...@@ -137,6 +138,14 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -137,6 +138,14 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
if(null != orderDeductSource && BigDecimal.ZERO.compareTo(orderDeductSource) < 0) { if(null != orderDeductSource && BigDecimal.ZERO.compareTo(orderDeductSource) < 0) {
BigDecimal orderDeductAmount = calculateDeduction(orderDeductSource, timeLag, dicParentKey, orderRefundDescBuilder); BigDecimal orderDeductAmount = calculateDeduction(orderDeductSource, timeLag, dicParentKey, orderRefundDescBuilder);
Integer dayLag = Long.valueOf(timeLag/(1000L * 60L * 60L * 24L)).intValue();
if(dayLag <= 0 && baseOrder.getInsureAmount().compareTo(BigDecimal.ZERO) > 0) {
//扣钱
orderDeductAmount = orderDeductAmount.add(baseOrder.getInsureAmount());
orderRefundDescBuilder = orderRefundDescBuilder.insert(0, "小于24小时扣除保险费");
}
//如果属于免扣费情况 //如果属于免扣费情况
if(noDeduct) { if(noDeduct) {
orderDeductAmount = BigDecimal.ZERO; orderDeductAmount = BigDecimal.ZERO;
...@@ -172,33 +181,33 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -172,33 +181,33 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
BigDecimal originalDepositRefundAmount = BigDecimal.ZERO.add(depositAmount); BigDecimal originalDepositRefundAmount = BigDecimal.ZERO.add(depositAmount);
BigDecimal depositRefundAmount = BigDecimal.ZERO.add(depositAmount); BigDecimal depositRefundAmount = BigDecimal.ZERO.add(depositAmount);
if(null != depositDeductSource && BigDecimal.ZERO.compareTo(depositDeductSource) < 0) { // if(null != depositDeductSource && BigDecimal.ZERO.compareTo(depositDeductSource) < 0) {
//通过原扣除款 计算剩余款 // //通过原扣除款 计算剩余款
BigDecimal depositDeductAmount = calculateDeduction(depositDeductSource, timeLag, dicParentKey, depositRefundDescBuilder); // BigDecimal depositDeductAmount = calculateDeduction(depositDeductSource, timeLag, dicParentKey, depositRefundDescBuilder);
//如果属于免扣费情况 // //如果属于免扣费情况
if(noDeduct) { // if(noDeduct) {
depositDeductAmount = BigDecimal.ZERO; // depositDeductAmount = BigDecimal.ZERO;
depositRefundDescBuilder = new StringBuilder(""); // depositRefundDescBuilder = new StringBuilder("");
} // }
depositDeductAmount = depositDeductAmount.setScale(2, RoundingMode.HALF_UP); // depositDeductAmount = depositDeductAmount.setScale(2, RoundingMode.HALF_UP);
if(null != orderViolateCoverAmount) { // if(null != orderViolateCoverAmount) {
depositDeductAmount = orderViolateCoverAmount; // depositDeductAmount = orderViolateCoverAmount;
} // }
if (null != depositViolateCoverAmount) { // if (null != depositViolateCoverAmount) {
depositDeductAmount = depositViolateCoverAmount; // depositDeductAmount = depositViolateCoverAmount;
} // }
if(topAmount.compareTo(depositDeductAmount) > 0) { // if(topAmount.compareTo(depositDeductAmount) > 0) {
totalDeductAmount = totalDeductAmount.add(depositDeductAmount); // totalDeductAmount = totalDeductAmount.add(depositDeductAmount);
topAmount = topAmount.subtract(depositDeductAmount); // topAmount = topAmount.subtract(depositDeductAmount);
}else { // }else {
totalDeductAmount = totalDeductAmount.add(topAmount); // totalDeductAmount = totalDeductAmount.add(topAmount);
depositDeductAmount = topAmount; // depositDeductAmount = topAmount;
topAmount = BigDecimal.ZERO; // topAmount = BigDecimal.ZERO;
} // }
//
//返回押金 // //返回押金
depositRefundAmount = originalDepositRefundAmount.subtract(depositDeductAmount); // depositRefundAmount = originalDepositRefundAmount.subtract(depositDeductAmount);
} // }
//设置违章款账单 //设置违章款账单
StringBuilder stringBuilder = new StringBuilder(""); StringBuilder stringBuilder = new StringBuilder("");
......
...@@ -123,6 +123,10 @@ public class OrderCalculateBiz implements CalculateInterface { ...@@ -123,6 +123,10 @@ public class OrderCalculateBiz implements CalculateInterface {
//其他消费金额 = 商品真实价格 - 主要商品真实价格 = (商品价格 - 优惠价格)- 主要商品真实价格 //其他消费金额 = 商品真实价格 - 主要商品真实价格 = (商品价格 - 优惠价格)- 主要商品真实价格
BigDecimal otherItemRealAmount = goodsRealAmount.subtract(vehicleItemDTO.getRealAmount()); BigDecimal otherItemRealAmount = goodsRealAmount.subtract(vehicleItemDTO.getRealAmount());
// //人身保险费用处理
// Long dayLong = 1000L * 60L * 60L * 24L;
// if()
InProgressVO inProgressVO = new InProgressVO(); InProgressVO inProgressVO = new InProgressVO();
inProgressVO.setUsedDays(useDays); inProgressVO.setUsedDays(useDays);
......
...@@ -270,7 +270,8 @@ public class OrderCancelBiz { ...@@ -270,7 +270,8 @@ public class OrderCancelBiz {
//退款流程 //退款流程
//违约金封顶 租车身份价 * 2天 //违约金封顶 租车身份价 * 2天
orderAccountBiz.rentRefundProcessCancel(baseOrder, BigDecimal.ZERO, timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), vehicleItemDTO.getBuyAmount(), oad, vehicleItemDTO.getTopAmount(0), null, changeViolateAmount, (!overCancelBuffer)); orderAccountBiz.rentRefundProcessCancel(baseOrder, vehicleItemDTO.getBuyAmount(), timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), BigDecimal.ZERO, oad, vehicleItemDTO.getTopAmount(0), null, changeViolateAmount, (!overCancelBuffer));
//设置订单数据 //设置订单数据
//baseOrder.setDamagesAmount(csv.getDamagesAmount()); //baseOrder.setDamagesAmount(csv.getDamagesAmount());
...@@ -301,6 +302,24 @@ public class OrderCancelBiz { ...@@ -301,6 +302,24 @@ public class OrderCancelBiz {
} }
} }
} }
//设置人身保险状态
if(BaseOrder.INSURE_STATUS_BUY == baseOrder.getInsureStatus()) {
List<OrderPersonInsurance> insuranceList = orderPersonInsuranceBiz.selectList(new OrderPersonInsurance(){{
setOrderId(baseOrder.getId());
}});
Integer dayLag = Long.valueOf(timeLag/(1000L * 60L * 60L * 24L)).intValue();
if(dayLag <= 0) {
baseOrder.setInsureStatus(BaseOrder.INSURE_STATUS_CNL);
//更新 申请状态
insuranceList.forEach( insurance -> {
insurance.setStatus(STATUS_CNL);
insurance.setRefundTime(DateUtil.date().getTime());
});
}
}
} }
//已付款的取消订单发送消息 //已付款的取消订单发送消息
...@@ -463,17 +482,6 @@ public class OrderCancelBiz { ...@@ -463,17 +482,6 @@ public class OrderCancelBiz {
} }
if(BaseOrder.INSURE_STATUS_BUY == baseOrder.getInsureStatus()) {
List<OrderPersonInsurance> insuranceList = orderPersonInsuranceBiz.selectList(new OrderPersonInsurance(){{
setOrderId(baseOrder.getId());
}});
//更新 申请状态
insuranceList.forEach( insurance -> {
insurance.setStatus(STATUS_CNL);
insurance.setRefundTime(DateUtil.date().getTime());
});
}
}else if(OrderTypeEnum.TOUR.getCode().equals(baseOrder.getType())) { }else if(OrderTypeEnum.TOUR.getCode().equals(baseOrder.getType())) {
otd = orderTourDetailBiz.selectOne(new OrderTourDetail(){{ otd = orderTourDetailBiz.selectOne(new OrderTourDetail(){{
setOrderId(baseOrder.getId()); setOrderId(baseOrder.getId());
......
...@@ -746,7 +746,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -746,7 +746,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
detail.getConfirmInsurances().add(BeanUtil.toBean(opi, OrderPersonInsurance.class)); detail.getConfirmInsurances().add(BeanUtil.toBean(opi, OrderPersonInsurance.class));
OrderItem personInsuranceOrderItem = orderItemBiz.initOrderItem(opi.getAmount(), 1, "人身保险", null, ItemTypeEnum.PERSON_INSURANCE, JSONUtil.toJsonStr(opi)); OrderItem personInsuranceOrderItem = orderItemBiz.initOrderItem(opi.getAmount(), 1, "人身保险", null, ItemTypeEnum.PERSON_INSURANCE, JSONUtil.toJsonStr(opi));
detail.getItems().add(personInsuranceOrderItem); detail.getItems().add(personInsuranceOrderItem);
personInsuranceAmount = personInsuranceAmount.add(opi.getAmount()); personInsuranceAmount = personInsuranceAmount.add(personInsuranceOrderItem.getCalculateAmount(Boolean.TRUE));
} }
} }
} }
......
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