From c3a8f590e862bc808c839d206814002957c3bb6e Mon Sep 17 00:00:00 2001 From: mirage <1127314491@qq.com> Date: Thu, 26 Feb 2026 09:39:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BB=E9=A1=B5=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=8F=B0=E5=B8=83=E5=B1=80=E4=BB=A5=E5=8F=8A=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=98=BE=E7=A4=BA,=20=E6=94=B9=E6=88=90=E9=A2=84?= =?UTF-8?q?=E6=8A=A5=E5=90=8D=E6=8A=A5=E8=A1=A8=E7=BB=9F=E8=AE=A1=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/api/app.ts | 4 +- admin/src/views/enrollment/index.vue | 278 +++++++---------- admin/src/views/student/info/edit.vue | 4 +- admin/src/views/workbench/index.vue | 291 ++++++++---------- .../mdd/admin/controller/IndexController.java | 7 +- .../controller/StudentInfoController.java | 9 + .../com/mdd/admin/service/IIndexService.java | 4 +- .../admin/service/IStudentInfoService.java | 3 + .../admin/service/impl/IndexServiceImpl.java | 235 ++++++++++++-- .../service/impl/StudentInfoServiceImpl.java | 34 +- .../validate/StudentInfoCreateValidate.java | 4 +- .../validate/StudentInfoSearchValidate.java | 6 + .../validate/StudentInfoUpdateValidate.java | 14 +- .../com/mdd/admin/vo/StudentInfoDetailVo.java | 4 +- .../com/mdd/admin/vo/StudentInfoListedVo.java | 3 + .../com/mdd/common/entity/StudentInfo.java | 2 +- .../mdd/common/mapper/StudentInfoMapper.java | 19 ++ .../resources/mapper/StudentInfoMapper.xml | 40 +++ 18 files changed, 570 insertions(+), 391 deletions(-) create mode 100644 server/like-common/src/main/resources/mapper/StudentInfoMapper.xml diff --git a/admin/src/api/app.ts b/admin/src/api/app.ts index d72719cb..a6a2408a 100644 --- a/admin/src/api/app.ts +++ b/admin/src/api/app.ts @@ -6,8 +6,8 @@ export function getConfig() { } // 工作台主页 -export function getWorkbench() { - return request.get({ url: '/workbench/index' }) +export function getWorkbench(params?: Record) { + return request.get({ url: '/workbench/index', params }) } //字典数据 diff --git a/admin/src/views/enrollment/index.vue b/admin/src/views/enrollment/index.vue index f074d763..70bda70b 100644 --- a/admin/src/views/enrollment/index.vue +++ b/admin/src/views/enrollment/index.vue @@ -12,20 +12,10 @@ - + - - - - - - - - - - - - - - + + @@ -90,7 +70,19 @@ - +
+ + 批量入学 + +
+ + - + - - - - - + - - - - - - + @@ -174,115 +123,50 @@ \ No newline at end of file + diff --git a/admin/src/views/student/info/edit.vue b/admin/src/views/student/info/edit.vue index 773677ee..21fd4e86 100644 --- a/admin/src/views/student/info/edit.vue +++ b/admin/src/views/student/info/edit.vue @@ -497,7 +497,7 @@ v-model="studentFormData.preRegistrationTime" type="datetime" placeholder="请选择预报名时间" - value-format="X" + value-format="YYYY-MM-DD HH:mm:ss" class="w-full" :disabled="isViewMode" /> @@ -717,7 +717,7 @@ const studentFormData = reactive({ preRegistrationAmount: '', recruitmentTeacherId: undefined as number | undefined, receptionTeacherId: undefined as number | undefined, - preRegistrationTime: undefined as number | undefined, + preRegistrationTime: undefined as string | undefined, invitationCode: '', isVerified: undefined as number | undefined, verifiedBy: '', diff --git a/admin/src/views/workbench/index.vue b/admin/src/views/workbench/index.vue index 7c880419..4fca7b57 100644 --- a/admin/src/views/workbench/index.vue +++ b/admin/src/views/workbench/index.vue @@ -43,59 +43,83 @@
-
销售额
-
{{ workbenchData.today.today_sales }}
+
总招生数量
+
{{ workbenchData.today.total_enroll_count || 0 }}
- 总:{{ workbenchData.today.total_sales }} + 学生状态为"预报名"或"报名"的学生总数
-
成交订单
-
{{ workbenchData.today.order_num }}
+
今日招生数量
+
{{ workbenchData.today.today_enroll_count || 0 }}
- 总:{{ workbenchData.today.order_sum }} + 今天新增的招生人数
-
新增用户
-
{{ workbenchData.today.today_new_user }}
+
本周招生数量
+
{{ workbenchData.today.week_enroll_count || 0 }}
- 总:{{ workbenchData.today.total_new_user }} + 最近 7 天的招生人数
-
新增访问量
-
{{ workbenchData.today.today_visitor }}
+
本月招生数量
+
{{ workbenchData.today.month_enroll_count || 0 }}
- 总:{{ workbenchData.today.total_visitor }} + 最近 30 天的招生人数
-
- - -
-
- - -
{{ item.name }}
-
-
-
-
-
+ + + + + + + + + + + + + + + + + + +
({ + teacherId: null, + rangeType: 'week' +}) + +// 招生老师下拉数据 +const teacherOptions = ref>([]) + +const fetchTeacherOptions = async () => { + try { + const res: any = await teacherLists() + teacherOptions.value = res.lists || [] + } catch (e) { + // 静默处理,工作台不因下拉失败报错中断 + console.error('获取招生老师列表失败', e) + } +} + // 获取工作台主页数据 const getData = () => { - getWorkbench() + const params: Record = { + rangeType: filterForm.rangeType + } + if (filterForm.teacherId) { + params.teacherId = filterForm.teacherId + } + + getWorkbench(params) .then((res: any) => { workbenchData.version = res.version - workbenchData.today = res.today - workbenchData.menu = res.menu - workbenchData.visitor = res.visitor + workbenchData.today = res.today || {} + workbenchData.menu = res.menu || [] + workbenchData.visitor = res.enrollmentTrend || {} workbenchData.support = res.support - // 清空echarts 数据 - workbenchData.visitorOption.xAxis.data = [] - workbenchData.visitorOption.series[0].data = [] - workbenchData.saleOption.xAxis.data = [] - workbenchData.saleOption.series[0].data = [] + const trend = res.enrollmentTrend || {} + const dates: string[] = Array.isArray(trend.date) ? trend.date : [] + const list: any[] = Array.isArray(trend.list) ? trend.list : [] - // 写入从后台拿来的数据 - res.visitor.date.reverse().forEach((item: any) => { - workbenchData.visitorOption.xAxis.data.push(item) - }) - res.visitor.list[0].data.forEach((item: any) => { - workbenchData.visitorOption.series[0].data.push(item) - }) - res.sale.date.reverse().forEach((item: any) => { - workbenchData.saleOption.xAxis.data.push(item) - }) - res.sale.list[0].data.forEach((item: any) => { - if (item <= 50) { - item = { - value: item, - itemStyle: { - color: { - type: 'linear', - x: 0, - y: 0, - x2: 0, - y2: 1, - colorStops: [ - { - offset: 0, - color: '#ff8729' - }, - { - offset: 1, - color: '#ff8729' - } - ] - } - } - } - } - workbenchData.saleOption.series[0].data.push(item) + // 清空 ECharts 数据 + workbenchData.visitorOption.xAxis.data = [] + workbenchData.visitorOption.series = [] + workbenchData.visitorOption.legend.data = [] + + // 写入从后台拿来的数据:每个老师一条线 + workbenchData.visitorOption.xAxis.data = dates + + list.forEach((item: any) => { + const name = item.name || '未知老师' + const data = Array.isArray(item.data) ? item.data : [] + + workbenchData.visitorOption.legend.data.push(name) + workbenchData.visitorOption.series.push({ + name, + type: 'line', + smooth: true, + data + }) }) }) .catch((err: any) => { @@ -300,7 +256,12 @@ const getData = () => { }) } +const handleFilterChange = () => { + getData() +} + onMounted(() => { + fetchTeacherOptions() getData() }) diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/IndexController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/IndexController.java index d256c6a4..19da59b4 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/controller/IndexController.java +++ b/server/like-admin/src/main/java/com/mdd/admin/controller/IndexController.java @@ -7,6 +7,7 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -23,8 +24,10 @@ public class IndexController { @GetMapping("/index") @ApiOperation(value="控制台") - public AjaxResult> index() { - Map map = iIndexService.index(); + public AjaxResult> index( + @RequestParam(value = "teacherId", required = false) Integer teacherId, + @RequestParam(value = "rangeType", required = false) String rangeType) { + Map map = iIndexService.index(teacherId, rangeType); return AjaxResult.success(map); } diff --git a/server/like-admin/src/main/java/com/mdd/admin/controller/StudentInfoController.java b/server/like-admin/src/main/java/com/mdd/admin/controller/StudentInfoController.java index 9d43b7fc..0f673e7f 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/controller/StudentInfoController.java +++ b/server/like-admin/src/main/java/com/mdd/admin/controller/StudentInfoController.java @@ -18,6 +18,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.List; @RestController @RequestMapping("adminapi/info") @@ -58,6 +59,14 @@ public class StudentInfoController { return AjaxResult.success(); } + @Log(title = "学生批量入学") + @GetMapping("/batchUpdateStudentStatus") + @ApiOperation(value = "学生批量入学") + public AjaxResult batchUpdateStudentStatus(@RequestParam("studentIdList") List studentIdList) { + iStudentInfoService.batchUpdateStudentStatus(studentIdList); + return AjaxResult.success(); + } + @Log(title = "学生信息删除") @PostMapping("/del") @ApiOperation(value = "学生信息删除") diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/IIndexService.java b/server/like-admin/src/main/java/com/mdd/admin/service/IIndexService.java index 5d1238ef..d601d187 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/service/IIndexService.java +++ b/server/like-admin/src/main/java/com/mdd/admin/service/IIndexService.java @@ -11,9 +11,11 @@ public interface IIndexService { * 控制台数据 * * @author fzr + * @param teacherId 招生老师ID(可选) + * @param rangeType 时间区间类型:day / week / month(可选,默认 week) * @return Map */ - Map index(); + Map index(Integer teacherId, String rangeType); /** * 公共配置 diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/IStudentInfoService.java b/server/like-admin/src/main/java/com/mdd/admin/service/IStudentInfoService.java index b870ab5b..0103d0aa 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/service/IStudentInfoService.java +++ b/server/like-admin/src/main/java/com/mdd/admin/service/IStudentInfoService.java @@ -9,6 +9,7 @@ import com.mdd.admin.vo.StudentInfoDetailVo; import com.mdd.common.core.PageResult; import javax.validation.constraints.NotNull; +import java.util.List; /** * 学生信息服务接口类 @@ -58,4 +59,6 @@ public interface IStudentInfoService { * @param id 主键ID */ void del(Integer id); + + void batchUpdateStudentStatus(List studentIdList); } diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/impl/IndexServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/impl/IndexServiceImpl.java index 28921d67..7268fa37 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/service/impl/IndexServiceImpl.java +++ b/server/like-admin/src/main/java/com/mdd/admin/service/impl/IndexServiceImpl.java @@ -4,9 +4,21 @@ import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.mdd.admin.service.IIndexService; import com.mdd.common.config.GlobalConfig; -import com.mdd.common.util.*; +import com.mdd.common.entity.StudentInfo; +import com.mdd.common.entity.Teacher; +import com.mdd.common.mapper.StudentInfoMapper; +import com.mdd.common.mapper.TeacherMapper; +import com.mdd.common.util.ConfigUtils; +import com.mdd.common.util.ListUtils; +import com.mdd.common.util.TimeUtils; +import com.mdd.common.util.UrlUtils; +import com.mdd.common.util.YmlUtils; import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; import java.util.*; /** @@ -15,14 +27,22 @@ import java.util.*; @Service public class IndexServiceImpl implements IIndexService { + @Resource + private StudentInfoMapper studentInfoMapper; + + @Resource + private TeacherMapper teacherMapper; + /** * 控制台数据 * * @author fzr + * @param teacherId 招生老师ID(可选) + * @param rangeType 时间区间类型:day / week / month(可选,默认 week) * @return Map */ @Override - public Map index() { + public Map index(Integer teacherId, String rangeType) { Map console = new LinkedHashMap<>(); // 版本信息 @@ -37,30 +57,15 @@ public class IndexServiceImpl implements IIndexService { version.put("channel", channel); console.put("version", version); - // 今日数据 - Map today = new LinkedHashMap<>(); - today.put("time", "2022-08-11 15:08:29"); - today.put("today_visitor", 10); // 访问量(人) - today.put("total_visitor", 100); // 总访问量 - today.put("today_sales", 30); // 销售额(元) - today.put("total_sales", 65); // 总销售额 - today.put("order_num", 12); // 订单量(笔) - today.put("order_sum", 255); // 总订单量 - today.put("today_new_user", 120); // 新增用户 - today.put("total_new_user", 360); // 总访用户 - console.put("today", today); + // 招生统计数据 + Map enrollmentStats = buildEnrollmentStats(); + console.put("today", enrollmentStats); - // 访客图表 - Map visitor = new LinkedHashMap<>(); - visitor.put("date", TimeUtils.daysAgoDate(15)); - visitor.put("list", new JSONArray() {{ - add(new JSONObject() {{ - put("name", "访客数"); - put("data", Arrays.asList(12,13,11,5,8,22,14,9,456,62,78,12,18,22,46)); - }}); - }}); - console.put("visitor", visitor); + // 招生趋势数据(带筛选条件) + Map enrollmentTrend = buildEnrollmentTrend(teacherId, rangeType); + console.put("enrollmentTrend", enrollmentTrend); + // 常用功能菜单 console.put("menu", new JSONArray() {{ add(new JSONObject() {{ @@ -113,10 +118,190 @@ public class IndexServiceImpl implements IIndexService { }}); - return console; } + /** + * 构建招生统计数据: + * - 总招生数量 + * - 今日招生数量 + * - 本周招生数量 + * - 本月招生数量 + * + * 招生数量定义:student_status = 0 或 1 的学生数量 + */ + private Map buildEnrollmentStats() { + Map stats = new LinkedHashMap<>(); + + // 当前时间 + Date now = new Date(); + stats.put("time", new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(now)); + + // 总招生数量(所有时间) + long totalCount = studentInfoMapper.selectCount( + new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper() + .in("student_status", 0, 1) + .isNull("delete_time") + ); + + // 今日、本周、本月时间范围 + LocalDate today = LocalDate.now(); + Date todayStart = toDate(today.atStartOfDay()); + Date tomorrowStart = toDate(today.plusDays(1).atStartOfDay()); + + LocalDate weekStartDate = today.minusDays(6); // 最近7天 + Date weekStart = toDate(weekStartDate.atStartOfDay()); + + LocalDate monthStartDate = today.minusDays(29); // 最近30天 + Date monthStart = toDate(monthStartDate.atStartOfDay()); + + long todayCount = countEnrollmentInRange(todayStart, tomorrowStart); + long weekCount = countEnrollmentInRange(weekStart, tomorrowStart); + long monthCount = countEnrollmentInRange(monthStart, tomorrowStart); + + stats.put("total_enroll_count", totalCount); + stats.put("today_enroll_count", todayCount); + stats.put("week_enroll_count", weekCount); + stats.put("month_enroll_count", monthCount); + + return stats; + } + + /** + * 计算时间区间内的招生数量(按 pre_registration_time 筛选) + */ + private long countEnrollmentInRange(Date startTime, Date endTime) { + return studentInfoMapper.selectCount( + new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper() + .in("student_status", 0, 1) + .isNull("delete_time") + .isNotNull("pre_registration_time") + .ge("pre_registration_time", startTime) + .lt("pre_registration_time", endTime) + ); + } + + /** + * 构建招生趋势数据 + * + * @param teacherId 招生老师ID(为空则统计所有老师) + * @param rangeType 时间区间类型:day / week / month + */ + private Map buildEnrollmentTrend(Integer teacherId, String rangeType) { + Map result = new LinkedHashMap<>(); + + if (rangeType == null || rangeType.trim().isEmpty()) { + rangeType = "week"; + } + + LocalDate today = LocalDate.now(); + LocalDate startDate; + + switch (rangeType) { + case "day": + startDate = today; + break; + case "month": + startDate = today.minusDays(29); + break; + case "week": + default: + startDate = today.minusDays(6); + break; + } + + LocalDate endDate = today; + Date startTime = toDate(startDate.atStartOfDay()); + Date endTime = toDate(endDate.plusDays(1).atStartOfDay()); + + // 生成日期列表 + List dateList = new ArrayList<>(); + Map dateIndexMap = new LinkedHashMap<>(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + int idx = 0; + for (LocalDate d = startDate; !d.isAfter(endDate); d = d.plusDays(1)) { + String dateStr = d.format(formatter); + dateList.add(dateStr); + dateIndexMap.put(dateStr, idx++); + } + + // 查询数据库中的统计数据:按日期 + 招生老师分组 + List> rows = studentInfoMapper.selectEnrollmentTrend(startTime, endTime, teacherId); + + // 收集涉及到的老师ID + Set teacherIds = new LinkedHashSet<>(); + for (Map row : rows) { + Object tIdObj = row.get("teacherId"); + if (tIdObj != null) { + teacherIds.add(((Number) tIdObj).intValue()); + } + } + + Map teacherNameMap = new LinkedHashMap<>(); + if (!teacherIds.isEmpty()) { + List teachers = teacherMapper.selectBatchIds(teacherIds); + for (Teacher t : teachers) { + teacherNameMap.put(t.getTeacherId(), t.getTeacherName()); + } + } + + // 构建每个老师的时间序列数据 + Map> teacherSeriesMap = new LinkedHashMap<>(); + for (Integer tId : teacherIds) { + List initList = new ArrayList<>(); + for (int i = 0; i < dateList.size(); i++) { + initList.add(0L); + } + teacherSeriesMap.put(tId, initList); + } + + for (Map row : rows) { + Object dateObj = row.get("statDate"); + Object tIdObj = row.get("teacherId"); + Object countObj = row.get("enrollCount"); + if (dateObj == null || tIdObj == null || countObj == null) { + continue; + } + String dateStr = String.valueOf(dateObj); + Integer tId = ((Number) tIdObj).intValue(); + Integer index = dateIndexMap.get(dateStr); + if (index == null) { + continue; + } + List dataList = teacherSeriesMap.get(tId); + if (dataList == null) { + dataList = new ArrayList<>(); + for (int i = 0; i < dateList.size(); i++) { + dataList.add(0L); + } + teacherSeriesMap.put(tId, dataList); + } + long count = ((Number) countObj).longValue(); + dataList.set(index, count); + } + + // 组装返回给前端的 list 数据 + JSONArray seriesList = new JSONArray(); + for (Map.Entry> entry : teacherSeriesMap.entrySet()) { + Integer tId = entry.getKey(); + List data = entry.getValue(); + JSONObject item = new JSONObject(); + item.put("teacherId", tId); + item.put("name", teacherNameMap.getOrDefault(tId, "未知老师")); + item.put("data", data); + seriesList.add(item); + } + + result.put("date", dateList); + result.put("list", seriesList); + result.put("rangeType", rangeType); + return result; + } + + private Date toDate(java.time.LocalDateTime localDateTime) { + return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); + } + /** * 公共配置 * diff --git a/server/like-admin/src/main/java/com/mdd/admin/service/impl/StudentInfoServiceImpl.java b/server/like-admin/src/main/java/com/mdd/admin/service/impl/StudentInfoServiceImpl.java index 9d878ab9..67b7676c 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/service/impl/StudentInfoServiceImpl.java +++ b/server/like-admin/src/main/java/com/mdd/admin/service/impl/StudentInfoServiceImpl.java @@ -4,6 +4,7 @@ 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; import com.mdd.admin.validate.commons.PageValidate; import com.mdd.admin.service.IStudentInfoService; import com.mdd.admin.validate.StudentInfoCreateValidate; @@ -12,18 +13,12 @@ import com.mdd.admin.validate.StudentInfoSearchValidate; import com.mdd.admin.vo.StudentInfoListedVo; import com.mdd.admin.vo.StudentInfoDetailVo; import com.mdd.common.core.PageResult; +import com.mdd.common.entity.*; 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.exception.OperateException; +import com.mdd.common.mapper.*; import com.mdd.common.mapper.admin.AdminMapper; import com.mdd.common.mapper.user.UserMapper; @@ -33,6 +28,7 @@ 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; @@ -47,7 +43,7 @@ import java.util.*; * @author gyp */ @Service -public class StudentInfoServiceImpl implements IStudentInfoService { +public class StudentInfoServiceImpl extends ServiceImpl implements IStudentInfoService { @Resource StudentInfoMapper studentInfoMapper; @@ -63,6 +59,8 @@ public class StudentInfoServiceImpl implements IStudentInfoService { private AdminMapper adminMapper; @Autowired private UserMapper userMapper; + @Autowired + private TeacherMapper teacherMapper; /** * 学生信息列表 @@ -95,6 +93,7 @@ public class StudentInfoServiceImpl implements IStudentInfoService { "=:verifiedBy@verified_by:int", "=:recruitmentTeacherId@recruitment_teacher_id:int", "=:receptionTeacherId@reception_teacher_id:int", + "datetime:createTimeStart-createTimeEnd@create_time:str", }); IPage iPage = studentInfoMapper.selectPage(new Page<>(page, limit), queryWrapper); @@ -133,12 +132,14 @@ public class StudentInfoServiceImpl implements IStudentInfoService { 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); } @@ -232,6 +233,10 @@ public class StudentInfoServiceImpl implements IStudentInfoService { studentInfo.setIsVerified(createValidate.getIsVerified() != null ? createValidate.getIsVerified() : 0); studentInfo.setVerifiedBy(createValidate.getVerifiedBy()); studentInfo.setVerifiedTime(createValidate.getVerifiedTime()); + studentInfo.setPreRegistrationTime(createValidate.getPreRegistrationTime()); + studentInfo.setRecruitmentTeacherId(createValidate.getRecruitmentTeacherId()); + studentInfo.setReceptionTeacherId(createValidate.getReceptionTeacherId()); + studentInfo.setInvitationCode(createValidate.getInvitationCode()); studentInfoMapper.insert(studentInfo); // 创建基本信息 @@ -384,6 +389,15 @@ public class StudentInfoServiceImpl implements IStudentInfoService { studentInfoMapper.delete(new QueryWrapper().eq("student_id", id)); } + @Override + public void batchUpdateStudentStatus(List studentIdList) { + if (CollectionUtils.isEmpty(studentIdList)) { + throw new OperateException("批量入学失败, 学生idList丢失"); + } + + studentInfoMapper.batchUpdateStudentStatus(studentIdList); + } + private > T getRandomEntity(M mapper) { try { QueryWrapper wrapper = new QueryWrapper<>(); diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoCreateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoCreateValidate.java index ba491cb3..806c8a03 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoCreateValidate.java +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoCreateValidate.java @@ -1,5 +1,6 @@ package com.mdd.admin.validate; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -75,7 +76,8 @@ public class StudentInfoCreateValidate implements Serializable { private Integer receptionTeacherId; @ApiModelProperty(value = "预报名时间") - private Long preRegistrationTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private java.util.Date preRegistrationTime; @ApiModelProperty(value = "邀请码") private String invitationCode; diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoSearchValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoSearchValidate.java index 829c212a..577092f4 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoSearchValidate.java +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoSearchValidate.java @@ -56,4 +56,10 @@ public class StudentInfoSearchValidate implements Serializable { @ApiModelProperty(value = "接待老师ID") private Integer receptionTeacherId; + @ApiModelProperty(value = "创建时间开始") + private String createTimeStart; + + @ApiModelProperty(value = "创建时间结束") + private String createTimeEnd; + } diff --git a/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoUpdateValidate.java b/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoUpdateValidate.java index 4dbe2fd4..a5adf3a3 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoUpdateValidate.java +++ b/server/like-admin/src/main/java/com/mdd/admin/validate/StudentInfoUpdateValidate.java @@ -1,5 +1,6 @@ package com.mdd.admin.validate; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -25,7 +26,7 @@ public class StudentInfoUpdateValidate implements Serializable { @ApiModelProperty(value = "主键") private Long studentId; - @NotNull(message = "studentNumber参数缺失") +// @NotNull(message = "studentNumber参数缺失") @ApiModelProperty(value = "学号") private String studentNumber; @@ -41,19 +42,19 @@ public class StudentInfoUpdateValidate implements Serializable { @ApiModelProperty(value = "班级ID") private Integer classId; - @NotNull(message = "grade参数缺失") +// @NotNull(message = "grade参数缺失") @ApiModelProperty(value = "年级") private Integer grade; - @NotNull(message = "enrollmentYear参数缺失") +// @NotNull(message = "enrollmentYear参数缺失") @ApiModelProperty(value = "入学年份") private Integer enrollmentYear; - @NotNull(message = "expectedGraduationYear参数缺失") +// @NotNull(message = "expectedGraduationYear参数缺失") @ApiModelProperty(value = "预计毕业年份") private Integer expectedGraduationYear; - @NotNull(message = "studentStatus参数缺失") +// @NotNull(message = "studentStatus参数缺失") @ApiModelProperty(value = "学生状态: [0=预报名, 1=报名, 2=在读, 3=休学, 4=毕业, 5=退学]") private Integer studentStatus; @@ -85,7 +86,8 @@ public class StudentInfoUpdateValidate implements Serializable { private Integer receptionTeacherId; @ApiModelProperty(value = "预报名时间") - private Long preRegistrationTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private java.util.Date preRegistrationTime; @ApiModelProperty(value = "邀请码") private String invitationCode; diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoDetailVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoDetailVo.java index 397b46a1..cbccc3be 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoDetailVo.java +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoDetailVo.java @@ -1,5 +1,6 @@ package com.mdd.admin.vo; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -69,7 +70,8 @@ public class StudentInfoDetailVo implements Serializable { private Integer receptionTeacherId; @ApiModelProperty(value = "预报名时间") - private Long preRegistrationTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private java.util.Date preRegistrationTime; @ApiModelProperty(value = "邀请码") private String invitationCode; diff --git a/server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoListedVo.java b/server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoListedVo.java index b87dbb08..e33a232f 100644 --- a/server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoListedVo.java +++ b/server/like-admin/src/main/java/com/mdd/admin/vo/StudentInfoListedVo.java @@ -99,6 +99,9 @@ public class StudentInfoListedVo implements Serializable { @ApiModelProperty(value = "招生老师ID") private Integer recruitmentTeacherId; + @ApiModelProperty(value = "招生老师名字") + private String recruitmentTeacherName; + @ApiModelProperty(value = "接待老师ID") private Integer receptionTeacherId; diff --git a/server/like-common/src/main/java/com/mdd/common/entity/StudentInfo.java b/server/like-common/src/main/java/com/mdd/common/entity/StudentInfo.java index a9f1099f..e49ef833 100644 --- a/server/like-common/src/main/java/com/mdd/common/entity/StudentInfo.java +++ b/server/like-common/src/main/java/com/mdd/common/entity/StudentInfo.java @@ -72,7 +72,7 @@ public class StudentInfo implements Serializable { private Integer receptionTeacherId; @ApiModelProperty(value = "预报名时间") - private Long preRegistrationTime; + private Date preRegistrationTime; @ApiModelProperty(value = "邀请码") private String invitationCode; diff --git a/server/like-common/src/main/java/com/mdd/common/mapper/StudentInfoMapper.java b/server/like-common/src/main/java/com/mdd/common/mapper/StudentInfoMapper.java index 9033394f..ebde9b4e 100644 --- a/server/like-common/src/main/java/com/mdd/common/mapper/StudentInfoMapper.java +++ b/server/like-common/src/main/java/com/mdd/common/mapper/StudentInfoMapper.java @@ -3,6 +3,11 @@ package com.mdd.common.mapper; import com.mdd.common.core.basics.IBaseMapper; import com.mdd.common.entity.StudentInfo; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; +import java.util.Map; /** * 学生信息Mapper @@ -10,4 +15,18 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface StudentInfoMapper extends IBaseMapper { + + void batchUpdateStudentStatus(@Param("studentIdList") List studentIdList); + + /** + * 按日期和招生老师统计招生数量(student_status = 0 或 1) + * + * @param startTime 开始时间(含) + * @param endTime 结束时间(不含) + * @param teacherId 招生老师ID(可选) + * @return 每行包含 statDate(yyyy-MM-dd)、teacherId、enrollCount + */ + List> selectEnrollmentTrend(@Param("startTime") Date startTime, + @Param("endTime") Date endTime, + @Param("teacherId") Integer teacherId); } diff --git a/server/like-common/src/main/resources/mapper/StudentInfoMapper.xml b/server/like-common/src/main/resources/mapper/StudentInfoMapper.xml new file mode 100644 index 00000000..27222ae6 --- /dev/null +++ b/server/like-common/src/main/resources/mapper/StudentInfoMapper.xml @@ -0,0 +1,40 @@ + + + + + + + UPDATE la_student_info + SET student_status = 2 + WHERE student_id IN + + #{id} + + + + + + + +