zwxi 6 luni în urmă
părinte
comite
cc6efbe5e3

+ 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
+}
+

+ 1032 - 0
services/base_from_oilchem/jiachun_edb.go

@@ -0,0 +1,1032 @@
+package services
+
+import (
+	"encoding/json"
+	"eta/eta_data_analysis/models"
+	"eta/eta_data_analysis/utils"
+	"fmt"
+	"github.com/PuerkitoBio/goquery"
+	"strconv"
+	"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)
+				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)
+				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)
+				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)
+				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)
+				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)
+				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)
+
+				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)
+				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("JiaChunList Err:", err)
+	}
+	err = FuHeFeiList(num)
+	if err != nil {
+		utils.FileLog.Info("JiaChunList Err:", err)
+	}
+	err = ZhiJiangList(num)
+	if err != nil {
+		utils.FileLog.Info("JiaChunList Err:", err)
+	}
+	err = YuanYouList(num)
+	if err != nil {
+		utils.FileLog.Info("JiaChunList 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
+}

+ 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

+ 12 - 0
services/task.go

@@ -2,6 +2,7 @@ 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/utils"
 	"fmt"
 	"github.com/beego/beego/v2/task"
@@ -90,6 +91,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")

+ 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
+}

+ 17 - 0
utils/config.go

@@ -79,6 +79,14 @@ var (
 	CCFPassword       string // CCF登录密码
 )
 
+var (
+	OilchemAccount    string
+	OilchemPassword   string
+	OilchemCookieFile string
+	OilchemOpen string
+	OilchemDataInit string
+)
+
 var TerminalCode string
 
 func init() {
@@ -165,6 +173,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"]
+	}
 }
 
 //修改接口文档

+ 2 - 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,5 @@ 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"  // 隆众资讯入库接口地址
 )