增加 判断是否支付成功的检验逻辑 member/isPayed
This commit is contained in:
@@ -3,8 +3,10 @@ package com.sv.api.controller;
|
|||||||
import com.enums.EnterEnum;
|
import com.enums.EnterEnum;
|
||||||
import com.sv.dto.BarCodeResult;
|
import com.sv.dto.BarCodeResult;
|
||||||
import com.sv.entity.Device;
|
import com.sv.entity.Device;
|
||||||
|
import com.sv.entity.Order;
|
||||||
import com.sv.entity.Venue;
|
import com.sv.entity.Venue;
|
||||||
import com.sv.mapper.BarcodeMapper;
|
import com.sv.mapper.BarcodeMapper;
|
||||||
|
import com.sv.service.api.OrderService;
|
||||||
import com.sv.service.api.VenueService;
|
import com.sv.service.api.VenueService;
|
||||||
import com.sv.service.common.BarcodeService;
|
import com.sv.service.common.BarcodeService;
|
||||||
import com.sv.service.common.DoorLockUtil;
|
import com.sv.service.common.DoorLockUtil;
|
||||||
@@ -13,6 +15,7 @@ import com.ydd.framework.core.common.Pagination;
|
|||||||
import com.ydd.framework.core.common.dto.ResponseDTO;
|
import com.ydd.framework.core.common.dto.ResponseDTO;
|
||||||
import com.ydd.framework.core.controller.BaseApiController;
|
import com.ydd.framework.core.controller.BaseApiController;
|
||||||
import com.ydd.framework.core.exception.ServiceException;
|
import com.ydd.framework.core.exception.ServiceException;
|
||||||
|
import com.ydd.oms.entity.enums.PayStatusEnum;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -100,9 +103,24 @@ public class VenueController extends BaseApiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
DeviceService deviceService;
|
OrderService orderService;
|
||||||
|
/**
|
||||||
|
* 判断是否支付成功
|
||||||
|
* @param venueId 场馆Id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/member/isPayed", method = RequestMethod.POST)
|
||||||
|
public ResponseDTO isPayed(@RequestParam("venueId") Integer venueId) {
|
||||||
|
Order orderSn = orderService.findOrderSn("230801205026443583", 535);
|
||||||
|
boolean isPayed = false;
|
||||||
|
if (orderSn != null && orderSn.getPayStatus() != null && PayStatusEnum.PAYED.getValue() == orderSn.getPayStatus()) {
|
||||||
|
isPayed = true;
|
||||||
|
}
|
||||||
|
return ResponseDTO.ok().addAttribute("isPayed", isPayed);
|
||||||
|
}
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
BarcodeMapper barcodeMapper;
|
DeviceService deviceService;
|
||||||
/**
|
/**
|
||||||
* 我要进场
|
* 我要进场
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,15 +10,15 @@ public enum PayStatusEnum {
|
|||||||
|
|
||||||
NOT_PAY(0, "未支付"), PAYED(1, "已支付");
|
NOT_PAY(0, "未支付"), PAYED(1, "已支付");
|
||||||
|
|
||||||
public Byte value;
|
public Integer value;
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
PayStatusEnum(Integer value, String name) {
|
PayStatusEnum(Integer value, String name) {
|
||||||
this.value = value.byteValue();
|
this.value = value;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Byte getValue() {
|
public Integer getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import com.sv.service.api.config.WechatPayService;
|
|||||||
import com.ydd.framework.core.common.Pagination;
|
import com.ydd.framework.core.common.Pagination;
|
||||||
import com.ydd.framework.core.exception.ServiceException;
|
import com.ydd.framework.core.exception.ServiceException;
|
||||||
import com.ydd.framework.core.service.impl.BaseServiceImpl;
|
import com.ydd.framework.core.service.impl.BaseServiceImpl;
|
||||||
import com.ydd.oms.entity.enums.PayStatusEnum;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|||||||
@@ -168,13 +168,6 @@ public class OrderService extends BaseServiceImpl {
|
|||||||
orderMapper.updatePrepayId(orderSn,prepayId);
|
orderMapper.updatePrepayId(orderSn,prepayId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* api
|
|
||||||
*/
|
|
||||||
public Order findByOrderSn(String orderSn, Integer memberId) {
|
|
||||||
return orderMapper.findOrderSn(orderSn, memberId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* api 支付成功
|
* api 支付成功
|
||||||
*
|
*
|
||||||
@@ -259,7 +252,7 @@ public class OrderService extends BaseServiceImpl {
|
|||||||
order.setPayType(payTypeEnum.value);
|
order.setPayType(payTypeEnum.value);
|
||||||
order.setPrice(price);
|
order.setPrice(price);
|
||||||
order.setPayTime(new Date());
|
order.setPayTime(new Date());
|
||||||
order.setPayStatus(PayStatusEnum.PAYED.value.intValue());
|
order.setPayStatus(PayStatusEnum.PAYED.value);
|
||||||
order.setType(OrderTypeEnum.BASKETBALL_ORDER.value);
|
order.setType(OrderTypeEnum.BASKETBALL_ORDER.value);
|
||||||
order.setPlatformId(venue.getPlatformId());
|
order.setPlatformId(venue.getPlatformId());
|
||||||
order.setMemberId(memberId);
|
order.setMemberId(memberId);
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ public class WechatPayService extends BaseServiceImpl {
|
|||||||
if (params.get("return_code").equals("SUCCESS")) {
|
if (params.get("return_code").equals("SUCCESS")) {
|
||||||
if (params.get("result_code").equals("SUCCESS")) {
|
if (params.get("result_code").equals("SUCCESS")) {
|
||||||
String orderSn = params.get("out_trade_no");
|
String orderSn = params.get("out_trade_no");
|
||||||
Order order = orderService.findByOrderSn(orderSn,null);
|
Order order = orderService.findOrderSn(orderSn,null);
|
||||||
if (order.getPayStatus().intValue() > 0) {
|
if (order.getPayStatus().intValue() > 0) {
|
||||||
//已支付 不需要在判断
|
//已支付 不需要在判断
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user