diff --git a/internal/domain/workflow/recharge/statistics_ours_product.go b/internal/domain/workflow/recharge/statistics_ours_product.go index 8ca32c2..19a6351 100644 --- a/internal/domain/workflow/recharge/statistics_ours_product.go +++ b/internal/domain/workflow/recharge/statistics_ours_product.go @@ -13,6 +13,7 @@ import ( "fmt" "math/rand" "path/filepath" + "strconv" "time" "github.com/cloudwego/eino/compose" @@ -179,6 +180,29 @@ func (w *statisticsOursProduct) generateExcelAndUpload(ctx context.Context, stat func (w *statisticsOursProduct) convertDataToExcelFormat(data []statistics_ours_product.StatisticsOursProductItem) [][]string { var result [][]string for _, item := range data { + + var profitVal float64 + // 处理 Profit 字段类型 + switch v := item.Profit.(type) { + case float64: + profitVal = v + case string: + if val, err := strconv.ParseFloat(v, 64); err == nil { + profitVal = val + } else { + // 解析失败默认为0,或者记录错误 + profitVal = 0 + } + default: + // 其他类型视为0 + profitVal = 0 + } + + // 过滤利润小于 -100 的记录 + if profitVal < -100 { + continue + } + row := []string{ item.OursProductName, // fmt.Sprintf("%d", item.OursProductId), diff --git a/tmpl/excel_temp/recharge_statistics_ours_product.xlsx b/tmpl/excel_temp/recharge_statistics_ours_product.xlsx index 8294b55..aff4bd4 100755 Binary files a/tmpl/excel_temp/recharge_statistics_ours_product.xlsx and b/tmpl/excel_temp/recharge_statistics_ours_product.xlsx differ