|
@@ -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
|