api-目前只支持健身馆强校验
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
package com.sv.netty.controller;
|
||||
|
||||
import com.enums.DeviceType;
|
||||
import com.enums.VenueTypeEnum;
|
||||
import com.sv.entity.Venue;
|
||||
import com.sv.entity.VenueType;
|
||||
import com.sv.netty.config.ClientChannelCache;
|
||||
import com.sv.netty.config.Constant;
|
||||
import com.sv.netty.netty.service.MessageService;
|
||||
import com.sv.service.api.QRCodeService;
|
||||
import com.ydd.framework.core.common.dto.ResponseDTO;
|
||||
import com.ydd.framework.core.controller.BaseApiController;
|
||||
import com.ydd.framework.core.exception.ServiceException;
|
||||
import io.netty.channel.Channel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -60,10 +63,8 @@ public class QREnterController extends BaseApiController {
|
||||
String deviceName = getDeviceName(deviceId);
|
||||
DeviceType enterOrOut = getEnterOrOut(deviceId);
|
||||
Venue venue = qrCodeService.initEnter(venueId, deviceName);
|
||||
if (venue!=null){
|
||||
Channel channel = ClientChannelCache.getCurrentChannel(deviceName,venueId ,enterOrOut);
|
||||
messageService.sendLoading(channel,memberId);
|
||||
}
|
||||
return ResponseDTO.ok().addAttribute("venueInit", venue);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ public class ExceptionCodeTemplate {
|
||||
public static final ExceptionCode VENUE_ERROR = ExceptionCode.init(30023, "场馆暂未开放");
|
||||
|
||||
public static final ExceptionCode DEVICE_ERROR = ExceptionCode.init(30024, "未找到该设备");
|
||||
public static final ExceptionCode VENUE_TYPE_ERROR = ExceptionCode.init(30025, "该场馆暂不支持扫码入场");
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.sv.service.api;
|
||||
|
||||
import com.enums.DeviceType;
|
||||
import com.enums.VenueTypeEnum;
|
||||
import com.sv.entity.Venue;
|
||||
import com.sv.mapper.DeviceMapper;
|
||||
import com.sv.mapper.VenueMapper;
|
||||
@@ -30,7 +31,14 @@ public class QRCodeService {
|
||||
if (integer != 1){
|
||||
throw new ServiceException(com.sv.exception.api.ExceptionCodeTemplate.DEVICE_ERROR);
|
||||
}
|
||||
return venueMapper.findById(venueId);
|
||||
Venue venue = venueMapper.findById(venueId);
|
||||
if (venue==null){
|
||||
throw new ServiceException(com.sv.exception.api.ExceptionCodeTemplate.VENUE_ERROR);
|
||||
}
|
||||
if (!VenueTypeEnum.FITNESS.value.equals(venue.getType())){
|
||||
throw new ServiceException(com.sv.exception.api.ExceptionCodeTemplate.VENUE_TYPE_ERROR);
|
||||
}
|
||||
return venue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user