|
|
|
@ -11,6 +11,7 @@ import com.inspect.simulator.domain.algorithm.out.AnalyseResPoint; |
|
|
|
import com.inspect.simulator.domain.algorithm.out.AnalyseResult; |
|
|
|
import com.inspect.simulator.domain.assistant.*; |
|
|
|
import com.inspect.simulator.domain.bigmodelr.*; |
|
|
|
import com.inspect.simulator.mapper.PatrolResultMapper; |
|
|
|
import com.inspect.simulator.mapper.ResultAnalysisMapper; |
|
|
|
import com.inspect.simulator.service.ModelService; |
|
|
|
import com.inspect.simulator.service.remote.AnalysisRemoteService; |
|
|
|
@ -70,6 +71,9 @@ public class ModelServiceImpl implements ModelService { |
|
|
|
@Resource |
|
|
|
private ResultAnalysisMapper resultAnalysisMapper; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private PatrolResultMapper patrolResultMapper; |
|
|
|
|
|
|
|
private final Logger log = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
private final ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
@ -288,28 +292,35 @@ public class ModelServiceImpl implements ModelService { |
|
|
|
String content = (String) parsedResponse.getChoices().get(0).getMessage().getContent(); |
|
|
|
// 移除转义字符,还原为标准JSON格式 |
|
|
|
String normalizedJson = content.replace("\\\"", "\"").replace("\\n", ""); |
|
|
|
// 使用Jackson反序列化 |
|
|
|
ContentJson contentJson = new ContentJson(false, "无描述内容", "无缺陷类型",""); |
|
|
|
try { |
|
|
|
contentJson = objectMapper.readValue(normalizedJson, ContentJson.class); |
|
|
|
} catch (JsonProcessingException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
if (contentJson.getIsDefect()) {//true |
|
|
|
contentJson.setIsDefectValue("1"); |
|
|
|
}else { |
|
|
|
contentJson.setIsDefectValue("0"); |
|
|
|
} |
|
|
|
//存入数据库 |
|
|
|
String objectId = analyseRequest.getObjectList().get(0).getObjectId(); |
|
|
|
contentJson.setObjectId(objectId); |
|
|
|
contentJson.setFilter("2"); |
|
|
|
log.info("返回json"+new Gson().toJson(contentJson)); |
|
|
|
String lineId = patrolResultMapper.selectPatrolResultByTaskPatrolledId(analyseRequest.getTaskPatrolId()); |
|
|
|
String[] typeList = analyseRequest.getObjectList().get(0).getTypeList(); |
|
|
|
List<ContentJson> contentJsonList =new ArrayList<>(); |
|
|
|
for (int i = 0; i < typeList.length; i++) { |
|
|
|
// 使用Jackson反序列化 |
|
|
|
ContentJson contentJson = new ContentJson(false, "无描述内容", "无缺陷类型",""); |
|
|
|
try { |
|
|
|
contentJson = objectMapper.readValue(normalizedJson, ContentJson.class); |
|
|
|
} catch (JsonProcessingException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
if (contentJson.getIsDefect()) {//true-缺陷 |
|
|
|
contentJson.setIsDefectValue("0"); |
|
|
|
}else { |
|
|
|
contentJson.setIsDefectValue("1"); |
|
|
|
} |
|
|
|
|
|
|
|
int i = resultAnalysisMapper.addDmtModelInfo(contentJson); |
|
|
|
//存入数据库 |
|
|
|
String objectId = analyseRequest.getObjectList().get(0).getObjectId(); |
|
|
|
contentJson.setObjectId(objectId); |
|
|
|
contentJson.setFilter("2"); |
|
|
|
contentJson.setTaskPatrolId(analyseRequest.getTaskPatrolId()); |
|
|
|
|
|
|
|
contentJson.setBusinessId(lineId); |
|
|
|
contentJson.setUseType(typeList[i]); |
|
|
|
contentJsonList.add(contentJson); |
|
|
|
} |
|
|
|
int i = resultAnalysisMapper.addDmtModelInfo(contentJsonList); |
|
|
|
return i; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|