叫号返回叫号状态
This commit is contained in:
@@ -5,6 +5,8 @@ import cn.ysk.cashier.dto.calltable.*;
|
|||||||
import cn.ysk.cashier.exception.BadRequestException;
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
import cn.ysk.cashier.service.app.TbCallService;
|
import cn.ysk.cashier.service.app.TbCallService;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -20,6 +22,7 @@ import java.util.HashMap;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class TbCallTableController {
|
public class TbCallTableController {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(TbCallTableController.class);
|
||||||
private final TbCallService tbCallService;
|
private final TbCallService tbCallService;
|
||||||
|
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
@@ -83,9 +86,11 @@ public class TbCallTableController {
|
|||||||
try {
|
try {
|
||||||
return ResponseEntity.ok(tbCallService.call(callQueueDTO));
|
return ResponseEntity.ok(tbCallService.call(callQueueDTO));
|
||||||
}catch (BadRequestException e) {
|
}catch (BadRequestException e) {
|
||||||
HashMap<String, Object> data = new HashMap<>();
|
log.error("异常", e);
|
||||||
data.put("message", e.getMessage());
|
return ResponseEntity.ok(new HashMap<String, Object>(){{
|
||||||
return ResponseEntity.badRequest().body(data);
|
put("state", "0");
|
||||||
|
put("message", e.getMessage());
|
||||||
|
}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -227,7 +227,9 @@ public class TbCallServiceImpl implements TbCallService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (callQueue.getSubState().equals(0)) {
|
if (callQueue.getSubState().equals(0)) {
|
||||||
throw new BadRequestException("当前用户未订阅微信提醒");
|
return new HashMap<String, Object>(){{
|
||||||
|
put("state", "-1");
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
callQueue.setState((byte) 1);
|
callQueue.setState((byte) 1);
|
||||||
@@ -254,7 +256,9 @@ public class TbCallServiceImpl implements TbCallService {
|
|||||||
|
|
||||||
|
|
||||||
if (StrUtil.isBlank(callQueue.getOpenId())) {
|
if (StrUtil.isBlank(callQueue.getOpenId())) {
|
||||||
throw new BadRequestException("此用户未订阅微信小程序消息");
|
return new HashMap<String, Object>(){{
|
||||||
|
put("state", "-1");
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMiniUtils.sendCurrentOrNearCallMsg(shopInfo.getShopName(), getStrByState(Integer.valueOf(callQueue.getState())),
|
wxMiniUtils.sendCurrentOrNearCallMsg(shopInfo.getShopName(), getStrByState(Integer.valueOf(callQueue.getState())),
|
||||||
@@ -273,7 +277,9 @@ public class TbCallServiceImpl implements TbCallService {
|
|||||||
wxMiniUtils.sendCurrentOrNearCallMsg(shopInfo.getShopName(), getStrByState(Integer.valueOf(nearQueue.getState())),
|
wxMiniUtils.sendCurrentOrNearCallMsg(shopInfo.getShopName(), getStrByState(Integer.valueOf(nearQueue.getState())),
|
||||||
nearQueue.getCallNum(), current.isEmpty() ? "" : current.get(0).getCallNum(), "排号信息", nearQueue.getOpenId(), true);
|
nearQueue.getCallNum(), current.isEmpty() ? "" : current.get(0).getCallNum(), "排号信息", nearQueue.getOpenId(), true);
|
||||||
}
|
}
|
||||||
return flag;
|
return new HashMap<String, Object>(){{
|
||||||
|
put("state", "1");
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getStrByState(Integer state) {
|
private String getStrByState(Integer state) {
|
||||||
|
|||||||
Reference in New Issue
Block a user