|
@@ -4,18 +4,22 @@ import (
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
jinmencaijingReq "hongze/hongze_open_api/models/request/jinmencaijing"
|
|
|
+ reportSelectionResp "hongze/hongze_open_api/models/response/cygx_report_selection"
|
|
|
"hongze/hongze_open_api/models/response/jinmencaijing"
|
|
|
"hongze/hongze_open_api/models/tables/company"
|
|
|
"hongze/hongze_open_api/models/tables/company_product"
|
|
|
"hongze/hongze_open_api/models/tables/company_report_permission"
|
|
|
cygxActivity "hongze/hongze_open_api/models/tables/cygx/cygx_activity"
|
|
|
+ "hongze/hongze_open_api/models/tables/cygx/cygx_report_selection"
|
|
|
"hongze/hongze_open_api/models/tables/cygx/cygx_three_api_log"
|
|
|
"hongze/hongze_open_api/models/tables/wx_user"
|
|
|
"hongze/hongze_open_api/services/alarm_msg"
|
|
|
+ servicesCompany "hongze/hongze_open_api/services/company"
|
|
|
cygxSeriesActivity "hongze/hongze_open_api/services/cygx_activity"
|
|
|
servicesWxUser "hongze/hongze_open_api/services/wx_user"
|
|
|
"hongze/hongze_open_api/utils"
|
|
|
"strconv"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -388,3 +392,124 @@ func (c *JinMenCaiJingController) ActivitySignupDetail() {
|
|
|
// encryptMobile := string(utils.DesBase64Encrypt([]byte(mobile)))
|
|
|
// fmt.Println(encryptMobile)
|
|
|
//}
|
|
|
+
|
|
|
+// 重点公司详情接口
|
|
|
+// @Title 重点公司详情接口
|
|
|
+// @Description 重点公司详情接口
|
|
|
+// @router /report_selection/detail [get]
|
|
|
+func (c *JinMenCaiJingController) ReportSelectionDetail() {
|
|
|
+ //回调中url参数要做签名(get请求中的参数,按照自己的方式签名,避免链接被别人拿去随意请求)
|
|
|
+ articleId, _ := c.GetInt("article_id")
|
|
|
+ resp := new(reportSelectionResp.ReportSelectionLetailResp)
|
|
|
+ detail, err := cygx_report_selection.GetCygxReportSelectionInfoById(articleId)
|
|
|
+ if err != nil {
|
|
|
+ c.FailWithMessage("报告ID异常:" + strconv.Itoa(articleId))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format("2006-01-02")
|
|
|
+ existMap := make(map[int]int)
|
|
|
+ var items []*reportSelectionResp.ReportSelectionChartPermission
|
|
|
+ var itemsSubject []*reportSelectionResp.ReportSelectionChartLogPermission
|
|
|
+ listLog, err := cygx_report_selection.GetReportSelectionlogListAll(articleId)
|
|
|
+ if err != nil {
|
|
|
+ c.FailWithMessage("获取信息失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取行业核心逻辑汇总
|
|
|
+ listChartLog, err := cygx_report_selection.GetCygxReportSelectionChartLogRepList(articleId)
|
|
|
+ if err != nil {
|
|
|
+ c.FailWithMessage("获取信息失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapChartLog := make(map[string]string)
|
|
|
+ for _, v := range listChartLog {
|
|
|
+ mapChartLog[v.ChartPermissionName] = v.BodyChartSummary
|
|
|
+ }
|
|
|
+
|
|
|
+ PermissionNameMap, err := servicesCompany.GetPermissionNameMap()
|
|
|
+ if err != nil {
|
|
|
+ c.FailWithMessage("获取信息失败:")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range listLog {
|
|
|
+ v.PermissionName = PermissionNameMap[v.ChartPermissionId]
|
|
|
+ item := new(reportSelectionResp.ReportSelectionChartPermission)
|
|
|
+ itemSubject := new(reportSelectionResp.ReportSelectionChartLogPermission)
|
|
|
+ itemSubject.PermissionName = v.PermissionName
|
|
|
+ if existMap[v.ChartPermissionId] == 0 {
|
|
|
+ item.PermissionName = v.PermissionName
|
|
|
+ listSonLog, err := cygx_report_selection.GetReportSelectionlogSonListAll(articleId, v.ChartPermissionId)
|
|
|
+ if err != nil {
|
|
|
+ c.FailWithMessage("获取信息失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for k2, v2 := range listSonLog {
|
|
|
+ if v2.IndustrialManagementId != "" {
|
|
|
+ listIndustrial, err := cygx_report_selection.GetIndustrialByIds(v2.IndustrialManagementId)
|
|
|
+ if err != nil {
|
|
|
+ c.FailWithMessage("获取信息失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ listSonLog[k2].List = listIndustrial
|
|
|
+ if v2.SubjectName == "" {
|
|
|
+ v2.ShowName = v2.IndustrialManagementNames
|
|
|
+ } else {
|
|
|
+ v2.ShowName = v2.SubjectName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if v2.Label != "" {
|
|
|
+ CompanyLabelSlice := strings.Split(v2.Label, "{|}")
|
|
|
+ for _, vCompanyLabel := range CompanyLabelSlice {
|
|
|
+ v2.CompanyLabel = append(v2.CompanyLabel, "#"+vCompanyLabel+"#")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if v2.ThirdName != "" {
|
|
|
+ v2.ShowName = v2.ThirdName
|
|
|
+ }
|
|
|
+ subjectItem := new(reportSelectionResp.ReportSelectionChartLogSubjectName)
|
|
|
+ subjectItem.SubjectName = v2.SubjectName
|
|
|
+ subjectItem.IsNew = v2.IsNew
|
|
|
+ if v2.ThirdName != "" {
|
|
|
+ subjectItem.SubjectName = v2.ThirdName
|
|
|
+ } else {
|
|
|
+ if subjectItem.SubjectName == "" {
|
|
|
+ subjectItem.SubjectName = v2.IndustrialManagementNames
|
|
|
+ }
|
|
|
+ }
|
|
|
+ subjectItem.UniqueString = utils.MD5(fmt.Sprint("IN_ID", v2.IndustrialManagementId, "S_ID", v2.IndustrialSubjectId, "T_ID", v2.ThirdId))
|
|
|
+ v2.UniqueString = subjectItem.UniqueString
|
|
|
+ itemSubject.ListSubject = append(itemSubject.ListSubject, subjectItem)
|
|
|
+ }
|
|
|
+ item.BodyChartSummary = mapChartLog[v.PermissionName]
|
|
|
+
|
|
|
+ for _, vs := range listSonLog {
|
|
|
+ listItem := new(reportSelectionResp.CygxReportSelectionLogDetail)
|
|
|
+ listItem.IsNew = vs.IsNew
|
|
|
+ listItem.Body = vs.Body
|
|
|
+ listItem.CompanyLabel = vs.CompanyLabel
|
|
|
+ listItem.UniqueString = vs.UniqueString
|
|
|
+ listItem.ShowName = vs.ShowName
|
|
|
+ item.List = append(item.List, listItem)
|
|
|
+ }
|
|
|
+ item.PermissionName = PermissionNameMap[v.ChartPermissionId]
|
|
|
+ items = append(items, item)
|
|
|
+ itemsSubject = append(itemsSubject, itemSubject)
|
|
|
+ }
|
|
|
+ existMap[v.ChartPermissionId] = v.ChartPermissionId
|
|
|
+ }
|
|
|
+
|
|
|
+ resp.List = items
|
|
|
+ resp.ListPermissionSubject = itemsSubject
|
|
|
+ detailItem := new(reportSelectionResp.DetailCygxReportSelectionRep)
|
|
|
+ detailItem.ArticleId = detail.ArticleId
|
|
|
+ detailItem.Title = detail.Title
|
|
|
+ detailItem.Department = detail.Department
|
|
|
+ detailItem.PublishDate = detail.PublishDate
|
|
|
+ detailItem.ProductDescription = detail.ProductDescription
|
|
|
+ detailItem.UpdateDescription = detail.UpdateDescription
|
|
|
+ detailItem.FocusOn = detail.FocusOn
|
|
|
+ detailItem.MarketStrategy = detail.MarketStrategy
|
|
|
+ resp.Detail = detailItem
|
|
|
+ c.OkDetailed(resp, "获取成功")
|
|
|
+}
|