liusheng
2024-04-26 b220383758021bcb26d0a788ebe9a31795d23b6d
代码提交
已修改10个文件
125 ■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/controller/hanler/ChatWebSocketHandler.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/config/PhoneUtils.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTask.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskSingleVO.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrTaskMapper.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/hanler/ChatWebSocketHandler.java
@@ -205,6 +205,38 @@
                        redisCache.setCacheObject(userId + "noVoice", noVoice2, 120, TimeUnit.MINUTES);
                    }
                } else {
                    //通过valueType判断是什么题型(值类型(1 选项  2 文本  3 数值))
                    if (ivrLibaTemplateScriptVO.getValueType() == 2 || ivrLibaTemplateScriptVO.getValueType() == 3) {
                        ivrLibaTemplateScriptVO.setQuestionResult(questionMessage.getContent());
                        List<IvrLibaTemplateScriptVO> backQusetList = redisCache.getCacheObject(userId + "backQuset");
                        //匹配完成后,将结果保存到新的数组
                        backQusetList.add(ivrLibaTemplateScriptVO);
                        redisCache.setCacheObject(userId + "backQuset", backQusetList, 120, TimeUnit.MINUTES);
                        //将静默置为0
                        redisCache.setCacheObject(userId + "noVoice", 0, 120, TimeUnit.MINUTES);
                        //获取下一题
                        Integer nextQuestion = ivrLibaTemplateScriptVO.getTargetid() + 1;
                        if (nextQuestion > ivrLibaTemplateScriptVOList.size()) {
                            //如果下一题没有了,就结束了
                            QuestionMessage returnQues = new QuestionMessage();
                            List<IvrLibaTemplateScriptVO> backQusetRedis = redisCache.getCacheObject(userId + "backQuset");
                            returnQues.setContent(JSON.toJSONString(backQusetRedis));
                            returnQues.setJsy(ivrLibaTemplateVO1.getRevisitAfter());
                            redisCache.setCacheObject(userId + "returnQues", returnQues, 120, TimeUnit.MINUTES);
                            redisCache.setCacheObject(userId + "isOver", 1, 120, TimeUnit.MINUTES);
                        } else {
                            for (IvrLibaTemplateScriptVO script : ivrLibaTemplateScriptVOList) {
                                if (script.getTargetid() == nextQuestion) {
                                    QuestionMessage returnQues = new QuestionMessage();
                                    returnQues.setNowQuestion(script);
                                    redisCache.setCacheObject(userId + "returnQues", returnQues, 120, TimeUnit.MINUTES);
                                }
                            }
                        }
                    } else if (ivrLibaTemplateScriptVO.getValueType() == 1) {
                    //对回答的问题,进行正则匹配(这里只针对选择题,其它题型不行)x
                    for (int j = 0; j < ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().size(); j++) {
                        //包含
@@ -284,6 +316,7 @@
                            }
                        }
                    }
                    }
                    //选项匹配完成后,需要再去通过库再进行匹配一次
                    String extemplateID = ivrLibaTemplateVO1.getSubmoduleID();
                    String[] split = extemplateID.split(",");
