Commit d87c8887 authored by ='s avatar =

Hieu v1

parent 714712ff
package com.itsol.quantrivanphong.manager.reportdetail.bussiness;
import com.itsol.quantrivanphong.manager.employee.repository.EmployeeRepository;
import com.itsol.quantrivanphong.manager.project.project.repository.ProjectRRepository;
import com.itsol.quantrivanphong.manager.reportdetail.dto.request.ReportDTO;
import com.itsol.quantrivanphong.manager.reportdetail.dto.request.TimesheetRequestDTO;
......@@ -8,7 +9,6 @@ import com.itsol.quantrivanphong.manager.reportdetail.repository.ProjectReportRe
import com.itsol.quantrivanphong.model.*;
import com.itsol.quantrivanphong.report.timesheet.repository.EProjectRepository;
import com.itsol.quantrivanphong.report.timesheet.repository.TimeSheetRepository;
import com.itsol.quantrivanphong.repository.EmployeeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
......@@ -67,12 +67,12 @@ public class ReportProjectController {
//=================================================================================================================
//Tạo một báo cáo mới
@PostMapping(path = "/project/newReport", consumes = "application/json", produces = "application/json")
public ResponseEntity<String> updateTimesheetChecked(@RequestBody TimesheetRequestDTO timesheetRequestDTO){
String mess = reportProjectBussiness.updateTimesheetChecked(timesheetRequestDTO);
return ResponseEntity.ok(mess);
}
// //Tạo một báo cáo mới
// @PostMapping(path = "/project/newReport", consumes = "application/json", produces = "application/json")
// public ResponseEntity<String> updateTimesheetChecked(@RequestBody TimesheetRequestDTO timesheetRequestDTO){
// String mess = reportProjectBussiness.updateTimesheetChecked(timesheetRequestDTO);
// return ResponseEntity.ok(mess);
// }
......
......@@ -24,7 +24,7 @@ public class TimeSheetBusiness {
public String insertTimeSheet(int employee_Id, TimeSheetDTO timeSheetDTO) {
String message;
Employee employee = employeeRepository.findEmployeeById(employee_Id);
Eproject eproject = eProjectRepository.findEprojectByIdAndEmployee(timeSheetDTO.getEproject_id(), employee);
Eproject eproject = eProjectRepository.findEprojectByIdAndEmployee(timeSheetDTO.getEprojectId(), employee);
if (eproject != null) {
// SimpleDateFormat formatter= new SimpleDateFormat("dd-MM-yyyy HH:mm");
// Date date = new Date(System.currentTimeMillis());
......
......@@ -16,19 +16,19 @@ import java.util.List;
public class TimeSheetController {
@Autowired
TimeSheetBusiness timeSheetBusiness;
@PostMapping(path = "/timesheet", consumes = "application/json", produces = "application/json")
public ResponseEntity<String> insertTimeSheet(@RequestBody TimeSheetDTO timeSheetDTO) {
String message;
try {
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");
message = timeSheetBusiness.insertTimeSheet(timeSheetDTO);
} catch (InputException e) {
message = e.getMessage();
}
return ResponseEntity.ok(message);
}
// @PostMapping(path = "/timesheet", consumes = "application/json", produces = "application/json")
// public ResponseEntity<String> insertTimeSheet(@RequestBody TimeSheetDTO timeSheetDTO) {
// String message;
// try {
// 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");
// message = timeSheetBusiness.insertTimeSheet(timeSheetDTO);
// } catch (InputException e) {
// message = e.getMessage();
// }
//
// return ResponseEntity.ok(message);
// }
@DeleteMapping("/{employee_Id}/timesheet/{timesheet_Id}")
public ResponseEntity<String> deleteTimeSheet(@PathVariable int employee_Id, @Valid @PathVariable int timesheet_Id) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment