1.排队取号 限制同一微信订阅次数
This commit is contained in:
@@ -37,13 +37,10 @@ public class TbCallTableController {
|
||||
*/
|
||||
@GetMapping("queue")
|
||||
public Result get(
|
||||
@RequestParam(required = false) String openId,
|
||||
@RequestParam String openId,
|
||||
@RequestParam Integer shopId,
|
||||
@RequestParam(required = false) Integer queueId
|
||||
) {
|
||||
if (StrUtil.isBlank(openId) && queueId == null) {
|
||||
return Result.fail("shopId和queueId不能同时为空");
|
||||
}
|
||||
return Result.successWithData(tbCallService.getList(shopId, openId, queueId));
|
||||
}
|
||||
|
||||
@@ -73,7 +70,7 @@ public class TbCallTableController {
|
||||
return Result.successWithData(tbCallService.getState(openId, shopId, queueId));
|
||||
}
|
||||
|
||||
@PutMapping("subMsg")
|
||||
@PostMapping("subMsg")
|
||||
public Result subMsg(
|
||||
@Validated @RequestBody CallSubMsgDTO subMsgDTO
|
||||
) {
|
||||
|
||||
@@ -85,7 +85,7 @@ public class TbCallServiceImpl implements TbCallService {
|
||||
}
|
||||
|
||||
TbCallQueue callQueue = callQueueService.lambdaQuery()
|
||||
.eq(TbCallQueue::getPhone, takeNumberDTO.getPhone())
|
||||
// .eq(TbCallQueue::getPhone, takeNumberDTO.getPhone())
|
||||
.eq(TbCallQueue::getOpenId, takeNumberDTO.getOpenId())
|
||||
.eq(TbCallQueue::getShopId, takeNumberDTO.getShopId())
|
||||
.eq(TbCallQueue::getCreateDay, DateUtil.today())
|
||||
@@ -97,7 +97,7 @@ public class TbCallServiceImpl implements TbCallService {
|
||||
}
|
||||
|
||||
callQueue = BeanUtil.copyProperties(takeNumberDTO, TbCallQueue.class);
|
||||
callQueue.setSubState(1);
|
||||
callQueue.setSubState(0);
|
||||
callQueue.setCreateTime(DateUtil.date());
|
||||
callQueue.setShopId(shopInfo.getId());
|
||||
callQueue.setShopName(shopInfo.getShopName());
|
||||
@@ -165,6 +165,22 @@ public class TbCallServiceImpl implements TbCallService {
|
||||
throw new MsgException("您未排号请先排号");
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(queue.getOpenId()) && queue.getSubState() == 1) {
|
||||
throw new MsgException("此号码已被其他用户订阅");
|
||||
}
|
||||
|
||||
Integer count = callQueueService.lambdaQuery()
|
||||
// .eq(TbCallQueue::getPhone, takeNumberDTO.getPhone())
|
||||
.eq(TbCallQueue::getOpenId, subMsgDTO.getOpenId())
|
||||
.eq(TbCallQueue::getShopId, subMsgDTO.getShopId())
|
||||
.eq(TbCallQueue::getCreateDay, DateUtil.today())
|
||||
.in(TbCallQueue::getState, 0, 1)
|
||||
.ne(TbCallQueue::getIsPostpone, 2)
|
||||
.eq(TbCallQueue::getCallTableId, queue.getCallTableId()).count();
|
||||
if (count > 0) {
|
||||
throw new MsgException("您已订阅其他号码,请勿重复订阅");
|
||||
}
|
||||
|
||||
queue.setSubState(1);
|
||||
queue.setOpenId(subMsgDTO.getOpenId());
|
||||
return callQueueMapper.updateById(queue);
|
||||
|
||||
Reference in New Issue
Block a user