zhangchuanxing 3 bulan lalu
induk
melakukan
42af191c21
2 mengubah file dengan 27 tambahan dan 1 penghapusan
  1. 16 0
      models/ficc_report/ficc_report_by_hand.go
  2. 11 1
      services/ficc_report.go

+ 16 - 0
models/ficc_report/ficc_report_by_hand.go

@@ -0,0 +1,16 @@
+package ficc_report
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+)
+
+type CygxFiccReportByHand struct {
+	FiccReportId int `description:"FICC研报ID"`
+}
+
+func GetCygxFiccReportByHandList() (items []*CygxFiccReportByHand, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT ficc_report_id  FROM  cygx_ficc_report_by_hand LIMIT 1000  `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 11 - 1
services/ficc_report.go

@@ -591,6 +591,16 @@ func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
 	if lenArr == 0 {
 		return
 	}
+	reportByHandList, e := ficc_report.GetCygxFiccReportByHandList() // 手动同步过来的报告
+	if e != nil {
+		err = errors.New("GetCygxFiccReportByHandList, Err: " + e.Error())
+		return
+	}
+	ficcReporIdsHand := make(map[int]bool) // Ficc 研报手动同步过来的报告ID
+	for _, v := range reportByHandList {
+		ficcReporIdsHand[v.FiccReportId] = true
+	}
+
 	condition = ` AND id IN (` + utils.GetOrmInReplace(lenArr) + `) `
 	pars = make([]interface{}, 0)
 	pars = append(pars, cygxFiccReportIds)
@@ -606,7 +616,7 @@ func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
 	}
 
 	for _, v := range listCygxFiccReport {
-		if !ficcReporIdsPush[v.ReportId] {
+		if !ficcReporIdsPush[v.ReportId] && !ficcReporIdsHand[v.ReportId] { // 手动同步过来的报告不做删除处理
 			removeficcReporIds = append(removeficcReporIds, v.ReportId)
 		}
 	}