fix: 调整报表添加顺序

This commit is contained in:
renzhiyuan 2026-01-04 18:04:45 +08:00
parent 370090ad15
commit c69345bcaf
3 changed files with 12 additions and 4 deletions

View File

@ -27,7 +27,7 @@ func Test_StatisOursProductLossSumApiTotal(t *testing.T) {
if err != nil {
panic(err)
}
reports, err := o.DailyReport(time.Now(), []string{"官方-爱奇艺-星钻季卡", "官方-爱奇艺-星钻半年卡", "官方--腾讯-年卡", "官方--爱奇艺-月卡"}, ossClient)
reports, err := o.DailyReport(time.Now(), DownWardValue, []string{"官方-爱奇艺-星钻季卡", "官方-爱奇艺-星钻半年卡", "官方--腾讯-年卡", "官方--爱奇艺-月卡"}, SumFilter, ossClient)
t.Log(reports, err)

View File

@ -42,7 +42,7 @@ func (b *BbxtTools) SimpleFillExcelWithTitle(templatePath, outputPath string, da
log.Errorf("获取模板行高失败: %v", err)
rowHeight = 31 // 默认高度
}
rowWidth := 25.00
// 反射获取切片数据
v := reflect.ValueOf(dataSlice)
if v.Kind() != reflect.Slice {
@ -101,7 +101,7 @@ func (b *BbxtTools) SimpleFillExcelWithTitle(templatePath, outputPath string, da
// 填充数据到Excel
for col, value := range rowData {
cell := fmt.Sprintf("%c%d", 'A'+col, currentRow)
f.SetColWidth(sheet, cell, cell, rowWidth)
switch value.(type) {
case string:
var style = value.(string)

View File

@ -223,7 +223,7 @@ func (b *BbxtTools) OfficialProductSumDeclineExcel(templatePath, outputPath stri
if err != nil {
rowHeightData = 20
}
rowWidth := 25.00
currentRow := 3
pattern := `\$\{(.*?)\}`
re := regexp.MustCompile(pattern)
@ -293,6 +293,14 @@ func (b *BbxtTools) OfficialProductSumDeclineExcel(templatePath, outputPath stri
twoDiffValue := re.ReplaceAllString(twoDiff, "")
f.SetCellStyle(sheet, fmt.Sprintf("G%d", currentRow), fmt.Sprintf("G%d", currentRow), fontStyleIDG)
// 设置值
//f.SetColWidth(sheet, fmt.Sprintf("A%d", currentRow), fmt.Sprintf("A%d", currentRow), product.OfficialProductName)
//f.SetColWidth(sheet, fmt.Sprintf("B%d", currentRow), fmt.Sprintf("B%d", currentRow), p.ResellerName)
f.SetColWidth(sheet, fmt.Sprintf("C%d", currentRow), fmt.Sprintf("C%d", currentRow), rowWidth)
f.SetColWidth(sheet, fmt.Sprintf("D%d", currentRow), fmt.Sprintf("D%d", currentRow), rowWidth)
f.SetColWidth(sheet, fmt.Sprintf("E%d", currentRow), fmt.Sprintf("E%d", currentRow), rowWidth)
f.SetColWidth(sheet, fmt.Sprintf("F%d", currentRow), fmt.Sprintf("F%d", currentRow), rowWidth)
f.SetColWidth(sheet, fmt.Sprintf("G%d", currentRow), fmt.Sprintf("G%d", currentRow), rowWidth)
f.SetCellValue(sheet, fmt.Sprintf("A%d", currentRow), product.OfficialProductName)
f.SetCellValue(sheet, fmt.Sprintf("B%d", currentRow), p.ResellerName)
f.SetCellValue(sheet, fmt.Sprintf("C%d", currentRow), p.CurrentNum)