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

Merge branch 'master-zjw' into dev

parents 69dbbab7 3b747bfc
......@@ -78,6 +78,9 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
@Autowired
OrderCalculateBiz orderCalculateBiz;
@Autowired
OrderViolationBiz orderViolationBiz;
@Autowired
ThirdFeign thirdFeign;
......@@ -601,6 +604,34 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
}
public void handleRentDepositMargin(BaseOrder baseOrder, OrderRentVehicleDetail orvd, OrderVehicleCrosstown crosstown) {
OrderViolation orderViolation = orderViolationBiz.selectOne(new OrderViolation(){{
setDetailId(orvd.getId());
setIsDel(SYS_FALSE);
}});
OrderAccountDetail oad = new OrderAccountDetail();
String refundDesc = "退还违章押金:";
BigDecimal refundAmont;
if(null != orderViolation) {
//设置扣款项
oad.getDeductions().add(
initDeduction(orderViolation.getPrice(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT.getDesc(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT, OrderAccountDeduction.ORIGIN_DEPOSIT)
);
//还车扣除款 剩余的 钱,再减去违章预备金
refundAmont = orvd.getReturnPayResidue().subtract(orderViolation.getPrice());
refundDesc += refundAmont.toString();
}else {
refundAmont = orvd.getReturnPayResidue();
refundDesc += refundAmont.toString();
}
oad.setOriginDepositAmount(orvd.getReturnPayResidue());
oad.setDepositAmount(refundAmont);
refundTrigger(baseOrder, orvd, BigDecimal.ZERO, orvd.getReturnPayResidue(), refundAmont, refundDesc, RefundStatusEnum.REFUND_DEPOSIT.getCode(), AccountTypeEnum.OUT_RESIDUE_DEPOSIT, oad);
orderDepositRefundRecordBiz.completeRecordStatus(crosstown.getId(), DepositRefundStatus.VIOLATIONARRIVAL);
orderMsgBiz.handelMsgDeposit(orvd, baseOrder, userFeign.userDetailById(baseOrder.getUserId()).getData());
}
}
\ No newline at end of file
......@@ -103,33 +103,7 @@ public class RentDepositJobHandler extends IJobHandler {
}});
if(crosstown.getCrtTime().compareTo(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60L * 1000L)) < 0) {
OrderViolation orderViolation = orderViolationBiz.selectOne(new OrderViolation(){{
setDetailId(orvd.getId());
setIsDel(SYS_FALSE);
}});
OrderAccountDetail oad = new OrderAccountDetail();
String refundDesc = "退还违章押金:";
BigDecimal refundAmont;
if(null != orderViolation) {
//设置扣款项
oad.getDeductions().add(
orderAccountBiz.initDeduction(orderViolation.getPrice(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT.getDesc(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT, OrderAccountDeduction.ORIGIN_DEPOSIT)
);
//还车扣除款 剩余的 钱,再减去违章预备金
refundAmont = orvd.getReturnPayResidue().subtract(orderViolation.getPrice());
refundDesc += refundAmont.toString();
}else {
refundAmont = orvd.getReturnPayResidue();
refundDesc += refundAmont.toString();
}
oad.setOriginDepositAmount(orvd.getReturnPayResidue());
oad.setDepositAmount(refundAmont);
orderAccountBiz.refundTrigger(baseOrder, orvd, BigDecimal.ZERO, orvd.getReturnPayResidue(), refundAmont, refundDesc, RefundStatusEnum.REFUND_DEPOSIT.getCode(), AccountTypeEnum.OUT_RESIDUE_DEPOSIT, oad);
orderDepositRefundRecordBiz.completeRecordStatus(crosstown.getId(), DepositRefundStatus.VIOLATIONARRIVAL);
orderMsgBiz.handelMsgDeposit(orvd, baseOrder, userFeign.userDetailById(baseOrder.getUserId()).getData());
orderAccountBiz.handleRentDepositMargin(baseOrder, orvd, crosstown);
}
}
......
......@@ -24,6 +24,7 @@ import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mqhandler.RabbitProduct;
import com.xxfc.platform.order.pojo.account.OrderAccountDeduction;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.order.pojo.order.CancelOrderDTO;
import com.xxfc.platform.order.pojo.order.OrderAboutParamDTO;
import com.xxfc.platform.order.pojo.order.OrderPageVO;
......@@ -407,6 +408,9 @@ public class BaseOrderController extends CommonBaseController implements UserRes
@IgnoreClientToken
@IgnoreUserToken
public ObjectRestResponse refundDepositAmount(@PathVariable("no") String no) {
if(StrUtil.isBlank(no)) {
return ObjectRestResponse.createDefaultFail();
}
BaseOrder baseOrder = baseOrderBiz.selectOne(new BaseOrder(){{
setNo(no);
}});
......@@ -427,35 +431,41 @@ public class BaseOrderController extends CommonBaseController implements UserRes
setType(crosstownTypeEnum);
}});
OrderViolation orderViolation = orderViolationBiz.selectOne(new OrderViolation(){{
setDetailId(orvd.getId());
setIsDel(SYS_FALSE);
}});
orderAccountBiz.handleRentDepositMargin(baseOrder, orvd, crosstown);
return ObjectRestResponse.succ();
}
OrderAccountDetail oad = new OrderAccountDetail();
@RequestMapping(value = "/app/unauth/refundPartDeposit/{no}", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "退款第一部分证金")
@IgnoreClientToken
@IgnoreUserToken
public ObjectRestResponse refundPartDepositAmount(@PathVariable("no") String no) {
if(StrUtil.isBlank(no)) {
return ObjectRestResponse.createDefaultFail();
}
BaseOrder baseOrder = baseOrderBiz.selectOne(new BaseOrder(){{
setNo(no);
}});
//发送队列消息
OrderMQDTO orderMQDTO = BeanUtil.toBean(baseOrder, OrderMQDTO.class);
orderMQDTO.setOrderRentVehicleDetail(orderRentVehicleBiz.selectOne(new OrderRentVehicleDetail(){{
setOrderId(baseOrder.getId());
}}));
orderMQDTO.setOrderTourDetail(new OrderTourDetail());
orderMQDTO.setOrderMemberDetail(new OrderMemberDetail());
String refundDesc = "退还违章押金:";
BigDecimal refundAmont;
if(null != orderViolation) {
//设置扣款项
oad.getDeductions().add(
orderAccountBiz.initDeduction(orderViolation.getPrice(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT.getDesc(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT, OrderAccountDeduction.ORIGIN_DEPOSIT)
);
//获取item
orderMQDTO.setItems(orderItemBiz.selectList(new OrderItem() {{
setOrderId(baseOrder.getId());
}}));
//还车扣除款 剩余的 钱,再减去违章预备金
refundAmont = orvd.getReturnPayResidue().subtract(orderViolation.getPrice());
refundDesc += refundAmont.toString();
}else {
refundAmont = orvd.getReturnPayResidue();
refundDesc += refundAmont.toString();
//租车订单完成
if(OrderTypeEnum.RENT_VEHICLE.getCode().equals(orderMQDTO.getType())) {
orderAccountBiz.refundPartDeposit(orderMQDTO);
}
oad.setOriginDepositAmount(orvd.getReturnPayResidue());
oad.setDepositAmount(refundAmont);
orderAccountBiz.refundTrigger(baseOrder, orvd, BigDecimal.ZERO, orvd.getReturnPayResidue(), refundAmont, refundDesc, RefundStatusEnum.REFUND_DEPOSIT.getCode(), AccountTypeEnum.OUT_RESIDUE_DEPOSIT, oad);
orderDepositRefundRecordBiz.completeRecordStatus(crosstown.getId(), DepositRefundStatus.VIOLATIONARRIVAL);
orderMsgBiz.handelMsgDeposit(orvd, baseOrder, userFeign.userDetailById(baseOrder.getUserId()).getData());
return ObjectRestResponse.succ();
}
}
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