上传代码

hehai
zhiyong.ning 4 years ago
parent c9c3d1f14b
commit 30ad4b516c
  1. 3
      src/main/java/com/msdw/tms/api/StudentControllerApi.java
  2. 3
      src/main/java/com/msdw/tms/api/UserInfoControllerApi.java
  3. 3
      src/main/java/com/msdw/tms/config/SendSMS.java
  4. 47
      src/main/java/com/msdw/tms/controller/StudentController.java
  5. 47
      src/main/java/com/msdw/tms/controller/UserInfoController.java
  6. 1
      src/main/java/com/msdw/tms/entity/vo/StudentVo.java
  7. 2
      src/main/java/com/msdw/tms/service/UserInfoService.java
  8. 4
      src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java

@ -18,6 +18,9 @@ public interface StudentControllerApi {
@ApiOperation(value = "新增学生",notes = "新增学生")
public R addStudent(@RequestBody StudentVo studentVo);
@ApiOperation(value = "新增学生",notes = "新增学生")
public R zzAddStudent(@RequestBody StudentVo studentVo);
@ApiOperation(value = "学生列表信息",notes = "学生列表信息")
public R queryStudent(Integer schoolId, String seachContent, Integer page, Integer size);

@ -26,6 +26,9 @@ public interface UserInfoControllerApi {
@ApiOperation(value = "注册",notes = "注册")
R save(UserInfoEntity entity,@ApiParam(value = "学号",required = true)String workNumber);
@ApiOperation(value = "注册",notes = "注册")
R zzAdd(UserInfoEntity entity,@ApiParam(value = "学号",required = true)String workNumber);
@ApiOperation(value = "个人中心信息展示",notes = "个人中心信息展示")
R userInfo(Integer id);

@ -16,7 +16,7 @@ public class SendSMS {
private static final String PHONSMSTEMPLATE = "SMS_204155294";
public static void main(String[] args){
String mobile="17722612183";//需要接受短信验证码的手机号
String mobile="12345678910";//需要接受短信验证码的手机号
// String sendTemplate="SMS_204155294";//短信模板ID,需要去阿里云平台申请,审核通过后方能使用,通常是以"SMS_"开头字符串
String code = (int)((Math.random() * 9 + 1) * 100000)+ "";//要发送给用户的短信验证码,行业通常使用六位纯数字
@ -26,7 +26,6 @@ public class SendSMS {
}else{
System.out.println("短信发送失败");
}
}
/**
* 通过阿里云平台发送短信如果发送成功返回"OK" ;否则返回的是错误信息

@ -40,13 +40,13 @@ public class StudentController implements StudentControllerApi{
private UserInfoService userInfoService;
/**
* 新增学生
* 职站新增学生
* @param studentVo
* @return
*/
@Transactional
@Override
@PostMapping("/addStudent")
@PostMapping("/zzAddStudent")
public R addStudent(@RequestBody @Valid StudentVo studentVo){
studentVo.setSchoolId(ConstantUtils.Keda_schoolId);
String account = studentVo.getAccount();
@ -83,6 +83,49 @@ public class StudentController implements StudentControllerApi{
}
}
/**
* 科大新增学生
* @param studentVo
* @return
*/
@Transactional
@Override
@PostMapping("/addStudent")
public R zzAddStudent(@RequestBody @Valid StudentVo studentVo){
String account = studentVo.getAccount();
String phone = studentVo.getPhone();
Integer schoolId = studentVo.getSchoolId();
Integer result = studentService.queryStudentIdNumber(studentVo.getWorkNumber(),schoolId);
Integer res = userInfoService.queryStudentAccount(account,schoolId);
if (phone!=null&&phone!=""){
Integer outcome = userInfoService.queryStudentPhone(phone);
if(outcome==1){
return R.error("手机号不能重复,只能绑定一个用户");
}
}
String email = studentVo.getEmail();
if (result==1){
return R.error("学号不能重复");
}else if (res==1){
return R.error("账号不能重复");
}
else{
UserInfoEntity userInfoList = new UserInfoEntity();
userInfoList.setAccount(account)
.setPhone(phone)
.setEmail(studentVo.getEmail())
.setSchoolId(studentVo.getSchoolAppellationId())
.setUserName(studentVo.getUserName())
.setToken(new ConstantUtils().token);
userInfoService.saveUserInfo(userInfoList);
studentVo.setUserId(userInfoList.getUserId()).setPlatformId(ConstantUtils.PLATFORMID);//暂时写死平台id(PlatformId)
boolean saveStudent = studentService.saveStudent(studentVo);
return saveStudent ? R.ok() : R.error();
}
}
/**
* 学生列表
* @param schoolId

@ -62,7 +62,6 @@ public class UserInfoController implements UserInfoControllerApi {
public R save(@RequestBody UserInfoEntity userInfoEntity,@RequestParam String workNumber){
String token ="UT_"+ UUID.randomUUID().toString().replace("-", "");
userInfoEntity.setToken(token);
userInfoEntity.setSchoolId(2105);
Integer schoolId = userInfoEntity.getSchoolId();
Integer integer = userInfoService.queryStudentAccount(userInfoEntity.getAccount(),schoolId);
Integer integer1 = userInfoService.queryStudentPhone(userInfoEntity.getPhone());
@ -96,6 +95,48 @@ public class UserInfoController implements UserInfoControllerApi {
return studentService.addStudentInfo(studentVo);
}
/**
* 职站注册
*/
@Override
@Transactional
@PostMapping("/zzAdd")
public R zzAdd(@RequestBody UserInfoEntity userInfoEntity,@RequestParam String workNumber){
String token ="UT_"+ UUID.randomUUID().toString().replace("-", "");
userInfoEntity.setToken(token);
userInfoEntity.setSchoolId(2105);
Integer schoolId = userInfoEntity.getSchoolId();
Integer integer = userInfoService.queryStudentAccount(userInfoEntity.getAccount(),schoolId);
Integer integer1 = userInfoService.queryStudentPhone(userInfoEntity.getPhone());
//新增学生
StudentVo studentVo = new StudentVo();
studentVo.setRoleId(Integer.valueOf(userInfoEntity.getRoleId()));
studentVo.setSchoolId(schoolId);
studentVo.setIsdel(0);
studentVo.setWorkNumber(workNumber);
studentVo.setPlatformId(1);
//为1 学号有重复
int num = studentService.queryStudentByWorkNumber(studentVo);
if (integer==1){
return R.error(400,"账号已存在");
}
if (integer1==1){
return R.error(400,"该手机号已被绑定");
}
if (num == 1){
return R.error(400,"该学号重复!");
}
int userId = userInfoService.add(userInfoEntity);
if (userId==0){
return R.error(400,"添加用户信息失败");
}
// userInfoEntity.setUserId(userId);
studentVo.setUserId(userInfoEntity.getUserId());
return studentService.addStudentInfo(studentVo);
}
/**
* 修改
*/
@ -222,7 +263,7 @@ public class UserInfoController implements UserInfoControllerApi {
@Override
@GetMapping("/getUserId")
public R getUserId(@RequestParam String token){
Integer userId = userInfoService.getUserId(token);
return R.ok().put("userId", userId);
R result = userInfoService.getUserId(token);
return result;
}
}

@ -5,6 +5,7 @@ import com.msdw.tms.entity.UserInfoEntity;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.List;

@ -48,6 +48,6 @@ public interface UserInfoService extends IService<UserInfoEntity> {
R queryAccount();
Integer getUserId(String token);
R getUserId(String token);
}

@ -223,8 +223,8 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoDao, UserInfoEntity
}
@Override
public Integer getUserId(String token) {
public R getUserId(String token) {
Integer userId = userInfoDao.getUserId(token);
return userId;
return R.ok().put("userId", userId);
}
}

Loading…
Cancel
Save