Commit abc230b6 by zhiwj

代码结构调整

parent 87784320
......@@ -13,6 +13,7 @@ import com.gic.widget.screening.api.dto.EsScreeningEnterpriseCategorySceneInfoDT
import com.gic.widget.screening.api.dto.EsScreeningTemplateDTO;
import com.gic.widget.screening.api.service.EsScreeningInitService;
import com.gic.widget.screening.api.service.EsScreeningTemplateService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -110,13 +111,15 @@ public class ScreeningController {
public RestResponse getScreeningData(String widgetChainId) {
List<EsScreeningChainDetailDTO> list = this.esScreeningInitService
.queryEsScreeningByParentChainId(widgetChainId);
list = list.stream().peek(item -> {
if (StringUtils.isNotBlank(item.getWidget().getWidgetValues())) {
List<WidgetValuesOldVO> oldVOS = JSONObject.parseArray(item.getWidget().getWidgetValues(), WidgetValuesOldVO.class);
List<WidgetValuesNewVO> newVOList = oldVOS.stream().map(data -> new WidgetValuesNewVO(data.getKey(), data.getValue(), data.getName())).collect(Collectors.toList());
item.getWidget().setWidgetValues(JSON.toJSONString(newVOList));
}
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)) {
list = list.stream().peek(item -> {
if (StringUtils.isNotBlank(item.getWidget().getWidgetValues())) {
List<WidgetValuesOldVO> oldVOS = JSONObject.parseArray(item.getWidget().getWidgetValues(), WidgetValuesOldVO.class);
List<WidgetValuesNewVO> newVOList = oldVOS.stream().map(data -> new WidgetValuesNewVO(data.getKey(), data.getValue(), data.getName())).collect(Collectors.toList());
item.getWidget().setWidgetValues(JSON.toJSONString(newVOList));
}
}).collect(Collectors.toList());
}
return RestResponse.success(list);
}
......@@ -124,7 +127,7 @@ public class ScreeningController {
@ResponseBody
public RestResponse getScreeningChainDetail(String parentChainId, String widgetFieldKey) {
EsScreeningChainDetailDTO dto = this.esScreeningInitService.findChainDetail(parentChainId, widgetFieldKey);
if (StringUtils.isNotBlank(dto.getWidget().getWidgetValues())) {
if (dto != null && StringUtils.isNotBlank(dto.getWidget().getWidgetValues())) {
List<WidgetValuesOldVO> oldVOS = JSONObject.parseArray(dto.getWidget().getWidgetValues(), WidgetValuesOldVO.class);
List<WidgetValuesNewVO> newVOList = oldVOS.stream().map(data -> new WidgetValuesNewVO(data.getKey(), data.getValue(), data.getName())).collect(Collectors.toList());
dto.getWidget().setWidgetValues(JSON.toJSONString(newVOList));
......@@ -137,7 +140,7 @@ public class ScreeningController {
@ResponseBody
public Object getScreeningWidgetDetail(String widgetChainId) {
EsScreeningChainDetailDTO dto = this.esScreeningInitService.findChainDetail(widgetChainId);
if (StringUtils.isNotBlank(dto.getWidget().getWidgetValues())) {
if (dto != null && StringUtils.isNotBlank(dto.getWidget().getWidgetValues())) {
List<WidgetValuesOldVO> oldVOS = JSONObject.parseArray(dto.getWidget().getWidgetValues(), WidgetValuesOldVO.class);
List<WidgetValuesNewVO> newVOList = oldVOS.stream().map(data -> new WidgetValuesNewVO(data.getKey(), data.getValue(), data.getName())).collect(Collectors.toList());
dto.getWidget().setWidgetValues(JSON.toJSONString(newVOList));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment