定时删除过期访客

This commit is contained in:
张博 2024-11-01 10:04:15 +08:00
parent cc1f33fc50
commit eccf6f1406
1 changed files with 15 additions and 8 deletions

View File

@ -3,8 +3,10 @@
package net.shapelight.modules.job.task; package net.shapelight.modules.job.task;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import net.shapelight.common.utils.Constant; import net.shapelight.common.utils.Constant;
import net.shapelight.common.utils.DateUtils; import net.shapelight.common.utils.DateUtils;
import net.shapelight.modules.face.util.UserRamGroup;
import net.shapelight.modules.nettyapi.service.ServerApiService; import net.shapelight.modules.nettyapi.service.ServerApiService;
import net.shapelight.modules.sys.entity.SysDbBakEntity; import net.shapelight.modules.sys.entity.SysDbBakEntity;
import net.shapelight.modules.sys.service.SysDbBakService; import net.shapelight.modules.sys.service.SysDbBakService;
@ -27,6 +29,7 @@ import java.util.List;
*/ */
@Component("personProcessTask") @Component("personProcessTask")
@Data @Data
@Slf4j
public class PersonProcessTask implements ITask { public class PersonProcessTask implements ITask {
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
@ -39,22 +42,26 @@ public class PersonProcessTask implements ITask {
@Override @Override
public void run(String params) { public void run(String params) {
logger.debug("personProcessTask定时任务正在执行,参数为:{}", params); logger.debug("personProcessTask定时任务正在执行.................................");
//1. 遍历人员表找出所有过期的访客并设置为过期不可用 //1. 遍历人员表找出所有过期的访客并设置为过期不可用
List<TenPersonEntity> guestList = tenPersonService.getAllExpireGuest(); List<TenPersonEntity> guestList = tenPersonService.getAllExpireGuest();
for (TenPersonEntity guest : guestList) { for (TenPersonEntity guest : guestList) {
guest.setStatus(Constant.PESON_SUATUS_GUEST_DATE_OUT); guest.setStatus(Constant.PESON_SUATUS_GUEST_DATE_OUT);
//修改人员表 //修改人员表
tenPersonService.updateStatusById(guest); tenPersonService.updateStatusById(guest);
//特征保存到内存
UserRamGroup.removeUser(guest.getPersonId()+"",guest.getCellId()+"");
// UserRamCache.removeUser(guest.getPersonId()+"");
log.debug("内存删除人员:"+guest.getPersonId()+" 姓名:"+guest.getName());
//修改同步表 //修改同步表
List<TenPersonSyncEntity> syncEntityList = tenPersonSyncService.findByPersonId(guest.getPersonId(),guest.getTenantId()); // List<TenPersonSyncEntity> syncEntityList = tenPersonSyncService.findByPersonId(guest.getPersonId(),guest.getTenantId());
for(TenPersonSyncEntity syncEntity: syncEntityList){ // for(TenPersonSyncEntity syncEntity: syncEntityList){
syncEntity.setState(Constant.PERSON_SYNC_DELETE); // syncEntity.setState(Constant.PERSON_SYNC_DELETE);
tenPersonSyncService.updateById(syncEntity); // tenPersonSyncService.updateById(syncEntity);
} // }
} }
//断开说有设备 //断开说有设备
serverApiService.closeAll(); // serverApiService.closeAll();
logger.debug("personProcessTask定时任务执行完毕"); logger.debug("personProcessTask定时任务执行完毕....................");
} }
} }