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
f945d079
Commit
f945d079
authored
Oct 27, 2026
by
wujipeng
Browse files
学员基本信息、认证管理
parent
56a847d8
Changes
25
Show whitespace changes
Inline
Side-by-side
practical-api/practical-business-api/src/main/java/com/platform/business/model/dto/StudentCertificationExportDTO.java
0 → 100644
View file @
f945d079
package
com.platform.business.model.dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.List
;
/** 管理端批量导出参数;studentIds非空时优先按勾选学员导出。 */
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
"学员认证批量导出参数"
)
public
class
StudentCertificationExportDTO
extends
StudentCertificationQueryDTO
{
@ApiModelProperty
(
"勾选的学员ID,最多500个"
)
private
List
<
String
>
studentIds
;
}
practical-api/practical-business-api/src/main/java/com/platform/business/model/dto/StudentCertificationProfileDTO.java
0 → 100644
View file @
f945d079
package
com.platform.business.model.dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* 学员认证报名资料保存参数。
*
* <p>学员ID不由前端传入,服务端始终从JWT获取当前学员,避免水平越权。</p>
*/
@Data
@ApiModel
(
"学员认证报名资料"
)
public
class
StudentCertificationProfileDTO
{
@ApiModelProperty
(
value
=
"姓名"
,
required
=
true
)
private
String
name
;
@ApiModelProperty
(
value
=
"性别"
,
required
=
true
)
private
String
gender
;
@ApiModelProperty
(
value
=
"出生日期,yyyy-MM-dd"
,
required
=
true
)
private
String
birthday
;
@ApiModelProperty
(
value
=
"户口性质"
,
required
=
true
)
private
String
householdType
;
@ApiModelProperty
(
value
=
"证件类型"
,
required
=
true
)
private
String
idType
;
@ApiModelProperty
(
value
=
"证件号码"
,
required
=
true
)
private
String
idCard
;
@ApiModelProperty
(
value
=
"最高学历"
,
required
=
true
)
private
String
highestEducation
;
@ApiModelProperty
(
"所学专业"
)
private
String
major
;
@ApiModelProperty
(
value
=
"行政区"
,
required
=
true
)
private
String
administrativeDistrict
;
@ApiModelProperty
(
value
=
"人员类别,多选"
,
required
=
true
)
private
List
<
String
>
personTypes
;
@ApiModelProperty
(
"人员类别选择其他时的说明"
)
private
String
personTypeOther
;
@ApiModelProperty
(
value
=
"联系地址"
,
required
=
true
)
private
String
homeAddress
;
@ApiModelProperty
(
"邮编,6位数字"
)
private
String
zipCode
;
@ApiModelProperty
(
value
=
"联系电话"
,
required
=
true
)
private
String
phoneNumber
;
@ApiModelProperty
(
"工作单位"
)
private
String
workUnit
;
@ApiModelProperty
(
"单位联系电话"
)
private
String
unitPhone
;
@ApiModelProperty
(
"单位地址"
)
private
String
workUnitAddress
;
@ApiModelProperty
(
"劳动手册编号"
)
private
String
laborBookNo
;
@ApiModelProperty
(
value
=
"本工种工作年限,0至60"
,
required
=
true
)
private
Integer
currentWorkYears
;
@ApiModelProperty
(
value
=
"社保缴费年限,0至60"
,
required
=
true
)
private
Integer
socialSecurityYears
;
@ApiModelProperty
(
"原职业(工种)"
)
private
String
previousOccupation
;
@ApiModelProperty
(
"原职业等级"
)
private
String
previousLevel
;
@ApiModelProperty
(
"原职业证书编号"
)
private
String
previousCertNo
;
@ApiModelProperty
(
"原职业发证日期,yyyy-MM-dd"
)
private
String
previousIssueDate
;
@ApiModelProperty
(
"原职业发证部门"
)
private
String
previousIssueDept
;
@ApiModelProperty
(
"上一等级职业资格证书编号"
)
private
String
previousLevelCertNo
;
@ApiModelProperty
(
"毕业院校"
)
private
String
graduationSchool
;
@ApiModelProperty
(
"毕业日期,yyyy-MM-dd"
)
private
String
graduationDate
;
@ApiModelProperty
(
"毕业证书编号"
)
private
String
graduationCertNo
;
@ApiModelProperty
(
value
=
"培训职业(工种)"
,
required
=
true
)
private
String
trainingOccupation
;
@ApiModelProperty
(
value
=
"培训等级"
,
required
=
true
)
private
String
trainingLevel
;
@ApiModelProperty
(
value
=
"培训类别,单选"
,
required
=
true
)
private
String
trainingCategory
;
@ApiModelProperty
(
value
=
"是否申请培训补贴"
,
required
=
true
)
private
Boolean
subsidyFlag
;
@ApiModelProperty
(
value
=
"从事本职业或相关职业年限,0至60"
,
required
=
true
)
private
Integer
jobYears
;
@ApiModelProperty
(
value
=
"鉴定职业(工种)"
,
required
=
true
)
private
String
assessmentOccupation
;
@ApiModelProperty
(
value
=
"鉴定等级"
,
required
=
true
)
private
String
assessmentLevel
;
}
practical-api/practical-business-api/src/main/java/com/platform/business/model/dto/StudentCertificationQueryDTO.java
0 → 100644
View file @
f945d079
package
com.platform.business.model.dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/** 管理端学员认证分页及导出筛选条件。 */
@Data
@ApiModel
(
"学员认证查询条件"
)
public
class
StudentCertificationQueryDTO
{
@ApiModelProperty
(
"页码,默认1"
)
private
Integer
pageNum
;
@ApiModelProperty
(
"每页条数,默认20,最大100"
)
private
Integer
pageSize
;
@ApiModelProperty
(
"姓名或证件号码关键字"
)
private
String
keyword
;
@ApiModelProperty
(
"工种"
)
private
String
occupation
;
@ApiModelProperty
(
"等级名称"
)
private
String
levelName
;
@ApiModelProperty
(
"班级ID"
)
private
Integer
classId
;
}
practical-api/practical-business-api/src/main/java/com/platform/business/model/entity/UserEntity.java
View file @
f945d079
...
@@ -197,6 +197,87 @@ public class UserEntity {
...
@@ -197,6 +197,87 @@ public class UserEntity {
@TableField
(
"zip_code"
)
@TableField
(
"zip_code"
)
private
String
zipCode
;
private
String
zipCode
;
/** 户口性质,例如本市城镇、本市农村、外省市。 */
@ApiModelProperty
(
"户口性质"
)
@TableField
(
"household_type"
)
private
String
householdType
;
/** 户籍或常住地所属行政区。 */
@ApiModelProperty
(
"行政区"
)
@TableField
(
"administrative_district"
)
private
String
administrativeDistrict
;
/** 人员类别多选值,按JSON字符串保存。 */
@ApiModelProperty
(
"人员类别JSON数组"
)
@TableField
(
"person_types"
)
private
String
personTypes
;
/** 选择“其他”人员类别时填写的说明。 */
@ApiModelProperty
(
"其他人员类别说明"
)
@TableField
(
"person_type_other"
)
private
String
personTypeOther
;
@ApiModelProperty
(
"单位联系电话"
)
@TableField
(
"unit_phone"
)
private
String
unitPhone
;
@ApiModelProperty
(
"劳动手册编号"
)
@TableField
(
"labor_book_no"
)
private
String
laborBookNo
;
@ApiModelProperty
(
"本工种工作年限"
)
@TableField
(
"current_work_year"
)
private
Integer
currentWorkYear
;
@ApiModelProperty
(
"上一等级职业资格证书编号"
)
@TableField
(
"previous_level_cert_no"
)
private
String
previousLevelCertNo
;
@ApiModelProperty
(
"毕业院校"
)
@TableField
(
"graduation_school"
)
private
String
graduationSchool
;
@ApiModelProperty
(
"毕业日期"
)
@TableField
(
"graduation_date"
)
private
String
graduationDate
;
@ApiModelProperty
(
"毕业证书编号"
)
@TableField
(
"graduation_cert_no"
)
private
String
graduationCertNo
;
@ApiModelProperty
(
"培训职业(工种)"
)
@TableField
(
"training_occupation"
)
private
String
trainingOccupation
;
@ApiModelProperty
(
"培训等级"
)
@TableField
(
"training_level"
)
private
String
trainingLevel
;
@ApiModelProperty
(
"培训类别(单选)"
)
@TableField
(
"training_category"
)
private
String
trainingCategory
;
@ApiModelProperty
(
"是否申请培训补贴"
)
@TableField
(
"subsidy_flag"
)
private
Boolean
subsidyFlag
;
@ApiModelProperty
(
"鉴定职业(工种)"
)
@TableField
(
"assessment_occupation"
)
private
String
assessmentOccupation
;
@ApiModelProperty
(
"鉴定等级"
)
@TableField
(
"assessment_level"
)
private
String
assessmentLevel
;
@ApiModelProperty
(
"认证报名资料是否已完善"
)
@TableField
(
"student_profile_completed"
)
private
Boolean
studentProfileCompleted
;
@ApiModelProperty
(
"认证报名资料最近提交时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@TableField
(
"student_profile_submit_time"
)
private
Date
studentProfileSubmitTime
;
@ApiModelProperty
(
"头像"
)
@ApiModelProperty
(
"头像"
)
@TableField
(
"avatar"
)
@TableField
(
"avatar"
)
private
String
avatar
;
private
String
avatar
;
...
...
practical-api/practical-business-api/src/main/java/com/platform/business/model/vo/StudentCertificationListVO.java
0 → 100644
View file @
f945d079
package
com.platform.business.model.vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/** 管理端认证学员列表行。 */
@Data
@ApiModel
(
"学员认证列表行"
)
public
class
StudentCertificationListVO
{
@ApiModelProperty
(
"学员ID"
)
private
String
studentId
;
@ApiModelProperty
(
"姓名"
)
private
String
name
;
@ApiModelProperty
(
"性别"
)
private
String
gender
;
@ApiModelProperty
(
"证件号码"
)
private
String
idCard
;
@ApiModelProperty
(
"申报工种"
)
private
String
assessmentOccupation
;
@ApiModelProperty
(
"申报等级"
)
private
String
assessmentLevel
;
@ApiModelProperty
(
"班级ID"
)
private
Integer
classId
;
@ApiModelProperty
(
"班级名称"
)
private
String
className
;
@ApiModelProperty
(
"工作单位"
)
private
String
workUnit
;
@ApiModelProperty
(
"工作年限"
)
private
Integer
jobYears
;
@ApiModelProperty
(
"社保年限"
)
private
Integer
socialSecurityYears
;
}
practical-api/practical-business-api/src/main/java/com/platform/business/model/vo/StudentCertificationProfileVO.java
0 → 100644
View file @
f945d079
package
com.platform.business.model.vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.platform.business.model.dto.StudentCertificationProfileDTO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/** 学员认证报名资料及当前班级只读信息。 */
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
"学员认证报名资料详情"
)
public
class
StudentCertificationProfileVO
extends
StudentCertificationProfileDTO
{
@ApiModelProperty
(
"学员ID"
)
private
String
studentId
;
@ApiModelProperty
(
"当前班级ID"
)
private
Integer
classId
;
@ApiModelProperty
(
"当前班级名称"
)
private
String
className
;
@ApiModelProperty
(
"当前班级工种"
)
private
String
classOccupation
;
@ApiModelProperty
(
"当前班级等级"
)
private
String
classLevelName
;
@ApiModelProperty
(
"账户状态"
)
private
String
accountStatus
;
@ApiModelProperty
(
"资料是否已完善"
)
private
Boolean
completed
;
@ApiModelProperty
(
"是否允许编辑"
)
private
Boolean
editable
;
@ApiModelProperty
(
"最近提交时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
submitTime
;
/** Mapper内部承接JSON文本,服务层转换为personTypes后不向前端输出。 */
@JsonIgnore
private
String
personTypesJson
;
/** 历史人员类别字段,仅用于兼容旧数据预填。 */
@JsonIgnore
private
String
legacyPersonType1
;
/** 历史人员类别字段,仅用于兼容旧数据预填。 */
@JsonIgnore
private
String
legacyPersonType2
;
}
practical-api/practical-business-api/src/main/java/com/platform/business/model/vo/StudentCertificationScopeVO.java
0 → 100644
View file @
f945d079
package
com.platform.business.model.vo
;
import
lombok.Data
;
/** Mapper返回的认证范围聚合行,供服务层组装三级树。 */
@Data
public
class
StudentCertificationScopeVO
{
private
String
occupation
;
private
String
levelName
;
private
Integer
classId
;
private
String
className
;
private
Integer
count
;
}
practical-api/practical-business-api/src/main/java/com/platform/business/model/vo/StudentCertificationTreeVO.java
0 → 100644
View file @
f945d079
package
com.platform.business.model.vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
/** 管理端“工种-等级-班级”认证范围树节点。 */
@Data
@ApiModel
(
"学员认证范围树节点"
)
public
class
StudentCertificationTreeVO
{
@ApiModelProperty
(
"节点类型:OCCUPATION、LEVEL、CLASS"
)
private
String
nodeType
;
@ApiModelProperty
(
"显示名称"
)
private
String
label
;
@ApiModelProperty
(
"筛选值"
)
private
String
value
;
@ApiModelProperty
(
"该节点下已完善学员数"
)
private
Integer
count
=
0
;
@ApiModelProperty
(
"班级节点ID"
)
private
Integer
classId
;
@ApiModelProperty
(
"子节点"
)
private
List
<
StudentCertificationTreeVO
>
children
=
new
ArrayList
<>();
}
practical-business/src/main/java/com/platform/business/controller/StudentCertificationAdminController.java
0 → 100644
View file @
f945d079
package
com.platform.business.controller
;
import
com.github.pagehelper.PageHelper
;
import
com.platform.business.model.dto.StudentCertificationExportDTO
;
import
com.platform.business.model.dto.StudentCertificationQueryDTO
;
import
com.platform.business.model.entity.UserEntity
;
import
com.platform.business.model.vo.StudentCertificationProfileVO
;
import
com.platform.business.model.vo.StudentCertificationTreeVO
;
import
com.platform.business.service.AuthenticatedUserService
;
import
com.platform.business.service.StudentCertificationAdminService
;
import
com.platform.controller.BaseController
;
import
com.platform.exception.BusinessException
;
import
com.platform.model.resp.Result
;
import
com.platform.page.TableDataInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/** 管理端学员认证管理接口;只提供查询和导出,不提供代替学员修改资料的入口。 */
@Api
(
tags
=
"管理端-学员认证管理"
)
@RestController
@RequestMapping
(
"/certification/admin"
)
public
class
StudentCertificationAdminController
extends
BaseController
{
@Resource
private
StudentCertificationAdminService
service
;
@Resource
private
AuthenticatedUserService
authenticatedUserService
;
@ApiOperation
(
"查询工种、等级、班级三级认证范围树"
)
@GetMapping
(
"/tree"
)
public
Result
<
List
<
StudentCertificationTreeVO
>>
tree
(
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
HttpServletRequest
request
)
{
requireAdmin
(
request
);
return
Result
.
data
(
service
.
tree
(
keyword
));
}
@ApiOperation
(
"分页查询已完善认证资料的学员"
)
@PostMapping
(
"/page"
)
public
TableDataInfo
page
(
@RequestBody
StudentCertificationQueryDTO
query
,
HttpServletRequest
request
)
{
requireAdmin
(
request
);
if
(
query
==
null
)
query
=
new
StudentCertificationQueryDTO
();
normalize
(
query
);
startPage
(
query
.
getPageNum
(),
query
.
getPageSize
());
try
{
return
getDataTable
(
service
.
page
(
query
));
}
finally
{
PageHelper
.
clearPage
();
}
}
@ApiOperation
(
"查询学员认证报名资料详情(只读)"
)
@GetMapping
(
"/{studentId}"
)
public
Result
<
StudentCertificationProfileVO
>
detail
(
@PathVariable
String
studentId
,
HttpServletRequest
request
)
{
requireAdmin
(
request
);
return
Result
.
data
(
service
.
detail
(
studentId
));
}
@ApiOperation
(
"导出单个学员原版式B2报名表"
)
@GetMapping
(
"/{studentId}/export"
)
public
void
exportOne
(
@PathVariable
String
studentId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
requireAdmin
(
request
);
service
.
exportOne
(
studentId
,
response
);
}
@ApiOperation
(
"按勾选学员或当前筛选条件批量导出B2报名表ZIP"
)
@PostMapping
(
"/export"
)
public
void
exportBatch
(
@RequestBody
(
required
=
false
)
StudentCertificationExportDTO
body
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
requireAdmin
(
request
);
service
.
exportBatch
(
body
,
response
);
}
/** 将分页参数约束为前端可稳定处理的范围。 */
private
void
normalize
(
StudentCertificationQueryDTO
query
)
{
if
(
query
.
getPageNum
()==
null
||
query
.
getPageNum
()<
1
)
query
.
setPageNum
(
1
);
if
(
query
.
getPageSize
()==
null
||
query
.
getPageSize
()<
1
)
query
.
setPageSize
(
20
);
if
(
query
.
getPageSize
()>
100
)
query
.
setPageSize
(
100
);
}
/** 统一执行JWT解析和管理员角色校验。 */
private
UserEntity
requireAdmin
(
HttpServletRequest
request
)
{
UserEntity
user
=
authenticatedUserService
.
current
(
request
);
authenticatedUserService
.
requireAdmin
(
user
);
return
user
;
}
}
practical-business/src/main/java/com/platform/business/controller/StudentCertificationProfileController.java
0 → 100644
View file @
f945d079
package
com.platform.business.controller
;
import
com.platform.business.model.dto.StudentCertificationProfileDTO
;
import
com.platform.business.model.entity.UserEntity
;
import
com.platform.business.model.vo.StudentCertificationProfileVO
;
import
com.platform.business.service.AuthenticatedUserService
;
import
com.platform.business.service.StudentCertificationProfileService
;
import
com.platform.model.resp.Result
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
/** 学员端认证基本信息接口;所有操作对象均从JWT解析,不接受客户端用户ID。 */
@Api
(
tags
=
"学员端-认证基本信息"
)
@RestController
@RequestMapping
(
"/student/certification-profile"
)
public
class
StudentCertificationProfileController
{
@Resource
private
StudentCertificationProfileService
service
;
@Resource
private
AuthenticatedUserService
authenticatedUserService
;
@ApiOperation
(
"查询当前学员认证报名资料"
)
@GetMapping
public
Result
<
StudentCertificationProfileVO
>
get
(
HttpServletRequest
request
)
{
UserEntity
user
=
requireStudent
(
request
);
return
Result
.
data
(
service
.
get
(
user
.
getId
()));
}
@ApiOperation
(
"保存当前学员认证报名资料;首次提交同时激活账户"
)
@PutMapping
public
Result
<
StudentCertificationProfileVO
>
save
(
@RequestBody
StudentCertificationProfileDTO
body
,
HttpServletRequest
request
)
{
UserEntity
user
=
requireStudent
(
request
);
return
Result
.
data
(
service
.
save
(
user
.
getId
(),
body
));
}
/** 统一执行JWT解析和学员角色校验。 */
private
UserEntity
requireStudent
(
HttpServletRequest
request
)
{
UserEntity
user
=
authenticatedUserService
.
current
(
request
);
authenticatedUserService
.
requireStudent
(
user
);
return
user
;
}
}
practical-business/src/main/java/com/platform/business/mapper/StudentCertificationMapper.java
0 → 100644
View file @
f945d079
package
com.platform.business.mapper
;
import
com.platform.business.model.dto.StudentCertificationProfileDTO
;
import
com.platform.business.model.dto.StudentCertificationQueryDTO
;
import
com.platform.business.model.vo.StudentCertificationListVO
;
import
com.platform.business.model.vo.StudentCertificationProfileVO
;
import
com.platform.business.model.vo.StudentCertificationScopeVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
/** 学员认证资料、管理列表及范围树专用Mapper。 */
@Mapper
public
interface
StudentCertificationMapper
{
/** 查询学员资料;includeIncomplete用于区分本人预填与管理员只读详情。 */
StudentCertificationProfileVO
selectProfile
(
@Param
(
"studentId"
)
String
studentId
,
@Param
(
"includeIncomplete"
)
boolean
includeIncomplete
);
/** 显式更新全部表单字段,使前端能够清空非必填字段。 */
int
updateProfile
(
@Param
(
"studentId"
)
String
studentId
,
@Param
(
"profile"
)
StudentCertificationProfileDTO
profile
,
@Param
(
"personTypesJson"
)
String
personTypesJson
,
@Param
(
"submitTime"
)
Date
submitTime
);
/** 查询已完善学员列表,分页由PageHelper在外层统一处理。 */
List
<
StudentCertificationListVO
>
selectPage
(
@Param
(
"query"
)
StudentCertificationQueryDTO
query
,
@Param
(
"studentIds"
)
List
<
String
>
studentIds
);
/** 按班级聚合已完善学员人数,服务层再组装为三级树。 */
List
<
StudentCertificationScopeVO
>
selectScope
(
@Param
(
"keyword"
)
String
keyword
);
}
practical-business/src/main/java/com/platform/business/service/StudentCertificationAdminService.java
0 → 100644
View file @
f945d079
package
com.platform.business.service
;
import
com.platform.business.model.dto.StudentCertificationExportDTO
;
import
com.platform.business.model.dto.StudentCertificationQueryDTO
;
import
com.platform.business.model.vo.StudentCertificationListVO
;
import
com.platform.business.model.vo.StudentCertificationProfileVO
;
import
com.platform.business.model.vo.StudentCertificationTreeVO
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/** 管理端学员认证范围、列表、详情及B2导出服务。 */
public
interface
StudentCertificationAdminService
{
List
<
StudentCertificationTreeVO
>
tree
(
String
keyword
);
List
<
StudentCertificationListVO
>
page
(
StudentCertificationQueryDTO
query
);
StudentCertificationProfileVO
detail
(
String
studentId
);
void
exportOne
(
String
studentId
,
HttpServletResponse
response
);
void
exportBatch
(
StudentCertificationExportDTO
request
,
HttpServletResponse
response
);
}
practical-business/src/main/java/com/platform/business/service/StudentCertificationProfileService.java
0 → 100644
View file @
f945d079
package
com.platform.business.service
;
import
com.platform.business.model.dto.StudentCertificationProfileDTO
;
import
com.platform.business.model.vo.StudentCertificationProfileVO
;
/** 学员端认证报名资料查询及保存服务。 */
public
interface
StudentCertificationProfileService
{
/** 查询当前学员资料,未正式提交的数据仅作为预填值返回。 */
StudentCertificationProfileVO
get
(
String
studentId
);
/** 校验并保存当前学员资料;首次提交同时激活学员账户。 */
StudentCertificationProfileVO
save
(
String
studentId
,
StudentCertificationProfileDTO
profile
);
}
practical-business/src/main/java/com/platform/business/service/impl/StudentCertificationAdminServiceImpl.java
0 → 100644
View file @
f945d079
package
com.platform.business.service.impl
;
import
com.platform.business.mapper.StudentCertificationMapper
;
import
com.platform.business.model.dto.StudentCertificationExportDTO
;
import
com.platform.business.model.dto.StudentCertificationQueryDTO
;
import
com.platform.business.model.vo.StudentCertificationListVO
;
import
com.platform.business.model.vo.StudentCertificationProfileVO
;
import
com.platform.business.model.vo.StudentCertificationScopeVO
;
import
com.platform.business.model.vo.StudentCertificationTreeVO
;
import
com.platform.business.service.StudentCertificationAdminService
;
import
com.platform.exception.BusinessException
;
import
org.apache.poi.hwpf.HWPFDocument
;
import
org.apache.poi.hwpf.usermodel.Table
;
import
org.apache.poi.hwpf.usermodel.TableCell
;
import
org.apache.poi.hwpf.usermodel.TableIterator
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.ByteArrayOutputStream
;
import
java.io.InputStream
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
/**
* 管理端学员认证实现。
*
* <p>B2文件始终在原始Word 97-2003模板副本上写入,既保留页面尺寸、合并单元格和
* 打印版式,也避免多个请求共享并修改同一个模板对象。</p>
*/
@Service
public
class
StudentCertificationAdminServiceImpl
implements
StudentCertificationAdminService
{
private
static
final
String
TEMPLATE
=
"templates/certification/B2-student-training-assessment-registration.doc"
;
private
static
final
int
MAX_EXPORT
=
500
;
@Resource
private
StudentCertificationMapper
mapper
;
@Override
public
List
<
StudentCertificationTreeVO
>
tree
(
String
keyword
)
{
List
<
StudentCertificationTreeVO
>
roots
=
new
ArrayList
<>();
Map
<
String
,
StudentCertificationTreeVO
>
occupations
=
new
LinkedHashMap
<>();
Map
<
String
,
StudentCertificationTreeVO
>
levels
=
new
LinkedHashMap
<>();
for
(
StudentCertificationScopeVO
row
:
mapper
.
selectScope
(
trim
(
keyword
)))
{
String
occupationName
=
value
(
row
.
getOccupation
(),
"未分类工种"
);
StudentCertificationTreeVO
occupation
=
occupations
.
get
(
occupationName
);
if
(
occupation
==
null
)
{
occupation
=
node
(
"OCCUPATION"
,
occupationName
,
occupationName
,
null
);
occupations
.
put
(
occupationName
,
occupation
);
roots
.
add
(
occupation
);
}
String
levelName
=
value
(
row
.
getLevelName
(),
"未分类等级"
);
String
levelKey
=
occupationName
+
"|"
+
levelName
;
StudentCertificationTreeVO
level
=
levels
.
get
(
levelKey
);
if
(
level
==
null
)
{
level
=
node
(
"LEVEL"
,
levelName
,
levelName
,
null
);
levels
.
put
(
levelKey
,
level
);
occupation
.
getChildren
().
add
(
level
);
}
StudentCertificationTreeVO
classNode
=
node
(
"CLASS"
,
value
(
row
.
getClassName
(),
"未命名班级"
),
String
.
valueOf
(
row
.
getClassId
()),
row
.
getClassId
());
int
count
=
row
.
getCount
()
==
null
?
0
:
row
.
getCount
();
classNode
.
setCount
(
count
);
level
.
getChildren
().
add
(
classNode
);
level
.
setCount
(
level
.
getCount
()
+
count
);
occupation
.
setCount
(
occupation
.
getCount
()
+
count
);
}
return
roots
;
}
@Override
public
List
<
StudentCertificationListVO
>
page
(
StudentCertificationQueryDTO
query
)
{
return
mapper
.
selectPage
(
query
,
null
);
}
@Override
public
StudentCertificationProfileVO
detail
(
String
studentId
)
{
StudentCertificationProfileVO
value
=
mapper
.
selectProfile
(
studentId
,
false
);
if
(
value
==
null
)
throw
new
BusinessException
(
"学员不存在或报名资料尚未完善"
);
// 管理端详情只读,显式覆盖可编辑标记,避免前端误用学员端状态。
value
.
setEditable
(
false
);
fillPersonTypes
(
value
);
return
value
;
}
@Override
public
void
exportOne
(
String
studentId
,
HttpServletResponse
response
)
{
StudentCertificationProfileVO
profile
=
detail
(
studentId
);
byte
[]
bytes
=
createDocument
(
profile
);
String
fileName
=
safe
(
profile
.
getName
())
+
"_B2学员培训鉴定报名表.doc"
;
writeResponse
(
response
,
"application/msword"
,
fileName
,
bytes
);
}
@Override
public
void
exportBatch
(
StudentCertificationExportDTO
request
,
HttpServletResponse
response
)
{
if
(
request
==
null
)
request
=
new
StudentCertificationExportDTO
();
List
<
String
>
ids
=
request
.
getStudentIds
()
==
null
?
null
:
new
ArrayList
<>(
new
LinkedHashSet
<>(
request
.
getStudentIds
()));
if
(
ids
!=
null
&&
ids
.
size
()
>
MAX_EXPORT
)
throw
new
BusinessException
(
"单次最多导出500名学员"
);
List
<
StudentCertificationListVO
>
rows
=
mapper
.
selectPage
(
request
,
ids
);
if
(
rows
.
size
()
>
MAX_EXPORT
)
throw
new
BusinessException
(
"当前筛选结果超过500人,请缩小筛选范围后重试"
);
if
(
rows
.
isEmpty
())
throw
new
BusinessException
(
"没有可导出的已完善学员资料"
);
try
{
ByteArrayOutputStream
output
=
new
ByteArrayOutputStream
();
ZipOutputStream
zip
=
new
ZipOutputStream
(
output
,
StandardCharsets
.
UTF_8
);
Set
<
String
>
usedNames
=
new
HashSet
<>();
for
(
StudentCertificationListVO
row
:
rows
)
{
StudentCertificationProfileVO
profile
=
detail
(
row
.
getStudentId
());
String
idCard
=
value
(
profile
.
getIdCard
(),
"0000"
);
String
suffix
=
idCard
.
length
()
<=
4
?
idCard
:
idCard
.
substring
(
idCard
.
length
()
-
4
);
String
base
=
safe
(
profile
.
getName
())
+
"_"
+
safe
(
suffix
)
+
"_B2学员培训鉴定报名表"
;
String
entryName
=
base
+
".doc"
;
if
(!
usedNames
.
add
(
entryName
))
{
entryName
=
base
+
"_"
+
safe
(
profile
.
getStudentId
())
+
".doc"
;
usedNames
.
add
(
entryName
);
}
zip
.
putNextEntry
(
new
ZipEntry
(
entryName
));
zip
.
write
(
createDocument
(
profile
));
zip
.
closeEntry
();
}
zip
.
finish
();
zip
.
close
();
String
fileName
=
"B2学员培训鉴定报名表_"
+
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
).
format
(
new
Date
())
+
".zip"
;
writeResponse
(
response
,
"application/zip"
,
fileName
,
output
.
toByteArray
());
}
catch
(
BusinessException
e
)
{
throw
e
;
}
catch
(
Exception
e
)
{
throw
new
BusinessException
(
"批量导出B2报名表失败"
);
}
}
/** 根据已确认的模板行列坐标填值;模板升级时测试会校验行数,防止静默错位。 */
byte
[]
createDocument
(
StudentCertificationProfileVO
p
)
{
try
(
InputStream
input
=
new
ClassPathResource
(
TEMPLATE
).
getInputStream
();
HWPFDocument
document
=
new
HWPFDocument
(
input
);
ByteArrayOutputStream
output
=
new
ByteArrayOutputStream
())
{
TableIterator
iterator
=
new
TableIterator
(
document
.
getRange
());
if
(!
iterator
.
hasNext
())
throw
new
BusinessException
(
"B2模板中未找到报名表表格"
);
Table
table
=
iterator
.
next
();
if
(
table
.
numRows
()
<
33
)
throw
new
BusinessException
(
"B2模板结构已变化,请重新确认字段映射"
);
// HWPF的Range不会在前方插入后自动重算全部旧引用,因此必须严格从后向前填充。
markLevel
(
table
,
21
,
p
.
getAssessmentLevel
());
put
(
table
,
19
,
2
,
p
.
getAssessmentOccupation
());
markBoolean
(
table
,
18
,
p
.
getSubsidyFlag
(),
7
,
8
);
markTrainingCategory
(
table
,
18
,
p
.
getTrainingCategory
());
markLevel
(
table
,
16
,
p
.
getTrainingLevel
());
put
(
table
,
14
,
2
,
p
.
getTrainingOccupation
());
put
(
table
,
12
,
6
,
p
.
getJobYears
());
put
(
table
,
12
,
4
,
p
.
getPreviousIssueDept
());
put
(
table
,
12
,
2
,
p
.
getPreviousIssueDate
());
put
(
table
,
11
,
6
,
p
.
getPreviousCertNo
());
put
(
table
,
11
,
4
,
p
.
getPreviousLevel
());
put
(
table
,
11
,
2
,
p
.
getPreviousOccupation
());
put
(
table
,
10
,
4
,
p
.
getSocialSecurityYears
());
put
(
table
,
10
,
2
,
p
.
getWorkUnitAddress
());
put
(
table
,
9
,
4
,
p
.
getUnitPhone
());
put
(
table
,
9
,
2
,
p
.
getWorkUnit
());
put
(
table
,
8
,
4
,
p
.
getPhoneNumber
());
put
(
table
,
8
,
2
,
p
.
getLaborBookNo
());
put
(
table
,
7
,
4
,
p
.
getZipCode
());
put
(
table
,
7
,
2
,
p
.
getHomeAddress
());
markMany
(
table
,
6
,
p
.
getPersonTypes
(),
new
int
[]{
4
,
5
,
6
,
7
,
8
});
put
(
table
,
5
,
2
,
p
.
getHighestEducation
());
put
(
table
,
4
,
2
,
p
.
getIdCard
());
mark
(
table
,
2
,
p
.
getHouseholdType
(),
"本市城镇"
,
4
,
"本市农村"
,
5
,
"外省市"
,
6
);
mark
(
table
,
1
,
p
.
getGender
(),
"男"
,
6
,
"女"
,
8
);
put
(
table
,
1
,
4
,
p
.
getBirthday
());
put
(
table
,
1
,
2
,
p
.
getName
());
put
(
table
,
0
,
14
,
string
(
p
.
getClassId
()));
put
(
table
,
0
,
1
,
formatDate
(
p
.
getSubmitTime
()));
// 写出前用HWPF内存模型核验关键字段,避免模板变更后生成内容为空。
String
filledText
=
document
.
getText
().
toString
();
if
(!
filledText
.
contains
(
string
(
p
.
getName
()))
||
!
filledText
.
contains
(
string
(
p
.
getIdCard
())))
{
throw
new
BusinessException
(
"B2模板字段填充校验失败"
);
}
document
.
write
(
output
);
return
output
.
toByteArray
();
}
catch
(
BusinessException
e
)
{
throw
e
;
}
catch
(
Exception
e
)
{
throw
new
BusinessException
(
"生成B2报名表失败"
);
}
}
private
void
put
(
Table
table
,
int
row
,
int
cell
,
Object
value
)
{
String
text
=
string
(
value
);
if
(
text
.
isEmpty
())
return
;
TableCell
target
=
table
.
getRow
(
row
).
getCell
(
cell
);
target
.
insertBefore
(
text
);
}
private
void
mark
(
Table
table
,
int
row
,
String
actual
,
String
first
,
int
firstCell
,
String
second
,
int
secondCell
)
{
if
(
first
.
equals
(
actual
))
put
(
table
,
row
,
firstCell
,
"√"
);
else
if
(
second
.
equals
(
actual
))
put
(
table
,
row
,
secondCell
,
"√"
);
}
private
void
mark
(
Table
table
,
int
row
,
String
actual
,
String
a
,
int
ac
,
String
b
,
int
bc
,
String
c
,
int
cc
)
{
if
(
a
.
equals
(
actual
))
put
(
table
,
row
,
ac
,
"√"
);
else
if
(
b
.
equals
(
actual
))
put
(
table
,
row
,
bc
,
"√"
);
else
if
(
c
.
equals
(
actual
))
put
(
table
,
row
,
cc
,
"√"
);
}
private
void
markMany
(
Table
table
,
int
row
,
List
<
String
>
selected
,
int
[]
cells
)
{
if
(
selected
==
null
)
return
;
String
[]
names
=
{
"失业"
,
"协保"
,
"农村富余劳动力"
,
"在职"
,
"其他"
};
for
(
int
i
=
names
.
length
-
1
;
i
>=
0
;
i
--)
if
(
selected
.
contains
(
names
[
i
]))
put
(
table
,
row
,
cells
[
i
],
"√"
);
}
private
void
markLevel
(
Table
table
,
int
row
,
String
level
)
{
String
[]
names
={
"五级"
,
"四级"
,
"三级"
,
"二级"
,
"一级"
,
"专项职业能力"
};
for
(
int
i
=
0
;
i
<
names
.
length
;
i
++)
if
(
names
[
i
].
equals
(
level
))
put
(
table
,
row
,
i
+
2
,
"√"
);
}
private
void
markTrainingCategory
(
Table
table
,
int
row
,
String
category
)
{
String
[]
names
={
"政府补贴培训"
,
"企业培训"
,
"院校培训"
};
for
(
int
i
=
0
;
i
<
names
.
length
;
i
++)
if
(
names
[
i
].
equals
(
category
))
put
(
table
,
row
,
i
+
2
,
"√"
);
}
private
void
markBoolean
(
Table
table
,
int
row
,
Boolean
flag
,
int
yesCell
,
int
noCell
)
{
put
(
table
,
row
,
Boolean
.
TRUE
.
equals
(
flag
)?
yesCell:
noCell
,
"√"
);
}
private
void
fillPersonTypes
(
StudentCertificationProfileVO
p
)
{
if
(
p
.
getPersonTypes
()
!=
null
)
return
;
List
<
String
>
values
=
new
ArrayList
<>();
String
json
=
trim
(
p
.
getPersonTypesJson
());
if
(
json
!=
null
)
{
String
body
=
json
.
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
replace
(
"\""
,
""
);
for
(
String
item
:
body
.
split
(
","
))
if
(
trim
(
item
)
!=
null
)
values
.
add
(
item
.
trim
());
}
if
(
values
.
isEmpty
()
&&
trim
(
p
.
getLegacyPersonType1
())
!=
null
)
values
.
add
(
p
.
getLegacyPersonType1
().
trim
());
if
(
trim
(
p
.
getLegacyPersonType2
())
!=
null
&&
!
values
.
contains
(
p
.
getLegacyPersonType2
().
trim
()))
values
.
add
(
p
.
getLegacyPersonType2
().
trim
());
p
.
setPersonTypes
(
values
);
}
private
StudentCertificationTreeVO
node
(
String
type
,
String
label
,
String
value
,
Integer
classId
)
{
StudentCertificationTreeVO
node
=
new
StudentCertificationTreeVO
();
node
.
setNodeType
(
type
);
node
.
setLabel
(
label
);
node
.
setValue
(
value
);
node
.
setClassId
(
classId
);
return
node
;
}
private
String
formatDate
(
Date
value
)
{
return
value
==
null
?
""
:
new
SimpleDateFormat
(
"yyyy年MM月dd日"
).
format
(
value
);
}
private
String
safe
(
String
value
)
{
String
result
=
value
(
value
,
"未知"
).
replaceAll
(
"[\\\\/:*?\"<>|]"
,
"_"
);
return
result
.
length
()>
80
?
result
.
substring
(
0
,
80
):
result
;
}
private
String
string
(
Object
value
)
{
return
value
==
null
?
""
:
String
.
valueOf
(
value
);
}
private
String
value
(
String
value
,
String
fallback
)
{
return
trim
(
value
)==
null
?
fallback:
value
.
trim
();
}
private
String
trim
(
String
value
)
{
return
value
==
null
||
value
.
trim
().
isEmpty
()?
null
:
value
.
trim
();
}
private
void
writeResponse
(
HttpServletResponse
response
,
String
contentType
,
String
fileName
,
byte
[]
bytes
)
{
try
{
String
encoded
=
URLEncoder
.
encode
(
fileName
,
"UTF-8"
).
replace
(
"+"
,
"%20"
);
response
.
reset
();
response
.
setContentType
(
contentType
);
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename*=UTF-8''"
+
encoded
);
response
.
setContentLength
(
bytes
.
length
);
response
.
getOutputStream
().
write
(
bytes
);
response
.
flushBuffer
();
}
catch
(
Exception
e
)
{
throw
new
BusinessException
(
"写出下载文件失败"
);
}
}
}
practical-business/src/main/java/com/platform/business/service/impl/StudentCertificationProfileServiceImpl.java
0 → 100644
View file @
f945d079
package
com.platform.business.service.impl
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.platform.business.mapper.AccountAdminMapper
;
import
com.platform.business.mapper.StudentCertificationMapper
;
import
com.platform.business.model.dto.StudentCertificationProfileDTO
;
import
com.platform.business.model.entity.SysPhoneRoleEntity
;
import
com.platform.business.model.vo.StudentCertificationProfileVO
;
import
com.platform.business.service.StudentCertificationProfileService
;
import
com.platform.business.service.SysPhoneRoleService
;
import
com.platform.exception.BusinessException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeParseException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.regex.Pattern
;
/**
* 学员认证报名资料业务实现。
*
* <p>校验、公共字段同步、首次提交激活在同一事务中完成,任一步失败都不会留下半份资料。</p>
*/
@Service
public
class
StudentCertificationProfileServiceImpl
implements
StudentCertificationProfileService
{
private
static
final
Pattern
PHONE
=
Pattern
.
compile
(
"^1\\d{10}$"
);
private
static
final
Pattern
ZIP
=
Pattern
.
compile
(
"^\\d{6}$"
);
private
static
final
Set
<
String
>
CERT_LEVELS
=
new
LinkedHashSet
<>();
static
{
CERT_LEVELS
.
add
(
"一级"
);
CERT_LEVELS
.
add
(
"二级"
);
CERT_LEVELS
.
add
(
"三级"
);
CERT_LEVELS
.
add
(
"四级"
);
}
@Resource
private
StudentCertificationMapper
mapper
;
@Resource
private
AccountAdminMapper
accountAdminMapper
;
@Resource
private
SysPhoneRoleService
phoneRoleService
;
@Resource
private
ObjectMapper
objectMapper
;
@Override
public
StudentCertificationProfileVO
get
(
String
studentId
)
{
StudentCertificationProfileVO
result
=
mapper
.
selectProfile
(
studentId
,
true
);
if
(
result
==
null
)
throw
new
BusinessException
(
"当前学员不存在"
);
result
.
setPersonTypes
(
readPersonTypes
(
result
));
result
.
setCompleted
(
Boolean
.
TRUE
.
equals
(
result
.
getCompleted
()));
return
result
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
StudentCertificationProfileVO
save
(
String
studentId
,
StudentCertificationProfileDTO
profile
)
{
if
(
profile
==
null
)
throw
new
BusinessException
(
"报名资料不能为空"
);
StudentCertificationProfileVO
current
=
get
(
studentId
);
if
(!
Boolean
.
TRUE
.
equals
(
current
.
getEditable
()))
throw
new
BusinessException
(
"当前账户已归档,不允许编辑报名资料"
);
normalizeAndValidate
(
profile
);
if
(
accountAdminMapper
.
countPhone
(
profile
.
getPhoneNumber
(),
studentId
)
>
0
)
{
throw
new
BusinessException
(
"联系电话已被其他账户使用"
);
}
String
oldPhone
=
current
.
getPhoneNumber
();
String
personTypesJson
;
try
{
personTypesJson
=
objectMapper
.
writeValueAsString
(
profile
.
getPersonTypes
());
}
catch
(
Exception
e
)
{
throw
new
BusinessException
(
"人员类别保存失败"
);
}
if
(
mapper
.
updateProfile
(
studentId
,
profile
,
personTypesJson
,
new
Date
())
!=
1
)
{
throw
new
BusinessException
(
"报名资料保存失败,请刷新后重试"
);
}
// 手机号是当前项目角色映射的关联键,修改手机号时必须同步迁移角色关系。
if
(!
profile
.
getPhoneNumber
().
equals
(
oldPhone
))
{
phoneRoleService
.
update
(
new
LambdaUpdateWrapper
<
SysPhoneRoleEntity
>()
.
eq
(
SysPhoneRoleEntity:
:
getPhone
,
oldPhone
)
.
set
(
SysPhoneRoleEntity:
:
getPhone
,
profile
.
getPhoneNumber
()));
}
return
get
(
studentId
);
}
/** 统一清理字符串并执行所有跨字段规则,错误提示可直接展示给学员。 */
void
normalizeAndValidate
(
StudentCertificationProfileDTO
p
)
{
p
.
setName
(
required
(
p
.
getName
(),
"姓名"
,
64
));
p
.
setGender
(
required
(
p
.
getGender
(),
"性别"
,
16
));
p
.
setBirthday
(
requiredDate
(
p
.
getBirthday
(),
"出生日期"
));
p
.
setHouseholdType
(
required
(
p
.
getHouseholdType
(),
"户口性质"
,
32
));
p
.
setIdType
(
required
(
p
.
getIdType
(),
"证件类型"
,
32
));
p
.
setIdCard
(
required
(
p
.
getIdCard
(),
"证件号码"
,
64
));
if
(
p
.
getIdCard
().
length
()
<
15
)
throw
new
BusinessException
(
"证件号码长度不能少于15位"
);
p
.
setHighestEducation
(
required
(
p
.
getHighestEducation
(),
"最高学历"
,
32
));
p
.
setAdministrativeDistrict
(
required
(
p
.
getAdministrativeDistrict
(),
"行政区"
,
64
));
p
.
setPhoneNumber
(
required
(
p
.
getPhoneNumber
(),
"联系电话"
,
11
));
if
(!
PHONE
.
matcher
(
p
.
getPhoneNumber
()).
matches
())
throw
new
BusinessException
(
"联系电话必须为11位手机号"
);
p
.
setHomeAddress
(
required
(
p
.
getHomeAddress
(),
"联系地址"
,
255
));
p
.
setZipCode
(
optional
(
p
.
getZipCode
(),
6
,
"邮编"
));
if
(
p
.
getZipCode
()
!=
null
&&
!
ZIP
.
matcher
(
p
.
getZipCode
()).
matches
())
throw
new
BusinessException
(
"邮编必须为6位数字"
);
validateYear
(
p
.
getCurrentWorkYears
(),
"本工种工作年限"
);
validateYear
(
p
.
getSocialSecurityYears
(),
"社保缴费年限"
);
validateYear
(
p
.
getJobYears
(),
"从事本职业或相关职业年限"
);
if
(
p
.
getSocialSecurityYears
()
>
p
.
getCurrentWorkYears
())
throw
new
BusinessException
(
"社保缴费年限不能大于本工种工作年限"
);
p
.
setTrainingOccupation
(
required
(
p
.
getTrainingOccupation
(),
"培训职业(工种)"
,
64
));
p
.
setTrainingLevel
(
required
(
p
.
getTrainingLevel
(),
"培训等级"
,
32
));
p
.
setTrainingCategory
(
required
(
p
.
getTrainingCategory
(),
"培训类别"
,
32
));
if
(
p
.
getSubsidyFlag
()
==
null
)
throw
new
BusinessException
(
"请选择是否申请培训补贴"
);
p
.
setAssessmentOccupation
(
required
(
p
.
getAssessmentOccupation
(),
"鉴定职业(工种)"
,
64
));
p
.
setAssessmentLevel
(
required
(
p
.
getAssessmentLevel
(),
"鉴定等级"
,
32
));
p
.
setPreviousLevelCertNo
(
optional
(
p
.
getPreviousLevelCertNo
(),
100
,
"上一等级证书编号"
));
if
(
CERT_LEVELS
.
contains
(
p
.
getAssessmentLevel
())
&&
p
.
getPreviousLevelCertNo
()
==
null
)
{
throw
new
BusinessException
(
"申报一级至四级必须填写上一等级职业资格证书编号"
);
}
if
(
p
.
getPersonTypes
()
==
null
||
p
.
getPersonTypes
().
isEmpty
())
throw
new
BusinessException
(
"请至少选择一个人员类别"
);
List
<
String
>
unique
=
new
ArrayList
<>();
for
(
String
item
:
new
LinkedHashSet
<>(
p
.
getPersonTypes
()))
unique
.
add
(
required
(
item
,
"人员类别"
,
32
));
p
.
setPersonTypes
(
unique
);
p
.
setPersonTypeOther
(
optional
(
p
.
getPersonTypeOther
(),
100
,
"其他人员类别说明"
));
if
(
unique
.
contains
(
"其他"
)
&&
p
.
getPersonTypeOther
()
==
null
)
throw
new
BusinessException
(
"人员类别选择其他时必须填写说明"
);
p
.
setMajor
(
optional
(
p
.
getMajor
(),
64
,
"专业"
));
p
.
setWorkUnit
(
optional
(
p
.
getWorkUnit
(),
128
,
"工作单位"
));
p
.
setUnitPhone
(
optional
(
p
.
getUnitPhone
(),
32
,
"单位联系电话"
));
p
.
setWorkUnitAddress
(
optional
(
p
.
getWorkUnitAddress
(),
255
,
"单位地址"
));
p
.
setLaborBookNo
(
optional
(
p
.
getLaborBookNo
(),
64
,
"劳动手册编号"
));
p
.
setPreviousOccupation
(
optional
(
p
.
getPreviousOccupation
(),
64
,
"原职业"
));
p
.
setPreviousLevel
(
optional
(
p
.
getPreviousLevel
(),
32
,
"原职业等级"
));
p
.
setPreviousCertNo
(
optional
(
p
.
getPreviousCertNo
(),
100
,
"原职业证书编号"
));
p
.
setPreviousIssueDept
(
optional
(
p
.
getPreviousIssueDept
(),
100
,
"原职业发证部门"
));
p
.
setPreviousIssueDate
(
optionalDate
(
p
.
getPreviousIssueDate
(),
"原职业发证日期"
));
p
.
setGraduationSchool
(
optional
(
p
.
getGraduationSchool
(),
128
,
"毕业院校"
));
p
.
setGraduationDate
(
optionalDate
(
p
.
getGraduationDate
(),
"毕业日期"
));
p
.
setGraduationCertNo
(
optional
(
p
.
getGraduationCertNo
(),
100
,
"毕业证书编号"
));
}
private
List
<
String
>
readPersonTypes
(
StudentCertificationProfileVO
value
)
{
try
{
if
(
value
.
getPersonTypesJson
()
!=
null
&&
!
value
.
getPersonTypesJson
().
trim
().
isEmpty
())
{
return
objectMapper
.
readValue
(
value
.
getPersonTypesJson
(),
new
TypeReference
<
List
<
String
>>()
{
});
}
}
catch
(
Exception
ignored
)
{
/* 损坏的历史JSON退回旧字段,不能阻断学员重新提交。 */
}
List
<
String
>
result
=
new
ArrayList
<>();
if
(
text
(
value
.
getLegacyPersonType1
())
!=
null
)
result
.
add
(
value
.
getLegacyPersonType1
().
trim
());
if
(
text
(
value
.
getLegacyPersonType2
())
!=
null
&&
!
result
.
contains
(
value
.
getLegacyPersonType2
().
trim
()))
result
.
add
(
value
.
getLegacyPersonType2
().
trim
());
return
result
;
}
private
void
validateYear
(
Integer
value
,
String
label
)
{
if
(
value
==
null
)
throw
new
BusinessException
(
label
+
"不能为空"
);
if
(
value
<
0
||
value
>
60
)
throw
new
BusinessException
(
label
+
"必须在0至60之间"
);
}
private
String
required
(
String
value
,
String
label
,
int
max
)
{
String
result
=
optional
(
value
,
max
,
label
);
if
(
result
==
null
)
throw
new
BusinessException
(
label
+
"不能为空"
);
return
result
;
}
private
String
optional
(
String
value
,
int
max
,
String
label
)
{
String
result
=
text
(
value
);
if
(
result
!=
null
&&
result
.
length
()
>
max
)
throw
new
BusinessException
(
label
+
"长度不能超过"
+
max
+
"个字符"
);
return
result
;
}
private
String
requiredDate
(
String
value
,
String
label
)
{
String
result
=
optionalDate
(
value
,
label
);
if
(
result
==
null
)
throw
new
BusinessException
(
label
+
"不能为空"
);
return
result
;
}
private
String
optionalDate
(
String
value
,
String
label
)
{
String
result
=
text
(
value
);
if
(
result
==
null
)
return
null
;
try
{
LocalDate
.
parse
(
result
);
}
catch
(
DateTimeParseException
e
)
{
throw
new
BusinessException
(
label
+
"格式必须为yyyy-MM-dd"
);
}
return
result
;
}
private
String
text
(
String
value
)
{
return
value
==
null
||
value
.
trim
().
isEmpty
()
?
null
:
value
.
trim
();
}
}
practical-business/src/main/resources/com/platform/business/mapper/StudentCertificationMapper.xml
0 → 100644
View file @
f945d079
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.platform.business.mapper.StudentCertificationMapper"
>
<!-- 同一学员可能有历史班级关系;认证管理统一取最新加入的班级。 -->
<sql
id=
"currentClassJoin"
>
left join class_student cs on cs.id = (
select max(cs2.id) from class_student cs2 where cs2.user_id = u.id
)
left join `class` c on c.id = cs.class_id
left join sys_level sl on cast(sl.id as char) = c.level
</sql>
<select
id=
"selectProfile"
resultType=
"com.platform.business.model.vo.StudentCertificationProfileVO"
>
select u.id studentId, u.nick_name name, u.sex gender, u.birthday,
u.household_type householdType, u.id_type idType, u.id_card idCard,
u.highest_education highestEducation, u.major,
u.administrative_district administrativeDistrict,
u.person_types personTypesJson, u.user_type1 legacyPersonType1,
u.user_type2 legacyPersonType2, u.person_type_other personTypeOther,
u.home_address homeAddress, u.zip_code zipCode, u.phone_number phoneNumber,
coalesce(nullif(u.work_unit, ''), u.company_name1) workUnit,
u.unit_phone unitPhone, u.work_unit_address workUnitAddress,
u.labor_book_no laborBookNo, u.current_work_year currentWorkYears,
cast(nullif(u.social_security_year, '') as signed) socialSecurityYears,
u.occupation previousOccupation, u.level previousLevel,
u.cert_no previousCertNo, u.issue_date previousIssueDate,
u.issue_dept1 previousIssueDept, u.previous_level_cert_no previousLevelCertNo,
u.graduation_school graduationSchool, u.graduation_date graduationDate,
u.graduation_cert_no graduationCertNo,
u.training_occupation trainingOccupation, u.training_level trainingLevel,
u.training_category trainingCategory, u.subsidy_flag subsidyFlag,
cast(nullif(u.work_year, '') as signed) jobYears,
u.assessment_occupation assessmentOccupation,
u.assessment_level assessmentLevel,
c.id classId, c.name className, c.occupation classOccupation,
coalesce(sl.name, c.level) classLevelName,
u.account_status accountStatus,
coalesce(u.student_profile_completed, 0) completed,
case when coalesce(u.del_flag, 0) = 0
and upper(coalesce(u.account_status, '')) != 'ARCHIVED'
then 1 else 0 end editable,
u.student_profile_submit_time submitTime
from user u
<include
refid=
"currentClassJoin"
/>
where u.id = #{studentId}
<if
test=
"!includeIncomplete"
>
and coalesce(u.student_profile_completed, 0) = 1
and coalesce(u.del_flag, 0) = 0
</if>
</select>
<update
id=
"updateProfile"
>
update user
set nick_name=#{profile.name}, sex=#{profile.gender}, birthday=#{profile.birthday},
household_type=#{profile.householdType}, id_type=#{profile.idType}, id_card=#{profile.idCard},
highest_education=#{profile.highestEducation}, major=#{profile.major},
administrative_district=#{profile.administrativeDistrict}, person_types=#{personTypesJson},
user_type1=#{profile.personTypes[0]},
user_type2=
<choose><when
test=
"profile.personTypes.size() > 1"
>
#{profile.personTypes[1]}
</when><otherwise>
null
</otherwise></choose>
,
person_type_other=#{profile.personTypeOther}, home_address=#{profile.homeAddress},
zip_code=#{profile.zipCode}, phone_number=#{profile.phoneNumber},
work_unit=#{profile.workUnit}, company_name1=#{profile.workUnit}, unit_phone=#{profile.unitPhone},
work_unit_address=#{profile.workUnitAddress}, labor_book_no=#{profile.laborBookNo},
current_work_year=#{profile.currentWorkYears}, social_security_year=#{profile.socialSecurityYears},
occupation=#{profile.previousOccupation}, level=#{profile.previousLevel}, cert_no=#{profile.previousCertNo},
issue_date=#{profile.previousIssueDate}, issue_dept1=#{profile.previousIssueDept},
previous_level_cert_no=#{profile.previousLevelCertNo}, graduation_school=#{profile.graduationSchool},
graduation_date=#{profile.graduationDate}, graduation_cert_no=#{profile.graduationCertNo},
training_occupation=#{profile.trainingOccupation}, training_level=#{profile.trainingLevel},
training_category=#{profile.trainingCategory}, subsidy_flag=#{profile.subsidyFlag},
work_year=#{profile.jobYears}, assessment_occupation=#{profile.assessmentOccupation},
assessment_level=#{profile.assessmentLevel}, student_profile_completed=1,
student_profile_submit_time=#{submitTime}, update_time=#{submitTime},
first_login_flag=0,
account_status=case when upper(coalesce(account_status, 'PENDING'))='PENDING'
then 'STUDYING' else account_status end
where id=#{studentId} and coalesce(del_flag, 0)=0
</update>
<sql
id=
"completedStudentWhere"
>
where coalesce(u.student_profile_completed, 0)=1 and coalesce(u.del_flag, 0)=0
and exists (select 1 from phone_role pr where pr.phone=u.phone_number
and pr.role_name in ('学生','学员'))
<if
test=
"studentIds != null and studentIds.size() > 0"
>
and u.id in
<foreach
collection=
"studentIds"
item=
"id"
open=
"("
close=
")"
separator=
","
>
#{id}
</foreach>
</if>
<if
test=
"(studentIds == null or studentIds.size() == 0) and query != null"
>
<if
test=
"query.keyword != null and query.keyword != ''"
>
and (u.nick_name like concat('%',#{query.keyword},'%')
or u.id_card like concat('%',#{query.keyword},'%'))
</if>
<if
test=
"query.occupation != null and query.occupation != ''"
>
and c.occupation=#{query.occupation}
</if>
<if
test=
"query.levelName != null and query.levelName != ''"
>
and coalesce(sl.name,c.level)=#{query.levelName}
</if>
<if
test=
"query.classId != null"
>
and c.id=#{query.classId}
</if>
</if>
</sql>
<select
id=
"selectPage"
resultType=
"com.platform.business.model.vo.StudentCertificationListVO"
>
select u.id studentId, u.nick_name name, u.sex gender, u.id_card idCard,
u.assessment_occupation assessmentOccupation, u.assessment_level assessmentLevel,
c.id classId, c.name className, coalesce(nullif(u.work_unit,''),u.company_name1) workUnit,
cast(nullif(u.work_year,'') as signed) jobYears,
cast(nullif(u.social_security_year,'') as signed) socialSecurityYears
from user u
<include
refid=
"currentClassJoin"
/>
<include
refid=
"completedStudentWhere"
/>
order by u.student_profile_submit_time desc, u.id asc
</select>
<select
id=
"selectScope"
resultType=
"com.platform.business.model.vo.StudentCertificationScopeVO"
>
select c.occupation, coalesce(sl.name,c.level) levelName, c.id classId, c.name className,
count(distinct u.id) count
from user u
<include
refid=
"currentClassJoin"
/>
where coalesce(u.student_profile_completed,0)=1 and coalesce(u.del_flag,0)=0
and c.id is not null
and exists (select 1 from phone_role pr where pr.phone=u.phone_number
and pr.role_name in ('学生','学员'))
<if
test=
"keyword != null and keyword != ''"
>
and (c.occupation like concat('%',#{keyword},'%')
or coalesce(sl.name,c.level) like concat('%',#{keyword},'%')
or c.name like concat('%',#{keyword},'%'))
</if>
group by c.occupation, coalesce(sl.name,c.level), c.id, c.name
order by c.occupation, sl.id, c.name, c.id
</select>
</mapper>
practical-business/src/main/resources/com/platform/business/mapper/StudentLevelCertMapper.xml
View file @
f945d079
...
@@ -33,7 +33,9 @@
...
@@ -33,7 +33,9 @@
and student_level_cert.factory = #{factory}
and student_level_cert.factory = #{factory}
</if>
</if>
<if
test=
"name != null and name != ''"
>
<if
test=
"name != null and name != ''"
>
and student_level_cert.user_name like concat('%', #{name}, '%')
and (student_level_cert.user_name like concat('%', #{name}, '%')
or student_level_cert.id_card like concat('%', #{name}, '%')
or student_level_cert.cert_no like concat('%', #{name}, '%'))
</if>
</if>
</where>
</where>
</select>
</select>
...
...
practical-business/src/main/resources/sql/student_certification.sql
0 → 100644
View file @
f945d079
-- 学员基本信息与认证管理增量脚本(MySQL 5.7+/8.0)。
-- 仅操作当前连接的database(),不包含USE语句或固定数据库名,可安全用于各套环境。
-- 所有列和索引均先查询information_schema,脚本可重复执行。
delimiter
$$
drop
procedure
if
exists
migrate_student_certification
$$
create
procedure
migrate_student_certification
()
begin
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'household_type'
)
then
alter
table
user
add
column
household_type
varchar
(
32
)
null
comment
'户口性质'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'administrative_district'
)
then
alter
table
user
add
column
administrative_district
varchar
(
64
)
null
comment
'行政区'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'person_types'
)
then
alter
table
user
add
column
person_types
text
null
comment
'人员类别JSON数组'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'person_type_other'
)
then
alter
table
user
add
column
person_type_other
varchar
(
100
)
null
comment
'其他人员类别说明'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'unit_phone'
)
then
alter
table
user
add
column
unit_phone
varchar
(
32
)
null
comment
'单位联系电话'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'labor_book_no'
)
then
alter
table
user
add
column
labor_book_no
varchar
(
64
)
null
comment
'劳动手册编号'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'current_work_year'
)
then
alter
table
user
add
column
current_work_year
int
null
comment
'本工种工作年限'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'previous_level_cert_no'
)
then
alter
table
user
add
column
previous_level_cert_no
varchar
(
100
)
null
comment
'上一等级职业资格证书编号'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'graduation_school'
)
then
alter
table
user
add
column
graduation_school
varchar
(
128
)
null
comment
'毕业院校'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'graduation_date'
)
then
alter
table
user
add
column
graduation_date
varchar
(
10
)
null
comment
'毕业日期yyyy-MM-dd'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'graduation_cert_no'
)
then
alter
table
user
add
column
graduation_cert_no
varchar
(
100
)
null
comment
'毕业证书编号'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'training_occupation'
)
then
alter
table
user
add
column
training_occupation
varchar
(
64
)
null
comment
'培训职业工种'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'training_level'
)
then
alter
table
user
add
column
training_level
varchar
(
32
)
null
comment
'培训等级'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'training_category'
)
then
alter
table
user
add
column
training_category
varchar
(
32
)
null
comment
'培训类别单选值'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'subsidy_flag'
)
then
alter
table
user
add
column
subsidy_flag
tinyint
(
1
)
null
comment
'是否申请培训补贴'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'assessment_occupation'
)
then
alter
table
user
add
column
assessment_occupation
varchar
(
64
)
null
comment
'鉴定职业工种'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'assessment_level'
)
then
alter
table
user
add
column
assessment_level
varchar
(
32
)
null
comment
'鉴定等级'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'student_profile_completed'
)
then
-- 默认0且不回填历史数据,旧学员必须完成一次正式提交后才进入认证管理列表。
alter
table
user
add
column
student_profile_completed
tinyint
(
1
)
not
null
default
0
comment
'认证报名资料是否已完善'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
columns
where
table_schema
=
database
()
and
table_name
=
'user'
and
column_name
=
'student_profile_submit_time'
)
then
alter
table
user
add
column
student_profile_submit_time
datetime
null
comment
'认证报名资料最近提交时间'
;
end
if
;
if
not
exists
(
select
1
from
information_schema
.
statistics
where
table_schema
=
database
()
and
table_name
=
'user'
and
index_name
=
'idx_user_profile_completed'
)
then
alter
table
user
add
index
idx_user_profile_completed
(
student_profile_completed
,
del_flag
,
student_profile_submit_time
);
end
if
;
end
$$
call
migrate_student_certification
()
$$
drop
procedure
if
exists
migrate_student_certification
$$
delimiter
;
practical-business/src/main/resources/student-certification-api.md
0 → 100644
View file @
f945d079
# 学员基本信息与认证管理接口文档
## 1. 通用约定
-
基础路径由部署环境决定,以下均为相对路径。
-
请求头:
`Authorization: Bearer <JWT>`
,兼容不带
`Bearer `
前缀的项目历史调用方式。
-
学员接口只使用 JWT 中的当前用户,不接收
`userId`
;管理端接口要求“管理员”角色。
-
普通 JSON 成功响应为
`Result<T>`
;分页响应为项目统一
`TableDataInfo`
,核心字段为
`code`
、
`msg`
、
`total`
、
`rows`
。
-
日期格式为
`yyyy-MM-dd`
,日期时间格式为
`yyyy-MM-dd HH:mm:ss`
。
## 2. 学员端资料
### 2.1 查询资料
`GET /student/certification-profile`
返回账号旧字段预填值、最新班级以及报名资料。
`completed=false`
表示尚未正式提交;
`editable=false`
表示账户已归档。
```
json
{
"code"
:
200
,
"data"
:
{
"studentId"
:
"190001"
,
"name"
:
"张三"
,
"gender"
:
"男"
,
"birthday"
:
"1995-06-01"
,
"householdType"
:
"本市城镇"
,
"idType"
:
"身份证"
,
"idCard"
:
"310101199506011234"
,
"highestEducation"
:
"大专"
,
"administrativeDistrict"
:
"浦东新区"
,
"personTypes"
:
[
"在职"
],
"homeAddress"
:
"上海市浦东新区示例路1号"
,
"zipCode"
:
"200120"
,
"phoneNumber"
:
"13800138000"
,
"workUnit"
:
"示例水务公司"
,
"currentWorkYears"
:
5
,
"socialSecurityYears"
:
5
,
"trainingOccupation"
:
"污水处理工"
,
"trainingLevel"
:
"五级"
,
"trainingCategory"
:
"企业培训"
,
"subsidyFlag"
:
true
,
"jobYears"
:
5
,
"assessmentOccupation"
:
"污水处理工"
,
"assessmentLevel"
:
"五级"
,
"classId"
:
12
,
"className"
:
"2026污水五级一班"
,
"classOccupation"
:
"污水"
,
"classLevelName"
:
"五级"
,
"accountStatus"
:
"PENDING"
,
"completed"
:
false
,
"editable"
:
true
,
"submitTime"
:
null
}
}
```
### 2.2 保存资料
`PUT /student/certification-profile`
请求体不传
`studentId`
、班级信息、状态和提交时间。完整示例:
```
json
{
"name"
:
"张三"
,
"gender"
:
"男"
,
"birthday"
:
"1995-06-01"
,
"householdType"
:
"本市城镇"
,
"idType"
:
"身份证"
,
"idCard"
:
"310101199506011234"
,
"highestEducation"
:
"大专"
,
"major"
:
"环境工程"
,
"administrativeDistrict"
:
"浦东新区"
,
"personTypes"
:
[
"在职"
],
"personTypeOther"
:
null
,
"homeAddress"
:
"上海市浦东新区示例路1号"
,
"zipCode"
:
"200120"
,
"phoneNumber"
:
"13800138000"
,
"workUnit"
:
"示例水务公司"
,
"unitPhone"
:
"021-12345678"
,
"workUnitAddress"
:
"上海市示例路2号"
,
"laborBookNo"
:
"LD-001"
,
"currentWorkYears"
:
5
,
"socialSecurityYears"
:
5
,
"previousOccupation"
:
"污水处理工"
,
"previousLevel"
:
"五级"
,
"previousCertNo"
:
"CERT-001"
,
"previousIssueDate"
:
"2024-01-01"
,
"previousIssueDept"
:
"上海市职业技能鉴定中心"
,
"previousLevelCertNo"
:
null
,
"graduationSchool"
:
"示例职业学院"
,
"graduationDate"
:
"2016-06-30"
,
"graduationCertNo"
:
"GRAD-001"
,
"trainingOccupation"
:
"污水处理工"
,
"trainingLevel"
:
"五级"
,
"trainingCategory"
:
"企业培训"
,
"subsidyFlag"
:
true
,
"jobYears"
:
5
,
"assessmentOccupation"
:
"污水处理工"
,
"assessmentLevel"
:
"五级"
}
```
成功响应与查询接口的数据结构相同。首次成功提交会把
`PENDING`
更新为
`STUDYING`
并清除首次登录标记;后续编辑不会改变
`STUDYING`
、
`GRADUATED`
等已有状态。
字段规则:姓名、性别、出生日期、户口性质、证件类型/号码、最高学历、行政区、人员类别、地址、手机号、三个年限、培训工种/等级/类别、补贴标记、鉴定工种/等级必填。手机号为
`1`
开头的 11 位数字,邮编为空或 6 位数字,证件号码至少 15 位,年限均为 0~60,社保年限不得大于本工种工作年限。人员类别可多选,选择“其他”时
`personTypeOther`
必填。培训类别只传一个字符串。申报一级至四级时
`previousLevelCertNo`
必填。
常见业务错误会通过项目统一异常响应返回明确中文提示,例如“联系电话已被其他账户使用”“申报一级至四级必须填写上一等级职业资格证书编号”。
## 3. 管理端认证管理
### 3.1 范围树
`GET /certification/admin/tree?keyword=污水`
返回
`OCCUPATION → LEVEL → CLASS`
三级节点。
`count`
为节点下资料已完善且未删除的有效学员人数,关键字匹配工种、等级和班级名称。
```
json
{
"code"
:
200
,
"data"
:[{
"nodeType"
:
"OCCUPATION"
,
"label"
:
"污水"
,
"value"
:
"污水"
,
"count"
:
30
,
"classId"
:
null
,
"children"
:[{
"nodeType"
:
"LEVEL"
,
"label"
:
"五级"
,
"value"
:
"五级"
,
"count"
:
30
,
"classId"
:
null
,
"children"
:[{
"nodeType"
:
"CLASS"
,
"label"
:
"2026污水五级一班"
,
"value"
:
"12"
,
"count"
:
30
,
"classId"
:
12
,
"children"
:[]}]}]}]}
```
### 3.2 分页列表
`POST /certification/admin/page`
```
json
{
"pageNum"
:
1
,
"pageSize"
:
20
,
"keyword"
:
"张"
,
"occupation"
:
"污水"
,
"levelName"
:
"五级"
,
"classId"
:
12
}
```
`keyword`
同时模糊匹配姓名和证件号码。
`rows`
包含
`studentId`
、
`name`
、
`gender`
、
`idCard`
、
`assessmentOccupation`
、
`assessmentLevel`
、
`classId`
、
`className`
、
`workUnit`
、
`jobYears`
、
`socialSecurityYears`
。仅返回已完善资料。
```
json
{
"code"
:
200
,
"msg"
:
"查询成功"
,
"total"
:
1
,
"rows"
:[{
"studentId"
:
"190001"
,
"name"
:
"张三"
,
"gender"
:
"男"
,
"idCard"
:
"310101199506011234"
,
"assessmentOccupation"
:
"污水处理工"
,
"assessmentLevel"
:
"五级"
,
"classId"
:
12
,
"className"
:
"2026污水五级一班"
,
"workUnit"
:
"示例水务公司"
,
"jobYears"
:
5
,
"socialSecurityYears"
:
5
}]}
```
### 3.3 详情
`GET /certification/admin/{studentId}`
响应字段与学员端查询一致,但固定
`editable=false`
;本接口不提供修改能力。未完善、已删除或不存在时返回“学员不存在或报名资料尚未完善”。
### 3.4 单人导出
`GET /certification/admin/{studentId}/export`
-
`Content-Type: application/msword`
-
`Content-Disposition: attachment; filename*=UTF-8''...`
-
文件名:
`{姓名}_B2学员培训鉴定报名表.doc`
### 3.5 批量导出
`POST /certification/admin/export`
勾选导出:
```
json
{
"studentIds"
:[
"190001"
,
"190002"
]}
```
筛选结果导出:
```
json
{
"keyword"
:
"张"
,
"occupation"
:
"污水"
,
"levelName"
:
"五级"
,
"classId"
:
12
}
```
`studentIds`
非空时优先按 ID 导出,否则使用筛选条件。最多 500 人,响应为
`application/zip`
,ZIP 名称为
`B2学员培训鉴定报名表_yyyyMMddHHmmss.zip`
;内部文件名为
`{姓名}_{证件后四位}_B2学员培训鉴定报名表.doc`
,重名时追加学员 ID。文件名中的 Windows 非法字符会替换为下划线。
## 4. 推荐联调顺序
1.
学员登录后调用查询接口显示账号和班级预填值。
2.
提交一份完整资料,确认
`completed=true`
,首次账户状态变为
`STUDYING`
。
3.
管理员调用范围树,再按树节点调用分页接口。
4.
通过列表
`studentId`
查询只读详情。
5.
分别验证单人
`.doc`
和勾选/筛选批量 ZIP 下载。
6.
修改已完善或已结业学员资料,确认账户状态不被重置。
practical-business/src/main/resources/templates/certification/B2-student-training-assessment-registration.doc
0 → 100644
View file @
f945d079
File added
Prev
1
2
Next
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