|
@@ -36,14 +36,13 @@ type ResourceController struct {
|
|
|
// @Param StartDate query string true "开始时间"
|
|
|
// @Param EndDate query string true "结束时间"
|
|
|
// @Param Frequency query string true "频度"
|
|
|
-// @Param ClassifyIdFirst query int true "一级分类id"
|
|
|
-// @Param ClassifyIdSecond query int true "二级分类id"
|
|
|
-// @Param ClassifyIdThird query int true "三级分类id"
|
|
|
+// @Param ClassifyIds query int true "分类id, 多选, 英文逗号分隔"
|
|
|
// @Param State query int true "状态"
|
|
|
// @Param KeyWord query string true "搜索关键词"
|
|
|
// @Param PublishSort query string true "desc:降序,asc 升序(预留)"
|
|
|
// @Param FilterReportType query string true "筛选事件类型,1:公共研报,2:共享研报,3:我的研报"
|
|
|
// @Param IncludeFile query string true "是否包含文件, no:不包含"
|
|
|
+// @Param SourceFrom query string true "来源, 用英文逗号分隔"
|
|
|
// @Param IsShowMe query string true "只看我, false:全部, true:只看我"
|
|
|
// @Success 200 {object} knowledge.KnowledgeResourceListResp
|
|
|
// @router /resource/list [get]
|
|
@@ -279,6 +278,137 @@ func (this *ResourceController) List() {
|
|
|
br.Data = resp
|
|
|
}
|
|
|
|
|
|
+// Search
|
|
|
+// @Title 获取事件列表接口
|
|
|
+// @Description 获取事件列表
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
+// @Param TimeType query string true "筛选的时间类别:publish_time(发布时间),modify_time(更新时间);approve_time(审批时间)"
|
|
|
+// @Param StartDate query string true "开始时间"
|
|
|
+// @Param EndDate query string true "结束时间"
|
|
|
+// @Param Frequency query string true "频度"
|
|
|
+// @Param ClassifyIds query int true "分类id, 多选, 英文逗号分隔"
|
|
|
+// @Param SysUserIds query int true "用户id, 多选, 英文逗号分隔"
|
|
|
+// @Param State query int true "状态"
|
|
|
+// @Param KeyWord query string true "搜索关键词"
|
|
|
+// @Param PublishSort query string true "desc:降序,asc 升序(预留)"
|
|
|
+// @Param FilterReportType query string true "筛选事件类型,1:公共研报,2:共享研报,3:我的研报"
|
|
|
+// @Param IncludeFile query string true "是否包含文件, no:不包含"
|
|
|
+// @Param SourceFrom query string true "来源, 用英文逗号分隔"
|
|
|
+// @Param IsShowMe query string true "只看我, false:全部, true:只看我"
|
|
|
+// @Success 200 {object} knowledge.KnowledgeResourceListResp
|
|
|
+// @router /resource/search_by_es [get]
|
|
|
+func (this *ResourceController) Search() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+
|
|
|
+ classifyIds := this.GetString("ClassifyIds")
|
|
|
+ // 添加人
|
|
|
+ addUserIds := this.GetString("SysUserIds")
|
|
|
+ // 标签
|
|
|
+ tagIds := this.GetString("TagIds")
|
|
|
+
|
|
|
+ keyWord := this.GetString("Keyword")
|
|
|
+ resourceType, _ := this.GetInt("ResourceType")
|
|
|
+
|
|
|
+ sourceFrom := this.GetString("SourceFrom")
|
|
|
+
|
|
|
+ includeFile := this.GetString("IncludeFile")
|
|
|
+
|
|
|
+ IsShowMe, _ := this.GetBool("IsShowMe")
|
|
|
+
|
|
|
+ var startSize int
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+
|
|
|
+ startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
+
|
|
|
+ isIncludeFile := true
|
|
|
+ if includeFile == "no" {
|
|
|
+ isIncludeFile = false
|
|
|
+ }
|
|
|
+ var searchUserIds []int
|
|
|
+ if IsShowMe {
|
|
|
+ searchUserIds = append(searchUserIds, this.SysUser.AdminId)
|
|
|
+ }
|
|
|
+ if addUserIds != "" {
|
|
|
+ // 转成数组,并把类型转成int
|
|
|
+ addUserIdsArr := strings.Split(addUserIds, ",")
|
|
|
+ for _, v := range addUserIdsArr {
|
|
|
+ addUserId, _ := strconv.Atoi(v)
|
|
|
+ searchUserIds = append(searchUserIds, addUserId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var sourceFromArr []string
|
|
|
+ if sourceFrom != "" {
|
|
|
+ sourceFromArr = strings.Split(sourceFrom, ",")
|
|
|
+ }
|
|
|
+ var classifyIdsInt []int
|
|
|
+ if classifyIds != "" {
|
|
|
+ //转成数组,并把类型转成int
|
|
|
+ classifyIdsArr := strings.Split(classifyIds, ",")
|
|
|
+ for _, v := range classifyIdsArr {
|
|
|
+ classifyId, _ := strconv.Atoi(v)
|
|
|
+ classifyIdsInt = append(classifyIdsInt, classifyId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var tagIdsInt []int
|
|
|
+ if tagIds != "" {
|
|
|
+ //转成数组,并把类型转成int
|
|
|
+ tagIdsArr := strings.Split(tagIds, ",")
|
|
|
+ for _, v := range tagIdsArr {
|
|
|
+ tagId, _ := strconv.Atoi(v)
|
|
|
+ tagIdsInt = append(tagIdsInt, tagId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ knowledges, total, err := knowledgeServ.SearchKnowledgeResourceByEs(resourceType, keyWord, searchUserIds, classifyIdsInt, sourceFromArr, tagIdsInt, isIncludeFile, startSize, pageSize)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ list := make([]*knowledge.KnowledgeResourceList, 0, len(knowledges))
|
|
|
+ for _, v := range knowledges {
|
|
|
+ item := new(knowledge.KnowledgeResourceList)
|
|
|
+ item.KnowledgeResourceId = v.KnowledgeResourceId
|
|
|
+ item.ResourceType = v.ResourceType
|
|
|
+ item.ClassifyId = v.ClassifyId
|
|
|
+ item.Title = v.Title
|
|
|
+ item.CreateTime = v.CreateTime.Format(utils.FormatDateTime)
|
|
|
+ item.ModifyTime = v.ModifyTime.Format(utils.FormatDateTime)
|
|
|
+ item.State = v.State
|
|
|
+ item.ResourceCode = v.ResourceCode
|
|
|
+ item.AdminId = v.AdminId
|
|
|
+ item.AdminRealName = v.AdminRealName
|
|
|
+ item.SourceFrom = v.SourceFrom
|
|
|
+ item.TagId = v.TagId
|
|
|
+ item.StartTime = v.StartTime.Format(utils.FormatDateTime)
|
|
|
+ item.EndTime = v.EndTime.Format(utils.FormatDateTime)
|
|
|
+ list = append(list, item)
|
|
|
+ }
|
|
|
+
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, int(total))
|
|
|
+ resp := new(knowledge.KnowledgeResourceListResp)
|
|
|
+ resp.Paging = page
|
|
|
+ resp.List = list
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
// Add
|
|
|
// @Title 新增事件接口
|
|
|
// @Description 新增事件(区分事件类型)
|
|
@@ -816,6 +946,13 @@ func (this *ResourceController) Delete() {
|
|
|
br.ErrMsg = "删除事件失败, Err: " + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ go func() {
|
|
|
+ item.IsDelete = 1
|
|
|
+ er := knowledgeServ.EsAddOrEditKnowledgeResource(item)
|
|
|
+ if er != nil {
|
|
|
+ utils.FileLog.Info("知识资源id:" + strconv.Itoa(req.KnowledgeResourceId) + ",删除事件同步es失败, Err: " + er.Error())
|
|
|
+ }
|
|
|
+ }()
|
|
|
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
@@ -1206,10 +1343,7 @@ func (this *ResourceController) TemplateDownload() {
|
|
|
// @Title 获取bi看报中的知识资源列表
|
|
|
// @Description 获取bi看报中的知识资源列表
|
|
|
// @Success 200 {object} models.EdbdataClassifyResp
|
|
|
-// @Param ResourceType query int true "资源库类型:0:事件库 1:政策库 2:观点库;3:知识库"
|
|
|
// @Param BiDashboardDetailId query int true "bi看板详情ID"
|
|
|
-// @Param CurrentIndex query int true "当前页码,从1开始"
|
|
|
-// @Param PageSize query int true "每页显示数量"
|
|
|
// @router /resource/bi_dashboard/list [get]
|
|
|
func (this *ResourceController) BiDashboardResourceList() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
@@ -1219,11 +1353,11 @@ func (this *ResourceController) BiDashboardResourceList() {
|
|
|
}()
|
|
|
|
|
|
biDashboardDetailId, _ := this.GetInt("BiDashboardDetailId")
|
|
|
- resourceType, _ := this.GetInt("ResourceType")
|
|
|
- currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
- pageSize, _ := this.GetInt("PageSize")
|
|
|
+ // resourceType, _ := this.GetInt("ResourceType")
|
|
|
+ // currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+ // pageSize, _ := this.GetInt("PageSize")
|
|
|
|
|
|
- resp, msg, err := knowledgeServ.GetKnowledgeResourceList(biDashboardDetailId, resourceType, currentIndex, pageSize)
|
|
|
+ resp, msg, err := knowledgeServ.GetKnowledgeResourceList(biDashboardDetailId)
|
|
|
if err != nil {
|
|
|
if msg == "" {
|
|
|
msg = "获取数据失败"
|
|
@@ -1243,7 +1377,7 @@ func (this *ResourceController) BiDashboardResourceList() {
|
|
|
// @Title 获取bi看报中的知识资源列表
|
|
|
// @Description 获取bi看报中的知识资源列表
|
|
|
// @Success 200 {object} models.EdbdataClassifyResp
|
|
|
-// @Param ResourceType query int true "资源库类型:0:事件库 1:政策库 2:观点库;3:知识库"
|
|
|
+// @Param biDashboardDetailId query int true "看板详情ID"
|
|
|
// @router /resource/bi_dashboard/cache/list [get]
|
|
|
func (this *ResourceController) BiDashboardCacheResourceList() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
@@ -1253,9 +1387,8 @@ func (this *ResourceController) BiDashboardCacheResourceList() {
|
|
|
}()
|
|
|
|
|
|
biDashboardDetailId, _ := this.GetInt("BiDashboardDetailId")
|
|
|
- resourceType, _ := this.GetInt("ResourceType")
|
|
|
|
|
|
- resp, msg, err := knowledgeServ.GetKnowledgeResourceTmpList(biDashboardDetailId, resourceType, this.SysUser.AdminId)
|
|
|
+ resp, msg, err := knowledgeServ.GetKnowledgeResourceTmpList(biDashboardDetailId, this.SysUser.AdminId)
|
|
|
if err != nil {
|
|
|
if msg == "" {
|
|
|
msg = "获取数据失败"
|