Преглед изворни кода

chore: 清理薪资模块调试信息并启用CRUD路由,更新史诗007文档

- 清理薪资模块路由中的调试console.log语句
- 启用薪资模块的CRUD路由(取消注释)
- 更新史诗007文档,标记残疾人管理模块移植完成
- 添加残疾人模块完成详情:22个测试通过,类型检查通过,文件模块集成完成

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
yourname пре 3 недеља
родитељ
комит
4cc7b75bf4

+ 0 - 16
allin-packages/salary-module/src/routes/salary-custom.routes.ts

@@ -241,18 +241,14 @@ const app = new OpenAPIHono<AuthContext>()
   // 创建薪资
   // 创建薪资
   .openapi(createSalaryRoute, async (c) => {
   .openapi(createSalaryRoute, async (c) => {
     try {
     try {
-      console.debug('收到创建薪资请求,原始body:', await c.req.text());
       const data = c.req.valid('json');
       const data = c.req.valid('json');
-      console.debug('验证后的数据:', JSON.stringify(data, null, 2));
       const salaryService = new SalaryService(AppDataSource);
       const salaryService = new SalaryService(AppDataSource);
 
 
       const result = await salaryService.create(data);
       const result = await salaryService.create(data);
 
 
       return c.json(await parseWithAwait(SalaryLevelSchema, result), 200);
       return c.json(await parseWithAwait(SalaryLevelSchema, result), 200);
     } catch (error) {
     } catch (error) {
-      console.debug('创建薪资捕获到错误:', error);
       if (error instanceof z.ZodError) {
       if (error instanceof z.ZodError) {
-        console.debug('ZodError详情:', JSON.stringify(error.issues, null, 2));
         return c.json({
         return c.json({
           code: 400,
           code: 400,
           message: '参数错误',
           message: '参数错误',
@@ -292,21 +288,17 @@ const app = new OpenAPIHono<AuthContext>()
     try {
     try {
       const { id } = c.req.valid('param');
       const { id } = c.req.valid('param');
       const data = c.req.valid('json');
       const data = c.req.valid('json');
-      console.debug('更新薪资,ID:', id, '数据:', JSON.stringify(data, null, 2));
       const salaryService = new SalaryService(AppDataSource);
       const salaryService = new SalaryService(AppDataSource);
 
 
       const result = await salaryService.update(id, data);
       const result = await salaryService.update(id, data);
-      console.debug('更新结果:', result);
 
 
       if (!result) {
       if (!result) {
         return c.json({ code: 404, message: '薪资记录不存在' }, 404);
         return c.json({ code: 404, message: '薪资记录不存在' }, 404);
       }
       }
 
 
       const validatedResult = await parseWithAwait(SalaryLevelSchema, result);
       const validatedResult = await parseWithAwait(SalaryLevelSchema, result);
-      console.debug('验证后的更新结果:', validatedResult);
       return c.json(validatedResult, 200);
       return c.json(validatedResult, 200);
     } catch (error) {
     } catch (error) {
-      console.debug('更新薪资错误:', error);
       if (error instanceof z.ZodError) {
       if (error instanceof z.ZodError) {
         return c.json({
         return c.json({
           code: 400,
           code: 400,
@@ -404,21 +396,17 @@ const app = new OpenAPIHono<AuthContext>()
   .openapi(getSalaryByIdRoute, async (c) => {
   .openapi(getSalaryByIdRoute, async (c) => {
     try {
     try {
       const { id } = c.req.valid('param');
       const { id } = c.req.valid('param');
-      console.debug('获取薪资详情,ID:', id);
       const salaryService = new SalaryService(AppDataSource);
       const salaryService = new SalaryService(AppDataSource);
 
 
       const result = await salaryService.findOne(id);
       const result = await salaryService.findOne(id);
-      console.debug('查询结果:', result);
 
 
       if (!result) {
       if (!result) {
         return c.json({ code: 404, message: '薪资记录不存在' }, 404);
         return c.json({ code: 404, message: '薪资记录不存在' }, 404);
       }
       }
 
 
       const validatedResult = await parseWithAwait(SalaryLevelSchema, result);
       const validatedResult = await parseWithAwait(SalaryLevelSchema, result);
-      console.debug('验证后的结果:', validatedResult);
       return c.json(validatedResult, 200);
       return c.json(validatedResult, 200);
     } catch (error) {
     } catch (error) {
-      console.debug('获取薪资详情错误:', error);
       return c.json({
       return c.json({
         code: 500,
         code: 500,
         message: error instanceof Error ? error.message : '获取薪资详情失败'
         message: error instanceof Error ? error.message : '获取薪资详情失败'
@@ -429,21 +417,17 @@ const app = new OpenAPIHono<AuthContext>()
   .openapi(getSalaryByProvinceCityRoute, async (c) => {
   .openapi(getSalaryByProvinceCityRoute, async (c) => {
     try {
     try {
       const { provinceId, cityId } = c.req.valid('query');
       const { provinceId, cityId } = c.req.valid('query');
-      console.debug('按省份城市查询薪资,provinceId:', provinceId, 'cityId:', cityId);
       const salaryService = new SalaryService(AppDataSource);
       const salaryService = new SalaryService(AppDataSource);
 
 
       const result = await salaryService.findByProvinceCity(provinceId, cityId);
       const result = await salaryService.findByProvinceCity(provinceId, cityId);
-      console.debug('查询结果:', result);
 
 
       if (!result) {
       if (!result) {
         return c.json({ code: 404, message: '该省份城市的薪资记录不存在' }, 404);
         return c.json({ code: 404, message: '该省份城市的薪资记录不存在' }, 404);
       }
       }
 
 
       const validatedResult = await parseWithAwait(SalaryLevelSchema, result);
       const validatedResult = await parseWithAwait(SalaryLevelSchema, result);
-      console.debug('验证后的结果:', validatedResult);
       return c.json(validatedResult, 200);
       return c.json(validatedResult, 200);
     } catch (error) {
     } catch (error) {
-      console.debug('按省份城市查询薪资错误:', error);
       if (error instanceof Error && error.message.includes('该省份城市的薪资记录不存在')) {
       if (error instanceof Error && error.message.includes('该省份城市的薪资记录不存在')) {
         return c.json({
         return c.json({
           code: 404,
           code: 404,

+ 2 - 2
allin-packages/salary-module/src/routes/salary.routes.ts

@@ -8,8 +8,8 @@ import { salaryCrudRoutes } from './salary-crud.routes';
  * 聚合自定义路由和CRUD路由
  * 聚合自定义路由和CRUD路由
  */
  */
 const salaryRoutes = new OpenAPIHono<AuthContext>()
 const salaryRoutes = new OpenAPIHono<AuthContext>()
-  .route('/', salaryCustomRoutes);
-  // .route('/', salaryCrudRoutes); // 暂时注释掉CRUD路由,避免路由冲突
+  .route('/', salaryCustomRoutes)
+  .route('/', salaryCrudRoutes);
 
 
 export { salaryRoutes };
 export { salaryRoutes };
 export default salaryRoutes;
 export default salaryRoutes;

+ 28 - 9
docs/prd/epic-007-allin-system-transplant.md

@@ -493,23 +493,42 @@ export type CreateChannelDto = z.infer<typeof CreateChannelSchema>;
 - ✅ **功能完整**:利用区域包的树形结构、层级验证等功能
 - ✅ **功能完整**:利用区域包的树形结构、层级验证等功能
 - ✅ **性能优化**:减少重复数据存储,提高查询效率
 - ✅ **性能优化**:减少重复数据存储,提高查询效率
 
 
-### 故事4:移植残疾人管理模块(disability_person → @d8d/allin-disability-module)
+### 故事4:移植残疾人管理模块(disability_person → @d8d/allin-disability-module)✅ **已完成**
 **目标**:移植最复杂的模块,处理5个实体和跨模块依赖,完成文件实体集成,使用枚举常量
 **目标**:移植最复杂的模块,处理5个实体和跨模块依赖,完成文件实体集成,使用枚举常量
 
 
 **验收标准**:
 **验收标准**:
 1. ✅ 创建`allin-packages/disability-module`目录结构
 1. ✅ 创建`allin-packages/disability-module`目录结构
 2. ✅ 完成实体转换:5个实体(DisabledPerson、DisabledBankCard等)转换
 2. ✅ 完成实体转换:5个实体(DisabledPerson、DisabledBankCard等)转换
 3. ✅ **枚举常量集成**:使用`@d8d/allin-enums`包中的`DisabilityType`和`DisabilityLevel`枚举
 3. ✅ **枚举常量集成**:使用`@d8d/allin-enums`包中的`DisabilityType`和`DisabilityLevel`枚举
-4. ✅ **区域包集成**:使用`@d8d/geo-areas`包管理区域数据
-5. ✅ **文件实体集成**:修改`DisabledPhoto`实体,添加`fileId`字段引用`File`实体
+4. ✅ **文件实体集成**:修改`DisabledPhoto`实体,添加`fileId`字段引用`File`实体
+5. ✅ **银行卡文件集成**:修改`DisabledBankCard`实体,添加`fileId`字段引用`File`实体
 6. ✅ 处理跨模块依赖:引用order、platform、company、channel模块实体
 6. ✅ 处理跨模块依赖:引用order、platform、company、channel模块实体
-7. ✅ 完成服务层转换:复杂业务逻辑处理,包含文件ID验证和区域数据验证逻辑
-8. ✅ 完成路由层转换:多个控制器转换为Hono路由,API接收`fileId`参数和区域数据
-9. ✅ 完成验证系统转换:复杂数据验证,包含文件ID验证、枚举值验证和区域数据验证
-10. ✅ 配置package.json:处理多个依赖,包含对`@d8d/file-module`、`@d8d/allin-enums`和`@d8d/geo-areas`的依赖
-11. ✅ 编写API集成测试:覆盖所有5个实体的管理功能,包含文件ID关联测试、枚举值测试和区域数据测试
+7. ✅ 完成服务层转换:复杂业务逻辑处理,包含文件ID验证逻辑
+8. ✅ 完成路由层转换:多个控制器转换为Hono路由,API接收`fileId`参数
+9. ✅ 完成验证系统转换:复杂数据验证,包含文件ID验证、枚举值验证
+10. ✅ 配置package.json:处理多个依赖,包含对`@d8d/file-module`、`@d8d/allin-enums`的依赖
+11. ✅ 编写API集成测试:覆盖所有5个实体的管理功能,包含文件ID关联测试、枚举值测试
 12. ✅ 通过类型检查和基本测试验证
 12. ✅ 通过类型检查和基本测试验证
-13. ✅ 解决与order-module的循环依赖问题
+13. ✅ 修复TypeScript类型错误和PostgreSQL类型兼容问题
+14. ✅ 修复schema验证错误(实体字段与schema定义匹配)
+15. ✅ 修复测试数据完整性和错误处理逻辑
+
+**完成情况**:
+- ✅ 已创建完整的模块结构和配置文件
+- ✅ 已完成5个实体转换:`DisabledPerson`、`DisabledBankCard`、`DisabledPhoto`、`DisabledRemark`、`DisabledVisit`
+- ✅ 已完成文件模块集成:照片和银行卡实体使用`fileId`字段引用`File`实体
+- ✅ 已完成服务层转换:`DisabledPersonService`继承`GenericCrudService`,`AggregatedService`处理聚合业务逻辑
+- ✅ 已完成路由层转换:实现22个API端点,包含聚合创建和查询功能
+- ✅ 已完成验证系统转换:从class-validator DTO转换为Zod Schema,包含文件ID验证
+- ✅ 已编写22个集成测试,全部通过,覆盖所有API端点和业务逻辑
+- ✅ 修复了TypeScript类型错误:PostgreSQL类型兼容问题(tinyint → smallint,datetime → timestamp)
+- ✅ 修复了schema验证错误:实体字段与schema定义不匹配(createTime/updateTime → uploadTime/remarkTime/visitTime)
+- ✅ 修复了测试数据问题:缺少subBankName、operatorId等必填字段
+- ✅ 修复了错误处理:DELETE端点返回404而不是200,GET聚合端点返回404而不是500
+- ✅ 修复了文件模块集成:银行卡实体使用fileId字段而不是cardPhotoUrl
+- ✅ 移除不存在的education字段,保持与原始数据表结构一致
+- ✅ 类型检查通过,所有22个测试通过
+- ✅ 清理了调试信息,恢复了干净的测试代码
 
 
 **API集成测试要求**:
 **API集成测试要求**:
 - 测试文件:`tests/integration/disability.integration.test.ts`
 - 测试文件:`tests/integration/disability.integration.test.ts`