Commit 43efc4f4 by 李小龙

整理代码

parent 8ec03134
......@@ -26,17 +26,19 @@ CREATE TABLE `plat_user` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='租户账号管理';
CREATE TABLE `plat_role` (
`id` varchar(64) NOT NULL COLLATE utf8mb4_general_ci COMMENT 'id',
`id` varchar(64) NOT NULL COMMENT 'id',
`tenant_id` varchar(64) NOT NULL COMMENT '租户id',
`name` varchar(100) NOT NULL COMMENT '名称',
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
`data_scope` varchar(600) DEFAULT NULL COMMENT '数据权限 子公司id 上级可看到下级',
`create_date` datetime NOT NULL COMMENT '创建时间',
`update_date` datetime NOT NULL COMMENT '更新时间',
`del_flag` CHAR(1) DEFAULT NULL COMMENT '删除标识',
`update_by` varchar(64) DEFAULT NULL COMMENT '更新人',
`del_flag` char(1) DEFAULT NULL COMMENT '删除标识',
`update_by` varchar(64) DEFAULT NULL COMMENT '更新人',
`create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
`org_id` varchar(64) DEFAULT NULL COMMENT '所属组织',
`code` varchar(64) DEFAULT NULL COMMENT 'code',
`status` char(1) DEFAULT NULL COMMENT '状态',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='租户端角色';
......
......@@ -94,7 +94,7 @@ public class RedisConst {
public static final String ALARM_DEVICE_ID = "alarm:device:id:";
public static final String ALARM_CONFIG_ORG_ID = "alarm:config:org:id";
public static final String ALARM_CONFIG_ORG_ID = "alarm:config:org:id:";
public static final String PLAT_IOT_DEVICE_PREFIX = "plat:iot:device:";
......
......@@ -38,4 +38,10 @@ public class PlatRoleDTOVO extends BaseOrgDTO implements Serializable {
@ApiModelProperty(value = "菜单集合")
private List<PlatMenuDTOVO> menuList;
private String code;
private String remark;
private String status;
}
......@@ -33,4 +33,8 @@ public class PlatRole extends BaseBusEntity {
private String dataScope;
private String orgId;
private String code;
private String status;
}
\ No newline at end of file
package com.makeit.service.platform.alarm.alarmStrategy;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSONObject;
import com.makeit.dto.platform.alarm.PlatAlarmCheckDTO;
import com.makeit.dto.platform.alarm.PlatAlarmConfigBehaviorDTOVO;
......@@ -46,7 +47,7 @@ public class BehaviorAlarm implements IAlarm{
if (StringUtils.isBlank(ruleConfigStr)) {
return;
}
String personState = (String) properties.get("personState");
String personState = Convert.toStr(properties.get("personState"));
PlatAlarmConfigBehaviorDTOVO ruleConfig = JsonUtil.toObj(ruleConfigStr, PlatAlarmConfigBehaviorDTOVO.class);
Integer duration = ruleConfig.getDuration();
duration = duration*60;
......
package com.makeit.service.platform.alarm.alarmStrategy;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSONObject;
import com.makeit.dto.platform.alarm.PlatAlarmCheckDTO;
import com.makeit.dto.platform.alarm.PlatAlarmConfigRespiratoryDTOVO;
......@@ -48,7 +49,7 @@ public class BreathAlarm implements IAlarm{
if (StringUtils.isBlank(ruleConfigStr)) {
return;
}
String personState = (String) properties.get("personState");
String personState = Convert.toStr(properties.get("personState"));
//呼吸率
int br = (int) properties.get("br");
......
package com.makeit.service.platform.alarm.alarmStrategy;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSONObject;
import com.makeit.dto.platform.alarm.PlatAlarmCheckDTO;
import com.makeit.entity.platform.alarm.PlatAlarmRecord;
import com.makeit.entity.platform.elder.PlatElder;
import com.makeit.entity.platform.space.PlatRoom;
import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum;
import com.makeit.service.platform.alarm.PlatAlarmRecordService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class FallAlarm implements IAlarm{
@Autowired
......@@ -29,18 +35,27 @@ public class FallAlarm implements IAlarm{
@Override
public void checkConfig(PlatAlarmCheckDTO platAlarmCheckDTO) {
JSONObject properties = platAlarmCheckDTO.getProperties();
String personState = (String) properties.get("personState");
String personState = Convert.toStr(properties.get("personState"));
if (StringUtils.equals(personState, "1")) {
notice(platAlarmCheckDTO);
}
}
@Override
@Async
public void notice(PlatAlarmCheckDTO platAlarmCheckDTO) {
platAlarmRecordService.getElderListByDeviceId(platAlarmCheckDTO);
platAlarmCheckDTO.getParam().add("房间名111");
PlatAlarmRecord platAlarmRecord = platAlarmRecordService.createPlatAlarmRecord(platAlarmCheckDTO);
platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(),platAlarmRecord);
List<PlatElder> platElderList = platAlarmCheckDTO.getPlatElderList();
if(CollectionUtils.isEmpty(platElderList)){
return;
}
PlatRoom platRoom = platAlarmCheckDTO.getPlatRoom();
for (PlatElder platElder : platElderList) {
List<String> param = new ArrayList<>();
param.add(platElder.getName());
param.add(platRoom.getName());
platAlarmCheckDTO.setParam(param);
PlatAlarmRecord platAlarmRecord = platAlarmRecordService.createPlatAlarmRecord(platAlarmCheckDTO);
platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(),platAlarmRecord);
}
}
}
package com.makeit.service.platform.alarm.alarmStrategy;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSONObject;
import com.makeit.dto.platform.alarm.PlatAlarmCheckDTO;
import com.makeit.dto.platform.alarm.PlatAlarmConfigHeartDTOVO;
......@@ -40,7 +41,7 @@ public class HeartAlarm implements IAlarm {
if (StringUtils.isBlank(ruleConfigStr)) {
return;
}
String personState = (String) properties.get("personState");
String personState = Convert.toStr(properties.get("personState"));
//心率
int hr = (int) properties.get("hr");
PlatAlarmConfigHeartDTOVO ruleConfig = JsonUtil.toObj(ruleConfigStr, PlatAlarmConfigHeartDTOVO.class);
......
......@@ -229,7 +229,7 @@ implements PlatRoleService {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR);
}
PlatRole role = getById(dto.getId());
role.setStatus(dto.getStatus());
updateById(role);
}
......
......@@ -51,8 +51,8 @@ public class AlarmConfigCacheUtil implements ApplicationRunner {
});
}
public PlatAlarmConfig get(String orgIdType) {
return RedisUtil.get(RedisConst.ALARM_CONFIG_ORG_ID+orgIdType);
public PlatAlarmConfig get(String orgId,String alarmType) {
return RedisUtil.get(RedisConst.ALARM_CONFIG_ORG_ID+orgId+":"+alarmType);
}
......@@ -70,19 +70,17 @@ public class AlarmConfigCacheUtil implements ApplicationRunner {
}
public List<PlatAlarmConfig> getDeviceAlarmConfigMap(PlatDevice platDevice) {
List<PlatAlarmConfig> set = new ArrayList<>();
if (StringUtils.equals(platDevice.getCategory(), PlatDeviceEnum.CategoryEnum.HEART.getValue())) {
List<PlatAlarmConfig> set = new ArrayList<>();
set.add(this.get(platDevice.getOrgId() + PlatAlarmConfigEnum.AlarmTypeEnum.BREATHE.getValue()));
set.add(this.get(platDevice.getOrgId() + PlatAlarmConfigEnum.AlarmTypeEnum.HEART.getValue()));
set.add(this.get(platDevice.getOrgId() ,PlatAlarmConfigEnum.AlarmTypeEnum.BREATHE.getValue()));
set.add(this.get(platDevice.getOrgId() , PlatAlarmConfigEnum.AlarmTypeEnum.HEART.getValue()));
}
if (StringUtils.equals(platDevice.getCategory(), PlatDeviceEnum.CategoryEnum.FALL.getValue())) {
List<PlatAlarmConfig> set = new ArrayList<>();
set.add(this.get(platDevice.getOrgId() + PlatAlarmConfigEnum.AlarmTypeEnum.FALL.getValue()));
set.add(this.get(platDevice.getOrgId() , PlatAlarmConfigEnum.AlarmTypeEnum.FALL.getValue()));
}
if (StringUtils.equals(platDevice.getCategory(), PlatDeviceEnum.CategoryEnum.SPACE.getValue())) {
List<PlatAlarmConfig> set = new ArrayList<>();
set.add(this.get(platDevice.getOrgId() + PlatAlarmConfigEnum.AlarmTypeEnum.BEHAVIOR.getValue()));
set.add(this.get(platDevice.getOrgId() , PlatAlarmConfigEnum.AlarmTypeEnum.BEHAVIOR.getValue()));
}
return new ArrayList<>();
return set ;
}
}
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