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