|
|
@@ -426,12 +426,13 @@ public class DeviceInstanceController implements
|
|
|
@SaveAction
|
|
|
@Operation(summary = "保存设备标签")
|
|
|
public Flux<DeviceTagEntity> saveDeviceTag(@PathVariable @Parameter(description = "设备ID") String deviceId,
|
|
|
- @RequestBody DeviceTagEntity tags) {
|
|
|
- return Flux.just(tags)
|
|
|
+ @RequestBody Flux<DeviceTagEntity> tags) {
|
|
|
+ return tags
|
|
|
.doOnNext(tag -> {
|
|
|
tag.setId(DeviceTagEntity.createTagId(deviceId, tag.getKey()));
|
|
|
tag.setDeviceId(deviceId);
|
|
|
tag.tryValidate();
|
|
|
+ tag.setAutoUpdate(true);
|
|
|
})
|
|
|
.flatMap(tagsService::saveOrUpdate)
|
|
|
.onErrorMap(DuplicateKeyException.class, err -> new BusinessException("标签不可重复添加", err))
|