|
@@ -35,7 +35,7 @@ import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 类注释
|
|
|
|
|
|
+ * {@link StatusException} 状态码范围:056XXX<br>
|
|
*
|
|
*
|
|
* @author WANGWEI
|
|
* @author WANGWEI
|
|
* @date 2018年8月14日
|
|
* @date 2018年8月14日
|
|
@@ -162,14 +162,64 @@ public class StudentCloudServiceProvider extends ControllerSupport implements St
|
|
@PostMapping("updatePassword")
|
|
@PostMapping("updatePassword")
|
|
@Override
|
|
@Override
|
|
public UpdatePasswordResp updatePassword(@RequestBody UpdatePasswordReq req) {
|
|
public UpdatePasswordResp updatePassword(@RequestBody UpdatePasswordReq req) {
|
|
- return null;
|
|
|
|
|
|
+ Long rootOrgId = req.getRootOrgId();
|
|
|
|
+ String identityNumber = req.getIdentityNumber();
|
|
|
|
+ Long studentId = req.getStudentId();
|
|
|
|
+ String password = req.getPassword();
|
|
|
|
+
|
|
|
|
+ StudentEntity entity = null;
|
|
|
|
+ if (null != studentId) {
|
|
|
|
+ entity = GlobalHelper.getEntity(studentRepo, studentId, StudentEntity.class);
|
|
|
|
+ } else if (StringUtils.isNotBlank(identityNumber)) {
|
|
|
|
+ if (null == rootOrgId) {
|
|
|
|
+ throw new StatusException("056001", "rootOrgId is needed");
|
|
|
|
+ }
|
|
|
|
+ entity = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber, rootOrgId);
|
|
|
|
+ } else {
|
|
|
|
+ throw new StatusException("056002", "params is missing");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (null == entity) {
|
|
|
|
+ throw new StatusException("056003", "no student");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ entity.setPassword(password);
|
|
|
|
+ studentRepo.save(entity);
|
|
|
|
+
|
|
|
|
+ UpdatePasswordResp resp = new UpdatePasswordResp();
|
|
|
|
+ return resp;
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "更新学生状态")
|
|
@ApiOperation(value = "更新学生状态")
|
|
@PostMapping("updateStudentStatus")
|
|
@PostMapping("updateStudentStatus")
|
|
@Override
|
|
@Override
|
|
public UpdateStudentStatusResp updateStudentStatus(@RequestBody UpdateStudentStatusReq req) {
|
|
public UpdateStudentStatusResp updateStudentStatus(@RequestBody UpdateStudentStatusReq req) {
|
|
- return null;
|
|
|
|
|
|
+ Long rootOrgId = req.getRootOrgId();
|
|
|
|
+ String identityNumber = req.getIdentityNumber();
|
|
|
|
+ Long studentId = req.getStudentId();
|
|
|
|
+ Boolean enable = req.getEnable();
|
|
|
|
+
|
|
|
|
+ StudentEntity entity = null;
|
|
|
|
+ if (null != studentId) {
|
|
|
|
+ entity = GlobalHelper.getEntity(studentRepo, studentId, StudentEntity.class);
|
|
|
|
+ } else if (StringUtils.isNotBlank(identityNumber)) {
|
|
|
|
+ if (null == rootOrgId) {
|
|
|
|
+ throw new StatusException("056004", "rootOrgId is needed");
|
|
|
|
+ }
|
|
|
|
+ entity = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber, rootOrgId);
|
|
|
|
+ } else {
|
|
|
|
+ throw new StatusException("056005", "params is missing");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (null == entity) {
|
|
|
|
+ throw new StatusException("056006", "no student");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ entity.setEnable(enable);
|
|
|
|
+ studentRepo.save(entity);
|
|
|
|
+
|
|
|
|
+ UpdateStudentStatusResp resp = new UpdateStudentStatusResp();
|
|
|
|
+ return resp;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|