fix--JSON null

qianming 1 year ago
parent 60e562df3a
commit d2d050fc57

@ -1,8 +1,11 @@
package com.anjiplus.template.gaea.business.modules.dataset.service.impl; package com.anjiplus.template.gaea.business.modules.dataset.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; 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.constant.Enabled;
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper; import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
import com.anji.plus.gaea.exception.BusinessExceptionBuilder; 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -39,8 +43,8 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* @desc DataSet
* @author Raod * @author Raod
* @desc DataSet
* @date 2021-03-18 12:11:31.150755900 * @date 2021-03-18 12:11:31.150755900
**/ **/
@Service @Service
@ -127,7 +131,7 @@ public class DataSetServiceImpl implements DataSetService {
if (StringUtils.isNotBlank(dto.getCaseResult())) { if (StringUtils.isNotBlank(dto.getCaseResult())) {
try { try {
JSONArray jsonArray = JSONArray.parseArray(dto.getCaseResult()); JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(dto.getCaseResult(), SerializerFeature.WriteMapNullValue));
JSONObject jsonObject = jsonArray.getJSONObject(0); JSONObject jsonObject = jsonArray.getJSONObject(0);
dto.setSetParamList(jsonObject.keySet()); dto.setSetParamList(jsonObject.keySet());
} catch (Exception e) { } catch (Exception e) {
@ -420,6 +424,7 @@ public class DataSetServiceImpl implements DataSetService {
/** /**
* dataSetParamDtoListmap * dataSetParamDtoListmap
*
* @param dataSetParamDtoList * @param dataSetParamDtoList
* @return * @return
*/ */

Loading…
Cancel
Save