이용자 제재 해지 사유 추가

This commit is contained in:
2025-05-15 17:52:26 +09:00
parent f537b6d424
commit ed072b94c0
4 changed files with 52 additions and 41 deletions

View File

@@ -12,9 +12,11 @@ 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.constants.MysqlConstants;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.ExcelUtils;
import com.caliverse.admin.history.service.MysqlHistoryLogService;
import lombok.RequiredArgsConstructor;
import org.json.JSONObject;
import org.slf4j.Logger;
@@ -37,10 +39,8 @@ public class BlackListService {
private static final Logger logger = LoggerFactory.getLogger(BlackListService.class);
private final BlackListMapper blackListMapper;
private final ExcelUtils excelUtils;
private final HistoryMapper historyMapper;
private final HistoryService historyService;
private final DynamoDBService dynamoDBService;
private final DynamodbUserService dynamodbUserService;
private final MysqlHistoryLogService mysqlHistoryLogService;
@Value("${caliverse.file}")
private String excelPath;
private final ResourceLoader resourceLoader;
@@ -158,7 +158,7 @@ public class BlackListService {
item->{
if(item.getGuid() != null){
String guid = item.getGuid();
if(dynamoDBService.isGuidChecked(guid)){
if(!dynamodbUserService.isUser(guid)){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
}
@@ -170,6 +170,15 @@ public class BlackListService {
blackListRequest.setNickname(item.getNickname());
blackListMapper.postBlackList(blackListRequest);
logger.info("postBlackList insertBlackList: {}",blackListRequest);
BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId());
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPE.BLACKLIST_ADD,
MysqlConstants.TABLE_NAME_USER_BLOCK,
HISTORYTYPE.BLACKLIST_ADD.name(),
info
);
}
}
);
@@ -183,7 +192,7 @@ public class BlackListService {
if(cnt > 0){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USER_BLOCK_REGIST_DUPLE_WARNING.toString());
}
if(dynamoDBService.isGuidChecked(item.getGuid())){
if(!dynamodbUserService.isUser(item.getGuid())){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
}
@@ -195,6 +204,15 @@ public class BlackListService {
blackListRequest.setNickname(dynamodbUserService.getGuidByName(item.getGuid()));
blackListMapper.postBlackList(blackListRequest);
logger.info("postBlackList insertBlackList: {}",blackListRequest);
BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId());
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPE.BLACKLIST_ADD,
MysqlConstants.TABLE_NAME_USER_BLOCK,
HISTORYTYPE.BLACKLIST_ADD.name(),
info
);
}
}
);
@@ -215,31 +233,27 @@ public class BlackListService {
Map<String,Object> map = new HashMap<>();
blackListRequest.getBlackList().forEach(
item->{
map.put("id",item.getId());
long id = item.getId();
BlackList blackList = blackListMapper.getBlackListDetail(id);
map.put("id",id);
map.put("reason",item.getReason());
blackListMapper.deleteBlackList(map);
//로그 기록
BlackList blackList = blackListMapper.getBlackListDetail(Long.valueOf(item.getId()));
map.put("adminId", CommonUtils.getAdmin().getId());
map.put("name", CommonUtils.getAdmin().getName());
map.put("mail", CommonUtils.getAdmin().getEmail());
map.put("type", HISTORYTYPE.BLACKLIST_DELETE);
JSONObject jsonObject = new JSONObject();
jsonObject.put("guid",blackList.getGuid());
jsonObject.put("name","");
map.put("content",jsonObject.toString());
historyMapper.saveLog(map);
//dynamoDB char# 테이블에 isBlackUser : false 값을 insert
// dynamoDBService.insertUpdateData(blackList.getGuid(),"isBlackUser", false);
logger.info("deleteBlackList delete: {}",map);
if(blackList.getStatus().equals(BlackList.STATUSTYPE.INPROGRESS))
mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPE.BLACKLIST_DELETE,
MysqlConstants.TABLE_NAME_USER_BLOCK,
HISTORYTYPE.BLACKLIST_DELETE.name(),
blackList
);
if(dynamodbUserService.isBlockUser(blackList.getGuid()))
dynamodbUserService.updateBlockUser(BlackList.STATUSTYPE.EXPIRATION, blackList);
}
);
return BlackListResponse.builder()
.resultData(BlackListResponse.ResultData.builder()
.message(SuccessCode.DELETE.getMessage()).build())
@@ -255,6 +269,7 @@ public class BlackListService {
map.put("status", status);
blackListMapper.updateStatus(map);
logger.info("updateBlackListStatus BlackListSchedule status update: {}",map);
}