Commit abc230b6 by zhiwj

代码结构调整

parent 87784320
...@@ -13,6 +13,7 @@ import com.gic.widget.screening.api.dto.EsScreeningEnterpriseCategorySceneInfoDT ...@@ -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.dto.EsScreeningTemplateDTO;
import com.gic.widget.screening.api.service.EsScreeningInitService; import com.gic.widget.screening.api.service.EsScreeningInitService;
import com.gic.widget.screening.api.service.EsScreeningTemplateService; import com.gic.widget.screening.api.service.EsScreeningTemplateService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -110,13 +111,15 @@ public class ScreeningController { ...@@ -110,13 +111,15 @@ public class ScreeningController {
public RestResponse getScreeningData(String widgetChainId) { public RestResponse getScreeningData(String widgetChainId) {
List<EsScreeningChainDetailDTO> list = this.esScreeningInitService List<EsScreeningChainDetailDTO> list = this.esScreeningInitService
.queryEsScreeningByParentChainId(widgetChainId); .queryEsScreeningByParentChainId(widgetChainId);
list = list.stream().peek(item -> { if (CollectionUtils.isNotEmpty(list)) {
if (StringUtils.isNotBlank(item.getWidget().getWidgetValues())) { list = list.stream().peek(item -> {
List<WidgetValuesOldVO> oldVOS = JSONObject.parseArray(item.getWidget().getWidgetValues(), WidgetValuesOldVO.class); if (StringUtils.isNotBlank(item.getWidget().getWidgetValues())) {
List<WidgetValuesNewVO> newVOList = oldVOS.stream().map(data -> new WidgetValuesNewVO(data.getKey(), data.getValue(), data.getName())).collect(Collectors.toList()); List<WidgetValuesOldVO> oldVOS = JSONObject.parseArray(item.getWidget().getWidgetValues(), WidgetValuesOldVO.class);
item.getWidget().setWidgetValues(JSON.toJSONString(newVOList)); 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()); }
}).collect(Collectors.toList());
}
return RestResponse.success(list); return RestResponse.success(list);
} }
...@@ -124,7 +127,7 @@ public class ScreeningController { ...@@ -124,7 +127,7 @@ public class ScreeningController {
@ResponseBody @ResponseBody
public RestResponse getScreeningChainDetail(String parentChainId, String widgetFieldKey) { public RestResponse getScreeningChainDetail(String parentChainId, String widgetFieldKey) {
EsScreeningChainDetailDTO dto = this.esScreeningInitService.findChainDetail(parentChainId, 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<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()); List<WidgetValuesNewVO> newVOList = oldVOS.stream().map(data -> new WidgetValuesNewVO(data.getKey(), data.getValue(), data.getName())).collect(Collectors.toList());
dto.getWidget().setWidgetValues(JSON.toJSONString(newVOList)); dto.getWidget().setWidgetValues(JSON.toJSONString(newVOList));
...@@ -137,7 +140,7 @@ public class ScreeningController { ...@@ -137,7 +140,7 @@ public class ScreeningController {
@ResponseBody @ResponseBody
public Object getScreeningWidgetDetail(String widgetChainId) { public Object getScreeningWidgetDetail(String widgetChainId) {
EsScreeningChainDetailDTO dto = this.esScreeningInitService.findChainDetail(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<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()); List<WidgetValuesNewVO> newVOList = oldVOS.stream().map(data -> new WidgetValuesNewVO(data.getKey(), data.getValue(), data.getName())).collect(Collectors.toList());
dto.getWidget().setWidgetValues(JSON.toJSONString(newVOList)); 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