xyxie 1 年之前
父节点
当前提交
ee64538c13
共有 2 个文件被更改,包括 0 次插入122 次删除
  1. 0 59
      services/elastic.go
  2. 0 63
      services/english_report.go

+ 0 - 59
services/elastic.go

@@ -207,65 +207,6 @@ func EsAddOrEditEnglishReport(indexName, docId string, item *models.ElasticEngli
 	return
 }
 
-// EsAddOrEditSaCompare 新增编辑es语义分析文档对比
-func EsAddOrEditSaCompare(indexName, docId string, item *saModel.SaCompareElastic) (err error) {
-	defer func() {
-		if err != nil {
-			fmt.Println("EsAddOrEditSaCompare Err:", err.Error())
-			go alarm_msg.SendAlarmMsg("新增编辑es语义分析文档对比 EsAddOrEditSaCompare,Err:"+err.Error(), 3)
-		}
-	}()
-	client := utils.EsClient
-	// docId为报告ID
-	searchById, err := client.Get().Index(indexName).Id(docId).Do(context.Background())
-	if err != nil {
-		if strings.Contains(err.Error(), "404") {
-			err = nil
-		} else {
-			fmt.Println("Get Err" + err.Error())
-			return
-		}
-	}
-	if searchById != nil && searchById.Found {
-		resp, e := client.Update().Index(indexName).Id(docId).Doc(map[string]interface{}{
-			"SaCompareId":  item.SaCompareId,
-			"ClassifyName": item.ClassifyName,
-			"ClassifyId":   item.ClassifyId,
-			"Title":        item.Title,
-			"ResultImg":    item.ResultImg,
-			"CreateTime":   item.CreateTime,
-			"ModifyTime":   item.ModifyTime,
-			"SysAdminId":   item.SysAdminId,
-			"SysAdminName": item.SysAdminName,
-		}).Do(context.Background())
-		if e != nil {
-			err = e
-			return
-		}
-		//fmt.Println(resp.Status, resp.Result)
-		if resp.Status == 0 {
-			fmt.Println("修改成功" + docId)
-			err = nil
-		} else {
-			fmt.Println("EditData", resp.Status, resp.Result)
-		}
-	} else {
-		resp, e := client.Index().Index(indexName).Id(docId).BodyJson(item).Do(context.Background())
-		if e != nil {
-			err = e
-			fmt.Println("新增失败:", err.Error())
-			return
-		}
-		if resp.Status == 0 && resp.Result == "created" {
-			fmt.Println("新增成功" + docId)
-			return
-		} else {
-			fmt.Println("AddData", resp.Status, resp.Result)
-		}
-	}
-	return
-}
-
 // EsAddOrEditSaDoc 新增编辑语义分析文档
 func EsAddOrEditSaDoc(indexName, docId string, item *saModel.ElasticSaDoc) (err error) {
 	defer func() {

+ 0 - 63
services/english_report.go

@@ -598,69 +598,6 @@ func CreateEnglishReportIndex() {
 	EsCreateIndex(indexName, mappingJson)
 }
 
-func CreateSaCompareES() {
-	indexName := utils.EsSemanticAnalysisCompareIndexName
-	mappingJson := `{
-  "mappings": {
-    "dynamic": true,
-    "properties": {
-        "ResultImg" : {
-          "type" : "text"
-        },
-        "ClassifyName" : {
-          "type" : "text",
-          "fields" : {
-            "keyword" : {
-              "type" : "keyword",
-              "ignore_above" : 256
-            }
-          }
-        },
-		"SysAdminName" : {
-          "type" : "text"
-        },
-		"SysAdminId" : {
-          "type" : "long"
-        },
-        "ClassifyId" : {
-          "type" : "long"
-        },
-        "ModifyTime" : {
-          "type" : "text",
-          "fields" : {
-            "keyword" : {
-              "type" : "keyword",
-              "ignore_above" : 256
-            }
-          }
-        },
-       "CreateTime" : {
-          "type" : "text",
-          "fields" : {
-            "keyword" : {
-              "type" : "keyword",
-              "ignore_above" : 256
-            }
-          }
-        },
-        "SaCompareId" : {
-          "type" : "long"
-        },
-        "Title" : {
-          "type" : "text",
-          "fields" : {
-            "keyword" : {
-              "type" : "keyword",
-              "ignore_above" : 256
-            }
-          }
-        }
-      }
-  }
-}`
-	EsCreateIndex(indexName, mappingJson)
-}
-
 // UpdateEnReportEditMark 更新英文研报当前更新状态
 // status 枚举值 1:编辑中,0:完成编辑, 2:只做查询
 func UpdateEnReportEditMark(reportId, nowUserId, status int, nowUserName string) (ret models.MarkReportResp, err error) {