Merge remote-tracking branch 'origin/dev-feature-20241211-voctransfer-zhangfan' into dev-feature-20241211-voctransfer-zhangfan
This commit is contained in:
@@ -20,7 +20,6 @@ public class DataMaskingRuleServiceImpl extends ServiceImpl<DataMaskingRuleMappe
|
|||||||
public List<DataMaskingRule> getDataMaskingRuleListByApplicationChannel(String applicationChannel) {
|
public List<DataMaskingRule> getDataMaskingRuleListByApplicationChannel(String applicationChannel) {
|
||||||
log.info("getDataMaskingRuleListByApplicationChannel {}", applicationChannel);
|
log.info("getDataMaskingRuleListByApplicationChannel {}", applicationChannel);
|
||||||
//根据适用渠道applicationChannel获取数据脱敏规则List
|
//根据适用渠道applicationChannel获取数据脱敏规则List
|
||||||
log.info("getDataMaskingRuleListByApplicationChannel applicationChannel:{}", applicationChannel);
|
|
||||||
List<DataMaskingRule> dataMaskingRuleList = this.lambdaQuery()
|
List<DataMaskingRule> dataMaskingRuleList = this.lambdaQuery()
|
||||||
// .eq(DataMaskingRule::getApplicationChannel, applicationChannel)
|
// .eq(DataMaskingRule::getApplicationChannel, applicationChannel)
|
||||||
.eq(DataMaskingRule::getRuleStatus, YesOrNoConstants.YES)
|
.eq(DataMaskingRule::getRuleStatus, YesOrNoConstants.YES)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
@@ -69,6 +70,7 @@ public class MqMessageRecordServiceImpl extends ServiceImpl<MqMessageRecordMappe
|
|||||||
* @return 返回处理情况
|
* @return 返回处理情况
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public boolean processMessageByMQ(String message) {
|
public boolean processMessageByMQ(String message) {
|
||||||
log.info("message: {}", message);
|
log.info("message: {}", message);
|
||||||
LocalDateTime currTime = LocalDateTime.now();
|
LocalDateTime currTime = LocalDateTime.now();
|
||||||
@@ -180,19 +182,21 @@ public class MqMessageRecordServiceImpl extends ServiceImpl<MqMessageRecordMappe
|
|||||||
if (!CollectionUtils.isEmpty(sourceIds)) {
|
if (!CollectionUtils.isEmpty(sourceIds)) {
|
||||||
//查询未完成解析的通话信息
|
//查询未完成解析的通话信息
|
||||||
String sourceId = sourceIds.stream().map(code -> "'"+code+"'").collect(Collectors.joining(","));
|
String sourceId = sourceIds.stream().map(code -> "'"+code+"'").collect(Collectors.joining(","));
|
||||||
int asrCount = clickhouseJdbcTemplate.queryForObject("select count(1) from asr_speechdetail where source_id in ("+ sourceId+") and file_status='InProgress'",Integer.class);
|
// int asrCount = clickhouseJdbcTemplate.queryForObject("select count(1) from asr_speechdetail where source_id in ("+ sourceId+") and file_status='InProgress'",Integer.class);
|
||||||
if (asrCount > 0) {
|
// if (asrCount > 0) {
|
||||||
log.info("存在未完成解析的通话信息");
|
// log.info("存在未完成解析的通话信息");
|
||||||
output.setHandleStatus(HandleStatusEnum.ANALYSIS_CALLING.getCode());
|
// output.setHandleStatus(HandleStatusEnum.ANALYSIS_CALLING.getCode());
|
||||||
output.setResultStr(HandleStatusEnum.ANALYSIS_CALLING.getMessage());
|
// output.setResultStr(HandleStatusEnum.ANALYSIS_CALLING.getMessage());
|
||||||
return new DiffDefeatAnalyseOutputResult(output, contentStr.toString());
|
// return new DiffDefeatAnalyseOutputResult(output, contentStr.toString());
|
||||||
}
|
// }
|
||||||
//查询到的通话数据
|
//查询到的通话数据
|
||||||
List<Map<String, Object>> historyList = clickhouseJdbcTemplate.queryForList("select id,msg_json,source_id from asr_hishistory where dialect_text=0 and source_id in ("+ sourceId+") order by id");
|
String sql = "select display,sourceId from ods_asrdetail_d where sourceId in ("+ sourceId+") order by transcribeTime";
|
||||||
|
log.info("查询通话数据sql {}",sql);
|
||||||
|
List<Map<String, Object>> historyList = clickhouseJdbcTemplate.queryForList(sql);
|
||||||
for (CallItem item : input.getCallList()) {
|
for (CallItem item : input.getCallList()) {
|
||||||
Optional<String> result = CollectionUtils.isEmpty(historyList) ? Optional.empty():
|
Optional<String> result = CollectionUtils.isEmpty(historyList) ? Optional.empty():
|
||||||
historyList.stream().filter(entity -> entity.get("source_id").equals(item.getSourceId()))
|
historyList.stream().filter(entity -> entity.get("sourceId").equals(item.getSourceId()))
|
||||||
.findFirst().map(entity -> entity.get("msg_json") == null ? "" : entity.get("msg_json").toString());
|
.findFirst().map(entity -> entity.get("display") == null ? "" : entity.get("display").toString());
|
||||||
DiffDefeatCorpuItem curDiffDefeatCorpItem = new DiffDefeatCorpuItem();
|
DiffDefeatCorpuItem curDiffDefeatCorpItem = new DiffDefeatCorpuItem();
|
||||||
curDiffDefeatCorpItem.setSourceId(item.getSourceId());
|
curDiffDefeatCorpItem.setSourceId(item.getSourceId());
|
||||||
curDiffDefeatCorpItem.setCategory(CategoryEnum.PHONE_VOICE.getCode());
|
curDiffDefeatCorpItem.setCategory(CategoryEnum.PHONE_VOICE.getCode());
|
||||||
@@ -207,8 +211,9 @@ public class MqMessageRecordServiceImpl extends ServiceImpl<MqMessageRecordMappe
|
|||||||
log.info("企微用户信息为空,不附加企微数据");
|
log.info("企微用户信息为空,不附加企微数据");
|
||||||
}else {
|
}else {
|
||||||
try {
|
try {
|
||||||
String userIdSql = "select distinct userid as userid from ods_vdqw.ods_vdqw_workuserinfo_d where middleuserid ='" + input.getVdqwUserId()
|
String userIdSql = "select distinct userid as userid from ods_workuserinfo_d where middleuserid ='" + input.getVdqwUserId()
|
||||||
+ "' union ALL select externaluserid as userid from ods_vdqw.ods_vdqw_externalcontact_d where unionid ='" + input.getVdqwCustomerId() + "'";
|
+ "' union ALL select externaluserid as userid from ods_externalcontact_d where unionid ='" + input.getVdqwCustomerId() + "'";
|
||||||
|
log.info("查询企微用户数据sql {}",userIdSql);
|
||||||
List<Map<String, Object>> userList = clickhouseJdbcTemplate.queryForList(userIdSql);
|
List<Map<String, Object>> userList = clickhouseJdbcTemplate.queryForList(userIdSql);
|
||||||
if (!CollectionUtils.isEmpty(userList) && userList.size() == 2) {
|
if (!CollectionUtils.isEmpty(userList) && userList.size() == 2) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
@@ -219,17 +224,18 @@ public class MqMessageRecordServiceImpl extends ServiceImpl<MqMessageRecordMappe
|
|||||||
String user2 = userList.get(1).get("userid").toString();
|
String user2 = userList.get(1).get("userid").toString();
|
||||||
String sql = "with tab As(" +
|
String sql = "with tab As(" +
|
||||||
"select *, ROW_NUMBER() OVER (PARTITION BY id ORDER BY msgtime DESC) as rn " +
|
"select *, ROW_NUMBER() OVER (PARTITION BY id ORDER BY msgtime DESC) as rn " +
|
||||||
"from ods_vdqw.ods_vdqw_messagearchiving_d " +
|
"from ods_messagearchiving_d " +
|
||||||
"where msgtime >= '" + startTime + "' and msgtime < '" + endTime + "' " +
|
"where msgtime >= '" + startTime + "' and msgtime < '" + endTime + "' " +
|
||||||
"and chattype = '0' and msgtype='text')" +
|
"and chattype = '0' and msgtype='text')" +
|
||||||
"select id,fromuserid,acceptuserid,msgtime,content,seq,actiontype,msgid,msgtype," +
|
"select id,fromuserid,acceptuserid,msgtime,content,seq,actiontype,msgid,msgtype," +
|
||||||
"(case when tab2.userid is null or tab2.userid='' then 0 else 1 end) as fromuserrole " +
|
"(case when tab2.userid is null or tab2.userid='' then 0 else 1 end) as fromuserrole " +
|
||||||
"from tab LEFT JOIN (select distinct userid from ods_vdqw.ods_vdqw_workuserinfo_d) tab2 " +
|
"from tab LEFT JOIN (select distinct userid from ods_workuserinfo_d) tab2 " +
|
||||||
"on tab.fromuserid = tab2.userid " +
|
"on tab.fromuserid = tab2.userid " +
|
||||||
"where rn = 1 and ((" +
|
"where rn = 1 and ((" +
|
||||||
"fromuserid ='" + user1 + "' and acceptuserid ='" + user2 + "') or (" +
|
"fromuserid ='" + user1 + "' and acceptuserid ='" + user2 + "') or (" +
|
||||||
"fromuserid ='" + user2 + "' and acceptuserid ='" + user1 + "'))" +
|
"fromuserid ='" + user2 + "' and acceptuserid ='" + user1 + "'))" +
|
||||||
"order by seq;";
|
"order by seq;";
|
||||||
|
log.info("企微数据查询sql {}",sql);
|
||||||
List<SessionItem> userInfoList = clickhouseJdbcTemplate.queryForList(sql, SessionItem.class);
|
List<SessionItem> userInfoList = clickhouseJdbcTemplate.queryForList(sql, SessionItem.class);
|
||||||
|
|
||||||
for (int i=0;i<offsetDay;i++){
|
for (int i=0;i<offsetDay;i++){
|
||||||
@@ -239,7 +245,7 @@ public class MqMessageRecordServiceImpl extends ServiceImpl<MqMessageRecordMappe
|
|||||||
this.addSliceData(curDiffDefeatCorpItems, sliceStartTime, sliceStopTime, userInfoList);
|
this.addSliceData(curDiffDefeatCorpItems, sliceStartTime, sliceStopTime, userInfoList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ParseException e) {
|
} catch (Exception e) {
|
||||||
log.error("企微数据处理异常",e);
|
log.error("企微数据处理异常",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,9 +258,10 @@ public class MqMessageRecordServiceImpl extends ServiceImpl<MqMessageRecordMappe
|
|||||||
contentStr.append(item.getCorpuText());
|
contentStr.append(item.getCorpuText());
|
||||||
} else if (Objects.equals(CategoryEnum.PHONE_VOICE.getCode(),item.getCategory()) && StringUtils.isNotEmpty(item.getCorpuText())) {
|
} else if (Objects.equals(CategoryEnum.PHONE_VOICE.getCode(),item.getCategory()) && StringUtils.isNotEmpty(item.getCorpuText())) {
|
||||||
// 反序列化CorpuText为KafkaJson对象
|
// 反序列化CorpuText为KafkaJson对象
|
||||||
KafkaJson oldItem = JSON.parseObject(item.getCorpuText(), KafkaJson.class);
|
// KafkaJson oldItem = JSON.parseObject(item.getCorpuText(), KafkaJson.class);
|
||||||
// 反序列化display为CollectTranscriberJobResponse对象
|
// 反序列化display为CollectTranscriberJobResponse对象
|
||||||
CollectTranscriberJobResponse resp = JSON.parseObject(oldItem.getDisplay(), CollectTranscriberJobResponse.class);
|
CollectTranscriberJobResponse resp = JSON.parseObject(item.getCorpuText(), CollectTranscriberJobResponse.class);
|
||||||
|
// CollectTranscriberJobResponse resp = JSON.parseObject(oldItem.getDisplay(), CollectTranscriberJobResponse.class);
|
||||||
// 检查状态并处理Segments
|
// 检查状态并处理Segments
|
||||||
if (Objects.equals("FINISHED",resp.getStatus()) && !CollectionUtils.isEmpty(resp.getSegments())) {
|
if (Objects.equals("FINISHED",resp.getStatus()) && !CollectionUtils.isEmpty(resp.getSegments())) {
|
||||||
StringBuilder vocStr = new StringBuilder();
|
StringBuilder vocStr = new StringBuilder();
|
||||||
|
|||||||
Reference in New Issue
Block a user