|
@@ -13,10 +13,10 @@ type EnterpriseSearch struct {
|
|
|
MatchType string //搜索范围[A:企业名称,B:法定代表人,C:股东,D:高管,E:项目or标的物]
|
|
|
EntArea string //注册地省份[多个用逗号分割]
|
|
|
EntCity string //注册地城市[多个用逗号分割]
|
|
|
- EntCapital string //注册资本[min-max,必有-]
|
|
|
- EntType string //企业类型[A:有限责任公司,B:股份有限公司,C:有限合伙,D:普通合伙]
|
|
|
- EntStatus string //企业状态[A:存续,B:吊销,C:注销、D:(停业??)、E:撤销]
|
|
|
- BiddingArea string //中标地区[会员:多个用逗号分割]
|
|
|
+ EntCapital string //注册资本[min-max,必有-][多个用逗号分割]
|
|
|
+ EntType string //企业类型[A:有限责任公司,B:股份有限公司,C:有限合伙,D:普通合伙][多个用逗号分割]
|
|
|
+ EntStatus string //企业状态[A:存续,B:吊销,C:注销、D:(停业??)、E:撤销][多个用逗号分割]
|
|
|
+ BiddingArea string //中标地区
|
|
|
EntClass string //单位类型[会员:1:采购单位、2:投标企业、3:代理机构、4:厂商]
|
|
|
EntContact string //联系方式[会员:1:固定电话、2:手机号、3:邮箱、4:不存在]
|
|
|
|
|
@@ -139,19 +139,29 @@ func (es *EnterpriseSearch) GetQuerySql() string {
|
|
|
|
|
|
//注册资本
|
|
|
if es.EntCapital != "" {
|
|
|
- moneyRange := strings.Split(es.EntCapital, "-")
|
|
|
- limit, max, moneyQuery := qutil.Int64All(moneyRange[0]), qutil.Int64All(moneyRange[1]), ""
|
|
|
- if limit > 0 {
|
|
|
- moneyQuery = fmt.Sprintf(`"from": "%d"`, qutil.Int64All(limit))
|
|
|
- }
|
|
|
- if max > 0 {
|
|
|
- if moneyQuery != `` {
|
|
|
- moneyQuery += ","
|
|
|
+ thisQuery := []string{}
|
|
|
+ for _, moneyRanges := range strings.Split(es.EntCapital, ",") {
|
|
|
+ if moneyRanges == "" || strings.Index(moneyRanges, "-") < 0 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ moneyRange := strings.Split(moneyRanges, "-")
|
|
|
+ limit, max, moneyQuery := qutil.Int64All(moneyRange[0]), qutil.Int64All(moneyRange[1]), ""
|
|
|
+ if limit > 0 {
|
|
|
+ moneyQuery = fmt.Sprintf(`"from": "%d"`, qutil.Int64All(limit))
|
|
|
+ }
|
|
|
+ if max > 0 {
|
|
|
+ if moneyQuery != `` {
|
|
|
+ moneyQuery += ","
|
|
|
+ }
|
|
|
+ moneyQuery += fmt.Sprintf(`"to": "%d"`, qutil.Int64All(max))
|
|
|
+ }
|
|
|
+ if moneyQuery != "" {
|
|
|
+ thisQuery = append(thisQuery, fmt.Sprintf(`{"range": {"capital": {%s}}}`, moneyQuery))
|
|
|
}
|
|
|
- moneyQuery += fmt.Sprintf(`"to": "%d"`, qutil.Int64All(max))
|
|
|
}
|
|
|
- if moneyQuery != "" {
|
|
|
- musts = append(musts, fmt.Sprintf(`{"range": {"capital": {%s}}}`, moneyQuery))
|
|
|
+
|
|
|
+ if len(thisQuery) > 0 {
|
|
|
+ musts = append(musts, fmt.Sprintf(`{"bool":{"should":[%s],"minimum_should_match": 1}}`, strings.Join(thisQuery, ",")))
|
|
|
}
|
|
|
}
|
|
|
//企业类型(页面显示的企业与数据已存在的类型不一致)
|