@Test public void calculateThePersonToGetCoin() { mostVotedJob.calculateThePersonToGetCoin(); }
public void calculateThePersonToGetCoin(){ dailyMostVotedRecordMapper.deleteByDate(new Date()); final ThisLocalizedWeek chinaWeek = new ThisLocalizedWeek(Locale.CHINA); List<MostVotedRecord> mostVotedRecords = mostVotedRecordMapper.selectThePersonShouldBeAward(chinaWeek.getFirstDay(), chinaWeek.getLastDay(), new Date()); for (MostVotedRecord mostVotedRecord : mostVotedRecords) { DailyMostVotedRecord dailyMostVotedRecord = dailyMostVotedRecordMapper.selectByawardDateAndMostVotedUserGroupId(new Date(), mostVotedRecord.getUserGroupId()); if (dailyMostVotedRecord == null) { dailyMostVotedRecord = new DailyMostVotedRecord(); dailyMostVotedRecord.setMostVotedUserGroupId(mostVotedRecord.getUserGroupId()); dailyMostVotedRecord.setEarnCoin(1); dailyMostVotedRecord.setAwardDate(new Date()); dailyMostVotedRecordMapper.insertSelective(dailyMostVotedRecord); }else { dailyMostVotedRecord.setEarnCoin(1); dailyMostVotedRecordMapper.updateByPrimaryKey(dailyMostVotedRecord); } } }
MostVotedJob { public void calculateThePersonToGetCoin(){ dailyMostVotedRecordMapper.deleteByDate(new Date()); final ThisLocalizedWeek chinaWeek = new ThisLocalizedWeek(Locale.CHINA); List<MostVotedRecord> mostVotedRecords = mostVotedRecordMapper.selectThePersonShouldBeAward(chinaWeek.getFirstDay(), chinaWeek.getLastDay(), new Date()); for (MostVotedRecord mostVotedRecord : mostVotedRecords) { DailyMostVotedRecord dailyMostVotedRecord = dailyMostVotedRecordMapper.selectByawardDateAndMostVotedUserGroupId(new Date(), mostVotedRecord.getUserGroupId()); if (dailyMostVotedRecord == null) { dailyMostVotedRecord = new DailyMostVotedRecord(); dailyMostVotedRecord.setMostVotedUserGroupId(mostVotedRecord.getUserGroupId()); dailyMostVotedRecord.setEarnCoin(1); dailyMostVotedRecord.setAwardDate(new Date()); dailyMostVotedRecordMapper.insertSelective(dailyMostVotedRecord); }else { dailyMostVotedRecord.setEarnCoin(1); dailyMostVotedRecordMapper.updateByPrimaryKey(dailyMostVotedRecord); } } } }
MostVotedJob { public void calculateThePersonToGetCoin(){ dailyMostVotedRecordMapper.deleteByDate(new Date()); final ThisLocalizedWeek chinaWeek = new ThisLocalizedWeek(Locale.CHINA); List<MostVotedRecord> mostVotedRecords = mostVotedRecordMapper.selectThePersonShouldBeAward(chinaWeek.getFirstDay(), chinaWeek.getLastDay(), new Date()); for (MostVotedRecord mostVotedRecord : mostVotedRecords) { DailyMostVotedRecord dailyMostVotedRecord = dailyMostVotedRecordMapper.selectByawardDateAndMostVotedUserGroupId(new Date(), mostVotedRecord.getUserGroupId()); if (dailyMostVotedRecord == null) { dailyMostVotedRecord = new DailyMostVotedRecord(); dailyMostVotedRecord.setMostVotedUserGroupId(mostVotedRecord.getUserGroupId()); dailyMostVotedRecord.setEarnCoin(1); dailyMostVotedRecord.setAwardDate(new Date()); dailyMostVotedRecordMapper.insertSelective(dailyMostVotedRecord); }else { dailyMostVotedRecord.setEarnCoin(1); dailyMostVotedRecordMapper.updateByPrimaryKey(dailyMostVotedRecord); } } }  }
MostVotedJob { public void calculateThePersonToGetCoin(){ dailyMostVotedRecordMapper.deleteByDate(new Date()); final ThisLocalizedWeek chinaWeek = new ThisLocalizedWeek(Locale.CHINA); List<MostVotedRecord> mostVotedRecords = mostVotedRecordMapper.selectThePersonShouldBeAward(chinaWeek.getFirstDay(), chinaWeek.getLastDay(), new Date()); for (MostVotedRecord mostVotedRecord : mostVotedRecords) { DailyMostVotedRecord dailyMostVotedRecord = dailyMostVotedRecordMapper.selectByawardDateAndMostVotedUserGroupId(new Date(), mostVotedRecord.getUserGroupId()); if (dailyMostVotedRecord == null) { dailyMostVotedRecord = new DailyMostVotedRecord(); dailyMostVotedRecord.setMostVotedUserGroupId(mostVotedRecord.getUserGroupId()); dailyMostVotedRecord.setEarnCoin(1); dailyMostVotedRecord.setAwardDate(new Date()); dailyMostVotedRecordMapper.insertSelective(dailyMostVotedRecord); }else { dailyMostVotedRecord.setEarnCoin(1); dailyMostVotedRecordMapper.updateByPrimaryKey(dailyMostVotedRecord); } } }  void insertDailyVotedCount(); void calculateThePersonToGetCoin(); }
MostVotedJob { public void calculateThePersonToGetCoin(){ dailyMostVotedRecordMapper.deleteByDate(new Date()); final ThisLocalizedWeek chinaWeek = new ThisLocalizedWeek(Locale.CHINA); List<MostVotedRecord> mostVotedRecords = mostVotedRecordMapper.selectThePersonShouldBeAward(chinaWeek.getFirstDay(), chinaWeek.getLastDay(), new Date()); for (MostVotedRecord mostVotedRecord : mostVotedRecords) { DailyMostVotedRecord dailyMostVotedRecord = dailyMostVotedRecordMapper.selectByawardDateAndMostVotedUserGroupId(new Date(), mostVotedRecord.getUserGroupId()); if (dailyMostVotedRecord == null) { dailyMostVotedRecord = new DailyMostVotedRecord(); dailyMostVotedRecord.setMostVotedUserGroupId(mostVotedRecord.getUserGroupId()); dailyMostVotedRecord.setEarnCoin(1); dailyMostVotedRecord.setAwardDate(new Date()); dailyMostVotedRecordMapper.insertSelective(dailyMostVotedRecord); }else { dailyMostVotedRecord.setEarnCoin(1); dailyMostVotedRecordMapper.updateByPrimaryKey(dailyMostVotedRecord); } } }  void insertDailyVotedCount(); void calculateThePersonToGetCoin();  }