|
@@ -7,6 +7,7 @@ import (
|
|
|
"fmt"
|
|
|
"github.com/chromedp/cdproto/browser"
|
|
|
"github.com/chromedp/chromedp"
|
|
|
+ "github.com/shopspring/decimal"
|
|
|
"hongze/hongze_data_crawler/models"
|
|
|
"hongze/hongze_data_crawler/services/alarm_msg"
|
|
|
"hongze/hongze_data_crawler/utils"
|
|
@@ -14,7 +15,6 @@ import (
|
|
|
"log"
|
|
|
"os"
|
|
|
"path/filepath"
|
|
|
- "strconv"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -103,19 +103,19 @@ func AddSourceChangesVisitorsCovid() (err error) {
|
|
|
}
|
|
|
|
|
|
tmp.RetailAndRecreation = row[3]
|
|
|
- retailAndRecreation, _ := strconv.ParseFloat(tmp.RetailAndRecreation, 32)
|
|
|
+ retailAndRecreation, _ := decimal.NewFromString(tmp.RetailAndRecreation)
|
|
|
tmp.GroceryAndPharmacy = row[4]
|
|
|
- groceryAndPharmacy, _ := strconv.ParseFloat(tmp.GroceryAndPharmacy, 32)
|
|
|
+ groceryAndPharmacy, _ := decimal.NewFromString(tmp.GroceryAndPharmacy)
|
|
|
tmp.Residential = row[5]
|
|
|
- residential, _ := strconv.ParseFloat(tmp.Residential, 32)
|
|
|
+ residential, _ := decimal.NewFromString(tmp.Residential)
|
|
|
tmp.TransitStations = row[6]
|
|
|
- transitStations, _ := strconv.ParseFloat(tmp.TransitStations, 32)
|
|
|
+ transitStations, _ := decimal.NewFromString(tmp.TransitStations)
|
|
|
tmp.Parks = row[7]
|
|
|
- parks, _ := strconv.ParseFloat(tmp.Parks, 32)
|
|
|
+ parks, _ := decimal.NewFromString(tmp.Parks)
|
|
|
tmp.Workplaces = row[8]
|
|
|
- workplaces, _ := strconv.ParseFloat(tmp.Workplaces, 32)
|
|
|
- total := retailAndRecreation + groceryAndPharmacy + residential + transitStations + parks + workplaces
|
|
|
- tmp.Total = strconv.FormatFloat(total,'f',5,32)
|
|
|
+ workplaces, _ := decimal.NewFromString(tmp.Workplaces)
|
|
|
+ total := retailAndRecreation.Add(groceryAndPharmacy).Add(residential).Add(transitStations).Add(parks).Add(workplaces)
|
|
|
+ tmp.Total = total.String()
|
|
|
tmp.CreateTime = now
|
|
|
tmp.ModifyTime = now
|
|
|
|
|
@@ -146,6 +146,7 @@ func AddSourceChangesVisitorsCovid() (err error) {
|
|
|
err = errors.New("删除文件失败 "+ err.Error())
|
|
|
return
|
|
|
}*/
|
|
|
+ println("入库成功")
|
|
|
return
|
|
|
}
|
|
|
|