|
@@ -1,37 +1,41 @@
|
|
|
package com.jpsoft.education.modules.mobile.controller;
|
|
|
|
|
|
-import cn.hutool.core.lang.Validator;
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.UUID;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
+
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.joda.time.DateTime;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.data.redis.core.ValueOperations;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestAttribute;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.github.pagehelper.Page;
|
|
|
import com.jpsoft.education.modules.base.entity.Employee;
|
|
|
import com.jpsoft.education.modules.base.entity.RegUser;
|
|
|
import com.jpsoft.education.modules.base.entity.Student;
|
|
|
import com.jpsoft.education.modules.base.service.EmployeeService;
|
|
|
import com.jpsoft.education.modules.base.service.RegUserService;
|
|
|
import com.jpsoft.education.modules.base.service.StudentService;
|
|
|
-import com.jpsoft.education.modules.common.dto.Sort;
|
|
|
-import com.jpsoft.education.modules.common.utils.JwtUtil;
|
|
|
-import com.jpsoft.education.modules.common.utils.PojoUtils;
|
|
|
import com.jpsoft.education.modules.common.dto.MessageResult;
|
|
|
+import com.jpsoft.education.modules.common.utils.JwtUtil;
|
|
|
import com.jpsoft.education.modules.common.utils.SMSUtil;
|
|
|
import com.jpsoft.education.modules.sys.entity.SysLog;
|
|
|
import com.jpsoft.education.modules.sys.service.SysLogService;
|
|
|
+
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.joda.time.DateTime;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.data.redis.core.ValueOperations;
|
|
|
-import org.springframework.format.annotation.DateTimeFormat;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.util.*;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
@Slf4j
|
|
|
@RestController
|
|
@@ -262,12 +266,17 @@ public class RegUserApiController {
|
|
|
try {
|
|
|
String key = "SMS_" + telephone;
|
|
|
|
|
|
- RegUser regUser = regUserService.findByPhone(telephone);
|
|
|
-
|
|
|
- if (regUser != null && regUser.getUserType().contains("2")) {
|
|
|
- //教师
|
|
|
- } else {
|
|
|
- throw new Exception("该手机号未注册!");
|
|
|
+ /*
|
|
|
+ * RegUser regUser = regUserService.findByPhone(telephone);
|
|
|
+ *
|
|
|
+ * if (regUser != null && regUser.getUserType().contains("2")) { //教师 } else {
|
|
|
+ * throw new Exception("该手机号未注册!"); }
|
|
|
+ */
|
|
|
+ Employee employee=employeeService.getByPhone(telephone);
|
|
|
+ if(employee==null) {
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage("该手机号未登记,请联系管理员");
|
|
|
+ return messageResult;
|
|
|
}
|
|
|
|
|
|
//1分钟限制
|
|
@@ -365,6 +374,8 @@ public class RegUserApiController {
|
|
|
regUser.setHeadImg(headImg);
|
|
|
}
|
|
|
regUserService.insert(regUser);
|
|
|
+ employeeService.updateForBindReg(regUser.getId(), telephone);
|
|
|
+ token = JwtUtil.createToken(jwtSecret, regUser.getId(), DateTime.now().plusHours(6).toDate());
|
|
|
|
|
|
}
|
|
|
}
|