修改教师表, 学生表表结构, 并同步前后端代码使其跟表结构字段保持一致

This commit is contained in:
mirage 2026-02-03 15:00:52 +08:00
parent 5ec30c46cb
commit 8d2058f549
26 changed files with 851 additions and 562 deletions

View File

@ -28,23 +28,23 @@ public class StudentBaseInfoController {
IStudentBaseInfoService iStudentBaseInfoService;
@GetMapping("/list")
@ApiOperation(value="学生基本信息列表")
@ApiOperation(value = "学生基本信息列表")
public AjaxResult<PageResult<StudentBaseInfoListedVo>> list(@Validated PageValidate pageValidate,
@Validated StudentBaseInfoSearchValidate searchValidate) {
@Validated StudentBaseInfoSearchValidate searchValidate) {
PageResult<StudentBaseInfoListedVo> list = iStudentBaseInfoService.list(pageValidate, searchValidate);
return AjaxResult.success(list);
}
@GetMapping("/detail")
@ApiOperation(value="学生基本信息详情")
public AjaxResult<StudentBaseInfoDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
@ApiOperation(value = "学生基本信息详情")
public AjaxResult<StudentBaseInfoDetailVo> detail(@Validated @IDMust() @RequestParam("id") Long id) {
StudentBaseInfoDetailVo detail = iStudentBaseInfoService.detail(id);
return AjaxResult.success(detail);
}
@Log(title = "学生基本信息新增")
@PostMapping("/add")
@ApiOperation(value="学生基本信息新增")
@ApiOperation(value = "学生基本信息新增")
public AjaxResult<Object> add(@Validated @RequestBody StudentBaseInfoCreateValidate createValidate) {
iStudentBaseInfoService.add(createValidate);
return AjaxResult.success();
@ -52,7 +52,7 @@ public class StudentBaseInfoController {
@Log(title = "学生基本信息编辑")
@PostMapping("/edit")
@ApiOperation(value="学生基本信息编辑")
@ApiOperation(value = "学生基本信息编辑")
public AjaxResult<Object> edit(@Validated @RequestBody StudentBaseInfoUpdateValidate updateValidate) {
iStudentBaseInfoService.edit(updateValidate);
return AjaxResult.success();
@ -60,9 +60,9 @@ public class StudentBaseInfoController {
@Log(title = "学生基本信息删除")
@PostMapping("/del")
@ApiOperation(value="学生基本信息删除")
@ApiOperation(value = "学生基本信息删除")
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
iStudentBaseInfoService.del(idValidate.getId());
iStudentBaseInfoService.del(idValidate.getId().longValue());
return AjaxResult.success();
}

View File

@ -6,7 +6,6 @@ import com.mdd.admin.validate.commons.IdValidate;
import com.mdd.admin.validate.StudentInfoCreateValidate;
import com.mdd.admin.validate.StudentInfoUpdateValidate;
import com.mdd.admin.validate.StudentInfoSearchValidate;
import com.mdd.admin.validate.commons.NumValidate;
import com.mdd.admin.validate.commons.PageValidate;
import com.mdd.admin.vo.StudentInfoListedVo;
import com.mdd.admin.vo.StudentInfoDetailVo;
@ -29,15 +28,15 @@ public class StudentInfoController {
IStudentInfoService iStudentInfoService;
@GetMapping("/list")
@ApiOperation(value="学生信息列表")
@ApiOperation(value = "学生信息列表")
public AjaxResult<PageResult<StudentInfoListedVo>> list(@Validated PageValidate pageValidate,
@Validated StudentInfoSearchValidate searchValidate) {
@Validated StudentInfoSearchValidate searchValidate) {
PageResult<StudentInfoListedVo> list = iStudentInfoService.list(pageValidate, searchValidate);
return AjaxResult.success(list);
}
@GetMapping("/detail")
@ApiOperation(value="学生信息详情")
@ApiOperation(value = "学生信息详情")
public AjaxResult<StudentInfoDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
StudentInfoDetailVo detail = iStudentInfoService.detail(id);
return AjaxResult.success(detail);
@ -45,7 +44,7 @@ public class StudentInfoController {
@Log(title = "学生信息新增")
@PostMapping("/add")
@ApiOperation(value="学生信息新增")
@ApiOperation(value = "学生信息新增")
public AjaxResult<Object> add(@Validated @RequestBody StudentInfoCreateValidate createValidate) {
iStudentInfoService.add(createValidate);
return AjaxResult.success();
@ -53,7 +52,7 @@ public class StudentInfoController {
@Log(title = "学生信息编辑")
@PostMapping("/edit")
@ApiOperation(value="学生信息编辑")
@ApiOperation(value = "学生信息编辑")
public AjaxResult<Object> edit(@Validated @RequestBody StudentInfoUpdateValidate updateValidate) {
iStudentInfoService.edit(updateValidate);
return AjaxResult.success();
@ -61,17 +60,9 @@ public class StudentInfoController {
@Log(title = "学生信息删除")
@PostMapping("/del")
@ApiOperation(value="学生信息删除")
@ApiOperation(value = "学生信息删除")
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
iStudentInfoService.del(idValidate.getId());
return AjaxResult.success();
}
@Log(title = "添加随机学生信息")
@PostMapping("/create.random.info")
@ApiOperation(value = "添加随机学生信息")
public AjaxResult<Object> createRandomInfo(@Validated @RequestBody NumValidate numValidate) {
iStudentInfoService.createRandomInfo(numValidate.getNum());
return AjaxResult.success();
}
}

View File

@ -35,19 +35,27 @@ public class StudentRegistrationController {
private AdminMapper adminMapper;
@GetMapping("/list")
@ApiOperation(value="学生注册状态列表")
@ApiOperation(value = "学生注册状态列表")
public AjaxResult<PageResult<StudentRegistrationListedVo>> list(@Validated PageValidate pageValidate,
@Validated StudentRegistrationSearchValidate searchValidate) {
@Validated StudentRegistrationSearchValidate searchValidate) {
PageResult<StudentRegistrationListedVo> list = iStudentRegistrationService.list(pageValidate, searchValidate);
for(StudentRegistrationListedVo e: list.getLists()){
for (StudentRegistrationListedVo e : list.getLists()) {
Admin admin = adminMapper.selectById(e.getApprovedBy());
if(admin != null) {e.setApprovedName(admin.getName());}
if (admin != null) {
e.setApprovedName(admin.getName());
}
admin = adminMapper.selectById(e.getAdmissionBy());
if(admin != null) {e.setAdmissionName(admin.getName());}
if (admin != null) {
e.setAdmissionName(admin.getName());
}
admin = adminMapper.selectById(e.getPaymentReviewBy());
if(admin != null) {e.setPaymentReviewName(admin.getName());}
if (admin != null) {
e.setPaymentReviewName(admin.getName());
}
admin = adminMapper.selectById(e.getRegistrationReviewBy());
if(admin != null) {e.setRegistrationReviewName(admin.getName());}
if (admin != null) {
e.setRegistrationReviewName(admin.getName());
}
}
return AjaxResult.success(list);
}
@ -56,7 +64,7 @@ public class StudentRegistrationController {
@ApiOperation(value = "(无用,自动录取)学生报名信息待审核列表")
public AjaxResult<PageResult<StudentRegistrationListedVo>> listRegistration(
@Validated PageValidate pageValidate,
@Validated StudentRegistrationSearchValidate searchValidate){
@Validated StudentRegistrationSearchValidate searchValidate) {
searchValidate.setAdmissionStatus(0); // 未录取
PageResult<StudentRegistrationListedVo> list = iStudentRegistrationService.list(pageValidate, searchValidate);
return AjaxResult.success(list);
@ -65,7 +73,7 @@ public class StudentRegistrationController {
@PostMapping("/op/audit")
@ApiOperation(value = "(无用,自动录取)审核操作")
public AjaxResult<Object> auditOperation(@Validated @RequestBody OperationValidate operation) {
for(Integer id: operation.getId()){
for (Integer id : operation.getId()) {
StudentRegistrationUpdateValidate updateValidate = new StudentRegistrationUpdateValidate();
updateValidate.setId(id);
updateValidate.setApprovedBy(LikeAdminThreadLocal.getAdminId());
@ -79,20 +87,22 @@ public class StudentRegistrationController {
iStudentRegistrationService.edit(updateValidate);
}
String op = ProgressEnum.getMsgByCode(operation.getOperation());
return AjaxResult.success("已设置为“"+op+"");
return AjaxResult.success("已设置为“" + op + "");
}
@GetMapping("/list.admission")
@ApiOperation(value = "(无用,自动录取)学生待录取列表")
public AjaxResult<PageResult<StudentRegistrationListedVo>> listAdmission(
@Validated PageValidate pageValidate,
@Validated StudentRegistrationSearchValidate searchValidate){
@Validated StudentRegistrationSearchValidate searchValidate) {
searchValidate.setApprovalStatus(1); // 信息审核通过
searchValidate.setPaymentStatus(0); // 未缴费
PageResult<StudentRegistrationListedVo> list = iStudentRegistrationService.list(pageValidate, searchValidate);
for(StudentRegistrationListedVo e: list.getLists()){
for (StudentRegistrationListedVo e : list.getLists()) {
Admin admin = adminMapper.selectById(e.getApprovedBy());
if(admin != null) {e.setApprovedName(admin.getName());}
if (admin != null) {
e.setApprovedName(admin.getName());
}
}
return AjaxResult.success(list);
}
@ -100,7 +110,7 @@ public class StudentRegistrationController {
@PostMapping("/op/admission")
@ApiOperation(value = "(无用,自动录取)录取操作")
public AjaxResult<Object> admissionOperation(@Validated @RequestBody OperationValidate operation) {
for(Integer id: operation.getId()){
for (Integer id : operation.getId()) {
StudentRegistrationUpdateValidate updateValidate = new StudentRegistrationUpdateValidate();
updateValidate.setId(id);
updateValidate.setAdmissionBy(LikeAdminThreadLocal.getAdminId());
@ -114,22 +124,26 @@ public class StudentRegistrationController {
iStudentRegistrationService.edit(updateValidate);
}
String op = ProgressEnum.getMsgByCode(operation.getOperation());
return AjaxResult.success("已设置为“"+op+"");
return AjaxResult.success("已设置为“" + op + "");
}
@GetMapping("/list.payment")
@ApiOperation(value = "学生待缴费列表")
public AjaxResult<PageResult<StudentRegistrationListedVo>> listPayment(
@Validated PageValidate pageValidate,
@Validated StudentRegistrationSearchValidate searchValidate){
@Validated StudentRegistrationSearchValidate searchValidate) {
searchValidate.setApprovalStatus(1); // 信息审核通过
searchValidate.setAdmissionStatus(1); // 已录取
PageResult<StudentRegistrationListedVo> list = iStudentRegistrationService.list(pageValidate, searchValidate);
for(StudentRegistrationListedVo e: list.getLists()){
for (StudentRegistrationListedVo e : list.getLists()) {
Admin admin = adminMapper.selectById(e.getApprovedBy());
if(admin != null) {e.setApprovedName(admin.getName());}
if (admin != null) {
e.setApprovedName(admin.getName());
}
admin = adminMapper.selectById(e.getAdmissionBy());
if(admin != null) {e.setAdmissionName(admin.getName());}
if (admin != null) {
e.setAdmissionName(admin.getName());
}
}
return AjaxResult.success(list);
}
@ -137,7 +151,7 @@ public class StudentRegistrationController {
@PostMapping("/op/payment")
@ApiOperation(value = "(测试用)缴费操作")
public AjaxResult<Object> paymentOperation(@Validated @RequestBody OperationValidate operation) {
for(Integer id: operation.getId()){
for (Integer id : operation.getId()) {
StudentRegistrationUpdateValidate updateValidate = new StudentRegistrationUpdateValidate();
updateValidate.setId(id);
updateValidate.setPaymentReviewBy(LikeAdminThreadLocal.getAdminId());
@ -149,22 +163,26 @@ public class StudentRegistrationController {
iStudentRegistrationService.edit(updateValidate);
}
String op = ProgressEnum.getMsgByCode(operation.getOperation());
return AjaxResult.success("已设置为“"+op+"");
return AjaxResult.success("已设置为“" + op + "");
}
@GetMapping("/list.enrollment")
@ApiOperation(value = "学生待入学列表")
public AjaxResult<PageResult<StudentRegistrationListedVo>> listEnrollment(
@Validated PageValidate pageValidate,
@Validated StudentRegistrationSearchValidate searchValidate){
@Validated StudentRegistrationSearchValidate searchValidate) {
searchValidate.setApprovalStatus(1); // 信息审核通过
searchValidate.setAdmissionStatus(1); // 已录取
PageResult<StudentRegistrationListedVo> list = iStudentRegistrationService.list(pageValidate, searchValidate);
for(StudentRegistrationListedVo e: list.getLists()){
for (StudentRegistrationListedVo e : list.getLists()) {
Admin admin = adminMapper.selectById(e.getApprovedBy());
if(admin != null) {e.setApprovedName(admin.getName());}
if (admin != null) {
e.setApprovedName(admin.getName());
}
admin = adminMapper.selectById(e.getAdmissionBy());
if(admin != null) {e.setAdmissionName(admin.getName());}
if (admin != null) {
e.setAdmissionName(admin.getName());
}
}
return AjaxResult.success(list);
}
@ -172,7 +190,7 @@ public class StudentRegistrationController {
@PostMapping("/op/enrollment")
@ApiOperation(value = "入学操作")
public AjaxResult<Object> enrollmentOperation(@Validated @RequestBody OperationValidate operation) {
for(Integer id: operation.getId()){
for (Integer id : operation.getId()) {
StudentRegistrationUpdateValidate updateValidate = new StudentRegistrationUpdateValidate();
updateValidate.setId(id);
updateValidate.setRegistrationReviewBy(LikeAdminThreadLocal.getAdminId());
@ -184,11 +202,11 @@ public class StudentRegistrationController {
iStudentRegistrationService.edit(updateValidate);
}
String op = ProgressEnum.getMsgByCode(operation.getOperation());
return AjaxResult.success("已设置为“"+op+"");
return AjaxResult.success("已设置为“" + op + "");
}
@GetMapping("/detail")
@ApiOperation(value="学生注册状态详情")
@ApiOperation(value = "学生注册状态详情")
public AjaxResult<StudentRegistrationDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
StudentRegistrationDetailVo detail = iStudentRegistrationService.detail(id);
return AjaxResult.success(detail);
@ -196,7 +214,7 @@ public class StudentRegistrationController {
@Log(title = "学生注册状态编辑")
@PostMapping("/edit")
@ApiOperation(value="学生注册状态编辑")
@ApiOperation(value = "学生注册状态编辑")
public AjaxResult<Object> edit(@Validated @RequestBody StudentRegistrationUpdateValidate updateValidate) {
iStudentRegistrationService.edit(updateValidate);
return AjaxResult.success();
@ -204,17 +222,9 @@ public class StudentRegistrationController {
@Log(title = "学生注册状态删除")
@PostMapping("/del")
@ApiOperation(value="学生注册状态删除")
@ApiOperation(value = "学生注册状态删除")
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
iStudentRegistrationService.del(idValidate.getId());
return AjaxResult.success();
}
@Log(title = "随机报名信息生成")
@PostMapping("/genreginfo")
@ApiOperation(value = "随机报名信息生成", notes = "参数num为要生成的数量")
public AjaxResult<Object> genRegInfo(@RequestBody Integer num) {
iStudentRegistrationService.genRegInfo(num);
return AjaxResult.success();
}
}

View File

@ -31,7 +31,7 @@ public interface IStudentBaseInfoService {
* @param id 主键ID
* @return StudentBaseInfoDetailVo
*/
StudentBaseInfoDetailVo detail(Integer id);
StudentBaseInfoDetailVo detail(Long id);
/**
* 学生基本信息新增
@ -55,6 +55,6 @@ public interface IStudentBaseInfoService {
* @author gyp
* @param id 主键ID
*/
void del(Integer id);
void del(Long id);
}

View File

@ -58,12 +58,4 @@ public interface IStudentInfoService {
* @param id 主键ID
*/
void del(Integer id);
/**
* 添加随机学生信息
*
* @author gyp
* @param num 人数
*/
void createRandomInfo(@NotNull(message = "数量参数缺失") Integer num);
}

View File

@ -56,6 +56,4 @@ public interface IStudentRegistrationService {
* @param id 主键ID
*/
void del(Integer id);
void genRegInfo(Integer num);
}

View File

@ -1,7 +1,6 @@
package com.mdd.admin.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.yulichang.query.MPJQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mdd.admin.validate.commons.PageValidate;
@ -11,13 +10,9 @@ import com.mdd.admin.validate.StudentBaseInfoUpdateValidate;
import com.mdd.admin.validate.StudentBaseInfoSearchValidate;
import com.mdd.admin.vo.StudentBaseInfoListedVo;
import com.mdd.admin.vo.StudentBaseInfoDetailVo;
import com.mdd.common.config.GlobalConfig;
import com.mdd.common.core.PageResult;
import com.mdd.common.entity.StudentBaseInfo;
import com.mdd.common.mapper.StudentBaseInfoMapper;
import com.mdd.common.util.ListUtils;
import com.mdd.common.util.TimeUtils;
import com.mdd.common.util.UrlUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
@ -27,6 +22,7 @@ import java.util.*;
/**
* 学生基本信息实现类
*
* @author gyp
*/
@Service
@ -38,41 +34,39 @@ public class StudentBaseInfoServiceImpl implements IStudentBaseInfoService {
/**
* 学生基本信息列表
*
* @author gyp
* @param pageValidate 分页参数
* @param pageValidate 分页参数
* @param searchValidate 搜索参数
* @return PageResult<StudentBaseInfoListedVo>
* @author gyp
*/
@Override
public PageResult<StudentBaseInfoListedVo> list(PageValidate pageValidate, StudentBaseInfoSearchValidate searchValidate) {
Integer page = pageValidate.getPage_no();
Integer page = pageValidate.getPage_no();
Integer limit = pageValidate.getPage_size();
QueryWrapper<StudentBaseInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("id");
queryWrapper.orderByDesc("student_base_id");
studentBaseInfoMapper.setSearch(queryWrapper, searchValidate, new String[]{
"=:userId@user_id:int",
"like:name:str",
"=:gender:int",
"=:idCard@id_card:str",
"=:nationality:str",
"=:politicalStatus@political_status:int",
"=:phone:str",
"=:nativePlace@native_place:str",
"=:schoolType@school_type:int",
"=:graduationYear@graduation_year:int",
"=:academicQualification@academic_qualification:int",
"=:studentId@student_id:int",
"like:name:str",
"=:gender:int",
"=:idCard@id_card:str",
"=:nationality:str",
"=:politicalStatus@political_status:int",
"=:phone:str",
"=:nativePlace@native_place:str",
"=:schoolType@school_type:int",
"=:graduationYear@graduation_year:int",
"=:academicQualification@academic_qualification:int",
});
IPage<StudentBaseInfo> iPage = studentBaseInfoMapper.selectPage(new Page<>(page, limit), queryWrapper);
List<StudentBaseInfoListedVo> list = new LinkedList<>();
for(StudentBaseInfo item : iPage.getRecords()) {
for (StudentBaseInfo item : iPage.getRecords()) {
StudentBaseInfoListedVo vo = new StudentBaseInfoListedVo();
BeanUtils.copyProperties(item, vo);
vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime()));
vo.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime()));
list.add(vo);
}
@ -82,16 +76,16 @@ public class StudentBaseInfoServiceImpl implements IStudentBaseInfoService {
/**
* 学生基本信息详情
*
* @author gyp
* @param id 主键参数
* @return StudentBaseInfo
* @author gyp
*/
@Override
public StudentBaseInfoDetailVo detail(Integer id) {
public StudentBaseInfoDetailVo detail(Long id) {
StudentBaseInfo model = studentBaseInfoMapper.selectOne(
new QueryWrapper<StudentBaseInfo>()
.eq("id", id)
.last("limit 1"));
.eq("student_base_id", id)
.last("limit 1"));
Assert.notNull(model, "数据不存在");
@ -103,12 +97,13 @@ public class StudentBaseInfoServiceImpl implements IStudentBaseInfoService {
/**
* 学生基本信息新增
*
* @author gyp
* @param createValidate 参数
* @author gyp
*/
@Override
public void add(StudentBaseInfoCreateValidate createValidate) {
StudentBaseInfo model = new StudentBaseInfo();
model.setStudentId(createValidate.getStudentId());
model.setName(createValidate.getName());
model.setGender(createValidate.getGender());
model.setIdCard(createValidate.getIdCard());
@ -122,30 +117,37 @@ public class StudentBaseInfoServiceImpl implements IStudentBaseInfoService {
model.setRelationship(createValidate.getRelationship());
model.setHomeAddress(createValidate.getHomeAddress());
model.setNativePlace(createValidate.getNativePlace());
model.setPostalCode(createValidate.getPostalCode());
model.setPreviousSchool(createValidate.getPreviousSchool());
model.setSchoolType(createValidate.getSchoolType());
model.setGraduationYear(createValidate.getGraduationYear());
model.setCreateTime(System.currentTimeMillis() / 1000);
model.setUpdateTime(System.currentTimeMillis() / 1000);
model.setAcademicQualification(createValidate.getAcademicQualification());
model.setMajorStudied(createValidate.getMajorStudied());
model.setHeight(createValidate.getHeight());
model.setWeight(createValidate.getWeight());
model.setShoeSize(createValidate.getShoeSize());
studentBaseInfoMapper.insert(model);
}
/**
* 学生基本信息编辑
*
* @author gyp
* @param updateValidate 参数
* @author gyp
*/
@Override
public void edit(StudentBaseInfoUpdateValidate updateValidate) {
StudentBaseInfo model = studentBaseInfoMapper.selectOne(
new QueryWrapper<StudentBaseInfo>()
.eq("id", updateValidate.getId())
.last("limit 1"));
.eq("student_base_id", updateValidate.getStudentBaseId())
.last("limit 1"));
Assert.notNull(model, "数据不存在!");
model.setId(updateValidate.getId());
model.setStudentBaseId(updateValidate.getStudentBaseId());
if (updateValidate.getStudentId() != null) {
model.setStudentId(updateValidate.getStudentId());
}
model.setName(updateValidate.getName());
model.setGender(updateValidate.getGender());
model.setIdCard(updateValidate.getIdCard());
@ -159,29 +161,35 @@ public class StudentBaseInfoServiceImpl implements IStudentBaseInfoService {
model.setRelationship(updateValidate.getRelationship());
model.setHomeAddress(updateValidate.getHomeAddress());
model.setNativePlace(updateValidate.getNativePlace());
model.setPostalCode(updateValidate.getPostalCode());
model.setPreviousSchool(updateValidate.getPreviousSchool());
model.setSchoolType(updateValidate.getSchoolType());
model.setGraduationYear(updateValidate.getGraduationYear());
model.setUpdateTime(System.currentTimeMillis() / 1000);
model.setAcademicQualification(updateValidate.getAcademicQualification());
model.setMajorStudied(updateValidate.getMajorStudied());
model.setHeight(updateValidate.getHeight());
model.setWeight(updateValidate.getWeight());
model.setShoeSize(updateValidate.getShoeSize());
model.setUpdateTime(new Date());
studentBaseInfoMapper.updateById(model);
}
/**
* 学生基本信息删除
*
* @author gyp
* @param id 主键ID
* @author gyp
*/
@Override
public void del(Integer id) {
public void del(Long id) {
StudentBaseInfo model = studentBaseInfoMapper.selectOne(
new QueryWrapper<StudentBaseInfo>()
.eq("id", id)
.last("limit 1"));
.eq("student_base_id", id)
.last("limit 1"));
Assert.notNull(model, "数据不存在!");
studentBaseInfoMapper.delete(new QueryWrapper<StudentBaseInfo>().eq("id", id));
studentBaseInfoMapper.delete(new QueryWrapper<StudentBaseInfo>().eq("student_base_id", id));
}
}

View File

@ -16,14 +16,20 @@ import com.mdd.common.entity.Class;
import com.mdd.common.entity.College;
import com.mdd.common.entity.Major;
import com.mdd.common.entity.StudentInfo;
import com.mdd.common.entity.StudentBaseInfo;
import com.mdd.common.entity.admin.Admin;
import com.mdd.common.entity.user.User;
import com.mdd.common.mapper.ClassMapper;
import com.mdd.common.mapper.CollegeMapper;
import com.mdd.common.mapper.MajorMapper;
import com.mdd.common.mapper.StudentInfoMapper;
import com.mdd.common.mapper.StudentBaseInfoMapper;
import com.mdd.common.mapper.admin.AdminMapper;
import com.mdd.common.mapper.user.UserMapper;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import com.mdd.common.util.*;
import io.netty.util.internal.ThreadLocalRandom;
import org.springframework.beans.BeanUtils;
@ -36,6 +42,7 @@ import java.util.*;
/**
* 学生信息实现类
*
* @author gyp
*/
@Service
@ -44,6 +51,8 @@ public class StudentInfoServiceImpl implements IStudentInfoService {
@Resource
StudentInfoMapper studentInfoMapper;
@Autowired
private StudentBaseInfoMapper studentBaseInfoMapper;
@Autowired
private CollegeMapper collegeMapper;
@Autowired
private MajorMapper majorMapper;
@ -57,46 +66,50 @@ public class StudentInfoServiceImpl implements IStudentInfoService {
/**
* 学生信息列表
*
* @author gyp
* @param pageValidate 分页参数
* @param pageValidate 分页参数
* @param searchValidate 搜索参数
* @return PageResult<StudentInfoListedVo>
* @author gyp
*/
@Override
public PageResult<StudentInfoListedVo> list(PageValidate pageValidate, StudentInfoSearchValidate searchValidate) {
Integer page = pageValidate.getPage_no();
Integer page = pageValidate.getPage_no();
Integer limit = pageValidate.getPage_size();
QueryWrapper<StudentInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("id");
queryWrapper.orderByDesc("student_id");
studentInfoMapper.setSearch(queryWrapper, searchValidate, new String[]{
"like:name:str",
"=:gender:int",
"like:studentNumber@student_number:str",
"=:collegeId@college_id:int",
"=:majorId@major_id:int",
"=:classId@class_id:int",
"=:grade:int",
"=:enrollmentYear@enrollment_year:int",
"=:studentStatus@student_status:int",
"=:politicalStatus@political_status:int",
"like:dormitory:str",
"=:counselorId@counselor_id:int",
"=:academicWarnings@academic_warnings:int",
"=:isVerified@is_verified:int",
"=:verifiedBy@verified_by:int",
"like:studentNumber@student_number:str",
"=:collegeId@college_id:int",
"=:majorId@major_id:int",
"=:classId@class_id:int",
"=:grade:int",
"=:enrollmentYear@enrollment_year:int",
"=:studentStatus@student_status:int",
"like:dormitory:str",
"=:counselorId@counselor_id:int",
"=:academicWarnings@academic_warnings:int",
"=:isVerified@is_verified:int",
"=:verifiedBy@verified_by:int",
});
IPage<StudentInfo> iPage = studentInfoMapper.selectPage(new Page<>(page, limit), queryWrapper);
List<StudentInfoListedVo> list = new LinkedList<>();
for(StudentInfo item : iPage.getRecords()) {
for (StudentInfo item : iPage.getRecords()) {
StudentInfoListedVo vo = new StudentInfoListedVo();
BeanUtils.copyProperties(item, vo);
vo.setVerifiedTime(TimeUtils.timestampToDate(item.getVerifiedTime()));
vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime()));
vo.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime()));
// 通过 student_id 关联查询基本信息获取 name
StudentBaseInfo baseInfo = studentBaseInfoMapper.selectOne(
new QueryWrapper<StudentBaseInfo>()
.eq("student_id", item.getStudentId())
.last("limit 1"));
if (baseInfo != null) {
vo.setName(baseInfo.getName());
}
College college = collegeMapper.selectById(item.getCollegeId());
Major major = majorMapper.selectById(item.getMajorId());
@ -104,11 +117,11 @@ public class StudentInfoServiceImpl implements IStudentInfoService {
Admin counselor = adminMapper.selectById(item.getCounselorId());
Admin verifier = adminMapper.selectById(item.getVerifiedBy());
vo.setCollegeName(college.getCollegeName());
vo.setMajorName(major.getMajorName());
vo.setClassName(clazz.getClassName());
vo.setCounselorName(counselor.getName());
vo.setVerifierName(verifier.getName());
vo.setCollegeName(college != null ? college.getCollegeName() : "");
vo.setMajorName(major != null ? major.getMajorName() : "");
vo.setClassName(clazz != null ? clazz.getClassName() : "");
vo.setCounselorName(counselor != null ? counselor.getName() : "");
vo.setVerifierName(verifier != null ? verifier.getName() : "");
list.add(vo);
}
@ -119,87 +132,145 @@ public class StudentInfoServiceImpl implements IStudentInfoService {
/**
* 学生信息详情
*
* @author gyp
* @param id 主键参数
* @return StudentInfo
* @author gyp
*/
@Override
public StudentInfoDetailVo detail(Integer id) {
StudentInfo model = studentInfoMapper.selectOne(
new QueryWrapper<StudentInfo>()
.eq("id", id)
.last("limit 1"));
.eq("student_id", id)
.last("limit 1"));
Assert.notNull(model, "数据不存在");
StudentInfoDetailVo vo = new StudentInfoDetailVo();
BeanUtils.copyProperties(model, vo);
// 关联查询基本信息并合并到返回数据中
StudentBaseInfo baseInfo = studentBaseInfoMapper.selectOne(
new QueryWrapper<StudentBaseInfo>()
.eq("student_id", model.getStudentId())
.last("limit 1"));
if (baseInfo != null) {
vo.setStudentBaseId(baseInfo.getStudentBaseId());
vo.setName(baseInfo.getName());
vo.setGender(baseInfo.getGender());
vo.setIdCard(baseInfo.getIdCard());
if (baseInfo.getBirthday() != null) {
vo.setBirthday(baseInfo.getBirthday().toString());
}
vo.setNationality(baseInfo.getNationality());
vo.setPoliticalStatus(baseInfo.getPoliticalStatus());
vo.setPhone(baseInfo.getPhone());
vo.setEmail(baseInfo.getEmail());
vo.setEmergencyContact(baseInfo.getEmergencyContact());
vo.setEmergencyPhone(baseInfo.getEmergencyPhone());
vo.setRelationship(baseInfo.getRelationship());
vo.setHomeAddress(baseInfo.getHomeAddress());
vo.setNativePlace(baseInfo.getNativePlace());
vo.setPostalCode(baseInfo.getPostalCode());
vo.setPreviousSchool(baseInfo.getPreviousSchool());
vo.setSchoolType(baseInfo.getSchoolType());
vo.setGraduationYear(baseInfo.getGraduationYear());
vo.setAcademicQualification(baseInfo.getAcademicQualification());
vo.setMajorStudied(baseInfo.getMajorStudied());
vo.setHeight(baseInfo.getHeight());
vo.setWeight(baseInfo.getWeight());
vo.setShoeSize(baseInfo.getShoeSize());
}
return vo;
}
/**
* 学生信息新增
*
* @author gyp
* @param createValidate 参数
* @author gyp
*/
@Override
public void add(StudentInfoCreateValidate createValidate) {
// 查询班级是否满人
Class clazz = classMapper.selectById(createValidate.getClassId());
if(clazz == null) throw new RuntimeException("班级不存在");
if(clazz.getStudentCount()>=clazz.getMaxStudentCount()) throw new RuntimeException("班级已满人");
clazz.setStudentCount(clazz.getStudentCount()+1);
if (clazz == null) throw new RuntimeException("班级不存在");
if (clazz.getStudentCount() >= clazz.getMaxStudentCount()) throw new RuntimeException("班级已满人");
clazz.setStudentCount(clazz.getStudentCount() + 1);
StudentInfo studentInfo = new StudentInfo();
studentInfo.setStudentNumber(createValidate.getStudentNumber());
studentInfo.setCollegeId(createValidate.getCollegeId());
studentInfo.setMajorId(createValidate.getMajorId());
studentInfo.setClassId(createValidate.getClassId());
studentInfo.setGrade(createValidate.getGrade());
studentInfo.setEnrollmentYear(createValidate.getEnrollmentYear());
studentInfo.setExpectedGraduationYear(createValidate.getExpectedGraduationYear());
studentInfo.setStudentStatus(createValidate.getStudentStatus());
studentInfo.setDormitory(createValidate.getDormitory());
studentInfo.setCounselorId(createValidate.getCounselorId());
studentInfo.setTotalCredits(createValidate.getTotalCredits());
studentInfo.setGpa(createValidate.getGpa());
studentInfo.setAcademicWarnings(createValidate.getAcademicWarnings());
studentInfo.setIsVerified(createValidate.getIsVerified() != null ? createValidate.getIsVerified() : 0);
studentInfo.setVerifiedBy(createValidate.getVerifiedBy());
studentInfo.setVerifiedTime(createValidate.getVerifiedTime());
studentInfoMapper.insert(studentInfo);
// 创建基本信息
if (createValidate.getName() != null && !createValidate.getName().isEmpty()) {
StudentBaseInfo baseInfo = new StudentBaseInfo();
baseInfo.setStudentId(studentInfo.getStudentId());
baseInfo.setName(createValidate.getName());
baseInfo.setGender(createValidate.getGender());
baseInfo.setIdCard(createValidate.getIdCard() != null ? createValidate.getIdCard() : "");
if (createValidate.getBirthday() != null && !createValidate.getBirthday().isEmpty()) {
try {
baseInfo.setBirthday(LocalDate.parse(createValidate.getBirthday(), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
} catch (Exception e) {
// 忽略日期解析错误
}
}
baseInfo.setNationality(createValidate.getNationality() != null ? createValidate.getNationality() : "汉族");
baseInfo.setPoliticalStatus(createValidate.getPoliticalStatus());
baseInfo.setPhone(createValidate.getPhone() != null ? createValidate.getPhone() : "");
baseInfo.setEmail(createValidate.getEmail() != null ? createValidate.getEmail() : "");
baseInfo.setEmergencyContact(createValidate.getEmergencyContact() != null ? createValidate.getEmergencyContact() : "");
baseInfo.setEmergencyPhone(createValidate.getEmergencyPhone() != null ? createValidate.getEmergencyPhone() : "");
baseInfo.setRelationship(createValidate.getRelationship() != null ? createValidate.getRelationship() : "");
baseInfo.setHomeAddress(createValidate.getHomeAddress() != null ? createValidate.getHomeAddress() : "");
baseInfo.setNativePlace(createValidate.getNativePlace() != null ? createValidate.getNativePlace() : "");
baseInfo.setPostalCode(createValidate.getPostalCode() != null ? createValidate.getPostalCode() : "");
baseInfo.setPreviousSchool(createValidate.getPreviousSchool() != null ? createValidate.getPreviousSchool() : "");
baseInfo.setSchoolType(createValidate.getSchoolType());
baseInfo.setGraduationYear(createValidate.getGraduationYear());
baseInfo.setAcademicQualification(createValidate.getAcademicQualification());
baseInfo.setMajorStudied(createValidate.getMajorStudied() != null ? createValidate.getMajorStudied() : "");
baseInfo.setHeight(createValidate.getHeight());
baseInfo.setWeight(createValidate.getWeight());
baseInfo.setShoeSize(createValidate.getShoeSize());
studentBaseInfoMapper.insert(baseInfo);
}
StudentInfo model = new StudentInfo();
model.setName(createValidate.getName());
model.setGender(createValidate.getGender());
model.setUserId(createValidate.getUserId());
model.setStudentNumber(createValidate.getStudentNumber());
model.setCollegeId(createValidate.getCollegeId());
model.setMajorId(createValidate.getMajorId());
model.setClassId(createValidate.getClassId());
model.setGrade(createValidate.getGrade());
model.setEnrollmentYear(createValidate.getEnrollmentYear());
model.setExpectedGraduationYear(createValidate.getExpectedGraduationYear());
model.setStudentStatus(createValidate.getStudentStatus());
model.setIdCard(createValidate.getIdCard());
model.setBirthday(createValidate.getBirthday());
model.setPoliticalStatus(createValidate.getPoliticalStatus());
model.setNativePlace(createValidate.getNativePlace());
model.setHomeAddress(createValidate.getHomeAddress());
model.setEmergencyContact(createValidate.getEmergencyContact());
model.setEmergencyPhone(createValidate.getEmergencyPhone());
model.setDormitory(createValidate.getDormitory());
model.setCounselorId(createValidate.getCounselorId());
model.setIsVerified(createValidate.getIsVerified());
model.setVerifiedBy(createValidate.getVerifiedBy());
model.setVerifiedTime(createValidate.getVerifiedTime());
model.setCreateTime(System.currentTimeMillis() / 1000);
model.setUpdateTime(System.currentTimeMillis() / 1000);
studentInfoMapper.insert(model);
classMapper.updateById(clazz);
}
/**
* 学生信息编辑
*
* @author gyp
* @param updateValidate 参数
* @author gyp
*/
@Override
public void edit(StudentInfoUpdateValidate updateValidate) {
StudentInfo model = studentInfoMapper.selectOne(
new QueryWrapper<StudentInfo>()
.eq("id", updateValidate.getId())
.last("limit 1"));
.eq("student_id", updateValidate.getStudentId())
.last("limit 1"));
Assert.notNull(model, "数据不存在!");
model.setId(updateValidate.getId());
model.setName(updateValidate.getName());
model.setGender(updateValidate.getGender());
model.setUserId(updateValidate.getUserId());
model.setStudentId(updateValidate.getStudentId());
model.setStudentNumber(updateValidate.getStudentNumber());
model.setCollegeId(updateValidate.getCollegeId());
model.setMajorId(updateValidate.getMajorId());
@ -208,84 +279,92 @@ public class StudentInfoServiceImpl implements IStudentInfoService {
model.setEnrollmentYear(updateValidate.getEnrollmentYear());
model.setExpectedGraduationYear(updateValidate.getExpectedGraduationYear());
model.setStudentStatus(updateValidate.getStudentStatus());
model.setIdCard(updateValidate.getIdCard());
model.setBirthday(updateValidate.getBirthday());
model.setPoliticalStatus(updateValidate.getPoliticalStatus());
model.setNativePlace(updateValidate.getNativePlace());
model.setHomeAddress(updateValidate.getHomeAddress());
model.setEmergencyContact(updateValidate.getEmergencyContact());
model.setEmergencyPhone(updateValidate.getEmergencyPhone());
model.setDormitory(updateValidate.getDormitory());
model.setCounselorId(updateValidate.getCounselorId());
model.setTotalCredits(updateValidate.getTotalCredits());
model.setGpa(updateValidate.getGpa());
model.setAcademicWarnings(updateValidate.getAcademicWarnings());
model.setIsVerified(updateValidate.getIsVerified());
model.setHighSchoolScore(updateValidate.getHighSchoolScore());
model.setPreRegistrationAmount(updateValidate.getPreRegistrationAmount());
model.setRecruitmentTeacherId(updateValidate.getRecruitmentTeacherId());
model.setReceptionTeacherId(updateValidate.getReceptionTeacherId());
model.setPreRegistrationTime(updateValidate.getPreRegistrationTime());
model.setInvitationCode(updateValidate.getInvitationCode());
if (updateValidate.getIsVerified() != null) {
model.setIsVerified(updateValidate.getIsVerified());
}
model.setVerifiedBy(updateValidate.getVerifiedBy());
model.setVerifiedTime(updateValidate.getVerifiedTime());
model.setUpdateTime(System.currentTimeMillis() / 1000);
model.setUpdateTime(new Date());
studentInfoMapper.updateById(model);
// 更新基本信息
if (updateValidate.getStudentBaseId() != null) {
StudentBaseInfo baseInfo = studentBaseInfoMapper.selectOne(
new QueryWrapper<StudentBaseInfo>()
.eq("student_base_id", updateValidate.getStudentBaseId())
.last("limit 1"));
if (baseInfo != null) {
if (updateValidate.getName() != null) baseInfo.setName(updateValidate.getName());
if (updateValidate.getGender() != null) baseInfo.setGender(updateValidate.getGender());
if (updateValidate.getIdCard() != null) baseInfo.setIdCard(updateValidate.getIdCard());
if (updateValidate.getBirthday() != null && !updateValidate.getBirthday().isEmpty()) {
try {
baseInfo.setBirthday(LocalDate.parse(updateValidate.getBirthday(), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
} catch (Exception e) {
// 忽略日期解析错误
}
}
if (updateValidate.getNationality() != null) baseInfo.setNationality(updateValidate.getNationality());
if (updateValidate.getPoliticalStatus() != null)
baseInfo.setPoliticalStatus(updateValidate.getPoliticalStatus());
if (updateValidate.getPhone() != null) baseInfo.setPhone(updateValidate.getPhone());
if (updateValidate.getEmail() != null) baseInfo.setEmail(updateValidate.getEmail());
if (updateValidate.getEmergencyContact() != null)
baseInfo.setEmergencyContact(updateValidate.getEmergencyContact());
if (updateValidate.getEmergencyPhone() != null)
baseInfo.setEmergencyPhone(updateValidate.getEmergencyPhone());
if (updateValidate.getRelationship() != null)
baseInfo.setRelationship(updateValidate.getRelationship());
if (updateValidate.getHomeAddress() != null) baseInfo.setHomeAddress(updateValidate.getHomeAddress());
if (updateValidate.getNativePlace() != null) baseInfo.setNativePlace(updateValidate.getNativePlace());
if (updateValidate.getPostalCode() != null) baseInfo.setPostalCode(updateValidate.getPostalCode());
if (updateValidate.getPreviousSchool() != null)
baseInfo.setPreviousSchool(updateValidate.getPreviousSchool());
if (updateValidate.getSchoolType() != null) baseInfo.setSchoolType(updateValidate.getSchoolType());
if (updateValidate.getGraduationYear() != null)
baseInfo.setGraduationYear(updateValidate.getGraduationYear());
if (updateValidate.getAcademicQualification() != null)
baseInfo.setAcademicQualification(updateValidate.getAcademicQualification());
if (updateValidate.getMajorStudied() != null)
baseInfo.setMajorStudied(updateValidate.getMajorStudied());
if (updateValidate.getHeight() != null) baseInfo.setHeight(updateValidate.getHeight());
if (updateValidate.getWeight() != null) baseInfo.setWeight(updateValidate.getWeight());
if (updateValidate.getShoeSize() != null) baseInfo.setShoeSize(updateValidate.getShoeSize());
baseInfo.setUpdateTime(new Date());
studentBaseInfoMapper.updateById(baseInfo);
}
}
}
/**
* 学生信息删除
*
* @author gyp
* @param id 主键ID
* @author gyp
*/
@Override
public void del(Integer id) {
StudentInfo model = studentInfoMapper.selectOne(
new QueryWrapper<StudentInfo>()
.eq("id", id)
.last("limit 1"));
.eq("student_id", id)
.last("limit 1"));
Assert.notNull(model, "数据不存在!");
studentInfoMapper.delete(new QueryWrapper<StudentInfo>().eq("id", id));
}
@Override
public void createRandomInfo(Integer num) {
if (num == null) return;
for (int i = 0; i < num; i++) {
// 生成用户
User user = new User();
String idCard = createRandomUser(user);
String name = user.getRealName();
String studentNumber = user.getAccount();
Integer userId = user.getId();
// 生成学生信息
Random random = ThreadLocalRandom.current();
StudentInfoCreateValidate createValidate = new StudentInfoCreateValidate();
createValidate.setUserId(userId);
createValidate.setName(name);
createValidate.setGender(RandomUtil.genderFromIdCard(idCard));
createValidate.setStudentNumber(studentNumber);
Class clazz = getRandomEntity(classMapper);
if (clazz == null) {throw new RuntimeException("为随机学生分配班级信息错误");}
createValidate.setClassId(clazz.getId());
createValidate.setMajorId(clazz.getMajorId());
createValidate.setCollegeId(clazz.getCollegeId());
Integer enrollmentYear = clazz.getEnrollmentYear();
createValidate.setGrade(calculateGrade(enrollmentYear));
createValidate.setEnrollmentYear(enrollmentYear);
createValidate.setExpectedGraduationYear(enrollmentYear + 4);
createValidate.setStudentStatus(1);
createValidate.setIdCard(idCard);
createValidate.setBirthday(RandomUtil.StrBirthdayFromIdCard(idCard));
createValidate.setPoliticalStatus(random.nextInt(3) + 1);
createValidate.setIsVerified(1);
createValidate.setVerifiedBy(1);
createValidate.setVerifiedTime(System.currentTimeMillis() / 1000);
createValidate.setCounselorId(clazz.getHeadTeacherId());
// 创建学生信息
add(createValidate);
}
studentInfoMapper.delete(new QueryWrapper<StudentInfo>().eq("student_id", id));
}
private <T, M extends BaseMapper<T>> T getRandomEntity(M mapper) {
@ -310,6 +389,7 @@ public class StudentInfoServiceImpl implements IStudentInfoService {
/**
* 根据班级入学年份计算当前年级
*
* @param enrollmentYear 班级入学年份
* @return 当前年级1-4 对应大一到大四
*/
@ -342,9 +422,9 @@ public class StudentInfoServiceImpl implements IStudentInfoService {
}
/**
* 生成随机的用户信息返回身份证号
* 生成随机的用户信息返回身份证号
* 由于user实体不存储身份证号但生成的用户账户是根据身份证后六位生成的故需要让方法返回一个身份证号
* */
*/
public String createRandomUser(User user) {
// 生成随机姓名
String name = RandomUtil.randomName();

View File

@ -3,8 +3,6 @@ package com.mdd.admin.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mdd.admin.LikeAdminThreadLocal;
import com.mdd.admin.validate.StudentBaseInfoCreateValidate;
import com.mdd.admin.validate.commons.PageValidate;
import com.mdd.admin.service.IStudentRegistrationService;
import com.mdd.admin.validate.StudentRegistrationCreateValidate;
@ -15,24 +13,20 @@ import com.mdd.admin.vo.StudentRegistrationDetailVo;
import com.mdd.common.core.PageResult;
import com.mdd.common.entity.StudentBaseInfo;
import com.mdd.common.entity.StudentRegistration;
import com.mdd.common.entity.admin.Admin;
import com.mdd.common.mapper.StudentBaseInfoMapper;
import com.mdd.common.mapper.StudentRegistrationMapper;
import com.mdd.common.mapper.admin.AdminMapper;
import com.mdd.common.util.RandomUtil;
import com.mdd.common.util.TimeUtils;
import io.netty.util.internal.ThreadLocalRandom;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.*;
/**
* 学生注册状态实现类
*
* @author gyp
*/
@Service
@ -45,42 +39,41 @@ public class StudentRegistrationServiceImpl implements IStudentRegistrationServi
private StudentBaseInfoMapper studentBaseInfoMapper;
/**
* 学生注册状态列表
*
* @author gyp
* @param pageValidate 分页参数
* @param pageValidate 分页参数
* @param searchValidate 搜索参数
* @return PageResult<StudentRegistrationListedVo>
* @author gyp
*/
@Override
public PageResult<StudentRegistrationListedVo> list(PageValidate pageValidate, StudentRegistrationSearchValidate searchValidate) {
Integer page = pageValidate.getPage_no();
Integer page = pageValidate.getPage_no();
Integer limit = pageValidate.getPage_size();
QueryWrapper<StudentRegistration> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("id");
studentRegistrationMapper.setSearch(queryWrapper, searchValidate, new String[]{
"=:baseInfoId@base_info_id:int",
"=:applicationNumber@application_number:str",
"=:invitationCode@invitation_code:str",
"=:intendedCollegeId@intended_college_id:int",
"=:intendedMajorId@intended_major_id:int",
"=:admissionStatus@admission_status:int",
"=:paymentStatus@payment_status:int",
"=:registrationStatus@registration_status:int",
"=:approvalStatus@approval_status:int",
"=:isAssigned@is_assigned:int",
"=:approvedBy@approved_by:int",
"=:baseInfoId@base_info_id:int",
"=:applicationNumber@application_number:str",
"=:invitationCode@invitation_code:str",
"=:intendedCollegeId@intended_college_id:int",
"=:intendedMajorId@intended_major_id:int",
"=:admissionStatus@admission_status:int",
"=:paymentStatus@payment_status:int",
"=:registrationStatus@registration_status:int",
"=:approvalStatus@approval_status:int",
"=:isAssigned@is_assigned:int",
"=:approvedBy@approved_by:int",
});
IPage<StudentRegistration> iPage = studentRegistrationMapper.selectPage(new Page<>(page, limit), queryWrapper);
List<StudentRegistrationListedVo> list = new LinkedList<>();
for(StudentRegistration item : iPage.getRecords()) {
for (StudentRegistration item : iPage.getRecords()) {
StudentRegistrationListedVo vo = new StudentRegistrationListedVo();
BeanUtils.copyProperties(item, vo);
vo.setApplicationTime(TimeUtils.timestampToDate(item.getApplicationTime()));
@ -104,16 +97,16 @@ public class StudentRegistrationServiceImpl implements IStudentRegistrationServi
/**
* 学生注册状态详情
*
* @author gyp
* @param id 主键参数
* @return StudentRegistration
* @author gyp
*/
@Override
public StudentRegistrationDetailVo detail(Integer id) {
StudentRegistration model = studentRegistrationMapper.selectOne(
new QueryWrapper<StudentRegistration>()
.eq("id", id)
.last("limit 1"));
.eq("id", id)
.last("limit 1"));
Assert.notNull(model, "数据不存在");
@ -125,8 +118,8 @@ public class StudentRegistrationServiceImpl implements IStudentRegistrationServi
/**
* 学生注册状态新增
*
* @author gyp
* @param createValidate 参数
* @author gyp
*/
@Override
public void add(StudentRegistrationCreateValidate createValidate) {
@ -147,15 +140,15 @@ public class StudentRegistrationServiceImpl implements IStudentRegistrationServi
/**
* 学生注册状态编辑
*
* @author gyp
* @param updateValidate 参数
* @author gyp
*/
@Override
public void edit(StudentRegistrationUpdateValidate updateValidate) {
StudentRegistration model = studentRegistrationMapper.selectOne(
new QueryWrapper<StudentRegistration>()
.eq("id", updateValidate.getId())
.last("limit 1"));
.eq("id", updateValidate.getId())
.last("limit 1"));
Assert.notNull(model, "数据不存在!");
// 检测是否是非法操作未检测
@ -168,67 +161,18 @@ public class StudentRegistrationServiceImpl implements IStudentRegistrationServi
/**
* 学生注册状态删除
*
* @author gyp
* @param id 主键ID
* @author gyp
*/
@Override
public void del(Integer id) {
StudentRegistration model = studentRegistrationMapper.selectOne(
new QueryWrapper<StudentRegistration>()
.eq("id", id)
.last("limit 1"));
.eq("id", id)
.last("limit 1"));
Assert.notNull(model, "数据不存在!");
studentRegistrationMapper.delete(new QueryWrapper<StudentRegistration>().eq("id", id));
}
/**
*
* 创建随机报名注册信息
* */
@Override
public void genRegInfo(Integer num) {
Random random = ThreadLocalRandom.current();
for (int i = 0; i < num; i++) {
String name = RandomUtil.randomName();
String idCard = RandomUtil.randomIdCard();
LocalDate birthday = RandomUtil.birthdayFromIdCard(idCard);
Integer gender = RandomUtil.genderFromIdCard(idCard);
StudentBaseInfoCreateValidate createValidate = new StudentBaseInfoCreateValidate();
createValidate.setName(name);
createValidate.setIdCard(idCard);
createValidate.setGender(gender);
createValidate.setBirthday(birthday);
createValidate.setEmail("123456test@mz.com");
createValidate.setNationality("汉族");
createValidate.setPhone(RandomUtil.randomPhone());
createValidate.setHomeAddress("测试家庭住址");
createValidate.setNativePlace("北京");
createValidate.setPoliticalStatus(random.nextInt(3));
createValidate.setEmergencyContact(RandomUtil.randomName());
createValidate.setEmergencyPhone(RandomUtil.randomPhone());
createValidate.setRelationship("紧急联系人测试");
createValidate.setPreviousSchool("测试学校");
createValidate.setSchoolType(random.nextInt(2)+1);
createValidate.setGraduationYear(2025);
StudentBaseInfo model1 = new StudentBaseInfo();
BeanUtils.copyProperties(createValidate, model1);
studentBaseInfoMapper.insert(model1);
Long currentTime = System.currentTimeMillis()/1000;
StudentRegistration model2 = new StudentRegistration();
model2.setBaseInfoId(model1.getId());
model2.setApplicationNumber("test"+ model1.getIdCard().substring(13)); // 设置报考编号
model2.setInvitationCode(createValidate.getInvitationCode());
model2.setApplicationTime(currentTime);
model2.setCreateTime(currentTime);
model2.setUpdateTime(currentTime);
try{
studentRegistrationMapper.insert(model2);
}
catch (Exception ignored){}
}
}
}

View File

@ -6,6 +6,7 @@ import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
@Data
@ -19,7 +20,7 @@ public class StudentBaseInfoCreateValidate implements Serializable {
private String name;
@NotNull(message = "性别参数缺失")
@ApiModelProperty(value = "性别0-未知 1-男 2-女")
@ApiModelProperty(value = "性别0-女 1-男")
private Integer gender;
@NotNull(message = "身份证参数缺失")
@ -65,6 +66,9 @@ public class StudentBaseInfoCreateValidate implements Serializable {
@ApiModelProperty(value = "籍贯")
private String nativePlace;
@ApiModelProperty(value = "邮政编码")
private String postalCode;
@NotNull(message = "毕业学校参数缺失")
@ApiModelProperty(value = "毕业学校")
private String previousSchool;
@ -77,6 +81,22 @@ public class StudentBaseInfoCreateValidate implements Serializable {
@ApiModelProperty(value = "毕业年份")
private Integer graduationYear;
@ApiModelProperty(value = "邀请码")
private String invitationCode;
@NotNull(message = "学历参数缺失")
@ApiModelProperty(value = "学历1-初中 2-高中 3-中专 4-大专 5-本科 6-硕士 7-博士")
private Integer academicQualification;
@ApiModelProperty(value = "原所学专业")
private String majorStudied;
@ApiModelProperty(value = "身高cm")
private BigDecimal height;
@ApiModelProperty(value = "体重kg")
private BigDecimal weight;
@ApiModelProperty(value = "鞋码")
private Integer shoeSize;
@ApiModelProperty(value = "关联学生学业信息ID")
private Long studentId;
}

View File

@ -3,6 +3,7 @@ package com.mdd.admin.validate;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@ -12,13 +13,13 @@ public class StudentBaseInfoSearchValidate implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "关联用户ID")
private Integer userId;
@ApiModelProperty(value = "关联学生学业信息ID")
private Integer studentId;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "性别0-未知 1-男 2-女")
@ApiModelProperty(value = "性别0-女 1-男")
private Integer gender;
@ApiModelProperty(value = "身份证号")

View File

@ -7,11 +7,12 @@ import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
/**
* 学生基本信息参数
*
* @author gyp
*/
@Data
@ -20,16 +21,19 @@ public class StudentBaseInfoUpdateValidate implements Serializable {
private static final long serialVersionUID = 1L;
@IDMust(message = "id参数必传且需大于0")
@IDMust(message = "studentBaseId参数必传且需大于0")
@ApiModelProperty(value = "主键ID")
private Integer id;
private Long studentBaseId;
@ApiModelProperty(value = "关联学生学业信息ID")
private Long studentId;
@NotNull(message = "name参数缺失")
@ApiModelProperty(value = "姓名")
private String name;
@NotNull(message = "gender参数缺失")
@ApiModelProperty(value = "性别0-未知 1-男 2-女")
@ApiModelProperty(value = "性别0-女 1-男")
private Integer gender;
@NotNull(message = "idCard参数缺失")
@ -100,4 +104,13 @@ public class StudentBaseInfoUpdateValidate implements Serializable {
@ApiModelProperty(value = "原所学专业")
private String majorStudied;
@ApiModelProperty(value = "身高cm")
private BigDecimal height;
@ApiModelProperty(value = "体重kg")
private BigDecimal weight;
@ApiModelProperty(value = "鞋码")
private Integer shoeSize;
}

View File

@ -3,6 +3,7 @@ package com.mdd.admin.validate;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigDecimal;
@ -14,18 +15,6 @@ public class StudentInfoCreateValidate implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull(message = "name参数缺失")
@ApiModelProperty(value = "姓名")
private String name;
@NotNull(message = "gender参数缺失")
@ApiModelProperty(value = "性别 1-男 2-女")
private Integer gender;
@NotNull(message = "userId参数缺失")
@ApiModelProperty(value = "关联用户ID")
private Integer userId;
@NotNull(message = "studentNumber参数缺失")
@ApiModelProperty(value = "学号")
private String studentNumber;
@ -55,50 +44,116 @@ public class StudentInfoCreateValidate implements Serializable {
private Integer expectedGraduationYear;
@NotNull(message = "studentStatus参数缺失")
@ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]")
@ApiModelProperty(value = "学生状态: [0=预报名, 1=报名, 2=在读, 3=休学, 4=毕业, 5=退学]")
private Integer studentStatus;
@NotNull(message = "idCard参数缺失")
@ApiModelProperty(value = "身份证号")
private String idCard;
@NotNull(message = "birthday参数缺失")
@ApiModelProperty(value = "出生日期")
private String birthday;
@NotNull(message = "politicalStatus参数缺失")
@ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]")
private Integer politicalStatus;
@NotNull(message = "nativePlace参数缺失")
@ApiModelProperty(value = "籍贯")
private String nativePlace;
@ApiModelProperty(value = "家庭住址")
private String homeAddress;
@ApiModelProperty(value = "紧急联系人")
private String emergencyContact;
@ApiModelProperty(value = "紧急联系电话")
private String emergencyPhone;
@ApiModelProperty(value = "宿舍号")
private String dormitory;
@ApiModelProperty(value = "辅导员用户ID")
private Integer counselorId;
@NotNull(message = "isVerified参数缺失")
@ApiModelProperty(value = "总学分")
private BigDecimal totalCredits;
@ApiModelProperty(value = "平均绩点")
private BigDecimal gpa;
@ApiModelProperty(value = "学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]")
private Integer academicWarnings;
@ApiModelProperty(value = "中考成绩")
private BigDecimal highSchoolScore;
@ApiModelProperty(value = "预报名金额")
private BigDecimal preRegistrationAmount;
@ApiModelProperty(value = "招生老师ID")
private Integer recruitmentTeacherId;
@ApiModelProperty(value = "接待老师ID")
private Integer receptionTeacherId;
@ApiModelProperty(value = "预报名时间")
private Long preRegistrationTime;
@ApiModelProperty(value = "邀请码")
private String invitationCode;
@ApiModelProperty(value = "是否认证: [0=未认证, 1=已认证]")
private Integer isVerified;
@NotNull(message = "verifiedBy参数缺失")
@ApiModelProperty(value = "认证人ID")
private Integer verifiedBy;
@NotNull(message = "verifiedTime参数缺失")
@ApiModelProperty(value = "认证时间")
private Long verifiedTime;
// 基本信息字段用于同时创建
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "性别0-女 1-男")
private Integer gender;
@ApiModelProperty(value = "身份证号")
private String idCard;
@ApiModelProperty(value = "出生日期")
private String birthday;
@ApiModelProperty(value = "民族")
private String nationality;
@ApiModelProperty(value = "政治面貌0-群众 1-团员 2-党员 3-其他")
private Integer politicalStatus;
@ApiModelProperty(value = "手机号码")
private String phone;
@ApiModelProperty(value = "邮箱")
private String email;
@ApiModelProperty(value = "紧急联系人")
private String emergencyContact;
@ApiModelProperty(value = "紧急联系电话")
private String emergencyPhone;
@ApiModelProperty(value = "与紧急联系人关系")
private String relationship;
@ApiModelProperty(value = "家庭住址")
private String homeAddress;
@ApiModelProperty(value = "籍贯")
private String nativePlace;
@ApiModelProperty(value = "邮政编码")
private String postalCode;
@ApiModelProperty(value = "毕业学校")
private String previousSchool;
@ApiModelProperty(value = "学校类型1-普通高中 2-职业高中 3-中专 4-大专 5-本科 6-其他")
private Integer schoolType;
@ApiModelProperty(value = "毕业年份")
private Integer graduationYear;
@ApiModelProperty(value = "学历1-初中 2-高中 3-中专 4-大专 5-本科 6-硕士 7-博士")
private Integer academicQualification;
@ApiModelProperty(value = "原所学专业")
private String majorStudied;
@ApiModelProperty(value = "身高cm")
private BigDecimal height;
@ApiModelProperty(value = "体重kg")
private BigDecimal weight;
@ApiModelProperty(value = "鞋码")
private Integer shoeSize;
}

View File

@ -3,6 +3,7 @@ package com.mdd.admin.validate;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigDecimal;
@ -13,12 +14,6 @@ public class StudentInfoSearchValidate implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "性别 1-男 2-女")
private Integer gender;
@ApiModelProperty(value = "学号")
private String studentNumber;
@ -37,12 +32,9 @@ public class StudentInfoSearchValidate implements Serializable {
@ApiModelProperty(value = "入学年份")
private Integer enrollmentYear;
@ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]")
@ApiModelProperty(value = "学生状态: [0=预报名, 1=报名, 2=在读, 3=休学, 4=毕业, 5=退学]")
private Integer studentStatus;
@ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]")
private Integer politicalStatus;
@ApiModelProperty(value = "宿舍号")
private String dormitory;

View File

@ -3,14 +3,17 @@ package com.mdd.admin.validate;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.math.BigDecimal;
import com.mdd.common.validator.annotation.IDMust;
/**
* 学生信息参数
*
* @author gyp
*/
@Data
@ -19,35 +22,22 @@ public class StudentInfoUpdateValidate implements Serializable {
private static final long serialVersionUID = 1L;
@IDMust(message = "id参数必传且需大于0")
@ApiModelProperty(value = "主键")
private Integer id;
@NotNull(message = "name参数缺失")
@ApiModelProperty(value = "姓名")
private String name;
@NotNull(message = "gender参数缺失")
@ApiModelProperty(value = "性别 1-男 2-女")
private Integer gender;
@NotNull(message = "userId参数缺失")
@ApiModelProperty(value = "关联用户ID")
private Integer userId;
private Long studentId;
@NotNull(message = "studentNumber参数缺失")
@ApiModelProperty(value = "学号")
private String studentNumber;
@NotNull(message = "collegeId参数缺失")
// @NotNull(message = "collegeId参数缺失")
@ApiModelProperty(value = "学院ID")
private Integer collegeId;
@NotNull(message = "majorId参数缺失")
// @NotNull(message = "majorId参数缺失")
@ApiModelProperty(value = "专业ID")
private Integer majorId;
@NotNull(message = "classId参数缺失")
// @NotNull(message = "classId参数缺失")
@ApiModelProperty(value = "班级ID")
private Integer classId;
@ -64,34 +54,9 @@ public class StudentInfoUpdateValidate implements Serializable {
private Integer expectedGraduationYear;
@NotNull(message = "studentStatus参数缺失")
@ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]")
@ApiModelProperty(value = "学生状态: [0=预报名, 1=报名, 2=在读, 3=休学, 4=毕业, 5=退学]")
private Integer studentStatus;
@NotNull(message = "idCard参数缺失")
@ApiModelProperty(value = "身份证号")
private String idCard;
@NotNull(message = "birthday参数缺失")
@ApiModelProperty(value = "出生日期")
private String birthday;
@NotNull(message = "politicalStatus参数缺失")
@ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]")
private Integer politicalStatus;
@NotNull(message = "nativePlace参数缺失")
@ApiModelProperty(value = "籍贯")
private String nativePlace;
@ApiModelProperty(value = "家庭住址")
private String homeAddress;
@ApiModelProperty(value = "紧急联系人")
private String emergencyContact;
@ApiModelProperty(value = "紧急联系电话")
private String emergencyPhone;
@ApiModelProperty(value = "宿舍号")
private String dormitory;
@ -107,16 +72,101 @@ public class StudentInfoUpdateValidate implements Serializable {
@ApiModelProperty(value = "学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]")
private Integer academicWarnings;
@NotNull(message = "isVerified参数缺失")
@ApiModelProperty(value = "中考成绩")
private BigDecimal highSchoolScore;
@ApiModelProperty(value = "预报名金额")
private BigDecimal preRegistrationAmount;
@ApiModelProperty(value = "招生老师ID")
private Integer recruitmentTeacherId;
@ApiModelProperty(value = "接待老师ID")
private Integer receptionTeacherId;
@ApiModelProperty(value = "预报名时间")
private Long preRegistrationTime;
@ApiModelProperty(value = "邀请码")
private String invitationCode;
@ApiModelProperty(value = "是否认证: [0=未认证, 1=已认证]")
private Integer isVerified;
@NotNull(message = "verifiedBy参数缺失")
@ApiModelProperty(value = "认证人ID")
private Integer verifiedBy;
@NotNull(message = "verifiedTime参数缺失")
@ApiModelProperty(value = "认证时间")
private Long verifiedTime;
// 基本信息字段用于同时更新
@ApiModelProperty(value = "基本信息主键ID")
private Long studentBaseId;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "性别0-女 1-男")
private Integer gender;
@ApiModelProperty(value = "身份证号")
private String idCard;
@ApiModelProperty(value = "出生日期")
private String birthday;
@ApiModelProperty(value = "民族")
private String nationality;
@ApiModelProperty(value = "政治面貌0-群众 1-团员 2-党员 3-其他")
private Integer politicalStatus;
@ApiModelProperty(value = "手机号码")
private String phone;
@ApiModelProperty(value = "邮箱")
private String email;
@ApiModelProperty(value = "紧急联系人")
private String emergencyContact;
@ApiModelProperty(value = "紧急联系电话")
private String emergencyPhone;
@ApiModelProperty(value = "与紧急联系人关系")
private String relationship;
@ApiModelProperty(value = "家庭住址")
private String homeAddress;
@ApiModelProperty(value = "籍贯")
private String nativePlace;
@ApiModelProperty(value = "邮政编码")
private String postalCode;
@ApiModelProperty(value = "毕业学校")
private String previousSchool;
@ApiModelProperty(value = "学校类型1-普通高中 2-职业高中 3-中专 4-大专 5-本科 6-其他")
private Integer schoolType;
@ApiModelProperty(value = "毕业年份")
private Integer graduationYear;
@ApiModelProperty(value = "学历1-初中 2-高中 3-中专 4-大专 5-本科 6-硕士 7-博士")
private Integer academicQualification;
@ApiModelProperty(value = "原所学专业")
private String majorStudied;
@ApiModelProperty(value = "身高cm")
private BigDecimal height;
@ApiModelProperty(value = "体重kg")
private BigDecimal weight;
@ApiModelProperty(value = "鞋码")
private Integer shoeSize;
}

View File

@ -15,11 +15,11 @@ public class StudentRegistrationCreateValidate implements Serializable {
@NotNull(message = "userId参数缺失")
@ApiModelProperty(value = "用户ID")
private Integer userId;
private Long userId;
@NotNull(message = "baseInfoId参数缺失")
@ApiModelProperty(value = "关联基本信息ID")
private Integer baseInfoId;
private Long baseInfoId;
@NotNull(message = "applicationNumber参数缺失")
@ApiModelProperty(value = "报名编号")
@ -57,5 +57,4 @@ public class StudentRegistrationCreateValidate implements Serializable {
private Long applicationTime;
}

View File

@ -14,15 +14,15 @@ public class StudentBaseInfoDetailVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
private Integer id;
private Long studentBaseId;
@ApiModelProperty(value = "关联用户ID")
private Integer userId;
@ApiModelProperty(value = "关联学生学业信息ID")
private Integer studentId;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "性别0-未知 1-男 2-女")
@ApiModelProperty(value = "性别0-女 1-男")
private Integer gender;
@ApiModelProperty(value = "身份证号")

View File

@ -14,15 +14,15 @@ public class StudentBaseInfoListedVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
private Integer id;
private Long studentBaseId;
@ApiModelProperty(value = "关联用户ID")
private Integer userId;
@ApiModelProperty(value = "关联学生学业信息ID")
private Integer studentId;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "性别0-未知 1-男 2-女")
@ApiModelProperty(value = "性别0-女 1-男")
private Integer gender;
@ApiModelProperty(value = "身份证号")

View File

@ -15,16 +15,7 @@ public class StudentInfoDetailVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Integer id;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "性别 1-男 2-女")
private Integer gender;
@ApiModelProperty(value = "关联用户ID")
private Integer userId;
private Long studentId;
@ApiModelProperty(value = "学号")
private String studentNumber;
@ -47,30 +38,9 @@ public class StudentInfoDetailVo implements Serializable {
@ApiModelProperty(value = "预计毕业年份")
private Integer expectedGraduationYear;
@ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]")
@ApiModelProperty(value = "学生状态: [0=预报名, 1=报名, 2=在读, 3=休学, 4=毕业, 5=退学]")
private Integer studentStatus;
@ApiModelProperty(value = "身份证号")
private String idCard;
@ApiModelProperty(value = "出生日期")
private String birthday;
@ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]")
private Integer politicalStatus;
@ApiModelProperty(value = "籍贯")
private String nativePlace;
@ApiModelProperty(value = "家庭住址")
private String homeAddress;
@ApiModelProperty(value = "紧急联系人")
private String emergencyContact;
@ApiModelProperty(value = "紧急联系电话")
private String emergencyPhone;
@ApiModelProperty(value = "宿舍号")
private String dormitory;
@ -86,6 +56,24 @@ public class StudentInfoDetailVo implements Serializable {
@ApiModelProperty(value = "学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]")
private Integer academicWarnings;
@ApiModelProperty(value = "中考成绩")
private BigDecimal highSchoolScore;
@ApiModelProperty(value = "预报名金额")
private BigDecimal preRegistrationAmount;
@ApiModelProperty(value = "招生老师ID")
private Integer recruitmentTeacherId;
@ApiModelProperty(value = "接待老师ID")
private Integer receptionTeacherId;
@ApiModelProperty(value = "预报名时间")
private Long preRegistrationTime;
@ApiModelProperty(value = "邀请码")
private String invitationCode;
@ApiModelProperty(value = "是否认证: [0=未认证, 1=已认证]")
private Integer isVerified;
@ -95,5 +83,74 @@ public class StudentInfoDetailVo implements Serializable {
@ApiModelProperty(value = "认证时间")
private Long verifiedTime;
// 基本信息字段
@ApiModelProperty(value = "基本信息主键ID")
private Long studentBaseId;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "性别0-女 1-男")
private Integer gender;
@ApiModelProperty(value = "身份证号")
private String idCard;
@ApiModelProperty(value = "出生日期")
private String birthday;
@ApiModelProperty(value = "民族")
private String nationality;
@ApiModelProperty(value = "政治面貌0-群众 1-团员 2-党员 3-其他")
private Integer politicalStatus;
@ApiModelProperty(value = "手机号码")
private String phone;
@ApiModelProperty(value = "邮箱")
private String email;
@ApiModelProperty(value = "紧急联系人")
private String emergencyContact;
@ApiModelProperty(value = "紧急联系电话")
private String emergencyPhone;
@ApiModelProperty(value = "与紧急联系人关系")
private String relationship;
@ApiModelProperty(value = "家庭住址")
private String homeAddress;
@ApiModelProperty(value = "籍贯")
private String nativePlace;
@ApiModelProperty(value = "邮政编码")
private String postalCode;
@ApiModelProperty(value = "毕业学校")
private String previousSchool;
@ApiModelProperty(value = "学校类型1-普通高中 2-职业高中 3-中专 4-大专 5-本科 6-其他")
private Integer schoolType;
@ApiModelProperty(value = "毕业年份")
private Integer graduationYear;
@ApiModelProperty(value = "学历1-初中 2-高中 3-中专 4-大专 5-本科 6-硕士 7-博士")
private Integer academicQualification;
@ApiModelProperty(value = "原所学专业")
private String majorStudied;
@ApiModelProperty(value = "身高cm")
private BigDecimal height;
@ApiModelProperty(value = "体重kg")
private BigDecimal weight;
@ApiModelProperty(value = "鞋码")
private Integer shoeSize;
}

View File

@ -15,14 +15,11 @@ public class StudentInfoListedVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Integer id;
private Long studentId;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "性别 1-男 2-女")
private Integer gender;
@ApiModelProperty(value = "学号")
private String studentNumber;
@ -53,30 +50,9 @@ public class StudentInfoListedVo implements Serializable {
@ApiModelProperty(value = "预计毕业年份")
private Integer expectedGraduationYear;
@ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]")
@ApiModelProperty(value = "学生状态: [0=预报名, 1=报名, 2=在读, 3=休学, 4=毕业, 5=退学]")
private Integer studentStatus;
@ApiModelProperty(value = "身份证号")
private String idCard;
@ApiModelProperty(value = "出生日期")
private String birthday;
@ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]")
private Integer politicalStatus;
@ApiModelProperty(value = "籍贯")
private String nativePlace;
@ApiModelProperty(value = "家庭住址")
private String homeAddress;
@ApiModelProperty(value = "紧急联系人")
private String emergencyContact;
@ApiModelProperty(value = "紧急联系电话")
private String emergencyPhone;
@ApiModelProperty(value = "宿舍号")
private String dormitory;
@ -113,5 +89,4 @@ public class StudentInfoListedVo implements Serializable {
@ApiModelProperty(value = "更新时间")
private String updateTime;
}

View File

@ -9,7 +9,6 @@ import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Date;
@Data
@ApiModel("资产信息实体")
@ -17,7 +16,7 @@ public class AssetInfo implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value="id", type= IdType.AUTO)
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "唯一标识")
private Integer id;

View File

@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
@ -16,14 +17,17 @@ public class StudentBaseInfo implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value="id", type= IdType.AUTO)
@TableId(value = "student_base_id", type = IdType.AUTO)
@ApiModelProperty(value = "主键ID")
private Integer id;
private Long studentBaseId;
@ApiModelProperty(value = "学生学业信息表主键ID")
private Long studentId;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "性别:0-未知 1-男 2-女")
@ApiModelProperty(value = "性别:1-男 0-女")
private Integer gender;
@ApiModelProperty(value = "身份证号")
@ -59,25 +63,40 @@ public class StudentBaseInfo implements Serializable {
@ApiModelProperty(value = "籍贯")
private String nativePlace;
@ApiModelProperty(value = "邮政编码")
private String postalCode;
@ApiModelProperty(value = "毕业学校")
private String previousSchool;
@ApiModelProperty(value = "学校类型1-普高 2-中职")
@ApiModelProperty(value = "学校类型1-普通高中 2-职业高中 3-中专 4-大专 5-本科 6-其他")
private Integer schoolType;
@ApiModelProperty(value = "毕业年份")
private Integer graduationYear;
@ApiModelProperty(value = "邀请码")
private String invitationCode;
@ApiModelProperty(value = "学历1-初中 2-高中 3-中专 4-大专 5-本科 6-硕士 7-博士")
private Integer academicQualification;
@ApiModelProperty(value = "原所学专业")
private String majorStudied;
@ApiModelProperty(value = "身高cm")
private BigDecimal height;
@ApiModelProperty(value = "体重kg")
private BigDecimal weight;
@ApiModelProperty(value = "鞋码")
private Integer shoeSize;
@ApiModelProperty(value = "创建时间")
private Long createTime;
private Date createTime;
@ApiModelProperty(value = "更新时间")
private Long updateTime;
private Date updateTime;
@ApiModelProperty(value = "删除时间")
private Long deleteTime;
private Date deleteTime;
}

View File

@ -8,7 +8,7 @@ import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ApiModel("学生信息实体")
@ -16,18 +16,9 @@ public class StudentInfo implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value="id", type= IdType.AUTO)
@TableId(value = "student_id", type = IdType.AUTO)
@ApiModelProperty(value = "主键")
private Integer id;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "性别 1-男 2-女")
private Integer gender;
@ApiModelProperty(value = "关联用户ID")
private Integer userId;
private Long studentId;
@ApiModelProperty(value = "学号")
private String studentNumber;
@ -50,30 +41,9 @@ public class StudentInfo implements Serializable {
@ApiModelProperty(value = "预计毕业年份")
private Integer expectedGraduationYear;
@ApiModelProperty(value = "学生状态: [1=在读, 2=休学, 3=毕业, 4=退学]")
@ApiModelProperty(value = "学生状态: [0=预报名, 1=报名, 2=在读, 3=休学, 4=毕业, 5=退学]")
private Integer studentStatus;
@ApiModelProperty(value = "身份证号")
private String idCard;
@ApiModelProperty(value = "出生日期")
private String birthday;
@ApiModelProperty(value = "政治面貌: [1=党员, 2=团员, 3=群众]")
private Integer politicalStatus;
@ApiModelProperty(value = "籍贯")
private String nativePlace;
@ApiModelProperty(value = "家庭住址")
private String homeAddress;
@ApiModelProperty(value = "紧急联系人")
private String emergencyContact;
@ApiModelProperty(value = "紧急联系电话")
private String emergencyPhone;
@ApiModelProperty(value = "宿舍号")
private String dormitory;
@ -89,6 +59,24 @@ public class StudentInfo implements Serializable {
@ApiModelProperty(value = "学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]")
private Integer academicWarnings;
@ApiModelProperty(value = "中考成绩")
private BigDecimal highSchoolScore;
@ApiModelProperty(value = "预报名金额")
private BigDecimal preRegistrationAmount;
@ApiModelProperty(value = "招生老师ID")
private Integer recruitmentTeacherId;
@ApiModelProperty(value = "接待老师ID")
private Integer receptionTeacherId;
@ApiModelProperty(value = "预报名时间")
private Long preRegistrationTime;
@ApiModelProperty(value = "邀请码")
private String invitationCode;
@ApiModelProperty(value = "是否认证: [0=未认证, 1=已认证]")
private Integer isVerified;
@ -99,12 +87,12 @@ public class StudentInfo implements Serializable {
private Long verifiedTime;
@ApiModelProperty(value = "创建时间")
private Long createTime;
private Date createTime;
@ApiModelProperty(value = "更新时间")
private Long updateTime;
private Date updateTime;
@ApiModelProperty(value = "删除时间")
private Long deleteTime;
private Date deleteTime;
}

View File

@ -14,12 +14,12 @@ public class StudentRegistration implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value="id", type= IdType.AUTO)
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "主键ID")
private Integer id;
@ApiModelProperty(value = "关联基本信息ID")
private Integer baseInfoId;
private Long baseInfoId;
@ApiModelProperty(value = "报名编号")
private String applicationNumber;

View File

@ -16,6 +16,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
@Service
public class EnrollmentServiceImpl implements IEnrollmentService {
@ -31,7 +32,7 @@ public class EnrollmentServiceImpl implements IEnrollmentService {
CertificateValidate certificateValidate = new CertificateValidate();
certificateValidate.setName(createValidate.getName());
certificateValidate.setIdCard(createValidate.getIdCard());
if(!certificate(certificateValidate).getData()){
if (!certificate(certificateValidate).getData()) {
return AjaxResult.failed("实名认证错误");
}
// 根据身份证号检测是否重复提交
@ -39,7 +40,7 @@ public class EnrollmentServiceImpl implements IEnrollmentService {
queryWrapper.eq("id_card", createValidate.getIdCard());
StudentBaseInfo studentBaseInfo = studentBaseInfoMapper.selectOne(queryWrapper);
// 检测到重复提交
if(studentBaseInfo != null){
if (studentBaseInfo != null) {
return AjaxResult.failed("请勿重复提交");
}
// 材料信息保存到数据库并且创建新的报名进度
@ -54,17 +55,17 @@ public class EnrollmentServiceImpl implements IEnrollmentService {
/**
* 材料信息保存到数据库并且创建新的报名进度
* */
*/
private void save(StudentBaseInfoCreateValidate createValidate) {
Long currentTime = System.currentTimeMillis() / 1000;
StudentBaseInfo model = new StudentBaseInfo();
BeanUtils.copyProperties(createValidate, model);
model.setCreateTime(currentTime);
model.setUpdateTime(currentTime);
model.setCreateTime(new Date());
model.setUpdateTime(new Date());
studentBaseInfoMapper.insert(model);
// 创建新的报名进度
StudentRegistration studentRegistration = new StudentRegistration();
studentRegistration.setBaseInfoId(model.getId());
studentRegistration.setBaseInfoId(model.getStudentBaseId());
studentRegistration.setApplicationNumber(getApplicationNumber(createValidate)); // 设置报考编号
studentRegistration.setInvitationCode(createValidate.getInvitationCode());
studentRegistration.setApplicationTime(currentTime);
@ -75,7 +76,7 @@ public class EnrollmentServiceImpl implements IEnrollmentService {
/**
* 报考编号生成方法(未知规则使用暂定算法)
* */
*/
private String getApplicationNumber(StudentBaseInfoCreateValidate createValidate) {
String str = createValidate.getIdCard().substring(13);
return "mozhe-default" + str + RandomUtil.randomNumber(4);
@ -89,12 +90,12 @@ public class EnrollmentServiceImpl implements IEnrollmentService {
queryWrapper.eq("id_card", idCard);
StudentBaseInfo studentBaseInfo = studentBaseInfoMapper.selectOne(queryWrapper);
// 若查找不到返回空
if(studentBaseInfo == null) return null;
if (studentBaseInfo == null) return null;
QueryWrapper<StudentRegistration> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("base_info_id", studentBaseInfo.getId());
queryWrapper2.eq("base_info_id", studentBaseInfo.getStudentBaseId());
StudentRegistration studentRegistration = studentRegistrationMapper.selectOne(queryWrapper2);
// 若有基础信息但没有报名进度报错
if(studentRegistration == null) throw new RuntimeException("无法查询报名进度,请联系系统管理员");
if (studentRegistration == null) throw new RuntimeException("无法查询报名进度,请联系系统管理员");
// 正常情况返回报考进度
BeanUtils.copyProperties(studentRegistration, processStatusVo);
return processStatusVo;

View File

@ -0,0 +1,97 @@
drop table if exists `la_student_base_info`;
create table `la_student_base_info` (
`student_base_id` bigint unsigned not null auto_increment comment '学生基本信息主键id',
`student_id` bigint null comment '学生学业信息表主键id',
-- 身份信息
`name` varchar(100) null comment '姓名',
`gender` tinyint unsigned null default '0' comment '性别1-男 0-女',
`id_card` varchar(20) null default '' comment '身份证号',
`birthday` date null comment '出生日期',
`nationality` varchar(50) null default '汉族' comment '民族',
`political_status` tinyint unsigned null default '0' comment '政治面貌0-群众 1-团员 2-党员 3-其他',
-- 联系信息
`phone` varchar(20) null default '' comment '手机号码',
`email` varchar(100) null default '' comment '邮箱',
`emergency_contact` varchar(100) null default '' comment '紧急联系人',
`emergency_phone` varchar(20) null default '' comment '紧急联系电话',
`relationship` varchar(20) null default '' comment '与紧急联系人关系',
`home_address` varchar(200) null default '' comment '家庭住址',
`native_place` varchar(100) null default '' comment '籍贯',
`postal_code` varchar(10) null default '' comment '邮政编码',
-- 教育背景
`previous_school` varchar(200) null default '' comment '毕业学校',
`school_type` tinyint unsigned null default '0' comment '学校类型1-普通高中 2-职业高中 3-中专 4-大专 5-本科 6-其他',
`graduation_year` int unsigned null default '0' comment '毕业年份',
`academic_qualification` tinyint unsigned null default '0' comment '学历1-初中 2-高中 3-中专 4-大专 5-本科 6-硕士 7-博士',
`major_studied` varchar(100) null default '' comment '原所学专业',
-- 身体信息
`height` decimal(5,2) default null comment '身高cm',
`weight` decimal(5,2) default null comment '体重kg',
`shoe_size` tinyint unsigned default null comment '鞋码',
-- 系统信息
`create_time` datetime not null default CURRENT_TIMESTAMP comment '创建时间',
`update_time` datetime null comment '更新时间',
`delete_time` datetime null comment '删除时间',
primary key (`student_base_id`),
key `idx_name` (`name`) comment '姓名索引',
key `idx_phone` (`phone`) comment '手机号索引'
) engine=innodb default charset=utf8mb4 collate=utf8mb4_0900_ai_ci comment='学生基本信息表';
drop table if exists `la_student_info`;
create table `la_student_info` (
`student_id` int unsigned not null auto_increment comment '学生学业信息表主键id',
-- 学校信息
`student_number` varchar(32) character set utf8mb4 collate utf8mb4_0900_ai_ci null comment '学号',
`college_id` int unsigned null comment '学院id',
`major_id` int unsigned null comment '专业id',
`class_id` int unsigned null comment '班级id',
`grade` tinyint unsigned null comment '年级',
`enrollment_year` int unsigned null default '0' comment '入学年份',
`expected_graduation_year` int unsigned null default '0' comment '预计毕业年份',
`student_status` tinyint unsigned null default '2' comment '学生状态: [0=预报名, 1=报名, 2=在读, 3=休学, 4=毕业, 5=退学]',
-- 住宿信息
`dormitory` varchar(50) null default '' comment '宿舍号',
-- 辅导员信息
`counselor_id` int unsigned null default '0' comment '辅导员用户id',
-- 学业信息
`total_credits` decimal(5,2) unsigned null default '0.00' comment '总学分',
`gpa` decimal(3,2) unsigned null default '0.00' comment '平均绩点',
`academic_warnings` tinyint unsigned null default '0' comment '学业预警: [0=无, 1=一级预警, 2=二级预警, 3=三级预警]',
-- 预报名信息
`high_school_score` decimal(5,2) default null comment '中考成绩',
`pre_registration_amount` decimal(10,2) default null comment '预报名金额',
`recruitment_teacher_id` int unsigned default null comment '招生老师id关联la_teacher表',
`reception_teacher_id` int unsigned default null comment '接待老师id关联la_teacher表',
`pre_registration_time` bigint unsigned null default '0' comment '预报名时间',
`invitation_code` varchar(50) default null comment '邀请码',
-- 认证信息
`is_verified` tinyint unsigned null default '0' comment '是否认证: [0=未认证, 1=已认证]',
`verified_by` int unsigned null default '0' comment '认证人id',
`verified_time` int unsigned null default '0' comment '认证时间',
-- 系统信息
`create_time` datetime not null default CURRENT_TIMESTAMP comment '创建时间',
`update_time` datetime null comment '更新时间',
`delete_time` datetime null comment '删除时间',
primary key (`student_id`) using btree,
key `college_major` (`college_id`,`major_id`) using btree comment '学院专业索引',
key `class_name` (`class_id`) using btree comment '班级索引',
key `enrollment_year` (`enrollment_year`) using btree comment '入学年份索引',
key `idx_recruitment_teacher_info` (`recruitment_teacher_id`) comment '招生老师索引',
key `idx_reception_teacher_info` (`reception_teacher_id`) comment '接待老师索引',
key `idx_pre_registration_time` (`pre_registration_time`) comment '预报名时间索引',
key `idx_invitation_code` (`invitation_code`) comment '邀请码索引'
) engine=innodb default charset=utf8mb4 collate=utf8mb4_0900_ai_ci comment='学生学业信息表';