From 87ba9e89438ae7c2c5cb3d1657501a8a73cc9543 Mon Sep 17 00:00:00 2001 From: "Mr. Lan" Date: Fri, 9 Oct 2020 00:58:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=B1=95=E7=A4=BAbug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/service/process.go | 13 +++++++++---- pkg/service/workOrderList.go | 28 +++++++++++++++++----------- 2 files changed, 26 insertions(+), 15 deletions(-) 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)