Commit 93e09be4 by 朱淼
parents 93fddd61 a8b90e59
Showing with 704 additions and 161 deletions
...@@ -102,4 +102,22 @@ CREATE TABLE `plat_role_org` ( ...@@ -102,4 +102,22 @@ CREATE TABLE `plat_role_org` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `plat_role_iorg_id_index` (`org_id`), KEY `plat_role_iorg_id_index` (`org_id`),
KEY `plat_role_role_id_index` (`role_id`) KEY `plat_role_role_id_index` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPACT COMMENT='租户端角色部门关联表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPACT COMMENT='租户端角色部门关联表';
\ No newline at end of file
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; ...@@ -9,13 +9,16 @@ 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.common.vo.ExcelImportVo; import com.makeit.common.vo.ExcelImportVo;
import com.makeit.dto.platform.auth.PlatUserImportDTO;
import com.makeit.enums.CodeMessageEnum; import com.makeit.enums.CodeMessageEnum;
import com.makeit.enums.FileSuffixEnum;
import com.makeit.exception.BusinessException; import com.makeit.exception.BusinessException;
import com.makeit.global.annotation.Action; import com.makeit.global.annotation.Action;
import com.makeit.module.admin.dto.plat.PlatUserDTOVO; import com.makeit.module.admin.dto.plat.PlatUserDTOVO;
import com.makeit.module.admin.dto.plat.PlatUserQueryDTO; import com.makeit.module.admin.dto.plat.PlatUserQueryDTO;
import com.makeit.module.admin.vo.plat.PlatUserLoginVO; import com.makeit.module.admin.vo.plat.PlatUserLoginVO;
import com.makeit.service.platform.auth.PlatUserService; import com.makeit.service.platform.auth.PlatUserService;
import com.makeit.utils.data.excel.ExcelUtil;
import com.makeit.vo.platform.auth.PlatPersonDTOVO; import com.makeit.vo.platform.auth.PlatPersonDTOVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -28,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -28,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
...@@ -167,5 +171,14 @@ public class PlatUserController { ...@@ -167,5 +171,14 @@ public class PlatUserController {
ExcelImportVo excelImportVo = platUserService.importExcel(excelFile); ExcelImportVo excelImportVo = platUserService.importExcel(excelFile);
return ApiResponseUtils.success(excelImportVo); 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 { ...@@ -92,6 +92,10 @@ public class RedisConst {
public static final String TENANT_PREFIX = "tenant:"; 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; ...@@ -7,11 +7,12 @@ import lombok.Getter;
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
public enum DeviceState { public enum DeviceState {
notActive("禁用"), notActive("notActive","禁用"),
offline("离线"), offline("offline","离线"),
online("在线"); online("online","在线");
private final String text; private final String value;
private final String name;
} }
...@@ -7,10 +7,11 @@ import lombok.Getter; ...@@ -7,10 +7,11 @@ import lombok.Getter;
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
public enum DeviceType { public enum DeviceType {
device("直连设备"), device("device","直连设备"),
childrenDevice("网关子设备"), childrenDevice("device","网关子设备"),
gateway("网关设备"); gateway("gateway","网关设备");
private final String value;
private final String text; 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 { ...@@ -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"} * text: "事件上报", value: "event"}
......
package com.makeit.module.iot.mqtt; package com.makeit.module.iot.vo;
import lombok.Data; import lombok.Data;
......
package com.makeit.module.iot.mqtt; package com.makeit.module.iot.vo;
import lombok.Data; import lombok.Data;
......
...@@ -36,23 +36,5 @@ public class MsgSendDTO { ...@@ -36,23 +36,5 @@ public class MsgSendDTO {
this.param = param; 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 { ...@@ -367,4 +367,6 @@ public class RedisUtil {
public void setProjectName(String projectName) { public void setProjectName(String projectName) {
RedisUtil.projectName = projectName; RedisUtil.projectName = projectName;
} }
} }
...@@ -50,9 +50,9 @@ public class JoinUtil { ...@@ -50,9 +50,9 @@ public class JoinUtil {
join(list, service, null, getNidList, getMid, consumerList); 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) { // 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); // 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) { 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()) { if (list.isEmpty()) {
...@@ -81,9 +81,9 @@ public class JoinUtil { ...@@ -81,9 +81,9 @@ public class JoinUtil {
join(list, service, null, getNid, getMid, consumer); 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) { // 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); // 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) { 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()) { if (list.isEmpty()) {
......
...@@ -71,7 +71,7 @@ public class PlatUserUtil { ...@@ -71,7 +71,7 @@ public class PlatUserUtil {
public static PlatUserVO getSystemUser() { public static PlatUserVO getSystemUser() {
PlatUserVO platUserVO = new PlatUserVO(); PlatUserVO platUserVO = new PlatUserVO();
platUserVO.setId("1"); platUserVO.setId("1");
platUserVO.setName("system"); platUserVO.setUsername("system");
//tntUserVO.setTenantId(); //tntUserVO.setTenantId();
platUserVO.setIsTenant(CommonEnum.NO.getValue()); platUserVO.setIsTenant(CommonEnum.NO.getValue());
......
...@@ -11,8 +11,8 @@ import java.util.function.BiConsumer; ...@@ -11,8 +11,8 @@ import java.util.function.BiConsumer;
@Data @Data
public class PlatUserVO implements Serializable { public class PlatUserVO implements Serializable {
private String id; private String id;
private String name;
// private String username; private String username;
private String tenantId; private String tenantId;
...@@ -40,12 +40,12 @@ public class PlatUserVO implements Serializable { ...@@ -40,12 +40,12 @@ public class PlatUserVO implements Serializable {
public PlatUserVO(String id, String name, String tenantId) { public PlatUserVO(String id, String name, String tenantId) {
this.id = id; this.id = id;
this.tenantId = tenantId; this.tenantId = tenantId;
this.name = name; this.username = name;
} }
public PlatUserVO(String id, String name) { public PlatUserVO(String id, String name) {
this.id = id; this.id = id;
this.name = name; this.username = name;
} }
......
...@@ -41,7 +41,19 @@ public class PlatElderReportDayController { ...@@ -41,7 +41,19 @@ public class PlatElderReportDayController {
@ApiOperation("心率呼吸评价") @ApiOperation("心率呼吸评价")
@PostMapping("heartRespiratoryEvaluation") @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; 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; ...@@ -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.realtime.PlatElderRealTimeHeartRespiratoryVO;
import com.makeit.vo.platform.elder.report.week.PlatElderComprehensiveEvaluationVO; import com.makeit.vo.platform.elder.report.week.PlatElderComprehensiveEvaluationVO;
import com.makeit.vo.platform.elder.report.day.*; 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 com.makeit.vo.platform.elder.report.week.PlatElderSleepDiagramWeekVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -49,13 +50,25 @@ public class PlatElderReportWeekController { ...@@ -49,13 +50,25 @@ public class PlatElderReportWeekController {
@ApiOperation("心率呼吸评价") @ApiOperation("心率呼吸评价")
@PostMapping("heartRespiratoryEvaluation") @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; return null;
} }
@ApiOperation("心率呼吸率") @ApiOperation("心率呼吸率")
@PostMapping("heartRespiratory") @PostMapping("heartRespiratory")
public ApiResponseEntity<PlatElderRealTimeHeartRespiratoryVO> heartRespiratory(@RequestBody PlatElderIdDTO platElderIdDTO) { public ApiResponseEntity<PlatElderRealTimeHeartRespiratoryWeekVO> heartRespiratory(@RequestBody PlatElderIdDTO platElderIdDTO) {
return null; 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; package com.makeit.entity.platform.device;
import com.makeit.common.entity.BaseBusEntity; import com.makeit.common.entity.BaseBusEntity;
import com.makeit.module.iot.enums.DeviceState;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -47,7 +48,10 @@ public class PlatDevice extends BaseBusEntity { ...@@ -47,7 +48,10 @@ public class PlatDevice extends BaseBusEntity {
@ApiModelProperty(value = "说明") @ApiModelProperty(value = "说明")
private String description; private String description;
@ApiModelProperty(value = "状态 数据字典 1 在线 0离线") /**
* @see DeviceState
*/
@ApiModelProperty(value = "状态 数据字典 1 在线 0离线 ")
private String status; private String status;
@ApiModelProperty(value = "组织id") @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 ...@@ -155,6 +155,8 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
/** /**
* 设备告警调用 发送消息 * 设备告警调用 发送消息
*
* todo 异步
*/ */
@Transactional @Transactional
@Override @Override
......
...@@ -9,13 +9,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -9,13 +9,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.common.entity.BaseEntity; import com.makeit.common.entity.BaseEntity;
import com.makeit.common.page.PageReqDTO; import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO; 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.PlatOrg;
import com.makeit.entity.platform.auth.PlatRole; import com.makeit.entity.platform.auth.PlatRole;
import com.makeit.entity.platform.auth.PlatRoleOrg; import com.makeit.entity.platform.auth.PlatRoleOrg;
import com.makeit.entity.platform.auth.PlatUserRole; import com.makeit.entity.platform.auth.PlatUserRole;
import com.makeit.enums.CommonEnum; import com.makeit.enums.CommonEnum;
import com.makeit.enums.id.TreeConst; import com.makeit.enums.id.TreeConst;
import com.makeit.exception.BusinessException;
import com.makeit.global.aspect.tenant.TenantIdUtil; import com.makeit.global.aspect.tenant.TenantIdUtil;
import com.makeit.mapper.platform.auth.PlatOrgMapper; import com.makeit.mapper.platform.auth.PlatOrgMapper;
import com.makeit.service.platform.alarm.PlatAlarmConfigService; import com.makeit.service.platform.alarm.PlatAlarmConfigService;
...@@ -273,7 +273,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -273,7 +273,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
@Transactional @Transactional
@Override @Override
public String add(PlatOrg dto) { public String add(PlatOrg dto) {
check(dto);
dto.setTenantId(TenantIdUtil.getTenantId()); dto.setTenantId(TenantIdUtil.getTenantId());
if (StringUtils.isBlank(dto.getParentId())) { if (StringUtils.isBlank(dto.getParentId())) {
String tenantId = TenantIdUtil.getTenantId(); String tenantId = TenantIdUtil.getTenantId();
...@@ -287,10 +287,20 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -287,10 +287,20 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
return dto.getId(); 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 @Transactional
@Override @Override
public void edit(PlatOrg dto) { public void edit(PlatOrg dto) {
check(dto);
if (StringUtils.isBlank(dto.getParentId())||StringUtils.equals(dto.getParentId(),"1")) { if (StringUtils.isBlank(dto.getParentId())||StringUtils.equals(dto.getParentId(),"1")) {
String tenantId = TenantIdUtil.getTenantId(); String tenantId = TenantIdUtil.getTenantId();
dto.setParentId(tenantId); dto.setParentId(tenantId);
...@@ -443,7 +453,11 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -443,7 +453,11 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
public List<PlatOrg> createOrgTree(List<PlatOrg> orgList) { public List<PlatOrg> createOrgTree(List<PlatOrg> orgList) {
Map<String, PlatOrg> orgMap = orgList.stream().collect(Collectors.toMap(BaseEntity::getId, vo -> vo, (a, b) -> a)); Map<String, PlatOrg> orgMap = orgList.stream().collect(Collectors.toMap(BaseEntity::getId, vo -> vo, (a, b) -> a));
for (PlatOrg platOrg : orgList) { 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); findParent(orgMap,platOrg,split,split.length-1);
} }
return orgList.stream().filter(vo->StringUtils.isBlank(vo.getParentNodeId())).collect(Collectors.toList()); return orgList.stream().filter(vo->StringUtils.isBlank(vo.getParentNodeId())).collect(Collectors.toList());
...@@ -504,7 +518,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -504,7 +518,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
private LambdaQueryWrapper<PlatOrg> getLambdaQueryWrapper(PlatOrgQueryDTO dto) { private LambdaQueryWrapper<PlatOrg> getLambdaQueryWrapper(PlatOrgQueryDTO dto) {
LambdaQueryWrapper<PlatOrg> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PlatOrg> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PlatOrg::getParentId, dto.getParentId()) queryWrapper.eq(StringUtils.isNotBlank(dto.getParentId()), PlatOrg::getParentId, dto.getParentId())
.orderByDesc(BaseEntity::getUpdateDate); .orderByDesc(BaseEntity::getUpdateDate);
return queryWrapper; return queryWrapper;
} }
...@@ -512,9 +526,23 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -512,9 +526,23 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
@Override @Override
public List<PlatOrg> subOrgList(PlatOrgQueryDTO platOrgQueryDTO) { public List<PlatOrg> subOrgList(PlatOrgQueryDTO platOrgQueryDTO) {
LambdaQueryWrapper<PlatOrg> queryWrapper = getLambdaQueryWrapper(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> ...@@ -523,6 +551,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
* @param platOrg * @param platOrg
*/ */
@Override @Override
@Transactional
public void saveOrg(PlatOrg platOrg) { public void saveOrg(PlatOrg platOrg) {
save(platOrg); save(platOrg);
......
...@@ -787,8 +787,8 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -787,8 +787,8 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
user.setAccount(dto.getMobile()); user.setAccount(dto.getMobile());
PlatOrg platOrg = platOrgService.getById(dto.getId()); fillOrgPath(dto, user);
user.setOrgPath(platOrg.getPath()+","+platOrg.getId());
save(user); save(user);
dto.setId(user.getId()); dto.setId(user.getId());
setRoleList(dto); setRoleList(dto);
...@@ -796,6 +796,13 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -796,6 +796,13 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
return user.getId(); 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 @Transactional
@Override @Override
...@@ -807,8 +814,8 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser> ...@@ -807,8 +814,8 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
setPassword(user); setPassword(user);
PlatOrg platOrg = platOrgService.getById(dto.getId()); fillOrgPath(dto, user);
user.setOrgPath(platOrg.getPath()+","+platOrg.getId());
updateById(user); updateById(user);
setRoleList(dto); setRoleList(dto);
} }
......
...@@ -72,12 +72,12 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -72,12 +72,12 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
List<PlatDeviceListVO> voList = BeanDtoVoUtils.listVo(page.getRecords(), PlatDeviceListVO.class); 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()); d.setOrgName(o.getName());
}); });
JoinUtil.joinSplit(voList, platOrgService, PlatDeviceListVO::getOrgPath, (d, o) -> { JoinUtil.joinSplit(voList, platOrgService, PlatDeviceListVO::getOrgPath, PlatOrg::getId, (d, o) -> {
d.setOrgName(StreamUtil.join(o, PlatOrg::getName)); d.setOrgPathName(StreamUtil.join(o, PlatOrg::getName));
}); });
return PageUtil.toPageVO(voList, page); return PageUtil.toPageVO(voList, page);
......
...@@ -62,12 +62,12 @@ public class PlatElderChildrenInfoServiceImpl extends ServiceImpl<PlatElderChild ...@@ -62,12 +62,12 @@ public class PlatElderChildrenInfoServiceImpl extends ServiceImpl<PlatElderChild
c.setElderName(StreamUtil.join(e, PlatElder::getName)); 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()); d.setOrgName(o.getName());
}); });
JoinUtil.joinSplit(voList, platOrgService, PlatElderChildrenInfoListVO::getOrgPath, (d, o) -> { JoinUtil.joinSplit(voList, platOrgService, PlatElderChildrenInfoListVO::getOrgPath, PlatOrg::getId, (d, o) -> {
d.setOrgName(StreamUtil.join(o, PlatOrg::getName)); d.setOrgPathName(StreamUtil.join(o, PlatOrg::getName));
}); });
} }
......
...@@ -116,23 +116,23 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -116,23 +116,23 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
List<PlatElderListVO> list = BeanDtoVoUtils.listVo(voList, PlatElderListVO.class); 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()); d.setOrgName(o.getName());
}); });
JoinUtil.joinSplit(list, platOrgService, PlatElderListVO::getOrgPath, (d, o) -> { JoinUtil.joinSplit(list, platOrgService, PlatElderListVO::getOrgPath, PlatOrg::getId, (d, o) -> {
d.setOrgName(StreamUtil.join(o, PlatOrg::getName)); 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)); 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)); 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)); e.setSpacePathName(e.getSpacePathName() + "," + StreamUtil.join(l, Objects::nonNull, PlatBed::getName));
}); });
...@@ -142,7 +142,7 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -142,7 +142,7 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
PlatElderListVO::getBuildingSpaceId, PlatElderListVO::getBuildingSpaceId,
PlatElderListVO::getUnitSpaceId, PlatElderListVO::getUnitSpaceId,
PlatElderListVO::getFloorSpaceId PlatElderListVO::getFloorSpaceId
), Arrays.asList( ), PlatSpace::getId, Arrays.asList(
(e, s) -> e.setSpaceName(s.getName()), (e, s) -> e.setSpaceName(s.getName()),
(e, s) -> e.setStreetSpaceName(s.getName()), (e, s) -> e.setStreetSpaceName(s.getName()),
(e, s) -> e.setBuildingSpaceName(s.getName()), (e, s) -> e.setBuildingSpaceName(s.getName()),
...@@ -150,11 +150,11 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -150,11 +150,11 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
(e, s) -> e.setFloorSpaceName(s.getName()) (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()); 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()); e.setBedName(l.getName());
}); });
...@@ -207,18 +207,18 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -207,18 +207,18 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
PlatElderExportVO::getBuildingSpaceId, PlatElderExportVO::getBuildingSpaceId,
PlatElderExportVO::getUnitSpaceId, PlatElderExportVO::getUnitSpaceId,
PlatElderExportVO::getFloorSpaceId PlatElderExportVO::getFloorSpaceId
), Arrays.asList( ), PlatSpace::getId, Arrays.asList(
(e, s) -> e.setStreetSpaceName(s.getName()), (e, s) -> e.setStreetSpaceName(s.getName()),
(e, s) -> e.setBuildingSpaceName(s.getName()), (e, s) -> e.setBuildingSpaceName(s.getName()),
(e, s) -> e.setUnitSpaceName(s.getName()), (e, s) -> e.setUnitSpaceName(s.getName()),
(e, s) -> e.setFloorSpaceName(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()); 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()); e.setBedName(l.getName());
}); });
...@@ -558,15 +558,15 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -558,15 +558,15 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
List<PlatElderDTOVO> list = Arrays.asList(vo); 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)); 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)); 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)); e.setSpacePathName(e.getSpacePathName() + "," + StreamUtil.join(l, Objects::nonNull, PlatBed::getName));
}); });
...@@ -576,7 +576,7 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -576,7 +576,7 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
PlatElderDTOVO::getBuildingSpaceId, PlatElderDTOVO::getBuildingSpaceId,
PlatElderDTOVO::getUnitSpaceId, PlatElderDTOVO::getUnitSpaceId,
PlatElderDTOVO::getFloorSpaceId PlatElderDTOVO::getFloorSpaceId
), Arrays.asList( ), PlatSpace::getId, Arrays.asList(
(e, s) -> e.setSpaceName(s.getName()), (e, s) -> e.setSpaceName(s.getName()),
(e, s) -> e.setStreetSpaceName(s.getName()), (e, s) -> e.setStreetSpaceName(s.getName()),
(e, s) -> e.setBuildingSpaceName(s.getName()), (e, s) -> e.setBuildingSpaceName(s.getName()),
...@@ -584,11 +584,11 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder ...@@ -584,11 +584,11 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
(e, s) -> e.setFloorSpaceName(s.getName()) (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()); 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()); e.setBedName(l.getName());
}); });
......
...@@ -91,8 +91,8 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM ...@@ -91,8 +91,8 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
Page<PlatDevice> p = PageUtil.toMpPage(pageReqDTO); Page<PlatDevice> p = PageUtil.toMpPage(pageReqDTO);
LambdaQueryWrapper<PlatDevice> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PlatDevice> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.notIn(PlatDevice::getId, listEquipmentIds); queryWrapper.notIn(!listEquipmentIds.isEmpty(),PlatDevice::getId, listEquipmentIds);
queryWrapper.eq(PlatDevice::getCategory,dto.getCategory()); 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.getOriDeviceId()), PlatDevice::getOriDeviceId, dto.getOriDeviceId());
queryWrapper.like(StringUtil.isNotEmpty(dto.getName()), PlatDevice::getName, dto.getName()); queryWrapper.like(StringUtil.isNotEmpty(dto.getName()), PlatDevice::getName, dto.getName());
queryWrapper.like(StringUtil.isNotEmpty(dto.getProductName()), PlatDevice::getProductName, dto.getProductName()); 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; ...@@ -8,6 +8,8 @@ import com.makeit.enums.CommonEnum;
import com.makeit.global.aspect.tenant.TenantIdIgnore; import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.module.iot.service.IotOrgService; import com.makeit.module.iot.service.IotOrgService;
import com.makeit.module.iot.vo.DeviceInstanceEntity; 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.platform.device.PlatDeviceService;
import com.makeit.service.saas.PlatTenantService; import com.makeit.service.saas.PlatTenantService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -35,6 +37,8 @@ public class IotSyncTask { ...@@ -35,6 +37,8 @@ public class IotSyncTask {
private PlatTenantService platTenantService; private PlatTenantService platTenantService;
@Autowired @Autowired
private PlatDeviceService platDeviceService; private PlatDeviceService platDeviceService;
@Autowired
private SysDictionaryCategoryService sysDictionaryCategoryService;
/** /**
* 一小时同步一次 * 一小时同步一次
...@@ -47,14 +51,18 @@ public class IotSyncTask { ...@@ -47,14 +51,18 @@ public class IotSyncTask {
log.info("开始执行同步设备信息接口"); log.info("开始执行同步设备信息接口");
LambdaQueryWrapper<PlatTenant> tenantLambdaQueryWrapper = new LambdaQueryWrapper<PlatTenant>().eq(PlatTenant::getStatus, CommonEnum.YES.getValue()); LambdaQueryWrapper<PlatTenant> tenantLambdaQueryWrapper = new LambdaQueryWrapper<PlatTenant>().eq(PlatTenant::getStatus, CommonEnum.YES.getValue());
List<PlatTenant> platTenants = platTenantService.list(tenantLambdaQueryWrapper); 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) { for (PlatTenant platTenant : platTenants) {
String iotOrgId = platTenant.getIotOrgId(); String iotOrgId = platTenant.getIotOrgId();
if(StringUtils.isBlank(iotOrgId)){ if (StringUtils.isBlank(iotOrgId)) {
continue; continue;
} }
//查询iot设备 //查询iot设备
List<DeviceInstanceEntity> iotDeviceList = iotOrgService.getOrgDevice(iotOrgId); List<DeviceInstanceEntity> iotDeviceList = iotOrgService.getOrgDevice(iotOrgId);
if(CollectionUtils.isEmpty(iotDeviceList)){ if (CollectionUtils.isEmpty(iotDeviceList)) {
continue; continue;
} }
//查询平台设备 //查询平台设备
...@@ -63,7 +71,7 @@ public class IotSyncTask { ...@@ -63,7 +71,7 @@ public class IotSyncTask {
.in(PlatDevice::getOriDeviceId, iotDeviceIdSet); .in(PlatDevice::getOriDeviceId, iotDeviceIdSet);
List<PlatDevice> deviceList = platDeviceService.list(deviceLambdaQueryWrapper); 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); platDeviceService.saveOrUpdateBatch(platDevices);
} }
...@@ -71,7 +79,7 @@ public class IotSyncTask { ...@@ -71,7 +79,7 @@ public class IotSyncTask {
} }
@Scheduled(cron = "0 0/1 * * * ?") @Scheduled(cron = "0 0 */1 * * ?")
public void syncDeviceLog() { public void syncDeviceLog() {
log.info("开始同步设备日志"); log.info("开始同步设备日志");
...@@ -80,28 +88,28 @@ public class IotSyncTask { ...@@ -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)); 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()); PlatDevice platDevice = deviceMap.get(iotDevice.getId());
if(platDevice==null){ if (platDevice == null) {
platDevice=new PlatDevice(); platDevice = new PlatDevice();
platDevice.setTenantId(tenantId); platDevice.setTenantId(tenantId);
deviceMap.put(iotDevice.getId(),platDevice); deviceMap.put(iotDevice.getId(), platDevice);
} }
platDevice.setOriDeviceId(iotDevice.getId()); platDevice.setOriDeviceId(iotDevice.getId());
platDevice.setName(iotDevice.getName()); platDevice.setName(iotDevice.getName());
platDevice.setProductName(iotDevice.getProductName()); platDevice.setProductName(iotDevice.getProductName());
platDevice.setProductId(iotDevice.getProductId()); 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.setRegistrationDate(registryTime);
platDevice.setDescription(iotDevice.getDescribe()); platDevice.setDescription(iotDevice.getDescribe());
String state = iotDevice.getState(); String state = iotDevice.getState();
platDevice.setStatus(StringUtils.equals("online",state)?CommonEnum.YES.getValue() : CommonEnum.NO.getValue()); platDevice.setStatus(state);
//todo 根据类型名称来匹配 //todo 根据类型名称来匹配
// platDevice.setCategory(); platDevice.setCategory(dicNameIdMap.get(iotDevice.getProductName()));
// platDevice.setFirmwareVersion(); // platDevice.setFirmwareVersion();
// platDevice.setLastOnlineData(); // platDevice.setLastOnlineData();
// platDevice.setOrgId(); // platDevice.setOrgId();
......
...@@ -40,6 +40,8 @@ public class PlatPersonDTOVO extends BaseIdDTO { ...@@ -40,6 +40,8 @@ public class PlatPersonDTOVO extends BaseIdDTO {
@ApiModelProperty(value = "手机号") @ApiModelProperty(value = "手机号")
private String mobile; private String mobile;
private String email;
@NotBlank(message = "状态不能为空") @NotBlank(message = "状态不能为空")
@Pattern(regexp = "0|1", message = "状态可选值为 0禁用 1启用") @Pattern(regexp = "0|1", message = "状态可选值为 0禁用 1启用")
@ApiModelProperty(value = "状态 0禁用 1启用") @ApiModelProperty(value = "状态 0禁用 1启用")
......
...@@ -23,10 +23,4 @@ public class PlatElderHeartRespiratoryEvaluationVO { ...@@ -23,10 +23,4 @@ public class PlatElderHeartRespiratoryEvaluationVO {
@ApiModelProperty("呼吸率") @ApiModelProperty("呼吸率")
private Integer respiratoryRate; 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 { ...@@ -9,7 +9,17 @@ public class PlatElderSleepEvaluationVO {
@ApiModelProperty("得分") @ApiModelProperty("得分")
private Integer score; private Integer score;
@ApiModelProperty("结果")
private String result;
@ApiModelProperty("评价") @ApiModelProperty("评价")
private String evaluation; 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 com.makeit.module.iot.service.IotTokenService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -44,12 +44,10 @@ public class MqttConfig { ...@@ -44,12 +44,10 @@ public class MqttConfig {
@Bean @Bean
public MqttPushClient getMqttPushClient() { public MqttPushClient getMqttPushClient() {
clientId = StringUtils.isNotEmpty(clientId) ? clientId : iotTokenService.getIotToken();
String iotToken = iotTokenService.getIotToken();
clientId = StringUtils.isNotEmpty(iotToken) ? iotToken : clientId;
mqttPushClient.connect(hostUrl, clientId, username, password, timeout, keepalive); mqttPushClient.connect(hostUrl, clientId, username, password, timeout, keepalive);
// 订阅主题 // 订阅主题
mqttPushClient.subscribe("/device/*/*/**", 0); mqttPushClient.subscribe(defaultTopic, 0);
return mqttPushClient; return mqttPushClient;
} }
......
package com.makeit.module.iot.mqtt; package com.makeit.mqtt;
import org.eclipse.paho.client.mqttv3.*; import org.eclipse.paho.client.mqttv3.*;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
...@@ -85,7 +85,7 @@ public class MqttPushClient { ...@@ -85,7 +85,7 @@ public class MqttPushClient {
} }
public void subscribe(String defaultTopic, int qos) { public void subscribe(String defaultTopic, int qos) {
logger.info("开始订阅主题" + defaultTopic); logger.info("开始订阅主题:" + defaultTopic);
try { try {
MqttPushClient.getMqttClient().subscribe(defaultTopic, qos); MqttPushClient.getMqttClient().subscribe(defaultTopic, qos);
} catch (MqttException e) { } catch (MqttException e) {
......
...@@ -115,8 +115,8 @@ mqtt: ...@@ -115,8 +115,8 @@ mqtt:
username: admin|1693982115969 username: admin|1693982115969
password: 8e3795ef7b5e95869fa8c323b865b3a9 password: 8e3795ef7b5e95869fa8c323b865b3a9
hostUrl: tcp://124.71.33.17:11883 hostUrl: tcp://124.71.33.17:11883
clientId: ab3a2fd694c8c838aba2686df3a80e7b clientId:
defaultTopic: defaultTopic: /device/*/*/**
timeout: 10 timeout: 10
keepalive: 60 keepalive: 60
......
...@@ -112,8 +112,8 @@ mqtt: ...@@ -112,8 +112,8 @@ mqtt:
username: admin|1693982115969 username: admin|1693982115969
password: 8e3795ef7b5e95869fa8c323b865b3a9 password: 8e3795ef7b5e95869fa8c323b865b3a9
hostUrl: tcp://124.71.33.17:11883 hostUrl: tcp://124.71.33.17:11883
clientId: ab3a2fd694c8c838aba2686df3a80e7b clientId:
defaultTopic: defaultTopic: /device/*/*/**
timeout: 10 timeout: 10
keepalive: 60 keepalive: 60
......
...@@ -59,7 +59,7 @@ public class IotTest { ...@@ -59,7 +59,7 @@ public class IotTest {
@Test @Test
void getLastDeviceLog() { void getLastDeviceLog() {
iotProductDeviceService.getLastDeviceLog("1694547143952007168"); iotProductDeviceService.getLastDeviceLog("1701127702523473920");
} }
@Test @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