Эх сурвалжийг харах

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

chenw 6 жил өмнө
parent
commit
3a569a298c

+ 1 - 1
applications/device/device-sdk-dahua/src/main/java/com/usoftchina/smartschool/device/dahua/service/DahuaDataAnalyzeService.java

@@ -65,7 +65,7 @@ public class DahuaDataAnalyzeService {
                     DEV_EVENT_ACCESS_CTL_INFO info = new DEV_EVENT_ACCESS_CTL_INFO(pAlarmInfo);
                     AccessControlInfo accessControlInfo = new AccessControlInfo();
                     if (dwBufSize > 0) {
-                        accessControlInfo.setImageBuffer(pBuffer.getByteArray(0, dwBufSize));
+                        accessControlInfo.setImageData(pBuffer.getByteArray(0, dwBufSize));
                     }
                     accessControlInfo.setCardNo(new String(info.szCardNo));
                     accessControlInfo.setEventType(convertEventType(info.emEventType));

+ 5 - 5
applications/device/device-sdk/src/main/java/com/usoftchina/smartschool/device/dto/AccessControlInfo.java

@@ -27,7 +27,7 @@ public class AccessControlInfo implements Serializable {
     /**
      * 以人脸识别方式打开门禁时,图片信息
      */
-    private byte[] imageBuffer;
+    private byte[] imageData;
     /**
      * 打开门禁的方式
      *
@@ -59,12 +59,12 @@ public class AccessControlInfo implements Serializable {
         this.cardNo = cardNo;
     }
 
-    public byte[] getImageBuffer() {
-        return imageBuffer;
+    public byte[] getImageData() {
+        return imageData;
     }
 
-    public void setImageBuffer(byte[] imageBuffer) {
-        this.imageBuffer = imageBuffer;
+    public void setImageData(byte[] imageData) {
+        this.imageData = imageData;
     }
 
     public int getOpenMethod() {

+ 1 - 1
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/controller/DeviceController.java

@@ -6,4 +6,4 @@ package com.usoftchina.smartschool.device.controller;
  */
 public class DeviceController {
 
-}
+}

+ 12 - 6
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/impl/GradeServiceImpl.java

@@ -6,10 +6,7 @@ import com.usoftchina.smartschool.exception.BizException;
 import com.usoftchina.smartschool.school.basic.service.GradeService;
 import com.usoftchina.smartschool.school.dto.DocBaseDTO;
 import com.usoftchina.smartschool.school.exception.BizExceptionCode;
-import com.usoftchina.smartschool.school.mapper.DataImportMapper;
-import com.usoftchina.smartschool.school.mapper.SysClazzMapper;
-import com.usoftchina.smartschool.school.mapper.SysGradeMapper;
-import com.usoftchina.smartschool.school.mapper.SysSchoolMapper;
+import com.usoftchina.smartschool.school.mapper.*;
 import com.usoftchina.smartschool.school.po.*;
 import com.usoftchina.smartschool.utils.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -40,6 +37,9 @@ public class GradeServiceImpl implements GradeService{
     @Autowired
     private DataImportMapper dataImportMapper;
 
+    @Autowired
+    private SysStudentMapper sysStudentMapper;
+
     @Override
     public TreeNode getSchoolTree() {
         Long school_id = BaseContextHolder.getSchoolId();
@@ -174,12 +174,15 @@ public class GradeServiceImpl implements GradeService{
             throw new BizException(BizExceptionCode.USELESS_DATA);
         }
         sysClazz.setClazz_status(1);
-        String clazz_grade = sysGradeMapper.selectByPrimaryKey(sysClazz.getGrade_id()).getGrade_name();
-        if(sysClazzMapper.countClazz(sysClazz.getClazz_name(),clazz_grade)>0){
+        SysGrade gradeData = sysGradeMapper.selectByPrimaryKey(sysClazz.getGrade_id());
+        String clazz_grade = gradeData.getGrade_name();
+        if(sysClazzMapper.countClazz(sysClazz.getClazz_name(),clazz_grade ) >0 ){
             throw new BizException(BizExceptionCode.REPEAT_CLASS_NAME);
         }
 
+        sysClazz.setSchool_id(gradeData.getSchool_id());
         sysClazz.setClazz_grade(clazz_grade);
+        sysClazz.setClazz_nickname(clazz_grade+sysClazz.getClazz_name());
         sysClazzMapper.insertSelective(sysClazz);
         return new DocBaseDTO(sysClazz.getClazz_id());
     }
@@ -203,6 +206,9 @@ public class GradeServiceImpl implements GradeService{
         if (StringUtils.isEmpty(id)) {
             throw new BizException(BizExceptionCode.USELESS_DATA);
         }
+        if(sysStudentMapper.countStudent(id) > 0){
+            throw new BizException(BizExceptionCode.EFFECTIVE_CLASS_DATA);
+        }
         sysClazzMapper.deleteByPrimaryKey(id);
     }
 

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

@@ -159,11 +159,12 @@ public class TeacherServiceImpl implements TeacherService{
         if (null == id || "0".equals(id)) {
             return;
         }
-        Integer check = 0;
+        List<String> check = null;
         //教师检测
         check = sysTeacherMapper.checkTeacher(id);
-        if (check > 0) {
-            throw new BizException(BizExceptionCode.EXISTS_TEACHER_CLASS);
+        if (check != null) {
+            String.join("|", check);
+            throw new BizException(BizExceptionCode.TEACHERS_EXISTS_CLASS.getCode(), String.format(BizExceptionCode.TEACHERS_EXISTS_CLASS.getMessage(), String.join("|", check)));
         }
         sysTeacherMapper.deleteByPrimaryKey(id);
         sysTeacherMapper.deleteRelation(id);

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

@@ -20,12 +20,14 @@ public enum BizExceptionCode implements BaseExceptionCode {
     EXISTS_TEACHER(500004,"存在教师,无法删除"),
     EXISTS_CURRICULUM(500005,"存在课表,无法删除"),
     EXISTS_TEACHER_CLASS(500006,"存在任课班级,无法删除"),
+    TEACHERS_EXISTS_CLASS(500006,"%s存在任课班级,无法删除"),
     EXISTS_SUBJECT_TEACHER(5000012, "该课程存在班级与任课教师,禁止删除"),
     EXISTS_SCORE_PUBLISH(5000013, "存在已发布成绩,禁止删除"),
     EXISTS_CLASS(500011, "存在班级,无法删除"),
     REPEAT_GRADE_NAME(600001, "年级名称重复"),
     REPEAT_CLASS_NAME(600002, "班级名称重复"),
-    REPEAT_STUDENT_NUMBER(600003, "学生学号不可重复");
+    REPEAT_STUDENT_NUMBER(600003, "学生学号不可重复"),
+    EFFECTIVE_CLASS_DATA(600004, "无法删除有学生的班级");
 
 
     private int code;

+ 6 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/SysStudentMapper.java

@@ -65,6 +65,12 @@ public interface SysStudentMapper {
 
     SysStudent selectNumberByKey(String stu_number);
 
+    /**
+     * 班级组织:班级中学生的数量
+     * @return
+     */
+    int countStudent(@Param("clazz_id") Long clazz_id);
+
     /**
      * 查找班级下的所有学生ID
      * @param clazzId

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

@@ -39,5 +39,5 @@ public interface SysTeacherMapper {
 
     SysTeacher selectNumberByKey(String teacher_number);
 
-    Integer checkTeacher(Long id);
+    List<String> checkTeacher(Long id);
 }

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

@@ -82,7 +82,7 @@
         #{grade_id,jdbcType=BIGINT},
       </if>
       <if test="school_id != null" >
-        #{school_id,jdbcType=BIGINT}
+        #{school_id,jdbcType=BIGINT},
       </if>
       <if test="clazz_grade != null" >
         #{clazz_grade,jdbcType=VARCHAR},

+ 9 - 0
applications/school/school-server/src/main/resources/mapper/SysStudentMapper.xml

@@ -467,6 +467,15 @@
     where stu_number = #{stu_number,jdbcType=VARCHAR}
   </select>
 
+  <select id="countStudent" resultType="int">
+    select count(*) from sys_student
+    <where>
+      <if test="clazz_id != null">
+         clazz_id=#{clazz_id}
+      </if>
+    </where>
+  </select>
+
   <select id="selectIdByClazzId" resultType="string" parameterType="long">
     SELECT stu_id FROM student WHERE clazz_id = #{clazzId}
   </select>

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

@@ -395,7 +395,7 @@ where sys_teacher_clazz.teacher_id=#{id}
     where teacher_number = #{teacher_number,jdbcType=VARCHAR}
   </select>
 
-  <select id="checkTeacher" parameterType="long" resultType="integer">
-    select count(1) from sys_teacher_clazz where  teacher_id= #{id}
+  <select id="checkTeacher" parameterType="long" resultType="List">
+    select teacher_name from sys_teacher_clazz where  teacher_id= #{id}
   </select>
 </mapper>