陈昶聿
6 小时以前 cccb9150471097edd5f01e5c2a5724bfcea0101b
smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java
@@ -8,11 +8,13 @@
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysConfigService;
import com.smartor.domain.*;
import com.smartor.mapper.IvrLibaTargetMapper;
import com.smartor.mapper.IvrLibaTargetTagMapper;
import com.smartor.mapper.IvrLibaTargetoptionMapper;
import com.smartor.service.IIvrLibaTargetService;
import com.smartor.service.IServiceSubtaskService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -43,6 +45,12 @@
    @Autowired
    private IvrLibaTargetoptionMapper ivrLibaTargetoptionMapper;
    @Autowired
    private ISysConfigService configService;
    @Autowired
    private IServiceSubtaskService serviceSubtaskService;
    /**
     * 查询指标选项库
@@ -191,7 +199,7 @@
                }
            }
        }
        if (CollectionUtils.isNotEmpty(ivrLibaTargetVO.getTargetoptionList()) && ivrLibaTargetVO.getValueType() == 1) {
        if (CollectionUtils.isNotEmpty(ivrLibaTargetVO.getTargetoptionList()) && ivrLibaTargetVO.getScriptType().equals("1") || CollectionUtils.isNotEmpty(ivrLibaTargetVO.getTargetoptionList()) && ivrLibaTargetVO.getScriptType().equals("2")) {
            //选项处理
            for (IvrLibaTargetoption ivrLibaTargetoption : ivrLibaTargetVO.getTargetoptionList()) {
                if (CollectionUtils.isNotEmpty(ivrLibaTargetoption.getNodynamiccruxs())) {
@@ -201,6 +209,8 @@
                    ivrLibaTargetoption.setDynamiccruxsJson(new Gson().toJson(ivrLibaTargetoption.getDynamiccruxs()));
                }
                //指标库排序
                ivrLibaTargetoption.setSortid(ivrLibaTargetoption.getGuid());
                ivrLibaTargetoption.setGuid(ivrLibaTargetVO.getGuid());
                ivrLibaTargetoption.setOrgid(ivrLibaTargetVO.getOrgid());
                if (ivrLibaTargetoption.getIsoperation() != null && ivrLibaTargetoption.getIsoperation() == 1) {
@@ -216,7 +226,8 @@
                }
            }
        } else if (ivrLibaTargetVO.getValueType() == 2 || ivrLibaTargetVO.getValueType() == 3) {
        } else if (ivrLibaTargetVO.getScriptType().equals("3") || ivrLibaTargetVO.getScriptType().equals("4")) {
            //这里先等等
        }
        return ivrLibaTarget.getId().intValue();
@@ -248,7 +259,24 @@
     */
    @Override
    public String targetQuesMate(IvrLibaTargetVO ivrLibaTargetVO) {
        //1-AI识别
        String url = configService.selectConfigByKey("sys.voice.match.ai.url");
        if (ObjectUtils.isNotEmpty(url)) {
            String matchedText = "";
            String questionText = ivrLibaTargetVO.getQuestionText();
            String voiceText = ivrLibaTargetVO.getContent();
            List<IvrTaskTemplateTargetoption> options = DtoConversionUtils.sourceToTarget(ivrLibaTargetVO.getTargetoptionList(), IvrTaskTemplateTargetoption.class);
            //1-AI识别
            Integer matched = serviceSubtaskService.matchOptionIndex(url, questionText, voiceText, options, "1");
            if (ObjectUtils.isNotEmpty(matched)) {
                if (matched >= 0) {
                    matchedText = options.get(matched).getTargetvalue();
                }
            }
            log.info("ai匹配成功,匹配结果是:" + matchedText);
            return matchedText;
        }
        for (IvrLibaTargetoption ivrLibaTargetoption : ivrLibaTargetVO.getTargetoptionList()) {
            Matcher matcher = null;