Commit 11fd085f authored by kongfm's avatar kongfm

更新CTI相关代码

parent 29834cb2
...@@ -282,15 +282,15 @@ public class AlertCalledController extends BaseController { ...@@ -282,15 +282,15 @@ public class AlertCalledController extends BaseController {
queryWrapper.isNull("father_alert"); queryWrapper.isNull("father_alert");
} }
if(ValidationUtil.isEmpty(alertCalled.getType())) { if(!ValidationUtil.isEmpty(alertCalled.getType())) {
queryWrapper.eq("type",alertCalled.getType()); queryWrapper.eq("type",alertCalled.getType());
} }
if(ValidationUtil.isEmpty(alertCalled.getAlarmType())) { if(!ValidationUtil.isEmpty(alertCalled.getAlarmType())) {
queryWrapper.eq("alarm_type",alertCalled.getAlarmType()); queryWrapper.eq("alarm_type",alertCalled.getAlarmType());
} }
if(ValidationUtil.isEmpty(alertCalled.getAlertSource())) { if(!ValidationUtil.isEmpty(alertCalled.getAlertSource())) {
queryWrapper.eq("alert_source",alertCalled.getAlertSource()); queryWrapper.eq("alert_source",alertCalled.getAlertSource());
} }
return queryWrapper; return queryWrapper;
......
...@@ -81,10 +81,13 @@ public class CtiController extends BaseController { ...@@ -81,10 +81,13 @@ public class CtiController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/info/{connectId}") @GetMapping(value = "/info/{serviceconnectionid}")
@ApiOperation(httpMethod = "GET", value = "获取通话话单详情", notes = "获取通话话单详情") @ApiOperation(httpMethod = "GET", value = "获取通话话单详情", notes = "获取通话话单详情")
public ResponseModel<JSONObject> getCallInfo(@PathVariable String connectId) { public ResponseModel<JSONObject> getCallInfo(@PathVariable String serviceconnectionid) {
JSONArray recordInfos = ctiService.getCallInfo(connectId); JSONArray recordInfos = ctiService.getCallInfo(serviceconnectionid);
if(recordInfos.size() == 0) {
throw new BadRequest("未找到相关通话信息");
}
JSONObject recordInfo = recordInfos.getJSONObject(0); JSONObject recordInfo = recordInfos.getJSONObject(0);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
return ResponseHelper.buildResponse(recordInfo); return ResponseHelper.buildResponse(recordInfo);
......
...@@ -116,7 +116,7 @@ public class VoiceRecordFileController extends BaseController { ...@@ -116,7 +116,7 @@ public class VoiceRecordFileController extends BaseController {
/** /**
* 新增通话记录 * 新增-通话记录
* *
* @return * @return
*/ */
...@@ -135,13 +135,13 @@ public class VoiceRecordFileController extends BaseController { ...@@ -135,13 +135,13 @@ public class VoiceRecordFileController extends BaseController {
} }
JSONObject recordInfo = recordInfos.getJSONObject(0); JSONObject recordInfo = recordInfos.getJSONObject(0);
model.setTel(recordInfo.getString("telephone")); model.setTel(recordInfo.getString("telephone"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
Date telStartTime = null; Date telStartTime = null;
Date telEndTime = null; Date telEndTime = null;
try { try {
telStartTime = sdf.parse(recordInfo.getString("connectTime")); telStartTime = DateUtils.longStr2Date(recordInfo.getString("connectTime"));
telEndTime = sdf.parse(recordInfo.getString("hangupTime")); telEndTime = DateUtils.longStr2Date(recordInfo.getString("hangupTime"));
} catch (ParseException e) { } catch (Exception e) {
throw new BadRequest("日期转换错误"); throw new BadRequest("日期转换错误");
} }
model.setTelStartTime(telStartTime); model.setTelStartTime(telStartTime);
...@@ -152,8 +152,13 @@ public class VoiceRecordFileController extends BaseController { ...@@ -152,8 +152,13 @@ public class VoiceRecordFileController extends BaseController {
model.setFileType("坐席呼出"); model.setFileType("坐席呼出");
} }
// 获取附件 // 获取附件 需要延时5S
Map<String, String> downloadFile = ctiService.downLoadRecordFile(model.getConnectId()); try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Map<String, String> downloadFile = ctiService.downLoadRecordFile(recordInfo.getString("connectionid"));
if(downloadFile.isEmpty()) { if(downloadFile.isEmpty()) {
throw new BadRequest("未找到附件文件"); throw new BadRequest("未找到附件文件");
} }
......
package com.yeejoin.amos.boot.module.tzs.biz.service.impl; package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; 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.update.LambdaUpdateWrapper;
import com.google.common.collect.Maps;
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.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.FormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums;
import com.yeejoin.amos.boot.module.tzs.api.mapper.AlertCalledMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IAlertCalledService;
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.biz.utils.BeanDtoVoUtils;
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.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.FileInfoModel;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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.http.MediaType;
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.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -70,11 +36,14 @@ public class CtiServiceImpl implements ICtiService { ...@@ -70,11 +36,14 @@ public class CtiServiceImpl implements ICtiService {
*/ */
private long time = 6000l; private long time = 6000l;
private final String APP_KEY = "4e805006-3fef-ae43-3915-a153731007c4"; @Value("${tzs.cti.appkey}")
private String APP_KEY;
private final String SECRET_KEY = "7bd29115-99ee-4f7d-1fb1-7c4719d5f43a"; @Value("${tzs.cti.secretkey}")
private String SECRET_KEY;
private String ctiUrl = "http://36.46.151.113:8000"; @Value("${tzs.cti.url}")
private String ctiUrl;
@Override @Override
public String getAccessToken() { public String getAccessToken() {
...@@ -144,11 +113,11 @@ public class CtiServiceImpl implements ICtiService { ...@@ -144,11 +113,11 @@ public class CtiServiceImpl implements ICtiService {
} }
@Override @Override
public JSONArray getCallInfo(String connectionid) { public JSONArray getCallInfo(String serviceconnectionid) {
String token = this.getAccessToken(); String token = this.getAccessToken();
String url = ctiUrl + "/onOpenAuth/cti/openApi/querycalllist1"; String url = ctiUrl + "/onOpenAuth/cti/openApi/queryservicelist1";
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("connectionid",connectionid); params.put("serviceconnectionid",serviceconnectionid);
Map<String,String> header = new HashMap<>(); Map<String,String> header = new HashMap<>();
header.put("accessToken",token); header.put("accessToken",token);
String responseStr = HttpUtils.doPostWithHeader(url,params.toJSONString(),header); String responseStr = HttpUtils.doPostWithHeader(url,params.toJSONString(),header);
......
...@@ -40,4 +40,8 @@ emqx.password=a123456 ...@@ -40,4 +40,8 @@ emqx.password=a123456
## redisʱʱ ## redisʱʱ
redis.cache.failure.time=10800 redis.cache.failure.time=10800
failure.work.flow.processDefinitionKey=malfunction_repair failure.work.flow.processDefinitionKey=malfunction_repair
\ No newline at end of file
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.46.151.113:8000
\ No newline at end of file
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