Commit 0aae7ba9 by lzy

Merge branch 'dev' of git.xmmakeit.com:huangjiay/iot-platform-server into dev

parents 260e7e4e a2daf2cf
package com.makeit.module.iot.service;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.makeit.module.iot.util.HttpRequest;
import com.makeit.module.iot.vo.DeviceInstanceEntity;
import com.makeit.module.iot.vo.ResponseMessage;
import com.makeit.utils.data.convert.JsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* iot产品设备相关接口
*/
@Component
@Slf4j
public class IotDevicePropertiesOperateService extends IotCommonService {
public static final String DEVICE_PREFIX_URL = "/device-instance/";
/**
* 把设备写入属性
*/
@Async
public List<DeviceInstanceEntity> deviceWrite(String deviceId, Integer radarMount, Integer radarMode, Integer radarHight) {
String url = iotUrl + DEVICE_PREFIX_URL + deviceId + "/property";
// 条件可以自己改
Map<String, Object> map = Maps.newHashMap();
if (radarMount != null) {
map.put("radarMount", radarMount);
}
if (radarMode != null) {
map.put("radarMode", radarMode);
}
if (radarHight != null) {
map.put("radarHight", radarHight);
}
String body = JsonUtil.toJson(map);
HttpRequest request = buildRequest(url, body);
try {
ResponseMessage responseMessage = sendPut(url, request);
log.error("写入设备属性信息:{}", responseMessage.getMessage());
} catch (IOException e) {
log.error("调用:{}接口异常:{}", url, e.getMessage());
}
return Lists.newArrayList();
}
}
...@@ -38,6 +38,8 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -38,6 +38,8 @@ public class IotProductDeviceService extends IotCommonService {
public static final String DEVICE_PREFIX_URL = "/device-instance/"; public static final String DEVICE_PREFIX_URL = "/device-instance/";
public static final String REPORT_PROPERTY = "reportProperty";
/** /**
* 获取设备信息 * 获取设备信息
*/ */
...@@ -92,7 +94,7 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -92,7 +94,7 @@ public class IotProductDeviceService extends IotCommonService {
} }
public DeviceInfoContentBreathe getLastDeviceLogBreathe(String deviceId, Integer ignoreDuration) {//秒 public DeviceInfoContentBreathe getLastDeviceLogBreathe(String deviceId, Integer ignoreDuration) {//秒
DeviceOperationLogEntity deviceOperationLogEntity = getLastDeviceLogByType(deviceId, "reportProperty"); DeviceOperationLogEntity deviceOperationLogEntity = getLastDeviceLogByType(deviceId, REPORT_PROPERTY);
if (deviceOperationLogEntity == null) { if (deviceOperationLogEntity == null) {
return null; return null;
} }
...@@ -109,7 +111,7 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -109,7 +111,7 @@ public class IotProductDeviceService extends IotCommonService {
} }
public DeviceInfoContentSpace getLastDeviceLogSpace(String deviceId, Integer ignoreDuration) {//秒 public DeviceInfoContentSpace getLastDeviceLogSpace(String deviceId, Integer ignoreDuration) {//秒
DeviceOperationLogEntity deviceOperationLogEntity = getLastDeviceLogByType(deviceId, "reportProperty"); DeviceOperationLogEntity deviceOperationLogEntity = getLastDeviceLogByType(deviceId, REPORT_PROPERTY);
if (deviceOperationLogEntity == null) { if (deviceOperationLogEntity == null) {
return null; return null;
} }
...@@ -128,7 +130,7 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -128,7 +130,7 @@ public class IotProductDeviceService extends IotCommonService {
public List<DeviceInfoContentBreathe> getDeviceLogByTimeRangeBreathe(String deviceId, int pageSize, LocalDateTime startTime, LocalDateTime endTime) { public List<DeviceInfoContentBreathe> getDeviceLogByTimeRangeBreathe(String deviceId, int pageSize, LocalDateTime startTime, LocalDateTime endTime) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
List<DeviceOperationLogEntity> deviceOperationLogEntityList = getDeviceLogByTimeRange(deviceId, "reportProperty", pageSize, dateTimeFormatter.format(startTime), dateTimeFormatter.format(endTime)); List<DeviceOperationLogEntity> deviceOperationLogEntityList = getDeviceLogByTimeRange(deviceId, REPORT_PROPERTY, pageSize, dateTimeFormatter.format(startTime), dateTimeFormatter.format(endTime));
List<DeviceInfoContentBreathe> deviceInfoContentBreatheList = StreamUtil.map(deviceOperationLogEntityList, e -> JsonUtil.toObj((String) e.getContent(), DeviceInfoContentBreathe.class)); List<DeviceInfoContentBreathe> deviceInfoContentBreatheList = StreamUtil.map(deviceOperationLogEntityList, e -> JsonUtil.toObj((String) e.getContent(), DeviceInfoContentBreathe.class));
...@@ -138,7 +140,7 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -138,7 +140,7 @@ public class IotProductDeviceService extends IotCommonService {
public List<DeviceInfoContentSpace> getDeviceLogByTimeRangeSpace(String deviceId, int pageSize, LocalDateTime startTime, LocalDateTime endTime) { public List<DeviceInfoContentSpace> getDeviceLogByTimeRangeSpace(String deviceId, int pageSize, LocalDateTime startTime, LocalDateTime endTime) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
List<DeviceOperationLogEntity> deviceOperationLogEntityList = getDeviceLogByTimeRange(deviceId, "reportProperty", pageSize, dateTimeFormatter.format(startTime), dateTimeFormatter.format(endTime)); List<DeviceOperationLogEntity> deviceOperationLogEntityList = getDeviceLogByTimeRange(deviceId, REPORT_PROPERTY, pageSize, dateTimeFormatter.format(startTime), dateTimeFormatter.format(endTime));
List<DeviceInfoContentSpace> deviceInfoContentSpaceList = StreamUtil.map(deviceOperationLogEntityList, e -> JsonUtil.toObj((String) e.getContent(), DeviceInfoContentSpace.class)); List<DeviceInfoContentSpace> deviceInfoContentSpaceList = StreamUtil.map(deviceOperationLogEntityList, e -> JsonUtil.toObj((String) e.getContent(), DeviceInfoContentSpace.class));
...@@ -148,7 +150,7 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -148,7 +150,7 @@ public class IotProductDeviceService extends IotCommonService {
public List<DeviceInfoContentFall> getDeviceLogByTimeRangeFall(String deviceId, int pageSize, LocalDateTime startTime, LocalDateTime endTime) { public List<DeviceInfoContentFall> getDeviceLogByTimeRangeFall(String deviceId, int pageSize, LocalDateTime startTime, LocalDateTime endTime) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
List<DeviceOperationLogEntity> deviceOperationLogEntityList = getDeviceLogByTimeRange(deviceId, "reportProperty", pageSize, dateTimeFormatter.format(startTime), dateTimeFormatter.format(endTime)); List<DeviceOperationLogEntity> deviceOperationLogEntityList = getDeviceLogByTimeRange(deviceId, REPORT_PROPERTY, pageSize, dateTimeFormatter.format(startTime), dateTimeFormatter.format(endTime));
List<DeviceInfoContentFall> deviceInfoContentFallList = StreamUtil.map(deviceOperationLogEntityList, e -> JsonUtil.toObj((String) e.getContent(), DeviceInfoContentFall.class)); List<DeviceInfoContentFall> deviceInfoContentFallList = StreamUtil.map(deviceOperationLogEntityList, e -> JsonUtil.toObj((String) e.getContent(), DeviceInfoContentFall.class));
...@@ -235,7 +237,7 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -235,7 +237,7 @@ public class IotProductDeviceService extends IotCommonService {
Term term3 = Term.builder() Term term3 = Term.builder()
.column("type") .column("type")
.termType("eq") .termType("eq")
.type(Term.Type.or) .type(Term.Type.and)
.value(typeValue) .value(typeValue)
.terms(Lists.newArrayList()) .terms(Lists.newArrayList())
.options(Lists.newArrayList()) .options(Lists.newArrayList())
......
...@@ -7,6 +7,7 @@ import com.makeit.common.page.PageVO; ...@@ -7,6 +7,7 @@ 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.PlatDeviceQueryDTO; import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
import com.makeit.dto.wechat.device.PlatDeviceAttrWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO; import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceSetupDTO; import com.makeit.dto.wechat.device.PlatDeviceSetupDTO;
import com.makeit.service.platform.device.PlatDeviceService; import com.makeit.service.platform.device.PlatDeviceService;
...@@ -64,5 +65,12 @@ public class PlatDeviceWechatController { ...@@ -64,5 +65,12 @@ public class PlatDeviceWechatController {
return ApiResponseUtils.success(); return ApiResponseUtils.success();
} }
@ApiOperation("编辑设备属性")
@PostMapping("editDeviceProperties")
public ApiResponseEntity<?> editDeviceProperties(@RequestBody PlatDeviceAttrWechatDTO dto) {
platDeviceService.editDeviceProperties(dto);
return ApiResponseUtils.success();
}
} }
package com.makeit.dto.wechat.device;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
* 设备
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Data
@ApiModel(value = "PlatDeviceAttrWechatDTO对象", description = "设备属性")
public class PlatDeviceAttrWechatDTO {
@ApiModelProperty(value = "设备id")
private String deviceId;
@ApiModelProperty(value = "雷达安装方式 雷达安装方式")
private Integer radarMount;
@ApiModelProperty(value = "雷达功能模式 默认侧装轨迹\n" +
"侧装下\n" +
"0为存在模式,1为轨迹模式;\n" +
"顶装下\n" +
"0为存在模式,1为区块模式;")
private Integer radarMode;
@ApiModelProperty(value = "\"最小值\":200,\"最大值\":380,\"步\n" +
"进\":1,\"单位\":\"cm\"")
private Integer radarHight;
}
...@@ -15,7 +15,7 @@ import java.util.List; ...@@ -15,7 +15,7 @@ import java.util.List;
* @Describe: * @Describe:
*/ */
public interface PlatRoomMapper extends BaseMapper<PlatRoom> { public interface PlatRoomMapper extends BaseMapper<PlatRoom> {
List<PlatSpaceAndRoomVO> spaceAndRoomList(); List<PlatSpaceAndRoomVO> spaceAndRoomList(@Param("orgIds")List<String> orgIds);
List<WorkStationInstitutionRoomVO> workStationList(@Param("dto") WorkStationQueryDTO dto); List<WorkStationInstitutionRoomVO> workStationList(@Param("dto") WorkStationQueryDTO dto);
} }
...@@ -15,7 +15,7 @@ import java.util.List; ...@@ -15,7 +15,7 @@ import java.util.List;
*/ */
public interface PlatSpaceMapper extends BaseMapper<PlatSpace> { public interface PlatSpaceMapper extends BaseMapper<PlatSpace> {
List<PlatSpaceAndRoomVO> spaceListExcludeLast(); List<PlatSpaceAndRoomVO> spaceListExcludeLast(@Param("orgIds") List<String> orgIds);
List<PlatSpace> listChild(@Param("spaceIds") List<String> spaceIds); List<PlatSpace> listChild(@Param("spaceIds") List<String> spaceIds);
} }
...@@ -7,6 +7,7 @@ import com.makeit.dto.platform.device.PlatDeviceDetailDTO; ...@@ -7,6 +7,7 @@ import com.makeit.dto.platform.device.PlatDeviceDetailDTO;
import com.makeit.dto.platform.device.PlatDeviceEditDTO; import com.makeit.dto.platform.device.PlatDeviceEditDTO;
import com.makeit.dto.platform.device.PlatDeviceQueryDTO; import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
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.PlatDeviceEditWechatDTO; import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceSetupDTO; import com.makeit.dto.wechat.device.PlatDeviceSetupDTO;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
...@@ -52,4 +53,6 @@ public interface PlatDeviceService extends IService<PlatDevice> { ...@@ -52,4 +53,6 @@ public interface PlatDeviceService extends IService<PlatDevice> {
PlatDeviceDetailDTO getDetailDTO(String deviceId); PlatDeviceDetailDTO getDetailDTO(String deviceId);
void saasEdit(PlatDeviceEditSaasDTO dto); void saasEdit(PlatDeviceEditSaasDTO dto);
void editDeviceProperties(PlatDeviceAttrWechatDTO dto);
} }
...@@ -12,6 +12,7 @@ import com.makeit.dto.platform.device.PlatDeviceDetailDTO; ...@@ -12,6 +12,7 @@ import com.makeit.dto.platform.device.PlatDeviceDetailDTO;
import com.makeit.dto.platform.device.PlatDeviceEditDTO; import com.makeit.dto.platform.device.PlatDeviceEditDTO;
import com.makeit.dto.platform.device.PlatDeviceQueryDTO; import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
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.PlatDeviceEditWechatDTO; import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceSetupDTO; import com.makeit.dto.wechat.device.PlatDeviceSetupDTO;
import com.makeit.entity.platform.auth.PlatOrg; import com.makeit.entity.platform.auth.PlatOrg;
...@@ -20,6 +21,7 @@ import com.makeit.entity.platform.device.PlatDeviceOther; ...@@ -20,6 +21,7 @@ import com.makeit.entity.platform.device.PlatDeviceOther;
import com.makeit.enums.CodeMessageEnum; import com.makeit.enums.CodeMessageEnum;
import com.makeit.exception.BusinessException; import com.makeit.exception.BusinessException;
import com.makeit.mapper.platform.device.PlatDeviceMapper; import com.makeit.mapper.platform.device.PlatDeviceMapper;
import com.makeit.module.iot.service.IotDevicePropertiesOperateService;
import com.makeit.service.platform.auth.PlatOrgService; import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.device.PlatDeviceOtherService; import com.makeit.service.platform.device.PlatDeviceOtherService;
import com.makeit.service.platform.device.PlatDeviceService; import com.makeit.service.platform.device.PlatDeviceService;
...@@ -56,6 +58,8 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -56,6 +58,8 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
private PlatOrgService platOrgService; private PlatOrgService platOrgService;
@Autowired @Autowired
private DeviceCacheUtil deviceCacheUtil; private DeviceCacheUtil deviceCacheUtil;
@Autowired
private IotDevicePropertiesOperateService devicePropertiesOperateService;
@Override @Override
public PageVO<PlatDeviceListVO> page(PageReqDTO<PlatDeviceQueryDTO> pageReqDTO) { public PageVO<PlatDeviceListVO> page(PageReqDTO<PlatDeviceQueryDTO> pageReqDTO) {
...@@ -256,4 +260,9 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -256,4 +260,9 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
.orderByDesc(BaseEntity::getUpdateDate); .orderByDesc(BaseEntity::getUpdateDate);
} }
@Override
public void editDeviceProperties(PlatDeviceAttrWechatDTO dto) {
devicePropertiesOperateService.deviceWrite(dto.getDeviceId(),dto.getRadarMount(),dto.getRadarMode(),dto.getRadarHight());
}
} }
...@@ -60,7 +60,7 @@ public interface PlatRoomService extends IService<PlatRoom> { ...@@ -60,7 +60,7 @@ public interface PlatRoomService extends IService<PlatRoom> {
*/ */
PageVO<PlatRoom> page(PageReqDTO<PlatRoomQueryDTO> page); PageVO<PlatRoom> page(PageReqDTO<PlatRoomQueryDTO> page);
List<PlatSpaceAndRoomVO> spaceAndRoomList(); List<PlatSpaceAndRoomVO> spaceAndRoomList(List<String> orgIds);
List<WorkStationInstitutionRoomVO> workStationList(WorkStationQueryDTO dto); List<WorkStationInstitutionRoomVO> workStationList(WorkStationQueryDTO dto);
} }
...@@ -52,7 +52,7 @@ public interface PlatSpaceService extends IService<PlatSpace> { ...@@ -52,7 +52,7 @@ public interface PlatSpaceService extends IService<PlatSpace> {
*/ */
PlatSpaceAddDTO view(String id); PlatSpaceAddDTO view(String id);
List<PlatSpaceAndRoomVO> spaceListExcludeLast(); List<PlatSpaceAndRoomVO> spaceListExcludeLast(List<String> orgIds);
/** /**
* 空间树 到 床位 * 空间树 到 床位
......
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.makeit.dto.platform.elder.PlatElderQueryDTO; import com.makeit.dto.platform.elder.PlatElderQueryDTO;
import com.makeit.dto.platform.space.PlatBedPanoramaDTO; import com.makeit.dto.platform.space.PlatBedPanoramaDTO;
import com.makeit.dto.platform.space.PlatRoomPanoramaDTO; import com.makeit.dto.platform.space.PlatRoomPanoramaDTO;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.elder.PlatElder; import com.makeit.entity.platform.elder.PlatElder;
import com.makeit.entity.platform.space.PlatBed; import com.makeit.entity.platform.space.PlatBed;
import com.makeit.entity.platform.space.PlatRoom; import com.makeit.entity.platform.space.PlatRoom;
...@@ -12,6 +13,7 @@ import com.makeit.entity.platform.space.PlatSpace; ...@@ -12,6 +13,7 @@ import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.enums.platform.space.PlatBedPanoramaSpaceType; import com.makeit.enums.platform.space.PlatBedPanoramaSpaceType;
import com.makeit.enums.platform.space.PlatBedStatusEnum; import com.makeit.enums.platform.space.PlatBedStatusEnum;
import com.makeit.enums.platform.space.PlatRoomStatusEnum; import com.makeit.enums.platform.space.PlatRoomStatusEnum;
import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.elder.PlatElderService; import com.makeit.service.platform.elder.PlatElderService;
import com.makeit.service.platform.space.*; import com.makeit.service.platform.space.*;
import com.makeit.utils.data.convert.BeanDtoVoUtils; import com.makeit.utils.data.convert.BeanDtoVoUtils;
...@@ -44,6 +46,8 @@ public class PlatRoomDynamicServiceImpl implements PlatRoomDynamicService { ...@@ -44,6 +46,8 @@ public class PlatRoomDynamicServiceImpl implements PlatRoomDynamicService {
private PlatElderService platElderService; private PlatElderService platElderService;
@Autowired @Autowired
private PlatRoomBedDeviceService platRoomBedDeviceService; private PlatRoomBedDeviceService platRoomBedDeviceService;
@Autowired
private PlatOrgService platOrgService;
@Override @Override
...@@ -130,8 +134,14 @@ public class PlatRoomDynamicServiceImpl implements PlatRoomDynamicService { ...@@ -130,8 +134,14 @@ public class PlatRoomDynamicServiceImpl implements PlatRoomDynamicService {
@Override @Override
public List<PlatSpaceAndRoomVO> roomPanoramaTree() { public List<PlatSpaceAndRoomVO> roomPanoramaTree() {
//查询用户权限组织id
List<PlatOrg> orgs = platOrgService.belongToScopeList(new PlatOrg());
if(orgs.isEmpty()){
return new ArrayList<>();
}
List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
//获取房间前两级空间 //获取房间前两级空间
List<PlatSpaceAndRoomVO> list = platSpaceService.spaceListExcludeLast(); List<PlatSpaceAndRoomVO> list = platSpaceService.spaceListExcludeLast(orgIds);
//父级 //父级
List<PlatSpaceAndRoomVO> listParent = list.stream().filter(item-> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList()); List<PlatSpaceAndRoomVO> listParent = list.stream().filter(item-> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
...@@ -149,8 +159,14 @@ public class PlatRoomDynamicServiceImpl implements PlatRoomDynamicService { ...@@ -149,8 +159,14 @@ public class PlatRoomDynamicServiceImpl implements PlatRoomDynamicService {
@Override @Override
public List<PlatSpaceAndRoomVO> bedPanoramaTree() { public List<PlatSpaceAndRoomVO> bedPanoramaTree() {
//查询用户权限组织id
List<PlatOrg> orgs = platOrgService.belongToScopeList(new PlatOrg());
if(orgs.isEmpty()){
return new ArrayList<>();
}
List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
//获取空间及房间 //获取空间及房间
List<PlatSpaceAndRoomVO> list = platRoomService.spaceAndRoomList(); List<PlatSpaceAndRoomVO> list = platRoomService.spaceAndRoomList(orgIds);
//父级 //父级
List<PlatSpaceAndRoomVO> listParent = list.stream().filter(item-> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList()); List<PlatSpaceAndRoomVO> listParent = list.stream().filter(item-> StringUtil.isEmpty(item.getParentId())).collect(Collectors.toList());
......
...@@ -145,8 +145,8 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i ...@@ -145,8 +145,8 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i
} }
@Override @Override
public List<PlatSpaceAndRoomVO> spaceAndRoomList() { public List<PlatSpaceAndRoomVO> spaceAndRoomList(List<String> orgIds) {
return baseMapper.spaceAndRoomList(); return baseMapper.spaceAndRoomList(orgIds);
} }
@Override @Override
......
...@@ -163,8 +163,8 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -163,8 +163,8 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
} }
@Override @Override
public List<PlatSpaceAndRoomVO> spaceListExcludeLast() { public List<PlatSpaceAndRoomVO> spaceListExcludeLast(List<String> orgIds) {
return baseMapper.spaceListExcludeLast(); return baseMapper.spaceListExcludeLast(orgIds);
} }
@Override @Override
......
...@@ -70,6 +70,16 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -70,6 +70,16 @@ public class WorkStationServiceImpl implements WorkStationService {
List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList()); List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
dto.setOrgIds(orgIds); dto.setOrgIds(orgIds);
}else {
//根据类型过滤数据
List<PlatOrg> platOrgs = platOrgService.list(new QueryWrapper<PlatOrg>().lambda()
.in(PlatOrg::getId, dto.getOrgIds())
.eq(PlatOrg::getType, PlatOrgEnum.OrgTypeEnum.INSTITUTION.getValue()));
if(platOrgs.isEmpty()){
return vo;
}
List<String> orgIdList = platOrgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
dto.setOrgIds(orgIdList);
} }
//待处理告警 //待处理告警
long unHandledNumber = platAlarmRecordService.count(new QueryWrapper<PlatAlarmRecord>().lambda() long unHandledNumber = platAlarmRecordService.count(new QueryWrapper<PlatAlarmRecord>().lambda()
...@@ -259,6 +269,16 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -259,6 +269,16 @@ public class WorkStationServiceImpl implements WorkStationService {
List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList()); List<String> orgIds = orgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
dto.setOrgIds(orgIds); dto.setOrgIds(orgIds);
}else {
//根据类型过滤数据
List<PlatOrg> platOrgs = platOrgService.list(new QueryWrapper<PlatOrg>().lambda()
.in(PlatOrg::getId, dto.getOrgIds())
.eq(PlatOrg::getType, PlatOrgEnum.OrgTypeEnum.HOME.getValue()));
if(platOrgs.isEmpty()){
return vo;
}
List<String> orgIdList = platOrgs.stream().map(PlatOrg::getId).collect(Collectors.toList());
dto.setOrgIds(orgIdList);
} }
//长者数 //长者数
long elderNumber = platElderService.count(new QueryWrapper<PlatElder>().lambda() long elderNumber = platElderService.count(new QueryWrapper<PlatElder>().lambda()
......
...@@ -5,10 +5,28 @@ ...@@ -5,10 +5,28 @@
<mapper namespace="com.makeit.mapper.platform.space.PlatRoomMapper"> <mapper namespace="com.makeit.mapper.platform.space.PlatRoomMapper">
<select id="spaceAndRoomList" resultType="com.makeit.vo.platform.space.PlatSpaceAndRoomVO"> <select id="spaceAndRoomList" resultType="com.makeit.vo.platform.space.PlatSpaceAndRoomVO">
SELECT ps.id,ps.`name`,ps.parent_id as parentId,'1' as type FROM plat_space ps SELECT ps.id,ps.`name`,ps.parent_id as parentId,'1' as type FROM plat_space ps
WHERE ps.del_flag = 0 <where>
ps.del_flag = 0
<if test="orgIds != null and orgIds.size()>0 ">
AND ps.org_id IN
<foreach collection="orgIds" item="item" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
</where>
UNION UNION
SELECT pr.id,pr.`name`,pr.space_id as parentId,'2' as type FROM plat_room pr SELECT pr.id,pr.`name`,pr.space_id as parentId,'2' as type FROM plat_room pr
WHERE pr.del_flag = 0 LEFT JOIN plat_space p ON p.id = pr.space_id
<where>
pr.del_flag = 0
<if test="orgIds != null and orgIds.size()>0 ">
AND p.org_id IN
<foreach collection="orgIds" item="item" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
</where>
</select> </select>
<select id="workStationList" resultType="com.makeit.vo.platform.workstation.WorkStationInstitutionRoomVO"> <select id="workStationList" resultType="com.makeit.vo.platform.workstation.WorkStationInstitutionRoomVO">
......
...@@ -5,7 +5,16 @@ ...@@ -5,7 +5,16 @@
<mapper namespace="com.makeit.mapper.platform.space.PlatSpaceMapper"> <mapper namespace="com.makeit.mapper.platform.space.PlatSpaceMapper">
<select id="spaceListExcludeLast" resultType="com.makeit.vo.platform.space.PlatSpaceAndRoomVO"> <select id="spaceListExcludeLast" resultType="com.makeit.vo.platform.space.PlatSpaceAndRoomVO">
SELECT ps.id,ps.`name`,ps.parent_id as parentId FROM plat_space ps SELECT ps.id,ps.`name`,ps.parent_id as parentId FROM plat_space ps
WHERE ps.id in (SELECT parent_id FROM `plat_space` WHERE del_flag =0) and ps.del_flag = 0 <where>
ps.id in (SELECT parent_id FROM `plat_space` WHERE del_flag =0) and ps.del_flag = 0
<if test="orgIds != null and orgIds.size() > 0 ">
AND ps.org_id in
<foreach collection="orgIds" item="item" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
</where>
</select> </select>
<select id="listChild" resultType="com.makeit.entity.platform.space.PlatSpace"> <select id="listChild" resultType="com.makeit.entity.platform.space.PlatSpace">
......
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