Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
golang-queue-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8fb550d2
authored
Jun 23, 2020
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
up
parent
91b37254
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
dal/order/bom/bom.go
dal/order/bom/bom.go
View file @
8fb550d2
...
...
@@ -32,6 +32,7 @@ type LieOrderInfo struct {
OrderSn
string
`db:"order_sn"`
OrderAmount
float64
` db:"order_amount"`
CreateTime
int64
`db:"create_time"`
UserId
int64
`db:"user_id"`
}
...
...
@@ -44,12 +45,16 @@ func BuildBomOrder(orderBomData *CreateOrderBomData) (err error){
order_id
:=
orderBomData
.
Order_id
//查询订单相关信息
lieOrder
:=
&
LieOrderInfo
{}
getOrderSql
:=
"select order_id,order_sn,order_amount,create_time from lie_order where order_id = ? "
getOrderSql
:=
"select order_id,order_sn,order_amount,create_time
,user_id
from lie_order where order_id = ? "
err
=
db
.
DB
.
Get
(
lieOrder
,
getOrderSql
,
order_id
)
if
err
!=
nil
{
return
returnError
(
fmt
.
Sprintf
(
"没有找到相关平台订单信息 订单id: : %s"
,
order_id
))
}
companyName
:=
findUserCompany
(
lieOrder
.
UserId
)
//fmt.Println("公司",companyName)
tx
:=
db
.
BomDB
.
MustBegin
()
var
(
BomId
int64
...
...
@@ -94,8 +99,14 @@ func BuildBomOrder(orderBomData *CreateOrderBomData) (err error){
//更新首次下单时间
if
(
fcorder_time
==
0
){
time_
:=
time
.
Now
()
.
Unix
()
bom_extend_sql
:=
"update lie_bom_extend set fcorder_time = ? where bom_id = ?"
_
=
tx
.
MustExec
(
bom_extend_sql
,
time_
,
BomId
)
bom_extend_sql
:=
"update lie_bom_extend set fcorder_time = ?,company_name= ? where bom_id = ?"
_
=
tx
.
MustExec
(
bom_extend_sql
,
time_
,
companyName
,
BomId
)
}
}
else
{
//更新首次下单时间
if
(
fcorder_time
==
0
){
bom_extend_sql
:=
"update lie_bom_extend set company_name= ? where bom_id = ?"
_
=
tx
.
MustExec
(
bom_extend_sql
,
companyName
,
BomId
)
}
}
...
...
@@ -137,6 +148,17 @@ func BuildBomOrder(orderBomData *CreateOrderBomData) (err error){
}
func
findUserCompany
(
user_id
int64
)
string
{
var
company
string
sql
:=
"select tax_title from lie_taxinfo where user_id=? and tax_title != '' order by tax_id desc "
db
.
DB
.
Get
(
&
company
,
sql
,
user_id
)
if
company
==
""
{
sql
:=
"select com_name from lie_user_company where user_id=? "
db
.
DB
.
Get
(
&
company
,
sql
,
user_id
)
}
return
company
}
func
getBomMatchTable
(
bom_id
int64
)
string
{
bom_idstr
:=
strconv
.
FormatInt
(
bom_id
,
10
)
...
...
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