退款金额搞起
This commit is contained in:
@@ -60,9 +60,6 @@ public class ServerMessageHandlerAdapter implements MessageService {
|
||||
@Resource
|
||||
private MemberEnterVenueLogService memberEnterVenueLogService;
|
||||
|
||||
@Resource
|
||||
private MemberMoneyLogService memberMoneyLogService;
|
||||
|
||||
@Resource
|
||||
private BarcodeMapper barcodeMapper;
|
||||
|
||||
@@ -139,7 +136,7 @@ public class ServerMessageHandlerAdapter implements MessageService {
|
||||
lastOrder.setLastOut(new Date());
|
||||
// 不需要补交钱且需要退钱
|
||||
if (lastOrder.getPayMoney() > 0) {
|
||||
lastOrder.setPaying(1);
|
||||
// lastOrder.setPaying(1);
|
||||
lastOrder.setModifiedTime(new Date());
|
||||
}
|
||||
barcodeOrderTimeMapper.updateByPrimaryKey(lastOrder);
|
||||
|
||||
@@ -6,8 +6,10 @@ import com.enums.PayTypeEnum;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.sv.dto.api.MemberLessonTicketDetailDTO;
|
||||
import com.sv.dto.api.wechat.BaseResult;
|
||||
import com.sv.entity.BarcodeOrderTime;
|
||||
import com.sv.entity.MemberRefund;
|
||||
import com.sv.entity.Order;
|
||||
import com.sv.mapper.BarcodeOrderTimeMapper;
|
||||
import com.sv.mapper.MemberRefundMapper;
|
||||
import com.sv.service.api.config.WechatPayService;
|
||||
import com.ydd.framework.core.common.Pagination;
|
||||
@@ -45,6 +47,8 @@ public class MemberRefundService extends BaseServiceImpl {
|
||||
private WechatPayService wechatPayService;
|
||||
@Resource
|
||||
private MemberMoneyLogService memberMoneyLogService;
|
||||
@Resource
|
||||
private BarcodeOrderTimeMapper barcodeOrderTimeMapper;
|
||||
|
||||
/**
|
||||
* 创建用户退款记录表
|
||||
@@ -181,7 +185,19 @@ public class MemberRefundService extends BaseServiceImpl {
|
||||
memberRefund.setSuccessTime(time);
|
||||
memberRefundMapper.update(memberRefund);
|
||||
|
||||
// 记录到‘用户账单(余额,微信,会员卡)记录’
|
||||
// 如果是球场订单(更新总退款金额) add by limqsh
|
||||
BarcodeOrderTime barcodeOrderTime = barcodeOrderTimeMapper.selectByPrimaryKey(memberRefund.getLessonId());
|
||||
if (barcodeOrderTime != null) {
|
||||
if (barcodeOrderTime.getOrderSn() != null
|
||||
&& barcodeOrderTime.getOrderSn().equals(memberRefund.getOrderSn())) {
|
||||
barcodeOrderTime.setSumPayMoney(barcodeOrderTime.getSumPayMoney() == null ? 0 : barcodeOrderTime.getSumPayMoney() + memberRefund.getMoney().intValue());
|
||||
barcodeOrderTime.setModifiedTime(new Date());
|
||||
barcodeOrderTimeMapper.updateByPrimaryKey(barcodeOrderTime);
|
||||
}
|
||||
}
|
||||
// 如果是球场订单(更新总退款金额) add by limqsh end
|
||||
|
||||
// 记录到‘用户账单(余额,微信,会员卡)记录’
|
||||
memberMoneyLogService.create(memberRefund.getMemberId(),platformId,MoneyLogEnum.REFUND.value,memberRefund.getMoney(),PayTypeEnum.WEI_XIN.value,
|
||||
null,null,null,memberRefund.getLessonId());
|
||||
}catch (Exception e){
|
||||
|
||||
@@ -183,6 +183,10 @@ public class VenueEnterService extends BaseServiceImpl {
|
||||
// 不需要补交钱且需要退钱
|
||||
lastOrder.setPayMoney(price.abs().intValue());
|
||||
lastOrder.setSumPayMoney(price.abs().intValue());
|
||||
if (lastOrder.getPayMoney() > 0) {
|
||||
lastOrder.setPaying(1);
|
||||
lastOrder.setModifiedTime(new Date());
|
||||
}
|
||||
barcodeOrderTimeMapper.updateByPrimaryKey(lastOrder);
|
||||
result.setFlg(888);
|
||||
result.setMsg("如要继续订单,请在10分钟内进入,否则将结束订单");
|
||||
@@ -338,6 +342,7 @@ public class VenueEnterService extends BaseServiceImpl {
|
||||
}
|
||||
|
||||
public void enterOrderAccount(Integer enterId, Integer payMoney) {
|
||||
logger.info("手动结算【" + enterId + "】,结算金额为:" + payMoney);
|
||||
BarcodeOrderTime barcodeOrder = barcodeOrderTimeMapper.selectByPrimaryKey(enterId);
|
||||
if (barcodeOrder == null) {
|
||||
throw new ServiceException("订单不存在!");
|
||||
@@ -345,7 +350,7 @@ public class VenueEnterService extends BaseServiceImpl {
|
||||
if (1 == barcodeOrder.getPaying()) {
|
||||
throw new ServiceException("订单正在结算,无法结算!");
|
||||
}
|
||||
if (barcodeOrder.getPayMoney() <=0 ) {
|
||||
if (payMoney <=0 ) {
|
||||
throw new ServiceException("退款金额不能为负数!");
|
||||
}
|
||||
String orderSn = barcodeOrder.getOrderSn();
|
||||
@@ -354,12 +359,12 @@ public class VenueEnterService extends BaseServiceImpl {
|
||||
throw new ServiceException("订单多次支付(使用超时),无法进行退款!");
|
||||
}
|
||||
Order baseOrder = orderMapper.findByOrderSn(orderSn);
|
||||
if ((barcodeOrder.getSumPayMoney() + payMoney) > baseOrder.getPrice().intValue()) {
|
||||
if ((barcodeOrder.getSumPayMoney() == null ? 0 : barcodeOrder.getSumPayMoney() + payMoney) > baseOrder.getPrice().intValue()) {
|
||||
throw new ServiceException("退款金额不能超过总支付金额!");
|
||||
}
|
||||
barcodeOrder.setSumPayMoney(barcodeOrder.getSumPayMoney() + payMoney);
|
||||
barcodeOrder.setPaying(1);
|
||||
barcodeOrder.setPayMoney(payMoney); // 此次支付金额
|
||||
logger.info("手动结算【" + enterId + "】,结算金额为:" + payMoney + "成功!");
|
||||
barcodeOrderTimeMapper.updateByPrimaryKey(barcodeOrder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,9 @@ public class BarcodeService extends BaseServiceImpl {
|
||||
BarcodeOrderTime lastEnterOrder = barcodeOrderTimeMapper.findLastOrder(code.getMemberId(), code.getVenueId());
|
||||
barcodeDTO.setEnterId(lastEnterOrder.getId());
|
||||
}
|
||||
logger.info("barcode check used =====" + barcode);
|
||||
logger.info("barcode check used =====" + barcodeDTO.isUsed());
|
||||
logger.info("barcode check used =====" + barcodeDTO.getEnterId());
|
||||
return barcodeDTO;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user