use of com.webank.wedatasphere.qualitis.response.IndexApplicationTodayResponse in project Qualitis by WeBankFinTech.
the class IndexController method getTodaySubmitApplications.
/**
* Paging get applications information that was submitted today.
* Including details of applications
* @return
*/
@POST
@Path("application/today")
@Produces(MediaType.APPLICATION_JSON)
public GeneralResponse<?> getTodaySubmitApplications(@Context HttpServletRequest httpServletRequest, PageRequest pageRequest) throws UnExpectedRequestException {
PageRequest.checkRequest(pageRequest);
String user = HttpUtils.getUserName(httpServletRequest);
try {
IndexApplicationTodayResponse response = indexService.getTodaySubmitApplications(user, pageRequest);
return new GeneralResponse<>("200", "{&QUERY_SUCCESSFULLY}", response);
} catch (Exception e) {
LOG.error("[Home overview]Failed to query API: application/today, internal error", e);
return new GeneralResponse<>("500", e.getMessage(), -1);
}
}
use of com.webank.wedatasphere.qualitis.response.IndexApplicationTodayResponse in project Qualitis by WeBankFinTech.
the class IndexServiceImpl method getTodaySubmitApplications.
@Override
public IndexApplicationTodayResponse getTodaySubmitApplications(String username, PageRequest pageRequest) {
// Find applications submitted today
String today = DateFormatUtils.format(new Date(), DATE_FORMAT_PATTERN);
List<Application> applications = getUserApplications(username, today, pageRequest);
if (applications == null || applications.isEmpty()) {
LOGGER.info("[Home overview]user:{},date:{},The user and the task submitted by the specified date were not found.", username, today);
return null;
}
// Get total num of applications today
long totalNum = countUserApplications(username, today);
// Get successful total num of applications today
long totalSuccNum = countUserSuccApplications(username, today);
// Get failed total num of applications today
long totalFailNum = countUserFailApplications(username, today);
// Get not pass total num of applications today
long totalFailCheckNum = countUserFailCheckApplications(username, today);
LOGGER.info("[Home overview]user:{},date:{},Find {} tasks submitted by the user's specified date, for a total of {}.", username, today, applications.size(), totalNum);
List<IndexApplicationResponse> applicationResponses = new ArrayList<>();
for (Application application : applications) {
List<Task> tasks = taskDao.findByApplication(application);
IndexApplicationResponse applicationResponse = new IndexApplicationResponse(application, tasks);
applicationResponses.add(applicationResponse);
}
return new IndexApplicationTodayResponse(applicationResponses, totalNum, totalSuccNum, totalFailNum, totalFailCheckNum);
}
Aggregations