Kaynağa Gözat

Merge branch 'pre'

dzx 1 yıl önce
ebeveyn
işleme
bd40b20439
38 değiştirilmiş dosya ile 1697 ekleme ve 55 silme
  1. 48 0
      src/main/java/com/xjrsoft/common/enums/GenderIntEnum.java
  2. 134 0
      src/main/java/com/xjrsoft/module/attendance/controller/AttendanceMessageSetController.java
  3. 54 0
      src/main/java/com/xjrsoft/module/attendance/dto/AddAttendanceMessageSetDto.java
  4. 53 0
      src/main/java/com/xjrsoft/module/attendance/dto/AddAttendanceMessageUserRelationDto.java
  5. 15 0
      src/main/java/com/xjrsoft/module/attendance/dto/AttendanceMessageSetDto.java
  6. 26 0
      src/main/java/com/xjrsoft/module/attendance/dto/AttendanceMessageSetPageDto.java
  7. 33 0
      src/main/java/com/xjrsoft/module/attendance/dto/UpdateAttendanceMessageSetDto.java
  8. 109 0
      src/main/java/com/xjrsoft/module/attendance/entity/AttendanceMessageSet.java
  9. 103 0
      src/main/java/com/xjrsoft/module/attendance/entity/AttendanceMessageUserRelation.java
  10. 17 0
      src/main/java/com/xjrsoft/module/attendance/mapper/AttendanceMessageSetMapper.java
  11. 17 0
      src/main/java/com/xjrsoft/module/attendance/mapper/AttendanceMessageUserRelationMapper.java
  12. 48 0
      src/main/java/com/xjrsoft/module/attendance/service/IAttendanceMessageSetService.java
  13. 102 0
      src/main/java/com/xjrsoft/module/attendance/service/impl/AttendanceMessageSetServiceImpl.java
  14. 84 0
      src/main/java/com/xjrsoft/module/attendance/vo/AttendanceMessageSetPageVo.java
  15. 60 0
      src/main/java/com/xjrsoft/module/attendance/vo/AttendanceMessageSetVo.java
  16. 54 0
      src/main/java/com/xjrsoft/module/attendance/vo/AttendanceMessageUserRelationVo.java
  17. 16 0
      src/main/java/com/xjrsoft/module/hikvision/mapper/HikvisionDataMapper.java
  18. 4 0
      src/main/java/com/xjrsoft/module/hikvision/util/Car_OutInRecordUtil.java
  19. 51 29
      src/main/java/com/xjrsoft/module/hikvision/util/DataUtil.java
  20. 2 1
      src/main/java/com/xjrsoft/module/hikvision/util/FaceImportUtil.java
  21. 143 0
      src/main/java/com/xjrsoft/module/hikvision/util/Teacher_Student_OutIn_RecordUtil.java
  22. 6 2
      src/main/java/com/xjrsoft/module/job/HikvisionBaseDataTask.java
  23. 3 1
      src/main/java/com/xjrsoft/module/liteflow/node/ReservationSchoolNode.java
  24. 31 0
      src/main/java/com/xjrsoft/module/liteflow/node/StudentLeaveNode.java
  25. 1 1
      src/main/java/com/xjrsoft/module/personnel/controller/CarMessageApplyController.java
  26. 2 1
      src/main/java/com/xjrsoft/module/personnel/entity/ReservationSchoolPeople.java
  27. 7 0
      src/main/java/com/xjrsoft/module/personnel/service/IReservationSchoolService.java
  28. 69 12
      src/main/java/com/xjrsoft/module/personnel/service/impl/ReservationSchoolServiceImpl.java
  29. 109 0
      src/main/java/com/xjrsoft/module/student/entity/StudentLeave.java
  30. 16 0
      src/main/java/com/xjrsoft/module/student/mapper/StudentLeaveMapper.java
  31. 16 0
      src/main/java/com/xjrsoft/module/student/service/IStudentLeaveService.java
  32. 107 0
      src/main/java/com/xjrsoft/module/student/service/impl/StudentLeaveServiceImpl.java
  33. 2 0
      src/main/java/com/xjrsoft/module/teacher/mapper/FaceImportMapper.java
  34. 10 0
      src/main/resources/mapper/teacher/TeacherFaceImportMapper.xml
  35. 35 8
      src/test/java/com/xjrsoft/module/job/HikvisionBaseDataTaskTest.java
  36. 41 0
      src/test/java/com/xjrsoft/module/liteflow/node/ReservationSchoolNodeTest.java
  37. 35 0
      src/test/java/com/xjrsoft/module/liteflow/node/StudentLeaveNodeTest.java
  38. 34 0
      src/test/java/com/xjrsoft/xjrsoftboot/FreeMarkerGeneratorTest.java

+ 48 - 0
src/main/java/com/xjrsoft/common/enums/GenderIntEnum.java

@@ -0,0 +1,48 @@
+package com.xjrsoft.common.enums;
+
+public enum GenderIntEnum {
+    /**
+     * 男
+     */
+    MALE("SB10001", 1),
+    /**
+     * 女
+     */
+    FEMALE("SB10002", 2);
+
+    final String code;
+    final Integer value;
+
+    public String getCode() {
+        return this.code;
+    }
+
+    public Integer getValue() {
+        return this.value;
+    }
+
+    public static Integer getValue(String code) {
+        for (GenderIntEnum item : values()) {
+            if (item.getCode().equals(code)) {
+                return  item.getValue();
+            }
+        }
+        return null;
+    }
+
+    GenderIntEnum(final String code, final Integer message) {
+        this.code = code;
+        this.value = message;
+    }
+
+    public static String getCode(Integer value) {
+        for (GenderIntEnum item : values()) {
+            if (item.getValue() == value) {
+                return  item.getCode();
+            }
+        }
+        return null;
+    }
+
+
+}

+ 134 - 0
src/main/java/com/xjrsoft/module/attendance/controller/AttendanceMessageSetController.java

@@ -0,0 +1,134 @@
+package com.xjrsoft.module.attendance.controller;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.yulichang.toolkit.MPJWrappers;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.constant.GlobalConstant;
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import com.xjrsoft.common.page.ConventPage;
+import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.common.model.result.RT;
+import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.attendance.dto.AddAttendanceMessageSetDto;
+import com.xjrsoft.module.attendance.dto.AttendanceMessageSetDto;
+import com.xjrsoft.module.attendance.dto.UpdateAttendanceMessageSetDto;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+
+import com.xjrsoft.module.attendance.dto.AttendanceMessageSetPageDto;
+import com.xjrsoft.module.attendance.entity.AttendanceMessageSet;
+import com.xjrsoft.module.attendance.entity.TeacherAttendanceRecord;
+import com.xjrsoft.module.attendance.service.IAttendanceMessageSetService;
+import com.xjrsoft.module.attendance.vo.AttendanceMessageSetPageVo;
+
+import com.xjrsoft.module.attendance.vo.AttendanceMessageSetVo;
+import com.xjrsoft.module.attendance.vo.AttendanceMessageUserRelationVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+* @title: 考勤消息设置
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+@RestController
+@RequestMapping("/attendance" + "/attendanceMessageSet")
+@Api(value = "/attendance"  + "/attendanceMessageSet",tags = "考勤消息设置代码")
+@AllArgsConstructor
+public class AttendanceMessageSetController {
+
+
+    private final IAttendanceMessageSetService attendanceMessageSetService;
+
+    @GetMapping(value = "/page")
+    @ApiOperation(value="考勤消息设置列表(分页)")
+    @SaCheckPermission("attendancemessageset:detail")
+    public RT<PageOutput<AttendanceMessageSetPageVo>> page(@Valid AttendanceMessageSetPageDto dto){
+
+        LambdaQueryWrapper<AttendanceMessageSet> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper
+                    .orderByDesc(AttendanceMessageSet::getId)
+                .select(AttendanceMessageSet.class,x -> VoToColumnUtil.fieldsToColumns(AttendanceMessageSetPageVo.class).contains(x.getProperty()));
+        IPage<AttendanceMessageSet> page = attendanceMessageSetService.page(ConventPage.getPage(dto), queryWrapper);
+        PageOutput<AttendanceMessageSetPageVo> pageOutput = ConventPage.getPageOutput(page, AttendanceMessageSetPageVo.class);
+        return RT.ok(pageOutput);
+    }
+
+    @GetMapping(value = "/list")
+    @ApiOperation(value="考勤消息设置列表")
+    @SaCheckPermission("attendancemessageset:detail")
+    public RT<List<AttendanceMessageSetVo>> list(@Valid AttendanceMessageSetDto dto) {
+        List<AttendanceMessageSet> list = attendanceMessageSetService.list(MPJWrappers.<AttendanceMessageSet>lambdaJoin().eq(ObjectUtil.isNotNull(dto.getRoleType()) && dto.getRoleType() != 0, AttendanceMessageSet::getRoleType, dto.getRoleType()));
+        List<AttendanceMessageSetVo> res = new ArrayList<>();
+        for (AttendanceMessageSet item : list) {
+            AttendanceMessageSet attendanceMessageSet = attendanceMessageSetService.getByIdDeep(item.getId());
+            if (attendanceMessageSet != null) {
+                res.add(BeanUtil.toBean(attendanceMessageSet, AttendanceMessageSetVo.class));
+            }
+        }
+        return RT.ok(res);
+    }
+
+    @GetMapping(value = "/info")
+    @ApiOperation(value="根据id查询考勤消息设置信息")
+    @SaCheckPermission("attendancemessageset:detail")
+    public RT<AttendanceMessageSetVo> info(@RequestParam Long id){
+        AttendanceMessageSet attendanceMessageSet = attendanceMessageSetService.getByIdDeep(id);
+        if (attendanceMessageSet == null) {
+           return RT.error("找不到此数据!");
+        }
+        return RT.ok(BeanUtil.toBean(attendanceMessageSet, AttendanceMessageSetVo.class));
+    }
+
+
+    @PostMapping
+    @ApiOperation(value = "新增考勤消息设置")
+    @SaCheckPermission("attendancemessageset:add")
+    public RT<Boolean> add(@Valid @RequestBody AddAttendanceMessageSetDto dto){
+        AttendanceMessageSet attendanceMessageSet = BeanUtil.toBean(dto, AttendanceMessageSet.class);
+        boolean isSuccess = attendanceMessageSetService.add(attendanceMessageSet);
+    return RT.ok(isSuccess);
+    }
+
+    @PutMapping
+    @ApiOperation(value = "修改考勤消息设置")
+    @SaCheckPermission("attendancemessageset:edit")
+    public RT<Boolean> update(@Valid @RequestBody UpdateAttendanceMessageSetDto dto){
+        AttendanceMessageSet attendanceMessageSet = BeanUtil.toBean(dto, AttendanceMessageSet.class);
+        return RT.ok(attendanceMessageSetService.update(attendanceMessageSet));
+    }
+
+    @PostMapping("edit")
+    @ApiOperation(value = "新增考勤消息设置")
+    @SaCheckPermission("attendancemessageset:add")
+    public RT<Boolean> add(@Valid @RequestBody List<UpdateAttendanceMessageSetDto> dtos) {
+        List<AttendanceMessageSet> attendanceMessageSets = new ArrayList<>();
+        for (UpdateAttendanceMessageSetDto dto : dtos) {
+            AttendanceMessageSet attendanceMessageSet = BeanUtil.toBean(dto, AttendanceMessageSet.class);
+            attendanceMessageSets.add(attendanceMessageSet);
+        }
+        boolean isSuccess = attendanceMessageSetService.edit(attendanceMessageSets);
+        return RT.ok(isSuccess);
+    }
+
+    @DeleteMapping
+    @ApiOperation(value = "删除考勤消息设置")
+    @SaCheckPermission("attendancemessageset:delete")
+    public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
+        return RT.ok(attendanceMessageSetService.delete(ids));
+
+    }
+
+}

