فهرست منبع

Merge branch 'eta/1.1.6' into debug

Roc 1 سال پیش
والد
کامیت
4f73307641

+ 8 - 1
controllers/data_manage/edb_info.go

@@ -4174,7 +4174,9 @@ func (this *EdbInfoController) GetEdbBeforeAndAfterDateData() {
 	if date == `` {
 		currDate = edbInfo.EndDate
 		isFindAfter = false
-		num-- //减去最后一期的数据,获取前面的几期数据
+		if num <= 0 {
+			num = 4 //默认获取前面的几期数据
+		}
 	}
 
 	dataList := make([]*data_manage.EdbDataList, 0)
@@ -4254,6 +4256,11 @@ func (this *EdbInfoController) GetEdbBeforeAndAfterDateData() {
 		Date: currDate,
 	}
 
+	// 前端不传入日期的时候,这个J皮不让返回这个字段,要不然他会颜色标记
+	if date == `` {
+		resp.Date = ``
+	}
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"

+ 21 - 4
controllers/data_manage/excel/excel_info.go

@@ -180,9 +180,12 @@ func (c *ExcelInfoController) Add() {
 			br.ErrMsg = "表格json转结构体失败,Err:" + err.Error()
 			return
 		}
-		newResult, tmpErr := excel2.GetMixedTableCellData(result.Data)
+		newResult, tmpErr, tmpErrMsg := excel2.GetMixedTableCellData(result.CellRelation, result.Data)
 		if tmpErr != nil {
 			br.Msg = "获取失败"
+			if tmpErrMsg != `` {
+				br.Msg = tmpErrMsg
+			}
 			br.ErrMsg = "获取最新的数据失败,Err:" + err.Error()
 			return
 		}
@@ -595,9 +598,12 @@ func (c *ExcelInfoController) Edit() {
 			br.ErrMsg = "表格json转结构体失败,Err:" + err.Error()
 			return
 		}
-		newResult, tmpErr := excel2.GetMixedTableCellData(result.Data)
+		newResult, tmpErr, tmpErrMsg := excel2.GetMixedTableCellData(result.CellRelation, result.Data)
 		if tmpErr != nil {
 			br.Msg = "获取失败"
+			if tmpErrMsg != `` {
+				br.Msg = tmpErrMsg
+			}
 			br.ErrMsg = "获取最新的数据失败,Err:" + err.Error()
 			return
 		}
@@ -1183,9 +1189,12 @@ func (c *ExcelInfoController) GetExcelTableData() {
 			br.ErrMsg = "表格json转结构体失败,Err:" + err.Error()
 			return
 		}
-		newResult, tmpErr := excel2.GetMixedTableCellData(result.Data)
+		newResult, tmpErr, tmpErrMsg := excel2.GetMixedTableCellData(result.CellRelation, result.Data)
 		if tmpErr != nil {
 			br.Msg = "获取失败"
+			if tmpErrMsg != `` {
+				br.Msg = tmpErrMsg
+			}
 			br.ErrMsg = "获取最新的数据失败,Err:" + err.Error()
 			return
 		}
@@ -1908,9 +1917,12 @@ func (c *ExcelInfoController) Download() {
 			br.ErrMsg = "表格json转结构体失败,Err:" + err.Error()
 			return
 		}
-		newResult, tmpErr := excel2.GetMixedTableCellData(result.Data)
+		newResult, tmpErr, tmpErrMsg := excel2.GetMixedTableCellData(result.CellRelation, result.Data)
 		if tmpErr != nil {
 			br.Msg = "获取失败"
+			if tmpErrMsg != `` {
+				br.Msg = tmpErrMsg
+			}
 			br.ErrMsg = "获取最新的数据失败,Err:" + err.Error()
 			return
 		}
@@ -2140,3 +2152,8 @@ func decompressZip(src string) error {
 	}
 	return nil
 }
+
+func init() {
+	val := `{"Source":3,Frequency":"本周","Day":"周日"}`
+	fmt.Println(excel2.HandleDate(request.SystemDateT, val))
+}

+ 0 - 17
models/data_manage/excel/request/excel_info.go

@@ -128,20 +128,3 @@ type CopyExcelInfoReq struct {
 	ExcelName       string `description:"表格名称"`
 	ExcelClassifyId int    `description:"分类id"`
 }
