forked from Cookies_Github_mirror/AquaDX
Merge dev.s-ul.net:rinsama/aqua into v1-dev
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package icu.samnyan.aqua.sega.chusan.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chusan.model.userdata.UserCMissionProgress;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository("ChusanUserCMissionProgressRepository")
|
||||
public interface UserCMissionProgressRepository extends JpaRepository<UserCMissionProgress, Long> {
|
||||
List<UserCMissionProgress> findByUser_Card_ExtIdAndMissionId(Long extId, int missionId);
|
||||
|
||||
Optional<UserCMissionProgress> findByUser_Card_ExtIdAndMissionIdAndOrder(Long extId, int missionId, int order);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package icu.samnyan.aqua.sega.chusan.dao.userdata;
|
||||
|
||||
import icu.samnyan.aqua.sega.chusan.model.userdata.UserCMission;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository("ChusanUserCMissionRepository")
|
||||
public interface UserCMissionRepository extends JpaRepository<UserCMission, Long> {
|
||||
Optional<UserCMission> findByUser_Card_ExtIdAndMissionId(Long extId, int missionId);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package icu.samnyan.aqua.sega.chusan.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chusan.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component("ChusanGetGameMapAreaConditionHandler")
|
||||
public class GetGameMapAreaConditionHandler implements BaseHandler {
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameMapAreaConditionHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
@Autowired
|
||||
public GetGameMapAreaConditionHandler(StringMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
logger.info("MapAreaCondition Dummy Handler");
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("mapAreaConditionList", new LinkedHashMap<>());
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package icu.samnyan.aqua.sega.chusan.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chusan.dao.userdata.UserCMissionProgressRepository;
|
||||
import icu.samnyan.aqua.sega.chusan.dao.userdata.UserCMissionRepository;
|
||||
import icu.samnyan.aqua.sega.chusan.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chusan.model.response.data.UserCMissionProgressResp;
|
||||
import icu.samnyan.aqua.sega.chusan.model.response.data.UserCMissionResp;
|
||||
import icu.samnyan.aqua.sega.chusan.model.userdata.UserCMission;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Component("ChusanGetUserCMissionHandler")
|
||||
public class GetUserCMissionHandler implements BaseHandler {
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserCMissionHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final UserCMissionProgressRepository userCMissionProgressRepository;
|
||||
private final UserCMissionRepository userCMissionRepository;
|
||||
|
||||
@Autowired
|
||||
public GetUserCMissionHandler(StringMapper mapper, UserCMissionProgressRepository userCMissionProgressRepository, UserCMissionRepository userCMissionRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userCMissionProgressRepository = userCMissionProgressRepository;
|
||||
this.userCMissionRepository = userCMissionRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = Long.parseLong((String) request.get("userId"));
|
||||
int missionId = Integer.parseInt((String) request.get("missionId"));
|
||||
|
||||
UserCMissionResp userCMissionResp = new UserCMissionResp();
|
||||
userCMissionResp.setUserId(userId);
|
||||
userCMissionResp.setMissionId(missionId);
|
||||
|
||||
Optional<UserCMission> userCMissionOptional = userCMissionRepository.findByUser_Card_ExtIdAndMissionId(userId, missionId);
|
||||
if (userCMissionOptional.isPresent()) {
|
||||
userCMissionResp.setPoint(userCMissionOptional.get().getPoint());
|
||||
List<UserCMissionProgressResp> userCMissionProgressRespList = userCMissionProgressRepository.findByUser_Card_ExtIdAndMissionId(userId, missionId).stream()
|
||||
.map(userCMissionProgress -> {
|
||||
UserCMissionProgressResp userCMissionProgressResp = new UserCMissionProgressResp();
|
||||
userCMissionProgressResp.setOrder(userCMissionProgress.getOrder());
|
||||
userCMissionProgressResp.setProgress(userCMissionProgress.getProgress());
|
||||
userCMissionProgressResp.setStage(userCMissionProgress.getStage());
|
||||
return userCMissionProgressResp;
|
||||
}).toList();
|
||||
userCMissionResp.setUserCMissionProgressList(userCMissionProgressRespList);
|
||||
}
|
||||
|
||||
String json = mapper.write(userCMissionResp);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package icu.samnyan.aqua.sega.chusan.handler.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.chusan.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component("ChusanGetUserNetBattleRankingInfoHandler")
|
||||
public class GetUserNetBattleRankingInfoHandler implements BaseHandler {
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserNetBattleRankingInfoHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
|
||||
@Autowired
|
||||
public GetUserNetBattleRankingInfoHandler(StringMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
logger.info("UserNetBattleRankingInfo Dummy Handler");
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", request.get("userId"));
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("userNetBattleRankingInfoList", new LinkedHashMap<>());
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package icu.samnyan.aqua.sega.chusan.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chusan.dao.userdata.UserCMissionProgressRepository;
|
||||
import icu.samnyan.aqua.sega.chusan.dao.userdata.UserCMissionRepository;
|
||||
import icu.samnyan.aqua.sega.chusan.model.request.UpsertUserAll;
|
||||
import icu.samnyan.aqua.sega.chusan.model.response.CodeResp;
|
||||
import icu.samnyan.aqua.sega.chusan.model.userdata.*;
|
||||
@@ -46,6 +48,8 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
private final UserDuelService userDuelService;
|
||||
private final UserGeneralDataService userGeneralDataService;
|
||||
private final UserLoginBonusService userLoginBonusService;
|
||||
private final UserCMissionRepository userCMissionRepository;
|
||||
private final UserCMissionProgressRepository userCMissionProgressRepository;
|
||||
|
||||
@Autowired
|
||||
public UpsertUserAllHandler(StringMapper mapper,
|
||||
@@ -62,7 +66,8 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
UserCourseService userCourseService,
|
||||
UserDuelService userDuelService,
|
||||
UserGeneralDataService userGeneralDataService,
|
||||
UserLoginBonusService userLoginBonusService) {
|
||||
UserLoginBonusService userLoginBonusService,
|
||||
UserCMissionRepository userCMissionRepository, UserCMissionProgressRepository userCMissionProgressRepository) {
|
||||
this.mapper = mapper;
|
||||
this.cardService = cardService;
|
||||
this.userDataService = userDataService;
|
||||
@@ -78,6 +83,8 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
this.userDuelService = userDuelService;
|
||||
this.userGeneralDataService = userGeneralDataService;
|
||||
this.userLoginBonusService = userLoginBonusService;
|
||||
this.userCMissionRepository = userCMissionRepository;
|
||||
this.userCMissionProgressRepository = userCMissionProgressRepository;
|
||||
}
|
||||
|
||||
|
||||
@@ -336,6 +343,45 @@ public class UpsertUserAllHandler implements BaseHandler {
|
||||
userLoginBonusService.saveAll(newUserLoginBonusMap.values());
|
||||
}
|
||||
|
||||
// userCMissionList
|
||||
if (upsertUserAll.getUserCMissionList() != null){
|
||||
List<Map<String, Object>> userCMissionList = upsertUserAll.getUserCMissionList();
|
||||
userCMissionList.forEach(userCMission -> {
|
||||
int missionId = Integer.parseInt((String) userCMission.get("missionId"));
|
||||
int point = Integer.parseInt((String) userCMission.get("point"));
|
||||
List<Map<String, Object>> userCMissionProgressList = (List<Map<String, Object>>) userCMission.get("userCMissionProgressList");
|
||||
userCMissionRepository.findByUser_Card_ExtIdAndMissionId(Long.parseLong(userId), missionId).ifPresentOrElse(userCMission1 -> {
|
||||
userCMission1.setPoint(point);
|
||||
userCMissionRepository.save(userCMission1);
|
||||
}, () -> {
|
||||
UserCMission userCMission1 = new UserCMission();
|
||||
userCMission1.setMissionId(missionId);
|
||||
userCMission1.setPoint(point);
|
||||
userCMission1.setUser(userData);
|
||||
userCMissionRepository.save(userCMission1);
|
||||
});
|
||||
|
||||
userCMissionProgressList.forEach(userCMissionProgress -> {
|
||||
int order = Integer.parseInt((String) userCMissionProgress.get("order"));
|
||||
int progress = Integer.parseInt((String) userCMissionProgress.get("progress"));
|
||||
int stage = Integer.parseInt((String) userCMissionProgress.get("stage"));
|
||||
userCMissionProgressRepository.findByUser_Card_ExtIdAndMissionIdAndOrder(Long.parseLong(userId), missionId, order).ifPresentOrElse(userCMissionProgress1 -> {
|
||||
userCMissionProgress1.setProgress(progress);
|
||||
userCMissionProgress1.setStage(stage);
|
||||
userCMissionProgressRepository.save(userCMissionProgress1);
|
||||
}, () -> {
|
||||
UserCMissionProgress userCMissionProgress1 = new UserCMissionProgress();
|
||||
userCMissionProgress1.setMissionId(missionId);
|
||||
userCMissionProgress1.setOrder(order);
|
||||
userCMissionProgress1.setProgress(progress);
|
||||
userCMissionProgress1.setStage(stage);
|
||||
userCMissionProgress1.setUser(userData);
|
||||
userCMissionProgressRepository.save(userCMissionProgress1);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
String json = mapper.write(new CodeResp(1));
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
|
||||
@@ -83,6 +83,9 @@ public class UpsertUserAll implements Serializable {
|
||||
@Nullable
|
||||
private List<Map<String, Object>> userNetBattleData;
|
||||
|
||||
@Nullable
|
||||
private List<Map<String, Object>> userCMissionList;
|
||||
|
||||
@Nullable
|
||||
@JsonProperty("isNewCharacterList")
|
||||
private String isNewCharacterList;
|
||||
@@ -107,4 +110,8 @@ public class UpsertUserAll implements Serializable {
|
||||
@JsonProperty("isNewMapAreaList")
|
||||
private String isNewMapAreaList;
|
||||
|
||||
@Nullable
|
||||
@JsonProperty("isNewCMissionList")
|
||||
private String isNewCMissionList;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package icu.samnyan.aqua.sega.chusan.model.response.data;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserCMissionProgressResp implements Serializable {
|
||||
private int order;
|
||||
private int stage;
|
||||
private int progress;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package icu.samnyan.aqua.sega.chusan.model.response.data;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserCMissionResp implements Serializable {
|
||||
private long userId;
|
||||
private int missionId;
|
||||
private int point;
|
||||
private List<UserCMissionProgressResp> userCMissionProgressList;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package icu.samnyan.aqua.sega.chusan.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import javax.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Entity(name = "ChusanUserCMission")
|
||||
@Table(name = "chusan_user_cmission")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserCMission {
|
||||
@Id
|
||||
@JsonIgnore
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
@Column(name = "mission_id")
|
||||
private int missionId;
|
||||
|
||||
@Column(name = "point")
|
||||
private int point;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package icu.samnyan.aqua.sega.chusan.model.userdata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity(name = "ChusanUserCMissionProgress")
|
||||
@Table(name = "chusan_user_cmission_progress", uniqueConstraints = {@UniqueConstraint(columnNames = {"user_id", "mission_id", "order"})})
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserCMissionProgress {
|
||||
@Id
|
||||
@JsonIgnore
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserData user;
|
||||
|
||||
@Column(name = "mission_id")
|
||||
private int missionId;
|
||||
|
||||
@Column(name = "`order`")
|
||||
private int order;
|
||||
|
||||
private int stage;
|
||||
|
||||
private int progress;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
CREATE TABLE chusan_user_cmission
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT NOT NULL,
|
||||
user_id BIGINT NULL,
|
||||
mission_id INT NULL,
|
||||
point INT NULL,
|
||||
CONSTRAINT pk_chusan_user_cmission PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
ALTER TABLE chusan_user_cmission
|
||||
ADD CONSTRAINT FK_CHUSAN_USER_CMISSION_ON_USER FOREIGN KEY (user_id) REFERENCES chusan_user_data (id);
|
||||
|
||||
CREATE TABLE chusan_user_cmission_progress
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT NOT NULL,
|
||||
user_id BIGINT NULL,
|
||||
mission_id INT NULL,
|
||||
`order` INT NOT NULL,
|
||||
stage INT NULL,
|
||||
progress INT NULL,
|
||||
CONSTRAINT pk_chusan_user_cmission_progress PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
ALTER TABLE chusan_user_cmission_progress
|
||||
ADD CONSTRAINT uc_6ab791e9e8fee2b3fab35d3d2 UNIQUE (user_id, mission_id, `order`);
|
||||
|
||||
ALTER TABLE chusan_user_cmission_progress
|
||||
ADD CONSTRAINT FK_CHUSAN_USER_CMISSION_PROGRESS_ON_USER FOREIGN KEY (user_id) REFERENCES chusan_user_data (id);
|
||||
@@ -0,0 +1,28 @@
|
||||
CREATE TABLE chusan_user_cmission
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT NOT NULL,
|
||||
user_id BIGINT NULL,
|
||||
mission_id INT NULL,
|
||||
point INT NULL,
|
||||
CONSTRAINT pk_chusan_user_cmission PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
ALTER TABLE chusan_user_cmission
|
||||
ADD CONSTRAINT FK_CHUSAN_USER_CMISSION_ON_USER FOREIGN KEY (user_id) REFERENCES chusan_user_data (id);
|
||||
|
||||
CREATE TABLE chusan_user_cmission_progress
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT NOT NULL,
|
||||
user_id BIGINT NULL,
|
||||
mission_id INT NULL,
|
||||
`order` INT NOT NULL,
|
||||
stage INT NULL,
|
||||
progress INT NULL,
|
||||
CONSTRAINT pk_chusan_user_cmission_progress PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
ALTER TABLE chusan_user_cmission_progress
|
||||
ADD CONSTRAINT uc_6ab791e9e8fee2b3fab35d3d2 UNIQUE (user_id, mission_id, `order`);
|
||||
|
||||
ALTER TABLE chusan_user_cmission_progress
|
||||
ADD CONSTRAINT FK_CHUSAN_USER_CMISSION_PROGRESS_ON_USER FOREIGN KEY (user_id) REFERENCES chusan_user_data (id);
|
||||
@@ -0,0 +1,20 @@
|
||||
CREATE TABLE chusan_user_cmission
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
user_id INTEGER,
|
||||
mission_id INTEGER,
|
||||
point INTEGER,
|
||||
FOREIGN KEY(user_id) REFERENCES chusan_user_data(id)
|
||||
);
|
||||
|
||||
CREATE TABLE chusan_user_cmission_progress
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
user_id INTEGER,
|
||||
mission_id INTEGER,
|
||||
`order` INTEGER NOT NULL,
|
||||
stage INTEGER,
|
||||
progress INTEGER,
|
||||
UNIQUE(user_id, mission_id, `order`),
|
||||
FOREIGN KEY(user_id) REFERENCES chusan_user_data(id)
|
||||
);
|
||||
Reference in New Issue
Block a user