|
@@ -29,6 +29,7 @@ import cn.com.qmth.examcloud.commons.base.util.ErrorMsg;
|
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.constants.Consts;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.Student;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.impl.StudentServiceImpl;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -134,11 +135,11 @@ public class StudentController extends ControllerSupport {
|
|
|
List<Long> studentIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
.collect(Collectors.toList());
|
|
|
List<String> ret = Lists.newArrayList();
|
|
|
- for (Long userId : studentIds) {
|
|
|
- Student user = studentRepo.findOne(userId);
|
|
|
- user.setEnable(true);
|
|
|
- studentRepo.save(user);
|
|
|
- ret.add(user.getId() + ":" + user.getName());
|
|
|
+ for (Long cur : studentIds) {
|
|
|
+ Student s = studentRepo.findOne(cur);
|
|
|
+ s.setEnable(true);
|
|
|
+ studentRepo.save(s);
|
|
|
+ ret.add(s.getId() + ":" + s.getName());
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
@@ -156,13 +157,25 @@ public class StudentController extends ControllerSupport {
|
|
|
List<Long> studentIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
.collect(Collectors.toList());
|
|
|
List<String> ret = Lists.newArrayList();
|
|
|
- for (Long userId : studentIds) {
|
|
|
- Student user = studentRepo.findOne(userId);
|
|
|
- user.setEnable(false);
|
|
|
- studentRepo.save(user);
|
|
|
- ret.add(user.getId() + ":" + user.getName());
|
|
|
+ for (Long cur : studentIds) {
|
|
|
+ Student s = studentRepo.findOne(cur);
|
|
|
+ s.setEnable(false);
|
|
|
+ studentRepo.save(s);
|
|
|
+ ret.add(s.getId() + ":" + s.getName());
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "重置用户密码", notes = "重置密码")
|
|
|
+ @PutMapping("/resetPass/{ids}")
|
|
|
+ public void resetPassword(@PathVariable String ids) {
|
|
|
+ List<Long> studentIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ for (Long cur : studentIds) {
|
|
|
+ Student s = studentRepo.findOne(cur);
|
|
|
+ s.setPassword(Consts.DEFAULT_PASSWORD);
|
|
|
+ studentRepo.save(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|