liusheng
16 小时以前 eb0b35549f024d7c0d3608e04fc51ef17ab3b2a0
(1)替换模板,需要将之前的任务模板删除
已修改3个文件
118 ■■■■ 文件已修改
smartor/src/main/java/com/smartor/domain/SvyTaskTemplate.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml 74 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SvyTaskTemplate.java
@@ -63,10 +63,10 @@
    private String description;
    /**
     * 问卷介绍
     * 问卷介绍(当备注用)
     */
    @Excel(name = " 问卷介绍 ")
    @ApiModelProperty(value = "问卷介绍")
    @Excel(name = " 问卷介绍(当备注用) ")
    @ApiModelProperty(value = "问卷介绍(当备注用)")
    private String introduce;
    /**
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -655,9 +655,16 @@
        ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(serviceSubtaskTemplateVO.getSubId());
        if (serviceSubtask == null || serviceSubtask.getSendstate() != 2L)
            throw new BaseException("该任务已发送给患者,不能再进行修改模板");
        serviceSubtaskTemplateVO.getSvyTaskTemplateVO().setIntroduce("该问卷是替换后的问题,替换前的问题是:" + serviceSubtask.getTemplateid());
        Integer taskTempid = svyTaskTemplateService.saveOrUpdateTemplate(serviceSubtaskTemplateVO.getSvyTaskTemplateVO());
        if (taskTempid == null) return false;
        //每次都新建一个也可以,但新建之后要把之前的删除
        if (serviceSubtask.getType().equals("2")) {
            svyTaskTemplateService.deleteSvyTaskTemplateBySvyid(serviceSubtask.getTemplateid());
        } else if (serviceSubtask.getType().equals("1"))
            ivrTaskTemplateService.deleteIvrTaskTemplateByID(serviceSubtask.getTemplateid());
        String tempName = svyTaskTemplateService.selectSvyTaskTemplateBySvyid(Long.valueOf(taskTempid)).getSvyname();
        serviceSubtask.setTemplateid(taskTempid.longValue());
@@ -1719,12 +1726,6 @@
                }
            }
//            //2-AI识别
//            SysConfig configVoiceMatchType = new SysConfig();
//            configVoiceMatchType.setOrgid(phoneCallReqYQVO.getOrgid());
//            configVoiceMatchType.setConfigKey("sys.voice.match.type");
//            SysConfig matchType = sysConfigMapper.selectConfig(configVoiceMatchType);
            //如果是文本回调
            //根据问题ID获取该问题的类型
            if (ivrTaskTemplateScriptVO.getScriptType().equals("1")) {
@@ -1736,15 +1737,20 @@
                    if (StringUtils.isEmpty(phoneCallReqYQVO.getAsrtext())) {
                        continue;
                    }
                    //2-AI识别
                    SysConfig configVoiceMatchType = new SysConfig();
                    configVoiceMatchType.setOrgid(phoneCallReqYQVO.getOrgid());
                    configVoiceMatchType.setConfigKey("sys.voice.match.type");
                    SysConfig matchType = sysConfigMapper.selectConfig(configVoiceMatchType);
                    boolean matchedFlag = false;
//                    if(ObjectUtils.isNotEmpty(matchType) && StringUtils.isNotEmpty(matchType.getConfigValue()) && matchType.getConfigValue().equals("2")){
//                        int checkFlag = DeepSeekApi.matchQuestionAnswer(ivrTaskTemplateScriptVO.getScriptContent(),
//                                phoneCallReqYQVO.getAsrtext(),
//                                ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetvalue());
//                        if(checkFlag == 1){
//                            matchedFlag = true;
//                        }
//                    }else {
                    if (ObjectUtils.isNotEmpty(matchType) && StringUtils.isNotEmpty(matchType.getConfigValue()) && matchType.getConfigValue().equals("2")) {
                        int checkFlag = DeepSeekApi.matchQuestionAnswer(ivrTaskTemplateScriptVO.getScriptContent(),
                                phoneCallReqYQVO.getAsrtext(),
                                ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetvalue());
                        if (checkFlag == 1) {
                            matchedFlag = true;
                        }
                    } else {
                        //包含
                        Matcher matcher = null;
                        if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex())) {
@@ -1761,7 +1767,7 @@
                        if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches() || StringUtils.isEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches()) {
                            matchedFlag = true;
                        }
//                    }
                    }
                    //说明匹配正确了
                    if(matchedFlag){
                        //这里应该先判断类型,去再修改,设置IsUserOperation是单选题的改法
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml
@@ -93,45 +93,45 @@
            resultMap="SvyTaskTemplateResult">
        <include refid="selectSvyTaskTemplateVo"/>
        where 1=1
            and del_flag = 0
            <if test="templateid != null ">and templateid = #{templateid}</if>
            <if test="id != null ">and id = #{id}</if>
            <if test="categoryid != null ">and categoryid = #{categoryid}</if>
            <if test="svycode != null  and svycode != ''">and svycode = #{svycode}</if>
            <if test="svyname != null  and svyname != ''">and svyname like concat('%', #{svyname}, '%')</if>
            <if test="description != null  and description != ''">and description = #{description}</if>
            <if test="introduce != null  and introduce != ''">and introduce = #{introduce}</if>
            <if test="submitprompt != null  and submitprompt != ''">and submitprompt = #{submitprompt}</if>
            <if test="tag != null  and tag != ''">and tag = #{tag}</if>
            <if test="version != null ">and version = #{version}</if>
            <if test="centerlibrarycode != null  and centerlibrarycode != ''">and centerlibrarycode =
                #{centerlibrarycode}
            </if>
            <if test="centerlibraryid != null ">and centerlibraryid = #{centerlibraryid}</if>
            <if test="islocal != null ">and islocal = #{islocal}</if>
            <if test="isenable != null  and isenable != ''">and isenable = #{isenable}</if>
            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
            <if test="isupload != null ">and isupload = #{isupload}</if>
            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
            <if test="taskScriptId != null  and taskScriptId != ''">and task_script_id = #{taskScriptId}</if>
            <if test="pid != null ">and pid = #{pid}</if>
            <if test="guid != null  and guid != ''">and guid = #{guid}</if>
            <if test="deptNames != null  and deptNames != ''">and dept_names = #{deptNames}</if>
            <if test="labelInfo != null  and labelInfo != ''">and label_info = #{labelInfo}</if>
            <if test="campus != null  and campus != ''">and campus = #{campus}</if>
            <if test="suitway != null  and suitway != ''">and suitway = #{suitway}</if>
            <if test="otherdata != null  and otherdata != ''">and otherdata = #{otherdata}</if>
            <if test="valueType != null  and valueType != ''">and value_type = #{valueType}</if>
            <if test="reply != null  and reply != ''">and reply = #{reply}</if>
            <if test="taskid != null ">and taskid = #{taskid}</if>
            <if test="deptCode != null ">and dept_code = #{deptCode}</if>
            <if test="longTemp != null ">and long_temp = #{longTemp}</if>
            <if test="sendDay != null ">and send_day = #{sendDay}</if>
        and del_flag = 0
        <if test="templateid != null ">and templateid = #{templateid}</if>
        <if test="id != null ">and id = #{id}</if>
        <if test="categoryid != null ">and categoryid = #{categoryid}</if>
        <if test="svycode != null  and svycode != ''">and svycode = #{svycode}</if>
        <if test="svyname != null  and svyname != ''">and svyname like concat('%', #{svyname}, '%')</if>
        <if test="description != null  and description != ''">and description = #{description}</if>
        <if test="introduce != null  and introduce != ''">and introduce = #{introduce}</if>
        <if test="submitprompt != null  and submitprompt != ''">and submitprompt = #{submitprompt}</if>
        <if test="tag != null  and tag != ''">and tag = #{tag}</if>
        <if test="version != null ">and version = #{version}</if>
        <if test="centerlibrarycode != null  and centerlibrarycode != ''">and centerlibrarycode =
            #{centerlibrarycode}
        </if>
        <if test="centerlibraryid != null ">and centerlibraryid = #{centerlibraryid}</if>
        <if test="islocal != null ">and islocal = #{islocal}</if>
        <if test="isenable != null  and isenable != ''">and isenable = #{isenable}</if>
        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
        <if test="isupload != null ">and isupload = #{isupload}</if>
        <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
        <if test="taskScriptId != null  and taskScriptId != ''">and task_script_id = #{taskScriptId}</if>
        <if test="pid != null ">and pid = #{pid}</if>
        <if test="guid != null  and guid != ''">and guid = #{guid}</if>
        <if test="deptNames != null  and deptNames != ''">and dept_names = #{deptNames}</if>
        <if test="labelInfo != null  and labelInfo != ''">and label_info = #{labelInfo}</if>
        <if test="campus != null  and campus != ''">and campus = #{campus}</if>
        <if test="suitway != null  and suitway != ''">and suitway = #{suitway}</if>
        <if test="otherdata != null  and otherdata != ''">and otherdata = #{otherdata}</if>
        <if test="valueType != null  and valueType != ''">and value_type = #{valueType}</if>
        <if test="reply != null  and reply != ''">and reply = #{reply}</if>
        <if test="taskid != null ">and taskid = #{taskid}</if>
        <if test="deptCode != null ">and dept_code = #{deptCode}</if>
        <if test="longTemp != null ">and long_temp = #{longTemp}</if>
        <if test="sendDay != null ">and send_day = #{sendDay}</if>
    </select>
    <select id="selectSvyTaskTemplateBySvyid" parameterType="Long" resultMap="SvyTaskTemplateResult">
        <include refid="selectSvyTaskTemplateVo"/>
        where del_flag=0 and  id = #{id}
        where del_flag=0 and id = #{id}
    </select>
    <insert id="insertSvyTaskTemplate" parameterType="com.smartor.domain.SvyTaskTemplate" useGeneratedKeys="true"
@@ -265,8 +265,8 @@
    </update>
    <delete id="deleteSvyTaskTemplateBySvyid" parameterType="Long">
        delete
        from svy_task_template
        update svy_task_template
        set del_flag=1
        where id = #{id}
    </delete>