|
|
|
@ -1,8 +1,11 @@
|
|
|
|
|
|
|
|
|
|
package com.anjiplus.template.gaea.business.modules.dataset.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.alibaba.fastjson.parser.Feature;
|
|
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
|
|
import com.anji.plus.gaea.constant.Enabled;
|
|
|
|
|
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
|
|
|
|
|
import com.anji.plus.gaea.exception.BusinessExceptionBuilder;
|
|
|
|
@ -27,6 +30,7 @@ import com.anjiplus.template.gaea.business.util.JdbcConstants;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
@ -39,10 +43,10 @@ import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @desc DataSet 数据集服务实现
|
|
|
|
|
* @author Raod
|
|
|
|
|
* @date 2021-03-18 12:11:31.150755900
|
|
|
|
|
**/
|
|
|
|
|
* @author Raod
|
|
|
|
|
* @desc DataSet 数据集服务实现
|
|
|
|
|
* @date 2021-03-18 12:11:31.150755900
|
|
|
|
|
**/
|
|
|
|
|
@Service
|
|
|
|
|
//@RequiredArgsConstructor
|
|
|
|
|
@Slf4j
|
|
|
|
@ -127,11 +131,11 @@ public class DataSetServiceImpl implements DataSetService {
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getCaseResult())) {
|
|
|
|
|
try {
|
|
|
|
|
JSONArray jsonArray = JSONArray.parseArray(dto.getCaseResult());
|
|
|
|
|
JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(dto.getCaseResult(), SerializerFeature.WriteMapNullValue));
|
|
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(0);
|
|
|
|
|
dto.setSetParamList(jsonObject.keySet());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("error",e);
|
|
|
|
|
log.error("error", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return dto;
|
|
|
|
@ -266,11 +270,11 @@ public class DataSetServiceImpl implements DataSetService {
|
|
|
|
|
String body = JSONObject.parseObject(dynSentence).getString("body");
|
|
|
|
|
if (StringUtils.isNotBlank(body)) {
|
|
|
|
|
dynSentence = body;
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
dynSentence = "{}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
dataSource = dataSourceService.selectOne("source_code", dataSetDto.getSourceCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -322,11 +326,11 @@ public class DataSetServiceImpl implements DataSetService {
|
|
|
|
|
String body = JSONObject.parseObject(dynSentence).getString("body");
|
|
|
|
|
if (StringUtils.isNotBlank(body)) {
|
|
|
|
|
dynSentence = body;
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
dynSentence = "{}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
dataSource = dataSourceService.selectOne("source_code", sourceCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -374,7 +378,7 @@ public class DataSetServiceImpl implements DataSetService {
|
|
|
|
|
return dataSetMapper.selectList(wrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void dataSetParamBatch(List<DataSetParamDto> dataSetParamDtoList,String setCode){
|
|
|
|
|
public void dataSetParamBatch(List<DataSetParamDto> dataSetParamDtoList, String setCode) {
|
|
|
|
|
dataSetParamService.delete(
|
|
|
|
|
new QueryWrapper<DataSetParam>()
|
|
|
|
|
.lambda()
|
|
|
|
@ -396,7 +400,7 @@ public class DataSetServiceImpl implements DataSetService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void dataSetTransformBatch(List<DataSetTransformDto> dataSetTransformDtoList,String setCode){
|
|
|
|
|
public void dataSetTransformBatch(List<DataSetTransformDto> dataSetTransformDtoList, String setCode) {
|
|
|
|
|
dataSetTransformService.delete(
|
|
|
|
|
new QueryWrapper<DataSetTransform>()
|
|
|
|
|
.lambda()
|
|
|
|
@ -420,10 +424,11 @@ public class DataSetServiceImpl implements DataSetService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* dataSetParamDtoList转map
|
|
|
|
|
*
|
|
|
|
|
* @param dataSetParamDtoList
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map<String, Object> setContextData(List<DataSetParamDto> dataSetParamDtoList){
|
|
|
|
|
public Map<String, Object> setContextData(List<DataSetParamDto> dataSetParamDtoList) {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
if (null != dataSetParamDtoList && dataSetParamDtoList.size() > 0) {
|
|
|
|
|
dataSetParamDtoList.forEach(dataSetParamDto -> map.put(dataSetParamDto.getParamName(), dataSetParamDto.getSampleItem()));
|
|
|
|
|