Browse Source

Merge remote-tracking branch 'origin/dev'

zhuth 7 years ago
parent
commit
5470601245
17 changed files with 166 additions and 17 deletions
  1. 14 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/controller/CurriculumController.java
  2. 12 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/CurriculumService.java
  3. 16 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/impl/CurriculumServiceImpl.java
  4. 15 1
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/impl/GradeServiceImpl.java
  5. 1 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/exception/BizExceptionCode.java
  6. 14 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/CurriculumMapper.java
  7. 1 1
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/SysStudentMapper.java
  8. 3 1
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/SysTeacherMapper.java
  9. 13 0
      applications/school/school-server/src/main/resources/mapper/CurriculumMapper.xml
  10. 2 2
      applications/school/school-server/src/main/resources/mapper/SysStudentMapper.xml
  11. 5 1
      applications/school/school-server/src/main/resources/mapper/SysTeacherMapper.xml
  12. 2 2
      frontend/pc-web/app/view/Interaction/score/Detail.js
  13. 2 1
      frontend/pc-web/app/view/Interaction/score/List.js
  14. 17 5
      frontend/pc-web/app/view/Interaction/timetable/Detail.js
  15. 47 1
      frontend/pc-web/app/view/Interaction/timetable/DetailController.js
  16. 1 1
      frontend/pc-web/app/view/Interaction/timetable/List.js
  17. 1 1
      frontend/pc-web/app/view/basic/student/StudentDetail.js

+ 14 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/controller/CurriculumController.java

@@ -57,4 +57,18 @@ public class CurriculumController {
         curriculumService.saveToFormal(id, update);
         return Result.success();
     }
+
+    //发布接口
+    @PostMapping("/publish/{id}")
+    public Result publish(@PathVariable("id") Long id){
+        curriculumService.publish(id);
+        return Result.success();
+    }
+
+    //取消发布
+    @PostMapping("/republish/{id}")
+    public Result republish(@PathVariable("id") Long id){
+        curriculumService.republish(id);
+        return Result.success();
+    }
 }

+ 12 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/CurriculumService.java

@@ -52,4 +52,16 @@ public interface CurriculumService {
      * @param update
      */
     void saveToFormal(Integer id, boolean update);
+
+    /**
+     * 发布
+     * @param id
+     */
+    void publish(Long id);
+
+    /**
+     * 取消发布
+     * @param id
+     */
+    void republish(Long id);
 }

+ 16 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/impl/CurriculumServiceImpl.java

@@ -264,4 +264,20 @@ public class CurriculumServiceImpl implements CurriculumService {
         }
         dataImportMapper.updateDataImport(id);
     }
+
+    @Override
+    public void publish(Long id) {
+        if(org.springframework.util.StringUtils.isEmpty(id) || "0".equals(id)) {
+            return;
+        }
+        curriculumMapper.updateByPublish(id);
+    }
+
+    @Override
+    public void republish(Long id) {
+        if(org.springframework.util.StringUtils.isEmpty(id) || "0".equals(id)) {
+            return;
+        }
+        curriculumMapper.updateByRepublish(id);
+    }
 }

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

