计划监控增加计划名
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
type MonitorService interface {
|
||||
ListSensorData(opts repository.SensorDataListOptions, page, pageSize int) ([]models.SensorData, int64, error)
|
||||
ListDeviceCommandLogs(opts repository.DeviceCommandLogListOptions, page, pageSize int) ([]models.DeviceCommandLog, int64, error)
|
||||
ListPlanExecutionLogs(opts repository.PlanExecutionLogListOptions, page, pageSize int) ([]models.PlanExecutionLog, int64, error)
|
||||
ListPlanExecutionLogs(opts repository.PlanExecutionLogListOptions, page, pageSize int) ([]models.PlanExecutionLog, []models.Plan, int64, error)
|
||||
ListTaskExecutionLogs(opts repository.TaskExecutionLogListOptions, page, pageSize int) ([]models.TaskExecutionLog, int64, error)
|
||||
ListPendingCollections(opts repository.PendingCollectionListOptions, page, pageSize int) ([]models.PendingCollection, int64, error)
|
||||
ListUserActionLogs(opts repository.UserActionLogListOptions, page, pageSize int) ([]models.UserActionLog, int64, error)
|
||||
@@ -32,6 +32,7 @@ type monitorService struct {
|
||||
sensorDataRepo repository.SensorDataRepository
|
||||
deviceCommandLogRepo repository.DeviceCommandLogRepository
|
||||
executionLogRepo repository.ExecutionLogRepository
|
||||
planRepository repository.PlanRepository
|
||||
pendingCollectionRepo repository.PendingCollectionRepository
|
||||
userActionLogRepo repository.UserActionLogRepository
|
||||
rawMaterialRepo repository.RawMaterialRepository
|
||||
@@ -49,6 +50,7 @@ func NewMonitorService(
|
||||
sensorDataRepo repository.SensorDataRepository,
|
||||
deviceCommandLogRepo repository.DeviceCommandLogRepository,
|
||||
executionLogRepo repository.ExecutionLogRepository,
|
||||
planRepository repository.PlanRepository,
|
||||
pendingCollectionRepo repository.PendingCollectionRepository,
|
||||
userActionLogRepo repository.UserActionLogRepository,
|
||||
rawMaterialRepo repository.RawMaterialRepository,
|
||||
@@ -64,6 +66,7 @@ func NewMonitorService(
|
||||
sensorDataRepo: sensorDataRepo,
|
||||
deviceCommandLogRepo: deviceCommandLogRepo,
|
||||
executionLogRepo: executionLogRepo,
|
||||
planRepository: planRepository,
|
||||
pendingCollectionRepo: pendingCollectionRepo,
|
||||
userActionLogRepo: userActionLogRepo,
|
||||
rawMaterialRepo: rawMaterialRepo,
|
||||
@@ -88,8 +91,25 @@ func (s *monitorService) ListDeviceCommandLogs(opts repository.DeviceCommandLogL
|
||||
}
|
||||
|
||||
// ListPlanExecutionLogs 负责处理查询计划执行日志列表的业务逻辑
|
||||
func (s *monitorService) ListPlanExecutionLogs(opts repository.PlanExecutionLogListOptions, page, pageSize int) ([]models.PlanExecutionLog, int64, error) {
|
||||
return s.executionLogRepo.ListPlanExecutionLogs(opts, page, pageSize)
|
||||
func (s *monitorService) ListPlanExecutionLogs(opts repository.PlanExecutionLogListOptions, page, pageSize int) ([]models.PlanExecutionLog, []models.Plan, int64, error) {
|
||||
planLogs, total, err := s.executionLogRepo.ListPlanExecutionLogs(opts, page, pageSize)
|
||||
if err != nil {
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
planIds := []uint{}
|
||||
for _, datum := range planLogs {
|
||||
for _, id := range planIds {
|
||||
if id == datum.PlanID {
|
||||
break
|
||||
}
|
||||
planIds = append(planIds, datum.PlanID)
|
||||
}
|
||||
}
|
||||
plans, err := s.planRepository.GetPlansByIDs(planIds)
|
||||
if err != nil {
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
return planLogs, plans, total, nil
|
||||
}
|
||||
|
||||
// ListTaskExecutionLogs 负责处理查询任务执行日志列表的业务逻辑
|
||||
|
||||
Reference in New Issue
Block a user