[143] | 1 | class TaskSearchService { |
---|
| 2 | |
---|
| 3 | boolean transactional = false |
---|
| 4 | |
---|
| 5 | def dateUtilService |
---|
| 6 | def authenticateService |
---|
| 7 | |
---|
[260] | 8 | def paramsMax = 99999 |
---|
| 9 | |
---|
[143] | 10 | def getTodays(params) { |
---|
[260] | 11 | params.max = Math.min(params?.max?.toInteger() ?: 10, paramsMax) |
---|
[143] | 12 | params.offset = params?.offset?.toInteger() ?: 0 |
---|
| 13 | params.sort = params?.sort ?: "id" |
---|
| 14 | params.order = params?.order ?: "desc" |
---|
| 15 | |
---|
| 16 | def taskInstanceList = Task.createCriteria().list( |
---|
| 17 | max: params.max, |
---|
| 18 | offset: params.offset, |
---|
| 19 | sort: params.sort, |
---|
| 20 | order: params.order) { |
---|
[219] | 21 | ge("targetStartDate", dateUtilService.today) |
---|
[143] | 22 | lt("targetStartDate", dateUtilService.getTomorrow()) |
---|
[181] | 23 | eq("trash", false) |
---|
[143] | 24 | } |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | def getMyTodays(params) { |
---|
[260] | 28 | params.max = Math.min(params?.max?.toInteger() ?: 10, paramsMax) |
---|
[143] | 29 | params.offset = params?.offset?.toInteger() ?: 0 |
---|
| 30 | params.sort = params?.sort ?: "id" |
---|
| 31 | params.order = params?.order ?: "desc" |
---|
| 32 | |
---|
| 33 | def taskInstanceList = Task.createCriteria().list( |
---|
| 34 | max: params.max, |
---|
| 35 | offset: params.offset, |
---|
| 36 | sort: params.sort, |
---|
| 37 | order: params.order) { |
---|
| 38 | eq("leadPerson", Person.get(authenticateService.userDomain().id)) |
---|
[219] | 39 | ge("targetStartDate", dateUtilService.today) |
---|
[143] | 40 | lt("targetStartDate", dateUtilService.getTomorrow()) |
---|
[181] | 41 | eq("trash", false) |
---|
[143] | 42 | } |
---|
| 43 | } |
---|
[144] | 44 | |
---|
| 45 | def getInTheLastWeek(params) { |
---|
[260] | 46 | params.max = Math.min(params?.max?.toInteger() ?: 10, paramsMax) |
---|
[144] | 47 | params.offset = params?.offset?.toInteger() ?: 0 |
---|
| 48 | params.sort = params?.sort ?: "id" |
---|
| 49 | params.order = params?.order ?: "desc" |
---|
| 50 | |
---|
| 51 | def taskInstanceList = Task.createCriteria().list( |
---|
| 52 | max: params.max, |
---|
| 53 | offset: params.offset, |
---|
| 54 | sort: params.sort, |
---|
| 55 | order: params.order) { |
---|
[219] | 56 | ge("targetStartDate", dateUtilService.oneWeekAgo) |
---|
[144] | 57 | lt("targetStartDate", dateUtilService.getTomorrow()) |
---|
[181] | 58 | eq("trash", false) |
---|
[144] | 59 | } |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | def getMyInTheLastWeek(params) { |
---|
[260] | 63 | params.max = Math.min(params?.max?.toInteger() ?: 10, paramsMax) |
---|
[144] | 64 | params.offset = params?.offset?.toInteger() ?: 0 |
---|
| 65 | params.sort = params?.sort ?: "id" |
---|
| 66 | params.order = params?.order ?: "desc" |
---|
| 67 | |
---|
| 68 | def taskInstanceList = Task.createCriteria().list( |
---|
| 69 | max: params.max, |
---|
| 70 | offset: params.offset, |
---|
| 71 | sort: params.sort, |
---|
| 72 | order: params.order) { |
---|
| 73 | eq("leadPerson", Person.get(authenticateService.userDomain().id)) |
---|
[219] | 74 | ge("targetStartDate", dateUtilService.oneWeekAgo) |
---|
[144] | 75 | lt("targetStartDate", dateUtilService.getTomorrow()) |
---|
[181] | 76 | eq("trash", false) |
---|
[144] | 77 | } |
---|
| 78 | } |
---|
[165] | 79 | |
---|
| 80 | def getBudgetPlanned(params) { |
---|
[260] | 81 | params.max = Math.min(params?.max?.toInteger() ?: 10, paramsMax) |
---|
[165] | 82 | params.offset = params?.offset?.toInteger() ?: 0 |
---|
| 83 | params.sort = params?.sort ?: "id" |
---|
| 84 | params.order = params?.order ?: "desc" |
---|
| 85 | |
---|
| 86 | def taskInstanceList = Task.createCriteria().list( |
---|
| 87 | max: params.max, |
---|
| 88 | offset: params.offset, |
---|
| 89 | sort: params.sort, |
---|
| 90 | order: params.order) { |
---|
[252] | 91 | eq("taskBudgetStatus", TaskBudgetStatus.get(2)) |
---|
[219] | 92 | ge("targetStartDate", dateUtilService.oneWeekAgo) |
---|
[252] | 93 | lt("targetStartDate", dateUtilService.tomorrow) |
---|
[181] | 94 | eq("trash", false) |
---|
[165] | 95 | } |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | def getBudgetUnplanned(params) { |
---|
[260] | 99 | params.max = Math.min(params?.max?.toInteger() ?: 10, paramsMax) |
---|
[165] | 100 | params.offset = params?.offset?.toInteger() ?: 0 |
---|
| 101 | params.sort = params?.sort ?: "id" |
---|
| 102 | params.order = params?.order ?: "desc" |
---|
| 103 | |
---|
| 104 | def taskInstanceList = Task.createCriteria().list( |
---|
| 105 | max: params.max, |
---|
| 106 | offset: params.offset, |
---|
| 107 | sort: params.sort, |
---|
| 108 | order: params.order) { |
---|
[252] | 109 | eq("taskBudgetStatus", TaskBudgetStatus.get(1)) |
---|
[219] | 110 | ge("targetStartDate", dateUtilService.oneWeekAgo) |
---|
[165] | 111 | lt("targetStartDate", dateUtilService.getTomorrow()) |
---|
[181] | 112 | eq("trash", false) |
---|
[165] | 113 | } |
---|
| 114 | } |
---|
[143] | 115 | } |
---|