Commit ee415b501920af992f5d7041718fdc0aded24708

Authored by xp.Huang
2 parents 07576fe0 bd380407

Merge branch '2024-1-30-bug' into 'master_dev'

fix:1.流媒体配置编辑时未校验名称重复;2.导入失败提示优化

See merge request yunteng/thingskit!322
@@ -253,32 +253,32 @@ public class ThingsModelController extends BaseController { @@ -253,32 +253,32 @@ public class ThingsModelController extends BaseController {
253 String functionName = row.getCell(0).toString();//功能名称 253 String functionName = row.getCell(0).toString();//功能名称
254 if(StringUtils.isEmpty(functionName)){ 254 if(StringUtils.isEmpty(functionName)){
255 failed++; 255 failed++;
256 - failedString.append("第"+i+"条,功能名称未填\r\n"); 256 + failedString.append("第"+i+"条,功能名称未填");
257 continue; 257 continue;
258 } 258 }
259 String identifier = row.getCell(1).toString();//标识符* 259 String identifier = row.getCell(1).toString();//标识符*
260 if(StringUtils.isEmpty(identifier)){ 260 if(StringUtils.isEmpty(identifier)){
261 failed++; 261 failed++;
262 - failedString.append("第"+i+"条,标识符未填\r\n"); 262 + failedString.append("第"+i+"条,标识符未填");
263 continue; 263 continue;
264 } 264 }
265 String dataType = row.getCell(2).toString();//数据类型* 265 String dataType = row.getCell(2).toString();//数据类型*
266 if(StringUtils.isEmpty(dataType)){ 266 if(StringUtils.isEmpty(dataType)){
267 failed++; 267 failed++;
268 - failedString.append("第"+i+"条,数据类型未填\r\n"); 268 + failedString.append("第"+i+"条,数据类型未填");
269 continue; 269 continue;
270 } 270 }
271 String accessMode = row.getCell(7).toString();//读写类型* 271 String accessMode = row.getCell(7).toString();//读写类型*
272 if(StringUtils.isEmpty(accessMode)){ 272 if(StringUtils.isEmpty(accessMode)){
273 failed++; 273 failed++;
274 - failedString.append("第"+i+"条,读写类型未填\r\n"); 274 + failedString.append("第"+i+"条,读写类型未填");
275 continue; 275 continue;
276 } 276 }
277 Cell dataJons = row.getCell(9);//Josn对象 277 Cell dataJons = row.getCell(9);//Josn对象
278 if(dataType.equals("struct(结构体)")){ 278 if(dataType.equals("struct(结构体)")){
279 if(StringUtils.isEmpty(dataJons.toString())){ 279 if(StringUtils.isEmpty(dataJons.toString())){
280 failed++; 280 failed++;
281 - failedString.append("第"+i+"条,如果数据类型选为结构体则必填Json对象,请填入\r\n"); 281 + failedString.append("第"+i+"条,如果数据类型选为结构体则必填Json对象,请填入");
282 continue; 282 continue;
283 } 283 }
284 } 284 }
@@ -287,7 +287,7 @@ public class ThingsModelController extends BaseController { @@ -287,7 +287,7 @@ public class ThingsModelController extends BaseController {
287 Boolean identifierState = thingsModelService.getByIdentifier(tenantId,deviceProfileId,categoryId,identifier); 287 Boolean identifierState = thingsModelService.getByIdentifier(tenantId,deviceProfileId,categoryId,identifier);
288 if(!identifierState){ 288 if(!identifierState){
289 failed++; 289 failed++;
290 - failedString.append("第"+i+"条,标识符已存在\r\n"); 290 + failedString.append("第"+i+"条,标识符已存在");
291 continue; 291 continue;
292 } 292 }
293 ThingsModelDTO dto = new ThingsModelDTO(); 293 ThingsModelDTO dto = new ThingsModelDTO();
@@ -43,6 +43,12 @@ public class TkVideoPlatformServiceImpl extends AbstractBaseService<TkVideoPlatf @@ -43,6 +43,12 @@ public class TkVideoPlatformServiceImpl extends AbstractBaseService<TkVideoPlatf
43 @Override 43 @Override
44 @Transactional(rollbackFor = Exception.class) 44 @Transactional(rollbackFor = Exception.class)
45 public TkVideoPlatformDTO saveOrUpdate(TkVideoPlatformDTO videoPlatformDTO) { 45 public TkVideoPlatformDTO saveOrUpdate(TkVideoPlatformDTO videoPlatformDTO) {
  46 + TkVideoPlatformEntity entity = baseMapper.selectOne(new LambdaQueryWrapper<TkVideoPlatformEntity>()
  47 + .eq(TkVideoPlatformEntity::getHost, videoPlatformDTO.getHost())
  48 + .eq(TkVideoPlatformEntity::getTenantId,videoPlatformDTO.getTenantId()));
  49 + if (null != entity) {
  50 + throw new TkDataValidationException(ErrorMessage.VIDEO_PLATFORM_HOST_EXISTED.getMessage());
  51 + }
46 if (StringUtils.isNotEmpty(videoPlatformDTO.getId())) { 52 if (StringUtils.isNotEmpty(videoPlatformDTO.getId())) {
47 Wrapper filter = new QueryWrapper<TkVideoPlatformEntity>().lambda() 53 Wrapper filter = new QueryWrapper<TkVideoPlatformEntity>().lambda()
48 .eq(TkVideoPlatformEntity::getTenantId, videoPlatformDTO.getTenantId()) 54 .eq(TkVideoPlatformEntity::getTenantId, videoPlatformDTO.getTenantId())
@@ -54,12 +60,6 @@ public class TkVideoPlatformServiceImpl extends AbstractBaseService<TkVideoPlatf @@ -54,12 +60,6 @@ public class TkVideoPlatformServiceImpl extends AbstractBaseService<TkVideoPlatf
54 } 60 }
55 baseMapper.updateById(videoPlatformDTO.getEntity(TkVideoPlatformEntity.class)); 61 baseMapper.updateById(videoPlatformDTO.getEntity(TkVideoPlatformEntity.class));
56 } else { 62 } else {
57 - TkVideoPlatformEntity entity = baseMapper.selectOne(new LambdaQueryWrapper<TkVideoPlatformEntity>()  
58 - .eq(TkVideoPlatformEntity::getHost, videoPlatformDTO.getHost())  
59 - .eq(TkVideoPlatformEntity::getTenantId,videoPlatformDTO.getTenantId()));  
60 - if (null != entity) {  
61 - throw new TkDataValidationException(ErrorMessage.VIDEO_PLATFORM_HOST_EXISTED.getMessage());  
62 - }  
63 baseMapper.insert(videoPlatformDTO.getEntity(TkVideoPlatformEntity.class)); 63 baseMapper.insert(videoPlatformDTO.getEntity(TkVideoPlatformEntity.class));
64 } 64 }
65 return videoPlatformDTO; 65 return videoPlatformDTO;