251202_01_ENH: User 관련 기능 구현
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.kri.contact.server.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@Schema(description = "데이터 검증에 대한 공용 Dto")
|
||||
public class DataVerificationDto {
|
||||
@Schema(description = "데이터 검증 통과 여부")
|
||||
private boolean success;
|
||||
|
||||
@Schema(description = "검증 필드명")
|
||||
private String fieldName;
|
||||
|
||||
@Schema(description = "검증 메시지(error)")
|
||||
private String errMessage;
|
||||
|
||||
public DataVerificationDto() {
|
||||
this.success = true;
|
||||
this.fieldName = "";
|
||||
this.errMessage = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.kri.contact.server.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class ExcelUploadResponseDto {
|
||||
|
||||
@Schema(description = "전체 읽은 행 수 (헤더 제외)")
|
||||
private int totalCount;
|
||||
|
||||
@Schema(description = "DB에 실제로 insert/update 성공한 개수")
|
||||
private int successCount;
|
||||
|
||||
@Schema(description = "실패(에러) 개수")
|
||||
private int failCount;
|
||||
|
||||
@Schema(description = "에러 엑셀 파일이 있는지 여부")
|
||||
private boolean hasErrorFile;
|
||||
|
||||
@Schema(description = "프론트가 저장용으로 쓸 파일명")
|
||||
private String errorFileName;
|
||||
|
||||
@Schema(description = "에러 엑셀 파일 (xlsx)의 Base64 문자열 (hasErrorFile == true일 때만 세팅)")
|
||||
private String errorFileBase64;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.kri.contact.server.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "사용자 로그인 요청")
|
||||
public class LoginRequestDto {
|
||||
@Schema(description = "사용자 ID")
|
||||
private String userId;
|
||||
|
||||
@Schema(description = "사용자 PW")
|
||||
private String userPw;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.kri.contact.server.dto;
|
||||
|
||||
import com.kri.common.auth.jwt.JwtUserClaimsDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
@Schema(description = "로그인 응답")
|
||||
public class LoginResponseDto {
|
||||
@Schema(description = "jwt access 토큰")
|
||||
private String accessToken;
|
||||
|
||||
@Schema(description = "사용자 정보")
|
||||
private JwtUserClaimsDto user;
|
||||
|
||||
public static LoginResponseDto from(String accessToken, JwtUserClaimsDto jwtUserClaims){
|
||||
return LoginResponseDto.builder()
|
||||
.accessToken(accessToken)
|
||||
.user(jwtUserClaims)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
54
src/main/java/com/kri/contact/server/dto/RoleInfoDto.java
Normal file
54
src/main/java/com/kri/contact/server/dto/RoleInfoDto.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.kri.contact.server.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.kri.contact.server.persistence.entity.TRoleEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@Schema(description = "권한 정보")
|
||||
public class RoleInfoDto {
|
||||
@Schema(description = "권한 코드")
|
||||
private Integer roleCd;
|
||||
|
||||
@Schema(description = "권한 명")
|
||||
private String roleNm;
|
||||
|
||||
@Schema(description = "메모")
|
||||
private String memo;
|
||||
|
||||
@Schema(description = "등록자", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private String regUser;
|
||||
|
||||
@Schema(description = "등록일시", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
@Schema(description = "수정자", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private String modUser;
|
||||
|
||||
@Schema(description = "수정일시", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private LocalDateTime modDt;
|
||||
|
||||
|
||||
public static RoleInfoDto from(TRoleEntity roleEntity){
|
||||
return RoleInfoDto.builder()
|
||||
.roleCd(roleEntity.getRoleCd())
|
||||
.roleNm(roleEntity.getRoleNm())
|
||||
.memo(roleEntity.getMemo())
|
||||
.regUser(roleEntity.getRegUser())
|
||||
.regDt(roleEntity.getRegDt())
|
||||
.modUser(roleEntity.getModUser())
|
||||
.modDt(roleEntity.getModDt())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
84
src/main/java/com/kri/contact/server/dto/UserInfoDto.java
Normal file
84
src/main/java/com/kri/contact/server/dto/UserInfoDto.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package com.kri.contact.server.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.kri.common.datetime.DateTimeUtil;
|
||||
import com.kri.contact.server.dto.excel.UserUploadDto;
|
||||
import com.kri.contact.server.persistence.entity.TUserEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(description = "사용자 정보")
|
||||
public class UserInfoDto {
|
||||
@Schema(description = "사용자 ID")
|
||||
private String userId;
|
||||
|
||||
@Schema(description = "사용자 PW")
|
||||
private String userPw;
|
||||
|
||||
@Schema(description = "사용자 이름")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "사용자 소속 회사")
|
||||
private String userCmpn;
|
||||
|
||||
@Schema(description = "사용자 소속 팀")
|
||||
private String userTeam = "S101";
|
||||
|
||||
@Schema(description = "사용자 권한")
|
||||
private Integer userRole;
|
||||
|
||||
@Schema(description = "메모")
|
||||
private String memo;
|
||||
|
||||
@Schema(description = "등록자", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private String regUser;
|
||||
|
||||
@Schema(description = "등록일시", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
@Schema(description = "수정자", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private String modUser;
|
||||
|
||||
@Schema(description = "수정일시", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private LocalDateTime modDt;
|
||||
|
||||
public static UserInfoDto from(TUserEntity entity){
|
||||
return UserInfoDto.builder()
|
||||
.userId(entity.getUserId())
|
||||
.userName(entity.getUserNm())
|
||||
.userCmpn(entity.getUserCmpn())
|
||||
.userTeam(entity.getUserTeam())
|
||||
.userRole(entity.getUserRole())
|
||||
.memo(entity.getMemo())
|
||||
.regUser(entity.getRegUser())
|
||||
.regDt(entity.getRegDt())
|
||||
.modUser(entity.getModUser())
|
||||
.modDt(entity.getModDt())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static UserInfoDto from(UserUploadDto dto, Integer userRole, String regUser){
|
||||
return UserInfoDto.builder()
|
||||
.userId(dto.getUserId())
|
||||
.userPw(dto.getUserPw())
|
||||
.userName(dto.getUserName())
|
||||
.userCmpn(dto.getUserCmpn())
|
||||
.userTeam("S101")
|
||||
.userRole(userRole)
|
||||
.memo(dto.getMemo())
|
||||
.regUser(regUser)
|
||||
.regDt(DateTimeUtil.nowKstLocalDateTime())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.kri.contact.server.dto.excel;
|
||||
|
||||
import com.kri.common.excel.ExcelColumn;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ExcelErrorDto {
|
||||
|
||||
@ExcelColumn(header = "행 번호", order = 0)
|
||||
private int rowNumber;
|
||||
|
||||
@ExcelColumn(header = "필드명", order = 1)
|
||||
private String fieldName;
|
||||
|
||||
@ExcelColumn(header = "에러 메시지", order = 2)
|
||||
private String errorMessage;
|
||||
|
||||
public static ExcelErrorDto of(int rowNumber, String fieldName, String errorMessage) {
|
||||
ExcelErrorDto dto = new ExcelErrorDto();
|
||||
dto.setRowNumber(rowNumber);
|
||||
dto.setFieldName(fieldName);
|
||||
dto.setErrorMessage(errorMessage);
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.kri.contact.server.dto.excel;
|
||||
|
||||
import com.kri.common.excel.ExcelColumn;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserUploadDto {
|
||||
@ExcelColumn(header = "사용자 ID", order = 0, width = 11)
|
||||
@Schema(description = "사용자 ID")
|
||||
private String userId;
|
||||
|
||||
@ExcelColumn(header = "사용자 PW", order = 1, width = 11)
|
||||
@Schema(description = "사용자 PW")
|
||||
private String userPw;
|
||||
|
||||
@ExcelColumn(header = "사용자 이름", order = 2, width = 11)
|
||||
@Schema(description = "사용자 이름")
|
||||
private String userName;
|
||||
|
||||
@ExcelColumn(header = "사용자 소속 회사", order = 3, width = 16)
|
||||
@Schema(description = "사용자 소속 회사")
|
||||
private String userCmpn;
|
||||
|
||||
@ExcelColumn(header = "사용자 권한", order = 4, width = 11)
|
||||
@Schema(description = "사용자 권한")
|
||||
private String userRoleStr;
|
||||
|
||||
@ExcelColumn(header = "메모", order = 5, width = 20)
|
||||
@Schema(description = "메모")
|
||||
private String memo;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.kri.contact.server.dto.excel;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class UserUploadErrorDto extends ExcelErrorDto {
|
||||
|
||||
public static UserUploadErrorDto of(int rowNumber, String fieldName, String errorMessage) {
|
||||
UserUploadErrorDto dto = new UserUploadErrorDto();
|
||||
dto.setRowNumber(rowNumber);
|
||||
dto.setFieldName(fieldName);
|
||||
dto.setErrorMessage(errorMessage);
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.kri.contact.server.dto.systemlog;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class UploadUserContentDto {
|
||||
String fileName;
|
||||
String fileType;
|
||||
Long fileSize;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.kri.contact.server.dto.systemlog;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class UserIdContentDto {
|
||||
private String userId;
|
||||
}
|
||||
Reference in New Issue
Block a user