|
@@ -2,13 +2,18 @@ package com.template.services.impl;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.template.config.ScheduleConfig;
|
|
import com.template.config.ScheduleConfig;
|
|
|
|
|
+import com.template.model.dto.WarningUserDto;
|
|
|
import com.template.model.pojo.SmartAccess;
|
|
import com.template.model.pojo.SmartAccess;
|
|
|
import com.template.model.pojo.SmartFaceDiscern;
|
|
import com.template.model.pojo.SmartFaceDiscern;
|
|
|
import com.template.model.pojo.SmartRelation;
|
|
import com.template.model.pojo.SmartRelation;
|
|
|
import com.template.mapper.SmartRelationMapper;
|
|
import com.template.mapper.SmartRelationMapper;
|
|
|
import com.template.model.pojo.SmartUser;
|
|
import com.template.model.pojo.SmartUser;
|
|
|
|
|
+import com.template.model.result.PageUtils;
|
|
|
|
|
+import com.template.model.vo.UserVo;
|
|
|
import com.template.services.SmartAccessService;
|
|
import com.template.services.SmartAccessService;
|
|
|
import com.template.services.SmartFaceDiscernService;
|
|
import com.template.services.SmartFaceDiscernService;
|
|
|
import com.template.services.SmartRelationService;
|
|
import com.template.services.SmartRelationService;
|
|
@@ -47,6 +52,9 @@ public class SmartRelationServiceImpl extends ServiceImpl<SmartRelationMapper, S
|
|
|
@Autowired
|
|
@Autowired
|
|
|
SmartUserService smartUserService;
|
|
SmartUserService smartUserService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ SmartRelationMapper smartRelationMapper;
|
|
|
|
|
+
|
|
|
@Async
|
|
@Async
|
|
|
@Scheduled(cron = "0 0 1 * * ? ")//每天凌晨一点
|
|
@Scheduled(cron = "0 0 1 * * ? ")//每天凌晨一点
|
|
|
public void getAccessSmartRelation() {
|
|
public void getAccessSmartRelation() {
|
|
@@ -55,6 +63,7 @@ public class SmartRelationServiceImpl extends ServiceImpl<SmartRelationMapper, S
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
LocalDateTime start = now.withHour(0).withMinute(0).withSecond(0).minusDays(1);
|
|
LocalDateTime start = now.withHour(0).withMinute(0).withSecond(0).minusDays(1);
|
|
|
LocalDateTime end = now.withHour(23).withMinute(59).withSecond(59).minusDays(1);
|
|
LocalDateTime end = now.withHour(23).withMinute(59).withSecond(59).minusDays(1);
|
|
|
|
|
+ String format = start.format(pattern);
|
|
|
// 找到昨天的所有数据
|
|
// 找到昨天的所有数据
|
|
|
List<SmartAccess> accessList = smartAccessService.toDatelist(start, end);
|
|
List<SmartAccess> accessList = smartAccessService.toDatelist(start, end);
|
|
|
|
|
|
|
@@ -74,7 +83,8 @@ public class SmartRelationServiceImpl extends ServiceImpl<SmartRelationMapper, S
|
|
|
// 判断是否已添加,有的话则加1
|
|
// 判断是否已添加,有的话则加1
|
|
|
LambdaQueryWrapper<SmartRelation> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<SmartRelation> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(SmartRelation::getUserId, userId)
|
|
wrapper.eq(SmartRelation::getUserId, userId)
|
|
|
- .eq(SmartRelation::getRelationId, userId1);
|
|
|
|
|
|
|
+ .eq(SmartRelation::getRelationId, userId1)
|
|
|
|
|
+ .eq(SmartRelation::getDateTime,format);
|
|
|
SmartRelation one = this.getOne(wrapper);
|
|
SmartRelation one = this.getOne(wrapper);
|
|
|
if (ObjectUtils.isEmpty(one)) {
|
|
if (ObjectUtils.isEmpty(one)) {
|
|
|
SmartRelation smartRelation = new SmartRelation();
|
|
SmartRelation smartRelation = new SmartRelation();
|
|
@@ -87,6 +97,7 @@ public class SmartRelationServiceImpl extends ServiceImpl<SmartRelationMapper, S
|
|
|
smartRelation.setRelationName(smartById.getName());
|
|
smartRelation.setRelationName(smartById.getName());
|
|
|
}
|
|
}
|
|
|
smartRelation.setCount(0);
|
|
smartRelation.setCount(0);
|
|
|
|
|
+ smartRelation.setDateTime(format);
|
|
|
this.save(smartRelation);
|
|
this.save(smartRelation);
|
|
|
} else {
|
|
} else {
|
|
|
Integer count = one.getCount();
|
|
Integer count = one.getCount();
|
|
@@ -112,6 +123,9 @@ public class SmartRelationServiceImpl extends ServiceImpl<SmartRelationMapper, S
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
LocalDateTime start = now.withHour(0).withMinute(0).withSecond(0).minusDays(1);
|
|
LocalDateTime start = now.withHour(0).withMinute(0).withSecond(0).minusDays(1);
|
|
|
LocalDateTime end = now.withHour(23).withMinute(59).withSecond(59).minusDays(1);
|
|
LocalDateTime end = now.withHour(23).withMinute(59).withSecond(59).minusDays(1);
|
|
|
|
|
+
|
|
|
|
|
+ String format = start.format(pattern);
|
|
|
|
|
+
|
|
|
// 找到昨天的所有数据
|
|
// 找到昨天的所有数据
|
|
|
List<SmartFaceDiscern> faceDiscernList = smartFaceDiscernService.toDateList(start, end);
|
|
List<SmartFaceDiscern> faceDiscernList = smartFaceDiscernService.toDateList(start, end);
|
|
|
|
|
|
|
@@ -131,7 +145,8 @@ public class SmartRelationServiceImpl extends ServiceImpl<SmartRelationMapper, S
|
|
|
// 判断是否已添加,有的话则加1
|
|
// 判断是否已添加,有的话则加1
|
|
|
LambdaQueryWrapper<SmartRelation> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<SmartRelation> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(SmartRelation::getUserId, userId)
|
|
wrapper.eq(SmartRelation::getUserId, userId)
|
|
|
- .eq(SmartRelation::getRelationId, userId1);
|
|
|
|
|
|
|
+ .eq(SmartRelation::getRelationId, userId1)
|
|
|
|
|
+ .eq(SmartRelation::getDateTime,format);
|
|
|
SmartRelation one = this.getOne(wrapper);
|
|
SmartRelation one = this.getOne(wrapper);
|
|
|
if (ObjectUtils.isEmpty(one)) {
|
|
if (ObjectUtils.isEmpty(one)) {
|
|
|
SmartRelation smartRelation = new SmartRelation();
|
|
SmartRelation smartRelation = new SmartRelation();
|
|
@@ -143,6 +158,7 @@ public class SmartRelationServiceImpl extends ServiceImpl<SmartRelationMapper, S
|
|
|
if (ObjectUtils.isNotEmpty(smartById)) {
|
|
if (ObjectUtils.isNotEmpty(smartById)) {
|
|
|
smartRelation.setRelationName(smartById.getName());
|
|
smartRelation.setRelationName(smartById.getName());
|
|
|
}
|
|
}
|
|
|
|
|
+ smartRelation.setDateTime(format);
|
|
|
smartRelation.setCount(0);
|
|
smartRelation.setCount(0);
|
|
|
this.save(smartRelation);
|
|
this.save(smartRelation);
|
|
|
} else {
|
|
} else {
|
|
@@ -162,4 +178,13 @@ public class SmartRelationServiceImpl extends ServiceImpl<SmartRelationMapper, S
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public PageUtils<SmartRelation> getPage(int currentPage, int pageCount, Integer userId) {
|
|
|
|
|
+// Page<UserVo> page = new Page<>();
|
|
|
|
|
+// page.setCurrent(currentPage);
|
|
|
|
|
+// page.setSize(pageCount);
|
|
|
|
|
+// IPage<WarningUserDto> result = smartUserMapper.warningUserList(page, name);
|
|
|
|
|
+// return new PageUtils(result);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|