fix: 调整报表添加顺序
This commit is contained in:
parent
370090ad15
commit
c69345bcaf
|
|
@ -27,7 +27,7 @@ func Test_StatisOursProductLossSumApiTotal(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
reports, err := o.DailyReport(time.Now(), []string{"官方-爱奇艺-星钻季卡", "官方-爱奇艺-星钻半年卡", "官方--腾讯-年卡", "官方--爱奇艺-月卡"}, ossClient)
|
reports, err := o.DailyReport(time.Now(), DownWardValue, []string{"官方-爱奇艺-星钻季卡", "官方-爱奇艺-星钻半年卡", "官方--腾讯-年卡", "官方--爱奇艺-月卡"}, SumFilter, ossClient)
|
||||||
|
|
||||||
t.Log(reports, err)
|
t.Log(reports, err)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ func (b *BbxtTools) SimpleFillExcelWithTitle(templatePath, outputPath string, da
|
||||||
log.Errorf("获取模板行高失败: %v", err)
|
log.Errorf("获取模板行高失败: %v", err)
|
||||||
rowHeight = 31 // 默认高度
|
rowHeight = 31 // 默认高度
|
||||||
}
|
}
|
||||||
|
rowWidth := 25.00
|
||||||
// 反射获取切片数据
|
// 反射获取切片数据
|
||||||
v := reflect.ValueOf(dataSlice)
|
v := reflect.ValueOf(dataSlice)
|
||||||
if v.Kind() != reflect.Slice {
|
if v.Kind() != reflect.Slice {
|
||||||
|
|
@ -101,7 +101,7 @@ func (b *BbxtTools) SimpleFillExcelWithTitle(templatePath, outputPath string, da
|
||||||
// 填充数据到Excel
|
// 填充数据到Excel
|
||||||
for col, value := range rowData {
|
for col, value := range rowData {
|
||||||
cell := fmt.Sprintf("%c%d", 'A'+col, currentRow)
|
cell := fmt.Sprintf("%c%d", 'A'+col, currentRow)
|
||||||
|
f.SetColWidth(sheet, cell, cell, rowWidth)
|
||||||
switch value.(type) {
|
switch value.(type) {
|
||||||
case string:
|
case string:
|
||||||
var style = value.(string)
|
var style = value.(string)
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ func (b *BbxtTools) OfficialProductSumDeclineExcel(templatePath, outputPath stri
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rowHeightData = 20
|
rowHeightData = 20
|
||||||
}
|
}
|
||||||
|
rowWidth := 25.00
|
||||||
currentRow := 3
|
currentRow := 3
|
||||||
pattern := `\$\{(.*?)\}`
|
pattern := `\$\{(.*?)\}`
|
||||||
re := regexp.MustCompile(pattern)
|
re := regexp.MustCompile(pattern)
|
||||||
|
|
@ -293,6 +293,14 @@ func (b *BbxtTools) OfficialProductSumDeclineExcel(templatePath, outputPath stri
|
||||||
twoDiffValue := re.ReplaceAllString(twoDiff, "")
|
twoDiffValue := re.ReplaceAllString(twoDiff, "")
|
||||||
f.SetCellStyle(sheet, fmt.Sprintf("G%d", currentRow), fmt.Sprintf("G%d", currentRow), fontStyleIDG)
|
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("A%d", currentRow), product.OfficialProductName)
|
||||||
f.SetCellValue(sheet, fmt.Sprintf("B%d", currentRow), p.ResellerName)
|
f.SetCellValue(sheet, fmt.Sprintf("B%d", currentRow), p.ResellerName)
|
||||||
f.SetCellValue(sheet, fmt.Sprintf("C%d", currentRow), p.CurrentNum)
|
f.SetCellValue(sheet, fmt.Sprintf("C%d", currentRow), p.CurrentNum)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue