|
@@ -441,11 +441,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
pType += ","
|
|
pType += ","
|
|
}
|
|
}
|
|
pType += vv.Type
|
|
pType += vv.Type
|
|
- }
|
|
|
|
- if myChildIds == "" {
|
|
|
|
myChildIds = tempId
|
|
myChildIds = tempId
|
|
- }
|
|
|
|
- if myChildTypes == "" {
|
|
|
|
myChildTypes = vv.Type
|
|
myChildTypes = vv.Type
|
|
}
|
|
}
|
|
cm := map[string]interface{}{
|
|
cm := map[string]interface{}{
|
|
@@ -484,45 +480,68 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
|
|
if in.Current_page <= 0 {
|
|
if in.Current_page <= 0 {
|
|
in.Current_page = 1
|
|
in.Current_page = 1
|
|
}
|
|
}
|
|
|
|
+ dbPaging := in.Buyercount_start == 0 && in.Buyercount_end == 0 && in.Monitor == 0 && in.Monitorcount_start == 0 && in.Monitorcount_end == 0 && in.Project_matchme == 0 && in.Order_amount == 0
|
|
sqlAppendArgs := []interface{}{}
|
|
sqlAppendArgs := []interface{}{}
|
|
sqlAppend1 := ""
|
|
sqlAppend1 := ""
|
|
- if in.Type != "" {
|
|
|
|
|
|
+ if dbPaging && in.Type != "" {
|
|
sqlAppend1 += ` and a.itype=?`
|
|
sqlAppend1 += ` and a.itype=?`
|
|
sqlAppendArgs = append(sqlAppendArgs, n.TypeStrConvert(in.Type))
|
|
sqlAppendArgs = append(sqlAppendArgs, n.TypeStrConvert(in.Type))
|
|
}
|
|
}
|
|
|
|
+ comSqlAppend := ""
|
|
|
|
+ comSqlArgs := []interface{}{}
|
|
if in.Starttime != "" {
|
|
if in.Starttime != "" {
|
|
- sqlAppend1 += ` and a.create_time>=?`
|
|
|
|
- sqlAppendArgs = append(sqlAppendArgs, in.Starttime+" 00:00:00")
|
|
|
|
|
|
+ comSqlAppend += ` and a.create_time>=?`
|
|
|
|
+ comSqlArgs = append(comSqlArgs, in.Starttime+" 00:00:00")
|
|
}
|
|
}
|
|
if in.Endtime != "" {
|
|
if in.Endtime != "" {
|
|
- sqlAppend1 += ` and a.create_time<=?`
|
|
|
|
|
|
+ comSqlAppend += ` and a.create_time<=?`
|
|
if in.Starttime == in.Endtime {
|
|
if in.Starttime == in.Endtime {
|
|
in.Endtime += " 23:59:59"
|
|
in.Endtime += " 23:59:59"
|
|
} else {
|
|
} else {
|
|
in.Endtime += " 00:00:00"
|
|
in.Endtime += " 00:00:00"
|
|
}
|
|
}
|
|
- sqlAppendArgs = append(sqlAppendArgs, in.Endtime)
|
|
|
|
|
|
+ comSqlArgs = append(comSqlArgs, in.Endtime)
|
|
}
|
|
}
|
|
if in.Name != "" {
|
|
if in.Name != "" {
|
|
- sqlAppend1 += ` and a.company_name like ?`
|
|
|
|
- sqlAppendArgs = append(sqlAppendArgs, "%"+in.Name+"%")
|
|
|
|
|
|
+ comSqlAppend += ` and a.company_name like ?`
|
|
|
|
+ comSqlArgs = append(comSqlArgs, "%"+in.Name+"%")
|
|
}
|
|
}
|
|
|
|
+ sqlAppend1 += comSqlAppend
|
|
|
|
+ sqlAppendArgs = append(sqlAppendArgs, comSqlArgs...)
|
|
var count int64
|
|
var count int64
|
|
start := (in.Current_page - 1) * in.Page_size
|
|
start := (in.Current_page - 1) * in.Page_size
|
|
end := start + in.Page_size
|
|
end := start + in.Page_size
|
|
- dbPaging := in.Buyercount_start == 0 && in.Buyercount_end == 0 && in.Monitor == 0 && in.Monitorcount_start == 0 && in.Monitorcount_end == 0 && in.Project_matchme == 0 && in.Order_amount == 0
|
|
|
|
args := []interface{}{in.PositionId, in.PositionId, in.PositionId}
|
|
args := []interface{}{in.PositionId, in.PositionId, in.PositionId}
|
|
args = append(args, sqlAppendArgs...)
|
|
args = append(args, sqlAppendArgs...)
|
|
sqlAppend2 := ""
|
|
sqlAppend2 := ""
|
|
|
|
+ firstparty_count, supplier_count, adiffb_count, middleman_count, agency_count := 0, 0, 0, 0, 0
|
|
if dbPaging {
|
|
if dbPaging {
|
|
newArgs := []interface{}{in.PositionId}
|
|
newArgs := []interface{}{in.PositionId}
|
|
newArgs = append(newArgs, sqlAppendArgs...)
|
|
newArgs = append(newArgs, sqlAppendArgs...)
|
|
count = CrmMysql.CountBySql(`select count(1) as count from crm.connection a where a.position_id=?`+sqlAppend1, newArgs...)
|
|
count = CrmMysql.CountBySql(`select count(1) as count from crm.connection a where a.position_id=?`+sqlAppend1, newArgs...)
|
|
sqlAppend2 = ` limit ?,?`
|
|
sqlAppend2 = ` limit ?,?`
|
|
args = append(args, start, end)
|
|
args = append(args, start, end)
|
|
|
|
+ itemArgs := []interface{}{in.PositionId}
|
|
|
|
+ itemArgs = append(itemArgs, comSqlArgs...)
|
|
|
|
+ items := CrmMysql.SelectBySql(`SELECT itype,SUM(1) AS sum FROM crm.connection WHERE position_id=?`+comSqlAppend+` GROUP BY itype`, itemArgs...)
|
|
|
|
+ if items != nil {
|
|
|
|
+ for _, v := range *items {
|
|
|
|
+ switch Int64All(v["itype"]) {
|
|
|
|
+ case 1:
|
|
|
|
+ firstparty_count = IntAll(v["sum"])
|
|
|
|
+ case 2:
|
|
|
|
+ supplier_count = IntAll(v["sum"])
|
|
|
|
+ case 3:
|
|
|
|
+ adiffb_count = IntAll(v["sum"])
|
|
|
|
+ case 4:
|
|
|
|
+ middleman_count = IntAll(v["sum"])
|
|
|
|
+ case 5:
|
|
|
|
+ agency_count = IntAll(v["sum"])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//
|
|
//
|
|
- firstparty_count, supplier_count, adiffb_count, middleman_count, agency_count := 0, 0, 0, 0, 0
|
|
|
|
list := []*map[string]interface{}{}
|
|
list := []*map[string]interface{}{}
|
|
isTjProject := true
|
|
isTjProject := true
|
|
probusfors := []string{}
|
|
probusfors := []string{}
|
|
@@ -550,7 +569,6 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
|
|
}
|
|
}
|
|
jump_id += vv.CompanyId
|
|
jump_id += vv.CompanyId
|
|
}
|
|
}
|
|
- firstparty_count++
|
|
|
|
if aio.Firstparty[v.Company_id] != nil {
|
|
if aio.Firstparty[v.Company_id] != nil {
|
|
buyer_count = aio.Firstparty[v.Company_id].BuyerCount
|
|
buyer_count = aio.Firstparty[v.Company_id].BuyerCount
|
|
project_count = aio.Firstparty[v.Company_id].ProjectCount
|
|
project_count = aio.Firstparty[v.Company_id].ProjectCount
|
|
@@ -562,7 +580,6 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
|
|
itype = "供应商"
|
|
itype = "供应商"
|
|
jump_type = "supplier"
|
|
jump_type = "supplier"
|
|
jump_id = v.Company_id
|
|
jump_id = v.Company_id
|
|
- supplier_count++
|
|
|
|
if aio.Supplier[v.Company_id] != nil {
|
|
if aio.Supplier[v.Company_id] != nil {
|
|
buyer_count = aio.Supplier[v.Company_id].BuyerCount
|
|
buyer_count = aio.Supplier[v.Company_id].BuyerCount
|
|
project_count = aio.Supplier[v.Company_id].ProjectCount
|
|
project_count = aio.Supplier[v.Company_id].ProjectCount
|
|
@@ -574,7 +591,6 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
|
|
itype = "同甲异业渠道"
|
|
itype = "同甲异业渠道"
|
|
jump_type = "adiffb"
|
|
jump_type = "adiffb"
|
|
jump_id = v.Company_id
|
|
jump_id = v.Company_id
|
|
- adiffb_count++
|
|
|
|
if aio.Adiffb[v.Company_id] != nil {
|
|
if aio.Adiffb[v.Company_id] != nil {
|
|
buyer_count = aio.Adiffb[v.Company_id].BuyerCount
|
|
buyer_count = aio.Adiffb[v.Company_id].BuyerCount
|
|
project_count = aio.Adiffb[v.Company_id].ProjectCount
|
|
project_count = aio.Adiffb[v.Company_id].ProjectCount
|
|
@@ -586,7 +602,6 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
|
|
itype = "中间人"
|
|
itype = "中间人"
|
|
jump_type = "middleman"
|
|
jump_type = "middleman"
|
|
jump_id = fmt.Sprint(v.Id)
|
|
jump_id = fmt.Sprint(v.Id)
|
|
- middleman_count++
|
|
|
|
buyer_count = v.Buyer_count
|
|
buyer_count = v.Buyer_count
|
|
if v.Relate_buyer_id != "" {
|
|
if v.Relate_buyer_id != "" {
|
|
for _, v := range strings.Split(v.Relate_buyer_id, ",") {
|
|
for _, v := range strings.Split(v.Relate_buyer_id, ",") {
|
|
@@ -611,7 +626,6 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
|
|
itype = "招标代理机构"
|
|
itype = "招标代理机构"
|
|
jump_type = "agency"
|
|
jump_type = "agency"
|
|
jump_id = v.Company_id
|
|
jump_id = v.Company_id
|
|
- agency_count++
|
|
|
|
if aio.Agency[v.Company_id] != nil {
|
|
if aio.Agency[v.Company_id] != nil {
|
|
buyer_count = aio.Agency[v.Company_id].BuyerCount
|
|
buyer_count = aio.Agency[v.Company_id].BuyerCount
|
|
project_count = aio.Agency[v.Company_id].ProjectCount
|
|
project_count = aio.Agency[v.Company_id].ProjectCount
|
|
@@ -635,9 +649,38 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
|
|
} else if in.Project_matchme == 1 && project_count == 0 {
|
|
} else if in.Project_matchme == 1 && project_count == 0 {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
+ if !dbPaging {
|
|
|
|
+ switch v.Itype {
|
|
|
|
+ case 1:
|
|
|
|
+ firstparty_count++
|
|
|
|
+ case 2:
|
|
|
|
+ supplier_count++
|
|
|
|
+ case 3:
|
|
|
|
+ adiffb_count++
|
|
|
|
+ case 4:
|
|
|
|
+ middleman_count++
|
|
|
|
+ case 5:
|
|
|
|
+ agency_count++
|
|
|
|
+ }
|
|
|
|
+ if in.Type != "" && n.TypeStrConvert(in.Type) != v.Itype {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ }
|
|
export_url := ""
|
|
export_url := ""
|
|
if len(export_id) > 0 {
|
|
if len(export_id) > 0 {
|
|
- export_url = "/subscribepay/network/projectExport?export_id=" + encrypt.SE.EncodeStringByCheck(strings.Join(export_id, ","))
|
|
|
|
|
|
+ exportIdRepeat := map[string]bool{}
|
|
|
|
+ exportId := ""
|
|
|
|
+ for _, v := range export_id {
|
|
|
|
+ if exportIdRepeat[v] {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ exportIdRepeat[v] = true
|
|
|
|
+ if exportId != "" {
|
|
|
|
+ exportId += ","
|
|
|
|
+ }
|
|
|
|
+ exportId += v
|
|
|
|
+ }
|
|
|
|
+ export_url = "/subscribepay/network/projectExport?export_id=" + encrypt.SE.EncodeStringByCheck(exportId)
|
|
}
|
|
}
|
|
url := ""
|
|
url := ""
|
|
if v.Qyxy_id != "" && (jump_type == "supplier" || jump_type == "adiffb") {
|
|
if v.Qyxy_id != "" && (jump_type == "supplier" || jump_type == "adiffb") {
|
|
@@ -654,12 +697,13 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
|
|
"person": v.Person,
|
|
"person": v.Person,
|
|
"phone": v.Phone,
|
|
"phone": v.Phone,
|
|
"buyer_count": buyer_count,
|
|
"buyer_count": buyer_count,
|
|
- "monitor_count": 0,
|
|
|
|
|
|
+ "monitor_count": monitor_count,
|
|
"expect_amount": RetainDecimal(expect_amount/10000, 2),
|
|
"expect_amount": RetainDecimal(expect_amount/10000, 2),
|
|
"project_count": project_count,
|
|
"project_count": project_count,
|
|
"create_time": v.Create_time,
|
|
"create_time": v.Create_time,
|
|
"export_url": export_url,
|
|
"export_url": export_url,
|
|
"url": url,
|
|
"url": url,
|
|
|
|
+ "id": v.Id,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -809,6 +853,7 @@ func (n *network) Introduce_Firstparty(fpn map[string][]*firstpartyNetwork, entM
|
|
}
|
|
}
|
|
result[k].ProjectCount += vm[vv.CompanyId].ProjectCount
|
|
result[k].ProjectCount += vm[vv.CompanyId].ProjectCount
|
|
result[k].ProjectAmount += vm[vv.CompanyId].ProjectAmount
|
|
result[k].ProjectAmount += vm[vv.CompanyId].ProjectAmount
|
|
|
|
+ result[k].ExportId = append(result[k].ExportId, vm[vv.CompanyId].ExportId...)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return result
|
|
return result
|
|
@@ -952,7 +997,7 @@ func (n *network) Introduce_Middleman(values []string, entMonitor map[string]boo
|
|
}
|
|
}
|
|
|
|
|
|
//
|
|
//
|
|
-func (n *network) TypeStrConvert(itype string) int {
|
|
|
|
|
|
+func (n *network) TypeStrConvert(itype string) int64 {
|
|
//firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
|
|
//firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
|
|
switch itype {
|
|
switch itype {
|
|
case "firstparty":
|
|
case "firstparty":
|