Browse Source

超管及sop测试租户在禁用sop任务时,改为重置为草稿状态

boweniac 6 months ago
parent
commit
f4ae3706bf

+ 0 - 9
internal/logic/sop_task/get_sop_task_record_list_logic.go

@@ -2,7 +2,6 @@ package sop_task
 
 import (
 	"context"
-	"fmt"
 	"wechat-api/ent"
 	"wechat-api/ent/messagerecords"
 	"wechat-api/ent/soptask"
@@ -38,17 +37,13 @@ func (l *GetSopTaskRecordListLogic) GetSopTaskRecordList(req *types.IDReq) (resp
 	if err != nil {
 		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
 	}
-	fmt.Printf("----------------data1----------------: %+v\n", data.Edges.TaskStages)
-	fmt.Printf("----------------data2----------------: %+v\n", data.Edges.TaskStages[0].Edges.StageNodes)
 	var sopTaskRecordList []types.SopTaskRecordInfo
 	for _, s := range data.Edges.TaskStages {
 		// 在message_records 表中统计 source_type=3, source_id=s.ID的记录数,以及其中status=3的记录数
 		sst, _ := l.SopTaskRecord(3, s.ID, s.Name)
-		fmt.Printf("----------------sst----------------: %+v\n", *sst)
 		sopTaskRecordList = append(sopTaskRecordList, *sst)
 		for _, n := range s.Edges.StageNodes {
 			nst, _ := l.SopTaskRecord(4, n.ID, n.Name)
-			fmt.Printf("----------------nst----------------: %+v\n", *nst)
 			sopTaskRecordList = append(sopTaskRecordList, *nst)
 		}
 	}
@@ -61,16 +56,12 @@ func (l *GetSopTaskRecordListLogic) GetSopTaskRecordList(req *types.IDReq) (resp
 }
 
 func (l *GetSopTaskRecordListLogic) SopTaskRecord(sourceType int, sourceId uint64, name string) (resp *types.SopTaskRecordInfo, err error) {
-	fmt.Printf("----------------sourceType----------------: %d\n", sourceType)
-	fmt.Printf("----------------sourceId----------------: %d\n", sourceId)
 	stageTotalCount, _ := l.svcCtx.DB.MessageRecords.Query().
 		Where(messagerecords.SourceType(sourceType), messagerecords.SourceID(sourceId)).
 		Count(l.ctx)
 	stageSuccessCount, _ := l.svcCtx.DB.MessageRecords.Query().
 		Where(messagerecords.SourceTypeEQ(sourceType), messagerecords.SourceID(sourceId), messagerecords.Status(3)).
 		Count(l.ctx)
-	fmt.Printf("----------------stageTotalCount----------------: %d\n", stageTotalCount)
-	fmt.Printf("----------------stageSuccessCount----------------: %d\n", stageSuccessCount)
 	totalCountInt64 := int64(stageTotalCount)
 	successCountInt64 := int64(stageSuccessCount)
 	failureCount := totalCountInt64 - successCountInt64

+ 1 - 5
internal/logic/sop_task/sop_task_stop_logic.go

@@ -2,7 +2,6 @@ package sop_task
 
 import (
 	"context"
-	"fmt"
 	"github.com/suyuan32/simple-admin-common/msg/errormsg"
 	"wechat-api/ent/messagerecords"
 	"wechat-api/ent/sopstage"
@@ -50,8 +49,7 @@ func (l *SopTaskStopLogic) SopTaskStop(req *types.IDReq) (resp *types.BaseMsgRes
 	if task.Status != 3 {
 		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
 	}
-
-	if isAdmin {
+	if isAdmin || organizationId == 12 {
 		err = tx.SopTask.UpdateOneID(req.Id).
 			SetStatus(1).
 			Exec(l.ctx)
@@ -59,12 +57,10 @@ func (l *SopTaskStopLogic) SopTaskStop(req *types.IDReq) (resp *types.BaseMsgRes
 			Where(sopstage.TaskID(req.Id)).
 			WithStageNodes().
 			All(l.ctx)
-		fmt.Printf("------------------------sourceInfo------------------------: %+v\n", sourceInfo)
 		if err != nil {
 			return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
 		}
 		for _, stage := range sourceInfo {
-			fmt.Printf("------------------------stage.ID------------------------: %+v\n", stage.ID)
 			_, err := tx.MessageRecords.Delete().Where(messagerecords.SourceIDEQ(stage.ID)).Exec(l.ctx)
 
 			if err != nil {