zoujiajian 1 год назад
Родитель
Сommit
24824e75dd

+ 4 - 0
netflix-dao/src/main/java/com/cyksj/model/kf/WxCpKfEventMsg.java

@@ -32,7 +32,11 @@ public class WxCpKfEventMsg {
   private String failMsgId;
   private String failMsgId;
   @JsonProperty("fail_type")
   @JsonProperty("fail_type")
   private Integer failType;
   private Integer failType;
+  //状态类型。1-接待中 2-停止接待
   private Integer status;
   private Integer status;
+  //接待人员的状态为「停止接待」的子类型。0:停止接待,1:暂时挂起
+  @JsonProperty("stop_type")
+  private Integer stopType;
   @JsonProperty("change_type")
   @JsonProperty("change_type")
   private Integer changeType;
   private Integer changeType;
   @JsonProperty("msg_code")
   @JsonProperty("msg_code")

+ 0 - 7
netflix-dao/src/main/java/com/cyksj/model/kf/WxCpKfMsgListResp.java

@@ -68,12 +68,5 @@ public class WxCpKfMsgListResp {
     private WxCorpFileMsg file;
     private WxCorpFileMsg file;
     //菜单消息
     //菜单消息
     private WxCorpMenuMsg msgmenu;
     private WxCorpMenuMsg msgmenu;
-
-    //状态类型。1-接待中 2-停止接待
-    private Integer status;
-
-    //接待人员的状态为「停止接待」的子类型。0:停止接待,1:暂时挂起
-    @JsonProperty("stop_type")
-    private Integer stopType;
   }
   }
 }
 }

+ 23 - 15
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpServiceImpl.java

@@ -747,18 +747,25 @@ public class CorpServiceImpl implements CorpService {
 				}
 				}
 			}
 			}
 			if (beforeRecord == null) {
 			if (beforeRecord == null) {
-				CorpKfServicerSessionRecord newSession = new CorpKfServicerSessionRecord();
-				newSession.setOpenKfId(openKfId);
-				newSession.setServicerUserid(newServicerUserId);
-				newSession.setExternalUserid(externalUserId);
-				newSession.setChangeType(changeType);
-				newSession.setServiceState(0);
-				newSession.setStartTime(sendDate);
-				newSession.setMsgid(msgId);
-				corpKfServicerSessionRecordMapper.insert(newSession);
-				//等待用户删除
-				delQueueUser(openKfId, externalUserId, sendDate);
-				syncUserChatSession(newSession.getId(), externalUserId);
+				CorpKfServicerSessionRecord corpKfServicerSessionRecord = corpKfServicerSessionRecordMapper.selectOne(Wrappers.lambdaQuery(CorpKfServicerSessionRecord.class)
+						.eq(CorpKfServicerSessionRecord::getOpenKfId, openKfId)
+						.eq(CorpKfServicerSessionRecord::getExternalUserid, externalUserId)
+						.eq(CorpKfServicerSessionRecord::getServiceState, 0)
+						.last("limit 1"));
+				if (corpKfServicerSessionRecord == null) {
+					CorpKfServicerSessionRecord newSession = new CorpKfServicerSessionRecord();
+					newSession.setOpenKfId(openKfId);
+					newSession.setServicerUserid(newServicerUserId);
+					newSession.setExternalUserid(externalUserId);
+					newSession.setChangeType(changeType);
+					newSession.setServiceState(0);
+					newSession.setStartTime(sendDate);
+					newSession.setMsgid(msgId);
+					corpKfServicerSessionRecordMapper.insert(newSession);
+					//等待用户删除
+					delQueueUser(openKfId, externalUserId, sendDate);
+					syncUserChatSession(newSession.getId(), externalUserId);
+				}
 			}
 			}
 		}
 		}
 		//2-转接会话
 		//2-转接会话
@@ -1180,11 +1187,12 @@ public class CorpServiceImpl implements CorpService {
 	 * 接待人员接待状态变更记录
 	 * 接待人员接待状态变更记录
 	 */
 	 */
 	private void recordCorpKfServicerState(String openKfId, WxCpKfMsgListResp.WxCpKfMsgItem item) {
 	private void recordCorpKfServicerState(String openKfId, WxCpKfMsgListResp.WxCpKfMsgItem item) {
-		String servicerUserId = item.getServicerUserId();
+		String servicerUserId = item.getEvent().getServicerUserId();
 		//状态类型。1-接待中 2-停止接待
 		//状态类型。1-接待中 2-停止接待
-		Integer status = item.getStatus();
+		Integer status = item.getEvent().getStatus();
 		//0:停止接待,1:暂时挂起
 		//0:停止接待,1:暂时挂起
-		Integer stopType = item.getStopType();
+		Integer stopType = item.getEvent().getStopType();
+		log.info("接待人员状态变更事件:{}", servicerUserId);
 		CorpKfServicerStatusChangeRecord corpKfServicerStatusChangeRecord = new CorpKfServicerStatusChangeRecord();
 		CorpKfServicerStatusChangeRecord corpKfServicerStatusChangeRecord = new CorpKfServicerStatusChangeRecord();
 		corpKfServicerStatusChangeRecord.setOpenKfId(openKfId);
 		corpKfServicerStatusChangeRecord.setOpenKfId(openKfId);
 		corpKfServicerStatusChangeRecord.setServicerUserid(servicerUserId);
 		corpKfServicerStatusChangeRecord.setServicerUserid(servicerUserId);