Przeglądaj źródła

Merge branch 'master' of http://8.136.199.33:3000/eta_server/eta_data_analysis into bzq/yongyi_new_data

zqbao 6 miesięcy temu
rodzic
commit
6b05140be6

+ 99 - 0
models/base_from_fenwei.go

@@ -58,3 +58,102 @@ type EdbLibFenweiIndexListResponse struct {
 	ErrCode string
 	Data    []BaseFromFenweiIndex
 }
+
+// RequestParams 接口爬取汾渭网页数据
+type RequestParams struct {
+	Category     interface{}         `json:"category"`
+	CheckedDims  map[string][]string `json:"checkedDims"`
+	DateRange    string              `json:"dateRange"`
+	ProductCode  string              `json:"productCode"`
+	QuotaName    string              `json:"quotaName"`
+	SplitTypeKey string              `json:"splitTypeKey"`
+	IsTotal      interface{}         `json:"isTotal"`
+	DataType     interface{}         `json:"dataType"`
+	Type         int                 `json:"type"`
+	IsSeason     int                 `json:"isSeason"`
+	splitTypeKey string              `json:"splitTypeKey"`
+}
+
+type Response struct {
+	Code    int    `json:"code"`
+	Message string `json:"message"`
+}
+
+type JsonConfig struct {
+	Data []string `json:"data"`
+}
+
+type FenWeiNetResponse struct {
+	MonthlyAccumulation        float64     `json:"monthly_accumulation"`
+	ProductItemCode            string      `json:"product_item_code"`
+	MonthlyValueChnName        string      `json:"monthly_value_chn_name"`
+	MonthlyAccumulationChnName string      `json:"monthly_accumulation_chn_name"`
+	ProductItemName            string      `json:"product_item_name"`
+	DataDate                   string      `json:"data_date"`
+	MonthlyValue               float64     `json:"monthly_value"`
+	MonthlyValueChnUnit        string      `json:"monthly_value_chn_unit"`
+	ProductCode                string      `json:"product_code"`
+	ProvinceName               string      `json:"province_name"`
+	MonthlyAccumulationChnUnit string      `json:"monthly_accumulation_chn_unit"`
+	PortName                   string      `json:"port_name"`
+	PortSonName                string      `json:"port_son_name"`
+	Stock                      float64     `json:"stock"`
+	StockChnName               string      `json:"stock_chn_name"`
+	StockChnUnit               string      `json:"stock_chn_unit"`
+	CoalTypeName               string      `json:"coal_type_name"`
+	WeekValueChnName           string      `json:"week_value_chn_name"`
+	WeekValue                  float64     `json:"week_value"`
+	AvaliableDaysChnName       string      `json:"avaliable_days_chn_name"`
+	AvaliableDaysChnUnit       string      `json:"avaliable_days_chn_unit"`
+	AvaliableDays              float64     `json:"avaliable_days"`
+	DailyConsumptionChnName    string      `json:"daily_consumption_chn_name"`
+	DailyConsumptionChnUnit    string      `json:"daily_consumption_chn_unit"`
+	DailyConsumption           float64     `json:"daily_consumption"`
+	InventoryIndexChnUnit      string      `json:"inventory_index_chn_unit"`
+	InventoryIndex             float64     `json:"inventory_index"`
+	TonsChnUnit                string      `json:"tons_chn_unit"`
+	Tons                       float64     `json:"tons"`
+	TransportVolumeChnUnit     string      `json:"transport_volume_chn_unit"`
+	TransportVolume            float64     `json:"transport_volume"`
+	PriceRmbChnName            string      `json:"price_rmb_chn_name"`
+	PriceIndexMomChnName       string      `json:"price_index_mom_chn_name"`
+	PriceRmbChnUnit            string      `json:"price_rmb_chn_unit"`
+	PriceIndexMomChnUnit       string      `json:"price_index_mom_chn_unit"`
+	PriceRmb                   interface{} `json:"price_rmb"`
+	PriceIndexMom              interface{} `json:"price_index_mom"`
+	VehicleChnUnit             string      `json:"vehicle_chn_unit"`
+	ShipChnUnit                string      `json:"ship_chn_unit"`
+	WeekValueChnUnit           string      `json:"week_value_chn_unit"`
+}
+
+type FenWeiNetResponseWrapper struct {
+	Data struct {
+		Data []FenWeiNetResponse `json:"data"`
+	} `json:"data"`
+}
+
+type FenWeiNetResponseMapWrapper struct {
+	Data struct {
+		Data map[string][]FenWeiNetResponse `json:"data"`
+	} `json:"data"`
+}
+
+type FenWeiNetResponseAStratumMapWrapper struct {
+	Data map[string][]FenWeiNetResponse `json:"data"`
+}
+
+type FenWeiNetResponseResult struct {
+	Product            string              `json:"product"`
+	FenWeiNetResponses []FenWeiNetResponse `json:"fenWeiNetResponses"`
+}
+
+type FenWeiNetIndexInfo struct {
+	IndexName string `description:"指标名称"`
+	//IndexCode    string  `description:"指标编码"`
+	Unit         string      `description:"单位"`
+	Frequency    string      `description:"频度"`
+	TerminalCode string      `description:"编码"`
+	ClassifyName string      `description:"分类名称"`
+	DataTime     string      `description:"数据时间"`
+	Value        interface{} `description:"数据值"`
+}

+ 20 - 0
models/base_from_oilchem.go

@@ -0,0 +1,20 @@
+package models
+
+import "time"
+
+type BaseFromOilchemIndex struct {
+	BaseFromOilchemIndexId int       // 主键ID
+	IndexCode              string    // 指标编码
+	IndexName              string    // 指标名称
+	ClassifyId             uint      // 分类ID
+	Unit                   string    // 单位
+	Frequency              string    // 频度
+	Describe               string    // 指标描述
+	DataTime               string    // 数据日期
+	Value                  string    // 数据值
+	Sort                   int       // 排序
+	CreateTime             time.Time // 创建时间
+	ModifyTime             time.Time // 修改时间
+	IndexNameStr           string    // 指标名称字符串
+	MarketName             string    // 市场名称
+}

+ 1 - 20
services/base_from_ccf/common.go

@@ -351,7 +351,7 @@ func savePageHtml(nameKey, saveDir string, historyPage bool, reportMax int) (fil
 			continue
 		}
 		outputPath := fmt.Sprintf("%s/%d-%s.html", dateDir, v.Page, v.Title)
