|
|
@@ -219,7 +219,7 @@ public class RiceService {
|
|
|
|
|
|
|
|
|
public List<RiceDTO> getTop100(Long userId) {
|
|
|
- // this.updateLvRank();
|
|
|
+ this.updateLvRank();
|
|
|
List<Rice> top100Rices = riceRepo.findTop100OrderByEmpiricalValueDesc();
|
|
|
List<RiceDTO> result = new ArrayList<>();
|
|
|
|
|
|
@@ -774,29 +774,29 @@ public class RiceService {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
- @Scheduled(cron = "0 0 12 * * ?")
|
|
|
- public void updateAllRiceLevel() {
|
|
|
- String jsonString = sysConfigService.getString("rice_level");
|
|
|
- JsonReader jsonReader = Json.createReader(new StringReader(jsonString));
|
|
|
- JsonArray jsonArray = jsonReader.readArray();
|
|
|
-
|
|
|
- List<Rice> allRices = riceRepo.findAll();
|
|
|
- allRices.forEach(rice -> {
|
|
|
- Long currentLevel = null;
|
|
|
- for (int j = 0; j < jsonArray.size(); j++) {
|
|
|
- JsonObject jsonObject = jsonArray.getJsonObject(j);
|
|
|
- Long start = Long.valueOf(jsonObject.getInt("start"));
|
|
|
- if (rice.getEmpiricalValue() >= start && rice.getEmpiricalValue() < (j < jsonArray.size() - 1 ? Long.valueOf(jsonArray.getJsonObject(j + 1).getInt("start")) : Long.MAX_VALUE)) {
|
|
|
- String currentLevelStr = jsonObject.getString("name").replace("Lv", "");
|
|
|
- currentLevel = Long.parseLong(currentLevelStr);
|
|
|
- rice.setLevel(currentLevel);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- riceRepo.saveAll(allRices);
|
|
|
- }
|
|
|
+//
|
|
|
+// @Scheduled(cron = "0 0 12 * * ?")
|
|
|
+// public void updateAllRiceLevel() {
|
|
|
+// String jsonString = sysConfigService.getString("rice_level");
|
|
|
+// JsonReader jsonReader = Json.createReader(new StringReader(jsonString));
|
|
|
+// JsonArray jsonArray = jsonReader.readArray();
|
|
|
+//
|
|
|
+// List<Rice> allRices = riceRepo.findAll();
|
|
|
+// allRices.forEach(rice -> {
|
|
|
+// Long currentLevel = null;
|
|
|
+// for (int j = 0; j < jsonArray.size(); j++) {
|
|
|
+// JsonObject jsonObject = jsonArray.getJsonObject(j);
|
|
|
+// Long start = Long.valueOf(jsonObject.getInt("start"));
|
|
|
+// if (rice.getEmpiricalValue() >= start && rice.getEmpiricalValue() < (j < jsonArray.size() - 1 ? Long.valueOf(jsonArray.getJsonObject(j + 1).getInt("start")) : Long.MAX_VALUE)) {
|
|
|
+// String currentLevelStr = jsonObject.getString("name").replace("Lv", "");
|
|
|
+// currentLevel = Long.parseLong(currentLevelStr);
|
|
|
+// rice.setLevel(currentLevel);
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
+// riceRepo.saveAll(allRices);
|
|
|
+// }
|
|
|
|
|
|
|
|
|
|