@@ -329,6 +362,7 @@
                        }
                    }
                }
            }
            QuestionMessage returnQues = redisCache.getCacheObject(userId + "returnQues");
            List<IvrLibaTemplateScriptVO> backQusetRedis = redisCache.getCacheObject(userId + "backQuset");
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java
@@ -1,6 +1,8 @@
package com.ruoyi.web.controller.smartor;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
@@ -50,6 +52,14 @@
        PageUtils.startPageByPost(ivrTask.getPageNum(), ivrTask.getPageSize());
        List<IvrTask> list = ivrTaskService.selectIvrTaskList(ivrTask);
        List<IvrTaskVO> ivrTaskVOS = DtoConversionUtils.sourceToTarget(list, IvrTaskVO.class);
        //设置分页
        TableDataInfo rspData = new TableDataInfo();
        rspData.setCode(HttpStatus.SUCCESS);
        rspData.setMsg("查询成功");
        rspData.setRows(null);
        rspData.setTotal(0);
        if (CollectionUtils.isNotEmpty(ivrTaskVOS)) {
            for (IvrTaskVO ivrTaskVO : ivrTaskVOS) {
                IvrTaskSingle ivrTaskcall = new IvrTaskSingle();
@@ -64,8 +74,18 @@
                    ivrTaskVO.setWfs(wfs);
                }
            }
            //用于分页
            ivrTask.setPageNum(null);
            ivrTask.setPageSize(null);
            List<IvrTask> ivrTasks = ivrTaskService.selectIvrTaskList(ivrTask);
            rspData.setCode(HttpStatus.SUCCESS);
            rspData.setMsg("查询成功");
            rspData.setRows(ivrTaskVOS);
            rspData.setTotal(new PageInfo(ivrTasks).getTotal());
        }
        return getDataTable(ivrTaskVOS);
        return rspData;
    }
    /**
ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
@@ -18,6 +18,8 @@
import org.springframework.web.context.request.ServletRequestAttributes;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -164,7 +166,7 @@
            if (inputStream == null) {
                throw new HttpRequestException(RESPONSE_NULL_ERROR_CODE, "响应为null");
            }
            BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
            BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("GB2312")));
            StringBuffer stringBuffer = new StringBuffer();
            String str = "";
            while ((str = reader.readLine()) != null) {
@@ -186,7 +188,7 @@
                        RESPBODY respBody = JSON.parseObject(respStr, respBodyClass);
                        rep = new HttpEntity<RESPBODY>(respHeaders, respBody);
                    } else {
                        rep = new HttpEntity<RESPBODY>(respHeaders, (RESPBODY) respStr);
                        rep = new HttpEntity<RESPBODY>(respHeaders, (RESPBODY) new String(respStr.getBytes("ISO8859-1"), StandardCharsets.UTF_8));
                    }
                }
                return rep;
smartor/src/main/java/com/smartor/config/PhoneUtils.java
@@ -241,6 +241,7 @@
        map.put("dnis", dnis);
        map.put("call_uuid", call_uuid);
        map.put("force_call", force_call);
        map.put("fs_node_id", 8021);
        if (force_call == null) map.put("force_call", true);
        return sendReq(map, "/tel/ai_api/outbound");
    }
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
@@ -158,7 +158,7 @@
     */
    @Excel(name = "值类型", readConverterExp = "1=,选=项,2=,文=本,3=,数=值")
    @ApiModelProperty(value = "值类型(1 选项  2 文本  3 数值)")
    private Long isEnable;
    private Long valueType;
    /**
     * 删除标记
@@ -253,4 +253,11 @@
    @Excel(name = "是否必填(给人工用的,AI不用遵守)")
    @ApiModelProperty(value = "是否必填(给人工用的,AI不用遵守)")
    private String isMust;
    /**
     * 问题结果(给“值类型”是文本或者数值用的)
     */
    @Excel(name = "问题结果(给“值类型”是文本或者数值用的)")
    @ApiModelProperty(value = "问题结果(给“值类型”是文本或者数值用的)")
    private String questionResult;
}
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
@@ -158,7 +158,7 @@
     */
    @Excel(name = "值类型", readConverterExp = "1=,选=项,2=,文=本,3=,数=值")
    @ApiModelProperty(value = "值类型(1 选项  2 文本  3 数值)")
    private Long isEnable;
    private Long valueType;
    /**
     * 删除标记
@@ -255,6 +255,13 @@
    private String isMust;
    /**
     * 问题结果(给“值类型”是文本或者数值用的)
     */
    @Excel(name = "问题结果(给“值类型”是文本或者数值用的)")
    @ApiModelProperty(value = "问题结果(给“值类型”是文本或者数值用的)")
    private String questionResult;
    /**
     * 话术选项
     */
    @ApiModelProperty(value = "话术选项")
