Commit 2373d0a7 by huangjy

Merge remote-tracking branch 'origin/dev' into dev

parents fbb06ab5 f6340356
...@@ -12,7 +12,8 @@ import com.makeit.module.iot.vo.DeviceOperationLogEntity; ...@@ -12,7 +12,8 @@ import com.makeit.module.iot.vo.DeviceOperationLogEntity;
import com.makeit.module.iot.vo.IotPagerResult; import com.makeit.module.iot.vo.IotPagerResult;
import com.makeit.module.iot.vo.ResponseMessage; import com.makeit.module.iot.vo.ResponseMessage;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe; import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentSpace; import com.makeit.module.iot.vo.fall.DeviceInfoContentFall;
import com.makeit.module.iot.vo.space.DeviceInfoContentSpace;
import com.makeit.utils.LongTimestampUtil; import com.makeit.utils.LongTimestampUtil;
import com.makeit.utils.data.convert.JsonUtil; import com.makeit.utils.data.convert.JsonUtil;
import com.makeit.utils.data.convert.StreamUtil; import com.makeit.utils.data.convert.StreamUtil;
...@@ -23,9 +24,7 @@ import org.springframework.stereotype.Component; ...@@ -23,9 +24,7 @@ import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
import java.time.Duration; import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -146,6 +145,16 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -146,6 +145,16 @@ public class IotProductDeviceService extends IotCommonService {
return deviceInfoContentSpaceList; return deviceInfoContentSpaceList;
} }
public List<DeviceInfoContentFall> getDeviceLogByTimeRangeFall(String deviceId, int pageSize, LocalDateTime startTime, LocalDateTime endTime) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
List<DeviceOperationLogEntity> deviceOperationLogEntityList = getDeviceLogByTimeRange(deviceId, "event", pageSize, dateTimeFormatter.format(startTime), dateTimeFormatter.format(endTime));
List<DeviceInfoContentFall> deviceInfoContentSpaceList = StreamUtil.map(deviceOperationLogEntityList, e -> JsonUtil.toObj((String) e.getContent(), DeviceInfoContentFall.class));
return deviceInfoContentSpaceList;
}
/** /**
* 根据类型查询设备日志 * 根据类型查询设备日志
...@@ -196,7 +205,6 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -196,7 +205,6 @@ public class IotProductDeviceService extends IotCommonService {
} }
/** /**
*
* @param deviceId * @param deviceId
* @param typeValue * @param typeValue
* @param pageSize * @param pageSize
......
package com.makeit.module.iot.vo.fall;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@NoArgsConstructor
@Data
public class DeviceInfoContentFall {
@JsonProperty("headers")
private DeviceInfoContentBreathe.Headers headers;
@JsonProperty("messageType")
private String messageType;
@JsonProperty("deviceId")
private String deviceId;
@JsonProperty("properties")
private Properties properties;
@JsonProperty("timestamp")
private Long timestamp;
@NoArgsConstructor
@Data
public static class Properties {
@JsonProperty("personState")
private Integer personState;
@JsonProperty("person")
private Integer person;
@JsonProperty("radarHitch")
private String radarHitch;
@JsonProperty("track")
private List<Integer> track;
@JsonProperty("mount")
private Integer mount;
}
}
package com.makeit.module.iot.vo.breathe; package com.makeit.module.iot.vo.space;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
......
...@@ -10,7 +10,7 @@ import com.makeit.entity.platform.elder.PlatElderSleepAnalysis; ...@@ -10,7 +10,7 @@ import com.makeit.entity.platform.elder.PlatElderSleepAnalysis;
import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum; import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum;
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.breathe.DeviceInfoContentSpace; import com.makeit.module.iot.vo.space.DeviceInfoContentSpace;
import com.makeit.service.platform.alarm.PlatAlarmRecordService; import com.makeit.service.platform.alarm.PlatAlarmRecordService;
import com.makeit.service.platform.device.PlatDeviceService; import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.elder.*; import com.makeit.service.platform.elder.*;
......
...@@ -4,7 +4,7 @@ import com.makeit.dto.platform.elder.PlatElderIdDTO; ...@@ -4,7 +4,7 @@ import com.makeit.dto.platform.elder.PlatElderIdDTO;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
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.breathe.DeviceInfoContentSpace; import com.makeit.module.iot.vo.space.DeviceInfoContentSpace;
import com.makeit.service.platform.device.PlatDeviceService; import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.elder.PlatElderRealTimeService; import com.makeit.service.platform.elder.PlatElderRealTimeService;
import com.makeit.service.platform.elder.PlatElderService; import com.makeit.service.platform.elder.PlatElderService;
......
...@@ -172,12 +172,10 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -172,12 +172,10 @@ public class WorkStationServiceImpl implements WorkStationService {
e.setPathName(StreamUtil.join(l, Objects::nonNull, PlatSpace::getName, "-")); e.setPathName(StreamUtil.join(l, Objects::nonNull, PlatSpace::getName, "-"));
}); });
for (WorkStationInstitutionRoomVO roomVo : roomVOList) { for (WorkStationInstitutionRoomVO vo : roomVOList) {
WorkStationInstitutionRoomVO vo = new WorkStationInstitutionRoomVO();
vo.setRoomId(roomVo.getRoomId());
vo.setPathName(vo.getPathName() + "-" + vo.getRoomName()); vo.setPathName(vo.getPathName() + "-" + vo.getRoomName());
if (bedMap.get(roomVo.getRoomId()) != null) { if (bedMap.get(vo.getRoomId()) != null) {
List<WorkStationInstitutionBedVO> roomBedVos = bedMap.get(roomVo.getRoomId()); List<WorkStationInstitutionBedVO> roomBedVos = bedMap.get(vo.getRoomId());
//获取告警类型及老人状态 //获取告警类型及老人状态
roomBedVos.forEach(r -> { roomBedVos.forEach(r -> {
if (StringUtil.isNotEmpty(r.getElderId()) ) { if (StringUtil.isNotEmpty(r.getElderId()) ) {
......
...@@ -86,17 +86,23 @@ implements SaasRoleService{ ...@@ -86,17 +86,23 @@ implements SaasRoleService{
} }
private void check(SaasRoleDTOVO dto) { private void check(SaasRoleDTOVO dto) {
SaasRole old = getOne(new QueryWrapper<SaasRole>().lambda() List<SaasRole> oldList = list(new QueryWrapper<SaasRole>().lambda()
.eq(SaasRole::getName, dto.getName())); .eq(SaasRole::getName, dto.getName()));
if (old != null && !old.getId().equals(dto.getId())) { for (SaasRole old : oldList) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_NAME_DUPLICATE); if (old != null && !old.getId().equals(dto.getId())) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_NAME_DUPLICATE);
}
}
oldList = list(new QueryWrapper<SaasRole>().lambda()
.eq(SaasRole::getCode, dto.getCode()));
for (SaasRole old : oldList) {
if (old != null && !old.getId().equals(dto.getId())) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_CODE_DUPLICATE);
}
} }
// old = getOne(new QueryWrapper<SaasRole>().lambda()
// .eq(SaasRole::getName, dto.getName()));
// if (old != null && !old.getId().equals(dto.getId())) {
// throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_CODE_DUPLICATE);
// }
} }
@Transactional @Transactional
......
...@@ -186,7 +186,7 @@ implements SaasUserService{ ...@@ -186,7 +186,7 @@ implements SaasUserService{
private void setRoleList(SaasUserDTOVO dto) { private void setRoleList(SaasUserDTOVO dto) {
saasUserRoleService.remove(new QueryWrapper<SaasUserRole>().lambda() saasUserRoleService.remove(new QueryWrapper<SaasUserRole>().lambda()
.eq(SaasUserRole::getUserId, dto.getId())); .eq(SaasUserRole::getUserId, dto.getId()));
if (CollectionUtils.isNotEmpty(dto.getRoleList())) { if (CollectionUtils.isNotEmpty(dto.getRoleIdList())) {
List<SaasUserRole> userRoleList = StreamUtil.map(dto.getRoleIdList(), e -> { List<SaasUserRole> userRoleList = StreamUtil.map(dto.getRoleIdList(), e -> {
SaasUserRole saasUserRole = new SaasUserRole(); SaasUserRole saasUserRole = new SaasUserRole();
saasUserRole.setUserId(dto.getId()); saasUserRole.setUserId(dto.getId());
...@@ -249,7 +249,6 @@ implements SaasUserService{ ...@@ -249,7 +249,6 @@ implements SaasUserService{
@Transactional @Transactional
@Override @Override
public void edit(SaasUserDTOVO dto) { public void edit(SaasUserDTOVO dto) {
dto.setAccount(null);
superCantEdit(dto); superCantEdit(dto);
check(dto); check(dto);
......
...@@ -156,12 +156,10 @@ public class PlatElderCenterWechatServiceImpl implements PlatElderCenterWechatSe ...@@ -156,12 +156,10 @@ public class PlatElderCenterWechatServiceImpl implements PlatElderCenterWechatSe
//长者对应的报警类型 //长者对应的报警类型
Map<String, Map<String,List<String>>> elderAlarmTypeMap = workStationService.mapElderAlarmType(alarmRecords); Map<String, Map<String,List<String>>> elderAlarmTypeMap = workStationService.mapElderAlarmType(alarmRecords);
for (WorkStationInstitutionRoomVO roomVo : roomVOList) { for (WorkStationInstitutionRoomVO vo : roomVOList) {
WorkStationInstitutionRoomVO vo = new WorkStationInstitutionRoomVO();
vo.setRoomId(roomVo.getRoomId());
vo.setPathName(vo.getPathName() + "-" + vo.getRoomName()); vo.setPathName(vo.getPathName() + "-" + vo.getRoomName());
if (bedMap.get(roomVo.getRoomId()) != null) { if (bedMap.get(vo.getRoomId()) != null) {
List<WorkStationInstitutionBedVO> roomBedVos = bedMap.get(roomVo.getRoomId()); List<WorkStationInstitutionBedVO> roomBedVos = bedMap.get(vo.getRoomId());
//获取告警类型及老人状态 //获取告警类型及老人状态
roomBedVos.forEach(r -> { roomBedVos.forEach(r -> {
if (StringUtil.isNotEmpty(r.getElderId()) ) { if (StringUtil.isNotEmpty(r.getElderId()) ) {
......
...@@ -27,7 +27,7 @@ public class WorkStationInstitutionBedVO { ...@@ -27,7 +27,7 @@ public class WorkStationInstitutionBedVO {
private String roomId; private String roomId;
@ApiModelProperty(value = "状态") @ApiModelProperty(value = "状态")
private String stauts; private String status;
@ApiModelProperty(value = "长者id") @ApiModelProperty(value = "长者id")
private String elderId; private String elderId;
......
...@@ -50,12 +50,12 @@ ...@@ -50,12 +50,12 @@
</select> </select>
<select id="selectByRoomIds" resultType="com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO"> <select id="selectByRoomIds" resultType="com.makeit.vo.platform.workstation.WorkStationInstitutionBedVO">
SELECT pb.`name` as bedName, pb.id as bedId, pb.room_id as roomId , pe.id as elderId, pb.name as elderName, prbd.device_id as deviceId SELECT pb.`name` as bedName, pb.id as bedId, pb.room_id as roomId , pe.id as elderId, pb.name as elderName, prbd.device_id as deviceId,pb.status
FROM plat_bed pb FROM plat_bed pb
LEFT JOIN plat_elder pe ON pe.bed_id = pb.id LEFT JOIN plat_elder pe ON pe.bed_id = pb.id
LEFT JOIN plat_room_bed_device prbd ON prbd.bed_id = pb.id LEFT JOIN plat_room_bed_device prbd ON prbd.bed_id = pb.id
<where> <where>
pb.del_flag = 0 and pe.del_flag = 0 and prbd.del_flag = 0 pb.del_flag = 0
<if test="roomIds != null and roomIds.size() > 0 "> <if test="roomIds != null and roomIds.size() > 0 ">
AND pb.room_id IN AND pb.room_id IN
<foreach collection="roomIds" item="item" separator="," open="(" close=")" index=""> <foreach collection="roomIds" item="item" separator="," open="(" close=")" index="">
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
<select id="selectByCondition" resultType="com.makeit.dto.saas.SaasOperationLogDTO"> <select id="selectByCondition" resultType="com.makeit.dto.saas.SaasOperationLogDTO">
select select
ol.id as id, ol.id as id,
ol.saas_user_id as platUserId, ol.saas_user_id as saasUserId,
ol.tenant_id as tenantId, ol.tenant_id as tenantId,
ol.content as content, ol.content as content,
ol.create_date as createDate, ol.create_date as createDate,
pu.username as platUserName, pu.username as saasUserName,
t.name as tenantName t.name as tenantName
from saas_operation_log ol from saas_operation_log ol
left join saas_user pu on ol.saas_user_id = pu.id and pu.del_flag = 0 left join saas_user pu on ol.saas_user_id = pu.id and pu.del_flag = 0
......
...@@ -82,7 +82,7 @@ mybatis-plus: ...@@ -82,7 +82,7 @@ mybatis-plus:
global-config: global-config:
db-config: db-config:
id-type: ASSIGN_ID id-type: ASSIGN_ID
update-strategy: not_empty update-strategy: not_null
insert-strategy: not_empty insert-strategy: not_empty
where-strategy: not_empty where-strategy: not_empty
......
...@@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest @SpringBootTest
public class IotTest { public class IotDeviceInfoContentFall {
@Autowired @Autowired
private IotTokenService tokenService; private IotTokenService tokenService;
......
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