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
examsAndAdmissions
Commits
b2853199
Commit
b2853199
authored
1 year ago
by
jay pratap singh
Browse files
Options
Download
Patches
Plain Diff
fixed dispatch proof errors
parent
057423ef
github/fork/ruksana2808/filter_bug_examCycle
bug_fix_question_paper_upload
development
1 merge request
!157
fixed dispatch proof errors
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/DispatchTrackerService.java
+16
-10
...mf/examsAndAdmissions/service/DispatchTrackerService.java
with
16 additions
and
10 deletions
+16
-10
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/DispatchTrackerService.java
+
16
−
10
View file @
b2853199
...
...
@@ -30,6 +30,8 @@ import java.util.Calendar;
import
java.util.Date
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
@Service
@Slf4j
...
...
@@ -223,7 +225,11 @@ public class DispatchTrackerService {
List
<
ExamCenter
>
allInstitutes
=
examCenterRepository
.
findByExamCycle_Id
(
examCycleId
);
List
<
DispatchTracker
>
uploadedProofsForExam
=
dispatchTrackerRepository
.
findByExamIdAndExamCycleId
(
examId
,
examCycleId
);
/*Exam exam = examRepository.findById(examId).orElse(null); // Fetch the exam details
Exam
exam
=
examRepository
.
findById
(
examId
).
orElse
(
null
);
// Fetch the exam details
// Creating a map of Institute ID to DispatchTracker for quick lookup
Map
<
Long
,
DispatchTracker
>
dispatchTrackerMap
=
uploadedProofsForExam
.
stream
()
.
collect
(
Collectors
.
toMap
(
dispatch
->
dispatch
.
getExamCenter
().
getId
(),
Function
.
identity
()));
List
<
InstituteDispatchStatusDto
>
result
=
new
ArrayList
<>();
...
...
@@ -231,27 +237,25 @@ public class DispatchTrackerService {
InstituteDispatchStatusDto
statusDto
=
new
InstituteDispatchStatusDto
();
statusDto
.
setInstituteId
(
institute
.
getId
());
statusDto
.
setInstituteName
(
institute
.
getName
());
statusDto.setExamName(exam != null ? exam.getExamName() : null);
// Set exam name
statusDto
.
setExamName
(
exam
!=
null
?
exam
.
getExamName
()
:
null
);
DispatchTracker matchedDispatch = uploadedProofsForExam.stream()
.filter(dispatch -> dispatch.getExamCenter().getId().equals(institute.getId()))
.findFirst()
.orElse(null);
DispatchTracker
matchedDispatch
=
dispatchTrackerMap
.
get
(
institute
.
getId
());
if
(
matchedDispatch
!=
null
)
{
statusDto
.
setProofUploaded
(
true
);
statusDto
.
setUpdatedDate
(
matchedDispatch
.
getDispatchDate
());
statusDto.setDispatchProofFileLocation(generateSignedUrl(matchedDispatch.getDispatchProofFileLocation()));
// Use the method here
statusDto
.
setDispatchProofFileLocation
(
generateSignedUrl
(
matchedDispatch
.
getDispatchProofFileLocation
()));
}
else
{
statusDto
.
setProofUploaded
(
false
);
// Here you can set default values or placeholders for other fields if needed
}
result
.
add
(
statusDto
);
}
*/
}
if
(!
uploadedProofsForExam
.
isEmpty
())
{
if
(!
result
.
isEmpty
())
{
response
.
put
(
Constants
.
MESSAGE
,
Constants
.
SUCCESSMESSAGE
);
response
.
put
(
Constants
.
RESPONSE
,
uploadedProofsForExam
);
response
.
put
(
Constants
.
RESPONSE
,
result
);
response
.
setResponseCode
(
HttpStatus
.
OK
);
}
else
{
ResponseDto
.
setErrorResponse
(
response
,
"NO_DATA_FOUND"
,
"No dispatch data found for the given exam and exam cycle across all institutes."
,
HttpStatus
.
NOT_FOUND
);
...
...
@@ -259,6 +263,8 @@ public class DispatchTrackerService {
return
response
;
}
private
String
generateSignedUrl
(
String
blobName
)
{
try
{
// Define resource
...
...
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