From 1cff3842cca26d770bdba4f8fd2143742342b093 Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期一, 22 七月 2024 17:40:12 +0800 Subject: [PATCH] 代码提交 --- smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 42 insertions(+), 1 deletions(-) diff --git a/smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java index 50b52cf..e31e958 100644 --- a/smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java +++ b/smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java @@ -1,5 +1,7 @@ package com.smartor.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; @@ -18,7 +20,13 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; /** * 鎸囨爣閫夐」搴揝ervice涓氬姟灞傚鐞� @@ -65,6 +73,8 @@ List<IvrLibaTarget> ivrLibaTargets = ivrLibaTargetMapper.selectIvrLibaTargetList(ivrLibaTarget); List<IvrLibaTargetVO> ivrLibaTargetVOS = DtoConversionUtils.sourceToTarget(ivrLibaTargets, IvrLibaTargetVO.class); for (IvrLibaTargetVO ivrLibaTarget1 : ivrLibaTargetVOS) { + ivrLibaTarget1.setSuitWayList(JSONArray.parseArray(ivrLibaTarget1.getSuitWay(), String.class)); + IvrLibaTargetoption ivrLibaTargetoption = new IvrLibaTargetoption(); ivrLibaTargetoption.setTargetid(ivrLibaTarget1.getId()); //鑾峰彇璇ユ寚鏍囩殑閫夐」 @@ -138,6 +148,8 @@ @Transactional(rollbackFor = Exception.class) public int saveOrupdateIvrLibaTarget(IvrLibaTargetVO ivrLibaTargetVO) { IvrLibaTarget ivrLibaTarget = DtoConversionUtils.sourceToTarget(ivrLibaTargetVO, IvrLibaTarget.class); + if (ObjectUtils.isNotEmpty(ivrLibaTargetVO.getSuitWayList())) + ivrLibaTarget.setSuitWay(JSON.toJSONString(ivrLibaTargetVO.getSuitWayList())); ivrLibaTarget.setUpdateTime(DateUtils.getNowDate()); if (ivrLibaTargetVO.getIsoperation() != null && ivrLibaTargetVO.getIsoperation() == 1) { //鏂板 @@ -165,7 +177,8 @@ } } } - if (CollectionUtils.isNotEmpty(ivrLibaTargetVO.getTargetoptionList())) { + if (CollectionUtils.isNotEmpty(ivrLibaTargetVO.getTargetoptionList()) && ivrLibaTargetVO.getValueType() == 1) { + //閫夐」澶勭悊 for (IvrLibaTargetoption ivrLibaTargetoption : ivrLibaTargetVO.getTargetoptionList()) { if (CollectionUtils.isNotEmpty(ivrLibaTargetoption.getNodynamiccruxs())) { ivrLibaTargetoption.setNodynamiccruxsJson(new Gson().toJson(ivrLibaTargetoption.getNodynamiccruxs())); @@ -187,6 +200,7 @@ } } + } else if (ivrLibaTargetVO.getValueType() == 2 || ivrLibaTargetVO.getValueType() == 3) { } return ivrLibaTarget.getId().intValue(); @@ -212,4 +226,31 @@ public int deleteIvrLibaTargetByTargetID(Long id) { return ivrLibaTargetMapper.deleteIvrLibaTargetByTargetID(id); } + + /** + * 鎸囨爣娴嬭瘯闂鍖归厤 + */ + @Override + public String targetQuesMate(IvrLibaTargetVO ivrLibaTargetVO) { + + for (IvrLibaTargetoption ivrLibaTargetoption : ivrLibaTargetVO.getTargetoptionList()) { + + Matcher matcher = null; + if (StringUtils.isNotEmpty(ivrLibaTargetoption.getTargetregex())) { + Pattern pattern = Pattern.compile(ivrLibaTargetoption.getTargetregex()); + matcher = pattern.matcher(ivrLibaTargetVO.getContent()); + } + //涓嶅寘鍚� + Matcher matcher2 = null; + if (StringUtils.isNotEmpty(ivrLibaTargetoption.getTargetregex2())) { + Pattern pattern2 = Pattern.compile(ivrLibaTargetoption.getTargetregex2()); + matcher2 = pattern2.matcher(ivrLibaTargetVO.getContent()); + } + if (StringUtils.isNotEmpty(ivrLibaTargetoption.getTargetregex2()) && matcher2.matches() && StringUtils.isNotEmpty(ivrLibaTargetoption.getTargetregex()) && matcher.matches() || StringUtils.isEmpty(ivrLibaTargetoption.getTargetregex2()) && StringUtils.isNotEmpty(ivrLibaTargetoption.getTargetregex()) && matcher.matches()) { + return ivrLibaTargetoption.getTargetvalue(); + } + + } + return null; + } } -- Gitblit v1.9.3