Browse Source

Merge branch 'bzq1/excel_size_cf' of eta_server/eta_api into debug

baoziqiang 5 tháng trước cách đây
mục cha
commit
0e0a0c85c2

+ 27 - 1
controllers/data_manage/excel/excel_info.go

@@ -1924,6 +1924,11 @@ func (c *ExcelInfoController) GetOtherEdbData() {
 			dataList[i], dataList[j] = dataList[j], dataList[i]
 		}
 	}
+	// 设置数据默认高度和宽度
+	for i := range dataList {
+		dataList[i].Width = 140
+		dataList[i].Height = 35
+	}
 
 	sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList([]int{req.EdbInfoId})
 	if err != nil {
@@ -2029,6 +2034,11 @@ func (c *ExcelInfoController) GetBatchEdbData() {
 				br.Msg = "指标数据异常,请检查"
 				return
 			}
+			// 设置数据默认高度和宽度
+			for i := range dataList {
+				dataList[i].Width = 140
+				dataList[i].Height = 35
+			}
 			tableList = append(tableList, &response.TableDataItem{
 				EdbInfoId:     v,
 				Data:          dataList,
@@ -2057,7 +2067,11 @@ func (c *ExcelInfoController) GetBatchEdbData() {
 					dataList[i], dataList[j] = dataList[j], dataList[i]
 				}
 			}
-
+			// 设置数据默认高度和宽度
+			for i := range dataList {
+				dataList[i].Width = 140
+				dataList[i].Height = 35
+			}
 			sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList([]int{v})
 			if err != nil {
 				br.Msg = "自定义表格数据获取失败"
@@ -2330,6 +2344,12 @@ func (c *ExcelInfoController) GetHistoryDateData() {
 			Data:      firstDataList,
 		})
 
+		// 设置数据默认高度和宽度
+		for i := range firstDataList {
+			firstDataList[i].Width = 140
+			firstDataList[i].Height = 35
+		}
+
 		for _, v := range firstDataList {
 			dateStrList = append(dateStrList, v.DataTime)
 		}
@@ -2353,6 +2373,12 @@ func (c *ExcelInfoController) GetHistoryDateData() {
 				br.ErrMsg = fmt.Sprint("获取失败,Err:", err.Error())
 				return
 			}
+
+			// 设置数据默认高度和宽度
+			for i := range dataList {
+				dataList[i].Width = 140
+				dataList[i].Height = 35
+			}
 			result = append(result, response.TableDataItem{
 				EdbInfoId: v,
 				Decimal:   req.Decimal[k],

+ 10 - 10
models/bi_dashboard/bi_dashboard.go

@@ -6,15 +6,15 @@ import (
 )
 
 type BiDashboard struct {
-	BiDashboardId         int       `gorm:"primaryKey;autoIncrement;column:bi_dashboard_id"` // bi看板id
-	BiDashboardClassifyId int       `gorm:"column:bi_dashboard_classify_id" `                // 看板分类id
-	BiDashboardName       string    `gorm:"column:bi_dashboard_name;size:255"`               // 看板名称
-	SysAdminId            int       `gorm:"column:sys_admin_id" `                            // 创建人ID
-	SysAdminName          string    `gorm:"column:sys_admin_name;size:128" `                 // 创建人姓名
-	Sort                  int       `gorm:"column:sort" `                                    // 排序字段
-	CreateTime            time.Time `gorm:"column:create_time" `                             // 创建时间
-	ModifyTime            time.Time `gorm:"column:modify_time"`                              // 更新时间
-	State                 int       `gorm:"column:state"`                                    // 状态 1:未公开; 4-待审批;5-已驳回;6-已通过
+	BiDashboardId         int       `orm:"column(bi_dashboard_id);pk"`         // bi看板id
+	BiDashboardClassifyId int       `gorm:"column:bi_dashboard_classify_id" `  // 看板分类id
+	BiDashboardName       string    `gorm:"column:bi_dashboard_name;size:255"` // 看板名称
+	SysAdminId            int       `gorm:"column:sys_admin_id" `              // 创建人ID
+	SysAdminName          string    `gorm:"column:sys_admin_name;size:128" `   // 创建人姓名
+	Sort                  int       `gorm:"column:sort" `                      // 排序字段
+	CreateTime            time.Time `gorm:"column:create_time" `               // 创建时间
+	ModifyTime            time.Time `gorm:"column:modify_time"`                // 更新时间
+	State                 int       `gorm:"column:state"`                      // 状态 1:未公开; 4-待审批;5-已驳回;6-已通过
 }
 
 // tableName
@@ -161,7 +161,7 @@ WHERE a.sys_admin_id = ? GROUP BY a.bi_dashboard_id   `
 }
 
 // getByName
-func GetDashboardByName(name string,adminId int) (item *BiDashboard, err error) {
+func GetDashboardByName(name string, adminId int) (item *BiDashboard, err error) {
 	sql := `SELECT * FROM bi_dashboard WHERE bi_dashboard_name = ? and sys_admin_id =? limit 1`
 	o := orm.NewOrm()
 	err = o.Raw(sql, name, adminId).QueryRow(&item)

+ 1 - 1
models/bi_dashboard/bi_dashboard_classify.go

@@ -6,7 +6,7 @@ import (
 )
 
 type BiDashboardClassify struct {
-	BiDashboardClassifyId   int       `gorm:"primaryKey;autoIncrement;column:bi_dashboard_classify_id"` // bi看板分类id
+	BiDashboardClassifyId   int       `orm:"column(bi_dashboard_classify_id);pk"` // bi看板分类id
 	BiDashboardClassifyName string    `gorm:"column:bi_dashboard_classify_name;size:255;not null" `     // 看板分类名称
 	Sort                    int       `gorm:"column:sort" `                                             // 排序字段
 	CreateTime              time.Time `gorm:"column:create_time" `                                      // 创建时间

+ 1 - 1
models/bi_dashboard/bi_dashboard_detail.go

@@ -6,7 +6,7 @@ import (
 )
 
 type BiDashboardDetail struct {
-	BiDashboardDetailId int       `gorm:"primaryKey;autoIncrement;column:bi_dashboard_detail_id" ` // bi看板id
+	BiDashboardDetailId int       `orm:"column(bi_dashboard_detail_id);pk" ` // bi看板id
 	BiDashboardId       int       `gorm:"column:bi_dashboard_id" `                                 // 看板id
 	Type                int       `gorm:"column:type" `                                            // 1图表 2表格
 	UniqueCode          string    `gorm:"column:unique_code;size:32;not null" `                    // 报告唯一编码

+ 1 - 1
models/bi_dashboard/bi_dashboard_grant.go

@@ -6,7 +6,7 @@ import (
 )
 
 type BiDashboardGrant struct {
-	GrantId       int       `gorm:"primaryKey;autoIncrement;column:grant_id"` // 授权id
+	GrantId       int       `orm:"column(grant_id);pk"` // 授权id
 	BiDashboardId int       `gorm:"column:bi_dashboard_id" `                  // 看板id
 	GrantAdminId  int       `gorm:"column:grant_admin_id"`                    // 授权的用户id
 	CreateTime    time.Time `gorm:"column:create_time"`                       // 授权时间

+ 1 - 1
models/bi_dashboard/bi_dashboard_home_page.go

@@ -6,7 +6,7 @@ import (
 )
 
 type BiDashboardHomePage struct {
-	BiDashboardHomePageId int       `gorm:"primaryKey;autoIncrement;comment:'bi首页看板id'"`
+	BiDashboardHomePageId int       `orm:"column(bi_dashboard_home_page_id);pk"`
 	BiDashboardId         int       `gorm:"type:int(10);default:null;comment:'看板id'"`
 	AdminId               int       `gorm:"type:int(10);default:null;"`
 	CreateTime            time.Time `gorm:"type:datetime;comment:'创建时间'"`

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

@@ -183,6 +183,8 @@ type ManualDataReq struct {
 	ShowValue           string            `description:"展示值"`
 	Value               string            `description:"实际值(计算公式)"`
 	Decimal             int               `description:"小数位数"`
+	Width               int               `description:"单元格宽度"`
+	Height              int               `description:"单元格高度"`
 	RelationEdbInfoList []RelationEdbInfo `description:"关联指标(计算公式中关联的指标,用于计算的时候去匹配)"`
 }
 

+ 4 - 4
models/data_manage/trade_analysis/trade_analysis.go

@@ -361,10 +361,10 @@ const (
 	WarehouseDefaultFrequency = "日度"
 
 	GuangZhouTopCompanyAliasName = "日成交持仓排名" // 广期所TOP20对应的公司名称
-	GuangZhouSeatNameBuy         = "持买单量"    // 广期所指标名称中的多单名称
-	GuangZhouSeatNameSold        = "持卖单量"    // 广期所指标名称中的空单名称
-	GuangZhouTopSeatNameBuy      = "持买单量总计"  // 广期所指标名称中的TOP20多单名称
-	GuangZhouTopSeatNameSold     = "持卖单量总计"  // 广期所指标名称中的TOP20空单名称
+	GuangZhouSeatNameBuy         = "持买单量"       // 广期所指标名称中的多单名称
+	GuangZhouSeatNameSold        = "持卖单量"       // 广期所指标名称中的空单名称
+	GuangZhouTopSeatNameBuy      = "持买单量总计"   // 广期所指标名称中的TOP20多单名称
+	GuangZhouTopSeatNameSold     = "持卖单量总计"   // 广期所指标名称中的TOP20空单名称
 )
 
 const (

+ 1 - 1
services/data/stl/stl.go

@@ -436,7 +436,7 @@ warnings.filterwarnings('ignore')
 file_path = r"%s"
 df = pd.read_excel(file_path, parse_dates=['日期'], engine='openpyxl')
 df.set_index('日期', inplace=True)
-
+df = df[df.index.notna()]
 
 period = %d
 seasonal = %d