Commit 654a48d6 by chenjinjing

no message

parent d920324d
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<dbServer>http://127.0.0.1:13276</dbServer> <dbServer>http://127.0.0.1:13276</dbServer>
<mysqldb> <mysqldb>
<!-- 本地mysql配置 --> <!-- 本地mysql配置 -->
<mysqlHost>localhost</mysqlHost> <mysqlHost>127.0.0.1</mysqlHost>
<mysqlPort>3306</mysqlPort> <mysqlPort>3306</mysqlPort>
<mysqlUser>root</mysqlUser> <mysqlUser>root</mysqlUser>
<mysqlPwd>123456</mysqlPwd> <mysqlPwd>123456</mysqlPwd>
......
...@@ -20,7 +20,7 @@ async function lanuch() { ...@@ -20,7 +20,7 @@ async function lanuch() {
console.log('This indicates that the server is started successfully.'); console.log('This indicates that the server is started successfully.');
backup(); // backup();
// 应用启动时初始化UAC集成 // 应用启动时初始化UAC集成
const xmlRpcServer = await initUACIntegration(); const xmlRpcServer = await initUACIntegration();
...@@ -29,6 +29,7 @@ async function lanuch() { ...@@ -29,6 +29,7 @@ async function lanuch() {
} else { } else {
console.error('🔴 XML-RPC服务器启动失败'); console.error('🔴 XML-RPC服务器启动失败');
} }
} }
lanuch(); lanuch();
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
*/ */
import * as questionRouter from './question'; import * as questionRouter from './question';
import * as throwMethodRouter from './throwMethod';
export function setRouter(httpServer){ export function setRouter(httpServer){
questionRouter.setRouter(httpServer); questionRouter.setRouter(httpServer);
throwMethodRouter.setRouter(httpServer);
} }
/**
* 公智能评价答题 - 能力同比分析路由
*/
import asyncHandler from 'express-async-handler';
import * as throwMethodBiz from '../biz/throwMethod';
import { checkUser } from '../middleware/user';
export function setRouter(httpServer) {
/**学生能力同比分析接口 */
// 获取学生九大能力得分及同比数据(完整版)
httpServer.post('/gzn/throwmethod/abilitycomparison', asyncHandler(getStudentAbilityComparison));
// 获取学生九大能力得分及同比数据(简化版,用于图表)
httpServer.post('/gzn/throwmethod/abilitycomparisonsimple', asyncHandler(getStudentAbilityComparisonSimple));
// 批量获取多个学生的能力同比数据
httpServer.post('/gzn/throwmethod/batchabilitycomparison', asyncHandler(getBatchStudentAbilityComparison));
}
/**
* 获取学生九大能力得分及同比数据(完整版)
* @param req - 请求对象
* @param res - 响应对象
*
* 请求参数:
* - student_id?: string - 学生ID(可选,不传则使用当前登录用户)
*/
async function getStudentAbilityComparison(req, res) {
const UserInfo = req.userInfo;
let { student_id } = req.body;
// 如果没有传student_id,使用当前登录用户的ID
const targetStudentId = student_id || UserInfo.studentId;
let result = await throwMethodBiz.getStudentAbilityScoresWithComparison(targetStudentId);
res.success(result);
}
/**
* 获取学生九大能力得分及同比数据(简化版,仅返回数值数组,用于图表展示)
* @param req - 请求对象
* @param res - 响应对象
*
* 请求参数:
* - student_id?: string - 学生ID(可选,不传则使用当前登录用户)
*/
async function getStudentAbilityComparisonSimple(req, res) {
const UserInfo = req.userInfo;
let { student_id } = req.body;
// 如果没有传student_id,使用当前登录用户的ID
const targetStudentId = student_id || UserInfo.studentId;
let result = await throwMethodBiz.getStudentAbilityScoresSimple(targetStudentId);
res.success(result);
}
/**
* 批量获取多个学生的九大能力得分及同比数据
* @param req - 请求对象
* @param res - 响应对象
*
* 请求参数:
* - student_ids: string[] - 学生ID数组(必填)
*/
async function getBatchStudentAbilityComparison(req, res) {
const UserInfo = req.userInfo;
let { student_ids } = req.body;
if (!student_ids || !Array.isArray(student_ids) || student_ids.length === 0) {
throw new Error('学生ID列表不能为空');
}
const results = [];
for (const student_id of student_ids) {
try {
const result = await throwMethodBiz.getStudentAbilityScoresWithComparison(student_id);
results.push(result);
} catch (error) {
results.push({
student_id,
hasData: false,
message: error.message || '获取数据失败'
});
}
}
res.success({
total: results.length,
list: results
});
}
...@@ -6,7 +6,11 @@ ...@@ -6,7 +6,11 @@
"rootDir":"./src", "rootDir":"./src",
"outDir":"./out", "outDir":"./out",
"esModuleInterop": true, "esModuleInterop": true,
// "strict": true, "allowSyntheticDefaultImports": true,
"strict": false,
"noImplicitAny": false,
"strictNullChecks": false,
"types": ["node"]
}, },
"exclude": [ "exclude": [
"node_modules", "node_modules",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment