Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
doerj-caderno-dxp-7.2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
diogo.souza
doerj-caderno-dxp-7.2
Commits
ce6d0e34
Commit
ce6d0e34
authored
Jun 17, 2021
by
Diogo Fellipe De Melo Souza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajustes para homologação
parent
fa438c86
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
14 deletions
+67
-14
CadernoUtil.class
bin/main/mprj/doerj/caderno/util/CadernoUtil.class
+0
-0
GeraCaderno.class
bin/main/mprj/doerj/caderno/util/GeraCaderno.class
+0
-0
CadernoUtil.java
src/main/java/mprj/doerj/caderno/util/CadernoUtil.java
+66
-13
GeraCaderno.java
src/main/java/mprj/doerj/caderno/util/GeraCaderno.java
+1
-1
No files found.
bin/main/mprj/doerj/caderno/util/CadernoUtil.class
View file @
ce6d0e34
No preview for this file type
bin/main/mprj/doerj/caderno/util/GeraCaderno.class
View file @
ce6d0e34
No preview for this file type
src/main/java/mprj/doerj/caderno/util/CadernoUtil.java
View file @
ce6d0e34
...
...
@@ -35,6 +35,8 @@ import org.docx4j.wml.PPrBase;
import
org.docx4j.wml.PPrBase.NumPr
;
import
org.docx4j.wml.PPrBase.NumPr.Ilvl
;
import
org.docx4j.wml.PPrBase.NumPr.NumId
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
org.docx4j.wml.R
;
import
mprj.doerj.caderno.application.model.Lista
;
...
...
@@ -63,7 +65,10 @@ public class CadernoUtil {
if
(
tipo
.
equals
(
"conteudo"
)||
tipo
.
equals
(
"conteudoPrimeiraPagina"
)){
textoHtml
=
tratarTagsHtml
(
textoHtml
,
"p"
,
"manterTags"
);
textoHtml
=
tratarTagsHtml
(
textoHtml
,
"o:p"
,
"manterTags"
);
textoHtml
=
tratarTagsHtml
(
textoHtml
,
"b"
,
"manterTags"
);
textoHtml
=
tratarTagsHtml
(
textoHtml
,
"u"
,
"manterTags"
);
textoHtml
=
tratarTagsHtml
(
textoHtml
,
"span"
,
"manterTags"
);
...
...
@@ -75,11 +80,11 @@ public class CadernoUtil {
textoHtml
=
tratarTagsHtml
(
textoHtml
,
"ul"
,
"manterTags"
);
textoHtml
=
tratarTagsHtml
(
textoHtml
,
"li"
,
"manterTags"
);
textoHtml
=
textoHtml
.
replaceAll
(
"<p> </p>"
,
""
);
textoHtml
=
textoHtml
.
replaceAll
(
"<p></p>"
,
""
);
textoHtml
=
textoHtml
.
replaceAll
(
"data:image="""
,
""
);
textoHtml
=
textoHtml
.
replaceAll
(
"\""
,
""
);
textoHtml
=
textoHtml
.
replaceAll
(
"–"
,
"-"
);
textoHtml
=
textoHtml
.
replaceAll
(
"<p> </p>"
,
""
);
textoHtml
=
textoHtml
.
replaceAll
(
" "
,
" "
);
textoHtml
=
textoHtml
.
replaceAll
(
"""
,
"'"
);
textoHtml
=
textoHtml
.
replaceAll
(
"<h2>"
,
"<p>"
);
...
...
@@ -112,15 +117,15 @@ public class CadernoUtil {
primeirosChar
=
textoHtml
.
substring
(
1
,
3
);
if
(!
primeirosChar
.
equals
(
"<p>"
)&&
!
tipo
.
equals
(
"conteudoPrimeiraPagina"
)){
textoHtml
=
"<p align='JUSTIFY'>"
+
textoHtml
+
"</p>"
;
//
textoHtml = "<p>" + textoHtml + "</p>";
/*
if (!primeirosChar.equals("<p>")&& !tipo.equals("conteudoPrimeiraPagina")){
//
textoHtml = "<p align='JUSTIFY'>" + textoHtml + "</p>";
textoHtml = "<p>" + textoHtml + "</p>";
}
}
*/
if
(
tipo
.
equals
(
"conteudo"
)){
//textoHtml = "<body><head><style type='" + "text/css'" + ">p{font-family:Spranq eco sans;font-size:12px;} </style></head>" + textoHtml + "<p></p></body>";
textoHtml
=
"<body><head><style type='"
+
"text/css'"
+
">p{font-family:Spranq eco sans;font-size:12px;margin-left:-4px;} ul {list-style-type: circle;} </style></head>"
+
textoHtml
+
"</body>"
;
textoHtml
=
"<body><head><style type='"
+
"text/css'"
+
">p{font-family:Spranq eco sans;font-size:12px;margin-left:-4px;
text-align:justify;margin-top:0px;margin-bottom:0px;
} ul {list-style-type: circle;} </style></head>"
+
textoHtml
+
"</body>"
;
//textoHtml = "<body><head></head>" + textoHtml + "</body>";
}
...
...
@@ -248,6 +253,14 @@ public class CadernoUtil {
}
if
(
tag
.
equals
(
"o:p"
)){
tagAberta
=
"<o:p "
;
tagFechada
=
"<o:p>"
;
tamanhoTag
=
5
;
}
int
len
=
conteudoHtml
.
length
();
String
tagP
=
""
;
...
...
@@ -297,6 +310,11 @@ public class CadernoUtil {
conteudoHtml
=
conteudoHtml
.
replaceAll
(
"</sup>"
,
""
);
conteudoHtml
=
conteudoHtml
.
replaceAll
(
"<sup>"
,
""
);
i
=
0
;
}
else
if
(
tag
.
equals
(
"o:p"
)){
conteudoHtml
=
conteudoHtml
.
replace
(
strAcumulado
,
""
);
conteudoHtml
=
conteudoHtml
.
replaceAll
(
"</o:p>"
,
""
);
conteudoHtml
=
conteudoHtml
.
replaceAll
(
"<o:p>"
,
""
);
i
=
0
;
}
else
if
(
tag
.
equals
(
"ol"
)){
if
(
strAcumulado
.
contains
(
"alpha"
))
{
...
...
@@ -424,6 +442,11 @@ public static String gerarDataCabecalho(String data) throws ParseException{
gc
.
setTime
(
dataConverter
);
int
diaSemana
=
gc
.
get
(
GregorianCalendar
.
DAY_OF_WEEK
);
if
(
dia
.
substring
(
0
,
1
).
equals
(
"0"
))
{
dia
=
dia
.
substring
(
1
,
2
);
}
if
(
diaSemana
==
1
){
diaSemanaStr
=
"Domingo"
;
}
...
...
@@ -718,8 +741,7 @@ public static String tratarLista(String conteudoHtml){
int
tamanhoTag
=
0
;
String
marcador
=
""
;
String
newTagP
=
""
;
String
dezEspacos
=
" "
;
String
noveEspacos
=
" "
;
String
espacos
=
"\u202F\u202F"
;
char
alpha
=
'a'
;
tamanhoTag
=
4
;
...
...
@@ -775,9 +797,9 @@ public static String tratarLista(String conteudoHtml){
newTagP
=
"<p style='margin-left:"
+
margem
+
"px'>"
;
if
(
item
<=
9
)
{
marcador
=
newTagP
+
String
.
valueOf
(
listaOls
.
get
(
indiceListaAtual
))+
"."
+
dezE
spacos
;
marcador
=
newTagP
+
String
.
valueOf
(
listaOls
.
get
(
indiceListaAtual
))+
"."
+
e
spacos
;
}
else
{
marcador
=
newTagP
+
String
.
valueOf
(
listaOls
.
get
(
indiceListaAtual
))+
"."
+
noveE
spacos
;
marcador
=
newTagP
+
String
.
valueOf
(
listaOls
.
get
(
indiceListaAtual
))+
"."
+
e
spacos
;
}
item
=
listaOls
.
get
(
indiceListaAtual
)+
1
;
...
...
@@ -788,7 +810,7 @@ public static String tratarLista(String conteudoHtml){
if
(
tagO1
==
true
)
{
newTagP
=
"<p style='margin-left:0px'>"
;
marcador
=
newTagP
+
alpha
+
". "
;
marcador
=
newTagP
+
alpha
+
espacos
;
conteudoHtml
=
conteudoHtml
.
substring
(
0
,
i
)
+
marcador
+
conteudoHtml
.
substring
(
i
+
tamanhoTag
,
conteudoHtml
.
length
());
alpha
++;
len
=
conteudoHtml
.
length
();
...
...
@@ -797,7 +819,7 @@ public static String tratarLista(String conteudoHtml){
if
(
tagOl
==
false
&&
tagO1
==
false
)
{
newTagP
=
"<p style='margin-left:0px'>"
;
marcador
=
newTagP
+
"\u2022 "
;
marcador
=
newTagP
+
espacos
;
conteudoHtml
=
conteudoHtml
.
substring
(
0
,
i
)
+
marcador
+
conteudoHtml
.
substring
(
i
+
tamanhoTag
,
conteudoHtml
.
length
());
len
=
conteudoHtml
.
length
();
}
...
...
@@ -828,5 +850,36 @@ public static String tratarLista(String conteudoHtml){
return
conteudoHtml
;
}
public
String
trataNome
(
JSONArray
listaConteudos
,
String
titulo
)
{
String
tituloTratado
=
""
;
Long
contador
=
0L
;
int
indiceItem
=
0
;
for
(
int
i
=
0
;
i
<
listaConteudos
.
length
();
i
++){
JSONObject
obj
=
new
JSONObject
(
listaConteudos
.
get
(
i
).
toString
());
tituloTratado
=
obj
.
get
(
"NOME"
).
toString
();
if
(
titulo
.
equals
(
tituloTratado
))
{
contador
++;
indiceItem
=
i
;
}
}
if
(
contador
>
1
)
{
JSONObject
obj
=
new
JSONObject
(
listaConteudos
.
get
(
indiceItem
).
toString
());
tituloTratado
=
obj
.
get
(
"NOMEPLURAL"
).
toString
();
}
else
{
JSONObject
obj
=
new
JSONObject
(
listaConteudos
.
get
(
indiceItem
).
toString
());
tituloTratado
=
obj
.
get
(
"NOME"
).
toString
();
}
return
tituloTratado
;
}
}
src/main/java/mprj/doerj/caderno/util/GeraCaderno.java
View file @
ce6d0e34
...
...
@@ -197,7 +197,7 @@ public class GeraCaderno {
orgao
=
util
.
tratarString
(
orgao
,
"titulo"
);
titulo
=
obj
.
get
(
"NOME"
).
toString
(
);
titulo
=
util
.
trataNome
(
listaConteudos
,
obj
.
get
(
"NOME"
).
toString
()
);
titulo
=
util
.
tratarString
(
titulo
,
"titulo"
);
conteudo
=
obj
.
get
(
"CONTEUDO"
).
toString
();
...
...
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