叫号返回叫号状态

This commit is contained in:
SongZhang 2024-09-24 15:03:05 +08:00
parent 69ec3f381c
commit 1e09c75ea0
2 changed files with 17 additions and 6 deletions

View File

@ -5,6 +5,8 @@ import cn.ysk.cashier.dto.calltable.*;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.service.app.TbCallService;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -20,6 +22,7 @@ import java.util.HashMap;
@AllArgsConstructor
public class TbCallTableController {
private static final Logger log = LoggerFactory.getLogger(TbCallTableController.class);
private final TbCallService tbCallService;
@AnonymousAccess
@ -83,9 +86,11 @@ public class TbCallTableController {
try {
return ResponseEntity.ok(tbCallService.call(callQueueDTO));
}catch (BadRequestException e) {
HashMap<String, Object> data = new HashMap<>();
data.put("message", e.getMessage());
return ResponseEntity.badRequest().body(data);
log.error("异常", e);
return ResponseEntity.ok(new HashMap<String, Object>(){{
put("state", "0");
put("message", e.getMessage());
}});
}
}

View File

@ -227,7 +227,9 @@ public class TbCallServiceImpl implements TbCallService {
}
if (callQueue.getSubState().equals(0)) {
throw new BadRequestException("当前用户未订阅微信提醒");
return new HashMap<String, Object>(){{
put("state", "-1");
}};
}
callQueue.setState((byte) 1);
@ -254,7 +256,9 @@ public class TbCallServiceImpl implements TbCallService {
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())),
@ -273,7 +277,9 @@ public class TbCallServiceImpl implements TbCallService {
wxMiniUtils.sendCurrentOrNearCallMsg(shopInfo.getShopName(), getStrByState(Integer.valueOf(nearQueue.getState())),
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) {