|
@@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.auth0.jwt.interfaces.DecodedJWT;
|
|
|
import com.rf.kjb.base.rest.BaseController;
|
|
|
import com.rf.kjb.chat.dao.domain.*;
|
|
|
-import com.rf.kjb.chat.service.ChatAnswerService;
|
|
|
-import com.rf.kjb.chat.service.ChatQuestionService;
|
|
|
-import com.rf.kjb.chat.service.ChatRecordService;
|
|
|
-import com.rf.kjb.chat.service.ResultQuestionService;
|
|
|
+import com.rf.kjb.chat.service.*;
|
|
|
import com.rf.kjb.excel.ExcelUtil;
|
|
|
import com.rf.kjb.exception.ErrorCode;
|
|
|
import com.rf.kjb.intelligentDialogue.dao.domain.IntelligentDialogueEntity;
|
|
@@ -69,11 +66,8 @@ public class ChatController extends BaseController {
|
|
|
@Autowired
|
|
|
private IntelligentDialogueService intelligentDialogueService;
|
|
|
|
|
|
- private String depressedOneEvaluationResult = "'5','134','298'";
|
|
|
- private String depressedTwoEvaluationResult = "'5','134'";
|
|
|
- private String depressedThreeEvaluationResult = "'5','134'";
|
|
|
- private String depressedFourEvaluationResult = "'5','134'";
|
|
|
- private String depressedFiveEvaluationResult = "'5','134'";
|
|
|
+ @Autowired
|
|
|
+ private QuestionSkipService questionSkipService;
|
|
|
|
|
|
/**
|
|
|
* 查询会话问题
|
|
@@ -97,7 +91,63 @@ public class ChatController extends BaseController {
|
|
|
questionEntity.setQuestion(userEntry.getUserName()+questionEntity.getQuestion());
|
|
|
}
|
|
|
//情绪打分跳转
|
|
|
- if (label.equals("2")){
|
|
|
+ List<QuestionSkipEntity> questionSkipEntities = this.questionSkipService.findByLabelAndNumAndType(label,num,"5");
|
|
|
+ for (QuestionSkipEntity questionSkipEntity : questionSkipEntities) {
|
|
|
+ if (id.equals(questionSkipEntity.getQuestionNo())){
|
|
|
+ int a = emotionScore(identifier,label,num,questionSkipEntity.getSkipQuestionNo());
|
|
|
+ switch (a) {
|
|
|
+ case 1:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum(id, label, num);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum(String.valueOf(Integer.valueOf(id)+2), label, num);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum(String.valueOf(Integer.valueOf(id)+4), label, num);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum(String.valueOf(Integer.valueOf(id)+6), label, num);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //情绪二次打分跳转
|
|
|
+ if (id.equals("4")){
|
|
|
+ if (num.equals("2") || num.equals("3") || num.equals("4") || num.equals("5")){
|
|
|
+ String lastNum = String.valueOf(Integer.valueOf(num) - 1);
|
|
|
+ IntelligentDialogueEntity intelligentDialogue = this.intelligentDialogueService.findLastScoreByIdentifierByLabelByNumByQuestionNo(identifier,label,lastNum,"5");
|
|
|
+ int lastScore = 0;
|
|
|
+ if (intelligentDialogue != null){
|
|
|
+ lastScore = Integer.valueOf(intelligentDialogue.getContent());
|
|
|
+ }
|
|
|
+ IntelligentDialogueEntity intelligentDialogueEntity = this.intelligentDialogueService.findScoreByIdentifierByLabelByNumByQuestionNo(identifier,label,num);
|
|
|
+ int score = Integer.valueOf(intelligentDialogueEntity.getContent()) - lastScore;
|
|
|
+ if (score <= -80){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("13", label, num);
|
|
|
+ }else if (score <= -60 && score > -80){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("11", label, num);
|
|
|
+ }else if (score <= -40 && score > -60){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("9", label, num);
|
|
|
+ }else if (score <= -20 && score > -40){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("7", label, num);
|
|
|
+ }else if (score <= 0 && score > -20){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("5", label, num);
|
|
|
+ }else if (score <= 20 && score > 0){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("4", label, num);
|
|
|
+ }else if (score <= 40 && score > 20){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("6", label, num);
|
|
|
+ }else if (score <= 60 && score > 40){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("8", label, num);
|
|
|
+ }else if (score <= 80 && score > 60){
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("10", label, num);
|
|
|
+ }else {
|
|
|
+ questionEntity = this.questionService.findByIdAndLabelAndNum("12", label, num);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*if (label.equals("2")){
|
|
|
if (num.equals("1")){
|
|
|
if (id.equals("41")){
|
|
|
questionEntity = emotionScoreSkip(identifier,label,num,"40");
|
|
@@ -164,7 +214,11 @@ public class ChatController extends BaseController {
|
|
|
//情绪二次打分跳转
|
|
|
if (id.equals("4")){
|
|
|
String lastNum = String.valueOf(Integer.valueOf(num) - 1);
|
|
|
- int lastScore = Integer.valueOf(this.intelligentDialogueService.findLastScoreByIdentifierByLabelByNumByQuestionNo(identifier,label,lastNum,"4").getContent());
|
|
|
+ IntelligentDialogueEntity intelligentDialogue = this.intelligentDialogueService.findLastScoreByIdentifierByLabelByNumByQuestionNo(identifier,label,lastNum,"4");
|
|
|
+ int lastScore = 0;
|
|
|
+ if (intelligentDialogue != null){
|
|
|
+ lastScore = Integer.valueOf(intelligentDialogue.getContent());
|
|
|
+ }
|
|
|
IntelligentDialogueEntity intelligentDialogueEntity = this.intelligentDialogueService.findScoreByIdentifierByLabelByNumByQuestionNo(identifier,label,num);
|
|
|
int score = Integer.valueOf(intelligentDialogueEntity.getContent()) - lastScore;
|
|
|
if (score <= -80){
|
|
@@ -190,7 +244,7 @@ public class ChatController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
//替换用户名
|
|
|
if (questionEntity.getQuestion().contains("userName")){
|
|
|
questionEntity.setQuestion(questionEntity.getQuestion().replace("userName",userEntry.getUserName()));
|