Ver Fonte

Merge branch 'master' of http://8.136.199.33:3000/eta_server/eta_mobile

hsun há 1 ano atrás
pai
commit
1944615680

+ 4 - 4
controllers/data_manage/chart_common.go

@@ -123,8 +123,8 @@ func (this *ChartInfoController) CommonChartInfoDetailFromUniqueCode() {
 		br.Success = true
 		br.Msg = "获取成功"
 		br.Data = resp
-	case utils.CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION, utils.CHART_SOURCE_LINE_FEATURE_PERCENTILE, utils.CHART_SOURCE_LINE_FEATURE_FREQUENCY:
-		resp, isOk, msg, errMsg := GetLineFeatureChartInfoDetailFromUniqueCode(chartInfo, isCache, sysUser)
+	case utils.CHART_SOURCE_LINE_EQUATION:
+		resp, isOk, msg, errMsg := line_equation.GetChartInfoDetailFromUniqueCode(chartInfo, isCache, sysUser)
 		if !isOk {
 			br.Msg = msg
 			br.ErrMsg = errMsg
@@ -134,8 +134,8 @@ func (this *ChartInfoController) CommonChartInfoDetailFromUniqueCode() {
 		br.Success = true
 		br.Msg = "获取成功"
 		br.Data = resp
-	case utils.CHART_SOURCE_LINE_EQUATION:
-		resp, isOk, msg, errMsg := line_equation.GetChartInfoDetailFromUniqueCode(chartInfo, isCache, sysUser)
+	case utils.CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION, utils.CHART_SOURCE_LINE_FEATURE_PERCENTILE, utils.CHART_SOURCE_LINE_FEATURE_FREQUENCY:
+		resp, isOk, msg, errMsg := GetLineFeatureChartInfoDetailFromUniqueCode(chartInfo, isCache, sysUser)
 		if !isOk {
 			br.Msg = msg
 			br.ErrMsg = errMsg

+ 12 - 0
controllers/data_manage/chart_info.go

@@ -225,6 +225,12 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *data_manage.ChartInfoView, isCa
 		}
 	}
 
+	// 单位
+	if chartType == utils.CHART_TYPE_BAR && len(yDataList) > 0 {
+		chartInfo.Unit = yDataList[0].Unit
+		chartInfo.UnitEn = yDataList[0].UnitEn
+	}
+
 	//图表操作权限
 	chartInfo.IsEdit = data.CheckOpChartPermission(sysUser, chartInfo.SysUserId)
 	chartInfo.Button = data_manage.ChartViewButton{
@@ -814,6 +820,12 @@ func (this *ChartInfoController) ChartInfoDetail() {
 			}
 		}
 	}
+	
+	// 单位
+	if chartType == utils.CHART_TYPE_BAR && len(yDataList) > 0 {
+		chartInfo.Unit = yDataList[0].Unit
+		chartInfo.UnitEn = yDataList[0].UnitEn
+	}
 
 	//图表操作权限
 	chartInfo.IsEdit = data.CheckOpChartPermission(sysUser, chartInfo.SysUserId)

Diff do ficheiro suprimidas por serem muito extensas
+ 1228 - 0
controllers/data_manage/line_equation/line_chart_info.go


+ 99 - 3
controllers/english_report/report.go

@@ -313,10 +313,12 @@ func (this *EnglishReportController) Detail() {
 	br.Data = item
 }
 
+// ListReport
 // @Title 获取报告列表接口
 // @Description 获取报告列表
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   TimeType     query string true  "筛选的时间类别:publish_time(发布时间),modify_time(更新时间)"
 // @Param   StartDate   query   string  true       "开始时间"
 // @Param   EndDate   query   string  true       "结束时间"
 // @Param   Frequency   query   string  true       "频度"
@@ -345,6 +347,7 @@ func (this *EnglishReportController) ListReport() {
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
 
+	timeType := this.GetString("TimeType")
 	startDate := this.GetString("StartDate")
 	endDate := this.GetString("EndDate")
 	frequency := this.GetString("Frequency")
@@ -371,12 +374,21 @@ func (this *EnglishReportController) ListReport() {
 	if keyWord != "" {
 		condition += ` AND (title LIKE '%` + keyWord + `%' OR author LIKE '%` + keyWord + `%' ) `
 	}
+	if timeType == "" {
+		timeType = "publish_time"
+	}
+	if timeType != "publish_time" && timeType != "modify_time" {
+		br.Msg = "请选择正确的时间"
+		br.ErrMsg = "请选择正确的时间"
+		return
+	}
+
 	if startDate != "" {
-		condition += ` AND create_time >= ? `
+		condition += ` AND ` + timeType + ` >= ? `
 		pars = append(pars, startDate)
 	}
 	if endDate != "" {
-		condition += ` AND create_time <= ? `
+		condition += ` AND ` + timeType + ` <= ? `
 		pars = append(pars, endDate)
 	}
 	if frequency != "" {
@@ -746,7 +758,14 @@ func (this *EnglishReportController) PublishReport() {
 			br.ErrMsg = "报告内容为空,不需要生成,report_id:" + strconv.Itoa(report.Id)
 			return
 		}
-		if tmpErr = models.PublishEnglishReportById(report.Id); tmpErr != nil {
+		var publishTime string
+		if report.PublishTime != "" {
+			// 发布时间固定为首次发布时间
+			publishTime = report.PublishTime
+		} else {
+			publishTime = time.Now().Format(utils.FormatDateTime)
+		}
+		if tmpErr = models.PublishEnglishReportById(report.Id, publishTime); tmpErr != nil {
 			br.Msg = "报告发布失败"
 			br.ErrMsg = "报告发布失败, Err:" + tmpErr.Error() + ", report_id:" + strconv.Itoa(report.Id)
 			return
@@ -761,6 +780,83 @@ func (this *EnglishReportController) PublishReport() {
 	br.Msg = "发布成功"
 }
 
+// PrePublishReport
+// @Title 设置定时发布接口
+// @Description 设置定时发布接口
+// @Param	request	body models.PrePublishReq true "type json string"
+// @Success 200 Ret=200 发布成功
+// @router /pre_publish [post]
+func (this *EnglishReportController) PrePublishReport() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req models.PrePublishReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	reportId := req.ReportId
+	if reportId == 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误,报告id不可为空"
+		return
+	}
+	if req.PrePublishTime == "" {
+		br.Msg = "发布时间不能为空"
+		return
+	}
+	prePublishTime, err := time.ParseInLocation(utils.FormatDateTime, req.PrePublishTime, time.Local)
+	if err != nil {
+		br.Msg = "发布时间格式错误"
+		br.ErrMsg = "发布时间格式错误,Err:" + err.Error()
+		return
+	}
+	if prePublishTime.Before(time.Now()) {
+		br.Msg = "发布时间不允许选择过去时间"
+		return
+	}
+	if prePublishTime.Before(time.Now().Add(2 * time.Minute)) {
+		br.Msg = "发布时间距离当前时间太近了"
+		return
+	}
+	report, err := models.GetEnglishReportById(reportId)
+	if err != nil {
+		br.Msg = "获取报告信息失败"
+		br.ErrMsg = "获取报告信息失败,Err:" + err.Error()
+		return
+	}
+	if report == nil {
+		br.Msg = "报告不存在"
+		return
+	}
+
+	if report.Content == "" {
+		br.Msg = "报告内容为空,不可发布"
+		br.ErrMsg = "报告内容为空,不需要生成,report_id:" + strconv.Itoa(report.Id)
+		return
+	}
+
+	if report.State == 2 {
+		br.Msg = "报告已发布,不可设置定时发布"
+		return
+	}
+
+	var tmpErr error
+	if tmpErr = models.SetPrePublishEnglishReportById(report.Id, req.PrePublishTime); tmpErr != nil {
+		br.Msg = "设置定时发布失败"
+		br.ErrMsg = "设置定时发布失败, Err:" + tmpErr.Error() + ", report_id:" + strconv.Itoa(report.Id)
+		return
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "定时发布成功"
+}
+
 // @Title 取消发布报告接口
 // @Description 取消发布报告
 // @Param	request	body models.PublishCancelReq true "type json string"

+ 99 - 2
controllers/report.go

@@ -31,6 +31,7 @@ type ReportUploadCommonController struct {
 // @Description 获取报告列表
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   TimeType     query string true  "筛选的时间类别:publish_time(发布时间),modify_time(更新时间)"
 // @Param   StartDate   query   string  true       "开始时间"
 // @Param   EndDate   query   string  true       "结束时间"
 // @Param   Frequency   query   string  true       "频度"
@@ -51,6 +52,7 @@ func (this *ReportController) ListReport() {
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
 
+	timeType := this.GetString("TimeType")
 	startDate := this.GetString("StartDate")
 	endDate := this.GetString("EndDate")
 	frequency := this.GetString("Frequency")
@@ -70,6 +72,15 @@ func (this *ReportController) ListReport() {
 	}
 	startSize = utils.StartIndex(currentIndex, pageSize)
 
+	if timeType == "" {
+		timeType = "publish_time"
+	}
+	if timeType != "publish_time" && timeType != "modify_time" {
+		br.Msg = "请选择正确的时间"
+		br.ErrMsg = "请选择正确的时间"
+		return
+	}
+
 	var condition string
 	var pars []interface{}
 
@@ -77,11 +88,11 @@ func (this *ReportController) ListReport() {
 		condition += ` AND (title LIKE '%` + keyWord + `%' OR author LIKE '%` + keyWord + `%' ) `
 	}
 	if startDate != "" {
-		condition += ` AND create_time >= ? `
+		condition += ` AND ` + timeType + ` >= ? `
 		pars = append(pars, startDate)
 	}
 	if endDate != "" {
-		condition += ` AND create_time <= ? `
+		condition += ` AND ` + timeType + ` <= ? `
 		pars = append(pars, endDate)
 	}
 	if frequency != "" {
@@ -2395,3 +2406,89 @@ func (this *ReportController) CheckDayWeekReportChapterVideo() {
 	br.Msg = "保存成功"
 	br.Data = typeNameArr
 }
+
+// PrePublishReport
+// @Title 设置定时发布接口
+// @Description 设置定时发布接口
+// @Param	request	body models.PrePublishReq true "type json string"
+// @Success 200 Ret=200 发布成功
+// @router /pre_publish [post]
+func (this *ReportController) PrePublishReport() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req models.PrePublishReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	reportId := req.ReportId
+	if reportId == 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误,报告id不可为空"
+		return
+	}
+	if req.PrePublishTime == "" {
+		br.Msg = "发布时间不能为空"
+		return
+	}
+
+	if req.PreMsgSend != 0 && req.PreMsgSend != 1 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "是否发送模版消息标识错误"
+		return
+	}
+	prePublishTime, err := time.ParseInLocation(utils.FormatDateTime, req.PrePublishTime, time.Local)
+	if err != nil {
+		br.Msg = "发布时间格式错误"
+		br.ErrMsg = "发布时间格式错误,Err:" + err.Error()
+		return
+	}
+	if prePublishTime.Before(time.Now()) {
+		br.Msg = "发布时间不允许选择过去时间"
+		return
+	}
+	if prePublishTime.Before(time.Now().Add(2 * time.Minute)) {
+		br.Msg = "发布时间距离当前时间太近了"
+		return
+	}
+	report, err := models.GetReportById(reportId)
+	if err != nil {
+		br.Msg = "获取报告信息失败"
+		br.ErrMsg = "获取报告信息失败,Err:" + err.Error()
+		return
+	}
+	if report == nil {
+		br.Msg = "报告不存在"
+		return
+	}
+	if report.HasChapter == 1 && (report.ChapterType == utils.REPORT_TYPE_DAY || report.ChapterType == utils.REPORT_TYPE_WEEK) {
+		br.Msg = "晨报周报不支持定时发布"
+		return
+	}
+	if report.Content == "" {
+		br.Msg = "报告内容为空,不可发布"
+		br.ErrMsg = "报告内容为空,不需要生成,report_id:" + strconv.Itoa(report.Id)
+		return
+	}
+
+	if report.State == 2 {
+		br.Msg = "报告已发布,不可设置定时发布"
+		return
+	}
+
+	var tmpErr error
+	if tmpErr = models.SetPrePublishReportById(report.Id, req.PrePublishTime, req.PreMsgSend); tmpErr != nil {
+		br.Msg = "设置定时发布失败"
+		br.ErrMsg = "设置定时发布失败, Err:" + tmpErr.Error() + ", report_id:" + strconv.Itoa(report.Id)
+		return
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "定时发布成功"
+}

+ 93 - 0
controllers/semantic_analysis/sa_compare.go

@@ -0,0 +1,93 @@
+package semantic_analysis
+
+import (
+	"fmt"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"eta/eta_mobile/controllers"
+	"eta/eta_mobile/models"
+	saModel "eta/eta_mobile/models/semantic_analysis"
+	"eta/eta_mobile/utils"
+)
+
+// SaCompareController 语义分析-文档比对
+type SaCompareController struct {
+	controllers.BaseAuthController
+}
+
+// Search
+// @Title 文档对比搜索(从es获取)
+// @Description  图表模糊搜索(从es获取)
+// @Param   Keyword   query   string  true       "文档对比标题"
+// @Success 200 {object} saModel.CompareListByEsResp
+// @router /compare/search [get]
+func (this *SaCompareController) Search() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = paging.StartIndex(currentIndex, pageSize)
+
+	keyword := this.GetString("Keyword")
+
+	var searchList []*saModel.SaCompareElastic
+	var total int
+	var err error
+
+	var list []*saModel.SaCompare
+	saCompare := new(saModel.SaCompare)
+	existCond := fmt.Sprintf(` AND result_img != ""`)
+	existPars := make([]interface{}, 0)
+	if keyword != "" {
+		existCond += ` AND  ( title LIKE ? )`
+		existPars = append(existPars, `%`+keyword+`%`)
+	}
+	total, list, err = saCompare.GetPageItemsByCondition(startSize, pageSize, existCond, existPars, []string{}, "")
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
+		return
+	}
+
+	for _, v := range list {
+		tmp := new(saModel.SaCompareElastic)
+		tmp.SaCompareId = v.SaCompareId
+		tmp.ResultImg = v.ResultImg
+		tmp.CreateTime = v.CreateTime.Format(utils.FormatDateTime)
+		tmp.ModifyTime = v.ModifyTime.Format(utils.FormatDateTime)
+		tmp.SysAdminId = v.SysAdminId
+		tmp.SysAdminName = v.SysAdminName
+		tmp.ClassifyId = v.ClassifyId
+		tmp.ClassifyName = v.ClassifyName
+		tmp.Title = v.Title
+		searchList = append(searchList, tmp)
+	}
+
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp := saModel.CompareListByEsResp{
+		Paging: page,
+		List:   searchList,
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 6 - 0
models/data_manage/chart_info.go

@@ -449,6 +449,7 @@ type ChartEdbInfoMapping struct {
 	ChartType           int     `description:"生成样式:1:曲线图,2:季节性图,3:面积图,4:柱状图,5:散点图,6:组合图,7:柱方图,8:商品价格曲线图,9:相关性图"`
 	LatestDate          string  `description:"数据最新日期"`
 	LatestValue         float64 `description:"数据最新值"`
+	MoveLatestDate      string  `description:"移动后的数据最新日期"`
 	UniqueCode          string  `description:"指标唯一编码"`
 	MinValue            float64 `json:"-" description:"最小值"`
 	MaxValue            float64 `json:"-" description:"最大值"`
@@ -505,6 +506,8 @@ type YData struct {
 	EnNameList     []string        `description:"每个值对应的英文名称"`
 	EdbValMap      map[int]float64 `description:"指标与值的对应" json:"-"`
 	M              []int           `description:"对应开始日期的间隔值" json:"-"`
+	Unit           string          `description:"中文单位名称"`
+	UnitEn         string          `description:"英文单位名称"`
 }
 
 func ModifyChartInfoAndMapping(edbInfoIdStr string, req *SaveChartInfoReq, chartType int) (err error) {
@@ -1232,6 +1235,7 @@ type ChartInfoView struct {
 	ChartName         string `description:"来源名称"`
 	ChartNameEn       string `description:"英文图表名称"`
 	UnitEn            string `description:"英文单位名称"`
+	Unit              string `description:"图表单位"`
 	ChartClassifyId   int    `description:"图表分类id"`
 	ChartClassifyName string `description:"图表名称"`
 	SysUserId         int
@@ -1404,6 +1408,8 @@ type BarChartInfoReq struct {
 	Sort          BarChartInfoSortReq      `description:"排序"`
 	XEdbList      []BarChartInfoEdbItemReq `description:"X轴选择的指标列表"`
 	YEdbList      []BarChartInfoEdbItemReq `description:"Y轴选择的指标列表"`
+	Unit          string                   `description:"中文单位名称"`
+	UnitEn        string                   `description:"英文单位名称"`
 }
 
 // BarChartInfoEdbItemReq 柱方图预览请求数据(指标相关)

+ 17 - 0
models/db.go

@@ -4,6 +4,7 @@ import (
 	"eta/eta_mobile/models/data_manage"
 	"eta/eta_mobile/models/ppt_english"
 	"eta/eta_mobile/models/sandbox"
+	saModel "eta/eta_mobile/models/semantic_analysis"
 	"eta/eta_mobile/models/system"
 	"eta/eta_mobile/utils"
 	_ "github.com/go-sql-driver/mysql"
@@ -42,6 +43,13 @@ func init() {
 	data_db, _ := orm.GetDB("data")
 	data_db.SetConnMaxLifetime(10 * time.Minute)
 
+	_ = orm.RegisterDataBase("eta", "mysql", utils.MYSQL_URL_ETA)
+	orm.SetMaxIdleConns("eta", 50)
+	orm.SetMaxOpenConns("eta", 100)
+
+	etaDb, _ := orm.GetDB("eta")
+	etaDb.SetConnMaxLifetime(10 * time.Minute)
+
 	orm.Debug = true
 	orm.DebugLog = orm.NewLog(utils.Binlog)
 
@@ -80,6 +88,9 @@ func init() {
 
 	// 沙盘推演
 	initSandbox()
+
+	// 文档对比
+	initSaCompare()
 }
 
 // initSystem 系统表 数据表
@@ -177,3 +188,9 @@ func initSandbox() {
 		new(sandbox.Sandbox), //沙盘主表
 	)
 }
+
+func initSaCompare() {
+	orm.RegisterModel(
+		new(saModel.SaCompare), //文档对比
+	)
+}

+ 14 - 4
models/english_report.go

@@ -24,6 +24,7 @@ type EnglishReport struct {
 	ModifyTime         time.Time `description:"修改时间"`
 	State              int       `description:"1:未发布,2:已发布"`
 	PublishTime        time.Time `description:"发布时间"`
+	PrePublishTime     time.Time `description:"预发布时间"`
 	Stage              int       `description:"期数"`
 	Content            string    `description:"内容"`
 	VideoUrl           string    `description:"音频文件URL"`
@@ -240,6 +241,7 @@ type EnglishReportList struct {
 	ModifyTime         time.Time `description:"修改时间"`
 	State              int       `description:"1:未发布,2:已发布"`
 	PublishTime        string    `description:"发布时间"`
+	PrePublishTime     string    `description:"预发布时间"`
 	Stage              int       `description:"期数"`
 	Content            string    `description:"内容"`
 	VideoUrl           string    `description:"音频文件URL"`
@@ -315,21 +317,29 @@ func GetEnglishReportByCondition(condition string, pars []interface{}) (items []
 }
 
 // 发布报告
-func PublishEnglishReportById(reportId int) (err error) {
+func PublishEnglishReportById(reportId int, publishTime string) (err error) {
 	o := orm.NewOrmUsingDB("rddp")
-	sql := `UPDATE english_report SET state=2,publish_time=now(),modify_time=NOW() WHERE id = ? `
-	_, err = o.Raw(sql, reportId).Exec()
+	sql := `UPDATE english_report SET state=2,publish_time=?,pre_publish_time=null,modify_time=NOW() WHERE id = ? `
+	_, err = o.Raw(sql, publishTime, reportId).Exec()
 	return
 }
 
 // 取消发布报告
 func PublishCancelEnglishReport(reportIds int) (err error) {
 	o := orm.NewOrmUsingDB("rddp")
-	sql := ` UPDATE english_report SET state=1,publish_time=null WHERE id =?  `
+	sql := ` UPDATE english_report SET state=1,pre_publish_time=null WHERE id =?  `
 	_, err = o.Raw(sql, reportIds).Exec()
 	return
 }
 
+// SetPrePublishEnglishReportById 设置定时发布
+func SetPrePublishEnglishReportById(reportId int, prePublishTime string) (err error) {
+	o := orm.NewOrmUsingDB("rddp")
+	sql := `UPDATE english_report SET pre_publish_time=? WHERE id = ? and state = 1 `
+	_, err = o.Raw(sql, prePublishTime, reportId).Exec()
+	return
+}
+
 // DeleteEnglishReportAndChapter 删除报告及章节
 func DeleteEnglishReportAndChapter(reportInfo *EnglishReportDetail) (err error) {
 	reportId := reportInfo.Id

+ 18 - 3
models/report.go

@@ -56,6 +56,7 @@ type ReportList struct {
 	ModifyTime         time.Time                 `description:"修改时间"`
 	State              int                       `description:"1:未发布,2:已发布"`
 	PublishTime        string                    `description:"发布时间"`
+	PrePublishTime     string                    `description:"预发布时间"`
 	Stage              int                       `description:"期数"`
 	MsgIsSend          int                       `description:"模板消息是否已发送,0:否,1:是"`
 	Content            string                    `description:"内容"`
@@ -138,9 +139,9 @@ func PublishCancleReport(reportIds int, publishTimeNullFlag bool) (err error) {
 	o := orm.NewOrmUsingDB("rddp")
 	var sql string
 	if publishTimeNullFlag {
-		sql = ` UPDATE report SET state=1, publish_time=null WHERE id =?`
+		sql = ` UPDATE report SET state=1, publish_time=null, pre_publish_time=null, pre_msg_send=0 WHERE id =?`
 	} else {
-		sql = ` UPDATE report SET state=1 WHERE id =?`
+		sql = ` UPDATE report SET state=1, pre_publish_time=null, pre_msg_send=0 WHERE id =?`
 	}
 	_, err = o.Raw(sql, reportIds).Exec()
 	return
@@ -257,6 +258,12 @@ type AddReq struct {
 	ReportVersion      int    `description:"1:旧版,2:新版"`
 }
 
+type PrePublishReq struct {
+	ReportId       int    `description:"报告id"`
+	PrePublishTime string `description:"预发布时间"`
+	PreMsgSend     int    `description:"定时发布成功后是否立即推送模版消息:0否,1是"`
+}
+
 type AddResp struct {
 	ReportId   int64  `description:"报告id"`
 	ReportCode string `description:"报告code"`
@@ -641,7 +648,7 @@ SELECT DISTINCT report_id FROM report_chapter WHERE publish_state = 2 AND (video
 // 发布报告
 func PublishReportById(reportId int, publishTime time.Time) (err error) {
 	o := orm.NewOrmUsingDB("rddp")
-	sql := `UPDATE report SET state = 2, publish_time = ?, modify_time = NOW() WHERE id = ? `
+	sql := `UPDATE report SET state = 2, publish_time = ?, pre_publish_time=null, pre_msg_send=0, modify_time = NOW() WHERE id = ? `
 	_, err = o.Raw(sql, publishTime, reportId).Exec()
 	return
 }
@@ -1006,3 +1013,11 @@ func ModifyReportMsgIsSendV2(reportId int) (err error) {
 	_, err = o.Raw(sql, reportId).Exec()
 	return
 }
+
+// SetPrePublishReportById 设置定时发布
+func SetPrePublishReportById(reportId int, prePublishTime string, preMsgSend int) (err error) {
+	o := orm.NewOrmUsingDB("rddp")
+	sql := `UPDATE report SET pre_publish_time=?, pre_msg_send=? WHERE id = ? and state = 1 `
+	_, err = o.Raw(sql, prePublishTime, preMsgSend, reportId).Exec()
+	return
+}

+ 160 - 0
models/semantic_analysis/sa_compare.go

@@ -0,0 +1,160 @@
+package semantic_analysis
+
+import (
+	"fmt"
+	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"strings"
+	"time"
+)
+
+type SaCompare struct {
+	SaCompareId  int       `orm:"column(sa_compare_id);pk" description:"比对ID"`
+	ClassifyId   int       `description:"比对分类ID"`
+	ClassifyName string    `description:"比对分类名称"`
+	Title        string    `description:"标题"`
+	ResultImg    string    `description:"比对结果图片"`
+	SysAdminId   int       `description:"创建人ID"`
+	SysAdminName string    `description:"创建人姓名"`
+	Sort         int       `description:"排序"`
+	CreateTime   time.Time `description:"创建时间"`
+	ModifyTime   time.Time `description:"修改时间"`
+}
+
+var SaCompareColumns = struct {
+	SaCompareId  string
+	ClassifyId   string
+	ClassifyName string
+	Title        string
+	ResultImg    string
+	SysAdminId   string
+	SysAdminName string
+	Sort         string
+	CreateTime   string
+	ModifyTime   string
+}{
+	SaCompareId:  "sa_compare_id",
+	ClassifyId:   "classify_id",
+	ClassifyName: "classify_name",
+	Title:        "title",
+	ResultImg:    "result_img",
+	SysAdminId:   "sys_admin_id",
+	SysAdminName: "sys_admin_name",
+	Sort:         "sort",
+	CreateTime:   "create_time",
+	ModifyTime:   "modify_time",
+}
+
+func (m *SaCompare) TableName() string {
+	return "sa_compare"
+}
+
+func (m *SaCompare) Create() (err error) {
+	o := orm.NewOrmUsingDB("eta")
+	id, err := o.Insert(m)
+	if err != nil {
+		return
+	}
+	m.SaCompareId = int(id)
+	return
+}
+
+func (m *SaCompare) Update(cols []string) (err error) {
+	o := orm.NewOrmUsingDB("eta")
+	_, err = o.Update(m, cols...)
+	return
+}
+
+func (m *SaCompare) Del() (err error) {
+	o := orm.NewOrmUsingDB("eta")
+	sql := `DELETE FROM sa_compare WHERE sa_compare_id = ? LIMIT 1`
+	_, err = o.Raw(sql, m.SaCompareId).Exec()
+	return
+}
+
+func (m *SaCompare) GetItemById(id int) (err error) {
+	o := orm.NewOrmUsingDB("eta")
+	sql := `SELECT * FROM sa_compare WHERE sa_compare_id = ? LIMIT 1`
+	err = o.Raw(sql, id).QueryRow(&m)
+	return
+}
+
+func (m *SaCompare) GetItemByCondition(condition string, pars []interface{}) (err error) {
+	o := orm.NewOrmUsingDB("eta")
+	sql := `SELECT * FROM sa_compare WHERE 1=1 `
+	sql += condition
+	sql += ` LIMIT 1`
+	err = o.Raw(sql, pars).QueryRow(&m)
+	return
+}
+
+func (m *SaCompare) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
+	o := orm.NewOrmUsingDB("eta")
+	sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
+	err = o.Raw(sql, pars).QueryRow(&count)
+	return
+}
+
+func (m *SaCompare) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*SaCompare, err error) {
+	o := orm.NewOrmUsingDB("eta")
+	fields := strings.Join(fieldArr, ",")
+	if len(fieldArr) == 0 {
+		fields = `*`
+	}
+	order := `ORDER BY create_time DESC`
+	if orderRule != "" {
+		order = ` ORDER BY ` + orderRule
+	}
+	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}
+
+func (m *SaCompare) GetPageItemsByCondition(startSize, pageSize int, condition string, pars []interface{}, fieldArr []string, orderRule string) (total int, items []*SaCompare, err error) {
+	o := orm.NewOrmUsingDB("eta")
+	fields := strings.Join(fieldArr, ",")
+	if len(fieldArr) == 0 {
+		fields = `*`
+	}
+	order := `ORDER BY create_time DESC`
+	if orderRule != "" {
+		order = ` ORDER BY ` + orderRule
+	}
+	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
+	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z`
+	if err = o.Raw(totalSql, pars).QueryRow(&total); err != nil {
+		return
+	}
+	sql += ` LIMIT ?,?`
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+type SaCompareItem struct {
+	SaCompareId  int    `description:"比对ID"`
+	ClassifyId   int    `description:"比对分类ID"`
+	ClassifyName string `description:"比对分类名称"`
+	Title        string `description:"标题"`
+	ResultImg    string `description:"比对结果图片"`
+	SysAdminId   int    `description:"创建人ID"`
+	SysAdminName string `description:"创建人姓名"`
+	CreateTime   string `description:"创建时间"`
+}
+
+type SaCompareElastic struct {
+	SaCompareId  int    `description:"比对ID"`
+	ClassifyId   int    `description:"比对分类ID"`
+	ClassifyName string `description:"比对分类名称"`
+	Title        string `description:"标题"`
+	ResultImg    string `description:"比对结果图片"`
+	SysAdminId   int    `description:"创建人ID"`
+	SysAdminName string `description:"创建人姓名"`
+	CreateTime   string `description:"创建时间"`
+	ModifyTime   string `description:"修改时间"`
+}
+
+// CompareListByEsResp 文档对比Es搜索返回
+type CompareListByEsResp struct {
+	Paging *paging.PagingItem
+	List   []*SaCompareElastic
+}

+ 27 - 0
routers/commentsRouter.go

@@ -664,6 +664,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_mobile/controllers/english_report:EnglishReportController"] = append(beego.GlobalControllerRouter["eta/eta_mobile/controllers/english_report:EnglishReportController"],
+        beego.ControllerComments{
+            Method: "PrePublishReport",
+            Router: `/pre_publish`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_mobile/controllers/english_report:EnglishReportController"] = append(beego.GlobalControllerRouter["eta/eta_mobile/controllers/english_report:EnglishReportController"],
         beego.ControllerComments{
             Method: "PublishReport",
@@ -736,6 +745,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_mobile/controllers/semantic_analysis:SaCompareController"] = append(beego.GlobalControllerRouter["eta/eta_mobile/controllers/semantic_analysis:SaCompareController"],
+        beego.ControllerComments{
+            Method: "Search",
+            Router: `/compare/search`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_mobile/controllers:ClassifyController"] = append(beego.GlobalControllerRouter["eta/eta_mobile/controllers:ClassifyController"],
         beego.ControllerComments{
             Method: "ListClassify",
@@ -1537,6 +1555,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_mobile/controllers:ReportController"] = append(beego.GlobalControllerRouter["eta/eta_mobile/controllers:ReportController"],
+        beego.ControllerComments{
+            Method: "PrePublishReport",
+            Router: `/pre_publish`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_mobile/controllers:ReportController"] = append(beego.GlobalControllerRouter["eta/eta_mobile/controllers:ReportController"],
         beego.ControllerComments{
             Method: "PublishReport",

+ 6 - 0
routers/router.go

@@ -16,6 +16,7 @@ import (
 	"eta/eta_mobile/controllers/data_manage/line_feature"
 	"eta/eta_mobile/controllers/english_report"
 	"eta/eta_mobile/controllers/sandbox"
+	"eta/eta_mobile/controllers/semantic_analysis"
 
 	"github.com/beego/beego/v2/server/web"
 	"github.com/beego/beego/v2/server/web/filter/cors"
@@ -152,6 +153,11 @@ func init() {
 				&controllers.UserLoginAuthController{},
 			),
 		),
+		web.NSNamespace("/semantic_analysis",
+			web.NSInclude(
+				&semantic_analysis.SaCompareController{},
+			),
+		),
 	)
 	web.AddNamespace(ns)
 }

+ 7 - 0
services/data/chart_info.go

@@ -125,6 +125,12 @@ func GetChartEdbData(chartInfoId, chartType int, calendar, startDate, endDate st
 				}
 			}
 		}
+
+		for k := range yDataList {
+			yDataList[k].Unit = barChartConf.Unit
+			yDataList[k].UnitEn = barChartConf.UnitEn
+		}
+
 	case 10: // 截面散点图
 		sectionScatterConf := extraConfig.(data_manage.SectionScatterReq)
 		xEdbIdValue, dataResp, err = GetSectionScatterChartData(mappingList, edbDataListMap, sectionScatterConf)
@@ -202,6 +208,7 @@ func getEdbDataMapList(chartInfoId, chartType int, calendar, startDate, endDate
 		item.LatestValue = v.LatestValue
 		item.LatestDate = v.LatestDate
 		item.UniqueCode = v.UniqueCode
+		item.MoveLatestDate = v.LatestDate
 
 		var startDateReal string
 		var diffSeconds int64

+ 2 - 0
utils/config.go

@@ -17,6 +17,7 @@ var (
 	MYSQL_URL_GL          string
 	MYSQL_LOG_URL         string
 	MYSQL_URL_COMEIN_DATA string // 路演记录数据库
+	MYSQL_URL_ETA         string
 
 	REDIS_CACHE string       //缓存地址
 	Rc          *cache.Cache //redis缓存
@@ -181,6 +182,7 @@ func init() {
 	MYSQL_URL_GL = config["mysql_url_gl"]
 	MYSQL_LOG_URL = config["mysql_url_log"]
 	MYSQL_URL_COMEIN_DATA = config["mysql_url_comein_data"]
+	MYSQL_URL_ETA = config["mysql_url_eta"]
 
 	REDIS_CACHE = config["beego_cache"]
 	if len(REDIS_CACHE) <= 0 {

+ 1 - 1
utils/constants.go

@@ -150,7 +150,7 @@ const (
 	DATA_SOURCE_PREDICT_CALCULATE_LJZ                           //预测指标 - 累计值 -> 65
 	DATA_SOURCE_PREDICT_CALCULATE_LJZNCZJ                       //预测指标 - 累计值(年初至今) -> 66
 	DATA_SOURCE_CALCULATE_STANDARD_DEVIATION                    //标准差->67
-	DATA_SOURCE_CALCULATE_PERCENTILE                            //百分位->68
+	DATA_SOURCE_CALCULATE_PERCENTILE                            //百分位图表->68
 	DATA_SOURCE_PREDICT_CALCULATE_STANDARD_DEVIATION            //预测标准差->69
 	DATA_SOURCE_PREDICT_CALCULATE_PERCENTILE                    //预测百分位->70
 	DATA_SOURCE_FUBAO                                           //富宝数据->71

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff