use of org.springframework.web.bind.annotation.GetMapping in project FP-PSP-SERVER by FundacionParaguaya.
the class SnapshotReportController method getFamiliesByOrganization.
@GetMapping(path = "/family/organizations", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<List<OrganizationFamilyDTO>> getFamiliesByOrganization(@RequestParam(value = "application_id", required = false) Long applicationId, @RequestParam(value = "organization_id", required = false) Long organizationId, @RequestParam(value = "family_id", required = false) Long familyId, @RequestParam(value = "date_from", required = true) String dateFrom, @RequestParam(value = "date_to", required = true) String dateTo) {
SnapshotFilterDTO filters = new SnapshotFilterDTO(applicationId, organizationId, familyId, dateFrom, dateTo);
List<OrganizationFamilyDTO> families = familyReportService.listFamilyByOrganizationAndCreatedDate(filters);
return ResponseEntity.ok(families);
}
use of org.springframework.web.bind.annotation.GetMapping in project FP-PSP-SERVER by FundacionParaguaya.
the class SnapshotReportController method getSnapshotsIndicatorsByFamily.
@GetMapping(path = "/family/indicators", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<List<FamilySnapshotDTO>> getSnapshotsIndicatorsByFamily(@RequestParam(value = "application_id", required = false) Long applicationId, @RequestParam(value = "organization_id", required = false) Long organizationId, @RequestParam(value = "family_id", required = true) Long familyId, @RequestParam(value = "date_from", required = true) String dateFrom, @RequestParam(value = "date_to", required = true) String dateTo) {
SnapshotFilterDTO filters = new SnapshotFilterDTO(applicationId, organizationId, familyId, dateFrom, dateTo);
List<FamilySnapshotDTO> snapshots = familyReportService.listSnapshotByFamily(filters);
return ResponseEntity.ok(snapshots);
}
use of org.springframework.web.bind.annotation.GetMapping in project FP-PSP-SERVER by FundacionParaguaya.
the class SnapshotReportController method generateCSVSnapshotByOrganizationAndCreatedDate.
@GetMapping(path = "/family/indicators/csv", produces = "application/octet-stream")
public void generateCSVSnapshotByOrganizationAndCreatedDate(@RequestParam(value = "application_id", required = false) Long applicationId, @RequestParam(value = "organization_id", required = false) Long organizationId, @RequestParam(value = "family_id", required = true) Long familyId, @RequestParam(value = "date_from", required = true) String dateFrom, @RequestParam(value = "date_to", required = true) String dateTo, HttpServletResponse response) throws IOException {
SnapshotFilterDTO filters = new SnapshotFilterDTO(applicationId, organizationId, familyId, dateFrom, dateTo);
String csv = familyReportService.generateCSVSnapshotByOrganizationAndCreatedDate(filters);
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment; filename=\"snapshots.csv\"");
response.getWriter().write(csv);
response.getWriter().close();
}
use of org.springframework.web.bind.annotation.GetMapping in project halo by ruibaby.
the class BackupController method backupDatabase.
/**
* 备份数据库
*
* @return return
*/
@GetMapping(value = "/backupDb")
public String backupDatabase() {
String fileName = "db_backup_" + HaloUtil.getStringDate("yyyy_MM_dd_HH_mm_ss") + ".sql";
try {
File path = new File(ResourceUtils.getURL("classpath:").getPath());
String savePath = path.getAbsolutePath() + "/backup/database";
HaloUtil.exportDatabase("localhost", "root", "123456", savePath, fileName, "testdb");
} catch (Exception e) {
log.error("未知错误:" + e.getMessage());
}
return "redirect:/admin/backup";
}
use of org.springframework.web.bind.annotation.GetMapping in project halo by ruibaby.
the class BackupController method backupPosts.
/**
* 备份文章,导出markdown文件
*
* @return return
*/
@GetMapping(value = "/backupPost")
public String backupPosts() {
List<Post> posts = postService.findAllPosts();
try {
File path = new File(ResourceUtils.getURL("classpath:").getPath());
String savePath = path.getAbsolutePath() + "/backup/posts/posts_backup_" + HaloUtil.getStringDate("yyyy_MM_dd_HH_mm_ss");
for (Post post : posts) {
HaloUtil.dbToFile(post.getPostContentMd(), savePath, post.getPostTitle() + ".md");
}
} catch (Exception e) {
e.printStackTrace();
}
return "redirect:/admin/backup";
}
Aggregations