Bladeren bron

Merge branch 'master' into hotfix/v1.0.3.1

lianbingjie 1 jaar geleden
bovenliggende
commit
464fcb7447
2 gewijzigde bestanden met toevoegingen van 24 en 5 verwijderingen
  1. 13 0
      common/src/qfw/util/dataexport/dataexport.go
  2. 11 5
      public/dataexport.go

+ 13 - 0
common/src/qfw/util/dataexport/dataexport.go

@@ -5,6 +5,7 @@ import (
 	"encoding/json"
 	"errors"
 	"fmt"
+	"github.com/gogf/gf/v2/util/gconv"
 	"log"
 	"math"
 	"regexp"
@@ -70,6 +71,7 @@ type SieveCondition struct {
 	SearchGroup      int       `json:"searchGroup"`      // 搜索分组:默认0:全部;1:招标采购公告;2:超前项目
 	SearchMode       int       `json:"searchMode"`       // 搜索模式:0:精准搜索;1:模糊搜索
 	WordsMode        int       `json:"wordsMode"`        // 搜索关键词模式;默认0:包含所有,1:包含任意
+	District         []string  `json:"district"`
 }
 
 const (
@@ -153,6 +155,16 @@ func getDataExportSql(scd *SieveCondition) string {
 		areaquery += `]}}`
 		areaCity = append(areaCity, areaquery)
 	}
+	district := scd.District
+	if len(district) > 0 {
+		for _, v := range district {
+			cityName := strings.Split(v, "_")[0]
+			districtName := strings.Split(v, "_")[1]
+			query_bool_must_and_district := `{"bool":{"must":[{"terms":{"city":["%s"]}},{"terms":{"district":["%s"]}}]}}`
+			areaCity = append(areaCity, fmt.Sprintf(query_bool_must_and_district, cityName, districtName))
+		}
+
+	}
 	if len(areaCity) > 0 {
 		musts = append(musts, fmt.Sprintf(query_bool_should, strings.Join(areaCity, ",")))
 	}
@@ -492,6 +504,7 @@ func GetSqlObjFromId(mongo mg.MongodbSim, _id string) *SieveCondition {
 		SearchGroup:      qutil.IntAll((*query)["searchGroup"]),    //搜索分组:默认0:全部;1:招标采购公告;2:超前项目
 		SearchMode:       qutil.IntAll((*query)["searchMode"]),     // 搜索模式:0:精准搜索;1:模糊搜索
 		WordsMode:        qutil.IntAll((*query)["wordsMode"]),      // 搜索关键词模式;默认0:包含所有,1:包含任意
+		District:         gconv.Strings((*query)["district"]),
 	}
 }
 

+ 11 - 5
public/dataexport.go

@@ -17,7 +17,7 @@ import (
 
 var ExConf *DataexportConfig
 
-//价格配置文件
+// 价格配置文件
 type DataexportConfig struct {
 	MsgMaxCount int  `json:"msgMaxCount"`
 	Font        Font `json:"font"`
@@ -37,7 +37,7 @@ func init() {
 	util.ReadConfig("./dataexport.json", &ExConf)
 }
 
-//发送邮箱验证码
+// 发送邮箱验证码
 func SendMailIdentCode(to, code string, auth []*mail.GmailAuth) bool {
 	html := fmt.Sprintf(`<div>
 		<div>
@@ -80,7 +80,7 @@ func GetWaitPayToken(orderid int64, order_money int, ordercode, payway, userid s
 }
 
 /*
-	获取-筛选条件-金额
+获取-筛选条件-金额
 */
 func GetPriceDes_SieveCondition(minPrice, maxPrice string) string {
 	des := ""
@@ -95,7 +95,7 @@ func GetPriceDes_SieveCondition(minPrice, maxPrice string) string {
 	return des
 }
 
-//招标数据导出筛选
+// 招标数据导出筛选
 type BidSearchExport struct {
 	Keywords        string //搜索词
 	Publishtime     string //发布时间
@@ -118,11 +118,13 @@ type BidSearchExport struct {
 	SearchMode      int    // 搜索模式:0:精准搜索;1:模糊搜索
 	WordsMode       int    // 搜索关键词模式;默认0:包含所有,1:包含任意
 	AdditionalWords string // 关键词:附加关键词(副:五组,每组最多15个字符)
+	District        string //地区
+	RegionMap       string
 }
 
 func (this *BidSearchExport) PassBidSearchExport(Sysconfig map[string]interface{}) (returnData map[string]interface{}) {
 	defer util.Catch()
-	areaSave, industrySave, citySave := []string{}, []string{}, []string{}
+	areaSave, industrySave, citySave, districtSave := []string{}, []string{}, []string{}, []string{}
 	winnerSave, buyerclassSave := []string{}, []string{}
 	publishtimeSave := this.Publishtime
 	if len(this.Area) > 0 {
@@ -131,6 +133,9 @@ func (this *BidSearchExport) PassBidSearchExport(Sysconfig map[string]interface{
 	if this.City != "" {
 		citySave = strings.Split(this.City, ",")
 	}
+	if this.District != "" {
+		districtSave = strings.Split(this.District, ",")
+	}
 	if len(this.Industry) > 0 {
 		industrySave = strings.Split(this.Industry, ",")
 	}
@@ -197,6 +202,7 @@ func (this *BidSearchExport) PassBidSearchExport(Sysconfig map[string]interface{
 		"publishtime":  publishtimeSave,
 		"area":         areaSave,
 		"city":         citySave,
+		"district":     districtSave,
 		"subtype":      this.Subtype,
 		"minprice":     this.Minprice,
 		"maxprice":     this.Maxprice,