From 6d51501ca93f5bf46759f851988650477cf32e6c Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 12 六月 2024 18:02:45 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 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 45dd461..421f2c7 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,6 @@
 package com.smartor.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.gson.Gson;
@@ -19,6 +20,8 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * 鎸囨爣閫夐」搴揝ervice涓氬姟灞傚鐞�
@@ -138,6 +141,8 @@
     @Transactional(rollbackFor = Exception.class)
     public int saveOrupdateIvrLibaTarget(IvrLibaTargetVO ivrLibaTargetVO) {
         IvrLibaTarget ivrLibaTarget = DtoConversionUtils.sourceToTarget(ivrLibaTargetVO, IvrLibaTarget.class);
+        if (ObjectUtils.isEmpty(ivrLibaTargetVO.getSuitWayList()))
+            ivrLibaTarget.setSuitWay(JSON.toJSONString(ivrLibaTargetVO.getSuitWayList()));
         ivrLibaTarget.setUpdateTime(DateUtils.getNowDate());
         if (ivrLibaTargetVO.getIsoperation() != null && ivrLibaTargetVO.getIsoperation() == 1) {
             //鏂板
@@ -214,4 +219,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