From c19f1f7e21c93d1f13b4f44a8a615f65af577559 Mon Sep 17 00:00:00 2001
From: wangzhibo <wangzhibo@shsening.com>
Date: 星期日, 16 八月 2026 15:10:24 +0800
Subject: [PATCH] 添加 android 端接口

---
 src/modules/order/service/info.ts |   71 +++++++++++++++++++++++++++++++++++
 1 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/src/modules/order/service/info.ts b/src/modules/order/service/info.ts
index 48786ee..384477c 100644
--- a/src/modules/order/service/info.ts
+++ b/src/modules/order/service/info.ts
@@ -7,6 +7,7 @@
 import { OrderGoodsEntity } from '../entity/goods';
 import * as moment from 'moment';
 import { UserAddressService } from '../../user/service/address';
+import { UserInfoEntity } from '../../user/entity/info';
 import { Action, OrderQueue } from '../queue/order';
 import { OrderPayService } from './pay';
 import { PluginService } from '../../plugin/service/info';
@@ -14,6 +15,7 @@
 import { MarketCouponInfoService } from '../../market/service/coupon/info';
 import { MarketCouponUserEntity } from '../../market/entity/coupon/user';
 import { BaseSysParamService } from '../../base/service/sys/param';
+import { BasicdataSorterEntity } from '../../basicdata/entity/sorter';
 import BigNumber from 'bignumber.js';
 
 /**
@@ -29,6 +31,9 @@
 
   @InjectEntityModel(MarketCouponUserEntity)
   marketCouponUserEntity: Repository<MarketCouponUserEntity>;
+
+  @InjectEntityModel(BasicdataSorterEntity)
+  basicdataSorterEntity: Repository<BasicdataSorterEntity>;
 
   @Inject()
   orderGoodsService: OrderGoodsService;
@@ -418,6 +423,72 @@
   }
 
   /**
+   * 鍒嗘嫞鍛樻煡鐪嬫牎鍥晢鍩庤鍗曪紙鎸夊鏍¤繃婊わ級
+   */
+  async sorterPage(query: any) {
+    const { sorterId, status, page = 1, size = 10, keyWord } = query || {};
+    if (!sorterId) {
+      throw new CoolCommException('缂哄皯鍒嗘嫞鍛樹俊鎭�');
+    }
+    const sorter = await this.basicdataSorterEntity.findOneBy({
+      businessId: String(sorterId),
+    });
+    if (!sorter || sorter.status !== 0) {
+      throw new CoolCommException('鍒嗘嫞鍛樿处鍙蜂笉鍙敤');
+    }
+    const find = this.orderInfoEntity
+      .createQueryBuilder('a')
+      .select([
+        'a.*',
+        'b.nickName AS nickName',
+        'b.phone AS phone',
+        'b.unionid AS unionid',
+      ])
+      .leftJoin(UserInfoEntity, 'b', 'a.userId = b.unionid');
+    if (sorter.departmentId) {
+      find.andWhere('b.departmentId = :deptId', {
+        deptId: sorter.departmentId,
+      });
+    }
+    if (status !== undefined && status !== null && status !== '') {
+      find.andWhere('a.status = :status', { status: Number(status) });
+    }
+    if (keyWord) {
+      find.andWhere(
+        '(a.orderNum LIKE :kw OR a.title LIKE :kw OR b.nickName LIKE :kw OR b.phone LIKE :kw)',
+        { kw: `%${keyWord}%` }
+      );
+    }
+    find.orderBy('a.createTime', 'DESC');
+    const result = await this.entityRenderPage(
+      find,
+      { ...query, page, size },
+      false
+    );
+    const ids = (result.list || []).map((e: any) => e.id);
+    if (ids.length) {
+      const goodsList = await this.orderGoodsService.getByOrderIds(ids);
+      for (const item of result.list) {
+        item.goodsList = goodsList.filter(e => e.orderId == item.id);
+      }
+    }
+    return result;
+  }
+
+  /**
+   * 鏍″洯鐜板満鍙戞斁锛堜笉璧扮墿娴侊級
+   */
+  async sorterDeliver(orderId: number, sorterId: string) {
+    if (!sorterId) {
+      throw new CoolCommException('缂哄皯鍒嗘嫞鍛樹俊鎭�');
+    }
+    return this.deliver(orderId, {
+      company: '鐜板満鍙戞斁',
+      num: String(sorterId),
+    });
+  }
+
+  /**
    * 妫�鏌ュ簱瀛�
    * @param goodsList
    */

--
Gitblit v1.9.1