|
@@ -38,27 +38,27 @@ type networkTreeChild struct {
|
|
|
CreateTime string `json:"createTime"`
|
|
|
}
|
|
|
|
|
|
-func (s *networkTree) Len() int {
|
|
|
- return len(s.Children)
|
|
|
+func (n *networkTree) Len() int {
|
|
|
+ return len(n.Children)
|
|
|
}
|
|
|
|
|
|
-func (s *networkTree) Less(i, j int) bool {
|
|
|
- if s.Name == "甲方" {
|
|
|
- return s.Children[i].CompanyName < s.Children[j].CompanyName
|
|
|
+func (n *networkTree) Less(i, j int) bool {
|
|
|
+ if n.Name == "甲方" {
|
|
|
+ return n.Children[i].CompanyName < n.Children[j].CompanyName
|
|
|
}
|
|
|
- it, err1 := time.ParseInLocation(Date_Full_Layout, s.Children[i].CreateTime, time.Local)
|
|
|
+ it, err1 := time.ParseInLocation(Date_Full_Layout, n.Children[i].CreateTime, time.Local)
|
|
|
if err1 != nil {
|
|
|
return true
|
|
|
}
|
|
|
- jt, err2 := time.ParseInLocation(Date_Full_Layout, s.Children[j].CreateTime, time.Local)
|
|
|
+ jt, err2 := time.ParseInLocation(Date_Full_Layout, n.Children[j].CreateTime, time.Local)
|
|
|
if err2 != nil {
|
|
|
return true
|
|
|
}
|
|
|
return it.Unix() < jt.Unix()
|
|
|
}
|
|
|
|
|
|
-func (s *networkTree) Swap(i, j int) {
|
|
|
- s.Children[i], s.Children[j] = s.Children[j], s.Children[i]
|
|
|
+func (n *networkTree) Swap(i, j int) {
|
|
|
+ n.Children[i], n.Children[j] = n.Children[j], n.Children[i]
|
|
|
}
|
|
|
|
|
|
type projectInfo struct {
|
|
@@ -119,6 +119,23 @@ type nodeTree struct {
|
|
|
MYTYPE string
|
|
|
}
|
|
|
|
|
|
+type nodeTrees []*nodeTree
|
|
|
+
|
|
|
+func (n *nodeTrees) Len() int {
|
|
|
+ return len(*n)
|
|
|
+}
|
|
|
+
|
|
|
+func (n *nodeTrees) Less(i, j int) bool {
|
|
|
+ if (*n)[i].PCODE == (*n)[j].PCODE {
|
|
|
+ return (*n)[i].CODE < (*n)[j].CODE
|
|
|
+ }
|
|
|
+ return (*n)[i].PCODE < (*n)[j].PCODE
|
|
|
+}
|
|
|
+
|
|
|
+func (n *nodeTrees) Swap(i, j int) {
|
|
|
+ (*n)[i], (*n)[j] = (*n)[j], (*n)[i]
|
|
|
+}
|
|
|
+
|
|
|
//人脉库-添加/修改人脉
|
|
|
func (n *network) AddOrUpdate(in *types.AddOrUpdateReq) *types.Reply {
|
|
|
reply := &types.Reply{Data: map[string]interface{}{
|
|
@@ -408,7 +425,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
list[v.Itype-1].Children = append(list[v.Itype-1].Children, ntc)
|
|
|
}
|
|
|
}
|
|
|
- convList := []*nodeTree{}
|
|
|
+ convList := &nodeTrees{}
|
|
|
for _, v := range list {
|
|
|
pm := &nodeTree{
|
|
|
CODE: v.Name,
|
|
@@ -481,7 +498,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
myChildTypes += ","
|
|
|
}
|
|
|
myChildTypes += vv.Type
|
|
|
- convList = append(convList, &nodeTree{
|
|
|
+ *convList = append(*convList, &nodeTree{
|
|
|
NAME: vvv.CompanyName,
|
|
|
ID: vvv.CompanyId,
|
|
|
SZ_PID0: v.Name,
|
|
@@ -498,7 +515,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
})
|
|
|
}
|
|
|
for _, cccNode := range cccNodes {
|
|
|
- convList = append(convList, cccNode)
|
|
|
+ *convList = append(*convList, cccNode)
|
|
|
}
|
|
|
} else {
|
|
|
if id != "" {
|
|
@@ -526,14 +543,15 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
MYID: myId,
|
|
|
MYTYPE: vv.Type,
|
|
|
}
|
|
|
- convList = append(convList, cm)
|
|
|
+ *convList = append(*convList, cm)
|
|
|
}
|
|
|
pm.ID = id
|
|
|
pm.TYPE = pType
|
|
|
pm.MYTYPE = pMyType
|
|
|
pm.MYID = pMyId
|
|
|
- convList = append(convList, pm)
|
|
|
+ *convList = append(*convList, pm)
|
|
|
}
|
|
|
+ sort.Sort(convList)
|
|
|
reply = &types.Reply{
|
|
|
Data: map[string]interface{}{
|
|
|
"count": count,
|