Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
practical_train
Commits
50a3f966
Commit
50a3f966
authored
Nov 06, 2026
by
wujipeng
Browse files
学员详情编辑优化
parent
bb53a972
Changes
10
Hide whitespace changes
Inline
Side-by-side
practical-api/practical-business-api/src/main/java/com/platform/business/model/dto/ClassStudentUpdateDTO.java
View file @
50a3f966
...
@@ -8,8 +8,8 @@ import java.util.List;
...
@@ -8,8 +8,8 @@ import java.util.List;
/**
/**
* 班级名单编辑学员资料请求。
* 班级名单编辑学员资料请求。
*
*
* <p>字段与
原型名单列保持一致,只允许维护个人资料,不允许通过本接口直接篡改班级关系、
* <p>字段与
“编辑学员”弹窗保持一致。所属班级和账户状态虽然在同一个弹窗提交,
*
考试成绩、出勤率或账户状态;这些信息分别由转班、考试、考勤和结业接口维护
。</p>
*
服务端仍分别复用既有转班审计和账户状态机,不能绕过历史记录及状态流转规则
。</p>
*/
*/
@Data
@Data
public
class
ClassStudentUpdateDTO
{
public
class
ClassStudentUpdateDTO
{
...
@@ -20,12 +20,27 @@ public class ClassStudentUpdateDTO {
...
@@ -20,12 +20,27 @@ public class ClassStudentUpdateDTO {
@ApiModelProperty
(
value
=
"手机号"
,
required
=
true
)
@ApiModelProperty
(
value
=
"手机号"
,
required
=
true
)
private
String
phone
;
private
String
phone
;
@ApiModelProperty
(
"人员类别,可多选"
)
@ApiModelProperty
(
"目标班级ID;为空或等于当前班级时不转班"
)
private
Integer
targetClassId
;
@ApiModelProperty
(
"账户状态:PENDING/STUDYING/GRADUATED/ARCHIVED;为空时保持原状态"
)
private
String
accountStatus
;
@ApiModelProperty
(
"身份证号"
)
private
String
idCard
;
@ApiModelProperty
(
"单位名称"
)
private
String
companyName
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
@ApiModelProperty
(
"兼容旧前端:人员类别,可多选"
)
private
List
<
String
>
personTypes
;
private
List
<
String
>
personTypes
;
@ApiModelProperty
(
"
所在单位
"
)
@ApiModelProperty
(
"
兼容旧前端:所在单位;companyName为空时使用该字段
"
)
private
String
workUnit
;
private
String
workUnit
;
@ApiModelProperty
(
"最高学历"
)
@ApiModelProperty
(
"
兼容旧前端:
最高学历"
)
private
String
highestEducation
;
private
String
highestEducation
;
}
}
practical-api/practical-business-api/src/main/java/com/platform/business/model/vo/ClassAdminStudentVO.java
View file @
50a3f966
...
@@ -18,6 +18,18 @@ public class ClassAdminStudentVO {
...
@@ -18,6 +18,18 @@ public class ClassAdminStudentVO {
private
String
phone
;
private
String
phone
;
/** 当前所属班级,编辑弹窗回显和转班下拉选中值共用。 */
private
Integer
classId
;
private
String
className
;
private
String
idCard
;
/** 编辑弹窗统一使用“单位名称”;workUnit继续保留给名单及旧前端。 */
private
String
companyName
;
private
String
remark
;
/** 人员类别原始多选值;兼容旧数据时由user_type1/user_type2补齐。 */
/** 人员类别原始多选值;兼容旧数据时由user_type1/user_type2补齐。 */
private
List
<
String
>
personTypes
;
private
List
<
String
>
personTypes
;
...
...
practical-business/src/main/java/com/platform/business/controller/ClassAdminController.java
View file @
50a3f966
...
@@ -134,8 +134,8 @@ public class ClassAdminController extends BaseController {
...
@@ -134,8 +134,8 @@ public class ClassAdminController extends BaseController {
@PathVariable
(
"userId"
)
String
userId
,
@PathVariable
(
"userId"
)
String
userId
,
@RequestBody
ClassStudentUpdateDTO
body
,
@RequestBody
ClassStudentUpdateDTO
body
,
HttpServletRequest
request
)
{
HttpServletRequest
request
)
{
requireAdmin
(
request
);
UserEntity
operator
=
requireAdmin
(
request
);
return
Result
.
data
(
classAdminService
.
updateStudent
(
classId
,
userId
,
body
));
return
Result
.
data
(
classAdminService
.
updateStudent
(
classId
,
userId
,
body
,
operator
));
}
}
@ApiOperation
(
"转班目标班级选项"
)
@ApiOperation
(
"转班目标班级选项"
)
...
...
practical-business/src/main/java/com/platform/business/mapper/ClassMapper.java
View file @
50a3f966
...
@@ -55,6 +55,9 @@ public interface ClassMapper extends BaseMapper<ClassEntity> {
...
@@ -55,6 +55,9 @@ public interface ClassMapper extends BaseMapper<ClassEntity> {
int
countAdminStudentPhone
(
@Param
(
"phone"
)
String
phone
,
int
countAdminStudentPhone
(
@Param
(
"phone"
)
String
phone
,
@Param
(
"excludeUserId"
)
String
excludeUserId
);
@Param
(
"excludeUserId"
)
String
excludeUserId
);
int
countAdminStudentIdCard
(
@Param
(
"idCard"
)
String
idCard
,
@Param
(
"excludeUserId"
)
String
excludeUserId
);
int
updateAdminStudentProfile
(
@Param
(
"userId"
)
String
userId
,
int
updateAdminStudentProfile
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"name"
)
String
name
,
@Param
(
"name"
)
String
name
,
@Param
(
"phone"
)
String
phone
,
@Param
(
"phone"
)
String
phone
,
...
@@ -63,6 +66,9 @@ public interface ClassMapper extends BaseMapper<ClassEntity> {
...
@@ -63,6 +66,9 @@ public interface ClassMapper extends BaseMapper<ClassEntity> {
@Param
(
"personType2"
)
String
personType2
,
@Param
(
"personType2"
)
String
personType2
,
@Param
(
"workUnit"
)
String
workUnit
,
@Param
(
"workUnit"
)
String
workUnit
,
@Param
(
"highestEducation"
)
String
highestEducation
,
@Param
(
"highestEducation"
)
String
highestEducation
,
@Param
(
"idCard"
)
String
idCard
,
@Param
(
"companyName"
)
String
companyName
,
@Param
(
"remark"
)
String
remark
,
@Param
(
"updateTime"
)
Date
updateTime
);
@Param
(
"updateTime"
)
Date
updateTime
);
int
deleteAdminStudentRelations
(
@Param
(
"classId"
)
Integer
classId
,
int
deleteAdminStudentRelations
(
@Param
(
"classId"
)
Integer
classId
,
...
...
practical-business/src/main/java/com/platform/business/service/ClassAdminService.java
View file @
50a3f966
...
@@ -40,7 +40,8 @@ public interface ClassAdminService {
...
@@ -40,7 +40,8 @@ public interface ClassAdminService {
ClassAdminStudentVO
studentDetail
(
Integer
classId
,
String
userId
);
ClassAdminStudentVO
studentDetail
(
Integer
classId
,
String
userId
);
ClassAdminStudentVO
updateStudent
(
Integer
classId
,
String
userId
,
ClassStudentUpdateDTO
request
);
ClassAdminStudentVO
updateStudent
(
Integer
classId
,
String
userId
,
ClassStudentUpdateDTO
request
,
UserEntity
operator
);
List
<
ClassAdminOptionVO
>
transferOptions
(
Integer
classId
);
List
<
ClassAdminOptionVO
>
transferOptions
(
Integer
classId
);
...
...
practical-business/src/main/java/com/platform/business/service/impl/ClassAdminServiceImpl.java
View file @
50a3f966
...
@@ -33,6 +33,7 @@ import com.platform.business.model.vo.ClassStudentExportFileVO;
...
@@ -33,6 +33,7 @@ import com.platform.business.model.vo.ClassStudentExportFileVO;
import
com.platform.business.model.vo.ClassStudentGraduationResultVO
;
import
com.platform.business.model.vo.ClassStudentGraduationResultVO
;
import
com.platform.business.model.vo.ClassStudentOperationResultVO
;
import
com.platform.business.model.vo.ClassStudentOperationResultVO
;
import
com.platform.business.service.BusinessNotificationPublisher
;
import
com.platform.business.service.BusinessNotificationPublisher
;
import
com.platform.business.service.AccountAdminService
;
import
com.platform.business.service.ClassAdminService
;
import
com.platform.business.service.ClassAdminService
;
import
com.platform.business.service.SysLevelService
;
import
com.platform.business.service.SysLevelService
;
import
com.platform.business.service.SysPhoneRoleService
;
import
com.platform.business.service.SysPhoneRoleService
;
...
@@ -74,6 +75,10 @@ public class ClassAdminServiceImpl implements ClassAdminService {
...
@@ -74,6 +75,10 @@ public class ClassAdminServiceImpl implements ClassAdminService {
@Resource
@Resource
private
ClassMapper
classMapper
;
private
ClassMapper
classMapper
;
/** 账户状态统一交给账户服务处理,复用状态机、登录禁用标记和操作审计。 */
@Resource
private
AccountAdminService
accountAdminService
;
@Resource
@Resource
private
SysLevelService
sysLevelService
;
private
SysLevelService
sysLevelService
;
...
@@ -245,9 +250,10 @@ public class ClassAdminServiceImpl implements ClassAdminService {
...
@@ -245,9 +250,10 @@ public class ClassAdminServiceImpl implements ClassAdminService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ClassAdminStudentVO
updateStudent
(
Integer
classId
,
String
userId
,
public
ClassAdminStudentVO
updateStudent
(
Integer
classId
,
String
userId
,
ClassStudentUpdateDTO
request
)
{
ClassStudentUpdateDTO
request
,
UserEntity
operator
)
{
ClassEntity
clazz
=
requireExistingClass
(
classId
);
ClassEntity
clazz
=
requireExistingClass
(
classId
);
requireStudent
(
classId
,
userId
);
ClassAdminStudentVO
currentStudent
=
requireStudent
(
classId
,
userId
);
if
(
request
==
null
)
{
if
(
request
==
null
)
{
throw
new
BusinessException
(
"学员信息不能为空"
);
throw
new
BusinessException
(
"学员信息不能为空"
);
}
}
...
@@ -260,9 +266,35 @@ public class ClassAdminServiceImpl implements ClassAdminService {
...
@@ -260,9 +266,35 @@ public class ClassAdminServiceImpl implements ClassAdminService {
throw
new
BusinessException
(
"手机号已被其他账户使用"
);
throw
new
BusinessException
(
"手机号已被其他账户使用"
);
}
}
List
<
String
>
personTypes
=
normalizePersonTypes
(
request
.
getPersonTypes
());
String
idCard
=
request
.
getIdCard
()
==
null
String
workUnit
=
optionalText
(
request
.
getWorkUnit
(),
"所在单位"
,
255
);
?
currentStudent
.
getIdCard
()
String
education
=
optionalText
(
request
.
getHighestEducation
(),
"最高学历"
,
64
);
:
optionalText
(
request
.
getIdCard
(),
"身份证号"
,
32
);
if
(
idCard
!=
null
&&
!
idCard
.
matches
(
"^(\\d{15}|\\d{17}[\\dXx])$"
))
{
throw
new
BusinessException
(
"身份证号需为15位或18位有效格式"
);
}
if
(
idCard
!=
null
&&
classMapper
.
countAdminStudentIdCard
(
idCard
,
userId
)
>
0
)
{
throw
new
BusinessException
(
"身份证号已被其他账户使用"
);
}
/*
* 新弹窗使用companyName;未传该字段时兼容旧前端的workUnit。两个字段都缺失时
* 保留原值,避免新前端不再提交人员类别和学历后意外清空历史资料。
*/
String
companySource
=
request
.
getCompanyName
()
!=
null
?
request
.
getCompanyName
()
:
request
.
getWorkUnit
();
String
companyName
=
companySource
==
null
?
(
currentStudent
.
getCompanyName
()
==
null
?
currentStudent
.
getWorkUnit
()
:
currentStudent
.
getCompanyName
())
:
optionalText
(
companySource
,
"单位名称"
,
255
);
String
remark
=
request
.
getRemark
()
==
null
?
currentStudent
.
getRemark
()
:
optionalText
(
request
.
getRemark
(),
"备注"
,
1000
);
List
<
String
>
personTypes
=
request
.
getPersonTypes
()
==
null
?
parsePersonTypes
(
currentStudent
)
:
normalizePersonTypes
(
request
.
getPersonTypes
());
String
education
=
request
.
getHighestEducation
()
==
null
?
currentStudent
.
getHighestEducation
()
:
optionalText
(
request
.
getHighestEducation
(),
"最高学历"
,
64
);
UserEntity
existingUser
=
userService
.
getById
(
userId
);
UserEntity
existingUser
=
userService
.
getById
(
userId
);
if
(
existingUser
==
null
)
{
if
(
existingUser
==
null
)
{
throw
new
BusinessException
(
"学员账户不存在或已删除"
);
throw
new
BusinessException
(
"学员账户不存在或已删除"
);
...
@@ -272,13 +304,33 @@ public class ClassAdminServiceImpl implements ClassAdminService {
...
@@ -272,13 +304,33 @@ public class ClassAdminServiceImpl implements ClassAdminService {
personTypes
.
isEmpty
()
?
null
:
JSON
.
toJSONString
(
personTypes
),
personTypes
.
isEmpty
()
?
null
:
JSON
.
toJSONString
(
personTypes
),
personTypes
.
isEmpty
()
?
null
:
personTypes
.
get
(
0
),
personTypes
.
isEmpty
()
?
null
:
personTypes
.
get
(
0
),
personTypes
.
size
()
<
2
?
null
:
personTypes
.
get
(
1
),
personTypes
.
size
()
<
2
?
null
:
personTypes
.
get
(
1
),
workUnit
,
education
,
new
Date
());
companyName
,
education
,
idCard
,
companyName
,
remark
,
new
Date
());
if
(
updated
!=
1
)
{
if
(
updated
!=
1
)
{
throw
new
BusinessException
(
"学员信息已发生变化,请刷新后重试"
);
throw
new
BusinessException
(
"学员信息已发生变化,请刷新后重试"
);
}
}
syncStudentPhoneRole
(
oldPhone
,
phone
);
syncStudentPhoneRole
(
oldPhone
,
phone
);
ClassAdminStudentVO
result
=
requireStudent
(
classId
,
userId
);
enrichStudent
(
result
,
resolveClassStatus
(
clazz
.
getStartDate
(),
clazz
.
getEndDate
(),
businessToday
()));
String
targetStatus
=
normalizeStudentAccountStatus
(
request
.
getAccountStatus
());
if
(
targetStatus
!=
null
&&
!
targetStatus
.
equalsIgnoreCase
(
String
.
valueOf
(
currentStudent
.
getAccountStatus
())))
{
accountAdminService
.
changeStatus
(
userId
,
targetStatus
,
operator
);
}
Integer
effectiveClassId
=
classId
;
ClassEntity
effectiveClass
=
clazz
;
if
(
request
.
getTargetClassId
()
!=
null
&&
!
classId
.
equals
(
request
.
getTargetClassId
()))
{
ClassStudentTransferDTO
transfer
=
new
ClassStudentTransferDTO
();
transfer
.
setTargetClassId
(
request
.
getTargetClassId
());
transfer
.
setStudentIds
(
Collections
.
singletonList
(
userId
));
// 复用正式转班链路,确保清理未来考试名册并完整记录管理员转班历史。
transferStudents
(
classId
,
transfer
,
operator
);
effectiveClassId
=
request
.
getTargetClassId
();
effectiveClass
=
requireExistingClass
(
effectiveClassId
);
}
ClassAdminStudentVO
result
=
requireStudent
(
effectiveClassId
,
userId
);
enrichStudent
(
result
,
resolveClassStatus
(
effectiveClass
.
getStartDate
(),
effectiveClass
.
getEndDate
(),
businessToday
()));
return
result
;
return
result
;
}
}
...
@@ -808,6 +860,22 @@ public class ClassAdminServiceImpl implements ClassAdminService {
...
@@ -808,6 +860,22 @@ public class ClassAdminServiceImpl implements ClassAdminService {
return
new
ArrayList
<>(
result
);
return
new
ArrayList
<>(
result
);
}
}
/**
* 编辑弹窗只接受学员账户状态代码;具体能否从当前状态流转到目标状态,
* 继续由AccountAdminService的统一状态机判断。
*/
private
String
normalizeStudentAccountStatus
(
String
value
)
{
String
status
=
trimToNull
(
value
);
if
(
status
==
null
)
{
return
null
;
}
status
=
status
.
toUpperCase
(
Locale
.
ROOT
);
if
(!
AccountAdminConstants
.
STUDENT_STATUSES
.
contains
(
status
))
{
throw
new
BusinessException
(
"账户状态参数无效"
);
}
return
status
;
}
private
ClassEntity
requireExistingClass
(
Integer
classId
)
{
private
ClassEntity
requireExistingClass
(
Integer
classId
)
{
requireClassId
(
classId
);
requireClassId
(
classId
);
ClassEntity
clazz
=
classMapper
.
selectById
(
classId
);
ClassEntity
clazz
=
classMapper
.
selectById
(
classId
);
...
...
practical-business/src/main/resources/class-management-api.md
View file @
50a3f966
...
@@ -89,7 +89,8 @@
...
@@ -89,7 +89,8 @@
-
全班及个人出勤率;只有
`NORMAL/LATE`
计入出勤分子,
`ABSENT/LEAVE`
计入分母。
-
全班及个人出勤率;只有
`NORMAL/LATE`
计入出勤分子,
`ABSENT/LEAVE`
计入分母。
-
最近一场
`exam.mark_flag=true`
的考试,以及考生侧
`mark_flag=true`
的正式成绩。
-
最近一场
`exam.mark_flag=true`
的考试,以及考生侧
`mark_flag=true`
的正式成绩。
-
最近考试中 60 分及以上人数占有效成绩人数的比例;没有正式成绩时通过率返回
`null`
。
-
最近考试中 60 分及以上人数占有效成绩人数的比例;没有正式成绩时通过率返回
`null`
。
-
学员名单返回姓名、手机号、人员类别、所在单位、学历、账户状态、出勤和理论/实训成绩。
-
学员名单返回姓名、手机号、所属班级、身份证号、单位名称、备注、账户状态、出勤和理论/实训成绩;
人员类别、所在单位和学历字段继续保留以兼容旧页面及导出。
-
学员状态优先采用账户真实状态;只有旧数据缺少账户状态时才按班级日期回退展示。
-
学员状态优先采用账户真实状态;只有旧数据缺少账户状态时才按班级日期回退展示。
-
`graduationEligible=true`
表示最近已发布的理论和实训成绩都存在,且两者平均分不低于 60。
-
`graduationEligible=true`
表示最近已发布的理论和实训成绩都存在,且两者平均分不低于 60。
-
`selectable=false`
表示学员已经结业或归档,前端应禁止再次勾选办理结业。
-
`selectable=false`
表示学员已经结业或归档,前端应禁止再次勾选办理结业。
...
@@ -104,6 +105,11 @@
...
@@ -104,6 +105,11 @@
"userId"
:
"1900000000000000101"
,
"userId"
:
"1900000000000000101"
,
"name"
:
"张三"
,
"name"
:
"张三"
,
"phone"
:
"13800000000"
,
"phone"
:
"13800000000"
,
"classId"
:
101
,
"className"
:
"污水五级补考"
,
"idCard"
:
"310225198004075411"
,
"companyName"
:
"市第一污水处理厂"
,
"remark"
:
""
,
"personTypes"
:
[
"在职"
,
"从业"
],
"personTypes"
:
[
"在职"
,
"从业"
],
"personTypeName"
:
"在职、从业"
,
"personTypeName"
:
"在职、从业"
,
"workUnit"
:
"市第一污水处理厂"
,
"workUnit"
:
"市第一污水处理厂"
,
...
@@ -128,7 +134,8 @@
...
@@ -128,7 +134,8 @@
`GET /class/admin/{classId}/students/{userId}`
`GET /class/admin/{classId}/students/{userId}`
接口会同时校验班级和成员关系。学员已被其他管理员转班或移除时返回业务错误,不会泄露其他
接口会同时校验班级和成员关系。学员已被其他管理员转班或移除时返回业务错误,不会泄露其他
班级资料。响应字段与班级详情中的单条
`students`
完全一致,可直接复用账户管理的详情组件。
班级资料。响应字段与班级详情中的单条
`students`
完全一致。编辑弹窗按图片依次绑定
`name`
、
`phone`
、
`classId/className`
、
`accountStatus`
、
`idCard`
、
`companyName`
、
`remark`
。
### 7.2 编辑名单资料
### 7.2 编辑名单资料
...
@@ -138,16 +145,41 @@
...
@@ -138,16 +145,41 @@
{
{
"name"
:
"张三"
,
"name"
:
"张三"
,
"phone"
:
"13800000000"
,
"phone"
:
"13800000000"
,
"personTypes"
:
[
"在职"
],
"targetClassId"
:
101
,
"workUnit"
:
"市第一污水处理厂"
,
"accountStatus"
:
"PENDING"
,
"highestEducation"
:
"本科"
"idCard"
:
"310225198004075411"
,
"companyName"
:
"市第一污水处理厂"
,
"remark"
:
"补考班学员"
}
}
```
```
图片字段与接口字段映射:
| 弹窗字段 | 请求字段 | 校验与行为 |
|---|---|---|
| 姓名 |
`name`
| 必填,最多100字符 |
| 手机号 |
`phone`
| 必填,1开头的11位数字,全系统不可重复 |
| 所属班级 |
`targetClassId`
| 选当前班不变;选其他班复用正式转班流程 |
| 账户状态 |
`accountStatus`
|
`PENDING/STUDYING/GRADUATED/ARCHIVED`
,遵循状态机 |
| 身份证号 |
`idCard`
| 选填,15位或18位,末位允许X,全系统不可重复 |
| 单位名称 |
`companyName`
| 选填,最多255字符 |
| 备注 |
`remark`
| 选填,最多1000字符 |
状态下拉展示:
`PENDING=待激活`
、
`STUDYING=在读`
、
`GRADUATED=已结业`
、
`ARCHIVED=已归档`
。状态只能按“待激活 → 在读 → 已结业 → 已归档”方向变化;结业和归档如需
完整办理证书、通知等业务,前端仍应优先使用专用结业/归档操作。
所属班级下拉的当前选中项直接使用详情返回的
`classId/className`
;其余可选项调用第8节接口。
如果目标班级改变,保存时会清理原班级未开始的考试名册、写入转班日志并迁移班级关系;接口
响应中的
`classId/className`
已是新班级,前端保存成功后应关闭弹窗并刷新原班级详情和目录树。
旧字段
`personTypes/workUnit/highestEducation`
仍可提交;新弹窗未提交这些字段时后端保留原值,
不会因弹窗改版清空历史资料。
-
姓名、手机号必填;手机号必须是以
`1`
开头的 11 位数字且全系统唯一。
-
姓名、手机号必填;手机号必须是以
`1`
开头的 11 位数字且全系统唯一。
-
人员类别最多 10 项,单项最长 32 个字符;空数组表示清空。
-
人员类别最多 10 项,单项最长 32 个字符;空数组表示清空。
-
编辑手机号会同步更新登录账号和
`phone_role`
的“学员”角色映射。
-
编辑手机号会同步更新登录账号和
`phone_role`
的“学员”角色映射。
-
本接口不能修改出勤率
、
考试成绩
、
账户状态
或
班级关系。
-
本接口不能修改出勤率
或
考试成绩
;
账户状态
和
班级关系
分别通过既有状态机及转班流程修改
。
## 8. 转班目标选项
## 8. 转班目标选项
...
@@ -276,7 +308,8 @@
...
@@ -276,7 +308,8 @@
1.
打开班级详情时调用
`GET /class/admin/{id}`
,将
`students`
渲染到“学员名单”Tab。
1.
打开班级详情时调用
`GET /class/admin/{id}`
,将
`students`
渲染到“学员名单”Tab。
2.
全选仅选择
`selectable=true`
的行,并维护半选状态;选中数大于 0 时启用批量按钮。
2.
全选仅选择
`selectable=true`
的行,并维护半选状态;选中数大于 0 时启用批量按钮。
3.
点击详情调用第 7.1 节接口;点击编辑提交第 7.2 节接口,成功后替换当前行。
3.
点击编辑先调用第7.1节接口回显;班级下拉用当前班级加第8节返回项,保存提交第7.2节接口。
如果响应
`classId`
与原班级不同,刷新原班级详情和左侧树;否则可直接替换当前行。
4.
打开转班弹窗时调用第 8 节接口,提交成功后重新获取班级详情和左侧班级树。
4.
打开转班弹窗时调用第 8 节接口,提交成功后重新获取班级详情和左侧班级树。
5.
移除成功后重新获取详情和树,不在前端自行推算班级人数。
5.
移除成功后重新获取详情和树,不在前端自行推算班级人数。
6.
结业弹窗用名单中的理论/实训分和
`graduationEligible`
展示达标摘要;提交后按响应展示跳过项,
6.
结业弹窗用名单中的理论/实训分和
`graduationEligible`
展示达标摘要;提交后按响应展示跳过项,
...
@@ -296,6 +329,9 @@
...
@@ -296,6 +329,9 @@
| 转入当前班 | 目标班级不能是当前班级 | 保持弹窗并重新选择 |
| 转入当前班 | 目标班级不能是当前班级 | 保持弹窗并重新选择 |
| 转入已结课班 | 目标班级必须是待开课或进行中状态 | 刷新目标班选项 |
| 转入已结课班 | 目标班级必须是待开课或进行中状态 | 刷新目标班选项 |
| 手机号重复 | 手机号已被其他账户使用 | 保持编辑弹窗并定位手机号 |
| 手机号重复 | 手机号已被其他账户使用 | 保持编辑弹窗并定位手机号 |
| 身份证号格式错误 | 身份证号需为15位或18位有效格式 | 保持编辑弹窗并定位身份证号 |
| 身份证号重复 | 身份证号已被其他账户使用 | 保持编辑弹窗并定位身份证号 |
| 状态逆向修改 | 学员状态只能按待激活→在读→已结业→已归档方向变更 | 恢复原状态并提示 |
| 重复结业 | 当前账户状态不支持结业 | 在结果明细中展示跳过原因 |
| 重复结业 | 当前账户状态不支持结业 | 在结果明细中展示跳过原因 |
## 15. 数据库部署
## 15. 数据库部署
...
...
practical-business/src/main/resources/com/platform/business/mapper/ClassMapper.xml
View file @
50a3f966
...
@@ -195,12 +195,17 @@
...
@@ -195,12 +195,17 @@
select
select
cs_member.id as relationId,
cs_member.id as relationId,
cs_member.user_id as userId,
cs_member.user_id as userId,
cs_member.class_id as classId,
current_class.name as className,
student.nick_name as name,
student.nick_name as name,
student.phone_number as phone,
student.phone_number as phone,
student.id_card as idCard,
student.person_types as personTypesJson,
student.person_types as personTypesJson,
student.user_type1 as legacyPersonType1,
student.user_type1 as legacyPersonType1,
student.user_type2 as legacyPersonType2,
student.user_type2 as legacyPersonType2,
coalesce(nullif(student.work_unit, ''), student.company_name1, student.factory) as workUnit,
coalesce(nullif(student.work_unit, ''), student.company_name1, student.factory) as workUnit,
coalesce(nullif(student.company_name1, ''), student.work_unit, student.factory) as companyName,
student.remark as remark,
student.highest_education as highestEducation,
student.highest_education as highestEducation,
case
case
when upper(trim(student.account_status)) in ('PENDING','STUDYING','GRADUATED','ARCHIVED')
when upper(trim(student.account_status)) in ('PENDING','STUDYING','GRADUATED','ARCHIVED')
...
@@ -217,6 +222,7 @@
...
@@ -217,6 +222,7 @@
practiceResult.score as practicalScore
practiceResult.score as practicalScore
from class_student cs_member
from class_student cs_member
left join user student on student.id = cs_member.user_id
left join user student on student.id = cs_member.user_id
left join class current_class on current_class.id = cs_member.class_id
left join (
left join (
select
select
record.user_id,
record.user_id,
...
@@ -303,6 +309,13 @@
...
@@ -303,6 +309,13 @@
and id != #{excludeUserId}
and id != #{excludeUserId}
</select>
</select>
<select
id=
"countAdminStudentIdCard"
resultType=
"java.lang.Integer"
>
select count(*)
from user
where id_card = #{idCard}
and id != #{excludeUserId}
</select>
<update
id=
"updateAdminStudentProfile"
>
<update
id=
"updateAdminStudentProfile"
>
update user
update user
set nick_name = #{name},
set nick_name = #{name},
...
@@ -312,8 +325,10 @@
...
@@ -312,8 +325,10 @@
user_type1 = #{personType1,jdbcType=VARCHAR},
user_type1 = #{personType1,jdbcType=VARCHAR},
user_type2 = #{personType2,jdbcType=VARCHAR},
user_type2 = #{personType2,jdbcType=VARCHAR},
work_unit = #{workUnit,jdbcType=VARCHAR},
work_unit = #{workUnit,jdbcType=VARCHAR},
company_name1 = #{
workUnit
,jdbcType=VARCHAR},
company_name1 = #{
companyName
,jdbcType=VARCHAR},
highest_education = #{highestEducation,jdbcType=VARCHAR},
highest_education = #{highestEducation,jdbcType=VARCHAR},
id_card = #{idCard,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
update_time = #{updateTime}
update_time = #{updateTime}
where id = #{userId}
where id = #{userId}
</update>
</update>
...
...
practical-business/src/test/java/com/platform/business/controller/ClassAdminControllerTest.java
View file @
50a3f966
...
@@ -2,6 +2,7 @@ package com.platform.business.controller;
...
@@ -2,6 +2,7 @@ package com.platform.business.controller;
import
com.platform.business.constant.ClassAdminConstants
;
import
com.platform.business.constant.ClassAdminConstants
;
import
com.platform.business.model.dto.ClassAdminQueryDTO
;
import
com.platform.business.model.dto.ClassAdminQueryDTO
;
import
com.platform.business.model.dto.ClassStudentUpdateDTO
;
import
com.platform.business.model.entity.UserEntity
;
import
com.platform.business.model.entity.UserEntity
;
import
com.platform.business.model.vo.ClassAdminOptionsVO
;
import
com.platform.business.model.vo.ClassAdminOptionsVO
;
import
com.platform.business.service.AuthenticatedUserService
;
import
com.platform.business.service.AuthenticatedUserService
;
...
@@ -78,4 +79,18 @@ class ClassAdminControllerTest {
...
@@ -78,4 +79,18 @@ class ClassAdminControllerTest {
assertThrows
(
BusinessException
.
class
,
()
->
controller
.
options
(
request
));
assertThrows
(
BusinessException
.
class
,
()
->
controller
.
options
(
request
));
}
}
@Test
void
updateStudentShouldPassAuthenticatedAdministratorForStatusAndTransferAudit
()
{
MockHttpServletRequest
request
=
new
MockHttpServletRequest
();
UserEntity
administrator
=
new
UserEntity
();
administrator
.
setId
(
"admin-1"
);
ClassStudentUpdateDTO
body
=
new
ClassStudentUpdateDTO
();
when
(
authenticatedUserService
.
current
(
request
)).
thenReturn
(
administrator
);
controller
.
updateStudent
(
1
,
"student-1"
,
body
,
request
);
verify
(
authenticatedUserService
).
requireAdmin
(
administrator
);
verify
(
classAdminService
).
updateStudent
(
1
,
"student-1"
,
body
,
administrator
);
}
}
}
practical-business/src/test/java/com/platform/business/service/impl/ClassAdminStudentServiceImplTest.java
View file @
50a3f966
...
@@ -7,6 +7,7 @@ import com.platform.business.model.dto.ClassStudentExportDTO;
...
@@ -7,6 +7,7 @@ import com.platform.business.model.dto.ClassStudentExportDTO;
import
com.platform.business.model.dto.ClassStudentGraduationDTO
;
import
com.platform.business.model.dto.ClassStudentGraduationDTO
;
import
com.platform.business.model.dto.ClassStudentIdsDTO
;
import
com.platform.business.model.dto.ClassStudentIdsDTO
;
import
com.platform.business.model.dto.ClassStudentTransferDTO
;
import
com.platform.business.model.dto.ClassStudentTransferDTO
;
import
com.platform.business.model.dto.ClassStudentUpdateDTO
;
import
com.platform.business.model.entity.ClassEntity
;
import
com.platform.business.model.entity.ClassEntity
;
import
com.platform.business.model.entity.ClassStudentChangeLogEntity
;
import
com.platform.business.model.entity.ClassStudentChangeLogEntity
;
import
com.platform.business.model.entity.StudentGraduationRecordEntity
;
import
com.platform.business.model.entity.StudentGraduationRecordEntity
;
...
@@ -15,6 +16,7 @@ import com.platform.business.model.vo.ClassAdminStudentVO;
...
@@ -15,6 +16,7 @@ import com.platform.business.model.vo.ClassAdminStudentVO;
import
com.platform.business.model.vo.ClassStudentExportFileVO
;
import
com.platform.business.model.vo.ClassStudentExportFileVO
;
import
com.platform.business.model.vo.ClassStudentGraduationResultVO
;
import
com.platform.business.model.vo.ClassStudentGraduationResultVO
;
import
com.platform.business.service.BusinessNotificationPublisher
;
import
com.platform.business.service.BusinessNotificationPublisher
;
import
com.platform.business.service.AccountAdminService
;
import
com.platform.business.service.SysLevelService
;
import
com.platform.business.service.SysLevelService
;
import
com.platform.business.service.SysPhoneRoleService
;
import
com.platform.business.service.SysPhoneRoleService
;
import
com.platform.business.service.UserService
;
import
com.platform.business.service.UserService
;
...
@@ -46,6 +48,7 @@ import static org.mockito.Mockito.when;
...
@@ -46,6 +48,7 @@ import static org.mockito.Mockito.when;
class
ClassAdminStudentServiceImplTest
{
class
ClassAdminStudentServiceImplTest
{
@Mock
private
ClassMapper
classMapper
;
@Mock
private
ClassMapper
classMapper
;
@Mock
private
AccountAdminService
accountAdminService
;
@Mock
private
SysLevelService
sysLevelService
;
@Mock
private
SysLevelService
sysLevelService
;
@Mock
private
UserService
userService
;
@Mock
private
UserService
userService
;
@Mock
private
SysPhoneRoleService
phoneRoleService
;
@Mock
private
SysPhoneRoleService
phoneRoleService
;
...
@@ -135,6 +138,87 @@ class ClassAdminStudentServiceImplTest {
...
@@ -135,6 +138,87 @@ class ClassAdminStudentServiceImplTest {
assertFalse
(
file
.
getFileName
().
contains
(
"/"
));
assertFalse
(
file
.
getFileName
().
contains
(
"/"
));
}
}
@Test
void
editStudentShouldUpdateImageFieldsAndReuseStatusTransition
()
{
ClassEntity
clazz
=
activeClass
(
1
,
"污水五级补考"
);
when
(
classMapper
.
selectById
(
1
)).
thenReturn
(
clazz
);
ClassAdminStudentVO
current
=
student
(
"u1"
,
"原姓名"
);
current
.
setAccountStatus
(
"PENDING"
);
current
.
setCompanyName
(
"原单位"
);
ClassAdminStudentVO
updated
=
student
(
"u1"
,
"丁晓贤"
);
updated
.
setClassId
(
1
);
updated
.
setClassName
(
"污水五级补考"
);
updated
.
setAccountStatus
(
"STUDYING"
);
when
(
classMapper
.
selectAdminStudent
(
1
,
"u1"
)).
thenReturn
(
current
,
updated
);
UserEntity
account
=
new
UserEntity
();
account
.
setId
(
"u1"
);
account
.
setPhoneNumber
(
"13800000000"
);
when
(
userService
.
getById
(
"u1"
)).
thenReturn
(
account
);
when
(
classMapper
.
updateAdminStudentProfile
(
any
(),
any
(),
any
(),
any
(),
any
(),
any
(),
any
(),
any
(),
any
(),
any
(),
any
(),
any
())).
thenReturn
(
1
);
ClassStudentUpdateDTO
request
=
new
ClassStudentUpdateDTO
();
request
.
setName
(
"丁晓贤"
);
request
.
setPhone
(
"13800000000"
);
request
.
setTargetClassId
(
1
);
request
.
setAccountStatus
(
"STUDYING"
);
request
.
setIdCard
(
"310225198004075411"
);
request
.
setCompanyName
(
"新单位"
);
request
.
setRemark
(
"图片弹窗备注"
);
ClassAdminStudentVO
result
=
service
.
updateStudent
(
1
,
"u1"
,
request
,
operator
());
assertEquals
(
"污水五级补考"
,
result
.
getClassName
());
verify
(
accountAdminService
).
changeStatus
(
eq
(
"u1"
),
eq
(
"STUDYING"
),
any
(
UserEntity
.
class
));
verify
(
classMapper
).
updateAdminStudentProfile
(
eq
(
"u1"
),
eq
(
"丁晓贤"
),
eq
(
"13800000000"
),
any
(),
any
(),
any
(),
eq
(
"新单位"
),
any
(),
eq
(
"310225198004075411"
),
eq
(
"新单位"
),
eq
(
"图片弹窗备注"
),
any
());
verify
(
classMapper
,
never
()).
deleteAdminStudentRelations
(
any
(),
any
());
}
@Test
void
editStudentShouldReuseAuditedTransferWhenClassChanges
()
{
ClassEntity
source
=
activeClass
(
1
,
"原班级"
);
ClassEntity
target
=
activeClass
(
2
,
"目标班级"
);
when
(
classMapper
.
selectById
(
1
)).
thenReturn
(
source
);
when
(
classMapper
.
selectById
(
2
)).
thenReturn
(
target
);
ClassAdminStudentVO
current
=
student
(
"u1"
,
"张三"
);
current
.
setAccountStatus
(
"PENDING"
);
ClassAdminStudentVO
transferred
=
student
(
"u1"
,
"张三"
);
transferred
.
setClassId
(
2
);
transferred
.
setClassName
(
"目标班级"
);
transferred
.
setAccountStatus
(
"PENDING"
);
when
(
classMapper
.
selectAdminStudent
(
1
,
"u1"
)).
thenReturn
(
current
);
when
(
classMapper
.
selectAdminStudent
(
2
,
"u1"
)).
thenReturn
(
transferred
);
UserEntity
account
=
new
UserEntity
();
account
.
setId
(
"u1"
);
account
.
setPhoneNumber
(
"13800000000"
);
when
(
userService
.
getById
(
"u1"
)).
thenReturn
(
account
);
when
(
classMapper
.
updateAdminStudentProfile
(
any
(),
any
(),
any
(),
any
(),
any
(),
any
(),
any
(),
any
(),
any
(),
any
(),
any
(),
any
())).
thenReturn
(
1
);
when
(
classMapper
.
lockAdminStudentIds
(
1
,
Collections
.
singletonList
(
"u1"
)))
.
thenReturn
(
Collections
.
singletonList
(
"u1"
));
when
(
changeLogMapper
.
insert
(
any
(
ClassStudentChangeLogEntity
.
class
))).
thenReturn
(
1
);
when
(
classMapper
.
deleteAdminStudentRelations
(
1
,
Collections
.
singletonList
(
"u1"
)))
.
thenReturn
(
1
);
when
(
classMapper
.
insertAdminStudentRelations
(
2
,
Collections
.
singletonList
(
"u1"
)))
.
thenReturn
(
1
);
ClassStudentUpdateDTO
request
=
new
ClassStudentUpdateDTO
();
request
.
setName
(
"张三"
);
request
.
setPhone
(
"13800000000"
);
request
.
setTargetClassId
(
2
);
ClassAdminStudentVO
result
=
service
.
updateStudent
(
1
,
"u1"
,
request
,
operator
());
assertEquals
(
2
,
result
.
getClassId
());
verify
(
classMapper
).
deletePendingExamStudents
(
eq
(
1
),
eq
(
Collections
.
singletonList
(
"u1"
)),
any
());
verify
(
classMapper
).
deleteAdminStudentRelations
(
1
,
Collections
.
singletonList
(
"u1"
));
verify
(
classMapper
).
insertAdminStudentRelations
(
2
,
Collections
.
singletonList
(
"u1"
));
verify
(
changeLogMapper
).
insert
(
any
(
ClassStudentChangeLogEntity
.
class
));
}
private
ClassStudentGraduationDTO
graduationRequest
(
String
mode
)
{
private
ClassStudentGraduationDTO
graduationRequest
(
String
mode
)
{
ClassStudentGraduationDTO
request
=
new
ClassStudentGraduationDTO
();
ClassStudentGraduationDTO
request
=
new
ClassStudentGraduationDTO
();
request
.
setStudentIds
(
Collections
.
singletonList
(
"u1"
));
request
.
setStudentIds
(
Collections
.
singletonList
(
"u1"
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment