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
bf308296
authored
May 11, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整发票公司
parent
0cfaa07d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
11 deletions
config/db.toml.pro.demo
dal/db/db.go
dal/user/InvoiceCompany/InvoiceCompany.go
user/company/main.go
util/config.go
config/db.toml.pro.demo
View file @
bf308296
...
...
@@ -8,6 +8,9 @@ dns="LabxsuT:Plz2#$afsPqmz@#5@tcp(172.18.137.34:3306)/lie_labels?parseTime=true"
[Liexincms_databases]
dns="dtuser:dAtaL#ym2902m2lLX2y33@tcp(appdb-master.ichunt.db:3306)/icdata?parseTime=true"
[Liexincrm_databases]
dns="dtuser:LxCrmUser#xUTmu0XsdUqoZIim2y@tcp(172.18.137.21:3306)/liexin_crm?parseTime=true"
[Bom_databases]
dns="BomUserIc:mLssyDxmsymBomy@tcp(172.18.137.21:3306)/liexin_bom?parseTime=true"
...
...
dal/db/db.go
View file @
bf308296
...
...
@@ -9,6 +9,7 @@ var (
DB
*
sqlx
.
DB
LabelDB
*
sqlx
.
DB
CmsDB
*
sqlx
.
DB
CrmDB
*
sqlx
.
DB
BomDB
*
sqlx
.
DB
)
...
...
@@ -74,6 +75,22 @@ func InitCmslDB(dns string) error{
return
nil
}
func
InitCrmDB
(
dns
string
)
error
{
var
err
error
CrmDB
,
err
=
sqlx
.
Open
(
"mysql"
,
dns
)
if
err
!=
nil
{
return
err
}
err
=
CrmDB
.
Ping
()
if
err
!=
nil
{
return
err
}
CrmDB
.
SetMaxOpenConns
(
20
)
CrmDB
.
SetMaxIdleConns
(
10
)
return
nil
}
func
CreateDB
(
action
string
,
dns
string
)
error
{
var
err
error
switch
action
{
...
...
@@ -83,8 +100,10 @@ func CreateDB(action string,dns string) error{
err
=
InitLabelDB
(
dns
)
case
"InitCmsDB"
:
err
=
InitCmslDB
(
dns
)
case
"InitCmsDB"
:
err
=
InitCrmDB
(
dns
)
case
"BomDB"
:
err
=
InitBomDB
(
dns
)
err
=
InitBomDB
(
dns
)
}
return
err
}
...
...
dal/user/InvoiceCompany/InvoiceCompany.go
View file @
bf308296
package
InvoiceCompany
import
(
_
"encoding/json"
_
"github.com/ichunt2019/logger"
)
type
Company
struct
{
Id
int
`db:"id"`
CompanyType
int
`db:"company_type"`
ComSn
string
`db:"com_sn"`
ErpComSn
string
`db:"erp_com_sn"`
ComName
string
`db:"com_name"`
UserId
int
`db:"user_id"`
TaxId
int
`db:"tax_id"`
ComName
string
`db:"com_name"`
OverseasComNameCn
string
`db:"overseas_com_name_cn"`
ComAddr
string
`db:"com_addr"`
ComTel
string
`db:"com_tel"`
ComTaxRegistration
string
`db:"com_tax_registration"`
...
...
@@ -42,4 +38,5 @@ type Company struct {
Status
int
`db:"status"`
CreateTime
int
`db:"create_time"`
UpdateTime
int
`db:"update_time"`
ComCnName
string
`db:"com_cn_name"`
}
user/company/main.go
View file @
bf308296
...
...
@@ -15,7 +15,7 @@ import (
)
func
initDb
(
dns
string
)
(
err
error
)
{
err
=
db
.
Init
(
dns
)
err
=
db
.
Init
CrmDB
(
dns
)
if
err
!=
nil
{
return
}
...
...
@@ -49,7 +49,7 @@ func main() {
logger
.
Init
()
//初始化db
initDb
(
util
.
Configs
.
Liexin_databases
.
Dns
)
initDb
(
util
.
Configs
.
Liexin
crm
_databases
.
Dns
)
updateData
()
...
...
@@ -59,7 +59,7 @@ func main() {
// 修改DB
func
updateData
()
(
err
error
)
{
// 获取未评分的公司
row
,
err
:=
db
.
DB
.
Queryx
(
"select * from lie_invoice_company where total_credit_score = 0"
)
row
,
err
:=
db
.
Crm
DB
.
Queryx
(
"select * from lie_invoice_company where total_credit_score = 0"
)
if
err
!=
nil
{
logger
.
Info
(
"获取未评分公司失败,DB错误原因: "
,
err
.
Error
())
...
...
@@ -99,7 +99,7 @@ func updateData() (err error) {
curr_time
:=
time
.
Now
()
.
Unix
()
// 更新发票公司表
_
,
err
=
db
.
DB
.
Exec
(
"update lie_invoice_company set erp_com_sn = ?, com_addr = ?, establishment_time = ?, registered_capital = ?, com_organization = ?,"
+
_
,
err
=
db
.
Crm
DB
.
Exec
(
"update lie_invoice_company set erp_com_sn = ?, com_addr = ?, establishment_time = ?, registered_capital = ?, com_organization = ?,"
+
"legal_representative = ?, five_legal_change = ?, two_years_no_lawsuit = ?, total_credit_score = ?, ichunt_hunting_core = ?, blacklist_hit = ?, "
+
"risk_type = ?, update_time = ? where com_name = ?"
,
erp_com_sn
,
com_addr
,
establishment_time
,
registered_capital
,
com_organization
,
legal_representative
,
five_legal_change
,
two_years_no_lawsuit
,
total_credit_score
,
ichunt_hunting_core
,
blacklist_hit
,
risk_type
,
curr_time
,
company
.
ComName
)
...
...
util/config.go
View file @
bf308296
...
...
@@ -9,6 +9,7 @@ type Config struct {
Liexin_databases
*
LiexinMysqlConfig
LiexinLabel_databases
*
LiexinLabelMysqlConfig
Liexincms_databases
*
LiexinCmsMysqlConfig
Liexincrm_databases
*
LiexinCrmMysqlConfig
Bom_databases
*
BomDatabasesMysqlConfig
Special_databases
*
SpecialDatabasesMysqlConfig
Mongo_config
*
MongoConn
...
...
@@ -35,6 +36,9 @@ type LiexinLabelMysqlConfig struct {
type
LiexinCmsMysqlConfig
struct
{
Dns
string
`toml:"dns"`
}
type
LiexinCrmMysqlConfig
struct
{
Dns
string
`toml:"dns"`
}
type
BomDatabasesMysqlConfig
struct
{
Dns
string
`toml:"dns"`
...
...
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