Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nanMoMentorPlatform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
node_server
nanMoMentorPlatform
Commits
342136f0
Commit
342136f0
authored
Jul 02, 2026
by
PC-20251223ZVQQ\Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
九维能力打分
parent
5d2323dc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
95 additions
and
11 deletions
+95
-11
AIGrowthMessage.ts
src/biz/teacher/AIGrowthMessage.ts
+4
-1
growthMessage.ts
src/biz/teacher/growthMessage.ts
+47
-2
dbEnum.ts
src/config/dbEnum.ts
+2
-0
enum.ts
src/config/enum.ts
+15
-0
mysqlTableConfig.ts
src/config/mysqlTableConfig.ts
+17
-0
teacher.ts
src/routers/teacher.ts
+10
-8
No files found.
src/biz/teacher/AIGrowthMessage.ts
View file @
342136f0
...
...
@@ -66,6 +66,7 @@ async function getAuthToken(): Promise<string> {
* @param classRole 班级职务(可选)
* @param growthPoints 成长亮点数组
* @param writingStyle 评语文风(可选)
* @param nineDimensionalScore 九维评分(可选)
* @param copilotId 智能体ID(可选)
* @param promptTemplateName 提示词模板名称(可选)
* @returns 生成的评语文本
...
...
@@ -78,6 +79,7 @@ export async function generateGrowthMessagePreview(
classRole
?:
string
,
growthPoints
?:
string
[],
writingStyle
?:
string
,
nineDimensionalScore
?:
Map
<
String
,
Number
>
,
copilotId
:
string
=
DEFAULT_COPILOT_ID
,
promptTemplateName
:
string
=
DEFAULT_PROMPT_NAME
):
Promise
<
string
>
{
...
...
@@ -96,7 +98,8 @@ export async function generateGrowthMessagePreview(
rank_change
:
rankChange
||
'上升10名'
,
class_role
:
classRole
||
'无职务'
,
growth_points
:
growthPoints
||
[],
writing_style
:
writingStyle
||
'温暖鼓励型'
writing_style
:
writingStyle
||
'温暖鼓励型'
,
nine_dimensional_score
:
nineDimensionalScore
||
{}
};
// 3. 构造 GraphQL 请求(以下代码不变)
...
...
src/biz/teacher/growthMessage.ts
View file @
342136f0
...
...
@@ -8,6 +8,7 @@ import { TABLENAME, TABLEID } from "../../config/dbEnum";
import
{
getCurrentSemester
}
from
"../common/semesterService"
;
import
{
BizError
}
from
"../../util/bizError"
;
import
{
ERRORENUM
}
from
"../../config/errorEnum"
;
import
{
ABILITYDIMENSION
}
from
"../../config/enum"
;
import
{
randomId
}
from
"../../tools/systemTools"
;
import
{
getMySqlMs
}
from
"../../tools/systemTools"
;
import
*
as
notificationBiz
from
"../headteacher/notification"
;
...
...
@@ -63,6 +64,8 @@ export async function addGrowthMessage(data: any) {
if
(
!
match
.
data
)
{
throw
new
BizError
(
ERRORENUM
.
权限不足
,
'您与该学生在所选学期无师生关系'
);
}
let
nineDimensionalScore
:
any
=
data
.
nineDimensionalScore
||
{};
/**创建成长寄语 */
await
addData
(
TABLENAME
.
成长寄语表
,
{
...
...
@@ -73,6 +76,9 @@ export async function addGrowthMessage(data: any) {
content
:
data
.
content
,
created_at
:
getMySqlMs
()
});
/**保存九维能力评分 */
await
saveAbilityAssessment
(
data
.
teacher_id
,
data
.
student_id
,
nineDimensionalScore
);
/**生成消息通知 */
try
{
...
...
@@ -353,10 +359,10 @@ export async function getGrowthStudent(
// 5. 获取最近成绩(语数英物化生...)、总分、班级排名
let
xuenian
=
semesterNameToXuenian
(
semester
?
semester
.
name
:
''
);
let
latestScore
=
await
getStudentLatestScore
(
student
No
,
xuenian
);
let
latestScore
=
await
getStudentLatestScore
(
student
Id
,
xuenian
);
// 6. 获取获奖情况列表(获奖内容、获奖时间)
let
awards
=
await
getStudentAwards
(
student
No
);
let
awards
=
await
getStudentAwards
(
student
Id
);
return
{
student_info
:
{
...
...
@@ -375,6 +381,45 @@ export async function getGrowthStudent(
};
}
/**
* 保存九维能力评分到 ability_assessment 表
* 固定插入9条记录,缺失的维度分值默认置0
* @param teacherId 导师ID
* @param studentId 学生ID
* @param nineDimensionalScore 前端传入的九维打分数据,key=维度编码,value=分值
*/
async
function
saveAbilityAssessment
(
teacherId
:
string
,
studentId
:
string
,
nineDimensionalScore
:
any
)
{
const
now
=
getMySqlMs
();
// 批次号: YYYYMMDDHHmmssT导师IDS学生ID
const
timeStr
=
now
.
replace
(
/-/g
,
''
).
replace
(
/:/g
,
''
).
replace
(
/
\s
/g
,
''
);
const
assessmentId
=
`
${
timeStr
}
T
${
teacherId
}
S
${
studentId
}
`
;
// 固定9个维度,缺失或非法则默认0
const
dimensionCodes
=
Object
.
values
(
ABILITYDIMENSION
);
const
records
=
dimensionCodes
.
map
(
dimensionCode
=>
({
assessment_id
:
assessmentId
,
teacher_id
:
teacherId
,
student_id
:
studentId
,
dimension_code
:
dimensionCode
,
score
:
toValidScore
(
nineDimensionalScore
&&
nineDimensionalScore
[
dimensionCode
]),
assess_time
:
now
,
created_at
:
now
,
updated_at
:
now
}));
await
addData
(
TABLENAME
.
九维能力打分表
,
records
);
}
/** 将任意值转成合法的 DECIMAL(4,1) 分值,非法值返回 0 */
function
toValidScore
(
value
:
any
):
number
{
const
num
=
Number
(
value
);
return
(
isNaN
(
num
)
||
num
<
0
)
?
0
:
Number
(
num
.
toFixed
(
1
));
}
...
...
src/config/dbEnum.ts
View file @
342136f0
...
...
@@ -25,6 +25,7 @@ export enum TABLENAME {
交流记录子类型表
=
'communication_subtype'
,
交流提醒记录表
=
'communication_reminder'
,
成长寄语表
=
'growth_message'
,
九维能力打分表
=
'ability_assessment'
,
导师见面会表
=
'meeting'
,
见面会学生表
=
'meeting_students'
,
导师案例表
=
'teacher_case'
,
...
...
@@ -55,6 +56,7 @@ export enum TABLEID {
交流记录子类型表
=
'CMS'
,
交流提醒记录表
=
'CR'
,
成长寄语表
=
'GM'
,
九维能力打分表
=
'AA'
,
导师见面会表
=
'MT'
,
导师案例表
=
'CS'
,
预约表
=
'AP'
,
...
...
src/config/enum.ts
View file @
342136f0
...
...
@@ -162,4 +162,19 @@ export enum POLITICALSTATUS {
无党派人士
=
'无党派人士'
,
};
/**
* 九大能力维度编码(固定9项)
*/
export
enum
ABILITYDIMENSION
{
家国情怀
=
'jgqh'
,
国际视野
=
'gjsy'
,
劳动意识
=
'ldys'
,
审美健康
=
'smjk'
,
健康生活
=
'jksh'
,
善于学习
=
'syxx'
,
勇于创新
=
'yycx'
,
学业扎实
=
'xysz'
,
责任担当
=
'zrdd'
,
};
src/config/mysqlTableConfig.ts
View file @
342136f0
...
...
@@ -243,6 +243,23 @@ export const TablesConfig = [
},
association
:
[]
},
// 九维能力打分表
{
tableNameCn
:
'九维能力打分表'
,
tableName
:
'ability_assessment'
,
schema
:
{
id
:
{
type
:
DataTypes
.
INTEGER
,
allowNull
:
false
,
primaryKey
:
true
,
autoIncrement
:
true
,
comment
:
'自增主键'
},
assessment_id
:
{
type
:
DataTypes
.
STRING
(
50
),
allowNull
:
false
,
comment
:
'批次号: 年月日时分秒导师ID学生ID,例如20221201103000T001S001'
},
teacher_id
:
{
type
:
DataTypes
.
STRING
(
20
),
allowNull
:
false
,
comment
:
'评分导师user_id,关联uac_user.user_id'
},
student_id
:
{
type
:
DataTypes
.
STRING
(
20
),
allowNull
:
false
,
comment
:
'学生user_id,关联uac_user.user_id'
},
dimension_code
:
{
type
:
DataTypes
.
STRING
(
32
),
allowNull
:
false
,
comment
:
'能力维度编码: jgqh-家国情怀,gjsy-国际视野,ldys-劳动意识'
},
score
:
{
type
:
DataTypes
.
DECIMAL
(
4
,
1
),
allowNull
:
false
,
comment
:
'分值'
},
assess_time
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
false
,
comment
:
'评分时间'
},
created_at
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
false
,
defaultValue
:
DataTypes
.
NOW
},
updated_at
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
false
,
defaultValue
:
DataTypes
.
NOW
}
},
association
:
[]
},
// 成长寄语表
{
tableNameCn
:
'成长寄语表'
,
...
...
src/routers/teacher.ts
View file @
342136f0
...
...
@@ -450,16 +450,17 @@ async function getStudentOptions(req, res) {
async
function
addGrowthMessage
(
req
,
res
)
{
const
userInfo
=
req
.
userInfo
;
let
reqConf
=
{
student_id
:
'String'
,
date
:
'String'
,
content
:
'String'
,
semester_id
:
'Number'
};
const
NotMustHaveKeys
=
[
'semester_id'
];
let
{
student_id
,
date
,
content
,
semester_id
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
reqConf
=
{
student_id
:
'String'
,
date
:
'String'
,
content
:
'String'
,
semester_id
:
'Number'
,
nineDimensionalScore
:
'Map<String, Number>'
};
const
NotMustHaveKeys
=
[
'semester_id'
,
'nineDimensionalScore'
];
let
{
student_id
,
date
,
content
,
semester_id
,
nineDimensionalScore
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
msgData
=
{
student_id
,
date
,
content
,
teacher_id
:
userInfo
.
userId
,
semester_id
:
semester_id
||
null
// 可选参数,不传则为null
semester_id
:
semester_id
||
null
,
// 可选参数,不传则为null
nine_dimensional_score
:
nineDimensionalScore
||
{}
// 可选参数,不传则为{}
};
let
result
=
await
growthMessageBiz
.
addGrowthMessage
(
msgData
);
...
...
@@ -545,11 +546,11 @@ async function aiPreviewGrowthMessage(req, res) {
let
reqConf
=
{
student_id
:
'String'
,
personalityTags
:
'[String]'
,
academicLevel
:
'String'
,
rankChange
:
'String'
,
classRole
:
'String'
,
growthPoints
:
'[String]'
,
writingStyle
:
'String'
,
copilotId
:
'String'
,
promptTemplateName
:
'String'
};
growthPoints
:
'[String]'
,
writingStyle
:
'String'
,
copilotId
:
'String'
,
promptTemplateName
:
'String'
,
nineDimensionalScore
:
'Map<String, Number>'
};
const
NotMustHaveKeys
=
[
'personalityTags'
,
'academicLevel'
,
'rankChange'
,
'classRole'
,
'growthPoints'
,
'writingStyle'
,
'copilotId'
,
'promptTemplateName'
];
const
NotMustHaveKeys
=
[
'personalityTags'
,
'academicLevel'
,
'rankChange'
,
'classRole'
,
'growthPoints'
,
'writingStyle'
,
'copilotId'
,
'promptTemplateName'
,
'nineDimensionalScore'
];
let
{
student_id
,
personalityTags
,
academicLevel
,
rankChange
,
classRole
,
growthPoints
,
writingStyle
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
{
student_id
,
personalityTags
,
academicLevel
,
rankChange
,
classRole
,
growthPoints
,
writingStyle
,
nineDimensionalScore
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
const
content
=
await
AIGrowthMessageBiz
.
generateGrowthMessagePreview
(
student_id
,
...
...
@@ -558,7 +559,8 @@ async function aiPreviewGrowthMessage(req, res) {
rankChange
,
classRole
,
growthPoints
,
writingStyle
writingStyle
,
nineDimensionalScore
);
res
.
success
({
content
});
...
...
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