|
@@ -90,6 +90,7 @@ type introduceOwnerProject struct {
|
|
|
Networks []*myNetwork
|
|
|
FirstpartyNetwork map[string][]*firstpartyNetwork
|
|
|
Firstparty map[string]*projectInfo
|
|
|
+ FirstpartyPio map[string]*projectInfo
|
|
|
Supplier map[string]*projectInfo
|
|
|
Adiffb map[string]*projectInfo
|
|
|
Agency map[string]*projectInfo
|
|
@@ -333,13 +334,13 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
businessType := strings.Split(FindBusiness(in.EntId, in.MgoUserId), ",")
|
|
|
var count int64
|
|
|
var list []*networkTree
|
|
|
- firstparty := map[string]*projectInfo{}
|
|
|
+ firstparty, firstpartyPio := map[string]*projectInfo{}, map[string]*projectInfo{}
|
|
|
firstpartyChild := map[string][]*firstpartyNetwork{}
|
|
|
if in.Id != "" {
|
|
|
if in.Type == "firstparty" {
|
|
|
fpn := n.FirstpartyNetwork(in.Name, []string{in.Id})
|
|
|
if fpn[in.Id] != nil {
|
|
|
- firstparty = n.Introduce_Firstparty(fpn, businessType)
|
|
|
+ firstparty, firstpartyPio = n.Introduce_Firstparty(fpn, businessType)
|
|
|
nameIndex := map[string]int{}
|
|
|
for _, v := range fpn[in.Id] {
|
|
|
if _, ok := nameIndex[v.Name]; !ok {
|
|
@@ -378,6 +379,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
redis.Put("newother", key, aio, NetworkCom.CacheTimeout())
|
|
|
}
|
|
|
firstparty = aio.Firstparty
|
|
|
+ firstpartyPio = aio.FirstpartyPio
|
|
|
firstpartyChild = aio.FirstpartyNetwork
|
|
|
list = []*networkTree{
|
|
|
&networkTree{
|
|
@@ -448,7 +450,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
list[v.Itype-1].Children = append(list[v.Itype-1].Children, ntc)
|
|
|
}
|
|
|
}
|
|
|
- checkCode := []string{}
|
|
|
+ checkCode := []*nodeTree{}
|
|
|
parentConvList := &nodeTrees{}
|
|
|
convList := &nodeTrees{}
|
|
|
for _, v := range list {
|
|
@@ -494,8 +496,8 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
}
|
|
|
cccIndex, cccOk := cccIndexMap[vvv.Name]
|
|
|
var dataCount int64
|
|
|
- if firstparty[vvv.CompanyId] != nil {
|
|
|
- dataCount = firstparty[vvv.CompanyId].ProjectCount
|
|
|
+ if firstpartyPio[vvv.CompanyId] != nil {
|
|
|
+ dataCount = firstpartyPio[vvv.CompanyId].ProjectCount
|
|
|
}
|
|
|
if cccOk {
|
|
|
cccNodes[cccIndex].ID += "," + vvv.CompanyId
|
|
@@ -522,7 +524,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
cccNodes = append(cccNodes, nt)
|
|
|
cccIndexMap[vvv.Name] = len(cccNodes) - 1
|
|
|
if compareId == in.ClickId {
|
|
|
- checkCode = append(checkCode, nt.CODE)
|
|
|
+ checkCode = append(checkCode, nt)
|
|
|
}
|
|
|
}
|
|
|
if id != "" {
|
|
@@ -558,7 +560,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
DATACOUNT: dataCount,
|
|
|
}
|
|
|
if compareId == in.ClickId {
|
|
|
- checkCode = append(checkCode, nt.CODE)
|
|
|
+ checkCode = append(checkCode, nt)
|
|
|
}
|
|
|
*convList = append(*convList, nt)
|
|
|
}
|
|
@@ -608,7 +610,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
}
|
|
|
//如果甲方的子节点被选中了,父节点跟着被选中,非甲方的要对比子节点可介绍业主
|
|
|
if thisLength == len(checkCode) && ((in.ClickId != "" && in.ClickId == fmt.Sprint(vv.Id)) || (in.CheckCode != "" && compareId == fmt.Sprint(vv.Id))) {
|
|
|
- checkCode = append(checkCode, cm.CODE)
|
|
|
+ checkCode = append(checkCode, cm)
|
|
|
}
|
|
|
*convList = append(*convList, cm)
|
|
|
}
|
|
@@ -627,12 +629,15 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
m[v] = true
|
|
|
}
|
|
|
for _, v := range checkCode {
|
|
|
- if m[v] {
|
|
|
- newCheckCode = append(newCheckCode, v)
|
|
|
+ if !m[v.SZ_PID0] && !m[v.SZ_PID1] && !m[v.SZ_PID2] && !m[v.SZ_PID3] {
|
|
|
+ continue
|
|
|
}
|
|
|
+ newCheckCode = append(newCheckCode, v.CODE)
|
|
|
}
|
|
|
} else {
|
|
|
- newCheckCode = checkCode
|
|
|
+ for _, v := range checkCode {
|
|
|
+ newCheckCode = append(newCheckCode, v.CODE)
|
|
|
+ }
|
|
|
}
|
|
|
if in.CheckCode == "" && in.ClickId == "" && len(newCheckCode) == 0 && len(*parentConvList) > 0 && (*parentConvList)[0].SZ_LEVEL == 0 {
|
|
|
if (*parentConvList)[0].NAME == "甲方" {
|
|
@@ -1021,7 +1026,7 @@ func (n *network) FirstpartyNetwork(name string, values []string) map[string][]*
|
|
|
return result
|
|
|
}
|
|
|
|
|
|
-func (n *network) Introduce_Firstparty(fpn map[string][]*firstpartyNetwork, businessType []string) map[string]*projectInfo {
|
|
|
+func (n *network) Introduce_Firstparty(fpn map[string][]*firstpartyNetwork, businessType []string) (map[string]*projectInfo, map[string]*projectInfo) {
|
|
|
values := []string{}
|
|
|
vm := map[string]*projectInfo{}
|
|
|
for _, v := range fpn {
|
|
@@ -1032,7 +1037,7 @@ func (n *network) Introduce_Firstparty(fpn map[string][]*firstpartyNetwork, busi
|
|
|
}
|
|
|
result := map[string]*projectInfo{}
|
|
|
if len(values) == 0 {
|
|
|
- return result
|
|
|
+ return result, vm
|
|
|
}
|
|
|
wh, args := WhArgs(values)
|
|
|
q := `select buyer_id,count(project_id) AS project_count,sum(project_money) AS project_amount,groupUniqArray(project_id) from information.transaction_info_all prewhere buyer_id in (` + wh + `) and zbtime>? and project_bidstatus>1`
|
|
@@ -1046,7 +1051,7 @@ func (n *network) Introduce_Firstparty(fpn map[string][]*firstpartyNetwork, busi
|
|
|
rows, err := ClickhouseConn.Query(context.Background(), q, args...)
|
|
|
if err != nil {
|
|
|
logx.Error(err)
|
|
|
- return nil
|
|
|
+ return result, vm
|
|
|
}
|
|
|
for rows.Next() {
|
|
|
var (
|
|
@@ -1085,7 +1090,7 @@ func (n *network) Introduce_Firstparty(fpn map[string][]*firstpartyNetwork, busi
|
|
|
result[k].ExportId = append(result[k].ExportId, vm[vv.CompanyId].ExportId...)
|
|
|
}
|
|
|
}
|
|
|
- return result
|
|
|
+ return result, vm
|
|
|
}
|
|
|
|
|
|
func (n *network) Introduce_Supplier(values []string, businessType []string) map[string]*projectInfo {
|
|
@@ -1503,7 +1508,7 @@ func (n *network) AllIntroduceOwner(positionId int64, sqlAppend1, sqlAppend2 str
|
|
|
if isTjProject {
|
|
|
iop.FirstpartyNetwork = n.FirstpartyNetwork("", firstparty_array)
|
|
|
logx.Info(positionId, " FirstpartyNetwork over 。。。")
|
|
|
- iop.Firstparty = n.Introduce_Firstparty(iop.FirstpartyNetwork, businessType)
|
|
|
+ iop.Firstparty, iop.FirstpartyPio = n.Introduce_Firstparty(iop.FirstpartyNetwork, businessType)
|
|
|
logx.Info(positionId, " Introduce_Firstparty over 。。。")
|
|
|
iop.Supplier = n.Introduce_Supplier(supplier_array, businessType)
|
|
|
logx.Info(positionId, " Introduce_Supplier over 。。。")
|