| | |
| | | |
| | | 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; |
| | |
| | | private IvrLibaTemplateTargetoptionMapper ivrLibaTemplateTargetOptionMapper; |
| | | |
| | | @Autowired |
| | | private RabbitMqCallPhoneConfig rabbitMqCallPhoneConfig; |
| | | private RedisCache redisCache; |
| | | |
| | | /** |
| | | * 查询语音任务 |
| | |
| | | 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()); |
| | |
| | | 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())) { |
| | |
| | | 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(); |