Commit 44631b2b authored by hezhen's avatar hezhen

Merge branch 'dev-chw' of http://113.105.137.151:22280/youjj/cloud-platform into dev-chw

parents d7d1257e a781f9c7
......@@ -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, "旅游保险"),
......
package com.xxfc.platform.order.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 订单人身保险
*
* @author libin
* @email 18178966185@163.com
* @date 2020-11-26 18:56:21
*/
@Data
@Table(name = "order_person_insurance")
public class OrderPersonInsurance implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键")
private Integer id;
/**
* 基础订单id
*/
@Column(name = "order_id")
@ApiModelProperty(value = "基础订单id")
private Integer orderId;
/**
* 姓名
*/
@Column(name = "name")
@ApiModelProperty(value = "姓名")
private String name;
/**
* 身份证号码
*/
@Column(name = "id_card")
@ApiModelProperty(value = "身份证号码")
private String idCard;
/**
* 订单的天数
*/
@Column(name = "order_day")
@ApiModelProperty(value = "订单的天数")
private Integer orderDay;
/**
* 保险的天数
*/
@Column(name = "insurance_day")
@ApiModelProperty(value = "保险的天数")
private Integer insuranceDay;
/**
* 金额
*/
@Column(name = "amount")
@ApiModelProperty(value = "金额")
private BigDecimal amount;
/**
* 状态 1--已支付;2--已退款
*/
@Column(name = "status")
@ApiModelProperty(value = "状态 1--已支付;2--已退款")
private Integer status;
/**
* 创建时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true )
private Date crtTime;
/**
* 创建者id
*/
@Column(name = "crt_user")
@ApiModelProperty(value = "创建者id")
private String crtUser;
/**
* 更新时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "更新时间", hidden = true )
private Date updTime;
/**
* 更新者id
*/
@Column(name = "upd_user")
@ApiModelProperty(value = "更新者id")
private String updUser;
}
......@@ -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
......
package com.xxfc.platform.order.biz;
import org.springframework.stereotype.Service;
import com.xxfc.platform.order.entity.OrderPersonInsurance;
import com.xxfc.platform.order.mapper.OrderPersonInsuranceMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
/**
* 订单人身保险
*
* @author libin
* @email 18178966185@163.com
* @date 2020-11-26 18:56:21
*/
@Service
public class OrderPersonInsuranceBiz extends BaseBiz<OrderPersonInsuranceMapper, OrderPersonInsurance> {
}
\ No newline at end of file
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderPersonInsurance;
import tk.mybatis.mapper.common.Mapper;
/**
* 订单人身保险
*
* @author libin
* @email 18178966185@163.com
* @date 2020-11-26 18:56:21
*/
public interface OrderPersonInsuranceMapper extends Mapper<OrderPersonInsurance> {
}
package com.xxfc.platform.order.rest;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.order.biz.OrderPersonInsuranceBiz;
import com.xxfc.platform.order.entity.OrderPersonInsurance;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("orderPersonInsurance")
public class OrderPersonInsuranceController extends BaseController<OrderPersonInsuranceBiz, OrderPersonInsurance> {
}
\ No newline at end of file
......@@ -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);
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.order.mapper.OrderPersonInsuranceMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.order.entity.OrderPersonInsurance" id="orderPersonInsuranceMap">
<result property="id" column="id"/>
<result property="orderId" column="order_id"/>
<result property="name" column="name"/>
<result property="idCard" column="id_card"/>
<result property="orderDay" column="order_day"/>
<result property="insuranceDay" column="insurance_day"/>
<result property="amount" column="amount"/>
<result property="status" column="status"/>
<result property="crtTime" column="crt_time"/>
<result property="crtUser" column="crt_user"/>
<result property="updTime" column="upd_time"/>
<result property="updUser" column="upd_user"/>
</resultMap>
</mapper>
\ No newline at end of file
......@@ -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";
/**
* 旅游:保险费用
......
......@@ -57,8 +57,9 @@ public interface CalculateInterface {
default Integer getIncludeHours(Long startLong, Long endLong) {
Map<String, Dictionary> dictionaryMap = getThirdFeign().dictionaryGetAll4Map().getData();
Long hourLong = (60L * 60L * 1000L);
Long minuteLong = (60L * 1000L);
//Long dayLong = hourLong * 24;
Long bufferLong = 0L;
Long bufferLong = Long.valueOf(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_TIME_HOUR_BUFFER).getDetail()) * minuteLong;
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long bookTimeLag = endLong - startLong;
......@@ -70,16 +71,16 @@ public interface CalculateInterface {
// log.info("bookTimeLag {}", new BigDecimal(bookTimeLag + ""));
// log.info("divide {}", new BigDecimal(hourLong+ ""));
Integer hourDays = new BigDecimal(bookTimeLag + "").divide(new BigDecimal(hourLong+ ""), 0, RoundingMode.DOWN).intValue();
Integer hourNums = new BigDecimal(bookTimeLag + "").divide(new BigDecimal(hourLong+ ""), 0, RoundingMode.DOWN).intValue();
Long excess = bookTimeLag%hourLong;
if(excess > bufferLong) {
hourDays += 1;
hourNums += 1;
}
if(0 == hourDays) {
hourDays = 1;
if(0 == hourNums) {
hourNums = 1;
}
return hourDays;
return hourNums;
}
}
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