123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- package data
- import (
- "eta_gn/eta_api/models/data_manage"
- "eta_gn/eta_api/models/data_manage/request"
- "eta_gn/eta_api/models/system"
- "eta_gn/eta_api/services/elastic"
- "eta_gn/eta_api/utils"
- "github.com/rdlucklib/rdluck_tools/paging"
- "strings"
- )
- func DeleteChartPublicCheck(chartInfoId int, sysUser *system.Admin) (deleteStatus int, tipsMsg string, tableList []*data_manage.ExcelBaseInfo, err error, errMsg string) {
-
- {
- }
-
- if chartInfoId > 0 {
-
-
-
-
-
-
-
-
-
-
- return
- }
- return
- }
- func GetChartSearchPar(req request.SearchPublicChartReq) (keyword string, searchChartPublicList, sourceList, chartTypeList, classifyIdList, publicClassifyIdList []int, chartAuth int, sortMap map[string]string) {
- keyword = req.Keyword
- keyword = strings.TrimSpace(keyword)
-
- sourceList = []int{utils.CHART_TYPE_CURVE}
- chartTypeList = req.ChartTypeList
-
- classifyIdList = req.ClassifyIdList
-
- publicClassifyIdList = req.PublicClassifyIdList
-
- chartPublicList := req.ChartPublicList
- if len(chartPublicList) <= 0 {
- chartPublicList = []int{1}
- }
- chartAuth = 1
- searchChartPublicList = make([]int, 0)
- if len(chartPublicList) > 0 && !utils.InArrayByInt(chartPublicList, 0) {
-
- for _, v := range chartPublicList {
- switch v {
- case 1:
- searchChartPublicList = append(searchChartPublicList, utils.DataPublicDefault)
- case 2:
- searchChartPublicList = append(searchChartPublicList, utils.DataPublicCommit, utils.DataPublicReject)
- case 3:
- searchChartPublicList = append(searchChartPublicList, utils.DataPublicSuccess)
- }
- }
- } else {
- searchChartPublicList = []int{0, 1, 2, 3}
- }
- sortMap = make(map[string]string)
-
- if keyword == `` {
- sortMap["ChartInfoId"] = `desc`
- }
- return
- }
- func GetAllChartInfoListBySearchPublicChartReq(req request.SearchPublicChartReq, userId int) (chartInfoList []*data_manage.ChartInfoView, err error) {
-
- keyword, searchChartPublicList, sourceList, chartTypeList, chartClassifyIdList, publicClassifyIdList, chartAuth, sortMap := GetChartSearchPar(req)
- _, chartInfoList, err = getAllChartInfoDataByPublic(keyword, 1, searchChartPublicList, sourceList, chartTypeList, chartClassifyIdList, publicClassifyIdList, chartAuth, userId, sortMap)
- if err != nil {
- return
- }
- return
- }
- func getAllChartInfoDataByPublic(keyword string, currPage int, searchChartPublicList, sourceList, chartTypeList, classifyIdList, publicClassifyIdList []int, chartAuth, sysUserId int, sortMap map[string]string) (total int64, list []*data_manage.ChartInfoView, err error) {
-
- pageSize := 5000
- var startSize int
- if currPage <= 0 {
- currPage = 1
- }
- startSize = paging.StartIndex(currPage, pageSize)
- total, list, err = elastic.SearchChartInfoDataByPublic(keyword, startSize, pageSize, searchChartPublicList, sourceList, chartTypeList, classifyIdList, publicClassifyIdList, chartAuth, sysUserId, sortMap)
- if err != nil {
- return
- }
- page := paging.GetPaging(currPage, pageSize, int(total))
- if !page.IsEnd {
- _, nextList, tmpErr := getAllChartInfoDataByPublic(keyword, page.NextIndex, searchChartPublicList, sourceList, chartTypeList, classifyIdList, publicClassifyIdList, chartAuth, sysUserId, sortMap)
- if tmpErr != nil {
- err = tmpErr
- return
- }
- list = append(list, nextList...)
- }
- return
- }
|