作者 yangfu

fix: 计划同步修改

@@ -55,11 +55,11 @@ func (crontabService *CrontabService) initTask() { @@ -55,11 +55,11 @@ func (crontabService *CrontabService) initTask() {
55 autoTodayWorkshopPlanCompletionRecord := task.NewTask("定时刷新当天车间计划完成纪录", "0 0 1-23/1 * * *", AutoTodayWorkshopPlanCompletionRecord) // 1:00, 4:00, 每三个小时运行一次 55 autoTodayWorkshopPlanCompletionRecord := task.NewTask("定时刷新当天车间计划完成纪录", "0 0 1-23/1 * * *", AutoTodayWorkshopPlanCompletionRecord) // 1:00, 4:00, 每三个小时运行一次
56 task.AddTask("autoTodayWorkshopPlanCompletionRecord", autoTodayWorkshopPlanCompletionRecord) 56 task.AddTask("autoTodayWorkshopPlanCompletionRecord", autoTodayWorkshopPlanCompletionRecord)
57 57
58 - syncProductPlan := task.NewTask("定时同步车间计划", "0 */5 * * * *", SyncProductPlan)  
59 - task.AddTask("SyncProductPlan", syncProductPlan)  
60 -  
61 - syncProduct := task.NewTask("定时同步产品信息", "0 */30 * * * *", SyncProduct) 58 + syncProduct := task.NewTask("定时同步产品信息", "0 0 * * * *", SyncProduct)
62 task.AddTask("syncProduct", syncProduct) 59 task.AddTask("syncProduct", syncProduct)
  60 +
  61 + syncProductPlan := task.NewTask("定时同步车间计划", "0 5 * * * *", SyncProductPlan)
  62 + task.AddTask("SyncProductPlan", syncProductPlan)
63 } 63 }
64 64
65 func (crontabService *CrontabService) StartCrontabTask() { 65 func (crontabService *CrontabService) StartCrontabTask() {
@@ -6,7 +6,7 @@ import ( @@ -6,7 +6,7 @@ import (
6 "github.com/linmadan/egglib-go/transaction/pg" 6 "github.com/linmadan/egglib-go/transaction/pg"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/syncdata" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/syncdata"
9 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/redis" 9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils"
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log"
11 "runtime/debug" 11 "runtime/debug"
12 "time" 12 "time"
@@ -45,7 +45,8 @@ func SyncProduct(ctx context.Context) error { @@ -45,7 +45,8 @@ func SyncProduct(ctx context.Context) error {
45 } 45 }
46 } 46 }
47 if fromTime.IsZero() { 47 if fromTime.IsZero() {
48 - fromTime, err = redis.GetLastFetchTime(redis.MaterialK3cloudFetchTimeKey()) 48 + // fromTime, err = redis.GetLastFetchTime(redis.MaterialK3cloudFetchTimeKey())
  49 + fromTime = utils.GetZeroTime(time.Now()).Add(-time.Hour * 24) //前一天有修改的记录
49 if err != nil { 50 if err != nil {
50 log.Logger.Error(err.Error()) 51 log.Logger.Error(err.Error())
51 return nil 52 return nil
@@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/domainService" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/domainService"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/redis" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/redis"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log"
9 "strconv" 10 "strconv"
10 "strings" 11 "strings"
@@ -483,10 +484,11 @@ func (srv *PullDataK3CloudService) SyncDataProductPlan(ptr *pgTransaction.Transa @@ -483,10 +484,11 @@ func (srv *PullDataK3CloudService) SyncDataProductPlan(ptr *pgTransaction.Transa
483 3.查询是否有重复的批次号 484 3.查询是否有重复的批次号
484 4.有进行更新,其他的插入 485 4.有进行更新,其他的插入
485 */ 486 */
486 - lastTime, err := redis.GetLastFetchTime()  
487 - if err != nil {  
488 - return err  
489 - } 487 + //lastTime, err := redis.GetLastFetchTime()
  488 + //if err != nil {
  489 + // return err
  490 + //}
  491 + var lastTime = utils.GetZeroTime(time.Now()).Add(-time.Hour * 24) //前一天有修改的记录
490 if !fromTime.IsZero() { 492 if !fromTime.IsZero() {
491 lastTime = fromTime 493 lastTime = fromTime
492 } 494 }