修改篮球入场支付方式
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
package com.sv.api.controller;
|
||||
|
||||
import com.enums.EnterEnum;
|
||||
import com.sv.dto.BarCodeResult;
|
||||
import com.sv.dto.BasketEnterResult;
|
||||
import com.sv.entity.Device;
|
||||
import com.sv.entity.Order;
|
||||
import com.sv.entity.Venue;
|
||||
import com.sv.mapper.BarcodeMapper;
|
||||
import com.sv.service.api.OrderService;
|
||||
import com.sv.service.api.VenueService;
|
||||
import com.sv.service.common.BarcodeService;
|
||||
@@ -39,6 +38,8 @@ public class VenueController extends BaseApiController {
|
||||
private BarcodeService barcodeService;
|
||||
@Resource
|
||||
private DoorLockUtil doorLockUtil;
|
||||
@Resource
|
||||
DeviceService deviceService;
|
||||
|
||||
/**
|
||||
* 分页查询场馆列表
|
||||
@@ -119,8 +120,6 @@ public class VenueController extends BaseApiController {
|
||||
return ResponseDTO.ok().addAttribute("isPayed", isPayed);
|
||||
}
|
||||
|
||||
@Resource
|
||||
DeviceService deviceService;
|
||||
/**
|
||||
* 我要进场
|
||||
*
|
||||
@@ -130,7 +129,7 @@ public class VenueController extends BaseApiController {
|
||||
@RequestMapping(value = "/venue/join", method = RequestMethod.GET)
|
||||
public ResponseDTO join(@RequestParam("venueId") Integer venueId) {
|
||||
Device byDevice = deviceService.findByDevice(venueId);
|
||||
BarCodeResult join = new BarCodeResult();
|
||||
BasketEnterResult join = new BasketEnterResult();
|
||||
if (byDevice == null) {
|
||||
join.setFlg(999);
|
||||
join.setMsg("通讯异常,门禁设备离线中");
|
||||
@@ -143,11 +142,6 @@ public class VenueController extends BaseApiController {
|
||||
}
|
||||
Integer memberId = getMemberIdByAccessToken();
|
||||
join = venueService.join(memberId, venueId);
|
||||
if (join.getFlg() == 0) {
|
||||
String barcode = barcodeService.newBarcode(doorSn, EnterEnum.ENTER, venueId, memberId);
|
||||
join.setBarcode(barcode);
|
||||
// doorLockUtil.lockDoor(doorSn);
|
||||
}
|
||||
return ResponseDTO.ok().addAttribute("join", join);
|
||||
}
|
||||
|
||||
@@ -160,7 +154,7 @@ public class VenueController extends BaseApiController {
|
||||
@RequestMapping(value = "/venue/out", method = RequestMethod.GET)
|
||||
public ResponseDTO out(@RequestParam("venueId") Integer venueId) {
|
||||
Device byDevice = deviceService.findByDevice(venueId);
|
||||
BarCodeResult out = new BarCodeResult();
|
||||
BasketEnterResult out = new BasketEnterResult();
|
||||
if (byDevice == null) {
|
||||
out.setFlg(999);
|
||||
out.setMsg("通讯异常,门禁设备离线中");
|
||||
@@ -173,12 +167,36 @@ public class VenueController extends BaseApiController {
|
||||
}
|
||||
Integer memberId = getMemberIdByAccessToken();
|
||||
out = venueService.out(memberId, venueId);
|
||||
if (out.getFlg() == 0) {
|
||||
String barcode = barcodeService.newBarcode(doorSn,EnterEnum.OUT,venueId,memberId);
|
||||
out.setBarcode(barcode);
|
||||
// doorLockUtil.lockDoor(doorSn);
|
||||
}
|
||||
return ResponseDTO.ok().addAttribute("out", out);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生产二维码
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
String doorSn = byDevice.getName();
|
||||
boolean lockStat = doorLockUtil.checkDoorLock(doorSn);
|
||||
if (lockStat) {
|
||||
throw new ServiceException("有人正在使用门禁,请稍后再试");
|
||||
}
|
||||
Integer memberId = getMemberIdByAccessToken();
|
||||
EnterEnum enterEnum = EnterEnum.OUT;
|
||||
if (enterFlag != null) {
|
||||
enterEnum = EnterEnum.getByValue(enterFlag);
|
||||
}
|
||||
String barcode = barcodeService.newBarcode(doorSn,orderSn,enterEnum,venueId,memberId);
|
||||
return ResponseDTO.ok().addAttribute("barcode", barcode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.sv.wx;
|
||||
|
||||
import com.WeiXinApplication;
|
||||
import com.enums.EnterEnum;
|
||||
import com.sv.dto.BarCodeResult;
|
||||
import com.sv.dto.BasketEnterResult;
|
||||
import com.sv.netty.netty.service.MessageService;
|
||||
import com.sv.netty.utils.JsonUtils;
|
||||
import com.sv.service.api.VenueService;
|
||||
@@ -30,12 +30,11 @@ public class VenueJoinTest {
|
||||
|
||||
@Test
|
||||
public void testJoin(){
|
||||
BarCodeResult join = venueService.join(535, 32);
|
||||
BasketEnterResult join = venueService.join(535, 32);
|
||||
System.out.println(JsonUtils.encode(join));
|
||||
if (join.getFlg() == 0) {
|
||||
String barcode = barcodeService.newBarcode("doorSn", EnterEnum.ENTER, 32, 535);
|
||||
String barcode = barcodeService.newBarcode("doorSn", "",EnterEnum.ENTER, 32, 535);
|
||||
System.err.println("入场的二维码为:" + barcode);
|
||||
join.setBarcode(barcode);
|
||||
doorLockUtil.lockDoor("doorSn");
|
||||
}
|
||||
}
|
||||
@@ -47,12 +46,11 @@ public class VenueJoinTest {
|
||||
|
||||
@Test
|
||||
public void testOut(){
|
||||
BarCodeResult out = venueService.out(535, 32);
|
||||
BasketEnterResult out = venueService.out(535, 32);
|
||||
System.out.println(JsonUtils.encode(out));
|
||||
if (out.getFlg() == 0) {
|
||||
String barcode = barcodeService.newBarcode("doorSn", EnterEnum.OUT, 32, 535);
|
||||
String barcode = barcodeService.newBarcode("doorSn","", EnterEnum.OUT, 32, 535);
|
||||
System.err.println("出场的二维码为:" + barcode);
|
||||
out.setBarcode(barcode);
|
||||
doorLockUtil.lockDoor("doorSn");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user