From a1ef32d99f80fc326da4bb410e62d6192d3ca0e4 Mon Sep 17 00:00:00 2001 From: wjt Date: Fri, 10 Mar 2023 17:51:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E5=86=8D=E6=AC=A1=E6=8B=A8?= =?UTF-8?q?=E6=89=93=E7=94=B5=E8=AF=9D=E7=9A=84=E9=A2=91=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../telemarkting/api/TelephoneCallController.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/api/TelephoneCallController.java b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/api/TelephoneCallController.java index 8a990f82..bd052927 100644 --- a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/api/TelephoneCallController.java +++ b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/telemarkting/api/TelephoneCallController.java @@ -1,7 +1,9 @@ package com.baiye.modules.telemarkting.api; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.baiye.constant.DefaultNumberConstants; @@ -15,6 +17,7 @@ import com.baiye.modules.platform.service.OrganizeService; import com.baiye.modules.system.service.UserService; import com.baiye.modules.telemarkting.entity.dto.*; import com.baiye.modules.telemarkting.service.TelephoneCallService; +import com.baiye.util.RedisUtils; import com.baiye.util.SecurityUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -47,10 +50,16 @@ public class TelephoneCallController { private final CompanyService companyService; private final UserService userService; + private final RedisUtils redisUtils; @PostMapping("/telephone/req") @ApiOperation("拨打电话") public CommonResponse doubleCallReq(@Validated @RequestBody TelephoneCallReqDTO telephoneCallReqDTO) { + String key = "tele:" + telephoneCallReqDTO.getUserData(); + if (redisUtils.get(key) != null) { + return CommonResponse.createByErrorMessage("请三分钟后再拨打此线索"); + } + if (ObjectUtil.isEmpty(telephoneCallReqDTO)) { return CommonResponse.createByError(); } @@ -97,6 +106,9 @@ public class TelephoneCallController { } } } + + redisUtils.set(key, RandomUtil.randomString(4), 180); + return CommonResponse.createByError(); } @@ -141,6 +153,7 @@ public class TelephoneCallController { public CommonResponse doubleCallStop(@RequestBody TelephoneCallStopDTO telephoneCallStopDTO) { return telephoneCallService.doubleCallStop(telephoneCallStopDTO); } + @PostMapping("/roll/stop") @ApiOperation("点呼挂断呼叫") public CommonResponse rollCallStop(@RequestBody TelephoneCallStopDTO telephoneCallStopDTO) {