修改json解析

This commit is contained in:
zren25
2025-04-08 11:54:45 +08:00
parent e642db2f93
commit 2b2a5acc6c

View File

@@ -108,21 +108,16 @@ public class IntelligentCustomerServiceImpl implements IntelligentCustomerServic
String message = null;
try {
JSONObject outputsJson = execDifyFlow.getJSONObject("outputs");
JSONObject textJsonObject =outputsJson.getJSONObject("text");
if(textJsonObject.containsKey("answer")){
textJsonObject = textJsonObject.getJSONObject("answer"); // 投诉
}
// 咨询
JSONObject textJsonObject =outputsJson.getJSONObject("text").getJSONObject("consult");
ConsultDTO consultDTO = new ConsultDTO();
consultDTO.setOrderType(fourInOneMqServiceFilter(IntelligentCustomerTypeEnum.CONSULT.getCode(),textJsonObject.getString("工单类别")));
consultDTO.setProblemDescription(textJsonObject.getString("问题描述"));
consultDTO.setContactSex(textJsonObject.getString("工单联系人性别"));
consultDTO.setContactName(textJsonObject.getString("工单联系人姓名"));
consultDTO.setContactTelephone(textJsonObject.getString("工单联系电话"));
JSONObject complainObject = outputsJson.getJSONObject("text1");
if(complainObject.containsKey("answer")){
complainObject = complainObject.getJSONObject("answer"); // 投诉
}
// 投诉
JSONObject complainObject = outputsJson.getJSONObject("text1").getJSONObject("complain");
ComplainDTO complainDTO = new ComplainDTO();
complainDTO.setComplainType(fourInOneMqServiceFilter(IntelligentCustomerTypeEnum.CONSULT_TYPE.getCode(),complainObject.getString("投诉类型")));
complainDTO.setOrderType(fourInOneMqServiceFilter(IntelligentCustomerTypeEnum.COMPLAIN.getCode(),complainObject.getString("工单类别")));