-		if e = writeHTMLToFile(string(htm), outputPath); e != nil {
+		if e = utils.WriteHTMLToFile(string(htm), outputPath); e != nil {
 			utils.FileLog.Info(fmt.Sprintf("写入HTML出错, err: %v", e))
 			continue
 		}
@@ -419,25 +419,6 @@ func analysisReportHrefs(contents []byte, page int) (hrefs []ReportHrefs, err er
 	return
 }
 
-// writeHTMLToFile 将HTML内容写入指定的文件中
-func writeHTMLToFile(content string, filePath string) error {
-	// 使用os.Create创建文件,如果文件已存在则会被截断
-	file, err := os.Create(filePath)
-	if err != nil {
-		return err
-	}
-	defer func() {
-		_ = file.Close()
-	}()
-
-	// 将HTML内容写入文件
-	_, err = file.WriteString(content)
-	if err != nil {
-		return err
-	}
-
-	return nil
-}
 
 // extractReportPublishTime 提取报告发布时间
 func extractReportPublishTime(text string) (time.Time, error) {

+ 199 - 0
services/base_from_oilchem/common.go

@@ -0,0 +1,199 @@
+package services
+
+import (
+	"compress/gzip"
+	"encoding/json"
+	"eta/eta_data_analysis/utils"
+	"fmt"
+	"io"
+	"net/http"
+	"os"
+	"strings"
+	"time"
+)
+
+// savePageHtml 拉取历史报告详情
+func savePageHtml(nameKey, saveDir string, historyPage bool, reportMax int) (files []string, err error) {
+	if nameKey == "" {
+		return
+	}
+	defer func() {
+		if err != nil {
+			tips := fmt.Sprintf("GetOilchemEdbHistory ErrMsg: %s", err.Error())
+			utils.FileLog.Info(tips)
+			fmt.Println(tips)
+		}
+	}()
+	//fetchRule, e := loadDataRule(nameKey)
+	//if e != nil {
+	//	err = fmt.Errorf("loadDataRule, err: %v", e)
+	//	return
+	//}
+	if saveDir == "" {
+		saveDir = "static/ccf"
+	}
+
+	// 拉取报告留档
+	strDate := time.Now().Format("20060102")
+	url := "https://www.oilchem.net/24-0801-09-4036018c523e4bbc.html"
+	htm, e := FetchPageHtml(url)
+	if e != nil {
+		utils.FileLog.Info("获取页面失败, err: %v", e)
+	}
+	dateDir := fmt.Sprintf("%s/%s", saveDir, strDate)
+	if e = utils.MkDir(dateDir); e != nil {
+		utils.FileLog.Info(fmt.Sprintf("创建目录失败, err: %v", e))
+	}
+	outputPath := fmt.Sprintf("%s/%d-%s.html", dateDir, "", "")
+	if e = utils.WriteHTMLToFile(string(htm), outputPath); e != nil {
+		utils.FileLog.Info(fmt.Sprintf("写入HTML出错, err: %v", e))
+	}
+	files = append(files, outputPath)
+	fmt.Println("拉取报告 end")
+	return
+}
+
+// fetchPageHtml 获取网站HTML文本
+func FetchPageHtml(baseUrl string) (respBody []byte, err error) {
+	defer func() {
+		if err != nil {
+			tips := fmt.Sprintf("BuildCCFRequest ErrMsg: %s", err.Error())
+			utils.FileLog.Info(tips)
+			fmt.Println(tips)
+		}
+	}()
+	// 查询次数
+	//fetchNum++
+	if baseUrl == "" {
+		err = fmt.Errorf("隆众请求地址为空")
+		return
+	}
+
+	// 获取Cookie
+	strCookie, e := getCookie()
+	if e != nil {
+		err = fmt.Errorf("读取cookie文件失败, err: %s", e.Error())
+		return
+	}
+
+	// 拉取网站内容
+	cli := new(http.Client)
+	req, e := http.NewRequest("GET", baseUrl, nil)
+	if e != nil {
+		err = fmt.Errorf("")
+		return
+	}
+
+	req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7")
+	req.Header.Set("Accept-Encoding", "gzip, deflate, br")
+	req.Header.Set("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6")
+	req.Header.Set("Connection", "keep-alive")
+	req.Header.Set("Cookie", strCookie)
+	req.Header.Set("Host", "www.oilchem.net")
+	req.Header.Set("Referer", "https://chem.oilchem.net/")
+	req.Header.Set("Sec-Ch-Ua", "\"Not A(Brand\";v=\"99\", \"Microsoft Edge\";v=\"121\", \"Chromium\";v=\"121\"")
+	req.Header.Set("Sec-Ch-Ua-Mobile", "?0")
+	req.Header.Set("Sec-Ch-Ua-Platform", "\"Windows\"")
+	req.Header.Set("Sec-Fetch-Dest", "empty")
+	req.Header.Set("Sec-Fetch-Mode", "cors")
+	req.Header.Set("Sec-Fetch-Site", "same-origin")
+	req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0")
+	req.Header.Set("X-Requested-With", "XMLHttpRequest")
+
+	resp, e := cli.Do(req)
+	if e != nil {
+		err = fmt.Errorf("HTTP client Do err: %s", e.Error())
+		return
+	}
+	defer func() {
+		_ = resp.Body.Close()
+	}()
+
+	// 读取响应的内容
+	reader, e := gzip.NewReader(resp.Body)
+	if e != nil {
+		err = fmt.Errorf("gzip NewReader err: %s", e.Error())
+		return
+	}
+
+	respBody, e = io.ReadAll(reader)
+	if e != nil {
+		err = fmt.Errorf("read body err: %s", e.Error())
+		return
+	}
+
+	return
+}
+
+
+// getCookie
+// @Description: 获取cookie
+// @author: Roc
+// @datetime 2024-07-09 14:00:53
+// @return cookieStr string
+// @return err error
+func getCookie() (cookieStr string, err error) {
+	// 读取Cookie
+	if utils.OilchemCookieFile == "" {
+		err = fmt.Errorf("cookie文件未配置")
+		return
+	}
+	cookieByte, e := os.ReadFile(utils.OilchemCookieFile)
+	if e != nil {
+		err = fmt.Errorf("读取cookie文件失败, err: %s", e.Error())
+		return
+	}
+	cookieStr = strings.TrimSpace(string(cookieByte))
+	if cookieStr == "" {
+		err = fmt.Errorf("cookie为空")
+		return
+	}
+
+	return
+}
+
+
+
+// postEdbLib 调用指标接口
+func postEdbLib(param map[string]interface{}, method string) (result []byte, err error) {
+	postUrl := utils.EDB_LIB_URL + method
+	postData, err := json.Marshal(param)
+	if err != nil {
+		return
+	}
+	result, err = httpPost(postUrl, string(postData), "application/json")
+	if err != nil {
+		return
+	}
+	return
+}
+
+// httpPost HTTP请求
+func httpPost(url, postData string, params ...string) ([]byte, error) {
+	fmt.Println("httpPost Url:" + url)
+	body := io.NopCloser(strings.NewReader(postData))
+	client := &http.Client{}
+	req, err := http.NewRequest("POST", url, body)
+	if err != nil {
+		return nil, err
+	}
+	contentType := "application/x-www-form-urlencoded;charset=utf-8"
+	if len(params) > 0 && params[0] != "" {
+		contentType = params[0]
+	}
+	req.Header.Set("Content-Type", contentType)
+	req.Header.Set("authorization", utils.MD5(utils.APP_EDB_LIB_NAME_EN+utils.EDB_LIB_Md5_KEY))
+	resp, err := client.Do(req)
+	if err != nil {
+		fmt.Println("client.Do err:" + err.Error())
+		return nil, err
+	}
+	defer func() {
+		_ = resp.Body.Close()
+	}()
+	b, err := io.ReadAll(resp.Body)
+	if err != nil {
+		fmt.Println("httpPost:" + string(b))
+	}
+	return b, err
+}

+ 424 - 0
services/base_from_oilchem/fuhefei_edb.go

@@ -0,0 +1,424 @@
+package services
+
+import (
+	"eta/eta_data_analysis/models"
+	"eta/eta_data_analysis/utils"
+	"fmt"
+	"github.com/PuerkitoBio/goquery"
+	"strings"
+	"time"
+)
+
+var FuHeFeiListMap = map[string]string {
+	"中国磷铵产能利用率周数据统计" : "https://list.oilchem.net/192/6522/",
+	"中国钾肥样本港口库存量周数据统计" : "https://list.oilchem.net/192/50857/",
+	"中国复合肥进出口月数据分析" : "https://list.oilchem.net/192/5379/",
+}
+
+func FuHeFeiList(num int) (err error) {
+	for k, v := range FuHeFeiListMap {
+		for i := 1; i < num; i++ {
+			listUrl := v + fmt.Sprintf("%d.html",i)
+			fmt.Println("listUrl:",listUrl)
+			htm, e := FetchPageHtml(listUrl)
+			if e != nil {
+				err = e
+				utils.FileLog.Error(fmt.Sprintf("FetchPageHtml err:%v",err))
+				fmt.Println("FetchPageHtml err",err)
+				return
+			}
+			err = AnalysisOilchemList(htm, k)
+			if err != nil {
+				utils.FileLog.Error(fmt.Sprintf("AnalysisOilchemList err:%v",err))
+				fmt.Println("AnalysisOilchemList err",err)
+				return
+			}
+			time.Sleep(2*time.Second)
+		}
+	}
+	return
+}
+
+
+// 中国磷铵产能利用率周数据统计
+func AnalysisOilchemFuHeFei1(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		if strings.Contains(ptext, "中国磷铵装置产能利用率") {
+			title := ptext
+			//fmt.Println("title:",title)
+			titleList = append(titleList, title)
+		}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国磷铵产能利用率"+ "(" +area+")"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				unit := ""
+				if strings.Contains(area,"产量") {
+					unit = "万吨"
+				} else {
+					unit = "%"
+				}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             3,
+					Unit:                   unit,
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           "中国磷铵产能利用率",
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国钾肥样本港口库存量周数据统计
+func AnalysisOilchemFuHeFei2(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国磷铵装置产能利用率") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国进口氯化钾港口库存"+ "(" +area+")"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             3,
+					Unit:                   "万吨",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           "中国进口氯化钾港口库存",
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国复合肥进出口月数据分析
+func AnalysisOilchemFuHeFei3(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p[style*='text-align: center;']").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		if strings.Contains(ptext, "统计") {
+			title := ptext
+			//fmt.Println("title:",title)
+			titleList = append(titleList, title)
+		}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				title := titleList[tableIndex]
+				//fmt.Println("tbody title:",title)
+				if strings.Contains(title,"中国氮磷钾复合肥按产销国进口量月数据统计") {
+					title = "中国氮磷钾复合肥产销国进口量"
+				} else if strings.Contains(title,"中国氮磷钾复合肥按贸易方式进口量月数据统计") {
+					title = "中国氮磷钾复合肥贸易方式进口量"
+				} else if strings.Contains(title,"中国氮磷钾三元肥产销国出口量月数据统计") {
+					title = "中国氮磷钾复合肥产销国出口量"
+				} else if strings.Contains(title,"中国氮磷钾三元肥贸易方式出口量月数据统计") {
+					title = "中国氮磷钾复合肥贸易方式出口量"
+				} else {
+					return
+				}
+
+				indexName := title + "(" +area+")"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             3,
+					Unit:                   "吨",
+					Frequency:              "月度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           title,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	//写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+

+ 1039 - 0
services/base_from_oilchem/jiachun_edb.go

@@ -0,0 +1,1039 @@
+package services
+
+import (
+	"encoding/json"
+	"eta/eta_data_analysis/models"
+	"eta/eta_data_analysis/utils"
+	"fmt"
+	"github.com/PuerkitoBio/goquery"
+	"strings"
+	"time"
+)
+
+// OilchemTaskAnalysisHandlers 解析表格的函数
+var OilchemTaskAnalysisHandlers = map[string]func(htm []byte) (err error){
+	"[产量/产能利用率]:中国甲醇产量及产能利用率周数据统计": AnalysisOilchemJiaChun1,
+	"库存周数据分析":  AnalysisOilchemJiaChun2,
+	"中国甲醇样本生产企业库存及订单待发周数据统计":  AnalysisOilchemJiaChun3,
+	"中国甲醇样本利润周数据统计":   AnalysisOilchemJiaChun4,
+	"中国甲醇产量及产能利用率":   AnalysisOilchemJiaChun5,
+	"中国甲醇下游样本产能利用率周数据":   AnalysisOilchemJiaChun6,
+	"中国甲醇样本生产企业库存及订单待发周数据分析":   AnalysisOilchemJiaChun7,
+	"中国尿素分原料产能利用率周数据统计": AnalysisOilchemNiaoSu1,
+	"中国尿素样本生产理论利润周数据统计": AnalysisOilchemNiaoSu2,
+	"中国尿素样本港口库存周数据统计": AnalysisOilchemNiaoSu3,
+	"中国尿素产量周数据分析": AnalysisOilchemNiaoSu4,
+	"中国尿素企业库存周数据分析": AnalysisOilchemNiaoSu5,
+	"中国尿素样本港口库存周数据分析": AnalysisOilchemNiaoSu6,
+	"中国尿素企业预收订单周数据分析": AnalysisOilchemNiaoSu7,
+	"中国尿素样本理论利润周数据分析": AnalysisOilchemNiaoSu8,
+	"中国复合肥产能利用率周数据统计": AnalysisOilchemNiaoSu9,
+	"中国三聚氰胺产能利用率周数据统计": AnalysisOilchemNiaoSu10,
+	"中国尿素产量分省份月数据统计": AnalysisOilchemNiaoSu11,
+	"中国尿素进出口量数据总体分析": AnalysisOilchemNiaoSu12,
+	"中国磷铵产能利用率周数据统计": AnalysisOilchemFuHeFei1,
+	"中国钾肥样本港口库存量周数据统计": AnalysisOilchemFuHeFei2,
+	"中国复合肥进出口月数据分析": AnalysisOilchemFuHeFei3,
+	"中国阔叶浆样本产量周数据分析": AnalysisOilchemZhiJiang1,
+	"中国化机浆样本产量周数据分析": AnalysisOilchemZhiJiang1,
+	"中国纸浆主流港口样本库存周数据分析": AnalysisOilchemZhiJiang2,
+	"国内独立炼厂产能利用率周数据统计": AnalysisOilchemYuanYou1,
+	"国内炼厂常减压装置产能利用率月数据统计": AnalysisOilchemYuanYou2,
+	"山东独立炼厂原油到港量周数据统计": AnalysisOilchemYuanYou3,
+	"中国港口商业原油库存指数分析": AnalysisOilchemYuanYou4,
+	"山东独立炼厂原油样本库容率周数据分析": AnalysisOilchemYuanYou5,
+	"中国炼厂原油加工量月数据分析": AnalysisOilchemYuanYou6,
+	"国内原油加工量简况": AnalysisOilchemYuanYou7,
+	"国内原油产量表": AnalysisOilchemYuanYou8,
+	"中国原油进出口量月数据统计": AnalysisOilchemYuanYou9,
+	"中国原油月度进出口数据分析报告": AnalysisOilchemYuanYou10,
+	"美国能源信息署最新石油库存报告": AnalysisOilchemYuanYou11,
+	"美国API库存数据": AnalysisOilchemYuanYou12,
+	"国际主要汇率收盘": AnalysisOilchemYuanYou13,
+}
+
+var JiaChunListMap = map[string]string {
+	"[产量/产能利用率]:中国甲醇产量及产能利用率周数据统计" : "https://list.oilchem.net/140/38266/",
+	"库存周数据分析" : "https://list.oilchem.net/140/38271/",
+	"中国甲醇样本生产企业库存及订单待发周数据统计" : "https://list.oilchem.net/140/1086/",
+	"中国甲醇样本利润周数据统计" : "https://list.oilchem.net/140/1088/",
+	"中国甲醇产量及产能利用率" : "https://list.oilchem.net/140/1087/",
+	"中国甲醇下游样本产能利用率周数据" : "https://list.oilchem.net/140/38270/",
+	"中国甲醇样本生产企业库存及订单待发周数据分析" : "https://list.oilchem.net/140/38271/",
+}
+
+// 中国甲醇产量及产能利用率周数据统计
+func AnalysisOilchemJiaChun1(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	suffixList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		if strings.Contains(ptext, "中国甲醇产量分地区") {
+			suffix := ptext
+			//fmt.Println("title:",title)
+			if strings.Contains(ptext, "利用率") {
+				suffix = "产能利用率"
+			} else {
+				suffix = "产量"
+			}
+			suffixList = append(suffixList, suffix)
+		}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		mid := "分地区"
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				text3 = strings.Replace(text3,"\u00a0","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+
+				if area == "工艺类型" {
+					mid = "分工艺"
+					return
+				}
+
+				title = "中国甲醇产量" + mid + suffixList[tableIndex]
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := title + "(" + area +")"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				unit := unitList[tableIndex]
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             1,
+					Unit:                   unit,
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           title,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国甲醇样本港口库存周数据统计
+func AnalysisOilchemJiaChun2(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "趋势") {
+			return
+		}
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		if strings.Contains(ptext, "中国甲醇港口样本库存周数据对比") {
+			title := "中国甲醇港口库存"
+			//fmt.Println("title:",title)
+			titleList = append(titleList, title)
+		}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				text3 = strings.Replace(text3,"\u00a0","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				title := "中国甲醇港口库存"
+				indexName := title + "(" + area +")"
+
+				unit := "万吨"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				fmt.Println("unit:",unit)
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             1,
+					Unit:                   unit,
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           title,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国甲醇样本生产企业库存及订单待发周数据统计
+func AnalysisOilchemJiaChun3(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "趋势") {
+			return
+		}
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+
+		//https://www.oilchem.net/22-1026-13-e6e4dd2d1d3d9309.html 10-26的表格没有名字。。。
+		//if strings.Contains(ptext, "中国甲醇样本生产企业") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	if strings.Contains(title, "订单待发") {
+		//		title = "中国甲醇样本生产企业订单待发"
+		//	} else {
+		//		title = "中国甲醇样本生产企业库存"
+		//	}
+		//	titleList = append(titleList, title)
+		//}
+		titleList = append(titleList, "中国甲醇样本生产企业库存","中国甲醇样本生产企业订单待发")
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				text3 = strings.Replace(text3,"\u00a0","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+
+				indexName := titleList[tableIndex] + "(" + area +")"
+				unit := "万吨"
+				fmt.Println("indexName:",indexName)
+				//fmt.Println("valueF:",valueF)
+				fmt.Println("unit:",unit)
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             1,
+					Unit:                   unit,
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           titleList[tableIndex],
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国甲醇样本利润周数据统计
+func AnalysisOilchemJiaChun4(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	//unitList := make([]string, 0)
+	//doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+	//	ptext := selection.Text()
+	//	if strings.Contains(ptext, "趋势") {
+	//		return
+	//	}
+	//	if strings.Contains(ptext, "单位:") {
+	//		unit := strings.Replace(ptext, "单位:", "", -1)
+	//		//fmt.Println("unit:",unit)
+	//		unitList = append(unitList, unit)
+	//	}
+	//	if strings.Contains(ptext, "中国甲醇样本利润") {
+	//		title := ptext
+	//		//fmt.Println("title:",title)
+	//		titleList = append(titleList, title)
+	//	}
+	//})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				text3 = strings.Replace(text3,"\u00a0","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				if e != nil {
+					err = e
+					utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+					return
+				}
+
+
+				indexName := area
+				unit := "元/吨"
+				fmt.Println("indexName:",indexName)
+				//fmt.Println("valueF:",valueF)
+				fmt.Println("unit:",unit)
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             1,
+					Unit:                   unit,
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             "",
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+	return
+}
+
+// 中国甲醇产量及产能利用率周数据
+func AnalysisOilchemJiaChun5(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	//unitList := make([]string, 0)
+	//doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+	//	ptext := selection.Text()
+	//	if strings.Contains(ptext, "趋势") {
+	//		return
+	//	}
+	//	if strings.Contains(ptext, "单位:") {
+	//		unit := strings.Replace(ptext, "单位:", "", -1)
+	//		//fmt.Println("unit:",unit)
+	//		unitList = append(unitList, unit)
+	//	}
+	//	if strings.Contains(ptext, "中国甲醇样本利润") {
+	//		title := ptext
+	//		//fmt.Println("title:",title)
+	//		titleList = append(titleList, title)
+	//	}
+	//})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				text3 = strings.Replace(text3,"\u00a0","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国甲醇" + area
+				unit := ""
+				if area == "产量" {
+					unit = "吨"
+				} else {
+					unit = "%"
+				}
+				fmt.Println("indexName:",indexName)
+				//fmt.Println("valueF:",valueF)
+				fmt.Println("unit:",unit)
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             1,
+					Unit:                   unit,
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+	return
+}
+
+// 中国甲醇部分下游品种产能利用率
+func AnalysisOilchemJiaChun6(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	//unitList := make([]string, 0)
+	//doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+	//	ptext := selection.Text()
+	//	if strings.Contains(ptext, "趋势") {
+	//		return
+	//	}
+	//	if strings.Contains(ptext, "单位:") {
+	//		unit := strings.Replace(ptext, "单位:", "", -1)
+	//		//fmt.Println("unit:",unit)
+	//		unitList = append(unitList, unit)
+	//	}
+	//	if strings.Contains(ptext, "中国甲醇样本利润") {
+	//		title := ptext
+	//		//fmt.Println("title:",title)
+	//		titleList = append(titleList, title)
+	//	}
+	//})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				text3 = strings.Replace(text3,"\u00a0","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) || utils.ContainsEnglishLetter(text3) {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+				area = strings.Replace(area," ","",-1)
+				area = strings.Replace(area," ","",-1)
+
+				indexName := "中国甲醇部分下游品种产能利用率" +"("+ area +")"
+				unit := "%"
+				fmt.Println("indexName:",indexName)
+				//fmt.Println("valueF:",valueF)
+				fmt.Println("unit:",unit)
+				item := &models.BaseFromOilchemIndex{
+					BaseFromOilchemIndexId: 0,
+					IndexName:              indexName,
+					ClassifyId:             1,
+					Unit:                   unit,
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             createTime,
+					ModifyTime:             createTime,
+					IndexNameStr:           "中国甲醇部分下游品种产能利用率",
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+	return
+}
+
+// 中国甲醇样本生产企业库存及订单待发
+func AnalysisOilchemJiaChun7(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	//unitList := make([]string, 0)
+	//doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+	//	ptext := selection.Text()
+	//	if strings.Contains(ptext, "趋势") {
+	//		return
+	//	}
+	//	if strings.Contains(ptext, "单位:") {
+	//		unit := strings.Replace(ptext, "单位:", "", -1)
+	//		//fmt.Println("unit:",unit)
+	//		unitList = append(unitList, unit)
+	//	}
+	//	if strings.Contains(ptext, "中国甲醇样本利润") {
+	//		title := ptext
+	//		//fmt.Println("title:",title)
+	//		titleList = append(titleList, title)
+	//	}
+	//})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				text3 = strings.Replace(text3,"\u00a0","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) || utils.ContainsEnglishLetter(text3) {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := area
+				unit := "万吨"
+				fmt.Println("indexName:",indexName)
+				//fmt.Println("valueF:",valueF)
+				fmt.Println("unit:",unit)
+				item := &models.BaseFromOilchemIndex{
+					BaseFromOilchemIndexId: 0,
+					IndexName:              indexName,
+					ClassifyId:             1,
+					Unit:                   unit,
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             createTime,
+					ModifyTime:             createTime,
+					IndexNameStr:           indexName,
+					MarketName:             "",
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+	return
+}
+
+func PostHandleOilchem(indexList []*models.BaseFromOilchemIndex) (err error) {
+	params := make(map[string]interface{})
+	params["List"] = indexList
+	result, e := postEdbLib(params, utils.LIB_ROUTE_OILCHEM_TABLE_HANDLE)
+	if e != nil {
+		b, _ := json.Marshal(params)
+		fmt.Printf("postEdbLib err: %v, params: %s\n", e, string(b))
+		utils.FileLog.Info(fmt.Sprintf("postEdbLib err: %v, params: %s", e, string(b)))
+		return
+	}
+	resp := new(models.BaseEdbLibResponse)
+	if e = json.Unmarshal(result, &resp); e != nil {
+		fmt.Printf("json.Unmarshal err: %v\n", e)
+		utils.FileLog.Info(fmt.Sprintf("json.Unmarshal err: %v", e))
+		return
+	}
+	if resp.Ret != 200 {
+		fmt.Printf("Msg: %s, ErrMsg: %s\n", resp.Msg, resp.ErrMsg)
+		utils.FileLog.Info(fmt.Sprintf("Msg: %s, ErrMsg: %s", resp.Msg, resp.ErrMsg))
+		return
+	}
+	return
+}
+
+func JiaChunList(num int) (err error) {
+	for k, v := range JiaChunListMap {
+		for i := 1; i < num; i++ {
+			listUrl := v + fmt.Sprintf("%d.html",i)
+			fmt.Println("listUrl:",listUrl)
+			htm, e := FetchPageHtml(listUrl)
+			if e != nil {
+				err = e
+				utils.FileLog.Error(fmt.Sprintf("FetchPageHtml err:%v",err))
+				fmt.Println("FetchPageHtml err",err)
+				return
+			}
+			err = AnalysisOilchemList(htm, k)
+			if err != nil {
+				utils.FileLog.Error(fmt.Sprintf("AnalysisOilchemJiaChunList err:%v",err))
+				fmt.Println("AnalysisOilchemJiaChunList err",err)
+				return
+			}
+			//time.Sleep(2*time.Second)
+		}
+	}
+	return
+}
+
+func AnalysisOilchemList(htm []byte, classifyTitle string) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+
+	doc.Find("div.list").Each(func(divIndex int, table *goquery.Selection) {
+		table.Find("li").Each(func(divIndex2 int, table2 *goquery.Selection) {
+			title := table2.Text()
+			if strings.Contains(title,classifyTitle) {
+				table2.Find("li.clearfix a").Each(func(i int, s *goquery.Selection) {
+					href, exists := s.Attr("href")
+					if exists {
+						fmt.Printf("Link %d: %s\n", i, href)
+						respBody, err := FetchPageHtml(href)
+						if err != nil {
+							utils.FileLog.Error(fmt.Sprintf("FetchPageHtml err:%v",err))
+							fmt.Println("FetchPageHtml err",err)
+							return
+						} else {
+							handler, ok := OilchemTaskAnalysisHandlers[classifyTitle]
+							if !ok {
+								utils.FileLog.Info(fmt.Sprintf("%s无解析函数\n", classifyTitle))
+								return
+							}
+							err := handler(respBody)
+							if err != nil {
+								utils.FileLog.Error(fmt.Sprintf("OilchemTaskAnalysisHandlers err:%v",err))
+								fmt.Println("OilchemTaskAnalysisHandlers err",err)
+								return
+							}
+						}
+					} else {
+						fmt.Println("Link attribute does not exist")
+					}
+				})
+			}
+
+		})
+	})
+
+	return
+}

+ 1538 - 0
services/base_from_oilchem/niaosu_edb.go

@@ -0,0 +1,1538 @@
+package services
+
+import (
+	"eta/eta_data_analysis/models"
+	"eta/eta_data_analysis/utils"
+	"fmt"
+	"github.com/PuerkitoBio/goquery"
+	"strings"
+	"time"
+)
+var NiaoSuListMap = map[string]string {
+	"中国尿素分原料产能利用率周数据统计" : "https://list.oilchem.net/188/43702/",
+	"中国尿素样本生产理论利润周数据统计" : "https://list.oilchem.net/188/43705/",
+	"中国尿素样本港口库存周数据统计" : "https://list.oilchem.net/188/43704/",
+	"中国尿素产量周数据分析" : "https://list.oilchem.net/188/43708/",
+	"中国尿素企业库存周数据分析" : "https://list.oilchem.net/188/43709/",
+	"中国尿素样本港口库存周数据分析" : "https://list.oilchem.net/188/43709/",
+	"中国尿素企业预收订单周数据分析" : "https://list.oilchem.net/188/43710/",
+	"中国复合肥产能利用率周数据统计" : "https://list.oilchem.net/188/43716/",
+	"中国三聚氰胺产能利用率周数据统计" : "https://list.oilchem.net/188/43717/",
+	"中国尿素产量分省份月数据统计" : "https://list.oilchem.net/188/43719/",
+	//"中国尿素进出口量数据总体分析" : "https://list.oilchem.net/188/5315/",
+}
+
+func NiaoSuList(num int) (err error) {
+	for k, v := range NiaoSuListMap {
+		for i := 1; i < num; i++ {
+			listUrl := v + fmt.Sprintf("%d.html",i)
+			fmt.Println("listUrl:",listUrl)
+			htm, e := FetchPageHtml(listUrl)
+			if e != nil {
+				err = e
+				utils.FileLog.Error(fmt.Sprintf("FetchPageHtml err:%v",err))
+				fmt.Println("FetchPageHtml err",err)
+				return
+			}
+			err = AnalysisOilchemList(htm, k)
+			if err != nil {
+				utils.FileLog.Error(fmt.Sprintf("AnalysisOilchemList err:%v",err))
+				fmt.Println("AnalysisOilchemList err",err)
+				return
+			}
+			time.Sleep(2*time.Second)
+		}
+	}
+	return
+}
+
+
+// 中国尿素分原料产能利用率周数据统计
+func AnalysisOilchemNiaoSu1(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		if strings.Contains(ptext, "中国尿素分原料产能利用率周数据统计") {
+			title := ptext
+			//fmt.Println("title:",title)
+			titleList = append(titleList, title)
+		}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国尿素"+ area
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				unit := ""
+				if strings.Contains(area,"产量") {
+					unit = "万吨"
+				} else {
+					unit = "%"
+				}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             2,
+					Unit:                   unit,
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国尿素样本生产理论利润周数据统计
+func AnalysisOilchemNiaoSu2(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国尿素样本生产理论利润周数据统计") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国尿素样本分工艺理论利润"+"("+ area+")"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             2,
+					Unit:                   "元/吨",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国尿素样本港口库存周数据统计
+func AnalysisOilchemNiaoSu3(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国尿素样本生产理论利润周数据统计") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国尿素样本港口库存"+"("+ area+")"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             2,
+					Unit:                   "万吨",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国尿素产量周数据分析
+func AnalysisOilchemNiaoSu4(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国尿素样本生产理论利润周数据统计") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国尿素产量"+"("+ area+")"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             2,
+					Unit:                   "万吨",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国尿素企业库存
+func AnalysisOilchemNiaoSu5(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国尿素样本生产理论利润周数据统计") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国尿素企业库存"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             2,
+					Unit:                   "万吨",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             "",
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国尿素样本港口库存周数据分析
+func AnalysisOilchemNiaoSu6(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国尿素样本生产理论利润周数据统计") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国尿素样本分港口库存" + "(" + area + ")"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             2,
+					Unit:                   "万吨",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国尿素企业预收订单周数据分析
+func AnalysisOilchemNiaoSu7(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国尿素样本生产理论利润周数据统计") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国尿素企业预收订单"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             2,
+					Unit:                   "日",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国尿素样本理论利润周数据分析
+func AnalysisOilchemNiaoSu8(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国尿素样本生产理论利润周数据统计") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国尿素企业预收订单"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             2,
+					Unit:                   "日",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国复合肥产能利用率周数据统计
+func AnalysisOilchemNiaoSu9(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国尿素样本生产理论利润周数据统计") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国复合肥产能利用率"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             2,
+					Unit:                   "%",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国三聚氰胺产能利用率周数据统计
+func AnalysisOilchemNiaoSu10(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国尿素样本生产理论利润周数据统计") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国三聚氰胺产能利用率"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             2,
+					Unit:                   "%",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国尿素产量分省份月数据统计
+func AnalysisOilchemNiaoSu11(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国尿素样本生产理论利润周数据统计") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国尿素产量" + "(" + area + ")"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             2,
+					Unit:                   "吨",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国尿素进出口量数据总体分析 todo
+func AnalysisOilchemNiaoSu12(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国尿素样本生产理论利润周数据统计") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+	indexTitle := "中国尿素"
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").Each(func(ii int, table2 *goquery.Selection) {
+			table2.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+
+				if jj == 1 {
+					indexTitle = "中国尿素进口量"
+				} else if jj == 4 {
+					indexTitle = "中国尿素出口量"
+				}
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				fmt.Println("area:",area)
+				if jj != 1 && jj != 4 {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				indexName := indexTitle + "(" + area + ")"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             2,
+					Unit:                   "吨",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+
+
+
+

+ 88 - 0
services/base_from_oilchem/oilchem.go

@@ -0,0 +1,88 @@
+package services
+
+import (
+	"context"
+	"eta/eta_data_analysis/utils"
+	"fmt"
+	"log"
+	"time"
+
+	"github.com/chromedp/chromedp"
+)
+
+// 隆众咨询数据
+func OilchemLogin() {
+	opts := append(
+		chromedp.DefaultExecAllocatorOptions[:],
+		chromedp.Flag("headless", false),
+	)
+
+	allocCtx, cancel := chromedp.NewExecAllocator(context.Background(), opts...)
+	defer cancel()
+
+	// 创建chrome实例
+	ctx, cancel := chromedp.NewContext(
+		allocCtx,
+		chromedp.WithLogf(log.Printf),
+	)
+	defer cancel()
+
+	var htmlContent string
+
+	err := chromedp.Run(ctx,
+		chromedp.Navigate(`https://chem.oilchem.net/chemical/methanol.shtml`),
+		chromedp.Sleep(5*time.Second),
+		chromedp.Click(`a[class="tpbtn left"]`, chromedp.ByQuery),
+		chromedp.Sleep(2*time.Second),
+		chromedp.SetValue(`input[name="username"]`, utils.OilchemAccount, chromedp.ByQuery),
+		chromedp.SetValue(`input[name="password"]`, utils.OilchemPassword, chromedp.ByQuery),
+		chromedp.Sleep(2*time.Second),
+		chromedp.Click(`button[id="smsValid"]`, chromedp.ByQuery),
+		chromedp.Sleep(5*time.Second),
+	)
+
+	time.Sleep(3 * time.Second)
+
+	err = chromedp.Run(ctx,
+		chromedp.Navigate(`https://www.oilchem.net/24-0801-09-4036018c523e4bbc.html`),
+		chromedp.Sleep(2*time.Second),
+		chromedp.OuterHTML("html", &htmlContent),
+	)
+
+	if err != nil {
+		fmt.Println(err)
+	}
+
+	fmt.Println("htmlContent:" + htmlContent)
+
+	utils.FileLog.Info("htmlContent:" + htmlContent)
+
+}
+
+func OilchemList(context.Context) (err error)  {
+	num := 2
+	if utils.OilchemDataInit == "1" {
+		num = 60
+	}
+	err = JiaChunList(num)
+	if err != nil {
+		utils.FileLog.Info("JiaChunList Err:", err)
+	}
+	err = NiaoSuList(num)
+	if err != nil {
+		utils.FileLog.Info("NiaoSuList Err:", err)
+	}
+	err = FuHeFeiList(num)
+	if err != nil {
+		utils.FileLog.Info("FuHeFeiList Err:", err)
+	}
+	err = ZhiJiangList(num)
+	if err != nil {
+		utils.FileLog.Info("ZhiJiangList Err:", err)
+	}
+	err = YuanYouList(num)
+	if err != nil {
+		utils.FileLog.Info("YuanYouList Err:", err)
+	}
+	return
+}

+ 1605 - 0
services/base_from_oilchem/yuanyou_edb.go

@@ -0,0 +1,1605 @@
+package services
+
+import (
+	"eta/eta_data_analysis/models"
+	"eta/eta_data_analysis/utils"
+	"fmt"
+	"github.com/PuerkitoBio/goquery"
+	"strings"
+	"time"
+)
+
+var YuanYouListMap = map[string]string{
+	"国内独立炼厂产能利用率周数据统计" : "https://list.oilchem.net/5158/43854/",
+	"国内炼厂常减压装置产能利用率月数据统计": "https://list.oilchem.net/5158/43854/",
+	"山东独立炼厂原油到港量周数据统计": "https://list.oilchem.net/5158/43856/",
+	"中国港口商业原油库存指数分析": "https://list.oilchem.net/5158/43857/",
+	"山东独立炼厂原油样本库容率周数据分析": "https://list.oilchem.net/5158/43859/",
+	"中国炼厂原油加工量月数据分析": "https://list.oilchem.net/5158/43858/",
+	"国内原油加工量简况": "https://list.oilchem.net/5158/37164/",
+	"国内原油产量表": "https://list.oilchem.net/5158/37164/",
+	//"中国原油进出口量月数据统计": "https://list.oilchem.net/5158/37160/",
+	"中国原油月度进出口数据分析报告": "https://list.oilchem.net/5158/37160/",
+	//"美国能源信息署最新石油库存报告": "https://list.oilchem.net/5158/37147/",
+	"美国API库存数据": "https://list.oilchem.net/5158/37147/",
+	"国际主要汇率收盘": "https://list.oilchem.net/5158/37156/",
+}
+
+func YuanYouList(num int) (err error) {
+	for k, v := range YuanYouListMap {
+		for i := 1; i < num; i++ {
+			listUrl := v + fmt.Sprintf("%d.html", i)
+			fmt.Println("listUrl:", listUrl)
+			htm, e := FetchPageHtml(listUrl)
+			if e != nil {
+				err = e
+				utils.FileLog.Error(fmt.Sprintf("FetchPageHtml err:%v", err))
+				fmt.Println("FetchPageHtml err", err)
+				return
+			}
+			err = AnalysisOilchemList(htm, k)
+			if err != nil {
+				utils.FileLog.Error(fmt.Sprintf("AnalysisOilchemList err:%v", err))
+				fmt.Println("AnalysisOilchemList err", err)
+				return
+			}
+			time.Sleep(2 * time.Second)
+		}
+	}
+	return
+}
+
+// 国内独立炼厂产能利用率周数据
+func AnalysisOilchemYuanYou1(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		if strings.Contains(ptext, "国内独立炼厂产能利用率周数据") {
+			title := ptext
+			//fmt.Println("title:",title)
+			titleList = append(titleList, title)
+		}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:", title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr, "发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr, "来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v", err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3, "\n", "", -1)
+				text3 = strings.Replace(text3, " ", "", -1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				indexName := "中国炼厂常减压装置产能利用率"
+				fmt.Println("indexName:", indexName)
+				fmt.Println("valueF:", value)
+				unit := ""
+				if strings.Contains(area, "产量") {
+					unit = "万吨"
+				} else {
+					unit = "%"
+				}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:    indexName,
+					ClassifyId:   5,
+					Unit:         unit,
+					Frequency:    "周度",
+					Describe:     "",
+					DataTime:     dataTime,
+					Value:        value,
+					Sort:         0,
+					CreateTime:   time.Now(),
+					ModifyTime:   time.Now(),
+					IndexNameStr: "中国炼厂常减压装置产能利用率",
+					MarketName:   "",
+				}
+				indexList = append(indexList, item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v", err))
+		fmt.Println("PostHandleOilchem err", err)
+		return
+	}
+
+	return
+}
+
+// 国内炼厂常减压装置产能利用率月数据统计
+func AnalysisOilchemYuanYou2(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		if strings.Contains(ptext, "国内独立炼厂产能利用率周数据") {
+			title := ptext
+			//fmt.Println("title:",title)
+			titleList = append(titleList, title)
+		}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:", title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr, "发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr, "来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v", err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3, "\n", "", -1)
+				text3 = strings.Replace(text3, " ", "", -1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				indexName := "中国炼厂常减压装置产能利用率" + "(" + area + ")"
+				fmt.Println("indexName:", indexName)
+				fmt.Println("valueF:", value)
+				unit := ""
+				if strings.Contains(area, "产量") {
+					unit = "万吨"
+				} else {
+					unit = "%"
+				}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:    indexName,
+					ClassifyId:   5,
+					Unit:         unit,
+					Frequency:    "周度",
+					Describe:     "",
+					DataTime:     dataTime,
+					Value:        value,
+					Sort:         0,
+					CreateTime:   time.Now(),
+					ModifyTime:   time.Now(),
+					IndexNameStr: "中国炼厂常减压装置产能利用率",
+					MarketName:   area,
+				}
+				indexList = append(indexList, item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v", err))
+		fmt.Println("PostHandleOilchem err", err)
+		return
+	}
+
+	return
+}
+
+// 山东独立炼厂原油到港量周数据统计
+func AnalysisOilchemYuanYou3(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "国内独立炼厂产能利用率周数据") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:", title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr, "发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr, "来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v", err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr:not(.firstRow)").Each(func(ii int, table2 *goquery.Selection) {
+			table2.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3, "\n", "", -1)
+				text3 = strings.Replace(text3, " ", "", -1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				indexName := "山东独立炼厂原油到港量"
+				fmt.Println("indexName:", indexName)
+				fmt.Println("valueF:", value)
+				//unit := ""
+				//if strings.Contains(area, "产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:    indexName,
+					ClassifyId:   5,
+					Unit:         "万吨",
+					Frequency:    "周度",
+					Describe:     "",
+					DataTime:     dataTime,
+					Value:        value,
+					Sort:         0,
+					CreateTime:   time.Now(),
+					ModifyTime:   time.Now(),
+					IndexNameStr: indexName,
+					MarketName:   "",
+				}
+				indexList = append(indexList, item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v", err))
+		fmt.Println("PostHandleOilchem err", err)
+		return
+	}
+
+	return
+}
+
+// 中国港口商业原油库存指数分析
+func AnalysisOilchemYuanYou4(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "国内独立炼厂产能利用率周数据") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:", title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr, "发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr, "来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v", err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("p").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3, "\n", "", -1)
+				text3 = strings.Replace(text3, " ", "", -1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周"{
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				indexName := "中国港口商业原油样本库存指数" + "(" + area + ")"
+				fmt.Println("indexName:", indexName)
+				fmt.Println("valueF:", value)
+				//unit := ""
+				//if strings.Contains(area, "产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:    indexName,
+					ClassifyId:   5,
+					Unit:         "%",
+					Frequency:    "周度",
+					Describe:     "",
+					DataTime:     dataTime,
+					Value:        value,
+					Sort:         0,
+					CreateTime:   time.Now(),
+					ModifyTime:   time.Now(),
+					IndexNameStr: "中国港口商业原油样本库存指数",
+					MarketName:   area,
+				}
+				indexList = append(indexList, item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v", err))
+		fmt.Println("PostHandleOilchem err", err)
+		return
+	}
+
+	return
+}
+
+// 山东独立炼厂原油样本库容率周数据分析
+func AnalysisOilchemYuanYou5(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "国内独立炼厂产能利用率周数据") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:", title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr, "发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr, "来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v", err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr:not(.firstRow)").Each(func(ii int, table2 *goquery.Selection) {
+			table2.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3, "\n", "", -1)
+				text3 = strings.Replace(text3, " ", "", -1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				indexName := "山东独立炼厂原油样本库容率"
+				fmt.Println("indexName:", indexName)
+				fmt.Println("valueF:", value)
+				//unit := ""
+				//if strings.Contains(area, "产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:    indexName,
+					ClassifyId:   5,
+					Unit:         "%",
+					Frequency:    "周度",
+					Describe:     "",
+					DataTime:     dataTime,
+					Value:        value,
+					Sort:         0,
+					CreateTime:   time.Now(),
+					ModifyTime:   time.Now(),
+					IndexNameStr: indexName,
+					MarketName:   "",
+				}
+				indexList = append(indexList, item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v", err))
+		fmt.Println("PostHandleOilchem err", err)
+		return
+	}
+
+	return
+}
+
+// 中国炼厂原油加工量月数据分析
+func AnalysisOilchemYuanYou6(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "国内独立炼厂产能利用率周数据") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:", title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr, "发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr, "来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v", err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr:not(.firstRow)").Each(func(ii int, table2 *goquery.Selection) {
+			table2.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3, "\n", "", -1)
+				text3 = strings.Replace(text3, " ", "", -1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				indexName := "中国炼厂原油加工量"
+				fmt.Println("indexName:", indexName)
+				fmt.Println("valueF:", value)
+				//unit := ""
+				//if strings.Contains(area, "产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:    indexName,
+					ClassifyId:   5,
+					Unit:         "万吨",
+					Frequency:    "月度",
+					Describe:     "",
+					DataTime:     dataTime,
+					Value:        value,
+					Sort:         0,
+					CreateTime:   time.Now(),
+					ModifyTime:   time.Now(),
+					IndexNameStr: indexName,
+					MarketName:   "",
+				}
+				indexList = append(indexList, item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v", err))
+		fmt.Println("PostHandleOilchem err", err)
+		return
+	}
+
+	return
+}
+
+// 国内原油加工量简况
+func AnalysisOilchemYuanYou7(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "国内独立炼厂产能利用率周数据") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:", title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr, "发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr, "来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v", err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr:not(.firstRow)").Each(func(ii int, table2 *goquery.Selection) {
+			table2.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3, "\n", "", -1)
+				text3 = strings.Replace(text3, " ", "", -1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				indexName := "国内原油加工量"
+				fmt.Println("indexName:", indexName)
+				fmt.Println("valueF:", value)
+				//unit := ""
+				//if strings.Contains(area, "产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:    indexName,
+					ClassifyId:   5,
+					Unit:         "万吨",
+					Frequency:    "月度",
+					Describe:     "",
+					DataTime:     dataTime,
+					Value:        value,
+					Sort:         0,
+					CreateTime:   time.Now(),
+					ModifyTime:   time.Now(),
+					IndexNameStr: indexName,
+					MarketName:   "",
+				}
+				indexList = append(indexList, item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v", err))
+		fmt.Println("PostHandleOilchem err", err)
+		return
+	}
+
+	return
+}
+
+// 国内原油加工量简况
+func AnalysisOilchemYuanYou8(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "国内独立炼厂产能利用率周数据") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:", title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr, "发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr, "来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v", err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr:not(.firstRow)").Each(func(ii int, table2 *goquery.Selection) {
+			table2.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3, "\n", "", -1)
+				text3 = strings.Replace(text3, " ", "", -1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				indexName := "国内原油产量表"
+				fmt.Println("indexName:", indexName)
+				fmt.Println("valueF:", value)
+				//unit := ""
+				//if strings.Contains(area, "产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:    indexName,
+					ClassifyId:   5,
+					Unit:         "万吨",
+					Frequency:    "月度",
+					Describe:     "",
+					DataTime:     dataTime,
+					Value:        value,
+					Sort:         0,
+					CreateTime:   time.Now(),
+					ModifyTime:   time.Now(),
+					IndexNameStr: indexName,
+					MarketName:   "",
+				}
+				indexList = append(indexList, item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v", err))
+		fmt.Println("PostHandleOilchem err", err)
+		return
+	}
+
+	return
+}
+
+// 中国原油进出口量月数据统计 todo
+func AnalysisOilchemYuanYou9(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "国内独立炼厂产能利用率周数据") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:", title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr, "发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr, "来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v", err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr:not(.firstRow)").Each(func(ii int, table2 *goquery.Selection) {
+			table2.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3, "\n", "", -1)
+				text3 = strings.Replace(text3, " ", "", -1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				indexName := "国内原油产量表"
+				fmt.Println("indexName:", indexName)
+				fmt.Println("valueF:", value)
+				//unit := ""
+				//if strings.Contains(area, "产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:    indexName,
+					ClassifyId:   5,
+					Unit:         "万吨",
+					Frequency:    "月度",
+					Describe:     "",
+					DataTime:     dataTime,
+					Value:        value,
+					Sort:         0,
+					CreateTime:   time.Now(),
+					ModifyTime:   time.Now(),
+					IndexNameStr: indexName,
+					MarketName:   "",
+				}
+				indexList = append(indexList, item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v", err))
+		fmt.Println("PostHandleOilchem err", err)
+		return
+	}
+
+	return
+}
+
+// 中国原油月度进出口数据分析报告
+func AnalysisOilchemYuanYou10(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "国内独立炼厂产能利用率周数据") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:", title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr, "发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr, "来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v", err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		if tableIndex != 1 {
+			return
+		}
+		table.Find("tr:not(.firstRow)").Each(func(ii int, table2 *goquery.Selection) {
+			table2.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3, "\n", "", -1)
+				text3 = strings.Replace(text3, " ", "", -1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				indexName := "中国原油按贸易方式进口量"+"(" + area +")"
+				fmt.Println("indexName:", indexName)
+				fmt.Println("valueF:", value)
+				//unit := ""
+				//if strings.Contains(area, "产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:    indexName,
+					ClassifyId:   5,
+					Unit:         "万吨",
+					Frequency:    "月度",
+					Describe:     "",
+					DataTime:     dataTime,
+					Value:        value,
+					Sort:         0,
+					CreateTime:   time.Now(),
+					ModifyTime:   time.Now(),
+					IndexNameStr: indexName,
+					MarketName:   area,
+				}
+				indexList = append(indexList, item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v", err))
+		fmt.Println("PostHandleOilchem err", err)
+		return
+	}
+
+	return
+}
+
+// 美国能源信息署最新石油库存报告 todo
+func AnalysisOilchemYuanYou11(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "国内独立炼厂产能利用率周数据") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:", title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr, "发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr, "来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v", err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr:not(.firstRow)").Each(func(ii int, table2 *goquery.Selection) {
+			table2.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3, "\n", "", -1)
+				text3 = strings.Replace(text3, " ", "", -1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				indexName := "中国原油按贸易方式进口量"+"(" + area +")"
+				fmt.Println("indexName:", indexName)
+				fmt.Println("valueF:", value)
+				//unit := ""
+				//if strings.Contains(area, "产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:    indexName,
+					ClassifyId:   5,
+					Unit:         "万吨",
+					Frequency:    "月度",
+					Describe:     "",
+					DataTime:     dataTime,
+					Value:        value,
+					Sort:         0,
+					CreateTime:   time.Now(),
+					ModifyTime:   time.Now(),
+					IndexNameStr: indexName,
+					MarketName:   area,
+				}
+				indexList = append(indexList, item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v", err))
+		fmt.Println("PostHandleOilchem err", err)
+		return
+	}
+
+	return
+}
+
+// 美国API库存数据
+func AnalysisOilchemYuanYou12(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "国内独立炼厂产能利用率周数据") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:", title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr, "发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr, "来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v", err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr:not(.firstRow)").Each(func(ii int, table2 *goquery.Selection) {
+			table2.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3, "\n", "", -1)
+				text3 = strings.Replace(text3, " ", "", -1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				if area == "与上周增长比" {
+					area = ""
+					return
+				}
+
+				indexName := "美国API原油库存数据"
+				fmt.Println("indexName:", indexName)
+				fmt.Println("valueF:", value)
+				//unit := ""
+				//if strings.Contains(area, "产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:    indexName,
+					ClassifyId:   5,
+					Unit:         "亿桶",
+					Frequency:    "月度",
+					Describe:     "",
+					DataTime:     dataTime,
+					Value:        value,
+					Sort:         0,
+					CreateTime:   time.Now(),
+					ModifyTime:   time.Now(),
+					IndexNameStr: indexName,
+					MarketName:   "",
+				}
+				indexList = append(indexList, item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v", err))
+		fmt.Println("PostHandleOilchem err", err)
+		return
+	}
+
+	return
+}
+
+// 国际主要汇率收盘
+func AnalysisOilchemYuanYou13(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "国内独立炼厂产能利用率周数据") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:", title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr, "发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr, "来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v", err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr:not(.firstRow)").Each(func(ii int, table2 *goquery.Selection) {
+			table2.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3, "\n", "", -1)
+				text3 = strings.Replace(text3, " ", "", -1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+				indexName := "国际主要汇率收盘价" +"("+area+")"
+				fmt.Println("indexName:", indexName)
+				fmt.Println("valueF:", value)
+				//unit := ""
+				//if strings.Contains(area, "产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:    indexName,
+					ClassifyId:   5,
+					Unit:         "无",
+					Frequency:    "月度",
+					Describe:     "",
+					DataTime:     dataTime,
+					Value:        value,
+					Sort:         0,
+					CreateTime:   time.Now(),
+					ModifyTime:   time.Now(),
+					IndexNameStr: "国际主要汇率收盘价",
+					MarketName:   area,
+				}
+				indexList = append(indexList, item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v", err))
+		fmt.Println("PostHandleOilchem err", err)
+		return
+	}
+
+	return
+}

