Commit 3bfd2d47 by huangjy

fix:修复bug

parent ec62fafb
...@@ -5,6 +5,7 @@ import com.makeit.common.page.PageReqDTO; ...@@ -5,6 +5,7 @@ import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; import com.makeit.common.page.PageVO;
import com.makeit.common.response.ApiResponseEntity; import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils; import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.device.PlatDeviceAttrDTO;
import com.makeit.dto.platform.device.PlatDeviceDetailDTO; import com.makeit.dto.platform.device.PlatDeviceDetailDTO;
import com.makeit.dto.saas.device.PlatDeviceEditSaasDTO; import com.makeit.dto.saas.device.PlatDeviceEditSaasDTO;
import com.makeit.dto.wechat.device.PlatDeviceAttrWechatDTO; import com.makeit.dto.wechat.device.PlatDeviceAttrWechatDTO;
...@@ -72,4 +73,11 @@ public class SaasDeviceController { ...@@ -72,4 +73,11 @@ public class SaasDeviceController {
return ApiResponseUtils.success(); return ApiResponseUtils.success();
} }
@ApiOperation(value = "批量编辑设备属性",notes = "批量编辑属性,仅相同产品类型的设备可批量编辑属性,点击展示该产品类型的可编辑属性(呼吸心率设备不可编辑设备属性,空间可编辑雷达安装方式和雷达功能模式,跌倒可编辑雷达安装高度")
@PostMapping("batchEditProperties")
public ApiResponseEntity<List<String>> batchEditProperties(@RequestBody PlatDeviceAttrDTO dto) {
platDeviceService.batchEditProperties(dto);
return ApiResponseUtils.success();
}
} }
...@@ -27,8 +27,9 @@ public class PlatDeviceEditDTO extends BaseTenantDTO { ...@@ -27,8 +27,9 @@ public class PlatDeviceEditDTO extends BaseTenantDTO {
@ApiModelProperty(value = "设备名称") @ApiModelProperty(value = "设备名称")
private String name; private String name;
@ApiModelProperty(value = "说明") @ApiModelProperty(value = "设备属性json")
private String description; private String attribute;
} }
...@@ -17,9 +17,8 @@ import java.util.List; ...@@ -17,9 +17,8 @@ import java.util.List;
* @since 2023-08-29 * @since 2023-08-29
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Elder批量变价对象", description = "长者批量编辑DTO") @ApiModel(value = "Elder批量变价对象", description = "长者批量编辑DTO")
public class PlatElderBatchEditDTOVO extends BaseTenantDTO { public class PlatElderBatchEditDTOVO {
@ApiModelProperty(value = "ID 添加不需要传此参数") @ApiModelProperty(value = "ID 添加不需要传此参数")
private List<String> idList; private List<String> idList;
......
...@@ -202,9 +202,25 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -202,9 +202,25 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
BeanUtils.copyProperties(dto, db, BaseBusEntity.Fields.tenantId); BeanUtils.copyProperties(dto, db, BaseBusEntity.Fields.tenantId);
updateById(db); updateById(db);
deviceCacheUtil.put(db); deviceCacheUtil.put(db);
if (StringUtils.isNotEmpty(dto.getAttribute())) {
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getDeviceId, db.getId()));
if (other != null) {
other.setAttribute(dto.getAttribute());
platDeviceOtherService.updateById(other);
}
// 写入设备
PlatDeviceAttrWechatDTO platDeviceAttrWechatDTO = JSON.parseObject(dto.getAttribute(), PlatDeviceAttrWechatDTO.class);
platDeviceAttrWechatDTO.setDeviceId(db.getOriDeviceId());
editDeviceProperties(platDeviceAttrWechatDTO);
}
//iotProductDeviceService.syncUpdateDeviceInfo(db.getOriDeviceId(),dto.getName(),db.getProductId()); //iotProductDeviceService.syncUpdateDeviceInfo(db.getOriDeviceId(),dto.getName(),db.getProductId());
} }
...@@ -454,8 +470,6 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -454,8 +470,6 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
if (CollectionUtils.isEmpty(dto.getDeviceIdList())) { if (CollectionUtils.isEmpty(dto.getDeviceIdList())) {
return; return;
} }
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getOriDeviceId, dto.getDeviceIdList()));
Map<String, Object> map = getAttrMap(dto); Map<String, Object> map = getAttrMap(dto);
List<String> resultList = Lists.newArrayList(); List<String> resultList = Lists.newArrayList();
for (String deviceId : dto.getDeviceIdList()) { for (String deviceId : dto.getDeviceIdList()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment