|
@@ -191,9 +191,6 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
@Autowired
|
|
|
private QwTagMapper qwTagMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
- private QwExternalContactServiceImpl qwExternalContactService;
|
|
|
-
|
|
|
|
|
|
org.slf4j.Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
|
@@ -417,7 +414,7 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
|
|
|
// 获取组公共信息(每组只需查一次)
|
|
|
QwExternalContact sample = group.get(0);
|
|
|
- QwUser qwUser = qwExternalContactService.getQwUserByRedis(sample.getCorpId(), sample.getUserId());
|
|
|
+ QwUser qwUser = this.getQwUserByRedis(sample.getCorpId(), sample.getUserId());
|
|
|
if (qwUser == null) {
|
|
|
logger.error("无企微员工信息: {}|{}", sample.getUserId(), sample.getCorpId());
|
|
|
return;
|
|
@@ -3248,8 +3245,18 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
if (i == 1) {
|
|
|
return;
|
|
|
}
|
|
|
- // 判断 SOP 任务的开始时间
|
|
|
- qwSopRuleTimeToolsCheck(sopStartLocalDate,currentDate,dateFormatter,userLogs,logsInfo,userLogsParamByDate,qwAutoSopTimeParam,timeFormatter,localTime);
|
|
|
+
|
|
|
+ if (Integer.valueOf(1).equals(ruleTimeVO.getIsFixed())){
|
|
|
+
|
|
|
+ qwSopRuleTimeToolsCheckByIsFixed(sopStartLocalDate,dateFormatter,userLogs,logsInfo,userLogsParamByDate);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ // 判断 SOP 任务的开始时间
|
|
|
+ qwSopRuleTimeToolsCheck(sopStartLocalDate,currentDate,dateFormatter,userLogs,logsInfo,userLogsParamByDate,qwAutoSopTimeParam,timeFormatter,localTime);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -3859,8 +3866,17 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
logsInfo.setExternalUserName(qwExternalContact.getName());
|
|
|
logsInfo.setSopId(ruleTimeVO.getId());
|
|
|
|
|
|
- //检查营期
|
|
|
- qwSopRuleTimeToolsCheck(sopStartLocalDate,currentDate,dateFormatter,userLogs,logsInfo,userLogsParamByDate,qwAutoSopTimeParam,timeFormatter,localTime);
|
|
|
+
|
|
|
+ //如果是固定营期
|
|
|
+ if (Integer.valueOf(1).equals(ruleTimeVO.getIsFixed())){
|
|
|
+
|
|
|
+ qwSopRuleTimeToolsCheckByIsFixed(sopStartLocalDate,dateFormatter,userLogs,logsInfo,userLogsParamByDate);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ //检查营期
|
|
|
+ qwSopRuleTimeToolsCheck(sopStartLocalDate,currentDate,dateFormatter,userLogs,logsInfo,userLogsParamByDate,qwAutoSopTimeParam,timeFormatter,localTime);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -3875,30 +3891,6 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-// if (!runRuleTime.isEmpty() && !qwSopRuleTimeVOS.isEmpty()){
|
|
|
-//
|
|
|
-// //剔除掉 销售的其他任务里的,这个人的信息ps:可能没有
|
|
|
-// Set<String> qwSopRuleTimeVOIds = qwSopRuleTimeVOS.stream()
|
|
|
-// .map(QwSopRuleTimeVO::getId)
|
|
|
-// .filter(Objects::nonNull) // 过滤掉 null
|
|
|
-// .map(String::trim) // 去除前后空格
|
|
|
-// .collect(Collectors.toSet());
|
|
|
-//
|
|
|
-// if (!qwSopRuleTimeVOIds.isEmpty()){
|
|
|
-//
|
|
|
-// //在 qwSopRuleTimeVOS 中过滤掉包含在 runRuleTimeIds 中的 id
|
|
|
-// List<QwSopRuleTimeVO> notOverlapList = runRuleTime.stream()
|
|
|
-// .filter(item -> item.getId() != null &&!qwSopRuleTimeVOIds.contains(item.getId().trim()))
|
|
|
-// .collect(Collectors.toList());
|
|
|
-//
|
|
|
-// notOverlapList.forEach(notSop->{
|
|
|
-// logger.info("删除这个客户在这个销售的其他不符合的sop"+notSop.getId()+"标签:"+tagArr+"id:"+qwExternalContact.getQwUserId()+"排除的标签:"+qwSopRuleTimeVOIds);
|
|
|
-//
|
|
|
-// deleteBySopIdToContactIdTools(notSop.getId(),qwExternalContact.getUserId(),qwExternalContact.getCorpId(),qwExternalContact.getId());
|
|
|
-//
|
|
|
-// });
|
|
|
-// }
|
|
|
-// }
|
|
|
}else {
|
|
|
//没匹配上任意一个(即这个剩下的标签匹配不上任意的sop),但是销售有任务-以防万一-删除这个客户在这个销售的sop
|
|
|
if (!runRuleTime.isEmpty()){
|
|
@@ -3918,6 +3910,38 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
|
|
|
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+ //固定营期 以 SOP 任务的开始时间为营期
|
|
|
+ private void qwSopRuleTimeToolsCheckByIsFixed(LocalDate sopStartLocalDate,DateTimeFormatter dateFormatter,
|
|
|
+ SopUserLogs userLogs,SopUserLogsInfo logsInfo,
|
|
|
+ SopUserLogsParamByDate userLogsParamByDate){
|
|
|
+
|
|
|
+ String sopStartLocalDateStr = sopStartLocalDate.format(dateFormatter);
|
|
|
+
|
|
|
+ userLogs.setStartTime(sopStartLocalDateStr);
|
|
|
+ // 查询开始时间营期表
|
|
|
+ String unionSopStartId = sopUserLogsService.selectSopUserLogsByUnionSopId(userLogs);
|
|
|
+
|
|
|
+ // 如果营期表里有,则加入;否则创建新营期
|
|
|
+ if (!StringUtil.strIsNullOrEmpty(unionSopStartId)) {
|
|
|
+ logsInfo.setUserLogsId(unionSopStartId);
|
|
|
+ // 查询这个人是否已在该营期里
|
|
|
+ handleInsertSopUserLogsInfo(logsInfo);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // 没有营期记录就先插入
|
|
|
+ userLogsParamByDate.setStartTime(sopStartLocalDateStr);
|
|
|
+
|
|
|
+ sopUserLogsService.insertSopUserLogsByDate(userLogsParamByDate);
|
|
|
+
|
|
|
+ // 再次查询 拿营期主键
|
|
|
+ String unionSopStartIdNew = sopUserLogsService.selectSopUserLogsByUnionSopId(userLogs);
|
|
|
+ logsInfo.setUserLogsId(unionSopStartIdNew);
|
|
|
+
|
|
|
+ // 查询是否在营期里,如果没有再插入
|
|
|
+ handleInsertSopUserLogsInfo(logsInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
/**
|
|
|
* 新客对话
|
|
|
*/
|