Commit f91e3d2a2e23880d22229e6206e2ec58dd387a89

Authored by 黄 x
1 parent a75d3f7c

fix: check parameter for add data component layout

@@ -70,11 +70,17 @@ public class YtDataComponentController extends BaseController { @@ -70,11 +70,17 @@ public class YtDataComponentController extends BaseController {
70 DataBoardDTO dataBoardDTO = ytDataBoardService.findDataBoardInfoById(boardId, tenantId); 70 DataBoardDTO dataBoardDTO = ytDataBoardService.findDataBoardInfoById(boardId, tenantId);
71 List<ComponentLayoutDTO> listLayout = dataBoardDTO.getLayout(); 71 List<ComponentLayoutDTO> listLayout = dataBoardDTO.getLayout();
72 ResponseResult<DataComponentDTO> result = saveOrUpdate(dataComponent); 72 ResponseResult<DataComponentDTO> result = saveOrUpdate(dataComponent);
73 - ComponentLayoutDTO defaultLayout;  
74 - if (null == dataComponent.getLayout()) { 73 + ComponentLayoutDTO defaultLayout = dataComponent.getLayout();
  74 + if (null == defaultLayout) {
75 defaultLayout = new ComponentLayoutDTO(result.getData().getId()); 75 defaultLayout = new ComponentLayoutDTO(result.getData().getId());
76 } else { 76 } else {
77 - defaultLayout = dataComponent.getLayout(); 77 + if (StringUtils.isEmpty(defaultLayout.getId())
  78 + || null == defaultLayout.getH()
  79 + || null == defaultLayout.getW()
  80 + || null == defaultLayout.getX()
  81 + || null == defaultLayout.getY()) {
  82 + throw new YtDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage());
  83 + }
78 } 84 }
79 listLayout.add(defaultLayout); 85 listLayout.add(defaultLayout);
80 ytDataBoardService.saveComponentLayout(listLayout, boardId, tenantId); 86 ytDataBoardService.saveComponentLayout(listLayout, boardId, tenantId);
@@ -23,6 +23,6 @@ public class DataComponentDTO extends TenantDTO { @@ -23,6 +23,6 @@ public class DataComponentDTO extends TenantDTO {
23 @ApiModelProperty(value = "备注") 23 @ApiModelProperty(value = "备注")
24 private String remark; 24 private String remark;
25 25
26 - @ApiModelProperty(value = "组件布局") 26 + @ApiModelProperty(value = "布局", required = true)
27 private ComponentLayoutDTO layout; 27 private ComponentLayoutDTO layout;
28 } 28 }