Browse Source

上周纪要汇总详情

xingzai 3 years ago
parent
commit
94c65cf39f

+ 2 - 0
controllers/activity.go

@@ -2412,6 +2412,8 @@ func (this *ActivityCoAntroller) ActivityListNew() {
 	}
 	if activeState == "2" || activeState == "3" {
 		condition += ` ORDER BY art.activity_time DESC  `
+	} else if activeState == "2,3" {
+		condition += ` ORDER BY art.active_state ASC, art.activity_time DESC  `
 	} else {
 		condition += ` ORDER BY art.active_state ASC, art.activity_time ASC  `
 	}

+ 91 - 4
controllers/report.go

@@ -1423,8 +1423,8 @@ func (this *ReportController) ResearchDetail() {
 // @Description 获取上周纪要汇总内容详情接口
 // @Param   ArticleId   query   int  true       "报告ID"
 // @Success 200 {object} models.MinutesSummaryLetailResp
-// @router /minutesSummary/detail [get]
-func (this *ReportController) MinutesDetail() {
+// @router /minutesSummary/detailv4 [get]
+func (this *ReportController) MinutesDetailV4() {
 	br := new(models.BaseResponse).Init()
 	defer func() {
 		this.Data["json"] = br
@@ -1443,7 +1443,7 @@ func (this *ReportController) MinutesDetail() {
 		br.ErrMsg = "参数错误"
 		return
 	}
-	resp := new(models.MinutesSummaryLetailResp)
+	resp := new(models.MinutesSummaryLetailRespV4)
 	//判断用户权限
 	hasPermission, err := services.GetUserhasPermission(user)
 	if err != nil {
@@ -1466,7 +1466,7 @@ func (this *ReportController) MinutesDetail() {
 	}
 	detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format(utils.FormatDate)
 	detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
-	listFirst, err := models.GetMinutesSummarylogListAll(articleId)
+	listFirst, err := models.GetMinutesSummarylogListAllV4(articleId)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
@@ -1531,6 +1531,93 @@ func (this *ReportController) MinutesDetail() {
 	br.Data = resp
 }
 
+// @Title 上周纪要汇总内容详情
+// @Description 获取上周纪要汇总内容详情接口
+// @Param   ArticleId   query   int  true       "报告ID"
+// @Success 200 {object} models.MinutesSummaryLetailResp
+// @router /minutesSummary/detail [get]
+func (this *ReportController) MinutesDetail() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	uid := user.UserId
+	articleId, _ := this.GetInt("ArticleId")
+	if articleId < 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误"
+		return
+	}
+	resp := new(models.MinutesSummaryLetailResp)
+	//判断用户权限
+	hasPermission, err := services.GetUserhasPermission(user)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
+	}
+	resp.HasPermission = hasPermission
+	if hasPermission != 1 {
+		br.Ret = 200
+		br.Success = true
+		br.Msg = "获取成功"
+		br.Data = resp
+		return
+	}
+	detail, err := models.GetCygxMinutesSummaryInfoById(articleId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		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)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
+		return
+	}
+	for k, v := range listLog {
+		listSonLog, err := models.GetMinutesSummarylogSonListAll(articleId, v.ChartPermissionId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取信息失败,Err:" + err.Error()
+			return
+		}
+		if len(listSonLog) > 0 {
+			listLog[k].List = listSonLog
+			for k2, v2 := range listSonLog {
+				if v2.ReportLink == "0" {
+					listSonLog[k2].ReportLink = ""
+				}
+			}
+		}
+	}
+	historyRecord := new(models.CygxReportHistoryRecord)
+	historyRecord.UserId = uid
+	historyRecord.ArticleId = articleId
+	historyRecord.CreateTime = time.Now()
+	historyRecord.Mobile = user.Mobile
+	historyRecord.Email = user.Email
+	historyRecord.CompanyId = user.CompanyId
+	historyRecord.CompanyName = user.CompanyName
+	historyRecord.ReportType = "szjyhz"
+	go models.AddCygxReportHistoryRecord(historyRecord)
+	resp.List = listLog
+	resp.Detail = detail
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
 // @Title 获取路演精华详情
 // @Description 获取路演精华详情接口
 // @Param   ArticleId   query   int  true       "报告ID"

+ 22 - 2
models/minutesSummary.go

@@ -15,12 +15,18 @@ type DetailCygxMinutesSummaryRep struct {
 	Abstract         string `description:"摘要"`
 }
 
-type MinutesSummaryLetailResp struct {
+type MinutesSummaryLetailRespV4 struct {
 	Detail        *DetailCygxMinutesSummaryRep
 	HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
 	List          []*ResearchSummaryChartPermission
 }
 
+type MinutesSummaryLetailResp struct {
+	Detail        *DetailCygxMinutesSummaryRep
+	HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	List          []*MinutesSummaryChartPermission
+}
+
 type MinutesSummaryChartPermission struct {
 	PermissionName    string `description:"行业名称"`
 	ChartPermissionId int    `description:"行业ID"`
@@ -52,7 +58,7 @@ func GetCygxMinutesSummaryInfoById(articleId int) (item *DetailCygxMinutesSummar
 }
 
 //列表
-func GetMinutesSummarylogListAll(articleId int) (items []*ResearchSummaryChartPermission, err error) {
+func GetMinutesSummarylogListAllV4(articleId int) (items []*ResearchSummaryChartPermission, err error) {
 	o := orm.NewOrm()
 	//sql := `SELECT c.permission_name ,c.image_url,l.*
 	//		FROM
@@ -70,6 +76,20 @@ func GetMinutesSummarylogListAll(articleId int) (items []*ResearchSummaryChartPe
 	return
 }
 
+//列表
+func GetMinutesSummarylogListAll(articleId int) (items []*MinutesSummaryChartPermission, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT c.permission_name ,c.image_url,l.*
+			FROM
+			cygx_minutes_summary_log AS l
+			INNER JOIN chart_permission AS c ON c.chart_permission_id = l.chart_permission_id 
+			WHERE l.article_id = ? 
+			GROUP BY l.chart_permission_id
+			ORDER BY l.chart_permission_sort ASC   `
+	_, err = o.Raw(sql, articleId).QueryRows(&items)
+	return
+}
+
 //列表
 func GetMinutesSummarylogSonListAll(articleId, chartPermissionId int) (items []*CygxMinutesSummaryLogDetail, err error) {
 	o := orm.NewOrm()

+ 4 - 0
models/wechat.go

@@ -77,6 +77,8 @@ func GetWxToken() (item *WxAccessToken, err error) {
 		return
 	}
 	if item.Errmsg != "" {
+		utils.FileLog.Info("GetWxToken fail result:%s", string(result))
+		err = fmt.Errorf(item.Errmsg)
 	}
 	return
 }
@@ -120,6 +122,8 @@ func GetWxTokenByXzs() (item *WxAccessToken, err error) {
 		return
 	}
 	if item.Errmsg != "" {
+		utils.FileLog.Info("GetWxToken fail result:%s", string(result))
+		err = fmt.Errorf(item.Errmsg)
 	}
 	return
 }

+ 9 - 0
routers/commentsRouter_controllers.go

@@ -403,6 +403,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ReportController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ReportController"],
+        beego.ControllerComments{
+            Method: "MinutesDetailV4",
+            Router: "/minutesSummary/detailv4",
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ReportController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ReportController"],
         beego.ControllerComments{
             Method: "ReportListByType",