rong.liu 4 years ago
commit fd3069ab89
  1. 2
      src/main/java/com/msdw/tms/api/UserInfoControllerApi.java
  2. 23
      src/main/java/com/msdw/tms/controller/UserInfoController.java
  3. 4
      src/main/java/com/msdw/tms/dao/StudentDao.java
  4. 3
      src/main/java/com/msdw/tms/service/StudentService.java
  5. 18
      src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java
  6. 5
      src/main/resources/mapper/tms/AchievementManagementDao.xml
  7. 8
      src/main/resources/mapper/tms/StudentDao.xml
  8. 1
      src/main/resources/mapper/tms/UserDao.xml

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

@ -8,6 +8,7 @@ import com.msdw.tms.entity.UserEntity;
import com.msdw.tms.entity.UserInfoEntity; import com.msdw.tms.entity.UserInfoEntity;
import com.msdw.tms.entity.UserPersonalFileEntity; import com.msdw.tms.entity.UserPersonalFileEntity;
import com.msdw.tms.entity.vo.CheckVo; import com.msdw.tms.entity.vo.CheckVo;
import com.msdw.tms.entity.vo.StudentVo;
import com.msdw.tms.entity.vo.UserEntityVo; import com.msdw.tms.entity.vo.UserEntityVo;
import com.msdw.tms.entity.vo.UserProsonalEntityVo; import com.msdw.tms.entity.vo.UserProsonalEntityVo;
import com.msdw.tms.service.StudentService; import com.msdw.tms.service.StudentService;
@ -58,27 +59,41 @@ public class UserInfoController implements UserInfoControllerApi {
@Override @Override
@Transactional @Transactional
@PostMapping("/add") @PostMapping("/add")
public R save(@RequestBody UserInfoEntity userInfoEntity){ public R save(@RequestBody UserInfoEntity userInfoEntity,@RequestParam String workNumber){
String token ="UT_"+ UUID.randomUUID().toString().replace("-", ""); String token ="UT_"+ UUID.randomUUID().toString().replace("-", "");
userInfoEntity.setToken(token); userInfoEntity.setToken(token);
userInfoEntity.setSchoolId(2105); userInfoEntity.setSchoolId(2105);
Integer schoolId = userInfoEntity.getSchoolId(); Integer schoolId = userInfoEntity.getSchoolId();
Integer integer = userInfoService.queryStudentAccount(userInfoEntity.getAccount(),schoolId); Integer integer = userInfoService.queryStudentAccount(userInfoEntity.getAccount(),schoolId);
Integer integer1 = userInfoService.queryStudentPhone(userInfoEntity.getPhone()); Integer integer1 = userInfoService.queryStudentPhone(userInfoEntity.getPhone());
//新增学生
StudentVo studentVo = new StudentVo();
studentVo.setUserId(userInfoEntity.getUserId());
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){ if (integer==1){
return R.error(400,"账号已存在"); return R.error(400,"账号已存在");
} }
if (integer1==1){ if (integer1==1){
return R.error(400,"改手机号已被绑定"); return R.error(400,"该手机号已被绑定");
}
if (num == 1){
return R.error(400,"该学号重复!");
} }
int userId = userInfoService.add(userInfoEntity); int userId = userInfoService.add(userInfoEntity);
if (userId==0){ if (userId==0){
return R.error(400,"添加用户信息失败"); return R.error(400,"添加用户信息失败");
} }
// userInfoEntity.setUserId(userId); // userInfoEntity.setUserId(userId);
studentService.addStudentInfo(userInfoEntity);
return R.ok(); return studentService.addStudentInfo(studentVo);
} }
/** /**

@ -28,7 +28,7 @@ public interface StudentDao extends BaseMapper<StudentEntity> {
void updateWorkNumber(String workNumber,Integer studentId); void updateWorkNumber(String workNumber,Integer studentId);
boolean addStudentInfo(UserInfoEntity userInfoEntity); boolean addStudentInfo(StudentVo studentVo);
List<Integer> querySchoolName(String schoolAppellationName); List<Integer> querySchoolName(String schoolAppellationName);
@ -37,4 +37,6 @@ public interface StudentDao extends BaseMapper<StudentEntity> {
int querySchoolAppellationName(String schoolAppellationName); int querySchoolAppellationName(String schoolAppellationName);
List<StudentVo> queryAccount(String account,Integer schoolId); List<StudentVo> queryAccount(String account,Integer schoolId);
int queryStudentByWorkNumber(StudentVo studentVo);
} }

@ -30,7 +30,7 @@ public interface StudentService extends IService<StudentEntity>{
void updateWorkNumber(Integer studentId); void updateWorkNumber(Integer studentId);
R addStudentInfo(UserInfoEntity userInfoEntity); R addStudentInfo(StudentVo studentVo);
void downloadFiles(HttpServletResponse response) throws IOException; void downloadFiles(HttpServletResponse response) throws IOException;
@ -40,4 +40,5 @@ public interface StudentService extends IService<StudentEntity>{
R queryAccount(String account,Integer schoolId); R queryAccount(String account,Integer schoolId);
int queryStudentByWorkNumber(StudentVo studentVo);
} }

@ -122,18 +122,15 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
} }
@Override @Override
public R addStudentInfo(UserInfoEntity userInfoEntity) { public R addStudentInfo(StudentVo studentVo) {
R r = new R(); R r = new R();
boolean result = studentDao.addStudentInfo(userInfoEntity); boolean result = studentDao.addStudentInfo(studentVo);
if (result==false){ if (result==false){
r.put("code",300); throw new RuntimeException();//添加失败,抛出运行时异常让外层事务回滚
r.put("errmessage","注册失败!");
return r;
}else{ }else{
r.put("code",200); return R.ok("注册成功!");
r.put("errmessage","注册成功!");
return r;
} }
} }
@Override @Override
@ -310,4 +307,9 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
} }
@Override
public int queryStudentByWorkNumber(StudentVo studentVo) {
return studentDao.queryStudentByWorkNumber(studentVo);
}
} }

@ -498,11 +498,10 @@
et.creation_time AS creationTime, et.creation_time AS creationTime,
et.is_del et.is_del
FROM FROM
tms_experimental_teaching et, tms_experimental_teaching et inner join
hr_project_management pm hr_project_management pm on et.project_id = pm.projectId
WHERE WHERE
user_id = #{userId} user_id = #{userId}
AND et.project_id = pm.projectId
AND pm.isdel = 0 AND pm.isdel = 0
<if test="searchContant!=null and searchContant!=''">and et.experimental_class_name like <if test="searchContant!=null and searchContant!=''">and et.experimental_class_name like
concat('%',#{searchContant},'%') or et.experimental_name like concat('%',#{searchContant},'%') or concat('%',#{searchContant},'%') or et.experimental_name like concat('%',#{searchContant},'%') or

@ -94,9 +94,9 @@ WHERE
) )
</insert> </insert>
<insert id="addStudentInfo"> <insert id="addStudentInfo">
INSERT INTO student(schoolId,userId,roleId,isdel,platformId) INSERT INTO student(schoolId,userId,roleId,isdel,platformId,workNumber)
VALUES VALUES
( #{schoolId},#{userId},4,0,1 ( #{schoolId},#{userId},#{roleId},#{isdel},#{platformId},#{workNumber}
) )
</insert> </insert>
<insert id="bacthAddStudents"> <insert id="bacthAddStudents">
@ -146,4 +146,8 @@ WHERE
update student set workNumber = #{workNumber} where studentId = #{studentId} update student set workNumber = #{workNumber} where studentId = #{studentId}
</update> </update>
<select id="queryStudentByWorkNumber" resultType="java.lang.Integer">
SELECT count(*) FROM student WHERE workNumber = #{workNumber} AND schoolId = #{schoolId} AND isdel = 0
</select>
</mapper> </mapper>

@ -19,6 +19,7 @@
u.IDNumber, u.IDNumber,
u.documentType, u.documentType,
u.educationDegree, u.educationDegree,
u.userAvatars,
pro.provinceId, pro.provinceId,
pro.provinceName, pro.provinceName,
s.schoolId, s.schoolId,

Loading…
Cancel
Save