Эх сурвалжийг харах

Merge commit 'cc78485646229b61b86f9f155beb7fdd0caa827d' into dev2.0

* commit 'cc78485646229b61b86f9f155beb7fdd0caa827d':
  time
Jianghan 1 жил өмнө
parent
commit
3aaa3cff7b

+ 22 - 11
CMPlatform/service/data_ent.go

@@ -1,23 +1,25 @@
 package service
 
 import (
+	"cmplatform/push"
+	"cmplatform/util"
+	"fmt"
+	"io"
+	"mime/multipart"
+	"strings"
+	"time"
+
+	"sync"
+
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/date"
 	elastic "app.yhyue.com/moapp/jybase/es"
 	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 	"app.yhyue.com/moapp/jybase/mongodb"
-	"cmplatform/push"
-	"cmplatform/util"
-	"fmt"
 	es "github.com/olivere/elastic/v7"
 	"github.com/tealeg/xlsx"
 	"go.mongodb.org/mongo-driver/bson"
-	"io"
-	"mime/multipart"
-	"strings"
-	"sync"
-	"time"
 )
 
 type EntData struct {
@@ -162,6 +164,15 @@ func ImportDataByExcel(mf multipart.File, eid int64, entid string) (int, int64,
 									"element_field": "industry", "pcode": common.IntAll((*info)["code"]), "element_value": id})
 							}
 						}
+					}
+				} else if fMap[index] == "bidopentime" || fMap[index] == "publishtime" || fMap[index] == "docstarttime" || fMap[index] == "bidstarttime" || fMap[index] == "bidendtime" {
+					if cell.Type() == xlsx.CellTypeNumeric {
+						dates, err := cell.GetTime(false)
+						if err != nil {
+							log.Debug("Error getting dates:", err)
+						} else {
+							tmp[fMap[index]] = dates.Format(date.Date_Short_Layout)
+						}
 					} else if fMap[index] == "winner_tag" {
 						// 中标单位标签
 						if v := WtM[val]; v != nil && v != 0 {
@@ -178,11 +189,11 @@ func ImportDataByExcel(mf multipart.File, eid int64, entid string) (int, int64,
 						}
 					} else if fMap[index] == "bidopentime" || fMap[index] == "publishtime" || fMap[index] == "docstarttime" || fMap[index] == "bidstarttime" || fMap[index] == "bidendtime" {
 						if cell.Type() == xlsx.CellTypeNumeric {
-							date, err := cell.GetTime(false)
+							dates, err := cell.GetTime(false)
 							if err != nil {
-								log.Debug("Error getting date:", err)
+								log.Debug("Error getting dates:", err)
 							} else {
-								tmp[fMap[index]] = date.Format(time.DateOnly)
+								tmp[fMap[index]] = dates.Format(date.Date_Short_Layout)
 							}
 						} else {
 							tmp[fMap[index]] = val