Commit 3dadccd1 authored by 周健威's avatar 周健威

修改退还第一部分押金

parent 9791657e
...@@ -4,7 +4,10 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,7 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.IntervalUtil; import com.github.wxiaoqi.security.common.util.IntervalUtil;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.order.biz.inner.OrderMsgBiz; import com.xxfc.platform.order.biz.inner.OrderMsgBiz;
import com.xxfc.platform.order.contant.enumerate.*; import com.xxfc.platform.order.contant.enumerate.*;
import com.xxfc.platform.order.entity.*; import com.xxfc.platform.order.entity.*;
...@@ -14,6 +17,7 @@ import com.xxfc.platform.universal.constant.DictionaryKey; ...@@ -14,6 +17,7 @@ import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary; import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign; import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.universal.vo.OrderRefundVo; import com.xxfc.platform.universal.vo.OrderRefundVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.jexl2.MapContext; import org.apache.commons.jexl2.MapContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -23,6 +27,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -23,6 +27,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
...@@ -39,6 +44,7 @@ import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER; ...@@ -39,6 +44,7 @@ import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
* @date 2019-06-18 11:08:09 * @date 2019-06-18 11:08:09
*/ */
@Service @Service
@Slf4j
public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
@Autowired @Autowired
ThirdFeign thirdFeign; ThirdFeign thirdFeign;
...@@ -61,6 +67,9 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { ...@@ -61,6 +67,9 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
@Autowired @Autowired
UserFeign userFeign; UserFeign userFeign;
@Autowired
OrderDepositRefundRecordBiz orderDepositRefundRecordBiz;
/** /**
* 退还部分押金 * 退还部分押金
* @param orderMQDTO * @param orderMQDTO
...@@ -72,16 +81,25 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { ...@@ -72,16 +81,25 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
//未退还, 进行挂起保留违章预备金 的退还 //未退还, 进行挂起保留违章预备金 的退还
if(RefundStatusEnum.NONE.getCode().equals(orderMQDTO.getRefundStatus())) { if(RefundStatusEnum.NONE.getCode().equals(orderMQDTO.getRefundStatus())) {
Integer crosstownTypeEnum; Integer crosstownTypeEnum;
Integer depositRefundRecordStatus;
//判断是否定损过 //判断是否定损过
if(SYS_TRUE.equals(orderMQDTO.getOrderRentVehicleDetail().getFixedLossStatus())) { if(SYS_TRUE.equals(orderMQDTO.getOrderRentVehicleDetail().getFixedLossStatus())) {
crosstownTypeEnum = CrosstownTypeEnum.FIXED_LOSS.getCode(); crosstownTypeEnum = CrosstownTypeEnum.FIXED_LOSS.getCode();
depositRefundRecordStatus = DepositRefundStatus.FIXLOSSREFUND.getCode();
}else { }else {
crosstownTypeEnum = CrosstownTypeEnum.ARRIVE.getCode(); crosstownTypeEnum = CrosstownTypeEnum.ARRIVE.getCode();
depositRefundRecordStatus = DepositRefundStatus.REFUNDARRIVAL.getCode();
} }
OrderVehicleCrosstown crosstown = crosstownBiz.selectOne(new OrderVehicleCrosstown(){{ OrderVehicleCrosstown crosstown = crosstownBiz.selectOne(new OrderVehicleCrosstown(){{
setOrderId(orderMQDTO.getId()); setOrderId(orderMQDTO.getId());
setType(crosstownTypeEnum); setType(crosstownTypeEnum);
}}); }});
if(null == crosstown) {
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, new HashSet<String>(){{
add("退款第一部分押金失败,获取不了还车/定损记录,订单号:"+ orderMQDTO.getId());
}});
}
//还车扣除款 剩余的 钱,再减去违章预备金 //还车扣除款 剩余的 钱,再减去违章预备金
BigDecimal refundAmont = crosstown.getRestDeposit().subtract(illegalReserve); BigDecimal refundAmont = crosstown.getRestDeposit().subtract(illegalReserve);
BigDecimal originalRefundAmount = crosstown.getRestDeposit().add(crosstown.getDeductionCost()).subtract(illegalReserve); BigDecimal originalRefundAmount = crosstown.getRestDeposit().add(crosstown.getDeductionCost()).subtract(illegalReserve);
...@@ -93,6 +111,10 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { ...@@ -93,6 +111,10 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
refundDesc += ")"; refundDesc += ")";
refundTrigger(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), illegalReserve, originalRefundAmount, refundAmont, refundDesc, RefundStatusEnum.RESIDUE_ILLEGAL.getCode(), RefundTypeEnum.PART_DEPOSIT); refundTrigger(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), illegalReserve, originalRefundAmount, refundAmont, refundDesc, RefundStatusEnum.RESIDUE_ILLEGAL.getCode(), RefundTypeEnum.PART_DEPOSIT);
DepositRefundRecord depositRefundRecord = orderDepositRefundRecordBiz.findByCrossIdAndStatus(crosstown.getId(), depositRefundRecordStatus);
depositRefundRecord.setIscomplete(Boolean.TRUE);
orderDepositRefundRecordBiz.updateSelectiveById(depositRefundRecord);
orderMsgBiz.handelMsgDeposit(orderMQDTO.getOrderRentVehicleDetail(), orderMQDTO, userFeign.userDetailById(orderMQDTO.getUserId()).getData()); orderMsgBiz.handelMsgDeposit(orderMQDTO.getOrderRentVehicleDetail(), orderMQDTO, userFeign.userDetailById(orderMQDTO.getUserId()).getData());
} }
// else { // else {
...@@ -220,7 +242,11 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { ...@@ -220,7 +242,11 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
orv.setOrderNo(baseOrder.getNo()); orv.setOrderNo(baseOrder.getNo());
orv.setRefundDesc(refundDesc+ refundAmount.toString()); orv.setRefundDesc(refundDesc+ refundAmount.toString());
orv.setRefundAmount(refundAmount.multiply(new BigDecimal("100")).intValue()); orv.setRefundAmount(refundAmount.multiply(new BigDecimal("100")).intValue());
refundTradeNo = thirdFeign.refund(orv).getData(); ObjectRestResponse<String> result = thirdFeign.refund(orv);
refundTradeNo = result.getData();
if(null == refundTradeNo) {
log.error("退款没有refundTradeNo,订单号为:"+ baseOrder.getNo()+ ", 微服务调用结果为"+ JSONUtil.toJsonStr(result));
}
} }
//记录订单退款记录 //记录订单退款记录
......
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