Prechádzať zdrojové kódy

Merge branch 'master' of https://e.coding.net/chuanghaikeji/smartCampus/backend_code

夏文涛 2 rokov pred
rodič
commit
16c84a501e
35 zmenil súbory, kde vykonal 1143 pridanie a 160 odobranie
  1. 1 1
      src/main/java/com/template/AutoCode.java
  2. 8 0
      src/main/java/com/template/api/SmartAccessControllerAPI.java
  3. 8 1
      src/main/java/com/template/api/SmartAttendanceControllerAPI.java
  4. 3 1
      src/main/java/com/template/api/SmartFaceDiscernControllerAPI.java
  5. 5 0
      src/main/java/com/template/api/SmartUserControllerAPI.java
  6. 7 0
      src/main/java/com/template/api/SmartVisitorControllerAPI.java
  7. 4 0
      src/main/java/com/template/api/SmartVisitorParentsConfigControllerAPI.java
  8. 21 0
      src/main/java/com/template/auto/controller/SmartPushConfigController.java
  9. 16 0
      src/main/java/com/template/auto/mapper/SmartPushConfigMapper.java
  10. 64 0
      src/main/java/com/template/auto/model/SmartPushConfig.java
  11. 20 0
      src/main/java/com/template/auto/service/impl/SmartPushConfigServiceImpl.java
  12. 16 0
      src/main/java/com/template/auto/services/SmartPushConfigService.java
  13. 17 0
      src/main/java/com/template/controller/SmartAccessController.java
  14. 77 5
      src/main/java/com/template/controller/SmartAttendanceController.java
  15. 16 0
      src/main/java/com/template/controller/SmartClassController.java
  16. 184 121
      src/main/java/com/template/controller/SmartFaceDiscernController.java
  17. 1 1
      src/main/java/com/template/controller/SmartScoreController.java
  18. 12 0
      src/main/java/com/template/controller/SmartUserController.java
  19. 395 6
      src/main/java/com/template/controller/SmartVisitorController.java
  20. 38 0
      src/main/java/com/template/controller/SmartVisitorParentsConfigController.java
  21. 8 0
      src/main/java/com/template/mapper/SmartAccessMapper.java
  22. 6 2
      src/main/java/com/template/mapper/SmartAttendanceMapper.java
  23. 2 0
      src/main/java/com/template/mapper/SmartVisitorParentsConfigMapper.java
  24. 9 0
      src/main/java/com/template/model/pojo/SmartAccess.java
  25. 44 0
      src/main/java/com/template/model/vo/SmartAccessVo.java
  26. 2 2
      src/main/java/com/template/model/vo/SmartAttendanceVo.java
  27. 4 1
      src/main/java/com/template/services/SmartAccessService.java
  28. 2 0
      src/main/java/com/template/services/SmartAttendanceService.java
  29. 2 0
      src/main/java/com/template/services/SmartVisitorParentsConfigService.java
  30. 18 2
      src/main/java/com/template/services/impl/SmartAccessServiceImpl.java
  31. 6 0
      src/main/java/com/template/services/impl/SmartAttendanceServiceImpl.java
  32. 7 0
      src/main/java/com/template/services/impl/SmartVisitorParentsConfigServiceImpl.java
  33. 45 0
      src/main/resources/mapper/template/SmartAccessMapper.xml
  34. 40 2
      src/main/resources/mapper/template/SmartAttendanceMapper.xml
  35. 35 15
      src/main/resources/mapper/template/SmartVisitorParentsConfigMapper.xml

+ 1 - 1
src/main/java/com/template/AutoCode.java

@@ -56,7 +56,7 @@ public class AutoCode {
         mpg.setPackageInfo(pc);
         //4、策略配置
         StrategyConfig strategy = new StrategyConfig();
-        strategy.setInclude("smart_section","smart_section_detail"); // 设置要映射的表名"smart_class","smart_grade","smart_attendance"
+        strategy.setInclude("smart_push_config"); // 设置要映射的表名"smart_class","smart_grade","smart_attendance"
         strategy.setNaming(NamingStrategy.underline_to_camel);//下划线转驼峰
         strategy.setColumnNaming(NamingStrategy.underline_to_camel);//下划线转驼峰
         strategy.setEntityLombokModel(true); // 自动lombok;

+ 8 - 0
src/main/java/com/template/api/SmartAccessControllerAPI.java

@@ -1,7 +1,15 @@
 package com.template.api;
 
+import com.template.model.result.CommonResult;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 
 @RequestMapping("/api/smartAccess")
 public interface SmartAccessControllerAPI {
+
+    @GetMapping("/getPage")
+    @ApiOperation(value = "门禁通行记录", notes = "门禁通行记录", httpMethod = "GET")
+    CommonResult getPage(@RequestParam Integer currentPage, @RequestParam Integer pageCount,String keyWord,Integer gradeId,Integer classId,Integer departmentId,Integer openType,Integer resultStatus,String startTime,String endTime);
 }

+ 8 - 1
src/main/java/com/template/api/SmartAttendanceControllerAPI.java

@@ -9,6 +9,8 @@ import org.springframework.validation.BindingResult;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+
 /**
  * @Author: binguo
  * @Date: 2023/3/30 星期四 17:28
@@ -85,10 +87,15 @@ public interface SmartAttendanceControllerAPI {
     CommonResult askForLeavePage(@RequestParam int currentPage, @RequestParam int pageCount,String name,String cardNo,String startTime,String endTime,String ifVerification,String classId);
 
     @GetMapping(value = "/queryPage")
-    @ApiOperation(value = "学生考勤纪律", notes = "学生考勤纪律", httpMethod = "GET")
+    @ApiOperation(value = "学生考勤记录", notes = "学生考勤记录", httpMethod = "GET")
     CommonResult queryPage(@RequestParam int currentPage, @RequestParam int pageCount,Integer gradeId,Integer classId,String status,String studentNo ,String name,String startTime,String endTime);
 
     @GetMapping(value = "/verification")
     @ApiOperation(value = "核销", notes = "核销", httpMethod = "GET")
     CommonResult verification(@RequestParam String id);
+
+    @GetMapping(value = "/queryPageExport")
+    @ApiOperation(value = "学生考勤记录导出", notes = "学生考勤记录导出", httpMethod = "GET")
+    void queryPageExport(HttpServletResponse response, Integer gradeId, Integer classId, String status, String studentNo , String name, @RequestParam String startTime, @RequestParam String endTime);
+
 }

+ 3 - 1
src/main/java/com/template/api/SmartFaceDiscernControllerAPI.java

@@ -31,6 +31,8 @@ public interface SmartFaceDiscernControllerAPI {
     @ApiOperation(value = "百胜门禁记录回调",notes = "百胜门禁记录回调",httpMethod = "POST")
     String callBack(HttpServletRequest request, HttpServletResponse response);
 
-
+    @GetMapping(value = "/selectTrack")
+    @ApiOperation(value = "轨迹查询", notes = "轨迹查询", httpMethod = "GET")
+    CommonResult selectTrack(@RequestParam Integer userId, @RequestParam String startTime,@RequestParam String endTime);
 
 }

+ 5 - 0
src/main/java/com/template/api/SmartUserControllerAPI.java

@@ -247,4 +247,9 @@ public interface SmartUserControllerAPI {
     @GetMapping(value = "/gauageOutfit")
     @ApiOperation(value = "表头列表集合", notes = "表头列表集合", httpMethod = "GET")
     CommonResult gauageOutfit();
+
+    @GetMapping(value = "/getPage")
+    @ApiOperation(value = "轨迹查询——用户下拉列表", notes = "轨迹查询——用户下拉列表", httpMethod = "GET")
+    CommonResult getPage(@RequestParam int currentPage, @RequestParam int pageCount,String keyWord);
+
 }

+ 7 - 0
src/main/java/com/template/api/SmartVisitorControllerAPI.java

@@ -131,5 +131,12 @@ public interface SmartVisitorControllerAPI {
     @ApiOperation(value = "访客预约数据", notes = "访客预约数据", httpMethod = "GET")
     CommonResult getPage(@RequestParam int currentPage, @RequestParam int pageCount,@RequestParam Integer type,String keyWord,Integer status,String startTime,String endTime,String visitorStartTime,String visitorEndTime);
 
+    @GetMapping(value = "/parentsAudit")
+    @ApiOperation(value = "家长访问预约审核", notes = "家长访客预约审核", httpMethod = "GET")
+    CommonResult parentsAudit(@RequestParam int id,@RequestParam int type);
+
+    @GetMapping(value = "/restsAudit")
+    @ApiOperation(value = "其他访问预约审核", notes = "其他访客预约审核", httpMethod = "GET")
+    CommonResult restsAudit(@RequestParam int id,@RequestParam int type);
 
 }

+ 4 - 0
src/main/java/com/template/api/SmartVisitorParentsConfigControllerAPI.java

@@ -17,4 +17,8 @@ public interface SmartVisitorParentsConfigControllerAPI {
     @ApiOperation(value = "家长访客配置修改", notes = "家长访客配置修改", httpMethod = "POST")
     CommonResult update(@RequestBody SmartVisitorParentsConfig smartVisitorParentsConfig);
 
+    @GetMapping(value = "/getUserId")
+    @ApiOperation(value = "根据用户id获取所管理的班级配置", notes = "根据用户id获取所管理的班级配置", httpMethod = "GET")
+    CommonResult getUserId(@RequestParam Integer userId);
+
 }

+ 21 - 0
src/main/java/com/template/auto/controller/SmartPushConfigController.java

@@ -0,0 +1,21 @@
+package com.template.auto.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-06-05
+ */
+@RestController
+@RequestMapping("/auto/smart-push-config")
+public class SmartPushConfigController {
+
+}
+

+ 16 - 0
src/main/java/com/template/auto/mapper/SmartPushConfigMapper.java

@@ -0,0 +1,16 @@
+package com.template.auto.mapper;
+
+import com.template.auto.model.SmartPushConfig;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-06-05
+ */
+public interface SmartPushConfigMapper extends BaseMapper<SmartPushConfig> {
+
+}

+ 64 - 0
src/main/java/com/template/auto/model/SmartPushConfig.java

@@ -0,0 +1,64 @@
+package com.template.auto.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-06-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="SmartPushConfig对象", description="")
+public class SmartPushConfig implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.UUID)
+    private Integer id;
+
+    @ApiModelProperty(value = "家长 1:推送,2:不推送")
+    private Integer parentsPush;
+
+    @ApiModelProperty(value = "班主任 1:推送,2:不推送")
+    private Integer chargeTeacherPush;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人员")
+    @TableField(fill = FieldFill.INSERT)
+    private String createUser;
+
+    @ApiModelProperty(value = "更新人员")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateUser;
+
+    @ApiModelProperty(value = "逻辑删除 未删除:0;删除:1")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleted;
+
+
+}

