Browse Source

完善教研详情

tags/正式3.10.0
王宁 1 year ago
parent
commit
bf7f88e256

+ 48
- 28
sapi/src/main/java/com/xhkjedu/sapi/service/research/ResearchUserService.java View File

9
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.stereotype.Service;
10
 import org.springframework.stereotype.Service;
11
 
11
 
12
+import java.util.ArrayList;
12
 import java.util.List;
13
 import java.util.List;
13
 import java.util.Map;
14
 import java.util.Map;
14
 
15
 
28
     private MessageSender messageSender;
29
     private MessageSender messageSender;
29
 
30
 
30
     /**
31
     /**
31
-     *功能描述  参与评论集合
32
+     * 功能描述  参与评论集合
33
+     *
34
+     * @param * @param researchid
35
+     * @return java.util.List<com.xhkjedu.model.research.TResearchUser>
32
      * @author WN
36
      * @author WN
33
      * @date 2020/6/11
37
      * @date 2020/6/11
34
-     * @param  * @param researchid
35
-     * @return java.util.List<com.xhkjedu.model.research.TResearchUser>
36
      */
38
      */
37
-    public List<Map> listRusersByReaearchid(Integer researchid,Integer schoolid){
38
-        return researchUserMapper.listRusersByReaearchid(researchid,schoolid);
39
+    public List<Map> listRusersByReaearchid(Integer researchid, Integer schoolid) {
40
+        return researchUserMapper.listRusersByReaearchid(researchid, schoolid);
39
     }
41
     }
40
 
42
 
41
     /**
43
     /**
42
-     *功能描述 教师--参与教研集合
43
-     * @author WN
44
-     * @date 2020/6/12
45
-     * @param  * @param userid
44
+     * 功能描述 教师--参与教研集合
45
+     *
46
+     * @param *      @param userid
46
      * @param rorder
47
      * @param rorder
47
      * @return java.util.List<com.xhkjedu.vo.research.ResearchVo>
48
      * @return java.util.List<com.xhkjedu.vo.research.ResearchVo>
49
+     * @author WN
50
+     * @date 2020/6/12
48
      */
51
      */
49
-    public List<Map> listUserResearchs(Integer userid, String rorder, Integer rustate){
50
-        return researchUserMapper.listUserResearchs(userid,rorder,rustate,N_Utils.getSecondTimestamp());
52
+    public List<Map> listUserResearchs(Integer userid, String rorder, Integer rustate) {
53
+        return researchUserMapper.listUserResearchs(userid, rorder, rustate, N_Utils.getSecondTimestamp());
51
     }
54
     }
52
 
55
 
53
     /**
56
     /**
54
-     *功能描述 教师--获取教研详情
57
+     * 功能描述 教师--获取教研详情
58
+     *
59
+     * @param * @param researchid
60
+     * @return com.xhkjedu.model.research.TResearch
55
      * @author WN
61
      * @author WN
56
      * @date 2020/6/12
62
      * @date 2020/6/12
57
-     * @param  * @param researchid
58
-     * @return com.xhkjedu.model.research.TResearch
59
      */
63
      */
60
-    public ResearchUserVo getResearchUserDetail(Integer researchid,Integer userid){
61
-        ResearchUserVo researchUserVo = researchUserMapper.getResearchUserDetail(researchid,userid);
62
-        //更改阅读次数
64
+    public ResearchUserVo getResearchUserDetail(Integer researchid, Integer userid) {
65
+        ResearchUserVo researchUserVo = researchUserMapper.getResearchUserDetail(researchid, userid);
66
+        // 更改阅读次数
63
         researchMapper.updateReadnum(researchid);
67
         researchMapper.updateReadnum(researchid);
64
 
68
 
65
-        //视频转换mq
69
+        // 视频转换mq
66
         if (!researchUserVo.getMp4code().equals("h264")) {
70
         if (!researchUserVo.getMp4code().equals("h264")) {
67
             messageSender.convertVideo(researchUserVo.getResearchid(), researchUserVo.getResearchpath());
71
             messageSender.convertVideo(researchUserVo.getResearchid(), researchUserVo.getResearchpath());
68
         }
72
         }
69
 
73
 
70
-        //如果教研是公开的,则获取所有已提交教研
71
-        if(researchUserVo.getPubliced() == 0){
72
-            List<Map> schools = researchUserMapper.listReaearchSchools(researchid,researchUserVo.getSchoolid());
74
+        // 如果教研是公开的,则获取所有已提交教研
75
+        if (researchUserVo.getPubliced() == 0) {
76
+            List<Map> schools = researchUserMapper.listReaearchSchools(researchid, researchUserVo.getSchoolid());
77
+            // 去除学校中未参与评价教师
78
+            for (int i = 0; i < schools.size(); i++) {
79
+                List<Map> commitRusers = new ArrayList<>();
80
+                List<Map> rusers = (List<Map>) schools.get(i).get("rusers");
81
+                for (int j = 0; j < rusers.size(); j++) {
82
+                    Map map = rusers.get(j);
83
+                    Integer rustate = Integer.parseInt(map.get("rustate").toString());
84
+                    if(rustate!=null && rustate == 1){
85
+                        commitRusers.add(map);
86
+                    }
87
+                }
88
+                schools.get(i).put("rusers",commitRusers);
89
+            }
73
             researchUserVo.setSchools(schools);
90
             researchUserVo.setSchools(schools);
74
         }
91
         }
75
 
92
 
77
     }
94
     }
