Search in sources :

Example 1 with IndexApplicationResponse

use of com.webank.wedatasphere.qualitis.response.IndexApplicationResponse 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);
}
Also used : Task(com.webank.wedatasphere.qualitis.entity.Task) IndexApplicationTodayResponse(com.webank.wedatasphere.qualitis.response.IndexApplicationTodayResponse) IndexApplicationResponse(com.webank.wedatasphere.qualitis.response.IndexApplicationResponse) ArrayList(java.util.ArrayList) Application(com.webank.wedatasphere.qualitis.entity.Application) Date(java.util.Date)

Aggregations

Application (com.webank.wedatasphere.qualitis.entity.Application)1 Task (com.webank.wedatasphere.qualitis.entity.Task)1 IndexApplicationResponse (com.webank.wedatasphere.qualitis.response.IndexApplicationResponse)1 IndexApplicationTodayResponse (com.webank.wedatasphere.qualitis.response.IndexApplicationTodayResponse)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1