|
@@ -455,7 +455,7 @@ func (this *SciHqDataController) IndexPageList() {
|
|
|
// SearchList
|
|
|
// @Title 卓创红期模糊搜索
|
|
|
// @Description 卓创红期模糊搜索
|
|
|
-// @Param Keyword query string ture "关键字搜索"
|
|
|
+// @Param Keyword query string true "关键字搜索"
|
|
|
// @Success 200 {object} models.BaseResponse
|
|
|
// @router /sci_hq/search_list [get]
|
|
|
func (this *SciHqDataController) SearchList() {
|
|
@@ -1344,9 +1344,9 @@ func (this *SciHqDataController) DeleteSciHqData() {
|
|
|
// ExportSciHqList
|
|
|
// @Title 导出Sci数据
|
|
|
// @Description 导出Sci数据
|
|
|
-// @Param request body request.ExportSciHqExcelReq true "type json string"
|
|
|
+// @Param ClassifyId query int true "关键字搜索"
|
|
|
// @Success 200 导出成功
|
|
|
-// @router /export/sciHqList [post]
|
|
|
+// @router /export/sciHqList [get]
|
|
|
func (this *SciHqDataController) ExportSciHqList() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
defer func() {
|
|
@@ -1360,42 +1360,38 @@ func (this *SciHqDataController) ExportSciHqList() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- //typeName := this.GetString("TypeName") //分类
|
|
|
- //frequency := this.GetString("Frequency")
|
|
|
- var req request.ExportSciHqExcelReq
|
|
|
- if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
|
|
|
- br.Msg = "参数解析异常!"
|
|
|
- br.ErrMsg = "参数解析失败,Err:" + e.Error()
|
|
|
+ classifyId, _ := this.GetInt("ClassifyId")
|
|
|
+ if classifyId < 0 {
|
|
|
+ br.Msg = "请选择分类"
|
|
|
return
|
|
|
}
|
|
|
secNameList := make([]*models.EdbdataExportList, 0)
|
|
|
-
|
|
|
dir, _ := os.Executable()
|
|
|
exPath := filepath.Dir(dir)
|
|
|
-
|
|
|
downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
|
|
|
xlsxFile := xlsx.NewFile()
|
|
|
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
- if req.KeyWord != "" {
|
|
|
- condition += `AND (index_code=? OR index_name=?)`
|
|
|
- pars = utils.GetLikeKeywordPars(pars, req.KeyWord, 2)
|
|
|
- }
|
|
|
- if req.IsSelectedAll {
|
|
|
- if len(req.IndexCode) > 0 {
|
|
|
- condition += ` AND index_code NOT IN (` + utils.GetOrmInReplace(len(req.IndexCode)) + `)`
|
|
|
- pars = append(pars, req.IndexCode)
|
|
|
+ if classifyId > 0 {
|
|
|
+ childClassify, err := data_manage.GetChildSciHqClassifyListById(classifyId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "下载失败"
|
|
|
+ br.ErrMsg = "获取分类失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
}
|
|
|
- } else {
|
|
|
- if len(req.IndexCode) > 0 {
|
|
|
- condition += ` AND index_code IN (` + utils.GetOrmInReplace(len(req.IndexCode)) + `)`
|
|
|
- pars = append(pars, req.IndexCode)
|
|
|
+ if len(childClassify) > 0 {
|
|
|
+ condition += `AND classify_id IN (` + utils.GetOrmInReplace(len(childClassify)) + `)`
|
|
|
+ for _, child := range childClassify {
|
|
|
+ pars = append(pars, child.ClassifyId)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ condition += ` AND classify_id=?`
|
|
|
+ pars = append(pars, classifyId)
|
|
|
}
|
|
|
- }
|
|
|
- if req.ClassifyId >= 0 {
|
|
|
+ } else {
|
|
|
condition += ` AND classify_id=?`
|
|
|
- pars = append(pars, req.ClassifyId)
|
|
|
+ pars = append(pars, classifyId)
|
|
|
}
|
|
|
frequencies, err := data_manage.GetSciHqFrequencyByCondition(condition, pars)
|
|
|
if err != nil {
|
|
@@ -1430,7 +1426,7 @@ func (this *SciHqDataController) ExportSciHqList() {
|
|
|
unitRow := sheetNew.AddRow()
|
|
|
lastModifyDateRow := sheetNew.AddRow()
|
|
|
//获取分类下指标最大数据量
|
|
|
- dataMax, err := data_manage.GetSciHqDataMaxCount(req.ClassifyId)
|
|
|
+ dataMax, err := data_manage.GetSciHqDataMaxCount(condition, pars)
|
|
|
if err != nil {
|
|
|
fmt.Println("获取指标最大数据量失败", err.Error())
|
|
|
return
|