Просмотр исходного кода

Merge branch 'dev' of ssh://10.10.100.21/source/smartschool-platform into dev

guq 7 лет назад
Родитель
Сommit
7e71d7c10f

+ 2 - 0
applications/device/device-client/src/main/java/com/usoftchina/smartschool/device/client/service/AccessControlService.java

@@ -100,6 +100,8 @@ public class AccessControlService {
      * @param info
      */
     public void saveRecord(AccessControlInfo info) {
+        //去除cardNo末尾中的\u0000...\u0000
+        info.setCardNo(info.getCardNo().trim());
         ResponseEntity<Result> response = restTemplate.postForEntity(
                 deviceServerProperties.getAccessControlEvent(), info, Result.class);
         if (response.getStatusCode() == HttpStatus.OK) {

+ 2 - 2
applications/device/device-client/src/main/resources/application.yml

@@ -4,10 +4,10 @@ device:
     connect-time: 10000
   server:
   # 门禁事件的服务端接口
-    accessControlEvent: https://school-api.ydyhz.com/api/device/accesscontrol/event
+    accessControlEvent: https://school-api.ubtob.com/api/device/accesscontrol/event
   # IC卡传输的服务端接口
   icCard:
-    icCardUrl: https://school-api.ydyhz.com/api/device/iccard/consume/record
+    icCardUrl: https://school-api.ubtob.com/api/device/iccard/consume/record
 server:
   tomcat:
     uri-encoding: UTF-8

+ 81 - 55
applications/device/device-sdk-dahua/src/main/java/com/usoftchina/smartschool/device/dahua/lib/DahuaLibrary.java

@@ -7,6 +7,7 @@ import com.sun.jna.Structure;
 import com.sun.jna.ptr.IntByReference;
 import com.sun.jna.win32.StdCallLibrary;
 
+import java.nio.charset.Charset;
 import java.time.LocalDateTime;
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
@@ -20,6 +21,10 @@ import java.util.Date;
  * @date 2019/3/7
  */
 public interface DahuaLibrary extends Library {
+    /**
+     * 默认编码
+     */
+    Charset DEFAULT_CHARSET = Charset.forName("GBK");
     /**
      * 通用字符串长度4
      */
@@ -283,66 +288,70 @@ public interface DahuaLibrary extends Library {
     /**
      * 登陆网络环境设置
      */
-    @Structure.FieldOrder({"bReserved", "byNetType", "byPlaybackBufSize", "byReserved1", "nConnectBufSize",
-            "nConnectTime", "nConnectTryNum", "nGetConnInfoTime", "nGetDevInfoTime", "nPicBufSize", "nSearchRecordTime",
-            "nWaittime", "nsubConnectSpaceTime", "nsubDisconnetTime"})
+    @Structure.FieldOrder({"nWaittime", "nConnectTime", "nConnectTryNum", "nSubConnectSpaceTime", "nGetDevInfoTime",
+            "nConnectBufSize", "nGetConnInfoTime", "nSearchRecordTime", "nsubDisconnetTime", "byNetType",
+            "byPlaybackBufSize", "bDetectDisconnTime", "bKeepLifeInterval", "nPicBufSize", "bReserved"})
     class NET_PARAM extends Structure {
         /**
-         * 保留字段
+         * 等待超时时间(毫秒为单位),为0默认5000ms
          */
-        public byte[] bReserved = new byte[4];
+        public int nWaittime;
         /**
-         * 网络类型,0-LAN, 1-WAN
+         * 连接超时时间(毫秒为单位),为0默认1500ms
          */
-        public byte byNetType;
+        public int nConnectTime;
         /**
-         * 回放数据接收缓冲大小(M为单位),为0默认为4M
+         * 连接尝试次数,为0默认1次
          */
-        public byte byPlaybackBufSize;
+        public int nConnectTryNum;
         /**
-         * 保留字段
+         * 子连接之间的等待时间(毫秒为单位),为0默认10ms
+         */
+        public int nSubConnectSpaceTime;
+        /**
+         * 获取设备信息超时时间,为0默认1000ms
          */
-        public byte[] byReserved1 = new byte[2];
+        public int nGetDevInfoTime;
         /**
          * 每个连接接收数据缓冲大小(字节为单位),为0默认250*1024
          */
         public int nConnectBufSize;
         /**
-         * 连接超时时间(毫秒为单位),为0默认1500ms
+         * 获取子连接信息超时时间(毫秒为单位),为0默认1000ms
          */
-        public int nConnectTime;
+        public int nGetConnInfoTime;
         /**
-         * 连接尝试次数,为0默认1次
+         * 按时间查询录像文件的超时时间(毫秒为单位),为0默认为3000ms
          */
-        public int nConnectTryNum;
+        public int nSearchRecordTime;
         /**
-         * 获取子连接信息超时时间(毫秒为单位),为0默认1000ms
+         * 检测子链接断线等待时间(毫秒为单位),为0默认为60000ms
          */
-        public int nGetConnInfoTime;
+        public int nsubDisconnetTime;
         /**
-         * 获取设备信息超时时间,为0默认1000ms
+         * 网络类型,0-LAN, 1-WAN
          */
-        public int nGetDevInfoTime;
+        public byte byNetType;
         /**
-         * 实时图片接收缓冲大小(字节为单位),为0默认为2*1024*1024
+         * 回放数据接收缓冲大小(M为单位),为0默认为4M
          */
-        public int nPicBufSize;
+        public byte byPlaybackBufSize;
         /**
-         * 按时间查询录像文件的超时时间(毫秒为单位),为0默认为3000ms
+         * 心跳检测断线时间(单位为秒),为0默认为60s,最小时间为2s
          */
-        public int nSearchRecordTime;
+        public byte bDetectDisconnTime;
         /**
-         * 等待超时时间(毫秒为单位),为0默认5000ms
+         * 心跳包发送间隔(单位为秒),为0默认为10s,最小间隔为2s
          */
-        public int nWaittime;
+        public byte bKeepLifeInterval;
         /**
-         * 子连接之间的等待时间(毫秒为单位),为0默认10ms
+         * 实时图片接收缓冲大小(字节为单位),为0默认为2*1024*1024
          */
-        public int nsubConnectSpaceTime;
+        public int nPicBufSize;
         /**
-         * 检测子链接断线等待时间(毫秒为单位),为0默认为60000ms
+         * 保留字段
          */
-        public int nsubDisconnetTime;
+        public byte[] bReserved = new byte[4];
     }
 
     /**
@@ -704,25 +713,13 @@ public interface DahuaLibrary extends Library {
     /**
      * 设备信息
      */
-    @Structure.FieldOrder({"Reserved", "bReserved", "byLeftLogTimes", "byLimitLoginTime", "nAlarmInPortNum",
-            "nAlarmOutPortNum", "nChanNum", "nDVRType", "nDiskNum", "nLockLeftTime", "sSerialNumber"})
+    @Structure.FieldOrder({"sSerialNumber", "nAlarmInPortNum", "nAlarmOutPortNum", "nDiskNum", "nDVRType",
+            "nChanNum", "byLimitLoginTime", "byLeftLogTimes", "bReserved", "nLockLeftTime", "Reserved"})
     class NET_DEVICEINFO_Ex extends Structure {
         /**
-         * 保留
-         */
-        public byte[] Reserved = new byte[24];
-        /**
-         * 保留字节
-         */
-        public byte[] bReserved = new byte[2];
-        /**
-         * 当登陆失败原因为密码错误时,通过此参数通知用户,剩余登陆次数,为0时表示此参数无效
-         */
-        public byte byLeftLogTimes;
-        /**
-         * 在线超时时间,为0表示不限制登陆,非0表示限制的分钟数
+         * 序列号
          */
-        public byte byLimitLoginTime;
+        public byte[] sSerialNumber = new byte[DH_SERIALNO_LEN];
         /**
          * DVR报警输入个数
          */
@@ -732,9 +729,9 @@ public interface DahuaLibrary extends Library {
          */
         public int nAlarmOutPortNum;
         /**
-         * DVR通道个数
+         * DVR硬盘个数
          */
-        public int nChanNum;
+        public int nDiskNum;
         /**
          * DVR类型
          *
@@ -742,17 +739,46 @@ public interface DahuaLibrary extends Library {
          */
         public int nDVRType;
         /**
-         * DVR硬盘个数
+         * DVR通道个数
          */
-        public int nDiskNum;
+        public int nChanNum;
+        /**
+         * 在线超时时间,为0表示不限制登陆,非0表示限制的分钟数
+         */
+        public byte byLimitLoginTime;
+        /**
+         * 当登陆失败原因为密码错误时,通过此参数通知用户,剩余登陆次数,为0时表示此参数无效
+         */
+        public byte byLeftLogTimes;
+        /**
+         * 保留字节
+         */
+        public byte[] bReserved = new byte[2];
         /**
          * 当登陆失败,用户解锁剩余时间(秒数), -1表示设备未设置该参数
          */
         public int nLockLeftTime;
         /**
-         * 序列号
+         * 保留
          */
-        public byte[] sSerialNumber = new byte[DH_SERIALNO_LEN];
+        public byte[] Reserved = new byte[24];
+
+        @Override
+        public String toString() {
+            return "NET_DEVICEINFO_Ex{" +
+                    "sSerialNumber=" + new String(sSerialNumber) +
+                    ", nAlarmInPortNum=" + nAlarmInPortNum +
+                    ", nAlarmOutPortNum=" + nAlarmOutPortNum +
+                    ", nDiskNum=" + nDiskNum +
+                    ", nDVRType=" + nDVRType +
+                    ", nChanNum=" + nChanNum +
+                    ", byLimitLoginTime=" + (byLimitLoginTime & 0xff) +
+                    ", byLeftLogTimes=" + (byLeftLogTimes & 0xff) +
+                    ", bReserved=" + new String(bReserved) +
+                    ", nLockLeftTime=" + nLockLeftTime +
+                    ", Reserved=" + Arrays.toString(Reserved) +
+                    '}';
+        }
     }
 
     /**
@@ -1464,8 +1490,8 @@ public interface DahuaLibrary extends Library {
                     ", emAttendanceState=" + emAttendanceState +
                     ", szClassNumber=" + new String(szClassNumber) +
                     ", szPhoneNumber=" + new String(szPhoneNumber) +
-                    ", szCardName=" + new String(szCardName) +
-                    ", uSimilarity=" + uSimilarity +
+                    ", szCardName=" + new String(szCardName, DEFAULT_CHARSET) +
+                    ", uSimilarity=" + (uSimilarity & 0x0ffffffff) +
                     '}';
         }
     }
@@ -1530,11 +1556,11 @@ public interface DahuaLibrary extends Library {
         /**
          * 图片宽度, 单位:像素
          */
-        public int wWidth;
+        public short wWidth;
         /**
          * 图片高度, 单位:像素
          */
-        public int wHeight;
+        public short wHeight;
         /**
          * 文件路径
          */

+ 1 - 1
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/impl/ClassServiceImpl.java

@@ -86,7 +86,7 @@ public class ClassServiceImpl implements ClassService{
         for (SysTeacherClazz detail : teachers) {
             detail.setClazz_id(clazz.getClazz_id());
             Integer count = 0;
-            count = sysClazzMapper.teacherClazz(detail.getSubject_name(),detail.getTeacher_id());
+            count = sysClazzMapper.teacherClazz(detail.getSubject_name(),clazz.getClazz_id());
             if(count > 0){
                 throw new BizException(BizExceptionCode.REPEAT_SUBJECTS);
             }

+ 5 - 3
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/impl/StudentServiceImpl.java

@@ -197,10 +197,12 @@ public class StudentServiceImpl implements StudentService{
                 json = JSONObject.parseObject(main.getDd_maindata());
                 if (null != json) {
                     if ("男".equals(json.get("stu_sex"))) {
-                        json.put("stu_sex", 1);
+                        json.put("stu_sex", 0);
                     }else if ("女".equals(json.get("stu_sex"))) {
-                        json.put("stu_sex", 2);
-                    };
+                        json.put("stu_sex", 1);
+                    }else if(!"男".equals(json.get("stu_sex")) && !"女".equals(json.get("stu_sex"))){
+                        throw new BizException(BizExceptionCode.ILLEGAL_Gender);
+                    }
                 }
 
                 SysStudent stu = JSONObject.parseObject(json.toJSONString(), SysStudent.class);

+ 5 - 4
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/business/service/impl/HomeWorkServiceImpl.java

@@ -10,10 +10,7 @@ import com.usoftchina.smartschool.school.dto.BatchDealBaseDTO;
 import com.usoftchina.smartschool.school.dto.DocBaseDTO;
 import com.usoftchina.smartschool.school.dto.ListReqDTO;
 import com.usoftchina.smartschool.school.exception.BizExceptionCode;
-import com.usoftchina.smartschool.school.mapper.HomeWorkMapper;
-import com.usoftchina.smartschool.school.mapper.SysClazzMapper;
-import com.usoftchina.smartschool.school.mapper.SysGradeMapper;
-import com.usoftchina.smartschool.school.mapper.SysStudentMapper;
+import com.usoftchina.smartschool.school.mapper.*;
 import com.usoftchina.smartschool.school.po.HomeWork;
 import com.usoftchina.smartschool.school.po.SysClazz;
 import com.usoftchina.smartschool.school.po.SysGrade;
@@ -40,6 +37,8 @@ public class HomeWorkServiceImpl implements HomeWorkService{
     private SysClazzMapper sysClazzMapper;
     @Autowired
     private SysStudentMapper sysStudentMapper;
+    @Autowired
+    private SysTeacherMapper sysTeacherMapper;
 
     @Override
     public DocBaseDTO save(HomeWork formdata) {
@@ -57,6 +56,8 @@ public class HomeWorkServiceImpl implements HomeWorkService{
             //获取时间
             Calendar calendar= Calendar.getInstance();
             formdata.setCreate_date(calendar.getTime());
+            Long Creator = sysTeacherMapper.taskCreator(formdata.getTask_creator());
+            formdata.setTask_creator(Creator);
             homeWorkMapper.insertSelective(formdata);
         } else {
             //更新

+ 1 - 1
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/exception/BizExceptionCode.java

@@ -25,7 +25,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     EXISTS_SCORE_PUBLISH(5000013, "存在已发布成绩,禁止删除"),
     EXISTS_CLASS(500011, "存在班级,无法删除"),
     HOMEWORK_RELEASE(500012, "存在发布作业,无法删除"),
-    REPEAT_SUBJECTS(600001, "同个老师不可班带相同的课"),
+    REPEAT_SUBJECTS(600001, "课程已存在"),
     REPEAT_GRADE_NAME(600001, "年级名称重复"),
     REPEAT_CLASS_NAME(600002, "班级名称重复"),
     REPEAT_STUDENT_NUMBER(600003, "学生学号不可重复"),

+ 1 - 1
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/SysClazzMapper.java

@@ -35,5 +35,5 @@ public interface SysClazzMapper {
 
     int countClazz(@Param("clazz_name") String clazz_name, @Param("clazz_grade") String clazz_grade, @Param("school_id") Long school_id);
 
-    Integer teacherClazz(@Param("subject_name") String subject_name,@Param("teacher_id") Long teacher_id );
+    Integer teacherClazz(@Param("subject_name") String subject_name, @Param("clazz_id") Long clazz_id);
 }

+ 2 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/SysTeacherMapper.java

@@ -42,4 +42,6 @@ public interface SysTeacherMapper {
     int checkTeacher(@Param("teacher_id") Long teacher_id);
 
     void deleteDetail(@Param("teacher_clazz_id") Long teacher_clazz_id);
+
+    Long taskCreator(@Param("user_id") Long user_id);
 }

+ 3 - 3
applications/school/school-server/src/main/resources/mapper/SysClazzMapper.xml

@@ -254,9 +254,9 @@
       <if test="subject_name != null">
         subject_name=#{subject_name}
       </if>
-        <if test="teacher_id != null">
-            and teacher_id=#{teacher_id}
-        </if>
+      <if test="clazz_id != null">
+        and clazz_id=#{clazz_id}
+      </if>
     </where>
   </select>
 

+ 4 - 0
applications/school/school-server/src/main/resources/mapper/SysTeacherMapper.xml

@@ -406,4 +406,8 @@ where sys_teacher_clazz.teacher_id=#{id}
   <delete id="deleteDetail">
     DELETE FROM sys_teacher_clazz where teacher_clazz_id = #{teacher_clazz_id}
   </delete>
+
+  <select id="taskCreator" parameterType="long" resultType="long">
+      select teacher_id from sys_teacher where user_id = #{user_id}
+  </select>
 </mapper>