1 | class TaskSearchService { |
---|
2 | |
---|
3 | boolean transactional = false |
---|
4 | static scope = "request" |
---|
5 | |
---|
6 | def dateUtilService |
---|
7 | def authenticateService |
---|
8 | |
---|
9 | def getTodays(params) { |
---|
10 | params.max = Math.min(params?.max?.toInteger() ?: 10, 100) |
---|
11 | params.offset = params?.offset?.toInteger() ?: 0 |
---|
12 | params.sort = params?.sort ?: "id" |
---|
13 | params.order = params?.order ?: "desc" |
---|
14 | |
---|
15 | def taskInstanceList = Task.createCriteria().list( |
---|
16 | max: params.max, |
---|
17 | offset: params.offset, |
---|
18 | sort: params.sort, |
---|
19 | order: params.order) { |
---|
20 | ge("targetStartDate", dateUtilService.getToday()) |
---|
21 | lt("targetStartDate", dateUtilService.getTomorrow()) |
---|
22 | eq("isActive", true) |
---|
23 | } |
---|
24 | } |
---|
25 | |
---|
26 | def getMyTodays(params) { |
---|
27 | params.max = Math.min(params?.max?.toInteger() ?: 10, 100) |
---|
28 | params.offset = params?.offset?.toInteger() ?: 0 |
---|
29 | params.sort = params?.sort ?: "id" |
---|
30 | params.order = params?.order ?: "desc" |
---|
31 | |
---|
32 | def taskInstanceList = Task.createCriteria().list( |
---|
33 | max: params.max, |
---|
34 | offset: params.offset, |
---|
35 | sort: params.sort, |
---|
36 | order: params.order) { |
---|
37 | eq("leadPerson", Person.get(authenticateService.userDomain().id)) |
---|
38 | ge("targetStartDate", dateUtilService.getToday()) |
---|
39 | lt("targetStartDate", dateUtilService.getTomorrow()) |
---|
40 | eq("isActive", true) |
---|
41 | } |
---|
42 | } |
---|
43 | |
---|
44 | def getInTheLastWeek(params) { |
---|
45 | params.max = Math.min(params?.max?.toInteger() ?: 10, 100) |
---|
46 | params.offset = params?.offset?.toInteger() ?: 0 |
---|
47 | params.sort = params?.sort ?: "id" |
---|
48 | params.order = params?.order ?: "desc" |
---|
49 | |
---|
50 | def taskInstanceList = Task.createCriteria().list( |
---|
51 | max: params.max, |
---|
52 | offset: params.offset, |
---|
53 | sort: params.sort, |
---|
54 | order: params.order) { |
---|
55 | ge("targetStartDate", dateUtilService.getToday()-7) |
---|
56 | lt("targetStartDate", dateUtilService.getTomorrow()) |
---|
57 | eq("isActive", true) |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | def getMyInTheLastWeek(params) { |
---|
62 | params.max = Math.min(params?.max?.toInteger() ?: 10, 100) |
---|
63 | params.offset = params?.offset?.toInteger() ?: 0 |
---|
64 | params.sort = params?.sort ?: "id" |
---|
65 | params.order = params?.order ?: "desc" |
---|
66 | |
---|
67 | def taskInstanceList = Task.createCriteria().list( |
---|
68 | max: params.max, |
---|
69 | offset: params.offset, |
---|
70 | sort: params.sort, |
---|
71 | order: params.order) { |
---|
72 | eq("leadPerson", Person.get(authenticateService.userDomain().id)) |
---|
73 | ge("targetStartDate", dateUtilService.getToday()-7) |
---|
74 | lt("targetStartDate", dateUtilService.getTomorrow()) |
---|
75 | eq("isActive", true) |
---|
76 | } |
---|
77 | } |
---|
78 | } |
---|