Commit 10fc4c07 authored by 周健威's avatar 周健威

Merge branch 'feature_chw_zjw' into dev-chw

parents 0bb42be1 bded309f
......@@ -19,6 +19,10 @@ import lombok.Data;
@Table(name = "order_person_insurance")
public class OrderPersonInsurance implements Serializable {
private static final long serialVersionUID = 1L;
public static final int STATUS_PAY = 1;
public static final int STATUS_CNL = 2;
public static final int STATUS_TOPAY = 3;
/**
* 主键
......@@ -71,10 +75,10 @@ public class OrderPersonInsurance implements Serializable {
private BigDecimal amount;
/**
* 状态 1--已支付;2--已退款
* 状态 1--已支付;2--已退款; 3--待支付;
*/
@Column(name = "status")
@ApiModelProperty(value = "状态 1--已支付;2--已退款")
@ApiModelProperty(value = "状态 1--已支付;2--已退款; 3--待支付;")
private Integer status;
/**
......
package com.xxfc.platform.order.entity.inter;
import cn.hutool.core.collection.CollUtil;
import com.xxfc.platform.order.contant.enumerate.ItemTypeEnum;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderItem;
......@@ -20,4 +21,14 @@ public interface OrderItemInter {
return null;
}
default List<OrderItem> getItemsByTypeEnum(ItemTypeEnum itemTypeEnum) {
List<OrderItem> returnItems = CollUtil.newArrayList();
for(OrderItem item: getItems()) {
if(itemTypeEnum.getCode().equals(item.getType())) {
returnItems.add(item);
}
}
return returnItems;
}
}
package com.xxfc.platform.order.pojo.order;
import com.xxfc.platform.universal.entity.Dictionary;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Data
public class OrderAboutParamDTO {
......@@ -25,6 +29,8 @@ public class OrderAboutParamDTO {
@ApiModelProperty(value = "免赔费用")
private BigDecimal damageSafe;
List<Dictionary> personInsurances;
// @ApiModelProperty(value = "违章保留金")
// private BigDecimal ;
}
\ No newline at end of file
package com.xxfc.platform.order.pojo.order;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderItem;
import com.xxfc.platform.order.entity.OrderPersonInsurance;
import com.xxfc.platform.order.entity.inter.OrderDetail;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.pojo.OrderAccompanyDTO;
......@@ -18,6 +20,8 @@ import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
@Data
public class RentVehicleBO extends OrderRentVehicleDetail implements OrderDetail {
private BaseOrder order;
......@@ -110,6 +114,10 @@ public class RentVehicleBO extends OrderRentVehicleDetail implements OrderDetail
*/
private String endDateTimeStr;
private Integer needPersonInsurance;
private List<OrderPersonInsurance> insurances;
private List<OrderPersonInsurance> confirmInsurances = CollUtil.newArrayList();
public void initDate() {
this.startDate = DateUtil.date(getStartTime());
this.endDate = DateUtil.date(getEndTime());
......
......@@ -47,6 +47,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_TRUE;
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.pojo.account.OrderAccountDeduction.ORIGIN_DEPOSIT;
import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_ORDER_DEPOSIT;
......@@ -343,29 +344,34 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
return deductGoodsAmount;
}
public BigDecimal calculatePersonInsurance(Long timeLag) {
BigDecimal amount = BigDecimal.ZERO;
public void calculatePersonInsurance(Long timeLag, OrderPersonInsurance opi) {
opi.setAmount(BigDecimal.ZERO);
opi.setStatus(-1);
//获取天
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();
Set<Dictionary> personInsurances = dictionaryMap.get(DictionaryKey.APP_ORDER+ "_"+ RENT_PERSON_INSURANCE).getChildrens();
for(com.xxfc.platform.universal.entity.Dictionary dic : personInsurances) {
if(StrUtil.isBlank(dic.getName())) {
continue;
}
String[] names = dic.getName().split("\\|");
if(names.length < 2) {
continue;
}
//符合范围
if(IntervalUtil.staticIsInTheInterval(dayLag.toString(), dic.getName())){
amount = new BigDecimal(dic.getDetail());
if(IntervalUtil.staticIsInTheInterval(dayLag.toString(), names[0])){
opi.setAmount(new BigDecimal(dic.getDetail()));
opi.setStatus(STATUS_TOPAY);
opi.setInsuranceDay(Integer.valueOf(names[1]));
break;
}
}
return amount;
}
/**
......
......@@ -54,6 +54,7 @@ import tk.mybatis.mapper.weekend.WeekendSqls;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -61,6 +62,7 @@ import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.order.entity.BaseOrder.ORDER_TYPE_VEHICLE;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
import static com.xxfc.platform.universal.constant.DictionaryKey.RENT_PERSON_INSURANCE;
@Controller
@RequestMapping("baseOrder")
......@@ -155,6 +157,8 @@ public class BaseOrderController extends CommonBaseController implements UserRes
setActMember(new Long(dictionaryMap.get(APP_ORDER + "_" + DictionaryKey.ACT_MEMBER).getDetail()));
setDamageSafe(new BigDecimal(dictionaryMap.get(APP_ORDER + "_" + DictionaryKey.DAMAGE_SAFE).getDetail()));
setDriverPrice(new BigDecimal(dictionaryMap.get(APP_ORDER + "_" + DictionaryKey.DRIVER_PRICE).getDetail()));
setPersonInsurances(dictionaryMap.get(DictionaryKey.APP_ORDER+ "_"+ RENT_PERSON_INSURANCE).getChildrens()
.parallelStream().sorted(Comparator.comparing(Dictionary::getId)).collect(Collectors.toList()));
}});
}
......
......@@ -142,6 +142,9 @@ public abstract class AbstractOrderHandle<Biz extends BaseBiz, Detail extends Or
/**
* 处理订单详情
* 1、补充baseorder 信息 update
* 2、插入item
* 3、判断是否支付
* @param detail
*/
public void handleDetail(Detail detail){
......
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