fix: 1. pass Profit < -100 记录 2.更新模板
This commit is contained in:
parent
8d9794a93c
commit
c63b01ba6d
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/cloudwego/eino/compose"
|
"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 {
|
func (w *statisticsOursProduct) convertDataToExcelFormat(data []statistics_ours_product.StatisticsOursProductItem) [][]string {
|
||||||
var result [][]string
|
var result [][]string
|
||||||
for _, item := range data {
|
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{
|
row := []string{
|
||||||
item.OursProductName,
|
item.OursProductName,
|
||||||
// fmt.Sprintf("%d", item.OursProductId),
|
// fmt.Sprintf("%d", item.OursProductId),
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue