Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wang
/
go_supplier_task
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
46e21aca
authored
Mar 16, 2021
by
wang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新增供应商系新增字段
parent
3619e948
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
9 deletions
cmd/cron/merge/cron.go
conf/dev/database.ini
readme.md
resources/erpSupplierZy.csv
service/service_erp.go
service/service_ly.go
service/service_mapping.go
service/supplier_common_service.go
cmd/cron/merge/cron.go
View file @
46e21aca
...
...
@@ -22,9 +22,14 @@ func main() {
if
err
:=
boot
.
Boot
(
path
);
err
!=
nil
{
panic
(
err
)
}
//service.NewServiceLy().Merger()
//service.NewErpService().SyncErp()
//return
//service.NewServiceSupplier().MergerCriteria()
//service.NewServiceSupplier().MappingHandle(2)
//return
//return
//return
switch
taskName
{
case
"supplierMerge"
:
fmt
.
Println
(
"供应商合并"
)
...
...
conf/dev/database.ini
View file @
46e21aca
[xorm]
ShowSQL
=
fals
e
ShowSQL
=
tru
e
[pool_class]
user_name
=
root
...
...
readme.md
View file @
46e21aca
...
...
@@ -18,6 +18,8 @@ go build -o ./cmd/cron/merge/cron ./cmd/cron/merge/cron.go
./cmd/cron/merge/cron -config=./conf/prod/ -taskName=lyMapping
##### 5.运行 同步到ERP脚本处理(将标准供应商压入到队列)
./cmd/cron/merge/cron -config=./conf/prod/ -taskName=erpSkuMerge
##### 6运行 联营sku同步
./cmd/cron/merge/cron -config=./conf/prod/ -taskName=lySkuMerge
...
...
resources/erpSupplierZy.csv
View file @
46e21aca
3629,深圳市弘安盛电子有限公司,深圳市弘安盛电子有限公司,D0000724,
韦燕
,代理,2021-02-25
3629,深圳市弘安盛电子有限公司,深圳市弘安盛电子有限公司,D0000724,
易敏
,代理,2021-02-25
3858,福州新拓电子有限公司,福州新拓电子有限公司,D0000383,王秋,代理,2021-02-25
4831,深圳市信宏泰电子有限公司,深圳市信宏泰电子有限公司,0030000018,朱玉嘉,代理,2021-02-25
1612,深圳视创盈科技有限公司,深圳视创盈科技有限公司,M0001606,王秋,贸易商,2021-02-24
...
...
service/service_erp.go
View file @
46e21aca
...
...
@@ -51,9 +51,9 @@ func NewErpService() *ErpService{
func
(
this
*
ErpService
)
SyncErp
()
{
dbSpu
:=
mysql
.
Conn
(
"supp"
)
//spu实例化链接
poolSupplierEntity
:=&
PoolSupplierEntity
{}
supplierId
:=
int64
(
0
)
for
{
poolSupplierEntity
:=&
PoolSupplierEntity
{}
count
:=
0
rows
,
err
:=
dbSpu
.
Table
(
"lie_supplier_channel"
)
.
Where
(
"is_type=? and status in (?,?) and supplier_id>? "
,
0
,
2
,
-
2
,
supplierId
)
.
Limit
(
10
)
.
Rows
(
poolSupplierEntity
)
if
err
!=
nil
{
...
...
@@ -106,11 +106,15 @@ func (this *ErpService) pushErp(poolSupplierEntity *PoolSupplierEntity) {
pushErpData
[
"address"
]
=
poolSupplierEntity
.
SupplierAddress
has
,
contactInfo
:=
this
.
GetContact
(
poolSupplierEntity
.
SupplierId
)
if
(
!
has
){
pushErpData
[
"contactPerson"
]
=
""
pushErpData
[
"phone"
]
=
""
common
.
PrintStdout
()
.
Printf
(
"supplierID:%d,没有找到对应的contact 数据"
,
poolSupplierEntity
.
SupplierId
)
}
else
{
pushErpData
[
"contactPerson"
]
=
contactInfo
[
"supplier_consignee"
]
pushErpData
[
"phone"
]
=
contactInfo
[
"supplier_telephone"
]
}
pushErpData
[
"contactPerson"
]
=
contactInfo
[
"supplier_consignee"
]
pushErpData
[
"phone"
]
=
contactInfo
[
"supplier_telephone"
]
pushErpData
[
"groupNumber"
]
=
gconv
.
String
(
SupplierGroup
[
poolSupplierEntity
.
SupplierGroup
])
bytes
,
err
:=
json
.
Marshal
(
pushErpData
)
...
...
@@ -138,8 +142,7 @@ func (this *ErpService) GetContact(supplierId int64) ( bool, map[string]string )
if
(
len
(
res
)
>
0
){
return
true
,
res
[
0
]
}
else
{
return
false
,
res
[
0
]
return
false
,
nil
}
}
...
...
service/service_ly.go
View file @
46e21aca
...
...
@@ -32,6 +32,8 @@ func NewServiceLy() (*ServiceLy) {
}
func
(
this
*
ServiceLy
)
Merger
()
{
//this.testMongo()
//return
maxNumTable
:=
10
maxNumDataBase
:=
10
for
dataBaseNum
:=
0
;
dataBaseNum
<
maxNumDataBase
;
dataBaseNum
++
{
...
...
@@ -240,6 +242,15 @@ func (this *ServiceLy) insertRedisSkuInfo(goodsId string, redisSkuInfoMap map[s
}
}
func
(
this
*
ServiceLy
)
testMongo
()
{
update
:=
bson
.
M
{
"canal"
:
"skdfjklsdjf"
}
err
:=
skuCache
.
MongoUpdateSku
(
"123"
,
update
)
if
(
err
!=
nil
){
//msg:=fmt.Sprintf("%s 修改mongosku数据出错,goodsId:%s,err:%s,updateData:%s",LyTaskName,lySkuEntity.GoodsId,err.Error(),update)
//syncLog.SyncInsertLog("ly_merger",msg)
panic
(
err
.
Error
())
}
}
//记录日志
...
...
service/service_mapping.go
View file @
46e21aca
...
...
@@ -47,6 +47,7 @@ func (this *ServiceSupplier)MappingHandle(MappingType int) {
csvPath
=
this
.
getResourcesPath
()
+
"/zySupplier.csv"
break
case
4
:
//金蝶erp联营
MappingType
=
2
TaskName
=
"[整合ERP联营映射]"
common
.
PrintStdout
()
.
Printf
(
"[整合ERP联营映射]开始
\n
"
)
csvPath
=
this
.
getResourcesPath
()
+
"/erpSupplierLy.csv"
...
...
@@ -142,7 +143,10 @@ func (this *ServiceSupplier) GetStatus2SupplierInfo(supplierName string,purchase
channelUidString
=
php2go
.
Implode
(
","
,
channelUidS
)
poolSupplierEntity
.
ChannelUid
=
channelUidString
//end
//新增人
poolSupplierEntity
.
CreateUid
=
1000
poolSupplierEntity
.
CreateName
=
"admin"
//end
poolSupplierEntity
.
SupplierGroup
=
gconv
.
Int
(
SupplierGroupCn
[
groupName
])
//修改
_
,
err
=
dbSpu
.
Table
(
"lie_supplier_channel"
)
.
Where
(
"supplier_id=?"
,
poolSupplierEntity
.
SupplierId
)
.
Update
(
&
poolSupplierEntity
)
...
...
service/supplier_common_service.go
View file @
46e21aca
...
...
@@ -25,7 +25,10 @@ type PoolSupplierEntity struct {
SupplierGroup
int
`json:"supplier_group" `
//分组
IsType
int
`json:"is_type"`
//'1假 0真',
UpdateTime
int
`json:"update_time" xorm:"updated"`
CreateTime
int
`json:"create_time" xorm:"created"`
CreateName
string
`json:"create_name" `
CreateUid
int
`json:"create_uid" `
}
//映射表
...
...
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