mirror of https://github.com/hykilpikonna/AquaDX
[F] Fix build
parent
add1e02d2f
commit
054b286388
|
@ -40,6 +40,8 @@ typealias Str = String
|
|||
typealias Bool = Boolean
|
||||
typealias JavaSerializable = java.io.Serializable
|
||||
|
||||
typealias JDict = Map<String, Any?>
|
||||
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.PROPERTY_GETTER)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class Doc(
|
||||
|
@ -179,6 +181,7 @@ fun <K, V: Any> Map<K, V?>.recursiveNotNull(): Map<K, V> = mapNotNull { (k, v) -
|
|||
|
||||
// Optionals
|
||||
operator fun <T> Optional<T>.invoke(): T? = orElse(null)
|
||||
fun <T> Optional<T>.expect(message: Str = "Value is not present") = orElseGet { (400 - message) }
|
||||
|
||||
// Strings
|
||||
operator fun Str.get(range: IntRange) = substring(range.first, (range.last + 1).coerceAtMost(length))
|
||||
|
|
|
@ -462,9 +462,9 @@ public class ApiChuniV2PlayerDataController {
|
|||
userItemList.forEach(x -> x.setUser(userData));
|
||||
userItemService.saveAll(userItemList);
|
||||
|
||||
List<UserMap> userMapList = data.getUserMapList();
|
||||
userMapList.forEach(x -> x.setUser(userData));
|
||||
userMapAreaService.saveAll(userMapList);
|
||||
// List<UserMap> userMapList = data.getUserMapList();
|
||||
// userMapList.forEach(x -> x.setUser(userData));
|
||||
// userMapAreaService.saveAll(userMapList);
|
||||
|
||||
List<UserMusicDetail> userMusicDetailList = data.getUserMusicDetailList();
|
||||
userMusicDetailList.forEach(x -> x.setUser(userData));
|
||||
|
|
|
@ -24,7 +24,7 @@ class GetUserMapAreaHandler(
|
|||
|
||||
val resultMap = mapOf(
|
||||
"userId" to userId,
|
||||
"userMapAreaList" to userMapRepo.findAllUserMaps(userId?.toLong() ?: return "{}", maps)
|
||||
"userMapAreaList" to userMapRepo.findAllByUserCardExtIdAndMapAreaIdIn(userId?.toLong() ?: return "{}", maps)
|
||||
)
|
||||
|
||||
val json = mapper.write(resultMap)
|
||||
|
|
|
@ -8,10 +8,10 @@ import icu.samnyan.aqua.sega.chusan.service.UserGeneralDataService;
|
|||
import icu.samnyan.aqua.sega.chusan.service.UserPlaylogService;
|
||||
import icu.samnyan.aqua.sega.general.model.response.UserRecentRating;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -22,25 +22,14 @@ import java.util.stream.Collectors;
|
|||
*
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Component("ChusanGetUserRecentRatingHandler")
|
||||
public class GetUserRecentRatingHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserRecentRatingHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserPlaylogService userPlaylogService;
|
||||
private final UserGeneralDataService userGeneralDataService;
|
||||
|
||||
@Autowired
|
||||
public GetUserRecentRatingHandler(StringMapper mapper, UserPlaylogService userPlaylogService, UserGeneralDataService userGeneralDataService) {
|
||||
this.mapper = mapper;
|
||||
this.userPlaylogService = userPlaylogService;
|
||||
this.userGeneralDataService = userGeneralDataService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, ?> request) throws JsonProcessingException {
|
||||
public Object handle(Map<String, ?> request) throws JsonProcessingException {
|
||||
String userId = (String) request.get("userId");
|
||||
|
||||
Optional<UserGeneralData> recentOptional = userGeneralDataService.getByUserIdAndKey(userId, "recent_rating_list");
|
||||
|
@ -73,8 +62,6 @@ public class GetUserRecentRatingHandler implements BaseHandler {
|
|||
resultMap.put("length", ratingList.size());
|
||||
resultMap.put("userRecentRatingList", ratingList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,10 +26,6 @@ public class UserMapAreaService {
|
|||
return userMapRepository.save(userMap);
|
||||
}
|
||||
|
||||
public List<UserMap> saveAll(Iterable<UserMap> userMap) {
|
||||
return userMapRepository.saveAll(userMap);
|
||||
}
|
||||
|
||||
public List<UserMap> getByUser(Chu3UserData user) {
|
||||
return userMapRepository.findByUser(user);
|
||||
}
|
||||
|
@ -37,8 +33,4 @@ public class UserMapAreaService {
|
|||
public List<UserMap> getByUserId(String userId) {
|
||||
return userMapRepository.findByUser_Card_ExtId(Long.parseLong(userId));
|
||||
}
|
||||
|
||||
public Optional<UserMap> getByUserAndMapAreaId(Chu3UserData user, int mapId) {
|
||||
return userMapRepository.findTopByUserAndMapAreaIdOrderByIdDesc(user, mapId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.JsonProcessingException
|
|||
import ext.invoke
|
||||
import ext.mapApply
|
||||
import ext.minus
|
||||
import icu.samnyan.aqua.net.games.SEGA_USERNAME_CAHRS
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.general.service.CardService
|
||||
import icu.samnyan.aqua.sega.maimai2.handler.UploadUserPlaylogHandler.Companion.playBacklog
|
||||
|
@ -15,7 +14,6 @@ import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
|||
import lombok.AllArgsConstructor
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import kotlin.math.log
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
|
@ -70,12 +68,12 @@ class UpsertUserAllHandler(
|
|||
}
|
||||
|
||||
// Set users
|
||||
req.run { listOf(userExtend, userOption, userCharacterList, userMapList, userLoginBonusList, userItemList,
|
||||
userMusicDetailList, userCourseList, userFriendSeasonRankingList, userFavoriteList).filterNotNull() }
|
||||
.flatten().forEach {
|
||||
logger.info(it.toString())
|
||||
it.user = u
|
||||
}
|
||||
req.run {
|
||||
listOfNotNull(
|
||||
userExtend, userOption, userCharacterList, userMapList, userLoginBonusList, userItemList,
|
||||
userMusicDetailList, userCourseList, userFriendSeasonRankingList, userFavoriteList
|
||||
)
|
||||
}.flatten().forEach { it.user = u }
|
||||
|
||||
req.userExtend?.getOrNull(0)?.let {
|
||||
repos.userExtend.save(it.apply { id = repos.userExtend.findSingleByUser(u)()?.id ?: 0 })
|
||||
|
|
Loading…
Reference in New Issue