Przeglądaj źródła

fix: 修复订单创建时残疾人工作状态不同步问题

修复 batchAddPersons 方法强制覆盖前端传递的 workStatus 值的问题。
现在会使用前端传递的工作状态,如果未传递则使用 PRE_WORKING 作为默认值。

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 21 godzin temu
rodzic
commit
0ff010d3e3

+ 3 - 2
allin-packages/order-module/src/services/order.service.ts

@@ -1,5 +1,5 @@
 import { GenericCrudService } from '@d8d/shared-crud';
-import { DataSource, Repository, DataSourceOptions, In, Not } from 'typeorm';
+import { DataSource, Repository } from 'typeorm';
 import { EmploymentOrder } from '../entities/employment-order.entity';
 import { OrderPerson } from '../entities/order-person.entity';
 import { OrderPersonAsset } from '../entities/order-person-asset.entity';
@@ -337,6 +337,7 @@ export class OrderService extends GenericCrudService<EmploymentOrder> {
     personId: number;
     joinDate: Date;
     salaryDetail: number;
+    workStatus?: WorkStatus;
   }>): Promise<{ success: boolean; message: string; addedCount: number }> {
     // 验证订单是否存在
     const order = await this.repository.findOne({
@@ -377,7 +378,7 @@ export class OrderService extends GenericCrudService<EmploymentOrder> {
           orderId: orderId,
           personId: person.personId,
           joinDate: person.joinDate,
-          workStatus: WorkStatus.PRE_WORKING,
+          workStatus: person.workStatus ?? WorkStatus.PRE_WORKING,
           salaryDetail: person.salaryDetail,
         });
       });