Sfoglia il codice sorgente

Merge branch 'dev' into feature-cloud

guq 7 anni fa
parent
commit
745d440f5e

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

@@ -0,0 +1,46 @@
+package com.usoftchina.smartschool.school.basic.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.smartschool.base.Result;
+import com.usoftchina.smartschool.page.PageDefault;
+import com.usoftchina.smartschool.page.PageRequest;
+import com.usoftchina.smartschool.school.basic.service.SubjectService;
+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.po.Subject;
+import com.usoftchina.smartschool.school.po.SysTeacher;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author: guq
+ * @create: 2019-02-27 10:09
+ **/
+@RestController
+@RequestMapping("subject")
+public class SubjectController {
+
+
+    @Autowired
+    private SubjectService subjectService;
+
+    @GetMapping("/list")
+    public Result getList(@PageDefault PageRequest page, ListReqDTO listReqDTO) {
+        PageInfo<Subject> student = subjectService.getListData(page, listReqDTO);
+        return Result.success(student);
+    }
+
+    @PostMapping("/save")
+    public Result getFormData(@RequestBody Subject data) {
+        DocBaseDTO formData = subjectService.saveFormData(data);
+        return Result.success(formData);
+    }
+
+    @PostMapping("/batchDelete")
+    public Result batchDelete(@RequestBody BatchDealBaseDTO baseDTOs) {
+        subjectService.batchDelete(baseDTOs);
+        return Result.success();
+    }
+
+}

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

@@ -0,0 +1,16 @@
+package com.usoftchina.smartschool.school.basic.service;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.smartschool.page.PageRequest;
+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.po.Subject;
+
+public interface SubjectService {
+    PageInfo<Subject> getListData(PageRequest page, ListReqDTO listReqDTO);
+
+    DocBaseDTO saveFormData(Subject teacher);
+
+    void batchDelete(BatchDealBaseDTO baseDTOs);
+}

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

@@ -0,0 +1,87 @@
+package com.usoftchina.smartschool.school.basic.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.smartschool.context.BaseContextHolder;
+import com.usoftchina.smartschool.exception.BizException;
+import com.usoftchina.smartschool.page.PageRequest;
+import com.usoftchina.smartschool.school.basic.service.SubjectService;
+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.SubjectMapper;
+import com.usoftchina.smartschool.school.po.Subject;
+import com.usoftchina.smartschool.school.po.SysStudent;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
+
+/**
+ * @author: guq
+ * @create: 2019-02-27 10:10
+ **/
+@Service
+public class SubjectServiceImpl implements SubjectService {
+
+    @Autowired
+    private SubjectMapper subjectMapper;
+
+
+    @Override
+    public PageInfo<Subject> getListData(PageRequest page, ListReqDTO listReqDTO) {
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        Long schoolId = BaseContextHolder.getSchoolId();
+        schoolId = 1l;
+        //condition语句
+        String condition = listReqDTO.getFinalCondition();
+        if(condition == null){
+            condition = "1=1";
+        }
+        List<Subject> data = subjectMapper.selectByConditon(condition, schoolId);
+        PageInfo<Subject> list = new PageInfo<>(data);
+        return list;
+    }
+
+    @Override
+    public DocBaseDTO saveFormData(Subject formdata) {
+        if (null == formdata){
+            throw new BizException(BizExceptionCode.EMPTY_DATA);
+        }
+        Long id = formdata.getSubject_id();
+        Long school = BaseContextHolder.getSchoolId();
+        school = 1l;
+        if (StringUtils.isEmpty(id) || "0".equals(id.toString())) {
+            formdata.setSchool_id(school);
+            formdata.setSubject_status(1);
+            subjectMapper.insertSelective(formdata);
+           id = formdata.getSubject_id();
+        } else {
+            //更新
+            subjectMapper.updateByPrimaryKeySelective(formdata);
+        }
+        return new DocBaseDTO(formdata.getSubject_id());
+    }
+
+    @Override
+    public void batchDelete(BatchDealBaseDTO baseDTOs) {
+        if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
+                baseDTOs.getBaseDTOs().size() == 0) {
+            return;
+        }
+        for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
+            delete(base.getId());
+        }
+    }
+
+
+
+    private void delete(Long id) {
+        if (null == id || "0".equals(id)) {
+            return;
+        }
+        subjectMapper.deleteByPrimaryKey(id);
+    }
+}

