liusheng
2024-09-18 907641e56c2085aaa81f267946dc3e3e9fca73e7
smartor/src/main/java/com/smartor/service/impl/IvrLibaScriptServiceImpl.java
@@ -1,8 +1,12 @@
package com.smartor.service.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.StringUtils;
import com.smartor.domain.*;
import com.smartor.mapper.IvrLibaScriptMapper;
import com.smartor.mapper.IvrLibaScriptTagMapper;
@@ -87,6 +91,19 @@
        IvrLibaScriptTargetoption ivrLibaScriptTargetoption = new IvrLibaScriptTargetoption();
        ivrLibaScriptTargetoption.setScriptid(ivrLibaScripts.get(0).getId());
        List<IvrLibaScriptTargetoption> ivrLibaScriptTargetoptions = ivrLibaScriptTargetoptionMapper.selectIvrLibaScriptTargetoptionList(ivrLibaScriptTargetoption);
        for (IvrLibaScriptTargetoption ivrLibaScriptTargetoption1 : ivrLibaScriptTargetoptions) {
            ObjectMapper objectMapper = new ObjectMapper();
            try {
                if (StringUtils.isNotEmpty(ivrLibaScriptTargetoption1.getDynamiccruxsJson()))
                    ivrLibaScriptTargetoption1.setDynamiccruxs(objectMapper.readValue(ivrLibaScriptTargetoption1.getDynamiccruxsJson(), List.class));
                if (StringUtils.isNotEmpty(ivrLibaScriptTargetoption1.getNodynamiccruxsJson()))
                    ivrLibaScriptTargetoption1.setNodynamiccruxs(objectMapper.readValue(ivrLibaScriptTargetoption1.getNodynamiccruxsJson(), List.class));
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            }
        }
        scriptVO.setIvrLibaScriptTargetoptionList(ivrLibaScriptTargetoptions);
//        //查询问题指标接口
@@ -119,31 +136,17 @@
        if (ivrLibaScript.getId() == null) {
            throw new BaseException("话术ID为空,请检查话术入参信息是否完整");
        }
//        //对问题指标进行处理
//        if (CollectionUtils.isNotEmpty(ivrLibaScriptVO.getIvrLibaScriptTargetList())) {
//            for (IvrLibaScriptTarget ivrLibaScriptTarget : ivrLibaScriptVO.getIvrLibaScriptTargetList()) {
//                if (ivrLibaScriptTarget.getIsoperation() != null && ivrLibaScriptTarget.getIsoperation() == 1) {
//                    //新增
//                    ivrLibaScriptTarget.setScriptid(ivrLibaScript.getId());
//                    ivrLibaScriptTargetMapper.insertIvrLibaScriptTarget(ivrLibaScriptTarget);
//                } else if (ivrLibaScriptTarget.getIsoperation() != null && ivrLibaScriptTarget.getIsoperation() == 2) {
//                    //修改
//                    ivrLibaScriptTarget.setScriptid(ivrLibaScript.getId());
//                    ivrLibaScriptTargetMapper.updateIvrLibaScriptTarget(ivrLibaScriptTarget);
//                } else if (ivrLibaScriptTarget.getIsoperation() != null && ivrLibaScriptTarget.getIsoperation() == 3) {
//                    //删除
//                    if (ivrLibaScriptTarget.getId() == null) {
//                        log.info("删除失败,问题指标id为空");
//                    } else {
//                        ivrLibaScriptTargetMapper.deleteIvrLibaScriptTargetByQuestionTargetID(ivrLibaScriptTarget.getId());
//                    }
//                }
//            }
//        }
        //对问题指标选项进行处理
        if (CollectionUtils.isNotEmpty(ivrLibaScriptVO.getIvrLibaScriptTargetoptionList())) {
            for (IvrLibaScriptTargetoption ivrLibaScriptTargetoption : ivrLibaScriptVO.getIvrLibaScriptTargetoptionList()) {
                if (CollectionUtils.isNotEmpty(ivrLibaScriptTargetoption.getNodynamiccruxs())) {
                    ivrLibaScriptTargetoption.setNodynamiccruxsJson(new Gson().toJson(ivrLibaScriptTargetoption.getNodynamiccruxs()));
                }
                if (CollectionUtils.isNotEmpty(ivrLibaScriptTargetoption.getDynamiccruxs())) {
                    ivrLibaScriptTargetoption.setDynamiccruxsJson(new Gson().toJson(ivrLibaScriptTargetoption.getDynamiccruxs()));
                }
                if (ivrLibaScriptTargetoption.getIsoperation() != null && ivrLibaScriptTargetoption.getIsoperation() == 1) {
                    //新增
                    ivrLibaScriptTargetoption.setScriptid(ivrLibaScript.getId());
@@ -159,7 +162,8 @@
                    if (ivrLibaScriptTargetoption.getId() == null) {
                        log.info("删除失败,问题指标选项id为空");
                    } else {
                        ivrLibaScriptTargetoptionMapper.deleteIvrLibaScriptTargetoptionByTargetoptionid(ivrLibaScriptTargetoption.getId());
                        Boolean aBoolean = ivrLibaScriptTargetoptionMapper.deleteIvrLibaScriptTargetoptionByTargetoptionid(ivrLibaScriptTargetoption.getId());
                        log.info("aBoolean的值为:{}", aBoolean);
                    }
                }
            }
@@ -188,8 +192,6 @@
                }
            }
        }
        return i;
    }