增加电话语料补偿

This commit is contained in:
zren25
2025-03-26 15:43:16 +08:00
parent f18a9d5a2b
commit 9ff431d492
7 changed files with 80 additions and 2 deletions

View File

@@ -1,6 +1,9 @@
package com.volvo.ai.analytic.center.job;
import com.volvo.ai.analytic.center.dto.corpus.AicorpusTelephoneDTO;
import com.volvo.ai.analytic.center.mapper.TmTelephoneCorpusMapper;
import com.volvo.ai.analytic.center.service.TmOdsVdqwMessagearchivingService;
import com.volvo.ai.analytic.center.service.TmTelephoneCorpusService;
import com.volvo.common.core.util.ResultMsg;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
@@ -12,6 +15,9 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
@Slf4j
@Component
@@ -21,6 +27,12 @@ public class QiWeiCorpusJob {
@Autowired
private TmOdsVdqwMessagearchivingService tmOdsVdqwMessagearchivingService;
@Autowired
private TmTelephoneCorpusService tmTelephoneCorpusService;
@Autowired
private TmTelephoneCorpusMapper tmTelephoneCorpusMapper;
/**
* 企微语料处理
*/
@@ -43,6 +55,28 @@ public class QiWeiCorpusJob {
return ResultMsg.ok();
}
@XxlJob("DccCorpusFailRetry")
@PostMapping("dccCorpusFailRetry")
public ResultMsg DccCorpusFailRetry(@RequestBody String paramJson) {
try {
// 获取任务参数
String param = XxlJobHelper.getJobParam();
if(StringUtils.isEmpty(param)){
param = paramJson;
}
// 执行业务逻辑
XxlJobHelper.log("任务参数: {}", param);
List<AicorpusTelephoneDTO> corpusDtoList = tmTelephoneCorpusMapper.queryTelephoneCorpusBySourceIds( Arrays.asList(param.split(",")));
corpusDtoList.stream().forEach(item->{
tmTelephoneCorpusService.runTelephoneCorpusDify(item);
});
} catch (Exception e) {
log.error("processMessageByTask 定时任务补偿处理消息异常",e.getMessage());
throw new RuntimeException(e);
}
return ResultMsg.ok();
}
@PostMapping("qiWeiCorpusTaskMock")
public ResultMsg qiWeiCorpusTaskMock(@RequestBody String paramJson) {
try {

View File

@@ -1,11 +1,13 @@
package com.volvo.ai.analytic.center.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.volvo.ai.analytic.center.dto.corpus.AicorpusTelephoneDTO;
import com.volvo.ai.analytic.center.entity.TmTelephoneCorpus;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.*;
import java.util.List;
/**
* @description 电话语料表-同步表
@@ -17,4 +19,6 @@ import java.util.*;
public interface TmTelephoneCorpusMapper extends BaseMapper<TmTelephoneCorpus> {
List<AicorpusTelephoneDTO> queryTelephoneCorpusBySourceIds(@Param("sourceIdList") List sourceIdList);
}

View File

@@ -0,0 +1,17 @@
package com.volvo.ai.analytic.center.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.volvo.ai.analytic.center.entity.AiAnalysisErrors;
import com.volvo.ai.analytic.center.entity.TtWorkflowRunRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface TtWorkflowRunRecordMapper extends BaseMapper<TtWorkflowRunRecord> {
List<AiAnalysisErrors> queryAnalysisErrorList(@Param("businessType") String businessType);
}

View File

@@ -10,4 +10,5 @@ public interface DiFyService {
public JSONObject executeDifyFlow(DiFyReq diFyReq, String businessType, String businessData);
public JSONObject executeDifyFlow(DiFyReq diFyReq);
}

View File

@@ -103,4 +103,5 @@ public class DiFyServiceImpl implements DiFyService{
JSONObject data = difyResult.getJSONObject("data");
return data;
}
}

View File

@@ -297,7 +297,7 @@ public class TmOdsVdqwMessagearchivingServiceImpl extends ServiceImpl<TmOdsVdqwM
}
log.info("runQiWeiCorpusDifyMock 数据量:",mockMessageList.size());
// mock
for (int i = 1; i <= 2000; i++) {
for (int i = 1; i <= 5; i++) {
log.info("runQiWeiCorpusDifyMock 数据量:{},第:{} 批次",mockMessageList.size(),i);
// 处理查询到的数据
// 使用 CompletableFuture 并行处理

View File

@@ -2,4 +2,25 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.volvo.ai.analytic.center.mapper.TmTelephoneCorpusMapper">
<select id="queryTelephoneCorpusBySourceIds" resultType="com.volvo.ai.analytic.center.dto.corpus.AicorpusTelephoneDTO">
SELECT
`appid` ,
`audio_url` as audioUrl,
`audio_file_id` as audioFileId ,
`source_id` as sourceId,
`category_code` as categoryCode ,
`transcribe_time` as transcribeTime,
`call_direct` as callDirect,
`status` ,
`display` ,
`platform_type` as platformType,
`display_url` as displayUrl
from tm_telephone_corpus
where is_deleted = 0
AND source_id IN
<foreach collection="sourceIdList" item="sourceId" open="(" separator="," close=")">
#{sourceId}
</foreach>
</select>
</mapper>