|
@@ -0,0 +1,412 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="zh-CN">
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>工伤接口Debug信息保留测试</title>
|
|
|
+ <style>
|
|
|
+ body {
|
|
|
+ font-family: Arial, sans-serif;
|
|
|
+ margin: 20px;
|
|
|
+ background-color: #f5f5f5;
|
|
|
+ }
|
|
|
+ .container {
|
|
|
+ max-width: 1200px;
|
|
|
+ margin: 0 auto;
|
|
|
+ background-color: white;
|
|
|
+ padding: 20px;
|
|
|
+ border-radius: 8px;
|
|
|
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
|
+ }
|
|
|
+ h1 {
|
|
|
+ color: #333;
|
|
|
+ text-align: center;
|
|
|
+ margin-bottom: 30px;
|
|
|
+ }
|
|
|
+ .test-section {
|
|
|
+ margin-bottom: 30px;
|
|
|
+ padding: 20px;
|
|
|
+ border: 1px solid #ddd;
|
|
|
+ border-radius: 5px;
|
|
|
+ background-color: #fafafa;
|
|
|
+ }
|
|
|
+ .test-section h3 {
|
|
|
+ color: #555;
|
|
|
+ margin-top: 0;
|
|
|
+ }
|
|
|
+ button {
|
|
|
+ background-color: #007bff;
|
|
|
+ color: white;
|
|
|
+ border: none;
|
|
|
+ padding: 10px 20px;
|
|
|
+ border-radius: 5px;
|
|
|
+ cursor: pointer;
|
|
|
+ margin: 5px;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ button:hover {
|
|
|
+ background-color: #0056b3;
|
|
|
+ }
|
|
|
+ button:disabled {
|
|
|
+ background-color: #6c757d;
|
|
|
+ cursor: not-allowed;
|
|
|
+ }
|
|
|
+ .result {
|
|
|
+ margin-top: 15px;
|
|
|
+ padding: 15px;
|
|
|
+ border-radius: 5px;
|
|
|
+ white-space: pre-wrap;
|
|
|
+ font-family: 'Courier New', monospace;
|
|
|
+ font-size: 12px;
|
|
|
+ max-height: 400px;
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+ .success {
|
|
|
+ background-color: #d4edda;
|
|
|
+ border: 1px solid #c3e6cb;
|
|
|
+ color: #155724;
|
|
|
+ }
|
|
|
+ .error {
|
|
|
+ background-color: #f8d7da;
|
|
|
+ border: 1px solid #f5c6cb;
|
|
|
+ color: #721c24;
|
|
|
+ }
|
|
|
+ .info {
|
|
|
+ background-color: #d1ecf1;
|
|
|
+ border: 1px solid #bee5eb;
|
|
|
+ color: #0c5460;
|
|
|
+ }
|
|
|
+ .debug-info {
|
|
|
+ background-color: #fff3cd;
|
|
|
+ border: 1px solid #ffeaa7;
|
|
|
+ color: #856404;
|
|
|
+ margin-top: 10px;
|
|
|
+ padding: 10px;
|
|
|
+ border-radius: 3px;
|
|
|
+ }
|
|
|
+ .status {
|
|
|
+ display: inline-block;
|
|
|
+ padding: 3px 8px;
|
|
|
+ border-radius: 3px;
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .status.success {
|
|
|
+ background-color: #28a745;
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+ .status.error {
|
|
|
+ background-color: #dc3545;
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+ .status.info {
|
|
|
+ background-color: #17a2b8;
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <div class="container">
|
|
|
+ <h1>工伤接口Debug信息保留测试</h1>
|
|
|
+
|
|
|
+ <div class="test-section">
|
|
|
+ <h3>测试说明</h3>
|
|
|
+ <p>此页面用于测试工伤接口的debug信息是否正确保留。主要检查以下字段是否在返回结果中存在:</p>
|
|
|
+ <ul>
|
|
|
+ <li><strong>debug_entry_time</strong>: 方法入口时间</li>
|
|
|
+ <li><strong>debug_method_entered</strong>: 方法是否已进入</li>
|
|
|
+ <li><strong>debug_stage</strong>: 当前执行阶段</li>
|
|
|
+ <li><strong>debug_timestamp</strong>: 时间戳</li>
|
|
|
+ <li><strong>debug_step</strong>: 执行步骤</li>
|
|
|
+ <li><strong>debug_request</strong>: 请求参数</li>
|
|
|
+ <li><strong>debug_action</strong>: 操作类型</li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="test-section">
|
|
|
+ <h3>初始化测试</h3>
|
|
|
+ <p>测试初始化接口,检查debug信息是否被正确保留:</p>
|
|
|
+ <button onclick="testInit()">测试初始化</button>
|
|
|
+ <button onclick="testInitWithConfig()">测试初始化(带配置)</button>
|
|
|
+ <button onclick="testInitTestMode()">测试初始化(测试模式)</button>
|
|
|
+ <div id="initResult" class="result" style="display: none;"></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="test-section">
|
|
|
+ <h3>健康检查测试</h3>
|
|
|
+ <p>测试健康检查接口,检查debug信息是否被正确保留:</p>
|
|
|
+ <button onclick="testHealth()">测试健康检查</button>
|
|
|
+ <div id="healthResult" class="result" style="display: none;"></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="test-section">
|
|
|
+ <h3>统计信息测试</h3>
|
|
|
+ <p>测试统计信息接口,检查debug信息是否被正确保留:</p>
|
|
|
+ <button onclick="testStats()">测试统计信息</button>
|
|
|
+ <div id="statsResult" class="result" style="display: none;"></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="test-section">
|
|
|
+ <h3>签到状态测试</h3>
|
|
|
+ <p>测试签到状态接口,检查debug信息是否被正确保留:</p>
|
|
|
+ <button onclick="testSignInStatus()">测试签到状态</button>
|
|
|
+ <div id="signInStatusResult" class="result" style="display: none;"></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="test-section">
|
|
|
+ <h3>批量测试</h3>
|
|
|
+ <p>批量测试所有接口,检查debug信息保留情况:</p>
|
|
|
+ <button onclick="runAllTests()">运行所有测试</button>
|
|
|
+ <div id="allTestsResult" class="result" style="display: none;"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <script>
|
|
|
+ const API_BASE_URL = 'http://localhost:8321/api/entry/workinjury';
|
|
|
+
|
|
|
+ // 通用API调用函数
|
|
|
+ async function callAPI(requestData) {
|
|
|
+ try {
|
|
|
+ const response = await fetch(API_BASE_URL, {
|
|
|
+ method: 'POST',
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ },
|
|
|
+ body: JSON.stringify(requestData)
|
|
|
+ });
|
|
|
+
|
|
|
+ const result = await response.json();
|
|
|
+ return {
|
|
|
+ success: true,
|
|
|
+ status: response.status,
|
|
|
+ data: result
|
|
|
+ };
|
|
|
+ } catch (error) {
|
|
|
+ return {
|
|
|
+ success: false,
|
|
|
+ error: error.message,
|
|
|
+ data: null
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查debug信息是否完整
|
|
|
+ function checkDebugInfo(data, testName) {
|
|
|
+ const requiredFields = [
|
|
|
+ 'debug_entry_time',
|
|
|
+ 'debug_method_entered',
|
|
|
+ 'debug_stage',
|
|
|
+ 'debug_timestamp',
|
|
|
+ 'debug_step'
|
|
|
+ ];
|
|
|
+
|
|
|
+ const missingFields = [];
|
|
|
+ const presentFields = [];
|
|
|
+
|
|
|
+ requiredFields.forEach(field => {
|
|
|
+ if (data[field] !== undefined && data[field] !== null) {
|
|
|
+ presentFields.push(field);
|
|
|
+ } else {
|
|
|
+ missingFields.push(field);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return {
|
|
|
+ testName: testName,
|
|
|
+ allPresent: missingFields.length === 0,
|
|
|
+ presentFields: presentFields,
|
|
|
+ missingFields: missingFields,
|
|
|
+ totalRequired: requiredFields.length,
|
|
|
+ presentCount: presentFields.length
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ // 显示结果
|
|
|
+ function showResult(elementId, apiResult, testName) {
|
|
|
+ const element = document.getElementById(elementId);
|
|
|
+ element.style.display = 'block';
|
|
|
+
|
|
|
+ if (!apiResult.success) {
|
|
|
+ element.className = 'result error';
|
|
|
+ element.textContent = `API调用失败: ${apiResult.error}`;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const debugCheck = checkDebugInfo(apiResult.data, testName);
|
|
|
+
|
|
|
+ let resultText = `=== ${testName} ===\n`;
|
|
|
+ resultText += `HTTP状态: ${apiResult.status}\n`;
|
|
|
+ resultText += `API成功: ${apiResult.data.success}\n`;
|
|
|
+ resultText += `返回代码: ${apiResult.data.code}\n`;
|
|
|
+ resultText += `消息: ${apiResult.data.message}\n\n`;
|
|
|
+
|
|
|
+ resultText += `=== Debug信息检查 ===\n`;
|
|
|
+ resultText += `完整性: ${debugCheck.allPresent ? '✅ 完整' : '❌ 不完整'}\n`;
|
|
|
+ resultText += `必需字段: ${debugCheck.totalRequired}\n`;
|
|
|
+ resultText += `存在字段: ${debugCheck.presentCount}\n`;
|
|
|
+ resultText += `缺失字段: ${debugCheck.missingFields.length > 0 ? debugCheck.missingFields.join(', ') : '无'}\n\n`;
|
|
|
+
|
|
|
+ resultText += `=== 存在的Debug字段 ===\n`;
|
|
|
+ debugCheck.presentFields.forEach(field => {
|
|
|
+ resultText += `${field}: ${apiResult.data[field]}\n`;
|
|
|
+ });
|
|
|
+
|
|
|
+ if (debugCheck.missingFields.length > 0) {
|
|
|
+ resultText += `\n=== 缺失的Debug字段 ===\n`;
|
|
|
+ debugCheck.missingFields.forEach(field => {
|
|
|
+ resultText += `${field}: 缺失\n`;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ resultText += `\n=== 完整响应数据 ===\n`;
|
|
|
+ resultText += JSON.stringify(apiResult.data, null, 2);
|
|
|
+
|
|
|
+ element.className = debugCheck.allPresent ? 'result success' : 'result error';
|
|
|
+ element.textContent = resultText;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 测试初始化
|
|
|
+ async function testInit() {
|
|
|
+ const requestData = {
|
|
|
+ action: "init",
|
|
|
+ timestamp: new Date().toISOString()
|
|
|
+ };
|
|
|
+
|
|
|
+ const result = await callAPI(requestData);
|
|
|
+ showResult('initResult', result, '初始化测试');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 测试初始化(带配置)
|
|
|
+ async function testInitWithConfig() {
|
|
|
+ const requestData = {
|
|
|
+ action: "init",
|
|
|
+ timestamp: new Date().toISOString(),
|
|
|
+ config: {
|
|
|
+ fixmedinsCode: "SQ201348",
|
|
|
+ fixmedinsName: "沭阳铭和医院",
|
|
|
+ interfaceVersion: "V2.1"
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const result = await callAPI(requestData);
|
|
|
+ showResult('initResult', result, '初始化测试(带配置)');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 测试初始化(测试模式)
|
|
|
+ async function testInitTestMode() {
|
|
|
+ const requestData = {
|
|
|
+ action: "init",
|
|
|
+ timestamp: new Date().toISOString(),
|
|
|
+ test_mode: "immediate_return",
|
|
|
+ config: {
|
|
|
+ fixmedinsCode: "SQ201348",
|
|
|
+ fixmedinsName: "沭阳铭和医院",
|
|
|
+ interfaceVersion: "V2.1"
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const result = await callAPI(requestData);
|
|
|
+ showResult('initResult', result, '初始化测试(测试模式)');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 测试健康检查
|
|
|
+ async function testHealth() {
|
|
|
+ const requestData = {
|
|
|
+ action: "health",
|
|
|
+ timestamp: new Date().toISOString()
|
|
|
+ };
|
|
|
+
|
|
|
+ const result = await callAPI(requestData);
|
|
|
+ showResult('healthResult', result, '健康检查测试');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 测试统计信息
|
|
|
+ async function testStats() {
|
|
|
+ const requestData = {
|
|
|
+ action: "stats",
|
|
|
+ timestamp: new Date().toISOString()
|
|
|
+ };
|
|
|
+
|
|
|
+ const result = await callAPI(requestData);
|
|
|
+ showResult('statsResult', result, '统计信息测试');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 测试签到状态
|
|
|
+ async function testSignInStatus() {
|
|
|
+ const requestData = {
|
|
|
+ action: "signin_status",
|
|
|
+ timestamp: new Date().toISOString()
|
|
|
+ };
|
|
|
+
|
|
|
+ const result = await callAPI(requestData);
|
|
|
+ showResult('signInStatusResult', result, '签到状态测试');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 运行所有测试
|
|
|
+ async function runAllTests() {
|
|
|
+ const element = document.getElementById('allTestsResult');
|
|
|
+ element.style.display = 'block';
|
|
|
+ element.className = 'result info';
|
|
|
+ element.textContent = '正在运行所有测试...';
|
|
|
+
|
|
|
+ const tests = [
|
|
|
+ { name: '初始化', func: testInit },
|
|
|
+ { name: '初始化(带配置)', func: testInitWithConfig },
|
|
|
+ { name: '初始化(测试模式)', func: testInitTestMode },
|
|
|
+ { name: '健康检查', func: testHealth },
|
|
|
+ { name: '统计信息', func: testStats },
|
|
|
+ { name: '签到状态', func: testSignInStatus }
|
|
|
+ ];
|
|
|
+
|
|
|
+ let allResults = `=== 批量测试结果 ===\n`;
|
|
|
+ let successCount = 0;
|
|
|
+ let totalCount = tests.length;
|
|
|
+
|
|
|
+ for (const test of tests) {
|
|
|
+ allResults += `\n--- ${test.name} ---\n`;
|
|
|
+
|
|
|
+ const requestData = {
|
|
|
+ action: test.name.includes('初始化') ? 'init' :
|
|
|
+ test.name.includes('健康') ? 'health' :
|
|
|
+ test.name.includes('统计') ? 'stats' :
|
|
|
+ test.name.includes('签到') ? 'signin_status' : 'init',
|
|
|
+ timestamp: new Date().toISOString()
|
|
|
+ };
|
|
|
+
|
|
|
+ if (test.name.includes('带配置')) {
|
|
|
+ requestData.config = {
|
|
|
+ fixmedinsCode: "SQ201348",
|
|
|
+ fixmedinsName: "沭阳铭和医院",
|
|
|
+ interfaceVersion: "V2.1"
|
|
|
+ };
|
|
|
+ } else if (test.name.includes('测试模式')) {
|
|
|
+ requestData.test_mode = "immediate_return";
|
|
|
+ requestData.config = {
|
|
|
+ fixmedinsCode: "SQ201348",
|
|
|
+ fixmedinsName: "沭阳铭和医院",
|
|
|
+ interfaceVersion: "V2.1"
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ const result = await callAPI(requestData);
|
|
|
+ const debugCheck = checkDebugInfo(result.data || {}, test.name);
|
|
|
+
|
|
|
+ allResults += `状态: ${result.success ? '✅ 成功' : '❌ 失败'}\n`;
|
|
|
+ allResults += `Debug完整性: ${debugCheck.allPresent ? '✅ 完整' : '❌ 不完整'}\n`;
|
|
|
+ allResults += `Debug字段: ${debugCheck.presentCount}/${debugCheck.totalRequired}\n`;
|
|
|
+
|
|
|
+ if (result.success) successCount++;
|
|
|
+ }
|
|
|
+
|
|
|
+ allResults += `\n=== 总结 ===\n`;
|
|
|
+ allResults += `总测试数: ${totalCount}\n`;
|
|
|
+ allResults += `成功数: ${successCount}\n`;
|
|
|
+ allResults += `失败数: ${totalCount - successCount}\n`;
|
|
|
+ allResults += `成功率: ${((successCount / totalCount) * 100).toFixed(1)}%\n`;
|
|
|
+
|
|
|
+ element.className = successCount === totalCount ? 'result success' : 'result error';
|
|
|
+ element.textContent = allResults;
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|