Commit d0e67a05 authored by unset's avatar unset

Merge remote-tracking branch 'origin/dev-chw' into dev-chw

parents e0e49a8b ab4a0069
...@@ -40,7 +40,7 @@ public class OrderUtil { ...@@ -40,7 +40,7 @@ public class OrderUtil {
if (orderIndex.intValue() > 9999) { if (orderIndex.intValue() > 9999) {
orderIndex = new AtomicInteger(1); orderIndex = new AtomicInteger(1);
} }
String indexString = String.format("%s%s%04d", currTime, midFix, orderIndex); String indexString = String.format("%s%s%04d", currTime, midFix, orderIndex.intValue());
return indexString; return indexString;
} }
......
...@@ -54,6 +54,9 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{ ...@@ -54,6 +54,9 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
@Autowired @Autowired
GroupBiz groupBiz; GroupBiz groupBiz;
@Autowired
AppUserRelationBiz userRelationBiz;
public static final String CODE="SHOP-"; public static final String CODE="SHOP-";
...@@ -76,6 +79,7 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{ ...@@ -76,6 +79,7 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
//初始化商家账号 //初始化商家账号
addUser(id); addUser(id);
//初始化店铺 //初始化店铺
setInviterAccount(companyInfoApply);
BranchCompany branchCompany = getBranchCompanyInfo(); BranchCompany branchCompany = getBranchCompanyInfo();
branchCompany.setCompanyId(id); branchCompany.setCompanyId(id);
branchCompany.setInviterAccount(companyInfoApply.getInviterAccount()); branchCompany.setInviterAccount(companyInfoApply.getInviterAccount());
...@@ -86,6 +90,21 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{ ...@@ -86,6 +90,21 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
return id; return id;
} }
//app上级用户为店铺推荐人
public void setInviterAccount(CompanyInfoApply companyInfoApply){
Integer inviterAccount = companyInfoApply.getInviterAccount() == null ? 0 : companyInfoApply.getInviterAccount();
if (inviterAccount == 0){
Integer appUserId = companyInfoApply.getAppUserId() == null ? 0 : companyInfoApply.getAppUserId();
if (appUserId > 0){
AppUserRelation appUserRelation = userRelationBiz.getRelationByUserId(appUserId);
if (appUserRelation != null ){
companyInfoApply.setInviterAccount(appUserRelation.getParentId());
}
}
}
}
//初始化店铺信息 //初始化店铺信息
......
...@@ -11,6 +11,15 @@ import java.util.List; ...@@ -11,6 +11,15 @@ import java.util.List;
@Data @Data
public class InProgressVO { public class InProgressVO {
public static final int VIOLATE_TYPE_NOT = 0;
public static final int VIOLATE_TYPE_ADVANCE = 1;
public static final int VIOLATE_TYPE_DELAY = 2;
/**
* 违约类型 0--没违约;1--提前还车;2--延期还车
*/
Integer violateType = 0;
/** /**
* 违约金 * 违约金
*/ */
......
...@@ -46,6 +46,8 @@ import java.util.List; ...@@ -46,6 +46,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
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.pojo.calculate.InProgressVO.VIOLATE_TYPE_ADVANCE;
import static com.xxfc.platform.order.pojo.calculate.InProgressVO.VIOLATE_TYPE_DELAY;
import static com.xxfc.platform.universal.constant.DictionaryKey.*; import static com.xxfc.platform.universal.constant.DictionaryKey.*;
/** /**
...@@ -278,9 +280,11 @@ public class OrderCalculateBiz implements CalculateInterface { ...@@ -278,9 +280,11 @@ public class OrderCalculateBiz implements CalculateInterface {
violateDesc += StrUtil.format("(封顶{}元)", residueAmount); violateDesc += StrUtil.format("(封顶{}元)", residueAmount);
} }
inProgressVO.setViolateType(VIOLATE_TYPE_ADVANCE);
inProgressVO.setViolateAmount(residueAmount); inProgressVO.setViolateAmount(residueAmount);
inProgressVO.setViolateDesc(" 提前还车违约金:"+ violateDesc); inProgressVO.setViolateDesc(" 提前还车违约金:"+ violateDesc);
OrderAccountDeduction violateDeduction = orderAccountBiz.initDeduction(inProgressVO.getViolateAmount(), violateDesc, DeductionTypeEnum.VIOLATE_ADVANCE, OrderAccountDeduction.ORIGIN_DEPOSIT); //提前还车 修改ORIGIN_DEPOSIT 为 ORIGIN_ORDER_DEPOSIT
OrderAccountDeduction violateDeduction = orderAccountBiz.initDeduction(inProgressVO.getViolateAmount(), violateDesc, DeductionTypeEnum.VIOLATE_ADVANCE, OrderAccountDeduction.ORIGIN_ORDER_DEPOSIT);
oad.getDeductions().add(violateDeduction); oad.getDeductions().add(violateDeduction);
}else if (realResidueDays.equals(0)) { //准时还车 }else if (realResidueDays.equals(0)) { //准时还车
//设置消耗费用列表 //设置消耗费用列表
...@@ -301,6 +305,7 @@ public class OrderCalculateBiz implements CalculateInterface { ...@@ -301,6 +305,7 @@ public class OrderCalculateBiz implements CalculateInterface {
.map(VMCalendarPriceCostDTO::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(new BigDecimal(2+ "")); .map(VMCalendarPriceCostDTO::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(new BigDecimal(2+ ""));
//超过的天数 价格 * 200% //超过的天数 价格 * 200%
inProgressVO.setViolateType(VIOLATE_TYPE_DELAY);
inProgressVO.setViolateAmount(overAmount); inProgressVO.setViolateAmount(overAmount);
inProgressVO.setViolateDesc(" 延期还车违约金:"+ violateDesc); inProgressVO.setViolateDesc(" 延期还车违约金:"+ violateDesc);
inProgressVO.setOverAmountList(overAmountList); inProgressVO.setOverAmountList(overAmountList);
...@@ -349,9 +354,17 @@ public class OrderCalculateBiz implements CalculateInterface { ...@@ -349,9 +354,17 @@ public class OrderCalculateBiz implements CalculateInterface {
public InProgressVO calculateOrderComplete(BaseOrder baseOrder, OrderRentVehicleDetail orvd, OrderAccountDetail oad, VehicleItemDTO vehicleItemDTO, Integer useDays, Boolean isCancel) { public InProgressVO calculateOrderComplete(BaseOrder baseOrder, OrderRentVehicleDetail orvd, OrderAccountDetail oad, VehicleItemDTO vehicleItemDTO, Integer useDays, Boolean isCancel) {
InProgressVO inProgressVO = inProgressCalculate(baseOrder, vehicleItemDTO, orvd, useDays, oad, isCancel); InProgressVO inProgressVO = inProgressCalculate(baseOrder, vehicleItemDTO, orvd, useDays, oad, isCancel);
//后修改为提前还车 订单款扣,延期还车 押金扣
if(InProgressVO.VIOLATE_TYPE_ADVANCE == inProgressVO.getViolateType()) {
//定金 - (额外消费金额)
oad.setDepositAmount(orvd.getDeposit().subtract(inProgressVO.getExtraAmount()));
//订单款 - 违约金
oad.setOrderAmount(inProgressVO.getRefundOrderAmount().subtract(inProgressVO.getViolateAmount()));
}else {
//定金 - (额外消费金额 + 违约金) //定金 - (额外消费金额 + 违约金)
oad.setDepositAmount(orvd.getDeposit().subtract(inProgressVO.getExtraAmount().add(inProgressVO.getViolateAmount()))); oad.setDepositAmount(orvd.getDeposit().subtract(inProgressVO.getExtraAmount().add(inProgressVO.getViolateAmount())));
oad.setOrderAmount(inProgressVO.getRefundOrderAmount()); oad.setOrderAmount(inProgressVO.getRefundOrderAmount());
}
oad.setOriginDepositAmount(orvd.getDeposit()); oad.setOriginDepositAmount(orvd.getDeposit());
oad.setOriginOrderAmount(baseOrder.getGoodsAmount().subtract(baseOrder.getCouponAmount())); oad.setOriginOrderAmount(baseOrder.getGoodsAmount().subtract(baseOrder.getCouponAmount()));
return inProgressVO; return inProgressVO;
......
...@@ -1192,7 +1192,7 @@ ...@@ -1192,7 +1192,7 @@
* 原(大于预约结束时间,小于预约开始时间的预约记录) * 原(大于预约结束时间,小于预约开始时间的预约记录)
* 相交叉(大于预约开始时间,小于预约结束时间的预约记录) * 相交叉(大于预约开始时间,小于预约结束时间的预约记录)
--> -->
<if test="recordIntersection == null "> <if test="recordIntersection == null or recordIntersection != true">
left join ( left join (
<include refid="aroundBookRecord"></include> <include refid="aroundBookRecord"></include>
) abr on v.`id` = abr.vehicle_id ) abr on v.`id` = abr.vehicle_id
......
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