Commit f91e3d2a2e23880d22229e6206e2ec58dd387a89
1 parent
a75d3f7c
fix: check parameter for add data component layout
Showing
2 changed files
with
10 additions
and
4 deletions
... | ... | @@ -70,11 +70,17 @@ public class YtDataComponentController extends BaseController { |
70 | 70 | DataBoardDTO dataBoardDTO = ytDataBoardService.findDataBoardInfoById(boardId, tenantId); |
71 | 71 | List<ComponentLayoutDTO> listLayout = dataBoardDTO.getLayout(); |
72 | 72 | ResponseResult<DataComponentDTO> result = saveOrUpdate(dataComponent); |
73 | - ComponentLayoutDTO defaultLayout; | |
74 | - if (null == dataComponent.getLayout()) { | |
73 | + ComponentLayoutDTO defaultLayout = dataComponent.getLayout(); | |
74 | + if (null == defaultLayout) { | |
75 | 75 | defaultLayout = new ComponentLayoutDTO(result.getData().getId()); |
76 | 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 | 85 | listLayout.add(defaultLayout); |
80 | 86 | ytDataBoardService.saveComponentLayout(listLayout, boardId, tenantId); | ... | ... |