-
-// MixedTableReq 混合表格保存请求参数
-type MixedTableReq struct {
-	CellRelation string                    `description:"单元格关系"`
-	Data         [][]MixedTableCellDataReq `description:"混合表格单元格参数"`
-}
-
-// MixedTableCellDataReq 混合表格单元格参数
-type MixedTableCellDataReq struct {
-	Uid          string `description:"单元格唯一标识"`
-	DataType     int    `description:"数据类型,1:日期,2:指标,3:自定义文本,4:插值"`
-	DataTime     string `description:"所属日期"`
-	DataTimeType int    `description:"日期类型:0:手动输入日期;1:导入系统日期;2:导入系统日期计算后的日期;3:导入系统日期相关的指定日期;4:导入指标日期(指标库的最新日期);"`
-	EdbInfoId    int    `description:"指标id"`
-	ShowValue    string `description:"展示值"`
-	Value        string `description:"实际值"`
-}

+ 68 - 0
models/data_manage/excel/request/mixed_table.go

@@ -0,0 +1,68 @@
+package request
+
+// 单元格的数据类型
+const (
+	DateDT          = iota + 1 //日期
+	EdbDT                      // 指标类型
+	CustomTextDT               // 自定义文本
+	InsertDataDT               // 插值
+	PopInsertDataDT            // 弹框插值
+)
+
+// 单元格的日期类型类型
+const (
+	CustomDateT = iota //手动输入日期
+	SystemDateT        // 系统日期
+	EdbDateDT          // 导入指标日期(指标库的最新日期)
+)
+
+// 单元格的日期类型类型
+const (
+	SystemCurrDateT      = iota + 1 //系统当前日期
+	SystemCalculateDateT            // 系统日期计算后的日期
+	SystemFrequencyDateT            // 导入系统日期相关的指定频率(所在周/旬/月/季/半年/年的最后/最早一天)
+)
+
+// MixedTableReq 混合表格保存请求参数
+type MixedTableReq struct {
+	CellRelation string                    `description:"单元格关系"`
+	Data         [][]MixedTableCellDataReq `description:"混合表格单元格参数"`
+}
+
+// MixedTableCellDataReq 混合表格单元格参数
+type MixedTableCellDataReq struct {
+	Uid          string `description:"单元格唯一标识"`
+	DataType     int    `description:"数据类型,1:日期,2:指标,3:自定义文本,4:插值"`
+	DataTime     string `description:"所属日期"`
+	DataTimeType int    `description:"日期类型:0:手动输入日期;1:导入系统日期;2:导入系统日期计算后的日期;3:导入系统日期相关的指定频率(所在周/旬/月/季/半年/年的最后/最早一天);4:导入指标日期(指标库的最新日期);"`
+	EdbInfoId    int    `description:"指标id"`
+	ShowValue    string `description:"展示值"`
+	Value        string `description:"实际值"`
+}
+
+// CellRelationConf
+// @Description: 单元格的关系配置结构体
+type CellRelationConf struct {
+	CellRelation
+	//Type         int          `json:"type" description:"数据类型,跟MixedTableCellDataReq的DataType保持一致"`
+	//Key          string       `json:"key" description:"单元格的唯一标识"`
+	RelationDate CellRelation `json:"relation_date"`
+	RelationEdb  CellRelation `json:"relation_edb"`
+}
+
+// CellRelation
+// @Description: 单元格的关系结构体
+type CellRelation struct {
+	Type int    `json:"type" description:"数据类型,跟MixedTableCellDataReq的DataType保持一致"`
+	Key  string `json:"key" description:"单元格的唯一标识"`
+}
+
+// SystemDateConf
+// @Description: 系统导入日期配置
+type SystemDateConf struct {
+	Source             int    `description:"类型,1:导入系统日期;2:导入系统日期计算后的日期;3:导入系统日期相关的指定频率"`
+	CalculateNum       int    `description:"计算频度的数量"`
+	CalculateFrequency string `description:"计算频度"`
+	Frequency          string `description:"指定频度"`
+	Day                string `description:"指定日期"`
+}

+ 2 - 91
services/data/excel/excel_info.go

@@ -73,8 +73,9 @@ func GetExcelDetailInfoByExcelInfoId(excelInfoId int) (excelDetail response.Exce
 			err = errors.New("表格json转结构体失败,Err:" + err.Error())
 			return
 		}
-		newData, tmpErr := GetMixedTableCellData(result.Data)
+		newData, tmpErr, tmpErrMsg := GetMixedTableCellData(result.CellRelation, result.Data)
 		if tmpErr != nil {
+			errMsg = tmpErrMsg
 			err = errors.New("获取最新的数据失败,Err:" + tmpErr.Error())
 			return
 		}
