Skip to content

Commit

Permalink
Merge pull request #8 from nimble-platform/staging
Browse files Browse the repository at this point in the history
 Pull Request for Release 14.0.0.
  • Loading branch information
Ayeshmantha Perera authored Nov 28, 2019
2 parents 7a9bbe7 + 56eddab commit 7098bbf
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,25 @@ Double getTradingVolumeByStatusForCompany(@RequestParam(value = "role") Role rol
Double getCollaborationTimeForCompany(@RequestParam(value = "role") Role role,
@RequestParam(value = "partyId") Integer partyId ,@RequestHeader("Authorization") String bearerToken);

@RequestMapping(method = RequestMethod.GET, value = "/statistics/collaboration-time")
Double getCollaborationTimeForPlatform(@RequestParam(value = "role") Role role,
@RequestHeader("Authorization") String bearerToken);

@RequestMapping(method = RequestMethod.GET, value = "/statistics/response-time")
Double geResponseTimeForCompany(@RequestParam(value = "partyId") Integer partyId ,
@RequestHeader("Authorization") String bearerToken);

@RequestMapping(method = RequestMethod.GET, value = "/statistics/response-time")
Double geResponseTimeForPlatform(@RequestHeader("Authorization") String bearerToken);

@RequestMapping(method = RequestMethod.GET, value = "/statistics/response-time-months")
Map<Integer,Double> geResponseTimeForCompanyForMonths(@RequestParam(value = "partyId") Integer partyId ,
@RequestHeader("Authorization") String bearerToken);

@RequestMapping(method = RequestMethod.GET, value = "/statistics/response-time-months")
Map<Integer,Double> geResponseTimeForPlatformForMonths(@RequestHeader("Authorization") String bearerToken);


enum Status {
APPROVED, WAITINGRESPONSE, DENIED
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,16 @@ public Map<Integer,Double> geResponseTimeForCompanyForMonths(Integer partyId, St
Map<Integer, Double> map = new HashMap<>();
return map;
}

@Override
public Double getCollaborationTimeForPlatform(Role role,String bearerToken){ return -1.0; }

@Override
public Double geResponseTimeForPlatform(String bearerToken){ return -1.0; }

@Override
public Map<Integer,Double> geResponseTimeForPlatformForMonths(String bearerToken){
Map<Integer, Double> map = new HashMap<>();
return map;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public class AggregateController {
public void init() {
logger.info("Using the following URLs: {}, {}", environment.getProperty("nimble.identity.url"), environment.getProperty("nimble.business-process.url"));
}

@ApiOperation(value = "Aggregate statistics of platform.", nickname = "getPlatformStats", response = PlatformStats.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Aggregated statistics of platform"),
Expand Down Expand Up @@ -229,4 +228,31 @@ public ResponseEntity<?> getCollabarationStatisticsForComany(@ApiParam(value = "

return ResponseEntity.ok(collabStats);
}

@ApiOperation(value = "Aggregate statistics of company collaboration.", nickname = "getCollabStats", response = CollaborationStats.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Aggregated statistics of company collaboration"),
@ApiResponse(code = 400, message = "Error while aggregating statistics.")})
@RequestMapping(value = "/platform/collabaration", produces = {"application/json"}, method = RequestMethod.GET)
public ResponseEntity<?> getCollabarationStatisticsForPlatform(@ApiParam(value = "The Bearer token provided by the identity service") @RequestHeader(value = "Authorization", required = true) String bearerToken) {


//collab time
Double averageCollabTimePurchases = businessProcessClient.getCollaborationTimeForPlatform(BUYER,bearerToken);
Double averageCollabTimeSales = businessProcessClient.getCollaborationTimeForPlatform(SELLER,bearerToken);
Double averageCollabTime = (averageCollabTimePurchases+averageCollabTimeSales)/2;
CollaborationTime collaborationTime = new CollaborationTime(averageCollabTime, averageCollabTimePurchases, averageCollabTimeSales);

//response time
Double averageResponseTime = businessProcessClient.geResponseTimeForPlatform(bearerToken);
Map<Integer,Double> averagetimeForMonths =
businessProcessClient.geResponseTimeForPlatformForMonths(bearerToken);
ResponseTime resTime = new ResponseTime(averageResponseTime,averagetimeForMonths);

// aggregate statistics
CollaborationStats collabStats = new CollaborationStats();
collabStats.setCollaborationTime(collaborationTime);
collabStats.setResponseTime(resTime);
return ResponseEntity.ok(collabStats);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ spring.jackson.date-format=com.fasterxml.jackson.databind.util.ISO8601DateFormat
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false

# This is feign client default timeout configuration
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=20000
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=26000

0 comments on commit 7098bbf

Please sign in to comment.