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