Commit c27b590a by 杨伟程

調整包結構

parents 4657dfba c2139b0b
Showing with 325 additions and 68 deletions
...@@ -157,7 +157,6 @@ ...@@ -157,7 +157,6 @@
<orderEntry type="library" name="Maven: org.springframework.integration:spring-integration-core:5.5.5" level="project" /> <orderEntry type="library" name="Maven: org.springframework.integration:spring-integration-core:5.5.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.3.12" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.3.12" level="project" />
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.3.1" level="project" /> <orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.3.1" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.integration:spring-integration-mqtt:5.5.5" level="project" /> <orderEntry type="library" name="Maven: org.springframework.integration:spring-integration-mqtt:5.5.5" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5" level="project" /> <orderEntry type="library" name="Maven: org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5" level="project" />
<orderEntry type="library" name="Maven: com.aliyun:dysmsapi20170525:2.0.9" level="project" /> <orderEntry type="library" name="Maven: com.aliyun:dysmsapi20170525:2.0.9" level="project" />
...@@ -184,6 +183,7 @@ ...@@ -184,6 +183,7 @@
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:5.2.2" level="project" /> <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:5.2.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-lite:5.2.2" level="project" /> <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-lite:5.2.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:5.0.3" level="project" /> <orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:5.0.3" level="project" />
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.21" level="project" /> <orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.21" level="project" />
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.07" level="project" /> <orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.07" level="project" />
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.3.5" level="project" /> <orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.3.5" level="project" />
...@@ -205,7 +205,6 @@ ...@@ -205,7 +205,6 @@
<orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-bridge:1.14" level="project" /> <orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-bridge:1.14" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-script:1.14" level="project" /> <orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-script:1.14" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-dom:1.14" level="project" /> <orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-dom:1.14" level="project" />
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-gvt:1.14" level="project" /> <orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-gvt:1.14" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-shared-resources:1.14" level="project" /> <orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-shared-resources:1.14" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-svggen:1.14" level="project" /> <orderEntry type="library" name="Maven: org.apache.xmlgraphics:batik-svggen:1.14" level="project" />
......
...@@ -8,7 +8,7 @@ public class HeaderConst { ...@@ -8,7 +8,7 @@ public class HeaderConst {
// public static final String PLATFORM_TOKEN = "platformToken"; // public static final String PLATFORM_TOKEN = "platformToken";
public static final String PLATFORM_TOKEN = "token"; public static final String PLATFORM_TOKEN = "token";
public static final String TOKEN = "token"; public static final String TOKEN = "token";
public static final String WECHAT_TOKEN = "wechatToken"; public static final String WECHAT_TOKEN = "token";
// public static final String CUSTOMER_TOKEN = "customerToken"; // public static final String CUSTOMER_TOKEN = "customerToken";
......
...@@ -61,7 +61,7 @@ public class DataScreenController { ...@@ -61,7 +61,7 @@ public class DataScreenController {
@ApiOperation("地图统计") @ApiOperation("地图统计")
@PostMapping("mapStatistics") @PostMapping("mapStatistics")
public ApiResponseEntity<PlatMapStatisticsVO> mapStatistics(@RequestBody PlatDataScreenQueryDTO dto) { public ApiResponseEntity<List<PlatMapStatisticsVO>> mapStatistics(@RequestBody PlatDataScreenQueryDTO dto) {
return ApiResponseUtils.success(dataScreenService.mapStatistics(dto)); return ApiResponseUtils.success(dataScreenService.mapStatistics(dto));
} }
} }
package com.makeit.module.controller.workstation; package com.makeit.module.controller.workstation;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.dataScreen.PlatDataScreenQueryDTO;
import com.makeit.dto.platform.workstation.WorkStationQueryDTO;
import com.makeit.service.platform.workstation.WorkStationService;
import com.makeit.vo.platform.dataScreen.PlatAgeStatisticsVO;
import com.makeit.vo.platform.workstation.WorkStationStatisticsVO;
import io.swagger.annotations.Api; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -9,5 +20,13 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -9,5 +20,13 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/plat/workstation") @RequestMapping("/plat/workstation")
public class WorkStationController { public class WorkStationController {
@Autowired
private WorkStationService workStationService;
@ApiOperation("统计")
@PostMapping("statistics")
public ApiResponseEntity<WorkStationStatisticsVO> statistics(@RequestBody WorkStationQueryDTO dto) {
return ApiResponseUtils.success(workStationService.statistics(dto));
}
} }
...@@ -28,4 +28,5 @@ public class PlatDataScreenQueryDTO { ...@@ -28,4 +28,5 @@ public class PlatDataScreenQueryDTO {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("结束时间") @ApiModelProperty("结束时间")
private LocalDateTime endTime; private LocalDateTime endTime;
} }
package com.makeit.dto.platform.workstation;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* Controller
*
* @author zm
* @version 2023/9/11
*/
@Data
@ApiModel("PlatDataScreenQueryDto参数")
public class WorkStationQueryDTO {
@ApiModelProperty("组织ids")
private List<String> orgIds;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("开始时间")
private LocalDateTime startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("结束时间")
private LocalDateTime endTime;
@ApiModelProperty("长者姓名")
private String elderName;
@ApiModelProperty("空间ids")
private List<String> spaceIds;
@ApiModelProperty("告警类型")
private String type;
}
...@@ -276,9 +276,6 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -276,9 +276,6 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
check(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();
dto.setParentId(tenantId);
dto.setPath(tenantId);
} else { } else {
PlatOrg parent = getById(dto.getParentId()); PlatOrg parent = getById(dto.getParentId());
dto.setPath(parent.getPath() + "," + parent.getId()); dto.setPath(parent.getPath() + "," + parent.getId());
...@@ -302,8 +299,6 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -302,8 +299,6 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
public void edit(PlatOrg dto) { public void edit(PlatOrg dto) {
check(dto); check(dto);
if (StringUtils.isBlank(dto.getParentId())||StringUtils.equals(dto.getParentId(),"1")) { if (StringUtils.isBlank(dto.getParentId())||StringUtils.equals(dto.getParentId(),"1")) {
dto.setParentId("1");
dto.setPath("1");
} else { } else {
PlatOrg parent = getById(dto.getParentId()); PlatOrg parent = getById(dto.getParentId());
dto.setPath(parent.getPath() + "," + parent.getId()); dto.setPath(parent.getPath() + "," + parent.getId());
...@@ -520,6 +515,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg> ...@@ -520,6 +515,7 @@ public class PlatOrgServiceImpl extends ServiceImpl<PlatOrgMapper, PlatOrg>
queryWrapper.eq(StringUtils.isNotBlank(dto.getParentId()), PlatOrg::getParentId, dto.getParentId()) queryWrapper.eq(StringUtils.isNotBlank(dto.getParentId()), PlatOrg::getParentId, dto.getParentId())
.like(StringUtils.isNotBlank(dto.getName()),PlatOrg::getName,dto.getName()) .like(StringUtils.isNotBlank(dto.getName()),PlatOrg::getName,dto.getName())
.eq(StringUtils.isNotBlank(dto.getType()),PlatOrg::getType,dto.getType()) .eq(StringUtils.isNotBlank(dto.getType()),PlatOrg::getType,dto.getType())
.eq(StringUtils.isNotBlank(dto.getStatus()),PlatOrg::getStatus,dto.getStatus())
.orderByDesc(BaseEntity::getUpdateDate); .orderByDesc(BaseEntity::getUpdateDate);
return queryWrapper; return queryWrapper;
} }
......
...@@ -22,5 +22,5 @@ public interface DataScreenService { ...@@ -22,5 +22,5 @@ public interface DataScreenService {
PlatBaseInfoStatisticsVO baseInfoStatistics(PlatDataScreenQueryDTO dto); PlatBaseInfoStatisticsVO baseInfoStatistics(PlatDataScreenQueryDTO dto);
PlatMapStatisticsVO mapStatistics(PlatDataScreenQueryDTO dto); List<PlatMapStatisticsVO> mapStatistics(PlatDataScreenQueryDTO dto);
} }
...@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service; ...@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -136,14 +137,18 @@ public class DataScreenServiceImpl implements DataScreenService { ...@@ -136,14 +137,18 @@ public class DataScreenServiceImpl implements DataScreenService {
if(StringUtil.isNotEmpty(record.getElderIds())){ if(StringUtil.isNotEmpty(record.getElderIds())){
List<String> elderIds = Arrays.asList(record.getElderIds().split(",")); List<String> elderIds = Arrays.asList(record.getElderIds().split(","));
PlatAlarmStatisticsListVo listVo = new PlatAlarmStatisticsListVo(); PlatAlarmStatisticsListVo listVo = new PlatAlarmStatisticsListVo();
String elderName = "";
for (String elderId : elderIds){ for (String elderId : elderIds){
if(elderNameMap.get(elderId)!=null){ if(elderNameMap.get(elderId)!=null){
listVo.setElderName(elderNameMap.get(elderId)); elderName = "".equals(elderName) ? elderNameMap.get(elderId) : elderName + "," + elderNameMap.get(elderId);
}
} }
listVo.setType(record.getAlarmType());
if(PlatAlarmConfigEnum.AlarmTypeEnum.HEART.getValue().equals(record.getAlarmType()) || if(PlatAlarmConfigEnum.AlarmTypeEnum.HEART.getValue().equals(record.getAlarmType()) ||
PlatAlarmConfigEnum.AlarmTypeEnum.BREATHE.getValue().equals(record.getAlarmType()) ){ PlatAlarmConfigEnum.AlarmTypeEnum.BREATHE.getValue().equals(record.getAlarmType()) ){
} }
listVo.setElderName(elderName);
listVo.setType(record.getAlarmType());
totla ++; totla ++;
if(PlatAlarmRecordEnum.AlarmRecordStatusEnum.HANDLED.getValue().equals(record.getStatus())){ if(PlatAlarmRecordEnum.AlarmRecordStatusEnum.HANDLED.getValue().equals(record.getStatus())){
handledNumber ++; handledNumber ++;
...@@ -152,8 +157,6 @@ public class DataScreenServiceImpl implements DataScreenService { ...@@ -152,8 +157,6 @@ public class DataScreenServiceImpl implements DataScreenService {
} }
list.add(listVo); list.add(listVo);
} }
}
} }
PlatAlarmStatisticsVO vo = new PlatAlarmStatisticsVO(); PlatAlarmStatisticsVO vo = new PlatAlarmStatisticsVO();
vo.setTotla(totla); vo.setTotla(totla);
...@@ -183,36 +186,82 @@ public class DataScreenServiceImpl implements DataScreenService { ...@@ -183,36 +186,82 @@ public class DataScreenServiceImpl implements DataScreenService {
} }
@Override @Override
public PlatMapStatisticsVO mapStatistics(PlatDataScreenQueryDTO dto) { public List<PlatMapStatisticsVO> mapStatistics(PlatDataScreenQueryDTO dto) {
PlatMapStatisticsVO vo = new PlatMapStatisticsVO(); List<PlatMapStatisticsVO> list = new ArrayList<>();
List<PlatOrg> orgs = platOrgService.list(new QueryWrapper<PlatOrg>().lambda()
.in(PlatOrg::getId, dto.getOrgIds()));
//取范围最大的管辖区域
List<PlatOrg> tree = platOrgService.createOrgTree(orgs);
List<String> region = tree.stream().filter(t->StringUtil.isNotEmpty(t.getRegion())).map(PlatOrg::getRegion).collect(Collectors.toList());
List<ChinaAreaVO> areas = AreaUtil.getByCodeList(region);
List<PlatSpace> spaces = platSpaceService.list(new QueryWrapper<PlatSpace>().lambda() List<PlatSpace> spaces = platSpaceService.list(new QueryWrapper<PlatSpace>().lambda()
.isNull(PlatSpace::getParentId) .isNull(PlatSpace::getParentId)
.in(PlatSpace::getOrgId, dto.getOrgIds())); .in(PlatSpace::getOrgId, dto.getOrgIds()));
List<PlatElder> elders = platElderService.list(new QueryWrapper<PlatElder>().lambda() List<PlatElder> elders = platElderService.list(new QueryWrapper<PlatElder>().lambda()
.isNotNull(PlatElder::getBedId) .isNotNull(PlatElder::getBedId)
.in(PlatElder::getOrgId, dto.getOrgIds())); .in(PlatElder::getOrgId, dto.getOrgIds()));
for(PlatElder elder : elders){
if(StringUtil.isNotEmpty(elder.getStreetSpaceId())){
elder.setSpaceId(elder.getStreetSpaceId());
}else {
if(StringUtil.isNotEmpty(elder.getBuildingSpaceId())) {
elder.setSpaceId(elder.getBuildingSpaceId());
}else {
if(StringUtil.isNotEmpty(elder.getUnitSpaceId())){
elder.setSpaceId(elder.getUnitSpaceId());
}else {
if(StringUtil.isNotEmpty(elder.getFloorSpaceId())){
elder.setSpaceId(elder.getFloorSpaceId());
}
}
}
}
}
Map<String,List<PlatElder>> elderMap = elders.stream().collect(Collectors.groupingBy(PlatElder::getSpaceId)); Map<String,List<PlatElder>> elderMap = elders.stream().collect(Collectors.groupingBy(PlatElder::getSpaceId));
List<PlatMapStatisticsSpaceVO> list = new ArrayList<>(); Map<String,PlatElder> platElderMap = elders.stream().collect(Collectors.toMap(PlatElder::getId, Function.identity()));
//今日告警
List<PlatAlarmRecord> alarmRecords = platAlarmRecordService.list(new QueryWrapper<PlatAlarmRecord>().lambda()
.between(PlatAlarmRecord::getAlarmDate,dto.getStartTime(),dto.getEndTime())
.in(PlatAlarmRecord::getOrgId, dto.getOrgIds()));
List<PlatAlarmRecordStatisticsVo> statisticsVos = coverToVoList(alarmRecords, platElderMap);
Map<String, List<PlatAlarmRecordStatisticsVo>> staticsMap = statisticsVos.stream().collect(Collectors.groupingBy(PlatAlarmRecordStatisticsVo::getSpaceId));
//待处理告警
List<PlatAlarmRecord> unHandledAlarmRecords = platAlarmRecordService.list(new QueryWrapper<PlatAlarmRecord>().lambda()
.eq(PlatAlarmRecord::getStatus, PlatAlarmRecordEnum.AlarmRecordStatusEnum.UNHANDLED.getValue())
.in(PlatAlarmRecord::getOrgId, dto.getOrgIds()));
List<PlatAlarmRecordStatisticsVo> unHandledStatisticsVos = coverToVoList(unHandledAlarmRecords, platElderMap);
Map<String, List<PlatAlarmRecordStatisticsVo>> unHandledStaticsMap = unHandledStatisticsVos.stream().collect(Collectors.groupingBy(PlatAlarmRecordStatisticsVo::getSpaceId));
for(PlatSpace space : spaces){ for(PlatSpace space : spaces){
PlatMapStatisticsSpaceVO spaceVo = new PlatMapStatisticsSpaceVO(); PlatMapStatisticsVO vo = new PlatMapStatisticsVO();
spaceVo.setSpaceId(space.getId()); vo.setSpaceId(space.getId());
spaceVo.setSpaceName(space.getName()); vo.setSpaceName(space.getName());
spaceVo.setLatitude(space.getLatitude()); vo.setLatitude(space.getLatitude());
spaceVo.setLongitude(space.getLongitude()); vo.setLongitude(space.getLongitude());
if(elderMap.get(space.getId())!=null){ if(elderMap.get(space.getId())!=null){
spaceVo.setElderNumber(Long.valueOf(elderMap.get(space.getId()).size())); vo.setElderNumber(Long.valueOf(elderMap.get(space.getId()).size()));
}
if(staticsMap.get(space.getId())!=null){
vo.setAlarmNumber(Long.valueOf(staticsMap.get(space.getId()).size()));
}
if(unHandledStaticsMap.get(space.getId())!=null){
vo.setUnHandledNumber(Long.valueOf(unHandledStaticsMap.get(space.getId()).size()));
}
list.add(vo);
} }
return list;
} }
vo.setAreas(areas);
return vo; private List<PlatAlarmRecordStatisticsVo> coverToVoList(List<PlatAlarmRecord> alarmRecords, Map<String,PlatElder> platElderMap) {
List<PlatAlarmRecordStatisticsVo> statisticsVos = new ArrayList<>();
alarmRecords.forEach(record->{
List<String> elderIds = Arrays.asList(record.getElderIds().split(","));
if(StringUtil.isNotEmpty(record.getElderIds())
&& elderIds.size()>0){
if(platElderMap.get(elderIds.get(0))!=null){
PlatAlarmRecordStatisticsVo statisticsVo = BeanDtoVoUtils.convert(record, PlatAlarmRecordStatisticsVo.class);
statisticsVo.setSpaceId(platElderMap.get(elderIds.get(0)).getSpaceId());
statisticsVos.add(statisticsVo);
}
}
});
return statisticsVos;
} }
......
...@@ -109,32 +109,32 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM ...@@ -109,32 +109,32 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
public List<PlatDeviceDTO> listBindDevice(PlatBedDeviceQueryDTO dto) { public List<PlatDeviceDTO> listBindDevice(PlatBedDeviceQueryDTO dto) {
LambdaQueryWrapper<PlatRoomBedDevice> queryWrapper1 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PlatRoomBedDevice> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(PlatRoomBedDevice::getRoomId, dto.getRoomId()); queryWrapper1.eq(PlatRoomBedDevice::getRoomId,dto.getRoomId());
queryWrapper1.eq(StringUtil.isNotEmpty(dto.getBedId()), PlatRoomBedDevice::getBedId, dto.getBedId()); queryWrapper1.eq(StringUtil.isNotEmpty(dto.getBedId()),PlatRoomBedDevice::getBedId,dto.getBedId());
List<PlatRoomBedDevice> list = list(queryWrapper1); List<PlatRoomBedDevice> list = list(queryWrapper1);
List<String> listEquipmentIds = list.stream().map(item -> item.getDeviceId()).collect(Collectors.toList()); List<String> listEquipmentIds = list.stream().map(item->item.getDeviceId()).collect(Collectors.toList());
List<String> listBedIds = list.stream().map(item -> item.getBedId()).collect(Collectors.toList()); List<String> listBedIds = list.stream().map(item->item.getBedId()).collect(Collectors.toList());
LambdaQueryWrapper<PlatBed> queryWrapper2 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PlatBed> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.in(PlatBed::getId, listBedIds); queryWrapper2.in(PlatBed::getId,listBedIds);
List<PlatBed> listBeds = platBedService.list(queryWrapper2); List<PlatBed> listBeds = platBedService.list(queryWrapper2);
Map<String, String> map = listBeds.stream().collect(Collectors.toMap(PlatBed::getId, PlatBed::getName, (k1, k2) -> k1)); Map<String,String> map = listBeds.stream().collect(Collectors.toMap(PlatBed::getId,PlatBed::getName,(k1, k2)->k1));
Map<String, String> mapName = new HashMap<>(); Map<String,String> mapName = new HashMap<>();
list.forEach(item -> { list.forEach(item->{
if (map.containsKey(item.getBedId())) { if(map.containsKey(item.getBedId())){
mapName.put(item.getDeviceId(), map.get(item.getBedId())); mapName.put(item.getDeviceId(),map.get(item.getBedId()));
} }
}); });
List<PlatDeviceDTO> data = new ArrayList<>(); List<PlatDeviceDTO> data = new ArrayList<>();
if (!listEquipmentIds.isEmpty()) { if(!listEquipmentIds.isEmpty()){
LambdaQueryWrapper<PlatDevice> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PlatDevice> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PlatDevice::getCategory, PlatDeviceEnum.CategoryEnum.HEART); //queryWrapper.eq(PlatDevice::getCategory, PlatDeviceEnum.CategoryEnum.HEART);
queryWrapper.in(PlatDevice::getId, listEquipmentIds); queryWrapper.in(PlatDevice::getId,listEquipmentIds);
List<PlatDevice> listDevices = platDeviceService.list(queryWrapper); List<PlatDevice> listDevices = platDeviceService.list(queryWrapper);
data = BeanDtoVoUtils.listVo(listDevices, PlatDeviceDTO.class); data = BeanDtoVoUtils.listVo(listDevices,PlatDeviceDTO.class);
data.forEach(item -> { data.forEach(item->{
item.setBedName(mapName.get(item.getId())); item.setBedName(mapName.get(item.getId()));
}); });
} }
......
...@@ -5,14 +5,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -5,14 +5,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.dto.platform.space.PlatSpaceAddDTO; import com.makeit.dto.platform.space.PlatSpaceAddDTO;
import com.makeit.dto.platform.space.PlatSpaceQueryDTO; import com.makeit.dto.platform.space.PlatSpaceQueryDTO;
import com.makeit.dto.platform.space.PlatSpaceVO; import com.makeit.dto.platform.space.PlatSpaceVO;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.space.PlatRoom; import com.makeit.entity.platform.space.PlatRoom;
import com.makeit.entity.platform.space.PlatSpace; import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.enums.CodeMessageEnum; import com.makeit.enums.CodeMessageEnum;
import com.makeit.exception.BusinessException; import com.makeit.exception.BusinessException;
import com.makeit.mapper.platform.space.PlatSpaceMapper; import com.makeit.mapper.platform.space.PlatSpaceMapper;
import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.space.PlatRoomService; import com.makeit.service.platform.space.PlatRoomService;
import com.makeit.service.platform.space.PlatSpaceService; import com.makeit.service.platform.space.PlatSpaceService;
import com.makeit.utils.data.convert.BeanDtoVoUtils; import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.user.plat.PlatUserUtil;
import com.makeit.utils.user.plat.PlatUserVO;
import com.makeit.vo.platform.space.PlatSpaceAndRoomVO; import com.makeit.vo.platform.space.PlatSpaceAndRoomVO;
import jodd.util.StringUtil; import jodd.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -34,6 +38,8 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -34,6 +38,8 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
@Autowired @Autowired
private PlatRoomService platRoomService; private PlatRoomService platRoomService;
@Autowired
private PlatOrgService platOrgService;
private void check(PlatSpaceAddDTO dto){ private void check(PlatSpaceAddDTO dto){
LambdaQueryWrapper<PlatSpace> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PlatSpace> queryWrapper = new LambdaQueryWrapper<>();
...@@ -57,6 +63,12 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -57,6 +63,12 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
public void add(PlatSpaceAddDTO dto) { public void add(PlatSpaceAddDTO dto) {
check(dto); check(dto);
PlatSpace space = BeanDtoVoUtils.convert(dto, PlatSpace.class); PlatSpace space = BeanDtoVoUtils.convert(dto, PlatSpace.class);
PlatUserVO userVO = PlatUserUtil.getUserVO();
space.setOrgId(userVO.getOrgId());
PlatOrg org = platOrgService.getById(userVO.getOrgId());
if(org!=null){
space.setAttribute(org.getType());
}
save(space); save(space);
} }
......
package com.makeit.service.platform.workstation;
import com.makeit.dto.platform.workstation.WorkStationQueryDTO;
import com.makeit.vo.platform.workstation.WorkStationStatisticsVO;
/**
* Controller
*
* @author zm
* @version 2023/9/11
*/
public interface WorkStationService {
WorkStationStatisticsVO statistics(WorkStationQueryDTO dto);
}
package com.makeit.service.platform.workstation.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.makeit.dto.platform.dataScreen.PlatDataScreenQueryDTO;
import com.makeit.dto.platform.workstation.WorkStationQueryDTO;
import com.makeit.entity.platform.alarm.PlatAlarmRecord;
import com.makeit.entity.platform.auth.PlatUser;
import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.entity.platform.elder.PlatElder;
import com.makeit.entity.platform.space.PlatSpace;
import com.makeit.enums.CommonEnum;
import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum;
import com.makeit.enums.platform.alarm.PlatAlarmRecordEnum;
import com.makeit.enums.platform.device.PlatDeviceEnum;
import com.makeit.enums.platform.elder.PlatElderEnum;
import com.makeit.module.iot.enums.DeviceState;
import com.makeit.service.platform.alarm.PlatAlarmRecordService;
import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.auth.PlatUserService;
import com.makeit.service.platform.dataScreen.DataScreenService;
import com.makeit.service.platform.device.PlatDeviceService;
import com.makeit.service.platform.elder.PlatElderService;
import com.makeit.service.platform.space.PlatBedService;
import com.makeit.service.platform.space.PlatSpaceService;
import com.makeit.service.platform.workstation.WorkStationService;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.vo.platform.dataScreen.*;
import com.makeit.vo.platform.workstation.WorkStationStatisticsVO;
import jodd.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* Controller
*
* @author zm
* @version 2023/9/11
*/
@Service
public class WorkStationServiceImpl implements WorkStationService {
@Autowired
private PlatElderService platElderService;
@Autowired
private PlatDeviceService platDeviceService;
@Autowired
private PlatBedService platBedService;
@Autowired
private PlatUserService platUserService;
@Autowired
private PlatAlarmRecordService platAlarmRecordService;
@Autowired
private PlatSpaceService platSpaceService;
@Autowired
private PlatOrgService platOrgService;
@Override
public WorkStationStatisticsVO statistics(WorkStationQueryDTO dto) {
WorkStationStatisticsVO vo = new WorkStationStatisticsVO();
//代处理告警
long unHandledNumber = platAlarmRecordService.count(new QueryWrapper<PlatAlarmRecord>().lambda()
.eq(PlatAlarmRecord::getStatus, PlatAlarmRecordEnum.AlarmRecordStatusEnum.UNHANDLED.getValue())
.in(PlatAlarmRecord::getOrgId, dto.getOrgIds()));
vo.setUnHandledNumber(unHandledNumber);
return null;
}
}
package com.makeit.vo.platform.dataScreen;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
/**
* Controller
*
* @author zm
* @version 2023/9/13
*/
@Data
@ApiModel("PlatAlarmRecordStatisticsVo对象")
public class PlatAlarmRecordStatisticsVo {
/**
* 告警时间
*/
private Date alarmDate;
/**
* 状态 0 待处理 1 已处理
*/
private String status;
/**
* 组织id
*/
private String orgId;
/**
* 老人id,逗号拼接
*/
private String elderIds;
/**
* 空间id
*/
private String spaceId;
}
...@@ -2,6 +2,7 @@ package com.makeit.vo.platform.dataScreen; ...@@ -2,6 +2,7 @@ package com.makeit.vo.platform.dataScreen;
import com.makeit.utils.area.ChinaAreaVO; import com.makeit.utils.area.ChinaAreaVO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
...@@ -16,8 +17,22 @@ import java.util.List; ...@@ -16,8 +17,22 @@ import java.util.List;
@ApiModel("PlatMapStatisticsVO对象") @ApiModel("PlatMapStatisticsVO对象")
public class PlatMapStatisticsVO { public class PlatMapStatisticsVO {
private List<ChinaAreaVO> areas; @ApiModelProperty(value = "空间id")
private List<PlatMapStatisticsSpaceVO> spaceList; private String spaceId;
@ApiModelProperty(value = "空间名称")
private String spaceName;
@ApiModelProperty(value = "空间地址")
private String address;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "纬度")
private String latitude;
@ApiModelProperty(value = "长者数量")
private Long elderNumber;
@ApiModelProperty(value = "今日告警数")
private Long alarmNumber;
@ApiModelProperty(value = "待处理告警")
private Long unHandledNumber;
} }
package com.makeit.vo.platform.dataScreen; package com.makeit.vo.platform.workstation;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -8,27 +8,12 @@ import lombok.Data; ...@@ -8,27 +8,12 @@ import lombok.Data;
* Controller * Controller
* *
* @author zm * @author zm
* @version 2023/9/11 * @version 2023/9/13
*/ */
@Data @Data
@ApiModel("PlatMapStatisticsSpaceVO对象") @ApiModel("WorkStationStatisticsVO对象")
public class PlatMapStatisticsSpaceVO { public class WorkStationStatisticsVO {
@ApiModelProperty(value = "空间id")
private String spaceId;
@ApiModelProperty(value = "空间名称")
private String spaceName;
@ApiModelProperty(value = "空间地址")
private String address;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "纬度")
private String latitude;
@ApiModelProperty(value = "长者数量")
private Long elderNumber;
@ApiModelProperty(value = "今日告警数")
private Long alarmNumber;
@ApiModelProperty(value = "待处理告警") @ApiModelProperty(value = "待处理告警")
private Long unHandledNumber; private Long unHandledNumber;
} }
...@@ -87,9 +87,13 @@ public class PushCallback implements MqttCallback { ...@@ -87,9 +87,13 @@ public class PushCallback implements MqttCallback {
} }
for (PlatAlarmConfig config : deviceAlarmConfigList) { for (PlatAlarmConfig config : deviceAlarmConfigList) {
String alarmType = config.getAlarmType(); String alarmType = config.getAlarmType();
PlatAlarmCheckDTO platAlarmCheckDTO = new PlatAlarmCheckDTO(); PlatAlarmCheckDTO platAlarmCheckDTO = new PlatAlarmCheckDTO();
//告警配置
platAlarmCheckDTO.setPlatAlarmConfig(config); platAlarmCheckDTO.setPlatAlarmConfig(config);
//设备信息
platAlarmCheckDTO.setPlatDevice(platDevice); platAlarmCheckDTO.setPlatDevice(platDevice);
//iot上报数据
platAlarmCheckDTO.setProperties(properties); platAlarmCheckDTO.setProperties(properties);
for (IAlarm alarm : alarmList) { for (IAlarm alarm : alarmList) {
......
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