commit
b528f1e147
@ -1,8 +1,10 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"ferry/global/orm"
|
"ferry/global/orm"
|
||||||
"ferry/models/system"
|
"ferry/models/system"
|
||||||
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -51,6 +53,7 @@ func GetPrincipalUserInfo(stateList []interface{}, creator int) (userInfoList []
|
|||||||
userInfo system.SysUser
|
userInfo system.SysUser
|
||||||
deptInfo system.Dept
|
deptInfo system.Dept
|
||||||
userInfoListTmp []system.SysUser // 临时保存查询的列表数据
|
userInfoListTmp []system.SysUser // 临时保存查询的列表数据
|
||||||
|
processorList []interface{}
|
||||||
)
|
)
|
||||||
|
|
||||||
err = orm.Eloquent.Model(&userInfo).Where("user_id = ?", creator).Find(&userInfo).Error
|
err = orm.Eloquent.Model(&userInfo).Where("user_id = ?", creator).Find(&userInfo).Error
|
||||||
@ -59,17 +62,31 @@ func GetPrincipalUserInfo(stateList []interface{}, creator int) (userInfoList []
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, stateItem := range stateList {
|
for _, stateItem := range stateList {
|
||||||
|
|
||||||
|
if reflect.TypeOf(stateItem.(map[string]interface{})["processor"]) == nil {
|
||||||
|
err = errors.New("未找到对应的处理人,请确认。")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
stateItemType := reflect.TypeOf(stateItem.(map[string]interface{})["processor"]).String()
|
||||||
|
if stateItemType == "[]int" {
|
||||||
|
for _, v := range stateItem.(map[string]interface{})["processor"].([]int) {
|
||||||
|
processorList = append(processorList, v)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
processorList = stateItem.(map[string]interface{})["processor"].([]interface{})
|
||||||
|
}
|
||||||
|
|
||||||
switch stateItem.(map[string]interface{})["process_method"] {
|
switch stateItem.(map[string]interface{})["process_method"] {
|
||||||
case "person":
|
case "person":
|
||||||
err = orm.Eloquent.Model(&system.SysUser{}).
|
err = orm.Eloquent.Model(&system.SysUser{}).
|
||||||
Where("user_id in (?)", stateItem.(map[string]interface{})["processor"].([]interface{})).
|
Where("user_id in (?)", processorList).
|
||||||
Find(&userInfoListTmp).Error
|
Find(&userInfoListTmp).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
userInfoList = append(userInfoList, userInfoListTmp...)
|
userInfoList = append(userInfoList, userInfoListTmp...)
|
||||||
case "variable": // 变量
|
case "variable": // 变量
|
||||||
for _, processor := range stateItem.(map[string]interface{})["processor"].([]interface{}) {
|
for _, processor := range processorList {
|
||||||
if int(processor.(float64)) == 1 {
|
if int(processor.(float64)) == 1 {
|
||||||
// 创建者
|
// 创建者
|
||||||
userInfoList = append(userInfoList, userInfo)
|
userInfoList = append(userInfoList, userInfo)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user