|
|
@@ -28,6 +28,7 @@ import com.fs.sop.mapper.SopUserLogsInfoMapper;
|
|
|
import com.fs.sop.params.DeleteQwSopParam;
|
|
|
import com.fs.sop.params.QwSopAutoByTags;
|
|
|
import com.fs.sop.params.SopUserLogsParamByDate;
|
|
|
+import com.fs.sop.util.SopTagMatchUtils;
|
|
|
import com.fs.voice.utils.StringUtil;
|
|
|
import com.fs.watch.mapper.WatchCompanyUserMapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -531,6 +532,14 @@ public class QwUserServiceAsyncHelperImpl implements IQwUserServiceAsyncHelper {
|
|
|
//匹配上剩下的标签看看符合不符合
|
|
|
qwSopRuleTimeVOS.forEach(ruleTimeVO -> {
|
|
|
|
|
|
+ // 标签规则:SQL 粗筛为 OR,此处按 filterType 精确校验(1含全部 / 2含任意)
|
|
|
+ if (!SopTagMatchUtils.customerMatchSopTags(ruleTimeVO.getFilterType(), ruleTimeVO.getTags(), cleanedTagList)) {
|
|
|
+ logger.info("客户标签不满足SOP规则,移出营期 sopId={}, filterType={}, sopTags={}, customerTags={}",
|
|
|
+ ruleTimeVO.getId(), ruleTimeVO.getFilterType(), ruleTimeVO.getTags(), cleanedTagList);
|
|
|
+ qwExternalContactService.deleteBySopIdToContactIdTools(ruleTimeVO.getId(), qwExternalContact.getUserId(), qwExternalContact.getCorpId(), qwExternalContact.getId());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 将排除的字符串转成列表
|
|
|
List<String> excludedTagsList = new ArrayList<>();
|
|
|
if (ruleTimeVO.getExcludeTags() != null && !ruleTimeVO.getExcludeTags().isEmpty()) {
|
|
|
@@ -589,9 +598,25 @@ public class QwUserServiceAsyncHelperImpl implements IQwUserServiceAsyncHelper {
|
|
|
|
|
|
logger.warn("sop任务的时间设置Tags:{}|{}|{}|{}", ruleTimeVO.getAutoSopTime(), ruleTimeVO.getId(), ruleTimeVO.getTags(), ruleTimeVO.getExcludeTags());
|
|
|
|
|
|
- //检查营期(如果开启了新客自动创建sop才检查营期,进入营期)
|
|
|
- if (ruleTimeVO.getIsAutoSop() == 1) {
|
|
|
- qwExternalContactService.qwSopRuleTimeToolsCheck(sopStartLocalDate, currentDate, dateFormatter, userLogs, logsInfo, userLogsParamByDate, qwAutoSopTimeParam, timeFormatter, localTime);
|
|
|
+ // 与 QwExternalContactServiceImpl.processTagsAll 保持一致:固定营期 / 自动时段入营
|
|
|
+ if (Integer.valueOf(1).equals(ruleTimeVO.getIsFixed())) {
|
|
|
+ qwExternalContactService.qwSopRuleTimeToolsCheckByIsFixed(sopStartLocalDate, dateFormatter, userLogs, logsInfo, userLogsParamByDate);
|
|
|
+ } else if (Integer.valueOf(1).equals(ruleTimeVO.getIsAutoSop())) {
|
|
|
+ if (qwAutoSopTimeParam == null) {
|
|
|
+ logger.warn("autoSopTime为空,降级按固定营期入营 sopId={}", ruleTimeVO.getId());
|
|
|
+ qwExternalContactService.qwSopRuleTimeToolsCheckByIsFixed(sopStartLocalDate, dateFormatter, userLogs, logsInfo, userLogsParamByDate);
|
|
|
+ } else {
|
|
|
+ qwExternalContactService.qwSopRuleTimeToolsCheck(sopStartLocalDate, currentDate, dateFormatter, userLogs, logsInfo, userLogsParamByDate, qwAutoSopTimeParam, timeFormatter, localTime);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 未开启「新客户自动创建sop」时,打标签原本不入营;
|
|
|
+ // 但标签已满足规则时仍应能入营(与删标签可移出对称,避免加回标签进不来)
|
|
|
+ logger.info("SOP未开启自动入营仍按标签规则入营 sopId={}, isAutoSop={}", ruleTimeVO.getId(), ruleTimeVO.getIsAutoSop());
|
|
|
+ if (qwAutoSopTimeParam == null) {
|
|
|
+ qwExternalContactService.qwSopRuleTimeToolsCheckByIsFixed(sopStartLocalDate, dateFormatter, userLogs, logsInfo, userLogsParamByDate);
|
|
|
+ } else {
|
|
|
+ qwExternalContactService.qwSopRuleTimeToolsCheck(sopStartLocalDate, currentDate, dateFormatter, userLogs, logsInfo, userLogsParamByDate, qwAutoSopTimeParam, timeFormatter, localTime);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|