+ 23 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/SubjectMapper.java

@@ -0,0 +1,23 @@
+package com.usoftchina.smartschool.school.mapper;
+
+import com.usoftchina.smartschool.school.po.Subject;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+@Mapper
+public interface SubjectMapper {
+    int deleteByPrimaryKey(Long subject_id);
+
+    int insert(Subject record);
+
+    int insertSelective(Subject record);
+
+    Subject selectByPrimaryKey(Long subject_id);
+
+    int updateByPrimaryKeySelective(Subject record);
+
+    int updateByPrimaryKey(Subject record);
+
+    List<Subject> selectByConditon(@Param("con") String con, @Param("school_id") Long school_id);
+}

+ 48 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/po/Subject.java

@@ -0,0 +1,48 @@
+package com.usoftchina.smartschool.school.po;
+
+/**
+ * @author: guq
+ * @create: 2019-02-27 11:49
+ **/
+public class Subject {
+
+    private Long subject_id;
+
+    private String subject_name;
+
+    private Integer subject_status;
+
+    private Long school_id;
+
+    public Long getSubject_id() {
+        return subject_id;
+    }
+
+    public void setSubject_id(Long subject_id) {
+        this.subject_id = subject_id;
+    }
+
+    public String getSubject_name() {
+        return subject_name;
+    }
+
+    public void setSubject_name(String subject_name) {
+        this.subject_name = subject_name == null ? null : subject_name.trim();
+    }
+
+    public Integer getSubject_status() {
+        return subject_status;
+    }
+
+    public void setSubject_status(Integer subject_status) {
+        this.subject_status = subject_status;
+    }
+
+    public Long getSchool_id() {
+        return school_id;
+    }
+
+    public void setSchool_id(Long school_id) {
+        this.school_id = school_id;
+    }
+}

+ 91 - 0
applications/school/school-server/src/main/resources/mapper/SubjectMapper.xml

