소스 검색

非同步满意度 继续创建新会话

zoujiajian 1 년 전
부모
커밋
5e8ac97c74
1개의 변경된 파일13개의 추가작업 그리고 6개의 파일을 삭제
  1. 13 6
      netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpServiceImpl.java

+ 13 - 6
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpServiceImpl.java

@@ -656,23 +656,28 @@ public class CorpServiceImpl implements CorpService {
 			corpKfAccountSessionChat.setSendTime(sendTime);
 			corpKfAccountSessionChat.setSendDate(DateTime.of(sendTime * 1000));
 			if (saveChatMsg(corpKfAccountSessionChat)) {
-				if (StrUtil.isNotEmpty(externalUserId)) {
-					//会话状态为待处理 则分配接待人员
-					assignKfSession(corpId, openKfId, externalUserId, corpKfAccountSessionConfig, corpKfAccountSessionChat.getSendDate(), msgId);
+				//非同步满意度 继续创建新会话
+				if (!syncSessionSatisfaction(item)) {
+					if (StrUtil.isNotEmpty(externalUserId)) {
+						//会话状态为待处理 则分配接待人员
+						assignKfSession(corpId, openKfId, externalUserId, corpKfAccountSessionConfig, corpKfAccountSessionChat.getSendDate(), msgId);
+					}
 				}
-				syncSessionSatisfaction(item);
 			}
 		}
 	}
 
-	private void syncSessionSatisfaction(WxCpKfMsgListResp.WxCpKfMsgItem item) throws Exception {
+	/**
+	 * 是否同步满意度
+	 */
+	private Boolean syncSessionSatisfaction(WxCpKfMsgListResp.WxCpKfMsgItem item) throws Exception {
 		Integer satisfaction = null;
 		WxCorpTextMsg text = item.getText();
 		//自定义菜单id
 		if (text != null && text.getMenu_id() != null) {
 			String[] split = text.getMenu_id().split("-");
 			if (split.length < 2) {
-				return;
+				return false;
 			}
 			String menuId = split[0];
 			String msgid = split[1];
@@ -700,8 +705,10 @@ public class CorpServiceImpl implements CorpService {
 							.set(CorpKfAccountSessionChat::getSessionId, corpKfServicerSessionRecord.getId())
 							.eq(CorpKfAccountSessionChat::getMsgid, item.getMsgId()));
 				}
+				return true;
 			}
 		}
+		return false;
 	}
 
 	private void sessionStatusChange(String corpId, String openKfId, WxCpKfMsgListResp.WxCpKfMsgItem wxCpKfMsgItem, CorpKfAccountSessionConfig corpKfAccountSessionConfig) throws Exception {