Commit a5db060c by huangjy

修复设备写入问题,工作台问题

parent 31c2b005
...@@ -62,15 +62,18 @@ public class IotDevicePropertiesOperateService extends IotCommonService { ...@@ -62,15 +62,18 @@ public class IotDevicePropertiesOperateService extends IotCommonService {
if (radarHight != null) { if (radarHight != null) {
map.put("radarHight", radarHight); map.put("radarHight", radarHight);
} }
String body = JsonUtil.toJson(map);
for (Map.Entry<String, Object> entry : map.entrySet()) {
String body = JsonUtil.toJson(entry);
HttpRequest request = buildRequest(url, body); HttpRequest request = buildRequest(url, body);
try { try {
ResponseMessage responseMessage = sendPut(url, request); ResponseMessage responseMessage = sendPut(url, request);
log.error("写入设备属性信息:{}", responseMessage.getMessage()); log.info("写入设备属性信息:{}", responseMessage.getMessage());
} catch (IOException e) { } catch (IOException e) {
log.error("调用:{}接口异常:{}", url, e.getMessage()); log.error("调用:{}接口异常:{}", url, e.getMessage());
} }
}
return Lists.newArrayList(); return Lists.newArrayList();
} }
......
...@@ -3,14 +3,17 @@ package com.makeit.module.controller.elder; ...@@ -3,14 +3,17 @@ package com.makeit.module.controller.elder;
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.wechat.device.PlatDeviceAttrWechatDTO;
import com.makeit.global.annotation.AuthIgnore; import com.makeit.global.annotation.AuthIgnore;
import com.makeit.global.aspect.tenant.TenantIdIgnore; import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.elder.PlatElderSleepService; import com.makeit.service.platform.elder.PlatElderSleepService;
import com.makeit.task.IotSyncTask; import com.makeit.task.IotSyncTask;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -31,7 +34,8 @@ public class PlatElderSleepController { ...@@ -31,7 +34,8 @@ public class PlatElderSleepController {
private IotSyncTask iotSyncTask; private IotSyncTask iotSyncTask;
@Autowired @Autowired
private PlatElderSleepService platElderSleepService; private PlatElderSleepService platElderSleepService;
@Autowired
private PlatDeviceService platDeviceService;
@ApiOperation("测试") @ApiOperation("测试")
@PostMapping("test") @PostMapping("test")
@AuthIgnore @AuthIgnore
...@@ -51,6 +55,14 @@ public class PlatElderSleepController { ...@@ -51,6 +55,14 @@ public class PlatElderSleepController {
} }
@ApiOperation("编辑设备属性")
@PostMapping("editDeviceProperties")
@AuthIgnore
@TenantIdIgnore
public ApiResponseEntity<?> editDeviceProperties(@RequestBody PlatDeviceAttrWechatDTO dto) {
platDeviceService.editDeviceProperties(dto);
return ApiResponseUtils.success();
}
} }
package com.makeit.mapper.platform.space; package com.makeit.mapper.platform.space;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.makeit.dto.platform.space.PlatSpaceQueryDTO;
import com.makeit.entity.platform.space.PlatSpace; import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.vo.platform.space.PlatSpaceAndRoomVO; import com.makeit.vo.platform.space.PlatSpaceAndRoomVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -18,4 +17,6 @@ public interface PlatSpaceMapper extends BaseMapper<PlatSpace> { ...@@ -18,4 +17,6 @@ public interface PlatSpaceMapper extends BaseMapper<PlatSpace> {
List<PlatSpaceAndRoomVO> spaceListExcludeLast(@Param("orgIds") List<String> orgIds); List<PlatSpaceAndRoomVO> spaceListExcludeLast(@Param("orgIds") List<String> orgIds);
List<PlatSpace> listChild(@Param("spaceIds") List<String> spaceIds); List<PlatSpace> listChild(@Param("spaceIds") List<String> spaceIds);
List<PlatSpace> listChildAndOrgIds(@Param("spaceIds") List<String> spaceIds, @Param("orgIds") List<String> orgIds);
} }
...@@ -93,4 +93,5 @@ public interface PlatSpaceService extends IService<PlatSpace> { ...@@ -93,4 +93,5 @@ public interface PlatSpaceService extends IService<PlatSpace> {
List<PlatSpaceVO> listBedTreeByElderGroup(PlatSpaceQueryDTO dto, boolean flag); List<PlatSpaceVO> listBedTreeByElderGroup(PlatSpaceQueryDTO dto, boolean flag);
List<PlatSpace> listChildAndOrgIds(List<String> spaceIds, List<String> orgIds);
} }
...@@ -330,6 +330,11 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -330,6 +330,11 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
} }
@Override @Override
public List<PlatSpace> listChildAndOrgIds(List<String> spaceIds, List<String> orgIds) {
return baseMapper.listChildAndOrgIds(spaceIds,orgIds);
}
@Override
public List<PlatSpaceAddDTO> oneLevelList(BaseIdDTO dto) { public List<PlatSpaceAddDTO> oneLevelList(BaseIdDTO dto) {
List<PlatSpace> spaces = list(new QueryWrapper<PlatSpace>().lambda() List<PlatSpace> spaces = list(new QueryWrapper<PlatSpace>().lambda()
......
...@@ -498,18 +498,22 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -498,18 +498,22 @@ public class WorkStationServiceImpl implements WorkStationService {
spaces = platSpaceService.list(new QueryWrapper<PlatSpace>().lambda() spaces = platSpaceService.list(new QueryWrapper<PlatSpace>().lambda()
.in(PlatSpace::getOrgId, dto.getOrgIds())); .in(PlatSpace::getOrgId, dto.getOrgIds()));
if (spaces.isEmpty()) {
return new PageVO<>();
}
List<String> spaceIds = spaces.stream().map(PlatSpace::getId).collect(Collectors.toList()); List<String> spaceIds = spaces.stream().map(PlatSpace::getId).collect(Collectors.toList());
dto.setSpaceIds(spaceIds); dto.setSpaceIds(spaceIds);
} else { } else {
//获取父级的所有子级空间 //获取父级的所有子级空间
if (CollectionUtils.isNotEmpty(dto.getOrgIds())) {
spaces = platSpaceService.listChildAndOrgIds(dto.getSpaceIds(),dto.getOrgIds());
} else {
spaces = platSpaceService.listChild(dto.getSpaceIds()); spaces = platSpaceService.listChild(dto.getSpaceIds());
}
List<String> spaceIds = spaces.stream().map(PlatSpace::getId).collect(Collectors.toList()); List<String> spaceIds = spaces.stream().map(PlatSpace::getId).collect(Collectors.toList());
dto.setSpaceIds(spaceIds); dto.setSpaceIds(spaceIds);
} }
if (spaces.isEmpty()) {
return new PageVO<>();
}
List<String> elderIdList = new ArrayList<>(); List<String> elderIdList = new ArrayList<>();
List<PlatAlarmRecord> alarmRecords = platAlarmRecordService.list( List<PlatAlarmRecord> alarmRecords = platAlarmRecordService.list(
new QueryWrapper<PlatAlarmRecord>().lambda() new QueryWrapper<PlatAlarmRecord>().lambda()
......
...@@ -32,4 +32,26 @@ ...@@ -32,4 +32,26 @@
</where> </where>
</select> </select>
<select id="listChildAndOrgIds" resultType="com.makeit.entity.platform.space.PlatSpace">
SELECT id,name,parent_id,type,address,longitude,latitude,parent_path,tenant_id,org_id,attribute
FROM plat_space
<where>
del_flag = 0
<if test="spaceIds != null and spaceIds.size() > 0 ">
AND (
<foreach collection="spaceIds" item="item" separator="or" open="" close="" index="">
FIND_IN_SET(#{item},parent_path) OR id = #{item}
</foreach>
)
</if>
<if test="orgIds != null and orgIds.size() > 0 ">
AND org_id in
<foreach collection="orgIds" item="item" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
</where>
</select>
</mapper> </mapper>
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