Commit 93e09be4 by 朱淼
parents 93fddd61 a8b90e59
Showing with 703 additions and 159 deletions
......@@ -103,3 +103,21 @@ CREATE TABLE `plat_role_org` (
KEY `plat_role_iorg_id_index` (`org_id`),
KEY `plat_role_role_id_index` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPACT COMMENT='租户端角色部门关联表';
CREATE TABLE `plat_logo_config` (
`id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'id',
`tenant_id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci NOT NULL COMMENT '租户id',
`name` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '名称',
`code` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '编码',
`logo_file_id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'logo文件ID',
`browser_file_id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '浏览器页签文件Id',
`background_file_id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '登录背景图片',
`create_date` datetime NOT NULL COMMENT '创建时间',
`update_date` datetime NOT NULL COMMENT '更新时间',
`del_flag` CHAR ( 1 ) DEFAULT NULL COMMENT '删除标识',
`create_by` VARCHAR ( 64 ) NOT NULL COMMENT '创建人',
`update_by` VARCHAR ( 64 ) NOT NULL COMMENT '更新人',
PRIMARY KEY ( `id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT COMMENT = '系统配置表';
\ No newline at end of file
package com.makeit.controller.plat;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.module.admin.dto.plat.PlatMenuDTOVO;
import com.makeit.module.admin.dto.plat.PlatMenuQueryDTO;
import com.makeit.service.saas.PlatMenuService;
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;
import java.util.List;
@Api(tags = "平台端-菜单")
@RestController
@RequestMapping("/plat/menu")
public class PlatMenuController {
@Autowired
private PlatMenuService platMenuService;
@ApiOperation("树形列表")
@PostMapping("tree")
public ApiResponseEntity<List<PlatMenuDTOVO>> treeAuthIgnore(@RequestBody PlatMenuQueryDTO dto){
return ApiResponseUtils.success(platMenuService.tree(dto));
}
}
......@@ -9,13 +9,16 @@ import com.makeit.common.page.PageVO;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.common.vo.ExcelImportVo;
import com.makeit.dto.platform.auth.PlatUserImportDTO;
import com.makeit.enums.CodeMessageEnum;
import com.makeit.enums.FileSuffixEnum;
import com.makeit.exception.BusinessException;
import com.makeit.global.annotation.Action;
import com.makeit.module.admin.dto.plat.PlatUserDTOVO;
import com.makeit.module.admin.dto.plat.PlatUserQueryDTO;
import com.makeit.module.admin.vo.plat.PlatUserLoginVO;
import com.makeit.service.platform.auth.PlatUserService;
import com.makeit.utils.data.excel.ExcelUtil;
import com.makeit.vo.platform.auth.PlatPersonDTOVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -28,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
......@@ -167,5 +171,14 @@ public class PlatUserController {
ExcelImportVo excelImportVo = platUserService.importExcel(excelFile);
return ApiResponseUtils.success(excelImportVo);
}
@ApiOperation("导出模板")
@PostMapping("exportExcelTemplate")
public ApiResponseEntity<Void> exportExcelTemplate(HttpServletResponse response) {
ExcelUtil.exportTemplate(response, "人员管理导入模板" + FileSuffixEnum.EXCEL.getSuffix(), "默认", PlatUserImportDTO.class);
return ApiResponseUtils.success();
}
}
package com.makeit.controller.sys;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.module.system.dto.ChinaAreaDTO;
import com.makeit.module.system.entity.ChinaArea;
import com.makeit.module.system.service.ChinaAreaService;
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;
import java.util.List;
/**
* <p>
* 省市区表 前端控制器
* </p>
*
* @author ywc
* @since 2021-06-09
*/
@Api(tags = "租户端-省市区")
@RestController
@RequestMapping("/sys/china-area")
public class SaasChinaAreaController {
@Autowired
private ChinaAreaService chinaAreaService;
@ApiOperation(value = "列表", notes = "列表")
@PostMapping("list")
public ApiResponseEntity<List<ChinaArea>> list(@RequestBody ChinaAreaDTO dto) {
return ApiResponseUtils.success(chinaAreaService.list(dto));
}
@ApiOperation(value = "树形列表", notes = "树形列表")
@PostMapping("tree")
public ApiResponseEntity<List<ChinaArea>> tree(@RequestBody ChinaAreaDTO dto) {
List<ChinaArea> list = chinaAreaService.tree(dto);
return ApiResponseUtils.success(list);
}
@ApiOperation(value = "树形列表-有深度", notes = "树形列表-有深度")
@PostMapping("treeDepth")
public ApiResponseEntity<List<ChinaArea>> treeDepth(@RequestBody ChinaAreaDTO dto) {
if (dto.getDepth() == null) {
dto.setDepth(1);
}
List<ChinaArea> list = chinaAreaService.treeDepth(dto);
return ApiResponseUtils.success(list);
}
}
......@@ -92,6 +92,10 @@ public class RedisConst {
public static final String TENANT_PREFIX = "tenant:";
public static final String ALARM_DEVICE_ID = "alarm:device:id:";
public static final String ALARM_CONFIG_ORG_ID = "alarm:config:org:id";
......
......@@ -7,11 +7,12 @@ import lombok.Getter;
@AllArgsConstructor
@Getter
public enum DeviceState {
notActive("禁用"),
offline("离线"),
online("在线");
notActive("notActive","禁用"),
offline("offline","离线"),
online("online","在线");
private final String text;
private final String value;
private final String name;
}
......@@ -7,10 +7,11 @@ import lombok.Getter;
@AllArgsConstructor
@Getter
public enum DeviceType {
device("直连设备"),
childrenDevice("网关子设备"),
gateway("网关设备");
device("device","直连设备"),
childrenDevice("device","网关子设备"),
gateway("gateway","网关设备");
private final String value;
private final String text;
......
package com.makeit.module.iot.mqtt;
import com.alibaba.fastjson.JSON;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class PushCallback implements MqttCallback {
private static final Logger logger = LoggerFactory.getLogger(MqttPushClient.class);
@Autowired
private MqttConfig mqttConfig;
private static MqttClient client;
@Override
public void connectionLost(Throwable cause) {
logger.info("连接断开,可以重连");
if (client == null || !client.isConnected()) {
mqttConfig.getMqttPushClient();
}
}
@Override
public void messageArrived(String topic, MqttMessage message) throws Exception {
// 收到消息并设置返回字符串格式
String payload = new String(message.getPayload(), "UTF-8");
//logger.info("接收消息主题:{}, 接收消息QoS:{}", topic, message.getQos());
//logger.info("接收消息内容:payload格式:{}", payload);
// 解析数据
DeviceInfo device = JSON.parseObject(payload, DeviceInfo.class);
// todo
}
@Override
public void deliveryComplete(IMqttDeliveryToken token) {
logger.info("deliveryComplete--------------" + token.isComplete());
}
}
......@@ -67,6 +67,19 @@ public class IotProductDeviceService extends IotCommonService {
/**
* 获取最新的一条设备属性上报的数据
* @param deviceId
* @param typeValue 类型
*
* 可以传 :reportProperty
* @return
*/
public DeviceOperationLogEntity getLastDeviceLogByType(String deviceId,String typeValue) {
List<DeviceOperationLogEntity> deviceOperationLogEntities = getDeviceLog(deviceId, 1, typeValue);
return CollectionUtils.isNotEmpty(deviceOperationLogEntities) ? deviceOperationLogEntities.get(0) : null;
}
/**
*
* 根据类型查询设备日志
* text: "事件上报", value: "event"}
......
......@@ -36,23 +36,5 @@ public class MsgSendDTO {
this.param = param;
}
private void replaceParam(){
if(StringUtils.isNotBlank(sendContent)){
return;
}
Pattern p = Pattern.compile("\\[#\\d+\\]|\\[#[\\p{IsHan}]+\\]|\\[#[^\\]]*\\]");
Matcher m = p.matcher(oriContent);
StringBuffer sb = new StringBuffer();
if(!m.find()){
sendContent= oriContent;
}
m.reset();
int i = 0;
while (m.find()) {
m.appendReplacement(sb, param[i]);
i++;
}
m.appendTail(sb);
sendContent=sb.toString();
}
}
......@@ -367,4 +367,6 @@ public class RedisUtil {
public void setProjectName(String projectName) {
RedisUtil.projectName = projectName;
}
}
......@@ -50,9 +50,9 @@ public class JoinUtil {
join(list, service, null, getNidList, getMid, consumerList);
}
public static <T, M extends BaseEntity> void join(List<T> list, IService<M> service, List<Function<T, String>> getNidList, List<BiConsumer<T, M>> consumerList) {
join(list, service, null, getNidList, BaseEntity::getId, consumerList);
}
// public static <T, M extends BaseEntity> void join(List<T> list, IService<M> service, List<Function<T, String>> getNidList, List<BiConsumer<T, M>> consumerList) {
// join(list, service, null, getNidList, BaseEntity::getId, consumerList);
// }
public static <T, M> void join(List<T> list, IService<M> service, Consumer<LambdaQueryWrapper<M>> extQuery, List<Function<T, String>> getNidList, SFunction<M, String> getMid, List<BiConsumer<T, M>> consumerList) {
if (list.isEmpty()) {
......@@ -81,9 +81,9 @@ public class JoinUtil {
join(list, service, null, getNid, getMid, consumer);
}
public static <T, M extends BaseEntity> void join(List<T> list, IService<M> service, Function<T, String> getNid, BiConsumer<T, M> consumer) {
join(list, service, null, getNid, BaseEntity::getId, consumer);
}
// public static <T, M extends BaseEntity> void join(List<T> list, IService<M> service, Function<T, String> getNid, BiConsumer<T, M> consumer) {
// join(list, service, null, getNid, BaseEntity::getId, consumer);
// }
public static <T, M> void join(List<T> list, IService<M> service, Consumer<LambdaQueryWrapper<M>> extQuery, Function<T, String> getNid, SFunction<M, String> getMid, BiConsumer<T, M> consumer) {
if (list.isEmpty()) {
......
......@@ -71,7 +71,7 @@ public class PlatUserUtil {
public static PlatUserVO getSystemUser() {
PlatUserVO platUserVO = new PlatUserVO();
platUserVO.setId("1");
platUserVO.setName("system");
platUserVO.setUsername("system");
//tntUserVO.setTenantId();
platUserVO.setIsTenant(CommonEnum.NO.getValue());
......
......@@ -11,8 +11,8 @@ import java.util.function.BiConsumer;
@Data
public class PlatUserVO implements Serializable {
private String id;
private String name;
// private String username;
private String username;
private String tenantId;
......@@ -40,12 +40,12 @@ public class PlatUserVO implements Serializable {
public PlatUserVO(String id, String name, String tenantId) {
this.id = id;
this.tenantId = tenantId;
this.name = name;
this.username = name;
}
public PlatUserVO(String id, String name) {
this.id = id;
this.name = name;
this.username = name;
}
......
......@@ -41,7 +41,19 @@ public class PlatElderReportDayController {
@ApiOperation("心率呼吸评价")
@PostMapping("heartRespiratoryEvaluation")
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationVO>> heartRespiratoryEvaluation(@RequestBody PlatElderIdDTO platElderIdDTO) {
public ApiResponseEntity<PlatElderHeartRespiratoryEvaluationVO> heartRespiratoryEvaluation(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null;
}
@ApiOperation("心率异常记录")
@PostMapping("heartExceptionRecordList")
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> heartExceptionRecordList(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null;
}
@ApiOperation("呼吸率异常记录")
@PostMapping("respiratoryExceptionRecordList")
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> respiratoryExceptionRecordList(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null;
}
......
package com.makeit.module.controller.elder;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.dto.platform.elder.PlatElderIdDTO;
import com.makeit.vo.platform.elder.report.day.PlatElderHeartRespiratoryEvaluationVO;
import com.makeit.vo.platform.elder.report.day.PlatElderReportMonthVO;
import com.makeit.vo.platform.elder.report.day.PlatElderSleepEvaluationVO;
import com.makeit.vo.platform.elder.report.week.PlatElderComprehensiveEvaluationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;
/**
* <p>
* 长者基本信息 前端控制器
* </p>
*
* @author eugene young
* @since 2023-08-29
*/
@Api(tags = "长者报告-周报")
@RestController
@RequestMapping("/plat/elder/report/month")
public class PlatElderReportMonthController {
@ApiOperation("综合评价")
@PostMapping("comprehensiveEvaluation")
public ApiResponseEntity<PlatElderComprehensiveEvaluationVO> comprehensiveEvaluation(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null;
}
@ApiOperation("睡眠评价")
@PostMapping("sleepEvaluation")
public ApiResponseEntity<PlatElderSleepEvaluationVO> sleepEvaluation(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null;
}
@ApiOperation("心率呼吸评价")
@PostMapping("heartRespiratoryEvaluation")
public ApiResponseEntity<PlatElderHeartRespiratoryEvaluationVO> heartRespiratoryEvaluation(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null;
}
@ApiOperation("月报表")
@PostMapping("reportMonth")
public ApiResponseEntity<PlatElderReportMonthVO> reportMonth(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null;
}
}
......@@ -6,6 +6,7 @@ import com.makeit.dto.platform.elder.PlatElderIdDTO;
import com.makeit.vo.platform.elder.realtime.PlatElderRealTimeHeartRespiratoryVO;
import com.makeit.vo.platform.elder.report.week.PlatElderComprehensiveEvaluationVO;
import com.makeit.vo.platform.elder.report.day.*;
import com.makeit.vo.platform.elder.report.week.PlatElderRealTimeHeartRespiratoryWeekVO;
import com.makeit.vo.platform.elder.report.week.PlatElderSleepDiagramWeekVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -49,13 +50,25 @@ public class PlatElderReportWeekController {
@ApiOperation("心率呼吸评价")
@PostMapping("heartRespiratoryEvaluation")
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationVO>> heartRespiratoryEvaluation(@RequestBody PlatElderIdDTO platElderIdDTO) {
public ApiResponseEntity<PlatElderHeartRespiratoryEvaluationVO> heartRespiratoryEvaluation(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null;
}
@ApiOperation("心率异常记录")
@PostMapping("heartExceptionRecordList")
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> heartExceptionRecordList(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null;
}
@ApiOperation("呼吸率异常记录")
@PostMapping("respiratoryExceptionRecordList")
public ApiResponseEntity<List<PlatElderHeartRespiratoryEvaluationRecordVO>> respiratoryExceptionRecordList(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null;
}
@ApiOperation("心率呼吸率")
@PostMapping("heartRespiratory")
public ApiResponseEntity<PlatElderRealTimeHeartRespiratoryVO> heartRespiratory(@RequestBody PlatElderIdDTO platElderIdDTO) {
public ApiResponseEntity<PlatElderRealTimeHeartRespiratoryWeekVO> heartRespiratory(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null;
}
......
package com.makeit.module.controller.sys;
import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.device.PlatDeviceDTO;
import com.makeit.dto.platform.space.PlatSpaceDeviceQueryDTO;
import com.makeit.dto.platform.sys.PlatLogoConfigDTO;
import com.makeit.dto.platform.sys.PlatLogoConfigDTOVO;
import com.makeit.dto.platform.sys.PlatLogoConfigQueryDTO;
import com.makeit.enums.CommonEnum;
import com.makeit.service.platform.sys.PlatLogoConfigService;
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;
/**
* @Author:lzy
* @Date:2023/9/12 10:41
* @Describe:
*/
@Api(tags = "LOGO设置")
@RestController
@RequestMapping("/plat/sys/logo/config/")
public class PlatLogoConfigController {
@Autowired
private PlatLogoConfigService platLogoConfigService;
@ApiOperation("设置LOGO")
@PostMapping("add")
public ApiResponseEntity<?> add(@RequestBody PlatLogoConfigDTO dto) {
platLogoConfigService.add(dto);
return ApiResponseUtils.success();
}
@ApiOperation("查看")
@PostMapping("view")
public ApiResponseEntity<PlatLogoConfigDTOVO> view(@RequestBody PlatLogoConfigQueryDTO dto) {
PlatLogoConfigDTOVO data = platLogoConfigService.view(dto);
return ApiResponseUtils.success(data);
}
}
package com.makeit.dto.platform.alarm;
import com.makeit.entity.platform.elder.PlatElder;
import com.makeit.entity.platform.space.PlatRoom;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class PlatAlaramCheckDTO {
private List<PlatElder> platElderList = new ArrayList<>();
private PlatRoom platRoom;
}
package com.makeit.dto.platform.sys;
import com.makeit.common.dto.BaseIdDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author:lzy
* @Date:2023/9/12 10:23
* @Describe:
*/
@Data
@ApiModel("LOGO配置")
public class PlatLogoConfigDTO extends BaseIdDTO {
@ApiModelProperty("系统名称")
private String name;
@ApiModelProperty("LOGO文件ID")
private String logoFileId;
@ApiModelProperty("浏览器文件ID")
private String browserFileId;
@ApiModelProperty("背景图片ID")
private String backgroundFileId;
@ApiModelProperty("编码")
private String code;
}
package com.makeit.dto.platform.sys;
import com.makeit.common.dto.BaseIdDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author:lzy
* @Date:2023/9/12 10:25
* @Describe:
*/
@Data
@ApiModel("LOGO配置 PlatLogoConfigDTOVO")
public class PlatLogoConfigDTOVO extends BaseIdDTO {
@ApiModelProperty("系统名称")
private String name;
@ApiModelProperty("LOGO文件ID")
private String logoFileId;
@ApiModelProperty("LOGO文件地址")
private String logoFilePath;
@ApiModelProperty("浏览器文件ID")
private String browserFileId;
@ApiModelProperty("浏览器文件地址")
private String browserFilePath;
@ApiModelProperty("背景图片ID")
private String backgroundFileId;
@ApiModelProperty("背景图片地址")
private String backgroundFilePath;
@ApiModelProperty("编码")
private String code;
}
package com.makeit.dto.platform.sys;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author:lzy
* @Date:2023/9/12 11:22
* @Describe:
*/
@Data
@ApiModel("参数")
public class PlatLogoConfigQueryDTO {
@ApiModelProperty("code")
private String code;
}
package com.makeit.entity.platform.device;
import com.makeit.common.entity.BaseBusEntity;
import com.makeit.module.iot.enums.DeviceState;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -47,7 +48,10 @@ public class PlatDevice extends BaseBusEntity {
@ApiModelProperty(value = "说明")
private String description;
@ApiModelProperty(value = "状态 数据字典 1 在线 0离线")
/**
* @see DeviceState
*/
@ApiModelProperty(value = "状态 数据字典 1 在线 0离线 ")
private String status;
@ApiModelProperty(value = "组织id")
......
package com.makeit.entity.platform.sys;
import com.makeit.common.entity.BaseBusEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @Author:lzy
* @Date:2023/9/12 10:05
* @Describe:
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "PlatLogoConfig对象", description = "LOGO配置")
public class PlatLogoConfig extends BaseBusEntity {
@ApiModelProperty("系统名称")
private String name;
@ApiModelProperty("LOGO文件ID")
private String logoFileId;
@ApiModelProperty("浏览器文件ID")
private String browserFileId;
@ApiModelProperty("背景图片ID")
private String backgroundFileId;
@ApiModelProperty("code")
private String code;
}
package com.makeit.mapper.platform.sys;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.makeit.entity.platform.sys.PlatLogoConfig;
/**
* @Author:lzy
* @Date:2023/9/12 10:21
* @Describe:
*/
public interface PlatLogoConfigMapper extends BaseMapper<PlatLogoConfig> {
}
......@@ -155,6 +155,8 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
/**
* 设备告警调用 发送消息
*
* todo 异步
*/
@Transactional
@Override
......
......@@ -9,13 +9,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.common.entity.BaseEntity;
import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
import com.makeit.entity.platform.alarm.PlatAlarmConfig;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.auth.PlatRole;
import com.makeit.entity.platform.auth.PlatRoleOrg;
import com.makeit.entity.platform.auth.PlatUserRole;
import com.makeit.enums.CommonEnum;
import com.makeit.enums.id.TreeConst;
import com.makeit.exception.BusinessException;
import com.makeit.global.aspect.tenant.TenantIdUtil;
import com.makeit.mapper.platform.auth.PlatOrgMapper;
import com.makeit.service.platform.alarm.PlatAlarmConfigService;
......@@ -273,7 +273,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
@Transactional
@Override
public String add(PlatOrg dto) {
check(dto);
dto.setTenantId(TenantIdUtil.getTenantId());
if (StringUtils.isBlank(dto.getParentId())) {
String tenantId = TenantIdUtil.getTenantId();
......@@ -287,10 +287,20 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
return dto.getId();
}
private void check(PlatOrg dto) {
LambdaQueryWrapper<PlatOrg> platOrgLambdaQueryWrapper = new LambdaQueryWrapper<>();
platOrgLambdaQueryWrapper.eq(PlatOrg::getParentId, dto.getParentId())
.eq(StringUtils.isNotBlank(dto.getId()),PlatOrg::getName, dto.getName())
.eq(PlatOrg::getName, dto);
if(count(platOrgLambdaQueryWrapper)>0){
throw new BusinessException("名称重复");
}
}
@Transactional
@Override
public void edit(PlatOrg dto) {
check(dto);
if (StringUtils.isBlank(dto.getParentId())||StringUtils.equals(dto.getParentId(),"1")) {
String tenantId = TenantIdUtil.getTenantId();
dto.setParentId(tenantId);
......@@ -443,7 +453,11 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
public List<PlatOrg> createOrgTree(List<PlatOrg> orgList) {
Map<String, PlatOrg> orgMap = orgList.stream().collect(Collectors.toMap(BaseEntity::getId, vo -> vo, (a, b) -> a));
for (PlatOrg platOrg : orgList) {
String[] split = platOrg.getPath().split(",");
String path = platOrg.getPath();
if(StringUtils.isBlank(path)){
continue;
}
String[] split = path.split(",");
findParent(orgMap,platOrg,split,split.length-1);
}
return orgList.stream().filter(vo->StringUtils.isBlank(vo.getParentNodeId())).collect(Collectors.toList());
......@@ -504,7 +518,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
private LambdaQueryWrapper<PlatOrg> getLambdaQueryWrapper(PlatOrgQueryDTO dto) {
LambdaQueryWrapper<PlatOrg> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PlatOrg::getParentId, dto.getParentId())
queryWrapper.eq(StringUtils.isNotBlank(dto.getParentId()), PlatOrg::getParentId, dto.getParentId())
.orderByDesc(BaseEntity::getUpdateDate);
return queryWrapper;
}
......@@ -512,9 +526,23 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
@Override
public List<PlatOrg> subOrgList(PlatOrgQueryDTO platOrgQueryDTO) {
LambdaQueryWrapper<PlatOrg> queryWrapper = getLambdaQueryWrapper(platOrgQueryDTO);
List<PlatOrg> list = list(queryWrapper);
List<PlatOrg> orgTree = createOrgTree2(list);
return orgTree;
}
private List<PlatOrg> createOrgTree2(List<PlatOrg> orgList){
if(CollectionUtils.isEmpty(orgList)){
return new ArrayList<>();
}
Map<String, List<PlatOrg>> parentMap = orgList.stream().collect(Collectors.groupingBy(PlatOrg::getParentId));
orgList.forEach(vo->{
vo.setChildren(parentMap.get(vo.getId()));
});
return list(queryWrapper);
return orgList.stream().filter(vo->StringUtils.equals(vo.getParentId(),"1")).collect(Collectors.toList());
}
/**
......@@ -523,6 +551,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
* @param platOrg
*/
@Override
@Transactional
public void saveOrg(PlatOrg platOrg) {
save(platOrg);
......
......@@ -787,8 +787,8 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
user.setAccount(dto.getMobile());
PlatOrg platOrg = platOrgService.getById(dto.getId());
user.setOrgPath(platOrg.getPath()+","+platOrg.getId());
fillOrgPath(dto, user);
save(user);
dto.setId(user.getId());
setRoleList(dto);
......@@ -796,6 +796,13 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
return user.getId();
}
private void fillOrgPath(PlatPersonDTOVO dto, PlatUser user) {
PlatOrg platOrg = platOrgService.getById(dto.getId());
if(platOrg!=null) {
user.setOrgPath(platOrg.getPath() + "," + platOrg.getId());
}
}
@Transactional
@Override
......@@ -807,8 +814,8 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
setPassword(user);
PlatOrg platOrg = platOrgService.getById(dto.getId());
user.setOrgPath(platOrg.getPath()+","+platOrg.getId());
fillOrgPath(dto, user);
updateById(user);
setRoleList(dto);
}
......
......@@ -72,12 +72,12 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
List<PlatDeviceListVO> voList = BeanDtoVoUtils.listVo(page.getRecords(), PlatDeviceListVO.class);
JoinUtil.join(voList, platOrgService, PlatDeviceListVO::getOrgId, (d, o) -> {
JoinUtil.join(voList, platOrgService, PlatDeviceListVO::getOrgId, PlatOrg::getId, (d, o) -> {
d.setOrgName(o.getName());
});
JoinUtil.joinSplit(voList, platOrgService, PlatDeviceListVO::getOrgPath, (d, o) -> {
d.setOrgName(StreamUtil.join(o, PlatOrg::getName));
JoinUtil.joinSplit(voList, platOrgService, PlatDeviceListVO::getOrgPath, PlatOrg::getId, (d, o) -> {
d.setOrgPathName(StreamUtil.join(o, PlatOrg::getName));
});
return PageUtil.toPageVO(voList, page);
......
......@@ -62,12 +62,12 @@ public class PlatElderChildrenInfoServiceImpl extends ServiceImpl<PlatElderChild
c.setElderName(StreamUtil.join(e, PlatElder::getName));
});
JoinUtil.join(voList, platOrgService, PlatElderChildrenInfoListVO::getOrgId, (d, o) -> {
JoinUtil.join(voList, platOrgService, PlatElderChildrenInfoListVO::getOrgId, PlatOrg::getId, (d, o) -> {
d.setOrgName(o.getName());
});
JoinUtil.joinSplit(voList, platOrgService, PlatElderChildrenInfoListVO::getOrgPath, (d, o) -> {
d.setOrgName(StreamUtil.join(o, PlatOrg::getName));
JoinUtil.joinSplit(voList, platOrgService, PlatElderChildrenInfoListVO::getOrgPath, PlatOrg::getId, (d, o) -> {
d.setOrgPathName(StreamUtil.join(o, PlatOrg::getName));
});
}
......
......@@ -116,23 +116,23 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
List<PlatElderListVO> list = BeanDtoVoUtils.listVo(voList, PlatElderListVO.class);
JoinUtil.join(list, platOrgService, PlatElderListVO::getOrgId, (d, o) -> {
JoinUtil.join(list, platOrgService, PlatElderListVO::getOrgId, PlatOrg::getId, (d, o) -> {
d.setOrgName(o.getName());
});
JoinUtil.joinSplit(list, platOrgService, PlatElderListVO::getOrgPath, (d, o) -> {
d.setOrgName(StreamUtil.join(o, PlatOrg::getName));
JoinUtil.joinSplit(list, platOrgService, PlatElderListVO::getOrgPath, PlatOrg::getId, (d, o) -> {
d.setOrgPathName(StreamUtil.join(o, PlatOrg::getName));
});
JoinUtil.joinSplit(list, platSpaceService, PlatElderListVO::getSpacePath, (e, l) -> {
JoinUtil.joinSplit(list, platSpaceService, PlatElderListVO::getSpacePath, PlatSpace::getId, (e, l) -> {
e.setSpacePathName(StreamUtil.join(l, Objects::nonNull, PlatSpace::getName));
});
JoinUtil.joinSplit(list, platRoomService, PlatElderListVO::getSpacePath, (e, l) -> {
JoinUtil.joinSplit(list, platRoomService, PlatElderListVO::getSpacePath, PlatRoom::getId, (e, l) -> {
e.setSpacePathName(e.getSpacePathName() + "," + StreamUtil.join(l, Objects::nonNull, PlatRoom::getName));
});
JoinUtil.joinSplit(list, platBedService, PlatElderListVO::getSpacePath, (e, l) -> {
JoinUtil.joinSplit(list, platBedService, PlatElderListVO::getSpacePath, PlatBed::getId, (e, l) -> {
e.setSpacePathName(e.getSpacePathName() + "," + StreamUtil.join(l, Objects::nonNull, PlatBed::getName));
});
......@@ -142,7 +142,7 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
PlatElderListVO::getBuildingSpaceId,
PlatElderListVO::getUnitSpaceId,
PlatElderListVO::getFloorSpaceId
), Arrays.asList(
), PlatSpace::getId, Arrays.asList(
(e, s) -> e.setSpaceName(s.getName()),
(e, s) -> e.setStreetSpaceName(s.getName()),
(e, s) -> e.setBuildingSpaceName(s.getName()),
......@@ -150,11 +150,11 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
(e, s) -> e.setFloorSpaceName(s.getName())
));
JoinUtil.join(list, platRoomService, PlatElderListVO::getRoomId, (e, l) -> {
JoinUtil.join(list, platRoomService, PlatElderListVO::getRoomId, PlatRoom::getId, (e, l) -> {
e.setRoomName(l.getName());
});
JoinUtil.join(list, platBedService, PlatElderListVO::getBedId, (e, l) -> {
JoinUtil.join(list, platBedService, PlatElderListVO::getBedId, PlatBed::getId, (e, l) -> {
e.setBedName(l.getName());
});
......@@ -207,18 +207,18 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
PlatElderExportVO::getBuildingSpaceId,
PlatElderExportVO::getUnitSpaceId,
PlatElderExportVO::getFloorSpaceId
), Arrays.asList(
), PlatSpace::getId, Arrays.asList(
(e, s) -> e.setStreetSpaceName(s.getName()),
(e, s) -> e.setBuildingSpaceName(s.getName()),
(e, s) -> e.setUnitSpaceName(s.getName()),
(e, s) -> e.setFloorSpaceName(s.getName())
));
JoinUtil.join(list, platRoomService, PlatElderExportVO::getRoomId, (e, l) -> {
JoinUtil.join(list, platRoomService, PlatElderExportVO::getRoomId, PlatRoom::getId, (e, l) -> {
e.setRoomName(l.getName());
});
JoinUtil.join(list, platBedService, PlatElderExportVO::getBedId, (e, l) -> {
JoinUtil.join(list, platBedService, PlatElderExportVO::getBedId, PlatBed::getId, (e, l) -> {
e.setBedName(l.getName());
});
......@@ -558,15 +558,15 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
List<PlatElderDTOVO> list = Arrays.asList(vo);
JoinUtil.joinSplit(list, platSpaceService, PlatElderDTOVO::getSpacePath, (e, l) -> {
JoinUtil.joinSplit(list, platSpaceService, PlatElderDTOVO::getSpacePath, PlatSpace::getId, (e, l) -> {
e.setSpacePathName(StreamUtil.join(l, Objects::nonNull, PlatSpace::getName));
});
JoinUtil.joinSplit(list, platRoomService, PlatElderDTOVO::getSpacePath, (e, l) -> {
JoinUtil.joinSplit(list, platRoomService, PlatElderDTOVO::getSpacePath, PlatRoom::getId, (e, l) -> {
e.setSpacePathName(e.getSpacePathName() + "," + StreamUtil.join(l, Objects::nonNull, PlatRoom::getName));
});
JoinUtil.joinSplit(list, platBedService, PlatElderDTOVO::getSpacePath, (e, l) -> {
JoinUtil.joinSplit(list, platBedService, PlatElderDTOVO::getSpacePath, PlatBed::getId, (e, l) -> {
e.setSpacePathName(e.getSpacePathName() + "," + StreamUtil.join(l, Objects::nonNull, PlatBed::getName));
});
......@@ -576,7 +576,7 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
PlatElderDTOVO::getBuildingSpaceId,
PlatElderDTOVO::getUnitSpaceId,
PlatElderDTOVO::getFloorSpaceId
), Arrays.asList(
), PlatSpace::getId, Arrays.asList(
(e, s) -> e.setSpaceName(s.getName()),
(e, s) -> e.setStreetSpaceName(s.getName()),
(e, s) -> e.setBuildingSpaceName(s.getName()),
......@@ -584,11 +584,11 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
(e, s) -> e.setFloorSpaceName(s.getName())
));
JoinUtil.join(list, platRoomService, PlatElderDTOVO::getRoomId, (e, l) -> {
JoinUtil.join(list, platRoomService, PlatElderDTOVO::getRoomId, PlatRoom::getId, (e, l) -> {
e.setRoomName(l.getName());
});
JoinUtil.join(list, platBedService, PlatElderDTOVO::getBedId, (e, l) -> {
JoinUtil.join(list, platBedService, PlatElderDTOVO::getBedId, PlatBed::getId, (e, l) -> {
e.setBedName(l.getName());
});
......
......@@ -91,8 +91,8 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
Page<PlatDevice> p = PageUtil.toMpPage(pageReqDTO);
LambdaQueryWrapper<PlatDevice> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.notIn(PlatDevice::getId, listEquipmentIds);
queryWrapper.eq(PlatDevice::getCategory,dto.getCategory());
queryWrapper.notIn(!listEquipmentIds.isEmpty(),PlatDevice::getId, listEquipmentIds);
queryWrapper.eq(StringUtil.isNotEmpty(dto.getCategory()), PlatDevice::getCategory,dto.getCategory());
queryWrapper.like(StringUtil.isNotEmpty(dto.getOriDeviceId()), PlatDevice::getOriDeviceId, dto.getOriDeviceId());
queryWrapper.like(StringUtil.isNotEmpty(dto.getName()), PlatDevice::getName, dto.getName());
queryWrapper.like(StringUtil.isNotEmpty(dto.getProductName()), PlatDevice::getProductName, dto.getProductName());
......
package com.makeit.service.platform.sys;
import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.dto.platform.sys.PlatLogoConfigDTO;
import com.makeit.dto.platform.sys.PlatLogoConfigDTOVO;
import com.makeit.dto.platform.sys.PlatLogoConfigQueryDTO;
import com.makeit.entity.platform.sys.PlatLogoConfig;
/**
* @Author:lzy
* @Date:2023/9/12 10:19
* @Describe:
*/
public interface PlatLogoConfigService extends IService<PlatLogoConfig> {
/**
* 添加
* @param dto
*/
void add(PlatLogoConfigDTO dto);
/**
* 详情
* @return
*/
PlatLogoConfigDTOVO view(PlatLogoConfigQueryDTO dto);
}
package com.makeit.service.platform.sys.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.dto.platform.sys.PlatLogoConfigDTO;
import com.makeit.dto.platform.sys.PlatLogoConfigDTOVO;
import com.makeit.dto.platform.sys.PlatLogoConfigQueryDTO;
import com.makeit.entity.platform.sys.PlatLogoConfig;
import com.makeit.mapper.platform.sys.PlatLogoConfigMapper;
import com.makeit.module.system.dto.SysFileDTOVO;
import com.makeit.service.platform.sys.PlatLogoConfigService;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.sys.FileUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author:lzy
* @Date:2023/9/12 10:19
* @Describe:
*/
@Service
public class PlatLogoConfigServiceImpl extends ServiceImpl<PlatLogoConfigMapper, PlatLogoConfig> implements PlatLogoConfigService {
@Override
@Transactional(rollbackFor = Exception.class)
public void add(PlatLogoConfigDTO dto) {
PlatLogoConfig platLogoConfig = BeanDtoVoUtils.convert(dto,PlatLogoConfig.class);
if(dto.getId() != null){
updateById(platLogoConfig);
}else{
save(platLogoConfig);
}
}
@Override
public PlatLogoConfigDTOVO view(PlatLogoConfigQueryDTO dto) {
LambdaQueryWrapper<PlatLogoConfig> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PlatLogoConfig::getCode,dto.getCode());
List<PlatLogoConfig> list = list(queryWrapper);
PlatLogoConfigDTOVO data = new PlatLogoConfigDTOVO();
if(!list.isEmpty()){
data = BeanDtoVoUtils.convert(list.get(0),PlatLogoConfigDTOVO.class);
List<String> fileIds = new ArrayList<>();
fileIds.add(data.getLogoFileId());
fileIds.add(data.getBrowserFileId());
fileIds.add(data.getBackgroundFileId());
List<SysFileDTOVO> listFile = FileUtil.convert(fileIds);
Map<String,String> map = listFile.stream().collect(Collectors.toMap(SysFileDTOVO::getId,SysFileDTOVO::getFullUrl,(k1,k2)->k1));
data.setLogoFilePath(map.get(data.getLogoFileId()));
data.setBrowserFilePath(map.get(data.getBrowserFileId()));
data.setBackgroundFilePath(map.get(data.getBackgroundFileId()));
}
return data;
}
}
......@@ -8,6 +8,8 @@ import com.makeit.enums.CommonEnum;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.module.iot.service.IotOrgService;
import com.makeit.module.iot.vo.DeviceInstanceEntity;
import com.makeit.module.system.service.SysDictionaryCategoryService;
import com.makeit.module.system.vo.DictionaryVo;
import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.saas.PlatTenantService;
import lombok.extern.slf4j.Slf4j;
......@@ -35,6 +37,8 @@ public class IotSyncTask {
private PlatTenantService platTenantService;
@Autowired
private PlatDeviceService platDeviceService;
@Autowired
private SysDictionaryCategoryService sysDictionaryCategoryService;
/**
* 一小时同步一次
......@@ -47,14 +51,18 @@ public class IotSyncTask {
log.info("开始执行同步设备信息接口");
LambdaQueryWrapper<PlatTenant> tenantLambdaQueryWrapper = new LambdaQueryWrapper<PlatTenant>().eq(PlatTenant::getStatus, CommonEnum.YES.getValue());
List<PlatTenant> platTenants = platTenantService.list(tenantLambdaQueryWrapper);
List<DictionaryVo> dictionaryVos = sysDictionaryCategoryService.getByCategoryCode("device.category");
Map<String, String> dicNameIdMap = dictionaryVos.stream().collect(Collectors.toMap(DictionaryVo::getName, DictionaryVo::getValue, (v1, v2) -> v1));
for (PlatTenant platTenant : platTenants) {
String iotOrgId = platTenant.getIotOrgId();
if(StringUtils.isBlank(iotOrgId)){
if (StringUtils.isBlank(iotOrgId)) {
continue;
}
//查询iot设备
List<DeviceInstanceEntity> iotDeviceList = iotOrgService.getOrgDevice(iotOrgId);
if(CollectionUtils.isEmpty(iotDeviceList)){
if (CollectionUtils.isEmpty(iotDeviceList)) {
continue;
}
//查询平台设备
......@@ -63,7 +71,7 @@ public class IotSyncTask {
.in(PlatDevice::getOriDeviceId, iotDeviceIdSet);
List<PlatDevice> deviceList = platDeviceService.list(deviceLambdaQueryWrapper);
//更新平台设备
Collection<PlatDevice> platDevices = convertToPlatDevice(iotDeviceList, deviceList,platTenant.getId());
Collection<PlatDevice> platDevices = convertToPlatDevice(iotDeviceList, deviceList, platTenant.getId(), dicNameIdMap);
platDeviceService.saveOrUpdateBatch(platDevices);
}
......@@ -71,7 +79,7 @@ public class IotSyncTask {
}
@Scheduled(cron = "0 0/1 * * * ?")
@Scheduled(cron = "0 0 */1 * * ?")
public void syncDeviceLog() {
log.info("开始同步设备日志");
......@@ -80,28 +88,28 @@ public class IotSyncTask {
}
private Collection<PlatDevice> convertToPlatDevice(List<DeviceInstanceEntity> iotDeviceList, List<PlatDevice> deviceList,String tenantId){
private Collection<PlatDevice> convertToPlatDevice(List<DeviceInstanceEntity> iotDeviceList, List<PlatDevice> deviceList, String tenantId, Map<String, String> dicNameIdMap) {
Map<String, PlatDevice> deviceMap = deviceList.stream().collect(Collectors.toMap(PlatDevice::getOriDeviceId, v -> v, (a, b) -> a));
iotDeviceList.forEach(iotDevice->{
iotDeviceList.forEach(iotDevice -> {
PlatDevice platDevice = deviceMap.get(iotDevice.getId());
if(platDevice==null){
platDevice=new PlatDevice();
if (platDevice == null) {
platDevice = new PlatDevice();
platDevice.setTenantId(tenantId);
deviceMap.put(iotDevice.getId(),platDevice);
deviceMap.put(iotDevice.getId(), platDevice);
}
platDevice.setOriDeviceId(iotDevice.getId());
platDevice.setName(iotDevice.getName());
platDevice.setProductName(iotDevice.getProductName());
platDevice.setProductId(iotDevice.getProductId());
LocalDateTime registryTime = LocalDateTime.ofEpochSecond(iotDevice.getRegistryTime()/1000, 0, ZoneOffset.ofHours(8));
LocalDateTime registryTime = LocalDateTime.ofEpochSecond(iotDevice.getRegistryTime() / 1000, 0, ZoneOffset.ofHours(8));
platDevice.setRegistrationDate(registryTime);
platDevice.setDescription(iotDevice.getDescribe());
String state = iotDevice.getState();
platDevice.setStatus(StringUtils.equals("online",state)?CommonEnum.YES.getValue() : CommonEnum.NO.getValue());
platDevice.setStatus(state);
//todo 根据类型名称来匹配
// platDevice.setCategory();
platDevice.setCategory(dicNameIdMap.get(iotDevice.getProductName()));
// platDevice.setFirmwareVersion();
// platDevice.setLastOnlineData();
// platDevice.setOrgId();
......
......@@ -40,6 +40,8 @@ public class PlatPersonDTOVO extends BaseIdDTO {
@ApiModelProperty(value = "手机号")
private String mobile;
private String email;
@NotBlank(message = "状态不能为空")
@Pattern(regexp = "0|1", message = "状态可选值为 0禁用 1启用")
@ApiModelProperty(value = "状态 0禁用 1启用")
......
......@@ -23,10 +23,4 @@ public class PlatElderHeartRespiratoryEvaluationVO {
@ApiModelProperty("呼吸率")
private Integer respiratoryRate;
@ApiModelProperty("心率异常记录")
private List<PlatElderHeartRespiratoryEvaluationRecordVO> heartList;
@ApiModelProperty("呼吸率异常记录")
private List<PlatElderHeartRespiratoryEvaluationRecordVO> respiratoryList;
}
package com.makeit.vo.platform.elder.report.day;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
@Data
public class PlatElderReportMonthVO {
@ApiModelProperty("日期")
private LocalDate day;
@ApiModelProperty("睡眠结果")
private String sleepResult;
@ApiModelProperty("心率")
private Integer heartRate;
@ApiModelProperty("呼吸率")
private Integer respiratoryRate;
@ApiModelProperty("跌倒次数")
private Integer failCount;
@ApiModelProperty("心率异常次数")
private Integer heartExceptionCount;
@ApiModelProperty("呼吸异常次数")
private Integer respiratoryExceptionCount;
@ApiModelProperty("行为异常次数")
private Integer behaviorExceptionCount;
}
......@@ -9,7 +9,17 @@ public class PlatElderSleepEvaluationVO {
@ApiModelProperty("得分")
private Integer score;
@ApiModelProperty("结果")
private String result;
@ApiModelProperty("评价")
private String evaluation;
@ApiModelProperty(value = "睡眠时长")
private Integer sleepDuration;
@ApiModelProperty(value = "休息时长")
private Integer restDuration;
}
package com.makeit.module.iot.mqtt;
package com.makeit.mqtt;
import com.makeit.module.iot.service.IotTokenService;
import org.apache.commons.lang3.StringUtils;
......@@ -44,12 +44,10 @@ public class MqttConfig {
@Bean
public MqttPushClient getMqttPushClient() {
String iotToken = iotTokenService.getIotToken();
clientId = StringUtils.isNotEmpty(iotToken) ? iotToken : clientId;
clientId = StringUtils.isNotEmpty(clientId) ? clientId : iotTokenService.getIotToken();
mqttPushClient.connect(hostUrl, clientId, username, password, timeout, keepalive);
// 订阅主题
mqttPushClient.subscribe("/device/*/*/**", 0);
mqttPushClient.subscribe(defaultTopic, 0);
return mqttPushClient;
}
......
package com.makeit.module.iot.mqtt;
package com.makeit.mqtt;
import org.eclipse.paho.client.mqttv3.*;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
......@@ -85,7 +85,7 @@ public class MqttPushClient {
}
public void subscribe(String defaultTopic, int qos) {
logger.info("开始订阅主题" + defaultTopic);
logger.info("开始订阅主题:" + defaultTopic);
try {
MqttPushClient.getMqttClient().subscribe(defaultTopic, qos);
} catch (MqttException e) {
......
......@@ -115,8 +115,8 @@ mqtt:
username: admin|1693982115969
password: 8e3795ef7b5e95869fa8c323b865b3a9
hostUrl: tcp://124.71.33.17:11883
clientId: ab3a2fd694c8c838aba2686df3a80e7b
defaultTopic:
clientId:
defaultTopic: /device/*/*/**
timeout: 10
keepalive: 60
......
......@@ -112,8 +112,8 @@ mqtt:
username: admin|1693982115969
password: 8e3795ef7b5e95869fa8c323b865b3a9
hostUrl: tcp://124.71.33.17:11883
clientId: ab3a2fd694c8c838aba2686df3a80e7b
defaultTopic:
clientId:
defaultTopic: /device/*/*/**
timeout: 10
keepalive: 60
......
......@@ -59,7 +59,7 @@ public class IotTest {
@Test
void getLastDeviceLog() {
iotProductDeviceService.getLastDeviceLog("1694547143952007168");
iotProductDeviceService.getLastDeviceLog("1701127702523473920");
}
@Test
......
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