liusheng
2024-06-12 6d51501ca93f5bf46759f851988650477cf32e6c
smartor/src/main/java/com/smartor/service/impl/IvrTaskServiceImpl.java
@@ -2,16 +2,17 @@
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import com.alibaba.fastjson2.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.StringUtils;
import com.smartor.config.RabbitMqCallPhoneConfig;
import org.apache.commons.lang3.StringUtils;
import com.smartor.domain.*;
import com.smartor.mapper.*;
import lombok.extern.slf4j.Slf4j;
@@ -46,7 +47,7 @@
    private IvrLibaTemplateTargetoptionMapper ivrLibaTemplateTargetOptionMapper;
    @Autowired
    private RabbitMqCallPhoneConfig rabbitMqCallPhoneConfig;
    private RedisCache redisCache;
    /**
     * 查询语音任务
@@ -209,7 +210,7 @@
            sendTaskVO.setSendType(ivrTask.getSendType().toString());
        }
        //判断任务是否是立即发送
        if (org.apache.commons.lang3.StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("2")) {
        if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("2")) {
            IvrTaskcallMQ ivrTaskcallMQ = new IvrTaskcallMQ();
            ivrTaskcallMQ.setTaskid(sendTaskVO.getTaskId());
            ivrTaskcallMQ.setSendType(sendTaskVO.getSendType());
@@ -221,14 +222,15 @@
            ivrTaskcallMQJson = ivrTaskcallMQJson.substring(1, ivrTaskcallMQJson.length() - 1);
            //立即发送
            rabbitMqCallPhoneConfig.sendMessage("phone_exchange", "phone.123", ivrTaskcallMQJson, 0L);
//            rabbitMqCallPhoneConfig.sendMessage("phone_exchange", "phone.123", ivrTaskcallMQJson, 0L);
            redisCache.setCacheObject(ivrTaskcallMQJson, ivrTaskcallMQJson, 1, TimeUnit.SECONDS);
            //将任务状态修改成执行中
            IvrTask ivrTask2 = new IvrTask();
            ivrTask2.setTaskid(ivrTask.getTaskid());
            ivrTask2.setSendState(2);
            updateIvrTask(ivrTask2);
        } else if (org.apache.commons.lang3.StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("1")) {
        } else if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("1") || StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("3")) {
            //时间段发送
            ObjectMapper objectMapper = new ObjectMapper();
            if (org.apache.commons.lang3.StringUtils.isNotEmpty(ivrTask.getSendTimeSlot())) {
@@ -267,7 +269,8 @@
                    Long finalMilliseconds = milliseconds;
                    String ivrTaskcallMQJson = JSON.toJSONString(ivrTaskcallMQ);
                    ivrTaskcallMQJson = ivrTaskcallMQJson.substring(1, ivrTaskcallMQJson.length() - 1);
                    rabbitMqCallPhoneConfig.sendMessage("phone_exchange", "phone.123", ivrTaskcallMQJson, milliseconds);
//                    rabbitMqCallPhoneConfig.sendMessage("phone_exchange", "phone.123", ivrTaskcallMQJson, milliseconds);
                    redisCache.setCacheObject(ivrTaskcallMQJson, ivrTaskcallMQJson, milliseconds / 1000, TimeUnit.SECONDS);
                }
                //将任务状态修改成执行中
                IvrTask ivrTask2 = new IvrTask();