smartor/src/main/java/com/smartor/domain/IvrTask.java
@@ -31,7 +31,7 @@
     */
    @Excel(name = "任务名称  ")
    @ApiModelProperty(value = "任务名称")
    private String taskname;
    private String taskName;
    /**
     * 模板ID
smartor/src/main/java/com/smartor/domain/IvrTaskSingleVO.java
@@ -282,6 +282,20 @@
    private Long isupload;
    /**
     * 患者ID
     */
    @Excel(name = "患者ID")
    @ApiModelProperty(value = "患者ID")
    private String patientid;
    /**
     * 患者姓名
     */
    @Excel(name = "患者姓名")
    @ApiModelProperty(value = "患者姓名")
    private String patientname;
    /**
     * 上传时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
@@ -24,7 +24,7 @@
        <result property="targetOptions" column="targetOptions"/>
        <result property="language" column="language"/>
        <result property="playWavOnly" column="playWavOnly"/>
        <result property="isEnable" column="isEnable"/>
        <result property="valueType" column="value_type"/>
        <result property="delFlag" column="del_flag"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
@@ -42,6 +42,7 @@
        <result property="nextQuestion" column="next_question"/>
        <result property="otherdata" column="otherdata"/>
        <result property="isMust" column="is_must"/>
        <result property="questionResult" column="question_result"/>
    </resultMap>
    <sql id="selectIvrLibaTemplateScriptVo">
@@ -68,7 +69,8 @@
               next_question,
               otherdata,
               is_must,
               targetOptions, language, playWavOnly, isEnable, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid
               question_result,
               targetOptions, language, playWavOnly, value_type, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid
        from ivr_liba_template_script
    </sql>
@@ -92,13 +94,14 @@
            <if test="noClearlyVoice != null  and noClearlyVoice != ''">and noClearlyVoice = #{noClearlyVoice}</if>
            <if test="questiontitle != null  and questiontitle != ''">and questiontitle = #{questiontitle}</if>
            <if test="nextQuestion != null  and nextQuestion != ''">and next_question = #{nextQuestion}</if>
            <if test="questionResult != null  and questionResult != ''">and question_result = #{questionResult}</if>
            <if test="categoryName != null  and categoryName != ''">and categoryName like concat('%', #{categoryName},
                '%')
            </if>
            <if test="targetOptions != null  and targetOptions != ''">and targetOptions = #{targetOptions}</if>
            <if test="language != null  and language != ''">and language = #{language}</if>
            <if test="playWavOnly != null ">and playWavOnly = #{playWavOnly}</if>
            <if test="isEnable != null ">and isEnable = #{isEnable}</if>
            <if test="valueType != null ">and value_type = #{valueType}</if>
            <if test="isupload != null ">and isupload = #{isupload}</if>
            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
@@ -139,7 +142,7 @@
            <if test="targetOptions != null">targetOptions,</if>
            <if test="language != null and language != ''">language,</if>
            <if test="playWavOnly != null">playWavOnly,</if>
            <if test="isEnable != null">isEnable,</if>
            <if test="valueType != null">value_type,</if>
            <if test="delFlag != null and delFlag != ''">del_flag,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
@@ -157,6 +160,7 @@
            <if test="nextQuestion != null">next_question,</if>
            <if test="otherdata != null">otherdata,</if>
            <if test="isMust != null  and isMust != ''">is_must,</if>
            <if test="questionResult != null  and questionResult != ''">question_result,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="templateQuestionNum != null">#{templateQuestionNum},</if>
@@ -177,7 +181,7 @@
            <if test="targetOptions != null">#{targetOptions},</if>
            <if test="language != null and language != ''">#{language},</if>
            <if test="playWavOnly != null">#{playWavOnly},</if>
            <if test="isEnable != null">#{isEnable},</if>
            <if test="valueType != null">#{valueType},</if>
            <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
@@ -195,6 +199,7 @@
            <if test="nextQuestion != null">#{nextQuestion},</if>
            <if test="otherdata != null">#{otherdata},</if>
            <if test="isMust != null  and isMust != ''">#{isMust},</if>
            <if test="questionResult != null  and questionResult != ''">#{questionResult},</if>
        </trim>
    </insert>
@@ -219,7 +224,7 @@
            <if test="targetOptions != null">targetOptions = #{targetOptions},</if>
            <if test="language != null and language != ''">language = #{language},</if>
            <if test="playWavOnly != null">playWavOnly = #{playWavOnly},</if>
            <if test="isEnable != null">isEnable = #{isEnable},</if>
            <if test="valueType != null">value_type = #{valueType},</if>
            <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
@@ -237,6 +242,7 @@
            <if test="nextQuestion != null">next_question = #{nextQuestion},</if>
            <if test="otherdata != null">otherdata = #{otherdata},</if>
            <if test="isMust != null  and isMust != ''">is_must = #{isMust}</if>
            <if test="questionResult != null  and questionResult != ''">question_result = #{questionResult},</if>
        </trim>
        where ID = #{ID}
    </update>
smartor/src/main/resources/mapper/smartor/IvrTaskMapper.xml
@@ -6,7 +6,7 @@
    <resultMap type="com.smartor.domain.IvrTask" id="IvrTaskResult">
        <result property="taskid" column="taskid"/>
        <result property="taskname" column="taskname"/>
        <result property="taskName" column="taskname"/>
        <result property="templateid" column="templateid"/>
        <result property="templatename" column="templatename"/>
        <result property="labelinfo" column="labelinfo"/>
@@ -82,7 +82,7 @@
    <select id="selectIvrTaskList" parameterType="com.smartor.domain.IvrTask" resultMap="IvrTaskResult">
        <include refid="selectIvrTaskVo"/>
        <where>
            <if test="taskname != null  and taskname != ''">and taskname like concat('%', #{taskname}, '%')</if>
            <if test="taskName != null  and taskName != ''">and taskname like concat('%', #{taskName}, '%')</if>
            <if test="templateid != null  and templateid != ''">and templateid = #{templateid}</if>
            <if test="templatename != null  and templatename != ''">and templatename like concat('%', #{templatename},
                '%')
@@ -121,7 +121,7 @@
            keyProperty="taskid">
        insert into ivr_task
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="taskname != null">taskname,</if>
            <if test="taskName != null">taskname,</if>
            <if test="templateid != null">templateid,</if>
            <if test="templatename != null">templatename,</if>
            <if test="labelinfo != null">labelinfo,</if>
@@ -156,7 +156,7 @@
            <if test="param != null">param,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskname != null">#{taskname},</if>
            <if test="taskName != null">#{taskName},</if>
            <if test="templateid != null">#{templateid},</if>
            <if test="templatename != null">#{templatename},</if>
            <if test="labelinfo != null">#{labelinfo},</if>
@@ -195,7 +195,7 @@
    <update id="updateIvrTask" parameterType="com.smartor.domain.IvrTask">
        update ivr_task
        <trim prefix="SET" suffixOverrides=",">
            <if test="taskname != null">taskname = #{taskname},</if>
            <if test="taskName != null">taskname = #{taskName},</if>
            <if test="templateid != null">templateid = #{templateid},</if>
            <if test="templatename != null">templatename = #{templatename},</if>
            <if test="labelinfo != null">labelinfo = #{labelinfo},</if>