Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openApi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hj
openApi
Commits
85d33e7e
Commit
85d33e7e
authored
Mar 09, 2023
by
hangjun83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
百化产品接口更新
parent
581e4a80
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
336 additions
and
0 deletions
+336
-0
server/app/Finance/Repositories/Contracts/BhuaInvoiceItemsRepository.php
...nce/Repositories/Contracts/BhuaInvoiceItemsRepository.php
+21
-0
server/app/Finance/Repositories/Contracts/BhuaInvoiceRepository.php
.../Finance/Repositories/Contracts/BhuaInvoiceRepository.php
+21
-0
server/app/Finance/Repositories/Eloquent/BhuaInvoiceItemsRepositoryEloquent.php
...ositories/Eloquent/BhuaInvoiceItemsRepositoryEloquent.php
+42
-0
server/app/Finance/Repositories/Eloquent/BhuaInvoiceRepositoryEloquent.php
...e/Repositories/Eloquent/BhuaInvoiceRepositoryEloquent.php
+53
-0
server/app/Finance/Repositories/Models/BhuaInvoice.php
server/app/Finance/Repositories/Models/BhuaInvoice.php
+59
-0
server/app/Finance/Repositories/Models/BhuaInvoiceItems.php
server/app/Finance/Repositories/Models/BhuaInvoiceItems.php
+58
-0
server/app/Repositories/Transformers/Rhawn/Bhua/ProductsTransformer.php
...ositories/Transformers/Rhawn/Bhua/ProductsTransformer.php
+82
-0
No files found.
server/app/Finance/Repositories/Contracts/BhuaInvoiceItemsRepository.php
0 → 100644
View file @
85d33e7e
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace
App\Finance\Repositories\Contracts
;
use
Prettus\Repository\Contracts\RepositoryInterface
;
/**
* Interface UserRepository.
*/
interface
BhuaInvoiceItemsRepository
extends
RepositoryInterface
{
}
server/app/Finance/Repositories/Contracts/BhuaInvoiceRepository.php
0 → 100644
View file @
85d33e7e
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace
App\Finance\Repositories\Contracts
;
use
Prettus\Repository\Contracts\RepositoryInterface
;
/**
* Interface UserRepository.
*/
interface
BhuaInvoiceRepository
extends
RepositoryInterface
{
}
server/app/Finance/Repositories/Eloquent/BhuaInvoiceItemsRepositoryEloquent.php
0 → 100644
View file @
85d33e7e
<?php
namespace
App\Finance\Repositories\Eloquent
;
use
App\Finance\Repositories\Contracts\BhuaInvoiceItemsRepository
;
use
App\Finance\Repositories\Models\BhuaInvoiceItems
;
/**
* Class UserRepositoryEloquent.
*/
class
BhuaInvoiceItemsRepositoryEloquent
extends
BaseRepository
implements
BhuaInvoiceItemsRepository
{
protected
$fieldSearchable
=
[
];
/**
* Specify Model class name.
*
* @return string
*/
public
function
model
()
{
return
BhuaInvoiceItems
::
class
;
}
public
function
getInvoiceItemsByIdAndItemId
(
$id
,
$itemId
)
{
$invoiceItemInfo
=
null
;
$invoiceItemInfo
=
$this
->
join
(
'dpdetail'
,
'dpdetail.dpd_id'
,
'soidetail.dpd_id'
)
->
join
(
'soitems'
,
'soitems.si_id'
,
'dpdetail.si_id'
)
->
join
(
'products'
,
'products.p_id'
,
'soitems.p_id'
)
->
whereIn
(
'soidetail.soid_id'
,
$itemId
)
->
where
(
'soidetail.soi_id'
,
$id
)
->
select
(
'soidetail.soi_id'
,
'soidetail.soid_id'
,
'soidetail.soid_amount'
,
'dpdetail.dpd_num'
,
'products.p_code'
,
'products.p_cn_name'
,
'products.p_pack'
,
'products.p_pack_unit'
,
'products.p_price'
)
->
get
()
->
toArray
();
return
$invoiceItemInfo
;
}
}
server/app/Finance/Repositories/Eloquent/BhuaInvoiceRepositoryEloquent.php
0 → 100644
View file @
85d33e7e
<?php
namespace
App\Finance\Repositories\Eloquent
;
use
App\Finance\Repositories\Contracts\BhuaInvoiceRepository
;
use
App\Finance\Repositories\Models\BhuaInvoice
;
/**
* Class UserRepositoryEloquent.
*/
class
BhuaInvoiceRepositoryEloquent
extends
BaseRepository
implements
BhuaInvoiceRepository
{
protected
$fieldSearchable
=
[
];
/**
* Specify Model class name.
*
* @return string
*/
public
function
model
()
{
return
BhuaInvoice
::
class
;
}
public
function
getInvoiceById
(
$id
)
{
$invoice
=
$this
->
where
(
'soi_id'
,
$id
)
->
get
()
->
toArray
();
if
(
$invoice
){
return
current
(
$invoice
);
}
return
null
;
}
public
function
updateInvoiceById
(
$id
,
$updateParams
)
{
$invoice
=
$this
->
getInvoiceById
(
$id
);
if
(
$invoice
){
return
$this
->
updateOrCreate
([
'soi_id'
=>
$id
],
$updateParams
)
->
toArray
();
}
return
null
;
}
public
function
queryCustomerInfoByInvoiceId
(
$invoiceId
)
{
$customerInfo
=
null
;
$customerInfo
=
$this
->
join
(
'customers'
,
'soinvoice.cus_id'
,
'customers.cus_id'
)
->
where
(
'soinvoice.soi_id'
,
$invoiceId
)
->
get
()
->
toArray
();
return
$customerInfo
;
}
}
server/app/Finance/Repositories/Models/BhuaInvoice.php
0 → 100644
View file @
85d33e7e
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace
App\Finance\Repositories\Models
;
use
App\Repositories\Models\Model
;
class
BhuaInvoice
extends
Model
{
// 销售订单
protected
$table
=
'soinvoice'
;
protected
$connection
=
'bh_mysql'
;
protected
$primaryKey
=
'soi_id'
;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected
$fillable
=
[
'soi_api_status'
,
'soi_no'
,
'soi_date'
,
'soi_tax'
,
'soi_amount'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected
$hidden
=
[
];
/**
* update时不做自动更新时间操作
* @return null
*/
public
function
getUpdatedAtColumn
()
{
return
null
;
}
public
function
getCreatedAtColumn
()
{
return
null
;
}
}
\ No newline at end of file
server/app/Finance/Repositories/Models/BhuaInvoiceItems.php
0 → 100644
View file @
85d33e7e
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace
App\Finance\Repositories\Models
;
use
App\Repositories\Models\Model
;
class
BhuaInvoiceItems
extends
Model
{
// 销售订单
protected
$table
=
'soidetail'
;
protected
$connection
=
'bh_mysql'
;
protected
$primaryKey
=
'soid_id'
;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected
$fillable
=
[
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected
$hidden
=
[
];
/**
* update时不做自动更新时间操作
* @return null
*/
public
function
getUpdatedAtColumn
()
{
return
null
;
}
public
function
getCreatedAtColumn
()
{
return
null
;
}
}
\ No newline at end of file
server/app/Repositories/Transformers/Rhawn/Bhua/ProductsTransformer.php
0 → 100644
View file @
85d33e7e
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace
App\Repositories\Transformers\Rhawn\Bhua
;
use
League\Fractal\TransformerAbstract
;
class
ProductsTransformer
extends
TransformerAbstract
{
/**
* 格式化结
* @param $rhawnSorders
* @return array
*/
public
function
transform
(
$products
,
$type
=
'all'
)
{
$productTransReturn
=
[];
if
(
$products
){
foreach
(
$products
as
$product
){
$temp
=
[];
$temp
[
'code'
]
=
$product
[
'p_code'
];
//中文别名
$temp
[
'cas'
]
=
$product
[
'c_cas'
];
//CAS号
$temp
[
'chem_cn_name'
]
=
$product
[
'c_cn_name'
];
//中文名
$temp
[
'chem_en_name'
]
=
$product
[
'c_en_name'
];
//中文名
$temp
[
'cn_name'
]
=
$product
[
'p_cn_name'
];
//中文名
$temp
[
'en_name'
]
=
$product
[
'p_en_name'
];
//英文名
$temp
[
'level'
]
=
$product
[
'p_level'
];
//项目规格
if
(
$type
==
'all'
){
$temp
[
'delivery'
]
=
$product
[
'p_tod'
];
//货期
}
$temp
[
'price'
]
=
$product
[
'p_price'
];
//单价
$temp
[
'market_price'
]
=
$product
[
'm_price'
];
//目录价格
if
(
$product
[
'r_gz_type'
]
==
2
){
$temp
[
'if_explode'
]
=
1
;
//是否易制爆
}
else
{
$temp
[
'if_explode'
]
=
0
;
//是否易制爆
}
if
(
$type
==
'all'
){
if
(
$product
[
'r_gz_type'
]
==
1
){
$temp
[
'if_drag'
]
=
1
;
//是否易制毒
}
else
{
$temp
[
'if_drag'
]
=
0
;
//是否易制毒
}
}
if
(
$product
[
'c_if_dangers'
]
==
1
){
$temp
[
'if_dangers'
]
=
1
;
//是否危化品
}
else
{
$temp
[
'if_dangers'
]
=
0
;
//是否危化品
}
if
(
$product
[
'r_status'
]
==
0
||
$product
[
'p_status'
]
==
0
||
$product
[
'p_show'
]
==
0
||
$product
[
'p_if_big'
]
==
1
){
$temp
[
'status'
]
=
0
;
$temp
[
'price'
]
=
0
;
$temp
[
'market_price'
]
=
0
;
}
else
{
$temp
[
'status'
]
=
1
;
}
$temp
[
'pack'
]
=
$product
[
'p_pack'
]
.
$product
[
'p_pack_unit'
];
//包装规格
$temp
[
'weight'
]
=
$product
[
'p_weight'
];
//产品重量kg
if
(
$product
[
'p_stock'
]
>
0
){
$temp
[
'tag'
]
=
'当天发货'
;
}
else
{
$temp
[
'tag'
]
=
''
;
}
if
(
$type
==
'bycas'
){
$temp
[
'city'
]
=
'上海'
;
$temp
[
'stock'
]
=
$product
[
'p_tod'
];
//货期
$temp
[
'pacs'
]
=
$product
[
'p_pack'
]
.
$product
[
'p_pack_unit'
];
//项目规格
}
array_push
(
$productTransReturn
,
$temp
);
}
}
return
$productTransReturn
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment