Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
QLNS_N01
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyễn Văn Hiếu
QLNS_N01
Commits
5df49b2f
Commit
5df49b2f
authored
Jun 05, 2019
by
Phạm Duy Phi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
9f0b15b1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
55 deletions
+55
-55
src/main/java/com/itsol/quantrivanphong/manage/leaveform/business/LeaveFormBusiness.java
...vanphong/manage/leaveform/business/LeaveFormBusiness.java
+2
-2
src/main/java/com/itsol/quantrivanphong/manage/leaveform/controller/LeaveFormController.java
...hong/manage/leaveform/controller/LeaveFormController.java
+4
-4
src/main/java/com/itsol/quantrivanphong/manage/leaveform/repository/LeaveFormRepository.java
...hong/manage/leaveform/repository/LeaveFormRepository.java
+2
-2
src/main/java/com/itsol/quantrivanphong/manage/timesheet/business/TimeSheetBusiness.java
...vanphong/manage/timesheet/business/TimeSheetBusiness.java
+26
-26
src/main/java/com/itsol/quantrivanphong/manage/timesheet/controller/TimeSheetController.java
...hong/manage/timesheet/controller/TimeSheetController.java
+13
-13
src/main/java/com/itsol/quantrivanphong/manage/timesheet/repository/EProjectRepository.java
...phong/manage/timesheet/repository/EProjectRepository.java
+1
-1
src/main/java/com/itsol/quantrivanphong/manage/timesheet/repository/TimeSheetRepository.java
...hong/manage/timesheet/repository/TimeSheetRepository.java
+7
-7
No files found.
src/main/java/com/itsol/quantrivanphong/manage/leaveform/business/LeaveFormBusiness.java
View file @
5df49b2f
...
@@ -22,8 +22,8 @@ public class LeaveFormBusiness {
...
@@ -22,8 +22,8 @@ public class LeaveFormBusiness {
@Autowired
@Autowired
EmployeeRepository
employeeRepository
;
EmployeeRepository
employeeRepository
;
public
List
<
LeaveForm
>
findAll
LeaveForm
()
{
public
List
<
LeaveForm
>
findAll
()
{
return
leaveFormRepository
.
findAll
LeaveForm
();
return
leaveFormRepository
.
findAll
();
}
}
public
String
insertLeaveForm
(
LeaveFormDTO
leaveFormDTO
)
{
public
String
insertLeaveForm
(
LeaveFormDTO
leaveFormDTO
)
{
...
...
src/main/java/com/itsol/quantrivanphong/manage/leaveform/controller/LeaveFormController.java
View file @
5df49b2f
...
@@ -12,14 +12,14 @@ import javax.validation.Valid;
...
@@ -12,14 +12,14 @@ import javax.validation.Valid;
import
java.util.List
;
import
java.util.List
;
@RestController
@RestController
@RequestMapping
(
path
=
"/
leav
e"
)
@RequestMapping
(
path
=
"/
employe
e"
)
public
class
LeaveFormController
{
public
class
LeaveFormController
{
@Autowired
@Autowired
LeaveFormBusiness
leaveFormBusiness
;
LeaveFormBusiness
leaveFormBusiness
;
@GetMapping
(
path
=
"/
index
"
)
@GetMapping
(
path
=
"/
leaveform
"
)
public
ResponseEntity
<
List
<
LeaveForm
>>
show
LeaveFormList
()
{
public
ResponseEntity
<
List
<
LeaveForm
>>
show
AllLeaveForm
()
{
return
ResponseEntity
.
ok
(
leaveFormBusiness
.
findAll
LeaveForm
());
return
ResponseEntity
.
ok
(
leaveFormBusiness
.
findAll
());
}
}
@PostMapping
(
path
=
"/insert"
,
consumes
=
"application/json"
,
produces
=
"application/json"
)
@PostMapping
(
path
=
"/insert"
,
consumes
=
"application/json"
,
produces
=
"application/json"
)
...
...
src/main/java/com/itsol/quantrivanphong/manage/leaveform/repository/LeaveFormRepository.java
View file @
5df49b2f
...
@@ -10,8 +10,8 @@ import org.springframework.data.jpa.repository.Query;
...
@@ -10,8 +10,8 @@ import org.springframework.data.jpa.repository.Query;
import
java.util.List
;
import
java.util.List
;
public
interface
LeaveFormRepository
extends
JpaRepository
<
LeaveForm
,
Integer
>
{
public
interface
LeaveFormRepository
extends
JpaRepository
<
LeaveForm
,
Integer
>
{
@Query
(
"select lf from LeaveForm lf"
)
//
@Query("select lf from LeaveForm lf")
List
<
LeaveForm
>
findAllLeaveForm
();
// List<LeaveForm> findAll
();
LeaveForm
findLeaveFormByEmployeeAndId
(
Employee
employee
,
int
id
);
LeaveForm
findLeaveFormByEmployeeAndId
(
Employee
employee
,
int
id
);
...
...
src/main/java/com/itsol/quantrivanphong/manage/timesheet/business/TimeSheetBusiness.java
View file @
5df49b2f
...
@@ -77,47 +77,47 @@ public class TimeSheetBusiness {
...
@@ -77,47 +77,47 @@ public class TimeSheetBusiness {
Employee
employee
=
employeeRepository
.
findEmployeeById
(
employee_Id
);
Employee
employee
=
employeeRepository
.
findEmployeeById
(
employee_Id
);
Eproject
eproject
=
eProjectRepository
.
findEprojectByEmployee
(
employee
);
Eproject
eproject
=
eProjectRepository
.
findEprojectByEmployee
(
employee
);
TimeSheet
timeSheet
=
timeSheetRepository
.
findTimeSheetByEprojectAndId
(
eproject
,
timesheet_Id
);
TimeSheet
timeSheet
=
timeSheetRepository
.
findTimeSheetByEprojectAndId
(
eproject
,
timesheet_Id
);
if
(
timeShee
t
!=
null
)
{
if
(
eprojec
t
!=
null
)
{
if
(
eprojec
t
!=
null
)
{
if
(
timeShee
t
!=
null
)
{
int
i
=
timeSheetRepository
.
updateTimeSheet
(
timeSheetDTO
.
getTitle
(),
timeSheetDTO
.
getContent
()
int
i
=
timeSheetRepository
.
updateTimeSheet
(
timeSheetDTO
.
getTitle
(),
timeSheetDTO
.
getContent
()
,
timeSheetDTO
.
getNote
(),
eproject
,
timeSheetDTO
.
getId
()
);
,
timeSheetDTO
.
getNote
(),
timesheet_Id
);
if
(
i
==
1
)
{
if
(
i
==
1
)
{
message
=
"Update success"
;
message
=
"Update success"
;
}
else
{
}
else
{
message
=
"Update failed"
;
message
=
"Update failed"
;
}
}
}
else
{
}
else
{
message
=
"
Eprojec
t does not exist"
;
message
=
"
TimeShee
t does not exist"
;
}
}
}
else
{
}
else
{
message
=
"
TimeShee
t does not exist"
;
message
=
"
Eprojec
t does not exist"
;
}
}
return
message
;
return
message
;
}
}
@Transactional
// @Transactional
public
String
updateLeaveFormStatus
(
TimeSheetDTO
timeSheetDTO
)
{
// public String updateLeaveFormStatus(TimeSheetDTO timeSheetDTO) {
String
message
;
// String message;
TimeSheet
timeSheet
=
timeSheetRepository
.
findTimeSheetById
(
timeSheetDTO
.
getId
());
// TimeSheet timeSheet = timeSheetRepository.findTimeSheetById(timeSheetDTO.getId());
if
(
timeSheet
!=
null
)
{
// if (timeSheet != null) {
int
i
=
timeSheetRepository
.
updateTimeSheetStatus
(
timeSheetDTO
.
isStatus
(),
timeSheetDTO
.
getId
());
// int i = timeSheetRepository.updateTimeSheetStatus(timeSheetDTO.isStatus(), timeSheetDTO.getId());
if
(
i
==
1
)
{
// if (i == 1) {
message
=
"Update status success"
;
// message = "Update status success";
}
else
{
// } else {
message
=
"Update status failed"
;
// message = "Update status failed";
}
// }
}
else
{
// } else {
message
=
"TimeSheet does not exist"
;
// message = "TimeSheet does not exist";
}
// }
//
// return message;
// }
return
message
;
public
List
<
TimeSheet
>
findTimeSheetById
(
int
employee_Id
)
{
}
Employee
employee
=
employeeRepository
.
findEmployeeById
(
employee_Id
);
public
List
<
TimeSheet
>
findTimeSheetById
(
int
id
)
{
Employee
employee
=
employeeRepository
.
findEmployeeById
(
id
);
Eproject
eproject
=
eProjectRepository
.
findEprojectByEmployee
(
employee
);
Eproject
eproject
=
eProjectRepository
.
findEprojectByEmployee
(
employee
);
if
(
employee
!=
null
&&
eproject
!=
null
&&
timeSheetRepository
.
timeSheetListById
(
eproject
)
!=
null
)
{
if
(
employee
!=
null
&&
eproject
!=
null
&&
timeSheetRepository
.
showTimeSheetByEproject
(
eproject
)
!=
null
)
{
return
timeSheetRepository
.
timeSheetListById
(
eproject
);
return
timeSheetRepository
.
showTimeSheetByEproject
(
eproject
);
}
else
{
}
else
{
return
null
;
return
null
;
}
}
...
...
src/main/java/com/itsol/quantrivanphong/manage/timesheet/controller/TimeSheetController.java
View file @
5df49b2f
...
@@ -35,19 +35,19 @@ public class TimeSheetController {
...
@@ -35,19 +35,19 @@ public class TimeSheetController {
return
ResponseEntity
.
ok
(
timeSheetBusiness
.
deleteTimeSheet
(
employee_Id
,
timesheet_Id
));
return
ResponseEntity
.
ok
(
timeSheetBusiness
.
deleteTimeSheet
(
employee_Id
,
timesheet_Id
));
}
}
@GetMapping
(
path
=
"/
index
"
)
@GetMapping
(
path
=
"/
eproject/leaveform
"
)
public
List
<
TimeSheet
>
showAllTimeSheet
()
{
public
List
<
TimeSheet
>
showAllTimeSheet
()
{
return
timeSheetBusiness
.
findAll
();
return
timeSheetBusiness
.
findAll
();
}
}
@PostMapping
(
path
=
"/
update
"
,
consumes
=
"application/json"
,
produces
=
"application/json"
)
@PostMapping
(
path
=
"/
{employee_Id}/timesheet/{timesheet_Id}
"
,
consumes
=
"application/json"
,
produces
=
"application/json"
)
public
ResponseEntity
<
String
>
update
LeaveForm
(
@RequestBody
TimeSheetDTO
timeSheetDTO
)
{
public
ResponseEntity
<
String
>
update
TimeSheet
(
@PathVariable
int
employee_Id
,
@PathVariable
int
timesheet_Id
,
@Valid
@RequestBody
TimeSheetDTO
timeSheetDTO
)
{
String
message
;
String
message
;
try
{
try
{
if
(
timeSheetDTO
.
getTitle
().
trim
().
equals
(
""
))
throw
new
InputException
(
"Tiêu đề không được để trống"
);
if
(
timeSheetDTO
.
getTitle
().
trim
().
equals
(
""
))
throw
new
InputException
(
"Tiêu đề không được để trống"
);
if
(
timeSheetDTO
.
getContent
().
trim
().
equals
(
""
))
throw
new
InputException
(
"Nội dung không được để trống"
);
if
(
timeSheetDTO
.
getContent
().
trim
().
equals
(
""
))
throw
new
InputException
(
"Nội dung không được để trống"
);
message
=
timeSheetBusiness
.
updateTimeSheet
(
timeSheetDTO
);
message
=
timeSheetBusiness
.
updateTimeSheet
(
employee_Id
,
timeSheetDTO
,
timesheet_Id
);
}
catch
(
InputException
e
)
{
}
catch
(
InputException
e
)
{
message
=
e
.
getMessage
();
message
=
e
.
getMessage
();
}
}
...
@@ -55,15 +55,15 @@ public class TimeSheetController {
...
@@ -55,15 +55,15 @@ public class TimeSheetController {
return
ResponseEntity
.
ok
(
message
);
return
ResponseEntity
.
ok
(
message
);
}
}
@PostMapping
(
path
=
"/update-status"
,
consumes
=
"application/json"
,
produces
=
"application/json"
)
//
@PostMapping(path = "/update-status", consumes = "application/json", produces = "application/json")
public
ResponseEntity
<
String
>
updateLeaveFormStatus
(
@RequestBody
TimeSheetDTO
timeSheetDTO
)
{
//
public ResponseEntity<String> updateLeaveFormStatus(@RequestBody TimeSheetDTO timeSheetDTO) {
String
message
;
//
String message;
message
=
timeSheetBusiness
.
updateLeaveFormStatus
(
timeSheetDTO
);
//
message = timeSheetBusiness.updateLeaveFormStatus(timeSheetDTO);
return
ResponseEntity
.
ok
(
message
);
//
return ResponseEntity.ok(message);
}
//
}
@GetMapping
(
"/
index/{id}
"
)
@GetMapping
(
"/
{employee_Id}/show
"
)
public
ResponseEntity
<
List
<
TimeSheet
>>
showTimeSheetById
(
@PathVariable
int
i
d
)
{
public
ResponseEntity
<
List
<
TimeSheet
>>
showTimeSheetById
(
@PathVariable
int
employee_I
d
)
{
return
ResponseEntity
.
ok
(
timeSheetBusiness
.
findTimeSheetById
(
i
d
));
return
ResponseEntity
.
ok
(
timeSheetBusiness
.
findTimeSheetById
(
employee_I
d
));
}
}
}
}
\ No newline at end of file
src/main/java/com/itsol/quantrivanphong/manage/timesheet/repository/EProjectRepository.java
View file @
5df49b2f
...
@@ -5,7 +5,7 @@ import com.itsol.quantrivanphong.model.Eproject;
...
@@ -5,7 +5,7 @@ import com.itsol.quantrivanphong.model.Eproject;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
public
interface
EProjectRepository
extends
JpaRepository
<
Eproject
,
Integer
>
{
public
interface
EProjectRepository
extends
JpaRepository
<
Eproject
,
Integer
>
{
Eproject
findEprojectById
(
int
id
);
//
Eproject findEprojectById(int id);
Eproject
findEprojectByEmployee
(
Employee
employee
);
Eproject
findEprojectByEmployee
(
Employee
employee
);
Eproject
findEprojectByIdAndEmployee
(
int
eProject_Id
,
Employee
employee
);
Eproject
findEprojectByIdAndEmployee
(
int
eProject_Id
,
Employee
employee
);
...
...
src/main/java/com/itsol/quantrivanphong/manage/timesheet/repository/TimeSheetRepository.java
View file @
5df49b2f
...
@@ -9,21 +9,21 @@ import org.springframework.data.jpa.repository.Query;
...
@@ -9,21 +9,21 @@ import org.springframework.data.jpa.repository.Query;
import
java.util.List
;
import
java.util.List
;
public
interface
TimeSheetRepository
extends
JpaRepository
<
TimeSheet
,
Integer
>
{
public
interface
TimeSheetRepository
extends
JpaRepository
<
TimeSheet
,
Integer
>
{
TimeSheet
findTimeSheetById
(
int
id
);
//
TimeSheet findTimeSheetById(int id);
// @Query("select ts from TimeSheet ts order by ts.createdAt desc")
// @Query("select ts from TimeSheet ts order by ts.createdAt desc")
// List<TimeSheet> getAllTimeSheet();
// List<TimeSheet> getAllTimeSheet();
@Modifying
@Modifying
@Query
(
"update TimeSheet ts set ts.title = ?1, ts.content = ?2, ts.note = ?3
, ts.eproject = ?4 where ts.id = ?5
"
)
@Query
(
"update TimeSheet ts set ts.title = ?1, ts.content = ?2, ts.note = ?3
where ts.id = ?4
"
)
int
updateTimeSheet
(
String
title
,
String
content
,
String
note
,
Eproject
eproject
,
int
i
d
);
int
updateTimeSheet
(
String
title
,
String
content
,
String
note
,
int
timesheet_I
d
);
@Modifying
//
@Modifying
@Query
(
"update TimeSheet ts set ts.status = ?1 where ts.id = ?2"
)
//
@Query("update TimeSheet ts set ts.status = ?1 where ts.id = ?2")
int
updateTimeSheetStatus
(
boolean
status
,
int
id
);
//
int updateTimeSheetStatus(boolean status, int id);
@Query
(
"select ts from TimeSheet ts where ts.eproject = ?1"
)
@Query
(
"select ts from TimeSheet ts where ts.eproject = ?1"
)
List
<
TimeSheet
>
timeSheetListById
(
Eproject
eproject
);
List
<
TimeSheet
>
showTimeSheetByEproject
(
Eproject
eproject
);
TimeSheet
findTimeSheetByEprojectAndId
(
Eproject
eproject
,
int
timeSheet_Id
);
TimeSheet
findTimeSheetByEprojectAndId
(
Eproject
eproject
,
int
timeSheet_Id
);
}
}
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