+ 288 - 0
services/base_from_oilchem/zhijiang_edb.go

@@ -0,0 +1,288 @@
+package services
+
+import (
+	"eta/eta_data_analysis/models"
+	"eta/eta_data_analysis/utils"
+	"fmt"
+	"github.com/PuerkitoBio/goquery"
+	"strings"
+	"time"
+)
+
+var ZhiJiangListMap = map[string]string {
+	"中国化机浆样本产量周数据分析" : "https://list.oilchem.net/2959/45240/",
+	"中国阔叶浆样本产量周数据分析" : "https://list.oilchem.net/2959/45240/",
+	"中国纸浆主流港口样本库存周数据分析" : "https://list.oilchem.net/2959/45241/",
+}
+
+func ZhiJiangList(num int) (err error) {
+	for k, v := range ZhiJiangListMap {
+		for i := 1; i < num; i++ {
+			listUrl := v + fmt.Sprintf("%d.html",i)
+			fmt.Println("listUrl:",listUrl)
+			htm, e := FetchPageHtml(listUrl)
+			if e != nil {
+				err = e
+				utils.FileLog.Error(fmt.Sprintf("FetchPageHtml err:%v",err))
+				fmt.Println("FetchPageHtml err",err)
+				return
+			}
+			err = AnalysisOilchemList(htm, k)
+			if err != nil {
+				utils.FileLog.Error(fmt.Sprintf("AnalysisOilchemList err:%v",err))
+				fmt.Println("AnalysisOilchemList err",err)
+				return
+			}
+			time.Sleep(2*time.Second)
+		}
+	}
+	return
+}
+
+
+
+// 中国化机浆样本产量,中国阔叶浆样本产量
+func AnalysisOilchemZhiJiang1(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国纸浆主流港口样本库存周数据") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国" + area + "样本产量"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             4,
+					Unit:                   "万吨",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           indexName,
+					MarketName:             "",
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}
+
+// 中国纸浆主流港口样本库存周数据
+func AnalysisOilchemZhiJiang2(htm []byte) (err error) {
+	if len(htm) == 0 {
+		utils.FileLog.Info("htm empty")
+		return
+	}
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(string(htm)))
+	if e != nil {
+		err = fmt.Errorf("NewDocumentFromReader err: %v", e)
+		return
+	}
+	//titleList := make([]string, 0)
+	unitList := make([]string, 0)
+	doc.Find("p").Each(func(i int, selection *goquery.Selection) {
+		ptext := selection.Text()
+		if strings.Contains(ptext, "单位:") {
+			unit := strings.Replace(ptext, "单位:", "", -1)
+			//fmt.Println("unit:",unit)
+			unitList = append(unitList, unit)
+		}
+		//if strings.Contains(ptext, "中国纸浆主流港口样本库存周数据") {
+		//	title := ptext
+		//	//fmt.Println("title:",title)
+		//	titleList = append(titleList, title)
+		//}
+	})
+	area := ""
+	title := doc.Find("h2").Text()
+	fmt.Println("title:",title)
+	createTimeStr := doc.Find("h2").Next().Text()
+	createTimeStr = strings.TrimLeft(createTimeStr,"发布时间:")
+	createTimeStrIndex := strings.Index(createTimeStr,"来源:")
+	createTimeStr = createTimeStr[:createTimeStrIndex]
+	createTimeStr = strings.TrimSpace(createTimeStr)
+	createTime, err := time.Parse(utils.HlbFormatDateTimeNoSecond, createTimeStr)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("time.Parse err:%v",err))
+		return
+	}
+	//fmt.Println("createTime:",createTime)
+	dataTime := createTime.Format(utils.FormatDate)
+	//fmt.Println("dataTime:",dataTime)
+
+	indexList := make([]*models.BaseFromOilchemIndex, 0)
+	doc.Find("tbody").Each(func(tableIndex int, table *goquery.Selection) {
+		table.Find("tr").First().Each(func(ii int, table2 *goquery.Selection) {
+			table.Find("td").Each(func(jj int, table3 *goquery.Selection) {
+				text3 := table3.Text()
+				text3 = strings.Replace(text3,"\n","",-1)
+				text3 = strings.Replace(text3," ","",-1)
+				if text3 == "上周" || text3 == "环比" || text3 == "地区" {
+					return
+				}
+				//fmt.Println("table3:",text3)
+				//utils.FileLog.Info(fmt.Sprintf("table3:%s",text3))
+				//fmt.Println("ii:",ii)
+				//utils.FileLog.Info(fmt.Sprintf("ii:%d",ii))
+				//fmt.Println("jj:",jj)
+				//utils.FileLog.Info(fmt.Sprintf("jj:%d",jj))
+				//fmt.Println("tableIndex:",tableIndex)
+				//utils.FileLog.Info(fmt.Sprintf("tableIndex:%d",tableIndex))
+
+				if utils.ContainsChinese(text3) && text3 != "本周" {
+					area = text3
+					return
+				}
+				if area == "" {
+					return
+				}
+				value := text3
+				value = strings.TrimRight(value, "%")
+				//valueF, e := strconv.ParseFloat(value, 64)
+				//if e != nil {
+				//	err = e
+				//	utils.FileLog.Error(fmt.Sprintf("strconv.ParseFloat err:%v",e))
+				//	return
+				//}
+
+
+				indexName := "中国纸浆主流港口样本库存" +"("+ area + ")"
+				fmt.Println("indexName:",indexName)
+				fmt.Println("valueF:",value)
+				//unit := ""
+				//if strings.Contains(area,"产量") {
+				//	unit = "万吨"
+				//} else {
+				//	unit = "%"
+				//}
+
+				item := &models.BaseFromOilchemIndex{
+					IndexName:              indexName,
+					ClassifyId:             4,
+					Unit:                   "万吨",
+					Frequency:              "周度",
+					Describe:               "",
+					DataTime:               dataTime,
+					Value:                  value,
+					Sort:                   0,
+					CreateTime:             time.Now(),
+					ModifyTime:             time.Now(),
+					IndexNameStr:           "中国纸浆主流港口样本库存",
+					MarketName:             area,
+				}
+				indexList = append(indexList,item)
+				area = ""
+			})
+		})
+	})
+
+	// 写入数据库
+	err = PostHandleOilchem(indexList)
+	if err != nil {
+		utils.FileLog.Error(fmt.Sprintf("PostHandleOilchem err:%v",err))
+		fmt.Println("PostHandleOilchem err",err)
+		return
+	}
+
+
+
+
+	return
+}

