Browse Source

fix:系统异常时格式化返回的答案

zhongwei
haungxing 6 months ago
parent
commit
4e6a3e28f4
  1. 6
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java
  2. 4
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java

6
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springblade.core.tool.utils.BeanUtil;
import java.io.Serializable; import java.io.Serializable;
@ -47,4 +48,9 @@ public class AnswerVO implements Serializable {
@ApiModelProperty("其它调用的参数") @ApiModelProperty("其它调用的参数")
private Object[] extras; private Object[] extras;
public static void error(AnswerVO usualVO) {
usualVO.setRunning(0);
usualVO.setStatus(-2);
}
} }

4
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java

@ -109,9 +109,9 @@ public class InteractiveSchedule {
answerVO.setExtras(extraList.toArray(new String[extraList.size()])); answerVO.setExtras(extraList.toArray(new String[extraList.size()]));
} }
catch(Exception e) { catch(Exception e) {
redisTemplate.opsForList().leftPush(HZIMS_BIGMODEL_ASK_KEY,answerVO.getSessionId());
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException(e); AnswerVO.error(answerVO);
answerVO.setAnswer("非常抱歉,系统在处理您的请求时遇到了问题。请稍后再试或联系我们的客服团队。");
} }
} }
if(sessionIds.contains(answerVO.getSessionId())){ if(sessionIds.contains(answerVO.getSessionId())){

Loading…
Cancel
Save