Browse Source

工作流重新提交,删除功能

v1
超级管理员 2 years ago
parent
commit
d40d0aa1a5
  1. 4
      api/version1/taskplatform/taskflow/judgmentFlow.go
  2. 2
      api/version1/taskplatform/taskflow/runflow.go
  3. 391
      api/version1/taskplatform/taskflow/taskFlow.go
  4. 3
      api/version1/taskplatform/taskflow/types.go
  5. 227
      api/version1/taskplatform/taskflow/workFlowRun.go
  6. 126
      api/version1/taskplatform/taskmanagement/appform.go
  7. 25
      apirouter/v1/taskrouter/taskrouter.go
  8. 3
      initialization/route/initRoute.go
  9. 1
      models/modelAppPlatform/run_task_flow.go
  10. 41
      overall/publicmethod/technique.go
  11. 4
      overall/publicmethod/type.go

4
api/version1/taskplatform/taskflow/judgmentFlow.go

@ -59,12 +59,16 @@ func GainFlowRoleUser(role int) (Operator []OperatorList, userKey []string) {
#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 {

2
api/version1/taskplatform/taskflow/runflow.go

@ -789,7 +789,7 @@ func (m *MultiLeveUserList) GainOrgPostPeople(orgId []int64, options []OptionsIn
}
if len(postId) > 0 {
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("`person_in_charge` = 1 AND `admin_org` IN ? AND position = ? AND `emp_type` BETWEEN ? AND ?", orgId, postId, 1, 10).Find(&userInfoAry)
overall.CONSTANT_DB_HR.Model(&modelshr.ManCont{}).Select("`key`,`name`,`number`,`icon`,`icon_photo`,`wechat`,`work_wechat`,`admin_org`,`position`,`teamid`,`mobilephone`,`company`").Where("`person_in_charge` = 1 AND `admin_org` IN ? AND position IN ? AND `emp_type` BETWEEN ? AND ?", orgId, postId, 1, 10).Find(&userInfoAry)
if len(userInfoAry) > 0 {
for _, uv := range userInfoAry {
m.UserList = append(m.UserList, TransformPublicUs(uv))

391
api/version1/taskplatform/taskflow/taskFlow.go

@ -53,11 +53,11 @@ func (a *ApiMethod) TaskFlowList(c *gin.Context) {
case 2: //待办事宜
gormDb = gormDb.Where("`status` = 3 AND FIND_IN_SET(?,`next_executor`)", userCont.Key)
case 3: //已办事宜
gormDb = gormDb.Where("`status` IN (3,4) AND FIND_IN_SET(?,`participants`) AND NOT FIND_IN_SET(?,`next_executor`) AND `creater` <> ?", userCont.Key, userCont.Key, userCont.Key)
gormDb = gormDb.Where("`status` IN (2,3,4) AND FIND_IN_SET(?,`participants`) AND NOT FIND_IN_SET(?,`next_executor`) AND `creater` <> ?", userCont.Key, userCont.Key, userCont.Key)
case 4: //草稿箱
gormDb = gormDb.Where("`status` = 1 AND `creater` = ?", userCont.Key)
default: //我的请求
gormDb = gormDb.Where("`creater` = ?", userCont.Key)
gormDb = gormDb.Where("`status` IN (1,2,3,4) AND `creater` = ?", userCont.Key)
}
if requestData.Title != "" {
gormDb = gormDb.Where("`title` LIKE ?", "%"+requestData.Title+"%")
@ -82,6 +82,8 @@ func (a *ApiMethod) TaskFlowList(c *gin.Context) {
}
overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.RunTaskFlow{}).Where("`id` IN ?", idAry).Order("`start_time` desc").Find(&userList)
for i := 0; i < len(userList); i++ {
userList[i].FormVersionId = strconv.FormatInt(userList[i].VersionId, 10)
userList[i].IdStr = strconv.FormatInt(userList[i].Id, 10)
userList[i].FlowKeys = strconv.FormatInt(userList[i].FlowKey, 10)
userList[i].CreaterInfo = GainSmaillUserInfo[int64](userList[i].Creater)
if userList[i].NextExecutor != "" {
@ -92,7 +94,7 @@ func (a *ApiMethod) TaskFlowList(c *gin.Context) {
}
userList[i].StartDate = publicmethod.UnixTimeToDay(userList[i].StartTime, 27)
if userList[i].NextStep != 0 {
nodeCont, idTrue := GainCurreNode(userList[i].FlowCont, userList[i].CurrentStep)
nodeCont, idTrue := GainCurreNode(userList[i].FlowCont, userList[i].CurrentStep, userList[i].NextStep, userList[i].Status)
if idTrue {
userList[i].CurrentNodeName = nodeCont.NodeName
}
@ -157,7 +159,7 @@ func GainTaskFormData(taskId int64) (mastesform, mastesformjson string) {
#
*/
func GainCurreNode(flowStr string, step int) (nodeInfo RunFlow, isOk bool) {
func GainCurreNode(flowStr string, step, nextStep, state int) (nodeInfo RunFlow, isOk bool) {
if flowStr == "" {
return
}
@ -166,6 +168,24 @@ func GainCurreNode(flowStr string, step int) (nodeInfo RunFlow, isOk bool) {
if err != nil {
return
}
if nextStep == 0 {
step = len(flowAry)
} else {
switch state {
case 1:
step = 0
case 2:
if step != 1 {
step = step + 1
}
case 3:
step = step + 1
case 4:
step = len(flowAry)
default:
step = step + 1
}
}
for _, v := range flowAry {
if v.Step == step {
nodeInfo = v
@ -258,10 +278,11 @@ func (a *ApiMethod) GainRunTaskFlow(c *gin.Context) {
return
}
//判断是否需要回写流程记录
flowAry, operational := CheckMakeCopy(runFlowInfo.FlowKey, runFlowInfo.CurrentStep, flowList, userCont)
flowAry, operational := CheckMakeCopy(runFlowInfo.FlowKey, runFlowInfo.RunKey, runFlowInfo.Status, runFlowInfo.CurrentStep, flowList, userCont)
sendMap := publicmethod.MapOut[string]()
sendMap["flowList"] = flowAry
sendMap["operational"] = operational
sendMap["current_step"] = runFlowInfo.CurrentStep
publicmethod.Result(0, sendMap, c)
}
@ -285,23 +306,30 @@ func (a *ApiMethod) GainRunTaskFlow(c *gin.Context) {
#
*/
func CheckMakeCopy(uuid int64, endStep int, flowList []RunFlow, userCont modelshr.ManCont) (flowMap []RunFlow, operational bool) {
func CheckMakeCopy(uuid, runKey int64, state int, currepStep int, flowList []RunFlow, userCont modelshr.ManCont) (flowMap []RunFlow, operational bool) {
if len(flowList) < 1 {
return
}
endStep := currepStep + 1
if endStep >= len(flowList) {
endStep = len(flowList)
}
fmt.Printf("currepStep:%v---->endStep:%v\n", currepStep, endStep)
operational = false
isWrite := false
userKey := strconv.FormatInt(userCont.Key, 10)
var cureeNode RunFlow
for i := 0; i < len(flowList); i++ { //梳理抄送节点
if flowList[i].Step == endStep {
cureeNode = flowList[i]
switch flowList[i].ExamineMode {
case 1:
operational = ApprovalInSequence(flowList[i].Operator, userCont)
case 2:
operational = NotSignJointly(flowList[i].Operator, userCont)
operational = NotSignJointly(runKey, state, flowList[i].Operator, userCont)
case 3:
operational = NotSignJointly(flowList[i].Operator, userCont)
operational = NotSignJointly(runKey, state, flowList[i].Operator, userCont)
default:
for m := 0; m < len(flowList[i].Operator); m++ {
if flowList[i].Operator[m].Id == userKey {
@ -309,6 +337,7 @@ func CheckMakeCopy(uuid int64, endStep int, flowList []RunFlow, userCont modelsh
}
}
}
fmt.Printf("currepStep:%v---->endStep:%v\n", flowList[i].ExamineMode, operational)
}
if flowList[i].Types != 0 {
if flowList[i].Step <= endStep {
@ -342,29 +371,37 @@ func CheckMakeCopy(uuid int64, endStep int, flowList []RunFlow, userCont modelsh
if timeStep <= 0 {
timeStep = 1
}
for k := 0; k < len(flowList); k++ {
if flowList[k].Step <= endStep {
flowList[k].RunType = 0
flowList[k].RunScope = 0
fmt.Printf("operational--->%v\n", operational)
if operational {
for k := 0; k < len(flowList); k++ {
if flowList[k].Step <= endStep {
flowList[k].RunType = 0
flowList[k].RunScope = 0
}
}
if flowList[k].Step >= endStep {
if flowList[k].Step >= endStep {
if flowList[k].CustomNode == cureeNode.NodeKey {
if flowList[k].RunScope == 0 {
flowList[k].RunScope = 1
}
// fmt.Printf("cureeNode.CustomNode =====> %v =====> %v =====> %v =====> %v\n", flowList[k].Step, endStep, flowList[k].CustomNode == cureeNode.NodeKey, flowList[timeStep].Operator)
if flowList[k].CustomNode == cureeNode.NodeKey {
if flowList[k].RunScope == 0 {
flowList[k].RunScope = 1
}
// fmt.Printf("cureeNode.CustomNode =====> %v =====> %v =====> %v =====> %v\n", flowList[k].Step, endStep, flowList[k].CustomNode == cureeNode.NodeKey, flowList[timeStep].Operator)
for j := 0; j < len(flowList[timeStep].Operator); j++ {
for j := 0; j < len(flowList[timeStep].Operator); j++ {
if flowList[timeStep].Operator[j].Id == userKey {
flowList[k].JudgeList = true
if flowList[timeStep].Operator[j].Id == userKey {
flowList[k].JudgeList = true
}
}
}
}
}
} else {
for k := 0; k < len(flowList); k++ {
flowList[k].JudgeList = false
}
}
flowMap = flowList
return
@ -389,9 +426,11 @@ func CheckMakeCopy(uuid int64, endStep int, flowList []RunFlow, userCont modelsh
*/
func ApprovalInSequence(Operator []OperatorList, userCont modelshr.ManCont) bool {
allAry := len(Operator)
if allAry < 1 {
return false
}
userKey := strconv.FormatInt(userCont.Key, 10)
if allAry == 1 {
for _, v := range Operator {
@ -402,19 +441,35 @@ func ApprovalInSequence(Operator []OperatorList, userCont modelshr.ManCont) bool
}
minVal := 0
for _, v := range Operator {
if minVal >= len(v.LogList) {
if minVal <= len(v.LogList) {
minVal = len(v.LogList)
}
}
fmt.Printf("依次审批--a-->%v---->%v---->%v\n", minVal, len(Operator), allAry)
if minVal == 0 {
for i, v := range Operator {
fmt.Printf("依次审批---->%v---->%v\n", i, v.Name)
if v.Id == userKey {
if i == 0 {
return true
}
}
}
return false
}
endTrue := true
for i := 0; i < allAry-2; i++ {
if len(Operator[i].LogList) <= minVal && len(Operator[i].LogList) <= len(Operator[i+1].LogList) {
if Operator[i].Id == userKey {
endTrue = false
return true
if allAry >= 2 {
for i := 0; i < allAry-2; i++ {
if len(Operator[i].LogList) <= minVal && len(Operator[i].LogList) <= len(Operator[i+1].LogList) {
if Operator[i].Id == userKey {
endTrue = false
return true
}
}
}
}
if endTrue {
if Operator[allAry-1].Id == userKey {
return true
@ -441,24 +496,26 @@ func ApprovalInSequence(Operator []OperatorList, userCont modelshr.ManCont) bool
#
*/
func NotSignJointly(Operator []OperatorList, userCont modelshr.ManCont) bool {
func NotSignJointly(runKey int64, state int, Operator []OperatorList, userCont modelshr.ManCont) bool {
if len(Operator) < 1 {
return false
}
userMap := make(map[string]int)
minVal := 0
for _, v := range Operator {
userMap[v.Id] = len(v.LogList)
if minVal >= len(v.LogList) {
minVal = len(v.LogList)
}
if state != 3 {
return false
}
userKey := strconv.FormatInt(userCont.Key, 10)
for i, m := range userMap {
if m == minVal && i == userKey {
runKeyStr := strconv.FormatInt(runKey, 10)
for _, v := range Operator {
if v.Id == userKey {
for _, lv := range v.LogList {
if lv.UID == runKeyStr {
return false
}
}
return true
}
}
return false
}
@ -517,31 +574,85 @@ func (a *ApiMethod) SubmitApprovalResults(c *gin.Context) {
context, _ := c.Get(overall.MyContJwt)
var userCont modelshr.ManCont
userCont.GetLoginCont(context) //当前操作人
var runFlowCont RunWorkFlow
runFlowCont.Step = flowInfo.CurrentStep
runFlowCont.NextStep = flowInfo.NextStep
runFlowCont.TotalSteps = len(requestData.FlowList)
runFlowCont.Uuid = flowInfo.FlowKey
runFlowCont.RunUid = flowInfo.RunKey
runFlowCont.Participant = strings.Split(flowInfo.Participants, ",")
runFlowCont.FlowList = requestData.FlowList
// var runFlowCont RunWorkFlow
// runFlowCont.Step = flowInfo.CurrentStep
// runFlowCont.NextStep = flowInfo.NextStep
// runFlowCont.TotalSteps = len(requestData.FlowList)
// runFlowCont.Uuid = flowInfo.FlowKey
// runFlowCont.RunUid = flowInfo.RunKey
//runFlowCont.Participant = strings.Split(flowInfo.Participants, ",")
// runFlowCont.FlowList = requestData.FlowList
//执行流程
var runFlow RunWorkFlow
runFlow.Step = 1 //执行第几部
runFlow.FlowList = requestData.FlowList
runFlow.Step = flowInfo.CurrentStep + 1 //执行第几部
runFlow.NextStep = flowInfo.NextStep
runFlow.TotalSteps = len(requestData.FlowList) //流程总长度
runFlow.Uuid = flowInfo.FlowKey
runFlow.RunUid = flowInfo.RunKey
runFlow.Participant = strings.Split(flowInfo.Participants, ",")
runFlow.FlowList = requestData.FlowList
runFlow.FlowStepRun(userCont.Key, requestData.AgreeOrRefuse, requestData.Suggest)
// fmt.Printf("执行流程--2->%v------>%v\n", runFlow.Step, runFlow.NextStep)
if runFlow.IsRun {
publicmethod.Result(1, err, c, runFlow.Msg)
return
}
flowJsonCont, _ := json.Marshal(runFlow.FlowList) //将步进流转化成json流
saveFlowInfo := publicmethod.MapOut[string]()
saveTaskInfo := publicmethod.MapOut[string]()
saveFlowInfo["`flow_cont`"] = flowJsonCont
saveFlowInfo["`current_step`"] = runFlow.Step
saveFlowInfo["`next_step`"] = runFlow.NextStep
if flowInfo.Participants != "" {
oldUser := strings.Split(flowInfo.Participants, ",")
runFlow.Participant = append(runFlow.Participant, oldUser...)
}
//参与人去重
var parUser []string
for _, v := range runFlow.Participant {
if !publicmethod.IsInTrue[string](v, parUser) {
parUser = append(parUser, v)
}
}
saveFlowInfo["`participants`"] = strings.Join(parUser, ",")
//下一步执行人
nextRunUser := runFlow.NextRunNodeUser(requestData.AgreeOrRefuse)
saveFlowInfo["`next_executor`"] = strings.Join(nextRunUser, ",")
saveFlowInfo["`update_time`"] = time.Now().Unix()
if requestData.AgreeOrRefuse == 1 {
if runFlow.NextStep != 0 {
saveFlowInfo["`status`"] = 3
saveTaskInfo["`status`"] = 3
} else {
saveFlowInfo["`status`"] = 4
saveTaskInfo["`status`"] = 4
}
} else {
saveFlowInfo["`runKey`"] = publicmethod.GetUUid(6)
if runFlow.Step != 1 {
saveFlowInfo["`status`"] = 3
} else {
saveFlowInfo["`status`"] = 2
saveTaskInfo["`status`"] = 1
}
}
saveTaskInfo["`edit_time`"] = time.Now().Unix()
// var runFlowContent modelAppPlatform.RunFlow
// var taskContent modelAppPlatform.Task
gordb := overall.CONSTANT_DB_AppPlatform.Begin()
flowErr := gordb.Model(&modelAppPlatform.RunFlow{}).Where(where).Updates(saveFlowInfo).Error
taskErr := gordb.Model(&modelAppPlatform.Task{}).Where("`masters_key` = ?", requestData.Id).Updates(saveTaskInfo).Error
if flowErr != nil || taskErr != nil {
gordb.Rollback()
publicmethod.Result(100, err, c, "数据提交失败!请重新提交!")
return
}
gordb.Commit()
publicmethod.Result(0, err, c)
}
/*
@ -568,28 +679,34 @@ func (r *RunWorkFlow) FlowStepRun(userKey int64, AgreeToRefuse int, Suggest stri
return
}
userKeyStr := strconv.FormatInt(userKey, 10)
currentStep, nextStep := PaceStep(2, r.TotalSteps)
for i := 0; i < r.TotalSteps; i++ {
if r.FlowList[i].Step == r.Step {
fmt.Printf("节点审批人--11->%v------>%v------>%v\n", r.FlowList[i].Step, r.Step, userKeyStr)
//判断操作人是有操作权限或是否已经操作过
r.IsRun, r.Msg = JudgeOperUser(userKey, r.RunUid, r.FlowList[i].Operator)
fmt.Printf("节点审批人--12->%v------>%v------>%v\n", r.IsRun, r.Msg, userKeyStr)
if r.IsRun {
return
} else {
if AgreeToRefuse != 1 { //驳回操作
r.FlowList[i].Status = 3
operatorAry, nodeUser := FindOperator(userKeyStr, r.RunUid, 3, r.FlowList[i].Operator)
operatorAry, nodeUser := FindOperator(userKeyStr, r.RunUid, 3, r.FlowList[i].Operator, Suggest)
r.FlowList[i].Operator = operatorAry
r.Participant = append(r.Participant, nodeUser...)
r.RejectNode(r.FlowList[i].GoBackNode)
return
} else { //同意操作
currentStep, nextStep := PaceStep(r.RunUid, r.Step, r.TotalSteps, r.FlowList[i])
fmt.Printf("节点审批人--0->%v------>%v->%v------>%v\n", r.Step, r.NextStep, currentStep, nextStep)
r.FlowList[i].Status = 2
operatorAry, nodeUser := FindOperator(userKeyStr, r.RunUid, 2, r.FlowList[i].Operator)
operatorAry, nodeUser := FindOperator(userKeyStr, r.RunUid, 2, r.FlowList[i].Operator, Suggest)
r.FlowList[i].Operator = operatorAry
r.Participant = append(r.Participant, nodeUser...)
fmt.Printf("节点审批人--2->%v------>%v\n", r.Step, r.NextStep)
switch r.FlowList[i].Types {
case 0:
r.Step = currentStep
@ -598,10 +715,14 @@ func (r *RunWorkFlow) FlowStepRun(userKey int64, AgreeToRefuse int, Suggest stri
if JudgeRunNode(currentStep, r.FlowList) {
r.FlowStepRun(userKey, AgreeToRefuse, Suggest)
}
fmt.Printf("节点审批人--3->%v------>%v\n", r.Step, r.NextStep)
return
case 1:
r.Step = currentStep
r.NextStep = nextStep
FlowRunLog(r.Uuid, userKey, 2, r.FlowList[i].NodeKey, Suggest, "")
fmt.Printf("节点审批人--4->%v------>%v\n", r.Step, r.NextStep)
return
case 2:
r.Step = currentStep
r.NextStep = nextStep
@ -614,16 +735,21 @@ func (r *RunWorkFlow) FlowStepRun(userKey int64, AgreeToRefuse int, Suggest stri
if r.NextStep > 0 {
r.FlowStepRun(userKey, AgreeToRefuse, Suggest)
}
return
fmt.Printf("节点审批人--5->%v------>%v\n", r.Step, r.NextStep)
case 3:
r.Step = currentStep
r.NextStep = nextStep
FlowRunLog(r.Uuid, userKey, 2, r.FlowList[i].NodeKey, Suggest, "")
fmt.Printf("节点审批人--6->%v------>%v\n", r.Step, r.NextStep)
return
default:
}
}
}
}
}
// fmt.Printf("节点审批人--end->%v------>%v\n", currentStep, nextStep)
// for i := 0; i < r.TotalSteps; i++ {
// if r.FlowList[i].Step == r.Step {
// // operNum := len(r.Operator) //判断有多少审批人
@ -652,3 +778,160 @@ func (r *RunWorkFlow) FlowStepRun(userKey int64, AgreeToRefuse int, Suggest stri
// }
// }
}
/*
*
@ 作者: 秦东
@ 时间: 2023-11-27 14:04:01
@ 功能: 删除工作流
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) DelRunFlow(c *gin.Context) {
var requestData publicmethod.PublicStates
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if requestData.Id == "" {
publicmethod.Result(100, err, c)
return
}
if requestData.Status == 0 {
requestData.Status = 1
}
where := publicmethod.MapOut[string]()
where["`id`"] = requestData.Id
var runFlowInfo modelAppPlatform.RunFlow
err = runFlowInfo.GetCont(where, "`flow_key`", "`status`")
if err != nil {
publicmethod.Result(107, err, c)
return
}
if runFlowInfo.Status != 1 && runFlowInfo.Status != 2 {
publicmethod.Result(1, err, c, "此流程不能操作!")
return
}
saveRunFlow := publicmethod.MapOut[string]()
saveRunFlow["`status`"] = requestData.Status
saveRunFlow["`update_time`"] = time.Now().Unix()
saveTask := publicmethod.MapOut[string]()
if requestData.Status == 2 {
saveTask["`status`"] = 1
} else {
saveTask["`status`"] = requestData.Status
}
saveTask["`edit_time`"] = time.Now().Unix()
var saveRunFlowInfo modelAppPlatform.RunFlow
err = saveRunFlowInfo.EiteCont(where, saveRunFlow)
var saveTaskInfo modelAppPlatform.Task
saveTaskInfo.EiteCont(map[string]interface{}{"`masters_key`": runFlowInfo.FlowKey}, saveTask)
if err != nil {
publicmethod.Result(106, err, c)
return
}
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-11-27 14:33:51
@ 功能: 重新发起流程
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) AfreshRunFlow(c *gin.Context) {
var requestData publicmethod.PublicId
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if requestData.Id == "" {
publicmethod.Result(100, err, c)
return
}
where := publicmethod.MapOut[string]()
where["`flow_key`"] = requestData.Id
var runFlowInfo modelAppPlatform.RunFlow
err = runFlowInfo.GetCont(where, "`id`", "`flow_cont`", "`current_step`", `next_step`, `participants`)
if err != nil {
publicmethod.Result(107, err, c)
return
}
var flowList []RunFlow
err = json.Unmarshal([]byte(runFlowInfo.FlowCont), &flowList)
if err != nil {
publicmethod.Result(107, err, c)
return
}
context, _ := c.Get(overall.MyContJwt)
var userCont modelshr.ManCont
userCont.GetLoginCont(context) //当前操作人
startUs := strconv.FormatInt(userCont.Key, 10) //当前操作人
runUuId := publicmethod.GetUUid(6)
//执行流程
var runFlow RunWorkFlow
runFlow.Step = 0 //执行第几部
runFlow.FlowList = flowList
runFlow.Participant = append(runFlow.Participant, startUs)
runFlow.TotalSteps = len(flowList) //流程总长度
runFlow.Uuid = runFlowInfo.Id
runFlow.RunUid = runUuId
runFlow.GainRunNode(startUs, 2, "重新发起流程")
flowJsonCont, _ := json.Marshal(runFlow.FlowList) //将步进流转化成json流
SaveFlowCont := publicmethod.MapOut[string]()
SaveFlowCont["`flow_cont`"] = string(flowJsonCont)
SaveFlowCont["`current_step`"] = runFlow.Step
SaveFlowCont["`next_step`"] = runFlow.NextStep
SaveFlowCont["`runKey`"] = runUuId
//参与人去重
var parUser []string
for _, v := range runFlow.Participant {
if !publicmethod.IsInTrue[string](v, parUser) {
parUser = append(parUser, v)
}
}
SaveFlowCont["`participants`"] = strings.Join(parUser, ",")
nextRunUser := runFlow.NextRunNodeUser(1)
SaveFlowCont["`next_executor`"] = strings.Join(nextRunUser, ",")
SaveFlowCont["`status`"] = 3
if runFlow.NextStep <= 0 {
SaveFlowCont["`status`"] = 4
}
SaveFlowCont["`update_time`"] = time.Now().Unix()
err = runFlowInfo.EiteCont(where, SaveFlowCont)
if err != nil {
publicmethod.Result(106, err, c)
return
}
var taskInfo modelAppPlatform.Task
saveTask := publicmethod.MapOut[string]()
saveTask["`status`"] = 3
saveTask["`edit_time`"] = time.Now().Unix()
taskInfo.EiteCont(map[string]interface{}{"`masters_key`": requestData.Id}, saveTask)
publicmethod.Result(0, err, c)
}

3
api/version1/taskplatform/taskflow/types.go

@ -205,6 +205,7 @@ type SwitchFlowStatus struct {
type StartFlow struct {
publicmethod.PublicId
FlowList []RunFlow `json:"flowList"` //流程主体
State int `json:"state"` //状态状态:1、草稿;2:驳回;3:审批中;4:归档;5:删除
}
// 流程执行
@ -237,6 +238,8 @@ type SendTaskFlowInfo struct {
StartDate string `json:"startDate" gorm:"-"` //创建日期
CurrentNodeName string `json:"currentNodeName" gorm:"-"` //当前节点名称
CurrentNodeUser []UserSmallInfo `json:"currentNodeUser" gorm:"-"` //节点操作人
IdStr string `json:"idStr" gorm:"-"` //
FormVersionId string `json:"formVersionId" gorm:"-"`
}
// 人员剪短信息

227
api/version1/taskplatform/taskflow/workFlowRun.go

@ -47,6 +47,9 @@ func (a *ApiMethod) StartRunFlow(c *gin.Context) {
publicmethod.Result(10001, err, c, "未知进程!不可执行")
return
}
if requestData.State == 0 {
requestData.State = 3
}
context, _ := c.Get(overall.MyContJwt)
var userCont modelshr.ManCont
userCont.GetLoginCont(context) //当前操作人
@ -64,46 +67,52 @@ func (a *ApiMethod) StartRunFlow(c *gin.Context) {
runFlowInfo.Version = strconv.FormatInt(taskInfo.FlowRunSing, 10) //工作流版本
runFlowInfo.VersionCont = flowVersionInfo.Content //当前工作流内容
runFlowInfo.Creater = userCont.Key //流程发起人
runFlowInfo.Status = 3 //状态:1、草稿;2:驳回;3:审批中;4:归档;5:删除
runFlowInfo.StartTime = creetTime //开始时间
runFlowInfo.UpdateTime = creetTime //更新时间
runFlowInfo.RunKey = runUuId //当前执行识别符
runFlowInfo.Creater = userCont.Key //流程发起人
runFlowInfo.Status = requestData.State //状态:1、草稿;2:驳回;3:审批中;4:归档;5:删除
runFlowInfo.StartTime = creetTime //开始时间
runFlowInfo.UpdateTime = creetTime //更新时间
runFlowInfo.RunKey = runUuId //当前执行识别符
startUs := strconv.FormatInt(userCont.Key, 10) //当前操作人
//执行流程
var runFlow RunWorkFlow
runFlow.Step = 1 //执行第几部
runFlow.Step = 0 //执行第几部
runFlow.FlowList = requestData.FlowList
runFlow.Participant = append(runFlow.Participant, startUs)
runFlow.TotalSteps = len(requestData.FlowList) //流程总长度
runFlow.Uuid = uuid
runFlow.RunUid = runUuId
runFlow.GainRunNode(startUs, 2)
if requestData.State == 3 {
runFlow.GainRunNode(startUs, 2, "发起工作流")
} else {
runFlow.GainRunNode(startUs, 1, "")
}
// fmt.Printf("执行完毕--10->%v->%v\n", runFlow.Step, runFlow.NextStep)
fmt.Printf("执行完毕--10->%v->%v\n", runFlow.Step, runFlow.NextStep)
flowJsonCont, _ := json.Marshal(runFlow.FlowList) //将步进流转化成json流
runFlowInfo.FlowCont = string(flowJsonCont) //流程执行体
runFlowInfo.CurrentStep = runFlow.Step
runFlowInfo.NextStep = runFlow.NextStep
//参与人去重
var parUser []string
for _, v := range runFlow.Participant {
if !publicmethod.IsInTrue[string](v, parUser) {
parUser = append(parUser, v)
if requestData.State == 3 {
runFlowInfo.CurrentStep = runFlow.Step
runFlowInfo.NextStep = runFlow.NextStep
//参与人去重
var parUser []string
for _, v := range runFlow.Participant {
if !publicmethod.IsInTrue[string](v, parUser) {
parUser = append(parUser, v)
}
}
runFlowInfo.Participants = strings.Join(parUser, ",")
nextRunUser := runFlow.NextRunNodeUser(1)
runFlowInfo.NextExecutor = strings.Join(nextRunUser, ",")
if runFlow.NextStep <= 0 {
runFlowInfo.Status = 4
}
}
runFlowInfo.Participants = strings.Join(parUser, ",")
nextRunUser := runFlow.NextRunNodeUser()
runFlowInfo.NextExecutor = strings.Join(nextRunUser, ",")
// xie, _ := json.Marshal(runFlowInfo)
// fmt.Printf("写入数据--10->%v\n", string(xie))
if runFlow.NextStep <= 0 {
runFlowInfo.Status = 4
}
err = runFlowInfo.WriteCont()
if err != nil {
publicmethod.Result(10001, err, c, "流程写入失败!请重新发起")
@ -112,6 +121,9 @@ func (a *ApiMethod) StartRunFlow(c *gin.Context) {
if runFlow.NextStep <= 0 {
var taskCont modelAppPlatform.Task
taskCont.EiteCont(map[string]interface{}{"`masters_key`": requestData.Id}, map[string]interface{}{"`status`": 4})
} else {
var taskCont modelAppPlatform.Task
taskCont.EiteCont(map[string]interface{}{"`masters_key`": requestData.Id}, map[string]interface{}{"`status`": requestData.State})
}
publicmethod.Result(0, err, c)
}
@ -169,19 +181,39 @@ func FlowRunLog(uuid, userKey int64, AgreeToRefuse int, nodeKey, idea, annex str
#
*/
func (r *RunWorkFlow) NextRunNodeUser() (userAry []string) {
func (r *RunWorkFlow) NextRunNodeUser(isTrue int) (userAry []string) {
if r.NextStep <= 0 {
return
}
for _, v := range r.FlowList {
if v.Step == r.Step {
for _, op := range v.Operator {
if !publicmethod.IsInTrue[string](op.Id, userAry) {
userAry = append(userAry, op.Id)
if isTrue == 1 {
curStep := r.Step + 1
if curStep > r.TotalSteps {
curStep = r.TotalSteps
}
for _, v := range r.FlowList {
if v.Step == curStep {
for _, op := range v.Operator {
if !publicmethod.IsInTrue[string](op.Id, userAry) {
userAry = append(userAry, op.Id)
}
}
}
}
} else {
if r.Step == 1 {
return
}
for _, v := range r.FlowList {
if v.Step == r.Step {
for _, op := range v.Operator {
if !publicmethod.IsInTrue[string](op.Id, userAry) {
userAry = append(userAry, op.Id)
}
}
}
}
}
return
}
@ -203,12 +235,16 @@ func (r *RunWorkFlow) NextRunNodeUser() (userAry []string) {
#
*/
func (r *RunWorkFlow) GainRunNode(userKey string, AgreeToRefuse int) {
func (r *RunWorkFlow) GainRunNode(userKey string, AgreeToRefuse int, runCont string) {
userkInt, _ := strconv.ParseInt(userKey, 10, 64)
currentStep, nextStep := PaceStep(2, r.TotalSteps)
curStep := 1
if r.Step != 0 {
curStep = r.Step
}
for i := 0; i < r.TotalSteps; i++ {
if r.FlowList[i].Step == r.Step {
operatorAry, nodeUser := FindOperator(userKey, r.RunUid, AgreeToRefuse, r.FlowList[i].Operator)
if r.FlowList[i].Step == curStep {
currentStep, nextStep := PaceStep(r.RunUid, r.Step, r.TotalSteps, r.FlowList[i])
operatorAry, nodeUser := FindOperator(userKey, r.RunUid, AgreeToRefuse, r.FlowList[i].Operator, runCont)
r.FlowList[i].Operator = operatorAry
r.FlowList[i].Status = AgreeToRefuse
r.Participant = append(r.Participant, nodeUser...)
@ -216,9 +252,9 @@ func (r *RunWorkFlow) GainRunNode(userKey string, AgreeToRefuse int) {
case 0:
r.Step = currentStep
r.NextStep = nextStep
FlowRunLog(r.Uuid, userkInt, AgreeToRefuse, r.FlowList[i].NodeKey, "发起流程", "")
FlowRunLog(r.Uuid, userkInt, AgreeToRefuse, r.FlowList[i].NodeKey, runCont, "")
if JudgeRunNode(currentStep, r.FlowList) {
r.GainRunNode(userKey, AgreeToRefuse)
r.GainRunNode(userKey, AgreeToRefuse, runCont)
}
return
case 1:
@ -235,7 +271,7 @@ func (r *RunWorkFlow) GainRunNode(userKey string, AgreeToRefuse int) {
FlowRunLog(r.Uuid, userkIntId, AgreeToRefuse, r.FlowList[i].NodeKey, title, "")
}
if r.NextStep > 0 {
r.GainRunNode(userKey, AgreeToRefuse)
r.GainRunNode(userKey, AgreeToRefuse, runCont)
}
return
case 3:
@ -295,26 +331,102 @@ func JudgeRunNode(step int, FlowList []RunFlow) (isRun bool) {
#
*/
func PaceStep(step, totalSteps int) (currentStep, nextStep int) {
// fmt.Printf("计算步伐--1-->%v-->%v\n", step, totalSteps)
if step >= totalSteps {
currentStep = totalSteps
nextStep = 0
return
}
// fmt.Printf("计算步伐--2-->%v-->%v\n", currentStep, nextStep)
currentStep = step
if currentStep >= totalSteps {
currentStep = totalSteps
nextStep = 0
return
}
// fmt.Printf("计算步伐--3-->%v-->%v\n", currentStep, nextStep)
nextStep = currentStep + 1
if nextStep >= totalSteps {
nextStep = totalSteps
func PaceStep(runId int64, step, totalSteps int, nodeInfo RunFlow) (currentStep, nextStep int) {
fmt.Printf("计算步伐--1-->%v-->%v\n", step, nodeInfo.ExamineMode)
if nodeInfo.ExamineMode == 0 {
if step >= totalSteps {
currentStep = totalSteps
nextStep = 0
fmt.Printf("计算步伐--2-->%v-->%v\n", currentStep, nextStep)
return
}
currentStep = step + 1
if currentStep >= totalSteps {
currentStep = totalSteps
nextStep = 0
fmt.Printf("计算步伐--3-->%v-->%v\n", currentStep, nextStep)
return
}
nextStep = currentStep + 1
if nextStep >= totalSteps {
nextStep = totalSteps
}
} else if nodeInfo.ExamineMode == 3 {
if step >= totalSteps {
currentStep = totalSteps
nextStep = 0
fmt.Printf("计算步伐--21-->%v-->%v\n", currentStep, nextStep)
return
}
currentStep = step
if currentStep >= totalSteps {
currentStep = totalSteps
nextStep = 0
fmt.Printf("计算步伐--31-->%v-->%v\n", currentStep, nextStep)
return
}
nextStep = currentStep + 1
if nextStep >= totalSteps {
nextStep = totalSteps
}
fmt.Printf("计算步伐--34-->%v-->%v\n", currentStep, nextStep)
} else {
runIdStr := strconv.FormatInt(runId, 10)
allUser := len(nodeInfo.Operator)
jiBuQi := 1
for _, v := range nodeInfo.Operator {
for _, m := range v.LogList {
if m.UID == runIdStr {
jiBuQi++
}
}
}
fmt.Printf("计算步伐--4-->%v-->%v\n", allUser, jiBuQi)
if allUser <= jiBuQi {
if step >= totalSteps {
currentStep = totalSteps
nextStep = 0
fmt.Printf("计算步伐--6-->%v-->%v\n", currentStep, nextStep)
return
}
//
currentStep = step + 1
if currentStep >= totalSteps {
currentStep = totalSteps
nextStep = 0
fmt.Printf("计算步伐--7-->%v-->%v\n", currentStep, nextStep)
return
}
// fmt.Printf("计算步伐--3-->%v-->%v\n", currentStep, nextStep)
nextStep = currentStep + 1
if nextStep >= totalSteps {
nextStep = totalSteps
}
fmt.Printf("计算步伐--8-->%v-->%v\n", currentStep, nextStep)
} else {
currentStep = step - 1
if currentStep <= 0 {
currentStep = 1
}
if currentStep >= totalSteps {
currentStep = totalSteps
nextStep = 0
fmt.Printf("计算步伐--9-->%v-->%v\n", currentStep, nextStep)
return
}
// fmt.Printf("计算步伐--3-->%v-->%v\n", currentStep, nextStep)
nextStep = currentStep + 1
if nextStep >= totalSteps {
nextStep = totalSteps
}
fmt.Printf("计算步伐--10-->%v-->%v\n", currentStep, nextStep)
}
}
// fmt.Printf("计算步伐--4-->%v-->%v\n", currentStep, nextStep)
fmt.Printf("计算步伐--11-->%v-->%v\n", currentStep, nextStep)
return
}
@ -329,6 +441,7 @@ func PaceStep(step, totalSteps int) (currentStep, nextStep int) {
#runUid 执行Uid
#AgreeToRefuse 同意或者驳回
#operator 当前节点操作人
#suggest 审批意见
@ 返回值
@ -338,15 +451,17 @@ func PaceStep(step, totalSteps int) (currentStep, nextStep int) {
#
*/
func FindOperator(userKey string, runUid int64, AgreeToRefuse int, operator []OperatorList) (OperatorAry []OperatorList, nodeUser []string) {
func FindOperator(userKey string, runUid int64, AgreeToRefuse int, operator []OperatorList, suggest string) (OperatorAry []OperatorList, nodeUser []string) {
// isOk := true
var logCont LogList
logCont.State = AgreeToRefuse //状态 1、未操作;2、通过;3、驳回
logCont.TimeVal = publicmethod.UnixTimeToDay(time.Now().Unix(), 1)
logCont.UID = strconv.FormatInt(runUid, 10)
logCont.Cause = suggest
for _, v := range operator {
nodeUser = append(nodeUser, v.Id)
if v.Id == userKey {
if v.Id == userKey && AgreeToRefuse != 1 {
// isOk = false
v.LogList = append(v.LogList, logCont)
}

126
api/version1/taskplatform/taskmanagement/appform.go

@ -453,11 +453,11 @@ func (a *ApiMethod) CustomerFormEditData(c *gin.Context) {
}
if _, ok := mapData["formId"]; !ok {
publicmethod.Result(1, err, c, "非法表单!不能提交数据!")
publicmethod.Result(1, err, c, "非法表单!1不能提交数据!")
return
}
if _, ok := mapData["id"]; !ok {
publicmethod.Result(1, err, c, "非法表单!不能提交数据!")
publicmethod.Result(1, err, c, "非法表单!2不能提交数据!")
return
}
var formCont modelAppPlatform.CustomerFormView //获取指定版本的表单
@ -1119,3 +1119,125 @@ func (a *ApiMethod) DelCustomerFormDataLog(c *gin.Context) {
}
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2023-09-25 11:45:08
@ 功能: 自定义表单编辑记录数据
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) NewCustomerFormEditData(c *gin.Context) {
data, err := c.GetRawData() //接收表单提交得数据
if err != nil {
publicmethod.Result(100, err, c)
return
}
mapData := publicmethod.MapOut[string]() //初始化MAP
err = json.Unmarshal(data, &mapData) //将json字符串转换成Map
if err != nil {
publicmethod.Result(100, err, c)
return
}
if _, ok := mapData["formKey"]; !ok {
publicmethod.Result(1, err, c, "非法表单!1不能提交数据!")
return
}
if _, ok := mapData["formId"]; !ok {
publicmethod.Result(1, err, c, "非法表单!2不能提交数据!")
return
}
var formCont modelAppPlatform.CustomerFormView //获取指定版本的表单
err = formCont.GetCont(map[string]interface{}{"`id`": mapData["formId"]})
if err != nil {
publicmethod.Result(107, err, c)
return
}
var sunFormName []string //子表名称集合
if formCont.TableStructure != "" { //拆解获取子表名称
var sunFormStruct map[string]string
err = json.Unmarshal([]byte(formCont.TableStructure), &sunFormStruct)
if err == nil {
for _, v := range sunFormStruct {
if !publicmethod.IsInTrue[string](v, sunFormName) {
sunFormName = append(sunFormName, v)
}
}
}
}
masterField := publicmethod.MapOut[string]() //主表数据
sunFieldAry := publicmethod.MapOut[string]() //子表数据
for k, v := range mapData {
if !publicmethod.IsInTrue[string](k, sunFormName) {
if !publicmethod.IsInTrue[string](k, []string{"formId", "id"}) {
masterField[k] = v
}
} else {
sunFieldAry[k] = v
}
}
context, _ := c.Get(overall.MyContJwt)
var userCont modelshr.ManCont
userCont.GetLoginCont(context) //当前操作人
cureeTime := time.Now().Unix()
var formJsonCont customerform.CustomerFormMaster
json.Unmarshal([]byte(formCont.MastesFormJson), &formJsonCont)
var formUnitCont customerform.FormUnitInfo
formUnitCont.GainMasterAndSunFormUnit(formCont.TableKey, formJsonCont.List, true)
masterUnitList := make(map[string]customerform.MasterStruct)
for _, v := range formUnitCont.MasterInfo {
masterUnitList[v.Name] = v
}
uuid, _ := strconv.ParseInt(mapData["formKey"].(string), 10, 64)
masrWriteMap := MakeFormMapData(uuid, userCont.Key, cureeTime, masterField, masterUnitList, 2)
//判断是否
if len(sunFieldAry) > 0 {
// fmt.Printf("sunFieldAry:%v\n", sunFieldAry)
//有子表
sunTypeAry := make(map[string]map[string]customerform.MasterStruct)
for _, v := range formUnitCont.SunFormInfo {
sunTypeAry[v.TableName] = v.UbitInfo
}
err = EditWriteSunDatabase(uuid, userCont.Key, cureeTime, formCont.TableKey, masrWriteMap, sunFieldAry, sunTypeAry)
} else {
err = overall.CONSTANT_DB_CustomerForm.Table(formCont.TableKey).Where("`masters_key` = ?", uuid).Updates(masrWriteMap).Error
// fmt.Printf("sunFieldAry2:%v----->%v\n", err, masrWriteMap)
}
if err != nil {
publicmethod.Result(104, err, c)
return
}
var taskCont modelAppPlatform.Task
// taskCont.Creater = userCont.Key
// taskCont.EditTime = cureeTime
saveData := publicmethod.MapOut[string]()
saveData["`edit_time`"] = time.Now().Unix()
saveData["`creater`"] = userCont.Key
err = taskCont.EiteCont(map[string]interface{}{"`masters_key`": uuid}, saveData)
sendData := publicmethod.MapOut[string]()
sendData["err"] = err
sendData["cureeTime"] = cureeTime
sendData["formJsonCont"] = formJsonCont
sendData["masterUnitList"] = masterUnitList
sendData["masrWriteMap"] = masrWriteMap
publicmethod.Result(0, err, c)
}

25
apirouter/v1/taskrouter/taskrouter.go

@ -11,13 +11,14 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter := router.Group("task_management")
var taskManagementRouter = version1.AppApiEntry.TaskManagementApi
{
apiRouter.GET("", taskManagementRouter.Index) //入口
apiRouter.POST("", taskManagementRouter.Index) //入口
apiRouter.POST("app_formdata_log", taskManagementRouter.AppFormDataLog) //非流程表单提交数据记录
apiRouter.POST("gain_task_list", taskManagementRouter.GainTaskList) //获取可执行得任务列表
apiRouter.POST("gain_task_versioncont", taskManagementRouter.GianTaskVersionCont) //根据版本获取表单内容
apiRouter.POST("customer_form_adddata", taskManagementRouter.CustomerFormAddData) //自定义表单新增记录数据
apiRouter.POST("customer_form_editdata", taskManagementRouter.CustomerFormEditData) //自定义表单编辑记录数据
apiRouter.GET("", taskManagementRouter.Index) //入口
apiRouter.POST("", taskManagementRouter.Index) //入口
apiRouter.POST("app_formdata_log", taskManagementRouter.AppFormDataLog) //非流程表单提交数据记录
apiRouter.POST("gain_task_list", taskManagementRouter.GainTaskList) //获取可执行得任务列表
apiRouter.POST("gain_task_versioncont", taskManagementRouter.GianTaskVersionCont) //根据版本获取表单内容
apiRouter.POST("customer_form_adddata", taskManagementRouter.CustomerFormAddData) //自定义表单新增记录数据
apiRouter.POST("customer_form_editdata", taskManagementRouter.CustomerFormEditData) //自定义表单编辑记录数据
apiRouter.POST("newcust_form_editdata", taskManagementRouter.NewCustomerFormEditData) //自定义表单编辑记录数据(新版)
// apiRouter.POST("look_customer_formdata", taskManagementRouter.LookCustomerFormData) //查看自定义表单记录数据列表
apiRouter.POST("look_customer_formdata", taskManagementRouter.LookNewCustomerFormData) //查看自定义表单记录数据列表
apiRouter.POST("del_customer_formdata", taskManagementRouter.DelCustomerFormDataLog) //删除自定义表单记录数据
@ -44,9 +45,11 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
taskFlowApi.POST("gainFlowPeople", taskFlowRouter.GainFlowPeople) //获取操作人、
taskFlowApi.POST("searchUserList", taskFlowRouter.SearchUserList) //自定义表单搜索人员
taskFlowApi.POST("startRunFlow", taskFlowRouter.StartRunFlow) //发起工作流
taskFlowApi.POST("taskFlowList", taskFlowRouter.TaskFlowList) //流程任务
taskFlowApi.POST("gainRunTaskFlow", taskFlowRouter.GainRunTaskFlow) //获取正在执行得任务流程
taskFlowApi.POST("startRunFlow", taskFlowRouter.StartRunFlow) //发起工作流
taskFlowApi.POST("taskFlowList", taskFlowRouter.TaskFlowList) //流程任务
taskFlowApi.POST("gainRunTaskFlow", taskFlowRouter.GainRunTaskFlow) //获取正在执行得任务流程
taskFlowApi.POST("submitApprovalResults", taskFlowRouter.SubmitApprovalResults) //提交审批结果
taskFlowApi.POST("delRunFlow", taskFlowRouter.DelRunFlow) //删除工作流任务
taskFlowApi.POST("afreshRunFlow", taskFlowRouter.AfreshRunFlow) //重新发起流程
}
}

3
initialization/route/initRoute.go

@ -3,12 +3,15 @@ package route
import (
"appPlatform/apirouter"
"appPlatform/identification/interceptor"
"io/ioutil"
"github.com/gin-gonic/gin"
)
// 初始化主路由
func InitialRouter() *gin.Engine {
gin.SetMode(gin.ReleaseMode)
gin.DefaultWriter = ioutil.Discard
var router = gin.Default()
//app默认相应

1
models/modelAppPlatform/run_task_flow.go

@ -42,6 +42,7 @@ type RunTaskFlow struct {
MastesForm string `json:"mastesform" gorm:"column:mastesform;type:longtext;default:'';comment:表单结构"`
MastesFormJson string `json:"mastesformjson" gorm:"column:mastesformjson;type:longtext;default:'';comment:表单结构json"`
RunKey int64 `json:"runKey" gorm:"column:runKey;type:bigint(20) unsigned;default:0;not null;comment:当前执行识别符"`
VersionId int64 `json:"version_id" gorm:"column:version_id;type:bigint(20) unsigned;default:0;not null;comment:来源于哪个表单"`
}
func (RunTaskFlow *RunTaskFlow) TableName() string {

41
overall/publicmethod/technique.go

@ -759,6 +759,9 @@ func GetOrgStructure(orgId int64) (groupId, companyId, departmentId, sunDepartId
// 获取指定行政组织id,所有子类
func GetDepartmentSun(superior int64, idary []int64) (orgIdAry []int64) {
if superior == 0 {
return
}
var orgAry []modelshr.AdministrativeOrganization
err := overall.CONSTANT_DB_HR.Model(&modelshr.AdministrativeOrganization{}).Select("`id`").Where("`state` = 1 AND `superior` = ?", superior).Find(&orgAry).Error
if err != nil {
@ -777,6 +780,9 @@ func GetDepartmentSun(superior int64, idary []int64) (orgIdAry []int64) {
// 获取集团或第一实权部门
func GetGroupOrDepartPower(parentId int64, departId ...int64) int64 {
if parentId == 0 {
return 0
}
var orgCont modelshr.AdministrativeOrganization
err := orgCont.GetCont(map[string]interface{}{"id": parentId}, "id", "organization_type", "superior", "ispower")
if err != nil {
@ -960,6 +966,9 @@ func getStorageSystemEmpower(menuIdAry []string) (menuUrl []string, err error) {
// 获取公司最小主责部门
func GetMinMainDutyDeparment(company string) (organization []modelshr.AdministrativeOrganization) {
if company == "" {
return
}
var allOrg []modelshr.AdministrativeOrganization
err := overall.CONSTANT_DB_HR.Model(&modelshr.AdministrativeOrganization{}).Where("ispower = 1 AND state = 1 AND organization_type > 2 AND superior = ?", company).Find(&allOrg).Error
if err != nil || len(allOrg) < 1 {
@ -980,6 +989,9 @@ func GetMinMainDutyDeparment(company string) (organization []modelshr.Administra
// 获取下级行政组织是否有主行政部门
func GetSunOrgList(orgId int64) (orgList []modelshr.AdministrativeOrganization, ovErr error) {
if orgId == 0 {
return
}
ovErr = overall.CONSTANT_DB_HR.Where("state = 1").Where("ispower = 1 AND superior = ?", orgId).Find(&orgList).Error
return
}
@ -1063,6 +1075,9 @@ func GetDepartmentLeader(userCont modelshr.PersonArchives) {
// 获取行政组织的所有上级实权部门
func GetAllFatherDeparment(orgId int64, sort int, oldCont []DepartmentIsPower) (orgContList []DepartmentIsPower) {
if orgId == 0 {
return
}
var orgCont modelshr.AdministrativeOrganization
err := orgCont.GetCont(map[string]interface{}{"id": orgId}, "id", "name", "organization_type", "superior", "ispower")
if err != nil {
@ -1536,19 +1551,26 @@ func GetSetpNodeName(setId int) (setpName string) {
#err cuo
*/
func GetRefereeTeamWorkWechat(wechatTeamId, departmentId int64) (userStrList []string, err error) {
var orgCont modelshr.AdministrativeOrganization
err = orgCont.GetCont(map[string]interface{}{"`id`": departmentId}, "`wechat_organization_id`")
// fmt.Printf("orgCont------------>%v\n", err)
if err != nil {
return
if departmentId != 0 {
err = orgCont.GetCont(map[string]interface{}{"`id`": departmentId}, "`wechat_organization_id`")
// fmt.Printf("orgCont------------>%v\n", err)
if err != nil {
return
}
}
//获取角色组数据
var roleCont modelsschool.RoleGroup
err = roleCont.GetCont(map[string]interface{}{"`srg_id`": wechatTeamId}, "`srg_extatry`", "`srg_type`")
// fmt.Printf("orgCont:%v------------>roleCont:%v\n", err, roleCont)
if err != nil {
return
if wechatTeamId != 0 {
err = roleCont.GetCont(map[string]interface{}{"`srg_id`": wechatTeamId}, "`srg_extatry`", "`srg_type`")
// fmt.Printf("orgCont:%v------------>roleCont:%v\n", err, roleCont)
if err != nil {
return
}
}
var roleUser []roleGroupBodyAry
if roleCont.Type == 1 {
//矩阵
@ -1930,6 +1952,9 @@ func JudjeMaxOfMinVal(maxVal, minVal float64) (maxVals, minVals float64) {
// 获取行政组织所有上级
func (g *GetOrgAllParent) GetOrgParentAllId(orgId int64) {
if orgId == 0 {
return
}
var orgCont modelshr.AdministrativeOrganization
err := orgCont.GetCont(map[string]interface{}{"`id`": orgId, "`state`": 1}, "`superior`")
if err == nil {

4
overall/publicmethod/type.go

@ -57,6 +57,10 @@ type PublicState struct {
State int `json:"state"`
IsTrue int `json:"istrue"` //1:强制删除;非1:软删除
}
type PublicStates struct {
PublicId
PublicStatus
}
// 通用图片结构体列表
type PubilcImageList struct {

Loading…
Cancel
Save