@@ -1261,93 +1262,3 @@ func calculate(calculateFormula string, TagMap map[string]float64) (calVal, errM
 
 	return
 }
-
-// GetMixedTableCellData 获取混合表格数据
-func GetMixedTableCellData(config [][]request.MixedTableCellDataReq) (newMixedTableCellDataList [][]request.MixedTableCellDataReq, err error) {
-	newMixedTableCellDataList = config
-
-	edbInfoIdList := make([]int, 0)
-	dataEdbInfoIdList := make([]int, 0)
-	for _, row := range config {
-		for _, cell := range row {
-			if cell.DataType == 2 {
-				edbInfoIdList = append(edbInfoIdList, cell.EdbInfoId)
-			} else if utils.InArrayByInt([]int{4, 5}, cell.DataType) {
-				dataEdbInfoIdList = append(dataEdbInfoIdList, cell.EdbInfoId)
-			}
-		}
-	}
-
-	edbInfoList, err := data_manage.GetEdbInfoByIdList(edbInfoIdList)
-	if err != nil {
-		return
-	}
-
-	// 指标信息map
-	edbInfoMap := make(map[int]*data_manage.EdbInfo)
-	// 日度指标数据map
-	edbDataListMap := make(map[int]map[string]float64)
-	// 月度指标数据map
-	edbMonthDataListMap := make(map[int]map[string]float64)
-	for _, edbInfo := range edbInfoList {
-		edbInfoMap[edbInfo.EdbInfoId] = edbInfo
-
-		dataList := make([]*data_manage.EdbDataList, 0)
-		switch edbInfo.EdbInfoType {
-		case 0:
-			dataList, _ = data_manage.GetEdbDataList(edbInfo.Source, edbInfo.EdbInfoId, ``, ``)
-		case 1:
-			_, dataList, _, _, _, _ = data.GetPredictDataListByPredictEdbInfoId(edbInfo.EdbInfoId, ``, ``, false)
-		default:
-			err = errors.New(fmt.Sprint("获取失败,指标类型异常", edbInfo.EdbInfoType))
-		}
-
-		dateValMap := make(map[string]float64)
-		monthValMap := make(map[string]float64)
-		for _, data := range dataList {
-			// 日度数据
-			dateValMap[data.DataTime] = data.Value
-			// 月度数据(取该月份的第一个数据)
-			yearMonth := strings.Join(strings.Split(data.DataTime, "-")[0:2], "-")
-			if _, ok := monthValMap[yearMonth]; !ok {
-				monthValMap[yearMonth] = data.Value
-			}
-		}
-		edbDataListMap[edbInfo.EdbInfoId] = dateValMap
-		edbMonthDataListMap[edbInfo.EdbInfoId] = monthValMap
-	}
-
-	for k, row := range newMixedTableCellDataList {
-		for i, cell := range row {
-			if cell.DataType == 2 {
-				if edbInfo, ok := edbInfoMap[cell.EdbInfoId]; ok {
-					cell.ShowValue = edbInfo.EdbName
-				}
-			} else if utils.InArrayByInt([]int{4, 5}, cell.DataType) {
-				tmpDateList := strings.Split(cell.DataTime, "-")
-				tmpDateValMap := make(map[string]float64)
-				if len(tmpDateList) == 2 {
-					//月度数据
-					if dateValMap, ok := edbMonthDataListMap[cell.EdbInfoId]; ok {
-						tmpDateValMap = dateValMap
-					}
-				} else {
-					// 日度数据
-					if dateValMap, ok := edbDataListMap[cell.EdbInfoId]; ok {
-						tmpDateValMap = dateValMap
-					}
-
-				}
-				if val, ok2 := tmpDateValMap[cell.DataTime]; ok2 {
-					//cell.ShowValue = fmt.Sprint(val)
-					cell.ShowValue = utils.FormatTableDataShowValue(val)
-				}
-			}
-
-			row[i] = cell
-		}
-		newMixedTableCellDataList[k] = row
-	}
-
-	return
-}

+ 366 - 0
services/data/excel/mixed_table.go

