| | |
| | | package service |
| | | |
| | | import ( |
| | | "apsClient/conf" |
| | | "apsClient/constvar" |
| | | "apsClient/model" |
| | | "apsClient/model/common" |
| | |
| | | } |
| | | |
| | | // GetTask 获取任务,未完成的开始时间小于等于当前时间,结束时间大于当前时间的任务 |
| | | func (slf TaskService) GetTask(page, pageSize int, mode constvar.TaskMode, channels []int32) (taskResp *response.TaskResponse, code int) { |
| | | func (slf TaskService) GetTask(deviceID string, page, pageSize int, mode constvar.TaskMode, channels []int32) (taskResp *response.TaskResponse, code int) { |
| | | var taskList []*response.TaskData |
| | | var count int64 |
| | | var workers []*common.ProcedureWorker |
| | |
| | | workOrderIds []string |
| | | ) |
| | | search := model.NewProceduresSearch(nil). |
| | | SetDeviceId(conf.Conf.System.DeviceId). |
| | | SetDeviceId(deviceID). |
| | | SetPage(page, pageSize) |
| | | |
| | | if mode == constvar.TaskModeUnStarted { |
| | |
| | | } |
| | | return taskResp, ecode.OK |
| | | } |
| | | func (slf TaskService) NewTaskCount() (count int64) { |
| | | count, _ = model.NewProceduresSearch(nil).SetDeviceId(conf.Conf.System.DeviceId).SetStatus(model.ProcedureStatusWaitProcess).Count() |
| | | func (slf TaskService) NewTaskCount(deviceId string) (count int64) { |
| | | count, _ = model.NewProceduresSearch(nil).SetDeviceId(deviceId).SetStatus(model.ProcedureStatusWaitProcess).Count() |
| | | return count |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | // GetTask2 获取任务列表2 |
| | | func (slf TaskService) GetTask2(offset, limit int, channels []int32, queryType request.QueryType) (taskResp *response.TaskResponse, err error) { |
| | | func (slf TaskService) GetTask2(deviceID string, offset, limit int, channels []int32, queryType request.QueryType) (taskResp *response.TaskResponse, err error) { |
| | | var taskList []*response.TaskData |
| | | var count int64 |
| | | var workers []*common.ProcedureWorker |
| | |
| | | workOrderIds []string |
| | | ) |
| | | search := model.NewProceduresSearch(nil). |
| | | SetDeviceId(conf.Conf.System.DeviceId). |
| | | SetDeviceId(deviceID). |
| | | SetOffset(offset, limit).SetChannels(channels) |
| | | nowTs := time.Now().Unix() |
| | | switch queryType { |