@@ -40,6 +40,12 @@ public class GradeServiceImpl implements GradeService{
     @Autowired
     private SysStudentMapper sysStudentMapper;
 
+    @Autowired
+    private SysTeacherMapper sysTeacherMapper;
+
+    @Autowired
+    private HomeWorkMapper homeWorkMapper;
+
     @Override
     public TreeNode getSchoolTree() {
         Long school_id = BaseContextHolder.getSchoolId();
@@ -205,9 +211,17 @@ public class GradeServiceImpl implements GradeService{
         if (StringUtils.isEmpty(id)) {
             throw new BizException(BizExceptionCode.USELESS_DATA);
         }
-        if(sysStudentMapper.countStudent(id) > 0){
+        Integer check = 0;
+        //检测学生
+        check = sysStudentMapper.countStudent(id);
+        if(check > 0){
             throw new BizException(BizExceptionCode.EFFECTIVE_CLASS_DATA);
         }
+        //检测科目
+        check = sysTeacherMapper.checkTeacherSubjects(id);
+        if(check > 0){
+            throw new BizException(BizExceptionCode.EXISTS_TEACHER_SUBJECTS);
+        }
         sysClazzMapper.deleteByPrimaryKey(id);
     }
 

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

@@ -24,6 +24,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     EXISTS_SUBJECT_TEACHER(5000012, "该课程存在班级与任课教师,禁止删除"),
     EXISTS_SCORE_PUBLISH(5000013, "存在已发布成绩,禁止删除"),
     EXISTS_CLASS(500011, "存在班级,无法删除"),
+    EXISTS_TEACHER_SUBJECTS(500012, "存在科目信息,无法删除"),
     REPEAT_GRADE_NAME(600001, "年级名称重复"),
     REPEAT_CLASS_NAME(600002, "班级名称重复"),
     REPEAT_STUDENT_NUMBER(600003, "学生学号不可重复"),

+ 14 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/CurriculumMapper.java

@@ -84,4 +84,18 @@ public interface CurriculumMapper {
     void updateDetailSelective(List<CurriculumDetailDTO> curriculumDetailDTOList);
 
     int courseStatus(Long id);
+
+    /**
+     * 发布
+     * @param
+     * @return
+     */
+    int updateByPublish(Long id);
+
+    /**
+     * 取消发布
+     * @param
+     * @return
+     */
+    int updateByRepublish(Long id);
 }

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

@@ -69,7 +69,7 @@ public interface SysStudentMapper {
      * 班级组织:班级中学生的数量
      * @return
      */
-    int countStudent(@Param("clazz_id") Long clazz_id);
+    Integer countStudent(@Param("clazz_id") Long clazz_id);
 
     /**
      * 查找班级下的所有学生ID

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

@@ -39,5 +39,7 @@ public interface SysTeacherMapper {
 
     SysTeacher selectNumberByKey(String teacher_number);
 
-    int checkTeacher(Long id);
+    int checkTeacher(@Param("teacher_id") Long teacher_id);
+
+    Integer checkTeacherSubjects(@Param("clazz_id") Long clazz_id);
 }

+ 13 - 0
applications/school/school-server/src/main/resources/mapper/CurriculumMapper.xml

@@ -263,4 +263,17 @@
     select count(1) from clazz_main_curriculum where mcur_status=1 and id=#{id}
   </select>
 
+  <update id="updateByPublish" parameterType="java.lang.Long">
+    update clazz_main_curriculum
+    set mcur_status = 1 ,
+      createTime = now()
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+
+  <update id="updateByRepublish" parameterType="java.lang.Long">
+    update clazz_main_curriculum
+    set mcur_status = 0
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+
 </mapper>

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

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

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

@@ -396,6 +396,10 @@ where sys_teacher_clazz.teacher_id=#{id}
   </select>
 
   <select id="checkTeacher" parameterType="long" resultType="int">
-    select count(*) from sys_teacher_clazz where  teacher_id= #{id}
+    select count(*) from sys_teacher_clazz where  teacher_id= #{teacher_id}
+  </select>
+
+  <select id="checkTeacherSubjects" parameterType="long" resultType="Integer">
+    select count(*) from sys_teacher_clazz where  clazz_id= #{clazz_id}
   </select>
 </mapper>

+ 2 - 2
frontend/pc-web/app/view/Interaction/score/Detail.js

@@ -9,7 +9,7 @@ Ext.define('school.view.interaction.score.Detail', {
     _idField: 'si_id',
     _codeField: null,
 
-    // _readUrl: 'http://10.1.80.47:9520/api/school/score/read',
+    // _readUrl: 'http://10.1.80.36:9520/api/school/score/read',
     _readUrl: '/api/school/score/read',
     // _saveUrl: 'http://10.1.80.47:9520/api/school/score/save',
     // _saveUrl: '/api/sale/sss/update',
@@ -71,7 +71,7 @@ Ext.define('school.view.interaction.score.Detail', {
                 rowViewModel: {},
                 columns: [{
                     text: '学生编号',
-                    dataIndex: 'sd_id'
+                    dataIndex: 'sd_stuNumber'
                 }, {
                     text: '姓名',
                     dataIndex: 'sd_stu'

+ 2 - 1
frontend/pc-web/app/view/Interaction/score/List.js

@@ -137,7 +137,8 @@ Ext.define('school.view.interaction.score.List', {
                     hidden: true
                 }, {
                     text: '考试标题',
-                    dataIndex: 'si_examtitle'
+                    dataIndex: 'si_examtitle',
+                    width: 200
                 }, {
                     text: '考试时间',
                     dataIndex: 'si_examdate',

+ 17 - 5
frontend/pc-web/app/view/Interaction/timetable/Detail.js

@@ -350,11 +350,23 @@ Ext.define('school.view.interaction.timetable.Detail', {
                     hidden: true
                 }]
             }],
-            // toolBtns: [{
-            //     xtype: 'button',
-            //     text: '发布',
-            //     handler: 'onPublish'
-            // }]
+            toolBtns: [{
+                xtype: 'button',
+                text: '启用',
+                hidden: true,
+                bind: {
+                    hidden: '{!id || status == 1}'
+                },
+                handler: 'onPublish'
+            }, {
+                xtype: 'button',
+                text: '禁用',
+                hidden: true,
+                bind: {
+                    hidden: '{!id || status == 0}'
+                },
+                handler: 'onRePublish'
+            }]
         });
         this.callParent();
     },

+ 47 - 1
frontend/pc-web/app/view/Interaction/timetable/DetailController.js

@@ -9,9 +9,55 @@ Ext.define('school.view.interaction.timetable.DetailController', {
         form.initId = id;
         school.util.FormUtil.loadData(form).then(function(data) {
             var newId = form.xtype + '-' + data.main.id;
-            var newTitle = form._title + '(' + data.main.id + ')';
+            var newTitle = form._title + '(' + data.main.name + ')';
     
             school.util.BaseUtil.refreshTabTitle(newId, newTitle);
         });
     },
+
+    onPublish: function() {
+        let me = this,
+        view = me.getView(),
+        viewModel = me.getViewModel(),
+        id = viewModel.data.id;
+        view.setLoading(true);
+        school.util.BaseUtil.request({
+            // url: 'http://10.1.80.180:9520/api/school/curriculum/publish/' + id,
+            url: '/api/school/curriculum/publish/' + id,
+            method: 'POST'
+        })
+        .then(function() {
+            view.setLoading(false);
+            school.util.BaseUtil.showSuccessToast('启用成功');
+            viewModel.set('status', 1);
+            me.refresh();
+        })
+        .catch(function(e) {
+            view.setLoading(false);
+            school.util.BaseUtil.showErrorToast('启用失败: ' + e.message);
+        });
+    },
+
+    onRePublish: function() {
+        let me = this,
+        view = me.getView(),
+        viewModel = me.getViewModel(),
+        id = viewModel.data.id;
+        view.setLoading(true);
+        school.util.BaseUtil.request({
+            // url: 'http://10.1.80.180:9520/api/school/curriculum/republish/' + id,
+            url: '/api/school/curriculum/republish/' + id,
+            method: 'POST'
+        })
+        .then(function() {
+            view.setLoading(false);
+            school.util.BaseUtil.showSuccessToast('禁用成功');
+            viewModel.set('status', 0);
+            me.refresh();
+        })
+        .catch(function(e) {
+            view.setLoading(false);
+            school.util.BaseUtil.showErrorToast('禁用失败: ' + e.message);
+        });
+    },
 });

+ 1 - 1
frontend/pc-web/app/view/Interaction/timetable/List.js

@@ -106,7 +106,7 @@ Ext.define('school.view.interaction.timetable.List', {
                 addTitle: '课程表',
                 addXtype: 'interaction-timetable-detail',
                 idField: 'id',
-                codeField: 'id',
+                codeField: 'name',
                 detailField: 'name',
                 dataUrl: me.dataUrl,
                 caller: null,

+ 1 - 1
frontend/pc-web/app/view/basic/student/StudentDetail.js

@@ -15,7 +15,7 @@ Ext.define('school.view.basic.student.StudentDetail', {
     _auditdateField: null,
     // _readUrl: 'http://10.1.80.47:9560/student/read',
     _readUrl: '/api/school/student/read',
-    // _saveUrl: 'http://10.1.80.47:9560/student/save',
+    // _saveUrl: 'http://10.1.80.36:9520/api/school/student/save',
     _saveUrl: '/api/school/student/save',
     // _deleteUrl: 'http://10.1.80.47:9560/student/delete',
     _deleteUrl: '/api/school/student/delete',