|
@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@@ -38,8 +39,25 @@ public class RaceServiceImpl extends IBaseServiceImpl<RaceEntity, Long> implemen
|
|
|
// 目前是12h
|
|
|
private static Integer RACE_EXPIRE = 1000 * 60 * 60 * 12;
|
|
|
|
|
|
+ // 月份映射
|
|
|
+ private static HashMap<Integer, String> monthMap;
|
|
|
+ static {
|
|
|
+ monthMap = new HashMap<>();
|
|
|
+ monthMap.put(1, "01");
|
|
|
+ monthMap.put(2, "02");
|
|
|
+ monthMap.put(3, "03");
|
|
|
+ monthMap.put(4, "04");
|
|
|
+ monthMap.put(5, "05");
|
|
|
+ monthMap.put(6, "06");
|
|
|
+ monthMap.put(7, "07");
|
|
|
+ monthMap.put(8, "08");
|
|
|
+ monthMap.put(9, "09");
|
|
|
+ monthMap.put(10, "10");
|
|
|
+ monthMap.put(11, "11");
|
|
|
+ monthMap.put(12, "12");
|
|
|
|
|
|
|
|
|
+ }
|
|
|
@Override
|
|
|
public IBaseMapper<RaceEntity, Long> getBaseMapper() {
|
|
|
return this.entityMapper;
|
|
@@ -71,7 +89,8 @@ public class RaceServiceImpl extends IBaseServiceImpl<RaceEntity, Long> implemen
|
|
|
List<RaceEntity> list;
|
|
|
LocalDate now = LocalDate.now();
|
|
|
if ("month".equals(type)){
|
|
|
- String date = now.getYear()+"" + now.getMonthValue();
|
|
|
+ String month = monthMap.get(now.getMonthValue());
|
|
|
+ String date = now.getYear()+month;
|
|
|
|
|
|
list = entityMapper.getRankingByMonth(size, date);
|
|
|
// 当月排名前山的添加积分, 每月1号添加积分
|
|
@@ -85,6 +104,8 @@ public class RaceServiceImpl extends IBaseServiceImpl<RaceEntity, Long> implemen
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 前三名添加积分
|
|
|
* @param param
|