Commit db24cc45 authored by kongfm's avatar kongfm

更新通话记录相关内容

parent 21c55b94
...@@ -37,6 +37,9 @@ public class RedisKey { ...@@ -37,6 +37,9 @@ public class RedisKey {
/**警情联系人*/ /**警情联系人*/
public static final String CONTACT_USER = "contact_user"; public static final String CONTACT_USER = "contact_user";
/**联通CTIuser token */
public static final String CTI_USER_TOKEN = "cti_user_token";
/** 驼峰转下划线(简单写法,效率低于 ) */ /** 驼峰转下划线(简单写法,效率低于 ) */
public static String humpToLine(String str) { public static String humpToLine(String str) {
return str.replaceAll("[A-Z]", "_$0").toLowerCase(); return str.replaceAll("[A-Z]", "_$0").toLowerCase();
......
...@@ -3,18 +3,14 @@ package com.yeejoin.amos.boot.module.tzs.biz.controller; ...@@ -3,18 +3,14 @@ package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto; import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService; import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.SignatureDto; import com.yeejoin.amos.boot.module.tzs.api.dto.SignatureDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatAccessDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatAccessDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMessageDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBusinessListDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBussinessDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBussinessDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskListDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskListDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatRelationDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatRelationDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatTaskLatLonDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatTaskLatLonDto;
...@@ -45,7 +41,6 @@ import org.slf4j.Logger; ...@@ -45,7 +41,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
......
...@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile; import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.security.MessageDigest; import java.security.MessageDigest;
......
...@@ -77,6 +77,8 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,V ...@@ -77,6 +77,8 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,V
VoiceRecordLog log = new VoiceRecordLog(); VoiceRecordLog log = new VoiceRecordLog();
log.setAlertId(model.getAlertId()); log.setAlertId(model.getAlertId());
log.setConnectId(model.getConnectId()); log.setConnectId(model.getConnectId());
log.setIsDeal(false);
log.setDealTimes(0);
iVoiceRecordLogServiceImpl.save(log); iVoiceRecordLogServiceImpl.save(log);
} }
......
...@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONArray; ...@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto; import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto; import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordLog; import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordLog;
...@@ -11,6 +13,11 @@ import com.yeejoin.amos.boot.module.tzs.api.mapper.VoiceRecordLogMapper; ...@@ -11,6 +13,11 @@ import com.yeejoin.amos.boot.module.tzs.api.mapper.VoiceRecordLogMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.ICtiService; import com.yeejoin.amos.boot.module.tzs.api.service.ICtiService;
import com.yeejoin.amos.boot.module.tzs.api.service.IVoiceRecordLogService; import com.yeejoin.amos.boot.module.tzs.api.service.IVoiceRecordLogService;
import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordLogDto; import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordLogDto;
import com.yeejoin.amos.component.feign.config.TokenOperation;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
...@@ -18,11 +25,13 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -18,11 +25,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -40,6 +49,8 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi ...@@ -40,6 +49,8 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi
@Autowired @Autowired
ICtiService ctiService; ICtiService ctiService;
@Autowired
RedisUtils redisUtils;
@Autowired @Autowired
AlertCalledServiceImpl iAlertCalledService; AlertCalledServiceImpl iAlertCalledService;
...@@ -53,11 +64,32 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi ...@@ -53,11 +64,32 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi
private String ctiMessage; private String ctiMessage;
@Value("${cti.user.name}")
private String ctiUserName;
@Value("${cti.user.pwd}")
private String ctiUserPwd;
@Autowired @Autowired
private VoiceRecordFileServiceImpl voiceRecordFileServiceImpl; private VoiceRecordFileServiceImpl voiceRecordFileServiceImpl;
@Scheduled(fixedDelay=ONE_Minute) @Scheduled(fixedDelay=ONE_Minute)
public void fixedDelayJob(){ public void fixedDelayJob(){
// 需要登录后台账号
RequestContext.setAppKey("AMOS_STUDIO");
RequestContext.setProduct("AMOS_STUDIO_WEB");
if(redisUtils.hasKey(RedisKey.CTI_USER_TOKEN)) {
// 验证token
boolean validToken = TokenOperation.refresh(redisUtils.get(RedisKey.CTI_USER_TOKEN).toString());
if(!validToken) { // 登陆
loginCtiUser();
}
} else { // 登陆
loginCtiUser();
}
String ctiToken = redisUtils.get(RedisKey.CTI_USER_TOKEN).toString();
RequestContext.setToken(ctiToken);
// 首先查找未完成 且失败次数少于5 的 记录 // 首先查找未完成 且失败次数少于5 的 记录
List<VoiceRecordLog> logList = this.list(new LambdaQueryWrapper<VoiceRecordLog>().eq(VoiceRecordLog::getIsDeal,false).lt(VoiceRecordLog::getDealTimes,5)); List<VoiceRecordLog> logList = this.list(new LambdaQueryWrapper<VoiceRecordLog>().eq(VoiceRecordLog::getIsDeal,false).lt(VoiceRecordLog::getDealTimes,5));
if(logList != null && logList.size() >0) { if(logList != null && logList.size() >0) {
...@@ -98,7 +130,14 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi ...@@ -98,7 +130,14 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi
model.setFileType("坐席呼出"); model.setFileType("坐席呼出");
} }
Map<String, String> downloadFile = ctiService.downLoadRecordFile(recordInfo.getString("connectionid")); Map<String, String> downloadFile = null;
try {
downloadFile = ctiService.downLoadRecordFile(recordInfo.getString("connectionid"));
} catch (Exception e) {
e.printStackTrace();
this.updateById(l);
return;
}
if(downloadFile.isEmpty()) { if(downloadFile.isEmpty()) {
this.updateById(l); this.updateById(l);
return; return;
...@@ -132,6 +171,18 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi ...@@ -132,6 +171,18 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi
} }
private void loginCtiUser() {
String passwd = DesUtil.encode(ctiUserPwd, "qaz");
IdPasswordAuthModel loninData = new IdPasswordAuthModel();
loninData.setLoginId(ctiUserName);
loninData.setPassword(passwd);
FeignClientResult loginResult = Privilege.authClient.idpassword(loninData);
if(loginResult.getStatus() == 200) {
HashMap resultMap = (HashMap) loginResult.getResult();
redisUtils.set(RedisKey.CTI_USER_TOKEN, resultMap.get("token").toString(), 25920000l);
}
}
......
package com.yeejoin.amos.boot.module.tzs.biz.service.impl; package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
...@@ -9,8 +8,6 @@ import com.yeejoin.amos.boot.module.tzs.api.service.IWechatService; ...@@ -9,8 +8,6 @@ import com.yeejoin.amos.boot.module.tzs.api.service.IWechatService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.HttpUtils; import com.yeejoin.amos.boot.module.tzs.biz.utils.HttpUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.apache.http.Header;
import org.apache.http.HeaderElement;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile; import org.springframework.mock.web.MockMultipartFile;
...@@ -18,7 +15,6 @@ import org.springframework.stereotype.Service; ...@@ -18,7 +15,6 @@ import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
......
...@@ -72,3 +72,7 @@ mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart ...@@ -72,3 +72,7 @@ mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti
cti.user.pwd=a1234567
\ No newline at end of file
...@@ -77,3 +77,7 @@ mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart ...@@ -77,3 +77,7 @@ mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti
cti.user.pwd=a1234567
...@@ -91,6 +91,18 @@ ...@@ -91,6 +91,18 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="kongfm" id="2021-11-10-01">
<preConditions onFail="MARK_RAN">
<tableExists tableName="tz_voice_record_file"/>
</preConditions>
<comment>modify tz_voice_record_file field</comment>
<sql>
alter table tz_voice_record_file modify rec_user_id bigint(30) NULL COMMENT '更新人id';
alter table tz_voice_record_file modify rec_user_name varchar(100) NULL COMMENT '更新人名称';
alter table tz_voice_record_file modify rec_date datetime NULL COMMENT '更新时间';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment