Commit 46a64466 authored by 赵啸非's avatar 赵啸非

修改通知去重复

parent 3e939741
......@@ -83,6 +83,7 @@ public class MeetSwitchTaskImpl implements ITaskExcuteService {
uploadDeviceReq.setDeviceCodeList(Arrays.asList(recordEntity.getDeviceCode()));
uploadDeviceReq.setAction("preMeetStart");
uploadDeviceReq.setContent(JSON.toJSONString(recordEntity));
log.info("preMeetStart send msg :{}",recordEntity.getDeviceCode());
messageFeign.downMsg(uploadDeviceReq);
}
}
......
......@@ -2,10 +2,16 @@ package com.mortals.xhx.module.metting.service.impl;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateRange;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.common.code.MeetStatusEnum;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.UploadDeviceReq;
import com.mortals.xhx.feign.device.IDeviceMessageFeign;
import com.mortals.xhx.module.basic.model.BasicSetEntity;
import com.mortals.xhx.module.basic.service.BasicSetService;
import com.mortals.xhx.module.metting.model.MettingRecordQuery;
import com.mortals.xhx.module.room.model.RoomDeviceQuery;
import com.mortals.xhx.module.room.model.RoomEntity;
......@@ -45,6 +51,8 @@ public class MettingRecordServiceImpl extends AbstractCRUDServiceImpl<MettingRec
private RoomService roomService;
@Autowired
private RoomDeviceService roomDeviceService;
@Autowired
private BasicSetService basicSetService;
@Override
protected void validData(MettingRecordEntity entity, Context context) throws AppException {
......@@ -86,8 +94,8 @@ public class MettingRecordServiceImpl extends AbstractCRUDServiceImpl<MettingRec
UploadDeviceReq uploadDeviceReq = new UploadDeviceReq();
RoomEntity roomEntity = roomService.get(entity.getRoomId(), context);
if(!ObjectUtils.isEmpty(roomEntity)){
uploadDeviceReq.setDeviceCodeList( roomDeviceService.find(new RoomDeviceQuery().roomId(roomEntity.getId())).stream().map(i->i.getDeviceCode()).collect(Collectors.toList()));
if (!ObjectUtils.isEmpty(roomEntity)) {
uploadDeviceReq.setDeviceCodeList(roomDeviceService.find(new RoomDeviceQuery().roomId(roomEntity.getId())).stream().map(i -> i.getDeviceCode()).collect(Collectors.toList()));
uploadDeviceReq.setAction("refreshMetting");
messageFeign.downMsg(uploadDeviceReq);
}
......@@ -106,4 +114,30 @@ public class MettingRecordServiceImpl extends AbstractCRUDServiceImpl<MettingRec
public Boolean checkTimesHasOverlap(Date dynaStartTime, Date dynaEndTime, Date fixedStartTime, Date fixedEndTime) {
return !(dynaEndTime.getTime() < fixedStartTime.getTime() || dynaStartTime.getTime() > fixedEndTime.getTime());
}
@Override
protected void findAfter(MettingRecordEntity params, PageInfo pageInfo, Context context, List<MettingRecordEntity> list) throws AppException {
BasicSetEntity basicSetEntity = basicSetService.selectOne(new BasicSetEntity());
if (!ObjectUtils.isEmpty(basicSetEntity) &&!ObjectUtils.isEmpty(basicSetEntity.getPreMeetStart()) && basicSetEntity.getPreMeetStart() > 0) {
//会议开始前几分钟 通知设备进行数据更新
MettingRecordQuery mettingRecordQuery = new MettingRecordQuery();
//mettingRecordQuery.setFinishMethod(FinishMethodEnum.自动结束.getValue());
mettingRecordQuery.setMeetStatus(MeetStatusEnum.等待中.getValue());
List<MettingRecordEntity> recordEntities = this.find(mettingRecordQuery);
for (MettingRecordEntity recordEntity : recordEntities) {
long between = DateUtil.between(new Date(), recordEntity.getMeetTimeStart(), DateUnit.MINUTE);
if (between <= basicSetEntity.getPreMeetStart()) {
//通知设备进行数据更新
UploadDeviceReq uploadDeviceReq = new UploadDeviceReq();
uploadDeviceReq.setDeviceCodeList(Arrays.asList(recordEntity.getDeviceCode()));
uploadDeviceReq.setAction("preMeetStart");
uploadDeviceReq.setContent(JSON.toJSONString(recordEntity));
log.info("preMeetStart send msg :{}", recordEntity.getDeviceCode());
messageFeign.downMsg(uploadDeviceReq);
}
}
}
super.findAfter(params, pageInfo, context, list);
}
}
\ No newline at end of file
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 to comment