commit
4f713d961e
@ -34,11 +34,12 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma
|
|||||||
)
|
)
|
||||||
|
|
||||||
err = orm.Eloquent.Model(&processValue).Where("id = ?", processId).Find(&processValue).Error
|
err = orm.Eloquent.Model(&processValue).Where("id = ?", processId).Find(&processValue).Error
|
||||||
if err != nil {
|
//if err != nil {
|
||||||
err = fmt.Errorf("查询流程失败,%v", err.Error())
|
// err = fmt.Errorf("查询流程失败,%v", err.Error())
|
||||||
return
|
// return
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
if processValue.Structure != nil && len(processValue.Structure) > 0 {
|
||||||
err = json.Unmarshal([]byte(processValue.Structure), &processStructureDetails)
|
err = json.Unmarshal([]byte(processValue.Structure), &processStructureDetails)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("json转map失败,%v", err.Error())
|
err = fmt.Errorf("json转map失败,%v", err.Error())
|
||||||
@ -67,6 +68,7 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma
|
|||||||
} else {
|
} else {
|
||||||
processNode = processStructureDetails["nodes"].([]map[string]interface{})
|
processNode = processStructureDetails["nodes"].([]map[string]interface{})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
processValue.Structure = nil
|
processValue.Structure = nil
|
||||||
result = map[string]interface{}{
|
result = map[string]interface{}{
|
||||||
@ -141,6 +143,7 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma
|
|||||||
if len(stateList) > 0 {
|
if len(stateList) > 0 {
|
||||||
breakStateTag:
|
breakStateTag:
|
||||||
for _, stateValue := range stateList {
|
for _, stateValue := range stateList {
|
||||||
|
if processStructureDetails["nodes"] != nil {
|
||||||
for _, processNodeValue := range processStructureDetails["nodes"].([]interface{}) {
|
for _, processNodeValue := range processStructureDetails["nodes"].([]interface{}) {
|
||||||
if stateValue["id"].(string) == processNodeValue.(map[string]interface{})["id"] {
|
if stateValue["id"].(string) == processNodeValue.(map[string]interface{})["id"] {
|
||||||
if _, ok := stateValue["processor"]; ok {
|
if _, ok := stateValue["processor"]; ok {
|
||||||
@ -157,6 +160,7 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if workOrderInfo.CurrentState == "" {
|
if workOrderInfo.CurrentState == "" {
|
||||||
workOrderInfo.CurrentState = stateList[0]["id"].(string)
|
workOrderInfo.CurrentState = stateList[0]["id"].(string)
|
||||||
|
@ -44,13 +44,16 @@ func JudgeUserAuthority(c *gin.Context, workOrderId int, currentState string) (s
|
|||||||
|
|
||||||
// 获取流程信息
|
// 获取流程信息
|
||||||
err = orm.Eloquent.Model(&process.Info{}).Where("id = ?", workOrderInfo.Process).Find(&processInfo).Error
|
err = orm.Eloquent.Model(&process.Info{}).Where("id = ?", workOrderInfo.Process).Find(&processInfo).Error
|
||||||
if err != nil {
|
//if err != nil {
|
||||||
return
|
// return
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
if processInfo.Structure != nil && len(processInfo.Structure) > 0 {
|
||||||
err = json.Unmarshal(processInfo.Structure, &processState.Structure)
|
err = json.Unmarshal(processInfo.Structure, &processState.Structure)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stateValue, err = processState.GetNode(currentState)
|
stateValue, err = processState.GetNode(currentState)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user