Commit 34c46add by 杨伟程
parents 52c33f5e 46e3276e
...@@ -57,6 +57,13 @@ public class PlatRoomBedDeviceController { ...@@ -57,6 +57,13 @@ public class PlatRoomBedDeviceController {
return ApiResponseUtils.success(data); return ApiResponseUtils.success(data);
} }
@ApiOperation("已绑定设备分页")
@PostMapping("pageBindDevice")
public ApiResponseEntity<PageVO<PlatDeviceDTO>> pageBindDevice(@RequestBody PageReqDTO<PlatBedDeviceQueryDTO> page) {
PageVO<PlatDeviceDTO> data = platRoomBedDeviceService.pageBindDevice(page);
return ApiResponseUtils.success(data);
}
@ApiOperation("绑定设备") @ApiOperation("绑定设备")
@PostMapping("bindingDevice") @PostMapping("bindingDevice")
public ApiResponseEntity<?> bindingDevice(@RequestBody PlatRoomBindDeviceDTO dto) { public ApiResponseEntity<?> bindingDevice(@RequestBody PlatRoomBindDeviceDTO dto) {
......
...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel; ...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/** /**
* @Author:lzy * @Author:lzy
* @Date:2023/9/18 11:38 * @Date:2023/9/18 11:38
...@@ -41,7 +42,7 @@ public class PlatSpaceImportDTO { ...@@ -41,7 +42,7 @@ public class PlatSpaceImportDTO {
@ExcelProperty({BIG_TITLE, "床位数量"}) @ExcelProperty({BIG_TITLE, "床位数量"})
@ApiModelProperty(value = "床位数量") @ApiModelProperty(value = "床位数量")
private Integer bedNumber; private String bedNumber;
......
...@@ -18,6 +18,7 @@ import com.makeit.service.platform.alarm.PlatDayDurationRecordService; ...@@ -18,6 +18,7 @@ import com.makeit.service.platform.alarm.PlatDayDurationRecordService;
import com.makeit.utils.AlarmConfigCacheUtil; import com.makeit.utils.AlarmConfigCacheUtil;
import com.makeit.utils.AlarmRedisDTO; import com.makeit.utils.AlarmRedisDTO;
import com.makeit.utils.DayDurationUtil; import com.makeit.utils.DayDurationUtil;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.JsonUtil; import com.makeit.utils.data.convert.JsonUtil;
import com.makeit.utils.redis.RedisUtil; import com.makeit.utils.redis.RedisUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -162,7 +163,9 @@ public class FallAlarm implements IAlarm { ...@@ -162,7 +163,9 @@ public class FallAlarm implements IAlarm {
return; return;
} }
//保存每次进入空间时长 //保存每次进入空间时长
platDayDurationRecordService.saveDayDurationRecord(platAlarmCheckDTO, alarmRedisDTO); PlatAlarmCheckDTO platAlarmCheckDTO_behavior = BeanDtoVoUtils.convert(platAlarmCheckDTO, PlatAlarmCheckDTO.class);
platAlarmCheckDTO_behavior.setPlatAlarmConfig(config);
platDayDurationRecordService.saveDayDurationRecord(platAlarmCheckDTO_behavior, alarmRedisDTO);
RedisUtil.delete(RedisConst.ALARM_DEVICE_BEHAVIOR_ID + deviceId); RedisUtil.delete(RedisConst.ALARM_DEVICE_BEHAVIOR_ID + deviceId);
} }
} }
......
...@@ -62,10 +62,10 @@ implements PlatDayDurationRecordService { ...@@ -62,10 +62,10 @@ implements PlatDayDurationRecordService {
} }
List<PlatElder> platElderList = platAlarmCheckDTO.getPlatElderList(); List<PlatElder> platElderList = platAlarmCheckDTO.getPlatElderList();
if(CollectionUtils.isNotEmpty(platElderList)){ // if(CollectionUtils.isNotEmpty(platElderList)){
platAlarmRecordService.getElderListByDeviceId(platAlarmCheckDTO); // platAlarmRecordService.getElderListByDeviceId(platAlarmCheckDTO);
platElderList = platAlarmCheckDTO.getPlatElderList(); // platElderList = platAlarmCheckDTO.getPlatElderList();
} // }
for (PlatElder platElder : platElderList) { for (PlatElder platElder : platElderList) {
if(StringUtils.isBlank(platElder.getRegionName())){ if(StringUtils.isBlank(platElder.getRegionName())){
continue; continue;
......
...@@ -47,6 +47,8 @@ import org.springframework.stereotype.Service; ...@@ -47,6 +47,8 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
...@@ -300,6 +302,12 @@ public class DataScreenServiceImpl implements DataScreenService { ...@@ -300,6 +302,12 @@ public class DataScreenServiceImpl implements DataScreenService {
@Override @Override
public List<PlatMapStatisticsVO> mapStatistics(PlatDataScreenQueryDTO dto) { public List<PlatMapStatisticsVO> mapStatistics(PlatDataScreenQueryDTO dto) {
if(dto.getStartTime() == null){
dto.setStartTime(LocalDateTime.of(LocalDateTime.now().toLocalDate(), LocalTime.MIN));
}
if(dto.getEndTime() == null){
dto.setEndTime(LocalDateTime.of(LocalDateTime.now().toLocalDate(), LocalTime.MAX));
}
List<PlatMapStatisticsVO> list = new ArrayList<>(); List<PlatMapStatisticsVO> list = new ArrayList<>();
if(dto.getOrgIds().isEmpty()){ if(dto.getOrgIds().isEmpty()){
//获取该账号的权限组织 //获取该账号的权限组织
...@@ -542,7 +550,12 @@ public class DataScreenServiceImpl implements DataScreenService { ...@@ -542,7 +550,12 @@ public class DataScreenServiceImpl implements DataScreenService {
if (elderIds.size() > 0) { if (elderIds.size() > 0) {
if (platElderMap.get(elderIds.get(0)) != null) { if (platElderMap.get(elderIds.get(0)) != null) {
PlatAlarmRecordStatisticsVo statisticsVo = BeanDtoVoUtils.convert(record, PlatAlarmRecordStatisticsVo.class); PlatAlarmRecordStatisticsVo statisticsVo = BeanDtoVoUtils.convert(record, PlatAlarmRecordStatisticsVo.class);
statisticsVo.setSpaceId(platElderMap.get(elderIds.get(0)).getSpaceId()); if(StringUtil.isNotEmpty(platElderMap.get(elderIds.get(0)).getSpacePath())){
String spacePath = platElderMap.get(elderIds.get(0)).getSpacePath();
String spaceId = Arrays.asList(spacePath.split(",")).get(0);
statisticsVo.setSpaceId(spaceId);
}
statisticsVos.add(statisticsVo); statisticsVos.add(statisticsVo);
} }
} }
......
...@@ -10,6 +10,7 @@ import com.makeit.enums.platform.elder.PlatElderRealtimeReportEnum; ...@@ -10,6 +10,7 @@ import com.makeit.enums.platform.elder.PlatElderRealtimeReportEnum;
import com.makeit.module.iot.enums.DeviceInfoContentBreatheEnum; import com.makeit.module.iot.enums.DeviceInfoContentBreatheEnum;
import com.makeit.module.iot.enums.DeviceInfoContentFallEnum; import com.makeit.module.iot.enums.DeviceInfoContentFallEnum;
import com.makeit.module.iot.enums.DeviceInfoContentSpaceEnum; import com.makeit.module.iot.enums.DeviceInfoContentSpaceEnum;
import com.makeit.module.iot.enums.DeviceState;
import com.makeit.module.iot.service.IotProductDeviceService; import com.makeit.module.iot.service.IotProductDeviceService;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe; import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe;
import com.makeit.module.iot.vo.fall.DeviceInfoContentFall; import com.makeit.module.iot.vo.fall.DeviceInfoContentFall;
...@@ -131,6 +132,9 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService { ...@@ -131,6 +132,9 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
if (platDevice == null) { if (platDevice == null) {
return null; return null;
} }
if (!platDevice.getStatus().equals(DeviceState.online.getValue())) {
return null;
}
DeviceInfoContentBreathe deviceInfoContentBreathe = iotProductDeviceService.getLastDeviceLogBreathe(platDevice.getOriDeviceId(), 10); DeviceInfoContentBreathe deviceInfoContentBreathe = iotProductDeviceService.getLastDeviceLogBreathe(platDevice.getOriDeviceId(), 10);
...@@ -341,10 +345,19 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService { ...@@ -341,10 +345,19 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
platElderRealTimeHeartRespiratoryVO.setHeartRate(heartRate); platElderRealTimeHeartRespiratoryVO.setHeartRate(heartRate);
platElderRealTimeHeartRespiratoryVO.setRespiratoryRate(respiratoryRate); platElderRealTimeHeartRespiratoryVO.setRespiratoryRate(respiratoryRate);
} else { } else {
if (heartRate == 0) {
platElderRealTimeHeartRespiratoryVO.setHeartRate(0);
} else {
int hrRange = RandomUtils.nextInt(1, 11) - 5; int hrRange = RandomUtils.nextInt(1, 11) - 5;
platElderRealTimeHeartRespiratoryVO.setHeartRate(Math.max(heartRate + hrRange,0));
}
if (respiratoryRate == 0) {
platElderRealTimeHeartRespiratoryVO.setRespiratoryRate(0);
} else {
int brRange = RandomUtils.nextInt(1, 7) - 3; int brRange = RandomUtils.nextInt(1, 7) - 3;
platElderRealTimeHeartRespiratoryVO.setHeartRate(heartRate + hrRange); platElderRealTimeHeartRespiratoryVO.setRespiratoryRate(Math.max(respiratoryRate + brRange,0));
platElderRealTimeHeartRespiratoryVO.setRespiratoryRate(respiratoryRate + brRange); }
} }
redisTemplate.opsForList().leftPush(ELDER_BR_HR + platElderIdDTO.getElderId(),JSON.toJSONString(platElderRealTimeHeartRespiratoryVO)); redisTemplate.opsForList().leftPush(ELDER_BR_HR + platElderIdDTO.getElderId(),JSON.toJSONString(platElderRealTimeHeartRespiratoryVO));
} }
...@@ -380,9 +393,14 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService { ...@@ -380,9 +393,14 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
if (i ==0) { if (i ==0) {
platElderRealTimeBodyVO.setBodyMovementIndex(body); platElderRealTimeBodyVO.setBodyMovementIndex(body);
} else { } else {
if (body == 0) {
platElderRealTimeBodyVO.setBodyMovementIndex(0);
} else {
int hrRange = RandomUtils.nextInt(1, 11) - 5; int hrRange = RandomUtils.nextInt(1, 11) - 5;
platElderRealTimeBodyVO.setBodyMovementIndex(Math.max(body + hrRange,0)); platElderRealTimeBodyVO.setBodyMovementIndex(Math.max(body + hrRange,0));
} }
}
redisTemplate.opsForList().leftPush(ELDER_MOVE + platElderIdDTO.getElderId(),JSON.toJSONString(platElderRealTimeBodyVO)); redisTemplate.opsForList().leftPush(ELDER_MOVE + platElderIdDTO.getElderId(),JSON.toJSONString(platElderRealTimeBodyVO));
} }
return JSON.parseObject(redisTemplate.opsForList().rightPop(ELDER_MOVE + platElderIdDTO.getElderId()),PlatElderRealTimeBodyVO.class); return JSON.parseObject(redisTemplate.opsForList().rightPop(ELDER_MOVE + platElderIdDTO.getElderId()),PlatElderRealTimeBodyVO.class);
...@@ -433,10 +451,7 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService { ...@@ -433,10 +451,7 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
List<PlatDevice> deviceListFall = getFallDevice(platElderIdDTO.getElderId(), platElderIdDTO.getDeviceId()); List<PlatDevice> deviceListFall = getFallDevice(platElderIdDTO.getElderId(), platElderIdDTO.getDeviceId());
if (CollectionUtils.isEmpty(deviceListSpace) && CollectionUtils.isNotEmpty(deviceListFall)) { if (CollectionUtils.isNotEmpty(deviceListSpace)) {
return voList;
}
deviceListSpace.forEach(e -> { deviceListSpace.forEach(e -> {
DeviceInfoContentSpace i = iotProductDeviceService.getLastDeviceLogSpace(e.getOriDeviceId(), 10); DeviceInfoContentSpace i = iotProductDeviceService.getLastDeviceLogSpace(e.getOriDeviceId(), 10);
if (i == null) { if (i == null) {
...@@ -457,7 +472,9 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService { ...@@ -457,7 +472,9 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
voList.add(vo); voList.add(vo);
}); });
}
if (CollectionUtils.isNotEmpty(deviceListFall)) {
deviceListFall.forEach(e -> { deviceListFall.forEach(e -> {
DeviceInfoContentFall i = iotProductDeviceService.getLastDeviceLogFall(e.getOriDeviceId(), 10); DeviceInfoContentFall i = iotProductDeviceService.getLastDeviceLogFall(e.getOriDeviceId(), 10);
if (i == null) { if (i == null) {
...@@ -474,8 +491,7 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService { ...@@ -474,8 +491,7 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
voList.add(vo); voList.add(vo);
}); });
}
return voList; return voList;
} }
......
...@@ -892,6 +892,9 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -892,6 +892,9 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
public List<PlatDevice> getSpaceDevice(String id) { public List<PlatDevice> getSpaceDevice(String id) {
PlatElder platElder = getById(id); PlatElder platElder = getById(id);
if (platElder == null) {
return null;
}
if (StringUtils.isBlank(platElder.getBedId())) { if (StringUtils.isBlank(platElder.getBedId())) {
return null; return null;
} }
......
...@@ -55,4 +55,6 @@ public interface PlatRoomBedDeviceService extends IService<PlatRoomBedDevice> { ...@@ -55,4 +55,6 @@ public interface PlatRoomBedDeviceService extends IService<PlatRoomBedDevice> {
List<PlatDevice> getSpaceDevice(String bedId); List<PlatDevice> getSpaceDevice(String bedId);
List<PlatDevice> getFallDevice(String bedId); List<PlatDevice> getFallDevice(String bedId);
PageVO<PlatDeviceDTO> pageBindDevice(PageReqDTO<PlatBedDeviceQueryDTO> page);
} }
...@@ -256,4 +256,46 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM ...@@ -256,4 +256,46 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
public List<PlatDevice> getFallDevice(String bedId) { public List<PlatDevice> getFallDevice(String bedId) {
return getDeviceInternal(bedId, PlatDeviceEnum.CategoryEnum.FALL.getValue()); return getDeviceInternal(bedId, PlatDeviceEnum.CategoryEnum.FALL.getValue());
} }
@Override
public PageVO<PlatDeviceDTO> pageBindDevice(PageReqDTO<PlatBedDeviceQueryDTO> pageReqDTO) {
PlatBedDeviceQueryDTO dto = pageReqDTO.getData();
Page<PlatDevice> p = PageUtil.toMpPage(pageReqDTO);
LambdaQueryWrapper<PlatRoomBedDevice> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(PlatRoomBedDevice::getRoomId, dto.getRoomId());
queryWrapper1.eq(StringUtil.isNotEmpty(dto.getBedId()), PlatRoomBedDevice::getBedId, dto.getBedId());
List<PlatRoomBedDevice> list = list(queryWrapper1);
List<String> listEquipmentIds = list.stream().map(item -> item.getDeviceId()).collect(Collectors.toList());
List<String> listBedIds = list.stream().map(item -> item.getBedId()).collect(Collectors.toList());
LambdaQueryWrapper<PlatBed> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.in(PlatBed::getId, listBedIds);
List<PlatBed> listBeds = platBedService.list(queryWrapper2);
Map<String, String> map = listBeds.stream().collect(Collectors.toMap(PlatBed::getId, PlatBed::getName, (k1, k2) -> k1));
Map<String, String> mapName = new HashMap<>(20);
Map<String, String> mapBedId = new HashMap<>(20);
list.forEach(item -> {
if (map.containsKey(item.getBedId())) {
mapName.put(item.getDeviceId(), map.get(item.getBedId()));
mapBedId.put(item.getDeviceId(), item.getBedId());
}
});
if (!listEquipmentIds.isEmpty()) {
LambdaQueryWrapper<PlatDevice> queryWrapper = new LambdaQueryWrapper<>();
//queryWrapper.eq(PlatDevice::getCategory, PlatDeviceEnum.CategoryEnum.HEART);
queryWrapper.in(PlatDevice::getId, listEquipmentIds);
Page<PlatDevice> pages = platDeviceService.page(p, queryWrapper);
List<PlatDeviceDTO> data = BeanDtoVoUtils.listVo(pages.getRecords(), PlatDeviceDTO.class);
data.forEach(item -> {
item.setBedName(mapName.get(item.getId()));
item.setBedId(mapBedId.get(item.getId()));
});
return PageUtil.toPageVO(data, pages);
}else {
return new PageVO<>();
}
}
} }
...@@ -39,6 +39,8 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -39,6 +39,8 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.*; import java.util.*;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -413,6 +415,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -413,6 +415,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
Integer errorCount = 0; Integer errorCount = 0;
Integer successCount = 0; Integer successCount = 0;
boolean errorFlag = false; boolean errorFlag = false;
Pattern pattern = Pattern.compile("^\\d+$");
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
PlatSpaceImportDTO item = list.get(i); PlatSpaceImportDTO item = list.get(i);
...@@ -449,6 +452,17 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -449,6 +452,17 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
} }
listKey.add(key+"-"+item.getRoomName()); listKey.add(key+"-"+item.getRoomName());
if(StringUtil.isNotEmpty(item.getBedNumber())){
Matcher matcher = pattern.matcher(item.getBedNumber());
// 进行匹配
if(!matcher.find()){
errorVoList.add(new ExcelErrorVo(i + 3, excelField.get(4), "床位数量格式错误"));
}
}
if (errorFlag) { if (errorFlag) {
errorCount++; errorCount++;
} else { } else {
...@@ -526,7 +540,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -526,7 +540,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
String threeKey = secondId + "-" + item.getUnit(); String threeKey = secondId + "-" + item.getUnit();
if (!childrenIdMap.containsKey(threeKey)) { if (!childrenIdMap.containsKey(threeKey)) {
PlatSpace platSpace = new PlatSpace(); PlatSpace platSpace = new PlatSpace();
platSpace.setName(item.getBuilding()); platSpace.setName(item.getUnit());
platSpace.setType(PlatSpaceEnum.TypeEnum.UNIT.getValue()); platSpace.setType(PlatSpaceEnum.TypeEnum.UNIT.getValue());
platSpace.setOrgId(orgId); platSpace.setOrgId(orgId);
platSpace.setParentId(secondId); platSpace.setParentId(secondId);
...@@ -555,7 +569,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -555,7 +569,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
String fourKey = threeId + "-" + item.getFloor(); String fourKey = threeId + "-" + item.getFloor();
if (!childrenIdMap.containsKey(fourKey)) { if (!childrenIdMap.containsKey(fourKey)) {
PlatSpace platSpace = new PlatSpace(); PlatSpace platSpace = new PlatSpace();
platSpace.setName(item.getBuilding()); platSpace.setName(item.getFloor());
platSpace.setType(PlatSpaceEnum.TypeEnum.FLOOR.getValue()); platSpace.setType(PlatSpaceEnum.TypeEnum.FLOOR.getValue());
platSpace.setOrgId(orgId); platSpace.setOrgId(orgId);
platSpace.setParentId(threeId); platSpace.setParentId(threeId);
...@@ -572,8 +586,8 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -572,8 +586,8 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
//房间 //房间
PlatRoomDTO platRoomDTO = new PlatRoomDTO(); PlatRoomDTO platRoomDTO = new PlatRoomDTO();
platRoomDTO.setName(item.getRoomName()); platRoomDTO.setName(item.getRoomName());
if(item.getBedNumber()!=null){ if(StringUtil.isNotEmpty(item.getBedNumber())){
platRoomDTO.setBedNumber(item.getBedNumber()); platRoomDTO.setBedNumber(Integer.valueOf(item.getBedNumber()));
}else { }else {
platRoomDTO.setBedNumber(0); platRoomDTO.setBedNumber(0);
} }
......
...@@ -561,7 +561,7 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -561,7 +561,7 @@ 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());
if(!dto.getOrgIds().isEmpty()){ if(dto.getOrgIds()!=null && !dto.getOrgIds().isEmpty()){
orgIds = dto.getOrgIds(); orgIds = dto.getOrgIds();
} }
......
...@@ -14,6 +14,7 @@ import com.makeit.module.iot.vo.DeviceState; ...@@ -14,6 +14,7 @@ import com.makeit.module.iot.vo.DeviceState;
import com.makeit.module.system.service.SysDictionaryCategoryService; import com.makeit.module.system.service.SysDictionaryCategoryService;
import com.makeit.module.system.vo.DictionaryVo; import com.makeit.module.system.vo.DictionaryVo;
import com.makeit.service.platform.device.PlatDeviceService; import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.elder.PlatElderDayReportDayService;
import com.makeit.service.platform.elder.PlatElderSleepService; import com.makeit.service.platform.elder.PlatElderSleepService;
import com.makeit.service.saas.PlatTenantService; import com.makeit.service.saas.PlatTenantService;
import com.makeit.utils.DeviceCacheUtil; import com.makeit.utils.DeviceCacheUtil;
...@@ -47,13 +48,15 @@ public class IotSyncTask { ...@@ -47,13 +48,15 @@ public class IotSyncTask {
private DeviceCacheUtil deviceCacheUtil; private DeviceCacheUtil deviceCacheUtil;
@Autowired @Autowired
private PlatElderSleepService platElderSleepService; private PlatElderSleepService platElderSleepService;
@Autowired
private PlatElderDayReportDayService platElderDayReportDayService;
/** /**
* 一小时同步一次 * 一小时同步一次
* 启用状态的租户才同步 * 启用状态的租户才同步
* 新增和更新平台端设备表 * 新增和更新平台端设备表
*/ */
@Scheduled(cron = "0 0 */1 * * ?") @Scheduled(cron = "0 0/10 * * * *")
public void syncEquipmentInfo() { public void syncEquipmentInfo() {
savePlatDevice(); savePlatDevice();
} }
...@@ -158,4 +161,13 @@ public class IotSyncTask { ...@@ -158,4 +161,13 @@ public class IotSyncTask {
log.info("定时分析长者睡眠质量结束"); log.info("定时分析长者睡眠质量结束");
} }
/* @Scheduled(cron = "0 0 1 * * ?")
@TenantIdIgnore
public void elderCoordinateListAnalysisTask() {
log.info("开始定时分析24小时热力图");
platElderDayReportDayService.elderCoordinateListAnalysisTask();
log.info("定时分析长者24小时热力图");
}*/
} }
...@@ -29,4 +29,7 @@ public class PlatBedVo extends BaseBusEntity { ...@@ -29,4 +29,7 @@ public class PlatBedVo extends BaseBusEntity {
@ApiModelProperty(value = "绑定设备") @ApiModelProperty(value = "绑定设备")
private String deviceName; private String deviceName;
@ApiModelProperty(value = "绑定设备id")
private String deviceId;
} }
...@@ -117,7 +117,8 @@ ...@@ -117,7 +117,8 @@
pb.update_by as updateBy, pb.update_by as updateBy,
pb.update_date as updateDate, pb.update_date as updateDate,
pb.sort as sort, pb.sort as sort,
d.name as deviceName d.name as deviceName,
d.id as deviceId
from plat_bed pb from plat_bed pb
left join plat_room_bed_device prbd on prbd.bed_id = pb.id and prbd.del_flag = 0 left join plat_room_bed_device prbd on prbd.bed_id = pb.id and prbd.del_flag = 0
left join plat_device d on d.id = prbd.device_id and d.del_flag = 0 left join plat_device d on d.id = prbd.device_id and d.del_flag = 0
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</foreach> </foreach>
</if> </if>
</where> </where>
UNION UNION ALL
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
LEFT JOIN plat_space p ON p.id = pr.space_id LEFT JOIN plat_space p ON p.id = pr.space_id
<where> <where>
......
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