+ 54 - 0
src/main/java/com/xjrsoft/module/attendance/dto/AddAttendanceMessageSetDto.java

@@ -0,0 +1,54 @@
+package com.xjrsoft.module.attendance.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+import com.xjrsoft.module.attendance.entity.AttendanceMessageUserRelation;
+
+
+
+/**
+* @title: 考勤消息设置
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+@Data
+public class AddAttendanceMessageSetDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Integer sortCode;
+    /**
+    * 消息类别(1:迟到消息 2:旷课消息 3:缺勤消息)
+    */
+    @ApiModelProperty("消息类别(1:迟到消息 2:旷课消息 3:缺勤消息)")
+    private Integer messageCategory;
+    /**
+    * 时间段(1:上午 2:下午 3:晚上 4:返校)
+    */
+    @ApiModelProperty("时间段(1:上午 2:下午 3:晚上 4:返校)")
+    private Integer timePeriod;
+    /**
+    * 指定人员
+    */
+    @ApiModelProperty("指定人员")
+    private String userRelation;
+
+    /**
+    * attendanceMessageUserRelation
+    */
+    @ApiModelProperty("attendanceMessageUserRelation子表")
+    private List<AddAttendanceMessageUserRelationDto> attendanceMessageUserRelationList;
+}

+ 53 - 0
src/main/java/com/xjrsoft/module/attendance/dto/AddAttendanceMessageUserRelationDto.java

@@ -0,0 +1,53 @@
+package com.xjrsoft.module.attendance.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+
+
+/**
+* @title: 考勤消息提醒人员
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+@Data
+public class AddAttendanceMessageUserRelationDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Integer sortCode;
+    /**
+    * 所属班级id
+    */
+    @ApiModelProperty("所属班级id")
+    private Integer classId;
+    /**
+    * 所属部门id
+    */
+    @ApiModelProperty("所属部门id")
+    private Integer deptId;
+    /**
+    * 用户id
+    */
+    @ApiModelProperty("用户id")
+    private String userId;
+    /**
+    * 考勤消息设置(attendance_message_set)
+    */
+    @ApiModelProperty("考勤消息设置(attendance_message_set)")
+    private String attendanceMessageSetId;
+
+}

+ 15 - 0
src/main/java/com/xjrsoft/module/attendance/dto/AttendanceMessageSetDto.java

@@ -0,0 +1,15 @@
+package com.xjrsoft.module.attendance.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class AttendanceMessageSetDto {
+    /**
+     * 人员类别(1:教职工 2:学生)
+     */
+    @ApiModelProperty("人员类别(1:教职工 2:学生)")
+    private  Integer roleType;
+}

+ 26 - 0
src/main/java/com/xjrsoft/module/attendance/dto/AttendanceMessageSetPageDto.java

@@ -0,0 +1,26 @@
+package com.xjrsoft.module.attendance.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.Date;
+
+
+/**
+* @title: 考勤消息设置分页查询入参
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class AttendanceMessageSetPageDto extends PageInput {
+
+
+}

+ 33 - 0
src/main/java/com/xjrsoft/module/attendance/dto/UpdateAttendanceMessageSetDto.java

@@ -0,0 +1,33 @@
+package com.xjrsoft.module.attendance.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.List;
+import java.util.Date;
+import com.xjrsoft.module.attendance.entity.AttendanceMessageUserRelation;
+
+
+
+/**
+* @title: 考勤消息设置
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+@Data
+public class UpdateAttendanceMessageSetDto extends AddAttendanceMessageSetDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Long id;
+}

+ 109 - 0
src/main/java/com/xjrsoft/module/attendance/entity/AttendanceMessageSet.java

@@ -0,0 +1,109 @@
+package com.xjrsoft.module.attendance.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.github.yulichang.annotation.EntityMapping;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+
+/**
+* @title: 考勤消息设置
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+@Data
+@TableName("attendance_message_set")
+@ApiModel(value = "attendance_message_set", description = "考勤消息设置")
+public class AttendanceMessageSet implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableId
+    private Long id;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT)
+    private Long createUserId;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createDate;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.UPDATE)
+    private Long modifyUserId;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.UPDATE)
+    private Date modifyDate;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleteMark;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT)
+    private Integer enabledMark;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Integer sortCode;
+    /**
+    * 消息类别(1:迟到消息 2:旷课消息 3:缺勤消息)
+    */
+    @ApiModelProperty("消息类别(1:迟到消息 2:旷课消息 3:缺勤消息)")
+    private Integer messageCategory;
+    /**
+    * 时间段(1:上午 2:下午 3:晚上 4:返校)
+    */
+    @ApiModelProperty("时间段(1:上午 2:下午 3:晚上 4:返校)")
+    private Integer timePeriod;
+    /**
+    * 指定人员
+    */
+    @ApiModelProperty("指定人员")
+    private String userRelation;
+    /**
+     * 人员类别(1:教职工 2:学生)
+     */
+    @ApiModelProperty("人员类别(1:教职工 2:学生)")
+    private  Integer roleType;
+    /**
+    * attendanceMessageUserRelation
+    */
+    @ApiModelProperty("attendanceMessageUserRelation子表")
+    @TableField(exist = false)
+    @EntityMapping(thisField = "id", joinField = "attendanceMessageSetId")
+    private List<AttendanceMessageUserRelation> attendanceMessageUserRelationList;
+
+}

+ 103 - 0
src/main/java/com/xjrsoft/module/attendance/entity/AttendanceMessageUserRelation.java

@@ -0,0 +1,103 @@
+package com.xjrsoft.module.attendance.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.github.yulichang.annotation.EntityMapping;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+
+/**
+* @title: 考勤消息提醒人员
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+@Data
+@TableName("attendance_message_user_relation")
+@ApiModel(value = "attendance_message_user_relation", description = "考勤消息提醒人员")
+public class AttendanceMessageUserRelation implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableId
+    private Long id;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT)
+    private Long createUserId;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createDate;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.UPDATE)
+    private Long modifyUserId;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.UPDATE)
+    private Date modifyDate;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleteMark;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT)
+    private Integer enabledMark;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Integer sortCode;
+    /**
+    * 所属班级id
+    */
+    @ApiModelProperty("所属班级id")
+    private Integer classId;
+    /**
+    * 所属部门id
+    */
+    @ApiModelProperty("所属部门id")
+    private Integer deptId;
+    /**
+    * 用户id
+    */
+    @ApiModelProperty("用户id")
+    private String userId;
+    /**
+    * 考勤消息设置(attendance_message_set)
+    */
+    @ApiModelProperty("考勤消息设置(attendance_message_set)")
+    private Long attendanceMessageSetId;
+
+
+}

+ 17 - 0
src/main/java/com/xjrsoft/module/attendance/mapper/AttendanceMessageSetMapper.java

