Commit 76c8fee4 by 邹磊浩

Merge remote-tracking branch 'origin/dev' into dev

parents e3b8987c 73a408c6
...@@ -558,13 +558,19 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -558,13 +558,19 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
} }
// 待办买药已接单 代发货下取消订单调用退款接口 // 待办买药已接单 代发货下取消订单调用退款接口
if (totalOrder.getBusinessId() == 5 && totalOrder.getStatus() == 1) { if (totalOrder.getBusinessId() == 5
&& totalOrder.getStatus() == 1
&& sonOrderSimpleDataByTotalId.getOrderStatus() == 1
) {
totalOrderBo.setIsRefund(0); totalOrderBo.setIsRefund(0);
return this.refundOrder(totalOrderBo); return this.refundOrder(totalOrderBo);
} }
// 已接单、待收货状态下等待药品到达后确认 // 已接单、待收货状态下等待药品到达后确认
if (totalOrder.getBusinessId() == 5 && totalOrder.getStatus() == 2) { if (totalOrder.getBusinessId() == 5
&& totalOrder.getStatus() == 2
&& sonOrderSimpleDataByTotalId.getOrderStatus() == 2
&& totalOrder.getRefundAmount() == 0) {
totalOrderBo.setIsRefund(1); totalOrderBo.setIsRefund(1);
return this.refundOrder(totalOrderBo); return this.refundOrder(totalOrderBo);
} }
...@@ -581,7 +587,8 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -581,7 +587,8 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
return this.refundOrder(totalOrderBo); return this.refundOrder(totalOrderBo);
} }
if (sonOrderSimpleDataByTotalId.getOrderStatus() == 0 && totalOrder.getEmId() == 0 && totalOrder.getStatus() == 0) {// 预约陪诊 //用户未付款 陪诊员为接单 和 用户未付款陪诊员已接单直接取消
if ((sonOrderSimpleDataByTotalId.getOrderStatus() == 0 && totalOrder.getStatus() == 0) || (sonOrderSimpleDataByTotalId.getOrderStatus() == 1 && totalOrder.getStatus() == 0)) {
// yypzOrderMapper.selectOne(new LambdaQueryWrapper<YypzOrder>().eq(YypzOrder::getOrderId,totalOrder)); // yypzOrderMapper.selectOne(new LambdaQueryWrapper<YypzOrder>().eq(YypzOrder::getOrderId,totalOrder));
totalOrder.setStatus(TotalOrderStatus.CANCEL.getCode()); totalOrder.setStatus(TotalOrderStatus.CANCEL.getCode());
if(totalOrder.getBusinessId() == 0){ if(totalOrder.getBusinessId() == 0){
...@@ -722,7 +729,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -722,7 +729,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
boolean sonOrderFlag = orderService.switchSonOrderStatus(totalOrder.getId(), CommonOrderStatus.REFUND.getCode()); boolean sonOrderFlag = orderService.switchSonOrderStatus(totalOrder.getId(), CommonOrderStatus.REFUND.getCode());
//除了商城订单和诊前挂号不需要给陪诊员和商户分成 //除了商城订单和诊前挂号不需要给陪诊员和商户分成
if(totalOrder.getBusinessId() != 0 && totalOrder.getBusinessId() != 6){ if(totalOrder.getBusinessId() != 0 && totalOrder.getBusinessId() != 6 && totalOrder.getStatus() == 2) {
Services services = servicesMapper.selectById(totalOrder.getServiceId()); Services services = servicesMapper.selectById(totalOrder.getServiceId());
if(services.getFenmo() != 0){ if(services.getFenmo() != 0){
double money = 0; double money = 0;
...@@ -759,6 +766,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -759,6 +766,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
if (!sonOrderFlag) { if (!sonOrderFlag) {
throw new ServiceException("子订单状态修改出错,接单失败"); throw new ServiceException("子订单状态修改出错,接单失败");
} }
totalOrder.setSuborderStatus(CommonOrderStatus.REFUND.getCode());
if (baseMapper.updateById(totalOrder) > 0) { if (baseMapper.updateById(totalOrder) > 0) {
// 添加退款记录 // 添加退款记录
PaymentRecord paymentRecord = new PaymentRecord(); PaymentRecord paymentRecord = new PaymentRecord();
...@@ -785,11 +793,11 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -785,11 +793,11 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
if (null == sonOrderSimpleDataByTotalId) { if (null == sonOrderSimpleDataByTotalId) {
throw new ServiceException("子订单状态出错!"); throw new ServiceException("子订单状态出错!");
} }
int IsRefund = getIsRefund(totalOrder.getBusinessId(),totalOrder.getStatus(),sonOrderSimpleDataByTotalId.getSonOrderId());
// 订单退款金额 // 订单退款金额
double money = 0; double money = 0;
if (bo.getIsRefund() == 0) {// 陪诊员订单未完成用户主动退款 if (IsRefund == 0) {// 陪诊员订单未完成用户主动退款直接退到账户
// 主订单必须为付款并且子订单为已接单 // 主订单必须为付款并且子订单为已接单
if (totalOrder.getStatus() != 1 && sonOrderSimpleDataByTotalId.getOrderStatus() != 1) { if (totalOrder.getStatus() != 1 && sonOrderSimpleDataByTotalId.getOrderStatus() != 1) {
if(totalOrder.getStatus() == 1 && sonOrderSimpleDataByTotalId.getOrderStatus() == 0){ if(totalOrder.getStatus() == 1 && sonOrderSimpleDataByTotalId.getOrderStatus() == 0){
...@@ -846,7 +854,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -846,7 +854,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
} }
totalOrder.setRefundAmount(money); totalOrder.setRefundAmount(money);
} else if (bo.getIsRefund() == 1) {// 陪诊员订单完成走审批流程 } else if (IsRefund == 1) {// 陪诊员订单完成走审批流程
if (sonOrderSimpleDataByTotalId.getOrderStatus() != 2) { if (sonOrderSimpleDataByTotalId.getOrderStatus() != 2) {
throw new ServiceException("订单状态错误"); throw new ServiceException("订单状态错误");
} }
...@@ -866,7 +874,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -866,7 +874,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
// 修改子订单状态 // 修改子订单状态
boolean sonOrderFlag = orderService.switchSonOrderStatus(totalOrder.getId(), CommonOrderStatus.REFUND.getCode()); boolean sonOrderFlag = orderService.switchSonOrderStatus(totalOrder.getId(), CommonOrderStatus.BEING_REFUND.getCode());
if (!sonOrderFlag) { if (!sonOrderFlag) {
throw new ServiceException("子订单状态修改出错"); throw new ServiceException("子订单状态修改出错");
...@@ -878,6 +886,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -878,6 +886,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
.set(StoreOrder::getStatus, ShopOrderStatus.BEING_REFUND.getCode())); .set(StoreOrder::getStatus, ShopOrderStatus.BEING_REFUND.getCode()));
}*/ }*/
totalOrder.setSuborderStatus(CommonOrderStatus.BEING_REFUND.getCode());
baseMapper.updateById(totalOrder); baseMapper.updateById(totalOrder);
return true; return true;
} }
...@@ -1178,4 +1187,16 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -1178,4 +1187,16 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
} }
return money; return money;
} }
public int getIsRefund(int businessId,int businessStatus,int ServiceStatus){
int IsRefund = 0;
if((businessStatus == 1 && ServiceStatus == 0) || (businessStatus == 1 && ServiceStatus == 1)){
IsRefund = 0;
}else if(businessStatus == 2 && ServiceStatus == 2){
IsRefund = 1;
}else if(businessId == 3 && businessStatus == 1 && ServiceStatus == 2){
IsRefund = 1;
}
return IsRefund;
}
} }
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