Commit a5db060c by huangjy

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

parent 31c2b005
......@@ -62,15 +62,18 @@ public class IotDevicePropertiesOperateService extends IotCommonService {
if (radarHight != null) {
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);
try {
ResponseMessage responseMessage = sendPut(url, request);
log.error("写入设备属性信息:{}", responseMessage.getMessage());
log.info("写入设备属性信息:{}", responseMessage.getMessage());
} catch (IOException e) {
log.error("调用:{}接口异常:{}", url, e.getMessage());
}
}
return Lists.newArrayList();
}
......
......@@ -3,14 +3,17 @@ package com.makeit.module.controller.elder;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.wechat.device.PlatDeviceAttrWechatDTO;
import com.makeit.global.annotation.AuthIgnore;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.elder.PlatElderSleepService;
import com.makeit.task.IotSyncTask;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;
......@@ -31,7 +34,8 @@ public class PlatElderSleepController {
private IotSyncTask iotSyncTask;
@Autowired
private PlatElderSleepService platElderSleepService;
@Autowired
private PlatDeviceService platDeviceService;
@ApiOperation("测试")
@PostMapping("test")
@AuthIgnore
......@@ -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;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.makeit.dto.platform.space.PlatSpaceQueryDTO;
import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.vo.platform.space.PlatSpaceAndRoomVO;
import org.apache.ibatis.annotations.Param;
......@@ -18,4 +17,6 @@ public interface PlatSpaceMapper extends BaseMapper<PlatSpace> {
List<PlatSpaceAndRoomVO> spaceListExcludeLast(@Param("orgIds") List<String> orgIds);
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> {
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
}
@Override
public List<PlatSpace> listChildAndOrgIds(List<String> spaceIds, List<String> orgIds) {
return baseMapper.listChildAndOrgIds(spaceIds,orgIds);
}
@Override
public List<PlatSpaceAddDTO> oneLevelList(BaseIdDTO dto) {
List<PlatSpace> spaces = list(new QueryWrapper<PlatSpace>().lambda()
......
......@@ -498,18 +498,22 @@ public class WorkStationServiceImpl implements WorkStationService {
spaces = platSpaceService.list(new QueryWrapper<PlatSpace>().lambda()
.in(PlatSpace::getOrgId, dto.getOrgIds()));
if (spaces.isEmpty()) {
return new PageVO<>();
}
List<String> spaceIds = spaces.stream().map(PlatSpace::getId).collect(Collectors.toList());
dto.setSpaceIds(spaceIds);
} else {
//获取父级的所有子级空间
if (CollectionUtils.isNotEmpty(dto.getOrgIds())) {
spaces = platSpaceService.listChildAndOrgIds(dto.getSpaceIds(),dto.getOrgIds());
} else {
spaces = platSpaceService.listChild(dto.getSpaceIds());
}
List<String> spaceIds = spaces.stream().map(PlatSpace::getId).collect(Collectors.toList());
dto.setSpaceIds(spaceIds);
}
if (spaces.isEmpty()) {
return new PageVO<>();
}
List<String> elderIdList = new ArrayList<>();
List<PlatAlarmRecord> alarmRecords = platAlarmRecordService.list(
new QueryWrapper<PlatAlarmRecord>().lambda()
......
......@@ -32,4 +32,26 @@
</where>
</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>
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