|
|
@@ -41,6 +41,7 @@ import java.net.URLDecoder;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.ZoneId;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
|
|
|
@@ -105,7 +106,7 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
ArrayList<LastSevenDaysTrackVo> vos = new ArrayList<>();
|
|
|
for (SmartFaceDiscern faceDiscern : smartFaceDiscerns) {
|
|
|
// 人脸通过type查询对应的坐标
|
|
|
- SmartCoord smartCoord=smartCoordService.getBytype(faceDiscern.getLocation());
|
|
|
+ SmartCoord smartCoord = smartCoordService.getBytype(faceDiscern.getLocation());
|
|
|
LastSevenDaysTrackVo lastSevenDaysTrackVo = new LastSevenDaysTrackVo();
|
|
|
if (ObjectUtils.isNotEmpty(smartCoord)) {
|
|
|
lastSevenDaysTrackVo.setLocation(smartCoord.getType());
|
|
|
@@ -124,7 +125,7 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
SmartClass smartClass = smartClassService.getSmartClassById(smartUser.getSchoolClass());
|
|
|
String className = smartClass.getName();
|
|
|
// 通过班级找到对应的坐标
|
|
|
- SmartCoord coord=smartCoordService.getBytype(className);
|
|
|
+ SmartCoord coord = smartCoordService.getBytype(className);
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
for (SmartAttendance attendance : attendances) {
|
|
|
LastSevenDaysTrackVo lastSevenDaysTrackVo = new LastSevenDaysTrackVo();
|
|
|
@@ -134,13 +135,13 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
|
|
|
lastSevenDaysTrackVo.setName(attendance.getXwUserName());
|
|
|
Integer status = attendance.getStatus();
|
|
|
- if (status==0) {
|
|
|
+ if (status == 0) {
|
|
|
lastSevenDaysTrackVo.setType("准时打卡");
|
|
|
- }else if (1==status){
|
|
|
+ } else if (1 == status) {
|
|
|
lastSevenDaysTrackVo.setType("迟到打卡");
|
|
|
- }else if (7==status){
|
|
|
+ } else if (7 == status) {
|
|
|
lastSevenDaysTrackVo.setType("超时打卡");
|
|
|
- }else if (6==status){
|
|
|
+ } else if (6 == status) {
|
|
|
lastSevenDaysTrackVo.setType("请假");
|
|
|
}
|
|
|
|
|
|
@@ -154,7 +155,7 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
List<SmartAccess> smartAccesses = smartAccessService.track(startTime, endTime, id);
|
|
|
for (SmartAccess faceDiscern : smartAccesses) {
|
|
|
// 门禁的通过type找到对应的坐标
|
|
|
- SmartCoord smartCoord=smartCoordService.getBytype(faceDiscern.getType());
|
|
|
+ SmartCoord smartCoord = smartCoordService.getBytype(faceDiscern.getType());
|
|
|
|
|
|
LastSevenDaysTrackVo lastSevenDaysTrackVo = new LastSevenDaysTrackVo();
|
|
|
|
|
|
@@ -184,25 +185,41 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
public CommonResult access() {
|
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
-
|
|
|
+ LocalDateTime stateTime = now.minusDays(29);
|
|
|
+ LocalDateTime endTime = now.minusDays(1);
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ Date stateDTime = Date.from(stateTime.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
+ Date endDTime = Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
+ String startStr = TimeExchange.getStartOfDayStr(stateDTime);
|
|
|
+ String endStr = TimeExchange.getEndOfDayStr(endDTime);
|
|
|
+ List<FaceDiscernVo> smartAccesses = smartFaceDiscernService.queryFaceCountByDate(startStr, endStr);
|
|
|
+ LambdaQueryWrapper<SmartQrcode> qrcodeWrapper = new LambdaQueryWrapper<>();
|
|
|
+ qrcodeWrapper.between(SmartQrcode::getCreateTime, stateTime, endTime);
|
|
|
+ List<SmartQrcode> smartQrcodes = smartQrcodeService.list(qrcodeWrapper);
|
|
|
+ LambdaQueryWrapper<SmartCarAccess> smartCarAccessWrapper = new LambdaQueryWrapper<>();
|
|
|
+ smartCarAccessWrapper.between(SmartCarAccess::getDataTime, stateTime, endTime);
|
|
|
+ List<SmartCarAccess> smartCarAccesses = smartCarAccessService.list(smartCarAccessWrapper);
|
|
|
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
for (int i = 0; i < 30; i++) {
|
|
|
- LocalDateTime stateTime = now.minusDays(i + 1);
|
|
|
- LocalDateTime endTime = now.minusDays(i);
|
|
|
- String dateTime = endTime.format(dateTimeFormatter);
|
|
|
- LambdaQueryWrapper<SmartAccess> smartAccessWrapper = new LambdaQueryWrapper<>();
|
|
|
- smartAccessWrapper.between(SmartAccess::getDateTime, stateTime, endTime);
|
|
|
- int faceDiscernCount = smartAccessService.count(smartAccessWrapper);
|
|
|
-
|
|
|
- LambdaQueryWrapper<SmartQrcode> qrcodeWrapper = new LambdaQueryWrapper<>();
|
|
|
- qrcodeWrapper.between(SmartQrcode::getCreateTime, stateTime, endTime);
|
|
|
- int qrcodeCount = smartQrcodeService.count(qrcodeWrapper);
|
|
|
+ LocalDateTime eachStateTime = now.minusDays(i + 1);
|
|
|
+ LocalDateTime eachEndTime = now.minusDays(i);
|
|
|
+ String dateTime = eachEndTime.format(dateTimeFormatter);
|
|
|
+ Date startDate = Date.from(eachStateTime.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
+ Date endDate = Date.from(eachEndTime.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
+
|
|
|
+ //<0 : A < B
|
|
|
+ //=0 : A = B
|
|
|
+ //>0 : A > B
|
|
|
+ int faceDiscernCount = 0;
|
|
|
+ Optional<FaceDiscernVo> oFaceDiscern =smartAccesses.stream().filter(e -> e.getDateStr().equals(dateTime)).findFirst();
|
|
|
+ if(oFaceDiscern != null && oFaceDiscern.isPresent()){
|
|
|
+ faceDiscernCount = oFaceDiscern.get().getCount();
|
|
|
+ }
|
|
|
|
|
|
- LambdaQueryWrapper<SmartCarAccess> smartCarAccessWrapper = new LambdaQueryWrapper<>();
|
|
|
- smartCarAccessWrapper.between(SmartCarAccess::getDataTime, stateTime, endTime);
|
|
|
- int carCount = smartCarAccessService.count(smartCarAccessWrapper);
|
|
|
+ long qrcodeCount = smartQrcodes.stream().filter(e -> e.getCreateTime().compareTo(startDate) >= 0 && e.getCreateTime().compareTo(endDate) <= 0).count();
|
|
|
+ long carCount = smartCarAccesses.stream().filter(e -> TimeExchange.StringToDate(e.getDataTime(), "yyyy-MM-dd HH:mm:ss").compareTo(startDate) >= 0
|
|
|
+ && TimeExchange.StringToDate(e.getDataTime(), "yyyy-MM-dd HH:mm:ss").compareTo(endDate) <= 0).count();
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("date", dateTime);
|
|
|
@@ -249,13 +266,13 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
LastSevenDaysTrackVo lastSevenDaysTrackVo = new LastSevenDaysTrackVo();
|
|
|
lastSevenDaysTrackVo.setName(attendance.getXwUserName());
|
|
|
Integer status = attendance.getStatus();
|
|
|
- if (status==0) {
|
|
|
+ if (status == 0) {
|
|
|
lastSevenDaysTrackVo.setType("准时打卡");
|
|
|
- }else if (1==status){
|
|
|
+ } else if (1 == status) {
|
|
|
lastSevenDaysTrackVo.setType("迟到打卡");
|
|
|
- }else if (7==status){
|
|
|
+ } else if (7 == status) {
|
|
|
lastSevenDaysTrackVo.setType("超时打卡");
|
|
|
- }else if (6==status){
|
|
|
+ } else if (6 == status) {
|
|
|
lastSevenDaysTrackVo.setType("请假");
|
|
|
}
|
|
|
lastSevenDaysTrackVo.setLocation(className);
|
|
|
@@ -387,7 +404,7 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
|
|
|
Integer identityId = smartUser.getIdentityId();
|
|
|
// 判断是否是学生
|
|
|
- if (2==identityId) {
|
|
|
+ if (2 == identityId) {
|
|
|
// 获取推送配置
|
|
|
List<SmartPushConfig> pushConfigs = smartPushConfigService.list(new LambdaQueryWrapper<>());
|
|
|
SmartPushConfig smartPushConfig = pushConfigs.get(0);
|
|
|
@@ -407,15 +424,15 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
pushType = "进入大门";
|
|
|
} else if (type.contains("出校")) {
|
|
|
pushType = "离开大门";
|
|
|
- }else if (type.contains("进地下室")){
|
|
|
+ } else if (type.contains("进地下室")) {
|
|
|
pushType = "进入地下室";
|
|
|
- }else if (type.contains("出地下室")){
|
|
|
+ } else if (type.contains("出地下室")) {
|
|
|
pushType = "离开地下室";
|
|
|
}
|
|
|
LocalDateTime date = LocalDateTime.now();
|
|
|
String format = date.format(dateTimeFormatter1);
|
|
|
// 公众号信息推送
|
|
|
- Message2.send2(gzhOpenId,s,format,address);
|
|
|
+ Message2.send2(gzhOpenId, s, format, address);
|
|
|
|
|
|
SmartNotification smartNotification = new SmartNotification();
|
|
|
smartNotification.setUserId(user.getId());
|
|
|
@@ -434,7 +451,7 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (1==chargeTeacherPush) {
|
|
|
+ if (1 == chargeTeacherPush) {
|
|
|
Integer schoolClass = smartUser.getSchoolClass();
|
|
|
// 通过班级找到对应的班主任
|
|
|
List<SmartUser> userLists = smartUserService.getChargeTeacher(schoolClass);
|
|
|
@@ -448,15 +465,15 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
pushType = "进入大门";
|
|
|
} else if (type.contains("出校")) {
|
|
|
pushType = "离开大门";
|
|
|
- }else if (type.contains("进地下室")){
|
|
|
+ } else if (type.contains("进地下室")) {
|
|
|
pushType = "进入地下室";
|
|
|
- }else if (type.contains("出地下室")){
|
|
|
+ } else if (type.contains("出地下室")) {
|
|
|
pushType = "离开地下室";
|
|
|
}
|
|
|
LocalDateTime date = LocalDateTime.now();
|
|
|
String format = date.format(dateTimeFormatter1);
|
|
|
// 公众号信息推送
|
|
|
- Message2.send2(gzhOpenId,s,format,address);
|
|
|
+ Message2.send2(gzhOpenId, s, format, address);
|
|
|
|
|
|
SmartNotification smartNotification = new SmartNotification();
|
|
|
smartNotification.setUserId(user.getId());
|
|
|
@@ -535,7 +552,7 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
List<SmartFaceDiscern> faceDiscerns = smartFaceDiscernService.track(startTime, endTime, userId);
|
|
|
for (SmartFaceDiscern faceDiscern : faceDiscerns) {
|
|
|
// 人脸通过type查询对应的坐标
|
|
|
- SmartCoord smartCoord=smartCoordService.getBytype(faceDiscern.getLocation());
|
|
|
+ SmartCoord smartCoord = smartCoordService.getBytype(faceDiscern.getLocation());
|
|
|
SelectTrackVo vo = new SelectTrackVo();
|
|
|
if (ObjectUtils.isNotEmpty(smartCoord)) {
|
|
|
vo.setX(smartCoord.getX());
|
|
|
@@ -557,7 +574,7 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
String className = smartClass.getName();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
// 通过班级找到对应的坐标
|
|
|
- SmartCoord coord=smartCoordService.getBytype(className);
|
|
|
+ SmartCoord coord = smartCoordService.getBytype(className);
|
|
|
for (SmartAttendance attendance : attendances) {
|
|
|
SelectTrackVo vo = new SelectTrackVo();
|
|
|
if (ObjectUtils.isNotEmpty(coord)) {
|
|
|
@@ -567,13 +584,13 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
}
|
|
|
vo.setName(attendance.getXwUserName());
|
|
|
Integer status = attendance.getStatus();
|
|
|
- if (status==0) {
|
|
|
+ if (status == 0) {
|
|
|
vo.setType("准时打卡");
|
|
|
- }else if (1==status){
|
|
|
+ } else if (1 == status) {
|
|
|
vo.setType("迟到打卡");
|
|
|
- }else if (7==status){
|
|
|
+ } else if (7 == status) {
|
|
|
vo.setType("超时打卡");
|
|
|
- }else if (6==status){
|
|
|
+ } else if (6 == status) {
|
|
|
vo.setType("请假");
|
|
|
}
|
|
|
Date attendTime = attendance.getAttendTime();
|
|
|
@@ -585,7 +602,7 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
List<SmartAccess> smartAccesses = smartAccessService.track(startTime, endTime, userId);
|
|
|
for (SmartAccess smartAccesse : smartAccesses) {
|
|
|
// 门禁的通过type找到对应的坐标
|
|
|
- SmartCoord smartCoord=smartCoordService.getBytype(smartAccesse.getType());
|
|
|
+ SmartCoord smartCoord = smartCoordService.getBytype(smartAccesse.getType());
|
|
|
SelectTrackVo vo = new SelectTrackVo();
|
|
|
if (ObjectUtils.isNotEmpty(smartCoord)) {
|
|
|
vo.setX(smartCoord.getX());
|
|
|
@@ -611,8 +628,8 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
|
|
|
@Override
|
|
|
@DESRespondSecret(validated = true)
|
|
|
- public CommonResult faceManagement(int currentPage, int pageCount, String keyWord,String gradeId,String classId,String startTime,String endTime) {
|
|
|
- PageUtils<FaceManagementVo> result= smartFaceDiscernService.faceManagement(currentPage,pageCount,keyWord,gradeId,classId,startTime,endTime);
|
|
|
+ public CommonResult faceManagement(int currentPage, int pageCount, String keyWord, String gradeId, String classId, String startTime, String endTime) {
|
|
|
+ PageUtils<FaceManagementVo> result = smartFaceDiscernService.faceManagement(currentPage, pageCount, keyWord, gradeId, classId, startTime, endTime);
|
|
|
|
|
|
return CommonResult.ok(result);
|
|
|
}
|
|
|
@@ -633,14 +650,14 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
// 默认前一天的
|
|
|
- if (ObjectUtils.isEmpty(startTime)||ObjectUtils.isEmpty(endTime)) {
|
|
|
+ if (ObjectUtils.isEmpty(startTime) || ObjectUtils.isEmpty(endTime)) {
|
|
|
LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
|
|
|
LocalDateTime end = now.plusDays(1);
|
|
|
- startTime=now.format(dateTimeFormatter);
|
|
|
- endTime=end.format(dateTimeFormatter);
|
|
|
+ startTime = now.format(dateTimeFormatter);
|
|
|
+ endTime = end.format(dateTimeFormatter);
|
|
|
}
|
|
|
|
|
|
- List<FaceManagementVo> vos= smartFaceDiscernService.faceManagementExport(keyWord,gradeId,classId,startTime,endTime);
|
|
|
+ List<FaceManagementVo> vos = smartFaceDiscernService.faceManagementExport(keyWord, gradeId, classId, startTime, endTime);
|
|
|
|
|
|
for (int i = 0; i < vos.size(); i++) {
|
|
|
FaceManagementVo vo = vos.get(i);
|