@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.usoftchina.smartschool.school.mapper.SubjectMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.smartschool.school.po.Subject" >
+    <id column="subject_id" property="subject_id" jdbcType="BIGINT" />
+    <result column="subject_name" property="subject_name" jdbcType="VARCHAR" />
+    <result column="subject_status" property="subject_status" jdbcType="INTEGER" />
+    <result column="school_id" property="school_id" jdbcType="BIGINT" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    subject_id, subject_name, subject_status, school_id
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
+    select 
+    <include refid="Base_Column_List" />
+    from subject
+    where subject_id = #{subject_id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
+    delete from subject
+    where subject_id = #{subject_id,jdbcType=BIGINT}
+  </delete>
+  <insert id="insert" parameterType="com.usoftchina.smartschool.school.po.Subject" >
+    insert into subject (subject_id, subject_name, subject_status, 
+      school_id)
+    values (#{subject_id,jdbcType=BIGINT}, #{subject_name,jdbcType=VARCHAR}, #{subject_status,jdbcType=INTEGER}, 
+      #{school_id,jdbcType=BIGINT})
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.smartschool.school.po.Subject" >
+    <selectKey  resultType="java.lang.Long" keyProperty="subject_id">
+      SELECT LAST_INSERT_ID() AS ID
+    </selectKey>
+    insert into subject
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="subject_name != null" >
+        subject_name,
+      </if>
+      <if test="subject_status != null" >
+        subject_status,
+      </if>
+      <if test="school_id != null" >
+        school_id,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="subject_name != null" >
+        #{subject_name,jdbcType=VARCHAR},
+      </if>
+      <if test="subject_status != null" >
+        #{subject_status,jdbcType=INTEGER},
+      </if>
+      <if test="school_id != null" >
+        #{school_id,jdbcType=BIGINT},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.smartschool.school.po.Subject" >
+    update subject
+    <set >
+      <if test="subject_name != null" >
+        subject_name = #{subject_name,jdbcType=VARCHAR},
+      </if>
+      <if test="subject_status != null" >
+        subject_status = #{subject_status,jdbcType=INTEGER},
+      </if>
+      <if test="school_id != null" >
+        school_id = #{school_id,jdbcType=BIGINT},
+      </if>
+    </set>
+    where subject_id = #{subject_id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.smartschool.school.po.Subject" >
+    update subject
+    set subject_name = #{subject_name,jdbcType=VARCHAR},
+      subject_status = #{subject_status,jdbcType=INTEGER},
+      school_id = #{school_id,jdbcType=BIGINT}
+    where subject_id = #{subject_id,jdbcType=BIGINT}
+  </update>
+
+  <select id="selectByConditon" resultMap="BaseResultMap">
+    select * from subject <where>
+    <if test="con != null">
+      ${con}
+    </if>
+    <if test="school_id != null">
+      and  school_id = #{school_id}
+    </if>
+  </where>
+    order by subject_id DESC
+  </select>
+</mapper>

+ 10 - 6
frontend/pc-web/app/view/Interaction/homework/List.js

@@ -33,7 +33,7 @@ Ext.define('school.view.interaction.homework.List', {
                 fieldLabel: '发布状态',
                 displayField: 'name',
                 valueField: 'value',
-                editable: false,
+                editable: true,
                 store: Ext.create('Ext.data.ArrayStore', {
                     fields: ['name', 'value'],
                     data: [
@@ -45,7 +45,7 @@ Ext.define('school.view.interaction.homework.List', {
                 queryMode: 'local'
             }, {
                 xtype: 'condatefield',
-                name: 'start_date',
+                name: 'publish_date',
                 fieldLabel: '发布时间',
                 columnWidth: 0.5
             }],
@@ -116,10 +116,10 @@ Ext.define('school.view.interaction.homework.List', {
                     hidden: true
                 }, {
                     text: '年级',
-                    dataIndex: 'nj'
+                    dataIndex: 'grade_name'
                 }, {
                     text: '班级',
-                    dataIndex: 'bj'
+                    dataIndex: 'classz_name'
                 }, {
                     text: '标题',
                     dataIndex: 'task_title',
@@ -143,10 +143,14 @@ Ext.define('school.view.interaction.homework.List', {
                     width: 150
                 }, {
                     text: '发布状态',
-                    dataIndex: 'zt'
+                    dataIndex: 'task_status',
+                    width: 120,
+                    renderer: function(v) {
+                        return !!v ? (v == 2 ? '未发布' : '已发布') : '未发布'
+                    }
                 }, {
                     text: '发布时间',
-                    dataIndex: 'start_date',
+                    dataIndex: 'publish_date',
                     width: 120
                 }, ]
             },

+ 24 - 30
frontend/pc-web/app/view/Interaction/homework/Release.js

@@ -31,21 +31,11 @@ Ext.define('school.view.interaction.homework.Release', {
                 columnWidth: 0.5
             }, {
                 xtype: 'textfield',
-                name: 'njid',
-                fieldLabel: '年级id',
-                hidden: true
-            }, {
-                xtype: 'textfield',
-                name: 'nj',
+                name: 'grade_name',
                 fieldLabel: '年级'
             }, {
                 xtype: 'textfield',
-                name: 'bjid',
-                fieldLabel: '班级id',
-                hidden: true
-            }, {
-                xtype: 'textfield',
-                name: 'bj',
+                name: 'classz_name',
                 fieldLabel: '班级'
             }, {
                 xtype: 'datefield',
@@ -63,6 +53,27 @@ Ext.define('school.view.interaction.homework.Release', {
                 name: "task_title",
                 fieldLabel: "标题",
                 columnWidth: 1
+            }, {
+                xtype: 'combobox',
+                name: 'task_status',
+                fieldLabel: '发布状态',
+                displayField: 'name',
+                valueField: 'value',
+                editable: false,
+                readOnly: true,
+                defaultValue: 2,
+                store: Ext.create('Ext.data.ArrayStore', {
+                    fields: ['name', 'value'],
+                    data: [['未发布', 2], ['已发布', 1]]
+                }),
+                minChars: 0,
+                queryMode: 'local'
+            }, {
+                xtype: 'datefield',
+                name: 'publish_date',
+                fieldLabel: '发布时间',
+                readOnly: true,
+                format: 'Y-m-d H:i:s'
             }, {
                 xtype: "textareafield",
                 name: 'task_context',
@@ -80,24 +91,7 @@ Ext.define('school.view.interaction.homework.Release', {
                 bind: {
                     hidden: '{!task_id}'
                 },
-                handler: function() {
-                    let id = me.getViewModel().data.task_id;
-                    me.setLoading(true);
-                    school.util.BaseUtil.request({
-                        url: '/api/school/homework/publish/' + id,
-                        method: 'POST'
-                    })
-                    .then(function() {
-                        me.setLoading(false);
-                        school.util.BaseUtil.showSuccessToast('发布成功');
-                        me.getViewModel().set('notify_status', 1);
-                        me.clearDirty();
-                    })
-                    .catch(function(e) {
-                        me.setLoading(false);
-                        school.util.BaseUtil.showErrorToast('发布失败: ' + e.message);
-                    });
-                }
+                handler: 'onPublish'
             }]
         });
         this.callParent();

+ 22 - 0
frontend/pc-web/app/view/Interaction/homework/ReleaseController.js

@@ -18,4 +18,26 @@ Ext.define('school.view.interaction.homework.ReleaseController', {
             school.util.BaseUtil.refreshTabTitle(newId, newTitle);
         });
     },
+
+    onPublish: function() {
+        let me = this,
+        view = me.getView(),
+        viewModel = me.getViewModel(),
+        id = viewModel.data.task_id;
+        view.setLoading(true);
+        school.util.BaseUtil.request({
+            url: '/api/school/homework/publish/' + id,
+            method: 'POST'
+        })
+        .then(function() {
+            view.setLoading(false);
+            school.util.BaseUtil.showSuccessToast('发布成功');
+            viewModel.set('task_status', 1);
+            me.refresh();
+        })
+        .catch(function(e) {
+            view.setLoading(false);
+            school.util.BaseUtil.showErrorToast('发布失败: ' + e.message);
+        });
+    }
 });

+ 3 - 3
frontend/pc-web/app/view/Interaction/notice/List.js

@@ -29,7 +29,7 @@ Ext.define('school.view.interaction.notice.List', {
                 fieldLabel: '发布状态',
                 displayField: 'name',
                 valueField: 'value',
-                editable: false,
+                editable: true,
                 store: Ext.create('Ext.data.ArrayStore', {
                     fields: ['name', 'value'],
                     data: [['已发布', 1], ['未发布', 2]]
@@ -38,7 +38,7 @@ Ext.define('school.view.interaction.notice.List', {
                 queryMode: 'local'
             }, {
                 xtype: 'condatefield',
-                name: 'create_date',
+                name: 'publish_date',
                 fieldLabel: '发布时间',
                 columnWidth: 0.5
             }],
@@ -140,7 +140,7 @@ Ext.define('school.view.interaction.notice.List', {
                     xtype: 'datecolumn',
                     formate: 'Y-m-d H:i:s',
                     text: '发布时间',
-                    dataIndex: 'create_date',
+                    dataIndex: 'publish_date',
                     width: 120
                 }]
             },

+ 4 - 21
frontend/pc-web/app/view/Interaction/notice/SchoolNotice.js

@@ -46,10 +46,10 @@ Ext.define('school.view.interaction.notice.SchoolNotice', {
                 queryMode: 'local'
             }, {
                 xtype: 'datefield',
-                name: 'create_date',
+                name: 'publish_date',
                 fieldLabel: '发布时间',
-                columnWidth: 0.5,
-                formatter: 'Y-m-d H:i:s'
+                readOnly: true,
+                format: 'Y-m-d H:i:s'
             }, {
                 xtype: "textfield",
                 name: "notify_title",
@@ -72,24 +72,7 @@ Ext.define('school.view.interaction.notice.SchoolNotice', {
                 bind: {
                     hidden: '{!notify_id}'
                 },
-                handler: function() {
-                    let id = me.getViewModel().data.notify_id;
-                    me.setLoading(true);
-                    school.util.BaseUtil.request({
-                        url: '/api/school/notice/publish/' + id,
-                        method: 'POST'
-                    })
-                    .then(function() {
-                        me.setLoading(false);
-                        school.util.BaseUtil.showSuccessToast('发布成功');
-                        me.getViewModel().set('notify_status', 1);
-                        me.clearDirty();
-                    })
-                    .catch(function(e) {
-                        me.setLoading(false);
-                        school.util.BaseUtil.showErrorToast('发布失败: ' + e.message);
-                    });
-                }
+                handler: 'onPublish'
             }]
         });
         this.callParent();

+ 22 - 0
frontend/pc-web/app/view/Interaction/notice/SchoolNoticeController.js

@@ -18,4 +18,26 @@ Ext.define('school.view.interaction.notice.SchoolNoticeController', {
             school.util.BaseUtil.refreshTabTitle(newId, newTitle);
         });
     },
+
+    onPublish: function() {
+        let me = this,
+        view = me.getView(),
+        viewModel = me.getViewModel(),
+        id = viewModel.data.notify_id;
+        view.setLoading(true);
+        school.util.BaseUtil.request({
+            url: '/api/school/notice/publish/' + id,
+            method: 'POST'
+        })
+        .then(function() {
+            view.setLoading(false);
+            school.util.BaseUtil.showSuccessToast('发布成功');
+            viewModel.set('notify_status', 1);
+            me.refresh();
+        })
+        .catch(function(e) {
+            view.setLoading(false);
+            school.util.BaseUtil.showErrorToast('发布失败: ' + e.message);
+        });
+    }
 });

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

@@ -18,15 +18,15 @@ Ext.define('school.view.interaction.timetable.List', {
         Ext.apply(this, {
             searchField: [{
                 xtype: 'textfield',
-                name: 'name',
+                name: 'mcur_name',
                 fieldLabel: '课表名称'
             }, {
                 xtype: 'textfield',
-                name: 'gradeName',
+                name: 'grade_id',
                 fieldLabel: '年级'
             }, {
                 xtype: 'textfield',
-                name: 'clazzName',
+                name: 'clazz_id',
                 fieldLabel: '班级'
             }, {
                 xtype: 'numberfield',
@@ -37,7 +37,7 @@ Ext.define('school.view.interaction.timetable.List', {
                 }
             }, {
                 xtype: 'textfield',
-                name: 'termName',
+                name: 'mcur_term_name',
                 fieldLabel: '学期'
             }],
         

+ 1 - 1
frontend/wechat-web/src/configs/router.config.js

@@ -118,7 +118,7 @@ class RouteConfig extends Component {
 
                         <Route path='/voteList' component={VoteListParent}/>{/*家长端投票列表*/}
                         <Route path='/voteListTab' component={VoteListTeacher}/>{/*教师端投票列表*/}
-                        <Route path="/voteDetail/:id/:role?" component={VoteDetailPage}/>{/*投票详情*/}
+                        <Route path="/voteDetail/:role/:id" component={VoteDetailPage}/>{/*投票详情*/}
 
                         {/*测试demo*/}
                         <Route path='/chartDemo' component={ChartDemo}/>{/*图表测试页面*/}

+ 1 - 1
frontend/wechat-web/src/modules/vote/VoteListParent.jsx

@@ -164,7 +164,7 @@ class VoteListParent extends Component {
             pageIndex: mPageIndex,
             itemIndex: index,
         })()
-        this.props.history.push('/voteDetail/' + voteId +'/parent')
+        this.props.history.push('/voteDetail/parent/' + voteId)
     }
 }
 

+ 1 - 1
frontend/wechat-web/src/modules/vote/VoteListTeacher.jsx

@@ -356,7 +356,7 @@ class VoteListTeacher extends Component {
 
     onItemClick = (index, voteId) => {
         this.saveListStatus(false, index)
-        this.props.history.push('/voteDetail/' + voteId+'/'+'teacher')
+        this.props.history.push('/voteDetail/teacher/' + voteId)
     }
 
     onAddVote = () => {