release-20260330 - 修改为手机开门,不扫码。
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package com.sv.oms.controller;
|
||||
import com.sv.entity.MemberEnterVenueLog;
|
||||
import com.sv.exception.oms.OmsException;
|
||||
import com.sv.service.api.VenueEnterService;
|
||||
import com.sv.service.oms.MemberEnterVenueLogService;
|
||||
import com.ydd.framework.core.common.Pagination;
|
||||
import com.ydd.framework.core.common.dto.ResponseDTO;
|
||||
import com.ydd.framework.core.exception.ServiceException;
|
||||
import com.ydd.oms.controller.OmsController;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -84,8 +86,14 @@ public class MemberEnterVeneuLogController extends OmsController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/member/enter/veneu/account", method = RequestMethod.POST)
|
||||
public ResponseDTO enterOrderAccount(@RequestParam("EnterId") Integer enterId,@RequestParam("payMoney") Integer payMoney) {
|
||||
venueEnterService.enterOrderAccount(enterId,payMoney);
|
||||
public ResponseDTO enterOrderAccount(@RequestParam("EnterId") Integer enterId,@RequestParam("payMoney") java.math.BigDecimal payMoney) {
|
||||
try {
|
||||
venueEnterService.enterOrderAccount(enterId,payMoney);
|
||||
}catch (Exception e) {
|
||||
if (e instanceof ServiceException) {
|
||||
throw new OmsException(e.getMessage());
|
||||
}
|
||||
}
|
||||
return ResponseDTO.ok("结算成功");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.sv.mapper.OrderMapper;
|
||||
import com.sv.service.api.config.WechatPayService;
|
||||
import com.sv.service.api.util.DateUtilCard;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -41,7 +42,7 @@ public class BarcodeTimeOrderTask {
|
||||
@Resource
|
||||
WechatPayService wechatPayService;
|
||||
|
||||
@Scheduled(cron = "0 0/5 * * * ?")
|
||||
@Scheduled(cron = "0 0/8 * * * ?")
|
||||
public void execute(){
|
||||
logger.error("执行BarcodeTimeOrderTask.execute");
|
||||
Date date = new Date();
|
||||
@@ -56,15 +57,15 @@ public class BarcodeTimeOrderTask {
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0/2 * * * ?")
|
||||
@Scheduled(cron = "0 0/5 * * * ?")
|
||||
public void refundOrder(){
|
||||
logger.error("执行BarcodeTimeOrderTask.refundOrder");
|
||||
List<BarcodeOrderTime> barcodeOrderTimes = barcodeOrderTimeMapper.needPayOrderList();
|
||||
if (barcodeOrderTimes != null && barcodeOrderTimes.size() > 0){
|
||||
Date date = new Date();
|
||||
for (BarcodeOrderTime barcodeOrderTime : barcodeOrderTimes) {
|
||||
boolean isHourlyRefund = barcodeOrderTime.getPayMoney() != null && barcodeOrderTime.getPayMoney() > 0;
|
||||
|
||||
boolean isHourlyRefund = barcodeOrderTime.getPayMoney() != null && barcodeOrderTime.getPayMoney().compareTo(BigDecimal.ZERO) > 0;
|
||||
|
||||
if (!isHourlyRefund) {
|
||||
// 按次计费:10分钟宽限期
|
||||
int minutes = DateUtilCard.diffMinute(barcodeOrderTime.getModifiedTime(), date);
|
||||
@@ -72,29 +73,35 @@ public class BarcodeTimeOrderTask {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 关闭订单
|
||||
barcodeOrderTime.setPaying(0);
|
||||
barcodeOrderTime.setModifiedTime(date);
|
||||
barcodeOrderTime.setStatus(BarCodeStatusEnum.USED.getValue());
|
||||
barcodeOrderTimeMapper.updateByPrimaryKey(barcodeOrderTime);
|
||||
|
||||
|
||||
// 按时计费退款
|
||||
if (isHourlyRefund) {
|
||||
// 如果有补费订单号,跳过退款(与管理员退费逻辑一致)
|
||||
if (!StringUtils.isEmpty(barcodeOrderTime.getOrderAddSn())) {
|
||||
logger.info("用户" + barcodeOrderTime.getMemberId() + "的订单有补费记录,跳过退款");
|
||||
continue;
|
||||
}
|
||||
Order order = orderMapper.findOrderSn(barcodeOrderTime.getOrderSn(), barcodeOrderTime.getMemberId());
|
||||
if (order != null) {
|
||||
logger.info("用户" + barcodeOrderTime.getMemberId() + "的订单" + barcodeOrderTime.getOrderSn() + "需要退款" + barcodeOrderTime.getPayMoney());
|
||||
BigDecimal refundAmount = barcodeOrderTime.getPayMoney();
|
||||
logger.info("用户" + barcodeOrderTime.getMemberId() + "的订单" + barcodeOrderTime.getOrderSn() + "需要退款" + refundAmount + "元");
|
||||
MemberRefund memberRefund = new MemberRefund();
|
||||
memberRefund.setMemberId(barcodeOrderTime.getMemberId());
|
||||
memberRefund.setLessonId(barcodeOrderTime.getId());
|
||||
memberRefund.setMoney(order.getPrice());
|
||||
memberRefund.setMoney(refundAmount);
|
||||
memberRefund.setOrderSn(barcodeOrderTime.getOrderSn());
|
||||
memberRefund.setTransactionId(order.getTradeSn());
|
||||
memberRefund.setOrderId(order.getId());
|
||||
memberRefund.setOutRefundNo(createSn());
|
||||
memberRefund.setPlatformId(1);
|
||||
memberRefundMapper.insert(memberRefund);
|
||||
wechatPayService.refundInputMoney(memberRefund,new BigDecimal(barcodeOrderTime.getPayMoney()));
|
||||
wechatPayService.refundInputMoney(memberRefund, order.getPrice(), refundAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user