FrontServices { public ResponseMessage everyOneWeekly(WeeklyReportRequest weeklyReportRequest) { WeeklyReportResponse weeklyReportResponse = new WeeklyReportResponse(); List<UserRecord> userRecords = Lists.newLinkedList(); List<UserGroup> userGroups = userGroupMapper.selectByGroupId(weeklyReportRequest.getGroupId()); ThisLocalizedWeek thisLocalizedWeek = new ThisLocalizedWeek(Locale.CHINA); Date start = thisLocalizedWeek.getFirstDay(); Date end = thisLocalizedWeek.getLastDay(); String rangeOfTime = parseForFrontEnd1(start) + " to " + parseForFrontEnd1(end); for (UserGroup userGroup : userGroups) { handleWeeklyUserInGroup(userRecords, start, end, userGroup); } weeklyReportResponse.setTimeRange(rangeOfTime); weeklyReportResponse.setAllWeeklyRecords(userRecords); return ResultUtils.success(weeklyReportResponse); } @Autowired  FrontServices(UserInfoMapper userInfoMapper,
                         UserGroupMapper userGroupMapper,
                         TargetDistanceMapper targetDistanceMapper,
                         RunningRecordMapper runningRecordMapper,
                         VoteRecordMapper voteRecordMapper); ResponseMessage userJoin(UserJoinRequest userJoinRequest); ResponseMessage userJoinv3(UserJoinRequest userJoinRequest); ResponseMessage currentUserWeekly(CurrentUserWeeklyReportRequest currentUserWeeklyReportRequest); ResponseMessage everyOneWeekly(WeeklyReportRequest weeklyReportRequest); ResponseMessage everyOneWeekly2(WeeklyReportRequest weeklyReportRequest); ResponseMessage userJoinv2(UserJoinRequest userJoinRequest);  }
@Test public void everyOneWeekly() { WeeklyReportRequest weeklyReportRequest = new WeeklyReportRequest(); weeklyReportRequest.setGroupId(1); long v1begin = System.currentTimeMillis(); ResponseMessage responseMessage = frontServices.everyOneWeekly(weeklyReportRequest); long v1end = System.currentTimeMillis(); System.err.println("old: "+ (v1end-v1begin)); System.err.println(JSON.toJSON(responseMessage)); long v2begin = System.currentTimeMillis(); ResponseMessage responseMessage2 = frontServices.everyOneWeekly2(weeklyReportRequest); long v2end = System.currentTimeMillis(); System.err.println("parallel: "+ (v2end-v2begin)); WeeklyReportResponse weeklyReportResponse = (WeeklyReportResponse) responseMessage2.getData(); List<UserRecord> allWeeklyRecords = weeklyReportResponse.getAllWeeklyRecords(); allWeeklyRecords.stream().forEach(System.out::println); System.err.println(JSON.toJSON(responseMessage2)); }