Commit 93d5f4005749bf126bfc86d09d8eced7402ebb09
Merge branch '2023-12-27' into 'master_dev'
feat:增加TCP产品导入物模型限制 See merge request yunteng/thingskit!299
Showing
2 changed files
with
12 additions
and
0 deletions
... | ... | @@ -119,6 +119,7 @@ public enum ErrorMessage { |
119 | 119 | IMPORT_TCP_SERVICE_ERROR(400094,"品类无法创建TCP产品的服务,请在产品内添加"), |
120 | 120 | EZVIZ_API_ERROR(400095,"荧石视频获取TokenAPI调用失败【%s】,错误码【%s】"), |
121 | 121 | EZVIZ_GET_URL_ERROR(400096,"荧石API调用获取URL失败!!"), |
122 | + IMPORT_TCP_ERROR(400097,"TCP产品不能导入INT,DOUBLE,BOOL,TEXT以外的数据类型属性!!"), | |
122 | 123 | HAVE_NO_PERMISSION(500002,"没有修改权限"), |
123 | 124 | NOT_ALLOED_ISOLATED_IN_MONOLITH(500003,"【monolith】模式下,不能选择【isolated】类型的租户配置"); |
124 | 125 | ... | ... |
... | ... | @@ -335,6 +335,17 @@ public class ThingsModelServiceImpl |
335 | 335 | } |
336 | 336 | if (Objects.equals(importThingsModel.getFunctionType(), FunctionTypeEnum.all) |
337 | 337 | || Objects.equals(importThingsModel.getFunctionType(), FunctionTypeEnum.properties)) { |
338 | + if(transportType.equals("TCP")){ | |
339 | + List<AttributeModelDTO> dto = importThingsModel.getData().getProperties(); | |
340 | + if (null != dto && !dto.isEmpty()) { | |
341 | + for (AttributeModelDTO model : dto) { | |
342 | + String dataType = model.getSpecs().path("dataType").path("type").asText(); | |
343 | + if(!StringUtils.isEmpty(dataType)&&!dataType.equals("INT")&&!dataType.equals("DOUBLE")&&!dataType.equals("TEXT")&&!dataType.equals("BOOL")){ | |
344 | + throw new TkDataValidationException(ErrorMessage.IMPORT_TCP_ERROR.getMessage()); | |
345 | + } | |
346 | + } | |
347 | + } | |
348 | + } | |
338 | 349 | importAttribute( |
339 | 350 | identifiers, |
340 | 351 | importThingsModel.getData().getProperties(), | ... | ... |