Skip to content

Commit fcd0b78

Browse files
author
Raj Shah
authored
Staging (#6)
* 57. getJSONReport method Schema completed * 58. MultiUsers Custom Report Generator Added.
1 parent 0b0d7a3 commit fcd0b78

File tree

7 files changed

+723
-450
lines changed

7 files changed

+723
-450
lines changed
Lines changed: 75 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
package systems.rajshah.controller;
22

33
import java.io.ByteArrayInputStream;
4-
import java.util.ArrayList;
54
import java.util.List;
5+
import java.util.Map;
66
import java.util.concurrent.ExecutionException;
7-
import java.util.stream.IntStream;
87

98
import org.springframework.beans.factory.annotation.Autowired;
109
import org.springframework.core.io.InputStreamResource;
@@ -25,72 +24,99 @@
2524
import systems.rajshah.model.FullInvestorInfo;
2625
import systems.rajshah.model.InvestorInfo;
2726
import systems.rajshah.model.QueryObjectDetails;
27+
import systems.rajshah.model.ReportGenObject;
2828
import systems.rajshah.model.UserInfo;
2929
import systems.rajshah.service.IfirebaseUser;
3030

3131
@RestController
3232
public class FdprojectRestController {
3333
@Autowired(required = false)
3434
IfirebaseUser ifirebaseuser;
35+
3536
@GetMapping("/")
3637
public ResponseEntity<String> greetMessage() {
37-
return new ResponseEntity<String>("***** Welcome To Data CRM System .Please Authenticate *****",HttpStatus.UNAUTHORIZED);
38+
return new ResponseEntity<String>("***** Welcome To Data CRM System .Please Authenticate *****",
39+
HttpStatus.UNAUTHORIZED);
3840
}
39-
@GetMapping(value="/users/{currentUid}",produces="application/json")
40-
public UserInfo getUserInfoByemail(@PathVariable("currentUid") String currentUid) throws FirebaseAuthException, InterruptedException, ExecutionException {
41+
42+
@GetMapping(value = "/users/{currentUid}", produces = "application/json")
43+
public UserInfo getUserInfoByemail(@PathVariable("currentUid") String currentUid)
44+
throws FirebaseAuthException, InterruptedException, ExecutionException {
4145
return ifirebaseuser.getCurrentUserDetails(currentUid);
4246
}
43-
44-
@PostMapping(value="/{currentUid}/addInvestor",consumes = "application/json")
45-
public String creaInvestorInfo(@RequestBody InvestorInfo investorInfo,@PathVariable("currentUid") String currentUid) throws FirebaseAuthException, InterruptedException, ExecutionException {
46-
return ifirebaseuser.createInvestorInfo(investorInfo,currentUid);
47+
48+
@PostMapping(value = "/{currentUid}/addInvestor", consumes = "application/json")
49+
public String creaInvestorInfo(@RequestBody InvestorInfo investorInfo,
50+
@PathVariable("currentUid") String currentUid)
51+
throws FirebaseAuthException, InterruptedException, ExecutionException {
52+
return ifirebaseuser.createInvestorInfo(investorInfo, currentUid);
4753
}
48-
@PostMapping(value="/{currentUid}/addfdinfo",consumes = "application/json")
49-
public String addFdInfo(@RequestBody FdInfo fdInfo,@PathVariable("currentUid") String currentUid) throws FirebaseAuthException, InterruptedException, ExecutionException {
50-
return ifirebaseuser.createFdInfo(fdInfo,currentUid);
54+
55+
@PostMapping(value = "/{currentUid}/addfdinfo", consumes = "application/json")
56+
public String addFdInfo(@RequestBody FdInfo fdInfo, @PathVariable("currentUid") String currentUid)
57+
throws FirebaseAuthException, InterruptedException, ExecutionException {
58+
return ifirebaseuser.createFdInfo(fdInfo, currentUid);
5159
}
52-
@GetMapping(value="/{currentUid}/getCustomer/{id}",produces = "application/json")
53-
public FullInvestorInfo getCustomerInfo(@PathVariable("id") String idvarable,@PathVariable("currentUid") String currentUid ) throws FirebaseAuthException, InterruptedException, ExecutionException {
54-
return ifirebaseuser.getfullInfo(idvarable,currentUid);
60+
61+
@GetMapping(value = "/{currentUid}/getCustomer/{id}", produces = "application/json")
62+
public FullInvestorInfo getCustomerInfo(@PathVariable("id") String idvarable,
63+
@PathVariable("currentUid") String currentUid)
64+
throws FirebaseAuthException, InterruptedException, ExecutionException {
65+
return ifirebaseuser.getfullInfo(idvarable, currentUid);
5566
}
56-
@GetMapping(value="/{currentUid}/getClientDataByRange",produces = "application/json")
57-
public List<FullInvestorInfo> getAllBetweenRangesMaturaty(@RequestBody QueryObjectDetails queryFullDetails,@PathVariable("currentUid") String currentUid) throws FirebaseAuthException, InterruptedException, ExecutionException{
67+
68+
@GetMapping(value = "/{currentUid}/getClientDataByRange", produces = "application/json")
69+
public List<FullInvestorInfo> getAllBetweenRangesMaturaty(@RequestBody QueryObjectDetails queryFullDetails,
70+
@PathVariable("currentUid") String currentUid)
71+
throws FirebaseAuthException, InterruptedException, ExecutionException {
5872
return ifirebaseuser.getInvestInfoBtDates(queryFullDetails, currentUid);
59-
}
60-
@GetMapping(value="/{currentUid}/getCustomersByFid/{id}",produces = "application/json")
61-
public List<FullInvestorInfo> getInfoByFamilyCode(@PathVariable("id") String idvarable,@RequestBody QueryObjectDetails queryFullDetails,@PathVariable("currentUid") String currentUid) throws FirebaseAuthException, InterruptedException, ExecutionException{
62-
return ifirebaseuser.getfullInfoByFamilyCode(idvarable,queryFullDetails, currentUid);
6373
}
64-
@GetMapping(value="/{currentUid}/generateCustIntiByFid/{id}")
65-
public ResponseEntity<InputStreamResource> generateCustInByFid(@PathVariable("id") String idvarable,@RequestBody QueryObjectDetails queryFullDetails,@PathVariable("currentUid") String currentUid) throws FirebaseAuthException, InterruptedException, ExecutionException, DocumentException{
66-
ByteArrayInputStream bis= ifirebaseuser.generateCustomerIntimationReport(idvarable, queryFullDetails, currentUid);
74+
75+
@GetMapping(value = "/{currentUid}/getCustomersByFid/{id}", produces = "application/json")
76+
public List<FullInvestorInfo> getInfoByFamilyCode(@PathVariable("id") String idvarable,
77+
@RequestBody QueryObjectDetails queryFullDetails, @PathVariable("currentUid") String currentUid)
78+
throws FirebaseAuthException, InterruptedException, ExecutionException {
79+
return ifirebaseuser.getfullInfoByFamilyCode(idvarable, queryFullDetails, currentUid);
80+
}
81+
82+
@GetMapping(value = "/{currentUid}/generateCustIntiByFid/{id}")
83+
public ResponseEntity<InputStreamResource> generateCustInByFid(@PathVariable("id") String idvarable,
84+
@RequestBody QueryObjectDetails queryFullDetails, @PathVariable("currentUid") String currentUid)
85+
throws FirebaseAuthException, InterruptedException, ExecutionException, DocumentException {
86+
ByteArrayInputStream bis = ifirebaseuser.generateCustomerIntimationReport(idvarable, queryFullDetails,
87+
currentUid);
6788
HttpHeaders headers = new HttpHeaders();
68-
headers.add("Content-Disposition", "inline; filename="+idvarable+".pdf");
69-
return ResponseEntity
70-
.ok()
71-
.headers(headers)
72-
.contentType(MediaType.APPLICATION_PDF)
73-
.body(new InputStreamResource(bis));
74-
}
75-
@GetMapping(value="/{currentUid}/getFamilyHeadDetails/{id}",produces="application/json")
76-
public InvestorInfo getFamilyHeadDetails(@PathVariable("id") String idvarable,@PathVariable("currentUid") String currentUid) throws FirebaseAuthException, InterruptedException, ExecutionException{
77-
return ifirebaseuser.getFamliyHeadForFamilyCode(idvarable,currentUid);
89+
headers.add("Content-Disposition", "inline; filename=" + idvarable + ".pdf");
90+
return ResponseEntity.ok().headers(headers).contentType(MediaType.APPLICATION_PDF)
91+
.body(new InputStreamResource(bis));
7892
}
79-
@GetMapping(value="/{currentUid}/getReportBwtDates")
80-
public List<ResponseEntity<InputStreamResource>> getReportBwtDates(@PathVariable("currentUid") String currentUid,@RequestBody QueryObjectDetails queryFullDetails) throws FirebaseAuthException, InterruptedException, ExecutionException {
81-
List<ByteArrayInputStream> bis= ifirebaseuser.getCustReportByDates(queryFullDetails, currentUid);
82-
List<ResponseEntity<InputStreamResource>> repsonse= new ArrayList<>();
83-
IntStream.range(0,bis.size()).forEach(e->{
84-
HttpHeaders headers = new HttpHeaders();
85-
headers.add("Content-Disposition", "inline; filename="+"Test"+".pdf");
86-
repsonse.add(ResponseEntity
87-
.ok()
88-
.headers(headers)
89-
.contentType(MediaType.APPLICATION_PDF)
90-
.body(new InputStreamResource(bis.get(e))));
91-
});
92-
return repsonse;
93-
93+
94+
@GetMapping(value = "/{currentUid}/getFamilyHeadDetails/{id}", produces = "application/json")
95+
public InvestorInfo getFamilyHeadDetails(@PathVariable("id") String idvarable,
96+
@PathVariable("currentUid") String currentUid)
97+
throws FirebaseAuthException, InterruptedException, ExecutionException {
98+
return ifirebaseuser.getFamliyHeadForFamilyCode(idvarable, currentUid);
99+
}
100+
101+
@GetMapping(value = "/{currentUid}/getReportJSON")
102+
public ResponseEntity<Map<String, ReportGenObject>> getReportJSON(@PathVariable("currentUid") String currentUid,
103+
@RequestBody QueryObjectDetails queryFullDetails)
104+
throws FirebaseAuthException, InterruptedException, ExecutionException {
105+
Map<String, ReportGenObject> responseMap = ifirebaseuser.getReportJSONService(queryFullDetails, currentUid);
106+
ResponseEntity.status(HttpStatus.ACCEPTED).build();
107+
return ResponseEntity.ok(responseMap);
108+
94109
}
95110

111+
@GetMapping(value="/{currentUid}/PrintMultiReportPDF")
112+
public ResponseEntity<InputStreamResource> printMultiReportPDF(
113+
@RequestBody QueryObjectDetails queryFullDetails, @PathVariable("currentUid") String currentUid)
114+
throws FirebaseAuthException, InterruptedException, ExecutionException, DocumentException {
115+
ByteArrayInputStream bis = ifirebaseuser.generateFullClientReport(queryFullDetails, currentUid);
116+
HttpHeaders headers = new HttpHeaders();
117+
118+
headers.add("Content-Disposition", "inline; filename=" + "FullCustReport" + ".pdf");
119+
return ResponseEntity.ok().headers(headers).contentType(MediaType.APPLICATION_PDF)
120+
.body(new InputStreamResource(bis));
121+
}
96122
}

0 commit comments

Comments
 (0)