|
@@ -52,12 +52,12 @@ func GetChartInfoDetail(c *gin.Context) {
|
|
|
reqChartType := c.DefaultQuery("ChartType", "")
|
|
|
chartType, _ := strconv.Atoi(reqChartType)
|
|
|
// 季节性图表时间
|
|
|
- seasonStartDate := c.DefaultQuery("SeasonStartDate", "")
|
|
|
- seasonEndDate := c.DefaultQuery("SeasonEndDate", "")
|
|
|
+ reqSeasonStartDate := c.DefaultQuery("SeasonStartDate", "")
|
|
|
+ reqSeasonEndDate := c.DefaultQuery("SeasonEndDate", "")
|
|
|
// 指标ID
|
|
|
edbInfoId := c.DefaultQuery("EdbInfoId", "")
|
|
|
// 公历/农历
|
|
|
- calendar := c.DefaultQuery("Calendar", "公历")
|
|
|
+ reqCalendar := c.DefaultQuery("Calendar", "")
|
|
|
|
|
|
// 获取图表信息
|
|
|
var err error
|
|
@@ -72,6 +72,10 @@ func GetChartInfoDetail(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
chartType = chartInfo.ChartType
|
|
|
+ calendar := chartInfo.Calendar
|
|
|
+ if reqCalendar != "" {
|
|
|
+ calendar = reqCalendar
|
|
|
+ }
|
|
|
|
|
|
// 时段筛选
|
|
|
reqDateType := c.DefaultQuery("DateType", "")
|
|
@@ -116,6 +120,17 @@ func GetChartInfoDetail(c *gin.Context) {
|
|
|
|
|
|
if chartType == 2 {
|
|
|
// 季节性图表
|
|
|
+ var seasonStartDate, seasonEndDate string
|
|
|
+ if reqSeasonStartDate == "" {
|
|
|
+ seasonStartDate = chartInfo.SeasonStartDate
|
|
|
+ } else {
|
|
|
+ seasonStartDate = reqSeasonStartDate
|
|
|
+ }
|
|
|
+ if reqSeasonEndDate == "" {
|
|
|
+ seasonEndDate = chartInfo.SeasonEndDate
|
|
|
+ } else {
|
|
|
+ seasonEndDate = reqSeasonEndDate
|
|
|
+ }
|
|
|
if seasonStartDate != "" {
|
|
|
startDate = seasonStartDate + "-01-01"
|
|
|
} else {
|
|
@@ -125,7 +140,7 @@ func GetChartInfoDetail(c *gin.Context) {
|
|
|
if seasonEndDate != "" {
|
|
|
endDate = seasonEndDate + "-12-31"
|
|
|
} else {
|
|
|
- endDate = ""
|
|
|
+ endDate = time.Now().Format(utils.FormatDate)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -148,9 +163,9 @@ func GetChartInfoDetail(c *gin.Context) {
|
|
|
}
|
|
|
|
|
|
// 指标列表
|
|
|
- edbList := make([]*chartEdbMappingModel.ChartEdbInfoMapping, 0)
|
|
|
+ edbList := make([]*chartEdbMappingModel.ChartEdbInfoMappingList, 0)
|
|
|
for _, v := range mappingList {
|
|
|
- item := new(chartEdbMappingModel.ChartEdbInfoMapping)
|
|
|
+ item := new(chartEdbMappingModel.ChartEdbInfoMappingList)
|
|
|
item.EdbInfoId = v.EdbInfoId
|
|
|
item.SourceName = v.SourceName
|
|
|
item.Source = v.Source
|
|
@@ -234,11 +249,11 @@ func GetChartInfoDetail(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
calendarPreYear = newStartDateReal.Year() - 1
|
|
|
- //newStartDateReal = newStartDateReal.AddDate(-1, 0, 0)
|
|
|
+ newStartDateReal = newStartDateReal.AddDate(-1, 0, 0)
|
|
|
startDateReal = newStartDateReal.Format(utils.FormatDate)
|
|
|
}
|
|
|
dataList := make([]*edbDataModel.EdbDataList, 0)
|
|
|
- //fmt.Println("chart:", v.Source, v.EdbInfoId, startDateReal, endDate)
|
|
|
+ fmt.Println("chart:", v.Source, v.EdbInfoId, startDateReal, endDate)
|
|
|
dataList, err = edbDataModel.GetEdbDataList(v.Source, v.EdbInfoId, startDateReal, endDate)
|
|
|
if err != nil {
|
|
|
response.FailMsg("获取失败", "获取图表指标信息失败4003, Err:" + err.Error(), c)
|
|
@@ -316,28 +331,14 @@ func GetChartInfoDetail(c *gin.Context) {
|
|
|
edbList = append(edbList, item)
|
|
|
}
|
|
|
|
|
|
- /*if chartInfoId > 0 && chartInfo != nil {
|
|
|
- // 判断是否加入我的图库
|
|
|
- {
|
|
|
- var myChartCondition string
|
|
|
- var myChartPars []interface{}
|
|
|
- myChartCondition += ` AND a.admin_id = ? `
|
|
|
- myChartPars = append(myChartPars, userInfo.AdminId)
|
|
|
- myChartCondition += ` AND a.chart_info_id = ? `
|
|
|
- myChartPars = append(myChartPars, chartInfo.ChartInfoId)
|
|
|
-
|
|
|
- myChartList, err := my_chart.GetMyChartByCondition(myChartCondition, myChartPars)
|
|
|
- if err != nil && err != utils.ErrNoRow {
|
|
|
- response.FailMsg("获取失败", "获取我的图表信息失败, Err:" + err.Error(), c)
|
|
|
- return
|
|
|
- }
|
|
|
- if myChartList != nil && len(myChartList) > 0 {
|
|
|
- chartInfo.IsAdd = true
|
|
|
- chartInfo.MyChartId = myChartList[0].MyChartId
|
|
|
- chartInfo.MyChartClassifyId = myChartList[0].MyChartClassifyId
|
|
|
- }
|
|
|
- }
|
|
|
- }*/
|
|
|
+ // 访问记录-仅普通用户记录
|
|
|
+ userInfo := user.GetInfoByClaims(c)
|
|
|
+ ok, _, _ := user.GetAdminByUserInfo(userInfo)
|
|
|
+ if !ok {
|
|
|
+ reqMyChartClassifyId := c.DefaultQuery("MyChartClassifyId", "")
|
|
|
+ myChartClassifyId, _ := strconv.Atoi(reqMyChartClassifyId)
|
|
|
+ go chart.SaveChartVisitLog(userInfo, chartInfo, myChartClassifyId)
|
|
|
+ }
|
|
|
|
|
|
resp := new(chart_info.ChartInfoDetailResp)
|
|
|
resp.ChartInfo = chartInfo
|