+ 20 - 0
src/main/java/com/template/auto/service/impl/SmartPushConfigServiceImpl.java

@@ -0,0 +1,20 @@
+package com.template.auto.service.impl;
+
+import com.template.auto.model.SmartPushConfig;
+import com.template.auto.mapper.SmartPushConfigMapper;
+import com.template.auto.services.SmartPushConfigService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-06-05
+ */
+@Service
+public class SmartPushConfigServiceImpl extends ServiceImpl<SmartPushConfigMapper, SmartPushConfig> implements SmartPushConfigService {
+
+}

+ 16 - 0
src/main/java/com/template/auto/services/SmartPushConfigService.java

@@ -0,0 +1,16 @@
+package com.template.auto.services;
+
+import com.template.auto.model.SmartPushConfig;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2024-06-05
+ */
+public interface SmartPushConfigService extends IService<SmartPushConfig> {
+
+}

+ 17 - 0
src/main/java/com/template/controller/SmartAccessController.java

@@ -1,7 +1,14 @@
 package com.template.controller;
 
 
+import com.template.annotation.DESRespondSecret;
 import com.template.api.SmartAccessControllerAPI;
+import com.template.model.pojo.SmartAccess;
+import com.template.model.result.CommonResult;
+import com.template.model.result.PageUtils;
+import com.template.model.vo.SmartAccessVo;
+import com.template.services.SmartAccessService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
@@ -15,7 +22,17 @@ import org.springframework.web.bind.annotation.RestController;
  * @since 2024-05-31
  */
 @RestController
+@DESRespondSecret
 public class SmartAccessController implements SmartAccessControllerAPI {
 
+    @Autowired
+    SmartAccessService smartAccessService;
+
+    @Override
+    @DESRespondSecret(validated = false)
+    public CommonResult getPage(Integer currentPage, Integer pageCount, String keyWord,Integer gradeId, Integer classId, Integer departmentId, Integer openType, Integer resultStatus,String startTime,String endTime) {
+        PageUtils<SmartAccessVo> pageUtils=smartAccessService.getPage(currentPage,pageCount,keyWord,gradeId,classId,departmentId,openType,resultStatus,startTime,endTime);
+        return CommonResult.ok(pageUtils);
+    }
 }
 

+ 77 - 5
src/main/java/com/template/controller/SmartAttendanceController.java

@@ -12,11 +12,9 @@ import com.template.annotation.DESRespondSecret;
 import com.template.api.SmartAttendanceControllerAPI;
 import com.template.common.utils.*;
 import com.template.config.ControlConfig;
+import com.template.config.ScheduleConfig;
 import com.template.config.SeewoConfig;
-import com.template.model.enumModel.eAttendanceStatu;
-import com.template.model.enumModel.eIdentityStatu;
-import com.template.model.enumModel.eIfVerification;
-import com.template.model.enumModel.eXwApproveStatu;
+import com.template.model.enumModel.*;
 import com.template.model.evaluate.student.SmartEvaluateStudent;
 import com.template.model.pojo.*;
 import com.template.model.request.askForLeaveRequest;
@@ -27,6 +25,10 @@ import com.template.model.seewo.PersonalLeaveListSchoolPeriodRecordsRequest;
 import com.template.model.seewo.PersonalLeaveListSchoolPeriodRecordsResult;
 import com.template.model.vo.*;
 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.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,10 +41,12 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
 import java.net.URLDecoder;
 import java.net.URLEncoder;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -103,13 +107,19 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
         return null;
     }
 
+
+    @Resource
+    private ScheduleConfig scheduleConfig;
     /**
      * 每一小时获取请假信息
       */
     @Async
     @Scheduled(cron = "0 0 0/1 * * ? ")
     public void get(){
-        queryLeaveRecords();
+        if(scheduleConfig.getIsOpen().equals("1")){
+            queryLeaveRecords();
+        }
+
     }
 
     @Override
@@ -392,6 +402,68 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
         return CommonResult.fail();
     }
 
+    @Override
+    public void queryPageExport(HttpServletResponse response, Integer gradeId, Integer classId, String status, String studentNo, String name, 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("打卡时间");
+        headerRow.createCell(7).setCellValue("请假时间");
+        headerRow.createCell(8).setCellValue("考勤状态");
+
+        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        //        默认前一天的
+        if (ObjectUtils.isEmpty(startTime)||ObjectUtils.isEmpty(endTime)) {
+            LocalDateTime end = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
+            LocalDateTime now = end.minusDays(1);
+            startTime=now.format(dateTimeFormatter);
+            endTime=end.format(dateTimeFormatter);
+        }
+
+        //获取学生考勤记录
+        List<SmartAttendanceVo> vos=smartAttendanceService.queryExpor(gradeId,classId,status,studentNo,name,startTime,endTime);
+
+        for (int i = 0; i < vos.size(); i++) {
+            SmartAttendanceVo 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.getGradeName());
+            dataRow.createCell(3).setCellValue(vo.getClassName());
+            dataRow.createCell(4).setCellValue(vo.getCardNo());
+            dataRow.createCell(5).setCellValue(vo.getHeadImage());
+            dataRow.createCell(6).setCellValue(vo.getAttendTime());
+            dataRow.createCell(7).setCellValue(vo.getInitiateTime());
+//            状态
+            Integer status1 = vo.getStatus();
+            String type="";
+            if (0==status1) {
+                type="准时";
+            }else if(1==status1) {
+                type="迟到";
+            }else if(3==status1) {
+                type="缺卡";
+            }else if(6==status1) {
+                type="请假";
+            }else if(7==status1) {
+                type="超时打卡";
+            }
+            dataRow.createCell(8).setCellValue(type);
+        }
+
+        // 将工作簿写入文件
+        ExcelUtils.excelDownload(workbook, "学生考勤.xlsx", response);
+    }
+
     public PersonalLeaveListSchoolPeriodRecordsResult getXwAttendance(String startDate, String endDate, Integer currentPage, Integer pageSize) {
         //初始化客户端
         SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));

+ 16 - 0
src/main/java/com/template/controller/SmartClassController.java

@@ -21,6 +21,7 @@ import com.template.model.seewo.*;
 import com.template.model.vo.*;
 import com.template.services.SmartClassService;
 import com.template.services.SmartGradeService;
