Преглед на файлове

fix(disability-module): 修复类型错误和测试失败问题

- 修复person-extension.integration.test.ts中的client.$get类型错误,改为client.index.$get
- 更新disabled-person.service.ts中的findOneForCompany方法,添加salaryDetail字段获取
- 更新disability.integration.test.ts测试数据,添加birthDate字段并修复日期格式
- 使用动态身份证号和残疾证号避免测试数据重复冲突

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

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
yourname преди 4 седмици
родител
ревизия
5f43d3a306

+ 10 - 0
allin-packages/disability-module/src/services/disabled-person.service.ts

@@ -606,6 +606,15 @@ export class DisabledPersonService extends GenericCrudService<DisabledPerson> {
       return null;
     }
 
+    // 获取薪资信息(从order_person表获取最新薪资)
+    const orderPersonRepo = this.dataSource.getRepository(OrderPerson);
+    const latestOrderPerson = await orderPersonRepo.createQueryBuilder('op')
+      .innerJoinAndSelect('op.order', 'order')
+      .where('op.personId = :personId', { personId })
+      .andWhere('order.companyId = :companyId', { companyId })
+      .orderBy('op.joinDate', 'DESC')
+      .getOne();
+
     // 获取关联数据
     const [bankCards, photos] = await Promise.all([
       this.bankCardRepository.find({
@@ -641,6 +650,7 @@ export class DisabledPersonService extends GenericCrudService<DisabledPerson> {
       disabilityType: person.disabilityType,
       disabilityLevel: person.disabilityLevel,
       birthDate: person.birthDate,
+      salaryDetail: latestOrderPerson?.salaryDetail || null,
       phone: person.phone,
       jobStatus: person.jobStatus?.toString() || '0', // 转换为字符串
       bankCards: formattedBankCards,

+ 5 - 4
allin-packages/disability-module/tests/integration/disability.integration.test.ts

@@ -1297,10 +1297,11 @@ describe('残疾人管理API集成测试', () => {
         personInfo: {
           name: '聚合创建测试',
           gender: '男',
-          idCard: '110101199001011245',
-          disabilityId: 'D123456767',
+          idCard: `110101${Date.now() % 1000000}`, // 动态身份证号避免重复
+          disabilityId: `D${Date.now() % 100000000}`, // 动态残疾证号避免重复
           disabilityType: '肢体残疾',
           disabilityLevel: '一级',
+          birthDate: '1990-01-01T00:00:00.000Z', // 添加出生日期字段
           idAddress: '北京市延庆区',
           phone: '13000130005',
           province: '北京市',
@@ -1311,8 +1312,8 @@ describe('残疾人管理API集成测试', () => {
           jobStatus: 1,
           specificDisability: '左腿截肢,右腿行动不便,需要轮椅',
           // 日期字段
-          idValidDate: new Date('2045-11-30'),
-          disabilityValidDate: new Date('2045-11-30')
+          idValidDate: '2045-11-30T00:00:00.000Z',
+          disabilityValidDate: '2045-11-30T00:00:00.000Z'
         },
         bankCards: [
           {

+ 5 - 5
allin-packages/disability-module/tests/integration/person-extension.integration.test.ts

@@ -382,7 +382,7 @@ describe('人才扩展API集成测试', () => {
       console.debug('测试用户companyId:', testUser.companyId);
       console.debug('测试公司ID:', testCompany.id);
 
-      const response = await client.$get({
+      const response = await client.index.$get({
         query: {
           page: '1',
           limit: '10'
@@ -430,7 +430,7 @@ describe('人才扩展API集成测试', () => {
     });
 
     it('应该支持搜索功能', async () => {
-      const response = await client.$get({
+      const response = await client.index.$get({
         query: {
           search: '测试残疾人',
           page: '1',
@@ -448,7 +448,7 @@ describe('人才扩展API集成测试', () => {
     });
 
     it('应该支持残疾类型筛选', async () => {
-      const response = await client.$get({
+      const response = await client.index.$get({
         query: {
           disabilityType: '视力残疾',
           page: '1',
@@ -466,7 +466,7 @@ describe('人才扩展API集成测试', () => {
     });
 
     it('应该支持分页', async () => {
-      const response = await client.$get({
+      const response = await client.index.$get({
         query: {
           page: '1',
           limit: '5'
@@ -515,7 +515,7 @@ describe('人才扩展API集成测试', () => {
       }, { companyId: otherCompany.id } as Partial<JWTPayload & { companyId: number }>);
 
       // 其他企业用户应该看不到任何数据(因为人员不属于他的企业)
-      const response = await client.$get({
+      const response = await client.index.$get({
         query: {
           page: '1',
           limit: '10'