Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
th-app-java
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oscar Enrique Gonzalez Escurra
th-app-java
Commits
89dd6852
Commit
89dd6852
authored
Nov 15, 2021
by
Nelson Ruiz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
validacion en el controller para fechas solapadas de una convocatoria
parent
e7f75029
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
curriculumsearch/mvnw
+0
-0
curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java
+28
-3
No files found.
curriculumsearch/mvnw
100644 → 100755
View file @
89dd6852
File mode changed from 100644 to 100755
curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java
View file @
89dd6852
...
...
@@ -3,10 +3,13 @@ package com.roshka.controller;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
com.roshka.modelo.Cargo
;
import
com.roshka.modelo.ConvocatoriaCargo
;
import
com.roshka.repositorio.CargoRepository
;
import
com.roshka.repositorio.ConvocatoriaRepository
;
import
org.apache.jasper.tagplugins.jstl.core.ForEach
;
import
org.dom4j.Branch
;
import
org.hibernate.jpa.TypedParameterValue
;
import
org.hibernate.type.IntegerType
;
import
org.hibernate.type.LongType
;
...
...
@@ -49,13 +52,18 @@ public class ConvocatoriaController {
@RequestMapping
(
path
=
{
"/convocatoria"
,
"/convocatoria/{id}"
})
public
String
formConvocatoria
(
Model
model
,
@PathVariable
(
required
=
false
)
Long
id
)
{
model
.
addAttribute
(
"cargos"
,
cargoRepo
.
findAll
());
if
(
id
==
null
)
model
.
addAttribute
(
"convocatoria"
,
new
ConvocatoriaCargo
());
if
(
id
==
null
){
model
.
addAttribute
(
"convocatoria"
,
new
ConvocatoriaCargo
());
model
.
addAttribute
(
"listaConvocatoria"
,
convoRepo
.
findAll
());
}
else
{
ConvocatoriaCargo
cc
=
convoRepo
.
getById
(
id
);
cc
.
setFechaFinS
(
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
((
cc
.
getFechaFin
())));
cc
.
setFechaInicioS
(
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
((
cc
.
getFechaInicio
())));
model
.
addAttribute
(
"convocatoria"
,
cc
);
model
.
addAttribute
(
"listaConvocatoria"
,
convoRepo
.
findAll
());
}
return
"convocatoria-form"
;
...
...
@@ -65,8 +73,25 @@ public class ConvocatoriaController {
public
String
guardarConvocatoria
(
@ModelAttribute
ConvocatoriaCargo
convocatoria
,
BindingResult
result
,
@PathVariable
(
required
=
false
)
Long
id
)
{
if
(
result
.
hasErrors
());
if
(
id
!=
null
)
convocatoria
.
setId
(
id
);
convoRepo
.
save
(
convocatoria
);
System
.
out
.
println
(
convocatoria
.
getFechaInicio
());
//System.out.println(convoRepo.filtrarConvocatoriasPorCargo(convocatoria.getCargoId()));
for
(
ConvocatoriaCargo
c:
convoRepo
.
filtrarConvocatoriasPorCargo
(
convocatoria
.
getCargoId
())){
if
(
c
.
getCargoId
()==
convocatoria
.
getCargoId
()
&&
c
.
getFechaFin
().
after
(
convocatoria
.
getFechaInicio
())
)
{
return
"redirect:/convocatoria"
;
}
else
{
convoRepo
.
save
(
convocatoria
);
System
.
out
.
println
(
"si anda"
);
break
;
}
}
return
"redirect:/convocatorias"
;
}
}
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