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