소스 검색

Merge branch 'chart/11.2' into debug

Roc 2 년 전
부모
커밋
8080450970
7개의 변경된 파일78개의 추가작업 그리고 5개의 파일을 삭제
  1. 4 0
      models/data_manage/edb_data_base.go
  2. 2 2
      models/report_view.go
  3. 3 0
      services/data/base_edb_lib.go
  4. 58 0
      services/data/edb_info.go
  5. 1 1
      services/report_view.go
  6. 3 1
      services/task.go
  7. 7 1
      utils/constants.go

+ 4 - 0
models/data_manage/edb_data_base.go

@@ -73,6 +73,10 @@ func GetEdbDataTableName(source int) (tableName string) {
 		tableName = "edb_data_predict_calculate_tcz"
 	case utils.DATA_SOURCE_MYSTEEL_CHEMICAL:
 		tableName = "edb_data_mysteel_chemical"
+	case utils.DATA_SOURCE_CALCULATE_CJJX:
+		tableName = "edb_data_calculate_cjjx"
+	case utils.DATA_SOURCE_EIA_STEO:
+		tableName = "edb_data_eia_steo"
 	default:
 		tableName = ""
 		errors.New("无效的渠道:" + strconv.Itoa(source))

+ 2 - 2
models/report_view.go

@@ -80,7 +80,7 @@ func GetRddpReportViewersDetail(startTime, endTime string) (items []*ResearchRep
 			WHERE uvh.create_time >?
             AND uvh.create_time <=?
 			AND c.company_id NOT IN (1)
-			AND r.classify_name_first not in ("周报","双周报","月报","数据点评","会议纪要","年报合集","需求报告")
+			AND r.classify_name_first not in ("周报","大宗商品","月报","数据点评","会议纪要","年报合集","需求报告")
 			ORDER BY uvh.create_time DESC
 `
 	o := orm.NewOrm()
@@ -136,7 +136,7 @@ FROM
 			WHERE uvh.create_time >?
             AND uvh.create_time <=?
 			AND c.company_id NOT IN (1)
-			AND r.classify_name_first = "双周报"
+			AND r.classify_name_first = "大宗商品"
 			ORDER BY uvh.create_time DESC
 `
 	o := orm.NewOrm()

+ 3 - 0
services/data/base_edb_lib.go

@@ -102,6 +102,9 @@ func RefreshEdbData(edbInfoId, source int, edbCode, startDate string) (resp *mod
 		urlStr = "google_travel/refresh"
 	case utils.DATA_SOURCE_MYSTEEL_CHEMICAL:
 		urlStr = "mysteel_chemical/refresh"
+		urlStr = "mysteel_chemical/refresh"
+	case utils.DATA_SOURCE_EIA_STEO:
+		urlStr = "eia_steo/refresh"
 	}
 	if urlStr == "" {
 		err = fmt.Errorf(fmt.Sprint("source:", source, ";未实现该指标的刷新接口,请联系管理员"))

+ 58 - 0
services/data/edb_info.go

@@ -1790,3 +1790,61 @@ func RefreshDataFromMysteelChemical(wg *sync.WaitGroup) (err error) {
 	}
 	return err
 }
+
+// RefreshDataFromEiaSteo 刷新eia steo 报告数据
+func RefreshDataFromEiaSteo(wg *sync.WaitGroup) (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println("RefreshDataFromEiaSteo Err:" + err.Error())
+			//go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "RefreshDataFromGl ErrMsg:"+err.Error(), utils.EmailSendToUsers)
+			go alarm_msg.SendAlarmMsg("RefreshDataFromEiaSteo ErrMsg:"+err.Error(), 3)
+		}
+		wg.Done()
+	}()
+	var condition string
+	var pars []interface{}
+	condition += " AND source=? "
+	pars = append(pars, utils.DATA_SOURCE_EIA_STEO)
+	items, err := data_manage.GetEdbInfoByCondition(condition, pars, 0)
+	if err != nil {
+		return errors.New("GetEdbInfoByCondition:" + err.Error())
+	}
+
+	//var endDate string
+	//endDate = time.Now().AddDate(utils.DATA_END_DATE_LIMIT, 0, 0).Format(utils.FormatDateUnSpace)
+	for _, v := range items {
+		startDate := ""
+		if v.Frequency == "日度" {
+			startDate = v.EndDate.AddDate(0, 0, -utils.DATA_REFRESH).Format(utils.FormatDate)
+		} else if v.Frequency == "周度" {
+			startDate = v.EndDate.AddDate(0, 0, -(utils.DATA_REFRESH * 7)).Format(utils.FormatDate)
+		} else if v.Frequency == "月度" {
+			startDate = v.EndDate.AddDate(0, -utils.DATA_REFRESH, 0).Format(utils.FormatDate)
+		} else if v.Frequency == "季度" {
+			startDate = v.EndDate.AddDate(0, -utils.DATA_REFRESH*3, 0).Format(utils.FormatDate)
+		} else if v.Frequency == "年度" {
+			startDate = v.EndDate.AddDate(-utils.DATA_REFRESH, 0, 0).Format(utils.FormatDate)
+		} else {
+			startDate = v.EndDate.AddDate(0, 0, -utils.DATA_REFRESH).Format(utils.FormatDate)
+		}
+
+		resp, err := RefreshEdbData(v.EdbInfoId, v.Source, v.EdbCode, startDate)
+		if err != nil {
+			return errors.New("RefreshDataFromEiaSteoData Err:" + err.Error())
+		}
+		if resp.Ret != 200 {
+			return errors.New("RefreshDataFromEiaSteoData Err:" + resp.Msg + ";ErrMsg:" + resp.ErrMsg)
+		}
+		//item, err := data_manage.GetEdbInfoMaxAndMinInfo(v.Source, v.EdbCode)
+		//if err != nil {
+		//	return err
+		//}
+		//if item != nil {
+		//	err = data_manage.ModifyEdbInfoMaxAndMinInfo(v.EdbInfoId, item)
+		//	if err != nil {
+		//		return err
+		//	}
+		//}
+	}
+	return err
+}

