전투 이벤트 등록 예외 추가
이용자 제재 엑셀 체크 수정
This commit is contained in:
@@ -130,6 +130,18 @@ public class BattleEventService {
|
||||
}
|
||||
battleEventRequest.setInstanceId(CommonConstants.BATTLE_INSTANCE_ID); //고정값으로 넣고 추후 맵정보가 늘어나면 선택하는 걸로
|
||||
|
||||
if(battleEventRequest.getRoundTime().equals(0)
|
||||
|| battleEventRequest.getHotTime().equals(0)
|
||||
|| battleEventRequest.getConfigId().equals(0)
|
||||
|| battleEventRequest.getRoundCount().equals(0)
|
||||
|| battleEventRequest.getRewardGroupId().equals(0)
|
||||
){
|
||||
return BattleEventResponse.builder()
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
.result(ErrorCode.ERROR_BATTLE_EVENT_TIME_OVER.toString())
|
||||
.build();
|
||||
}
|
||||
|
||||
int operation_time = calcEndTime(battleEventRequest);
|
||||
battleEventRequest.setEventOperationTime(operation_time);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.caliverse.admin.domain.service;
|
||||
import com.caliverse.admin.domain.dao.admin.BlackListMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.entity.BlackList;
|
||||
import com.caliverse.admin.domain.entity.Excel;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.request.BlackListRequest;
|
||||
import com.caliverse.admin.domain.response.BlackListResponse;
|
||||
@@ -10,6 +11,7 @@ import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.common.utils.ExcelUtils;
|
||||
@@ -85,10 +87,10 @@ public class BlackListService {
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_EXIT_EXCEL.getMessage() );
|
||||
}
|
||||
|
||||
List<String> listData = excelUtils.getListData(file, 1, 0);
|
||||
List<Excel> listData = excelUtils.getListData(file);
|
||||
|
||||
// 엑셀 파일내 중복된 데이터 있는지 체크
|
||||
if(excelUtils.hasDuplicates(listData)){
|
||||
if(excelUtils.hasDuplicatesExcel(listData)){
|
||||
//중복된 유저 정보가 있습니다.
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DUPLICATE_EXCEL.getMessage() );
|
||||
}
|
||||
@@ -96,28 +98,27 @@ public class BlackListService {
|
||||
listData.forEach(item->{
|
||||
|
||||
BlackList blackList = new BlackList();
|
||||
blackList.setGuid(item);
|
||||
//gameDB에서 닉네임, isWhiteUser, isBlackUser 조회
|
||||
String nickName = dynamodbUserService.getGuidByName(item);
|
||||
if(nickName != ""){
|
||||
|
||||
String user = item.getUser();
|
||||
boolean isGuid = true;
|
||||
if(item.getType().equals(CommonConstants.NICKNAME)){
|
||||
blackList.setNickname(user);
|
||||
String guid = dynamodbUserService.getNameByGuid(user);
|
||||
if(guid == null || guid.isEmpty()) isGuid = false;
|
||||
blackList.setGuid(guid);
|
||||
}else{
|
||||
isGuid = dynamodbUserService.isUser(user);
|
||||
blackList.setGuid(user);
|
||||
String nickName = dynamodbUserService.getGuidByName(user);
|
||||
blackList.setNickname(nickName);
|
||||
}
|
||||
|
||||
//adminDB 에 데이터 있는지 체크
|
||||
int cnt = blackListMapper.getCountByGuid(item);
|
||||
//gameDB isWhiteUser 값 체크
|
||||
// boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(item);
|
||||
boolean isBlackUser = dynamodbUserService.isBlockUser(item);
|
||||
boolean isGuid = dynamoDBService.isGuidChecked(item);
|
||||
int cnt = blackListMapper.getCountByGuid(blackList.getGuid());
|
||||
boolean isBlackUser = dynamodbUserService.isBlockUser(blackList.getGuid());
|
||||
|
||||
// //guid 검증
|
||||
// if(blackAttr.size() == 0){
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_CHECK.getMessage());
|
||||
// }
|
||||
//
|
||||
// boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(blackAttr.get("isBlackUser"));
|
||||
if(cnt == 0){
|
||||
if(isBlackUser || isGuid){
|
||||
if(isBlackUser || !isGuid){
|
||||
blackList.setValidate(false);
|
||||
}else{
|
||||
blackList.setValidate(true);
|
||||
@@ -160,7 +161,7 @@ public class BlackListService {
|
||||
if(dynamoDBService.isGuidChecked(guid)){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
|
||||
}
|
||||
// boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(guid);
|
||||
|
||||
boolean isBlackUser = dynamodbUserService.isBlockUser(guid);
|
||||
if(isBlackUser){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USER_BLOCK_REGIST_DUPLE_WARNING.toString());
|
||||
@@ -185,7 +186,7 @@ public class BlackListService {
|
||||
if(dynamoDBService.isGuidChecked(item.getGuid())){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
|
||||
}
|
||||
// boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(item.getGuid());
|
||||
|
||||
boolean isBlackUser = dynamodbUserService.isBlockUser(item.getGuid());
|
||||
if(isBlackUser){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USER_BLOCK_REGIST_DUPLE_WARNING.toString());
|
||||
|
||||
@@ -90,7 +90,7 @@ public class DynamodbUserService {
|
||||
}
|
||||
|
||||
public String getNameByGuid(String nickname){
|
||||
UserNicknameRegistryAttrib nicknameRegistryAttrib = userNicknameRegistryRepository.findUser(nickname);
|
||||
UserNicknameRegistryAttrib nicknameRegistryAttrib = userNicknameRegistryRepository.findUser(nickname.toLowerCase());
|
||||
if(nicknameRegistryAttrib == null){
|
||||
log.error("getNameByGuid UserNicknameRegistry Null nickname: {}", nickname);
|
||||
return "";
|
||||
|
||||
@@ -75,6 +75,7 @@ public enum ErrorCode {
|
||||
|
||||
//Battle
|
||||
ERROR_BATTLE_EVENT_TIME_OVER("해당 시간에 속하는 이벤트가 존재합니다."),
|
||||
ERROR_BATTLE_EVENT_CONFIG("설정값이 없는 데이터가 있다."),
|
||||
ERROR_BATTLE_EVENT_STATUS_IMPOSSIBLE("수정할 수 없는 이벤트상태입니다."),
|
||||
ERROR_BATTLE_EVENT_STATUS_START_IMPOSSIBLE("진행중인 이벤트상태입니다."),
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ public class CommonConstants {
|
||||
public static final String SYSTEM_MAIL_LAND_TRANS_KEY = "LandTrans";
|
||||
public static final int DYNAMODB_PAGING_SIZE = 30;
|
||||
public static final String S3_MENU_BANNER_DIRECTORY = "banner-";
|
||||
public static final String GUID = "GUID";
|
||||
public static final String NICKNAME = "NICKNAME";
|
||||
public static final String EMAIL = "EMAIL";
|
||||
|
||||
public static final String FORMAT_DATE_ISO_DATETIME_MILLIS = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
|
||||
public static final String FORMAT_DATE_ISO_DATETIME_MILLIS_NANO = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'";
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
@@ -202,6 +203,64 @@ public class ExcelUtils {
|
||||
return excelList;
|
||||
}
|
||||
|
||||
public List<Excel> getListData(MultipartFile file){
|
||||
List<Excel> excelList = new ArrayList<Excel>();
|
||||
|
||||
try {
|
||||
Workbook workbook = null;
|
||||
|
||||
String ext = FilenameUtils.getExtension(file.getOriginalFilename()).toLowerCase();
|
||||
if(!ext.equals("xlsx") && !ext.equals("xls")){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_EXIT_EXCEL.getMessage() ); //Excel 파일을 선택해주세요.
|
||||
}
|
||||
if (ext.equals("xls")){
|
||||
workbook = new HSSFWorkbook(file.getInputStream());
|
||||
}else{
|
||||
workbook = new XSSFWorkbook(file.getInputStream());
|
||||
}
|
||||
|
||||
// 첫번째 시트
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
|
||||
int rowIndex = 0;
|
||||
|
||||
// 첫번째 행(0)은 컬럼 명이기 때문에 두번째 행(1) 부터 검색
|
||||
for (rowIndex = 1; rowIndex < sheet.getLastRowNum() + 1; rowIndex++) {
|
||||
Row row = sheet.getRow(rowIndex);
|
||||
|
||||
if(row == null || row.getCell(0).toString().isBlank()) continue;
|
||||
|
||||
Excel rowData = new Excel();
|
||||
|
||||
Cell userCell = row.getCell(0);
|
||||
Cell typeCell = row.getCell(1);
|
||||
|
||||
if(getCellValue(typeCell).equals(CommonConstants.GUID)){
|
||||
if(!isString32Characters(getCellValue(userCell))){
|
||||
log.error("getListData : Excel Upload Guid Check Fail type {}, user {}", typeCell, userCell);
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_LENGTH_CHECK.getMessage() ); //guid 32자 체크
|
||||
}
|
||||
}else if(getCellValue(typeCell).equals(CommonConstants.NICKNAME) || getCellValue(typeCell).equals(CommonConstants.EMAIL)){
|
||||
}else{
|
||||
log.error("getListData : Excel Upload Type Error type {}, user {}", typeCell, userCell);
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USERTYPE_CHECK_EXCEL.getMessage() );
|
||||
}
|
||||
|
||||
rowData.setUser(getCellValue(userCell));
|
||||
rowData.setType(getCellValue(typeCell));
|
||||
|
||||
excelList.add(rowData);
|
||||
}
|
||||
|
||||
} catch (InvalidFormatException e) {
|
||||
log.info("getListData Invalid Excel Format:" + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
log.info("getListData IOException Excel Format:" + e.getMessage());
|
||||
}
|
||||
|
||||
return excelList;
|
||||
}
|
||||
|
||||
public void excelDownload(String sheetName, String headerNames[], String bodyDatass[][],String outfileName
|
||||
, HttpServletResponse res) throws IOException {
|
||||
|
||||
@@ -321,6 +380,19 @@ public class ExcelUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasDuplicatesExcel(List<Excel> dataList) {
|
||||
Set<String> uniqueValues = new HashSet<>();
|
||||
|
||||
for (Excel excel : dataList) {
|
||||
if(uniqueValues.contains(excel.getUser())){
|
||||
return true;
|
||||
}
|
||||
uniqueValues.add(excel.getUser());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isString32Characters(String input) {
|
||||
if (input == null) {
|
||||
return false;
|
||||
|
||||
Binary file not shown.
@@ -31,6 +31,7 @@
|
||||
,(SELECT @row_number:=0) AS t
|
||||
WHERE 1 = 1
|
||||
AND a.deleted = 0
|
||||
|
||||
<choose>
|
||||
<when test="search_type == 'NAME' or search_type == 'name' ">
|
||||
<if test="search_key != null and search_key != ''">
|
||||
@@ -43,6 +44,7 @@
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
<if test="sanctions != null and sanctions != ''">
|
||||
<choose>
|
||||
<when test="sanctions == 'ALL' ">
|
||||
@@ -52,6 +54,7 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="status != null and status != ''">
|
||||
<choose>
|
||||
<when test="status == 'ALL' ">
|
||||
@@ -61,6 +64,7 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="period != null and period != ''">
|
||||
<choose>
|
||||
<when test="period == 'ALL' ">
|
||||
@@ -76,16 +80,20 @@
|
||||
<if test="email != null and email != ''">
|
||||
AND c.create_by LIKE CONCAT('%',#{email},'%')
|
||||
</if>
|
||||
|
||||
<if test="orderby != null and orderby != ''">
|
||||
ORDER BY c.row_num ${orderby}
|
||||
</if>
|
||||
|
||||
<if test="pageSize != null and pageSize != ''">
|
||||
LIMIT ${pageSize} OFFSET ${offset}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getTotal" resultType="java.lang.Integer" parameterType="map">
|
||||
SELECT count(*) FROM black_list WHERE deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="getAllCnt" resultType="java.lang.Integer" parameterType="map">
|
||||
SELECT count(*) FROM black_list a WHERE a.deleted = 0
|
||||
<choose>
|
||||
@@ -128,6 +136,7 @@
|
||||
</choose>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getBlackListDetail" parameterType="java.lang.Long" resultMap="BlackListResultMap">
|
||||
SELECT a.id
|
||||
,a.guid
|
||||
@@ -142,6 +151,7 @@
|
||||
, (SELECT email FROM admin WHERE id = a.create_by ) AS create_by
|
||||
FROM black_list a WHERE a.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getHistoryByGuid" parameterType="java.lang.String" resultMap="BlackListResultMap">
|
||||
SELECT a.guid
|
||||
,a.nickname
|
||||
@@ -153,7 +163,10 @@
|
||||
, (SELECT email FROM admin WHERE id = a.create_by ) AS create_by
|
||||
,a.start_dt
|
||||
,a.end_dt
|
||||
FROM black_list a WHERE guid = #{guid}
|
||||
FROM black_list a
|
||||
WHERE guid = #{guid}
|
||||
AND a.deleted = 0
|
||||
ORDER BY a.create_dt desc
|
||||
</select>
|
||||
|
||||
<select id="getCountByGuid" parameterType="java.lang.String" resultType="java.lang.Integer">
|
||||
|
||||
Reference in New Issue
Block a user