Ver código fonte

提交app代码

weiwenhai 6 anos atrás
pai
commit
bf0d9cd006

+ 7 - 1
src/main/java/cn/com/qmth/examcloud/app/controller/UserAuthRestController.java

@@ -37,7 +37,7 @@ public class UserAuthRestController {
     private BaseInfoService baseInfoService;
 
     @ApiOperation(value = "登录接口", notes = "参数accountType值说明:学生身份证号类型=STUDENT_IDENTITY_NUMBER,学生学号类型=STUDENT_CODE,学生手机号类型=STUDENT_PHONE")
-    @RequestMapping(value = "/user/login", method = {RequestMethod.GET, RequestMethod.POST})
+    @RequestMapping(value = {"/user/login","/user/verify"}, method = {RequestMethod.GET, RequestMethod.POST})
     public Result<UserInfo> login(@RequestParam String account, @RequestParam String password, @RequestParam String accountType, @RequestParam(required = false) Long rootOrgId,
                                   @RequestParam(required = false) String domain, @RequestHeader String deviceId) throws Exception {
         LoginInfo loginInfo = new LoginInfo(account, password, accountType, rootOrgId, domain, deviceId);
@@ -74,6 +74,12 @@ public class UserAuthRestController {
                                  @RequestParam String newPassword) throws Exception {
         return userAuthService.updateStudentPassword(key, token, studentId, password, newPassword);
     }
+    
+    @ApiOperation(value = "重置密码接口")
+    @RequestMapping(value = "/user/reset/password", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result updateNewPassword(@RequestHeader String key, @RequestHeader String token, @RequestParam Long studentId, @RequestParam String newPassword) throws Exception {
+        return userAuthService.resetStudentPassword(key, token, newPassword);
+    }
 
     @ApiOperation(value = "保存用户绑定的手机号接口")
     @RequestMapping(value = "/user/binding/phone", method = {RequestMethod.GET, RequestMethod.POST})

+ 11 - 0
src/main/java/cn/com/qmth/examcloud/app/service/UserAuthService.java

@@ -61,6 +61,17 @@ public interface UserAuthService {
      * @throws Exception
      */
     Result updateStudentPassword(String key, String token, Long studentId, String password, String newPassword) throws Exception;
+    
+    /**
+     * 重置密码
+     * 
+     * @param key
+     * @param token
+     * @param newPassword
+     * @return
+     * @throws Exception
+     */
+    Result resetStudentPassword(String key, String token, String newPassword) throws Exception;
 
     /**
      * 获取短信验证码

+ 11 - 0
src/main/java/cn/com/qmth/examcloud/app/service/impl/UserAuthServiceImpl.java

@@ -17,6 +17,7 @@ import cn.com.qmth.examcloud.app.service.PropertyService;
 import cn.com.qmth.examcloud.app.service.RedisService;
 import cn.com.qmth.examcloud.app.service.UserAuthService;
 import okhttp3.*;
+
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -117,6 +118,16 @@ public class UserAuthServiceImpl implements UserAuthService {
                 .build();
         return HttpUtils.doPut(requestUrl, formBody, key, token);
     }
+    
+    @Override
+    public Result resetStudentPassword(String key, String token, String newPassword) throws Exception {
+        //封装请求参数
+        final String requestUrl = String.format("%s/api/ecs_core/student/password/direct", propertyService.getUserAuthUrl());
+        RequestBody formBody = new FormBody.Builder()
+                .add("newPassword", newPassword)
+                .build();
+        return HttpUtils.doPut(requestUrl, formBody, key, token);
+    }
 
     @Override
     public Result sendSmsCode(String key, String token, String phone) throws Exception {