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> { ...@@ -78,6 +78,9 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
@Autowired @Autowired
OrderCalculateBiz orderCalculateBiz; OrderCalculateBiz orderCalculateBiz;
@Autowired
OrderViolationBiz orderViolationBiz;
@Autowired @Autowired
ThirdFeign thirdFeign; ThirdFeign thirdFeign;
...@@ -601,6 +604,34 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -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 { ...@@ -103,33 +103,7 @@ public class RentDepositJobHandler extends IJobHandler {
}}); }});
if(crosstown.getCrtTime().compareTo(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60L * 1000L)) < 0) { if(crosstown.getCrtTime().compareTo(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60L * 1000L)) < 0) {
OrderViolation orderViolation = orderViolationBiz.selectOne(new OrderViolation(){{ orderAccountBiz.handleRentDepositMargin(baseOrder, orvd, crosstown);
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());
} }
} }
......
...@@ -24,6 +24,7 @@ import com.xxfc.platform.order.entity.*; ...@@ -24,6 +24,7 @@ import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mqhandler.RabbitProduct; import com.xxfc.platform.order.mqhandler.RabbitProduct;
import com.xxfc.platform.order.pojo.account.OrderAccountDeduction; import com.xxfc.platform.order.pojo.account.OrderAccountDeduction;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail; 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.CancelOrderDTO;
import com.xxfc.platform.order.pojo.order.OrderAboutParamDTO; import com.xxfc.platform.order.pojo.order.OrderAboutParamDTO;
import com.xxfc.platform.order.pojo.order.OrderPageVO; import com.xxfc.platform.order.pojo.order.OrderPageVO;
...@@ -407,6 +408,9 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -407,6 +408,9 @@ public class BaseOrderController extends CommonBaseController implements UserRes
@IgnoreClientToken @IgnoreClientToken
@IgnoreUserToken @IgnoreUserToken
public ObjectRestResponse refundDepositAmount(@PathVariable("no") String no) { public ObjectRestResponse refundDepositAmount(@PathVariable("no") String no) {
if(StrUtil.isBlank(no)) {
return ObjectRestResponse.createDefaultFail();
}
BaseOrder baseOrder = baseOrderBiz.selectOne(new BaseOrder(){{ BaseOrder baseOrder = baseOrderBiz.selectOne(new BaseOrder(){{
setNo(no); setNo(no);
}}); }});
...@@ -427,35 +431,41 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -427,35 +431,41 @@ public class BaseOrderController extends CommonBaseController implements UserRes
setType(crosstownTypeEnum); setType(crosstownTypeEnum);
}}); }});
OrderViolation orderViolation = orderViolationBiz.selectOne(new OrderViolation(){{ orderAccountBiz.handleRentDepositMargin(baseOrder, orvd, crosstown);
setDetailId(orvd.getId());
setIsDel(SYS_FALSE); 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 = "退还违章押金:"; //获取item
BigDecimal refundAmont; orderMQDTO.setItems(orderItemBiz.selectList(new OrderItem() {{
if(null != orderViolation) { setOrderId(baseOrder.getId());
//设置扣款项 }}));
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()); if(OrderTypeEnum.RENT_VEHICLE.getCode().equals(orderMQDTO.getType())) {
refundDesc += refundAmont.toString(); orderAccountBiz.refundPartDeposit(orderMQDTO);
}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());
return ObjectRestResponse.succ(); 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