Browse Source

Merge branch 'cygx_12.0' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 1 year ago
parent
commit
b848fac801

+ 32 - 1
controllers/report.go

@@ -1759,6 +1759,19 @@ func (this *ReportController) ResearchDetail() {
 		return
 	}
 
+	PermissionNameMap, err := services.GetPermissionNameMap()
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败 GetPermissionNameMap,Err:" + err.Error()
+		return
+	}
+
+	PermissionIcoMap, err := services.GetPermissionNameIcoMap()
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败 GetPermissionNameMap,Err:" + err.Error()
+		return
+	}
 	//未设置全部可见的只能给弘则内部查看
 	if detail.VisibleRange == 1 || user.CompanyId == utils.HZ_COMPANY_ID {
 		resp.IsShow = true
@@ -1793,6 +1806,8 @@ func (this *ReportController) ResearchDetail() {
 			return
 		}
 		for k2, v2 := range listSecond {
+			v2.PermissionName = PermissionNameMap[v2.ChartPermissionId]
+			v2.IcoLink = PermissionIcoMap[v2.ChartPermissionId]
 			listThird, err := models.GetResearchSummarylogSonListThird(articleId, v2.ChartPermissionId, v.Type)
 			if err != nil && err.Error() != utils.ErrNoRow() {
 				br.Msg = "获取信息失败"
@@ -1921,6 +1936,18 @@ func (this *ReportController) MinutesDetailV4() {
 		br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
 		return
 	}
+	PermissionNameMap, err := services.GetPermissionNameMap()
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败 GetPermissionNameMap,Err:" + err.Error()
+		return
+	}
+	PermissionIcoMap, err := services.GetPermissionNameIcoMap()
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败 GetPermissionNameMap,Err:" + err.Error()
+		return
+	}
 	//未设置全部可见的只能给弘则内部查看
 	if detail.VisibleRange == 1 || user.CompanyId == utils.HZ_COMPANY_ID {
 		resp.IsShow = true
@@ -1949,6 +1976,8 @@ func (this *ReportController) MinutesDetailV4() {
 			return
 		}
 		for k2, v2 := range listSecond {
+			v2.PermissionName = PermissionNameMap[v2.ChartPermissionId]
+			v2.IcoLink = PermissionIcoMap[v2.ChartPermissionId]
 			listThird, err := models.GetMinutesSummarylogListThird(articleId, v2.ChartPermissionId, v.Type)
 			if err != nil && err.Error() != utils.ErrNoRow() {
 				br.Msg = "获取信息失败"
@@ -2055,6 +2084,7 @@ func (this *ReportController) MinutesDetail() {
 		br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
 		return
 	}
+
 	detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format("2006-01-02")
 	detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
 	listLog, err := models.GetMinutesSummarylogListAll(articleId)
@@ -2071,12 +2101,13 @@ func (this *ReportController) MinutesDetail() {
 			return
 		}
 		if len(listSonLog) > 0 {
-			listLog[k].List = listSonLog
 			for k2, v2 := range listSonLog {
 				if v2.ReportLink == "0" {
 					listSonLog[k2].ReportLink = ""
 				}
 			}
+			listLog[k].List = listSonLog
+
 		}
 	}
 	//historyRecord := new(models.CygxReportHistoryRecord)

+ 1 - 0
controllers/report_selection.go

@@ -132,6 +132,7 @@ func (this *ReportSelectionController) Detail() {
 		mapChartLog[v.ChartPermissionName] = v.BodyChartSummary
 	}
 	for _, v := range listLog {
+		v.PermissionName = PermissionNameMap[v.ChartPermissionId]
 		item := new(models.ReportSelectionChartPermission)
 		itemSubject := new(models.ReportSelectionChartLogPermission)
 		itemSubject.PermissionName = v.PermissionName

+ 3 - 3
controllers/yanxuan_special.go

@@ -335,7 +335,7 @@ func (this *YanxuanSpecialController) Save() {
 	if req.DoType == 2 {
 		go services.SendReviewTemplateMsgAdmin(specialId)
 		go services.UpdateYanxuanSpecialResourceData(specialId) //  写入首页最新  cygx_resource_data 表
-		go services.AddYanxuanSpecial(specialId)                //  写入es 综合搜索
+		go services.EsAddYanxuanSpecial(specialId)              //  写入es 综合搜索
 	}
 
 	br.Ret = 200
@@ -429,7 +429,7 @@ func (this *YanxuanSpecialController) Enable() {
 	}
 	go services.SendWxMsgSpecialAuthor(req.Id, status)
 	go services.UpdateYanxuanSpecialResourceData(req.Id) //  写入首页最新  cygx_resource_data 表
-	go services.AddYanxuanSpecial(req.Id)                //  写入es 综合搜索
+	go services.EsAddYanxuanSpecial(req.Id)              //  写入es 综合搜索
 	br.Msg = "审批成功"
 	br.Ret = 200
 	br.Success = true
@@ -822,7 +822,7 @@ func (this *YanxuanSpecialController) Cancel() {
 		return
 	}
 	go services.UpdateYanxuanSpecialResourceData(req.Id) //  写入首页最新  cygx_resource_data 表
-	go services.AddYanxuanSpecial(req.Id)                //  写入es 综合搜索
+	go services.EsAddYanxuanSpecial(req.Id)              //  写入es 综合搜索
 	br.Msg = "取消发布成功"
 	br.Ret = 200
 	br.Success = true

+ 2 - 0
models/cygx_yanxuan_special.go

@@ -92,6 +92,8 @@ type CygxYanxuanSpecialCenterResp struct {
 	ContentHasStyle bool //正文是否包含格式
 	Docs            []Doc
 	Annotation      string `description:"核心观点"`
+	Source          string `description:"来源"`
+	PublishDate     string // 提审过审或驳回时间      string `description:"核心观点"`
 }
 
 type Doc struct {

+ 1 - 2
models/minutesSummary.go

@@ -107,10 +107,9 @@ func GetMinutesSummarylogSonListAll(articleId, chartPermissionId int) (items []*
 // 列表
 func GetMinutesSummarylogSonListSecond(articleId int, artType string) (items []*CygxResearchSummaryLogSecond, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT c.permission_name ,c.chart_permission_id ,c.image_url_m as image_url, l.* 
+	sql := `SELECT  l.* 
 			FROM
 			cygx_minutes_summary_log AS l
-			LEFT JOIN chart_permission AS c ON c.chart_permission_id = l.chart_permission_id 
 			WHERE l.article_id = ? AND l.type =?
 			GROUP BY l.chart_permission_id
 			ORDER  BY l.chart_permission_sort ASC`

+ 1 - 2
models/researchSummary.go

@@ -89,10 +89,9 @@ func GetResearchSummarylogListFirst(articleId int) (items []*ResearchSummaryChar
 // 列表
 func GetResearchSummarylogSonListSecond(articleId int, artType string) (items []*CygxResearchSummaryLogSecond, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT c.permission_name ,c.chart_permission_id ,c.image_url_m as image_url, l.* 
+	sql := `SELECT  l.* 
 			FROM
 			cygx_research_summary_log AS l
-			LEFT JOIN chart_permission AS c ON c.chart_permission_id = l.chart_permission_id 
 			WHERE l.article_id = ? AND l.type =?
 			GROUP BY l.chart_permission_id
 			ORDER  BY l.chart_permission_sort ASC`

+ 8 - 0
models/resource_data.go

@@ -135,3 +135,11 @@ func GetCygxResourceDataByIdAndSource(sourceId int, source string) (item *CygxRe
 	err = o.Raw(sql, sourceId, source).QueryRow(&item)
 	return
 }
+
+// 获取数量
+func GetCygxResourceDataBySourceAndIdCount(sourceId int, source string) (count int, err error) {
+	o := orm.NewOrm()
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_resource_data  WHERE  source_id = ? AND source =?  `
+	err = o.Raw(sqlCount, sourceId, source).QueryRow(&count)
+	return
+}

+ 1 - 1
services/cygx_yanxuan_special.go

@@ -268,7 +268,7 @@ func UpdateYanxuanSpecialResourceData(sourceId int) {
 		}
 	} else {
 		//判断是否存在,如果不存在就新增,存在就更新
-		totalData, e := models.GetCygxReportSelectionBySourceAndId(sourceId, source)
+		totalData, e := models.GetCygxResourceDataBySourceAndIdCount(sourceId, source)
 		if e != nil {
 			err = errors.New("GetCygxReportSelectionBySourceAndId, Err: " + e.Error())
 			return

+ 5 - 1
services/es_comprehensive.go

@@ -585,7 +585,7 @@ func AddComprehensiveRoadshow() {
 }
 
 // Es研选专栏
-func AddYanxuanSpecial(sourceId int) {
+func EsAddYanxuanSpecial(sourceId int) {
 	var err error
 	defer func() {
 		if err != nil {
@@ -1471,7 +1471,11 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 		}
 
 		for _, v := range listyanxuanSpecial {
+			v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
 			v.Annotation, _ = GetReportContentTextSubNew(v.Content)
+			// Source  PublishDate 字段兼容前端样式
+			v.Source = utils.CYGX_OBJ_YANXUANSPECIAL
+			v.PublishDate = v.PublishTime
 			mapItems[fmt.Sprint(utils.CYGX_OBJ_YANXUANSPECIAL, v.Id)].YanxuanSpecial = v
 		}
 	}

+ 5 - 1
services/resource_data.go

@@ -455,7 +455,11 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 		}
 
 		for _, v := range listyanxuanSpecial {
+			v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
 			v.Annotation, _ = GetReportContentTextSubNew(v.Content)
+			// Source  PublishDate 字段兼容前端样式
+			v.Source = utils.CYGX_OBJ_YANXUANSPECIAL
+			v.PublishDate = v.PublishTime
 			mapItems[fmt.Sprint(utils.CYGX_OBJ_YANXUANSPECIAL, v.Id)].YanxuanSpecial = v
 		}
 	}
@@ -554,7 +558,7 @@ func UpdateArticleResourceData(sourceId int) {
 		}
 	} else {
 		//判断是否存在,如果不存在就新增,存在就更新
-		totalData, e := models.GetCygxReportSelectionBySourceAndId(sourceId, source)
+		totalData, e := models.GetCygxResourceDataBySourceAndIdCount(sourceId, source)
 		if e != nil {
 			err = errors.New("GetCygxReportSelectionBySourceAndId, Err: " + e.Error())
 			return