@@ -0,0 +1,366 @@
+package excel
+
+import (
+	"encoding/json"
+	"errors"
+	"eta/eta_api/models/data_manage"
+	"eta/eta_api/models/data_manage/excel/request"
+	"eta/eta_api/services/data"
+	"eta/eta_api/utils"
+	"fmt"
+	"strings"
+	"time"
+)
+
+// GetMixedTableCellData 获取混合表格数据
+func GetMixedTableCellData(cellRelationConf string, config [][]request.MixedTableCellDataReq) (newMixedTableCellDataList [][]request.MixedTableCellDataReq, err error, errMsg string) {
+	// 单元格关系配置x信息
+	cellRelationConfMap := make(map[string]request.CellRelationConf)
+	cellRelationConfList := make([]request.CellRelationConf, 0)
+	if cellRelationConf != `` {
+		err = json.Unmarshal([]byte(cellRelationConf), &cellRelationConfList)
+		if err != nil {
+			return
+		}
+
+		for _, v := range cellRelationConfList {
+			cellRelationConfMap[v.Key] = v
+		}
+	}
+
+	// 找出所有的关联指标id
+	config, edbInfoIdList, _, err, errMsg := handleConfig(config)
+
+	// 查询所有关联的指标信息
+	edbInfoList, err := data_manage.GetEdbInfoByIdList(edbInfoIdList)
+	if err != nil {
+		return
+	}
+
+	// 指标信息map
+	edbInfoMap := make(map[int]*data_manage.EdbInfo)
+	// 日度指标数据map
+	edbDataListMap := make(map[int]map[string]float64)
+	// 月度指标数据map
+	edbMonthDataListMap := make(map[int]map[string]float64)
+	for _, edbInfo := range edbInfoList {
+		edbInfoMap[edbInfo.EdbInfoId] = edbInfo
+
+		dataList := make([]*data_manage.EdbDataList, 0)
+		switch edbInfo.EdbInfoType {
+		case 0:
+			dataList, _ = data_manage.GetEdbDataList(edbInfo.Source, edbInfo.EdbInfoId, ``, ``)
+		case 1:
+			_, dataList, _, _, _, _ = data.GetPredictDataListByPredictEdbInfoId(edbInfo.EdbInfoId, ``, ``, false)
+		default:
+			err = errors.New(fmt.Sprint("获取失败,指标类型异常", edbInfo.EdbInfoType))
+		}
+
+		dateValMap := make(map[string]float64)
+		monthValMap := make(map[string]float64)
+		for _, data := range dataList {
+			// 日度数据
+			dateValMap[data.DataTime] = data.Value
+			// 月度数据(取该月份的第一个数据)
+			yearMonth := strings.Join(strings.Split(data.DataTime, "-")[0:2], "-")
+			if _, ok := monthValMap[yearMonth]; !ok {
+				monthValMap[yearMonth] = data.Value
+			}
+		}
+		edbDataListMap[edbInfo.EdbInfoId] = dateValMap
+		edbMonthDataListMap[edbInfo.EdbInfoId] = monthValMap
+	}
+
+	// 处理指定指标的日期
+	for k, row := range config {
+		for i, cell := range row {
+			// 单元格是日期类型,且是日导入指标日期(指标库的最新日期)
+			if cell.DataType == request.DateDT && cell.DataTimeType == request.EdbDateDT {
+				if edbInfo, ok := edbInfoMap[cell.EdbInfoId]; ok {
+					cell.ShowValue = edbInfo.EndDate
+					cell.DataTime = edbInfo.EndDate
+					config[k][i] = cell
+				}
+			}
+			row[i] = cell
+		}
+		config[k] = row
+	}
+
+	for k, row := range config {
+		for i, cell := range row {
+			switch cell.DataType {
+			case request.EdbDT: // 指标类型
+				if edbInfo, ok := edbInfoMap[cell.EdbInfoId]; ok {
+					cell.ShowValue = edbInfo.EdbName
+				}
+			case request.InsertDataDT, request.PopInsertDataDT: // 数据类型
+				tmpDateList := strings.Split(cell.DataTime, "-")
+				tmpDateValMap := make(map[string]float64)
+				if len(tmpDateList) == 2 {
+					//月度数据
+					if dateValMap, ok := edbMonthDataListMap[cell.EdbInfoId]; ok {
+						tmpDateValMap = dateValMap
+					}
+				} else {
+					// 日度数据
+					if dateValMap, ok := edbDataListMap[cell.EdbInfoId]; ok {
+						tmpDateValMap = dateValMap
+					}
+
+				}
+				if val, ok2 := tmpDateValMap[cell.DataTime]; ok2 {
+					//cell.ShowValue = fmt.Sprint(val)
+					cell.ShowValue = utils.FormatTableDataShowValue(val)
+				}
+			}
+
+			row[i] = cell
+		}
+		config[k] = row
+	}
+
+	newMixedTableCellDataList = config
+
+	return
+}
+
+func handleConfig(configList [][]request.MixedTableCellDataReq) (newConfig [][]request.MixedTableCellDataReq, edbInfoIdList []int, dataEdbInfoIdList []int, err error, errMsg string) {
+	edbInfoIdList = make([]int, 0)
+	dataEdbInfoIdList = make([]int, 0)
+
+	for ck, rowList := range configList {
+		for rk, cell := range rowList {
+			switch cell.DataType {
+			case request.EdbDT: // 指标信息
+				edbInfoIdList = append(edbInfoIdList, cell.EdbInfoId)
+			case request.InsertDataDT, request.PopInsertDataDT: // 插值、弹框插值
+				dataEdbInfoIdList = append(dataEdbInfoIdList, cell.EdbInfoId)
+			case request.DateDT: // 日期类型
+				if cell.DataTimeType == request.EdbDateDT {
+					edbInfoIdList = append(edbInfoIdList, cell.EdbInfoId)
+				} else {
+					date, tmpErr, tmpErrMsg := handleDate(cell.DataTimeType, cell.Value)
+					if tmpErr != nil {
+						err = tmpErr
+						errMsg = tmpErrMsg
+						return
+					}
+					rowList[rk].DataTime = date
+					rowList[rk].ShowValue = date
+				}
+			}
+		}
+		configList[ck] = rowList
+	}
+
+	newConfig = configList
+
+	return
+}
+
+// HandleDate
+// @Description: 日期处理
+// @author: Roc
+// @datetime2023-10-27 09:37:02
+// @param dataTimeType int
+// @param val string
+// @return date string
+// @return err error
+// @return errMsg string
+func HandleDate(dataTimeType int, val string) (date string, err error, errMsg string) {
+	return handleDate(dataTimeType, val)
+}
+
+// handleDate
+// @Description: 日期处理
+// @author: Roc
+// @datetime2023-10-27 09:36:49
+// @param dataTimeType int
+// @param val string
+// @return date string
+// @return err error
+// @return errMsg string
+func handleDate(dataTimeType int, val string) (date string, err error, errMsg string) {
+	if val == `` {
+		errMsg = "错误的日期数据"
+		err = errors.New(errMsg)
+		return
+	}
+	switch dataTimeType {
+	case request.CustomDateT: //手动输入日期
+		date = val
+	case request.SystemDateT: // 系统日期
+		date, err, errMsg = handleSystemDateT(val)
+	case request.EdbDateDT: // 导入指标日期(指标库的最新日期)
+	default:
+		errMsg = "错误的日期类型"
+		err = errors.New(errMsg)
+		return
+	}
+
+	return
+}
+
+// handleSystemDateT
+// @Description: 处理导入系统日期
+// @author: Roc
+// @datetime2023-10-27 09:36:21
+// @param confStr string
+// @return date string
+// @return err error
+// @return errMsg string
+func handleSystemDateT(confStr string) (date string, err error, errMsg string) {
+	var config request.SystemDateConf
+	err = json.Unmarshal([]byte(confStr), &config)
+	if err != nil {
+		return
+	}
+	type SystemCalculateVal struct {
+		Source    int `description:"类型,"`
+		Num       int
+		Frequency string
+	}
+	switch config.Source {
+	case request.SystemCurrDateT:
+		date = time.Now().Format(utils.FormatDate)
+	case request.SystemCalculateDateT:
+		date, err, errMsg = handleSystemCalculateDateT(config.CalculateNum, config.CalculateFrequency)
+	case request.SystemFrequencyDateT: // 处理系统日期相关的指定频率(所在周/旬/月/季/半年/年的最后/最早一天)
+		date, err, errMsg = handleSystemAppointDateT(config.Day, config.Frequency)
+	default:
+		errMsg = "错误的日期日期导入方式"
+		err = errors.New(fmt.Sprint("错误的日期日期导入方式:", config.Source))
+		return
+	}
+
+	return
+}
+
+// handleSystemCalculateDateT
+// @Description: 处理系统日期计算后的日期
+// @author: Roc
+// @datetime2023-10-27 09:31:22
+// @param num int
+// @param frequency string
+// @return date string
+// @return err error
+// @return errMsg string
+func handleSystemCalculateDateT(num int, frequency string) (date string, err error, errMsg string) {
+	if err != nil {
+		return
+	}
+	currDate := time.Now()
+	switch frequency {
+	case "", "日":
+		date = currDate.AddDate(0, 0, num).Format(utils.FormatDate)
+	default:
+		errMsg = "错误的日期频度:" + frequency
+		err = errors.New(errMsg)
+		return
+	}
+
+	return
+}
+
+// handleSystemAppointDateT
+// @Description: 处理系统日期相关的指定频率(所在周/旬/月/季/半年/年的最后/最早一天)
+// @author: Roc
+// @datetime2023-10-27 09:31:35
+// @param Frequency string
+// @param Day string
+// @return date string
+// @return err error
+// @return errMsg string
+func handleSystemAppointDateT(appointDay, frequency string) (date string, err error, errMsg string) {
+	currDate := time.Now()
+	switch frequency {
+	case "本周":
+		day := int(currDate.Weekday())
+		if day == 0 { // 周日
+			day = 7
+		}
+		num := 0
+		switch appointDay {
+		case "周一":
+			num = 1
+		case "周二":
+			num = 2
+		case "周三":
+			num = 3
+		case "周四":
+			num = 4
+		case "周五":
+			num = 5
+		case "周六":
+			num = 6
+		case "周日":
+			num = 7
+		}
+		day = num - day
+		date = currDate.AddDate(0, 0, day).Format(utils.FormatDate)
+	case "本旬":
+		day := currDate.Day()
+		var tmpDate time.Time
+		switch appointDay {
+		case "第一天":
+			if day <= 10 {
+				tmpDate = time.Date(currDate.Year(), currDate.Month(), 1, 0, 0, 0, 0, currDate.Location())
+			} else if day <= 20 {
+				tmpDate = time.Date(currDate.Year(), currDate.Month(), 11, 0, 0, 0, 0, currDate.Location())
+			} else {
+				tmpDate = time.Date(currDate.Year(), currDate.Month(), 21, 0, 0, 0, 0, currDate.Location())
+			}
+		case "最后一天":
+			if day <= 10 {
+				tmpDate = time.Date(currDate.Year(), currDate.Month(), 10, 0, 0, 0, 0, currDate.Location())
+			} else if day <= 20 {
+				tmpDate = time.Date(currDate.Year(), currDate.Month(), 20, 0, 0, 0, 0, currDate.Location())
+			} else {
+				tmpDate = time.Date(currDate.Year(), currDate.Month()+1, 1, 0, 0, 0, 0, currDate.Location()).AddDate(0, 0, -1)
+			}
+		}
+		date = tmpDate.Format(utils.FormatDate)
+	case "本月":
+		var tmpDate time.Time
+		switch appointDay {
+		case "第一天":
+			tmpDate = time.Date(currDate.Year(), currDate.Month(), 1, 0, 0, 0, 0, currDate.Location())
+		case "最后一天":
+			tmpDate = time.Date(currDate.Year(), currDate.Month()+1, 1, 0, 0, 0, 0, currDate.Location()).AddDate(0, 0, -1)
+		}
+		date = tmpDate.Format(utils.FormatDate)
+	case "本季":
+		month := currDate.Month()
+		var tmpDate time.Time
+		switch appointDay {
+		case "第一天":
+			if month <= 3 {
+				tmpDate = time.Date(currDate.Year(), 1, 1, 0, 0, 0, 0, currDate.Location())
+			} else if month <= 6 {
+				tmpDate = time.Date(currDate.Year(), 4, 1, 0, 0, 0, 0, currDate.Location())
+			} else if month <= 9 {
+				tmpDate = time.Date(currDate.Year(), 7, 1, 0, 0, 0, 0, currDate.Location())
+			} else {
+				tmpDate = time.Date(currDate.Year(), 10, 1, 0, 0, 0, 0, currDate.Location())
+			}
+		case "最后一天":
+			if month <= 3 {
+				tmpDate = time.Date(currDate.Year(), 3, 31, 0, 0, 0, 0, currDate.Location())
+			} else if month <= 6 {
+				tmpDate = time.Date(currDate.Year(), 6, 30, 0, 0, 0, 0, currDate.Location())
+			} else if month <= 9 {
+				tmpDate = time.Date(currDate.Year(), 9, 30, 0, 0, 0, 0, currDate.Location())
+			} else {
+				tmpDate = time.Date(currDate.Year(), 12, 31, 0, 0, 0, 0, currDate.Location())
+			}
+		}
+		date = tmpDate.Format(utils.FormatDate)
+	default:
+		errMsg = "错误的日期频度:" + frequency
+		err = errors.New(errMsg)
+		return
+	}
+
+	return
+}