@@ -0,0 +1,17 @@
+package com.xjrsoft.module.attendance.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.attendance.entity.AttendanceMessageSet;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @title: 考勤消息设置
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+@Mapper
+public interface AttendanceMessageSetMapper extends MPJBaseMapper<AttendanceMessageSet> {
+
+}

+ 17 - 0
src/main/java/com/xjrsoft/module/attendance/mapper/AttendanceMessageUserRelationMapper.java

@@ -0,0 +1,17 @@
+package com.xjrsoft.module.attendance.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.attendance.entity.AttendanceMessageUserRelation;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @title: 考勤消息提醒人员
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+@Mapper
+public interface AttendanceMessageUserRelationMapper extends MPJBaseMapper<AttendanceMessageUserRelation> {
+
+}

+ 48 - 0
src/main/java/com/xjrsoft/module/attendance/service/IAttendanceMessageSetService.java

@@ -0,0 +1,48 @@
+package com.xjrsoft.module.attendance.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.attendance.entity.AttendanceMessageSet;
+import lombok.Data;
+import java.util.List;
+
+/**
+* @title: 考勤消息设置
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+
+public interface IAttendanceMessageSetService extends MPJBaseService<AttendanceMessageSet> {
+    /**
+    * 新增
+    *
+    * @param attendanceMessageSet
+    * @return
+    */
+    Boolean add(AttendanceMessageSet attendanceMessageSet);
+
+    /**
+    * 更新
+    *
+    * @param attendanceMessageSet
+    * @return
+    */
+    Boolean update(AttendanceMessageSet attendanceMessageSet);
+
+    /**
+     * 更新
+     *
+     * @param attendanceMessageSets
+     * @return
+     */
+    Boolean edit(List<AttendanceMessageSet>  attendanceMessageSets);
+
+    /**
+    * 删除
+    *
+    * @param ids
+    * @return
+    */
+    Boolean delete(List<Long> ids);
+}

+ 102 - 0
src/main/java/com/xjrsoft/module/attendance/service/impl/AttendanceMessageSetServiceImpl.java

@@ -0,0 +1,102 @@
+package com.xjrsoft.module.attendance.service.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.module.attendance.entity.AttendanceMessageUserRelation;
+import com.xjrsoft.module.attendance.mapper.AttendanceMessageUserRelationMapper;
+import com.xjrsoft.module.attendance.entity.AttendanceMessageSet;
+import com.xjrsoft.module.attendance.mapper.AttendanceMessageSetMapper;
+import com.xjrsoft.module.attendance.service.IAttendanceMessageSetService;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+
+/**
+* @title: 考勤消息设置
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+@Service
+@AllArgsConstructor
+public class AttendanceMessageSetServiceImpl extends MPJBaseServiceImpl<AttendanceMessageSetMapper, AttendanceMessageSet> implements IAttendanceMessageSetService {
+    private final AttendanceMessageSetMapper attendanceMessageSetAttendanceMessageSetMapper;
+
+    private final AttendanceMessageUserRelationMapper attendanceMessageSetAttendanceMessageUserRelationMapper;
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean add(AttendanceMessageSet attendanceMessageSet) {
+        attendanceMessageSetAttendanceMessageSetMapper.insert(attendanceMessageSet);
+        for (AttendanceMessageUserRelation attendanceMessageUserRelation : attendanceMessageSet.getAttendanceMessageUserRelationList()) {
+            attendanceMessageUserRelation.setAttendanceMessageSetId(attendanceMessageSet.getId());
+            attendanceMessageSetAttendanceMessageUserRelationMapper.insert(attendanceMessageUserRelation);
+        }
+
+        return true;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean update(AttendanceMessageSet attendanceMessageSet) {
+        attendanceMessageSetAttendanceMessageSetMapper.updateById(attendanceMessageSet);
+        //********************************* AttendanceMessageUserRelation  增删改  开始 *******************************************/
+        {
+            // 查出所有子级的id
+            List<AttendanceMessageUserRelation> attendanceMessageUserRelationList = attendanceMessageSetAttendanceMessageUserRelationMapper.selectList(Wrappers.lambdaQuery(AttendanceMessageUserRelation.class).eq(AttendanceMessageUserRelation::getAttendanceMessageSetId, attendanceMessageSet.getId()).select(AttendanceMessageUserRelation::getId));
+            List<Long> attendanceMessageUserRelationIds = attendanceMessageUserRelationList.stream().map(AttendanceMessageUserRelation::getId).collect(Collectors.toList());
+            //原有子表单 没有被删除的主键
+            List<Long> attendanceMessageUserRelationOldIds = attendanceMessageSet.getAttendanceMessageUserRelationList().stream().map(AttendanceMessageUserRelation::getId).filter(Objects::nonNull).collect(Collectors.toList());
+            //找到需要删除的id
+            List<Long> attendanceMessageUserRelationRemoveIds = attendanceMessageUserRelationIds.stream().filter(item -> !attendanceMessageUserRelationOldIds.contains(item)).collect(Collectors.toList());
+
+            for (AttendanceMessageUserRelation attendanceMessageUserRelation : attendanceMessageSet.getAttendanceMessageUserRelationList()) {
+                //如果不等于空则修改
+                if (attendanceMessageUserRelation.getId() != null) {
+                    attendanceMessageSetAttendanceMessageUserRelationMapper.updateById(attendanceMessageUserRelation);
+                }
+                //如果等于空 则新增
+                else {
+                    //已经不存在的id 删除
+                    attendanceMessageUserRelation.setAttendanceMessageSetId(attendanceMessageSet.getId());
+                    attendanceMessageSetAttendanceMessageUserRelationMapper.insert(attendanceMessageUserRelation);
+                }
+            }
+            //已经不存在的id 删除
+            if(attendanceMessageUserRelationRemoveIds.size() > 0){
+                attendanceMessageSetAttendanceMessageUserRelationMapper.deleteBatchIds(attendanceMessageUserRelationRemoveIds);
+            }
+        }
+        //********************************* AttendanceMessageUserRelation  增删改  结束 *******************************************/
+
+        return true;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean edit(List<AttendanceMessageSet>  attendanceMessageSets) {
+        for (AttendanceMessageSet attendanceMessageSet : attendanceMessageSets) {
+            if (ObjectUtil.isNotNull(attendanceMessageSet.getId()) && attendanceMessageSet.getId() != 0) {
+                update(attendanceMessageSet);
+            } else {
+                add(attendanceMessageSet);
+            }
+        }
+        return true;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean delete(List<Long> ids) {
+        attendanceMessageSetAttendanceMessageSetMapper.deleteBatchIds(ids);
+        attendanceMessageSetAttendanceMessageUserRelationMapper.delete(Wrappers.lambdaQuery(AttendanceMessageUserRelation.class).in(AttendanceMessageUserRelation::getAttendanceMessageSetId, ids));
+
+        return true;
+    }
+}

+ 84 - 0
src/main/java/com/xjrsoft/module/attendance/vo/AttendanceMessageSetPageVo.java

@@ -0,0 +1,84 @@
+package com.xjrsoft.module.attendance.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import com.xjrsoft.common.annotation.Trans;
+import com.xjrsoft.common.enums.TransType;
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+* @title: 考勤消息设置分页列表出参
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+@Data
+public class AttendanceMessageSetPageVo {
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private String id;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Long createUserId;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Date createDate;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Long modifyUserId;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Date modifyDate;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Integer deleteMark;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Integer enabledMark;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Integer sortCode;
+    /**
+    * 消息类别(1:迟到消息 2:旷课消息 3:缺勤消息)
+    */
+    @ApiModelProperty("消息类别(1:迟到消息 2:旷课消息 3:缺勤消息)")
+    private Integer messageCategory;
+    /**
+    * 时间段(1:上午 2:下午 3:晚上 4:返校)
+    */
+    @ApiModelProperty("时间段(1:上午 2:下午 3:晚上 4:返校)")
+    private Integer timePeriod;
+    /**
+    * 指定人员
+    */
+    @ApiModelProperty("指定人员")
+    private String userRelation;
+    /**
+     * 人员类别(1:教职工 2:学生)
+     */
+    @ApiModelProperty("人员类别(1:教职工 2:学生)")
+    private  Integer roleType;
+
+}

+ 60 - 0
src/main/java/com/xjrsoft/module/attendance/vo/AttendanceMessageSetVo.java

@@ -0,0 +1,60 @@
+package com.xjrsoft.module.attendance.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+import com.xjrsoft.module.attendance.entity.AttendanceMessageUserRelation;
+
+/**
+* @title: 考勤消息设置表单出参
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+@Data
+public class AttendanceMessageSetVo {
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Long id;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Integer sortCode;
+    /**
+    * 消息类别(1:迟到消息 2:旷课消息 3:缺勤消息)
+    */
+    @ApiModelProperty("消息类别(1:迟到消息 2:旷课消息 3:缺勤消息)")
+    private Integer messageCategory;
+    /**
+    * 时间段(1:上午 2:下午 3:晚上 4:返校)
+    */
+    @ApiModelProperty("时间段(1:上午 2:下午 3:晚上 4:返校)")
+    private Integer timePeriod;
+    /**
+    * 指定人员
+    */
+    @ApiModelProperty("指定人员")
+    private String userRelation;
+
+    /**
+     * 人员类别(1:教职工 2:学生)
+     */
+    @ApiModelProperty("人员类别(1:教职工 2:学生)")
+    private  Integer roleType;
+
+    /**
+    * attendanceMessageUserRelation
+    */
+    @ApiModelProperty("attendanceMessageUserRelation子表")
+    private List<AttendanceMessageUserRelationVo> attendanceMessageUserRelationList;
+
+}

