diff --git a/pkg/service/process.go b/pkg/service/process.go index f5d4913..c69f4e5 100644 --- a/pkg/service/process.go +++ b/pkg/service/process.go @@ -143,11 +143,16 @@ func ProcessStructure(c *gin.Context, processId int, workOrderId int) (result ma for _, stateValue := range stateList { for _, processNodeValue := range processStructureDetails["nodes"].([]interface{}) { if stateValue["id"].(string) == processNodeValue.(map[string]interface{})["id"] { - for _, userId := range stateValue["processor"].([]interface{}) { - if int(userId.(float64)) == tools.GetUserId(c) { - workOrderInfo.CurrentState = stateValue["id"].(string) - break breakStateTag + if _, ok := stateValue["processor"]; ok { + for _, userId := range stateValue["processor"].([]interface{}) { + if int(userId.(float64)) == tools.GetUserId(c) { + workOrderInfo.CurrentState = stateValue["id"].(string) + break breakStateTag + } } + } else { + err = errors.New("未查询到对应的处理人字段,请确认。") + return } } } diff --git a/pkg/service/workOrderList.go b/pkg/service/workOrderList.go index 8f33a70..bfda1da 100644 --- a/pkg/service/workOrderList.go +++ b/pkg/service/workOrderList.go @@ -122,18 +122,24 @@ func (w *WorkOrder) WorkOrderList() (result interface{}, err error) { authStatus bool ) if len(StateList) != 0 { - structResult, err = ProcessStructure(w.GinObj, v.Process, v.Id) - if err != nil { - return - } + // 仅待办工单需要验证 + // todo:还需要找最优解决方案 + if w.Classify == 1 { + structResult, err = ProcessStructure(w.GinObj, v.Process, v.Id) + if err != nil { + return + } - authStatus, err = JudgeUserAuthority(w.GinObj, v.Id, structResult["workOrder"].(WorkOrderData).CurrentState) - if err != nil { - return - } - if !authStatus { - minusTotal += 1 - continue + authStatus, err = JudgeUserAuthority(w.GinObj, v.Id, structResult["workOrder"].(WorkOrderData).CurrentState) + if err != nil { + return + } + if !authStatus { + minusTotal += 1 + continue + } + } else { + authStatus = true } processorList := make([]int, 0)