boweniac 3 месяцев назад
Родитель
Сommit
9a3e790c33
1 измененных файлов с 12 добавлено и 2 удалено
  1. 12 2
      internal/logic/sop_task/sop_task_copy_logic.go

+ 12 - 2
internal/logic/sop_task/sop_task_copy_logic.go

@@ -82,6 +82,16 @@ func (l *SopTaskCopyLogic) SopTaskCopy(req *types.CopyReq) (resp *types.BaseMsgR
 			c.LabelIdList = newLabels
 			newConditionList = append(newConditionList, c)
 		}
+		newLabelAdd, err := CreateLabels(tx, s.ActionLabelAdd, targetOrganizationId, l.ctx, l.Logger)
+		if err != nil {
+			_ = tx.Rollback()
+			return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+		}
+		newLabelDel, err := CreateLabels(tx, s.ActionLabelDel, targetOrganizationId, l.ctx, l.Logger)
+		if err != nil {
+			_ = tx.Rollback()
+			return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+		}
 		newStage, err := tx.SopStage.Create().
 			SetTaskID(newTask.ID).
 			SetName(s.Name).
@@ -89,8 +99,8 @@ func (l *SopTaskCopyLogic) SopTaskCopy(req *types.CopyReq) (resp *types.BaseMsgR
 			SetConditionOperator(s.ConditionOperator).
 			SetConditionList(newConditionList).
 			SetNotNilActionMessage(s.ActionMessage).
-			SetNotNilActionLabelAdd(s.ActionLabelAdd).
-			SetNotNilActionLabelDel(s.ActionLabelDel).
+			SetNotNilActionLabelAdd(newLabelAdd).
+			SetNotNilActionLabelDel(newLabelDel).
 			SetNotNilActionForward(&s.ActionForward).
 			SetIndexSort(s.IndexSort).
 			Save(l.ctx)