|
@@ -14,8 +14,16 @@ import com.template.common.utils.*;
|
|
|
import com.template.config.ControlConfig;
|
|
import com.template.config.ControlConfig;
|
|
|
import com.template.model.pojo.*;
|
|
import com.template.model.pojo.*;
|
|
|
import com.template.model.result.CommonResult;
|
|
import com.template.model.result.CommonResult;
|
|
|
|
|
+import com.template.model.result.PageUtils;
|
|
|
|
|
+import com.template.model.vo.AskForLeaveScreenVo;
|
|
|
|
|
+import com.template.model.vo.FaceManagementVo;
|
|
|
import com.template.model.vo.LastSevenDaysTrackVo;
|
|
import com.template.model.vo.LastSevenDaysTrackVo;
|
|
|
|
|
+import com.template.model.vo.SmartAccessVo;
|
|
|
import com.template.services.*;
|
|
import com.template.services.*;
|
|
|
|
|
+import org.apache.poi.ss.usermodel.Row;
|
|
|
|
|
+import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -84,6 +92,9 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
@Autowired
|
|
@Autowired
|
|
|
SmartAccessService smartAccessService;
|
|
SmartAccessService smartAccessService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ SmartPushConfigService smartPushConfigService;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@DESRespondSecret(validated = true)
|
|
@DESRespondSecret(validated = true)
|
|
|
public CommonResult track(Integer id, int dateTime) {
|
|
public CommonResult track(Integer id, int dateTime) {
|
|
@@ -337,39 +348,100 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
smartFaceDiscern.setImage(image);
|
|
smartFaceDiscern.setImage(image);
|
|
|
smartAccessService.save(smartFaceDiscern);
|
|
smartAccessService.save(smartFaceDiscern);
|
|
|
|
|
|
|
|
|
|
+ Integer identityId = smartUser.getIdentityId();
|
|
|
|
|
+// 判断是否是学生
|
|
|
|
|
+ if (2==identityId) {
|
|
|
|
|
+ // 获取推送配置
|
|
|
|
|
+ List<SmartPushConfig> pushConfigs = smartPushConfigService.list(new LambdaQueryWrapper<>());
|
|
|
|
|
+ SmartPushConfig smartPushConfig = pushConfigs.get(0);
|
|
|
|
|
+ Integer parentsPush = smartPushConfig.getParentsPush();
|
|
|
|
|
+ Integer chargeTeacherPush = smartPushConfig.getChargeTeacherPush();
|
|
|
|
|
+
|
|
|
|
|
+ if (parentsPush == 1) {
|
|
|
// 通过学生id找到关联的家长affiliate,并找到公众号,如果openid为空则不传
|
|
// 通过学生id找到关联的家长affiliate,并找到公众号,如果openid为空则不传
|
|
|
- List<SmartUser> userList = smartUserService.getAffiliateList(userId);
|
|
|
|
|
- if (ObjectUtils.isNotEmpty(userList) && userList.size() > 0) {
|
|
|
|
|
-
|
|
|
|
|
- for (SmartUser user : userList) {
|
|
|
|
|
- String gzhOpenId = user.getGzhOpenId();
|
|
|
|
|
- if (ObjectUtils.isNotEmpty(gzhOpenId)) {
|
|
|
|
|
- String pushType = "";
|
|
|
|
|
- if (type.contains("进校")) {
|
|
|
|
|
- pushType = "进入大门";
|
|
|
|
|
- } else if (type.contains("出校")) {
|
|
|
|
|
- pushType = "离开大门";
|
|
|
|
|
|
|
+ List<SmartUser> userList = smartUserService.getAffiliateList(userId);
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(userList) && userList.size() > 0) {
|
|
|
|
|
+
|
|
|
|
|
+ for (SmartUser user : userList) {
|
|
|
|
|
+ String gzhOpenId = user.getGzhOpenId();
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(gzhOpenId)) {
|
|
|
|
|
+ String pushType = "";
|
|
|
|
|
+ if (type.contains("进校")) {
|
|
|
|
|
+ pushType = "进入大门";
|
|
|
|
|
+ } else if (type.contains("出校")) {
|
|
|
|
|
+ pushType = "离开大门";
|
|
|
|
|
+ }else if (type.contains("进地下室")){
|
|
|
|
|
+ pushType = "进入地下室";
|
|
|
|
|
+ }else if (type.contains("出地下室")){
|
|
|
|
|
+ pushType = "离开地下室";
|
|
|
|
|
+ }
|
|
|
|
|
+ LocalDateTime date = LocalDateTime.now();
|
|
|
|
|
+ String format = date.format(dateTimeFormatter1);
|
|
|
|
|
+ // 公众号信息推送
|
|
|
|
|
+ Message2.send(gzhOpenId, pushType, address, format);
|
|
|
|
|
+
|
|
|
|
|
+ SmartNotification smartNotification = new SmartNotification();
|
|
|
|
|
+ smartNotification.setUserId(smartUser.getId());
|
|
|
|
|
+ smartNotification.setUserName(smartUser.getName());
|
|
|
|
|
+ smartNotification.setTypeName(pushType);
|
|
|
|
|
+ smartNotification.setLocation(address);
|
|
|
|
|
+ smartNotification.setImage(image);
|
|
|
|
|
+ smartNotification.setDateTime(time);
|
|
|
|
|
+ smartNotification.setType(2);
|
|
|
|
|
+
|
|
|
|
|
+ smartNotificationService.save(smartNotification);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- LocalDateTime date = LocalDateTime.now();
|
|
|
|
|
- String format = date.format(dateTimeFormatter1);
|
|
|
|
|
- // 公众号信息推送
|
|
|
|
|
- Message2.send(gzhOpenId, pushType, address, format);
|
|
|
|
|
-
|
|
|
|
|
- SmartNotification smartNotification = new SmartNotification();
|
|
|
|
|
- smartNotification.setUserId(smartUser.getId());
|
|
|
|
|
- smartNotification.setUserName(smartUser.getName());
|
|
|
|
|
- smartNotification.setTypeName(pushType);
|
|
|
|
|
- smartNotification.setLocation(address);
|
|
|
|
|
- smartNotification.setImage(image);
|
|
|
|
|
- smartNotification.setDateTime(time);
|
|
|
|
|
- smartNotification.setType(2);
|
|
|
|
|
-
|
|
|
|
|
- smartNotificationService.save(smartNotification);
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (1==chargeTeacherPush) {
|
|
|
|
|
+ Integer schoolClass = smartUser.getSchoolClass();
|
|
|
|
|
+// 通过班级找到对应的班主任
|
|
|
|
|
+ List<SmartUser> userLists = smartUserService.getChargeTeacher(schoolClass);
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(userLists) && userLists.size() > 0) {
|
|
|
|
|
+
|
|
|
|
|
+ for (SmartUser user : userLists) {
|
|
|
|
|
+ String gzhOpenId = user.getGzhOpenId();
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(gzhOpenId)) {
|
|
|
|
|
+ String pushType = "";
|
|
|
|
|
+ if (type.contains("进校")) {
|
|
|
|
|
+ pushType = "进入大门";
|
|
|
|
|
+ } else if (type.contains("出校")) {
|
|
|
|
|
+ pushType = "离开大门";
|
|
|
|
|
+ }else if (type.contains("进地下室")){
|
|
|
|
|
+ pushType = "进入地下室";
|
|
|
|
|
+ }else if (type.contains("出地下室")){
|
|
|
|
|
+ pushType = "离开地下室";
|
|
|
|
|
+ }
|
|
|
|
|
+ LocalDateTime date = LocalDateTime.now();
|
|
|
|
|
+ String format = date.format(dateTimeFormatter1);
|
|
|
|
|
+ // 公众号信息推送
|
|
|
|
|
+ Message2.send(gzhOpenId, pushType, address, format);
|
|
|
|
|
+
|
|
|
|
|
+ SmartNotification smartNotification = new SmartNotification();
|
|
|
|
|
+ smartNotification.setUserId(smartUser.getId());
|
|
|
|
|
+ smartNotification.setUserName(smartUser.getName());
|
|
|
|
|
+ smartNotification.setTypeName(pushType);
|
|
|
|
|
+ smartNotification.setLocation(address);
|
|
|
|
|
+ smartNotification.setImage(image);
|
|
|
|
|
+ smartNotification.setDateTime(time);
|
|
|
|
|
+ smartNotification.setType(2);
|
|
|
|
|
+
|
|
|
|
|
+ smartNotificationService.save(smartNotification);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
|
@@ -471,6 +543,56 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
|
|
|
return CommonResult.ok(vos);
|
|
return CommonResult.ok(vos);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @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);
|
|
|
|
|
+
|
|
|
|
|
+ return CommonResult.ok(result);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void faceManagementExport(HttpServletResponse response, String keyWord, String gradeId, String classId, String startTime, String endTime) {
|
|
|
|
|
+ //导出
|
|
|
|
|
+ Workbook workbook = new XSSFWorkbook();
|
|
|
|
|
+ Sheet sheet = workbook.createSheet("人脸记录");
|
|
|
|
|
+ Row headerRow = sheet.createRow(0);
|
|
|
|
|
+ headerRow.createCell(0).setCellValue("序号");
|
|
|
|
|
+ headerRow.createCell(1).setCellValue("姓名");
|
|
|
|
|
+ headerRow.createCell(2).setCellValue("班级");
|
|
|
|
|
+ headerRow.createCell(3).setCellValue("年级");
|
|
|
|
|
+ headerRow.createCell(4).setCellValue("地点");
|
|
|
|
|
+ headerRow.createCell(5).setCellValue("图片");
|
|
|
|
|
+ headerRow.createCell(6).setCellValue("创建时间");
|
|
|
|
|
+
|
|
|
|
|
+ DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ // 默认前一天的
|
|
|
|
|
+ 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);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<FaceManagementVo> vos= smartFaceDiscernService.faceManagementExport(keyWord,gradeId,classId,startTime,endTime);
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < vos.size(); i++) {
|
|
|
|
|
+ FaceManagementVo vo = vos.get(i);
|
|
|
|
|
+ Row dataRow = sheet.createRow(i + 1);
|
|
|
|
|
+ dataRow.createCell(0).setCellValue(i + 1);
|
|
|
|
|
+ dataRow.createCell(1).setCellValue(vo.getName());
|
|
|
|
|
+ dataRow.createCell(2).setCellValue(vo.getClassName());
|
|
|
|
|
+ dataRow.createCell(3).setCellValue(vo.getGradeName());
|
|
|
|
|
+ dataRow.createCell(4).setCellValue(vo.getLocation());
|
|
|
|
|
+ dataRow.createCell(5).setCellValue(vo.getImage());
|
|
|
|
|
+ dataRow.createCell(6).setCellValue(vo.getDateTime());
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 将工作簿写入文件
|
|
|
|
|
+ ExcelUtils.excelDownload(workbook, "人脸记录.xlsx", response);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
public static JSONObject getDate(Integer date) {
|
|
public static JSONObject getDate(Integer date) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|