应用集成平台服务端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

132 lines
2.8 KiB

package taskflowing
import (
"appPlatform/models/modelshr"
"appPlatform/overall"
"appPlatform/overall/publicmethod"
"strconv"
)
/*
*
@ 作者: 秦东
@ 时间: 2023-11-25 13:14:11
@ 功能: 获取流程管理员人员
@ 参数
#role 角色ID
@ 返回值
#
@ 方法原型
#
*/
func GainFlowRoleUser(role int) (Operator []OperatorList, userKey []string) {
var userInfoAry []modelshr.ManCont
overall.CONSTANT_DB_HR.Model(&modelshr.ManCont{}).Select("`key`,`name`,`number`,`icon`,`icon_photo`,`wechat`,`work_wechat`,`admin_org`,`position`,`teamid`,`mobilephone`,`company`").Where("FIND_IN_SET(?,`role`) AND `emp_type` BETWEEN ? AND ?", role, 1, 10).Find(&userInfoAry)
if len(userInfoAry) > 0 {
for _, uv := range userInfoAry {
Operator = append(Operator, TransformPublicUs(uv))
usKey := strconv.FormatInt(uv.Key, 10)
if !publicmethod.IsInTrue[string](usKey, userKey) {
userKey = append(userKey, usKey)
}
}
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2023-11-25 13:29:04
@ 功能: 判断操作人是否已经操作过,并写入操作记录
@ 参数
#userKey 当前操作人
#runId 执行码
#Operator 操作人
@ 返回值
#isTrue
@ 方法原型
#func JudgeOperUser(userKey, runId int64, Operator []OperatorList) (isTrue bool)
*/
func JudgeOperUser(userKey, runId int64, Operator []OperatorList) (bool, string) {
// fmt.Printf("节点审批人--->%v\n", userKey)
if len(Operator) < 1 {
return true, "您不是此节点操作人!请不要提交!"
}
caoZuoQuanXian := true
for _, v := range Operator {
// fmt.Printf("节点审批人--11->%v------>%v------>%v\n", v.Id, userKey, Operator)
// fmt.Printf("节点审批人-13-->%v-->%v\n", userKey, v.Id == strconv.FormatInt(userKey, 10))
if v.Id == strconv.FormatInt(userKey, 10) {
// fmt.Printf("节点审批人-14->%v-->%v\n", userKey, len(v.LogList))
caoZuoQuanXian = false
if len(v.LogList) > 0 {
for _, m := range v.LogList {
if m.UID == strconv.FormatInt(runId, 10) {
return true, "您已经操作过此节点!请不要重复提交!"
}
}
}
}
}
if caoZuoQuanXian {
return true, "您不是此节点操作人!请不要提交!"
}
return false, ""
}
/*
*
@ 作者: 秦东
@ 时间: 2023-11-25 13:50:28
@ 功能: 查询驳回到哪个点
@ 参数
#nodeKey 返回的节点
@ 返回值
#isNew 是否重新发起
@ 方法原型
#
*/
func (r *RunWorkFlow) RejectNode(nodeKey string) (isNew bool) {
if nodeKey == "beginnode" {
r.Step = 1
if r.TotalSteps >= 2 {
r.NextStep = 2
isNew = false
} else {
r.NextStep = 0
isNew = true
}
return
}
for _, v := range r.FlowList {
if nodeKey == v.NodeKey {
r.Step = v.Step
nextStep := v.Step + 1
if nextStep <= r.TotalSteps {
r.NextStep = nextStep
isNew = false
} else {
r.NextStep = 0
isNew = true
}
return
}
}
return
}