This commit is contained in:
parent
b5caf5fb15
commit
81bc8da7b9
|
@ -42,7 +42,7 @@ public class ReservationRefundServiceImpl implements IReservationRefundService {
|
||||||
* @return 预约退款
|
* @return 预约退款
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ReservationRefundVo queryById(Long id){
|
public ReservationRefundVo queryById(Long id) {
|
||||||
return baseMapper.selectVoById(id);
|
return baseMapper.selectVoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,28 +111,33 @@ public class ReservationRefundServiceImpl implements IReservationRefundService {
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateByBo(ReservationRefundBo bo) {
|
public Boolean updateByBo(ReservationRefundBo bo) {
|
||||||
ReservationRefund update = MapstructUtils.convert(bo, ReservationRefund.class);
|
ReservationRefund update = MapstructUtils.convert(bo, ReservationRefund.class);
|
||||||
validEntityBeforeSave(update);
|
//validEntityBeforeSave(update);
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存前的数据校验
|
* 保存前的数据校验
|
||||||
*/
|
*/
|
||||||
private void validEntityBeforeSave(ReservationRefund entity){
|
private void validEntityBeforeSave(ReservationRefund entity) {
|
||||||
Long orderId = entity.getOrderId();
|
Long orderId = entity.getOrderId();
|
||||||
Long userId = entity.getUserId();
|
Long userId = entity.getUserId();
|
||||||
ReservationOrder order = orderMapper.selectById(orderId);
|
ReservationOrder order = orderMapper.selectById(orderId);
|
||||||
if(order == null){
|
if (order == null) {
|
||||||
throw new ServiceException("查无订单,请确认后重试");
|
throw new ServiceException("查无订单,请确认后重试");
|
||||||
}
|
}
|
||||||
Long createBy = order.getCreateBy();
|
Long createBy = order.getCreateBy();
|
||||||
if(!createBy.equals(userId)){
|
if (!createBy.equals(userId)) {
|
||||||
throw new ServiceException("订单数据异常,请确认后重试");
|
throw new ServiceException("订单数据异常,请确认后重试");
|
||||||
}
|
}
|
||||||
Integer orderStatus = order.getOrderStatus();
|
Integer orderStatus = order.getOrderStatus();
|
||||||
if (orderStatus != 1) {
|
if (orderStatus != 1) {
|
||||||
throw new ServiceException("订单数据异常,请确认后重试");
|
throw new ServiceException("订单数据异常,请确认后重试");
|
||||||
}
|
}
|
||||||
|
boolean exists = baseMapper.exists(new LambdaQueryWrapper<ReservationRefund>()
|
||||||
|
.eq(ReservationRefund::getOrderId, orderId));
|
||||||
|
if (exists) {
|
||||||
|
throw new ServiceException("此订单已提交退款申请,请勿重复提交");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue