|
@@ -262,6 +262,56 @@ func IndexRefreshMethanol() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+func IndexRefreshTimely() {
|
|
|
+ fmt.Println("IndexRefreshTimely")
|
|
|
+ go alarm_msg.SendAlarmMsg(utils.APPNAME+" 及时刷新指标", 3)
|
|
|
+
|
|
|
+ indexObj := new(index.BaseFromMysteelChemicalIndex)
|
|
|
+ list, err := indexObj.GetIndexRefreshMethanolByTimely()
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("GetIndexRefreshAll Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println("listLen:", len(list))
|
|
|
+ if len(list) <= 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ now := time.Now()
|
|
|
+ month := int(now.Month())
|
|
|
+ day := now.Day()
|
|
|
+ week := int(now.Weekday())
|
|
|
+ for _, v := range list {
|
|
|
+ rn := utils.GetRandInt(1, 10)
|
|
|
+ time.Sleep(time.Duration(rn) * time.Second)
|
|
|
+ time.Sleep(3 * time.Second)
|
|
|
+ if v.Frequency == "年度" {
|
|
|
+ if month == 1 && day == 1 {
|
|
|
+ MysteelChemicalRefresh(v.MergeFilePath)
|
|
|
+ }
|
|
|
+ } else if v.Frequency == "季度" {
|
|
|
+ if (month == 1 || month == 4 || month == 7 || month == 10) && day == 1 {
|
|
|
+ MysteelChemicalRefresh(v.MergeFilePath)
|
|
|
+ }
|
|
|
+ } else if v.Frequency == "月度" {
|
|
|
+ if day == 1 {
|
|
|
+ MysteelChemicalRefresh(v.MergeFilePath)
|
|
|
+ }
|
|
|
+ } else if v.Frequency == "周度" {
|
|
|
+ if week > 2 && week < 6 {
|
|
|
+ MysteelChemicalRefresh(v.MergeFilePath)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if week < 6 {
|
|
|
+ MysteelChemicalRefresh(v.MergeFilePath)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
var lock sync.RWMutex
|
|
|
|
|
|
//刷新周度指标数据
|