浏览代码

Merge remote-tracking branch 'origin/wn' into ywx

tags/正式3.10.0
雍文秀 1年前
父节点
当前提交
d6fba7f984

+ 48
- 28
sapi/src/main/java/com/xhkjedu/sapi/service/research/ResearchUserService.java 查看文件

@@ -9,6 +9,7 @@ import com.xhkjedu.utils.N_Utils;
9 9
 import org.springframework.beans.factory.annotation.Autowired;
10 10
 import org.springframework.stereotype.Service;
11 11
 
12
+import java.util.ArrayList;
12 13
 import java.util.List;
13 14
 import java.util.Map;
14 15
 
@@ -28,48 +29,64 @@ public class ResearchUserService {
28 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 36
      * @author WN
33 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 47
      * @param rorder
47 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 61
      * @author WN
56 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 67
         researchMapper.updateReadnum(researchid);
64 68
 
65
-        //视频转换mq
69
+        // 视频转换mq
66 70
         if (!researchUserVo.getMp4code().equals("h264")) {
67 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 90
             researchUserVo.setSchools(schools);
74 91
         }
75 92
 
@@ -77,24 +94,26 @@ public class ResearchUserService {
77 94
     }
78 95
 
79 96
     /**
80
-     *功能描述 教师--保存教研评价
97
+     * 功能描述 教师--保存教研评价
98
+     *
99
+     * @param * @param ru
100
+     * @return java.lang.Integer
81 101
      * @author WN
82 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 106
         ru.setReviewtime(N_Utils.getSecondTimestamp());
89 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 114
      * @Param [research]
95 115
      * @Author ywx
96 116
      * @Date 2020/6/23 14:24
97
-     * @return java.util.List<com.xhkjedu.vo.research.ResearchVo>
98 117
      **/
99 118
     public List<Map> otherList(TResearchUser research) {
100 119
         research.setCreatetime(N_Utils.getSecondTimestamp());
@@ -103,10 +122,11 @@ public class ResearchUserService {
103 122
 
104 123
     /**
105 124
      * 教师未评价教研数量
125
+     *
126
+     * @return java.lang.Integer
106 127
      * @Param [userid]
107 128
      * @Author ywx
108 129
      * @Date 2020/7/24 10:45
109
-     * @return java.lang.Integer
110 130
      **/
111 131
     public Integer noEvaluatedNum(Integer userid) {
112 132
         return researchUserMapper.noEvaluatedNum(userid, N_Utils.getSecondTimestamp());

+ 3
- 2
sapi/src/main/resources/mapper/research/ResearchUserMapper.xml 查看文件

@@ -94,16 +94,17 @@
94 94
             <result column="userid" property="userid"></result>
95 95
             <result column="content" property="content"></result>
96 96
             <result column="reviewtime" property="reviewtime"></result>
97
+            <result column="rustate" property="rustate"></result>
97 98
             <result column="createname" property="createname"></result>
98 99
             <result column="headpic" property="headpic"></result>
99 100
         </collection>
100 101
     </resultMap>
101 102
     <!--教研学校用户-->
102 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 105
         u.username createname,u.headpic
105 106
         from t_research_user ru left join t_user u on ru.userid=u.userid
106 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 109
     </select>
109 110
 </mapper>

正在加载...
取消
保存