Commit 6fe14bff authored by xinglei's avatar xinglei

*)修改后端

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