|
@@ -3,9 +3,12 @@ package com.xhkjedu.sapi.service.research;
|
3
|
3
|
import com.xhkjedu.sapi.listener.MessageSender;
|
4
|
4
|
import com.xhkjedu.sapi.mapper.research.ResearchMapper;
|
5
|
5
|
import com.xhkjedu.sapi.mapper.research.ResearchUserMapper;
|
|
6
|
+import com.xhkjedu.sapi.model.research.TResearch;
|
6
|
7
|
import com.xhkjedu.sapi.model.research.TResearchUser;
|
|
8
|
+import com.xhkjedu.sapi.vo.research.CompareUserVo;
|
7
|
9
|
import com.xhkjedu.sapi.vo.research.ResearchUserVo;
|
8
|
10
|
import com.xhkjedu.utils.N_Utils;
|
|
11
|
+import com.xhkjedu.vo.ResultVo;
|
9
|
12
|
import org.springframework.beans.factory.annotation.Autowired;
|
10
|
13
|
import org.springframework.stereotype.Service;
|
11
|
14
|
|
|
@@ -71,9 +74,10 @@ public class ResearchUserService {
|
71
|
74
|
messageSender.convertVideo(researchUserVo.getResearchid(), researchUserVo.getResearchpath());
|
72
|
75
|
}
|
73
|
76
|
|
74
|
|
- // 如果教研是公开的,则获取所有已提交教研
|
75
|
|
- if (researchUserVo.getPubliced() == 0) {
|
76
|
|
- List<Map> schools = researchUserMapper.listReaearchSchools(researchid, researchUserVo.getSchoolid());
|
|
77
|
+ int publiced = researchUserVo.getPubliced();
|
|
78
|
+ // 如果教研是公开的,则获取所有已提交教研publiced:是否公开0不公开1校内公开2全部公开
|
|
79
|
+ if (publiced > 0) {
|
|
80
|
+ List<Map> schools = researchUserMapper.listReaearchSchools(researchid,publiced, researchUserVo.getSchoolid());
|
77
|
81
|
// 去除学校中未参与评价教师
|
78
|
82
|
for (int i = 0; i < schools.size(); i++) {
|
79
|
83
|
List<Map> commitRusers = new ArrayList<>();
|
|
@@ -81,11 +85,11 @@ public class ResearchUserService {
|
81
|
85
|
for (int j = 0; j < rusers.size(); j++) {
|
82
|
86
|
Map map = rusers.get(j);
|
83
|
87
|
Integer rustate = Integer.parseInt(map.get("rustate").toString());
|
84
|
|
- if(rustate!=null && rustate == 1){
|
|
88
|
+ if (rustate != null && rustate == 1) {
|
85
|
89
|
commitRusers.add(map);
|
86
|
90
|
}
|
87
|
91
|
}
|
88
|
|
- schools.get(i).put("rusers",commitRusers);
|
|
92
|
+ schools.get(i).put("rusers", commitRusers);
|
89
|
93
|
}
|
90
|
94
|
researchUserVo.setSchools(schools);
|
91
|
95
|
}
|
|
@@ -131,4 +135,68 @@ public class ResearchUserService {
|
131
|
135
|
public Integer noEvaluatedNum(Integer userid) {
|
132
|
136
|
return researchUserMapper.noEvaluatedNum(userid, N_Utils.getSecondTimestamp());
|
133
|
137
|
}
|
|
138
|
+
|
|
139
|
+ //判断修改1教研是否为自己发布的2在截至时间之前
|
|
140
|
+ private CompareUserVo getReachStoptimeCompareNow(Integer ruid, Integer userid) {
|
|
141
|
+ CompareUserVo compareUserVo = new CompareUserVo();
|
|
142
|
+
|
|
143
|
+ // 获取教研截至时间和教师id
|
|
144
|
+ TResearch research = researchUserMapper.getResearchStoptime(ruid);
|
|
145
|
+
|
|
146
|
+ //先获取当前登录用户和要修改的用户是否为同一个
|
|
147
|
+ if(userid.equals(research.getUserid())){
|
|
148
|
+ compareUserVo.setSameuser(1);
|
|
149
|
+ }else{
|
|
150
|
+ compareUserVo.setSameuser(0);
|
|
151
|
+ }
|
|
152
|
+
|
|
153
|
+ Integer nowtime = N_Utils.getSecondTimestamp();// 当前时间
|
|
154
|
+ Integer stoptime = research.getStoptime();//教研截至时间
|
|
155
|
+ int compresult = nowtime.compareTo(stoptime);
|
|
156
|
+ if (compresult == -1 || compresult == 0) {
|
|
157
|
+ compareUserVo.setComparetime(1);
|
|
158
|
+ }else {
|
|
159
|
+ compareUserVo.setComparetime(0);
|
|
160
|
+ }
|
|
161
|
+
|
|
162
|
+ return compareUserVo;
|
|
163
|
+ }
|
|
164
|
+
|
|
165
|
+ // 删除教研
|
|
166
|
+ public ResultVo delTeacherResearch(TResearchUser ruser){
|
|
167
|
+ CompareUserVo compareUserVo = getReachStoptimeCompareNow(ruser.getRuid(),ruser.getUserid());
|
|
168
|
+ if(compareUserVo.getSameuser() != 1){
|
|
169
|
+ return new ResultVo(1,"只能删除自己发布的教研");
|
|
170
|
+ }
|
|
171
|
+
|
|
172
|
+ if(compareUserVo.getComparetime() != 1){
|
|
173
|
+ return new ResultVo(1,"教研已结束禁止操作");
|
|
174
|
+ }
|
|
175
|
+ Integer rtn = researchUserMapper.delTeacherResearch(ruser.getRuid());
|
|
176
|
+ if(rtn > 0){
|
|
177
|
+ return new ResultVo(0,"删除成功");
|
|
178
|
+ }else {
|
|
179
|
+ return new ResultVo(1,"删除失败");
|
|
180
|
+ }
|
|
181
|
+ }
|
|
182
|
+
|
|
183
|
+ // 修改教研
|
|
184
|
+ public ResultVo updateTeacherResearch(TResearchUser ruser) {
|
|
185
|
+ CompareUserVo compareUserVo = getReachStoptimeCompareNow(ruser.getRuid(),ruser.getUserid());
|
|
186
|
+ if(compareUserVo.getSameuser() != 1){
|
|
187
|
+ return new ResultVo(1,"只能编辑自己发布的教研");
|
|
188
|
+ }
|
|
189
|
+
|
|
190
|
+ if(compareUserVo.getComparetime() != 1){
|
|
191
|
+ return new ResultVo(1,"教研已结束禁止操作");
|
|
192
|
+ }
|
|
193
|
+ ruser.setReviewtime(N_Utils.getSecondTimestamp());
|
|
194
|
+ Integer rtn = researchUserMapper.updateTeacherResearch(ruser);
|
|
195
|
+ if(rtn > 0){
|
|
196
|
+ return new ResultVo(0,"保存成功");
|
|
197
|
+ }else {
|
|
198
|
+ return new ResultVo(1,"保存失败");
|
|
199
|
+ }
|
|
200
|
+ }
|
|
201
|
+
|
134
|
202
|
}
|