|
@@ -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
|
|
|
@@ -81,11 +84,11 @@ public class ResearchUserService {
|
81
|
84
|
for (int j = 0; j < rusers.size(); j++) {
|
82
|
85
|
Map map = rusers.get(j);
|
83
|
86
|
Integer rustate = Integer.parseInt(map.get("rustate").toString());
|
84
|
|
- if(rustate!=null && rustate == 1){
|
|
87
|
+ if (rustate != null && rustate == 1) {
|
85
|
88
|
commitRusers.add(map);
|
86
|
89
|
}
|
87
|
90
|
}
|
88
|
|
- schools.get(i).put("rusers",commitRusers);
|
|
91
|
+ schools.get(i).put("rusers", commitRusers);
|
89
|
92
|
}
|
90
|
93
|
researchUserVo.setSchools(schools);
|
91
|
94
|
}
|
|
@@ -131,4 +134,68 @@ public class ResearchUserService {
|
131
|
134
|
public Integer noEvaluatedNum(Integer userid) {
|
132
|
135
|
return researchUserMapper.noEvaluatedNum(userid, N_Utils.getSecondTimestamp());
|
133
|
136
|
}
|
|
137
|
+
|
|
138
|
+ //判断修改1教研是否为自己发布的2在截至时间之前
|
|
139
|
+ private CompareUserVo getReachStoptimeCompareNow(Integer ruid, Integer userid) {
|
|
140
|
+ CompareUserVo compareUserVo = new CompareUserVo();
|
|
141
|
+
|
|
142
|
+ // 获取教研截至时间和教师id
|
|
143
|
+ TResearch research = researchUserMapper.getResearchStoptime(ruid);
|
|
144
|
+
|
|
145
|
+ //先获取当前登录用户和要修改的用户是否为同一个
|
|
146
|
+ if(userid.equals(research.getUserid())){
|
|
147
|
+ compareUserVo.setSameuser(1);
|
|
148
|
+ }else{
|
|
149
|
+ compareUserVo.setSameuser(0);
|
|
150
|
+ }
|
|
151
|
+
|
|
152
|
+ Integer nowtime = N_Utils.getSecondTimestamp();// 当前时间
|
|
153
|
+ Integer stoptime = research.getStoptime();//教研截至时间
|
|
154
|
+ int compresult = nowtime.compareTo(stoptime);
|
|
155
|
+ if (compresult == -1 || compresult == 0) {
|
|
156
|
+ compareUserVo.setComparetime(1);
|
|
157
|
+ }else {
|
|
158
|
+ compareUserVo.setComparetime(0);
|
|
159
|
+ }
|
|
160
|
+
|
|
161
|
+ return compareUserVo;
|
|
162
|
+ }
|
|
163
|
+
|
|
164
|
+ // 删除教研
|
|
165
|
+ public ResultVo delTeacherResearch(TResearchUser ruser){
|
|
166
|
+ CompareUserVo compareUserVo = getReachStoptimeCompareNow(ruser.getRuid(),ruser.getUserid());
|
|
167
|
+ if(compareUserVo.getSameuser() != 1){
|
|
168
|
+ return new ResultVo(1,"只能删除自己发布的教研");
|
|
169
|
+ }
|
|
170
|
+
|
|
171
|
+ if(compareUserVo.getComparetime() != 1){
|
|
172
|
+ return new ResultVo(1,"教研已结束禁止操作");
|
|
173
|
+ }
|
|
174
|
+ Integer rtn = researchUserMapper.delTeacherResearch(ruser.getRuid());
|
|
175
|
+ if(rtn > 0){
|
|
176
|
+ return new ResultVo(0,"删除成功");
|
|
177
|
+ }else {
|
|
178
|
+ return new ResultVo(1,"删除失败");
|
|
179
|
+ }
|
|
180
|
+ }
|
|
181
|
+
|
|
182
|
+ // 修改教研
|
|
183
|
+ public ResultVo updateTeacherResearch(TResearchUser ruser) {
|
|
184
|
+ CompareUserVo compareUserVo = getReachStoptimeCompareNow(ruser.getRuid(),ruser.getUserid());
|
|
185
|
+ if(compareUserVo.getSameuser() != 1){
|
|
186
|
+ return new ResultVo(1,"只能编辑自己发布的教研");
|
|
187
|
+ }
|
|
188
|
+
|
|
189
|
+ if(compareUserVo.getComparetime() != 1){
|
|
190
|
+ return new ResultVo(1,"教研已结束禁止操作");
|
|
191
|
+ }
|
|
192
|
+ ruser.setReviewtime(N_Utils.getSecondTimestamp());
|
|
193
|
+ Integer rtn = researchUserMapper.updateTeacherResearch(ruser);
|
|
194
|
+ if(rtn > 0){
|
|
195
|
+ return new ResultVo(0,"保存成功");
|
|
196
|
+ }else {
|
|
197
|
+ return new ResultVo(1,"保存失败");
|
|
198
|
+ }
|
|
199
|
+ }
|
|
200
|
+
|
134
|
201
|
}
|