篮球通过微信支付下订单,出场10分钟结束订单,该退钱退钱
This commit is contained in:
@@ -2,12 +2,12 @@ package com.sv.api.controller;
|
||||
|
||||
import com.enums.EnterEnum;
|
||||
import com.enums.PayTypeEnum;
|
||||
import com.sv.api.context.PlatformContext;
|
||||
import com.sv.dto.BasketEnterResult;
|
||||
import com.sv.entity.Device;
|
||||
import com.sv.entity.Order;
|
||||
import com.sv.entity.Venue;
|
||||
import com.sv.service.api.OrderService;
|
||||
import com.sv.service.api.VenueEnterService;
|
||||
import com.sv.service.api.VenueService;
|
||||
import com.sv.service.common.BarcodeService;
|
||||
import com.sv.service.common.DoorLockUtil;
|
||||
@@ -40,6 +40,8 @@ public class VenueController extends BaseApiController {
|
||||
@Resource
|
||||
private VenueService venueService;
|
||||
@Resource
|
||||
private VenueEnterService venueEnterService;
|
||||
@Resource
|
||||
private BarcodeService barcodeService;
|
||||
@Resource
|
||||
private DoorLockUtil doorLockUtil;
|
||||
@@ -112,15 +114,15 @@ public class VenueController extends BaseApiController {
|
||||
OrderService orderService;
|
||||
/**
|
||||
* 判断是否支付成功
|
||||
* @param venueId 场馆Id
|
||||
* @param orderSn 订单号
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/member/isPayed", method = RequestMethod.POST)
|
||||
public ResponseDTO isPayed(@RequestParam("venueId") Integer venueId,String orderSn) {
|
||||
public ResponseDTO isPayed(@RequestParam("orderSn") String orderSn) {
|
||||
Integer memberId = getMemberIdByAccessToken();
|
||||
Order order = orderService.findOrderSn(orderSn, memberId);
|
||||
boolean isPayed = false;
|
||||
if (orderSn != null && order.getPayStatus() != null && PayStatusEnum.PAYED.getValue() == order.getPayStatus()) {
|
||||
if (order != null && order.getPayStatus() != null && PayStatusEnum.PAYED.getValue() == order.getPayStatus()) {
|
||||
isPayed = true;
|
||||
}
|
||||
return ResponseDTO.ok().addAttribute("isPayed", isPayed);
|
||||
@@ -147,7 +149,7 @@ public class VenueController extends BaseApiController {
|
||||
throw new ServiceException("有人正在使用门禁,请稍后再试");
|
||||
}
|
||||
Integer memberId = getMemberIdByAccessToken();
|
||||
join = venueService.join(memberId, venueId);
|
||||
join = venueEnterService.join(memberId, venueId);
|
||||
return ResponseDTO.ok().addAttribute("join", join);
|
||||
}
|
||||
|
||||
@@ -172,7 +174,7 @@ public class VenueController extends BaseApiController {
|
||||
throw new ServiceException("有人正在使用门禁,请稍后再试");
|
||||
}
|
||||
Integer memberId = getMemberIdByAccessToken();
|
||||
out = venueService.out(memberId, venueId);
|
||||
out = venueEnterService.out(memberId, venueId);
|
||||
return ResponseDTO.ok().addAttribute("out", out);
|
||||
}
|
||||
|
||||
@@ -185,11 +187,8 @@ public class VenueController extends BaseApiController {
|
||||
@RequestMapping(value = "/venue/generate/barcode", method = RequestMethod.POST)
|
||||
public ResponseDTO generateBarcode(@RequestParam("orderSn") String orderSn,@RequestParam("venueId") Integer venueId,Integer enterFlag) {
|
||||
Device byDevice = deviceService.findByDevice(venueId);
|
||||
BasketEnterResult join = new BasketEnterResult();
|
||||
if (byDevice == null) {
|
||||
join.setFlg(999);
|
||||
join.setMsg("通讯异常,门禁设备离线中");
|
||||
return ResponseDTO.ok().addAttribute("join", join);
|
||||
throw new ServiceException("门禁通讯异常");
|
||||
}
|
||||
String doorSn = byDevice.getName();
|
||||
boolean lockStat = doorLockUtil.checkDoorLock(doorSn);
|
||||
@@ -206,17 +205,14 @@ public class VenueController extends BaseApiController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 余额充值
|
||||
* 篮球入场下订单
|
||||
*/
|
||||
@RequestMapping(value = "/venue/basketball/pay", method = RequestMethod.POST)
|
||||
@AccessToken
|
||||
public ResponseDTO recharge(@RequestParam("venueId") Integer venueId){
|
||||
public ResponseDTO basketPay(@RequestParam("venueId") Integer venueId,@RequestParam("payMoney") Double payMoney){
|
||||
Device byDevice = deviceService.findByDevice(venueId);
|
||||
BasketEnterResult join = new BasketEnterResult();
|
||||
if (byDevice == null) {
|
||||
join.setFlg(999);
|
||||
join.setMsg("通讯异常,门禁设备离线中");
|
||||
return ResponseDTO.ok().addAttribute("join", join);
|
||||
throw new ServiceException("门禁通讯异常");
|
||||
}
|
||||
String doorSn = byDevice.getName();
|
||||
boolean lockStat = doorLockUtil.checkDoorLock(doorSn);
|
||||
@@ -225,7 +221,7 @@ public class VenueController extends BaseApiController {
|
||||
}
|
||||
Integer memberId = getMemberIdByAccessToken();
|
||||
return ResponseDTO.ok().
|
||||
addAttribute("pay",orderService.createEnterVenueOrder(venueId, memberId, PayTypeEnum.WEI_XIN,new BigDecimal(10)));
|
||||
addAttribute("pay",orderService.createEnterVenueOrder(venueId, memberId, PayTypeEnum.WEI_XIN, new BigDecimal(payMoney)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.enums.EnterEnum;
|
||||
import com.sv.dto.BasketEnterResult;
|
||||
import com.sv.netty.netty.service.MessageService;
|
||||
import com.sv.netty.utils.JsonUtils;
|
||||
import com.sv.service.api.VenueEnterService;
|
||||
import com.sv.service.api.VenueService;
|
||||
import com.sv.service.common.BarcodeService;
|
||||
import com.sv.service.common.DoorLockUtil;
|
||||
@@ -20,7 +21,7 @@ import javax.annotation.Resource;
|
||||
public class VenueJoinTest {
|
||||
|
||||
@Resource
|
||||
VenueService venueService;
|
||||
VenueEnterService venueEnterService;
|
||||
@Resource
|
||||
MessageService messageService;
|
||||
@Resource
|
||||
@@ -30,7 +31,7 @@ public class VenueJoinTest {
|
||||
|
||||
@Test
|
||||
public void testJoin(){
|
||||
BasketEnterResult join = venueService.join(535, 32);
|
||||
BasketEnterResult join = venueEnterService.join(535, 32);
|
||||
System.out.println(JsonUtils.encode(join));
|
||||
if (join.getFlg() == 0) {
|
||||
String barcode = barcodeService.newBarcode("doorSn", "",EnterEnum.ENTER, 32, 535);
|
||||
@@ -46,7 +47,7 @@ public class VenueJoinTest {
|
||||
|
||||
@Test
|
||||
public void testOut(){
|
||||
BasketEnterResult out = venueService.out(535, 32);
|
||||
BasketEnterResult out = venueEnterService.out(535, 32);
|
||||
System.out.println(JsonUtils.encode(out));
|
||||
if (out.getFlg() == 0) {
|
||||
String barcode = barcodeService.newBarcode("doorSn","", EnterEnum.OUT, 32, 535);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class WxServiceTest {
|
||||
public void refund(){
|
||||
// wechatPayService.createUnifiedOrder("testlmq20231224",new BigDecimal(0.02),"127.0.0.1","JSAPI", 535);
|
||||
// 根据orderSn查出对应订单信息
|
||||
String orderSn = "231228000925924610";
|
||||
String orderSn = "231231014749545739";
|
||||
Integer memberId = 535;
|
||||
Order order = orderService.findOrderSn(orderSn,memberId);
|
||||
if (order == null){
|
||||
|
||||
Reference in New Issue
Block a user