瀏覽代碼

Merge remote-tracking branch 'origin/master' into custom

Roc 10 月之前
父節點
當前提交
3999f0bc51

+ 2 - 1
.gitignore

@@ -5,4 +5,5 @@
 /*.exe
 /conf
 *.tar.gz
-eta_report
+eta_report
+/eta_report

+ 52 - 0
controllers/base_auth.go

@@ -97,3 +97,55 @@ func (c *BaseAuthController) JSON(data interface{}, hasIndent bool, coding bool)
 	}
 	return c.Ctx.Output.Body(content)
 }
+
+
+func (c *BaseAuthController) ServeJSONNoEncryption(encoding ...bool) {
+	var (
+		hasIndent   = false
+		hasEncoding = false
+	)
+	if web.BConfig.RunMode == web.PROD {
+		hasIndent = false
+	}
+	if len(encoding) > 0 && encoding[0] == true {
+		hasEncoding = true
+	}
+	if c.Data["json"] == nil {
+		go utils.SendEmail(utils.APPNAME+" "+utils.RunMode+"异常提醒:", "接口:"+"URI:"+c.Ctx.Input.URI()+";无返回值", utils.EmailSendToUsers)
+		return
+	}
+	baseRes := c.Data["json"].(*models.BaseResponse)
+	if baseRes != nil && baseRes.Ret != 200 && baseRes.Ret != 408 && baseRes.IsSendEmail {
+		body, _ := json.Marshal(baseRes)
+		go utils.SendEmail(utils.APPNAME+" "+utils.RunMode+" 失败提醒", "URI:"+c.Ctx.Input.URI()+"<br/> ErrMsg:"+baseRes.ErrMsg+";<br/>Msg:"+baseRes.Msg+";<br/> Body:"+string(body), utils.EmailSendToUsers)
+	}
+	c.JSONNoEncryption(c.Data["json"], hasIndent, hasEncoding)
+}
+
+func (c *BaseAuthController) JSONNoEncryption(data interface{}, hasIndent bool, coding bool) error {
+	c.Ctx.Output.Header("Content-Type", "application/json; charset=utf-8")
+	//desEncrypt := utils.DesBase64Encrypt([]byte(utils.DesKey), utils.DesKeySalt)
+	//c.Ctx.Output.Header("Dk", string(desEncrypt)) // des3加解密key
+	var content []byte
+	var err error
+	if hasIndent {
+		content, err = json.MarshalIndent(data, "", "  ")
+	} else {
+		content, err = json.Marshal(data)
+	}
+	if err != nil {
+		http.Error(c.Ctx.Output.Context.ResponseWriter, err.Error(), http.StatusInternalServerError)
+		return err
+	}
+	if coding {
+		content = []byte(utils.StringsToJSON(string(content)))
+	}
+
+	//// 数据加密
+	//if services.CheckEncryption() {
+	//	content = utils.DesBase64Encrypt(content, utils.DesKey)
+	//	// get请求时,不加双引号就获取不到数据,不知道什么原因,所以还是在前后加上双引号吧
+	//	content = []byte(`"` + string(content) + `"`)
+	//}
+	return c.Ctx.Output.Body(content)
+}

+ 85 - 0
controllers/chart.go

@@ -0,0 +1,85 @@
+package controllers
+
+import (
+	"encoding/json"
+	"eta/eta_report/models"
+	"eta/eta_report/services"
+	"eta/eta_report/utils"
+	"fmt"
+	"io/ioutil"
+	"net/http"
+)
+
+// ChartController 图表详情
+type ChartController struct {
+	BaseAuthController
+}
+
+
+// ExcelDetail
+// @Title 表格详情
+// @Description 表格详情
+// @Success 200 {object} models.EnglishReportShareDetailResp
+// @router /detail [post]
+func (this *ChartController) ChartDetail()  {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		if br.ErrMsg == "" {
+			br.IsSendEmail = false
+		}
+		this.Data["json"] = br
+		this.ServeJSONNoEncryption()
+	}()
+
+	var req services.ChartDetailReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	if req.UniqueCode == "" {
+		br.Msg = "参数不能为空!"
+		br.ErrMsg = "参数不能为空!"
+		return
+	}
+	url := utils.ChartLibUrl+`/chart/common/detail?UniqueCode=%s`
+	url = fmt.Sprintf(url, req.UniqueCode)
+
+	resp, e := http.Get(url)
+	if e != nil {
+		err = fmt.Errorf("http Get err: %s", e.Error())
+		br.ErrMsg = err.Error()
+		return
+	}
+	defer resp.Body.Close()
+
+	b, e := ioutil.ReadAll(resp.Body)
+	if e != nil {
+		err = fmt.Errorf("resp body read err: %s", e.Error())
+		br.ErrMsg = err.Error()
+		return
+	}
+	if len(b) == 0 {
+		err = fmt.Errorf("resp body is empty")
+		br.ErrMsg = err.Error()
+		return
+	}
+
+	result := new(models.BaseResponse)
+	if e = json.Unmarshal(b, &result); e != nil {
+		err = fmt.Errorf("result unmarshal err: %s\nresult: %s", e.Error(), string(b))
+		br.ErrMsg = err.Error()
+		return
+	}
+	if result.Ret != 200 {
+		err = fmt.Errorf("result: %s", string(b))
+		br.ErrMsg = err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = result.Data
+	return
+}

+ 78 - 0
controllers/excel.go

@@ -0,0 +1,78 @@
+package controllers
+
+import (
+	"encoding/json"
+	"eta/eta_report/models"
+	"eta/eta_report/services"
+	"eta/eta_report/utils"
+	"fmt"
+	"io/ioutil"
+	"net/http"
+)
+
+// ExcelController 表格详情
+type ExcelController struct {
+	BaseAuthController
+}
+
+// ExcelDetail
+// @Title 表格详情
+// @Description 表格详情
+// @Success 200 {object} models.EnglishReportShareDetailResp
+// @router /detail [post]
+func (this *ExcelController) ExcelDetail()  {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		if br.ErrMsg == "" {
+			br.IsSendEmail = false
+		}
+		this.Data["json"] = br
+		this.ServeJSONNoEncryption()
+	}()
+
+	var req services.ExcelDetailReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	url := fmt.Sprintf(utils.ChartLibUrl+`/excel_info/detail?UniqueCode=%s&FromScene=%s`, req.UniqueCode,req.FromScene )
+
+	resp, e := http.Get(url)
+	if e != nil {
+		err = fmt.Errorf("http Get err: %s", e.Error())
+		br.ErrMsg = err.Error()
+		return
+	}
+	defer resp.Body.Close()
+
+	b, e := ioutil.ReadAll(resp.Body)
+	if e != nil {
+		err = fmt.Errorf("resp body read err: %s", e.Error())
+		br.ErrMsg = err.Error()
+		return
+	}
+	if len(b) == 0 {
+		err = fmt.Errorf("resp body is empty")
+		br.ErrMsg = err.Error()
+		return
+	}
+
+	result := new(models.BaseResponse)
+	if e = json.Unmarshal(b, &result); e != nil {
+		err = fmt.Errorf("result unmarshal err: %s\nresult: %s", e.Error(), string(b))
+		br.ErrMsg = err.Error()
+		return
+	}
+	if result.Ret != 200 {
+		err = fmt.Errorf("result: %s", string(b))
+		br.ErrMsg = err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = result.Data
+	return
+}

+ 20 - 0
controllers/smart_report.go

@@ -49,7 +49,27 @@ func (this *SmartReportController) Detail() {
 		return
 	}
 	resp.Report = models.FormatSmartReport2Item(item)
+	if resp.Report.HeadResourceId > 0 {
+		headResource, err := models.GetResourceItemById(resp.Report.HeadResourceId)
+		if err != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "获取资源库版头失败, Err: " + e.Error()
+			return
+		}
+		resp.Report.HeadImg = headResource.ImgUrl
+		resp.Report.HeadStyle = headResource.Style
+	}
 
+	if resp.Report.EndResourceId > 0 {
+		endResource, err := models.GetResourceItemById(resp.Report.EndResourceId)
+		if err != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "获取资源库版头失败, Err: " + e.Error()
+			return
+		}
+		resp.Report.EndImg = endResource.ImgUrl
+		resp.Report.EndStyle = endResource.Style
+	}
 	// 免责声明
 	conf, e := models.GetBusinessConf()
 	if e != nil {

二進制
eta_report


+ 31 - 0
models/response/excel_info.go

@@ -0,0 +1,31 @@
+package response
+
+import (
+	"eta/eta_report/services/excel"
+)
+
+// ExcelTableDetailResp  excel表格详情
+type ExcelTableDetailResp struct {
+	//ChartInfo   *ChartInfo
+	UniqueCode string `description:"表格唯一code"`
+	Source     int    `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
+	ExcelType  int    `description:"表格类型,1:指标列,2:日期列,默认:1"`
+	ExcelImage string `description:"表格截图"`
+	ExcelName  string `description:"表格名称"`
+	TableInfo  excel.TableData
+	Config     ExcelTableDetailConfigResp
+}
+
+// ExcelTableDetailConfigResp
+// @Description: Excel表格的配置信息
+type ExcelTableDetailConfigResp struct {
+	FontSize int
+}
+
+// TableCellResp 单元格
+type TableCellResp struct {
+	DataType  int    `description:"数据类型,1:普通的,2:插值法,3:手动输入,4:公式计算"`
+	DataTime  string `description:"所属日期"`
+	ShowValue string `description:"展示的值"`
+	Value     string `description:"实际值(计算公式)"`
+}

+ 29 - 0
models/smart_report.go

@@ -49,6 +49,11 @@ type SmartReport struct {
 	HeadImg             string    `description:"报告头图地址"`
 	EndImg              string    `description:"报告尾图地址"`
 	CanvasColor         string    `description:"画布颜色"`
+	NeedSplice          int     `description:"0-不需要 1-需要"`
+	HeadResourceId      int     `description:"版头资源ID"`
+	EndResourceId       int     `description:"版尾资源ID"`
+	HeadStyle           string  `description:"版头样式"`
+	EndStyle            string  `description:"版尾样式"`
 }
 
 func (m *SmartReport) TableName() string {
@@ -127,6 +132,11 @@ type SmartReportItem struct {
 	HeadImg            string  `description:"报告头图地址"`
 	EndImg             string  `description:"报告尾图地址"`
 	CanvasColor        string  `description:"画布颜色"`
+	NeedSplice          int     `description:"0-不需要 1-需要"`
+	HeadResourceId      int     `description:"版头资源ID"`
+	EndResourceId       int     `description:"版尾资源ID"`
+	HeadStyle           string  `description:"版头样式"`
+	EndStyle            string  `description:"版尾样式"`
 }
 
 // FormatSmartReport2Item 格式化智能研报数据格式
@@ -169,6 +179,9 @@ func FormatSmartReport2Item(origin *SmartReport) (item *SmartReportItem) {
 	item.CanvasColor = origin.CanvasColor
 	item.HeadImg = origin.HeadImg
 	item.EndImg = origin.EndImg
+	item.NeedSplice = origin.NeedSplice
+	item.HeadResourceId = origin.HeadResourceId
+	item.EndResourceId = origin.EndResourceId
 	return
 }
 
@@ -188,3 +201,19 @@ func UpdateSmartReportPv(reportId int) (err error) {
 	_, err = o.Raw(sql, reportId).Exec()
 	return
 }
+
+type SmartReportResource struct {
+	ResourceId int       `orm:"column(resource_id);pk" description:"智能研报资源ID"`
+	ImgUrl     string    // 图片链接
+	Style      string    // 版图样式
+	ImgName    string    // 图片名称
+	Type       int       // 类型 1-版头 2-版尾
+	CreateTime time.Time // 创建时间
+}
+
+func GetResourceItemById(id int) (item *SmartReportResource, err error) {
+	o := orm.NewOrm()
+	sql := fmt.Sprintf(`SELECT * FROM smart_report_resource WHERE resource_id = ? LIMIT 1`)
+	err = o.Raw(sql, id).QueryRow(&item)
+	return
+}

+ 18 - 0
routers/commentsRouter.go

@@ -7,6 +7,15 @@ import (
 
 func init() {
 
+    beego.GlobalControllerRouter["eta/eta_report/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta/eta_report/controllers:ChartController"],
+        beego.ControllerComments{
+            Method: "ChartDetail",
+            Router: `/detail`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_report/controllers:EnglishReportShareController"] = append(beego.GlobalControllerRouter["eta/eta_report/controllers:EnglishReportShareController"],
         beego.ControllerComments{
             Method: "EnglishReportDetail",
@@ -25,6 +34,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_report/controllers:ExcelController"] = append(beego.GlobalControllerRouter["eta/eta_report/controllers:ExcelController"],
+        beego.ControllerComments{
+            Method: "ExcelDetail",
+            Router: `/detail`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_report/controllers:ReportShareController"] = append(beego.GlobalControllerRouter["eta/eta_report/controllers:ReportShareController"],
         beego.ControllerComments{
             Method: "Detail",

+ 10 - 0
routers/router.go

@@ -34,6 +34,16 @@ func init() {
 				&controllers.SmartReportController{},
 			),
 		),
+		web.NSNamespace("/excel",
+			web.NSInclude(
+				&controllers.ExcelController{},
+			),
+		),
+		web.NSNamespace("/chart",
+			web.NSInclude(
+				&controllers.ChartController{},
+			),
+		),
 	)
 	web.AddNamespace(ns)
 }

+ 5 - 0
services/chart.go

@@ -0,0 +1,5 @@
+package services
+
+type ChartDetailReq struct {
+	UniqueCode string //"图表唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc"
+}

+ 6 - 0
services/excel.go

@@ -0,0 +1,6 @@
+package services
+
+type ExcelDetailReq struct {
+	UniqueCode string //"表格表唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc"
+	FromScene  int    //"场景来源,1:智能研报,2:研报列表;3:英文研报;4:中文PPT;5:英文PPT"
+}

+ 342 - 0
services/excel/lucky_sheet.go

@@ -0,0 +1,342 @@
+package excel
+
+import (
+	"encoding/json"
+	"fmt"
+	"reflect"
+	"strconv"
+)
+
+type LuckySheetDataBak struct {
+	CalcChain []interface{}        `json:"calcChain" description:"公式链"`
+	CellData  []LuckySheetCellData `json:"celldata" description:"单元格数据"`
+	ChWidth   int64                `json:"ch_width" description:"工作表区域的宽度"`
+	Config    struct {
+		BorderInfo []struct {
+			BorderType string `json:"borderType" description:""`
+			Color      string `json:"color" description:""`
+			Range      []struct {
+				Column []int64 `json:"column" description:""`
+				Row    []int64 `json:"row" description:""`
+			} `json:"range" description:""`
+			RangeType string `json:"rangeType" description:""`
+			Style     string `json:"style" description:""`
+			Value     struct {
+				B struct {
+					Color string `json:"color" description:""`
+					Style string `json:"style" description:""`
+				} `json:"b" description:""`
+				ColIndex int64 `json:"col_index" description:""`
+				L        struct {
+					Color string `json:"color" description:""`
+					Style string `json:"style" description:""`
+				} `json:"l" description:""`
+				R struct {
+					Color string `json:"color" description:""`
+					Style string `json:"style" description:""`
+				} `json:"r" description:""`
+				RowIndex int64 `json:"row_index" description:""`
+				T        struct {
+					Color string `json:"color" description:""`
+					Style string `json:"style" description:""`
+				} `json:"t" description:""`
+			} `json:"value" description:"" description:""`
+		} `json:"borderInfo" description:""`
+		Colhidden    struct{}           `json:"colhidden" description:""`
+		Columnlen    map[string]float64 `json:"columnlen" description:""`
+		CustomHeight struct {
+			Zero int64 `json:"0"`
+		} `json:"customHeight" description:""`
+		CustomWidth struct {
+			Two int64 `json:"2" description:""`
+		} `json:"customWidth" description:""`
+		Merge  struct{}           `json:"merge" description:""`
+		Rowlen map[string]float64 `json:"rowlen" description:""`
+	} `json:"config" description:""`
+	Data [][]struct {
+		Ct struct {
+			Fa string `json:"fa"`
+			T  string `json:"t"`
+		} `json:"ct"`
+		M string      `json:"m"`
+		V interface{} `json:"v"`
+	} `json:"data" description:""`
+	DataVerification              struct{}      `json:"dataVerification" description:""`
+	Filter                        interface{}   `json:"filter" description:""`
+	FilterSelect                  interface{}   `json:"filter_select" description:""`
+	Hyperlink                     struct{}      `json:"hyperlink" description:""`
+	Images                        struct{}      `json:"images" description:""`
+	Index                         string        `json:"index" description:""`
+	JfgirdSelectSave              []interface{} `json:"jfgird_select_save" description:""`
+	LuckysheetAlternateformatSave []interface{} `json:"luckysheet_alternateformat_save" description:""`
+	LuckysheetConditionformatSave []interface{} `json:"luckysheet_conditionformat_save" description:""`
+	LuckysheetSelectSave          []struct {
+		Column      []int64 `json:"column" description:""`
+		ColumnFocus int64   `json:"column_focus" description:""`
+		Height      int64   `json:"height" description:""`
+		HeightMove  int64   `json:"height_move" description:""`
+		Left        int64   `json:"left" description:""`
+		LeftMove    int64   `json:"left_move" description:""`
+		Row         []int64 `json:"row" description:""`
+		RowFocus    int64   `json:"row_focus" description:""`
+		Top         int64   `json:"top" description:""`
+		TopMove     int64   `json:"top_move" description:""`
+		Width       int64   `json:"width" description:""`
+		WidthMove   int64   `json:"width_move" description:""`
+	} `json:"luckysheet_select_save" description:"" description:""`
+	LuckysheetSelectionRange []struct {
+		Column []int64 `json:"column" description:""`
+		Row    []int64 `json:"row" description:""`
+	} `json:"luckysheet_selection_range" description:""`
+	RhHeight          float64 `json:"rh_height" description:""`
+	ScrollLeft        float64 `json:"scrollLeft" description:""`
+	ScrollTop         float64 `json:"scrollTop" description:""`
+	Status            int64   `json:"status" description:""`
+	Visibledatacolumn []int64 `json:"visibledatacolumn" description:""`
+	Visibledatarow    []int64 `json:"visibledatarow" description:""`
+	ZoomRatio         float64 `json:"zoomRatio" description:"sheet缩放比例"`
+}
+
+// LuckySheetData sheet表格数据
+type LuckySheetData struct {
+	CellData []LuckySheetCellData `json:"celldata" description:"单元格数据"`
+	ChWidth  int64                `json:"ch_width" description:"工作表区域的宽度"`
+	Config   LuckySheetDataConfig `json:"config" description:""`
+	//Index             int                  `json:"index" description:"工作表索引"`
+	RhHeight          float64     `json:"rh_height" description:"工作表区域的高度"`
+	ScrollLeft        float64     `json:"scrollLeft" description:"左右滚动条位置"`
+	ScrollTop         float64     `json:"scrollTop" description:"上下滚动条位置"`
+	Status            interface{} `json:"status" description:"激活状态"`
+	VisibleDataColumn []int64     `json:"visibledatacolumn" description:"所有列的位置信息,递增的列位置数据,初始化无需设置"`
+	VisibleDataRow    []int64     `json:"visibledatarow" description:"所有行的位置信息,递增的行位置数据,初始化无需设置"`
+	ZoomRatio         float64     `json:"zoomRatio" description:"sheet缩放比例"`
+}
+
+// LuckySheetDataConfig sheet表单的配置
+type LuckySheetDataConfig struct {
+	BorderInfo []LuckySheetDataConfigBorderInfo `json:"borderInfo" description:"边框"`
+	Colhidden  map[string]int64                 `json:"colhidden" description:"隐藏列,示例值:\"colhidden\":{\"30\":0,\"31\":0}"`
+	Columnlen  map[string]float64               `json:"columnlen" description:"每个单元格的列宽"`
+	//CustomHeight struct {
+	//	Zero int64 `json:"0"`
+	//} `json:"customHeight" description:""`
+	//CustomWidth struct {
+	//	Two int64 `json:"2" description:""`
+	//} `json:"customWidth" description:""`
+	Merge  map[string]LuckySheetDataConfigMerge `json:"merge" description:"合并单元格"`
+	Rowlen map[string]float64                   `json:"rowlen" description:"每个单元格的行高"`
+}
+
+// LuckySheetDataConfigMerge 合并单元格设置
+type LuckySheetDataConfigMerge struct {
+	Row    int `json:"r" description:"行数"`
+	Column int `json:"c" description:"列数"`
+	Rs     int `json:"rs" description:"合并的行数"`
+	Cs     int `json:"cs" description:"合并的列数"`
+}
+
+// LuckySheetDataConfigBorderInfo 单元格边框信息
+type LuckySheetDataConfigBorderInfo struct {
+	BorderType string `json:"borderType" description:"边框类型 border-left | border-right | border-top | border-bottom | border-all | border-outside | border-inside | border-horizontal | border-vertical | border-none"`
+	Color      string `json:"color" description:"边框颜色 color: 16进制颜色值"`
+	Range      []struct {
+		Column []int64 `json:"column" description:"行"`
+		Row    []int64 `json:"row" description:"列"`
+	} `json:"range" description:"选区范围 range: 行列信息数组"`
+	RangeType string                                  `json:"rangeType" description:"选区 rangeType: range | cell "`
+	Style     string                                  `json:"style" description:"边框粗细 style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick ,和aspose.cells的getLineStyle()的值对应的话,需要自己做个转换,参考 aspose.cells"`
+	Value     LuckySheetDataConfigBorderInfoCellValue `json:"value" description:"" description:"范围类型分单个单元格的数据"`
+}
+
+// LuckySheetDataConfigBorderInfoCellValue 单元格边框信息(范围类型为:单个单元格)
+type LuckySheetDataConfigBorderInfoCellValue struct {
+	B        LuckySheetDataConfigBorderInfoCell `json:"b" description:"下边框"`
+	L        LuckySheetDataConfigBorderInfoCell `json:"l" description:"左边框"`
+	R        LuckySheetDataConfigBorderInfoCell `json:"r" description:"右边框"`
+	T        LuckySheetDataConfigBorderInfoCell `json:"t" description:"上边框"`
+	ColIndex int64                              `json:"col_index" description:"第几行"`
+	RowIndex int64                              `json:"row_index" description:"第几列"`
+}
+
+// LuckySheetDataConfigBorderInfoCell 单元格边框信息(cell类型)
+type LuckySheetDataConfigBorderInfoCell struct {
+	Color string      `json:"color" description:"边框颜色 color: 16进制颜色值"`
+	Style int         `description:"边框粗细 style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick ,和aspose.cells的getLineStyle()的值对应的话,需要自己做个转换,参考 aspose.cells"`
+	Sl    interface{} `json:"style" description:"边框粗细 style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick ,和aspose.cells的getLineStyle()的值对应的话,需要自己做个转换,参考 aspose.cells"`
+}
+
+// LuckySheetCellData 单个单元格数据
+type LuckySheetCellData struct {
+	Col   int64               `json:"c" description:"列"`
+	Row   int64               `json:"r" description:"行"`
+	Value LuckySheetDataValue `json:"v" description:"单元格内值的数据"`
+}
+
+// LuckySheetDataValue 单元格内值的数据
+type LuckySheetDataValue struct {
+	CellType       LuckySheetDataCellType `json:"ct" description:"单元格值格式:文本、时间等	"`
+	Value          interface{}            `json:"v" description:"原始值"`
+	Monitor        string                 `json:"m" description:"显示值"`
+	Background     string                 `json:"bg" description:"背景色,实例值:#fff000"`
+	FontFamily     int                    `description:"字体,0 Times New Roman、 1 Arial、2 Tahoma 、3 Verdana、4 微软雅黑、5 宋体(Song)、6 黑体(ST Heiti)、7 楷体(ST Kaiti)、 8 仿宋(ST FangSong)、9 新宋体(ST Song)、10 华文新魏、11 华文行楷、12 华文隶书	"`
+	FF             interface{}            `json:"ff" description:"字体,0 Times New Roman、 1 Arial、2 Tahoma 、3 Verdana、4 微软雅黑、5 宋体(Song)、6 黑体(ST Heiti)、7 楷体(ST Kaiti)、 8 仿宋(ST FangSong)、9 新宋体(ST Song)、10 华文新魏、11 华文行楷、12 华文隶书	"`
+	FontColor      string                 `json:"fc" description:"字体颜色,示例值:#fff000" `
+	Bold           int                    `json:"bl" description:"粗体,0 常规 、 1加粗	"`
+	Italic         int                    `json:"it" description:"斜体,0 常规 、 1 斜体"`
+	Fontsize       int                    `description:"字体大小,14"`
+	CancelLine     int                    ` description:"删除线,	0 常规 、 1 删除线"`
+	HorizontalType int                    `description:"水平对齐,	0 居中、1 左、2右"`
+	VerticalType   int                    ` description:"垂直对齐,	0 中间、1 上、2下"`
+	Fs             interface{}            `json:"fs" description:"字体大小,14"`
+	Cl             interface{}            `json:"cl" description:"删除线,	0 常规 、 1 删除线"`
+	Ht             interface{}            `json:"ht" description:"水平对齐,	0 居中、1 左、2右"`
+	Vt             interface{}            `json:"vt" description:"垂直对齐,	0 中间、1 上、2下"`
+	//TextRotate     string                    `json:"tr" description:"竖排文字,	3"`
+	//RotateText     string                    `json:"rt" description:"文字旋转角度,	介于0~180之间的整数,包含0和180"`
+	TextBeak  int                       `description:"文本换行,	0 截断、1溢出、2 自动换行"`
+	Tb        interface{}               `json:"tb" description:"文本换行,	0 截断、1溢出、2 自动换行"`
+	Ps        LuckySheetDataCellComment `json:"ps" description:"批注"`
+	Function  string                    `json:"f" description:"公式"`
+	MergeCell LuckySheetDataConfigMerge `json:"mc" description:"合并单元格信息"`
+}
+
+// LuckySheetDataCellType 单元格值格式:文本、时间等
+type LuckySheetDataCellType struct {
+	Fa string `json:"fa" description:"格式名称,例如:“General”为自动格式"`
+	T  string `json:"t" description:"格式类型,例如:“n”为数字类型"`
+	S  []struct {
+		FontFamily     int         `description:"字体,0 Times New Roman、 1 Arial、2 Tahoma 、3 Verdana、4 微软雅黑、5 宋体(Song)、6 黑体(ST Heiti)、7 楷体(ST Kaiti)、 8 仿宋(ST FangSong)、9 新宋体(ST Song)、10 华文新魏、11 华文行楷、12 华文隶书	"`
+		FF             interface{} `json:"ff" description:"字体,0 Times New Roman、 1 Arial、2 Tahoma 、3 Verdana、4 微软雅黑、5 宋体(Song)、6 黑体(ST Heiti)、7 楷体(ST Kaiti)、 8 仿宋(ST FangSong)、9 新宋体(ST Song)、10 华文新魏、11 华文行楷、12 华文隶书	"`
+		FontColor      string      `json:"fc" description:"字体颜色,示例值:#fff000" `
+		Fontsize       int         `description:"字体大小,14"`
+		CancelLine     int         ` description:"删除线,	0 常规 、 1 删除线"`
+		HorizontalType int         `description:"水平对齐,	0 居中、1 左、2右"`
+		VerticalType   int         `description:"垂直对齐,	0 中间、1 上、2下"`
+		Fs             interface{} `json:"fs" description:"字体大小,14"`
+		Cl             interface{} `json:"cl" description:"删除线,	0 常规 、 1 删除线"`
+		Ht             interface{} `json:"ht" description:"水平对齐,	0 居中、1 左、2右"`
+		Vt             interface{} `json:"vt" description:"垂直对齐,	0 中间、1 上、2下"`
+		Un             interface{} `json:"un" description:""`
+		Bold           interface{} `json:"bl" description:"粗体,0 常规 、 1加粗	"`
+		Italic         interface{} `json:"it" description:"斜体,0 常规 、 1 斜体"`
+		Value          interface{} `json:"v" description:"原始值"`
+	} `json:"s"`
+}
+
+// LuckySheetDataCellComment 批注
+type LuckySheetDataCellComment struct {
+	Left   int    `json:"left" description:"批注框距离左边工作表边缘位置"`
+	Top    int    `json:"top" description:"批注框距离上边工作表边缘位置"`
+	Width  int    `json:"width" description:"批注框宽度"`
+	Height int    `json:"height" description:"批注框高度"`
+	Value  string `json:"value" description:"批注内容"`
+	IsShow bool   `json:"isshow" description:"是否显示批注"`
+}
+
+// GetLuckySheetData 获取LuckySheetData的结构体
+func GetLuckySheetData(jsonStr string) (item *LuckySheetData, err error) {
+	err = json.Unmarshal([]byte(jsonStr), &item)
+	for k, v := range item.CellData {
+		value := v.Value
+		value.Fontsize = getIntValueByInterface(value.Fs)
+		value.CancelLine = getIntValueByInterface(value.Cl)
+		value.HorizontalType = getIntValueByInterface(value.Ht)
+		value.VerticalType = getIntValueByInterface(value.Vt)
+		value.FontFamily = getIntValueByInterface(value.FF)
+		value.TextBeak = getIntValueByInterface(value.Tb)
+
+		if len(value.CellType.S) > 0 {
+			for kk, vv := range value.CellType.S {
+				vv.Fontsize = getIntValueByInterface(vv.Fs)
+				vv.CancelLine = getIntValueByInterface(vv.Cl)
+				vv.HorizontalType = getIntValueByInterface(vv.Ht)
+				vv.VerticalType = getIntValueByInterface(vv.Vt)
+				vv.FontFamily = getIntValueByInterface(vv.FF)
+				value.CellType.S[kk] = vv
+			}
+		}
+
+		item.CellData[k].Value = value
+	}
+
+	//边框
+	if len(item.Config.BorderInfo) > 0 {
+		for k, v := range item.Config.BorderInfo {
+			v.Value.T.Style = getIntValueByInterface(v.Value.T.Style)
+			v.Value.B.Style = getIntValueByInterface(v.Value.B.Style)
+			v.Value.L.Style = getIntValueByInterface(v.Value.L.Style)
+			v.Value.R.Style = getIntValueByInterface(v.Value.R.Style)
+			item.Config.BorderInfo[k] = v
+		}
+	}
+	return
+}
+
+// 兼容前端js传递的数据类型
+func getIntValueByInterface(valInterface interface{}) (val int) {
+	if valInterface == nil {
+		return
+	}
+	switch reflect.TypeOf(valInterface).Kind() {
+	case reflect.String:
+		tmpValue := reflect.ValueOf(valInterface).String()
+		tmpValInt, err := strconv.Atoi(tmpValue)
+		if err != nil {
+			val = 0
+		} else {
+			val = tmpValInt
+		}
+	case reflect.Int, reflect.Int32, reflect.Int64:
+		tmpValue := reflect.ValueOf(valInterface).Int()
+		val = int(tmpValue)
+	}
+	return
+}
+
+// TableData 表格数据
+type TableData struct {
+	TableDataList     [][]LuckySheetDataValue
+	RowWidthList      []float64
+	RowHeightList     []float64
+	RemoveTopRow      int              `description:"移除表格上方的行数"`
+	RemoveBottomRow   int              `description:"移除表格下方的行数"`
+	RemoveLeftColumn  int              `description:"移除表格左侧的列数"`
+	RemoveRightColumn int              `description:"移除表格右侧的列数"`
+	MergeList         []TableDataMerge `description:"合并数据列"`
+}
+
+// TableDataMerge 表格数据合并单元格配置
+type TableDataMerge struct {
+	StartRowIndex    int `json:"start_row_index" description:"开始的行下标"`
+	StartColumnIndex int `json:"start_column" description:"开始的列下标"`
+	MergeRowNum      int `json:"merge_row_num" description:"合并的行数"`
+	MergeColumnNum   int `json:"merge_column_num" description:"合并的列数"`
+}
+
+// TableRemoveNum 上下左右移除的空行空列数量
+type TableRemoveNum struct {
+	RemoveTopRow      int `description:"移除表格上方的行数"`
+	RemoveBottomRow   int `description:"移除表格下方的行数"`
+	RemoveLeftColumn  int `description:"移除表格左侧的列数"`
+	RemoveRightColumn int `description:"移除表格右侧的列数"`
+}
+
+// handleCellVal 处理单元格数据
+func handleCellVal(tmpTableColData LuckySheetDataValue) (valueStr string) {
+	valueStr = tmpTableColData.Monitor
+	if valueStr == `` {
+		//valueStr = fmt.Sprint(cellInfo.Value)
+		if valueStr == `` && tmpTableColData.CellType.S != nil {
+			//不是设置在单元格上面,而是设置在文本上
+			for _, cellS := range tmpTableColData.CellType.S {
+				valueStr += fmt.Sprint(cellS.Value)
+			}
+		}
+	}
+	return
+}
+
+type CellPosition struct {
+	RowIndex    int
+	ColumnIndex int
+}

+ 1 - 1
services/task.go

@@ -8,7 +8,7 @@ import (
 
 func InitTask() {
 	// 监听生成报告长图及pdf
-	go ListenReport2ImgQueue()
+	//go ListenReport2ImgQueue()
 }
 
 // Report2ImgQueueReq 报告生成长图请求体

+ 7 - 0
utils/config.go

@@ -48,6 +48,9 @@ var (
 	AlarmMsgUrl string
 
 	Report2ImgServerUrl string // 报告详情转图片服务地址
+
+	// ChartLibUrl 图库项目url
+	ChartLibUrl string
 )
 
 // 对象存储客户端
@@ -183,6 +186,10 @@ func init() {
 
 		// 报告详情转图片服务地址
 		Report2ImgServerUrl = config["report2img_server_url"]
+
+		// 图表项目域名
+		ChartLibUrl = config["chart_lib_url"]
+
 	}
 
 	// 对象存储客户端