diff --git a/internal/tools/bbxt/bbxt_test.go b/internal/tools/bbxt/bbxt_test.go index 3640dcd..ebfd6d6 100644 --- a/internal/tools/bbxt/bbxt_test.go +++ b/internal/tools/bbxt/bbxt_test.go @@ -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) diff --git a/internal/tools/bbxt/excel.go b/internal/tools/bbxt/excel.go index 19550cd..1a6b6eb 100644 --- a/internal/tools/bbxt/excel.go +++ b/internal/tools/bbxt/excel.go @@ -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) diff --git a/internal/tools/bbxt/upload.go b/internal/tools/bbxt/upload.go index 9eeb8a5..aa56ba1 100644 --- a/internal/tools/bbxt/upload.go +++ b/internal/tools/bbxt/upload.go @@ -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)