+import com.template.services.SmartVisitorParentsConfigService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -65,6 +66,9 @@ public class SmartClassController implements SmartClassControllerAPI {
     @Autowired
     private SmartGradeService smartGradeService;
 
+    @Autowired
+    private SmartVisitorParentsConfigService smartVisitorParentsConfigService;
+
     @Override
     @DESRespondSecret(validated = true)
     public CommonResult insertSmartClass(SmartClass smartApply, BindingResult bindingResult) {
@@ -223,6 +227,18 @@ public class SmartClassController implements SmartClassControllerAPI {
                     throw new Exception("新增失败");
                 }
 
+//                添加班级配置
+                SmartVisitorParentsConfig svpc = new SmartVisitorParentsConfig();
+                svpc.setClassId(smartClass.getId());
+                svpc.setAppAuditConfig(1);
+                svpc.setAppPushConfig(5);
+                svpc.setAppCancelConfig(6);
+                svpc.setAppAuditConfig(1);
+                svpc.setAppPushConfig(5);
+                svpc.setAppCancelConfig(6);
+                svpc.setAccessConfig(0);
+                smartVisitorParentsConfigService.save(svpc);
+
             } catch (Exception e) {
                 throw new Exception("新增失败");
             }

+ 184 - 121
src/main/java/com/template/controller/SmartFaceDiscernController.java

@@ -254,147 +254,157 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
             //                比对时间
             String time = jsonObject.getString("time");
             logger.info("time = " + time);
-            LocalDateTime localDateTime = LocalDateTime.now().withHour(0).withSecond(0).withMinute(0);
-            LocalDateTime localDateTime2 = LocalDateTime.parse(time, dateTimeFormatter1);
-//            只获取当天的
-            if (localDateTime.isBefore(localDateTime2)) {
+//            LocalDateTime localDateTime = LocalDateTime.now().withHour(0).withSecond(0).withMinute(0);
+//            LocalDateTime localDateTime2 = LocalDateTime.parse(time, dateTimeFormatter1);
+////            只获取当天的
+//            if (localDateTime.isBefore(localDateTime2)) {
 //            比对结果
-                Integer resultStatus = jsonObject.getInteger("resultStatus");
-                if (1 == resultStatus) {
-
-                    //          设备sn
-                    String sn = jsonObject.getString("sn");
-                    SmartDevice smartDevice = smartDeviceService.getNum(sn);
-                    String address = "";
-                    String type = "";
-                    if (ObjectUtils.isNotEmpty(smartDevice)) {
-                        //            地点
-                        address = smartDevice.getAddress();
+            Integer resultStatus = jsonObject.getInteger("resultStatus");
+//                if (1 == resultStatus) {
+
+            //          设备sn
+            String sn = jsonObject.getString("sn");
+            SmartDevice smartDevice = smartDeviceService.getNum(sn);
+            String address = "";
+            String type = "";
+            if (ObjectUtils.isNotEmpty(smartDevice)) {
+                //            地点
+                address = smartDevice.getAddress();
 //            类型
-                        type = smartDevice.getName();
-                    }
+                type = smartDevice.getName();
+            }
 
 //            名字,学生会加班级[]
-                    String name = jsonObject.getString("name");
-                    System.out.println("name = " + name);
-                    String[] split = name.split("\\[");
-                    String s = split[0];
-                    logger.info("name = " + s);
+            String name = jsonObject.getString("name");
+            System.out.println("name = " + name);
+            String[] split = name.split("\\[");
+            String s = split[0];
+            logger.info("name = " + s);
 //            百胜门禁编号
-                    String idNum = jsonObject.getString("idNum");
-                    logger.info("idNum = " + idNum);
-                    SmartUser smartUser = smartUserService.getBsStudentNo(idNum);
-                    Integer userId = 0;
-                    if (ObjectUtils.isNotEmpty(smartUser)) {
-                        userId = smartUser.getId();
-                    } else {
-                        userId = 0;
-                    }
-
+            String idNum = jsonObject.getString("idNum");
+            logger.info("idNum = " + idNum);
+
+            Integer userId = 0;
+            SmartUser smartUser = null;
+            if (ObjectUtils.isNotEmpty(idNum)) {
+                smartUser = smartUserService.getBsStudentNo(idNum);
+                if (ObjectUtils.isNotEmpty(smartUser)) {
+                    userId = smartUser.getId();
+                } else {
+                    userId = 0;
+                }
+            }
 
-                    SmartAccess smartFaceDiscern = new SmartAccess();
-
-                    smartFaceDiscern.setName(s);
-                    smartFaceDiscern.setLocation(address);
-                    smartFaceDiscern.setType(type);
-                    smartFaceDiscern.setUserId(userId);
-                    smartFaceDiscern.setDateTime(time);
-                    smartFaceDiscern.setIdNum(idNum);
-                    smartFaceDiscern.setSn(sn);
-                    if (userId != 0) {
-                        //                    判断是否已经添加
-                        LambdaQueryWrapper<SmartAccess> wrapperFD = new LambdaQueryWrapper<>();
-                        wrapperFD.eq(SmartAccess::getDateTime, smartFaceDiscern.getDateTime())
-                                .eq(SmartAccess::getUserId, userId);
-                        List<SmartAccess> list = smartAccessService.list(wrapperFD);
-                        if (ObjectUtils.isEmpty(list) && list.size() == 0) {
-                            //          抓拍的照片 base64字符串
-                            String scenePhoto = jsonObject.getString("scenePhoto");
-                            scenePhoto = "data:image/jpeg;base64," + scenePhoto;
-                            logger.info("scenePhoto =" + scenePhoto.substring(0, 50));
+//                    出入标识: 1-进, 0-出
+            Integer inout = jsonObject.getInteger("inout");
+//                    开门方式:0-白名单比对,1-人证比对,2-IC卡比对
+            Integer openType = jsonObject.getInteger("openType");
+
+            SmartAccess smartFaceDiscern = new SmartAccess();
+
+            smartFaceDiscern.setName(s);
+            smartFaceDiscern.setLocation(address);
+            smartFaceDiscern.setType(type);
+            smartFaceDiscern.setUserId(userId);
+            smartFaceDiscern.setDateTime(time);
+            smartFaceDiscern.setIdNum(idNum);
+            smartFaceDiscern.setSn(sn);
+            smartFaceDiscern.setInOut(inout);
+            smartFaceDiscern.setOpenType(openType);
+            smartFaceDiscern.setResultStatus(resultStatus);
+            if (userId != 0) {
+                //                    判断是否已经添加
+                LambdaQueryWrapper<SmartAccess> wrapperFD = new LambdaQueryWrapper<>();
+                wrapperFD.eq(SmartAccess::getDateTime, smartFaceDiscern.getDateTime())
+                        .eq(SmartAccess::getUserId, userId);
+                List<SmartAccess> list = smartAccessService.list(wrapperFD);
+                if (ObjectUtils.isEmpty(list) && list.size() == 0) {
+                    //          抓拍的照片 base64字符串
+                    String scenePhoto = jsonObject.getString("scenePhoto");
+                    scenePhoto = "data:image/jpeg;base64," + scenePhoto;
+                    logger.info("scenePhoto =" + scenePhoto.substring(0, 50));
 //            base64转文件
-                            MultipartFile multipartFile = MultipartFileUtils.base64ToMultipartFile(scenePhoto);
-                            String image="";
-                            try {
-                                //            上传到cos桶,并生成图片地址
-                                 image = smartUploadService.upload(new MultipartFile[]{multipartFile});
-                            }catch (Exception e){
-                                e.printStackTrace();
-                                logger.error("上传cos桶失败");
-                            }
+                    MultipartFile multipartFile = MultipartFileUtils.base64ToMultipartFile(scenePhoto);
+                    String image = "";
+                    try {
+                        //            上传到cos桶,并生成图片地址
+                        image = smartUploadService.upload(new MultipartFile[]{multipartFile});
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        logger.error("上传cos桶失败");
+                    }
 
-                            smartFaceDiscern.setImage(image);
-                            smartAccessService.save(smartFaceDiscern);
+                    smartFaceDiscern.setImage(image);
+                    smartAccessService.save(smartFaceDiscern);
 
 //                        通过学生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 = "离开大门";
-                                        }
-                                        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);
-
-                                    }
-
+                    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 = "离开大门";
                                 }
+                                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 {
 
-                        smartFaceDiscern.setUserId(0);
+                smartFaceDiscern.setUserId(0);
 //                    判断是否已经添加
-                        LambdaQueryWrapper<SmartAccess> wrapperFD = new LambdaQueryWrapper<>();
-                        wrapperFD.eq(SmartAccess::getDateTime, time)
-                                .eq(SmartAccess::getName, s)
-                                .eq(SmartAccess::getType, type);
-                        List<SmartAccess> list = smartAccessService.list(wrapperFD);
-
-                        if (ObjectUtils.isEmpty(list) && list.size() == 0) {
-                            //          抓拍的照片 base64字符串
-                            String scenePhoto = jsonObject.getString("scenePhoto");
-                            scenePhoto = "data:image/jpeg;base64," + scenePhoto;
-                            logger.info("scenePhoto =" + scenePhoto.substring(0, 50));
+                LambdaQueryWrapper<SmartAccess> wrapperFD = new LambdaQueryWrapper<>();
+                wrapperFD.eq(SmartAccess::getDateTime, time)
+                        .eq(SmartAccess::getName, s)
+                        .eq(SmartAccess::getType, type);
+                List<SmartAccess> list = smartAccessService.list(wrapperFD);
+
+                if (ObjectUtils.isEmpty(list) && list.size() == 0) {
+                    //          抓拍的照片 base64字符串
+                    String scenePhoto = jsonObject.getString("scenePhoto");
+                    scenePhoto = "data:image/jpeg;base64," + scenePhoto;
+                    logger.info("scenePhoto =" + scenePhoto.substring(0, 50));
 //            base64转文件
-                            MultipartFile multipartFile = MultipartFileUtils.base64ToMultipartFile(scenePhoto);
-                            String image="";
-                            try {
-                                //            上传到cos桶,并生成图片地址
-                                image = smartUploadService.upload(new MultipartFile[]{multipartFile});
-                            }catch (Exception e){
-                                e.printStackTrace();
-                                logger.error("上传cos桶失败");
-                            }
-                            smartFaceDiscern.setImage(image);
-                            smartAccessService.save(smartFaceDiscern);
-                        }
-
+                    MultipartFile multipartFile = MultipartFileUtils.base64ToMultipartFile(scenePhoto);
+                    String image = "";
+                    try {
+                        //            上传到cos桶,并生成图片地址
+                        image = smartUploadService.upload(new MultipartFile[]{multipartFile});
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        logger.error("上传cos桶失败");
                     }
+                    smartFaceDiscern.setImage(image);
+                    smartAccessService.save(smartFaceDiscern);
                 }
+
             }
+//            }
+//            }
 
-        } catch (
-                Exception e) {
+        } catch (Exception e) {
             e.printStackTrace();
             JSONObject r = new JSONObject();
             r.put("message", "Success");
@@ -408,6 +418,59 @@ public class SmartFaceDiscernController implements SmartFaceDiscernControllerAPI
         return r.toJSONString();
     }
 
+    @Override
+    public CommonResult selectTrack(Integer userId, String startTime, String endTime) {
+        ArrayList<LastSevenDaysTrackVo> vos = new ArrayList<>();
+        //        人脸抓拍
+        List<SmartFaceDiscern> faceDiscerns = smartFaceDiscernService.track(startTime, endTime, userId);
+        for (SmartFaceDiscern faceDiscern : faceDiscerns) {
+            LastSevenDaysTrackVo lastSevenDaysTrackVo = new LastSevenDaysTrackVo();
+            lastSevenDaysTrackVo.setName(faceDiscern.getName());
+            lastSevenDaysTrackVo.setType(faceDiscern.getType());
+            lastSevenDaysTrackVo.setLocation(faceDiscern.getLocation());
+            lastSevenDaysTrackVo.setImage(faceDiscern.getImage());
+            lastSevenDaysTrackVo.setDateTime(faceDiscern.getDateTime());
+            vos.add(lastSevenDaysTrackVo);
+        }
+
+//        打卡
+        List<SmartAttendance> attendances = smartAttendanceService.track(startTime, endTime, userId);
+//        获取班级名称
+        SmartUser smartUser = smartUserService.getSmartById(userId);
+        SmartClass smartClass = smartClassService.getSmartClassById(smartUser.getSchoolClass());
+        String className = smartClass.getName();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        for (SmartAttendance attendance : attendances) {
+            LastSevenDaysTrackVo lastSevenDaysTrackVo = new LastSevenDaysTrackVo();
+            lastSevenDaysTrackVo.setName(attendance.getXwUserName());
+            lastSevenDaysTrackVo.setType("打卡");
+            lastSevenDaysTrackVo.setLocation(className);
+            Date attendTime = attendance.getAttendTime();
+            lastSevenDaysTrackVo.setDateTime(sdf.format(attendTime));
+            vos.add(lastSevenDaysTrackVo);
+        }
+
+        //        门禁信息
+        List<SmartAccess> smartAccesses = smartAccessService.track(startTime, endTime, userId);
+        for (SmartAccess faceDiscern : smartAccesses) {
+            LastSevenDaysTrackVo lastSevenDaysTrackVo = new LastSevenDaysTrackVo();
+            lastSevenDaysTrackVo.setName(faceDiscern.getName());
+            lastSevenDaysTrackVo.setType(faceDiscern.getType());
+            lastSevenDaysTrackVo.setLocation(faceDiscern.getLocation());
+            lastSevenDaysTrackVo.setImage(faceDiscern.getImage());
+            lastSevenDaysTrackVo.setDateTime(faceDiscern.getDateTime());
+            vos.add(lastSevenDaysTrackVo);
+        }
+
+//        排序
+        Collections.sort(vos, Comparator.comparing((h) -> {
+            return h.getDateTime();
+        }));
+
+
+        return CommonResult.ok(vos);
+    }
+
 
     public static JSONObject getDate(Integer date) {
         JSONObject jsonObject = new JSONObject();

+ 1 - 1
src/main/java/com/template/controller/SmartScoreController.java

@@ -366,7 +366,7 @@ public class SmartScoreController implements SmartScoreControllerAPI {
     }
 
     @Override
-    @DESRespondSecret(validated = false)
+    @DESRespondSecret(validated = true)
     public void smartScoreExport(HttpServletResponse response, String name, String semester, String grade, String schoolClass, String subject, String examType, Double MinScore, Double MaxScore) {
 
         Integer subjectInt = subject == null ? null : eSubjectStatu.integerOf(subject);

+ 12 - 0
src/main/java/com/template/controller/SmartUserController.java

@@ -3,6 +3,8 @@ package com.template.controller;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
@@ -4633,6 +4635,16 @@ public class SmartUserController implements SmartUserControllerAPI {
         //endregion
         return CommonResult.ok(govs);
     }
+
+    @Override
+    @DESRespondSecret(validated = true)
+    public CommonResult getPage(int currentPage, int pageCount, String keyWord) {
+        LambdaQueryWrapper<SmartUser> wrapper=new LambdaQueryWrapper<>();
+        wrapper.like(ObjectUtils.isNotEmpty(keyWord),SmartUser::getName,keyWord);
+        IPage<SmartUser> page = smartUserService.page(new Page<>(currentPage, pageCount), wrapper);
+
+        return CommonResult.ok(page);
+    }
     //endregion
 
     //region 用户导出

+ 395 - 6
src/main/java/com/template/controller/SmartVisitorController.java

@@ -3,6 +3,7 @@ package com.template.controller;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -83,6 +84,11 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
     @Resource
     private ParkConfig parkConfig;
 
+    @Autowired
+    SmartVisitorParentsConfigService smartVisitorParentsConfigService;
+
+    @Autowired
+    SmartVisitorRestsConfigService smartVisitorRestsConfigService;
 
     /**
      * 新增访客预约
@@ -209,7 +215,7 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
             sv.setPeerNum(par.getPeerNum());
             sv.setCarNum(par.getCarNum());
             sv.setVisitReason(par.getVisitReason());
-            sv.setStatu(eApproveStatu.Audit.getValue());
+//            sv.setStatu(eApproveStatu.Audit.getValue());
             sv.setVisitorTime(TimeExchange.StringToDate(par.getVisitorTime(), "yyyy-MM-dd HH:mm:ss"));
             sv.setVisitorDeadline(TimeExchange.StringToDate(TimeExchange.AddTimeDesH(sv.getVisitorTime(), 4), "yyyy-MM-dd HH:mm:ss"));
             sv.setRespondent(student.getId());
@@ -218,14 +224,103 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
             //将第一个受访学生的部门ID带过去
             sv.setDepartmentId(student.getDepartmentId());
             sv.setVisitorType(eVisitorType.Parent.getValue());
+
+            //        获取受访者id
+            Integer respondent = sv.getRespondent();
+            SmartUser smartUser = smartUserService.getById(respondent);
+            Integer schoolClass = smartUser.getSchoolClass();
+            SmartVisitorParentsConfig svpc = smartVisitorParentsConfigService.getById(schoolClass);
+            Integer appAuditConfig = svpc.getAppAuditConfig();
+            if (1 == appAuditConfig) {//需要审核
+                sv.setStatu(1);
+            } else {//不需要审核
+                Integer appPushConfig = svpc.getAppPushConfig();
+//                判断是否需要推送
+                if (5 == appPushConfig) {//需要推送
+                    String content = sv.getRespondentName() + "你的家长将于" + TimeExchange.chineseDateTime(sv.getVisitorTime()) + "到校!";
+                    //将预约信息推送到希沃班牌
+                    CommonResult seewo = pushInfo(sv.getUserPhone(), sv.getResponcode(), content);
+                }
+//                核销
+                Integer appCancelConfig = svpc.getAppCancelConfig();
+                if (6 == appCancelConfig) {//需要核销
+                    sv.setStatu(7);
+                } else {//不需要核销
+                    sv.setStatu(9);
+                }
+//                门禁配置
+                Integer accessConfig = svpc.getAccessConfig();
+                if (0 == accessConfig) {
+                    try {
+                        if (!ObjectUtils.isEmpty(sv.getCarNum())) {
+                            String appId = parkConfig.getAppId();
+                            String carNo = sv.getCarNum();
+                            String parkKey = parkConfig.getParkKey();
+                            String rand = String.valueOf(Math.random());
+                            String reserveTime = TimeExchange.DateToString(sv.getVisitorTime(), "yyyy-MM-dd HH:mm:ss");
+                            String reserveEndTime = TimeExchange.DateToString(sv.getVisitorDeadline(), "yyyy-MM-dd HH:mm:ss");
+                            String version = "v1.0";
+                            String appSecret = parkConfig.getAppSecret();
+                            String url = parkConfig.getUrl() + "Inform/Reservation";
+
+                            JSONObject jsonobject = new JSONObject();
+                            jsonobject.put("appid", appId);
+                            jsonobject.put("carNo", carNo);
+                            jsonobject.put("parkKey", parkKey);
+                            jsonobject.put("rand", rand);
+                            jsonobject.put("reserveEndTime", reserveEndTime);
+                            jsonobject.put("reserveTime", reserveTime);
+                            jsonobject.put("version", "v1.0");
+
+                            //appid=ymdd36ed157ac423e2&carNo=赣U123659&parkKey=wdcmq9rc&rand=9.94995525689689966&reserveEndTime=2023-12-22 20:12:10&reserveTime=2023-12-21 18:12:10&version=v1.0&50596cd243dc4547b4c05f01f8ea02a4
+                            String md5Str = "appid=" + appId + "&carNo=" + carNo + "&parkKey=" + parkKey + "&rand=" + rand + "&reserveEndTime=" + reserveEndTime + "&reserveTime=" + reserveTime + "&version=" + version + "&" + appSecret;
+                            String sign = CommonUtil.MD5(md5Str);
+                            //sign签名
+                            jsonobject.put("sign", sign);
+
+                            //返回的结果中 code为1表示成功
+                            String result = RequestUtils.httpPost(url, jsonobject.toJSONString());
+
+                            logger.info(result);
+
+                            if (!result.contains("预约成功")) {
+                                throw new Exception("审核失败");
+                            }
+
+                            ObjectMapper objectMapper = new ObjectMapper();
+                            BsReservationVo reservation = objectMapper.readValue(result, BsReservationVo.class);
+                            sv.setBsOrderNo(reservation.getData().getReOrderNo());
+                        } else {
+                            List<SmartDevice> devices = smartDeviceService.queryOnLineDevice();
+                            String visitorNo = getUUIDBits(16);
+                            //region 将访客数据下发到设备
+                            for (SmartDevice device : devices) {
+                                CommonResult<String> insertVisitor = bsInsertVisitor(su, TimeExchange.DateToString(sv.getVisitorTime()), TimeExchange.DateToString(sv.getVisitorDeadline()), device.getNum(), visitorNo);
+                                if (!insertVisitor.isSuccess()) {
+                                    throw new Exception(insertVisitor.getMessage());
+                                }
+                                sv.setVisitorsync(sv.getVisitorsync() == null ? insertVisitor.getData() : (sv.getVisitorsync() + "," + insertVisitor.getData()));
+                                sv.setDeviceNum(sv.getDeviceNum() == null ? device.getNum() : (sv.getDeviceNum() + "," + device.getNum()));
+                            }
+                            String code = GetVertifyCode.getRandomNumCode(6);
+                            sv.setVisitorCode(code);
+                        }
+                    } catch (Exception e) {
+                        throw new RuntimeException(e);
+                    }
+                }
+            }
+
             svs.add(sv);
         }
 
+
         boolean result = smartVisitorService.insertVisitorBatch(svs);
 
         return result ? CommonResult.ok("预约成功,等待审批通过") : CommonResult.fail("预约失败");
     }
 
+
     @Override
     @DESRespondSecret(validated = true)
     public CommonResult otherAppointment(otherAppointmentRequest oar, BindingResult bindingResult) {
@@ -259,13 +354,92 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
         sv.setPeerNum(oar.getPeerNum());
         sv.setCarNum(oar.getCarNum());
         sv.setVisitReason(oar.getVisitReason());
-        sv.setStatu(eApproveStatu.Audit.getValue());
+//        sv.setStatu(eApproveStatu.Audit.getValue());
         sv.setVisitorTime(TimeExchange.StringToDate(startTime, "yyyy-MM-dd HH:mm:ss"));
         sv.setVisitorDeadline(TimeExchange.StringToDate(endTime, "yyyy-MM-dd HH:mm:ss"));
         sv.setRespondentName(oar.getRespondentName());
         sv.setRespondentPhone(oar.getRespondentPhone());
         sv.setVisitorType(eVisitorType.Other.getValue());
 
+        List<SmartVisitorRestsConfig> list = smartVisitorRestsConfigService.list(new LambdaQueryWrapper<>());
+        SmartVisitorRestsConfig smartVisitorRestsConfig = list.get(0);
+        Integer auditConfig = smartVisitorRestsConfig.getAuditConfig();
+        if (1 == auditConfig) {//需要审核
+            sv.setStatu(1);
+        } else if (9 == auditConfig) {
+            sv.setStatu(9);
+            Integer accessConfig = smartVisitorRestsConfig.getAccessConfig();
+            if (0 == accessConfig) {//推送到门禁
+                try {
+                    if (!ObjectUtils.isEmpty(sv.getCarNum())) {
+                        String appId = parkConfig.getAppId();
+                        String carNo = sv.getCarNum();
+                        String parkKey = parkConfig.getParkKey();
+                        String rand = String.valueOf(Math.random());
+                        String reserveTime = TimeExchange.DateToString(sv.getVisitorTime(), "yyyy-MM-dd HH:mm:ss");
+                        String reserveEndTime = TimeExchange.DateToString(sv.getVisitorDeadline(), "yyyy-MM-dd HH:mm:ss");
+                        String version = "v1.0";
+                        String appSecret = parkConfig.getAppSecret();
+                        String url = parkConfig.getUrl() + "Inform/Reservation";
+
+                        JSONObject jsonobject = new JSONObject();
+                        jsonobject.put("appid", appId);
+                        jsonobject.put("carNo", carNo);
+                        jsonobject.put("parkKey", parkKey);
+                        jsonobject.put("rand", rand);
+                        jsonobject.put("reserveEndTime", reserveEndTime);
+                        jsonobject.put("reserveTime", reserveTime);
+                        jsonobject.put("version", "v1.0");
+
+                        //appid=ymdd36ed157ac423e2&carNo=赣U123659&parkKey=wdcmq9rc&rand=9.94995525689689966&reserveEndTime=2023-12-22 20:12:10&reserveTime=2023-12-21 18:12:10&version=v1.0&50596cd243dc4547b4c05f01f8ea02a4
+                        String md5Str = "appid=" + appId + "&carNo=" + carNo + "&parkKey=" + parkKey + "&rand=" + rand + "&reserveEndTime=" + reserveEndTime + "&reserveTime=" + reserveTime + "&version=" + version + "&" + appSecret;
+                        String sign = CommonUtil.MD5(md5Str);
+                        //sign签名
+                        jsonobject.put("sign", sign);
+
+                        //返回的结果中 code为1表示成功
+                        String result = RequestUtils.httpPost(url, jsonobject.toJSONString());
+
+                        logger.info(result);
+
+                        if (!result.contains("预约成功")) {
+                            throw new Exception("审核失败");
+                        }
+
+                        ObjectMapper objectMapper = new ObjectMapper();
+                        BsReservationVo reservation = objectMapper.readValue(result, BsReservationVo.class);
+                        sv.setBsOrderNo(reservation.getData().getReOrderNo());
+                    } else {
+                        List<SmartDevice> devices = smartDeviceService.queryOnLineDevice();
+                        String visitorNo = getUUIDBits(16);
+                        //region 将访客数据下发到设备
+                        for (SmartDevice device : devices) {
+                            CommonResult<String> insertVisitor = bsInsertVisitor(su, TimeExchange.DateToString(sv.getVisitorTime()), TimeExchange.DateToString(sv.getVisitorDeadline()), device.getNum(), visitorNo);
+                            if (!insertVisitor.isSuccess()) {
+                                throw new Exception(insertVisitor.getMessage());
+                            }
+                            sv.setVisitorsync(sv.getVisitorsync() == null ? insertVisitor.getData() : (sv.getVisitorsync() + "," + insertVisitor.getData()));
+                            sv.setDeviceNum(sv.getDeviceNum() == null ? device.getNum() : (sv.getDeviceNum() + "," + device.getNum()));
+                        }
+                        String code = GetVertifyCode.getRandomNumCode(6);
+                        sv.setVisitorCode(code);
+                    }
+
+                    //发送短信给其他访客用户
+                    if (!ObjectUtils.isEmpty(sv.getVisitorCode())) {
+                        String message = SendSms.sendVisitorSms("+86" + sv.getUserPhone(), TimeExchange.getYear(sv.getVisitorTime()), TimeExchange.getMonth(sv.getVisitorTime()), TimeExchange.getDay(sv.getVisitorTime()), TimeExchange.getTime(sv.getVisitorTime()), TimeExchange.getTime(sv.getVisitorDeadline()), sv.getVisitorCode());
+                        if (!message.contains("success")) {
+                            throw new Exception("发送失败");
+                        }
+                    }
+
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+
+            }
+        }
+
         int result = smartVisitorService.insertSmartVisitor(sv);
 
         return result > 0 ? CommonResult.ok("预约成功,等待审批通过") : CommonResult.ok("预约失败");
@@ -428,12 +602,227 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
 
     @Override
     @DESRespondSecret(validated = false)
-    public CommonResult getPage(int currentPage, int pageCount,Integer type, String keyWord, Integer status, String startTime, String endTime,String visitorStartTime,String visitorEndTime) {
-       PageUtils<SmartVisitor> page= smartVisitorService.getPage(currentPage,pageCount,type,keyWord,status,startTime,endTime,visitorStartTime,visitorEndTime);
+    public CommonResult getPage(int currentPage, int pageCount, Integer type, String keyWord, Integer status, String startTime, String endTime, String visitorStartTime, String visitorEndTime) {
+        PageUtils<SmartVisitor> page = smartVisitorService.getPage(currentPage, pageCount, type, keyWord, status, startTime, endTime, visitorStartTime, visitorEndTime);
 
         return CommonResult.ok(page);
     }
 
+    @Override
+    public CommonResult parentsAudit(int id, int type) {
+        SmartVisitor sv = smartVisitorService.getSmartById(id);
+        if (sv == null) {
+            return CommonResult.fail("访客记录已失效,审核失败!");
+        }
+
+        //审核处理后的数据不能再处理判断
+        if (sv.getStatu().intValue() != eApproveStatu.Audit.getValue()) {
+            return CommonResult.fail("该记录已被操作过,请勿重复操作");
+        }
+        try {
+//            同意
+            if (type == 4) {
+                //        获取受访者id
+                Integer respondent = sv.getRespondent();
+                SmartUser smartUser = smartUserService.getById(respondent);
+                Integer schoolClass = smartUser.getSchoolClass();
+                SmartVisitorParentsConfig svpc = smartVisitorParentsConfigService.getById(schoolClass);
+                Integer appPushConfig = svpc.getAppPushConfig();
+//                判断是否需要推送
+                if (5 == appPushConfig) {//需要推送
+                    String content = sv.getRespondentName() + "你的家长将于" + TimeExchange.chineseDateTime(sv.getVisitorTime()) + "到校!";
+                    //将预约信息推送到希沃班牌
+                    CommonResult seewo = pushInfo(sv.getUserPhone(), sv.getResponcode(), content);
+                }
+//                核销
+                Integer appCancelConfig = svpc.getAppCancelConfig();
+                if (6 == appCancelConfig) {//需要核销
+                    sv.setStatu(7);
+                } else {//不需要核销
+                    sv.setStatu(9);
+                }
+//                门禁配置
+                Integer accessConfig = svpc.getAccessConfig();
+                if (0 == accessConfig) {
+
+                    if (!ObjectUtils.isEmpty(sv.getCarNum())) {
+                        String appId = parkConfig.getAppId();
+                        String carNo = sv.getCarNum();
+                        String parkKey = parkConfig.getParkKey();
+                        String rand = String.valueOf(Math.random());
+                        String reserveTime = TimeExchange.DateToString(sv.getVisitorTime(), "yyyy-MM-dd HH:mm:ss");
+                        String reserveEndTime = TimeExchange.DateToString(sv.getVisitorDeadline(), "yyyy-MM-dd HH:mm:ss");
+                        String version = "v1.0";
+                        String appSecret = parkConfig.getAppSecret();
+                        String url = parkConfig.getUrl() + "Inform/Reservation";
+
+                        JSONObject jsonobject = new JSONObject();
+                        jsonobject.put("appid", appId);
+                        jsonobject.put("carNo", carNo);
+                        jsonobject.put("parkKey", parkKey);
+                        jsonobject.put("rand", rand);
+                        jsonobject.put("reserveEndTime", reserveEndTime);
+                        jsonobject.put("reserveTime", reserveTime);
+                        jsonobject.put("version", "v1.0");
+
+                        //appid=ymdd36ed157ac423e2&carNo=赣U123659&parkKey=wdcmq9rc&rand=9.94995525689689966&reserveEndTime=2023-12-22 20:12:10&reserveTime=2023-12-21 18:12:10&version=v1.0&50596cd243dc4547b4c05f01f8ea02a4
+                        String md5Str = "appid=" + appId + "&carNo=" + carNo + "&parkKey=" + parkKey + "&rand=" + rand + "&reserveEndTime=" + reserveEndTime + "&reserveTime=" + reserveTime + "&version=" + version + "&" + appSecret;
+                        String sign = CommonUtil.MD5(md5Str);
+                        //sign签名
+                        jsonobject.put("sign", sign);
+
+                        //返回的结果中 code为1表示成功
+                        String result = RequestUtils.httpPost(url, jsonobject.toJSONString());
+
+                        logger.info(result);
+
+                        if (!result.contains("预约成功")) {
+                            throw new Exception("审核失败");
+                        }
+
+                        ObjectMapper objectMapper = new ObjectMapper();
+                        BsReservationVo reservation = objectMapper.readValue(result, BsReservationVo.class);
+                        sv.setBsOrderNo(reservation.getData().getReOrderNo());
+                    } else {
+                        //查找用户是否存在
+                        SmartUser user = smartUserService.getSmartById(sv.getUserId());
+                        if (user == null) {
+                            throw new Exception("访客用户ID在系统中不存在,无法将访客信息下发到门禁设备!");
+                        }
+                        List<SmartDevice> devices = smartDeviceService.queryOnLineDevice();
+                        String visitorNo = getUUIDBits(16);
+                        //region 将访客数据下发到设备
+                        for (SmartDevice device : devices) {
+                            CommonResult<String> insertVisitor = bsInsertVisitor(user, TimeExchange.DateToString(sv.getVisitorTime()), TimeExchange.DateToString(sv.getVisitorDeadline()), device.getNum(), visitorNo);
+                            if (!insertVisitor.isSuccess()) {
+                                throw new Exception(insertVisitor.getMessage());
+                            }
+                            sv.setVisitorsync(sv.getVisitorsync() == null ? insertVisitor.getData() : (sv.getVisitorsync() + "," + insertVisitor.getData()));
+                            sv.setDeviceNum(sv.getDeviceNum() == null ? device.getNum() : (sv.getDeviceNum() + "," + device.getNum()));
+                        }
+                        String code = GetVertifyCode.getRandomNumCode(6);
+                        sv.setVisitorCode(code);
+                    }
+
+                }
+
+            } else if (type == 2) {//拒绝
+                sv.setStatu(2);
+            }
+            int result = smartVisitorService.updateSmartVisitor(sv);
+            if (result <= 0) {
+                throw new Exception("审核失败");
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+        return CommonResult.ok("审核成功");
+    }
+
+    @Override
+    public CommonResult restsAudit(int id, int type) {
+        SmartVisitor sv = smartVisitorService.getSmartById(id);
+        if (sv == null) {
+            return CommonResult.fail("访客记录已失效,审核失败!");
+        }
+
+        //审核处理后的数据不能再处理判断
+        if (sv.getStatu().intValue() != eApproveStatu.Audit.getValue()) {
+            return CommonResult.fail("该记录已被操作过,请勿重复操作");
+        }
+
+        try {
+            //            同意
+            if (type == 4) {
+                sv.setStatu(9);
+                List<SmartVisitorRestsConfig> list = smartVisitorRestsConfigService.list(new LambdaQueryWrapper<>());
+                SmartVisitorRestsConfig smartVisitorRestsConfig = list.get(0);
+                Integer accessConfig = smartVisitorRestsConfig.getAccessConfig();
+                if (0 == accessConfig) {
+                    //推送到门禁
+                    if (!ObjectUtils.isEmpty(sv.getCarNum())) {
+                        String appId = parkConfig.getAppId();
+                        String carNo = sv.getCarNum();
+                        String parkKey = parkConfig.getParkKey();
+                        String rand = String.valueOf(Math.random());
+                        String reserveTime = TimeExchange.DateToString(sv.getVisitorTime(), "yyyy-MM-dd HH:mm:ss");
+                        String reserveEndTime = TimeExchange.DateToString(sv.getVisitorDeadline(), "yyyy-MM-dd HH:mm:ss");
+                        String version = "v1.0";
+                        String appSecret = parkConfig.getAppSecret();
+                        String url = parkConfig.getUrl() + "Inform/Reservation";
+
+                        JSONObject jsonobject = new JSONObject();
+                        jsonobject.put("appid", appId);
+                        jsonobject.put("carNo", carNo);
+                        jsonobject.put("parkKey", parkKey);
+                        jsonobject.put("rand", rand);
+                        jsonobject.put("reserveEndTime", reserveEndTime);
+                        jsonobject.put("reserveTime", reserveTime);
+                        jsonobject.put("version", "v1.0");
+
+                        //appid=ymdd36ed157ac423e2&carNo=赣U123659&parkKey=wdcmq9rc&rand=9.94995525689689966&reserveEndTime=2023-12-22 20:12:10&reserveTime=2023-12-21 18:12:10&version=v1.0&50596cd243dc4547b4c05f01f8ea02a4
+                        String md5Str = "appid=" + appId + "&carNo=" + carNo + "&parkKey=" + parkKey + "&rand=" + rand + "&reserveEndTime=" + reserveEndTime + "&reserveTime=" + reserveTime + "&version=" + version + "&" + appSecret;
+                        String sign = CommonUtil.MD5(md5Str);
+                        //sign签名
+                        jsonobject.put("sign", sign);
+
+                        //返回的结果中 code为1表示成功
+                        String result = RequestUtils.httpPost(url, jsonobject.toJSONString());
+
+                        logger.info(result);
+
+                        if (!result.contains("预约成功")) {
+                            throw new Exception("审核失败");
+                        }
+
+                        ObjectMapper objectMapper = new ObjectMapper();
+                        BsReservationVo reservation = objectMapper.readValue(result, BsReservationVo.class);
+                        sv.setBsOrderNo(reservation.getData().getReOrderNo());
+                    } else {
+                        List<SmartDevice> devices = smartDeviceService.queryOnLineDevice();
+                        String visitorNo = getUUIDBits(16);
+                        //region 将访客数据下发到设备
+                        for (SmartDevice device : devices) {
+                            //查找用户是否存在
+                            SmartUser user = smartUserService.getSmartById(sv.getUserId());
+                            if (user == null) {
+                                throw new Exception("访客用户ID在系统中不存在,无法将访客信息下发到门禁设备!");
+                            }
+                            CommonResult<String> insertVisitor = bsInsertVisitor(user, TimeExchange.DateToString(sv.getVisitorTime()), TimeExchange.DateToString(sv.getVisitorDeadline()), device.getNum(), visitorNo);
+                            if (!insertVisitor.isSuccess()) {
+                                throw new Exception(insertVisitor.getMessage());
+                            }
+                            sv.setVisitorsync(sv.getVisitorsync() == null ? insertVisitor.getData() : (sv.getVisitorsync() + "," + insertVisitor.getData()));
+                            sv.setDeviceNum(sv.getDeviceNum() == null ? device.getNum() : (sv.getDeviceNum() + "," + device.getNum()));
+                        }
+                        String code = GetVertifyCode.getRandomNumCode(6);
+                        sv.setVisitorCode(code);
+                    }
+
+                    //发送短信给其他访客用户
+                    if (!ObjectUtils.isEmpty(sv.getVisitorCode())) {
+                        String message = SendSms.sendVisitorSms("+86" + sv.getUserPhone(), TimeExchange.getYear(sv.getVisitorTime()), TimeExchange.getMonth(sv.getVisitorTime()), TimeExchange.getDay(sv.getVisitorTime()), TimeExchange.getTime(sv.getVisitorTime()), TimeExchange.getTime(sv.getVisitorDeadline()), sv.getVisitorCode());
+                        if (!message.contains("success")) {
+                            throw new Exception("发送失败");
+                        }
+                    }
+
+                }
+            } else if (type == 2) {//拒绝
+                sv.setStatu(2);
+            }
+            int result = smartVisitorService.updateSmartVisitor(sv);
+            if (result <= 0) {
+                throw new Exception("审核失败");
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+        return CommonResult.ok("审核成功");
+    }
+
     /**
      * 1、学生请假:
      * 我们这边调用请假接口之后,把请假数据写到了百胜系统的"学生请假登记"页面中,那到时候学生是通过任意设备都能进出吗?
@@ -736,7 +1125,7 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
                 case 1://家长
                     //查找是否存在访客记录
                     SmartVisitor visitor = smartVisitorService.queryParentVisitor(user.getId());
-                    if(visitor == null){
+                    if (visitor == null) {
                         logger.info("无访客数据,家长无法通行");
                         result.setResultcode(2);
                         result.setMessage("无访客数据,家长无法通行");
@@ -787,7 +1176,7 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
             //访客码中的ID是访客数据的ID
             //查找是否存在访客记录
             SmartVisitor visitor = smartVisitorService.getSmartById(qiv.getId());
-            if(visitor == null){
+            if (visitor == null) {
                 logger.info("无访客数据,访客无法通行");
                 result.setResultcode(2);
                 result.setMessage("无访客数据,访客无法通行");

+ 38 - 0
src/main/java/com/template/controller/SmartVisitorParentsConfigController.java

@@ -2,14 +2,19 @@ package com.template.controller;
 
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.template.annotation.DESRespondSecret;
 import com.template.api.SmartVisitorParentsConfigControllerAPI;
 import com.template.mapper.SmartVisitorParentsConfigMapper;
 import com.template.model.pojo.SmartAskForLeaveConfig;
+import com.template.model.pojo.SmartDuties;
+import com.template.model.pojo.SmartUser;
 import com.template.model.pojo.SmartVisitorParentsConfig;
 import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
 import com.template.model.vo.SmartVisitorParentsConfigVo;
+import com.template.services.SmartDutiesService;
+import com.template.services.SmartUserService;
 import com.template.services.SmartVisitorParentsConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -33,6 +38,12 @@ public class SmartVisitorParentsConfigController implements SmartVisitorParentsC
     @Autowired
     SmartVisitorParentsConfigService smartVisitorParentsConfigService;
 
+    @Autowired
+    SmartUserService smartUserService;
+
+    @Autowired
+    SmartDutiesService smartDutiesService;
+
     @Override
     @DESRespondSecret(validated = true)
     public CommonResult getClassId(Integer page,Integer size, Integer classId) {
@@ -51,5 +62,32 @@ public class SmartVisitorParentsConfigController implements SmartVisitorParentsC
         return CommonResult.fail();
     }
 
+    @Override
+    @DESRespondSecret(validated = true)
+    public CommonResult getUserId(Integer userId) {
+        SmartUser smartById = smartUserService.getSmartById(userId);
+        if (ObjectUtils.isEmpty(smartById)) {
+            return CommonResult.fail("不存在该用户");
+        }
+//        职务
+        Integer duties = smartById.getDuties();
+
+        SmartDuties smartDuties = smartDutiesService.getSmartById(duties);
+        if (ObjectUtils.isEmpty(smartDuties)) {
+            return CommonResult.fail("无职务");
+        }
+
+        String name = smartDuties.getName();
+        if (!"班主任".equals(name)) {
+            return CommonResult.fail("无配置权限");
+        }
+
+        Integer schoolClass = smartById.getSchoolClass();
+
+        SmartVisitorParentsConfigVo smartVisitorParentsConfigVo=smartVisitorParentsConfigService.getClassId(schoolClass);
+
+        return CommonResult.ok(smartVisitorParentsConfigVo);
+    }
+
 }
 

+ 8 - 0
src/main/java/com/template/mapper/SmartAccessMapper.java

@@ -1,7 +1,13 @@
 package com.template.mapper;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.template.model.pojo.SmartAccess;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.template.model.vo.SmartAccessVo;
+import com.template.model.vo.VisitorPageVo;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +17,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @author ceshi
  * @since 2024-05-31
  */
+@Repository
 public interface SmartAccessMapper extends BaseMapper<SmartAccess> {
 
+    IPage<SmartAccessVo> getPage(Page<SmartAccessVo> page,@Param("keyWord") String keyWord,@Param("gradeId") Integer gradeId, @Param("classId") Integer classId,@Param("departmentId") Integer departmentId,@Param("openType") Integer openType,@Param("resultStatus") Integer resultStatus,@Param("startTime")String startTime,@Param("endTime")String endTime);
 }

+ 6 - 2
src/main/java/com/template/mapper/SmartAttendanceMapper.java

@@ -24,7 +24,11 @@ public interface SmartAttendanceMapper extends BaseMapper<SmartAttendance> {
 
     List<Integer> getGroup();
 
-    IPage<AskForLeaveVo> askForLeavePage(Page<AskForLeaveVo> page, @Param("name") String name,@Param("cardNo") String cardNo,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("ifVerification")String ifVerification,@Param("classId")String classId);
+    IPage<AskForLeaveVo> askForLeavePage(Page<AskForLeaveVo> page, @Param("name") String name, @Param("cardNo") String cardNo, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("ifVerification") String ifVerification, @Param("classId") String classId);
+
+    IPage<SmartAttendanceVo> queryPage(Page<SmartAttendanceVo> page, @Param("gradeId") Integer gradeId, @Param("classId") Integer classId, @Param("status") String status, @Param("studentNo") String studentNo, @Param("name") String name, @Param("startTime") String startTime, @Param("endTime") String endTime);
+
+    List<SmartAttendanceVo> queryExpor(@Param("gradeId") Integer gradeId, @Param("classId") Integer classId, @Param("status") String status, @Param("studentNo") String studentNo, @Param("name") String name, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
-    IPage<SmartAttendanceVo> queryPage(Page<SmartAttendanceVo> page,@Param("gradeId") Integer gradeId,@Param("classId") Integer classId,@Param("status") String status,@Param("studentNo") String studentNo,@Param("name") String name,@Param("startTime") String startTime,@Param("endTime") String endTime);
 }
+

+ 2 - 0
src/main/java/com/template/mapper/SmartVisitorParentsConfigMapper.java

@@ -20,4 +20,6 @@ import org.springframework.stereotype.Repository;
 public interface SmartVisitorParentsConfigMapper extends BaseMapper<SmartVisitorParentsConfig> {
 
     IPage<SmartVisitorParentsConfigVo> getClassIdPage(Page<SmartVisitorParentsConfigVo> p,@Param("classId") Integer classId);
+
+    SmartVisitorParentsConfigVo getClassId(@Param("schoolClass") Integer schoolClass);
 }

+ 9 - 0
src/main/java/com/template/model/pojo/SmartAccess.java

@@ -60,6 +60,15 @@ public class SmartAccess implements Serializable {
     @ApiModelProperty(value = "发生时间")
     private String dateTime;
 
+    @ApiModelProperty(value = "出入标识: 1-进, 0-出")
+    private Integer inOut;
+
+    @ApiModelProperty(value = "开门方式:0-白名单比对,1-人证比对,2-IC卡比对")
+    private Integer openType;
+
+    @ApiModelProperty(value = "比对结果:1-成功,0-失败")
+    private Integer resultStatus;
+
     @ApiModelProperty(value = "创建时间")
     @TableField(fill = FieldFill.INSERT)
     private Date createTime;

+ 44 - 0
src/main/java/com/template/model/vo/SmartAccessVo.java

@@ -0,0 +1,44 @@
+package com.template.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class SmartAccessVo {
+    private Integer id;
+
+    @ApiModelProperty(value = "名字")
+    private String name;
+
+    @ApiModelProperty(value = "设备sn号")
+    private String sn;
+
+    @ApiModelProperty(value = "类型")
+    private String type;
+
+    @ApiModelProperty(value = "部门")
+    private String departmentName;
+
+
+    @ApiModelProperty(value = "班级")
+    private String className;
+
+    //    学号
+    private String cardNo;
+
+    @ApiModelProperty(value = "图片")
+    private String image;
+
+    @ApiModelProperty(value = "开门方式:0-白名单比对,1-人证比对,2-IC卡比对")
+    private Integer openType;
+
+    @ApiModelProperty(value = "发生时间")
+    private String dateTime;
+
+    @ApiModelProperty(value = "出入标识: 1-进, 0-出")
+    private Integer access;
+
+    @ApiModelProperty(value = "比对结果:1-成功,0-失败")
+    private Integer resultStatus;
+
+}

+ 2 - 2
src/main/java/com/template/model/vo/SmartAttendanceVo.java

@@ -25,10 +25,10 @@ public class SmartAttendanceVo {
     private String headImage;
 
     @ApiModelProperty(value = "签到时间")
-    private Date attendTime;
+    private String attendTime;
 
     @ApiModelProperty(value = "希沃发起时间")
-    private Date initiateTime;
+    private String initiateTime;
 
     @ApiModelProperty(value = "考勤状态 准时:0 迟到:1 缺卡:3 请假:6 超时打卡:7")
     private Integer status;

+ 4 - 1
src/main/java/com/template/services/SmartAccessService.java

@@ -2,6 +2,8 @@ package com.template.services;
 
 import com.template.model.pojo.SmartAccess;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.template.model.result.PageUtils;
+import com.template.model.vo.SmartAccessVo;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -14,8 +16,9 @@ import java.util.List;
  * @author ceshi
  * @since 2024-05-31
  */
-@Repository
 public interface SmartAccessService extends IService<SmartAccess> {
 
     List<SmartAccess> track(String stateTime, String endTime, Integer id);
+
+    PageUtils<SmartAccessVo> getPage(Integer currentPage, Integer pageCount,String keyWord,Integer gradeId, Integer classId, Integer departmentId, Integer openType, Integer resultStatus,String startTime,String endTime);
 }

+ 2 - 0
src/main/java/com/template/services/SmartAttendanceService.java

@@ -38,4 +38,6 @@ public interface SmartAttendanceService extends IService<SmartAttendance> {
     PageUtils<SmartAttendanceVo> queryPage(int currentPage, int pageCount, Integer gradeId, Integer classId, String status, String studentNo, String name, String startTime, String endTime);
 
     List<SmartAttendance> duplicatesList(Date startTime, Date endTime, Date initiateTime);
+
+    List<SmartAttendanceVo> queryExpor(Integer gradeId, Integer classId, String status, String studentNo, String name, String startTime, String endTime);
 }

+ 2 - 0
src/main/java/com/template/services/SmartVisitorParentsConfigService.java

@@ -17,4 +17,6 @@ import com.template.model.vo.SmartVisitorParentsConfigVo;
 public interface SmartVisitorParentsConfigService extends IService<SmartVisitorParentsConfig> {
 
     PageUtils<SmartVisitorParentsConfigVo> getClassIdPage(Integer page, Integer size, Integer classId);
+
+    SmartVisitorParentsConfigVo getClassId(Integer schoolClass);
 }

+ 18 - 2
src/main/java/com/template/services/impl/SmartAccessServiceImpl.java

@@ -1,11 +1,17 @@
 package com.template.services.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.template.model.pojo.SmartAccess;
 import com.template.mapper.SmartAccessMapper;
 import com.template.model.pojo.SmartFaceDiscern;
+import com.template.model.result.PageUtils;
+import com.template.model.vo.SmartAccessVo;
+import com.template.model.vo.VisitorPageVo;
 import com.template.services.SmartAccessService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -21,15 +27,25 @@ import java.util.List;
 @Service
 public class SmartAccessServiceImpl extends ServiceImpl<SmartAccessMapper, SmartAccess> implements SmartAccessService {
 
+    @Autowired
+    SmartAccessMapper smartAccessMapper;
+
     @Override
     public List<SmartAccess> track(String stateTime, String endTime, Integer id) {
         LambdaQueryWrapper<SmartAccess> wrapper = new LambdaQueryWrapper<>();
         wrapper.between(SmartAccess::getDateTime, stateTime, endTime)
                 .eq(SmartAccess::getUserId, id)
                 .orderByDesc(SmartAccess::getDateTime);
-
         List<SmartAccess> list = this.list(wrapper);
-
         return list;
     }
+
+    @Override
+    public PageUtils<SmartAccessVo> getPage(Integer currentPage, Integer pageCount,String keyWord,Integer gradeId, Integer classId, Integer departmentId, Integer openType, Integer resultStatus,String startTime,String endTime) {
+        Page<SmartAccessVo> page = new Page<>();
+        page.setCurrent(currentPage);
+        page.setSize(pageCount);
+        IPage<SmartAccessVo> datas = smartAccessMapper.getPage(page,keyWord,gradeId,classId,departmentId,openType,resultStatus,startTime,endTime);
+        return new PageUtils(datas);
+    }
 }

+ 6 - 0
src/main/java/com/template/services/impl/SmartAttendanceServiceImpl.java

@@ -125,4 +125,10 @@ public class SmartAttendanceServiceImpl extends ServiceImpl<SmartAttendanceMappe
 
         return list;
     }
+
+    @Override
+    public List<SmartAttendanceVo> queryExpor(Integer gradeId, Integer classId, String status, String studentNo, String name, String startTime, String endTime) {
+        List<SmartAttendanceVo> vos =smartAttendanceMapper.queryExpor(gradeId,classId,status,studentNo,name,startTime,endTime);
+        return vos;
+    }
 }

+ 7 - 0
src/main/java/com/template/services/impl/SmartVisitorParentsConfigServiceImpl.java

@@ -36,4 +36,11 @@ public class SmartVisitorParentsConfigServiceImpl extends ServiceImpl<SmartVisit
 
         return new PageUtils<>(page1);
     }
+
+    @Override
+    public SmartVisitorParentsConfigVo getClassId(Integer schoolClass) {
+
+        return smartVisitorParentsConfigMapper.getClassId(schoolClass);
+    }
+
 }

+ 45 - 0
src/main/resources/mapper/template/SmartAccessMapper.xml

@@ -2,4 +2,49 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.template.mapper.SmartAccessMapper">
 
+    <select id="getPage" resultType="com.template.model.vo.SmartAccessVo">
+        SELECT
+        sa.id,
+        sa.name,
+        sa.sn,
+        sa.type,
+        sd.`name` as departmentName,
+        sc.`name` as className,
+        su.card_no as cardNo,
+        sa.image,
+        sa.open_type as openType,
+        sa.date_time as dateTime,
+        sa.in_out as access,
+        sa.result_status as resultStatus
+        FROM
+        `smart_access` sa
+        LEFT JOIN smart_user su on sa.user_id=su.id
+        LEFT JOIN smart_department sd on su.department_id=sd.id
+        LEFT JOIN smart_class sc on su.school_class=sc.id
+        LEFT JOIN smart_grade sg on sc.grade_id=sg.id
+        WHERE sa.deleted = 0
+        <if test="keyWord != null and keyWord != ''">
+            and (sa.name like '%' #{keyWord} '%' or su.card_no like '%' #{keyWord} '%')
+        </if>
+        <if test="gradeId != null and gradeId != ''">
+            and sc.grade_id= #{gradeId}
+        </if>
+        <if test="classId != null and classId != ''">
+            and su.school_class= #{classId}
+        </if>
+        <if test="departmentId != null and departmentId != ''">
+            and su.department_id= #{departmentId}
+        </if>
+        <if test="openType != null and openType != ''">
+            and sa.open_type= #{openType}
+        </if>
+        <if test="resultStatus != null and  resultStatus != ''">
+            and sa.result_status= #{resultStatus}
+        </if>
+        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+            and sa.date_time &gt;= #{startTime} and sa.date_time &lt;= #{endTime}
+        </if>
+
+        ORDER BY sa.date_time DESC
+    </select>
 </mapper>

+ 40 - 2
src/main/resources/mapper/template/SmartAttendanceMapper.xml

@@ -28,7 +28,7 @@
         sa.`status` = 6
         AND sa.deleted = 0
         <if test="name != null and name != ''">
-            and sa.xw_user_name = #{name}
+            and sa.xw_user_name like '%' #{name} '%'
         </if>
         <if test="cardNo != null and cardNo != ''">
             and su.card_no = #{cardNo}
@@ -75,7 +75,45 @@
             and su.card_no = #{studentNo}
         </if>
         <if test="name != null and name != ''">
-            and sa.xw_user_name = #{name}
+            and sa.xw_user_name like '%' #{name} '%'
+        </if>
+        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+            and sa.attend_time &gt;= #{startTime} and sa.attend_time &lt;= #{endTime}
+        </if>
+        ORDER BY sa.create_time desc
+    </select>
+
+    <select id="queryExpor" resultType="com.template.model.vo.SmartAttendanceVo">
+        SELECT
+        sa.id,
+        sa.xw_user_name as name,
+        sc.`name` as className,
+        sg.`name` as gradeName,
+        su.card_no as cardNo,
+        su.head_image as headImage,
+        sa.attend_time as attendTime,
+        sa.initiate_time as initiateTime,
+        sa.`status`
+        FROM
+        `smart_attendance` sa
+        LEFT JOIN smart_class sc on sa.class_id=sc.id
+        LEFT JOIN smart_grade sg on sc.grade_id=sg.id
+        LEFT JOIN smart_user su on sa.user_id=su.id
+        where sa.deleted = 0
+        <if test="gradeId != null and gradeId != ''">
+            and sc.grade_id=#{gradeId}
+        </if>
+        <if test="classId != null and classId != ''">
+            and sa.class_id = #{classId}
+        </if>
+        <if test="status != null and status != ''">
+            and sa.`status` = #{status}
+        </if>
+        <if test="studentNo != null and studentNo != ''">
+            and su.card_no = #{studentNo}
+        </if>
+        <if test="name != null and name != ''">
+            and sa.xw_user_name like '%' #{name} '%'
         </if>
         <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
             and sa.attend_time &gt;= #{startTime} and sa.attend_time &lt;= #{endTime}

+ 35 - 15
src/main/resources/mapper/template/SmartVisitorParentsConfigMapper.xml

@@ -4,25 +4,45 @@
 
     <select id="getClassIdPage" resultType="com.template.model.vo.SmartVisitorParentsConfigVo">
         SELECT
-            svpc.id,
-            svpc.class_id as classId,
-            svpc.app_audit_config as appAuditConfig,
-            svpc.app_push_config as appPushConfig,
-            svpc.app_cancel_config as appCancelConfig,
-            svpc.screen_audit_config as screenAuditConfig,
-            svpc.screen_push_config as screenPushConfig,
-            svpc.screen_cancel_config as screenCancelConfig,
-            svpc.access_config as accessConfig,
-            svpc.create_time as createTime,
-            sc.`name` as className,
-            sg.`name` as gradeName
+        svpc.id,
+        svpc.class_id as classId,
+        svpc.app_audit_config as appAuditConfig,
+        svpc.app_push_config as appPushConfig,
+        svpc.app_cancel_config as appCancelConfig,
+        svpc.screen_audit_config as screenAuditConfig,
+        svpc.screen_push_config as screenPushConfig,
+        svpc.screen_cancel_config as screenCancelConfig,
+        svpc.access_config as accessConfig,
+        svpc.create_time as createTime,
+        sc.`name` as className,
+        sg.`name` as gradeName
         FROM
-            `smart_visitor_parents_config` svpc
-                LEFT JOIN smart_class sc ON svpc.class_id = sc.id
-                LEFT JOIN smart_grade sg ON sc.grade_id = sg.id
+        `smart_visitor_parents_config` svpc
+        LEFT JOIN smart_class sc ON svpc.class_id = sc.id
+        LEFT JOIN smart_grade sg ON sc.grade_id = sg.id
         WHERE svpc.deleted=0
         <if test="classId != null and classId != '' and classId != 0 ">
             and svpc.class_id = #{classId}
         </if>
     </select>
+
+    <select id="getClassId" resultType="com.template.model.vo.SmartVisitorParentsConfigVo">
+        SELECT svpc.id,
+               svpc.class_id             as classId,
+               svpc.app_audit_config     as appAuditConfig,
+               svpc.app_push_config      as appPushConfig,
+               svpc.app_cancel_config    as appCancelConfig,
+               svpc.screen_audit_config  as screenAuditConfig,
+               svpc.screen_push_config   as screenPushConfig,
+               svpc.screen_cancel_config as screenCancelConfig,
+               svpc.access_config        as accessConfig,
+               svpc.create_time          as createTime,
+               sc.`name`                 as className,
+               sg.`name`                 as gradeName
+        FROM `smart_visitor_parents_config` svpc
+                 LEFT JOIN smart_class sc ON svpc.class_id = sc.id
+                 LEFT JOIN smart_grade sg ON sc.grade_id = sg.id
+        WHERE svpc.deleted = 0
+          and svpc.class_id = #{schoolClass}
+    </select>
 </mapper>