语料结果分析入参修改
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.volvo.ai.analytic.center.dto.req;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@@ -7,6 +8,6 @@ public class SummaryQuestionRequestDTO {
|
||||
|
||||
private String summaryReportId;
|
||||
|
||||
private String preliminarySummaryResults;
|
||||
private JSONObject preliminarySummaryResults;
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@RestController()
|
||||
@@ -45,45 +48,43 @@ public class AiAnalysisDifyController {
|
||||
|
||||
@PostMapping("/aiAnalyze")
|
||||
@ApiOperation(value = "Ai解析接口")
|
||||
public AnalysisResp<Object> aiAnalyze(@Validated @RequestBody String message) {
|
||||
log.info("aiAnalyze data: {}",message);
|
||||
public AnalysisResp<Object> aiAnalyze(@Validated @RequestBody String message) {
|
||||
log.info("aiAnalyze data: {}", message);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true); // 允许未转义的控制字符
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
try {
|
||||
AnalysisReq analysisReq = objectMapper.readValue(message, AnalysisReq.class);
|
||||
AnalysisReq analysisReq = objectMapper.readValue(message, AnalysisReq.class);
|
||||
analysisReq.validate();
|
||||
return aiAnalysisDifyService.aiAnalyze(analysisReq);
|
||||
return aiAnalysisDifyService.aiAnalyze(analysisReq);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.info("aiAnalyze data error: {}",e);
|
||||
log.info("aiAnalyze data error: {}", e);
|
||||
return AnalysisResp.failed("解析失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/query")
|
||||
@ApiOperation(value = "Ai解析结果查询")
|
||||
public AnalysisResp<Object> query(@RequestBody @Validated AnalysisQueryReq analysisQueryReq) {
|
||||
log.info("aiAnalyze query data: {}",analysisQueryReq);
|
||||
return aiAnalysisDifyService.query(analysisQueryReq);
|
||||
public AnalysisResp<Object> query(@RequestBody @Validated AnalysisQueryReq analysisQueryReq) {
|
||||
log.info("aiAnalyze query data: {}", analysisQueryReq);
|
||||
return aiAnalysisDifyService.query(analysisQueryReq);
|
||||
}
|
||||
|
||||
@PostMapping("/callback")
|
||||
@ApiOperation(value = "Ai解析结果查询")
|
||||
public AnalysisResp<Object> testCallback(@RequestBody AnalysisResp analysisResp) {
|
||||
log.info("aiAnalyze testCallback data: {}",analysisResp);
|
||||
return AnalysisResp.success("ok");
|
||||
log.info("aiAnalyze testCallback data: {}", analysisResp);
|
||||
return AnalysisResp.success("ok");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/corpusSummaryQuestion")
|
||||
@ApiOperation(value = "单条语料分析结论入库")
|
||||
public AnalysisResp<Object> corpusSummaryQuestion(@RequestBody String requestDTO1) {
|
||||
log.info("aiAnalyze corpusSummaryQuestion requestDTO: {}", JSON.toJSONString(requestDTO1));
|
||||
|
||||
SummaryQuestionRequestDTO requestDTO = new SummaryQuestionRequestDTO();
|
||||
public AnalysisResp<Object> corpusSummaryQuestion(@RequestBody SummaryQuestionRequestDTO requestDTO) {
|
||||
log.info("aiAnalyze corpusSummaryQuestion requestDTO: {}", JSON.toJSONString(requestDTO));
|
||||
// 打印接收到的参数
|
||||
userQuestionSummaryService.updateSummery(requestDTO);
|
||||
return AnalysisResp .success("ok");
|
||||
return AnalysisResp.success("ok");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -89,10 +89,10 @@ public class UserQuestionSummaryServiceImpl extends ServiceImpl<TmCorpusQuestion
|
||||
|
||||
@Override
|
||||
public void updateSummery(SummaryQuestionRequestDTO summaryQuestionRequestDTO) {
|
||||
if (summaryQuestionRequestDTO == null || summaryQuestionRequestDTO.getSummaryReportId() == null || StringUtils.isBlank(summaryQuestionRequestDTO.getPreliminarySummaryResults())) {
|
||||
if (summaryQuestionRequestDTO == null || summaryQuestionRequestDTO.getSummaryReportId() == null || summaryQuestionRequestDTO.getPreliminarySummaryResults() ==null) {
|
||||
return;
|
||||
}
|
||||
tmCorpusQuestionSummaryReportMapper.updateBySummaryReportId(summaryQuestionRequestDTO.getSummaryReportId(), summaryQuestionRequestDTO.getPreliminarySummaryResults());
|
||||
tmCorpusQuestionSummaryReportMapper.updateBySummaryReportId(summaryQuestionRequestDTO.getSummaryReportId(), summaryQuestionRequestDTO.getPreliminarySummaryResults().toString());
|
||||
}
|
||||
|
||||
private void processItem(Date statTime, Date endTime, String mainCategoryString) {
|
||||
|
||||
Reference in New Issue
Block a user