+ 1 - 1
services/report_view.go

@@ -255,7 +255,7 @@ func ReportViewDetail() (err error) {
 				cellE := row.AddCell()
 				cellE.Value = item.ClassifyNameSecond
 				cellF := row.AddCell()
-				cellF.Value = `双周报`
+				cellF.Value = `大宗商品`
 			}
 			continue
 		} else if v.TypeName == `月报` {

+ 3 - 1
services/task.go

@@ -236,7 +236,7 @@ func OneMinute(cont context.Context) (err error) {
 
 func RefreshData(cont context.Context) (err error) {
 	wg := sync.WaitGroup{}
-	wg.Add(12)
+	wg.Add(13)
 	//hour := time.Now().Hour()
 	//if hour != 0 {
 	//}
@@ -263,6 +263,8 @@ func RefreshData(cont context.Context) (err error) {
 	go data.RefreshDataFromGoogleTravel(&wg)
 	//钢联化工
 	go data.RefreshDataFromMysteelChemical(&wg)
+	//eia steo报告指标
+	go data.RefreshDataFromEiaSteo(&wg)
 
 	wg.Wait()
 	////计算指标

+ 7 - 1
utils/constants.go

@@ -98,6 +98,8 @@ const (
 	DATA_SOURCE_PREDICT_CALCULATE_TBZ            //预测指标同比值->32
 	DATA_SOURCE_PREDICT_CALCULATE_TCZ            //预测指标同差值->33
 	DATA_SOURCE_MYSTEEL_CHEMICAL                 //钢联化工->34
+	DATA_SOURCE_CALCULATE_CJJX                   //超季节性->35
+	DATA_SOURCE_EIA_STEO                         //eia steo报告->36
 )
 
 //http://datawind.hzinsights.com:8040/hz_server
@@ -159,5 +161,9 @@ const (
 	TEMPLATE_MSG_YB_PRICE_DRIVEN                  //研报价格驱动 14
 	TEMPLATE_MSG_SEAL_FINISHED                    //用印申请已迁回通知 15
 	TEMPLATE_MSG_YB_COMMUNITY_VIDEO               //研报视频社区 16
-	TEMPLATE_MSG_YB_VOICE_BROADCAST               //研报语音播报 17
+	TEMPLATE_MSG_MOVE_SELLER                      //销售"移动/删除联系人"权限变更通知 17
+	TEMPLATE_MSG_YB_VOICE_BROADCAST               //研报语音播报 18
+	TEMPLATE_MSG_YB_VIDEO_UPLOAD                  //研报视频上传 19
+	TEMPLATE_MSG_YB_ROAD_VIDEO                    //研报线上路演 20
+	TEMPLATE_MSG_CYGX_ROADSHOW_VIDEO              //查研观向微路演视频 21
 )