+ 4 - 4
services/base_from_yongyi.go

@@ -218,8 +218,8 @@ func YongyiDownloadWeekyly(cont context.Context) (err error) {
 	fmt.Printf("endDate: %s\n", endDate)
 	dataFileExsit := false
 	chartFileExist := false
-	filePath := fmt.Sprintf("%s-%s%s", startDate, endDate, "涌益咨询 周度数据.xlsx")
-	filePath = filepath.Join(utils.YongyiReadFilePath, filePath)
+	fileName := fmt.Sprintf("%s-%s%s", startDate, endDate, "涌益咨询 周度数据.xlsx")
+	filePath := filepath.Join(utils.YongyiReadFilePath, fileName)
 
 	fmt.Println("YongyiDownloadWeekyly: " + filePath)
 
@@ -228,7 +228,7 @@ func YongyiDownloadWeekyly(cont context.Context) (err error) {
 	if e == nil { //文件或者目录存在
 		dataFileExsit = true
 	} else if os.IsNotExist(e) { //文件或者目录不存在
-		filePath = filepath.Join(utils.YongyiFilePath, filePath)
+		filePath = filepath.Join(utils.YongyiFilePath, fileName)
 
 		fmt.Println("YongyiDownloadWeekyly: " + filePath)
 
@@ -245,7 +245,7 @@ func YongyiDownloadWeekyly(cont context.Context) (err error) {
 	if e == nil { //文件或者目录存在
 		chartFileExist = true
 	} else if os.IsNotExist(e) { //文件或者目录不存在
-		filePath = filepath.Join(utils.YongyiFilePath, filePath)
+		filePath = filepath.Join(utils.YongyiFilePath, fileName)
 		fmt.Println("YongyiDownloadWeekyly: " + filePath)
 		// 从已处理的表格中查询是否已存在,如果已存在,也无需下载
 		_, e = os.Stat(filePath)

+ 3 - 0
services/commodity_coal.go

@@ -342,6 +342,7 @@ func Coastal(path string) (err error) {
 	//path := "/Users/xi/Desktop/瑞茂通-中国煤炭市场网数据/442家晋陕蒙、沿海8省、内陆17省最新数据/内陆17省动力煤终端用户供耗存.xlsx"
 	//path := "D:\\瑞茂通-中国煤炭市场网数据\\442家晋陕蒙、沿海8省、内陆17省历史数据\\CⅢ-8-16 25省市库存和日耗情况(CCTD).xlsx"
 
+	fmt.Println("沿海开始")
 	var xlFile *xlsx.File
 	exist, err := PathExists(path)
 	if err != nil {
@@ -383,8 +384,10 @@ func Coastal(path string) (err error) {
 			rows = append(rows, row)
 		}
 		sheetData.Rows = rows
+		fmt.Println("rows:", len(rows))
 		sheetDatas = append(sheetDatas, sheetData)
 	}
+	fmt.Println("sheetDatas:", len(sheetDatas))
 
 	params := make(map[string]interface{})
 	params["SheetData"] = sheetDatas

+ 52 - 0
services/fenwei/base_from_fenwei_service.go

@@ -0,0 +1,52 @@
+// Package fenwei
+// @Author gmy 2024/8/20 15:06:00
+package fenwei
+
+import (
+	"context"
+	"encoding/json"
+	"eta/eta_data_analysis/models"
+	"eta/eta_data_analysis/utils"
+	"fmt"
+	"os"
+)
+
+// FenWeiNetDataDeal 汾渭网络数据处理
+func FenWeiNetDataDeal(context.Context) (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println("FenWeiNetDataDeal Err:" + err.Error())
+			utils.FileLog.Info(fmt.Sprintf("FenWeiNetDataDeal Err: %s", err.Error()))
+		}
+	}()
+	utils.FileLog.Info("FenWeiNetDataDeal start")
+	// 读取配置
+	configFile, err := os.ReadFile(utils.FenweiNetJsonPath)
+	if err != nil {
+		utils.FileLog.Info(fmt.Sprintf("读取配置文件错误: %v", err))
+		return
+	}
+
+	// 定义通用的 map 结构体来解析 JSON
+	var config models.JsonConfig
+
+	// 解析 JSON 文件内容
+	err = json.Unmarshal(configFile, &config)
+	if err != nil {
+		utils.FileLog.Info(fmt.Sprintf("解析配置文件错误: %v", err))
+		return
+	}
+
+	factory := ProcessorFactory{}
+	// 遍历调用对应的处理方法
+	for _, v := range config.Data {
+		processor := factory.CreateProcessor(v)
+		err = processor.FetchAndProcess(processor)
+		if err != nil {
+			utils.FileLog.Info(fmt.Sprintf("处理数据错误: %v", err))
+			return
+		}
+	}
+	utils.FileLog.Info("FenWeiNetDataDeal end")
+	return
+}

+ 266 - 0
services/fenwei/data_processor.go

@@ -0,0 +1,266 @@
+// Package fenwei
+// @Author gmy 2024/8/20 14:47:00
+package fenwei
+
+import (
+	"bytes"
+	"context"
+	"encoding/json"
+	"eta/eta_data_analysis/models"
+	"eta/eta_data_analysis/utils"
+	"fmt"
+	"github.com/chromedp/cdproto/network"
+	"github.com/chromedp/chromedp"
+	"io"
+	"io/ioutil"
+	"log"
+	"net/http"
+	"strings"
+	"sync"
+	"time"
+)
+
+type DataProcessor interface {
+	FetchAndProcess(DataProcessor) error
+	GenerateRequestParams(currentTime string) map[string]string
+	ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error)
+}
+
+type BaseProcessor struct {
+	URL string
+}
+
+var (
+	authorization string
+	authLock      sync.RWMutex
+)
+
+func (p *BaseProcessor) FetchAndProcess(processor DataProcessor) error {
+
+	// 获取当前时间 yyyy-MM-dd
+	now := time.Now()
+	currentTime := now.Format(utils.FormatDateUnSpace)
+
+	// 请求参数
+	params := processor.GenerateRequestParams(currentTime)
+	// 保存请求参数
+	originalRequestBody := params["params"] // 保存原始请求数据
+
+	requestBody := bytes.NewBufferString(originalRequestBody)
+	req, err := http.NewRequest("POST", p.URL, requestBody)
+	if err != nil {
+		return err
+	}
+
+	// 设置请求头
+	req.Header.Set("Content-Type", "application/json")
+	req.Header.Set("accept-language", "zh-CN,zh;q=0.9")
+
+	authLock.RLock()
+	req.Header.Set("Authorization", authorization)
+	authLock.RUnlock()
+
+	client := &http.Client{}
+	resp, err := client.Do(req)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+
+	body, err := io.ReadAll(resp.Body)
+	if err != nil {
+		return err
+	}
+	if checkResp(string(body)) {
+		authLock.Lock()
+
+		// 登录获取Authorization
+		authorization, err = getAuthorizationByChrome()
+		if err != nil {
+			authLock.Unlock()
+			return err
+		}
+		authLock.Unlock()
+
+		// 重新创建请求对象
+		requestBody = bytes.NewBufferString(originalRequestBody)
+		req, err = http.NewRequest("POST", p.URL, requestBody)
+		if err != nil {
+			return err
+		}
+
+		// 重新设置请求头
+		req.Header.Set("Content-Type", "application/json")
+		req.Header.Set("accept-language", "zh-CN,zh;q=0.9")
+		req.Header.Set("Authorization", authorization)
+
+		// 重新请求
+		resp, err = client.Do(req)
+		if err != nil {
+			return err
+		}
+		defer resp.Body.Close()
+
+		body, err = io.ReadAll(resp.Body)
+		if err != nil {
+			return err
+		}
+	}
+
+	// 数据处理
+	response, err := processor.ProcessResponse(string(body))
+	if err != nil {
+		return err
+	}
+	log.Printf("response size: %v", len(response))
+	utils.FileLog.Info(fmt.Sprintf("response: %v", response))
+
+	// 请求lib应用入库
+	paramsLib := make(map[string]interface{})
+	paramsLib["List"] = response
+	paramsLib["TerminalCode"] = utils.TerminalCode
+	postEdbLib, err := postEdbLib(paramsLib, utils.LIB_ROUTE_FENWEI_NET_DATA_HANDLE)
+	if err != nil {
+		// 有错误就不继续执行
+		log.Printf("postEdbLib err: %v", err)
+		return err
+	}
+	log.Printf("postEdbLib size: %v", len(postEdbLib))
+	utils.FileLog.Info(fmt.Sprintf("postEdbLib: %v", string(postEdbLib)))
+	return nil
+}
+
+// PostEdbLib 调用指标接口
+func postEdbLib(param map[string]interface{}, method string) (result []byte, err error) {
+	postUrl := utils.EDB_LIB_URL + method
+	postData, err := json.Marshal(param)
+	if err != nil {
+		return
+	}
+	result, err = httpPost(postUrl, string(postData), "application/json")
+	if err != nil {
+		return
+	}
+	return
+}
+
+func httpPost(url, postData string, params ...string) ([]byte, error) {
+	fmt.Println("HttpPost Url:" + url)
+	body := ioutil.NopCloser(strings.NewReader(postData))
+	client := &http.Client{}
+	req, err := http.NewRequest("POST", url, body)
+	if err != nil {
+		return nil, err
+	}
+	contentType := "application/x-www-form-urlencoded;charset=utf-8"
+	if len(params) > 0 && params[0] != "" {
+		contentType = params[0]
+	}
+	req.Header.Set("Content-Type", contentType)
+	req.Header.Set("authorization", utils.MD5(utils.APP_EDB_LIB_NAME_EN+utils.EDB_LIB_Md5_KEY))
+	resp, err := client.Do(req)
+	if err != nil {
+		fmt.Println("client.Do err:" + err.Error())
+		return nil, err
+	}
+	defer resp.Body.Close()
+	b, err := ioutil.ReadAll(resp.Body)
+	if err != nil {
+		fmt.Println("HttpPost:" + string(b))
+	}
+	return b, err
+}
+
+// resp响应参数检测 code or message 判断是否需要重新登录
+func checkResp(resp string) bool {
+	if resp == "" {
+		return true
+	}
+	var responseObj models.Response
+	err := json.Unmarshal([]byte(resp), &responseObj)
+	if err != nil {
+		return false
+	}
+	if responseObj.Code != 200 || responseObj.Message != "成功!" {
+		return true
+	}
+
+	return false
+}
+
+// GenerateRequestParams 让子类来实现这个方法
+func (p *BaseProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	return map[string]string{}
+}
+
+func (p *BaseProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+
+	return nil, nil
+}
+
+// GetAuthorizationByChrome 获取Authorization
+func getAuthorizationByChrome() (authorization string, err error) {
+	// 检查账号和密码是否设置
+	if utils.FenweiNetUseName == "" {
+		return "", fmt.Errorf("汾渭账号未设置")
+	}
+	if utils.FenweiNetPassword == "" {
+		return "", fmt.Errorf("汾渭密码未设置")
+	}
+
+	opts := append(
+		chromedp.DefaultExecAllocatorOptions[:],
+		chromedp.Flag("headless", false),
+	)
+	allocCtx, cancel1 := chromedp.NewExecAllocator(context.Background(), opts...)
+	defer cancel1()
+
+	// 创建chrome实例
+	ctx, cancel2 := chromedp.NewContext(
+		allocCtx,
+		chromedp.WithLogf(log.Printf),
+	)
+	defer cancel2()
+
+	// 提前设置监听器
+	authorizationChan := make(chan string, 1) // 使用channel来确保监听到的Authorization可以安全传递
+	chromedp.ListenTarget(ctx, func(ev interface{}) {
+		if ev, ok := ev.(*network.EventRequestWillBeSent); ok {
+			if authHeader, found := ev.Request.Headers["Authorization"]; found {
+				if authStr, ok := authHeader.(string); ok {
+					select {
+					case authorizationChan <- authStr: // 将Authorization放入channel
+					default:
+					}
+					utils.FileLog.Info("Authorization header found: " + authStr)
+				}
+			}
+		}
+	})
+
+	// 运行浏览器操作
+	err = chromedp.Run(ctx,
+		chromedp.Navigate(`https://www.sxcoal.com/`),
+		chromedp.Click(`.pc_content__jO_mq`, chromedp.ByQuery),
+		chromedp.Sleep(2*time.Second),
+
+		chromedp.SetValue(`div.Sign_username__7eYwE input[type="text"]`, utils.FenweiNetUseName, chromedp.ByQuery),
+		chromedp.SetValue(`div.Sign_password__dwxMn input[type="password"]`, utils.FenweiNetPassword, chromedp.ByQuery),
+		chromedp.Sleep(2*time.Second),
+
+		// 定位并点击指定按钮(class属性为 'Button_btn__xbZjp Button_black__X_jwF Button_mediu__ZVHO_',并且 span 标签内容为 '登录')
+		chromedp.Click(`//button[contains(@class, 'Button_btn__xbZjp') and contains(@class, 'Button_black__X_jwF') and contains(@class, 'Button_mediu__ZVHO_')]/span[text()='登录']`, chromedp.BySearch),
+
+		// 添加延迟,确保捕获到请求头
+		chromedp.Sleep(8*time.Second),
+	)
+
+	// 从channel中获取authorization
+	select {
+	case authorization = <-authorizationChan:
+	case <-time.After(10 * time.Second): // 超时时间,可以根据实际情况调整
+		err = fmt.Errorf("未能获取到Authorization")
+	}
+
+	return
+}

+ 1378 - 0
services/fenwei/processor_business_logic.go

@@ -0,0 +1,1378 @@
+// Package fenwei
+// @Author gmy 2024/8/20 14:47:00
+package fenwei
+
+import (
+	"encoding/json"
+	"eta/eta_data_analysis/models"
+	"eta/eta_data_analysis/utils"
+	"fmt"
+	"strings"
+)
+
+// ThermalCoalSupplyProcessor 动力煤供应量
+type ThermalCoalSupplyProcessor struct {
+	BaseProcessor
+}
+
+func (p *ThermalCoalSupplyProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: nil,
+		CheckedDims: map[string][]string{
+			"province": {"20", "16", "21", "6", "19", "23", "8", "1", "7", "17", "9", "15", "11", "22", "24", "4", "25", "12", "14", "13", "18", "3", "10", "5", "2", "37"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW4002D",
+		QuotaName:    "monthly_value,monthly_accumulation",
+		SplitTypeKey: "province",
+		IsTotal:      0,
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *ThermalCoalSupplyProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseData := fillFenWeiNetResponseData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "动力煤供应量"
+	for _, data := range responseData {
+		var frequency string
+		if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+			frequency = "月度"
+		} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+			frequency = "周度"
+		} else {
+			frequency = "日度"
+		}
+
+		indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+			IndexName:    productName + data.ProvinceName + "/汾渭",
+			Unit:         data.MonthlyValueChnUnit,
+			Frequency:    frequency,
+			TerminalCode: utils.TerminalCode,
+			ClassifyName: productName,
+			DataTime:     data.DataDate,
+			Value:        data.MonthlyValue,
+		})
+	}
+
+	return indexInfoList, nil
+}
+
+// CokingCleanCoalSupplyProcessor 炼焦精煤供应量
+type CokingCleanCoalSupplyProcessor struct {
+	BaseProcessor
+}
+
+func (p *CokingCleanCoalSupplyProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: nil,
+		CheckedDims: map[string][]string{
+			"province":  {"20", "16", "21", "6", "19", "23", "8", "1", "7", "17", "9", "15", "11", "22", "24", "4", "25", "12", "14", "13", "18", "3", "10", "5", "2", "37"},
+			"coal_type": {"13", "10", "9", "8", "7", "5", "3"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW4001D",
+		QuotaName:    "monthly_value,monthly_accumulation",
+		SplitTypeKey: "coal_type",
+		IsTotal:      0,
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *CokingCleanCoalSupplyProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseData := fillFenWeiNetResponseData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "炼焦精煤供应量"
+	for _, data := range responseData {
+		var frequency string
+		if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+			frequency = "月度"
+		} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+			frequency = "周度"
+		} else {
+			frequency = data.MonthlyValueChnName
+		}
+
+		indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+			IndexName:    productName + data.CoalTypeName + "/汾渭",
+			Unit:         data.MonthlyValueChnUnit,
+			Frequency:    frequency,
+			TerminalCode: utils.TerminalCode,
+			ClassifyName: productName,
+			DataTime:     data.DataDate,
+			Value:        data.MonthlyValue,
+		})
+	}
+
+	return indexInfoList, nil
+}
+
+// RawCoalProvinceProductionProcessor 原煤分省分煤种产量
+type RawCoalProvinceProductionProcessor struct {
+	BaseProcessor
+}
+
+func (p *RawCoalProvinceProductionProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: nil,
+		CheckedDims: map[string][]string{
+			"province":  {"20", "16", "21", "6", "19", "23", "8", "1", "7", "17", "9", "15", "11", "22", "24", "4", "25", "12", "14", "13", "18", "3", "10", "5", "2", "37"},
+			"coal_type": {"14", "6", "40", "21"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW3050D",
+		QuotaName:    "monthly_value,monthly_accumulation",
+		SplitTypeKey: "coal_type",
+		IsTotal:      0,
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *RawCoalProvinceProductionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseData := fillFenWeiNetResponseData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "原煤分省分煤种产量"
+	for _, data := range responseData {
+		var frequency string
+		if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+			frequency = "月度"
+		} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+			frequency = "周度"
+		} else {
+			frequency = data.MonthlyValueChnName
+		}
+
+		indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+			IndexName:    productName + data.CoalTypeName + "/汾渭",
+			Unit:         data.MonthlyValueChnUnit,
+			Frequency:    frequency,
+			TerminalCode: utils.TerminalCode,
+			ClassifyName: productName,
+			DataTime:     data.DataDate,
+			Value:        data.MonthlyValue,
+		})
+	}
+
+	return indexInfoList, nil
+}
+
+// StateOwnedKeyCoalMineRawCoalProductionProcessor 国有重点煤矿原煤产量
+type StateOwnedKeyCoalMineRawCoalProductionProcessor struct {
+	BaseProcessor
+}
+
+func (p *StateOwnedKeyCoalMineRawCoalProductionProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: nil,
+		CheckedDims: map[string][]string{
+			"province": {"20", "16", "21", "6", "19", "23", "8", "1", "7", "17", "9", "15", "11", "22", "24", "4", "25", "12", "14", "13", "2", "27", "28"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW3007D",
+		QuotaName:    "monthly_value,monthly_accumulation",
+		SplitTypeKey: "province",
+		IsTotal:      0,
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *StateOwnedKeyCoalMineRawCoalProductionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseData := fillFenWeiNetResponseData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "国有重点煤矿原煤产量"
+	for _, data := range responseData {
+		var frequency string
+		if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+			frequency = "月度"
+		} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+			frequency = "周度"
+		} else {
+			frequency = data.MonthlyValueChnName
+		}
+
+		indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+			IndexName:    productName + data.ProvinceName + "/汾渭",
+			Unit:         data.MonthlyValueChnUnit,
+			Frequency:    frequency,
+			TerminalCode: utils.TerminalCode,
+			ClassifyName: productName,
+			DataTime:     data.DataDate,
+			Value:        data.MonthlyValue,
+		})
+	}
+
+	return indexInfoList, nil
+}
+
+// CokingBituminousCoalProductionProcessor 炼焦烟煤分煤种产量
+type CokingBituminousCoalProductionProcessor struct {
+	BaseProcessor
+}
+
+func (p *CokingBituminousCoalProductionProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: nil,
+		CheckedDims: map[string][]string{
+			"province":  {"20", "16", "21", "6", "19", "23", "8", "1", "7", "17", "9", "15", "11", "22", "24", "4", "25", "12", "14", "13", "18", "3", "10", "5", "2", "37"},
+			"coal_type": {"13", "10", "9", "8", "7", "5", "3"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW3001D",
+		QuotaName:    "monthly_value,monthly_accumulation",
+		SplitTypeKey: "coal_type",
+		IsTotal:      0,
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *CokingBituminousCoalProductionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseData := fillFenWeiNetResponseData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "炼焦烟煤分煤种产量"
+	for _, data := range responseData {
+		var frequency string
+		if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+			frequency = "月度"
+		} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+			frequency = "周度"
+		} else {
+			frequency = data.MonthlyValueChnName
+		}
+
+		indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+			IndexName:    productName + data.CoalTypeName + "/汾渭",
+			Unit:         data.MonthlyValueChnUnit,
+			Frequency:    frequency,
+			TerminalCode: utils.TerminalCode,
+			ClassifyName: productName,
+			DataTime:     data.DataDate,
+			Value:        data.MonthlyValue,
+		})
+	}
+
+	return indexInfoList, nil
+}
+
+// ThermalCoalInventorySocietyProcessor 动力煤库存-全社会
+type ThermalCoalInventorySocietyProcessor struct {
+	BaseProcessor
+}
+
+func (p *ThermalCoalInventorySocietyProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: "79",
+		CheckedDims: map[string][]string{
+			"product_item_code": {"FW8004D-1"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW8004D",
+		QuotaName:    "stock,avaliable_days,daily_consumption,monthly_value,inventory_index,week_value",
+		SplitTypeKey: "",
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *ThermalCoalInventorySocietyProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseDataMap := fillFenWeiNetResponseMapData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "动力煤库存-全社会"
+
+	for productCategoryName, responseDataList := range responseDataMap {
+		if productCategoryName != productName {
+			continue
+		}
+
+		for _, data := range responseDataList {
+			var frequency string
+			if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+				frequency = "月度"
+			} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+				frequency = "周度"
+			} else {
+				frequency = data.MonthlyValueChnName
+			}
+
+			indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+				IndexName:    productName + "/汾渭",
+				Unit:         data.MonthlyValueChnUnit,
+				Frequency:    frequency,
+				TerminalCode: utils.TerminalCode,
+				ClassifyName: productName,
+				DataTime:     data.DataDate,
+				Value:        data.MonthlyValue,
+			})
+		}
+	}
+
+	return indexInfoList, nil
+}
+
+// ThermalCoalInventoryProductionProcessor 动力煤库存-生产企业
+type ThermalCoalInventoryProductionProcessor struct {
+	BaseProcessor
+}
+
+func (p *ThermalCoalInventoryProductionProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: "116",
+		CheckedDims: map[string][]string{
+			"product_item_code": {"FW8004D-2"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW8004D",
+		QuotaName:    "stock,avaliable_days,daily_consumption,monthly_value,inventory_index,week_value",
+		SplitTypeKey: "",
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *ThermalCoalInventoryProductionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseDataMap := fillFenWeiNetResponseMapData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "动力煤库存-生产企业"
+
+	for productCategoryName, responseDataList := range responseDataMap {
+		if productCategoryName != productName {
+			continue
+		}
+
+		for _, data := range responseDataList {
+			var frequency string
+			if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+				frequency = "月度"
+			} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+				frequency = "周度"
+			} else {
+				frequency = data.MonthlyValueChnName
+			}
+
+			indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+				IndexName:    productName + "/汾渭",
+				Unit:         data.WeekValueChnUnit,
+				Frequency:    frequency,
+				TerminalCode: utils.TerminalCode,
+				ClassifyName: productName,
+				DataTime:     data.DataDate,
+				Value:        data.MonthlyValue,
+			})
+		}
+	}
+
+	return indexInfoList, nil
+}
+
+// ThermalCoalInventorySixPowerPlantProcessor 动力煤库存-六大电厂
+type ThermalCoalInventorySixPowerPlantProcessor struct {
+	BaseProcessor
+}
+
+func (p *ThermalCoalInventorySixPowerPlantProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: "118",
+		CheckedDims: map[string][]string{
+			"product_item_code": {"FW8004D-125500", "FW8004D-112534", "FW8004D-112548", "FW8004D-112549", "FW8004D-1129", "FW8004D-125", "FW8004D-125382", "FW8004D-125383"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW8004D",
+		QuotaName:    "stock,avaliable_days,daily_consumption,monthly_value,inventory_index,week_value",
+		SplitTypeKey: "",
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *ThermalCoalInventorySixPowerPlantProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseDataMap := fillFenWeiNetResponseMapData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "动力煤库存"
+
+	for productCategoryName, responseDataList := range responseDataMap {
+
+		for _, data := range responseDataList {
+			var frequency string
+			if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+				frequency = "月度"
+			} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+				frequency = "周度"
+			} else {
+				frequency = "日度"
+			}
+
+			classifyName := "动力煤库存-六大电厂"
+
+			// 库存
+			indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+				IndexName:    productName + productCategoryName + data.StockChnName + "/汾渭",
+				Unit:         data.StockChnUnit,
+				Frequency:    frequency,
+				TerminalCode: utils.TerminalCode,
+				ClassifyName: classifyName,
+				DataTime:     data.DataDate,
+				Value:        data.Stock,
+			})
+			// 可用天数
+			indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+				IndexName:    productName + productCategoryName + data.AvaliableDaysChnName + "/汾渭",
+				Unit:         data.AvaliableDaysChnUnit,
+				Frequency:    frequency,
+				TerminalCode: utils.TerminalCode,
+				ClassifyName: classifyName,
+				DataTime:     data.DataDate,
+				Value:        data.AvaliableDays,
+			})
+			// 日耗
+			indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+				IndexName:    productName + productCategoryName + data.DailyConsumptionChnName + "/汾渭",
+				Unit:         data.DailyConsumptionChnUnit,
+				Frequency:    frequency,
+				TerminalCode: utils.TerminalCode,
+				ClassifyName: classifyName,
+				DataTime:     data.DataDate,
+				Value:        data.DailyConsumption,
+			})
+		}
+	}
+
+	return indexInfoList, nil
+}
+
+// CokingCoalInventorySocietyProcessor 炼焦煤库存-全社会
+type CokingCoalInventorySocietyProcessor struct {
+	BaseProcessor
+}
+
+func (p *CokingCoalInventorySocietyProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: "79",
+		CheckedDims: map[string][]string{
+			"product_item_code": {"FW8005D-1"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW8005D",
+		QuotaName:    "stock,monthly_value,inventory_index,week_value",
+		SplitTypeKey: "",
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *CokingCoalInventorySocietyProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseDataMap := fillFenWeiNetResponseMapData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "炼焦煤库存-全社会"
+
+	for productCategoryName, responseDataList := range responseDataMap {
+		if productCategoryName == "合计" {
+			continue
+		}
+		for _, data := range responseDataList {
+			var frequency string
+			if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+				frequency = "月度"
+			} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+				frequency = "周度"
+			} else {
+				frequency = data.MonthlyValueChnName
+			}
+
+			indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+				IndexName:    productCategoryName + "/汾渭",
+				Unit:         data.MonthlyValueChnUnit,
+				Frequency:    frequency,
+				TerminalCode: utils.TerminalCode,
+				ClassifyName: productName,
+				DataTime:     data.DataDate,
+				Value:        data.MonthlyValue,
+			})
+		}
+	}
+
+	return indexInfoList, nil
+}
+
+// CokingCoalInventoryProductionProcessor 炼焦煤库存-生产企业
+type CokingCoalInventoryProductionProcessor struct {
+	BaseProcessor
+}
+
+func (p *CokingCoalInventoryProductionProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: "116",
+		CheckedDims: map[string][]string{
+			"product_item_code": {"FW8005D-2"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW8005D",
+		QuotaName:    "stock,monthly_value,inventory_index,week_value",
+		SplitTypeKey: "",
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *CokingCoalInventoryProductionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseDataMap := fillFenWeiNetResponseMapData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "炼焦煤库存-生产企业"
+
+	for productCategoryName, responseDataList := range responseDataMap {
+		if productCategoryName == "合计" {
+			continue
+		}
+		for _, data := range responseDataList {
+			var frequency string
+			if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+				frequency = "月度"
+			} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+				frequency = "周度"
+			} else {
+				frequency = data.MonthlyValueChnName
+			}
+
+			indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+				IndexName:    productCategoryName + "/汾渭",
+				Unit:         data.WeekValueChnUnit,
+				Frequency:    frequency,
+				TerminalCode: utils.TerminalCode,
+				ClassifyName: productName,
+				DataTime:     data.DataDate,
+				Value:        data.WeekValue,
+			})
+		}
+	}
+
+	return indexInfoList, nil
+}
+
+// CokingCoalInventoryDownstreamProcessor 炼焦煤库存-下游企业
+type CokingCoalInventoryDownstreamProcessor struct {
+	BaseProcessor
+}
+
+func (p *CokingCoalInventoryDownstreamProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: "117",
+		CheckedDims: map[string][]string{
+			"product_item_code": {"FW8005D-3", "FW8005D-5"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW8005D",
+		QuotaName:    "stock,monthly_value,inventory_index,week_value",
+		SplitTypeKey: "",
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *CokingCoalInventoryDownstreamProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseDataMap := fillFenWeiNetResponseMapData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "炼焦煤库存-下游企业"
+
+	for productCategoryName, responseDataList := range responseDataMap {
+		if productCategoryName == "合计" {
+			continue
+		}
+		for _, data := range responseDataList {
+			frequency := "周度"
+
+			indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+				IndexName:    productCategoryName + "/汾渭",
+				Unit:         data.StockChnUnit,
+				Frequency:    frequency,
+				TerminalCode: utils.TerminalCode,
+				ClassifyName: productName,
+				DataTime:     data.DataDate,
+				Value:        data.Stock,
+			})
+		}
+	}
+
+	return indexInfoList, nil
+}
+
+// NationalCoalMineInventoryProcessor 全国煤矿库存
+type NationalCoalMineInventoryProcessor struct {
+	BaseProcessor
+}
+
+func (p *NationalCoalMineInventoryProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category:     nil,
+		CheckedDims:  map[string][]string{},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW8001D",
+		QuotaName:    "monthly_value",
+		SplitTypeKey: "",
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *NationalCoalMineInventoryProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseData := fillFenWeiNetResponseData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "全国煤矿库存"
+
+	for _, data := range responseData {
+		var frequency string
+		if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+			frequency = "月度"
+		} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+			frequency = "周度"
+		} else {
+			frequency = "日度"
+		}
+
+		indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+			IndexName:    productName + "/汾渭",
+			Unit:         data.MonthlyValueChnUnit,
+			Frequency:    frequency,
+			TerminalCode: utils.TerminalCode,
+			ClassifyName: productName,
+			DataTime:     data.DataDate,
+			Value:        data.MonthlyValue,
+		})
+	}
+
+	return indexInfoList, nil
+}
+
+// StateOwnedKeyCoalMineInventoryProcessor 国有重点煤矿库存
+type StateOwnedKeyCoalMineInventoryProcessor struct {
+	BaseProcessor
+}
+
+func (p *StateOwnedKeyCoalMineInventoryProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: nil,
+		CheckedDims: map[string][]string{
+			"province": {"20", "16", "21", "6", "19", "23", "8", "1", "7", "17", "9", "15", "11", "22", "24", "4", "25", "12", "14", "13", "2", "27", "28"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW8003D",
+		QuotaName:    "monthly_value",
+		SplitTypeKey: "province",
+		IsTotal:      "",
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *StateOwnedKeyCoalMineInventoryProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseData := fillFenWeiNetResponseData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "国有重点煤矿库存"
+
+	for _, data := range responseData {
+		var frequency string
+		if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+			frequency = "月度"
+		} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+			frequency = "周度"
+		} else {
+			frequency = "日度"
+		}
+
+		indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+			IndexName:    productName + data.ProvinceName + "/汾渭",
+			Unit:         data.MonthlyValueChnUnit,
+			Frequency:    frequency,
+			TerminalCode: utils.TerminalCode,
+			ClassifyName: productName,
+			DataTime:     data.DataDate,
+			Value:        data.MonthlyValue,
+		})
+	}
+
+	return indexInfoList, nil
+}
+
+// CokeInventoryProcessor 焦炭库存
+type CokeInventoryProcessor struct {
+	BaseProcessor
+}
+
+func (p *CokeInventoryProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: nil,
+		CheckedDims: map[string][]string{
+			"product_item_code": {"FW1405D-1", "FW1405D-2", "FW1405D-3", "FW1405D-4", "FW1405D-5", "FW1405D-6", "FW1405D-7"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW1405D",
+		QuotaName:    "stock,inventory_index",
+		SplitTypeKey: "",
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *CokeInventoryProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseDataMap := fillFenWeiNetResponseMapData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "焦炭库存"
+	for productCategoryName, responseDataList := range responseDataMap {
+		utils.FileLog.Info(fmt.Sprintf("productName: %s, responseDataList:size: %v", productName, len(responseDataList)))
+		for _, data := range responseDataList {
+			var frequency string
+			productCodeMap := map[string]struct{}{
+				"FW1405D-1": {},
+				"FW1405D-2": {},
+				"FW1405D-3": {},
+				"FW1405D-6": {},
+				"FW1405D-7": {},
+			}
+			if _, ok := productCodeMap[data.ProductItemCode]; ok {
+				frequency = "周度"
+			} else {
+				frequency = "日度"
+			}
+
+			var unit string
+			if data.InventoryIndexChnUnit != "" {
+				unit = data.InventoryIndexChnUnit
+			} else {
+				unit = data.StockChnUnit
+			}
+
+			var value float64
+			if data.InventoryIndex != 0 {
+				value = data.InventoryIndex
+			} else {
+				value = data.Stock
+			}
+
+			indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+				IndexName:    productName + productCategoryName + "/汾渭",
+				Unit:         unit,
+				Frequency:    frequency,
+				TerminalCode: utils.TerminalCode,
+				ClassifyName: productName,
+				DataTime:     data.DataDate,
+				Value:        value,
+			})
+		}
+	}
+
+	return indexInfoList, nil
+}
+
+// PortDataInventoryNorthernPortProcessor 港口数据-库存-北方港口
+type PortDataInventoryNorthernPortProcessor struct {
+	BaseProcessor
+}
+
+func (p *PortDataInventoryNorthernPortProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: "79",
+		CheckedDims: map[string][]string{
+			"code": {"2332", "2333", "2335", "2334", "2337", "2339", "2340", "2341", "2342"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW1203D",
+		QuotaName:    "stock",
+		SplitTypeKey: "product_item_code",
+		IsTotal:      0,
+		DataType:     nil,
+		Type:         2,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *PortDataInventoryNorthernPortProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseData := fillFenWeiNetResponseData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "港口数据-库存-北方港口"
+
+	for _, data := range responseData {
+		var frequency string
+		if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+			frequency = "月度"
+		} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+			frequency = "周度"
+		} else {
+			frequency = "日度"
+		}
+
+		indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+			IndexName:    productName + data.ProductItemName + "/汾渭",
+			Unit:         data.StockChnUnit,
+			Frequency:    frequency,
+			TerminalCode: utils.TerminalCode,
+			ClassifyName: productName,
+			DataTime:     data.DataDate,
+			Value:        data.Stock,
+		})
+	}
+
+	return indexInfoList, nil
+}
+
+// PortDataInventoryInlandPortProcessor 港口数据-库存-江内港口
+type PortDataInventoryInlandPortProcessor struct {
+	BaseProcessor
+}
+
+func (p *PortDataInventoryInlandPortProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: "79",
+		CheckedDims: map[string][]string{
+			"code": {"2321", "2320", "2324", "2323", "2322", "2325"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW1203D",
+		QuotaName:    "stock",
+		SplitTypeKey: "product_item_code",
+		IsTotal:      0,
+		DataType:     nil,
+		Type:         2,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *PortDataInventoryInlandPortProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseData := fillFenWeiNetResponseData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "港口数据-库存-江内港口"
+
+	for _, data := range responseData {
+		var frequency = "周度"
+
+		indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+			IndexName:    productName + data.ProductItemName + "/汾渭",
+			Unit:         data.StockChnUnit,
+			Frequency:    frequency,
+			TerminalCode: utils.TerminalCode,
+			ClassifyName: productName,
+			DataTime:     data.DataDate,
+			Value:        data.Stock,
+		})
+	}
+
+	return indexInfoList, nil
+}
+
+// PortDataDispatchNorthernPortProcessor 港口数据-调度-北方港口
+type PortDataDispatchNorthernPortProcessor struct {
+	BaseProcessor
+}
+
+func (p *PortDataDispatchNorthernPortProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: "120",
+		CheckedDims: map[string][]string{
+			"code": {"2364", "2365", "2366", "2363", "2367", "2368"},
+			"port": {"2", "4", "7", "9", "11", "326", "327", "329", "330"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW1203D",
+		QuotaName:    "vehicle,ship,tons",
+		SplitTypeKey: "product_item_code,port",
+		IsTotal:      1,
+		DataType:     nil,
+		Type:         2,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *PortDataDispatchNorthernPortProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseData := fillFenWeiNetResponseData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "港口数据-调度-北方港口"
+
+	for _, data := range responseData {
+		var frequency = "日度"
+		var unit string
+		if data.VehicleChnUnit != "" {
+			unit = data.VehicleChnUnit
+		} else if data.TonsChnUnit != "" {
+			unit = data.TonsChnUnit
+		} else {
+			unit = data.ShipChnUnit
+		}
+
+		indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+			IndexName:    productName + "-" + data.PortName + data.ProductItemName + "/汾渭",
+			Unit:         unit,
+			Frequency:    frequency,
+			TerminalCode: utils.TerminalCode,
+			ClassifyName: productName,
+			DataTime:     data.DataDate,
+			Value:        data.Tons,
+		})
+	}
+
+	return indexInfoList, nil
+}
+
+// PortDataThroughputProcessor 港口数据-运量
+type PortDataThroughputProcessor struct {
+	BaseProcessor
+}
+
+func (p *PortDataThroughputProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: "30",
+		CheckedDims: map[string][]string{
+			"code":     {"2362"},
+			"port_son": {"44", "43", "42", "41", "40", "39"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW1203D",
+		QuotaName:    "transport_volume",
+		SplitTypeKey: "port_son",
+		IsTotal:      0,
+		DataType:     nil,
+		Type:         2,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *PortDataThroughputProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseData := fillFenWeiNetResponseData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "港口数据-运量"
+
+	for _, data := range responseData {
+		var frequency = "日度"
+
+		indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+			IndexName:    productName + data.PortSonName + "/汾渭",
+			Unit:         data.TransportVolumeChnUnit,
+			Frequency:    frequency,
+			TerminalCode: utils.TerminalCode,
+			ClassifyName: productName,
+			DataTime:     data.DataDate,
+			Value:        data.TransportVolume,
+		})
+	}
+
+	return indexInfoList, nil
+}
+
+// DaqinLineDailyThroughputProcessor 大秦线日运量
+type DaqinLineDailyThroughputProcessor struct {
+	BaseProcessor
+}
+
+func (p *DaqinLineDailyThroughputProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category:     nil,
+		CheckedDims:  map[string][]string{},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW1107D",
+		QuotaName:    "stock",
+		SplitTypeKey: "",
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *DaqinLineDailyThroughputProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseData := fillFenWeiNetResponseData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "大秦线日运量"
+
+	for _, data := range responseData {
+		var frequency = "日度"
+
+		indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+			IndexName:    productName + data.StockChnName + "/汾渭",
+			Unit:         data.StockChnUnit,
+			Frequency:    frequency,
+			TerminalCode: utils.TerminalCode,
+			ClassifyName: productName,
+			DataTime:     data.DataDate,
+			Value:        data.Stock,
+		})
+	}
+
+	return indexInfoList, nil
+}
+
+// ThermalCoalPortPriceProcessor 动力煤港口价格
+type ThermalCoalPortPriceProcessor struct {
+	BaseProcessor
+}
+
+func (p *ThermalCoalPortPriceProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: nil,
+		CheckedDims: map[string][]string{
+			"product_item_code": {"FW2001P-1001", "FW2001P-1002", "FW2001P-1004", "FW2001P-1005", "FW2001P-1003", "FW2001P-1171"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW2310R",
+		QuotaName:    "price_rmb,price_index_mom",
+		SplitTypeKey: "",
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *ThermalCoalPortPriceProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseDataMap := fillFenWeiNetResponseAStratumMapData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "动力煤港口价格"
+	for productCategoryName, responseDataList := range responseDataMap {
+		utils.FileLog.Info(fmt.Sprintf("productName: %s, responseDataList:size: %v", productName, len(responseDataList)))
+		for _, data := range responseDataList {
+			var frequency = "日度"
+
+			indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+				IndexName:    productName + productCategoryName + "-" + data.PriceRmbChnName + "/汾渭",
+				Unit:         data.PriceRmbChnUnit,
+				Frequency:    frequency,
+				TerminalCode: utils.TerminalCode,
+				ClassifyName: productName,
+				DataTime:     data.DataDate,
+				Value:        data.PriceRmb,
+			})
+			indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+				IndexName:    productName + productCategoryName + "-" + data.PriceIndexMomChnName + "/汾渭",
+				Unit:         data.PriceIndexMomChnUnit,
+				Frequency:    frequency,
+				TerminalCode: utils.TerminalCode,
+				ClassifyName: productName,
+				DataTime:     data.DataDate,
+				Value:        data.PriceIndexMom,
+			})
+		}
+	}
+
+	return indexInfoList, nil
+}
+
+// ThermalCoalConsumptionProcessor 动力煤消费量
+type ThermalCoalConsumptionProcessor struct {
+	BaseProcessor
+}
+
+func (p *ThermalCoalConsumptionProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category: nil,
+		CheckedDims: map[string][]string{
+			"product_item_code": {"FW5002D-1", "FW5002D-2", "FW5002D-3", "FW5002D-4", "FW5002D-5", "FW5002D-6", "FW5002D-7"},
+		},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW5002D",
+		QuotaName:    "monthly_value,monthly_accumulation",
+		SplitTypeKey: "",
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *ThermalCoalConsumptionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseDataMap := fillFenWeiNetResponseMapData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "动力煤消费量"
+	for productCategoryName, responseDataList := range responseDataMap {
+		utils.FileLog.Info(fmt.Sprintf("productName: %s, responseDataList:size: %v", productName, len(responseDataList)))
+		for _, data := range responseDataList {
+			var frequency string
+			if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+				frequency = "月度"
+			} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+				frequency = "周度"
+			} else {
+				frequency = "日度"
+			}
+
+			indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+				IndexName:    productName + productCategoryName + "/汾渭",
+				Unit:         data.MonthlyValueChnUnit,
+				Frequency:    frequency,
+				TerminalCode: utils.TerminalCode,
+				ClassifyName: productName,
+				DataTime:     data.DataDate,
+				Value:        data.MonthlyValue,
+			})
+		}
+	}
+
+	return indexInfoList, nil
+}
+
+// CokingCleanCoalConsumptionProcessor 炼焦精煤消费量
+type CokingCleanCoalConsumptionProcessor struct {
+	BaseProcessor
+}
+
+func (p *CokingCleanCoalConsumptionProcessor) GenerateRequestParams(currentTime string) map[string]string {
+	params := models.RequestParams{
+		Category:     nil,
+		CheckedDims:  map[string][]string{},
+		DateRange:    "20190820-" + currentTime,
+		ProductCode:  "FW5001D",
+		QuotaName:    "monthly_value,monthly_accumulation",
+		SplitTypeKey: "",
+		DataType:     nil,
+		IsSeason:     1,
+	}
+
+	// 将结构体转换为 JSON 字符串
+	paramsJSON, _ := json.Marshal(params)
+
+	// 返回为 map[string]string 类型
+	return map[string]string{
+		"params": string(paramsJSON),
+	}
+}
+
+func (p *CokingCleanCoalConsumptionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
+	responseData := fillFenWeiNetResponseData(data)
+
+	var indexInfoList []models.FenWeiNetIndexInfo
+	productName := "炼焦精煤消费量"
+
+	for _, data := range responseData {
+		var frequency string
+		if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
+			frequency = "月度"
+		} else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
+			frequency = "周度"
+		} else {
+			frequency = "日度"
+		}
+
+		indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
+			IndexName:    productName + "/汾渭",
+			Unit:         data.MonthlyValueChnUnit,
+			Frequency:    frequency,
+			TerminalCode: utils.TerminalCode,
+			ClassifyName: productName,
+			DataTime:     data.DataDate,
+			Value:        data.MonthlyValue,
+		})
+	}
+
+	return indexInfoList, nil
+}
+
+func fillFenWeiNetResponseData(data string) []models.FenWeiNetResponse {
+	var result models.FenWeiNetResponseWrapper
+	err := json.Unmarshal([]byte(data), &result)
+	if err != nil {
+		return nil
+	}
+	responseData := result.Data.Data
+	return responseData
+}
+
+func fillFenWeiNetResponseMapData(data string) map[string][]models.FenWeiNetResponse {
+	var result models.FenWeiNetResponseMapWrapper
+	err := json.Unmarshal([]byte(data), &result)
+	if err != nil {
+		return nil
+	}
+	responseData := result.Data.Data
+	return responseData
+}
+
+func fillFenWeiNetResponseAStratumMapData(data string) map[string][]models.FenWeiNetResponse {
+	var result models.FenWeiNetResponseAStratumMapWrapper
+	err := json.Unmarshal([]byte(data), &result)
+	if err != nil {
+		return nil
+	}
+	responseData := result.Data
+	return responseData
+}

