|
@@ -4,6 +4,7 @@ import (
|
|
|
"data_tidb/config"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
+ "github.com/robfig/cron"
|
|
|
"github.com/spf13/cobra"
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
|
"go.uber.org/zap"
|
|
@@ -19,6 +20,8 @@ import (
|
|
|
|
|
|
var (
|
|
|
UdpClient udp.UdpClient
|
|
|
+
|
|
|
+ Pici int64
|
|
|
)
|
|
|
|
|
|
func init() {
|
|
@@ -338,7 +341,6 @@ func relation() *cobra.Command {
|
|
|
// @Description 项目数据(目前仅关系表数据)
|
|
|
// @Author J 2022/9/20 17:52
|
|
|
func projectAdd() *cobra.Command {
|
|
|
- var pici int64
|
|
|
cmdClient := &cobra.Command{
|
|
|
Use: "project",
|
|
|
Short: "Start processing project data",
|
|
@@ -347,10 +349,18 @@ func projectAdd() *cobra.Command {
|
|
|
//go SaveProTagFunc()
|
|
|
//go SaveProbFunc()
|
|
|
go SaveRelationFunc()
|
|
|
- taskPAdd(pici)
|
|
|
+
|
|
|
+ taskPAdd()
|
|
|
+
|
|
|
+ crn := cron.New()
|
|
|
+ cronstr := "0 10 * * * *" // 每30min执行一次
|
|
|
+ _ = crn.AddFunc(cronstr, func() {
|
|
|
+ taskPAdd()
|
|
|
+ })
|
|
|
+ crn.Start()
|
|
|
},
|
|
|
}
|
|
|
- cmdClient.Flags().Int64VarP(&pici, "pici", "p", 0, "")
|
|
|
+ cmdClient.Flags().Int64VarP(&Pici, "pici", "p", 0, "")
|
|
|
return cmdClient
|
|
|
}
|
|
|
|
|
@@ -788,7 +798,7 @@ func SaveRelationFunc() {
|
|
|
defer func() {
|
|
|
<-saveRelationSp
|
|
|
}()
|
|
|
- MysqlTool.InsertBulk("dws_f_bpmc_relation_new", RelationField, arru...)
|
|
|
+ MysqlTool.InsertBulk("dws_f_bpmc_relation", RelationField, arru...)
|
|
|
}(arru)
|
|
|
arru = make([]map[string]interface{}, saveSize)
|
|
|
indexu = 0
|
|
@@ -800,7 +810,7 @@ func SaveRelationFunc() {
|
|
|
defer func() {
|
|
|
<-saveRelationSp
|
|
|
}()
|
|
|
- MysqlTool.InsertBulk("dws_f_bpmc_relation_new", RelationField, arru...)
|
|
|
+ MysqlTool.InsertBulk("dws_f_bpmc_relation", RelationField, arru...)
|
|
|
}(arru[:indexu])
|
|
|
arru = make([]map[string]interface{}, saveSize)
|
|
|
indexu = 0
|