Commit f3e83121 authored by Vijay Akula's avatar Vijay Akula

added logger in the services

parent 6574f8fd
......@@ -26,8 +26,11 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -35,7 +38,6 @@ import java.util.stream.Collectors;
import static org.springframework.data.mongodb.core.aggregation.Aggregation.*;
//import com.nisum.myteam.model.dao.Resource;
@RestController
@RequestMapping("/reports")
......@@ -218,6 +220,7 @@ public class ReportsController {
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, List<GroupByCount>>>> getEmployeesByFunctionalGroup1()
throws MyTeamException {
ProjectionOperation projectToMatchModel = project()
.andExpression("functionalGroup").as("name").andExpression("y")
.as("y");
......@@ -308,6 +311,7 @@ public class ReportsController {
return new ResponseEntity<>(empList, HttpStatus.OK);
}
@RequestMapping(value = "/billabilityByFunctionalGroup",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
......@@ -354,7 +358,6 @@ public class ReportsController {
}
//Not Ok Response
@RequestMapping(value = "/getBillabilityDetailsByAccount",
method = RequestMethod.GET,
......@@ -362,7 +365,6 @@ public class ReportsController {
public ResponseEntity<ColumnChartData> getBillabilityDetailsByAccount()
throws MyTeamException {
ProjectionOperation projectToMatchModel = project()
.andExpression("account").as("categories")
.andExpression("billableStatus").as("seriesName")
......@@ -388,12 +390,7 @@ public class ReportsController {
List<String> catagories = new ArrayList();
List<ReportSeriesRecord> seriesDetails = new ArrayList<ReportSeriesRecord>();
//List<Account> accounts = employeeService.getAccounts();
List<Account> accounts = accountService.getAllAccounts();
List<Account> accounts= accountService.getAllAccounts();
ColumnChartData reportData = new ColumnChartData();
for (String status : statusList) {
catagories = new ArrayList();
......@@ -426,14 +423,11 @@ public class ReportsController {
}
System.out.println(seriesDetails);
reportData.setCategoriesList(catagories);
reportData.setSeriesDataList(seriesDetails);
return new ResponseEntity<>(reportData, HttpStatus.OK);
}
}
......@@ -111,18 +111,18 @@ public class DashboardService implements IDashboardService {
@Override
public List<EmployeeDashboardVO> getDashBoardData(){
List<EmployeeDashboardVO> employeeDashboard = new ArrayList<>();
List<Employee> allEmployees = employeeService.getAllEmployees();
List<ResourceVO> resources = resourceService.getAllResourcesVO();
List<EmployeeDashboardVO> employeeDashboardList = new ArrayList<>();
List<Employee> allEmployeesList = employeeService.getAllEmployees();
List<ResourceVO> resourcesList = resourceService.getAllResourcesVO();
for (Employee employee:allEmployees){
for (Employee employee:allEmployeesList){
EmployeeDashboardVO employeeDashboardVO = new EmployeeDashboardVO();
BeanUtils.copyProperties(employee, employeeDashboardVO);
employeeDashboard.add(employeeDashboardVO);
employeeDashboardList.add(employeeDashboardVO);
}
employeeDashboard.stream().forEach(emp -> {
List<ResourceVO> latestResourceList = resources.stream().
employeeDashboardList.stream().forEach(emp -> {
List<ResourceVO> latestResourceList = resourcesList.stream().
filter(res -> (res.getEmployeeId().equals(emp.getEmployeeId())&&res.getBillingEndDate().after(new Date()))).collect(Collectors.toList());
if(!latestResourceList.isEmpty()){
ResourceVO latestResource = latestResourceList.get(0);
......@@ -139,6 +139,6 @@ public class DashboardService implements IDashboardService {
}
}
});
return employeeDashboard;
return employeeDashboardList;
}
}
......@@ -14,6 +14,7 @@ import java.util.List;
import javax.transaction.Transactional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -27,6 +28,7 @@ import com.nisum.myteam.utils.MyTeamUtils;
@Component
@Transactional
@Slf4j
public class EmployeeDataService implements IEmployeeDataService {
@Autowired
......@@ -93,6 +95,7 @@ public class EmployeeDataService implements IEmployeeDataService {
long totalseconds = 0;
int countHours = 0;
List<EmpLoginData> listOfEmpLoginData = new ArrayList<>();
log.info("The Query going to execute::"+query);
try (Connection connection = dbConnection.getDBConnection();
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query.toString())) {
......
......@@ -290,10 +290,7 @@ public class EmployeeService implements IEmployeeService {
public boolean verifyEmployeeRole(String empId, String roleIdReq) {
boolean flag = false;
log.info("The employeeId::" + empId);
Employee employee = getEmployeeById(empId);
log.info("Employee::::in EmployeeService::" + employee);
String roleName = employee.getRole();
log.info("The employee role::" + roleName);
......@@ -302,9 +299,7 @@ public class EmployeeService implements IEmployeeService {
if (ApplicationRole.FUNCTIONAL_MANAGER.getRoleName().equalsIgnoreCase(roleName) ||
ApplicationRole.DELIVERY_LEAD.getRoleName().equalsIgnoreCase(roleName)) {
flag = true;
log.info("in if block");
} else {
log.info("in else block");
Set<String> roleSet = employeeRoleService.empRolesMapInfoByEmpId(empId);
if (null != roleSet && !roleSet.isEmpty() && MyTeamUtils.INT_ZERO < roleSet.size()) {
if (roleSet.contains(roleIdReq)) {
......@@ -316,7 +311,6 @@ public class EmployeeService implements IEmployeeService {
}
log.info("before return flag::" + flag);
return flag;
}
......
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