Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SkuciSe
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tim 2 - 2022
SkuciSe
Commits
6e31cddb
Commit
6e31cddb
authored
Sep 19, 2022
by
Bogdan Andjelkovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
back za obostrane komentar uradjen jos front da se sakrije kad je komentarisano vec
parent
316631a7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletions
+31
-1
SkuciSe/src/main/java/com/example/SkuciSe/controller/KomentarController.java
+10
-1
SkuciSe/src/main/java/com/example/SkuciSe/repository/ZahtevRepository.java
+20
-0
SkuciSe/src/main/resources/templates/oglas.html
+1
-0
No files found.
SkuciSe/src/main/java/com/example/SkuciSe/controller/KomentarController.java
View file @
6e31cddb
package
com
.
example
.
SkuciSe
.
controller
;
package
com
.
example
.
SkuciSe
.
controller
;
import
com.example.SkuciSe.model.zahtev.Zahtev
;
import
com.example.SkuciSe.repository.KomentarRepository
;
import
com.example.SkuciSe.repository.KomentarRepository
;
import
com.example.SkuciSe.repository.KomentarVlasnikRepository
;
import
com.example.SkuciSe.repository.KomentarVlasnikRepository
;
import
com.example.SkuciSe.repository.ZahtevRepository
;
import
com.example.SkuciSe.repository.ZahtevRepository
;
...
@@ -25,7 +26,10 @@ public class KomentarController {
...
@@ -25,7 +26,10 @@ public class KomentarController {
{
{
try
{
try
{
komentarRepo
.
insert
(
korisnikId
,
oglasId
,
text
,
ocenaRadio
);
komentarRepo
.
insert
(
korisnikId
,
oglasId
,
text
,
ocenaRadio
);
zRepo
.
deleteZahtev
(
zahtevId
);
zRepo
.
zahtevKorisnikKom
(
zahtevId
);
Zahtev
zahtev
=
zRepo
.
findZahtevById
(
zahtevId
);
if
(
zahtev
.
getKorisnikKom
()
&&
zahtev
.
getVlasnikKom
())
zRepo
.
deleteZahtev
(
zahtevId
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
@@ -35,11 +39,16 @@ public class KomentarController {
...
@@ -35,11 +39,16 @@ public class KomentarController {
@GetMapping
(
"/oceni-korisnika"
)
@GetMapping
(
"/oceni-korisnika"
)
public
String
getOceniKorisnika
(
@RequestParam
(
"vlasnikId"
)
int
vlasnikId
,
public
String
getOceniKorisnika
(
@RequestParam
(
"vlasnikId"
)
int
vlasnikId
,
@RequestParam
(
"korisnikId"
)
int
korisnikId
,
@RequestParam
(
"korisnikId"
)
int
korisnikId
,
@RequestParam
(
"zahtevId"
)
int
zahtevId
,
@RequestParam
(
"ocenaRadio"
)
int
ocenaRadio
,
@RequestParam
(
"ocenaRadio"
)
int
ocenaRadio
,
@RequestParam
(
"komentar"
)
String
text
)
@RequestParam
(
"komentar"
)
String
text
)
{
{
try
{
try
{
komentarVlasnikRepo
.
insert
(
vlasnikId
,
korisnikId
,
ocenaRadio
,
text
);
komentarVlasnikRepo
.
insert
(
vlasnikId
,
korisnikId
,
ocenaRadio
,
text
);
zRepo
.
zahtevVlasnikKom
(
zahtevId
);
Zahtev
zahtev
=
zRepo
.
findZahtevById
(
zahtevId
);
if
(
zahtev
.
getKorisnikKom
()
&&
zahtev
.
getVlasnikKom
())
zRepo
.
deleteZahtev
(
zahtevId
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
...
SkuciSe/src/main/java/com/example/SkuciSe/repository/ZahtevRepository.java
View file @
6e31cddb
...
@@ -178,4 +178,24 @@ public class ZahtevRepository {
...
@@ -178,4 +178,24 @@ public class ZahtevRepository {
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
}
}
public
Zahtev
findZahtevById
(
int
zahtevId
)
{
this
.
postaviFinishedZahteve
();
String
sql
=
"call findZahtevById(?)"
;
CallableStatement
stmt
=
null
;
ResultSet
rs
=
null
;
try
{
stmt
=
dataBase
.
connection
.
prepareCall
(
sql
);
stmt
.
setInt
(
1
,
zahtevId
);
rs
=
stmt
.
executeQuery
();
while
(
rs
.
next
())
{
return
new
Zahtev
(
rs
.
getInt
(
1
),
rs
.
getInt
(
2
),
rs
.
getInt
(
3
),
rs
.
getString
(
4
),
rs
.
getString
(
5
),
StanjeZahteva
.
valueOf
(
rs
.
getString
(
6
)),
rs
.
getBoolean
(
7
),
rs
.
getBoolean
(
8
));
}
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
(
null
);
}
}
}
SkuciSe/src/main/resources/templates/oglas.html
View file @
6e31cddb
...
@@ -316,6 +316,7 @@
...
@@ -316,6 +316,7 @@
<form
method=
"get"
th:action=
"@{/oceni-korisnika}"
>
<form
method=
"get"
th:action=
"@{/oceni-korisnika}"
>
<input
type=
"text"
th:value=
"${loggedUser.korisnik.korisnikId}"
name=
"vlasnikId"
style=
"display: none"
>
<input
type=
"text"
th:value=
"${loggedUser.korisnik.korisnikId}"
name=
"vlasnikId"
style=
"display: none"
>
<input
type=
"text"
th:value=
"${korisnik.korisnikId}"
name=
"korisnikId"
style=
"display: none"
>
<input
type=
"text"
th:value=
"${korisnik.korisnikId}"
name=
"korisnikId"
style=
"display: none"
>
<input
type=
"text"
th:value=
"${zahtevi[korisnikStat.index].zahtevId}"
name=
"zahtevId"
style=
"display: none"
>
<input
type=
"number"
name=
"ocenaRadio"
><br>
<input
type=
"number"
name=
"ocenaRadio"
><br>
<input
type=
"text"
name=
"komentar"
><br>
<input
type=
"text"
name=
"komentar"
><br>
<button
type=
"submit"
>
Oceni
</button>
<button
type=
"submit"
>
Oceni
</button>
...
...
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