Commit cd1d2342 by 朱淼
parents 5c015b55 2bf556f5
{
"radarMount": {
"name": "雷达安装方式",
"type": "select",
"option": [{
"value": "0",
"name": "侧装"
},
{
"value": "1",
"name": "顶装"
}
]
},
"radarHight": {
"name": "雷达安装方式",
"type": "input",
"desc": "\"最小值\":200,\"最大值\":380,\"步进\":1,\"单位\":\"cm\""
}
}
\ No newline at end of file
......@@ -6,12 +6,17 @@ import com.makeit.global.aspect.misc.nofill.NoFillUtil;
import com.makeit.utils.user.common.CommonUserUtil;
import com.makeit.utils.user.common.CommonUserVO;
import org.apache.ibatis.reflection.MetaObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
@Order(30)
@Component
public class UserObjectHandler implements MetaObjectHandlerInternal {
private Logger logger = LoggerFactory.getLogger(UserObjectHandler.class);
@Override
public boolean support(MetaObject metaObject, MetaObjectHandler handler) {
return CommonUserUtil.getUser() != null;
......@@ -21,6 +26,8 @@ public class UserObjectHandler implements MetaObjectHandlerInternal {
public void insertFill(MetaObject metaObject, MetaObjectHandler handler) {
CommonUserVO commonUserVO = CommonUserUtil.getUser();
logger.info("user:{}",commonUserVO);
// if (metaObject.hasSetter(BaseEntity.Fields.createdByName)
// && handler.getFieldValByName(BaseEntity.Fields.createdByName, metaObject) == null) {
// handler.setFieldValByName(BaseEntity.Fields.createdByName, commonUserVO.getName(), metaObject);
......
......@@ -7,7 +7,10 @@ import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.alarm.PlatAlarmConfigDTOVO;
import com.makeit.dto.platform.alarm.PlatAlarmConfigQueryDTO;
import com.makeit.global.annotation.AuthIgnore;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.service.platform.alarm.PlatAlarmConfigService;
import com.makeit.utils.AlarmConfigCacheUtil;
import com.makeit.vo.platform.alarm.PlatAlarmConfigListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -81,6 +84,16 @@ public class PlatAlarmConfigController {
platAlarmConfigService.changeStatus(dto);
return ApiResponseUtils.success();
}
@Autowired
private AlarmConfigCacheUtil alarmConfigCacheUtil;
@ApiOperation("测试")
@PostMapping("test")
@TenantIdIgnore
@AuthIgnore
public ApiResponseEntity<?> test(@Validated @RequestBody PlatAlarmConfigDTOVO dto) {
alarmConfigCacheUtil.get(dto.getOrgId(),dto.getAlarmType());
return ApiResponseUtils.success();
}
}
......
......@@ -75,13 +75,21 @@ public class BehaviorAlarm implements IAlarm {
PlatAlarmConfigBehaviorDTOVO ruleConfig = JsonUtil.toObj(ruleConfigStr, PlatAlarmConfigBehaviorDTOVO.class);
Integer duration = ruleConfig.getDuration();//分钟
PlatDayDurationRecord platDayDurationRecord = dayDurationUtil.get(platDevice.getOriDeviceId());
if (platDayDurationRecord == null) {
log.error("行为告警未找到行为异常平均时长,设备plat_id:" + platDevice.getId());
return;
// if (platDayDurationRecord == null) {
// log.error("行为告警未找到行为异常平均时长,设备plat_id:" + platDevice.getId());
// return;
// }
Integer duration1 = 0;
if (platDayDurationRecord!=null){
duration1 = Math.toIntExact(platDayDurationRecord.getDuration());
}
Long duration1 = platDayDurationRecord.getDuration();
duration = duration * 60 + (int) (duration1 / 1000);
//duration+平均停留时长
if (duration == null){
duration = 0;
}else {
duration = duration * 60 + (duration1 / 1000);
}
List<String> personStateList = Arrays.asList("0");
//有人
//计数
......@@ -104,9 +112,11 @@ public class BehaviorAlarm implements IAlarm {
}
long count = endLong - startLong;
//进入空间时间满足告警时长,判断是否已经告警过了
if (count / 1000 >= duration && StringUtils.equals(alarmRedisDTO.getAlarm(), CommonEnum.NO.getValue())) {
if (duration!= 0 && count / 1000 >= duration && StringUtils.equals(alarmRedisDTO.getAlarm(), CommonEnum.NO.getValue())) {
log.error("空间雷达发出告警,设备plat_id:" + platDevice.getId());
notice(platAlarmCheckDTO);
if(duration1 != 0) {
notice(platAlarmCheckDTO);
}
alarmRedisDTO.setAlarm(CommonEnum.YES.getValue());
RedisUtil.set(RedisConst.ALARM_DEVICE_BEHAVIOR_ID + deviceId, alarmRedisDTO);
......
......@@ -126,7 +126,8 @@ implements PlatRoleService {
}
old = WrapperUtil.getOne(this, new QueryWrapper<PlatRole>().lambda()
.eq(PlatRole::getOrgId, dto.getOrgId()))
.eq(PlatRole::getOrgId, dto.getOrgId())
.eq(PlatRole::getCode, dto.getCode()))
;
if (old != null && !old.getId().equals(dto.getId())) {
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_CODE_DUPLICATE);
......
......@@ -126,7 +126,7 @@ public class PlatElderDayReportDayServiceImpl implements PlatElderDayReportDaySe
vo.setSleepAt(e.getStartSleep());
vo.setWakeUpAt(e.getEndSleep());
List<PlatElderSleepDiagramContentVO> contentList = StreamUtil.map(e.getSleepRecord(), i -> {
List<PlatElderSleepDiagramContentVO> contentList = StreamUtil.map(Optional.ofNullable(e.getSleepRecord()).orElse(new ArrayList<>(10)), i -> {
PlatElderSleepDiagramContentVO contentVO = new PlatElderSleepDiagramContentVO();
contentVO.setStartTime(i.getStartTime());
......
......@@ -131,7 +131,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
}
private LocalDate weekEndDate(LocalDateTime defaultTime) {
return weekStartDate(LocalDate.now().minusDays(1), defaultTime);
return weekEndDate(LocalDate.now().minusDays(1), defaultTime);
}
private LocalDate weekEndDate(LocalDate now, LocalDateTime defaultTime) {
......@@ -213,7 +213,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
public PlatElderSleepEvaluationVO sleepEvaluation(PlatElderReportDTO platElderIdDTO) {
LocalDate weekStartDate = weekStartDate(platElderIdDTO.getStartTime());
LocalDate weekEndDate = weekStartDate(platElderIdDTO.getEndTime());
LocalDate weekEndDate = weekEndDate(platElderIdDTO.getEndTime());
return sleepEvaluationInternal(platElderIdDTO, weekStartDate, weekEndDate);
......@@ -230,7 +230,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
public PlatElderSleepDiagramWeekVO sleepDiagram(PlatElderReportDTO platElderIdDTO) {
LocalDate weekStartDate = weekStartDate(platElderIdDTO.getStartTime());
LocalDate weekEndDate = weekStartDate(platElderIdDTO.getEndTime());
LocalDate weekEndDate = weekEndDate(platElderIdDTO.getEndTime());
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
......@@ -279,8 +279,36 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
});
return null;
List<PlatElderSleepDiagramWeekContentVO> rest = StreamUtil.map(dateList, e -> {
PlatElderSleepDiagramWeekContentVO vo = new PlatElderSleepDiagramWeekContentVO();
vo.setDay(e);
List<PlatElderSleep> list = Optional.ofNullable(sleepMap.get(2)).map(i -> i.get(dateTimeFormatter.format(e))).orElse(new ArrayList<>(10));
List<PlatSleepRangeVO> sleepRecord = list.stream().flatMap(i -> Optional.ofNullable(i.getSleepRecord()).orElse(new ArrayList<>(10)).stream()).collect(Collectors.toList());
vo.setSleepDeepDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SLEEP_DEEP.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue());
vo.setSleepModerateDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SLEEP_MODERATE.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue());
vo.setSleepLightnessDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SLEEP_LIGHTNESS.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue());
vo.setSoberDuration(sleepRecord.stream().filter(i -> SleepTypeEnum.SOBER.getCode().equals(i.getSleepType())).map(i -> duration(timeFormatter, i.getStartTime(), i.getEndTime())).reduce(0L, Long::sum).intValue());
PlatElderSleepAnalysis platElderSleepAnalysis = sleepAnalysisMap.get(dateTimeFormatter.format(e));
if (platElderSleepAnalysis != null) {
vo.setTurnedCount(platElderSleepAnalysis.getTurnedCount());
vo.setBodyMoveCount(platElderSleepAnalysis.getActionCount());
vo.setScore(Integer.valueOf(platElderSleepAnalysis.getSleepScore() + ""));
}
return vo;
});
PlatElderSleepDiagramWeekVO vo = new PlatElderSleepDiagramWeekVO();
vo.setSleep(sleep);
vo.setRest(rest);
return vo;
}
@Override
......@@ -317,7 +345,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
public PlatElderHeartRespiratoryEvaluationVO heartRespiratoryEvaluation(PlatElderReportDTO platElderIdDTO) {
LocalDate weekStartDate = weekStartDate(platElderIdDTO.getStartTime());
LocalDate weekEndDate = weekStartDate(platElderIdDTO.getEndTime());
LocalDate weekEndDate = weekEndDate(platElderIdDTO.getEndTime());
return heartRespiratoryEvaluationInternal(platElderIdDTO, weekStartDate, weekEndDate);
......@@ -346,7 +374,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
public List<PlatElderRealTimeHeartRespiratoryWeekVO> heartRespiratory(PlatElderReportDTO platElderIdDTO) {
LocalDate weekStartDate = weekStartDate(platElderIdDTO.getStartTime());
LocalDate weekEndDate = weekStartDate(platElderIdDTO.getEndTime());
LocalDate weekEndDate = weekEndDate(platElderIdDTO.getEndTime());
List<LocalDate> dateList = LocalDateTimeUtils.getDateSeries(weekStartDate, weekEndDate);
......@@ -427,7 +455,7 @@ public class PlatElderDayReportWeekServiceImpl implements PlatElderDayReportWeek
public List<PlatElderBehaviorDistributionVO> behaviorDistribution(PlatElderReportDTO platElderIdDTO) {
LocalDate weekStartDate = weekStartDate(platElderIdDTO.getStartTime());
LocalDate weekEndDate = weekStartDate(platElderIdDTO.getEndTime());
LocalDate weekEndDate = weekEndDate(platElderIdDTO.getEndTime());
List<LocalDate> dateList = LocalDateTimeUtils.getDateSeries(weekStartDate, weekEndDate);
......
......@@ -24,6 +24,7 @@ import com.makeit.service.platform.space.*;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.PageUtil;
import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.old.StringUtils;
import jodd.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -95,7 +96,7 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
List<String> listEquipmentIds = list.stream().map(item -> item.getDeviceId()).collect(Collectors.toList());
String orgId = "";
if(StringUtil.isNotEmpty(dto.getRoomId())){
if (StringUtil.isNotEmpty(dto.getRoomId())) {
PlatRoom platRoom = platRoomService.getById(dto.getRoomId());
PlatSpace platSpace = platSpaceService.getById(platRoom.getSpaceId());
orgId = platSpace.getOrgId();
......@@ -111,7 +112,7 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
queryWrapper.like(StringUtil.isNotEmpty(dto.getProductName()), PlatDevice::getProductName, dto.getProductName());
queryWrapper.eq(StringUtil.isNotEmpty(dto.getProductId()), PlatDevice::getProductId, dto.getProductId());
queryWrapper.eq(StringUtil.isNotEmpty(dto.getStatus()), PlatDevice::getStatus, dto.getStatus());
queryWrapper.eq(PlatDevice::getOrgId,orgId);
queryWrapper.eq(PlatDevice::getOrgId, orgId);
Page<PlatDevice> pages = platDeviceService.page(p, queryWrapper);
List<PlatDeviceDTO> listRecord = BeanDtoVoUtils.listVo(pages.getRecords(), PlatDeviceDTO.class);
......@@ -201,8 +202,17 @@ public class PlatRoomBedDeviceServiceImpl extends ServiceImpl<PlatRoomBedDeviceM
}
private List<PlatDevice> getDeviceInternal(String bedId, String category) {
if (StringUtils.isBlank(bedId)) {
return new ArrayList<>(10);
}
PlatBed bed = platBedService.getById(bedId);
if (bed == null) {
return new ArrayList<>(10);
}
List<PlatRoomBedDevice> deviceList = list(new QueryWrapper<PlatRoomBedDevice>().lambda()
.eq(PlatRoomBedDevice::getRoomId, bed.getRoomId()));
......
......@@ -13,5 +13,5 @@ import com.makeit.entity.saas.analysis.SaasModelManage;
*/
public interface SaasModelManageService extends IService<SaasModelManage> {
void updateEntity(String id, String sleep);
void updateEntity(String id, String type);
}
......@@ -51,6 +51,6 @@ public class SaasDiseaseModelServiceImpl extends ServiceImpl<SaasDiseaseModelMap
BeanUtils.copyProperties(dto,entity);
saveOrUpdate(entity);
saasModelManageService.updateEntity(dto.getId(),"sleep");
saasModelManageService.updateEntity(dto.getId(),"disease");
}
}
......@@ -52,7 +52,7 @@ public class SaasSleepAnalysisModelServiceImpl extends ServiceImpl<SaasSleepAnal
BeanUtils.copyProperties(dto,entity);
saveOrUpdate(entity);
saasModelManageService.updateEntity(dto.getId(),"disease");
saasModelManageService.updateEntity(dto.getId(),"sleep");
}
}
......@@ -3,11 +3,15 @@ package com.makeit.service.wechat.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.makeit.dto.platform.auth.PlatOrgSplitDTO;
import com.makeit.entity.platform.elder.PlatElderChildrenInfo;
import com.makeit.enums.Const;
import com.makeit.enums.HeaderConst;
import com.makeit.global.aspect.misc.nofill.NoFillUtil;
import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.elder.PlatElderChildrenInfoService;
import com.makeit.service.wechat.PlatElderChildrenInfoUserLoginWechatService;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.id.IdGen;
import com.makeit.utils.request.RequestUtil;
import com.makeit.utils.sys.FileUtil;
import com.makeit.utils.third.wechat.WechatLoginPhoneDTO;
import com.makeit.utils.third.wechat.WxUserInfo;
......@@ -52,12 +56,24 @@ public class PlatElderChildrenInfoUserLoginWechatServiceImpl implements PlatElde
childrenInfo.setStreetOrgId(vo.getStreetOrgId());
childrenInfo.setOrgPath(vo.getOrgPath());
childrenInfo.setCreateBy(userInfo.getNickName());
}
childrenInfo.setPhone(userInfo.getPhoneNumber());
childrenInfo.setAvatar(userInfo.getAvatarUrl());
platElderChildrenInfoService.saveOrUpdate(childrenInfo);
String token = IdGen.getUUID();
//RequestUtil.setHeader(HeaderConst.WECHAT_TOKEN, token);
childrenInfo.setUpdateBy(userInfo.getNickName());
PlatElderChildrenInfo finalChildrenInfo = childrenInfo;
NoFillUtil.executeCreate(()->{
NoFillUtil.executeUpdate(()->{
platElderChildrenInfoService.saveOrUpdate(finalChildrenInfo);
});
});
WechatUserInfo wechatUserVo = BeanDtoVoUtils.convert(childrenInfo, WechatUserInfo.class);
......@@ -65,11 +81,11 @@ public class PlatElderChildrenInfoUserLoginWechatServiceImpl implements PlatElde
u.setAvatarPath(f.getFullUrl());
});
String token = IdGen.getUUID();
wechatUserVo.setToken(token);
TokenUtil.wechatLogin(token, wechatUserVo);
return wechatUserVo;
}
......
......@@ -107,6 +107,7 @@ public class IotSyncTask {
}
platDevice.setOriDeviceId(iotDevice.getId());
platDevice.setName(iotDevice.getName());
platDevice.setOrgId(tenantId);
String productName = iotDevice.getProductName();
platDevice.setProductName(productName);
platDevice.setProductId(iotDevice.getProductId());
......
......@@ -37,7 +37,8 @@ public class AlarmConfigCacheUtil implements ApplicationRunner {
return list;
}
public void put(PlatAlarmConfig alarmConfig) {
public void put(PlatAlarmConfig alarmConfigVO) {
PlatAlarmConfig alarmConfig = platAlarmConfigService.getById(alarmConfigVO.getId());
if (StringUtils.equals(CommonEnum.YES.getValue(),alarmConfig.getStatus())) {
RedisUtil.set(RedisConst.ALARM_CONFIG_ORG_ID+alarmConfig.getOrgId() + ":" + alarmConfig.getAlarmType(),alarmConfig);
} else {
......
......@@ -59,7 +59,7 @@ public class DayDurationUtil implements ApplicationRunner {
public PlatDayDurationRecord get(String oriDeviceId) {
PlatDayDurationRecord platDayDurationRecord = RedisUtil.get(RedisConst.ELDER_DAY_DURATION_PREFIX + oriDeviceId);
if(platDayDurationRecord==null){
getAll();
//getAll();
}
return RedisUtil.get(RedisConst.ELDER_DAY_DURATION_PREFIX + oriDeviceId);
}
......
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