forked from github/dataease
Merge pull request #10920 from dataease/pr@dev-v2@feat_copilot
feat: 新增copilot所需接口
This commit is contained in:
commit
a4a7ccca2a
@ -71,6 +71,8 @@ public class CopilotManage {
|
|||||||
@Resource
|
@Resource
|
||||||
private F2CLicManage f2CLicManage;
|
private F2CLicManage f2CLicManage;
|
||||||
|
|
||||||
|
private String[] chartType = {"bar", "line", "pie"};
|
||||||
|
|
||||||
public MsgDTO chat(MsgDTO msgDTO) throws Exception {
|
public MsgDTO chat(MsgDTO msgDTO) throws Exception {
|
||||||
CoreDatasetGroup coreDatasetGroup = coreDatasetGroupMapper.selectById(msgDTO.getDatasetGroupId());
|
CoreDatasetGroup coreDatasetGroup = coreDatasetGroupMapper.selectById(msgDTO.getDatasetGroupId());
|
||||||
if (coreDatasetGroup == null) {
|
if (coreDatasetGroup == null) {
|
||||||
@ -294,7 +296,7 @@ public class CopilotManage {
|
|||||||
if (StringUtils.equalsIgnoreCase(receiveDTO.getChart().getType(), "pie")) {
|
if (StringUtils.equalsIgnoreCase(receiveDTO.getChart().getType(), "pie")) {
|
||||||
AxisFieldDTO column = receiveDTO.getChart().getColumn();
|
AxisFieldDTO column = receiveDTO.getChart().getColumn();
|
||||||
if (fields.size() != 2 || column == null) {
|
if (fields.size() != 2 || column == null) {
|
||||||
DEException.throwException("当前字段不足以构建饼图");
|
DEException.throwException("当前字段不足以构建饼图: " + JsonUtil.toJSONString(receiveDTO));
|
||||||
}
|
}
|
||||||
AxisDTO axisDTO = new AxisDTO();
|
AxisDTO axisDTO = new AxisDTO();
|
||||||
AxisFieldDTO x = new AxisFieldDTO();
|
AxisFieldDTO x = new AxisFieldDTO();
|
||||||
@ -310,7 +312,7 @@ public class CopilotManage {
|
|||||||
y.setName(column.getName());
|
y.setName(column.getName());
|
||||||
y.setValue(column.getValue());
|
y.setValue(column.getValue());
|
||||||
} else {
|
} else {
|
||||||
DEException.throwException("当前字段不足以构建饼图");
|
DEException.throwException("当前字段不足以构建饼图: " + JsonUtil.toJSONString(receiveDTO));
|
||||||
}
|
}
|
||||||
axisDTO.setX(x);
|
axisDTO.setX(x);
|
||||||
axisDTO.setY(y);
|
axisDTO.setY(y);
|
||||||
@ -328,6 +330,14 @@ public class CopilotManage {
|
|||||||
receiveDTO.getChart().setColumns(columns);
|
receiveDTO.getChart().setColumns(columns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 所有图表都加上columns字段用于切换明细表展示
|
||||||
|
if (Arrays.asList(chartType).contains(receiveDTO.getChart().getType())) {
|
||||||
|
List<AxisFieldDTO> columns = new ArrayList<>();
|
||||||
|
columns.add(receiveDTO.getChart().getAxis().getX());
|
||||||
|
columns.add(receiveDTO.getChart().getAxis().getY());
|
||||||
|
receiveDTO.getChart().setColumns(columns);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MsgDTO> getList(Long userId) {
|
public List<MsgDTO> getList(Long userId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user