|  |  |  | 
|---|
|  |  |  | private IvrLibaTemplateScriptMapper ivrLibaTemplateScriptMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private TempDetpRelevanceMapper tempDetpRelevanceMapper; | 
|---|
|  |  |  | private TemplateDeptMapper tempDetpRelevanceMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询模板库 | 
|---|
|  |  |  | 
|---|
|  |  |  | for (IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO : ivrLibaTemplateVO.getIvrLibaTemplateScriptVOList()) { | 
|---|
|  |  |  | if (ivrLibaTemplateScriptVO.getIsoperation() != null) { | 
|---|
|  |  |  | IvrLibaTemplateScript ivrLibaTemplateScript = scriptHandle(ivrLibaTemplate, ivrLibaTemplateScriptVO, ivrLibaTemplateScriptVO.getIsoperation()); | 
|---|
|  |  |  | dealOption(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList(), ivrLibaTemplateScript, ivrLibaTemplate.getId(),ivrLibaTemplateScriptVO.getIsoperation()); | 
|---|
|  |  |  | //                    dealOption(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList(), ivrLibaTemplateScript, ivrLibaTemplate.getId(), ivrLibaTemplateScriptVO.getIsoperation()); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | IvrLibaTemplateScript ivrLibaTemplateScript = scriptHandle(ivrLibaTemplate, ivrLibaTemplateScriptVO, ivrLibaTemplateVO.getIsoperation()); | 
|---|
|  |  |  | dealOption(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList(), ivrLibaTemplateScript, ivrLibaTemplate.getId(),ivrLibaTemplateVO.getIsoperation()); | 
|---|
|  |  |  | //                    dealOption(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList(), ivrLibaTemplateScript, ivrLibaTemplate.getId(), ivrLibaTemplateVO.getIsoperation()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //对科室进行处理 | 
|---|
|  |  |  | for (TempDetpRelevance tempDetpRelevance : ivrLibaTemplateVO.getTempDetpRelevances()) { | 
|---|
|  |  |  | for (TemplateDept tempDetpRelevance : ivrLibaTemplateVO.getTempDetpRelevances()) { | 
|---|
|  |  |  | if (tempDetpRelevance.getId() == null) { | 
|---|
|  |  |  | //新增 | 
|---|
|  |  |  | tempDetpRelevance.setTempid(ivrLibaTemplate.getId()); | 
|---|
|  |  |  | tempDetpRelevance.setType(2L); | 
|---|
|  |  |  | tempDetpRelevance.setCreateTime(new Date()); | 
|---|
|  |  |  | tempDetpRelevanceMapper.insertTempDetpRelevance(tempDetpRelevance); | 
|---|
|  |  |  | tempDetpRelevanceMapper.insertTemplateDept(tempDetpRelevance); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | tempDetpRelevance.setUpdateTime(new Date()); | 
|---|
|  |  |  | tempDetpRelevanceMapper.updateTempDetpRelevance(tempDetpRelevance); | 
|---|
|  |  |  | tempDetpRelevanceMapper.updateTemplateDept(tempDetpRelevance); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | ivrLibaTemplateScript.setCreateTime(new Date()); | 
|---|
|  |  |  | ivrLibaTemplateScriptMapper.insertIvrLibaTemplateScript(ivrLibaTemplateScript); | 
|---|
|  |  |  | //对选项目进行处理 | 
|---|
|  |  |  | dealOption(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList(), ivrLibaTemplateScript, ivrLibaTemplate.getId(),isoperation); | 
|---|
|  |  |  | dealOption(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList(), ivrLibaTemplateScript, ivrLibaTemplate.getId(), isoperation); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } else if (isoperation == 2) { | 
|---|
|  |  |  | //修改 | 
|---|
|  |  |  | 
|---|
|  |  |  | if (CollectionUtils.isNotEmpty(ivrLibaTemplateTargetoption.getNodynamiccruxs())) | 
|---|
|  |  |  | ivrLibaTemplateTargetoption.setNodynamiccruxsJson(JSON.toJSONString(ivrLibaTemplateTargetoption.getNodynamiccruxs())); | 
|---|
|  |  |  | ivrLibaTemplateTargetOptionMapper.updateIvrLibaTemplateTargetoption(ivrLibaTemplateTargetoption); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (CollectionUtils.isEmpty(ivrLibaTemplateTargetoption.getDynamiccruxs())) { | 
|---|
|  |  |  | ivrLibaTemplateTargetoption.setDynamiccruxsJson(null); | 
|---|
|  |  |  | ivrLibaTemplateTargetOptionMapper.updateDynamiccruxs(ivrLibaTemplateTargetoption); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (CollectionUtils.isEmpty(ivrLibaTemplateTargetoption.getNodynamiccruxs())) { | 
|---|
|  |  |  | ivrLibaTemplateTargetoption.setNodynamiccruxsJson(null); | 
|---|
|  |  |  | ivrLibaTemplateTargetOptionMapper.updateDynamiccruxs(ivrLibaTemplateTargetoption); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else if (isoperation == 3) { | 
|---|
|  |  |  | //删除 | 
|---|
|  |  |  | if (ivrLibaTemplateTargetoption.getId() == null) { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //通过话术ID获取选项 | 
|---|
|  |  |  | for (IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO : ivrLibaTemplateScriptVOS) { | 
|---|
|  |  |  | log.info("ivrLibaTemplateScriptVO的主键id为:{}", ivrLibaTemplateScriptVO.getId()); | 
|---|
|  |  |  | log.error("ivrLibaTemplateScriptVO的主键id为:{}", ivrLibaTemplateScriptVO.getId()); | 
|---|
|  |  |  | IvrLibaTemplateTargetoption ivrLibaTemplateTargetoption = new IvrLibaTemplateTargetoption(); | 
|---|
|  |  |  | ivrLibaTemplateTargetoption.setScriptid(ivrLibaTemplateScriptVO.getId()); | 
|---|
|  |  |  | List<IvrLibaTemplateTargetoption> ivrLibaTemplateTargetoptions = ivrLibaTemplateTargetOptionMapper.selectIvrLibaTemplateTargetoptionList(ivrLibaTemplateTargetoption); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ivrLibaTemplateScriptVO.setIvrLibaScriptTargetoptionList(ivrLibaTemplateTargetoptions); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Collections.sort(ivrLibaTemplateScriptVOS, Comparator.comparing(IvrLibaTemplateScriptVO::getTargetid)); | 
|---|
|  |  |  | Collections.sort(ivrLibaTemplateScriptVOS, Comparator.comparing(IvrLibaTemplateScriptVO::getSort)); | 
|---|
|  |  |  | //数据组装 | 
|---|
|  |  |  | templateVO.setIvrLibaTemplateTagList(ivrLibaTemplateTags); | 
|---|
|  |  |  | templateVO.setIvrLibaTemplateScriptVOList(ivrLibaTemplateScriptVOS); | 
|---|