78
 
95
 
79
     /**
96
     /**
80
-     *功能描述 教师--保存教研评价
97
+     * 功能描述 教师--保存教研评价
98
+     *
99
+     * @param * @param ru
100
+     * @return java.lang.Integer
81
      * @author WN
101
      * @author WN
82
      * @date 2020/6/12
102
      * @date 2020/6/12
83
-     * @param  * @param ru
84
-     * @return java.lang.Integer
85
      */
103
      */
86
-    public Integer updateUserResearch(TResearchUser ru){
87
-        ru.setRustate(1);//状态0未评1已评
104
+    public Integer updateUserResearch(TResearchUser ru) {
105
+        ru.setRustate(1);// 状态0未评1已评
88
         ru.setReviewtime(N_Utils.getSecondTimestamp());
106
         ru.setReviewtime(N_Utils.getSecondTimestamp());
89
         return researchUserMapper.updateUserResearch(ru);
107
         return researchUserMapper.updateUserResearch(ru);
90
     }
108
     }
91
 
109
 
92
     /**
110
     /**
93
      * 其他教研活动列表
111
      * 其他教研活动列表
112
+     *
113
+     * @return java.util.List<com.xhkjedu.vo.research.ResearchVo>
94
      * @Param [research]
114
      * @Param [research]
95
      * @Author ywx
115
      * @Author ywx
96
      * @Date 2020/6/23 14:24
116
      * @Date 2020/6/23 14:24
97
-     * @return java.util.List<com.xhkjedu.vo.research.ResearchVo>
98
      **/
117
      **/
99
     public List<Map> otherList(TResearchUser research) {
118
     public List<Map> otherList(TResearchUser research) {
100
         research.setCreatetime(N_Utils.getSecondTimestamp());
119
         research.setCreatetime(N_Utils.getSecondTimestamp());
103
 
122
 
104
     /**
123
     /**
105
      * 教师未评价教研数量
124
      * 教师未评价教研数量
125
+     *
126
+     * @return java.lang.Integer
106
      * @Param [userid]
127
      * @Param [userid]
107
      * @Author ywx
128
      * @Author ywx
108
      * @Date 2020/7/24 10:45
129
      * @Date 2020/7/24 10:45
109
-     * @return java.lang.Integer
110
      **/
130
      **/
111
     public Integer noEvaluatedNum(Integer userid) {
131
     public Integer noEvaluatedNum(Integer userid) {
112
         return researchUserMapper.noEvaluatedNum(userid, N_Utils.getSecondTimestamp());
132
         return researchUserMapper.noEvaluatedNum(userid, N_Utils.getSecondTimestamp());

+ 3
- 2
sapi/src/main/resources/mapper/research/ResearchUserMapper.xml View File

94
             <result column="userid" property="userid"></result>
94
             <result column="userid" property="userid"></result>
95
             <result column="content" property="content"></result>
95
             <result column="content" property="content"></result>
96
             <result column="reviewtime" property="reviewtime"></result>
96
             <result column="reviewtime" property="reviewtime"></result>
97
+            <result column="rustate" property="rustate"></result>
97
             <result column="createname" property="createname"></result>
98
             <result column="createname" property="createname"></result>
98
             <result column="headpic" property="headpic"></result>
99
             <result column="headpic" property="headpic"></result>
99
         </collection>
100
         </collection>
100
     </resultMap>
101
     </resultMap>
101
     <!--教研学校用户-->
102
     <!--教研学校用户-->
102
     <select id="listReaearchSchools" resultMap="researchSchoolUser">
103
     <select id="listReaearchSchools" resultMap="researchSchoolUser">
103
-        select ru.schoolid,s.schoolname,ru.ruid,ru.userid,ru.content,ru.reviewtime,
104
+        select ru.schoolid,s.schoolname,ru.ruid,ru.userid,ru.content,ru.reviewtime,ru.rustate,
104
         u.username createname,u.headpic
105
         u.username createname,u.headpic
105
         from t_research_user ru left join t_user u on ru.userid=u.userid
106
         from t_research_user ru left join t_user u on ru.userid=u.userid
106
         left join t_school s on ru.schoolid=s.schoolid
107
         left join t_school s on ru.schoolid=s.schoolid
107
-        where ru.researchid=#{researchid} and ru.rustate=1 order by ru.schoolid=#{schoolid},ru.schoolid,ru.reviewtime desc
108
+        where ru.researchid=#{researchid} order by ru.schoolid=#{schoolid},ru.schoolid,ru.reviewtime desc
108
     </select>
109
     </select>
109
 </mapper>
110
 </mapper>

Loading…
Cancel
Save