将预报名的相关接口独立, 优化教师信息管理-添加课程功能的相关权限设置

This commit is contained in:
mirage 2026-02-28 09:29:08 +08:00
parent b4725238ec
commit 8fe4f21c14
29 changed files with 773 additions and 293 deletions

View File

@ -5,6 +5,11 @@ export function collegeLists(params?: Record<string, any>) {
return request.get({ url: '/college/list', params })
}
// 学院下拉选项列表仅id和名称免权限
export function collegeOptionLists(params?: Record<string, any>) {
return request.get({ url: '/college/options', params })
}
// 学院详情
export function collegeDetail(params: Record<string, any>) {
return request.get({ url: '/college/detail', params })

View File

@ -0,0 +1,25 @@
import request from '@/utils/request'
// 预报名学生列表
export function preRegistrationInfoLists(params?: Record<string, any>) {
return request.get({ url: '/enrollment/preRegistrationList', params })
}
// 预报名详情
export function enrollmentDetail(params: { id: number }) {
return request.get({ url: '/enrollment/detail', params })
}
// 学生单个入学
export function updateStudentStatus(params: { studentId: number }) {
return request.get({ url: '/enrollment/updateStudentStatus', params })
}
// 学生批量入学
export function batchUpdateStudentStatus(params: { studentIdList: number[] }) {
// 批量入学接口GET /enrollment/batchUpdateStudentStatus?studentIdList=1&studentIdList=2...
const query = params.studentIdList.map((id) => `studentIdList=${encodeURIComponent(id)}`).join('&')
return request.get({
url: `/enrollment/batchUpdateStudentStatus?${query}`
})
}

View File

@ -1,6 +1,6 @@
import request from '@/utils/request'
// 学生信息列表
// 学生信息列表(综合管理用)
export function infoLists(params?: Record<string, any>) {
return request.get({ url: '/info/list', params })
}

View File

@ -1,5 +1,10 @@
import request from '@/utils/request'
// 所有课程列表
export function allCourseList(params?: Record<string, any>) {
return request.get({ url: '/teacher/course/allCourseList', params })
}
// 教师信息扩展列表(管理后台用,带权限控制)
export function teacherLists(params?: Record<string, any>) {
return request.get({ url: '/teacher/list', params })

View File

@ -4,7 +4,14 @@
* @returns
*/
export const snakeToCamel = (obj: Record<string, any>): Record<string, any> => {
if (typeof obj !== 'object' || obj === null) {
if (obj === null || obj === undefined) {
return obj as any
}
// 数组:逐项递归处理,保持数组结构
if (Array.isArray(obj)) {
return obj.map((item) => snakeToCamel(item)) as any
}
if (typeof obj !== 'object') {
return obj // 非对象类型直接返回
}
@ -26,7 +33,14 @@ export const snakeToCamel = (obj: Record<string, any>): Record<string, any> => {
* @returns 线
*/
export const camelToSnake = (obj: Record<string, any>): Record<string, any> => {
if (typeof obj !== 'object' || obj === null) {
if (obj === null || obj === undefined) {
return obj as any
}
// 数组:逐项递归处理,保持数组结构
if (Array.isArray(obj)) {
return obj.map((item) => camelToSnake(item)) as any
}
if (typeof obj !== 'object') {
return obj // 非对象类型直接返回
}

View File

@ -0,0 +1,73 @@
<template>
<div class="enrollment-detail">
<popup
ref="popupRef"
title="预报名详情"
:async="true"
width="700px"
:clickModalClose="true"
:confirm-button-text="false"
cancel-button-text="关闭"
>
<div v-loading="loading" class="p-4">
<el-descriptions :column="2" border>
<el-descriptions-item label="姓名">{{ detailData.name || '-' }}</el-descriptions-item>
<el-descriptions-item label="性别">{{ formatGender(detailData.gender) }}</el-descriptions-item>
<el-descriptions-item label="身份证号" :span="2">{{ detailData.idCard || '-' }}</el-descriptions-item>
<el-descriptions-item label="毕业学校" :span="2">{{ detailData.previousSchool || '-' }}</el-descriptions-item>
<el-descriptions-item label="身高 (cm)">{{ detailData.height || '-' }}</el-descriptions-item>
<el-descriptions-item label="体重 (kg)">{{ detailData.weight || '-' }}</el-descriptions-item>
<el-descriptions-item label="鞋码">{{ detailData.shoeSize || '-' }}</el-descriptions-item>
<el-descriptions-item label="中考成绩">{{ detailData.highSchoolScore || '-' }}</el-descriptions-item>
<el-descriptions-item label="报名专业">{{ detailData.majorName || '-' }}</el-descriptions-item>
<el-descriptions-item label="招生老师">{{ detailData.recruitmentTeacherName || '-' }}</el-descriptions-item>
<el-descriptions-item label="预报名金额" :span="2">
<span class="text-red-500 font-bold" v-if="detailData.preRegistrationAmount">
¥{{ detailData.preRegistrationAmount }}
</span>
<span v-else>-</span>
</el-descriptions-item>
</el-descriptions>
</div>
</popup>
</div>
</template>
<script lang="ts" setup>
import { enrollmentDetail } from '@/api/enrollment'
import Popup from '@/components/popup/index.vue'
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const loading = ref(false)
const detailData = ref<any>({})
const formatGender = (gender: number | string | undefined) => {
if (gender === 1 || gender === '1') return '男'
if (gender === 0 || gender === '0') return '女'
return '-'
}
const open = async (id: number) => {
loading.value = true
popupRef.value?.open()
try {
detailData.value = await enrollmentDetail({ id })
} catch (e) {
console.error('获取预报名详情失败', e)
} finally {
loading.value = false
}
}
defineExpose({
open
})
</script>
<style scoped>
.enrollment-detail :deep(.el-descriptions__label) {
width: 120px;
background-color: #f5f7fa;
font-weight: bold;
}
</style>

View File

@ -119,22 +119,22 @@
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
<enrollment-detail ref="detailRef" />
</div>
</template>
<script lang="ts" setup name="info">
import { infoLists, infoDetail, infoEdit } from '@/api/info/info'
<script lang="ts" setup name="enrollment">
import {
preRegistrationInfoLists,
updateStudentStatus,
batchUpdateStudentStatus
} from '@/api/enrollment'
import { majorOptionLists } from '@/api/major'
import { teacherOptionLists } from '@/api/teacher'
import { usePaging } from '@/hooks/usePaging'
import feedback from '@/utils/feedback'
import { snakeToCamel } from '@/utils/format'
import request from '@/utils/request'
import EnrollmentDetail from './detail.vue'
import EditPopup from '../student/info/edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const showEdit = ref(false)
const detailRef = shallowRef<InstanceType<typeof EnrollmentDetail>>()
const multipleSelection = ref<any[]>([])
const majorOptions = ref<Array<{ id: number; majorName: string }>>([])
const teacherOptions = ref<Array<{ id: number; name: string }>>([])
@ -222,7 +222,7 @@ const { pager, getLists, resetPage, resetParams } = usePaging({
processedParams.recruitmentTeacherId = parseInt(processedParams.recruitmentTeacherId)
}
return infoLists(processedParams)
return preRegistrationInfoLists(processedParams)
},
params: queryParams
})
@ -232,28 +232,14 @@ onMounted(() => {
fetchTeacherOptions()
})
const handleView = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('view')
editRef.value?.getDetail(data)
const handleView = async (row: any) => {
detailRef.value?.open(row.studentId || row.id)
}
const handleEnroll = async (row: any) => {
await feedback.confirm('是否确认入学?')
//
const detail = await infoDetail({
id: row.studentId || row.student_id || row.id
})
const data = snakeToCamel(detail)
//
if (!data.studentId) {
data.studentId = row.studentId || row.student_id || row.id
}
data.id = data.studentId
//
data.studentStatus = 2
await infoEdit(data)
const studentId = row.studentId || row.id
await updateStudentStatus({ studentId })
feedback.msgSuccess('入学成功')
getLists()
}
@ -262,17 +248,13 @@ const handleBatchEnroll = async () => {
if (!multipleSelection.value.length) return
await feedback.confirm('是否确认批量入学?')
const ids = multipleSelection.value
.map((item) => item.studentId || item.student_id || item.id)
.map((item) => item.studentId || item.id)
.filter((id) => id != null)
if (!ids.length) {
feedback.msgError('未获取到有效的学生ID')
return
}
// GET /info/batchUpdateStudentStatus?studentIdList=1&studentIdList=2...
const query = ids.map((id) => `studentIdList=${encodeURIComponent(id)}`).join('&')
await request.get({
url: `/info/batchUpdateStudentStatus?${query}`
})
await batchUpdateStudentStatus({ studentIdList: ids })
feedback.msgSuccess('批量入学成功')
getLists()
}

View File

@ -86,8 +86,7 @@
<script lang="ts" setup name="course">
import type { FormInstance } from 'element-plus'
import { courseLists } from '@/api/course'
import { teacherCourseAdd, teacherCourseDelete, teacherCourseList } from '@/api/teacher'
import { allCourseList, teacherCourseAdd, teacherCourseDelete, teacherCourseList } from '@/api/teacher'
import Popup from '@/components/popup/index.vue'
import { usePaging } from '@/hooks/usePaging'
import feedback from '@/utils/feedback'
@ -103,7 +102,7 @@ interface TeacherCourseItem {
}
const teacherCoursesDetail = ref<TeacherCourseItem[]>([])
const formData = reactive({
id: '',
teacherId: '',
courseCode: '',
courseName: '',
courseType: '',
@ -116,7 +115,7 @@ const formData = reactive({
const { pager, getLists, resetPage, resetParams } = usePaging({
fetchFun: async (params: any) => {
const response = await courseLists(params)
const response = await allCourseList(params)
return {
...response,
lists: response.lists.map((item: any) => snakeToCamel(item))
@ -135,7 +134,7 @@ const handleCheckChange = async (checked: boolean, row: any) => {
//
await teacherCourseAdd({
courseId: row.id,
teacherId: formData.id
teacherId: formData.teacherId
})
fetchTeacherCourses(formData)
getLists()
@ -187,7 +186,7 @@ const formatStatus = (row: any, column: any, cellValue: any) => {
const fetchTeacherCourses = async (row: Record<string, any>) => {
try {
const response = await teacherCourseList({
teacherId: row.id
teacherId: row.teacherId || row.id
})
//
const teacherCourses = (response.lists || []).map((item: any) => snakeToCamel(item))
@ -219,6 +218,12 @@ const setFormData = async (data: Record<string, any>) => {
formData[key] = data[key]
}
}
// ID
if (data.teacherId) {
formData.teacherId = data.teacherId
} else if (data.id) {
formData.teacherId = data.id
}
}
defineExpose({

View File

@ -37,6 +37,7 @@
multiple
placeholder="请选择角色"
clearable
:disabled="!isSuperAdmin"
>
<el-option
v-for="(item, index) in optionsData.role"
@ -60,8 +61,9 @@
import type { FormInstance } from 'element-plus'
import type { PropType } from 'vue'
import { collegeLists } from '@/api/college'
import { collegeOptionLists } from '@/api/college'
import { roleAll } from '@/api/perms/role'
import useUserStore from '@/stores/modules/user'
import { teacherAdd, teacherDetail, teacherEdit } from '@/api/teacher'
import Popup from '@/components/popup/index.vue'
import { useDictOptions } from '@/hooks/useDictOptions'
@ -82,6 +84,11 @@ const getCollegeLists = ref<{ lists: Array<{ id: number; collegeName: string }>
const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑教师信息扩展' : '新增教师信息扩展'
})
const userStore = useUserStore()
const isSuperAdmin = computed(() => {
const root = (userStore.userInfo as any)?.root
return Number(root) === 1
})
const { optionsData } = useDictOptions<{
role: any[]
}>({
@ -167,8 +174,8 @@ const open = (type = 'add') => {
const fetchCollegeLists = async () => {
try {
const res = await collegeLists() //
getCollegeLists.value = res //
const res = await collegeOptionLists()
getCollegeLists.value = { lists: res || [] }
} catch (err) {
feedback.msgError('获取学院列表失败')
}
@ -182,6 +189,10 @@ const setFormData = async (data: Record<string, any>) => {
formData[key] = camelData[key]
}
}
if (Array.isArray((camelData as any).roleId)) {
//@ts-ignore
formData.roleId = (camelData as any).roleId.map((v: any) => Number(v))
}
}
const getDetail = async (row: Record<string, any>) => {

View File

@ -67,7 +67,7 @@
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['teacher:edit']"
v-perms="['teacher/course/allCourseList']"
type="primary"
link
@click="handleCourse(row)"
@ -75,7 +75,7 @@
添加课程
</el-button>
<el-button
v-perms="['teacher:edit']"
v-perms="['teacher/generateInvitationCode']"
type="primary"
link
@click="handleGenerateQrCode(row)"
@ -83,7 +83,7 @@
生成二维码
</el-button>
<el-button
v-perms="['teacher:edit']"
v-perms="['teacher/edit']"
type="primary"
link
@click="handleEdit(row)"
@ -91,7 +91,7 @@
编辑
</el-button>
<el-button
v-perms="['teacher:del']"
v-perms="['teacher/del']"
type="danger"
link
@click="handleDelete(row.teacherId)"
@ -122,12 +122,17 @@
fit="contain"
style="width: 280px; height: 280px"
/>
<div v-else-if="qrDialog.qrcodeUrl" class="py-6 text-center text-info">二维码加载失败</div>
<div v-else-if="qrDialog.qrcodeUrl" class="py-6 text-center text-info">
二维码加载失败
</div>
<div class="w-full">
<div class="text-sm text-info mb-1">邀请码</div>
<div class="flex items-center gap-2">
<el-input v-model="qrDialog.invitationCode" disabled placeholder="暂无" />
<el-button v-copy="qrDialog.invitationCode" :disabled="!qrDialog.invitationCode">
<el-button
v-copy="qrDialog.invitationCode"
:disabled="!qrDialog.invitationCode"
>
复制
</el-button>
</div>
@ -135,11 +140,7 @@
<div class="w-full">
<div class="text-sm text-info mb-1">二维码图片地址</div>
<div class="flex items-center gap-2">
<el-input
v-model="qrDialog.qrcodeUrl"
disabled
placeholder="暂无"
/>
<el-input v-model="qrDialog.qrcodeUrl" disabled placeholder="暂无" />
<el-button v-copy="qrDialog.qrcodeUrl" :disabled="!qrDialog.qrcodeUrl">
复制
</el-button>
@ -148,7 +149,11 @@
</div>
<template #footer>
<el-button @click="qrDialog.visible = false">关闭</el-button>
<el-button type="primary" :disabled="!qrDialog.qrcodeUrl" @click="downloadQrCodeImage">
<el-button
type="primary"
:disabled="!qrDialog.qrcodeUrl"
@click="downloadQrCodeImage"
>
下载二维码
</el-button>
</template>
@ -323,9 +328,12 @@ const handleGenerateQrCode = async (row: any) => {
feedback.msgSuccess('生成成功')
}
watch(() => qrDialog.visible, (visible) => {
if (!visible) revokeQrDisplayUrl()
})
watch(
() => qrDialog.visible,
(visible) => {
if (!visible) revokeQrDisplayUrl()
}
)
getLists()
</script>

View File

@ -9,8 +9,10 @@ import com.mdd.admin.validate.college.CollegeSearchValidate;
import com.mdd.admin.validate.commons.PageValidate;
import com.mdd.admin.vo.college.CollegeListedVo;
import com.mdd.admin.vo.college.CollegeDetailVo;
import com.mdd.admin.vo.college.CollegeOptionVo;
import com.mdd.common.core.AjaxResult;
import com.mdd.common.core.PageResult;
import com.mdd.common.aop.NotPower;
import com.mdd.common.validator.annotation.IDMust;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -28,15 +30,15 @@ public class CollegeController {
ICollegeService iCollegeService;
@GetMapping("/list")
@ApiOperation(value="学院列表")
@ApiOperation(value = "学院列表")
public AjaxResult<PageResult<CollegeListedVo>> list(@Validated PageValidate pageValidate,
@Validated CollegeSearchValidate searchValidate) {
@Validated CollegeSearchValidate searchValidate) {
PageResult<CollegeListedVo> list = iCollegeService.list(pageValidate, searchValidate);
return AjaxResult.success(list);
}
@GetMapping("/detail")
@ApiOperation(value="学院详情")
@ApiOperation(value = "学院详情")
public AjaxResult<CollegeDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
CollegeDetailVo detail = iCollegeService.detail(id);
return AjaxResult.success(detail);
@ -44,7 +46,7 @@ public class CollegeController {
@Log(title = "学院新增")
@PostMapping("/add")
@ApiOperation(value="学院新增")
@ApiOperation(value = "学院新增")
public AjaxResult<Object> add(@Validated @RequestBody CollegeCreateValidate createValidate) {
iCollegeService.add(createValidate);
return AjaxResult.success();
@ -52,7 +54,7 @@ public class CollegeController {
@Log(title = "学院编辑")
@PostMapping("/edit")
@ApiOperation(value="学院编辑")
@ApiOperation(value = "学院编辑")
public AjaxResult<Object> edit(@Validated @RequestBody CollegeUpdateValidate updateValidate) {
iCollegeService.edit(updateValidate);
return AjaxResult.success();
@ -60,10 +62,17 @@ public class CollegeController {
@Log(title = "学院删除")
@PostMapping("/del")
@ApiOperation(value="学院删除")
@ApiOperation(value = "学院删除")
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
iCollegeService.del(idValidate.getId());
return AjaxResult.success();
}
@GetMapping("/options")
@NotPower
@ApiOperation(value = "学院下拉选项列表")
public AjaxResult<java.util.List<CollegeOptionVo>> options() {
return AjaxResult.success(iCollegeService.optionList());
}
}

View File

@ -18,7 +18,6 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("adminapi/info")
@ -59,14 +58,6 @@ public class StudentInfoController {
return AjaxResult.success();
}
@Log(title = "学生批量入学")
@GetMapping("/batchUpdateStudentStatus")
@ApiOperation(value = "学生批量入学")
public AjaxResult<Object> batchUpdateStudentStatus(@RequestParam("studentIdList") List<Integer> studentIdList) {
iStudentInfoService.batchUpdateStudentStatus(studentIdList);
return AjaxResult.success();
}
@Log(title = "学生信息删除")
@PostMapping("/del")
@ApiOperation(value = "学生信息删除")

View File

@ -2,11 +2,14 @@ package com.mdd.admin.controller;
import com.mdd.admin.LikeAdminThreadLocal;
import com.mdd.admin.aop.Log;
import com.mdd.admin.service.ICourseService;
import com.mdd.admin.service.ITeacherCourseService;
import com.mdd.admin.validate.commons.IdValidate;
import com.mdd.admin.validate.course.CourseSearchValidate;
import com.mdd.admin.validate.teacher.TeacherCourseCreateValidate;
import com.mdd.admin.validate.teacher.TeacherCourseSearchValidate;
import com.mdd.admin.validate.commons.PageValidate;
import com.mdd.admin.vo.course.CourseListedVo;
import com.mdd.admin.vo.teacher.TeacherCourseListedVo;
import com.mdd.admin.vo.teacher.TeacherCourseDetailVo;
import com.mdd.common.aop.NotPower;
@ -28,11 +31,21 @@ public class TeacherCourseController {
@Resource
ITeacherCourseService iTeacherCourseService;
@Resource
ICourseService iCourseService;
@GetMapping("/allCourseList")
@ApiOperation(value = "获取所有课程列表")
public AjaxResult<PageResult<CourseListedVo>> list(@Validated PageValidate pageValidate,
@Validated CourseSearchValidate searchValidate) {
PageResult<CourseListedVo> list = iCourseService.list(pageValidate, searchValidate);
return AjaxResult.success(list);
}
@GetMapping("/list")
@ApiOperation(value="教师可授课程列表")
@ApiOperation(value = "教师可授课程列表")
public AjaxResult<PageResult<TeacherCourseListedVo>> list(@Validated PageValidate pageValidate,
@Validated TeacherCourseSearchValidate searchValidate) {
@Validated TeacherCourseSearchValidate searchValidate) {
PageResult<TeacherCourseListedVo> list = iTeacherCourseService.list(pageValidate, searchValidate);
return AjaxResult.success(list);
}
@ -48,7 +61,7 @@ public class TeacherCourseController {
}
@GetMapping("/detail")
@ApiOperation(value="教师可授课程详情")
@ApiOperation(value = "教师可授课程详情")
public AjaxResult<TeacherCourseDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
TeacherCourseDetailVo detail = iTeacherCourseService.detail(id);
return AjaxResult.success(detail);
@ -56,7 +69,7 @@ public class TeacherCourseController {
@Log(title = "教师可授课程新增")
@PostMapping("/add")
@ApiOperation(value="教师可授课程新增")
@ApiOperation(value = "教师可授课程新增")
public AjaxResult<Object> add(@Validated @RequestBody TeacherCourseCreateValidate createValidate) {
iTeacherCourseService.add(createValidate);
return AjaxResult.success();
@ -65,7 +78,7 @@ public class TeacherCourseController {
@Log(title = "教师可授课程删除")
@PostMapping("/del")
@ApiOperation(value="教师可授课程删除")
@ApiOperation(value = "教师可授课程删除")
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
iTeacherCourseService.del(idValidate.getId());
return AjaxResult.success();

View File

@ -0,0 +1,64 @@
package com.mdd.admin.controller.enrollment;
import com.mdd.admin.aop.Log;
import com.mdd.admin.service.IEnrollmentService;
import com.mdd.admin.validate.StudentInfoSearchValidate;
import com.mdd.admin.validate.commons.PageValidate;
import com.mdd.admin.vo.EnrollmentDetailVo;
import com.mdd.admin.vo.StudentInfoListedVo;
import com.mdd.common.core.AjaxResult;
import com.mdd.common.core.PageResult;
import com.mdd.common.validator.annotation.IDMust;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("adminapi/enrollment")
@Api(tags = "预报名管理")
public class EnrollmentController {
@Resource
IEnrollmentService iEnrollmentService;
@GetMapping("/preRegistrationList")
@ApiOperation(value = "预报名学生列表")
public AjaxResult<PageResult<StudentInfoListedVo>> preRegistrationList(@Validated PageValidate pageValidate,
@Validated StudentInfoSearchValidate searchValidate) {
// 默认只查预报名0和报名1的学生
if (searchValidate.getStudentStatus() == null) {
// 约定 -1 表示预报名+报名 Service 层统一处理
searchValidate.setStudentStatus(-1);
}
PageResult<StudentInfoListedVo> list = iEnrollmentService.list(pageValidate, searchValidate);
return AjaxResult.success(list);
}
@GetMapping("/detail")
@ApiOperation(value = "预报名详情")
public AjaxResult<EnrollmentDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
EnrollmentDetailVo detail = iEnrollmentService.detail(id);
return AjaxResult.success(detail);
}
@Log(title = "学生单个入学")
@GetMapping("/updateStudentStatus")
@ApiOperation(value = "学生单个入学")
public AjaxResult<Object> updateStudentStatus(@RequestParam("studentId") Integer studentId) {
iEnrollmentService.updateStudentStatus(studentId);
return AjaxResult.success();
}
@Log(title = "学生批量入学")
@GetMapping("/batchUpdateStudentStatus")
@ApiOperation(value = "学生批量入学")
public AjaxResult<Object> batchUpdateStudentStatus(@RequestParam("studentIdList") List<Integer> studentIdList) {
iEnrollmentService.batchUpdateStudentStatus(studentIdList);
return AjaxResult.success();
}
}

View File

@ -6,10 +6,12 @@ import com.mdd.admin.validate.college.CollegeUpdateValidate;
import com.mdd.admin.validate.college.CollegeSearchValidate;
import com.mdd.admin.vo.college.CollegeListedVo;
import com.mdd.admin.vo.college.CollegeDetailVo;
import com.mdd.admin.vo.college.CollegeOptionVo;
import com.mdd.common.core.PageResult;
/**
* 学院服务接口类
*
* @author LikeAdmin
*/
public interface ICollegeService {
@ -17,43 +19,48 @@ public interface ICollegeService {
/**
* 学院列表
*
* @author LikeAdmin
* @param pageValidate 分页参数
* @param pageValidate 分页参数
* @param searchValidate 搜索参数
* @return PageResult<CollegeListedVo>
* @author LikeAdmin
*/
PageResult<CollegeListedVo> list(PageValidate pageValidate, CollegeSearchValidate searchValidate);
/**
* 学院详情
*
* @author LikeAdmin
* @param id 主键ID
* @return CollegeDetailVo
* @author LikeAdmin
*/
CollegeDetailVo detail(Integer id);
/**
* 学院下拉选项列表
*/
java.util.List<CollegeOptionVo> optionList();
/**
* 学院新增
*
* @author LikeAdmin
* @param createValidate 参数
* @author LikeAdmin
*/
void add(CollegeCreateValidate createValidate);
/**
* 学院编辑
*
* @author LikeAdmin
* @param updateValidate 参数
* @author LikeAdmin
*/
void edit(CollegeUpdateValidate updateValidate);
/**
* 学院删除
*
* @author LikeAdmin
* @param id 主键ID
* @author LikeAdmin
*/
void del(Integer id);

View File

@ -0,0 +1,46 @@
package com.mdd.admin.service;
import com.mdd.admin.validate.StudentInfoSearchValidate;
import com.mdd.admin.validate.commons.PageValidate;
import com.mdd.admin.vo.EnrollmentDetailVo;
import com.mdd.admin.vo.StudentInfoListedVo;
import com.mdd.common.core.PageResult;
import java.util.List;
/**
* 预报名服务接口类
*/
public interface IEnrollmentService {
/**
* 预报名列表
*
* @param pageValidate 分页参数
* @param searchValidate 搜索参数
* @return PageResult<StudentInfoListedVo>
*/
PageResult<StudentInfoListedVo> list(PageValidate pageValidate, StudentInfoSearchValidate searchValidate);
/**
* 预报名详情
*
* @param id 主键ID
* @return EnrollmentDetailVo
*/
EnrollmentDetailVo detail(Integer id);
/**
* 学生入学状态更新
*
* @param studentId 学生ID
*/
void updateStudentStatus(Integer studentId);
/**
* 学生批量入学状态更新
*
* @param studentIdList 学生ID列表
*/
void batchUpdateStudentStatus(List<Integer> studentIdList);
}

View File

@ -13,6 +13,7 @@ import java.util.List;
/**
* 学生信息服务接口类
*
* @author gyp
*/
public interface IStudentInfoService {
@ -20,45 +21,43 @@ public interface IStudentInfoService {
/**
* 学生信息列表
*
* @author gyp
* @param pageValidate 分页参数
* @param pageValidate 分页参数
* @param searchValidate 搜索参数
* @return PageResult<StudentInfoListedVo>
* @author gyp
*/
PageResult<StudentInfoListedVo> list(PageValidate pageValidate, StudentInfoSearchValidate searchValidate);
/**
* 学生信息详情
*
* @author gyp
* @param id 主键ID
* @return StudentInfoDetailVo
* @author gyp
*/
StudentInfoDetailVo detail(Integer id);
/**
* 学生信息新增
*
* @author gyp
* @param createValidate 参数
* @author gyp
*/
void add(StudentInfoCreateValidate createValidate);
/**
* 学生信息编辑
*
* @author gyp
* @param updateValidate 参数
* @author gyp
*/
void edit(StudentInfoUpdateValidate updateValidate);
/**
* 学生信息删除
*
* @author gyp
* @param id 主键ID
* @author gyp
*/
void del(Integer id);
void batchUpdateStudentStatus(List<Integer> studentIdList);
}

View File

@ -10,6 +10,7 @@ import com.mdd.admin.validate.college.CollegeUpdateValidate;
import com.mdd.admin.validate.college.CollegeSearchValidate;
import com.mdd.admin.vo.college.CollegeListedVo;
import com.mdd.admin.vo.college.CollegeDetailVo;
import com.mdd.admin.vo.college.CollegeOptionVo;
import com.mdd.common.core.PageResult;
import com.mdd.common.entity.College;
import com.mdd.common.mapper.CollegeMapper;
@ -23,40 +24,41 @@ import java.util.*;
/**
* 学院实现类
*
* @author LikeAdmin
*/
@Service
public class CollegeServiceImpl implements ICollegeService {
@Resource
CollegeMapper collegeMapper;
/**
* 学院列表
*
* @author LikeAdmin
* @param pageValidate 分页参数
* @param pageValidate 分页参数
* @param searchValidate 搜索参数
* @return PageResult<CollegeListedVo>
* @author LikeAdmin
*/
@Override
public PageResult<CollegeListedVo> list(PageValidate pageValidate, CollegeSearchValidate searchValidate) {
Integer page = pageValidate.getPage_no();
Integer page = pageValidate.getPage_no();
Integer limit = pageValidate.getPage_size();
QueryWrapper<College> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("id");
collegeMapper.setSearch(queryWrapper, searchValidate, new String[]{
"=:collegeCode@college_code:str",
"like:collegeName@college_name:str",
"=:status:int",
"=:collegeCode@college_code:str",
"like:collegeName@college_name:str",
"=:status:int",
});
IPage<College> iPage = collegeMapper.selectPage(new Page<>(page, limit), queryWrapper);
List<CollegeListedVo> list = new LinkedList<>();
for(College item : iPage.getRecords()) {
for (College item : iPage.getRecords()) {
CollegeListedVo vo = new CollegeListedVo();
BeanUtils.copyProperties(item, vo);
vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime()));
@ -70,16 +72,16 @@ public class CollegeServiceImpl implements ICollegeService {
/**
* 学院详情
*
* @author LikeAdmin
* @param id 主键参数
* @return College
* @author LikeAdmin
*/
@Override
public CollegeDetailVo detail(Integer id) {
College model = collegeMapper.selectOne(
new QueryWrapper<College>()
.eq("id", id)
.last("limit 1"));
.eq("id", id)
.last("limit 1"));
Assert.notNull(model, "数据不存在");
@ -88,11 +90,30 @@ public class CollegeServiceImpl implements ICollegeService {
return vo;
}
/**
* 学院下拉选项列表
*/
@Override
public java.util.List<CollegeOptionVo> optionList() {
QueryWrapper<College> queryWrapper = new QueryWrapper<>();
queryWrapper.isNull("delete_time")
.orderByAsc("college_name");
java.util.List<College> colleges = collegeMapper.selectList(queryWrapper);
java.util.List<CollegeOptionVo> list = new java.util.ArrayList<>();
for (College college : colleges) {
CollegeOptionVo vo = new CollegeOptionVo();
vo.setId(college.getId());
vo.setCollegeName(college.getCollegeName());
list.add(vo);
}
return list;
}
/**
* 学院新增
*
* @author LikeAdmin
* @param createValidate 参数
* @author LikeAdmin
*/
@Override
public void add(CollegeCreateValidate createValidate) {
@ -115,15 +136,15 @@ public class CollegeServiceImpl implements ICollegeService {
/**
* 学院编辑
*
* @author LikeAdmin
* @param updateValidate 参数
* @author LikeAdmin
*/
@Override
public void edit(CollegeUpdateValidate updateValidate) {
College model = collegeMapper.selectOne(
new QueryWrapper<College>()
.eq("id", updateValidate.getId())
.last("limit 1"));
.eq("id", updateValidate.getId())
.last("limit 1"));
Assert.notNull(model, "数据不存在!");
@ -145,16 +166,13 @@ public class CollegeServiceImpl implements ICollegeService {
/**
* 学院删除
*
* @author LikeAdmin
* @param id 主键ID
*/
@Override
public void del(Integer id) {
College model = collegeMapper.selectOne(
new QueryWrapper<College>()
.eq("id", id)
.last("limit 1"));
.eq("id", id)
.last("limit 1"));
Assert.notNull(model, "数据不存在!");

View File

@ -0,0 +1,195 @@
package com.mdd.admin.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mdd.admin.service.IEnrollmentService;
import com.mdd.admin.validate.StudentInfoSearchValidate;
import com.mdd.admin.validate.commons.PageValidate;
import com.mdd.admin.vo.EnrollmentDetailVo;
import com.mdd.admin.vo.StudentInfoListedVo;
import com.mdd.common.core.PageResult;
import com.mdd.common.entity.*;
import com.mdd.common.entity.Class;
import com.mdd.common.entity.admin.Admin;
import com.mdd.common.exception.OperateException;
import com.mdd.common.mapper.*;
import com.mdd.common.mapper.admin.AdminMapper;
import com.mdd.common.util.TimeUtils;
import org.apache.commons.collections4.CollectionUtils;
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.text.SimpleDateFormat;
import java.util.*;
/**
* 预报名服务实现类
*/
@Service
public class EnrollmentServiceImpl extends ServiceImpl<StudentInfoMapper, StudentInfo> implements IEnrollmentService {
@Resource
StudentInfoMapper studentInfoMapper;
@Autowired
private StudentBaseInfoMapper studentBaseInfoMapper;
@Autowired
private CollegeMapper collegeMapper;
@Autowired
private MajorMapper majorMapper;
@Autowired
private ClassMapper classMapper;
@Autowired
private AdminMapper adminMapper;
@Autowired
private TeacherMapper teacherMapper;
/**
* 预报名列表
*/
@Override
public PageResult<StudentInfoListedVo> list(PageValidate pageValidate, StudentInfoSearchValidate searchValidate) {
Integer page = pageValidate.getPage_no();
Integer limit = pageValidate.getPage_size();
QueryWrapper<StudentInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("student_id");
List<String> conditions = new ArrayList<>(Arrays.asList(
"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",
"=:recruitmentTeacherId@recruitment_teacher_id:int",
"=:receptionTeacherId@reception_teacher_id:int",
"datetime:createTimeStart-createTimeEnd@create_time:str"
));
if (searchValidate.getStudentStatus() != null && searchValidate.getStudentStatus() == -1) {
conditions.remove("=:studentStatus@student_status:int");
queryWrapper.in("student_status", 0, 1);
searchValidate.setStudentStatus(null);
}
studentInfoMapper.setSearch(queryWrapper, searchValidate, conditions.toArray(new String[0]));
IPage<StudentInfo> iPage = studentInfoMapper.selectPage(new Page<>(page, limit), queryWrapper);
List<StudentInfoListedVo> list = new LinkedList<>();
for (StudentInfo item : iPage.getRecords()) {
StudentInfoListedVo vo = new StudentInfoListedVo();
BeanUtils.copyProperties(item, vo);
vo.setVerifiedTime(TimeUtils.timestampToDate(item.getVerifiedTime()));
StudentBaseInfo baseInfo = studentBaseInfoMapper.selectOne(
new QueryWrapper<StudentBaseInfo>()
.eq("student_id", item.getStudentId())
.last("limit 1"));
if (baseInfo != null) {
vo.setName(baseInfo.getName());
vo.setGender(baseInfo.getGender());
vo.setIdCard(baseInfo.getIdCard());
vo.setPreviousSchool(baseInfo.getPreviousSchool());
vo.setHeight(baseInfo.getHeight());
vo.setWeight(baseInfo.getWeight());
vo.setShoeSize(baseInfo.getShoeSize());
}
if (item.getCreateTime() != null) {
vo.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(item.getCreateTime()));
}
if (item.getUpdateTime() != null) {
vo.setUpdateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(item.getUpdateTime()));
}
College college = collegeMapper.selectById(item.getCollegeId());
Major major = majorMapper.selectById(item.getMajorId());
Class clazz = classMapper.selectById(item.getClassId());
Admin counselor = adminMapper.selectById(item.getCounselorId());
Admin verifier = adminMapper.selectById(item.getVerifiedBy());
Teacher teacher = teacherMapper.selectById(item.getRecruitmentTeacherId());
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() : "");
vo.setRecruitmentTeacherName(teacher != null ? teacher.getTeacherName() : null);
list.add(vo);
}
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
}
/**
* 预报名详情
*/
@Override
public EnrollmentDetailVo detail(Integer id) {
StudentInfo model = studentInfoMapper.selectOne(
new QueryWrapper<StudentInfo>()
.eq("student_id", id)
.last("limit 1"));
Assert.notNull(model, "数据不存在");
EnrollmentDetailVo vo = new EnrollmentDetailVo();
vo.setHighSchoolScore(model.getHighSchoolScore());
vo.setPreRegistrationAmount(model.getPreRegistrationAmount());
Major major = majorMapper.selectById(model.getMajorId());
vo.setMajorName(major != null ? major.getMajorName() : "");
Teacher teacher = teacherMapper.selectById(model.getRecruitmentTeacherId());
vo.setRecruitmentTeacherName(teacher != null ? teacher.getTeacherName() : "");
StudentBaseInfo baseInfo = studentBaseInfoMapper.selectOne(
new QueryWrapper<StudentBaseInfo>()
.eq("student_id", model.getStudentId())
.last("limit 1"));
if (baseInfo != null) {
vo.setName(baseInfo.getName());
vo.setGender(baseInfo.getGender());
vo.setIdCard(baseInfo.getIdCard());
vo.setPreviousSchool(baseInfo.getPreviousSchool());
vo.setHeight(baseInfo.getHeight());
vo.setWeight(baseInfo.getWeight());
vo.setShoeSize(baseInfo.getShoeSize());
}
return vo;
}
/**
* 更新学生入学状态
*/
@Override
public void updateStudentStatus(Integer studentId) {
this.update(new UpdateWrapper<StudentInfo>().eq("student_id", studentId).set("student_status", 2));
}
/**
* 批量更新学生入学状态
*/
@Override
public void batchUpdateStudentStatus(List<Integer> studentIdList) {
if (CollectionUtils.isEmpty(studentIdList)) {
throw new OperateException("批量入学失败, 学生idList丢失");
}
studentInfoMapper.batchUpdateStudentStatus(studentIdList);
}
}

View File

@ -1,7 +1,6 @@
package com.mdd.admin.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -16,8 +15,6 @@ import com.mdd.common.core.PageResult;
import com.mdd.common.entity.*;
import com.mdd.common.entity.Class;
import com.mdd.common.entity.admin.Admin;
import com.mdd.common.entity.user.User;
import com.mdd.common.exception.OperateException;
import com.mdd.common.mapper.*;
import com.mdd.common.mapper.admin.AdminMapper;
import com.mdd.common.mapper.user.UserMapper;
@ -27,8 +24,6 @@ import java.time.format.DateTimeFormatter;
import java.text.SimpleDateFormat;
import com.mdd.common.util.*;
import io.netty.util.internal.ThreadLocalRandom;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -78,7 +73,8 @@ public class StudentInfoServiceImpl extends ServiceImpl<StudentInfoMapper, Stude
QueryWrapper<StudentInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("student_id");
studentInfoMapper.setSearch(queryWrapper, searchValidate, new String[]{
// 特殊处理 studentStatus = -1 表示预报名 + 报名
List<String> conditions = new ArrayList<>(Arrays.asList(
"like:studentNumber@student_number:str",
"=:collegeId@college_id:int",
"=:majorId@major_id:int",
@ -93,8 +89,18 @@ public class StudentInfoServiceImpl extends ServiceImpl<StudentInfoMapper, Stude
"=:verifiedBy@verified_by:int",
"=:recruitmentTeacherId@recruitment_teacher_id:int",
"=:receptionTeacherId@reception_teacher_id:int",
"datetime:createTimeStart-createTimeEnd@create_time:str",
});
"datetime:createTimeStart-createTimeEnd@create_time:str"
));
if (searchValidate.getStudentStatus() != null && searchValidate.getStudentStatus() == -1) {
// 移除默认的等号条件改为 in (0,1)
conditions.remove("=:studentStatus@student_status:int");
queryWrapper.in("student_status", 0, 1);
// 防止 setSearch 再次处理该字段
searchValidate.setStudentStatus(null);
}
studentInfoMapper.setSearch(queryWrapper, searchValidate, conditions.toArray(new String[0]));
IPage<StudentInfo> iPage = studentInfoMapper.selectPage(new Page<>(page, limit), queryWrapper);
@ -388,101 +394,5 @@ public class StudentInfoServiceImpl extends ServiceImpl<StudentInfoMapper, Stude
studentInfoMapper.delete(new QueryWrapper<StudentInfo>().eq("student_id", id));
}
@Override
public void batchUpdateStudentStatus(List<Integer> studentIdList) {
if (CollectionUtils.isEmpty(studentIdList)) {
throw new OperateException("批量入学失败, 学生idList丢失");
}
studentInfoMapper.batchUpdateStudentStatus(studentIdList);
}
private <T, M extends BaseMapper<T>> T getRandomEntity(M mapper) {
try {
QueryWrapper<T> wrapper = new QueryWrapper<>();
List<T> entityList = mapper.selectList(wrapper);
// 检查列表是否为空
if (entityList == null || entityList.isEmpty()) {
return null;
}
// 生成随机索引
Random random = new Random();
int randomIndex = random.nextInt(entityList.size());
return entityList.get(randomIndex);
} catch (Exception e) {
return null;
}
}
/**
* 根据班级入学年份计算当前年级
*
* @param enrollmentYear 班级入学年份
* @return 当前年级1-4 对应大一到大四
*/
private Integer calculateGrade(Integer enrollmentYear) {
if (enrollmentYear == null) {
return null;
}
// 获取当前年份
Calendar calendar = Calendar.getInstance();
int currentYear = calendar.get(Calendar.YEAR);
int currentMonth = calendar.get(Calendar.MONTH) + 1; // 月份从0开始需要+1
// 计算年级
int grade = currentYear - enrollmentYear;
// 调整如果当前月份在9月之前秋季学期开始前年级减1
if (currentMonth < 9) {
grade--;
}
// 确保年级在合理范围内1-4
if (grade < 1) {
grade = 1; // 最小为大一
} else if (grade > 4) {
grade = 4; // 最大为大四
}
return grade;
}
/**
* 生成随机的用户信息返回身份证号
* 由于user实体不存储身份证号但生成的用户账户是根据身份证后六位生成的故需要让方法返回一个身份证号
*/
public String createRandomUser(User user) {
// 生成随机姓名
String name = RandomUtil.randomName();
// 生成随机身份证号
String idCard = RandomUtil.randomIdCard();
// 生成随机编号
Random random = ThreadLocalRandom.current();
Integer sn = random.nextInt(900000) + 100000;
user.setNickname(name);
user.setRealName(name);
user.setAccount("T" + sn.toString());
user.setSn(sn);
String pwd = idCard.substring(12);
user.setPassword(ToolUtils.makePassword(pwd));
String defaultAvatar = ConfigUtils.get("default_image", "user_avatar", "/api/static/default_avatar.png");
user.setAvatar(defaultAvatar);
user.setChannel(0);
user.setIsNewUser(1);
user.setSex(RandomUtil.genderFromIdCard(idCard));
user.setCreateTime(System.currentTimeMillis() / 1000);
user.setUpdateTime(System.currentTimeMillis() / 1000);
userMapper.insert(user);
return idCard;
}
}

View File

@ -22,6 +22,7 @@ import com.mdd.common.entity.admin.AdminRole;
import com.mdd.common.entity.system.SystemRole;
import com.mdd.common.mapper.CollegeMapper;
import com.mdd.common.mapper.TeacherMapper;
import com.mdd.common.mapper.admin.AdminMapper;
import com.mdd.common.mapper.system.SystemRoleMapper;
import com.mdd.common.exception.OperateException;
import com.mdd.common.service.RegisterService;
@ -65,6 +66,8 @@ public class TeacherServiceImpl implements ITeacherService {
private AdminRoleServiceImpl adminRoleServiceImpl;
@Autowired
private SystemRoleMapper systemRoleMapper;
@Autowired
private AdminMapper adminMapper;
/**
* 教师信息扩展列表
@ -150,6 +153,17 @@ public class TeacherServiceImpl implements ITeacherService {
College college = collegeMapper.selectById(vo.getCollegeId());
if (college != null) vo.setCollegeName(college.getCollegeName());
// 绑定角色ID列表根据教师工号找到对应的后台账号再查询其角色ID
com.mdd.common.entity.admin.Admin admin = adminMapper.selectOne(
new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<com.mdd.common.entity.admin.Admin>()
.eq("account", model.getTeacherCode())
.isNull("delete_time")
.last("limit 1")
);
if (admin != null) {
java.util.List<Integer> roleIds = adminRoleServiceImpl.getRoleIdAttr(admin.getId());
vo.setRoleId(roleIds);
}
return vo;
}

View File

@ -17,17 +17,13 @@ import com.mdd.admin.validate.system.SystemAdminCreateValidate;
import com.mdd.admin.validate.system.SystemAdminSearchValidate;
import com.mdd.admin.validate.system.SystemAdminUpInfoValidate;
import com.mdd.admin.validate.system.SystemAdminUpdateValidate;
import com.mdd.admin.validate.user.UserSearchValidate;
import com.mdd.admin.vo.auth.AdminMySelfVo;
import com.mdd.admin.vo.auth.AuthMySelfVo;
import com.mdd.admin.vo.system.*;
import com.mdd.admin.vo.user.UserListExportVo;
import com.mdd.admin.vo.user.UserVo;
import com.mdd.common.core.PageResult;
import com.mdd.common.entity.Teacher;
import com.mdd.common.entity.admin.Admin;
import com.mdd.common.entity.admin.Dept;
import com.mdd.common.entity.system.Jobs;
import com.mdd.common.entity.admin.Jobs;
import com.mdd.common.entity.system.SystemMenu;
import com.mdd.common.entity.system.SystemRole;
import com.mdd.common.exception.OperateException;
@ -87,23 +83,23 @@ public class AdminServiceImpl implements IAdminService {
/**
* 管理员列表
*
* @author fzr
* @param pageValidate 分页参数
* @param pageValidate 分页参数
* @param searchValidate 搜索参数
* @return PageResult<SystemAuthAdminListedVo>
* @author fzr
*/
@Override
public PageResult<SystemAuthAdminListedVo> list(PageValidate pageValidate, SystemAdminSearchValidate searchValidate) {
Integer page = pageValidate.getPage_no();
Integer page = pageValidate.getPage_no();
Integer limit = pageValidate.getPage_size();
MPJQueryWrapper<Admin> mpjQueryWrapper = new MPJQueryWrapper<>();
mpjQueryWrapper.select("distinct t.id,t.account,t.name,t.avatar," +
"t.multipoint_login," +
"t.disable,t.login_ip,t.login_time,t.create_time,t.update_time")
"t.multipoint_login," +
"t.disable,t.login_ip,t.login_time,t.create_time,t.update_time")
.leftJoin("la_admin_role lar ON lar.admin_id = t.id")
.isNull("t.delete_time")
.orderByDesc(Arrays.asList("t.id"));
.isNull("t.delete_time")
.orderByDesc(Arrays.asList("t.id"));
systemAuthAdminMapper.setSearch(mpjQueryWrapper, searchValidate, new String[]{
@ -130,7 +126,7 @@ public class AdminServiceImpl implements IAdminService {
List<Integer> roleIds = new ArrayList<>();
List<String> roleNames = new ArrayList<>();
if (!roles.isEmpty()) {
roles.forEach(item-> {
roles.forEach(item -> {
roleIds.add(item.getId());
roleNames.add(item.getName());
@ -144,7 +140,7 @@ public class AdminServiceImpl implements IAdminService {
List<Integer> jobsId = new ArrayList<>();
List<String> jobsNames = new ArrayList<>();
if (!jobs.isEmpty()) {
jobs.forEach(item-> {
jobs.forEach(item -> {
jobsId.add(item.getId());
jobsNames.add(item.getName());
});
@ -157,7 +153,7 @@ public class AdminServiceImpl implements IAdminService {
List<Integer> deptIds = new ArrayList<>();
List<String> deptNames = new ArrayList<>();
if (!depts.isEmpty()) {
depts.forEach(item-> {
depts.forEach(item -> {
deptIds.add(item.getId());
deptNames.add(item.getName());
});
@ -181,17 +177,17 @@ public class AdminServiceImpl implements IAdminService {
/**
* 当前管理员
*
* @author fzr
* @param adminId 管理员ID
* @return SystemAuthAdminSelvesVo
* @author fzr
*/
@Override
public SystemAuthAdminSelvesVo self(Integer adminId) {
// 管理员信息
Admin sysAdmin = systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>()
.select(Admin.class, info->
!info.getColumn().equals("password") &&
!info.getColumn().equals("delete_time"))
.select(Admin.class, info ->
!info.getColumn().equals("password") &&
!info.getColumn().equals("delete_time"))
.isNull("delete_time")
.eq("id", adminId)
.last("limit 1"));
@ -241,9 +237,9 @@ public class AdminServiceImpl implements IAdminService {
/**
* 管理员详细
*
* @author fzr
* @param id 主键
* @return SystemAuthAdminDetailVo
* @author fzr
*/
@Override
public SystemAuthAdminDetailVo detail(Integer id) {
@ -269,8 +265,8 @@ public class AdminServiceImpl implements IAdminService {
/**
* 管理员新增
*
* @author fzr
* @param createValidate 参数
* @author fzr
*/
@Override
public void add(SystemAdminCreateValidate createValidate) {
@ -287,9 +283,9 @@ public class AdminServiceImpl implements IAdminService {
.eq("name", createValidate.getName())
.last("limit 1")), "昵称已存在换一个吧!");
String pwd = ToolUtils.makePassword(createValidate.getPassword().trim());
String pwd = ToolUtils.makePassword(createValidate.getPassword().trim());
String createAvatar = createValidate.getAvatar();
String createAvatar = createValidate.getAvatar();
String defaultAvatar = "/api/static/backend_avatar.png";
String avatar = StringUtils.isNotEmpty(createValidate.getAvatar()) ? UrlUtils.toRelativeUrl(createAvatar) : defaultAvatar;
@ -318,9 +314,9 @@ public class AdminServiceImpl implements IAdminService {
/**
* 管理员更新
*
* @author fzr
* @param updateValidate 参数
* @param adminId 管理员ID
* @param adminId 管理员ID
* @author fzr
*/
@Override
public void edit(SystemAdminUpdateValidate updateValidate, Integer adminId) {
@ -404,14 +400,13 @@ public class AdminServiceImpl implements IAdminService {
}
}
/**
* 当前管理员更新
*
* @author fzr
* @param upInfoValidate 参数
* @author fzr
*/
@Override
public void upInfo(SystemAdminUpInfoValidate upInfoValidate, Integer adminId) {
@ -423,7 +418,7 @@ public class AdminServiceImpl implements IAdminService {
Assert.notNull(model, "账号不存在了!");
String createAvatar = upInfoValidate.getAvatar();
String createAvatar = upInfoValidate.getAvatar();
String defaultAvatar = "/api/static/backend_avatar.png";
String avatar = StringUtils.isNotEmpty(upInfoValidate.getAvatar()) ? UrlUtils.toRelativeUrl(createAvatar) : defaultAvatar;
@ -437,7 +432,7 @@ public class AdminServiceImpl implements IAdminService {
if (upInfoValidate.getPassword().length() > 64) {
throw new OperateException("密码不能超出64个字符");
}
String pwd = ToolUtils.makePassword( upInfoValidate.getPassword().trim());
String pwd = ToolUtils.makePassword(upInfoValidate.getPassword().trim());
model.setPassword(pwd);
}
@ -450,9 +445,9 @@ public class AdminServiceImpl implements IAdminService {
/**
* 管理员删除
*
* @author fzr
* @param id 主键
* @param id 主键
* @param adminId 管理员ID
* @author fzr
*/
@Override
public void del(Integer id, Integer adminId) {
@ -464,7 +459,7 @@ public class AdminServiceImpl implements IAdminService {
.last("limit 1")), "账号已不存在!");
Assert.isFalse(id.equals(1), "系统管理员不允许删除!");
Assert.isFalse(id.equals(adminId) , "不能删除自己!");
Assert.isFalse(id.equals(adminId), "不能删除自己!");
Admin model = new Admin();
model.setId(id);
@ -480,9 +475,9 @@ public class AdminServiceImpl implements IAdminService {
/**
* 管理员状态切换
*
* @author fzr
* @param id 主键参数
* @param id 主键参数
* @param adminId 管理员ID
* @author fzr
*/
@Override
public void disable(Integer id, Integer adminId) {
@ -493,7 +488,7 @@ public class AdminServiceImpl implements IAdminService {
.last("limit 1"));
Assert.notNull(systemAuthAdmin, "账号已不存在!");
Assert.isFalse(id.equals(adminId) , "不能禁用自己!");
Assert.isFalse(id.equals(adminId), "不能禁用自己!");
Integer disable = systemAuthAdmin.getDisable() == 1 ? 0 : 1;
systemAuthAdmin.setDisable(disable);
@ -524,10 +519,10 @@ public class AdminServiceImpl implements IAdminService {
@Override
public JSONObject getExportData(PageValidate pageValidate, SystemAdminSearchValidate searchValidate) {
Integer page = pageValidate.getPage_no();
Integer page = pageValidate.getPage_no();
Integer limit = pageValidate.getPage_size();
PageResult<SystemAuthAdminListedVo> userVoPageResult = this.list(pageValidate, searchValidate);
JSONObject ret = ToolUtils.getExportData(userVoPageResult.getCount(), limit, searchValidate.getPage_start(), searchValidate.getPage_end(),"管理员记录列表");
JSONObject ret = ToolUtils.getExportData(userVoPageResult.getCount(), limit, searchValidate.getPage_start(), searchValidate.getPage_end(), "管理员记录列表");
return ret;
}
@ -548,9 +543,9 @@ public class AdminServiceImpl implements IAdminService {
Boolean isAll = StringUtils.isNull(searchValidate.getPage_type()) || searchValidate.getPage_type().equals(0) ? true : false;
List<SystemAuthAdminListedExportVo> excellist = this.getExcellist(isAll, pageValidate, searchValidate);
String fileName = StringUtils.isNull(searchValidate.getFile_name()) ? ToolUtils.makeUUID() : searchValidate.getFile_name();
String folderPath = "/excel/export/"+ TimeUtils.timestampToDay(System.currentTimeMillis() / 1000) +"/" ;
String path = folderPath + fileName +".xlsx";
String filePath = YmlUtils.get("like.upload-directory") + path;
String folderPath = "/excel/export/" + TimeUtils.timestampToDay(System.currentTimeMillis() / 1000) + "/";
String path = folderPath + fileName + ".xlsx";
String filePath = YmlUtils.get("like.upload-directory") + path;
File folder = new File(YmlUtils.get("like.upload-directory") + folderPath);
if (!folder.exists()) {
if (!folder.mkdirs()) {
@ -566,7 +561,7 @@ public class AdminServiceImpl implements IAdminService {
}
private List<SystemAuthAdminListedExportVo> getExcellist(boolean isAll, PageValidate pageValidate, SystemAdminSearchValidate searchValidate) {
Integer page = pageValidate.getPage_no();
Integer page = pageValidate.getPage_no();
Integer limit = pageValidate.getPage_size();
MPJQueryWrapper<Admin> mpjQueryWrapper = new MPJQueryWrapper<>();
@ -608,7 +603,7 @@ public class AdminServiceImpl implements IAdminService {
List<Integer> roleIds = new ArrayList<>();
List<String> roleNames = new ArrayList<>();
if (!roles.isEmpty()) {
roles.forEach(item-> {
roles.forEach(item -> {
roleIds.add(item.getId());
roleNames.add(item.getName());
@ -622,7 +617,7 @@ public class AdminServiceImpl implements IAdminService {
List<Integer> jobsId = new ArrayList<>();
List<String> jobsNames = new ArrayList<>();
if (!jobs.isEmpty()) {
jobs.forEach(item-> {
jobs.forEach(item -> {
jobsId.add(item.getId());
jobsNames.add(item.getName());
});
@ -635,7 +630,7 @@ public class AdminServiceImpl implements IAdminService {
List<Integer> deptIds = new ArrayList<>();
List<String> deptNames = new ArrayList<>();
if (!depts.isEmpty()) {
depts.forEach(item-> {
depts.forEach(item -> {
deptIds.add(item.getId());
deptNames.add(item.getName());
});

View File

@ -12,14 +12,11 @@ import com.mdd.admin.validate.commons.PageValidate;
import com.mdd.admin.validate.system.JobsCreateValidate;
import com.mdd.admin.validate.system.JobsSearchValidate;
import com.mdd.admin.validate.system.JobsUpdateValidate;
import com.mdd.admin.validate.user.UserSearchValidate;
import com.mdd.admin.vo.system.JobsExportVo;
import com.mdd.admin.vo.system.JobsVo;
import com.mdd.admin.vo.user.UserListExportVo;
import com.mdd.admin.vo.user.UserVo;
import com.mdd.common.core.PageResult;
import com.mdd.common.entity.admin.Admin;
import com.mdd.common.entity.system.Jobs;
import com.mdd.common.entity.admin.Jobs;
import com.mdd.common.exception.OperateException;
import com.mdd.common.mapper.admin.AdminMapper;
import com.mdd.common.mapper.admin.JobsMapper;
@ -48,8 +45,8 @@ public class JobsServiceImpl implements IJobsService {
/**
* 岗位所有
*
* @author fzr
* @return List<SystemPostVo>
* @author fzr
*/
@Override
public List<JobsVo> all() {
@ -73,19 +70,19 @@ public class JobsServiceImpl implements IJobsService {
/**
* 岗位列表
*
* @author fzr
* @param pageValidate 分页参数
* @param pageValidate 分页参数
* @param searchValidate 搜索参数
* @return PageResult<SystemPostVo>
* @author fzr
*/
@Override
public PageResult<JobsVo> list(PageValidate pageValidate, JobsSearchValidate searchValidate) {
Integer page = pageValidate.getPage_no();
Integer page = pageValidate.getPage_no();
Integer limit = pageValidate.getPage_size();
QueryWrapper<Jobs> queryWrapper = new QueryWrapper<>();
queryWrapper.select(Jobs.class, info->
!info.getColumn().equals("delete_time"))
queryWrapper.select(Jobs.class, info ->
!info.getColumn().equals("delete_time"))
.isNull("delete_time")
.orderByDesc(Arrays.asList("sort", "id"));
@ -113,15 +110,15 @@ public class JobsServiceImpl implements IJobsService {
/**
* 岗位详情
*
* @author fzr
* @param id 主键
* @return SystemPostVo
* @author fzr
*/
@Override
public JobsVo detail(Integer id) {
Jobs systemAuthPost = jobsMapper.selectOne(new QueryWrapper<Jobs>()
.select(Jobs.class, info ->
!info.getColumn().equals("delete_time"))
!info.getColumn().equals("delete_time"))
.eq("id", id)
.isNull("delete_time")
.last("limit 1"));
@ -139,15 +136,15 @@ public class JobsServiceImpl implements IJobsService {
/**
* 岗位新增
*
* @author fzr
* @param createValidate 参数
* @author fzr
*/
@Override
public void add(JobsCreateValidate createValidate) {
Assert.isNull(jobsMapper.selectOne(new QueryWrapper<Jobs>()
.select("id,code,name")
.nested(
wq->wq.eq("code", createValidate.getCode())
wq -> wq.eq("code", createValidate.getCode())
.or()
.eq("name", createValidate.getName())
)
@ -168,14 +165,14 @@ public class JobsServiceImpl implements IJobsService {
/**
* 岗位编辑
*
* @author fzr
* @param updateValidate 参数
* @author fzr
*/
@Override
public void edit(JobsUpdateValidate updateValidate) {
Jobs model = jobsMapper.selectOne(new QueryWrapper<Jobs>()
.select(Jobs.class, info ->
!info.getColumn().equals("delete_time"))
!info.getColumn().equals("delete_time"))
.eq("id", updateValidate.getId())
.isNull("delete_time")
.last("limit 1"));
@ -184,7 +181,7 @@ public class JobsServiceImpl implements IJobsService {
.select("id,code,name")
.ne("id", updateValidate.getId())
.nested(
wq->wq.eq("code", updateValidate.getCode())
wq -> wq.eq("code", updateValidate.getCode())
.or()
.eq("name", updateValidate.getName())
)
@ -202,8 +199,8 @@ public class JobsServiceImpl implements IJobsService {
/**
* 岗位删除
*
* @author fzr
* @param id 主键
* @author fzr
*/
@Override
public void del(Integer id) {
@ -225,10 +222,10 @@ public class JobsServiceImpl implements IJobsService {
@Override
public JSONObject getExportData(PageValidate pageValidate, JobsSearchValidate searchValidate) {
Integer page = pageValidate.getPage_no();
Integer page = pageValidate.getPage_no();
Integer limit = pageValidate.getPage_size();
PageResult<JobsVo> userVoPageResult = this.list(pageValidate, searchValidate);
JSONObject ret = ToolUtils.getExportData(userVoPageResult.getCount(), limit, searchValidate.getPage_start(), searchValidate.getPage_end(),"岗位记录列表");
JSONObject ret = ToolUtils.getExportData(userVoPageResult.getCount(), limit, searchValidate.getPage_start(), searchValidate.getPage_end(), "岗位记录列表");
return ret;
}
@ -249,9 +246,9 @@ public class JobsServiceImpl implements IJobsService {
Boolean isAll = StringUtils.isNull(searchValidate.getPage_type()) || searchValidate.getPage_type().equals(0) ? true : false;
List<JobsExportVo> excellist = this.getExcellist(isAll, pageValidate, searchValidate);
String fileName = StringUtils.isNull(searchValidate.getFile_name()) ? ToolUtils.makeUUID() : searchValidate.getFile_name();
String folderPath = "/excel/export/"+ TimeUtils.timestampToDay(System.currentTimeMillis() / 1000) +"/" ;
String path = folderPath + fileName +".xlsx";
String filePath = YmlUtils.get("like.upload-directory") + path;
String folderPath = "/excel/export/" + TimeUtils.timestampToDay(System.currentTimeMillis() / 1000) + "/";
String path = folderPath + fileName + ".xlsx";
String filePath = YmlUtils.get("like.upload-directory") + path;
File folder = new File(YmlUtils.get("like.upload-directory") + folderPath);
if (!folder.exists()) {
if (!folder.mkdirs()) {
@ -265,12 +262,13 @@ public class JobsServiceImpl implements IJobsService {
.doWrite(excellist);
return UrlUtils.toAdminAbsoluteUrl(path);
}
private List<JobsExportVo> getExcellist(boolean isAll, PageValidate pageValidate, JobsSearchValidate searchValidate) {
Integer page = pageValidate.getPage_no();
Integer page = pageValidate.getPage_no();
Integer limit = pageValidate.getPage_size();
QueryWrapper<Jobs> queryWrapper = new QueryWrapper<>();
queryWrapper.select(Jobs.class, info->
queryWrapper.select(Jobs.class, info ->
!info.getColumn().equals("delete_time"))
.isNull("delete_time")
.orderByDesc(Arrays.asList("sort", "id"));

View File

@ -0,0 +1,49 @@
package com.mdd.admin.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@ApiModel("预报名详情Vo")
public class EnrollmentDetailVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "性别0-女 1-男")
private Integer gender;
@ApiModelProperty(value = "身份证号")
private String idCard;
@ApiModelProperty(value = "毕业学校")
private String previousSchool;
@ApiModelProperty(value = "身高cm")
private BigDecimal height;
@ApiModelProperty(value = "体重kg")
private BigDecimal weight;
@ApiModelProperty(value = "鞋码")
private Integer shoeSize;
@ApiModelProperty(value = "中考成绩")
private BigDecimal highSchoolScore;
@ApiModelProperty(value = "报名专业")
private String majorName;
@ApiModelProperty(value = "招生老师")
private String recruitmentTeacherName;
@ApiModelProperty(value = "预报名金额")
private BigDecimal preRegistrationAmount;
}

View File

@ -0,0 +1,21 @@
package com.mdd.admin.vo.major;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel("专业下拉选项Vo")
public class MajorOptionVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "专业ID")
private Integer id;
@ApiModelProperty(value = "专业名称")
private String majorName;
}

View File

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
@ApiModel("教师信息扩展详情Vo")
@ -45,4 +46,7 @@ public class TeacherDetailVo implements Serializable {
@ApiModelProperty(value = "二维码图片地址")
private String qrcodeUrl;
@ApiModelProperty(value = "角色ID列表")
private List<Integer> roleId;
}

View File

@ -0,0 +1,21 @@
package com.mdd.admin.vo.teacher;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel("教师下拉选项Vo")
public class TeacherOptionVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "教师ID")
private Integer id;
@ApiModelProperty(value = "教师姓名")
private String name;
}

View File

@ -1,4 +1,4 @@
package com.mdd.common.entity.system;
package com.mdd.common.entity.admin;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
@ -14,7 +14,7 @@ public class Jobs implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value="id", type= IdType.AUTO)
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty("ID")
private Integer id;

View File

@ -1,9 +1,7 @@
package com.mdd.common.mapper.admin;
import com.mdd.common.core.basics.IBaseMapper;
import com.mdd.common.entity.admin.AdminJobs;
import com.mdd.common.entity.admin.Dept;
import com.mdd.common.entity.system.Jobs;
import com.mdd.common.entity.admin.Jobs;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;