이용자 제재 해지 사유 추가
This commit is contained in:
@@ -31,6 +31,7 @@ public class BlackList {
|
|||||||
private LocalDateTime startDt;
|
private LocalDateTime startDt;
|
||||||
@JsonProperty("end_dt")
|
@JsonProperty("end_dt")
|
||||||
private LocalDateTime endDt;
|
private LocalDateTime endDt;
|
||||||
|
private String reason;
|
||||||
|
|
||||||
//등록자 이메일 주소
|
//등록자 이메일 주소
|
||||||
@JsonProperty("create_by")
|
@JsonProperty("create_by")
|
||||||
@@ -49,7 +50,8 @@ public class BlackList {
|
|||||||
WAIT,
|
WAIT,
|
||||||
EXPIRATION, // 제재 종료
|
EXPIRATION, // 제재 종료
|
||||||
INPROGRESS, // 제재 중
|
INPROGRESS, // 제재 중
|
||||||
FAIL
|
FAIL,
|
||||||
|
CANCEL
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,16 +10,14 @@ import lombok.*;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class BlackListRequest {
|
public class BlackListRequest {
|
||||||
@Setter
|
private Long id;
|
||||||
private String guid;
|
private String guid;
|
||||||
@Setter
|
|
||||||
private String nickname;
|
private String nickname;
|
||||||
@Setter
|
|
||||||
private BlackList.STATUSTYPE status;
|
private BlackList.STATUSTYPE status;
|
||||||
|
|
||||||
private SANCTIONSTYPE type;
|
private SANCTIONSTYPE type;
|
||||||
@@ -30,7 +28,6 @@ public class BlackListRequest {
|
|||||||
@JsonProperty("end_dt")
|
@JsonProperty("end_dt")
|
||||||
private LocalDateTime endDt;
|
private LocalDateTime endDt;
|
||||||
|
|
||||||
@Setter
|
|
||||||
@JsonProperty("create_by")
|
@JsonProperty("create_by")
|
||||||
private Long createBy;
|
private Long createBy;
|
||||||
|
|
||||||
@@ -38,10 +35,4 @@ public class BlackListRequest {
|
|||||||
@JsonProperty("list")
|
@JsonProperty("list")
|
||||||
private List<BlackList> blackList;
|
private List<BlackList> blackList;
|
||||||
|
|
||||||
public enum POSTTYPE{
|
|
||||||
SINGLE,
|
|
||||||
MULTIPLE
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.ErrorCode;
|
||||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
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.exception.RestApiException;
|
||||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||||
import com.caliverse.admin.global.common.utils.ExcelUtils;
|
import com.caliverse.admin.global.common.utils.ExcelUtils;
|
||||||
|
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -37,10 +39,8 @@ public class BlackListService {
|
|||||||
private static final Logger logger = LoggerFactory.getLogger(BlackListService.class);
|
private static final Logger logger = LoggerFactory.getLogger(BlackListService.class);
|
||||||
private final BlackListMapper blackListMapper;
|
private final BlackListMapper blackListMapper;
|
||||||
private final ExcelUtils excelUtils;
|
private final ExcelUtils excelUtils;
|
||||||
private final HistoryMapper historyMapper;
|
|
||||||
private final HistoryService historyService;
|
|
||||||
private final DynamoDBService dynamoDBService;
|
|
||||||
private final DynamodbUserService dynamodbUserService;
|
private final DynamodbUserService dynamodbUserService;
|
||||||
|
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||||
@Value("${caliverse.file}")
|
@Value("${caliverse.file}")
|
||||||
private String excelPath;
|
private String excelPath;
|
||||||
private final ResourceLoader resourceLoader;
|
private final ResourceLoader resourceLoader;
|
||||||
@@ -158,7 +158,7 @@ public class BlackListService {
|
|||||||
item->{
|
item->{
|
||||||
if(item.getGuid() != null){
|
if(item.getGuid() != null){
|
||||||
String guid = item.getGuid();
|
String guid = item.getGuid();
|
||||||
if(dynamoDBService.isGuidChecked(guid)){
|
if(!dynamodbUserService.isUser(guid)){
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +170,15 @@ public class BlackListService {
|
|||||||
blackListRequest.setNickname(item.getNickname());
|
blackListRequest.setNickname(item.getNickname());
|
||||||
blackListMapper.postBlackList(blackListRequest);
|
blackListMapper.postBlackList(blackListRequest);
|
||||||
logger.info("postBlackList insertBlackList: {}",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){
|
if(cnt > 0){
|
||||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USER_BLOCK_REGIST_DUPLE_WARNING.toString());
|
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());
|
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,6 +204,15 @@ public class BlackListService {
|
|||||||
blackListRequest.setNickname(dynamodbUserService.getGuidByName(item.getGuid()));
|
blackListRequest.setNickname(dynamodbUserService.getGuidByName(item.getGuid()));
|
||||||
blackListMapper.postBlackList(blackListRequest);
|
blackListMapper.postBlackList(blackListRequest);
|
||||||
logger.info("postBlackList insertBlackList: {}",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<>();
|
Map<String,Object> map = new HashMap<>();
|
||||||
blackListRequest.getBlackList().forEach(
|
blackListRequest.getBlackList().forEach(
|
||||||
item->{
|
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);
|
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);
|
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);
|
dynamodbUserService.updateBlockUser(BlackList.STATUSTYPE.EXPIRATION, blackList);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return BlackListResponse.builder()
|
return BlackListResponse.builder()
|
||||||
.resultData(BlackListResponse.ResultData.builder()
|
.resultData(BlackListResponse.ResultData.builder()
|
||||||
.message(SuccessCode.DELETE.getMessage()).build())
|
.message(SuccessCode.DELETE.getMessage()).build())
|
||||||
@@ -255,6 +269,7 @@ public class BlackListService {
|
|||||||
map.put("status", status);
|
map.put("status", status);
|
||||||
|
|
||||||
blackListMapper.updateStatus(map);
|
blackListMapper.updateStatus(map);
|
||||||
|
|
||||||
logger.info("updateBlackListStatus BlackListSchedule status update: {}",map);
|
logger.info("updateBlackListStatus BlackListSchedule status update: {}",map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,11 +26,11 @@
|
|||||||
,a.status
|
,a.status
|
||||||
,a.period
|
,a.period
|
||||||
,a.sanctions
|
,a.sanctions
|
||||||
|
,a.reason
|
||||||
, (SELECT email FROM admin WHERE id = a.create_by ) AS create_by
|
, (SELECT email FROM admin WHERE id = a.create_by ) AS create_by
|
||||||
FROM black_list a
|
FROM black_list a
|
||||||
,(SELECT @row_number:=0) AS t
|
,(SELECT @row_number:=0) AS t
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
AND a.deleted = 0
|
|
||||||
|
|
||||||
<choose>
|
<choose>
|
||||||
<when test="search_type == 'NAME' or search_type == 'name' ">
|
<when test="search_type == 'NAME' or search_type == 'name' ">
|
||||||
@@ -91,11 +91,11 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getTotal" resultType="java.lang.Integer" parameterType="map">
|
<select id="getTotal" resultType="java.lang.Integer" parameterType="map">
|
||||||
SELECT count(*) FROM black_list WHERE deleted = 0
|
SELECT count(*) FROM black_list
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getAllCnt" resultType="java.lang.Integer" parameterType="map">
|
<select id="getAllCnt" resultType="java.lang.Integer" parameterType="map">
|
||||||
SELECT count(*) FROM black_list a WHERE a.deleted = 0
|
SELECT count(*) FROM black_list a WHERE 1=1
|
||||||
<choose>
|
<choose>
|
||||||
<when test="search_type == 'NAME' or search_type == 'name' ">
|
<when test="search_type == 'NAME' or search_type == 'name' ">
|
||||||
<if test="search_key != null and search_key != ''">
|
<if test="search_key != null and search_key != ''">
|
||||||
@@ -148,6 +148,7 @@
|
|||||||
,a.create_dt
|
,a.create_dt
|
||||||
,a.start_dt
|
,a.start_dt
|
||||||
,a.end_dt
|
,a.end_dt
|
||||||
|
,a.reason
|
||||||
, (SELECT email FROM admin WHERE id = a.create_by ) AS create_by
|
, (SELECT email FROM admin WHERE id = a.create_by ) AS create_by
|
||||||
FROM black_list a WHERE a.id = #{id}
|
FROM black_list a WHERE a.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
@@ -165,7 +166,6 @@
|
|||||||
,a.end_dt
|
,a.end_dt
|
||||||
FROM black_list a
|
FROM black_list a
|
||||||
WHERE guid = #{guid}
|
WHERE guid = #{guid}
|
||||||
AND a.deleted = 0
|
|
||||||
ORDER BY a.create_dt desc
|
ORDER BY a.create_dt desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -173,13 +173,16 @@
|
|||||||
SELECT COUNT(*) FROM black_list WHERE guid = #{guid} and STATUS in ('INPROGRESS','WAIT') AND deleted = 0
|
SELECT COUNT(*) FROM black_list WHERE guid = #{guid} and STATUS in ('INPROGRESS','WAIT') AND deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="postBlackList" parameterType="com.caliverse.admin.domain.request.BlackListRequest">
|
<insert id="postBlackList" parameterType="com.caliverse.admin.domain.request.BlackListRequest" useGeneratedKeys="true" keyProperty="id">
|
||||||
INSERT INTO black_list (guid, nickname, status, type, sanctions, period, start_dt, end_dt, create_by, create_dt)
|
INSERT INTO black_list (guid, nickname, status, type, sanctions, period, start_dt, end_dt, create_by, create_dt)
|
||||||
VALUES (#{guid},#{nickname}, #{status}, #{type}, #{sanctions},#{period}, #{startDt}, #{endDt}, #{createBy}, NOW())
|
VALUES (#{guid},#{nickname}, #{status}, #{type}, #{sanctions},#{period}, #{startDt}, #{endDt}, #{createBy}, NOW())
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="deleteBlackList" parameterType="map">
|
<update id="deleteBlackList" parameterType="map">
|
||||||
UPDATE black_list SET deleted = 1 WHERE id = #{id}
|
UPDATE black_list
|
||||||
|
SET status = 'CANCEL',
|
||||||
|
reason = #{reason}
|
||||||
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="getScheduleBlackList" resultMap="BlackListResultMap">
|
<select id="getScheduleBlackList" resultMap="BlackListResultMap">
|
||||||
|
|||||||
Reference in New Issue
Block a user