From 30de78aa63d73e4c2ac3a17ef8429258297619f7 Mon Sep 17 00:00:00 2001 From: ljl Date: Tue, 30 Jan 2024 11:44:08 +0800 Subject: [PATCH] yh --- .../order/class.WaybillBillController.php | 6 ++--- .../daos/OrderPrint/OpWaybillBillLogDao.php | 17 +++++++++++-- .../OrderPrint/WaybillBillService.php | 25 ++++++++++++++++++- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/app/libs/controller/order/class.WaybillBillController.php b/app/libs/controller/order/class.WaybillBillController.php index 5822c96..12aec08 100644 --- a/app/libs/controller/order/class.WaybillBillController.php +++ b/app/libs/controller/order/class.WaybillBillController.php @@ -43,10 +43,10 @@ class WaybillBillController extends AbstractApiController { /** * @api GET 获取对账日志 * @param int taskId 任务ID - * @param string type 类型 + * @param string type 类型 1-导入且匹配的运单号/2-导入但未匹配的运单号/3-未导入,但本店铺有打印的运单号/4-导入但已回收的运单号/5-上传文件中重复的单号 */ - public function searchWaybillBillLogList() { - $data = $this->waybillBillService->searchDuplicationWaybillBillLogList($this->mallId, $_GET['taskId']); + public function searchTaskWaybillBillLogList() { + $data = $this->waybillBillService->searchTaskWaybillBillLogList($this->mallId, $_GET); return $this->renderSuccess($data); } diff --git a/app/libs/daos/OrderPrint/OpWaybillBillLogDao.php b/app/libs/daos/OrderPrint/OpWaybillBillLogDao.php index 5018f5b..730ed3f 100644 --- a/app/libs/daos/OrderPrint/OpWaybillBillLogDao.php +++ b/app/libs/daos/OrderPrint/OpWaybillBillLogDao.php @@ -5,7 +5,20 @@ namespace Dao\OrderPrint; use Dao\AbstractDao; class OpWaybillBillLogDao extends AbstractDao { - public function searchPage($mallId, $taskId, $page, $pageSize) { - return $this->queryPage('select * from %b owbl where owbl.mall_id = %i and owbl.op_waybill_bill_task_id = %i', $this->getTable(), $mallId, $taskId, $page, $pageSize); + public function searchPage($mallId, $filter, $page, $pageSize) { + $whereArray = $this->getSearchCondition($filter); + $where = $whereArray ? implode( ' ', $whereArray) : ' '; + return $this->queryPage('select * from %b owbl where owbl.mall_id = %i %l order by gmt_create desc', $this->getTable(), $mallId, $where, $page, $pageSize); + } + + private function getSearchCondition($filter) { + $wheres = []; + if (!empty($filter['taskId'])) { + $wheres[] = $this->prepare('and owbl.op_waybill_bill_task_id = %i', $filter['taskId']); + } + if (!empty($filter['type'])) { + $wheres[] = $this->prepare('and owbl.type = %i', $filter['type']); + } + return $wheres; } } \ No newline at end of file diff --git a/app/libs/services/OrderPrint/WaybillBillService.php b/app/libs/services/OrderPrint/WaybillBillService.php index bf4359d..6014102 100644 --- a/app/libs/services/OrderPrint/WaybillBillService.php +++ b/app/libs/services/OrderPrint/WaybillBillService.php @@ -287,6 +287,29 @@ class WaybillBillService extends AbstractService { } } + public function searchTaskWaybillBillLogList($mallId, $params) { + if ($params['type'] == OrderPrintConst::waybillBillTypeImportAndDuplication) { + list($waybillBillLogList, $total) = $this->searchDuplicationWaybillBillLogList($mallId, $params['taskId']); + } else { + $page = intval($params['page'] ?: 1); + $pageSize = intval($params['pageSize'] ?: 20); + list($waybillBillLogList, $total) = $this->searchWaybillBillLogList($mallId, $params, $page, $pageSize); + } + return [ + 'waybillBillLogList' => $waybillBillLogList, + 'total' => $total, + ]; + } + + public function searchWaybillBillLogList($mallId, $filter, $page, $pageSize) { + list($waybillBillLogList, $total) = $this->opWaybillBillLogDao->searchPage($mallId, $filter, $page, $pageSize); + if (empty($waybillBillLogList)) { + return [$waybillBillLogList, $total]; + } + $waybillBillLogList = $this->rebuildWaybillBillLogList($mallId, $waybillBillLogList, $filter['type']); + return [$waybillBillLogList, $total]; + } + public function searchDuplicationWaybillBillLogList($mallId, $taskId) { $taskInfo = $this->opWaybillBillTaskDao->getTask($mallId, $taskId); if (empty($taskInfo)) { @@ -419,7 +442,7 @@ class WaybillBillService extends AbstractService { $logisticsNameMap[$logisticsInfo['logisticsId']] = $logisticsInfo['logisticsName']; while (true) { - list($opWaybillBillLogList, $total) = $this->opWaybillBillLogDao->searchPage($mallId, $taskId, $page, $pageSize); + list($opWaybillBillLogList, $total) = $this->opWaybillBillLogDao->searchPage($mallId, ['taskId' => $taskId], $page, $pageSize); if (empty($opWaybillBillLogList)) { break; }