+ 54 - 0
src/main/java/com/xjrsoft/module/attendance/vo/AttendanceMessageUserRelationVo.java

@@ -0,0 +1,54 @@
+package com.xjrsoft.module.attendance.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalTime;
+import java.time.LocalDateTime;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Date;
+
+/**
+* @title: 考勤消息提醒人员表单出参
+* @Author dzx
+* @Date: 2024-05-20
+* @Version 1.0
+*/
+@Data
+public class AttendanceMessageUserRelationVo {
+
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Long id;
+    /**
+    * 
+    */
+    @ApiModelProperty("")
+    private Integer sortCode;
+    /**
+    * 所属班级id
+    */
+    @ApiModelProperty("所属班级id")
+    private Integer classId;
+    /**
+    * 所属部门id
+    */
+    @ApiModelProperty("所属部门id")
+    private Integer deptId;
+    /**
+    * 用户id
+    */
+    @ApiModelProperty("用户id")
+    private String userId;
+    /**
+    * 考勤消息设置(attendance_message_set)
+    */
+    @ApiModelProperty("考勤消息设置(attendance_message_set)")
+    private String attendanceMessageSetId;
+
+
+
+}

+ 16 - 0
src/main/java/com/xjrsoft/module/hikvision/mapper/HikvisionDataMapper.java

@@ -0,0 +1,16 @@
+package com.xjrsoft.module.hikvision.mapper;
+
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.hikvision.entity.HikvisionData;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @title: 寝室床位
+* @Author dzx
+* @Date: 2023-12-27
+* @Version 1.0
+*/
+@Mapper
+public interface HikvisionDataMapper extends MPJBaseMapper<HikvisionData> {
+
+}

+ 4 - 0
src/main/java/com/xjrsoft/module/hikvision/util/Car_OutInRecordUtil.java

@@ -0,0 +1,4 @@
+package com.xjrsoft.module.hikvision.util;
+
+public class Car_OutInRecordUtil {
+}

+ 51 - 29
src/main/java/com/xjrsoft/module/hikvision/util/DataUtil.java

@@ -10,17 +10,15 @@ import com.xjrsoft.module.base.entity.BaseGrade;
 import com.xjrsoft.module.organization.entity.Department;
 import com.xjrsoft.module.personnel.entity.CarMessageApply;
 import com.xjrsoft.module.system.entity.DictionaryDetail;
+import com.xjrsoft.module.teacher.mapper.FaceImportMapper;
 import lombok.extern.slf4j.Slf4j;
 import lombok.var;
+import org.apache.velocity.runtime.directive.Foreach;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ThreadLocalRandom;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 /**
  * @author dzx
@@ -148,7 +146,7 @@ public class DataUtil {
                 paramJson.addProperty("parentIndexCode", status);
                 paramJson.addProperty("orgCode", dict.getCode());
                 dataArray.add(paramJson);
-                idCodeMap.put(clientId, dict.getCode());
+                idCodeMap.put(clientId, dict.getCode() + "-" + status);
                 clientId ++;
             }
         }
@@ -172,18 +170,18 @@ public class DataUtil {
         dataArray = new JsonArray();
         for (String classType : classTypeSet) {
             for (BaseGrade baseGrade : gradeList) {
-                gradeNameMap.put(baseGrade.getId(), baseGrade.getName());
+                gradeNameMap.put(baseGrade.getId(), baseGrade.getName().replaceAll("级", ""));
                 if(tableData != null && tableData.containsKey(baseGrade.getId().toString())){
                     continue;
                 }
                 JsonObject paramJson = new JsonObject();
                 paramJson.addProperty("clientId", clientId);
-                paramJson.addProperty("orgIndexCode", baseGrade.getName() + "-" + classType);
+                paramJson.addProperty("orgIndexCode", baseGrade.getName().replaceAll("级", "") + "-" + classType);
                 paramJson.addProperty("orgName", baseGrade.getName());
                 paramJson.addProperty("parentIndexCode", classType);
                 paramJson.addProperty("orgCode", clientId);
                 dataArray.add(paramJson);
-                idCodeMap.put(clientId, baseGrade.getName());
+                idCodeMap.put(clientId, baseGrade.getName().replaceAll("级", "") + "-" + classType);
                 clientId ++;
             }
         }
@@ -227,7 +225,7 @@ public class DataUtil {
                 paramJson.addProperty("parentIndexCode", grade);
                 paramJson.addProperty("orgCode", clientId);
                 dataArray.add(paramJson);
-                idCodeMap.put(clientId, baseClass.getId().toString());
+                idCodeMap.put(clientId, baseClass.getId() + "-" + grade);
                 clientId ++;
             }
         }
@@ -250,7 +248,7 @@ public class DataUtil {
     }
 
     public Map<String, String> insertStudentOne(Db db, String tableName, Map<String, String> tableData) throws Exception {
-        String sql = "SELECT t1.id,t1.name,CONCAT(t3.id,'-',t4.name,'-',t3.class_type,'-',t2.stduy_status)," +
+        String sql = "SELECT t1.id,t1.name,CONCAT(t3.id,'-',replace(t4.name,'级',''),'-',t3.class_type,'-',t2.stduy_status)," +
                 " t1.user_name,t1.gender,DATE_FORMAT(t1.birth_date, '%Y-%m-%d'),t1.mobile,t1.email,t1.credential_type,t1.credential_number FROM xjr_user t1" +
                 " INNER JOIN base_student_school_roll t2 ON t1.id = t2.user_id" +
                 " INNER JOIN base_class t3 ON t2.class_id = t3.id" +
@@ -296,6 +294,7 @@ public class DataUtil {
             paramJson.addProperty("gender", gender);
 
             clientMap.put(i, el[0]);
+            System.out.println("入参:" + paramJson.toString());
             String result = apiUtil.doPost(apiPath, paramJson.toString(), null, header);
             JsonElement parse = jsonParser.parse(result);
             JsonObject resultJson = parse.getAsJsonObject();
@@ -453,29 +452,38 @@ public class DataUtil {
     }
 
     /*同步车辆数据*/
-    public Map<String, String> insertCar(Db db, String tableName, Map<Long, String> tableData) throws Exception {
+    public Map<Long, String> insertCar(Db db, String tableName, Map<String, String> tableData, FaceImportMapper faceImportMapper) throws Exception {
         String sql = "SELECT * FROM " + tableName + " WHERE delete_mark = 0 and status = 1";
         List<CarMessageApply> dataList = db.query(sql, CarMessageApply.class);
         String apiPath = "/api/resource/v1/vehicle/batch/add";
-        Map<String, String> idMap = new HashMap<>();
+        String apiPathTime = "/api/pms/v1/car/charge";
+        Map<Long, String> idMap = new HashMap<>();
         JsonParser jsonParser = new JsonParser();
         ApiUtil apiUtil = new ApiUtil();
 
-        Map<String, String> idCodeMap = new HashMap<>();
-        idCodeMap.put("tagId", "frs");
+        Map<Integer, Long> clientMap = new HashMap<>();
+        Map<String, String> tagMap = new HashMap<>();
+        tagMap.put("tagId", "frs");
+
+        String existingPlatesSql = "SELECT source_id FROM hikvision_data";
+        List<String> existingPlates = db.query(existingPlatesSql, String.class);
+
+        for (String h : existingPlates){
+            System.out.println(h + "qqq");
+        }
 
         JsonArray dataArray = new JsonArray();
         String result = null;
+        int clientId = 1;
         for (CarMessageApply carMessageApply : dataList) {
-            long currentTimestamp = System.currentTimeMillis();
-            int randomSuffix = ThreadLocalRandom.current().nextInt(10000);
-            String uniqueClientIdStr = String.format("%03d%04d", currentTimestamp % 1000, randomSuffix);
-            long uniqueClientId = Long.parseLong(uniqueClientIdStr);
+            if(tableData != null && tableData.containsKey(existingPlates.get(clientId - 1))){
+                continue;
+            }
 
             JsonObject paramJson = new JsonObject();
-            paramJson.addProperty("clientId", uniqueClientId);
+            paramJson.addProperty("clientId", clientId);
             paramJson.addProperty("plateNo", carMessageApply.getCarNumber());
-            paramJson.addProperty("PersonId",carMessageApply.getUserId());
+            paramJson.addProperty("personId", faceImportMapper.GetHikvisonPersonId(Long.valueOf(Long.parseLong(carMessageApply.getId().toString()))));
 
             int vehicleTypeNum;
             switch (carMessageApply.getVehicleType()) {
@@ -493,25 +501,39 @@ public class DataUtil {
                     break;
             }
             paramJson.addProperty("vehicleType", vehicleTypeNum);
-
+            clientMap.put(clientId, carMessageApply.getId());
             dataArray.add(paramJson);
+            clientId++;
         }
-        result = apiUtil.doPost(apiPath, dataArray.toString(), idCodeMap, null);
+        result = apiUtil.doPost(apiPath, dataArray.toString(), tagMap, null);
 
-        JsonElement parse = jsonParser.parse(result);
+        for (CarMessageApply carMessageApply : dataList) {
+            JsonObject paramJsonTime = new JsonObject();
+            paramJsonTime.addProperty("parkSyscode", "c69f2a7c48a74216bcab7d65f24d4a09");
+            paramJsonTime.addProperty("plateNo", carMessageApply.getCarNumber());
+            paramJsonTime.addProperty("startTime", String.valueOf(carMessageApply.getStartTime()));
+            paramJsonTime.addProperty("endTime", String.valueOf(carMessageApply.getEndTime()));
+            String aa = apiUtil.doPost(apiPathTime, String.valueOf(paramJsonTime), tagMap, null);
+        }
 
+        JsonElement parse = jsonParser.parse(result);
         JsonObject resultJson = parse.getAsJsonObject();
         if ("0".equals(resultJson.get("code").getAsString()) && "success".equals(resultJson.get("msg").getAsString())) {
             JsonArray array = resultJson.get("data").getAsJsonObject().get("successes").getAsJsonArray();
             for (JsonElement jsonElement : array) {
                 JsonObject jsonObject = jsonElement.getAsJsonObject();
-                idMap.put(jsonObject.get("clientId").getAsString(), jsonObject.get("vehicleId").getAsString());
+                int responseClientId = jsonObject.get("clientId").getAsInt();
+                Long sourceId = clientMap.get(responseClientId);
+                if (sourceId != null) {
+                    idMap.put(sourceId, jsonObject.get("vehicleId").getAsString());
+                } else {
+                    System.err.println("No matching clientId found in clientMap for: " + responseClientId);
+                }
             }
+            insertRecord(db, tableName, idMap);
         } else {
             System.err.println("API call failed: " + resultJson.get("msg").getAsString());
         }
-
-        insertRecord(db, tableName, idMap);
         return idMap;
     }
 

+ 2 - 1
src/main/java/com/xjrsoft/module/hikvision/util/FaceImportUtil.java

@@ -62,6 +62,7 @@ public class FaceImportUtil {
         } catch (Exception e) {
             e.printStackTrace();
         }
-        return base64String;
+        int commaIndex = base64String.indexOf(',') + 1;
+        return base64String.substring(commaIndex);
     }
 }

