Przeglądaj źródła

Merge remote-tracking branch 'origin/dev' into dev

dzx 1 rok temu
rodzic
commit
6aca55c787

+ 1 - 1
src/main/java/com/xjrsoft/module/base/service/impl/BaseClassServiceImpl.java

@@ -39,7 +39,7 @@ public class BaseClassServiceImpl extends MPJBaseServiceImpl<BaseClassMapper, Ba
      */
     public List<UserStudentVo> getStudents(long id) {
         List<Long> studentIds = userStudentService.list(Wrappers.lambdaQuery(UserStudent.class)
-                        .eq(UserStudent::getUserId, id))
+                        .eq(UserStudent::getUserId, id).eq(UserStudent::getStatus, 1))
                 .stream().map(UserStudent::getStudentId).collect(Collectors.toList());
         List<UserStudentVo> list = null;
         if (studentIds.size() > 0) {

+ 5 - 4
src/main/java/com/xjrsoft/module/hikvision/controller/EventController.java

@@ -147,8 +147,9 @@ public class EventController {
         JsonObject paramJson = new JsonObject();
 //*******手动更改****************************************************
 //        eventList.add(196893); //人脸匹配成功
-        eventList.add(771760131); //入场放行事件
-        eventList.add(771760134); //出场放行事件
+//        eventList.add(197151); //人脸匹配失败
+        eventList.add(771760130); //入场放行事件
+        eventList.add(771760133); //出场放行事件
         paramJson.addProperty("eventDest", hikvisionConfig.getCarUrl()); //要修改第二个参数
 //******************************************************************
         paramJson.add("eventTypes", eventList);
@@ -181,8 +182,8 @@ public class EventController {
         JsonArray eventList = new JsonArray();
 //*******手动更改****************************************************
         eventList.add(196893);
-        eventList.add(771760131); //正常过车
-        eventList.add(771760134);
+//        eventList.add(771760131); //正常过车
+//        eventList.add(771760134);
 //******************************************************************
         JsonObject paramJson = new JsonObject();
         paramJson.add("eventTypes", eventList);

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

@@ -67,7 +67,7 @@ public class ApiUtil {
     }
 
     public static String GetRedirectURL(String uri){
-        if (!uri.isEmpty())
+        if (uri != null && !uri.isEmpty())
             return "https://" + ApiUtil.host + "/" + uri;
         else
             return "";

+ 10 - 9
src/main/java/com/xjrsoft/module/hikvision/util/OutInRecordUtil.java

@@ -40,10 +40,10 @@ public class OutInRecordUtil {
     }
 
 
-    public void visitInsertRecord(Db db, Long reservation_school_people_id, String recordTime,String facePhoto, int status) throws SQLException {
-        String sql = "INSERT INTO visitor_out_in_record(create_date, reservation_school_people_id, record_time, face_photo, status,delete_mark,enabled_mark) " +
+    public void visitInsertRecord(Db db, Long reservation_school_people_id, String recordTime,String facePhoto, int status, String eventId) throws SQLException {
+        String sql = "INSERT INTO visitor_out_in_record(create_date, reservation_school_people_id, record_time, face_photo, event_id, status,delete_mark,enabled_mark) " +
                 "VALUES(now(), '"  + reservation_school_people_id + "', '" +
-                 recordTime + "', '" + facePhoto + "', '" + status +  "',0,1)";
+                 recordTime + "', '" + facePhoto + "', '" + eventId + "', '" + status +  "',0,1)";
         db.execute(sql);
     }
 
@@ -295,16 +295,16 @@ public class OutInRecordUtil {
     }
 
     private void InsertVisitRecords(Db use, JsonArray eventsResponse, JsonArray doorEventsResponse,FaceImportMapper faceImportMapper) throws SQLException, ParseException {
-        List<Long> visit_id_list = faceImportMapper.GetReservationSchoolIdList();
 
         for (JsonElement element : eventsResponse) {
+            List<String> visit_id_list = faceImportMapper.GetReservationSchoolIdList();
             JsonObject item = element.getAsJsonObject();
 
-            String picUri = item.get("visitorPhotoUri").isJsonNull() ? null : ApiUtil.GetRedirectURL(item.get("visitorPhotoUri").getAsString());
+            String picUri = item.get("visitorPhotoUri").isJsonNull() ? "" : ApiUtil.GetRedirectURL(item.get("visitorPhotoUri").getAsString());
             String orderId = item.get("orderId").isJsonNull() ? null : item.get("orderId").getAsString();
             String eventTime = item.get("eventTime").isJsonNull() ? null : ChangeTime(item.get("eventTime").getAsString());
-            //todo: reservationSchoolId
-//            Long reservationSchoolId = faceImportMapper.GetReservationSchoolId(orderId) == null ? 1 : faceImportMapper.GetReservationSchoolId(orderId);
+            String reservationSchoolId = faceImportMapper.GetReservationSchoolId(orderId) == null ? "0" : String.valueOf(faceImportMapper.GetReservationSchoolId(orderId));
+            String eventId = item.get("eventId").isJsonNull() ? null : item.get("eventId").getAsString();
 
             int status = -1;
             for (JsonElement e : doorEventsResponse){
@@ -315,8 +315,9 @@ public class OutInRecordUtil {
                 }
             }
 
-            if (visit_id_list.contains(1)) continue;
-            visitInsertRecord(use, Long.parseLong("123"), eventTime, picUri, status);
+            if (visit_id_list.contains(eventId)) continue;
+
+            visitInsertRecord(use, Long.parseLong(reservationSchoolId), eventTime, picUri, status, eventId);
         }
 
     }

+ 5 - 3
src/main/java/com/xjrsoft/module/job/InsertOutInRecordTask.java

@@ -25,7 +25,7 @@ public class InsertOutInRecordTask {
 
     OutInRecordUtil out_in_recordUtil = new OutInRecordUtil();
 
-    @Scheduled(cron = "0 */15 * * * ?")
+    @Scheduled(cron = "*/15 * * * * ?")
     public void RefreshConnectionPool() {
         String active = SpringUtil.getActiveProfile();
         if(!"prod".equals(active)){
@@ -38,9 +38,11 @@ public class InsertOutInRecordTask {
             Db use = Db.use(datasource);
 
             //教师&学生拉取数据
-            out_in_recordUtil.GetTeacherAndStudentRecords(use, faceImportMapper);
+//            out_in_recordUtil.GetTeacherAndStudentRecords(use, faceImportMapper);
             //拉取车辆数据
-            out_in_recordUtil.GetVehicleRecord(use, faceImportMapper);
+//            out_in_recordUtil.GetVehicleRecord(use, faceImportMapper);
+            //拉取访客数据
+            out_in_recordUtil.GetVisitRecord(use, faceImportMapper);
 
             log.info("数据拉取完成");
         } catch (Exception e) {

+ 48 - 7
src/main/java/com/xjrsoft/module/organization/controller/UserController.java

@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fasterxml.jackson.core.type.TypeReference;
+import com.github.yulichang.toolkit.MPJWrappers;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.constant.GlobalConstant;
 import com.xjrsoft.common.enums.DeleteMark;
@@ -29,6 +30,7 @@ import com.xjrsoft.common.utils.RedisUtil;
 import com.xjrsoft.common.utils.TreeUtil;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.config.CommonPropertiesConfig;
+import com.xjrsoft.module.attendance.entity.StudentAttendanceRecord;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.entity.BaseGrade;
 import com.xjrsoft.module.base.service.IBaseClassService;
@@ -46,13 +48,7 @@ import com.xjrsoft.module.organization.dto.UserPageDto;
 import com.xjrsoft.module.organization.dto.UserStudentAddDto;
 import com.xjrsoft.module.organization.dto.UserStudentBindDto;
 import com.xjrsoft.module.organization.dto.UserStudentDeleteDto;
-import com.xjrsoft.module.organization.entity.Department;
-import com.xjrsoft.module.organization.entity.Post;
-import com.xjrsoft.module.organization.entity.Role;
-import com.xjrsoft.module.organization.entity.User;
-import com.xjrsoft.module.organization.entity.UserDeptRelation;
-import com.xjrsoft.module.organization.entity.UserPostRelation;
-import com.xjrsoft.module.organization.entity.UserRoleRelation;
+import com.xjrsoft.module.organization.entity.*;
 import com.xjrsoft.module.organization.service.IDepartmentService;
 import com.xjrsoft.module.organization.service.IPostService;
 import com.xjrsoft.module.organization.service.IRoleService;
@@ -65,10 +61,13 @@ import com.xjrsoft.module.organization.utils.OrganizationUtil;
 import com.xjrsoft.module.organization.vo.*;
 import com.xjrsoft.module.oss.factory.OssFactory;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
+import com.xjrsoft.module.student.entity.BaseStudentUser;
+import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
 import com.xjrsoft.module.system.entity.DictionaryDetail;
 import com.xjrsoft.module.system.entity.File;
 import com.xjrsoft.module.system.service.IFileService;
 import com.xjrsoft.module.teacher.entity.BaseTeacher;
+import com.xjrsoft.module.teacher.entity.XjrUser;
 import com.xjrsoft.module.workflow.constant.WorkflowConstant;
 import com.xjrsoft.module.workflow.entity.WorkflowExtra;
 import com.xjrsoft.module.workflow.mapper.WorkflowExtraMapper;
@@ -140,6 +139,8 @@ public class UserController {
 
     private final HistoryService historyService;
 
+    private final IBaseStudentSchoolRollService baseStudentSchoolRollService;
+
 
     @GetMapping(value = "/list")
     @ApiOperation(value = "用户列表(不分页)")
@@ -687,6 +688,26 @@ public class UserController {
         return R.ok(userStudentService.add(userStudentAddDto));
     }
 
+    @GetMapping(value = "/validate-student")
+    public  RT<UserStudentInfoVo> getValidateStudent(UserStudentBindDto dto) {
+
+        UserStudentInfoVo userStudentInfoVo = baseStudentSchoolRollService.selectJoinOne(UserStudentInfoVo.class,
+                MPJWrappers.<BaseStudentSchoolRoll>lambdaJoin()
+                        .innerJoin(User.class, User::getId, BaseStudentSchoolRoll::getUserId)
+                        .leftJoin(BaseClass.class,BaseClass::getId,BaseStudentSchoolRoll::getClassId)
+                        .eq(User::getName, dto.getName())
+                        .eq(User::getCredentialNumber, dto.getIdCard())
+                        .select(User::getId, User::getName, User::getMobile, User::getCredentialNumber)
+                        .select(BaseClass::getTeacherId)
+
+        );
+        if (userStudentInfoVo == null) {
+            return RT.error("学生不存在!");
+        }
+
+        return RT.ok(userStudentInfoVo);
+    }
+
     @DeleteMapping("/unbind-student")
     @ApiOperation(value = "解绑学生")
     public R unBindStudent(@Valid @RequestBody UserStudentDeleteDto dto) {
@@ -699,6 +720,26 @@ public class UserController {
         return R.ok(baseClassService.getStudents(id));
     }
 
+    @GetMapping("/user-student")
+    @ApiOperation(value = "获取绑定学生")
+    public RT<List<UserStudentVo>> getBindStudent(@Valid @RequestParam Long id) {
+
+        List<UserStudentVo> userStudentVoList = userStudentService.selectJoinList(UserStudentVo.class,
+                MPJWrappers.<UserStudent>lambdaJoin()
+                        .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, UserStudent::getStudentId)
+                        .innerJoin(BaseStudentUser.class, BaseStudentUser::getId, UserStudent::getStudentId)
+                        .leftJoin(BaseClass.class, BaseClass::getId, BaseStudentSchoolRoll::getClassId)
+                        .select(BaseStudentSchoolRoll::getClassId)
+                        .select(UserStudent::getStudentId,UserStudent::getStatus)
+                        .selectAs(BaseClass::getName, UserStudentVo::getClassName)
+                        .selectAs(BaseStudentUser::getName, UserStudentVo::getStudentName)
+                        .selectAs(BaseStudentUser::getAvatar, UserStudentVo::getAvatar)
+                        .eq(UserStudent::getUserId, id)
+
+        );
+        return RT.ok(userStudentVoList);
+    }
+
     @PostMapping("/upload-sign")
     @ApiOperation(value = "上传签名")
     public RT<Boolean> uploadSign(@Valid @RequestBody UploadSignDto dto) {

+ 3 - 0
src/main/java/com/xjrsoft/module/organization/entity/UserStudent.java

@@ -24,6 +24,9 @@ public class UserStudent implements Serializable {
     @ApiModelProperty("学生ID(xjr_user)")
     private Long studentId;
 
+    @ApiModelProperty("流程状态(0:审核中,1:通过,2:拒绝)")
+    private Integer status;
+
     @TableField(fill = FieldFill.INSERT)
     private LocalDateTime createDate;
 

+ 36 - 0
src/main/java/com/xjrsoft/module/organization/vo/UserStudentInfoVo.java

@@ -0,0 +1,36 @@
+package com.xjrsoft.module.organization.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class UserStudentInfoVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 主键
+     */
+    @ApiModelProperty("主键")
+    public Long id;
+    /**
+     * 姓名
+     */
+    private String name;
+    /**
+     * 手机号
+     */
+    @ApiModelProperty("手机号")
+    private String mobile;
+    /**
+     * 身份证
+     */
+    @ApiModelProperty("身份证")
+    private String credentialNumber;
+    /**
+     * 班主任
+     */
+    @ApiModelProperty("班主任")
+    public Long teacherId;
+
+}

+ 3 - 0
src/main/java/com/xjrsoft/module/organization/vo/UserStudentVo.java

@@ -1,6 +1,7 @@
 package com.xjrsoft.module.organization.vo;
 
 import com.xjrsoft.module.organization.dto.UserStudentUpdateDto;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 @Data
@@ -9,4 +10,6 @@ public class UserStudentVo extends UserStudentUpdateDto {
     private String className;
     private String avatar;
     private Long classId;
+    @ApiModelProperty("流程状态(0:审核中,1:通过,2:拒绝)")
+    private Integer status;
 }

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

@@ -23,7 +23,7 @@ public interface FaceImportMapper {
     List<String> GetStudentUrlList();
     List<String> GetTeacherUrlList();
 
-    List<Long> GetReservationSchoolIdList();
+    List<String> GetReservationSchoolIdList();
     Long GetReservationSchoolId(@Param("id") String id);
 
     String GetCarMessageApplyIdByCarNumber(@Param("id") String id);

+ 1 - 1
src/main/resources/application-dev.yml

@@ -146,7 +146,7 @@ xjrsoft:
     appKey: 21350095
     appSecret: LXi9rE2fm8IfRoLnTA2G
     people-url: http://ff.cf.yingcaibx.com/event/receivePeople
-    car-url: http://ff.cf.yingcaibx.com/event/receive
+    car-url: http://ff.cf.yingcaibx.com/event/receiveCar
   keycloak:
     url: http://192.168.0.221:12829/auth/
     realm: test

+ 1 - 1
src/main/resources/application-pre.yml

@@ -130,7 +130,7 @@ xjrsoft:
     appKey: 21350095
     appSecret: LXi9rE2fm8IfRoLnTA2G
     people-url: http://ff.cf.yingcaibx.com/event/receivePeople
-    car-url: http://ff.cf.yingcaibx.com/event/receive
+    car-url: http://ff.cf.yingcaibx.com/event/receiveCar
   keycloak:
     url: http://192.168.0.221:12829/auth/
     realm: test

+ 3 - 3
src/main/resources/mapper/teacher/TeacherFaceImportMapper.xml

@@ -94,8 +94,8 @@
         where t.delete_mark = 0
     </select>
 
-    <select id="GetReservationSchoolIdList" resultType="java.lang.Long">
-        SELECT reservation_school_people_id
+    <select id="GetReservationSchoolIdList" resultType="java.lang.String">
+        SELECT event_id
         FROM visitor_out_in_record
         where delete_mark = 0
     </select>
@@ -105,7 +105,7 @@
         FROM reservation_school_people
         where delete_mark = 0
         <if test="id != null">
-            and registration_result::text LIKE '%"orderId":"' || #{id} || '"%'
+            and JSON_VALUE(registration_result, '$.data.orderId') = #{id};
         </if>
     </select>
 

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

@@ -104,7 +104,7 @@ class HikvisionBaseDataTaskTest {
 //        String carTableName = "car_message_apply";
 //        selectCar(use, carTableName);
 
-        outInRecordUtil.GetTeacherAndStudentRecords(use,faceImportMapper);
+        outInRecordUtil.GetVisitRecord(use,faceImportMapper);
 ////        selecAllPersonById(use);
 //        selectResource(use);
     }