|
@@ -33,7 +33,7 @@ type networkTreeChild struct {
|
|
|
Count int64 `json:"count"`
|
|
|
Name string `json:"name"`
|
|
|
Id string `json:"id"`
|
|
|
- Type int `json:"type"`
|
|
|
+ Type string `json:"type"`
|
|
|
}
|
|
|
type projectInfo struct {
|
|
|
BuyerCount int64
|
|
@@ -87,7 +87,7 @@ func (n *network) AddOrUpdate(in *types.AddOrUpdateReq) *types.Reply {
|
|
|
r3, _ := CrmMysql.InsertBatchByTx(tx, "crm.connection_introduce", []string{"position_id", "ent_id", "ent_dept_id", "ent_user_id", "connection_id", "relate_id", "relate_name", "itype", "create_time"}, values)
|
|
|
return r2 >= 0 && r3 > 0
|
|
|
}
|
|
|
- itype := n.TypeConvert(in.Type)
|
|
|
+ itype := n.TypeStrConvert(in.Type)
|
|
|
if in.Id > 0 {
|
|
|
if CrmMysql.ExecTx("更新人脉", func(tx *sql.Tx) bool {
|
|
|
if in.Company_id != "" {
|
|
@@ -250,7 +250,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
ntc := &networkTreeChild{
|
|
|
Name: cName,
|
|
|
Id: cId,
|
|
|
- Type: 1,
|
|
|
+ Type: "firstparty",
|
|
|
}
|
|
|
if wh != "" {
|
|
|
thisArgs := []interface{}{ntc.Id}
|
|
@@ -319,7 +319,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
ntc := &networkTreeChild{
|
|
|
Name: company_name,
|
|
|
Id: ObjToString(v["company_id"]),
|
|
|
- Type: IntAll(v["itype"]),
|
|
|
+ Type: n.TypeIntConvert(Int64All(v["itype"])),
|
|
|
}
|
|
|
if wh != "" {
|
|
|
thisArgs := []interface{}{ntc.Id}
|
|
@@ -343,10 +343,52 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
|
|
|
}
|
|
|
wait.Wait()
|
|
|
}
|
|
|
+ convList := []map[string]interface{}{}
|
|
|
+ for _, v := range list {
|
|
|
+ pm := map[string]interface{}{
|
|
|
+ "CODE": v.Name,
|
|
|
+ "NAME": v.Name,
|
|
|
+ "SZ_PID0": v.Name,
|
|
|
+ "SZ_LEVEL": 0,
|
|
|
+ "datacount": 0,
|
|
|
+ }
|
|
|
+ if len(v.Children) > 0 {
|
|
|
+ pm["SZ_LEAF"] = 0
|
|
|
+ } else {
|
|
|
+ pm["SZ_LEAF"] = 1
|
|
|
+ }
|
|
|
+ ID := ""
|
|
|
+ pType := ""
|
|
|
+ for _, vv := range v.Children {
|
|
|
+ if ID != "" {
|
|
|
+ ID += ","
|
|
|
+ }
|
|
|
+ if pType != "" {
|
|
|
+ pType += ","
|
|
|
+ }
|
|
|
+ ID += vv.Id
|
|
|
+ pType += vv.Type
|
|
|
+ cm := map[string]interface{}{
|
|
|
+ "NAME": v.Name,
|
|
|
+ "ID": vv.Id,
|
|
|
+ "SZ_PID1": v.Name + ":" + vv.Id,
|
|
|
+ "CODE": v.Name + ":" + vv.Id,
|
|
|
+ "PCODE": v.Name,
|
|
|
+ "datacount": vv.Count,
|
|
|
+ "SZ_LEVEL": 1,
|
|
|
+ "SZ_LEAF": 1,
|
|
|
+ "type": vv.Type,
|
|
|
+ }
|
|
|
+ convList = append(convList, cm)
|
|
|
+ }
|
|
|
+ pm["ID"] = ID
|
|
|
+ pm["type"] = pType
|
|
|
+ convList = append(convList, pm)
|
|
|
+ }
|
|
|
reply = &types.Reply{
|
|
|
Data: map[string]interface{}{
|
|
|
"count": count,
|
|
|
- "list": list,
|
|
|
+ "list": convList,
|
|
|
},
|
|
|
}
|
|
|
return reply
|
|
@@ -359,7 +401,7 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
|
|
|
args := []interface{}{in.PositionId}
|
|
|
if in.Type != "" {
|
|
|
q += ` and a.itype=?`
|
|
|
- args = append(args, n.TypeConvert(in.Type))
|
|
|
+ args = append(args, n.TypeStrConvert(in.Type))
|
|
|
}
|
|
|
if in.Starttime != "" {
|
|
|
q += ` and a.create_time>=?`
|
|
@@ -839,7 +881,7 @@ func (n *network) Introduce_Middleman(values []string, entMonitor map[string]boo
|
|
|
}
|
|
|
|
|
|
//
|
|
|
-func (n *network) TypeConvert(itype string) int {
|
|
|
+func (n *network) TypeStrConvert(itype string) int {
|
|
|
//firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
|
|
|
switch itype {
|
|
|
case "firstparty":
|
|
@@ -855,3 +897,21 @@ func (n *network) TypeConvert(itype string) int {
|
|
|
}
|
|
|
return 0
|
|
|
}
|
|
|
+
|
|
|
+//
|
|
|
+func (n *network) TypeIntConvert(itype int64) string {
|
|
|
+ //firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
|
|
|
+ switch itype {
|
|
|
+ case 1:
|
|
|
+ return "firstparty"
|
|
|
+ case 2:
|
|
|
+ return "supplier"
|
|
|
+ case 3:
|
|
|
+ return "adiffb"
|
|
|
+ case 4:
|
|
|
+ return "middleman"
|
|
|
+ case 5:
|
|
|
+ return "agency"
|
|
|
+ }
|
|
|
+ return ""
|
|
|
+}
|