From ef81a5cbfbb98974ed1ba54d0e47b7e74a9b96b9 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 06 六月 2024 15:33:55 +0800
Subject: [PATCH] 代码提交
---
smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 54 insertions(+), 3 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 a5d2db3..8262bf3 100644
--- a/smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java
@@ -1,7 +1,11 @@
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.utils.DateUtils;
import com.ruoyi.common.utils.DtoConversionUtils;
+import com.ruoyi.common.utils.StringUtils;
import com.smartor.domain.*;
import com.smartor.mapper.IvrLibaTargetMapper;
import com.smartor.mapper.IvrLibaTargetTagMapper;
@@ -15,6 +19,8 @@
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* 鎸囨爣閫夐」搴揝ervice涓氬姟灞傚鐞�
@@ -66,6 +72,17 @@
//鑾峰彇璇ユ寚鏍囩殑閫夐」
List<IvrLibaTargetoption> ivrLibaTargetoptions = ivrLibaTargetoptionMapper.selectIvrLibaTargetoptionList(ivrLibaTargetoption);
if (CollectionUtils.isNotEmpty(ivrLibaTargetoptions)) {
+ for (IvrLibaTargetoption ivrLibaTargetoption1 : ivrLibaTargetoptions) {
+ ObjectMapper objectMapper = new ObjectMapper();
+ try {
+ if (StringUtils.isNotEmpty(ivrLibaTargetoption1.getDynamiccruxsJson()))
+ ivrLibaTargetoption1.setDynamiccruxs(objectMapper.readValue(ivrLibaTargetoption1.getDynamiccruxsJson(), List.class));
+ if (StringUtils.isNotEmpty(ivrLibaTargetoption1.getNodynamiccruxsJson()))
+ ivrLibaTargetoption1.setNodynamiccruxs(objectMapper.readValue(ivrLibaTargetoption1.getNodynamiccruxsJson(), List.class));
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ }
+ }
ivrLibaTarget1.setTargetoptionList(ivrLibaTargetoptions);
}
//鑾峰彇璇ユ寚鏍囩殑鏍囩
@@ -150,8 +167,16 @@
}
}
}
- 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()));
+ }
+ if (CollectionUtils.isNotEmpty(ivrLibaTargetoption.getDynamiccruxs())) {
+ ivrLibaTargetoption.setDynamiccruxsJson(new Gson().toJson(ivrLibaTargetoption.getDynamiccruxs()));
+ }
+
if (ivrLibaTargetoption.getIsoperation() != null && ivrLibaTargetoption.getIsoperation() == 1) {
//鏂板
ivrLibaTargetoption.setTargetid(ivrLibaTarget.getId());
@@ -165,6 +190,7 @@
}
}
+ } else if (ivrLibaTargetVO.getValueType() == 2 || ivrLibaTargetVO.getValueType() == 3) {
}
return ivrLibaTarget.getId().intValue();
@@ -174,7 +200,6 @@
/**
* 鎵归噺鍒犻櫎鎸囨爣閫夐」搴�
*
- * @param targetIDs 闇�瑕佸垹闄ょ殑鎸囨爣閫夐」搴撲富閿�
* @return 缁撴灉
*/
@Override
@@ -185,11 +210,37 @@
/**
* 鍒犻櫎鎸囨爣閫夐」搴撲俊鎭�
*
- * @param targetID 鎸囨爣閫夐」搴撲富閿�
* @return 缁撴灉
*/
@Override
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