Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
LaMartin-Webomagic
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sneha
LaMartin-Webomagic
Commits
db630f46
Commit
db630f46
authored
Jul 03, 2024
by
Deep Dey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add apis download different templates
parent
8cd2577e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
440 additions
and
0 deletions
+440
-0
lamartinBackend/src/main/java/com/example/LaMartin/admission/controller/AdmissionFormController.java
...aMartin/admission/controller/AdmissionFormController.java
+118
-0
lamartinBackend/src/main/java/com/example/LaMartin/common/service/TemplateService.java
.../com/example/LaMartin/common/service/TemplateService.java
+26
-0
lamartinBackend/src/main/resources/templates/CounsellorScoringTemplate.html
...c/main/resources/templates/CounsellorScoringTemplate.html
+100
-0
lamartinBackend/src/main/resources/templates/InteractionMasterTemplate.html
...c/main/resources/templates/InteractionMasterTemplate.html
+87
-0
lamartinBackend/src/main/resources/templates/InteractionScoringTemplate.html
.../main/resources/templates/InteractionScoringTemplate.html
+109
-0
No files found.
lamartinBackend/src/main/java/com/example/LaMartin/admission/controller/AdmissionFormController.java
View file @
db630f46
...
@@ -194,4 +194,122 @@ public class AdmissionFormController {
...
@@ -194,4 +194,122 @@ public class AdmissionFormController {
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename=admission-form-list.pdf"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename=admission-form-list.pdf"
);
IOUtils
.
copy
(
pdfStream
,
response
.
getOutputStream
());
IOUtils
.
copy
(
pdfStream
,
response
.
getOutputStream
());
}
}
@GetMapping
(
value
=
"/admission-form/download-counsellor-scoring-template"
)
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
200
,
message
=
"SUCCESS"
),
@ApiResponse
(
code
=
400
,
message
=
"FAILED"
),
@ApiResponse
(
code
=
500
,
message
=
"Exception Occurred"
)
})
@ApiOperation
(
value
=
""
)
public
void
downloadCounsellorScoringTemplate
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@RequestParam
(
"apikey"
)
String
apiKey
,
@RequestParam
String
schoolName
,
@RequestParam
String
interactionDate
)
throws
Exception
{
List
<
AdmissionFormData
>
admissionFormDataList
=
this
.
admissionFormDAOController
.
getAdmissionFormDataList
(
schoolName
,
null
,
interactionDate
,
null
);
if
(
admissionFormDataList
.
isEmpty
())
{
throw
new
Exception
(
"No Admission Data Found"
);
}
String
output
=
templateService
.
generateCounsellorScoringTemplate
(
admissionFormDataList
);
ByteArrayInputStream
pdfStream
=
pdfService
.
convertHtmlToPdf
(
output
);
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename=counsellor-scoring-template.pdf"
);
IOUtils
.
copy
(
pdfStream
,
response
.
getOutputStream
());
}
@GetMapping
(
value
=
"/admission-form/download-interaction-scoring-template"
)
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
200
,
message
=
"SUCCESS"
),
@ApiResponse
(
code
=
400
,
message
=
"FAILED"
),
@ApiResponse
(
code
=
500
,
message
=
"Exception Occurred"
)
})
@ApiOperation
(
value
=
""
)
public
void
downloadInteractionScoringTemplate
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@RequestParam
(
"apikey"
)
String
apiKey
,
@RequestParam
String
schoolName
,
@RequestParam
String
interactionDate
)
throws
Exception
{
List
<
AdmissionFormData
>
admissionFormDataList
=
this
.
admissionFormDAOController
.
getAdmissionFormDataList
(
schoolName
,
null
,
interactionDate
,
null
);
if
(
admissionFormDataList
.
isEmpty
())
{
throw
new
Exception
(
"No Admission Data Found"
);
}
String
output
=
templateService
.
generateInteractionScoringTemplate
(
admissionFormDataList
);
ByteArrayInputStream
pdfStream
=
pdfService
.
convertHtmlToPdf
(
output
);
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename=interaction-scoring-template.pdf"
);
IOUtils
.
copy
(
pdfStream
,
response
.
getOutputStream
());
}
@GetMapping
(
value
=
"/admission-form/download-master-interaction-template"
)
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
200
,
message
=
"SUCCESS"
),
@ApiResponse
(
code
=
400
,
message
=
"FAILED"
),
@ApiResponse
(
code
=
500
,
message
=
"Exception Occurred"
)
})
@ApiOperation
(
value
=
""
)
public
void
downloadMasterInteractionTemplate
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@RequestParam
(
"apikey"
)
String
apiKey
,
@RequestParam
String
schoolName
,
@RequestParam
String
interactionDate
,
@RequestParam
String
interactionTime
)
throws
Exception
{
List
<
AdmissionFormData
>
admissionFormDataList
=
this
.
admissionFormDAOController
.
getAdmissionFormDataList
(
schoolName
,
null
,
interactionDate
,
interactionTime
);
if
(
admissionFormDataList
.
isEmpty
())
{
throw
new
Exception
(
"No Admission Data Found"
);
}
String
output
=
templateService
.
generateMasterInteractionTemplate
(
admissionFormDataList
);
ByteArrayInputStream
pdfStream
=
pdfService
.
convertHtmlToPdf
(
output
);
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename=master-interaction-template.pdf"
);
IOUtils
.
copy
(
pdfStream
,
response
.
getOutputStream
());
}
}
}
lamartinBackend/src/main/java/com/example/LaMartin/common/service/TemplateService.java
View file @
db630f46
...
@@ -3,6 +3,7 @@ package com.example.LaMartin.common.service;
...
@@ -3,6 +3,7 @@ package com.example.LaMartin.common.service;
import
com.example.LaMartin.admission.model.AdmissionFormData
;
import
com.example.LaMartin.admission.model.AdmissionFormData
;
import
com.example.LaMartin.config.Settings
;
import
com.example.LaMartin.config.Settings
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
org.jetbrains.annotations.NotNull
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.thymeleaf.TemplateEngine
;
import
org.thymeleaf.TemplateEngine
;
...
@@ -40,4 +41,29 @@ public class TemplateService {
...
@@ -40,4 +41,29 @@ public class TemplateService {
return
templateEngine
.
process
(
"FormAutoReplyTemplate"
,
context
);
return
templateEngine
.
process
(
"FormAutoReplyTemplate"
,
context
);
}
}
public
String
generateCounsellorScoringTemplate
(
@NotNull
List
<
AdmissionFormData
>
admissionFormDataList
)
{
String
givenYear
=
admissionFormDataList
.
get
(
0
).
getInteractionDate
().
substring
(
0
,
4
);
Context
context
=
new
Context
();
context
.
setVariable
(
"admissionFormList"
,
admissionFormDataList
);
context
.
setVariable
(
"givenYear"
,
Integer
.
parseInt
(
givenYear
));
return
templateEngine
.
process
(
"CounsellorScoringTemplate"
,
context
);
}
public
String
generateInteractionScoringTemplate
(
@NotNull
List
<
AdmissionFormData
>
admissionFormDataList
)
{
String
givenYear
=
admissionFormDataList
.
get
(
0
).
getInteractionDate
().
substring
(
0
,
4
);
Context
context
=
new
Context
();
context
.
setVariable
(
"admissionFormList"
,
admissionFormDataList
);
context
.
setVariable
(
"givenYear"
,
Integer
.
parseInt
(
givenYear
));
return
templateEngine
.
process
(
"InteractionScoringTemplate"
,
context
);
}
public
String
generateMasterInteractionTemplate
(
@NotNull
List
<
AdmissionFormData
>
admissionFormDataList
)
{
Context
context
=
new
Context
();
context
.
setVariable
(
"admissionFormList"
,
admissionFormDataList
);
return
templateEngine
.
process
(
"InteractionMasterTemplate"
,
context
);
}
}
}
lamartinBackend/src/main/resources/templates/CounsellorScoringTemplate.html
0 → 100644
View file @
db630f46
<!DOCTYPE html>
<html
xmlns:th=
"http://www.thymeleaf.org"
lang=
"en"
>
<head>
<title>
Interaction Scoring Sheet
</title>
<style>
@page
{
size
:
landscape
;
margin
:
0
;
}
*
{
margin
:
0
;
padding
:
0
;
box-sizing
:
border-box
;
}
body
{
font-family
:
Arial
,
sans-serif
;
}
.container
{
width
:
85%
;
margin
:
30px
auto
;
}
h1
,
h2
{
text-align
:
center
;
}
table
{
width
:
100%
;
border-collapse
:
collapse
;
margin-top
:
20px
;
}
table
,
th
,
td
{
border
:
1px
solid
black
;
}
th
,
td
{
padding
:
8px
;
text-align
:
center
;
}
.header-row
th
{
background-color
:
#f2f2f2
;
}
.date
{
text-align
:
left
;
margin-top
:
10px
;
margin-bottom
:
10px
;
}
</style>
</head>
<body>
<div
class=
"container"
>
<h1
style=
"text-transform: uppercase"
th:text=
"${admissionFormList[0].school}"
></h1>
<h2>
INTERACTION SCORING SHEET FOR THE YEAR
<span
th:text=
"${givenYear} + ' - ' + (${givenYear + 1})"
></span>
</h2>
<div
class=
"date"
>
DATE:
<span
th:text=
"${admissionFormList[0].interactionDate}"
></span>
<br></br>
ASSESSMENT BY COUNSELLOR / TEACHER
</div>
<table
style=
"font-size: 12px;"
>
<tr
class=
"header-row"
>
<th>
SL. NO.
</th>
<th>
Name, DOB
&
Comm.
</th>
<th>
Class
</th>
<th>
SELF CONFIDENCE
</th>
<th>
SOCIAL DEVELOPMENT
</th>
<th>
EMOTIONAL DEVELOPMENT
</th>
<th>
MENTAL DEVELOPMENT
</th>
<th>
COMMUNICATION
</th>
<th>
PARENTAL CARE
</th>
<th>
TOTAL
</th>
</tr>
<tr
th:each=
"admissionForm, iterStat : ${admissionFormList}"
>
<td
th:text=
"${iterStat.count}"
>
1
</td>
<td
th:text=
"${admissionForm.fullName}"
>
VIVANN SURANA
</td>
<td
th:text=
"${admissionForm.admissionClass}"
>
Upper Nursery
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
</body>
</html>
\ No newline at end of file
lamartinBackend/src/main/resources/templates/InteractionMasterTemplate.html
0 → 100644
View file @
db630f46
<!DOCTYPE html>
<html
xmlns:th=
"http://www.thymeleaf.org"
lang=
"en"
>
<head>
<title>
Interaction Scoring Sheet
</title>
<style>
*
{
margin
:
0
;
padding
:
0
;
box-sizing
:
border-box
;
}
body
{
font-family
:
Arial
,
sans-serif
;
}
.container
{
width
:
80%
;
margin
:
0
auto
;
}
.h1
,
.h4
{
text-align
:
center
;
}
.h1
{
text-transform
:
uppercase
;
font-size
:
24px
;
margin-bottom
:
10px
;
font-weight
:
600
;
}
.h4
{
font-size
:
16px
;
margin-bottom
:
20px
;
}
table
{
width
:
100%
;
border-collapse
:
collapse
;
margin-top
:
20px
;
}
table
,
th
,
td
{
border
:
1px
solid
black
;
}
th
,
td
{
padding
:
8px
;
text-align
:
center
;
}
.header-row
th
{
background-color
:
#f2f2f2
;
}
</style>
</head>
<body>
<div
class=
"container"
>
<div
class=
"h1"
th:text=
"${admissionFormList[0].school}"
>
LA MARTINIERE FOR BOYS
</div>
<div
class=
"h4"
>
INTERACTION MASTER LIST FOR
<span
th:text=
"${admissionFormList[0].interactionDate}"
></span>
AT
<span
th:text=
"${admissionFormList[0].interactionTime}"
></span>
</div>
<table
style=
"font-size: 12px;"
>
<tr
class=
"header-row"
>
<th>
SL. NO.
</th>
<th>
Reference Id
</th>
<th>
Name
</th>
<th>
Father's Name
</th>
</tr>
<tr
th:each=
"admissionForm, iterStat : ${admissionFormList}"
>
<td
th:text=
"${iterStat.count}"
>
1
</td>
<td
th:text=
"${admissionForm.fatherEmail}"
>
VIVANN SURANA
</td>
<td
th:text=
"${admissionForm.fullName}"
>
VIVANN SURANA
</td>
<td
th:text=
"${admissionForm.fatherName}"
>
Upper Nursery
</td>
</tr>
</table>
</div>
</body>
</html>
\ No newline at end of file
lamartinBackend/src/main/resources/templates/InteractionScoringTemplate.html
0 → 100644
View file @
db630f46
<!DOCTYPE html>
<html
xmlns:th=
"http://www.thymeleaf.org"
lang=
"en"
>
<head>
<title>
Interaction Scoring Sheet
</title>
<style>
@page
{
size
:
landscape
;
margin
:
0
;
}
*
{
margin
:
0
;
padding
:
0
;
box-sizing
:
border-box
;
}
body
{
font-family
:
Arial
,
sans-serif
;
}
.container
{
width
:
90%
;
margin
:
30px
auto
;
}
h1
,
h2
{
text-align
:
center
;
}
table
{
width
:
100%
;
border-collapse
:
collapse
;
margin-top
:
20px
;
font-size
:
12px
;
}
table
,
th
,
td
{
border
:
1px
solid
black
;
}
th
{
text-align
:
center
;
}
th
,
td
{
padding
:
8px
;
text-align
:
center
;
}
.header-row
th
{
background-color
:
#f2f2f2
;
}
.date
{
font-size
:
10.5px
;
text-align
:
left
;
margin-bottom
:
10px
;
}
</style>
</head>
<body>
<div
class=
"container"
>
<h1
style=
"text-transform: uppercase"
th:text=
"${admissionFormList[0].school}"
></h1>
<h2>
INTERACTION SCORING SHEET FOR THE YEAR
<span
th:text=
"${givenYear} + ' - ' + (${givenYear + 1})"
></span>
</h2>
<div
style=
"margin-top: 10px;"
>
<div
class=
"date"
style=
"float: right;"
>
<div>
ASSESSMENT BY (ON SCALE OF 10)
</div>
<div>
(1 BEING LOWEST, 10 BEING HIGHEST)
</div>
</div>
<div
class=
"date"
>
DATE:
<span
th:text=
"${admissionFormList[0].interactionDate}"
></span>
</div>
</div>
<table
style=
"font-size: 12px;"
>
<tr
class=
"header-row"
>
<th>
SL. NO.
</th>
<th>
Name, DOB
&
Comm.
</th>
<th>
Class
</th>
<th>
Category
</th>
<th>
Rev. (Dr.) S. Bar
<br></br>
(Ex-Officio, Governor)
</th>
<th>
Rev. Abir Adhikari
<br></br>
(Member, Board of Acting Governors)
</th>
<th>
Mr. P.A. John Stephen
<br></br>
(Acting Principal, La Martiniere for Boys)
</th>
<th>
Mr. S. Dhar
<br></br>
(Secretary)
</th>
<th>
Mr. R. Sarkar
<br></br>
(Bursar-cum-Assistant Secretary)
</th>
<th>
TOTAL
</th>
</tr>
<tr
th:each=
"admissionForm, iterStat : ${admissionFormList}"
>
<td
th:text=
"${iterStat.count}"
>
1
</td>
<td
th:text=
"${admissionForm.fullName}"
>
VIVANN SURANA
</td>
<td
th:text=
"${admissionForm.admissionClass}"
>
Upper Nursery
</td>
<td
th:text=
"${admissionForm.category}"
></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment