|
|
@@ -82,9 +82,9 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
@Autowired
|
|
|
private ContractMapper contractMapper;
|
|
|
|
|
|
- private final BigDecimal DEFAULT_FIRST_PAYMENT = new BigDecimal(0);// 默认首付价格
|
|
|
- private final BigDecimal DEFAULT_COMMODITY_PRICE = new BigDecimal(0);// 默认单价
|
|
|
- private final String DEFAULT_PLATFORM_ID = "0"; // 平台默认id
|
|
|
+ private final BigDecimal DEFAULT_FIRST_PAYMENT = new BigDecimal(0);//默认首付价格
|
|
|
+ private final BigDecimal DEFAULT_COMMODITY_PRICE = new BigDecimal(0);//默认单价
|
|
|
+ private final String DEFAULT_PLATFORM_ID = "0"; //平台默认id
|
|
|
private final String DEFAULT_ADMIN_ID = "1"; //默认管理员
|
|
|
private final double DEFAULT_BROKERAGE_PROPORTION = 0; //佣金比例
|
|
|
private final double DEFAULT_COMMODITY_DISCOUNT = 1; //折扣比例
|
|
|
@@ -142,6 +142,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
tOrder.setBuyerId(TokenManager.getUserId());
|
|
|
tOrder.setSellerId(StringUtils.isBlank(bo.getSellerId()) ? DEFAULT_PLATFORM_ID : bo.getSellerId());
|
|
|
}
|
|
|
+ tOrder.setOrderType(commodityType);
|
|
|
tOrder.setBrokerageAmount(discountPrice.multiply(new BigDecimal(DEFAULT_BROKERAGE_PROPORTION)));
|
|
|
tOrder.setFirstPayment(DEFAULT_FIRST_PAYMENT);
|
|
|
tOrder.setOrderAmount(orderAmount);
|
|
|
@@ -164,6 +165,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
tOrderDetail.setCommodityFirstPayment(commodityFirstPayment);
|
|
|
tOrderDetail.setDiscountPrice(discountPrice);
|
|
|
tOrderDetail.setDiscountFirstPayment(discountFirstPayment);
|
|
|
+ tOrderDetail.setCreateTime(DateUtils.parseDate(createTime, AFTConstants.YYYYMMDDHHMMSS));
|
|
|
tOrderDetailMapper.insert(tOrderDetail);
|
|
|
tOrderMapper.insert(tOrder);
|
|
|
return 1;
|
|
|
@@ -211,8 +213,19 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT,""));
|
|
|
}
|
|
|
int boundary = tOrder.getActuallyFirstPayment().add(changeAmount).compareTo(tOrder.getSignFirstPayment());
|
|
|
- if(boundary == 1){
|
|
|
- throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT,"支付首付款"));
|
|
|
+ int boundary2 = tOrder.getActuallyTotalAmount().add(changeAmount).compareTo(tOrder.getSignTotalAmount());
|
|
|
+ if(boundary2 == 1){
|
|
|
+ throw new BusinessException(new Error(ErrorConstants.PAY_BEYOND_SIGN,"支付首付款"));
|
|
|
+ }else if(boundary2 == 0){ //全付清
|
|
|
+ tOrder.setActuallyTotalAmount(tOrder.getSignTotalAmount());
|
|
|
+ tOrder.setActuallyFirstPayment(tOrder.getSignFirstPayment());
|
|
|
+ tOrder.setLiquidationStatus(LiquidationState.ALREADY_PAY.getCode());
|
|
|
+ tOrder.setProjectStage(ProjectStage.WAIT_SET_UP.getCode());
|
|
|
+ }else if(boundary == 1){ //超过首付未达尾款
|
|
|
+ tOrder.setActuallyTotalAmount(tOrder.getActuallyTotalAmount().add(changeAmount));
|
|
|
+ tOrder.setActuallyFirstPayment(tOrder.getSignFirstPayment());
|
|
|
+ tOrder.setLiquidationStatus(LiquidationState.WAIT_PAY_LAST_BALANCE.getCode());
|
|
|
+ tOrder.setProjectStage(ProjectStage.WAIT_SET_UP.getCode());
|
|
|
}else if(boundary == -1){ //首付待付清
|
|
|
tOrder.setActuallyTotalAmount(tOrder.getActuallyTotalAmount().add(changeAmount));
|
|
|
tOrder.setActuallyFirstPayment(tOrder.getActuallyFirstPayment().add(changeAmount));
|
|
|
@@ -233,7 +246,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
tOrder.setActuallyTotalAmount(tOrder.getActuallyTotalAmount().add(changeAmount));
|
|
|
}else if(boundary == 0){
|
|
|
tOrder.setOrderStatus(OrderState.ALREADY_SIGN.getCode());
|
|
|
- tOrder.setActuallyTotalAmount(tOrder.getActuallyTotalAmount().add(changeAmount));
|
|
|
+ tOrder.setActuallyTotalAmount(tOrder.getSignTotalAmount());
|
|
|
tOrder.setLiquidationStatus(LiquidationState.ALREADY_PAY.getCode());
|
|
|
}
|
|
|
}else if(orderAction == OrderAction.APPLY_FOR_WITHDRAW){ //提现申请
|
|
|
@@ -376,14 +389,12 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
active.setConfirmIntention(false);
|
|
|
active.setRefuseIntention(false);
|
|
|
}
|
|
|
- if (tOrder.getOrderStatus() == OrderState.WAIT_FOR_SIGN.getCode()
|
|
|
- && tOrder.getLiquidationStatus() == LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode()) {
|
|
|
+ if (tOrder.getLiquidationStatus() == LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode()) {
|
|
|
active.setPayForFirst(true); //支付首付
|
|
|
} else {
|
|
|
active.setPayForFirst(false); //支付首付
|
|
|
}
|
|
|
- if (tOrder.getOrderStatus() == OrderState.WAIT_FOR_SIGN.getCode()
|
|
|
- && tOrder.getLiquidationStatus() == LiquidationState.WAIT_PAY_LAST_BALANCE.getCode()) {
|
|
|
+ if (tOrder.getLiquidationStatus() == LiquidationState.WAIT_PAY_LAST_BALANCE.getCode()) {
|
|
|
active.setPayForLast(true); //支付尾款
|
|
|
} else {
|
|
|
active.setPayForLast(false); //支付尾款
|
|
|
@@ -1015,7 +1026,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
.multiply(new BigDecimal(detail.getCommodityQuantity()));
|
|
|
BigDecimal signTotalAmountChange = detail.getDiscountPrice()
|
|
|
.multiply(new BigDecimal(detail.getCommodityQuantity()));
|
|
|
- BigDecimal signFirstPaymentChange = detail.getCommodityFirstPayment()
|
|
|
+ BigDecimal signFirstPaymentChange = detail.getDiscountFirstPayment()
|
|
|
.multiply(new BigDecimal(detail.getCommodityQuantity()));
|
|
|
tOrder.setOrderAmount(tOrder.getOrderAmount().subtract(totalAmountChange));
|
|
|
tOrder.setFirstPayment(tOrder.getFirstPayment().subtract(firstPaymentChange));
|
|
|
@@ -1489,4 +1500,10 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
return DEFAULT_ADMIN_ID;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<BillListBo> selectBillByOrderNo(String orderNo) {
|
|
|
+
|
|
|
+ return tOrderMapper.selectBillByOrderNo(orderNo);
|
|
|
+ }
|
|
|
}
|