|
@@ -156,31 +156,6 @@ func (this *UserInfoReq) format(data *map[string]interface{}) *map[string]interf
|
|
return data
|
|
return data
|
|
}
|
|
}
|
|
|
|
|
|
-type EntDeptParent struct {
|
|
|
|
- Id int
|
|
|
|
- Pid int
|
|
|
|
-}
|
|
|
|
-type EntDept struct {
|
|
|
|
- Id int
|
|
|
|
- Pid int
|
|
|
|
- Name string
|
|
|
|
- Nodiff int
|
|
|
|
- Subdis int
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-type EntDistribute struct {
|
|
|
|
- Id string
|
|
|
|
- DeptId int
|
|
|
|
- Area map[string]interface{}
|
|
|
|
- Buyerclass []interface{}
|
|
|
|
- Items []string
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-type EntRuleUser struct {
|
|
|
|
- UserId int
|
|
|
|
- RuleId string
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
//商机管理订阅设置
|
|
//商机管理订阅设置
|
|
func (this *UserInfoReq) EntnicheSub() *map[string]interface{} {
|
|
func (this *UserInfoReq) EntnicheSub() *map[string]interface{} {
|
|
currentUser := &CurrentUser{
|
|
currentUser := &CurrentUser{
|
|
@@ -197,79 +172,22 @@ func (this *UserInfoReq) EntnicheSub() *map[string]interface{} {
|
|
case 1:
|
|
case 1:
|
|
deptId := entInfo.Dept.Id
|
|
deptId := entInfo.Dept.Id
|
|
nodiff := false
|
|
nodiff := false
|
|
|
|
+ res_ := map[string]interface{}{} //临时map
|
|
//我所有的父部门
|
|
//我所有的父部门
|
|
- var EntParentDept = map[int][]*EntDeptParent{}
|
|
|
|
|
|
+ EntParentDept := map[int][]*EntDeptParent{}
|
|
|
|
|
|
//先获取用户组织架构权益
|
|
//先获取用户组织架构权益
|
|
- //查找父级部门(跨级)
|
|
|
|
- list := this.Mysql.SelectBySql(`select id,pid from entniche_department_parent where id =?`, entInfo.Dept.Id)
|
|
|
|
- log.Println(list, entInfo.Dept.Id, entInfo.Dept.Name)
|
|
|
|
- for _, v := range *list {
|
|
|
|
- id := common.IntAll(v["id"])
|
|
|
|
- pid := common.IntAll(v["pid"])
|
|
|
|
- EntParentDept[id] = append(EntParentDept[id], &EntDeptParent{
|
|
|
|
- Id: id,
|
|
|
|
- Pid: pid,
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ EntParentDept = GetEntDeptParent(this.Mysql, EntParentDept, deptId)
|
|
|
|
+
|
|
EntDepts := map[int]*EntDept{}
|
|
EntDepts := map[int]*EntDept{}
|
|
- //查看部门相关设置
|
|
|
|
- lis := this.Mysql.SelectBySql(`select * from entniche_department where ent_id=?`, this.EntId)
|
|
|
|
- for _, v := range *lis {
|
|
|
|
- //获取部门相关
|
|
|
|
- deptid := common.IntAll(v["id"])
|
|
|
|
- pid := common.IntAll(v["pid"])
|
|
|
|
- name := common.ObjToString(v["name"])
|
|
|
|
- subdis := common.IntAll(v["subdis"])
|
|
|
|
- nodiff := common.IntAll(v["nodiff"])
|
|
|
|
- EntDepts[deptid] = &EntDept{
|
|
|
|
- Id: deptid,
|
|
|
|
- Pid: pid,
|
|
|
|
- Name: name,
|
|
|
|
- Nodiff: nodiff,
|
|
|
|
- Subdis: subdis,
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ EntDepts = GetEntDepts(this.Mysql, EntDepts, this.EntId)
|
|
|
|
|
|
- var EntDis = map[string]*EntDistribute{} //分发规则的相关设置
|
|
|
|
- var EntUserRules = map[int][]*EntRuleUser{} //用户下所有的分发规则
|
|
|
|
- var res_ = map[string]interface{}{} //临时map
|
|
|
|
|
|
+ // //用户下所有的分发规则
|
|
|
|
+ EntUserRules := GetUserRules(this.Mysql, this.EntUserId)
|
|
|
|
|
|
- // 分发规则遍历 查询用户是否有被分发的规则
|
|
|
|
- data := this.Mysql.SelectBySql(`SELECT * FROM entniche_user_rule WHERE user_id=?`, this.EntUserId)
|
|
|
|
- if data != nil {
|
|
|
|
- for _, v := range *data {
|
|
|
|
- ruleId := common.ObjToString(v["rule_id"])
|
|
|
|
- userId := common.IntAll(v["user_id"])
|
|
|
|
- entRuleUser := &EntRuleUser{
|
|
|
|
- UserId: userId,
|
|
|
|
- RuleId: ruleId,
|
|
|
|
- }
|
|
|
|
- EntUserRules[userId] = append(EntUserRules[userId], entRuleUser)
|
|
|
|
|
|
+ ///分发规则的相关设置
|
|
|
|
+ EntDis := GetEntDistribute(this.Mgo, this.EntId)
|
|
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //获取具体分发规则
|
|
|
|
- disData, ok := this.Mgo.Find("entniche_distribute", map[string]interface{}{
|
|
|
|
- "i_status": map[string]interface{}{"$ne": 1},
|
|
|
|
- "i_entid": this.EntId,
|
|
|
|
- }, nil, nil, false, -1, -1)
|
|
|
|
- if ok && disData != nil && len(*disData) > 0 {
|
|
|
|
- for _, v := range *disData {
|
|
|
|
- deptId := common.IntAll(v["i_deptid"])
|
|
|
|
- a_items, _ := v["a_items"].([]interface{})
|
|
|
|
- o_area, _ := v["o_area"].(map[string]interface{})
|
|
|
|
- a_buyerclass, _ := v["a_buyerclass"].([]interface{})
|
|
|
|
- ruleId := mongodb.BsonIdToSId(v["_id"])
|
|
|
|
- EntDis[ruleId] = &EntDistribute{
|
|
|
|
- Id: ruleId,
|
|
|
|
- DeptId: deptId,
|
|
|
|
- Area: o_area,
|
|
|
|
- Buyerclass: a_buyerclass,
|
|
|
|
- Items: common.ObjArrToStringArr(a_items),
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
//我的上级部门
|
|
//我的上级部门
|
|
for _, v := range EntParentDept[entInfo.Dept.Id] {
|
|
for _, v := range EntParentDept[entInfo.Dept.Id] {
|
|
//看我的上级部门,有没有开启订阅分发
|
|
//看我的上级部门,有没有开启订阅分发
|