|
|
|
@@ -1,5 +1,7 @@ |
|
|
|
package com.ruoyi.platform.service.impl; |
|
|
|
|
|
|
|
import com.google.gson.Gson; |
|
|
|
import com.google.gson.reflect.TypeToken; |
|
|
|
import com.ruoyi.common.security.utils.SecurityUtils; |
|
|
|
import com.ruoyi.platform.constant.Constant; |
|
|
|
import com.ruoyi.platform.domain.Ray; |
|
|
|
@@ -17,7 +19,9 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.io.IOException; |
|
|
|
import java.lang.reflect.Type; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@Service("rayService") |
|
|
|
public class RayServiceImpl implements RayService { |
|
|
|
@@ -39,13 +43,13 @@ public class RayServiceImpl implements RayService { |
|
|
|
} |
|
|
|
Ray ray = new Ray(); |
|
|
|
BeanUtils.copyProperties(rayVo, ray); |
|
|
|
String username = SecurityUtils.getLoginUser().getUsername(); |
|
|
|
// String username = SecurityUtils.getLoginUser().getUsername(); |
|
|
|
String username = "admin"; |
|
|
|
ray.setCreateBy(username); |
|
|
|
ray.setUpdateBy(username); |
|
|
|
String datasetJson = JacksonUtil.toJSONString(rayVo.getDataset()); |
|
|
|
ray.setDataset(datasetJson); |
|
|
|
String codeJson = JacksonUtil.toJSONString(rayVo.getCode()); |
|
|
|
ray.setCode(codeJson); |
|
|
|
ray.setDataset(JacksonUtil.toJSONString(rayVo.getDataset())); |
|
|
|
ray.setCode(JacksonUtil.toJSONString(rayVo.getCode())); |
|
|
|
ray.setParameters(JacksonUtil.toJSONString(rayVo.getParameters())); |
|
|
|
rayDao.save(ray); |
|
|
|
return ray; |
|
|
|
} |
|
|
|
@@ -77,11 +81,15 @@ public class RayServiceImpl implements RayService { |
|
|
|
Ray ray = rayDao.getRayById(id); |
|
|
|
RayVo rayVo = new RayVo(); |
|
|
|
BeanUtils.copyProperties(ray, rayVo); |
|
|
|
|
|
|
|
Gson gson = new Gson(); |
|
|
|
Type listType = new TypeToken<List<Map<String, Object>>>() { |
|
|
|
}.getType(); |
|
|
|
if (StringUtils.isNotEmpty(ray.getParameters())) { |
|
|
|
rayVo.setParameters(JsonUtils.jsonToMap(ray.getParameters())); |
|
|
|
rayVo.setParameters(gson.fromJson(ray.getParameters(), listType)); |
|
|
|
} |
|
|
|
if (StringUtils.isNotEmpty(ray.getPointsToEvaluate())) { |
|
|
|
rayVo.setPointsToEvaluate(JsonUtils.jsonToMap(ray.getPointsToEvaluate())); |
|
|
|
rayVo.setPointsToEvaluate(gson.fromJson(ray.getPointsToEvaluate(), listType)); |
|
|
|
} |
|
|
|
if (StringUtils.isNotEmpty(ray.getDataset())) { |
|
|
|
rayVo.setDataset(JsonUtils.jsonToMap(ray.getDataset())); |
|
|
|
|