Commit 7e899482 by huangjy

fix: 修复bug

parent 1284b262
...@@ -38,6 +38,9 @@ public class PlatDeviceLog extends BaseBusEntity { ...@@ -38,6 +38,9 @@ public class PlatDeviceLog extends BaseBusEntity {
private String url; private String url;
@ApiModelProperty(value = "文件名称") @ApiModelProperty(value = "文件名称")
private String fileName; private String fileName;
@ApiModelProperty(value = "租户名称")
@TableField(exist = false)
private String tenantName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
......
...@@ -4,19 +4,28 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -4,19 +4,28 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.common.entity.BaseBusEntity;
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.dto.platform.device.PlatDeviceQueryDTO; import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
import com.makeit.entity.platform.alarm.PlatAlarmRecord; import com.makeit.entity.platform.alarm.PlatAlarmRecord;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.entity.platform.device.PlatDeviceLog; import com.makeit.entity.platform.device.PlatDeviceLog;
import com.makeit.entity.saas.PlatTenant;
import com.makeit.mapper.platform.device.PlatDeviceLogMapper; import com.makeit.mapper.platform.device.PlatDeviceLogMapper;
import com.makeit.service.platform.device.PlatDeviceLogService; import com.makeit.service.platform.device.PlatDeviceLogService;
import com.makeit.service.saas.PlatTenantService;
import com.makeit.utils.data.convert.PageUtil; import com.makeit.utils.data.convert.PageUtil;
import com.makeit.utils.data.convert.StreamUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
* 设备日志 服务实现类 * 设备日志 服务实现类
...@@ -30,6 +39,8 @@ public class PlatDeviceLogServiceImpl extends ServiceImpl<PlatDeviceLogMapper, P ...@@ -30,6 +39,8 @@ public class PlatDeviceLogServiceImpl extends ServiceImpl<PlatDeviceLogMapper, P
@Autowired @Autowired
private PlatDeviceLogMapper platDeviceLogMapper; private PlatDeviceLogMapper platDeviceLogMapper;
@Autowired
private PlatTenantService platTenantService;
@Override @Override
public PageVO<PlatDeviceLog> pageList(PageReqDTO<PlatDeviceLog> pageReqDTO) { public PageVO<PlatDeviceLog> pageList(PageReqDTO<PlatDeviceLog> pageReqDTO) {
...@@ -38,12 +49,19 @@ public class PlatDeviceLogServiceImpl extends ServiceImpl<PlatDeviceLogMapper, P ...@@ -38,12 +49,19 @@ public class PlatDeviceLogServiceImpl extends ServiceImpl<PlatDeviceLogMapper, P
LambdaQueryWrapper<PlatDeviceLog> lambdaQueryWrapper = new QueryWrapper<PlatDeviceLog>().lambda() LambdaQueryWrapper<PlatDeviceLog> lambdaQueryWrapper = new QueryWrapper<PlatDeviceLog>().lambda()
.eq(StringUtils.isNotEmpty(dto.getDeviceId()), PlatDeviceLog::getDeviceId, dto.getDeviceId()) .eq(StringUtils.isNotEmpty(dto.getDeviceId()), PlatDeviceLog::getDeviceId, dto.getDeviceId())
.eq(StringUtils.isNotEmpty(dto.getProductName()), PlatDeviceLog::getProductName, dto.getProductName()) .like(StringUtils.isNotEmpty(dto.getProductName()), PlatDeviceLog::getProductName, dto.getProductName())
.eq(StringUtils.isNotEmpty(dto.getTenantId()), PlatDeviceLog::getTenantId, dto.getTenantId()) .eq(StringUtils.isNotEmpty(dto.getTenantId()), PlatDeviceLog::getTenantId, dto.getTenantId())
.ge(dto.getStartTime() != null, PlatDeviceLog::getCreateDate, dto.getStartTime()) .ge(dto.getStartTime() != null, PlatDeviceLog::getCreateDate, dto.getStartTime())
.ge(dto.getEndTime() != null, PlatDeviceLog::getCreateDate, dto.getEndTime()); .ge(dto.getEndTime() != null, PlatDeviceLog::getCreateDate, dto.getEndTime());
Page<PlatDeviceLog> deviceLogPage = platDeviceLogMapper.selectPage(p, lambdaQueryWrapper); Page<PlatDeviceLog> deviceLogPage = platDeviceLogMapper.selectPage(p, lambdaQueryWrapper);
List<PlatDeviceLog> records = deviceLogPage.getRecords();
List<String> tenantIdList = StreamUtil.map(records, BaseBusEntity::getTenantId);
List<PlatTenant> platTenantList = platTenantService.listByIds(tenantIdList);
Map<String, String> tenantMap = platTenantList.stream().collect(Collectors.toMap(BaseEntity::getId, PlatTenant::getName, ((v1, v2) -> v2)));
for (PlatDeviceLog record : records) {
record.setTenantName(tenantMap.getOrDefault(record.getTenantId(),""));
}
return PageUtil.toPageVO(deviceLogPage.getRecords(), deviceLogPage); return PageUtil.toPageVO(records, deviceLogPage);
} }
} }
...@@ -102,7 +102,7 @@ public class PlatElderBreatheAnalysisServiceImpl extends ServiceImpl<PlatElderBr ...@@ -102,7 +102,7 @@ public class PlatElderBreatheAnalysisServiceImpl extends ServiceImpl<PlatElderBr
.in(PlatElderBreatheDayStat::getElderId, elderIdList) .in(PlatElderBreatheDayStat::getElderId, elderIdList)
.eq(PlatElderBreatheDayStat::getDay, yesDate)); .eq(PlatElderBreatheDayStat::getDay, yesDate));
Map<String, PlatElderBreatheDayStat> breatheDayStatMap = StreamUtil.toMap(elderBreatheDayStatList, PlatElderBreatheDayStat::getElderId); Map<String, PlatElderBreatheDayStat> breatheDayStatMap = StreamUtil.toMapDep(elderBreatheDayStatList, PlatElderBreatheDayStat::getElderId);
SaasSleepAnalysisModel analysisModel = saasSleepAnalysisModelService.getOne(new QueryWrapper<SaasSleepAnalysisModel>().lambda() SaasSleepAnalysisModel analysisModel = saasSleepAnalysisModelService.getOne(new QueryWrapper<SaasSleepAnalysisModel>().lambda()
.orderByDesc(BaseEntity::getCreateBy) .orderByDesc(BaseEntity::getCreateBy)
......
...@@ -422,13 +422,8 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService { ...@@ -422,13 +422,8 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
JSONObject result = JSON.parseObject(entity.toString()); JSONObject result = JSON.parseObject(entity.toString());
Object track = result.get("track"); Object track = result.get("track");
List<Integer> list = track == null ? Lists.newArrayList() : (List<Integer>) track; List<Integer> list = track == null ? Lists.newArrayList() : (List<Integer>) track;
String distance = result.getString("track"); vo.setX(CollectionUtils.isNotEmpty(list) ? new BigDecimal(list.get(1)) : BigDecimal.ZERO);
BigDecimal x = new BigDecimal(distance).multiply(BigDecimal.valueOf(Math.cos(Double.parseDouble(list.get(1) + ""))) vo.setY(CollectionUtils.isNotEmpty(list) ? new BigDecimal(list.get(2)): BigDecimal.ZERO);
.setScale(2, RoundingMode.HALF_UP));
BigDecimal y = new BigDecimal(distance).multiply(BigDecimal.valueOf(Math.sin(Math.cos(Double.parseDouble(list.get(2) + ""))))
.setScale(2, RoundingMode.HALF_UP));
vo.setX(x);
vo.setY(y);
vo.setPersonState(Integer.valueOf(result.getString("personState"))); vo.setPersonState(Integer.valueOf(result.getString("personState")));
return vo; return vo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
......
...@@ -281,12 +281,11 @@ public class WorkStationServiceImpl implements WorkStationService { ...@@ -281,12 +281,11 @@ public class WorkStationServiceImpl implements WorkStationService {
for (WorkStationInstitutionRoomVO vo : roomVOList) { for (WorkStationInstitutionRoomVO vo : roomVOList) {
vo.setPathName(vo.getPathName() + "-" + vo.getRoomName()); vo.setPathName(vo.getPathName() + "-" + vo.getRoomName());
List<PlatDevice> deviceList = Lists.newArrayList();
if (bedMap.get(vo.getRoomId()) != null) { if (bedMap.get(vo.getRoomId()) != null) {
List<WorkStationInstitutionBedVO> roomBedVos = bedMap.get(vo.getRoomId()); List<WorkStationInstitutionBedVO> roomBedVos = bedMap.get(vo.getRoomId());
//获取告警类型及老人状态 //获取告警类型及老人状态
for(WorkStationInstitutionBedVO r : roomBedVos){ for(WorkStationInstitutionBedVO r : roomBedVos){
List<PlatDevice> deviceList = Lists.newArrayList();
List<PlatRoomBedDevice> platRoomBedDevices = roomDeviceMap.get(r.getRoomId()); List<PlatRoomBedDevice> platRoomBedDevices = roomDeviceMap.get(r.getRoomId());
if (CollectionUtils.isNotEmpty(platRoomBedDevices)) { if (CollectionUtils.isNotEmpty(platRoomBedDevices)) {
List<String> tempDeviceIdList = StreamUtil.map(platRoomBedDevices, PlatRoomBedDevice::getDeviceId); List<String> tempDeviceIdList = StreamUtil.map(platRoomBedDevices, PlatRoomBedDevice::getDeviceId);
......
...@@ -43,8 +43,6 @@ public class PlatLoginWechatServiceImpl implements PlatLoginWechatService { ...@@ -43,8 +43,6 @@ public class PlatLoginWechatServiceImpl implements PlatLoginWechatService {
PlatUser platUser = platUserService.getOne(new QueryWrapper<PlatUser>().lambda() PlatUser platUser = platUserService.getOne(new QueryWrapper<PlatUser>().lambda()
.eq(PlatUser::getAccount, loginDTO.getAccount()) .eq(PlatUser::getAccount, loginDTO.getAccount())
.or()
.eq(PlatUser::getMobile, loginDTO.getAccount())
); );
if (platUser == null) { if (platUser == null) {
......
...@@ -114,9 +114,8 @@ public class PushCallback implements MqttCallback { ...@@ -114,9 +114,8 @@ public class PushCallback implements MqttCallback {
Long timestamp = device.getTimestamp(); Long timestamp = device.getTimestamp();
// TODO 先这样判断 // TODO 先这样判断
if (REPORT_PROPERTY.equals(device.getMessageType()) && headers.getProductName().contains("呼吸")) { if (REPORT_PROPERTY.equals(device.getMessageType()) && headers.getProductName().contains("呼吸")) {
// 缓存呼吸设备某段时间的数据,hash 最大长度 duration // 缓存呼吸设备某段时间的数据,hash 最大长度 duration
Long duration = getSleepTimeActionDuration(); long duration = getSleepTimeActionDuration();
Long size = redisTemplate.opsForHash().size(DEVICE_BR_ANALYSIS + device.getDeviceId()); Long size = redisTemplate.opsForHash().size(DEVICE_BR_ANALYSIS + device.getDeviceId());
if (size.equals(duration * 60)) { if (size.equals(duration * 60)) {
redisTemplate.opsForHash().delete(DEVICE_BR_ANALYSIS + device.getDeviceId(),timestamp - duration * 60); redisTemplate.opsForHash().delete(DEVICE_BR_ANALYSIS + device.getDeviceId(),timestamp - duration * 60);
......
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