Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-smf-form
Commits
83561f38
Commit
83561f38
authored
3 years ago
by
Darshan M N
Browse files
Options
Download
Patches
Plain Diff
Changes for the application status count
parent
10b8be76
master
bulk-download
cvs_download
delete-form
emailContentUpdate
inspection-flow-changes
institute-district
lat-long
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/main/java/com/tarento/formservice/model/Status.java
+1
-1
src/main/java/com/tarento/formservice/model/Status.java
src/main/java/com/tarento/formservice/service/FormsService.java
+2
-0
...in/java/com/tarento/formservice/service/FormsService.java
src/main/java/com/tarento/formservice/service/impl/FormsServiceImpl.java
+14
-14
...om/tarento/formservice/service/impl/FormsServiceImpl.java
src/main/java/com/tarento/formservice/utils/Constants.java
+3
-0
src/main/java/com/tarento/formservice/utils/Constants.java
with
20 additions
and
15 deletions
+20
-15
src/main/java/com/tarento/formservice/model/Status.java
+
1
−
1
View file @
83561f38
...
...
@@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
public
enum
Status
{
DRAFT
(
"Draft"
),
NEW
(
"New"
),
REVIEW
(
"Review"
),
PUBLISH
(
"Publish"
),
UNPUBLISH
(
"Unpublish"
),
INSCOMPLETED
(
"INSCOMPLETED"
),
LEADINSCOMPLETED
(
"LEADINSCOMPLETED"
);
"INSCOMPLETED"
),
LEADINSCOMPLETED
(
"LEADINSCOMPLETED"
)
,
SENTFORINS
(
"SENTFORINS"
)
;
private
String
value
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/formservice/service/FormsService.java
+
2
−
0
View file @
83561f38
...
...
@@ -29,6 +29,8 @@ import com.tarento.formservice.models.FormDetail;
*
*/
public
interface
FormsService
{
public
static
String
INSPECTION_LEAD_INSPECTOR
=
"inspectionLeadInspector"
;
public
Form
createForm
(
FormDetail
newForm
)
throws
IOException
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/formservice/service/impl/FormsServiceImpl.java
+
14
−
14
View file @
83561f38
...
...
@@ -782,7 +782,6 @@ public class FormsServiceImpl implements FormsService {
public
KeyValueList
getApplicationsStatusCount
(
UserInfo
userInfo
)
{
try
{
// query builder
if
(
userInfo
!=
null
&&
userInfo
.
getRoles
()
!=
null
)
{
for
(
Role
role
:
userInfo
.
getRoles
())
{
if
(
role
.
getName
().
equals
(
Roles
.
Regulator
.
name
()))
{
...
...
@@ -810,9 +809,10 @@ public class FormsServiceImpl implements FormsService {
finalList
.
setKeyValues
(
keyValueList
);
Calendar
startOfTodayCal
=
Calendar
.
getInstance
();
startOfTodayCal
.
setTime
(
new
Date
());
startOfTodayCal
.
set
(
Calendar
.
HOUR
,
0
);
startOfTodayCal
.
set
(
Calendar
.
AM_PM
,
Calendar
.
AM
);
startOfTodayCal
.
set
(
Calendar
.
MINUTE
,
01
);
startOfTodayCal
.
add
(
Calendar
.
DAY_OF_YEAR
,
-
1
);
startOfTodayCal
.
set
(
Calendar
.
HOUR
,
11
);
startOfTodayCal
.
set
(
Calendar
.
AM_PM
,
Calendar
.
PM
);
startOfTodayCal
.
set
(
Calendar
.
MINUTE
,
59
);
Calendar
endOfTodayCal
=
Calendar
.
getInstance
();
endOfTodayCal
.
setTime
(
new
Date
());
...
...
@@ -823,14 +823,14 @@ public class FormsServiceImpl implements FormsService {
// Creating Search Request for Total Pending
TermsQueryBuilder
userIdFilter
=
QueryBuilders
.
termsQuery
(
Constants
.
ElasticSearchFields
.
MAPPING
.
get
(
"inspectionLeadInspector"
),
userIdList
);
TermQueryBuilder
inspectionStatusFilter
=
QueryBuilders
.
termQuery
(
"inspection
.s
tatus
.keyword
"
,
"
SENTFORINS
"
);
TermQueryBuilder
statusFilter
=
QueryBuilders
.
termQuery
(
"status.keyword"
,
"
SENTFORINS
"
);
TermQueryBuilder
inspectionStatusFilter
=
QueryBuilders
.
termQuery
(
Constants
.
ElasticSearchFields
.
MAPPING
.
get
(
"inspection
S
tatus"
)
,
Status
.
SENTFORINS
.
name
()
);
TermQueryBuilder
statusFilter
=
QueryBuilders
.
termQuery
(
Constants
.
ElasticSearchFields
.
MAPPING
.
get
(
"status"
),
Status
.
SENTFORINS
.
name
()
);
BoolQueryBuilder
filters
=
QueryBuilders
.
boolQuery
().
filter
(
userIdFilter
)
.
filter
(
inspectionStatusFilter
).
filter
(
statusFilter
);
FilterAggregationBuilder
totalPendingAggregationFilter
=
AggregationBuilders
.
filter
(
"Inspector Total Pending"
,
filters
).
subAggregation
(
AggregationBuilders
.
cardinality
(
"Count"
).
field
(
"inspection
.a
pplicationId
.keyword
"
));
.
cardinality
(
"Count"
).
field
(
Constants
.
ElasticSearchFields
.
MAPPING
.
get
(
"inspection
A
pplicationId"
)
));
SearchSourceBuilder
totalPendingAggrSourceBuilder
=
new
SearchSourceBuilder
().
size
(
0
);
totalPendingAggrSourceBuilder
.
aggregation
(
totalPendingAggregationFilter
);
SearchRequest
totalPendingSearchRequest
=
new
SearchRequest
(
appConfig
.
getFormDataIndex
())
...
...
@@ -842,13 +842,13 @@ public class FormsServiceImpl implements FormsService {
finalList
.
getKeyValues
().
addAll
(
list
.
getKeyValues
());
// Creating Search Request for Received Today
RangeQueryBuilder
assignedDateFilter
=
QueryBuilders
.
rangeQuery
(
"inspection
.a
ssignedDate"
)
RangeQueryBuilder
assignedDateFilter
=
QueryBuilders
.
rangeQuery
(
"inspection
A
ssignedDate"
)
.
from
(
startOfTodayCal
.
getTime
().
getTime
()).
to
(
endOfTodayCal
.
getTime
().
getTime
());
BoolQueryBuilder
filters2
=
QueryBuilders
.
boolQuery
().
filter
(
userIdFilter
)
.
filter
(
assignedDateFilter
);
FilterAggregationBuilder
receivedTodayAggregationFilter
=
AggregationBuilders
.
filter
(
"Received Today"
,
filters2
).
subAggregation
(
AggregationBuilders
.
cardinality
(
"Count"
).
field
(
"inspection
.a
pplicationId
.keyword
"
));
.
cardinality
(
"Count"
).
field
(
Constants
.
ElasticSearchFields
.
MAPPING
.
get
(
"inspection
A
pplicationId"
)
));
SearchSourceBuilder
receivedTodayAggrSourceBuilder
=
new
SearchSourceBuilder
().
size
(
0
);
receivedTodayAggrSourceBuilder
.
aggregation
(
receivedTodayAggregationFilter
);
SearchRequest
receivedTodaySearchRequest
=
new
SearchRequest
(
appConfig
.
getFormDataIndex
())
...
...
@@ -860,15 +860,15 @@ public class FormsServiceImpl implements FormsService {
finalList
.
getKeyValues
().
addAll
(
list
.
getKeyValues
());
// Creating Search Request for Reviewed Today
RangeQueryBuilder
updatedDateFilter
=
QueryBuilders
.
rangeQuery
(
"inspection
.u
pdatedDate"
)
RangeQueryBuilder
updatedDateFilter
=
QueryBuilders
.
rangeQuery
(
Constants
.
ElasticSearchFields
.
MAPPING
.
get
(
"inspection
U
pdatedDate"
)
)
.
from
(
startOfTodayCal
.
getTime
().
getTime
()).
to
(
endOfTodayCal
.
getTime
().
getTime
());
TermQueryBuilder
inspectionCompletedFilter
=
QueryBuilders
.
termQuery
(
"status.keyword"
,
"
INSCOMPLETED
"
);
TermQueryBuilder
inspectionCompletedFilter
=
QueryBuilders
.
termQuery
(
Constants
.
ElasticSearchFields
.
MAPPING
.
get
(
"status"
)
,
Status
.
INSCOMPLETED
.
name
()
);
BoolQueryBuilder
filters3
=
QueryBuilders
.
boolQuery
().
filter
(
userIdFilter
)
.
filter
(
updatedDateFilter
).
filter
(
inspectionCompletedFilter
);
FilterAggregationBuilder
reviewedTodayAggregationFilter
=
AggregationBuilders
.
filter
(
"Reviewed Today"
,
filters3
).
subAggregation
(
AggregationBuilders
.
cardinality
(
"Count"
).
field
(
"inspection
.a
pplicationId
.keyword
"
));
.
cardinality
(
"Count"
).
field
(
Constants
.
ElasticSearchFields
.
MAPPING
.
get
(
"inspection
A
pplicationId"
)
));
SearchSourceBuilder
reviewedTodayAggrSourceBuilder
=
new
SearchSourceBuilder
().
size
(
0
);
reviewedTodayAggrSourceBuilder
.
aggregation
(
reviewedTodayAggregationFilter
);
SearchRequest
reviewedTodaySearchRequest
=
new
SearchRequest
(
appConfig
.
getFormDataIndex
())
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/formservice/utils/Constants.java
+
3
−
0
View file @
83561f38
...
...
@@ -199,6 +199,9 @@ public interface Constants {
put
(
"assignedTo"
,
"inspection.assignedTo.id"
);
put
(
"inspectionStatus"
,
"inspection.status.keyword"
);
put
(
"inspectionLeadInspector"
,
"inspection.leadInspector"
);
put
(
"inspectionApplicationId"
,
"inspection.applicationId.keyword"
);
put
(
"inspectionAssignedDate"
,
"inspection.assignedDate"
);
put
(
"inspectionUpdatedDate"
,
"inspection.updatedDate"
);
}
};
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets