| | |
| | | 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; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * 指标选项库Service业务层处理 |
| | |
| | | @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) { |
| | | //新增 |
| | |
| | | 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; |
| | | } |
| | | } |