Commit b459f35d by Joneq

重新同步订单

parent 1cb0089d
Showing with 36 additions and 17 deletions
......@@ -7,7 +7,6 @@ import (
"github.com/ichunt2019/cfg/lib"
"github.com/tidwall/gjson"
"golang-asynctask/app/dao/scm_data_dao"
"runtime"
"sync"
"time"
"xorm.io/xorm"
......@@ -49,22 +48,42 @@ func init(){
var currentDatetime int64
//同步海关信息至中间库
//func main() {
// runtime.GOMAXPROCS(5)
// //获取当天时间
// var currentDate = time.Now().Format("2006-01-02")
// //获取当前时间
// currentDatetime = getSysLogLastTIme(scm_data_dao.GetScmDataDb())
// fmt.Println(currentDatetime)
//
// //删除订单
// deleteOrder(currentDate)
//
// for _,v := range syncTable {
// wg.Add(1)
// go handleCurrentTable(v,currentDate)
// }
// wg.Wait()
//}
func main() {
runtime.GOMAXPROCS(5)
//获取当天时间
var currentDate = time.Now().Format("2006-01-02")
//获取当前时间
currentDatetime = getSysLogLastTIme(scm_data_dao.GetScmDataDb())
fmt.Println(currentDatetime)
//删除订单
deleteOrder(currentDate)
for _,v := range syncTable {
wg.Add(1)
go handleCurrentTable(v,currentDate)
sqlDb := scm_data_dao.GetScmDataDb()
sqlDb.Exec("truncate Ent_balance_sheet")
sqlDb.Exec("truncate Ent_cash_flow")
sqlDb.Exec("truncate Ent_profit")
sqlDb.Exec("truncate Purchase_Order")
sqlDb.Exec("truncate SYS_OPERATE_LOG")
var startTime int64 = 1577808000
var nowtime = time.Now().Unix()
for startTime < nowtime {
currentDate := time.Unix(startTime,0).Format("2006-01-02")
for _,v := range syncTable {
handleCurrentTable(v,currentDate)
}
startTime+=86400
}
wg.Wait()
}
......@@ -97,9 +116,9 @@ func deleteOrder(currentDate string) {
//处理当前的这个表任务
func handleCurrentTable(tableName,currentDate string) {
defer wg.Done()
//defer wg.Done()
fmt.Println(currentDate+"开始同步"+tableName)
//fmt.Println(currentDate+"开始同步"+tableName)
currentJson := requestTableInfo(tableName,currentDate)
if currentJson == "" {
......
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