|
@@ -5,7 +5,6 @@ import (
|
|
|
"database/sql"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
- "log"
|
|
|
"math"
|
|
|
"sort"
|
|
|
"strings"
|
|
@@ -450,15 +449,10 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
checkCode := []string{}
|
|
|
parentConvList := &nodeTrees{}
|
|
|
convList := &nodeTrees{}
|
|
|
- hasDefaultCheck := false
|
|
|
- if in.ClickId != "" {
|
|
|
- hasDefaultCheck = true
|
|
|
- }
|
|
|
for _, v := range list {
|
|
|
if len(v.Children) == 0 {
|
|
|
continue
|
|
|
}
|
|
|
- parentStartCheckCodeLen := len(checkCode)
|
|
|
pm := &nodeTree{
|
|
|
CODE: v.Name,
|
|
|
NAME: v.Name,
|
|
@@ -524,8 +518,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
}
|
|
|
cccNodes = append(cccNodes, nt)
|
|
|
cccIndexMap[vvv.Name] = len(cccNodes) - 1
|
|
|
- if !hasDefaultCheck || compareId == in.ClickId {
|
|
|
- log.Println("-----1", nt.CODE)
|
|
|
+ if compareId == in.ClickId {
|
|
|
checkCode = append(checkCode, nt.CODE)
|
|
|
}
|
|
|
}
|
|
@@ -561,14 +554,10 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
MYTYPE: "firstparty",
|
|
|
DATACOUNT: dataCount,
|
|
|
}
|
|
|
- if !hasDefaultCheck || compareId == in.ClickId {
|
|
|
- log.Println("-----2", nt.CODE)
|
|
|
+ if compareId == in.ClickId {
|
|
|
checkCode = append(checkCode, nt.CODE)
|
|
|
}
|
|
|
*convList = append(*convList, nt)
|
|
|
- if !hasDefaultCheck {
|
|
|
- hasDefaultCheck = true
|
|
|
- }
|
|
|
}
|
|
|
for _, cccNode := range cccNodes {
|
|
|
*convList = append(*convList, cccNode)
|
|
@@ -612,9 +601,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
MYTYPE: vv.Type,
|
|
|
}
|
|
|
//如果甲方的子节点被选中了,父节点跟着被选中,非甲方的要对比子节点可介绍业主
|
|
|
- if !hasDefaultCheck || (v.Name != "甲方" && in.ClickId != "" && compareId == fmt.Sprint(vv.Id)) {
|
|
|
- log.Println("-----3", cm.CODE)
|
|
|
- hasDefaultCheck = true
|
|
|
+ if v.Name != "甲方" && in.ClickId != "" && compareId == fmt.Sprint(vv.Id) {
|
|
|
checkCode = append(checkCode, cm.CODE)
|
|
|
}
|
|
|
*convList = append(*convList, cm)
|
|
@@ -624,9 +611,6 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
pm.MYTYPE = pMyType
|
|
|
pm.MYID = pMyId
|
|
|
*parentConvList = append(*parentConvList, pm)
|
|
|
- if parentStartCheckCodeLen != len(checkCode) {
|
|
|
- checkCode = append(checkCode, pm.CODE)
|
|
|
- }
|
|
|
}
|
|
|
sort.Sort(convList)
|
|
|
*parentConvList = append(*parentConvList, *convList...)
|
|
@@ -644,6 +628,42 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
} else {
|
|
|
newCheckCode = checkCode
|
|
|
}
|
|
|
+ if len(checkCode) == 0 && len(*parentConvList) > 0 && (*parentConvList)[0].SZ_LEVEL == 0 {
|
|
|
+ if (*parentConvList)[0].NAME == "甲方" {
|
|
|
+ var level1 *nodeTree
|
|
|
+ var level2 *nodeTree
|
|
|
+ var level3 *nodeTree
|
|
|
+ for _, v := range *parentConvList {
|
|
|
+ if (*parentConvList)[0].NAME != v.SZ_PID0 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if level1 == nil && v.SZ_LEVEL == 1 {
|
|
|
+ level1 = v
|
|
|
+ }
|
|
|
+ if level2 == nil && v.SZ_LEVEL == 2 {
|
|
|
+ level2 = v
|
|
|
+ }
|
|
|
+ if level3 == nil && v.SZ_LEVEL == 3 {
|
|
|
+ level3 = v
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if level3 != nil && level2 != nil && level1 != nil && level3.SZ_PID2 == level2.CODE && level2.SZ_PID1 == level1.CODE {
|
|
|
+ checkCode = append(checkCode, level3.CODE)
|
|
|
+ } else if level2 != nil && level1 != nil && level2.SZ_PID1 == level1.CODE {
|
|
|
+ checkCode = append(checkCode, level2.CODE)
|
|
|
+ } else if level1 != nil {
|
|
|
+ checkCode = append(checkCode, level1.CODE)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for _, v := range *parentConvList {
|
|
|
+ if (*parentConvList)[0].NAME != v.SZ_PID0 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ checkCode = append(checkCode, v.CODE)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
reply = &types.Reply{
|
|
|
Data: map[string]interface{}{
|
|
|
"count": count,
|