Commit 6fe14bff authored by xinglei's avatar xinglei

*)修改后端

parent f5df4d7d
......@@ -30,6 +30,12 @@ public class VoiceRecordFile extends BaseEntity {
private String filePath;
/**
* CID
*/
@TableField("connect_id")
private String connectId;
/**
* 通话类型
*/
@TableField("file_type")
......
......@@ -4,7 +4,6 @@
<sql id="componentField">
r.sequence_nbr AS sequenceNbr,
r.file_path AS filePath,
r.file_type AS fileType,
r.caller AS caller,
r.called AS called,
......
......@@ -40,7 +40,6 @@ public class VoiceRecordFileController extends BaseController {
@Autowired
AlertCalledServiceImpl iAlertCalledService;
/**
* 根据警情id 查找通话记录信息
*
......@@ -78,7 +77,6 @@ public class VoiceRecordFileController extends BaseController {
return ResponseHelper.buildResponse(record);
}
/**
* 新增-通话记录
*
......@@ -96,8 +94,6 @@ public class VoiceRecordFileController extends BaseController {
return ResponseHelper.buildResponse(true);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询通话记录", notes = "查询通话记录")
@GetMapping("/selectRecord")
......
......@@ -81,7 +81,7 @@ public class FusionServiceImpl implements IFusionService {
@Override
public Map<String, String> getCallRecordByCID(String cid) {
MultiValueMap<String, String> requestEntity = new LinkedMultiValueMap<String, String>();
requestEntity.add("cid", cid);
requestEntity.add("CID", cid);
JSONObject jsonObject = null;
try {
jsonObject = RestTemplateUtil.getRestInstance().postForObject(String.format("%s/GetCallRecordByCID", voiceURL), requestEntity, JSONObject.class);
......@@ -94,9 +94,17 @@ public class FusionServiceImpl implements IFusionService {
public Map<String, String> getResult(JSONObject jsonObject) {
Map<String, String> map = new HashMap<>();
JSONArray data = jsonObject.getJSONArray("data");
if (!ValidationUtil.isEmpty(data)) {
map = (Map) data.get(0);
if (ValidationUtil.isEmpty(jsonObject)) {
throw new BadRequest("访问融合终端失败");
}
if (jsonObject.get("data") instanceof Map) {
JSONObject data = jsonObject.getJSONObject("data");
map = (Map) data;
} else {
JSONArray data = jsonObject.getJSONArray("data");
if (!ValidationUtil.isEmpty(data)) {
map = (Map) data.get(0);
}
}
return map;
}
......
......@@ -20,6 +20,7 @@ import org.apache.logging.log4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -84,11 +85,19 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
VoiceRecordFile voiceRecordFile = new VoiceRecordFile();
BeanUtils.copyProperties(model, voiceRecordFile);
log.setAlertId(model.getAlertId());
log.setConnectId(dMap.get("cid"));
String cid = dMap.get("cid");
Assert.notNull(cid, "CID不能为空");
Map<String, String> callRecord = fusionService.getCallRecordByCID(cid);
log.setConnectId(cid);
log.setIsDeal(false);
log.setDealTimes(0);
if (!ValidationUtil.isEmpty(callRecord)){
voiceRecordFile.setFilePath(String.format("/%s/%s", callRecord.get("subPath"), callRecord.get("recordName").replace("wav", "mp3")));
logger.info(String.format("音频地址:【%s】", String.format("/%s/%s", callRecord.get("subPath"), callRecord.get("recordName"))));
} else { // 无录音地址记录日志
iVoiceRecordLogServiceImpl.save(log);
}
save(voiceRecordFile);
iVoiceRecordLogServiceImpl.save(log);
}
@Override
......@@ -108,6 +117,8 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
@Override
public VoiceRecordFileDto getRecordById(Long sequenceNbr) {
VoiceRecordFileDto record = baseMapper.getRecordById(sequenceNbr);
Map<String, String> callRecord = fusionService.getCallRecordByCID(record.getConnectId());
record.setFilePath(callRecord.get("cid"));
return record;
}
......@@ -125,8 +136,7 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
public List<FusionDto> getCarList(Boolean hasFusion) {
List<FusionDto> fusionDtos = new ArrayList<>();
List carList = equipFeignClient.getCarFusionList().getResult();
List<String> employeeIDs = getAllOnlineUser();
List<String> employeeIDs = getAllOnlineUser(hasFusion);
if (!ValidationUtil.isEmpty(carList)) {
carList.forEach(x -> {
FusionDto fusionDto = new FusionDto();
......@@ -145,7 +155,7 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
public List<FusionDto> getSinglePawnList(Boolean hasFusion) {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues(SINGLE_PAWN).getResult();
List<FusionDto> fusionDtos = new ArrayList<>();
List<String> employeeIDs = getAllOnlineUser();
List<String> employeeIDs = getAllOnlineUser(hasFusion);
result.forEach(model -> {
FusionDto fusionDto = new FusionDto();
......@@ -163,15 +173,17 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
*
* @return
*/
private List<String> getAllOnlineUser() {
JSONObject jsonObject = fusionService.getAllOnlineUser();
private List<String> getAllOnlineUser(Boolean hasFusion) {
List<String> employeeIDs = new ArrayList<>();
if (!ValidationUtil.isEmpty(jsonObject)) {
JSONArray onlines = jsonObject.getJSONArray("Onlines");
onlines.forEach(x -> {
Map<String, String> obj = (Map) x;
employeeIDs.add(obj.get("employeeID"));
});
if (hasFusion){
JSONObject jsonObject = fusionService.getAllOnlineUser();
if (!ValidationUtil.isEmpty(jsonObject)) {
JSONArray onlines = jsonObject.getJSONArray("Onlines");
onlines.forEach(x -> {
Map<String, String> obj = (Map) x;
employeeIDs.add(obj.get("employeeID"));
});
}
}
return employeeIDs;
}
......
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