+ 143 - 0
src/main/java/com/xjrsoft/module/hikvision/util/Teacher_Student_OutIn_RecordUtil.java

@@ -0,0 +1,143 @@
+package com.xjrsoft.module.hikvision.util;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.db.Db;
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import io.swagger.annotations.ApiOperation;
+import lombok.var;
+import org.springframework.web.bind.annotation.GetMapping;
+
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class Teacher_Student_OutIn_RecordUtil {
+//    void tearcherInsertRecord(Db db, Long userId, String recordTime, Long facePhoto,int status) throws SQLException {
+//
+//        String sql = "INSERT INTO teacher_out_in_record(create_date, ...) " +
+//                "VALUES(now(), '"  + userId + "', '" + teacherId + "', '" +
+//                classId + "', '" + recordTime + "', '" + facePhoto + "', '" + status + "', '" + entry.getValue() + "')";
+//        db.execute(sql);
+//    }
+
+    public void studentInsertRecord(Db db, Long userId, Long teacherId, Long classId, String recordTime,Long facePhoto, int status) throws SQLException {
+        String sql = "INSERT INTO teacher_out_in_record(create_date, ...) " +
+                "VALUES(now(), '"  + userId + "', '" + teacherId + "', '" +
+                classId + "', '" + recordTime + "', '" + facePhoto + "', '" + status + "', '" + "')";
+        db.execute(sql);
+    }
+
+    public void visitInsertRecord(Db db, Long reservation_school_people_id, String recordTime,Long facePhoto, int status) throws SQLException {
+        String sql = "INSERT INTO visitor_out_in_record(create_date, ...) " +
+                "VALUES(now(), '"  + reservation_school_people_id + "', '" +
+                 recordTime + "', '" + facePhoto + "', '" + status + "', '" + "')";
+        db.execute(sql);
+    }
+
+
+    @GetMapping(value = "/adada")
+    @ApiOperation(value = "新www价项")
+    @SaCheckPermission("evaluateitem:add")
+    public String GetAccessConsole(){
+        ApiUtil apiUtil = new ApiUtil();
+        JsonObject paramJson = new JsonObject();
+        paramJson.addProperty("pageNo", 1);
+        paramJson.addProperty("pageSize", 100);
+
+        Map<String, String> querys = new HashMap<>();
+        querys.put("tagId", "frs");
+
+        String apiPath = "/api/resource/v2/acsDevice/search";
+        String response = apiUtil.doPost(apiPath, String.valueOf(paramJson), querys);
+
+        return GetDoorEvents(response);
+    }
+
+    public String GetDoorEvents(String accessPointResponse){
+        ApiUtil apiUtil = new ApiUtil();
+
+        JsonObject accessPointJson = new Gson().fromJson(accessPointResponse, JsonObject.class);
+        JsonArray dataList = accessPointJson.getAsJsonObject("data").getAsJsonArray("list");
+        String apiPath = "/api/acs/v2/door/events";
+        String response = null;
+        for(JsonElement element : dataList){
+            JsonObject item = element.getAsJsonObject();
+            JsonObject paramJson = new JsonObject();
+            JsonArray doorIndexCodes = new JsonArray();
+            paramJson.addProperty("pageNo", 1);
+            paramJson.addProperty("pageSize", 10);
+            doorIndexCodes.add(item.get("indexCode"));
+            paramJson.add("doorIndexCodes", doorIndexCodes);
+            response = apiUtil.doPost(apiPath, String.valueOf(paramJson), null);
+            // 执行四中人员的导入
+            stProcessRecords(response);
+
+//            doorIndexCodes.add(item.get("indexCode").getAsString());
+            System.out.println(response);
+        }
+
+        return response;
+    }
+
+    public void stProcessRecords(String doorEventsResponse) {
+        JsonObject doorEventsJson = new Gson().fromJson(doorEventsResponse, JsonObject.class);
+        JsonArray dataList = doorEventsJson.getAsJsonObject("data").getAsJsonArray("list");
+
+        for (JsonElement element : dataList) {
+            JsonObject item = element.getAsJsonObject();
+            if (item.get("studentId").isJsonNull()) {
+                // 老师记录
+                String personId = item.get("personId").isJsonNull() ? null : item.get("personId").getAsString();
+                int inAndOutType = item.get("inAndOutType").getAsInt();
+
+            } else {
+                // 学生记录
+                String studentId = item.get("studentId").getAsString();
+                String personId = item.get("personId").isJsonNull() ? null : item.get("personId").getAsString();
+                int status = item.get("inAndOutType").getAsInt();
+                String receiveTime = item.get("receiveTime").getAsString();
+
+                // 执行mapper获取例如班主任等数据 然后执行
+//                Teacher_Student_OutIn_RecordUtil teacherStudentOutInRecordUtil = new Teacher_Student_OutIn_RecordUtil();
+//                teacherStudentOutInRecordUtil.studentInsertRecord(db...);
+            }
+        }
+    }
+
+    void GetVisitRecord(){
+        ApiUtil apiUtil = new ApiUtil();
+        JsonObject paramJson = new JsonObject();
+        paramJson.addProperty("pageNo", 1);
+        paramJson.addProperty("pageSize", 100);
+
+        Map<String, String> querys = new HashMap<>();
+        querys.put("tagId", "frs");
+
+        String apiPath = "/api/visitor/v2/visiting/records\n";
+        String response = apiUtil.doPost(apiPath, String.valueOf(paramJson), querys);
+
+        JsonObject doorEventsJson = new Gson().fromJson(response, JsonObject.class);
+        JsonArray dataList = doorEventsJson.getAsJsonObject("data").getAsJsonArray("list");
+
+        for (JsonElement element : dataList) {
+            JsonObject item = element.getAsJsonObject();
+            if (item.get("orderId").isJsonNull()) {
+                // 访客记录
+                Long orderId = item.get("orderId").getAsLong();
+                String picUri = item.get("picUri").getAsString();
+                String visitStartTime = item.get("visitStartTime").getAsString();
+                // int status?
+
+                // mapper
+
+//                Teacher_Student_OutIn_RecordUtil teacherStudentOutInRecordUtil = new Teacher_Student_OutIn_RecordUtil();
+//                teacherStudentOutInRecordUtil.visitInsertRecord();db...);
+            }
+        }
+    }
+
+}

+ 6 - 2
src/main/java/com/xjrsoft/module/job/HikvisionBaseDataTask.java

@@ -7,7 +7,9 @@ import com.xjrsoft.common.utils.DatasourceUtil;
 import com.xjrsoft.module.hikvision.entity.HikvisionData;
 import com.xjrsoft.module.hikvision.util.DataUtil;
 import com.xjrsoft.module.schedule.entity.JianyueData;
