MostVotedJob { public void insertDailyVotedCount() { List<UserGroup> userGroups = userGroupMapper.selectByGroupId(1); for (UserGroup userGroup : userGroups) { Integer count = voteRecordMapper.selectDailyVotedCountByGroupUserId(userGroup.getUserGroupId(),new Date()); MostVotedRecord mostVotedRecord = mostVotedRecordMapper.selectByVotedDateAndUserGroupId(new Date(), userGroup.getUserGroupId()); if (mostVotedRecord == null) { mostVotedRecord = new MostVotedRecord(); mostVotedRecord.setGroupId(1); mostVotedRecord.setUserGroupId(userGroup.getUserGroupId()); mostVotedRecord.setVotedCount(count); mostVotedRecord.setCoinGiveStatus(0); mostVotedRecord.setVotedDate(new Date()); mostVotedRecordMapper.insertSelective(mostVotedRecord); }else { mostVotedRecord.setVotedCount(count); mostVotedRecordMapper.updateByPrimaryKeySelective(mostVotedRecord); } } calculateThePersonToGetCoin(); }  void insertDailyVotedCount(); void calculateThePersonToGetCoin();  }
@Test public void insertDailyVotedCount() { mostVotedJob.insertDailyVotedCount(); }