|
@@ -50,6 +50,7 @@ import com.fs.qw.domain.*;
|
|
|
import com.fs.qw.mapper.*;
|
|
import com.fs.qw.mapper.*;
|
|
|
import com.fs.qw.param.QwAutoTagsRulesTags;
|
|
import com.fs.qw.param.QwAutoTagsRulesTags;
|
|
|
import com.fs.qw.service.*;
|
|
import com.fs.qw.service.*;
|
|
|
|
|
+import com.fs.qwApi.Result.QwSendMsgResult;
|
|
|
import com.fs.qwApi.domain.QwResult;
|
|
import com.fs.qwApi.domain.QwResult;
|
|
|
import com.fs.qwApi.param.QwEditUserTagParam;
|
|
import com.fs.qwApi.param.QwEditUserTagParam;
|
|
|
import com.fs.qwApi.param.QwSendMsgParam;
|
|
import com.fs.qwApi.param.QwSendMsgParam;
|
|
@@ -573,11 +574,12 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
if (result.isLongText()){
|
|
if (result.isLongText()){
|
|
|
//新增用户信息
|
|
//新增用户信息
|
|
|
addUserInfo(contentKh, qwExternalContacts.getId(),fastGptChatSession);
|
|
addUserInfo(contentKh, qwExternalContacts.getId(),fastGptChatSession);
|
|
|
- if (type==16){
|
|
|
|
|
- sendAiVoiceMsg(content,sender,uid,serverId,user);
|
|
|
|
|
- }else {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //if (type==16){
|
|
|
|
|
+ //sendAiVoiceMsg(content,sender,uid,serverId,user);
|
|
|
|
|
+ //}else {
|
|
|
sendAiMsg(content,sender,uid,serverId);
|
|
sendAiMsg(content,sender,uid,serverId);
|
|
|
- }
|
|
|
|
|
|
|
+ //}
|
|
|
|
|
|
|
|
}else {
|
|
}else {
|
|
|
String sa = contentKh.replaceAll("】\n", "】").replaceAll("\n【", "【");
|
|
String sa = contentKh.replaceAll("】\n", "】").replaceAll("\n【", "【");
|
|
@@ -592,11 +594,11 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
//新增用户信息
|
|
//新增用户信息
|
|
|
addUserInfo(contentKh, qwExternalContacts.getId(),fastGptChatSession);
|
|
addUserInfo(contentKh, qwExternalContacts.getId(),fastGptChatSession);
|
|
|
for (String msg : countList) {
|
|
for (String msg : countList) {
|
|
|
- if (type==16){
|
|
|
|
|
- sendAiVoiceMsg(msg,sender,uid,serverId,user);
|
|
|
|
|
- }else {
|
|
|
|
|
|
|
+ //if (type==16){
|
|
|
|
|
+ //sendAiVoiceMsg(msg,sender,uid,serverId,user);
|
|
|
|
|
+ //}else {
|
|
|
sendAiMsg(msg,sender,uid,serverId);
|
|
sendAiMsg(msg,sender,uid,serverId);
|
|
|
- }
|
|
|
|
|
|
|
+ //}
|
|
|
try {
|
|
try {
|
|
|
Thread.sleep(2000);
|
|
Thread.sleep(2000);
|
|
|
} catch (InterruptedException e) {
|
|
} catch (InterruptedException e) {
|
|
@@ -685,62 +687,67 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //发送欢迎宣语
|
|
|
|
|
- Long companyUserId = qwUser.getCompanyUserId();
|
|
|
|
|
- QwSopTempVoice qwSopTempVoice = qwSopTempVoiceService.selectQwSopTempVoiceByCompanyUserIdAndVoiceTxt(companyUserId, "欢迎宣导");
|
|
|
|
|
- if(qwSopTempVoice != null && qwSopTempVoice.getVoiceUrl() != null ){
|
|
|
|
|
- String voiceUrl = qwSopTempVoice.getVoiceUrl();
|
|
|
|
|
- WxwUploadCdnLinkFileDTO wxwUploadCdnLinkFileDTO = new WxwUploadCdnLinkFileDTO();
|
|
|
|
|
- wxwUploadCdnLinkFileDTO.setUrl(voiceUrl);
|
|
|
|
|
- wxwUploadCdnLinkFileDTO.setFilename(voiceUrl);
|
|
|
|
|
- wxwUploadCdnLinkFileDTO.setUuid(uid);
|
|
|
|
|
- WxWorkResponseDTO<WxwUploadCdnLinkFileRespDTO> dto = wxWorkService.uploadCdnLinkFile(wxwUploadCdnLinkFileDTO, qwUser.getServerId());
|
|
|
|
|
- WxwUploadCdnLinkFileRespDTO voice = dto.getData();
|
|
|
|
|
- WxwSendCDNVoiceMsgDTO wxwSendCDNVoiceMsgDTO = new WxwSendCDNVoiceMsgDTO();
|
|
|
|
|
- wxwSendCDNVoiceMsgDTO.setSend_userid(sender);
|
|
|
|
|
- System.out.println("语音size"+voice.getSize());
|
|
|
|
|
- wxwSendCDNVoiceMsgDTO.setVoice_time(qwSopTempVoice.getDuration());
|
|
|
|
|
- wxwSendCDNVoiceMsgDTO.setIsRoom(false);
|
|
|
|
|
- wxwSendCDNVoiceMsgDTO.setCdnkey(voice.getCdn_key());
|
|
|
|
|
- wxwSendCDNVoiceMsgDTO.setAeskey(voice.getAes_key());
|
|
|
|
|
- wxwSendCDNVoiceMsgDTO.setMd5(voice.getMd5());
|
|
|
|
|
- wxwSendCDNVoiceMsgDTO.setFileSize(voice.getSize());
|
|
|
|
|
- wxwSendCDNVoiceMsgDTO.setUuid(uid);
|
|
|
|
|
- WxWorkResponseDTO<WxwSendCDNVoiceMsgRespDTO> wxwSendCDNVoiceMsgRespDTOWxWorkResponseDTO = wxWorkService.SendCDNVoiceMsg(wxwSendCDNVoiceMsgDTO, qwUser.getServerId());
|
|
|
|
|
- log.info("发送语音成功"+qwUser);
|
|
|
|
|
- System.out.println(wxwSendCDNVoiceMsgRespDTOWxWorkResponseDTO);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ sendVideoAndVoice(sender, uid, qwUser);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- WxWorkResponseDTO<WxCdnUploadVideoResp> videoDto = new WxWorkResponseDTO<>();
|
|
|
|
|
- String videoUrl = "https://ysy-1329817240.cos.ap-guangzhou.myqcloud.com/app/344a6ed8e22f4928d9cbc4fe0bc1cb29.mp4";
|
|
|
|
|
- //1.1上传cdn网络视频
|
|
|
|
|
- WxCdnUploadVideoLinkDTO wxwUploadCdnVideoLinkDTO = new WxCdnUploadVideoLinkDTO();
|
|
|
|
|
- wxwUploadCdnVideoLinkDTO.setUuid(uid);
|
|
|
|
|
- wxwUploadCdnVideoLinkDTO.setUrl(videoUrl);
|
|
|
|
|
- // 找到最后一个斜杠的位置
|
|
|
|
|
- int lastSlashIndex = videoUrl.lastIndexOf('/');
|
|
|
|
|
-
|
|
|
|
|
- // 截取文件名(处理没有斜杠的特殊情况)
|
|
|
|
|
- String fileName = lastSlashIndex != -1 ? videoUrl.substring(lastSlashIndex + 1) : videoUrl;
|
|
|
|
|
- wxwUploadCdnVideoLinkDTO.setFilename(fileName);
|
|
|
|
|
- videoDto = wxWorkService.uploadCdnVideoLink(wxwUploadCdnVideoLinkDTO, qwUser.getServerId());
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //2.1发送模板中的视频内容
|
|
|
|
|
- if("成功".equals(videoDto.getErrmsg())){
|
|
|
|
|
- WxCdnUploadVideoResp videoDtoData = videoDto.getData();
|
|
|
|
|
- WxwSendCDNVideoMsgDTO sendCDNVideoMsgRespDTO = new WxwSendCDNVideoMsgDTO();
|
|
|
|
|
- sendCDNVideoMsgRespDTO.setSend_userid(sender);
|
|
|
|
|
- sendCDNVideoMsgRespDTO.setUuid(uid);
|
|
|
|
|
- sendCDNVideoMsgRespDTO.setIsRoom(false);
|
|
|
|
|
- sendCDNVideoMsgRespDTO.setCdnkey(videoDtoData.getCdn_key());
|
|
|
|
|
- sendCDNVideoMsgRespDTO.setAeskey(videoDtoData.getAes_key());
|
|
|
|
|
- sendCDNVideoMsgRespDTO.setMd5(videoDtoData.getMd5());
|
|
|
|
|
- sendCDNVideoMsgRespDTO.setFileSize(videoDtoData.getSize());
|
|
|
|
|
- sendCDNVideoMsgRespDTO.setVideo_img_size(videoDtoData.getVideo_img_size());
|
|
|
|
|
- sendCDNVideoMsgRespDTO.setVideo_duration(videoDtoData.getVideoDuration());
|
|
|
|
|
- wxWorkService.SendCDNVideoMsg(sendCDNVideoMsgRespDTO, qwUser.getServerId());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void sendVideoAndVoice(Long sender, String uid, QwUser qwUser) {
|
|
|
|
|
+ //发送欢迎宣语
|
|
|
|
|
+ Long companyUserId = qwUser.getCompanyUserId();
|
|
|
|
|
+ QwSopTempVoice qwSopTempVoice = qwSopTempVoiceService.selectQwSopTempVoiceByCompanyUserIdAndVoiceTxt(companyUserId, "欢迎宣导");
|
|
|
|
|
+ if(qwSopTempVoice != null && qwSopTempVoice.getVoiceUrl() != null ){
|
|
|
|
|
+ String voiceUrl = qwSopTempVoice.getVoiceUrl();
|
|
|
|
|
+ WxwUploadCdnLinkFileDTO wxwUploadCdnLinkFileDTO = new WxwUploadCdnLinkFileDTO();
|
|
|
|
|
+ wxwUploadCdnLinkFileDTO.setUrl(voiceUrl);
|
|
|
|
|
+ wxwUploadCdnLinkFileDTO.setFilename(voiceUrl);
|
|
|
|
|
+ wxwUploadCdnLinkFileDTO.setUuid(uid);
|
|
|
|
|
+ WxWorkResponseDTO<WxwUploadCdnLinkFileRespDTO> dto = wxWorkService.uploadCdnLinkFile(wxwUploadCdnLinkFileDTO, qwUser.getServerId());
|
|
|
|
|
+ WxwUploadCdnLinkFileRespDTO voice = dto.getData();
|
|
|
|
|
+ WxwSendCDNVoiceMsgDTO wxwSendCDNVoiceMsgDTO = new WxwSendCDNVoiceMsgDTO();
|
|
|
|
|
+ wxwSendCDNVoiceMsgDTO.setSend_userid(sender);
|
|
|
|
|
+ System.out.println("语音size"+voice.getSize());
|
|
|
|
|
+ wxwSendCDNVoiceMsgDTO.setVoice_time(qwSopTempVoice.getDuration());
|
|
|
|
|
+ wxwSendCDNVoiceMsgDTO.setIsRoom(false);
|
|
|
|
|
+ wxwSendCDNVoiceMsgDTO.setCdnkey(voice.getCdn_key());
|
|
|
|
|
+ wxwSendCDNVoiceMsgDTO.setAeskey(voice.getAes_key());
|
|
|
|
|
+ wxwSendCDNVoiceMsgDTO.setMd5(voice.getMd5());
|
|
|
|
|
+ wxwSendCDNVoiceMsgDTO.setFileSize(voice.getSize());
|
|
|
|
|
+ wxwSendCDNVoiceMsgDTO.setUuid(uid);
|
|
|
|
|
+ WxWorkResponseDTO<WxwSendCDNVoiceMsgRespDTO> wxwSendCDNVoiceMsgRespDTOWxWorkResponseDTO = wxWorkService.SendCDNVoiceMsg(wxwSendCDNVoiceMsgDTO, qwUser.getServerId());
|
|
|
|
|
+ log.info("发送语音成功"+ qwUser);
|
|
|
|
|
+ System.out.println(wxwSendCDNVoiceMsgRespDTOWxWorkResponseDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ WxWorkResponseDTO<WxCdnUploadVideoResp> videoDto = new WxWorkResponseDTO<>();
|
|
|
|
|
+ String videoUrl = "https://ysy-1329817240.cos.ap-guangzhou.myqcloud.com/app/344a6ed8e22f4928d9cbc4fe0bc1cb29.mp4";
|
|
|
|
|
+ //1.1上传cdn网络视频
|
|
|
|
|
+ WxCdnUploadVideoLinkDTO wxwUploadCdnVideoLinkDTO = new WxCdnUploadVideoLinkDTO();
|
|
|
|
|
+ wxwUploadCdnVideoLinkDTO.setUuid(uid);
|
|
|
|
|
+ wxwUploadCdnVideoLinkDTO.setUrl(videoUrl);
|
|
|
|
|
+ // 找到最后一个斜杠的位置
|
|
|
|
|
+ int lastSlashIndex = videoUrl.lastIndexOf('/');
|
|
|
|
|
+
|
|
|
|
|
+ // 截取文件名(处理没有斜杠的特殊情况)
|
|
|
|
|
+ String fileName = lastSlashIndex != -1 ? videoUrl.substring(lastSlashIndex + 1) : videoUrl;
|
|
|
|
|
+ wxwUploadCdnVideoLinkDTO.setFilename(fileName);
|
|
|
|
|
+ videoDto = wxWorkService.uploadCdnVideoLink(wxwUploadCdnVideoLinkDTO, qwUser.getServerId());
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //2.1发送模板中的视频内容
|
|
|
|
|
+ if("成功".equals(videoDto.getErrmsg())){
|
|
|
|
|
+ WxCdnUploadVideoResp videoDtoData = videoDto.getData();
|
|
|
|
|
+ WxwSendCDNVideoMsgDTO sendCDNVideoMsgRespDTO = new WxwSendCDNVideoMsgDTO();
|
|
|
|
|
+ sendCDNVideoMsgRespDTO.setSend_userid(sender);
|
|
|
|
|
+ sendCDNVideoMsgRespDTO.setUuid(uid);
|
|
|
|
|
+ sendCDNVideoMsgRespDTO.setIsRoom(false);
|
|
|
|
|
+ sendCDNVideoMsgRespDTO.setCdnkey(videoDtoData.getCdn_key());
|
|
|
|
|
+ sendCDNVideoMsgRespDTO.setAeskey(videoDtoData.getAes_key());
|
|
|
|
|
+ sendCDNVideoMsgRespDTO.setMd5(videoDtoData.getMd5());
|
|
|
|
|
+ sendCDNVideoMsgRespDTO.setFileSize(videoDtoData.getSize());
|
|
|
|
|
+ sendCDNVideoMsgRespDTO.setVideo_img_size(videoDtoData.getVideo_img_size());
|
|
|
|
|
+ sendCDNVideoMsgRespDTO.setVideo_duration(videoDtoData.getVideoDuration());
|
|
|
|
|
+ wxWorkService.SendCDNVideoMsg(sendCDNVideoMsgRespDTO, qwUser.getServerId());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -800,7 +807,8 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
* @param user
|
|
* @param user
|
|
|
* @param qwExternalContacts
|
|
* @param qwExternalContacts
|
|
|
*/
|
|
*/
|
|
|
- private void cleanNewUserDialogue(QwUser user, QwExternalContact qwExternalContacts) {
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void cleanNewUserDialogue(QwUser user, QwExternalContact qwExternalContacts) {
|
|
|
String redisKey = "qwNewChat:" + user.getQwUserId() + ":" + user.getCorpId() + ":" + qwExternalContacts.getExternalUserId();
|
|
String redisKey = "qwNewChat:" + user.getQwUserId() + ":" + user.getCorpId() + ":" + qwExternalContacts.getExternalUserId();
|
|
|
String key = (String) redisCache.getCacheObject(redisKey);
|
|
String key = (String) redisCache.getCacheObject(redisKey);
|
|
|
if(!StringUtil.strIsNullOrEmpty(key)){
|
|
if(!StringUtil.strIsNullOrEmpty(key)){
|
|
@@ -1283,7 +1291,8 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
text.setContent(content);
|
|
text.setContent(content);
|
|
|
qwSendMsgParam.setText(text);
|
|
qwSendMsgParam.setText(text);
|
|
|
qwSendMsgParam.setMsgtype("text");
|
|
qwSendMsgParam.setMsgtype("text");
|
|
|
- qwApiService.sendMsg(qwSendMsgParam, corpId);
|
|
|
|
|
|
|
+ QwSendMsgResult qwSendMsgResult = qwApiService.sendMsg(qwSendMsgParam, corpId);
|
|
|
|
|
+ log.info("发送消息给:{}",qwSendMsgResult);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1622,6 +1631,53 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
if(info==null){
|
|
if(info==null){
|
|
|
info=new QwExternalContactInfo();
|
|
info=new QwExternalContactInfo();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (info.getCreateTime()!=null){
|
|
|
|
|
+ Calendar today = Calendar.getInstance();
|
|
|
|
|
+ today.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
|
|
+ today.set(Calendar.MINUTE, 0);
|
|
|
|
|
+ today.set(Calendar.SECOND, 0);
|
|
|
|
|
+ today.set(Calendar.MILLISECOND, 0);
|
|
|
|
|
+ Calendar createDate = Calendar.getInstance();
|
|
|
|
|
+ createDate.setTime(info.getCreateTime());
|
|
|
|
|
+ createDate.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
|
|
+ createDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
+ createDate.set(Calendar.SECOND, 0);
|
|
|
|
|
+ createDate.set(Calendar.MILLISECOND, 0);
|
|
|
|
|
+ if(createDate.before(today)){
|
|
|
|
|
+ if (info.getTalk()==null||info.getTalk().isEmpty()){
|
|
|
|
|
+ info.setTalk("非首次交流");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ QwExternalContact qwExternalContact = qwExternalContactMapper.selectQwExternalContactById(extId);
|
|
|
|
|
+ if (qwExternalContact!=null){
|
|
|
|
|
+ if (qwExternalContact.getCreateTime()!=null){
|
|
|
|
|
+ Calendar today = Calendar.getInstance();
|
|
|
|
|
+ today.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
|
|
+ today.set(Calendar.MINUTE, 0);
|
|
|
|
|
+ today.set(Calendar.SECOND, 0);
|
|
|
|
|
+ today.set(Calendar.MILLISECOND, 0);
|
|
|
|
|
+ Calendar createDate = Calendar.getInstance();
|
|
|
|
|
+ createDate.setTime(qwExternalContact.getCreateTime());
|
|
|
|
|
+ createDate.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
|
|
+ createDate.set(Calendar.MINUTE, 0);
|
|
|
|
|
+ createDate.set(Calendar.SECOND, 0);
|
|
|
|
|
+ createDate.set(Calendar.MILLISECOND, 0);
|
|
|
|
|
+ if(createDate.before(today)){
|
|
|
|
|
+ if (info.getTalk()==null||info.getTalk().isEmpty()){
|
|
|
|
|
+ info.setTalk("非首次交流");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ if (info.getTalk()==null||info.getTalk().isEmpty()){
|
|
|
|
|
+ info.setTalk("非首次交流");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
if (info!=null){
|
|
if (info!=null){
|
|
|
str="【用户状态信息\n";
|
|
str="【用户状态信息\n";
|
|
|
Field[] fields = info.getClass().getDeclaredFields();
|
|
Field[] fields = info.getClass().getDeclaredFields();
|
|
@@ -1641,7 +1697,7 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
}
|
|
}
|
|
|
if (value != null) {
|
|
if (value != null) {
|
|
|
str += fieldName + ": " + value.toString() + "\n";
|
|
str += fieldName + ": " + value.toString() + "\n";
|
|
|
- }else {
|
|
|
|
|
|
|
+ }else if("交流状态".equals(fieldName) || "学习到的章节".equals(fieldName)){
|
|
|
str += fieldName + ": \n";
|
|
str += fieldName + ": \n";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1915,6 +1971,13 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
Matcher matcher1 = pattern1.matcher(s);
|
|
Matcher matcher1 = pattern1.matcher(s);
|
|
|
s = matcher1.replaceAll("");
|
|
s = matcher1.replaceAll("");
|
|
|
|
|
|
|
|
|
|
+ String regex2 = "<|lnnerThoughtBegin|>[\\s\\S]*?<|lnnerThoughtEnd|>";
|
|
|
|
|
+ // 创建 Pattern 对象
|
|
|
|
|
+ Pattern pattern2 = Pattern.compile(regex2);
|
|
|
|
|
+ // 创建 Matcher 对象
|
|
|
|
|
+ Matcher matcher2 = pattern2.matcher(s);
|
|
|
|
|
+ s = matcher2.replaceAll("");
|
|
|
|
|
+
|
|
|
String regex = "【[\\s\\S]*?】";
|
|
String regex = "【[\\s\\S]*?】";
|
|
|
// 创建 Pattern 对象
|
|
// 创建 Pattern 对象
|
|
|
Pattern pattern = Pattern.compile(regex);
|
|
Pattern pattern = Pattern.compile(regex);
|
|
@@ -2086,20 +2149,47 @@ public class AiHookServiceImpl implements AiHookService {
|
|
|
// 客服进行回复后就转人工10分钟
|
|
// 客服进行回复后就转人工10分钟
|
|
|
if(type == 1){
|
|
if(type == 1){
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.add(Calendar.MINUTE, -5);
|
|
|
|
|
|
|
+ calendar.add(Calendar.MINUTE, -1);
|
|
|
Date lastTime = calendar.getTime();
|
|
Date lastTime = calendar.getTime();
|
|
|
if(lastTime.after(fastGptChatSession.getCreateTime())){
|
|
if(lastTime.after(fastGptChatSession.getCreateTime())){
|
|
|
- Calendar calendar1 = Calendar.getInstance();
|
|
|
|
|
- //定时任务会处理10分钟以内的,所以设置20分钟
|
|
|
|
|
- calendar1.add(Calendar.MINUTE, 10);
|
|
|
|
|
- Date expireTime = calendar1.getTime();
|
|
|
|
|
-
|
|
|
|
|
- FastGptChatSession chatSession = new FastGptChatSession();
|
|
|
|
|
- chatSession.setLastTime(expireTime);
|
|
|
|
|
- chatSession.setIsArtificial(1);
|
|
|
|
|
- chatSession.setSessionId(fastGptChatSession.getSessionId());
|
|
|
|
|
|
|
+ Calendar oneDayAgo = Calendar.getInstance();
|
|
|
|
|
+ oneDayAgo.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
|
|
+ // 增加判断:lastTime必须在createTime之后,且与当前时间相差不超过1天
|
|
|
|
|
+ if (lastTime.after(oneDayAgo.getTime())) {
|
|
|
|
|
+ Calendar calendar1 = Calendar.getInstance();
|
|
|
|
|
+ //定时任务会处理10分钟以内的,所以设置20分钟
|
|
|
|
|
+ calendar1.add(Calendar.MINUTE, 10);
|
|
|
|
|
+ Date expireTime = calendar1.getTime();
|
|
|
|
|
+
|
|
|
|
|
+ FastGptChatSession chatSession = new FastGptChatSession();
|
|
|
|
|
+ chatSession.setLastTime(expireTime);
|
|
|
|
|
+ chatSession.setIsArtificial(1);
|
|
|
|
|
+ chatSession.setSessionId(fastGptChatSession.getSessionId());
|
|
|
|
|
+
|
|
|
|
|
+ fastGptChatSessionMapper.updateFastGptChatSession(chatSession);
|
|
|
|
|
+ try {
|
|
|
|
|
+ QwUser user = qwUserMapper.selectQwUserById(qwUserID);
|
|
|
|
|
+ String extId1 = getExtId(sender, user.getUid(), user.getServerId());
|
|
|
|
|
+ QwExternalContact qwExternalContact = qwExternalContactMapper.selectQwExternalContactByExternalUserIdAndQwUserId(extId1, user.getCorpId(),user.getQwUserId());
|
|
|
|
|
+ Long id1 = qwExternalContact.getId();
|
|
|
|
|
+ QwExternalContactInfo info = qwExternalContactInfoMapper.selectQwExternalContactInfoByExternalContactId(id1);
|
|
|
|
|
+ if(info == null){
|
|
|
|
|
+ info = new QwExternalContactInfo();
|
|
|
|
|
+ info.setTalk("非首次交流");
|
|
|
|
|
+ info.setExternalContactId(id1);
|
|
|
|
|
+ info.setCreateTime(new Date());
|
|
|
|
|
+ qwExternalContactInfoMapper.insertQwExternalContactInfo(info);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //将交流状态改为非首次交流
|
|
|
|
|
+ qwExternalContactInfoMapper.updateQwExternalContactInfoByExtId(id1);
|
|
|
|
|
+ }
|
|
|
|
|
+ //去除新客对话
|
|
|
|
|
+ cleanNewUserDialogue(user, qwExternalContact);
|
|
|
|
|
|
|
|
- fastGptChatSessionMapper.updateFastGptChatSession(chatSession);
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("id:{}, 处理通话后的视频语音:", qwUserID, e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}else {
|
|
}else {
|