已添加3个文件
已删除1个文件
已修改14个文件
已重命名1个文件
| | |
| | | log.info("䏿¯ä»»å¡ä¿¡æ¯"); |
| | | return; |
| | | } |
| | | IvrTaskcallMQ ivrTaskcallMQ = null; |
| | | CommonTaskcallMQ ivrTaskcallMQ = null; |
| | | try { |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | try { |
| | | if (!content.startsWith("{")) { |
| | | ivrTaskcallMQ = mapper.readValue("{" + content + "}", IvrTaskcallMQ.class); |
| | | ivrTaskcallMQ = mapper.readValue("{" + content + "}", CommonTaskcallMQ.class); |
| | | } else { |
| | | ivrTaskcallMQ = mapper.readValue(content, IvrTaskcallMQ.class); |
| | | ivrTaskcallMQ = mapper.readValue(content, CommonTaskcallMQ.class); |
| | | } |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.controller.smartor; |
| | | |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.smartor.domain.SendTaskVO; |
| | | import com.smartor.domain.ServiceThirdData; |
| | | import com.smartor.service.CommonTaskService; |
| | | import com.smartor.service.IServiceThirdDataService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * éç¨ä»»å¡Controller |
| | | * |
| | | * @author ruoyi |
| | | * @date 2023-06-26 |
| | | */ |
| | | @Api(description = "CommonTaskController") |
| | | @RestController |
| | | @RequestMapping("/commonTask") |
| | | public class CommonTaskController extends BaseController { |
| | | @Autowired |
| | | private IServiceThirdDataService iServiceThirdDataService; |
| | | |
| | | @Autowired |
| | | private CommonTaskService commonTaskService; |
| | | |
| | | /** |
| | | * æ¥è¯¢é¢ç®å表ï¼ä¹ä¹çhisæ°æ®è·åæ
åµï¼ |
| | | */ |
| | | @PostMapping("/list") |
| | | public TableDataInfo list(@RequestBody ServiceThirdData serviceThirdData) { |
| | | List<ServiceThirdData> list = iServiceThirdDataService.queryList(serviceThirdData); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡çåéæ§è¡ãæåãç»æ¢ |
| | | */ |
| | | @ApiOperation("ä»»å¡çåéæ§è¡ãæåãç»æ¢") |
| | | @PostMapping("/taskSend") |
| | | public AjaxResult taskSend(@RequestBody SendTaskVO sendTaskVO) { |
| | | return toAjax(commonTaskService.taskSend(sendTaskVO)); |
| | | } |
| | | |
| | | } |
| | |
| | | return getDataTable(ivrTaskService.getScriptInfoByCondition(tid, pid)); |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡çåéæ§è¡ãæåãç»æ¢ |
| | | */ |
| | | @ApiOperation("ä»»å¡çåéæ§è¡ãæåãç»æ¢") |
| | | @PostMapping("/taskSend") |
| | | public AjaxResult taskSend(@RequestBody SendTaskVO sendTaskVO) { |
| | | return toAjax(ivrTaskService.taskSend(sendTaskVO)); |
| | | } |
| | | |
| | | } |
ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/IvrTaskcallMQ.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * MQä»»å¡ |
| | |
| | | * @author ruoyi |
| | | * @date 2024-02-02 |
| | | */ |
| | | @ApiModel(value = "IvrTaskcallMQ", description = "MQä»»å¡") |
| | | @ApiModel(value = "CommonTaskcallMQ", description = "MQä»»å¡") |
| | | @Data |
| | | public class IvrTaskcallMQ { |
| | | public class CommonTaskcallMQ { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "æåç¶æ ï¼ ç¶æå¦æåçä¿®æ¹ï¼å¼å°±å 1") |
| | | private Long stopState; |
| | | |
| | | /** |
| | | * æåç¶æ ï¼ ç¶æå¦æåçä¿®æ¹ï¼å¼å°±å 1 |
| | | */ |
| | | @ApiModelProperty(value = "æåç¶æ ï¼ ç¶æå¦æåçä¿®æ¹ï¼å¼å°±å 1") |
| | | private Integer taskType; |
| | | |
| | | |
| | | /** |
| | | * åéæ¶é´æ®µ |
| | |
| | | @ApiModelProperty(value = "åéç¶æï¼ 1å建 2æ§è¡ä¸ 3 æå 4ç»æ¢ 5宿 ") |
| | | private Integer sendState; |
| | | |
| | | /** |
| | | * ä»»å¡ç±»åï¼ 1 é访 2 é®å· 3 宣æ |
| | | */ |
| | | @Excel(name = " ä»»å¡ç±»åï¼ 1 é访 2 é®å· 3 宣æ ") |
| | | @ApiModelProperty(value = "ä»»å¡ç±»åï¼ 1 é访 2 é®å· 3 宣æ ") |
| | | private Integer taskType; |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty("é¢ç®åå¼ï¼æ°å1,2çï¼åæ¯AãBï¼Cï¼Dçï¼") |
| | | private String score; |
| | | |
| | | /** |
| | | * é¢ç®ä¸»é¢ |
| | | */ |
| | | @Excel(name = "é¢ç®ä¸»é¢") |
| | | @ApiModelProperty("é¢ç®ä¸»é¢") |
| | | private String topic; |
| | | |
| | | } |
| | |
| | | */ |
| | | @Excel(name = "æ¯å¦åé ï¼ 0 æååé 1 宿¶åé 2 ç«å³åé ") |
| | | @ApiModelProperty(value = "æ¯å¦åé ï¼ 0 æååé 1 宿¶åé 2 ç«å³åé") |
| | | private Long isSend; |
| | | private Long sendType; |
| | | |
| | | /** |
| | | * åéç¶æï¼ 0 失败 1æå |
| | |
| | | private Long playWavOnly; |
| | | |
| | | /** |
| | | * æåº |
| | | */ |
| | | @ApiModelProperty(value = "æåº") |
| | | private Long sort; |
| | | |
| | | /** |
| | | * å 餿 è®° |
| | | */ |
| | | private String delFlag; |
| | |
| | | @ApiModelProperty(value = "é®é¢å¾çè·¯å¾") |
| | | private String picturePath; |
| | | |
| | | |
| | | /** |
| | | * é¢ç®ä¸»é¢ |
| | | */ |
| | | @Excel(name = "é¢ç®ä¸»é¢") |
| | | @ApiModelProperty("é¢ç®ä¸»é¢") |
| | | private String topic; |
| | | |
| | | } |
| | |
| | | private Long ID; |
| | | |
| | | /** |
| | | * é¢ç®ä¸»é¢ |
| | | */ |
| | | @Excel(name = "é¢ç®ä¸»é¢") |
| | | @ApiModelProperty("é¢ç®ä¸»é¢") |
| | | private String topic; |
| | | |
| | | /** |
| | | * ä»»å¡id |
| | | */ |
| | | @ApiModelProperty(value = "ä»»å¡id") |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.service; |
| | | |
| | | import com.smartor.domain.SendTaskVO; |
| | | import com.smartor.domain.ServiceThirdData; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç¬¬ä¸æ¹ååæ°æ®Serviceæ¥å£ |
| | | * |
| | | * @author ruoyi |
| | | * @date 2023-10-10 |
| | | */ |
| | | public interface CommonTaskService { |
| | | |
| | | /** |
| | | * ä»»å¡åéæ§è¡ |
| | | * |
| | | * @param sendTaskVO |
| | | * @return ç»æ |
| | | */ |
| | | public Integer taskSend(SendTaskVO sendTaskVO); |
| | | } |
| | |
| | | |
| | | public List<IvrLibaTemplateScriptVO> getScriptInfoByCondition(Long taskid, Long patid); |
| | | |
| | | /** |
| | | * ä»»å¡åéæ§è¡ |
| | | * |
| | | * @param sendTaskVO |
| | | * @return ç»æ |
| | | */ |
| | | public int taskSend(SendTaskVO sendTaskVO); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.service.impl; |
| | | |
| | | 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.DtoConversionUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.service.CommonTaskService; |
| | | import com.smartor.service.IIvrTaskService; |
| | | import com.smartor.service.ISvyTaskService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | |
| | | /** |
| | | * ç¬¬ä¸æ¹ååæ°æ®Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author ruoyi |
| | | * @date 2023-10-10 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class CommonTaskServiceImpl implements CommonTaskService { |
| | | @Autowired |
| | | private IIvrTaskService ivrTaskService; |
| | | |
| | | @Autowired |
| | | private ISvyTaskService iSvyTaskService; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | |
| | | @Override |
| | | public Integer taskSend(SendTaskVO sendTaskVO) { |
| | | if (sendTaskVO.getTaskId() == null || sendTaskVO.getTaskType() == null) |
| | | throw new BaseException("ä»»å¡IDæè
ä»»å¡ç±»åä¸è½ä¸ºç©ºï¼è¯·æ£æ¥åï¼åè¿è¡æ§è¡"); |
| | | if (sendTaskVO.getTaskType() == 1) { |
| | | //é访 |
| | | return sfSend(sendTaskVO); |
| | | } else if (sendTaskVO.getTaskType() == 2) { |
| | | //é®å· |
| | | return wjSend(sendTaskVO); |
| | | } else if (sendTaskVO.getTaskType() == 3) { |
| | | //宣æ |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public int sfSend(SendTaskVO sendTaskVO) { |
| | | IvrTask ivrTask = ivrTaskService.selectIvrTaskByTaskid(sendTaskVO.getTaskId()); |
| | | if (sendTaskVO.getSendState() != null && sendTaskVO.getSendState() == 3 || sendTaskVO.getSendState() != null && sendTaskVO.getSendState() == 4) { |
| | | //任塿åæç»æ¢ |
| | | IvrTask ivrTask3 = new IvrTask(); |
| | | ivrTask3.setTaskid(sendTaskVO.getTaskId()); |
| | | ivrTask3.setStopState(ivrTask.getStopState() + 1); |
| | | ivrTask3.setSendState(sendTaskVO.getSendState()); |
| | | ivrTaskService.updateIvrTask(ivrTask3); |
| | | return 0; |
| | | } |
| | | |
| | | //夿åéç¶ææ¯å¦ä¸ºç©º |
| | | if (StringUtils.isEmpty(sendTaskVO.getSendType())) { |
| | | sendTaskVO.setSendType(ivrTask.getSendType().toString()); |
| | | } |
| | | //夿任塿¯å¦æ¯ç«å³åé |
| | | if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("2")) { |
| | | String content = sendMQContent(sendTaskVO, ivrTask.getTemplateid().toString(), ivrTask.getPreachform(), ivrTask.getStopState(), null); |
| | | //ç«å³åé |
| | | redisCache.setCacheObject(content, content, 1, TimeUnit.SECONDS); |
| | | |
| | | //å°ä»»å¡ç¶æä¿®æ¹ææ§è¡ä¸ |
| | | IvrTask ivrTask2 = new IvrTask(); |
| | | ivrTask2.setTaskid(ivrTask.getTaskid()); |
| | | ivrTask2.setSendState(2); |
| | | ivrTaskService.updateIvrTask(ivrTask2); |
| | | } 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())) { |
| | | List<TaskSendTimeVO> taskSendTimeVOList = null; |
| | | try { |
| | | taskSendTimeVOList = objectMapper.readValue(ivrTask.getSendTimeSlot(), new TypeReference<List<TaskSendTimeVO>>() { |
| | | }); |
| | | } catch (JsonProcessingException e) { |
| | | log.error("JsonProcessingExceptionæ¥éäºï¼{}", e.getMessage()); |
| | | } |
| | | for (TaskSendTimeVO taskSendTimeVO : taskSendTimeVOList) { |
| | | //å»SendTimeslotä¸ï¼è·åææçæ¶é´æ®µ |
| | | List<TaskSendTimeVO> list = new ArrayList<>(); |
| | | list.add(taskSendTimeVO); |
| | | |
| | | //è·åå¼å§åéæ¶é´ |
| | | String begantime = taskSendTimeVO.getBegantime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | //è®°å½ç®åå°åéæ¶é´ç毫ç§å¼ ï¼åéæ¶é´ç毫ç§å¼ - å½åæ¶é´ç毫ç§å¼ï¼ |
| | | Long milliseconds = 1000L; |
| | | try { |
| | | Date date = sdf.parse(begantime); |
| | | milliseconds = date.getTime() - System.currentTimeMillis(); |
| | | System.out.println("æ¥ææ¯«ç§æ°ï¼" + milliseconds); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | SendTaskVO sendTaskVO1 = DtoConversionUtils.sourceToTarget(sendTaskVO, SendTaskVO.class); |
| | | sendTaskVO1.setSendType("1"); |
| | | String content = sendMQContent(sendTaskVO1, ivrTask.getTemplateid().toString(), ivrTask.getPreachform(), ivrTask.getStopState(), list); |
| | | redisCache.setCacheObject(content, content, milliseconds / 1000, TimeUnit.SECONDS); |
| | | } |
| | | //å°ä»»å¡ç¶æä¿®æ¹ææ§è¡ä¸ |
| | | IvrTask ivrTask2 = new IvrTask(); |
| | | ivrTask2.setTaskid(ivrTask.getTaskid()); |
| | | ivrTask2.setSendState(2); |
| | | ivrTaskService.updateIvrTask(ivrTask2); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | public int wjSend(SendTaskVO sendTaskVO) { |
| | | SvyTask svyTask = iSvyTaskService.selectSvyTaskByTaskid(sendTaskVO.getTaskId()); |
| | | if (sendTaskVO.getSendState() != null && sendTaskVO.getSendState() == 3 || sendTaskVO.getSendState() != null && sendTaskVO.getSendState() == 4) { |
| | | //任塿åæç»æ¢ |
| | | SvyTask svyTask1 = new SvyTask(); |
| | | svyTask1.setTaskid(sendTaskVO.getTaskId()); |
| | | svyTask1.setStopState(svyTask.getStopState() + 1); |
| | | svyTask1.setSendState(sendTaskVO.getSendState().toString()); |
| | | iSvyTaskService.updateSvyTask(svyTask1); |
| | | return 0; |
| | | } |
| | | |
| | | //夿åéç¶ææ¯å¦ä¸ºç©º |
| | | if (StringUtils.isEmpty(sendTaskVO.getSendType())) { |
| | | sendTaskVO.setSendType(svyTask.getSendType().toString()); |
| | | } |
| | | //夿任塿¯å¦æ¯ç«å³åé |
| | | if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("2")) { |
| | | |
| | | String content = sendMQContent(sendTaskVO, svyTask.getTemplateid(), svyTask.getPreachform(), svyTask.getStopState(), null); |
| | | //ç«å³åé |
| | | redisCache.setCacheObject(content, content, 1, TimeUnit.SECONDS); |
| | | |
| | | //å°ä»»å¡ç¶æä¿®æ¹ææ§è¡ä¸ |
| | | SvyTask svyTask2 = new SvyTask(); |
| | | svyTask2.setTaskid(svyTask.getTaskid()); |
| | | svyTask2.setSendState("2"); |
| | | iSvyTaskService.updateSvyTask(svyTask2); |
| | | } else if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("1") || StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("3")) { |
| | | //æ¶é´æ®µåé |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | if (StringUtils.isNotEmpty(svyTask.getSendTimeSlot())) { |
| | | List<TaskSendTimeVO> taskSendTimeVOList = null; |
| | | try { |
| | | taskSendTimeVOList = objectMapper.readValue(svyTask.getSendTimeSlot(), new TypeReference<List<TaskSendTimeVO>>() { |
| | | }); |
| | | } catch (JsonProcessingException e) { |
| | | log.error("JsonProcessingExceptionæ¥éäºï¼{}", e.getMessage()); |
| | | } |
| | | for (TaskSendTimeVO taskSendTimeVO : taskSendTimeVOList) { |
| | | //å»SendTimeslotä¸ï¼è·åææçæ¶é´æ®µ |
| | | List<TaskSendTimeVO> list = new ArrayList<>(); |
| | | list.add(taskSendTimeVO); |
| | | |
| | | //è·åå¼å§åéæ¶é´ |
| | | String begantime = taskSendTimeVO.getBegantime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | //è®°å½ç®åå°åéæ¶é´ç毫ç§å¼ ï¼åéæ¶é´ç毫ç§å¼ - å½åæ¶é´ç毫ç§å¼ï¼ |
| | | Long milliseconds = 1000L; |
| | | try { |
| | | Date date = sdf.parse(begantime); |
| | | milliseconds = date.getTime() - System.currentTimeMillis(); |
| | | System.out.println("æ¥ææ¯«ç§æ°ï¼" + milliseconds); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | SendTaskVO sendTaskVO1 = DtoConversionUtils.sourceToTarget(sendTaskVO, SendTaskVO.class); |
| | | sendTaskVO1.setSendType("1"); |
| | | String content = sendMQContent(sendTaskVO1, svyTask.getTemplateid(), svyTask.getPreachform(), svyTask.getStopState(), list); |
| | | redisCache.setCacheObject(content, content, milliseconds / 1000, TimeUnit.SECONDS); |
| | | } |
| | | //å°ä»»å¡ç¶æä¿®æ¹ææ§è¡ä¸ |
| | | SvyTask svyTask3 = new SvyTask(); |
| | | svyTask3.setTaskid(svyTask.getTaskid()); |
| | | svyTask3.setSendState("2"); |
| | | iSvyTaskService.updateSvyTask(svyTask3); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * MQä»»å¡å建å
容 |
| | | * |
| | | * @param sendTaskVO |
| | | * @param templateid |
| | | * @param preachform |
| | | * @param stopState |
| | | * @param sendTimeslot |
| | | * @return |
| | | */ |
| | | private String sendMQContent(SendTaskVO sendTaskVO, String templateid, String preachform, Long stopState, List<TaskSendTimeVO> sendTimeslot) { |
| | | CommonTaskcallMQ commonTaskcallMQ = new CommonTaskcallMQ(); |
| | | commonTaskcallMQ.setTaskid(sendTaskVO.getTaskId()); |
| | | commonTaskcallMQ.setSendType(sendTaskVO.getSendType()); |
| | | commonTaskcallMQ.setTemplateid(templateid); |
| | | commonTaskcallMQ.setPreachform(preachform); |
| | | commonTaskcallMQ.setStopState(stopState); |
| | | commonTaskcallMQ.setTaskType(sendTaskVO.getTaskType()); |
| | | commonTaskcallMQ.setSendTimeslot(sendTimeslot); |
| | | |
| | | String commonTaskcallMQJson = JSON.toJSONString(commonTaskcallMQ); |
| | | commonTaskcallMQJson = commonTaskcallMQJson.substring(1, commonTaskcallMQJson.length() - 1); |
| | | return commonTaskcallMQJson; |
| | | } |
| | | } |
| | |
| | | return ivrLibaTemplateScriptVOS; |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡åé |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int taskSend(SendTaskVO sendTaskVO) { |
| | | if (sendTaskVO.getTaskId() == null) throw new BaseException("ä»»å¡IDä¸è½ä¸ºç©ºï¼è¯·æ£æ¥åï¼åè¿è¡æ§è¡"); |
| | | IvrTask ivrTask = selectIvrTaskByTaskid(sendTaskVO.getTaskId()); |
| | | if (sendTaskVO.getSendState() != null && sendTaskVO.getSendState() == 3 || sendTaskVO.getSendState() != null && sendTaskVO.getSendState() == 4) { |
| | | //任塿åæç»æ¢ |
| | | IvrTask ivrTask3 = new IvrTask(); |
| | | ivrTask3.setTaskid(sendTaskVO.getTaskId()); |
| | | ivrTask3.setStopState(ivrTask.getStopState() + 1); |
| | | ivrTask3.setSendState(sendTaskVO.getSendState()); |
| | | updateIvrTask(ivrTask3); |
| | | return 0; |
| | | } |
| | | |
| | | //夿åéç¶ææ¯å¦ä¸ºç©º |
| | | if (org.apache.commons.lang3.StringUtils.isEmpty(sendTaskVO.getSendType())) { |
| | | sendTaskVO.setSendType(ivrTask.getSendType().toString()); |
| | | } |
| | | //夿任塿¯å¦æ¯ç«å³åé |
| | | if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("2")) { |
| | | IvrTaskcallMQ ivrTaskcallMQ = new IvrTaskcallMQ(); |
| | | ivrTaskcallMQ.setTaskid(sendTaskVO.getTaskId()); |
| | | ivrTaskcallMQ.setSendType(sendTaskVO.getSendType()); |
| | | ivrTaskcallMQ.setTemplateid(ivrTask.getTemplateid().toString()); |
| | | ivrTaskcallMQ.setPreachform(ivrTask.getPreachform()); |
| | | ivrTaskcallMQ.setStopState(ivrTask.getStopState()); |
| | | |
| | | String ivrTaskcallMQJson = JSON.toJSONString(ivrTaskcallMQ); |
| | | ivrTaskcallMQJson = ivrTaskcallMQJson.substring(1, ivrTaskcallMQJson.length() - 1); |
| | | |
| | | //ç«å³åé |
| | | // 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 (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())) { |
| | | List<TaskSendTimeVO> taskSendTimeVOList = null; |
| | | try { |
| | | taskSendTimeVOList = objectMapper.readValue(ivrTask.getSendTimeSlot(), new TypeReference<List<TaskSendTimeVO>>() { |
| | | }); |
| | | } catch (JsonProcessingException e) { |
| | | log.error("JsonProcessingExceptionæ¥éäºï¼{}", e.getMessage()); |
| | | } |
| | | for (TaskSendTimeVO taskSendTimeVO : taskSendTimeVOList) { |
| | | //å»SendTimeslotä¸ï¼è·åææçæ¶é´æ®µ |
| | | List<TaskSendTimeVO> list = new ArrayList<>(); |
| | | list.add(taskSendTimeVO); |
| | | |
| | | //è·åå¼å§åéæ¶é´ |
| | | String begantime = taskSendTimeVO.getBegantime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | //è®°å½ç®åå°åéæ¶é´ç毫ç§å¼ ï¼åéæ¶é´ç毫ç§å¼ - å½åæ¶é´ç毫ç§å¼ï¼ |
| | | Long milliseconds = 1000L; |
| | | try { |
| | | Date date = sdf.parse(begantime); |
| | | milliseconds = date.getTime() - System.currentTimeMillis(); |
| | | System.out.println("æ¥ææ¯«ç§æ°ï¼" + milliseconds); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | IvrTaskcallMQ ivrTaskcallMQ = new IvrTaskcallMQ(); |
| | | ivrTaskcallMQ.setTaskid(sendTaskVO.getTaskId()); |
| | | ivrTaskcallMQ.setSendType("1"); |
| | | ivrTaskcallMQ.setTemplateid(ivrTask.getTemplateid().toString()); |
| | | ivrTaskcallMQ.setSendTimeslot(list); |
| | | ivrTaskcallMQ.setStopState(ivrTask.getStopState()); |
| | | ivrTaskcallMQ.setPreachform(ivrTask.getPreachform()); |
| | | |
| | | Long finalMilliseconds = milliseconds; |
| | | String ivrTaskcallMQJson = JSON.toJSONString(ivrTaskcallMQ); |
| | | ivrTaskcallMQJson = ivrTaskcallMQJson.substring(1, ivrTaskcallMQJson.length() - 1); |
| | | // rabbitMqCallPhoneConfig.sendMessage("phone_exchange", "phone.123", ivrTaskcallMQJson, milliseconds); |
| | | redisCache.setCacheObject(ivrTaskcallMQJson, ivrTaskcallMQJson, milliseconds / 1000, TimeUnit.SECONDS); |
| | | } |
| | | //å°ä»»å¡ç¶æä¿®æ¹ææ§è¡ä¸ |
| | | IvrTask ivrTask2 = new IvrTask(); |
| | | ivrTask2.setTaskid(ivrTask.getTaskid()); |
| | | ivrTask2.setSendState(2); |
| | | updateIvrTask(ivrTask2); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | //å¤çé¢ç® |
| | | if (CollectionUtils.isNotEmpty(svyLibTemplate.getSvyLibScripts())) { |
| | | for (SvyLibTemplateScript svyLibScript : svyLibTemplate.getSvyLibScripts()) { |
| | | SvyLibTemplateScript svyLibTemplateScript = DtoConversionUtils.sourceToTarget(svyLibScript, SvyLibTemplateScript.class); |
| | | // SvyLibTemplateScript svyLibTemplateScript = DtoConversionUtils.sourceToTarget(svyLibScript, SvyLibTemplateScript.class); |
| | | //对é¢ç®è¿è¡å¤ç |
| | | if (svyLibScript.getIsoperation() != null && svyLibScript.getIsoperation() == 1) { |
| | | //æ°å¢ |
| | | svyLibTemplateScript.setSvyid(svyLibTemplate.getSvyid()); |
| | | svyLibTemplateScript.setId(null); |
| | | svyLibTemplateScriptMapper.insertSvyLibTemplateScript(svyLibTemplateScript); |
| | | svyLibScript.setSvyid(svyLibTemplate.getSvyid()); |
| | | svyLibScript.setId(null); |
| | | svyLibScript.setCreateTime(new Date()); |
| | | svyLibTemplateScriptMapper.insertSvyLibTemplateScript(svyLibScript); |
| | | |
| | | } else if (svyLibScript.getIsoperation() != null && svyLibScript.getIsoperation() == 2) { |
| | | //ä¿®æ¹ |
| | | svyLibTemplateScript.setSvyid(svyLibTemplate.getSvyid()); |
| | | svyLibTemplateScriptMapper.updateSvyLibTemplateScript(svyLibTemplateScript); |
| | | svyLibScript.setSvyid(svyLibTemplate.getSvyid()); |
| | | svyLibScript.setUpdateTime(new Date()); |
| | | svyLibTemplateScriptMapper.updateSvyLibTemplateScript(svyLibScript); |
| | | } else if (svyLibScript.getIsoperation() != null && svyLibScript.getIsoperation() == 3) { |
| | | svyLibTemplateScriptMapper.deleteSvyLibTemplateScriptByTopicid(svyLibTemplateScript.getId()); |
| | | svyLibTemplateScriptMapper.deleteSvyLibTemplateScriptByTopicid(svyLibScript.getId()); |
| | | } |
| | | |
| | | //对é¢ç®é项è¿è¡å¤ç |
| | |
| | | if (svyLibTemplateTargetoption.getIsoperation() != null && svyLibTemplateTargetoption.getIsoperation() == 1) { |
| | | //æ°å¢ |
| | | svyLibTemplateTargetoption.setScriptid(svyLibScript.getId()); |
| | | svyLibTemplateTargetoption.setCreateTime(new Date()); |
| | | svyLibTemplateTargetoptionMapper.insertSvyLibTemplateTargetoption(svyLibTemplateTargetoption); |
| | | } else if (svyLibTemplateTargetoption.getIsoperation() != null && svyLibTemplateTargetoption.getIsoperation() == 2) { |
| | | //ä¿®æ¹ |
| | | svyLibTemplateTargetoption.setScriptid(svyLibScript.getId()); |
| | | svyLibTemplateTargetoption.setUpdateTime(new Date()); |
| | | svyLibTemplateTargetoptionMapper.updateSvyLibTemplateTargetoption(svyLibTemplateTargetoption); |
| | | } else if (svyLibTemplateTargetoption.getIsoperation() != null && svyLibTemplateTargetoption.getIsoperation() == 3) { |
| | | //å é¤ |
| | |
| | | <result property="scoretype" column="scoretype"/> |
| | | <result property="score" column="score"/> |
| | | <result property="scriptPicture" column="script_picture"/> |
| | | <result property="topic" column="topic"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectSvyLibTemplateScriptVo"> |
| | |
| | | script_content, |
| | | suitway, |
| | | script_picture, |
| | | topic, |
| | | isavailable, language, otherdata, value_type, reply, scoretype, score |
| | | from svy_lib_template_script |
| | | </sql> |
| | |
| | | resultMap="SvyLibTemplateScriptResult"> |
| | | <include refid="selectSvyLibTemplateScriptVo"/> |
| | | <where> |
| | | del_flag=0 |
| | | <if test="oldid != null ">and oldid = #{oldid}</if> |
| | | <if test="svyid != null ">and svyid = #{svyid}</if> |
| | | <if test="scriptType != null and scriptType != ''">and script_type = #{scriptType}</if> |
| | |
| | | <if test="reply != null and reply != ''">and reply = #{reply}</if> |
| | | <if test="scoretype != null and scoretype != ''">and scoretype = #{scoretype}</if> |
| | | <if test="score != null and score != ''">and score = #{score}</if> |
| | | <if test="topic != null and topic != ''">and topic = #{topic}</if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | <if test="scoretype != null">scoretype,</if> |
| | | <if test="score != null">score,</if> |
| | | <if test="scriptPicture != null">script_picture,</if> |
| | | <if test="topic != null">topic,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="oldid != null">#{oldid},</if> |
| | |
| | | <if test="scoretype != null">#{scoretype},</if> |
| | | <if test="score != null">#{score},</if> |
| | | <if test="scriptPicture != null">#{scriptPicture},</if> |
| | | <if test="topic != null">#{topic},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="scoretype != null">scoretype = #{scoretype},</if> |
| | | <if test="score != null">score = #{score},</if> |
| | | <if test="scriptPicture != null">script_picture = #{scriptPicture},</if> |
| | | <if test="topic != null">topic = #{topic},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | |
| | | resultMap="SvyLibTemplateTargetoptionResult"> |
| | | <include refid="selectSvyLibTemplateTargetoptionVo"/> |
| | | <where> |
| | | del_flag=0 |
| | | <if test="groupid != null and groupid != ''">and groupid = #{groupid}</if> |
| | | <if test="categoryName != null and categoryName != ''">and categoryName like concat('%', #{categoryName}, |
| | | '%') |
| | |
| | | <result property="pid" column="pid"/> |
| | | <result property="guid" column="guid"/> |
| | | <result property="preachform" column="preachform"/> |
| | | <result property="isSend" column="is_send"/> |
| | | <result property="sendType" column="send_type"/> |
| | | <result property="sendState" column="send_state"/> |
| | | <result property="param" column="param"/> |
| | | <result property="textParam" column="text_param"/> |
| | |
| | | pid, |
| | | guid, |
| | | preachform, |
| | | is_send, |
| | | send_type, |
| | | send_state, |
| | | param |
| | | from svy_task |
| | |
| | | <if test="pid != null ">and pid = #{pid}</if> |
| | | <if test="guid != null and guid != ''">and guid = #{guid}</if> |
| | | <if test="preachform != null and preachform != ''">and preachform = #{preachform}</if> |
| | | <if test="isSend != null ">and is_send = #{isSend}</if> |
| | | <if test="sendType != null ">and send_type = #{sendType}</if> |
| | | <if test="sendState != null and sendState != ''">and send_state = #{sendState}</if> |
| | | <if test="param != null and param != ''">and param = #{param}</if> |
| | | <if test="sendTimeSlot != null and sendTimeSlot != ''">and send_time_slot like concat('%', #{sendTimeSlot}, |
| | |
| | | <if test="pid != null">pid,</if> |
| | | <if test="guid != null">guid,</if> |
| | | <if test="preachform != null">preachform,</if> |
| | | <if test="isSend != null">is_send,</if> |
| | | <if test="sendType != null">send_type,</if> |
| | | <if test="sendState != null">send_state,</if> |
| | | <if test="param != null">param,</if> |
| | | <if test="textParam != null">text_param,</if> |
| | |
| | | <if test="pid != null">#{pid},</if> |
| | | <if test="guid != null">#{guid},</if> |
| | | <if test="preachform != null">#{preachform},</if> |
| | | <if test="isSend != null">#{isSend},</if> |
| | | <if test="sendType != null">#{sendType},</if> |
| | | <if test="sendState != null">#{sendState},</if> |
| | | <if test="param != null">#{param},</if> |
| | | <if test="textParam != null">#{textParam},</if> |
| | |
| | | <if test="pid != null">pid = #{pid},</if> |
| | | <if test="guid != null">guid = #{guid},</if> |
| | | <if test="preachform != null">preachform = #{preachform},</if> |
| | | <if test="isSend != null">is_send = #{isSend},</if> |
| | | <if test="sendType != null">send_type = #{sendType},</if> |
| | | <if test="sendState != null">send_state = #{sendState},</if> |
| | | <if test="param != null">param = #{param},</if> |
| | | <if test="textParam != null">text_param = #{textParam},</if> |
| | |
| | | <result property="questionResult" column="question_result" /> |
| | | <result property="otherdata" column="otherdata" /> |
| | | <result property="picturePath" column="picture_path" /> |
| | | <result property="sort" column="sort" /> |
| | | <result property="topic" column="topic" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectSvyTaskTemplateScriptVo"> |
| | | select ID, taskid, templateQuestionNum, templateID, scriptID, questiontitle, language, categoryName, questionPoint, questionText, questionVoice, noMatchText, noMatchVoice, slienceText, slienceVoice, submoduleText, submoduleVoice, noClearlyText, noClearlyVoice, is_must, playWavOnly, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid, value_type, targetOptions, targettype, targetid, targetvalue, next_question, question_result, otherdata, picture_path from svy_task_template_script |
| | | select ID,sort,topic, taskid, templateQuestionNum, templateID, scriptID, questiontitle, language, categoryName, questionPoint, questionText, questionVoice, noMatchText, noMatchVoice, slienceText, slienceVoice, submoduleText, submoduleVoice, noClearlyText, noClearlyVoice, is_must, playWavOnly, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid, value_type, targetOptions, targettype, targetid, targetvalue, next_question, question_result, otherdata, picture_path from svy_task_template_script |
| | | </sql> |
| | | |
| | | <select id="selectSvyTaskTemplateScriptList" parameterType="com.smartor.domain.SvyTaskTemplateScript" resultMap="SvyTaskTemplateScriptResult"> |
| | |
| | | <if test="questionResult != null and questionResult != ''"> and question_result = #{questionResult}</if> |
| | | <if test="otherdata != null and otherdata != ''"> and otherdata = #{otherdata}</if> |
| | | <if test="picturePath != null and picturePath != ''"> and picture_path = #{picturePath}</if> |
| | | <if test="topic != null and topic != ''"> and topic = #{topic}</if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | <if test="questionResult != null">question_result,</if> |
| | | <if test="otherdata != null">otherdata,</if> |
| | | <if test="picturePath != null">picture_path,</if> |
| | | <if test="sort != null">sort,</if> |
| | | <if test="topic != null">topic,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="taskid != null">#{taskid},</if> |
| | |
| | | <if test="questionResult != null">#{questionResult},</if> |
| | | <if test="otherdata != null">#{otherdata},</if> |
| | | <if test="picturePath != null">#{picturePath},</if> |
| | | <if test="sort != null">#{sort},</if> |
| | | <if test="topic != null">#{topic},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="questionResult != null">question_result = #{questionResult},</if> |
| | | <if test="otherdata != null">otherdata = #{otherdata},</if> |
| | | <if test="picturePath != null">picture_path = #{picturePath},</if> |
| | | <if test="sort != null">sort = #{sort},</if> |
| | | <if test="topic != null">topic = #{topic},</if> |
| | | </trim> |
| | | where ID = #{ID} |
| | | </update> |