Commit 3a7ad803 authored by Vijay Akula's avatar Vijay Akula

Fixed the issues related to team details

parent b9280f6e
...@@ -28,9 +28,5 @@ public class EmailController { ...@@ -28,9 +28,5 @@ public class EmailController {
return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR);
} }
@RequestMapping(value = "/deleteReport/{fileName}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> deletePdfReport(@PathVariable("fileName") String fileName) {
String response = mailService.deletePdfReport(fileName);
return new ResponseEntity<>(response, HttpStatus.OK);
}
} }
package com.nisum.myteam.controller;
import com.nisum.myteam.service.ILoginReportsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
public class LoginReportsController {
@Autowired
private ILoginReportsService reportsService;
@RequestMapping(value = "/deleteReport/{fileName}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> deletePdfReport(@PathVariable("fileName") String fileName) {
String response = reportsService.deletePdfReport(fileName);
return new ResponseEntity<>(response, HttpStatus.OK);
}
}
package com.nisum.myteam.service;
public interface ILoginReportsService {
public String deletePdfReport(String fileName);
}
...@@ -17,8 +17,6 @@ public interface IMailService { ...@@ -17,8 +17,6 @@ public interface IMailService {
public String sendEmailWithAttachment(EmailDomain emailObj); public String sendEmailWithAttachment(EmailDomain emailObj);
public String deletePdfReport(String fileName);
public void sendLeaveNotification(Mail mail)throws MessagingException, IOException; public void sendLeaveNotification(Mail mail)throws MessagingException, IOException;
public void sendProjectNotification(Mail mail)throws MessagingException, IOException; public void sendProjectNotification(Mail mail)throws MessagingException, IOException;
......
package com.nisum.myteam.service.impl;
import com.nisum.myteam.service.ILoginReportsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
@Service
@Slf4j
public class LoginReportService implements ILoginReportsService {
@Autowired
ResourceLoader resourceLoader;
@Override
public String deletePdfReport(String fileName) {
String response = "";
try {
File file = resourceLoader.getResource("/WEB-INF/reports/" + fileName + ".pdf").getFile();
if (null != file && file.exists()) {
boolean status = file.delete();
if (status) {
response = "Success";
}
}
} catch (IOException e) {
response = "Report deletion failed due to: " + e.getMessage();
log.error("Report deletion failed due to: ", e);
}
return response;
}
}
...@@ -91,23 +91,7 @@ public class MailService implements IMailService { ...@@ -91,23 +91,7 @@ public class MailService implements IMailService {
return response; return response;
} }
@Override
public String deletePdfReport(String fileName) {
String response = "";
try {
File file = resourceLoader.getResource("/WEB-INF/reports/" + fileName+".pdf").getFile();
if(null != file && file.exists()){
boolean status = file.delete();
if(status){
response = "Success";
}
}
} catch (IOException e) {
response = "Report deletion failed due to: " + e.getMessage();
logger.error("Report deletion failed due to: ", e);
}
return response;
}
public void sendLeaveNotification(Mail mail) throws MessagingException, IOException public void sendLeaveNotification(Mail mail) throws MessagingException, IOException
{ {
......
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