From eb0b35549f024d7c0d3608e04fc51ef17ab3b2a0 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 24 七月 2026 14:16:23 +0800
Subject: [PATCH] (1)替换模板,需要将之前的任务模板删除

---
 smartor/src/main/java/com/smartor/domain/SvyTaskTemplate.java                 |    6 +-
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java |   38 +++++++++++--------
 smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml           |   74 ++++++++++++++++++------------------
 3 files changed, 62 insertions(+), 56 deletions(-)

diff --git a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplate.java b/smartor/src/main/java/com/smartor/domain/SvyTaskTemplate.java
index c0b0550..e774b24 100644
--- a/smartor/src/main/java/com/smartor/domain/SvyTaskTemplate.java
+++ b/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;
 
     /**
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
index 42ee2d7..f349cfa 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/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("璇ヤ换鍔″凡鍙戦�佺粰鎮h�咃紝涓嶈兘鍐嶈繘琛屼慨鏀规ā鏉�");
-
+        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;
                         }
-//                    }
+                    }
                     //璇存槑鍖归厤姝g‘浜�
                     if(matchedFlag){
                         //杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉�
diff --git a/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml b/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml
index 31eb308..73aee0e 100644
--- a/smartor/src/main/resources/mapper/smartor/SvyTaskTemplateMapper.xml
+++ b/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>
 

--
Gitblit v1.9.3