+ 106 - 0
services/fenwei/processor_factory.go

@@ -0,0 +1,106 @@
+// Package fenwei
+// @Author gmy 2024/8/20 14:50:00
+package fenwei
+
+const (
+	fenWeiUrl   = "https://www.sxcoal.com/api/coalresource-adhoc/queryV1/data"
+	fenWeiByUrl = "https://www.sxcoal.com/api/coalresource-adhoc/queryV1/byData"
+)
+
+type ProcessorFactory struct{}
+
+func (f *ProcessorFactory) CreateProcessor(module string) DataProcessor {
+	switch module {
+	case "动力煤供应量":
+		return &ThermalCoalSupplyProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "炼焦精煤供应量":
+		return &CokingCleanCoalSupplyProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "原煤分省分煤种产量":
+		return &RawCoalProvinceProductionProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "国有重点煤矿原煤产量":
+		return &StateOwnedKeyCoalMineRawCoalProductionProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "炼焦烟煤分煤种产量":
+		return &CokingBituminousCoalProductionProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "动力煤库存-全社会":
+		return &ThermalCoalInventorySocietyProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "动力煤库存-生产企业":
+		return &ThermalCoalInventoryProductionProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "动力煤库存-六大电厂":
+		return &ThermalCoalInventorySixPowerPlantProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "炼焦煤库存-全社会":
+		return &CokingCoalInventorySocietyProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "炼焦煤库存-生产企业":
+		return &CokingCoalInventoryProductionProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "炼焦煤库存-下游企业":
+		return &CokingCoalInventoryDownstreamProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "全国煤矿库存":
+		return &NationalCoalMineInventoryProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "国有重点煤矿库存":
+		return &StateOwnedKeyCoalMineInventoryProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "焦炭库存":
+		return &CokeInventoryProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "港口数据-库存-北方港口":
+		return &PortDataInventoryNorthernPortProcessor{
+			BaseProcessor{URL: fenWeiByUrl},
+		}
+	case "港口数据-库存-江内港口":
+		return &PortDataInventoryInlandPortProcessor{
+			BaseProcessor{URL: fenWeiByUrl},
+		}
+	case "港口数据-调度-北方港口":
+		return &PortDataDispatchNorthernPortProcessor{
+			BaseProcessor{URL: fenWeiByUrl},
+		}
+	case "港口数据-运量":
+		return &PortDataThroughputProcessor{
+			BaseProcessor{URL: fenWeiByUrl},
+		}
+	case "大秦线日运量":
+		return &DaqinLineDailyThroughputProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "动力煤港口价格":
+		return &ThermalCoalPortPriceProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "动力煤消费量":
+		return &ThermalCoalConsumptionProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+	case "炼焦精煤消费量":
+		return &CokingCleanCoalConsumptionProcessor{
+			BaseProcessor{URL: fenWeiUrl},
+		}
+
+	default:
+		return nil
+	}
+}

