|
|
@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.List;
|
|
|
|
|
|
@RestController
|
|
|
@@ -25,7 +26,7 @@ import java.util.List;
|
|
|
@AllArgsConstructor
|
|
|
public class EmailController extends BaseController {
|
|
|
private EmailService emailService;
|
|
|
- private EmailRepo emailRepo;
|
|
|
+ private EmailRepo emailRepo;
|
|
|
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/save")
|
|
|
@@ -35,6 +36,9 @@ public class EmailController extends BaseController {
|
|
|
ObjUtils.merge(orig, record);
|
|
|
return emailRepo.save(orig);
|
|
|
}
|
|
|
+ record.setEnabled(true);
|
|
|
+ record.setIsRead(false);
|
|
|
+ record.setSendTime(LocalDateTime.now());
|
|
|
return emailRepo.save(record);
|
|
|
}
|
|
|
|
|
|
@@ -42,7 +46,7 @@ public class EmailController extends BaseController {
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@GetMapping("/all")
|
|
|
public Page<Email> all(PageQuery pageQuery) {
|
|
|
- return emailRepo.findAll(toSpecification(pageQuery,Email.class), toPageRequest(pageQuery));
|
|
|
+ return emailRepo.findAll(toSpecification(pageQuery, Email.class), toPageRequest(pageQuery));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/get/{id}")
|
|
|
@@ -63,7 +67,7 @@ public class EmailController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/my")
|
|
|
- public List<Email> my(){
|
|
|
+ public List<Email> my() {
|
|
|
return emailRepo.findAllByReceiveUserId(SecurityUtils.getAuthenticatedUser().getId());
|
|
|
}
|
|
|
}
|