|
|
@ -2,6 +2,9 @@ package com.zdxt.knowledge.service.impl; |
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.zdxt.auth.dto.RoleBean; |
|
|
import com.zdxt.auth.dto.RoleBean; |
|
|
import com.zdxt.auth.dto.UserBean; |
|
|
import com.zdxt.auth.dto.UserBean; |
|
|
import com.zdxt.auth.dto.ZdxtFileBean; |
|
|
import com.zdxt.auth.dto.ZdxtFileBean; |
|
|
@ -16,17 +19,16 @@ import com.zdxt.common.zdxtFile.AttFileRespDTO; |
|
|
import com.zdxt.common.zdxtFile.FilePreviewUtilBean; |
|
|
import com.zdxt.common.zdxtFile.FilePreviewUtilBean; |
|
|
import com.zdxt.common.zdxtFile.ZdxtFileCommon; |
|
|
import com.zdxt.common.zdxtFile.ZdxtFileCommon; |
|
|
import com.zdxt.knowledge.domain.SceneQuestion; |
|
|
import com.zdxt.knowledge.domain.SceneQuestion; |
|
|
|
|
|
import com.zdxt.knowledge.domain.SceneRole; |
|
|
import com.zdxt.knowledge.mapper.SceneQuestionMapper; |
|
|
import com.zdxt.knowledge.mapper.SceneQuestionMapper; |
|
|
import com.zdxt.knowledge.service.ISceneQuestionService; |
|
|
import com.zdxt.knowledge.service.ISceneQuestionService; |
|
|
|
|
|
import com.zdxt.knowledge.service.ISceneRoleService; |
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.*; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -39,6 +41,7 @@ import java.util.stream.Collectors; |
|
|
public class SceneQuestionServiceImpl implements ISceneQuestionService { |
|
|
public class SceneQuestionServiceImpl implements ISceneQuestionService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private SceneQuestionMapper sceneQuestionMapper; |
|
|
private SceneQuestionMapper sceneQuestionMapper; |
|
|
|
|
|
@Autowired private ISceneRoleService iSceneRoleService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private UserApi userApi; |
|
|
private UserApi userApi; |
|
|
@Autowired |
|
|
@Autowired |
|
|
@ -192,4 +195,52 @@ public class SceneQuestionServiceImpl implements ISceneQuestionService { |
|
|
return zdxtFileCommonApi.deleteZdxtFileById(key); |
|
|
return zdxtFileCommonApi.deleteZdxtFileById(key); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 查出问题树 |
|
|
|
|
|
* |
|
|
|
|
|
* @param guid 场景题目ID |
|
|
|
|
|
* @return 场景题目 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public Map<String, Object> selectQuestionTree(String guid) { |
|
|
|
|
|
SceneRole sceneRole = iSceneRoleService.selectSceneRoleById(guid); |
|
|
|
|
|
JSONObject json = JSON.parseObject(sceneRole.getContent()); |
|
|
|
|
|
JSONObject dataJson = json.getJSONObject("drawflow").getJSONObject("Home").getJSONObject("data"); |
|
|
|
|
|
Map<String, Object> root = new HashMap<>(); |
|
|
|
|
|
List<Map<String, Object>> paramsList = new ArrayList<>(); |
|
|
|
|
|
for (int i=1; i<=dataJson.size(); i++) { |
|
|
|
|
|
JSONObject data = dataJson.getJSONObject(i+""); |
|
|
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
|
|
params.put("questionId", data.get("name")); |
|
|
|
|
|
|
|
|
|
|
|
Set outList = new HashSet(); |
|
|
|
|
|
JSONArray outs = data.getJSONObject("outputs").getJSONObject("output_1").getJSONArray("connections"); |
|
|
|
|
|
for (int j=0; j<outs.size(); j++) { |
|
|
|
|
|
JSONObject ot = outs.getJSONObject(j); |
|
|
|
|
|
outList.add(ot.getString("node")); |
|
|
|
|
|
} |
|
|
|
|
|
params.put("outs", outList); |
|
|
|
|
|
|
|
|
|
|
|
if ("开始".equals(data.get("name"))) { |
|
|
|
|
|
params.put("videoUrl", null); |
|
|
|
|
|
root = params; |
|
|
|
|
|
} else if (data.get("name").toString().length() == 32) { |
|
|
|
|
|
SceneQuestion sq = this.selectSceneQuestionById(params.get("questionId").toString()); |
|
|
|
|
|
if (null != sq) { |
|
|
|
|
|
params.put("videoUrl", sq.getUploadPath()); |
|
|
|
|
|
} else { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
paramsList.add(params); |
|
|
|
|
|
} |
|
|
|
|
|
System.out.println(paramsList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new HashMap<>(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|