+ 20 - 0
services/task.go

@@ -2,6 +2,8 @@ package services
 
 import (
 	ccfService "eta/eta_data_analysis/services/base_from_ccf"
+	oilchemService "eta/eta_data_analysis/services/base_from_oilchem"
+	"eta/eta_data_analysis/services/fenwei"
 	"eta/eta_data_analysis/utils"
 	"fmt"
 	"io/fs"
@@ -48,6 +50,13 @@ func Task() {
 		task.AddTask("汾渭数据指标文件检测", fenWeiReadWatchIndexFile)
 	}
 
+	// 汾渭网络数据
+	if utils.FenweiNetOpen == "1" {
+		// 汾渭网络数据处理 每天16点和19点 执行爬取
+		fenWeiNetDataDeal := task.NewTask("fenWeiNetDataDeal", "0 0 16,19 * * *", fenwei.FenWeiNetDataDeal)
+		task.AddTask("汾渭网络数据处理", fenWeiNetDataDeal)
+	}
+
 	if utils.MtjhOpen == "1" {
 		c := cron.New(cron.WithSeconds())
 		//每2分钟检测一次指标文件是否更新
@@ -91,6 +100,17 @@ func Task() {
 		task.AddTask("CCF装置检修", taskCCFStockTable)
 	}
 
+	// 隆众资讯
+	if utils.OilchemDataInit == "1" && utils.OilchemOpen == "1" {
+		err := oilchemService.OilchemList(nil)
+		if err != nil {
+			utils.FileLog.Info("InitOilchemList Err:" + err.Error())
+		}
+	} else if utils.OilchemOpen == "1" {
+		oilchemData := task.NewTask("oilchemData", "0 0 16 * * *", oilchemService.OilchemList)
+		task.AddTask("卓创资讯", oilchemData)
+	}
+
 	task.StartTask()
 
 	fmt.Println("task end")

+ 26 - 0
static/fen_wei_net_data_json.json

@@ -0,0 +1,26 @@
+{
+  "data": [
+    "动力煤供应量",
+    "炼焦精煤供应量",
+    "原煤分省分煤种产量",
+    "国有重点煤矿原煤产量",
+    "炼焦烟煤分煤种产量",
+    "动力煤库存-全社会",
+    "动力煤库存-生产企业",
+    "动力煤库存-六大电厂",
+    "炼焦煤库存-全社会",
+    "炼焦煤库存-生产企业",
+    "炼焦煤库存-下游企业",
+    "全国煤矿库存",
+    "国有重点煤矿库存",
+    "焦炭库存",
+    "港口数据-库存-北方港口",
+    "港口数据-库存-江内港口",
+    "港口数据-调度-北方港口",
+    "港口数据-运量",
+    "大秦线日运量",
+    "动力煤港口价格",
+    "动力煤消费量",
+    "炼焦精煤消费量"
+  ]
+}

+ 39 - 0
utils/common.go

@@ -26,6 +26,7 @@ import (
 	"strconv"
 	"strings"
 	"time"
+	"unicode"
 )
 
 // GetFirstPingYin 拼音首字母
@@ -1272,3 +1273,41 @@ func MkDir(dirPath string) error {
 	}
 	return nil
 }
+
+// WriteHTMLToFile 将HTML内容写入指定的文件中
+func WriteHTMLToFile(content string, filePath string) error {
+	// 使用os.Create创建文件,如果文件已存在则会被截断
+	file, err := os.Create(filePath)
+	if err != nil {
+		return err
+	}
+	defer func() {
+		_ = file.Close()
+	}()
+
+	// 将HTML内容写入文件
+	_, err = file.WriteString(content)
+	if err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func ContainsChinese(s string) bool {
+	for _, r := range s {
+		if unicode.Is(unicode.Han, r) {
+			return true
+		}
+	}
+	return false
+}
+
+func ContainsEnglishLetter(s string) bool {
+	for _, r := range s {
+		if unicode.IsLetter(r) {
+			return true
+		}
+	}
+	return false
+}

+ 27 - 0
utils/config.go

@@ -59,6 +59,11 @@ var (
 	FenweiFileDir    string // excel文件目录
 	FenweiOldFileDir string // 已读取过的excel文件目录
 	FenweiOpen       string // 是否配置汾渭数据源
+
+	FenweiNetOpen     string // 是否配置汾渭网页数据源
+	FenweiNetUseName  string // 汾渭登录账号
+	FenweiNetPassword string // 汾渭登录密码
+	FenweiNetJsonPath string // 汾渭json文件地址
 )
 
 // 煤炭江湖
@@ -79,6 +84,14 @@ var (
 	CCFPassword       string // CCF登录密码
 )
 
+var (
+	OilchemAccount    string
+	OilchemPassword   string
+	OilchemCookieFile string
+	OilchemOpen string
+	OilchemDataInit string
+)
+
 var TerminalCode string
 
 func init() {
@@ -144,6 +157,11 @@ func init() {
 		FenweiOpen = config["fenwei_open"]
 		FenweiFileDir = config["fenwei_file_dir"]
 		FenweiOldFileDir = config["fenwei_old_file_dir"]
+
+		FenweiNetOpen = config["fenwei_net_open"]
+		FenweiNetUseName = config["fenwei_net_username"]
+		FenweiNetPassword = config["fenwei_net_password"]
+		FenweiNetJsonPath = config["fenwei_net_json_path"]
 	}
 
 	//煤炭江湖文件夹配置
@@ -165,6 +183,15 @@ func init() {
 		CCFUseName = config["ccf_username"]
 		CCFPassword = config["ccf_password"]
 	}
+
+	// 隆众数据
+	{
+		OilchemAccount = config["oilchem_account"]
+		OilchemPassword = config["oilchem_password"]
+		OilchemCookieFile = config["oilchem_cookie_file"]
+		OilchemOpen = config["oilchem_open"]
+		OilchemDataInit = config["oilchem_data_init"]
+	}
 }
 
 //修改接口文档

+ 3 - 0
utils/constants.go

@@ -9,6 +9,7 @@ const (
 	FormatDateUnSpace          = "20060102"                //日期格式
 	FormatDateTime             = "2006-01-02 15:04:05"     //完整时间格式
 	HlbFormatDateTime          = "2006-01-02_15:04:05.999" //完整时间格式
+	HlbFormatDateTimeNoSecond  = "2006-01-02 15:04"        //完整时间格式
 	FormatDateTimeUnSpace      = "20060102150405"          //完整时间格式
 	FormatShortDateTimeUnSpace = "060102150405"            //省去开头两位年份的时间格式
 	FormatYearMonthDate        = "2006-01"                 //日期格式
@@ -246,4 +247,6 @@ const (
 	LIB_ROUTE_COAL_MINE_MTJH            = "/mtjh/data"                 //煤炭江湖数据处理excel数据并入库 数据地址
 	LIB_ROUTE_CCF_EDB_HANDLE            = "ccf/handle/edb_data"        // CCF化纤信息指标入库接口地址
 	LIB_ROUTE_CCF_TABLE_HANDLE          = "ccf/handle/table_data"      // CCF化纤信息装置表格入库接口地址
+	LIB_ROUTE_OILCHEM_TABLE_HANDLE      = "oilchem/handle/edb_data"  // 隆众资讯入库接口地址
+	LIB_ROUTE_FENWEI_NET_DATA_HANDLE    = "/fenwei/net/data/handle"    // 汾渭网页数据处理
 )