Commit c07ab32e by mushishixian

整合启动

parent 43f08466
......@@ -3,6 +3,9 @@ package main
import (
"github.com/imroc/req"
"scm_server/cmd/queue/sync_customer"
"scm_server/cmd/queue/sync_goods"
"scm_server/cmd/queue/sync_in_store"
"scm_server/cmd/queue/sync_out_store"
"scm_server/cmd/queue/sync_supplier"
"scm_server/configs"
"time"
......@@ -38,6 +41,7 @@ func pushAlive() {
}
payload = append(payload, item)
param := req.BodyJSON(&payload)
req.Debug = false
url = configs.OpenFalconPushUrl
_, err = req.Post(url, param)
if err != nil {
......@@ -48,6 +52,10 @@ func pushAlive() {
func main() {
go sync_customer.Sync()
go sync_supplier.Sync()
go sync_goods.Sync()
go sync_in_store.Sync()
go sync_out_store.Sync()
//定时请求open falcon证明自己没挂
for {
pushAlive()
time.Sleep(5 * time.Second)
......
......@@ -83,7 +83,6 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
if err = SyncCustomerData(operateType, customer); err != nil {
goto ERR
}
fmt.Println("同步成功,开始发送金蝶状态同步")
if err = product.SyncErpStatus("customer", customer.ErpId); err != nil {
goto ERR
}
......@@ -180,6 +179,11 @@ func (t *RecvPro) FailAction(dataByte []byte) error {
}
func Sync() {
defer func() {
if err := recover(); err != nil {
service.SendDingTalkRobotToApi(fmt.Sprintf("%s", err))
}
}()
t := &RecvPro{}
rabbitmq.Recv(rabbitmq.QueueExchange{
"store_customer",
......
package main
package sync_goods
import (
"encoding/json"
......@@ -86,7 +86,6 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
if err = SyncGoodsData(operateType, goods); err != nil {
goto ERR
}
fmt.Println("同步成功,开始发送金蝶状态同步")
if err = product.SyncErpStatus("material", goods.ErpId); err != nil {
goto ERR
}
......@@ -183,7 +182,12 @@ func (t *RecvPro) FailAction(dataByte []byte) error {
return nil
}
func main() {
func Sync() {
defer func() {
if err := recover(); err != nil {
service.SendDingTalkRobotToApi(fmt.Sprintf("%s", err))
}
}()
t := &RecvPro{}
rabbitmq.Recv(rabbitmq.QueueExchange{
"store_goods",
......
package main
package sync_goods
import (
"encoding/json"
......
package main
package sync_in_store
import (
"encoding/json"
......@@ -107,7 +107,6 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
goto ERR
}
}
fmt.Println("同步成功,开始发送金蝶状态同步")
if err = product.SyncErpStatus("inStore", inStore.BillId); err != nil {
goto ERR
}
......@@ -250,7 +249,7 @@ func (t *RecvPro) FailAction(dataByte []byte) error {
return nil
}
func main() {
func Sync() {
t := &RecvPro{}
rabbitmq.Recv(rabbitmq.QueueExchange{
"store_in",
......
package main
package sync_in_store
import (
"encoding/json"
......
package main
package sync_out_store
import (
"encoding/json"
......@@ -108,7 +108,6 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
goto ERR
}
}
fmt.Println("同步成功,开始发送金蝶状态同步")
if err = product.SyncErpStatus("outStore", outStore.BillId); err != nil {
goto ERR
}
......@@ -209,12 +208,12 @@ func TransformParams(message OutStoreMessage) (params map[string]interface{}) {
"receive_user_name": message.Data.FRecPerson,
"receive_tel": message.Data.FRecPersonContact,
"erp_out_store_id": message.Data.FSourceBillID,
"erp_client_sn": message.Data.FPrincipalNo,
"remark": message.Data.Remark,
"erp_store_sn": message.Data.FWarehouseNo,
"warehousing_sn": message.Data.FEntrustBillNo,
"is_apply_customs": isApplyCustoms,
"out_store_detail": outStoreDetail,
"erp_client_sn": message.Data.FPrincipalNo,
"remark": message.Data.Remark,
"erp_store_sn": message.Data.FWarehouseNo,
"warehousing_sn": message.Data.FEntrustBillNo,
"is_apply_customs": isApplyCustoms,
"out_store_detail": outStoreDetail,
}
return
}
......@@ -224,7 +223,7 @@ func (t *RecvPro) FailAction(dataByte []byte) error {
return nil
}
func main() {
func Sync() {
t := &RecvPro{}
rabbitmq.Recv(rabbitmq.QueueExchange{
"store_out",
......
package main
package sync_out_store
import (
"encoding/json"
......
......@@ -39,7 +39,6 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
goto ERR
}
//得到message以后,去请求金蝶的接口
fmt.Println("请求金蝶接口")
if err = SyncErpDataStatus(message.SyncName, message.ErpId); err != nil {
goto ERR
}
......
......@@ -180,6 +180,11 @@ func (t *RecvPro) FailAction(dataByte []byte) error {
}
func Sync() {
defer func() {
if err := recover(); err != nil {
service.SendDingTalkRobotToApi(fmt.Sprintf("%s", err))
}
}()
t := &RecvPro{}
rabbitmq.Recv(rabbitmq.QueueExchange{
"store_supplier",
......
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 sign in to comment