Commit 56801854 authored by hj's avatar hj

更新提交

parent e9fd3bb6
......@@ -101,4 +101,25 @@ class InvoiceController extends Controller
return $this->returnErrorExecptionResponse($exception,'获取失败');
}
}
public function getInvoiceListByOrderNumber(Request $request)
{
$customerCode = $request->get('customer_code');
if(!$customerCode){
return Response::ok('客户编号不存在!');
}
$this->checkCustomerType($customerCode,$this->controllerType);
$requestParams = $this->formatKeysfromArray($request->all(),'toUnderScore');
$requestParams = array_merge($requestParams,['customer_code' => $customerCode]);
try{
$orderItems = $this->rhawnInvoicesService->getInoviceListByOrderNumber($requestParams);
if($orderItems){
$orderItems = $this->formatKeysfromArray($orderItems,'toCamelCase');
}
return Response::success($orderItems,'操作成功');
}catch(\Throwable $exception){
return $this->returnErrorExecptionResponse($exception,'获取失败');
}
}
}
......@@ -31,4 +31,17 @@ class RhawnInvoiceRepositoryEloquent extends BaseRepository implements RhawnInvo
return $invoiceDetailInfo;
}
public function getInvoiceItemsByDpdIds($dpdIds)
{
$invoiceDetailInfo = $this
->join('soidetail','soinvoice.soi_id','soidetail.soi_id')
->join('dpdetail','depdetail.dpd_id', 'soidetail.dpd_id')
->whereIn('dpdetail.dpd_id',(array)$dpdIds)
->get()->toArray();
if(!$invoiceDetailInfo){
return null;
}
return $invoiceDetailInfo;
}
}
......@@ -64,4 +64,26 @@ class InvoicesService
return $sorderItems;
}
public function getInoviceListByOrderNumber($requestParams)
{
if(!isset($requestParams['order_number']) || empty($requestParams['order_number'])){
throw new \Exception('订单编号为空',502);
}
try{
$orderNumber = $requestParams['order_number'];
$dpdetailList = $this->rhawnOrdersService->getOrderDispatchDetail($orderNumber);
if(!$dpdetailList){
return null;
}
$dpdIds = array_column($dpdetailList, 'dpd_id');
$invoiceList = $this->invoiceRepository->getInvoiceItemsByDpdIds($dpdIds);
dd($invoiceList);
}catch(\Throwable $exception){
throw $exception;
}
}
}
......@@ -3,7 +3,7 @@
$api->version('v1', function($api) {
//获取token
$api->group(['namespace'=>'App\Http\Controllers\V1\Auth','middleware' => ['maintenance','throttle:60,1','requestlogs']], function($api) {
$api->group(['namespace'=>'App\Http\Controllers\V1\Auth','middleware' => ['maintenance','throttle:60,1']], function($api) {
$api->post('/openapi/auth/getToken', ['uses'=>'CustomerAuthController@getToken']);
});
......@@ -30,6 +30,7 @@ $api->version('v1', function($api) {
$api->group(['namespace'=>'App\Http\Controllers\V1\Rhawn','middleware' => ['maintenance','throttle:60,1','apiAuth','requestlogs'], 'providers' => 'jwt'], function($api) {
$api->post('/openapi/rhawn/invoice/getInvoiceSorderItems', ['permission' => 'orders.getInvoiceSorderItems', 'uses'=>'InvoiceController@getInvoiceSorderItems']);
$api->post('/openapi/rhawn/invoice/getOrderInvoiceListByOrderNumber', ['permission' => 'orders.getOrderInvoiceListByOrderNumber', 'uses'=>'InvoiceController@getInvoiceListByOrderNumber']);
});
// 百化接口
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment