|
@@ -20,7 +20,7 @@ import (
|
|
|
"app.yhyue.com/moapp/jybase/mongodb"
|
|
|
mg "app.yhyue.com/moapp/jybase/mongodb"
|
|
|
"app.yhyue.com/moapp/jybase/mysql"
|
|
|
-
|
|
|
+ . "app.yhyue.com/moapp/jybase/rpc"
|
|
|
"github.com/tealeg/xlsx"
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
|
)
|
|
@@ -30,7 +30,56 @@ type Filters struct {
|
|
|
FilterId string
|
|
|
}
|
|
|
|
|
|
-func GetEntDataExportCount(sim, bid mg.MongodbSim, bidMgoDBName, elasticAddress, _id string, entId, entUserId int, isFirst bool, url string, maxCount int) (count, newCount int, data *[]map[string]interface{}) {
|
|
|
+func GetEntDataExportCount(sim, bid mg.MongodbSim, bidMgoDBName, elasticAddress, _id, dataPkgRemoveRepeatAddr string, entId, entUserId int, isFirst bool, url string, maxCount int) (count, newCount int, data *[]map[string]interface{}) {
|
|
|
+ log.Println(fmt.Sprintf("GetEntDataExportCount entId:%v,entUserId:%v", entId, entUserId))
|
|
|
+ start := time.Now()
|
|
|
+ defer func() {
|
|
|
+ util.Catch()
|
|
|
+ log.Printf("GetEntDataExportCount entId:%v,entUserId:%v 总耗时:%v\n", entId, entUserId, time.Since(start))
|
|
|
+ }()
|
|
|
+ count = GetDataExportSearchCountByScdId(sim, bid, bidMgoDBName, elasticAddress, _id)
|
|
|
+ log.Printf("耗时: GetEntDataExportCount-GetDataExportSearchCountByScdId entId:%v,entUserId:%v,Since:%v \n", entId, entUserId, time.Since(start))
|
|
|
+ if count > maxCount || count == -1 {
|
|
|
+ count = maxCount
|
|
|
+ }
|
|
|
+ log.Println("GetEntDataExportCount-count", entId, entUserId, count)
|
|
|
+ dataType := "2"
|
|
|
+ //数据导出数据查询
|
|
|
+ res, err := GetDataExportSearchResultByScdId(sim, bid, bidMgoDBName, elasticAddress, _id, dataType, count)
|
|
|
+ log.Printf("耗时: GetEntDataExportCount-GetDataExportSearchResultByScdId entId:%v,entUserId:%v,Since:%v \n", entId, entUserId, time.Since(start))
|
|
|
+ if err != nil {
|
|
|
+ log.Println("企业数据导出错误 ", entId, entUserId, err)
|
|
|
+ return 0, 0, nil
|
|
|
+ }
|
|
|
+ infoIdList := []string{}
|
|
|
+ postStart := time.Now()
|
|
|
+ for _, v := range *res {
|
|
|
+ if util.IntAll(v["signendtime"]) != 0 {
|
|
|
+ date := v["signendtime"]
|
|
|
+ v["signendtime"] = FormatDateWithObj(&date, Date_Short_Layout)
|
|
|
+ }
|
|
|
+ if util.IntAll(v["bidendtime"]) != 0 {
|
|
|
+ date := v["bidendtime"]
|
|
|
+ v["bidendtime"] = FormatDateWithObj(&date, Date_Short_Layout)
|
|
|
+ }
|
|
|
+ id := util.ObjToString(v["_id"])
|
|
|
+ infoIdList = append(infoIdList, id)
|
|
|
+ if !isFirst {
|
|
|
+ delete(v, "_id")
|
|
|
+ v["entid"] = entId
|
|
|
+ v["userid"] = entUserId
|
|
|
+ v["infoid"] = id
|
|
|
+ v["createtime"] = time.Now().Unix()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ m, _ := NoRepeatData(dataPkgRemoveRepeatAddr, map[string]interface{}{"entid": entId, "ids": infoIdList})
|
|
|
+ newCount = len(m)
|
|
|
+ log.Printf("企业数据导出--数据遍历完成:entId:%v,entUserId:%v,newCount:%v,Since:%v \n", entId, entUserId, newCount, time.Since(postStart))
|
|
|
+ data = res
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+/*func GetEntDataExportCount(sim, bid mg.MongodbSim, bidMgoDBName, elasticAddress, _id string, entId, entUserId int, isFirst bool, url string, maxCount int) (count, newCount int, data *[]map[string]interface{}) {
|
|
|
log.Println(fmt.Sprintf("GetEntDataExportCount entId:%v,entUserId:%v", entId, entUserId))
|
|
|
start := time.Now()
|
|
|
defer func() {
|
|
@@ -138,7 +187,7 @@ func GetEntDataExportCount(sim, bid mg.MongodbSim, bidMgoDBName, elasticAddress,
|
|
|
log.Printf("企业数据导出--数据遍历完成:entId:%v,entUserId:%v,newCount:%v,Since:%v \n", entId, entUserId, newCount, time.Since(postStart))
|
|
|
data = res
|
|
|
return
|
|
|
-}
|
|
|
+}*/
|
|
|
func GetEntDataExportCountIdArr(sim, bid mg.MongodbSim, bidMgoDBName, elasticAddress, _id string, entId, entUserId int, url string, maxCount int) (count, newCount int, err error) {
|
|
|
log.Println(fmt.Sprintf("GetEntDataExportCountIdArr entId:%v,entUserId:%v", entId, entUserId))
|
|
|
start := time.Now()
|