+import com.xjrsoft.module.teacher.mapper.FaceImportMapper;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
@@ -25,7 +27,8 @@ import java.util.Set;
 @Component
 @Slf4j
 public class HikvisionBaseDataTask {
-
+    @Autowired
+    private FaceImportMapper faceImportMapper;
 
     @Scheduled(cron = "0 */15 * * * ?")
     public void RefreshConnectionPool() {
@@ -73,7 +76,8 @@ public class HikvisionBaseDataTask {
 
             //推送车辆
             String carTableName = "car_message_apply";
-            dataUtil.insertCar(use, carTableName, null);
+            Map<String, String> baseCar = dataMap.get(carTableName);
+            dataUtil.insertCar(use, carTableName, baseCar, faceImportMapper);
 
             tableName = "base_class";
             Map<String, String> baseClass = dataMap.get(tableName);

+ 3 - 1
src/main/java/com/xjrsoft/module/liteflow/node/ReservationSchoolNode.java

@@ -28,10 +28,12 @@ public class ReservationSchoolNode extends NodeComponent {
         Long formId = Convert.toLong(value);
         if (formId != null) {
             // 数据处理
-            ReservationSchool dataObj = reservationSchoolService.getById(formId);
+            ReservationSchool dataObj = reservationSchoolService.getByIdDeep(formId);
             dataObj.setStatus(1);
             dataObj.setExamStatus(1);
             reservationSchoolService.updateById(dataObj);
+
+            reservationSchoolService.registration(dataObj);
         }
     }
 }

+ 31 - 0
src/main/java/com/xjrsoft/module/liteflow/node/StudentLeaveNode.java

@@ -0,0 +1,31 @@
+package com.xjrsoft.module.liteflow.node;
+
+import cn.hutool.core.convert.Convert;
+import com.xjrsoft.module.student.service.IStudentLeaveService;
+import com.yomahub.liteflow.core.NodeComponent;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * 请假数据,推送海康门禁
+ */
+@Component("student_leave_node")
+public class StudentLeaveNode extends NodeComponent {
+
+    @Autowired
+    private IStudentLeaveService studentLeaveService;
+
+    @Override
+    public void process() throws Exception {
+        // 获取表单中数据编号
+        Map<String, Object> params = this.getFirstContextBean();
+        Object value = util.getFormDatKey(params,"id");
+        Long formId = Convert.toLong(value);
+        if (formId != null) {
+            // 数据处理
+            studentLeaveService.hikvisionLeave(formId);
+        }
+    }
+}

+ 1 - 1
src/main/java/com/xjrsoft/module/personnel/controller/CarMessageApplyController.java

@@ -72,7 +72,7 @@ public class CarMessageApplyController {
                         .eq(StrUtil.isNotBlank(dto.getUserName()), XjrUser::getUserName,dto.getUserName())
                         .like(StrUtil.isNotBlank(dto.getMobile()),XjrUser::getMobile,dto.getMobile())
                         .eq(ObjectUtil.isNotNull(dto.getDepId())&&dto.getDepId()!=0, CarMessageApply::getDeptId,dto.getDepId())
-                        .eq(ObjectUtil.isNotNull(dto.getStatus())&&dto.getStatus()!=0, CarMessageApply::getExamStatus,dto.getStatus())
+                        .eq(ObjectUtil.isNotNull(dto.getStatus())&&dto.getStatus()!=0, CarMessageApply::getStatus,dto.getStatus())
                         .select(CarMessageApply.class,x -> VoToColumnUtil.fieldsToColumns(CarMessageApplyPageVo.class).contains(x.getProperty()))
                         .select(CarMessageApply::getId)
                         .leftJoin(XjrUser.class,XjrUser::getId,CarMessageApply::getUserId, ext->ext.selectAs(XjrUser::getUserName, CarMessageApplyPageVo::getUserName).select(XjrUser::getMobile))

+ 2 - 1
src/main/java/com/xjrsoft/module/personnel/entity/ReservationSchoolPeople.java

@@ -109,5 +109,6 @@ public class ReservationSchoolPeople implements Serializable {
     @ApiModelProperty("车牌号")
     private String plateNumber;
 
-
+    @ApiModelProperty("记录海康登记结果")
+    private String registrationResult;
 }

+ 7 - 0
src/main/java/com/xjrsoft/module/personnel/service/IReservationSchoolService.java

@@ -37,4 +37,11 @@ public interface IReservationSchoolService extends MPJBaseService<ReservationSch
     * @return
     */
     Boolean delete(List<Long> ids);
+
+    /**
+     * 访问海康预约免登记接口
+     * @param dataObj
+     * @return
+     */
+    Boolean registration(ReservationSchool dataObj);
 }

+ 69 - 12
src/main/java/com/xjrsoft/module/personnel/service/impl/ReservationSchoolServiceImpl.java

@@ -1,7 +1,12 @@
 package com.xjrsoft.module.personnel.service.impl;
 
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.google.gson.JsonObject;
+import com.xjrsoft.common.enums.GenderIntEnum;
+import com.xjrsoft.module.hikvision.entity.HikvisionData;
+import com.xjrsoft.module.hikvision.mapper.HikvisionDataMapper;
+import com.xjrsoft.module.hikvision.util.ApiUtil;
 import com.xjrsoft.module.personnel.entity.ReservationSchoolPeople;
 import com.xjrsoft.module.personnel.mapper.ReservationSchoolPeopleMapper;
 import com.xjrsoft.module.personnel.entity.ReservationSchool;
@@ -10,6 +15,8 @@ import com.xjrsoft.module.personnel.service.IReservationSchoolService;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
+import java.text.SimpleDateFormat;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -24,18 +31,19 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 @Service
 @AllArgsConstructor
 public class ReservationSchoolServiceImpl extends MPJBaseServiceImpl<ReservationSchoolMapper, ReservationSchool> implements IReservationSchoolService {
-    private final ReservationSchoolMapper reservationSchoolReservationSchoolMapper;
+    private final ReservationSchoolMapper reservationSchoolMapper;
 
-    private final ReservationSchoolPeopleMapper reservationSchoolReservationSchoolPeopleMapper;
+    private final ReservationSchoolPeopleMapper reservationSchoolPeopleMapper;
 
+    private final HikvisionDataMapper hikvisionDataMapper;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean add(ReservationSchool reservationSchool) {
-        reservationSchoolReservationSchoolMapper.insert(reservationSchool);
+        reservationSchoolMapper.insert(reservationSchool);
         for (ReservationSchoolPeople reservationSchoolPeople : reservationSchool.getReservationSchoolPeopleList()) {
             reservationSchoolPeople.setReservationSchooId(reservationSchool.getId());
-            reservationSchoolReservationSchoolPeopleMapper.insert(reservationSchoolPeople);
+            reservationSchoolPeopleMapper.insert(reservationSchoolPeople);
         }
 
         return true;
@@ -44,11 +52,11 @@ public class ReservationSchoolServiceImpl extends MPJBaseServiceImpl<Reservation
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean update(ReservationSchool reservationSchool) {
-        reservationSchoolReservationSchoolMapper.updateById(reservationSchool);
+        reservationSchoolMapper.updateById(reservationSchool);
         //********************************* ReservationSchoolPeople  增删改  开始 *******************************************/
         {
             // 查出所有子级的id
-            List<ReservationSchoolPeople> reservationSchoolPeopleList = reservationSchoolReservationSchoolPeopleMapper.selectList(Wrappers.lambdaQuery(ReservationSchoolPeople.class).eq(ReservationSchoolPeople::getReservationSchooId, reservationSchool.getId()).select(ReservationSchoolPeople::getId));
+            List<ReservationSchoolPeople> reservationSchoolPeopleList = reservationSchoolPeopleMapper.selectList(Wrappers.lambdaQuery(ReservationSchoolPeople.class).eq(ReservationSchoolPeople::getReservationSchooId, reservationSchool.getId()).select(ReservationSchoolPeople::getId));
             List<Long> reservationSchoolPeopleIds = reservationSchoolPeopleList.stream().map(ReservationSchoolPeople::getId).collect(Collectors.toList());
             //原有子表单 没有被删除的主键
             List<Long> reservationSchoolPeopleOldIds = reservationSchool.getReservationSchoolPeopleList().stream().map(ReservationSchoolPeople::getId).filter(Objects::nonNull).collect(Collectors.toList());
@@ -58,18 +66,18 @@ public class ReservationSchoolServiceImpl extends MPJBaseServiceImpl<Reservation
             for (ReservationSchoolPeople reservationSchoolPeople : reservationSchool.getReservationSchoolPeopleList()) {
                 //如果不等于空则修改
                 if (reservationSchoolPeople.getId() != null) {
-                    reservationSchoolReservationSchoolPeopleMapper.updateById(reservationSchoolPeople);
+                    reservationSchoolPeopleMapper.updateById(reservationSchoolPeople);
                 }
                 //如果等于空 则新增
                 else {
                     //已经不存在的id 删除
                     reservationSchoolPeople.setReservationSchooId(reservationSchool.getId());
-                    reservationSchoolReservationSchoolPeopleMapper.insert(reservationSchoolPeople);
+                    reservationSchoolPeopleMapper.insert(reservationSchoolPeople);
                 }
             }
             //已经不存在的id 删除
             if(reservationSchoolPeopleRemoveIds.size() > 0){
-                reservationSchoolReservationSchoolPeopleMapper.deleteBatchIds(reservationSchoolPeopleRemoveIds);
+                reservationSchoolPeopleMapper.deleteBatchIds(reservationSchoolPeopleRemoveIds);
             }
         }
         //********************************* ReservationSchoolPeople  增删改  结束 *******************************************/
@@ -80,8 +88,57 @@ public class ReservationSchoolServiceImpl extends MPJBaseServiceImpl<Reservation
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean delete(List<Long> ids) {
-        reservationSchoolReservationSchoolMapper.deleteBatchIds(ids);
-        reservationSchoolReservationSchoolPeopleMapper.delete(Wrappers.lambdaQuery(ReservationSchoolPeople.class).in(ReservationSchoolPeople::getReservationSchooId, ids));
+        reservationSchoolMapper.deleteBatchIds(ids);
+        reservationSchoolPeopleMapper.delete(Wrappers.lambdaQuery(ReservationSchoolPeople.class).in(ReservationSchoolPeople::getReservationSchooId, ids));
+
+        return true;
+    }
+
+    /**
+     * 预约免登记
+     * @param dataObj
+     * @return
+     */
+    @Override
+    public Boolean registration(ReservationSchool dataObj) {
+        String apiPath = "/api/visitor/v1/appointment/registration";
+        ApiUtil apiUtil = new ApiUtil();
+
+        //查询被访人id
+        HikvisionData hikvisionData = hikvisionDataMapper.selectOne(
+                new QueryWrapper<HikvisionData>().lambda()
+                        .eq(HikvisionData::getSourceId, dataObj.getRespondentUserId())
+                        .eq(HikvisionData::getTableName, "base_teacher")
+        );
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss+08:00");
+        List<ReservationSchoolPeople> peopleList = dataObj.getReservationSchoolPeopleList();
+        for (ReservationSchoolPeople people : peopleList) {
+            JsonObject paramJson = new JsonObject();
+            paramJson.addProperty("receptionistId", hikvisionData.getHikvisionId());
+
+            paramJson.addProperty("visitStartTime", sdf.format(dataObj.getStartTime()));
+            paramJson.addProperty("visitEndTime", sdf.format(dataObj.getEndTime()));
+
+            //查询来访人数
+            paramJson.addProperty("personNum", dataObj.getReservationSchoolPeopleList().size());
+            paramJson.addProperty("visitorInfo", dataObj.getReservationSchoolPeopleList().size());
+            paramJson.addProperty("personNum", dataObj.getReservationSchoolPeopleList().size());
+            JsonObject visitorInfo = new JsonObject();
+            visitorInfo.addProperty("visitorName", people.getName());
+            visitorInfo.addProperty("gender", GenderIntEnum.getValue(people.getGender()));
+            visitorInfo.addProperty("phoneNo", people.getPhone());
+            if("是".equals(people.getIsCar())){
+                visitorInfo.addProperty("plateNo", people.getPlateNumber());
+            }
+            visitorInfo.addProperty("certificateNo", people.getIdentityCard());
+            visitorInfo.addProperty("certificateType", "111");
+            paramJson.add("visitorInfo", visitorInfo);
+
+            String result = apiUtil.doPost(apiPath, paramJson.toString(), null);
+
+            people.setRegistrationResult(result);
+            reservationSchoolPeopleMapper.updateById(people);
+        }
 
         return true;
     }

+ 109 - 0
src/main/java/com/xjrsoft/module/student/entity/StudentLeave.java

@@ -0,0 +1,109 @@
+package com.xjrsoft.module.student.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.util.Date;
+
+
+/**
+* @title: 退学申请
+* @Author dzx
+* @Date: 2024年4月17日
+* @Version 1.0
+*/
+@Data
+@TableName("student_leave")
+@ApiModel(value = "student_leave", description = "学生请假")
+public class StudentLeave implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    @TableId
+    private Long id;
+    /**
+    * 创建人
+    */
+    @ApiModelProperty("创建人")
+    @TableField(fill = FieldFill.INSERT)
+    private Long createUserId;
+    /**
+    * 创建时间
+    */
+    @ApiModelProperty("创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createDate;
+    /**
+    * 修改人
+    */
+    @ApiModelProperty("修改人")
+    @TableField(fill = FieldFill.UPDATE)
+    private Long modifyUserId;
+    /**
+    * 修改时间
+    */
+    @ApiModelProperty("修改时间")
+    @TableField(fill = FieldFill.UPDATE)
+    private Date modifyDate;
+    /**
+    * 删除标记
+    */
+    @ApiModelProperty("删除标记")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleteMark;
+    /**
+    * 有效标志
+    */
+    @ApiModelProperty("有效标志")
+    @TableField(fill = FieldFill.INSERT)
+    private Integer enabledMark;
+
+    @ApiModelProperty("学生id")
+    private Long studentUserId;
+
+    @ApiModelProperty("班级id")
+    private Long classId;
+
+    @ApiModelProperty("开始时间")
+    private LocalDate startDate;
+
+    @ApiModelProperty("开始时间")
+    private LocalDate endDate;
+
+    @ApiModelProperty("请假原因")
+    private String reason;
+
+    @ApiModelProperty("班主任")
+    private Long teacherId;
+
+    @ApiModelProperty("附件id")
+    private Long folderId;
+
+    /**
+    * 状态(1:结束 0:未结束)
+    */
+    @ApiModelProperty("状态(1:结束 0:未结束)")
+    private Integer status;
+
+    @ApiModelProperty("时长(天)")
+    private Double dayDuration;
+
+    @ApiModelProperty("请假类型")
+    private String leaveType;
+
+    @ApiModelProperty("海康接口返回信息")
+    private String hikvisionResult;
+}

+ 16 - 0
src/main/java/com/xjrsoft/module/student/mapper/StudentLeaveMapper.java

@@ -0,0 +1,16 @@
+package com.xjrsoft.module.student.mapper;
+
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.student.entity.StudentDropOut;
+import com.xjrsoft.module.student.entity.StudentLeave;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @title: 退学申请
+* @Author dzx
+* @Date: 2024年4月17日
+* @Version 1.0
+*/
+@Mapper
+public interface StudentLeaveMapper extends MPJBaseMapper<StudentLeave> {
+}

+ 16 - 0
src/main/java/com/xjrsoft/module/student/service/IStudentLeaveService.java

@@ -0,0 +1,16 @@
+package com.xjrsoft.module.student.service;
+
+import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.student.entity.StudentLeave;
+
+/**
+* @title: 学生荣誉
+* @Author dzx
+* @Date: 2023-12-05
+* @Version 1.0
+*/
+
+public interface IStudentLeaveService extends MPJBaseService<StudentLeave> {
+
+    Boolean hikvisionLeave(Long id);
+}

+ 107 - 0
src/main/java/com/xjrsoft/module/student/service/impl/StudentLeaveServiceImpl.java

@@ -0,0 +1,107 @@
+package com.xjrsoft.module.student.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import com.xjrsoft.module.hikvision.entity.HikvisionData;
+import com.xjrsoft.module.hikvision.mapper.HikvisionDataMapper;
+import com.xjrsoft.module.hikvision.util.ApiUtil;
+import com.xjrsoft.module.student.entity.StudentLeave;
+import com.xjrsoft.module.student.mapper.StudentLeaveMapper;
+import com.xjrsoft.module.student.service.IStudentLeaveService;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.time.format.DateTimeFormatter;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @title: 学生请假
+ * @Author dzx
+ * @Date: 2024年5月21日
+ * @Version 1.0
+*/
+@Service
+@AllArgsConstructor
+public class StudentLeaveServiceImpl extends MPJBaseServiceImpl<StudentLeaveMapper, StudentLeave> implements IStudentLeaveService {
+
+    private final HikvisionDataMapper hikvisionDataMapper;
+
+    @Override
+    public Boolean hikvisionLeave(Long id) {
+        StudentLeave studentLeave = this.getById(id);
+
+        //查询学生在海康的id
+        HikvisionData hikvisionData = hikvisionDataMapper.selectOne(
+            new QueryWrapper<HikvisionData>().lambda()
+            .eq(HikvisionData::getSourceId, studentLeave.getStudentUserId())
+            .eq(HikvisionData::getTableName, "base_student")
+        );
+        ApiUtil apiUtil = new ApiUtil();
+        String apiPath = "/api/acps/v1/auth_config/add";
+
+        String outputFormat = "yyyy-MM-dd'T'HH:mm:ss+08:00";
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(outputFormat);
+        JsonObject paramJson = new JsonObject();
+
+        paramJson.addProperty("startTime", studentLeave.getStartDate().atStartOfDay().format(formatter));
+        paramJson.addProperty("endTime", studentLeave.getEndDate().atTime(23,59,59).format(formatter));
+
+        //组装人员数据
+        JsonArray personDatas = new JsonArray();
+        JsonObject personData = new JsonObject();
+        personData.addProperty("personDataType", "person");
+
+        JsonArray indexCodes = new JsonArray();
+        indexCodes.add(hikvisionData.getHikvisionId());
+        personData.add("indexCodes", indexCodes);
+
+        personDatas.add(personData);
+        paramJson.add("personDatas", personDatas);
+
+        JsonArray resourceInfos = selectResource(apiUtil);
+        paramJson.add("resourceInfos", resourceInfos);
+
+        Map<String, String> header = new HashMap<>();
+        header.put("tagId", "studentleave");
+        //调用接口获取到返回内容,并将其存到数据库中
+        String result = apiUtil.doPost(apiPath, paramJson.toString(), null, header);
+        studentLeave.setHikvisionResult(result);
+        this.updateById(studentLeave);
+        return true;
+    }
+
+    JsonArray selectResource(ApiUtil apiUtil){
+        String apiPath = "/api/irds/v2/resource/resourcesByParams";
+        JsonObject jsonObject = new JsonObject();
+        jsonObject.addProperty("pageNo", 1);
+        jsonObject.addProperty("pageSize", 500);
+        jsonObject.addProperty("resourceType", "door");
+
+
+        String result = apiUtil.doPost(apiPath, jsonObject.toString(), null, null);
+        JsonParser parser = new JsonParser();
+        JsonObject resultJson = parser.parse(result).getAsJsonObject();
+        JsonArray resourceInfos = new JsonArray();
+
+        if("0".equals(resultJson.get("code").getAsString()) && "success".equals(resultJson.get("msg").getAsString())){
+            JsonArray list = resultJson.get("data").getAsJsonObject().get("list").getAsJsonArray();
+            for (JsonElement jsonElement : list) {
+                JsonObject listOne = jsonElement.getAsJsonObject();
+                JsonObject resourceInfo = new JsonObject();
+                resourceInfo.add("resourceIndexCode", listOne.get("indexCode"));
+                resourceInfo.add("resourceType", listOne.get("resourceType"));
+                JsonArray channelNos = new JsonArray();
+                channelNos.add(listOne.get("channelNo"));
+                resourceInfo.add("channelNos", channelNos);
+                resourceInfos.add(resourceInfo);
+            }
+        }
+
+        return resourceInfos;
+    }
+}

+ 2 - 0
src/main/java/com/xjrsoft/module/teacher/mapper/FaceImportMapper.java

@@ -11,5 +11,7 @@ public interface FaceImportMapper {
 
     String GetStudentUserIdById(@Param("id") Long id);
     String GetStudentHikvisionImgById(@Param("id") Long id);
+
+    Long GetHikvisonPersonId(@Param("id") Long id);
 }
 

+ 10 - 0
src/main/resources/mapper/teacher/TeacherFaceImportMapper.xml

@@ -40,4 +40,14 @@
         </if>
         and t.status = 1
     </select>
+
+    <select id="GetHikvisonPersonId" parameterType="long" resultType="java.lang.Long">
+        select t.hikvision_id
+        from hikvision_data t
+        left join car_message_apply t1 on t1.user_id = t.source_id
+        <if test="id != null">
+            where t1.id = #{id}
+        </if>
+        and t1.status = 1
+    </select>
 </mapper>

+ 35 - 8
src/test/java/com/xjrsoft/module/job/HikvisionBaseDataTaskTest.java

@@ -14,9 +14,11 @@ import com.xjrsoft.module.hikvision.util.DataUtil;
 import com.xjrsoft.module.organization.entity.Department;
 import com.xjrsoft.module.schedule.entity.JianyueData;
 import com.xjrsoft.module.teacher.entity.XjrUser;
+import com.xjrsoft.module.teacher.mapper.FaceImportMapper;
 import lombok.var;
 import org.junit.jupiter.api.Test;
 import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
@@ -36,6 +38,8 @@ import java.util.Set;
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = XjrSoftApplication.class)
 class HikvisionBaseDataTaskTest {
+    @Autowired
+    private FaceImportMapper faceImportMapper;
 
     @Test
     void test() throws Exception {
@@ -71,20 +75,43 @@ class HikvisionBaseDataTaskTest {
 //        tableName = "base_teacher";
 //        dataUtil.insertTeacher(use, tableName, dataMap.get(tableName), department);
 //
-//        //推送车辆
-//        String carTableName = "car_message_apply";
-//        dataUtil.insertCar(use, carTableName, null);
-//
+        //推送车辆
+
+        String carTableName = "car_message_apply";
+        Map<String, String> baseClass = dataMap.get(carTableName);
+        dataUtil.insertCar(use, carTableName,baseClass, faceImportMapper);
+
 //        tableName = "base_class";
 //        Map<String, String> baseClass = dataMap.get(tableName);
 //        Map<String, String> classes = dataUtil.insertClass(use, tableName, baseClass);
 
 
-        tableName = "base_student";
-        Map<String, String> baseStudent = dataMap.get(tableName);
-        Map<String, String> student = insertStudentOne(use, tableName, baseStudent);
+//        tableName = "base_student";
+//        Map<String, String> baseStudent = dataMap.get(tableName);
+//        Map<String, String> student = dataUtil.insertStudentOne(use, tableName, baseStudent);
 
 //        selectOrg(use, "base_class");
+
+        //查询车辆
+//        String carTableName = "car_message_apply";
+//        selectCar(use, carTableName);
+
+
+//        selecAllPersonById(use);
+        selectResource(use);
+    }
+
+    public static void selectCar(Db db, String tableName) throws SQLException {
+        String sql = "SELECT * FROM " + tableName + " WHERE delete_mark = 0";
+        List<Department> dataList = db.query(sql, Department.class);
+        String apiPath = "/api/resource/v2/vehicle/advance/vehicleList";
+        JsonObject jsonObject = new JsonObject();
+        jsonObject.addProperty("pageNo", 1);
+        jsonObject.addProperty("pageSize", 500);
+        ApiUtil apiUtil = new ApiUtil();
+        String result = apiUtil.doPost(apiPath, jsonObject.toString(), null);
+        System.out.println("-----------------------------------------------------");
+        System.out.println(result);
     }
 
     public static void insertRecord(Db db, String tableName, Map<?, String> idsMap) throws SQLException {
@@ -222,7 +249,7 @@ class HikvisionBaseDataTaskTest {
         JsonObject jsonObject = new JsonObject();
         jsonObject.addProperty("pageNo", 1);
         jsonObject.addProperty("pageSize", 500);
-        jsonObject.addProperty("personIds", "b9d90bdd018447f2951dadfaffd1e411");
+        jsonObject.addProperty("personIds", "654321987655613");
 
 
         ApiUtil apiUtil = new ApiUtil();

+ 41 - 0
src/test/java/com/xjrsoft/module/liteflow/node/ReservationSchoolNodeTest.java

@@ -0,0 +1,41 @@
+package com.xjrsoft.module.liteflow.node;
+
+import cn.hutool.core.convert.Convert;
+import com.xjrsoft.XjrSoftApplication;
+import com.xjrsoft.module.personnel.entity.ReservationSchool;
+import com.xjrsoft.module.personnel.service.IReservationSchoolService;
+import org.junit.jupiter.api.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ * @author dzx
+ * @date 2024/5/20
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = XjrSoftApplication.class)
+class ReservationSchoolNodeTest {
+    @Autowired
+    private IReservationSchoolService reservationSchoolService;
+    @Test
+    public void process() throws Exception {
+        // 获取表单中数据编号
+        Long formId = 1792446887763165184L;
+        if (formId != null) {
+            // 数据处理
+            ReservationSchool dataObj = reservationSchoolService.getByIdDeep(formId);
+            dataObj.setStatus(1);
+            dataObj.setExamStatus(1);
+            reservationSchoolService.updateById(dataObj);
+
+            reservationSchoolService.registration(dataObj);
+        }
+    }
+
+}

+ 35 - 0
src/test/java/com/xjrsoft/module/liteflow/node/StudentLeaveNodeTest.java

@@ -0,0 +1,35 @@
+package com.xjrsoft.module.liteflow.node;
+
+import cn.hutool.core.convert.Convert;
+import com.xjrsoft.XjrSoftApplication;
+import com.xjrsoft.module.student.service.IStudentLeaveService;
+import org.junit.jupiter.api.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ * @author dzx
+ * @date 2024/5/21
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = XjrSoftApplication.class)
+class StudentLeaveNodeTest {
+    @Autowired
+    private IStudentLeaveService studentLeaveService;
+
+    @Test
+    public void process() throws Exception {
+        // 获取表单中数据编号
+        Long formId = 1779431620300816384L;
+        if (formId != null) {
+            // 数据处理
+            studentLeaveService.hikvisionLeave(formId);
+        }
+    }
+}

+ 34 - 0
src/test/java/com/xjrsoft/xjrsoftboot/FreeMarkerGeneratorTest.java

@@ -3129,4 +3129,38 @@ public class FreeMarkerGeneratorTest {
 
         apiGeneratorService.generateCodes(params);
     }
+
+    @Test
+    public void gcAttendanceMessageSet() throws IOException {
+        List<TableConfig> tableConfigs = new ArrayList<>();
+        TableConfig mainTable = new TableConfig();
+        mainTable.setTableName("attendance_message_set");//init_sql中的表名
+        mainTable.setIsMain(true);//是否是主表,一般默认为true
+        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+        tableConfigs.add(mainTable);
+
+        mainTable = new TableConfig();
+        mainTable.setTableName("attendance_message_user_relation");//init_sql中的表名
+        mainTable.setIsMain(false);//是否是主表,一般默认为true
+        mainTable.setPkField(GlobalConstant.DEFAULT_PK);//设置主键
+        mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);//设置主键类型
+        mainTable.setRelationField("attendance_message_set_id");//设置外键
+        mainTable.setRelationTableField(GlobalConstant.DEFAULT_PK);//设置外键
+        tableConfigs.add(mainTable);
+
+        ApiGenerateCodesDto params = new ApiGenerateCodesDto();
+        params.setAuthor("dzx");//作者名称
+        params.setPackageName("attendance");//包名
+        params.setTableConfigs(tableConfigs);
+        params.setPage(true);//是否生成分页接口
+        params.setImport(false);//是否生成导入接口
+        params.setExport(false);//是否生成导出接口
+        params.setOutMainDir(true);//是否生成在主目录,前期测试可设置成false
+        params.setDs(ds);
+
+        IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
+
+        apiGeneratorService.generateCodes(params);
+    }
 }