退款优化
This commit is contained in:
parent
c10e8da522
commit
e7974b6455
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 预约退款对象 m_reservation_refund
|
||||
|
@ -42,6 +43,15 @@ public class ReservationRefund extends BaseEntity {
|
|||
*/
|
||||
private String refundDesc;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
private BigDecimal orderPrice;
|
||||
|
||||
/**
|
||||
* 实付价格
|
||||
*/
|
||||
private BigDecimal actualPrice;
|
||||
|
||||
/**
|
||||
* 退款状态
|
||||
|
|
|
@ -11,6 +11,8 @@ import lombok.Data;
|
|||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -46,7 +48,7 @@ public class ReservationRefundVo implements Serializable {
|
|||
@ExcelProperty(value = "申请人")
|
||||
private Long userId;
|
||||
|
||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
|
||||
@Translation(type = TransConstant.USER_ID_TO_NAME)
|
||||
@AutoMapping(target = "userId")
|
||||
private Long userPhone;
|
||||
|
||||
|
@ -56,11 +58,22 @@ public class ReservationRefundVo implements Serializable {
|
|||
@ExcelProperty(value = "退款原因")
|
||||
private String refundDesc;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
private BigDecimal orderPrice;
|
||||
|
||||
/**
|
||||
* 实付价格
|
||||
*/
|
||||
private BigDecimal actualPrice;
|
||||
|
||||
/**
|
||||
* 退款状态
|
||||
*/
|
||||
@ExcelProperty(value = "退款状态")
|
||||
private Integer status;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
|
|
|
@ -100,8 +100,10 @@ public class ReservationRefundServiceImpl implements IReservationRefundService {
|
|||
public Boolean insertByBo(ReservationRefundBo bo) {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
ReservationRefund add = MapstructUtils.convert(bo, ReservationRefund.class);
|
||||
ReservationOrder order = validEntityBeforeSave(add);
|
||||
add.setUserId(userId);
|
||||
validEntityBeforeSave(add);
|
||||
add.setOrderPrice(order.getOrderPrice());
|
||||
add.setActualPrice(order.getActualPrice());
|
||||
add.setStatus(0);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
|
@ -176,7 +178,7 @@ public class ReservationRefundServiceImpl implements IReservationRefundService {
|
|||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ReservationRefund entity) {
|
||||
private ReservationOrder validEntityBeforeSave(ReservationRefund entity) {
|
||||
Long orderId = entity.getOrderId();
|
||||
Long userId = entity.getUserId();
|
||||
ReservationOrder order = orderMapper.selectById(orderId);
|
||||
|
@ -196,6 +198,7 @@ public class ReservationRefundServiceImpl implements IReservationRefundService {
|
|||
if (exists) {
|
||||
throw new ServiceException("此订单已提交退款申请,请勿重复提交");
|
||||
}
|
||||
return order;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue