251222_01_FIX : 변수명 변경 및 Entity 생성 모두 빌더 타입으로 교체
This commit is contained in:
@@ -38,7 +38,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.kri.common:starter:beta.1.0.53"
|
||||
implementation "com.kri.common:starter:beta.1.0.54"
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||
@@ -50,6 +50,9 @@ dependencies {
|
||||
|
||||
//JPA
|
||||
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
|
||||
//Entity Json <-> Class 파싱용
|
||||
implementation "io.hypersistence:hypersistence-utils-hibernate-62:3.9.4"
|
||||
|
||||
//MySQL
|
||||
runtimeOnly "com.mysql:mysql-connector-j"
|
||||
// QueryDSL JPA
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.kri.contact.server.common.consts;
|
||||
|
||||
public final class AppConstant {
|
||||
private AppConstant(){}
|
||||
public final class ContactConstant {
|
||||
private ContactConstant(){}
|
||||
|
||||
public static final String DEFAULT_COMPANY_NAME = "KRI";
|
||||
|
||||
@@ -3,23 +3,17 @@ package com.kri.contact.server.common.enums;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.kri.common.enums.CodeEnum;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Getter(onMethod_ = @JsonValue) // Lombok이 생성하는 getCode()에 @JsonValue 부착
|
||||
@RequiredArgsConstructor
|
||||
public enum ProjectStatus implements CodeEnum<Short> {
|
||||
STANDBY((short) 0), // 대기
|
||||
PROGRESS((short) 1), // 진행
|
||||
COMPELETE((short) 10); // 완료
|
||||
|
||||
private final short code;
|
||||
|
||||
ProjectStatus(short code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public Short getCode() {
|
||||
return code;
|
||||
}
|
||||
private final Short code;
|
||||
|
||||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
||||
public static ProjectStatus fromCode(Short code) {
|
||||
|
||||
@@ -3,24 +3,18 @@ package com.kri.contact.server.common.enums;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.kri.common.enums.CodeEnum;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Getter(onMethod_ = @JsonValue)
|
||||
@RequiredArgsConstructor
|
||||
public enum ResultCodeType implements CodeEnum<Short> {
|
||||
|
||||
CONTACT((short) 0), // 컨택 결과코드
|
||||
INTERVIEW((short) 1), // 면접 결과코드
|
||||
SURVEY((short) 2); // 설문 결과코드
|
||||
|
||||
private final short code;
|
||||
|
||||
ResultCodeType(short code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public Short getCode() {
|
||||
return code;
|
||||
}
|
||||
private final Short code;
|
||||
|
||||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
||||
public static ResultCodeType fromCode(Short code) {
|
||||
|
||||
@@ -3,24 +3,18 @@ package com.kri.contact.server.common.enums;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.kri.common.enums.CodeEnum;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Getter(onMethod_ = @JsonValue)
|
||||
@RequiredArgsConstructor
|
||||
public enum SurveyType implements CodeEnum<Short> {
|
||||
NONE((short) 0), // 없음
|
||||
KON((short) 1), // KON
|
||||
KIWI((short) 2), // KIWI
|
||||
EXTERNAL((short) 99); // 외부
|
||||
|
||||
private final short code;
|
||||
|
||||
SurveyType(short code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public Short getCode() {
|
||||
return code;
|
||||
}
|
||||
private final Short code;
|
||||
|
||||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
||||
public static SurveyType fromCode(Short code) {
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package com.kri.contact.server.common.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.kri.common.enums.CodeEnum;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
public enum SystemEventType implements CodeEnum<Short> {
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum SystemEventType implements CodeEnum<Short> {
|
||||
LOGIN((short) 11), // 로그인
|
||||
LOGOUT((short) 11), // 로그 아웃
|
||||
|
||||
@@ -20,14 +25,5 @@ public enum SystemEventType implements CodeEnum<Short> {
|
||||
UPDATE_ROLE((short) 42), // 권한 수정
|
||||
DELETE_ROLE((short) 43); // 권한 삭제
|
||||
|
||||
private final short code;
|
||||
|
||||
SystemEventType(short code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Short getCode() {
|
||||
return code;
|
||||
}
|
||||
private final Short code;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.kri.contact.server.controller;
|
||||
|
||||
import com.kri.common.webmvc.RequestUserContext;
|
||||
import com.kri.contact.server.common.consts.AppConstant;
|
||||
import com.kri.contact.server.common.consts.ContactConstant;
|
||||
import com.kri.contact.server.dto.DataVerificationDto;
|
||||
import com.kri.contact.server.dto.ExcelUploadResponseDto;
|
||||
import com.kri.contact.server.dto.UserInfoDto;
|
||||
@@ -40,7 +40,7 @@ public class UserController {
|
||||
@GetMapping()
|
||||
public List<UserInfoDto> getUserList(RequestUserContext ctx){
|
||||
String searchCmpn = ctx.getUserCmpn();
|
||||
if(ctx.getUserRole() < AppConstant.OUTSOURCE_USER_ROLE){
|
||||
if(ctx.getUserRole() < ContactConstant.OUTSOURCE_USER_ROLE){
|
||||
return userService.getUserList();
|
||||
}
|
||||
else{
|
||||
@@ -51,7 +51,7 @@ public class UserController {
|
||||
@GetMapping("fieldwork")
|
||||
public List<UserInfoDto> getFiledoworkUserList(RequestUserContext ctx){
|
||||
String searchCmpn = ctx.getUserCmpn();
|
||||
if(ctx.getUserRole() < AppConstant.OUTSOURCE_USER_ROLE){
|
||||
if(ctx.getUserRole() < ContactConstant.OUTSOURCE_USER_ROLE){
|
||||
searchCmpn = "";
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class UserController {
|
||||
|
||||
@GetMapping("cmpn")
|
||||
public List<String> getUserCmpnList(RequestUserContext ctx){
|
||||
if(ctx.getUserRole() < AppConstant.OUTSOURCE_USER_ROLE){
|
||||
if(ctx.getUserRole() < ContactConstant.OUTSOURCE_USER_ROLE){
|
||||
return userService.getUserCmpnList();
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class UserController {
|
||||
String regId = ctx.getUserId();
|
||||
String clientIp = ctx.getClientIp();
|
||||
//외주사급이 업로드로 계정을 생성하는 경우 자신의 회사명으로 고정
|
||||
String forceCmpn = ctx.getUserRole() < AppConstant.OUTSOURCE_USER_ROLE? "" : ctx.getUserCmpn();
|
||||
String forceCmpn = ctx.getUserRole() < ContactConstant.OUTSOURCE_USER_ROLE? "" : ctx.getUserCmpn();
|
||||
|
||||
ExcelUploadResponseDto result = userService.createUsersFromExcel(file, regId, forceCmpn);
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@ package com.kri.contact.server.dto.excel;
|
||||
import com.kri.common.excel.ExcelColumn;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@SuperBuilder
|
||||
@Getter
|
||||
@Setter
|
||||
public class ExcelErrorDto {
|
||||
@@ -18,10 +20,10 @@ public class ExcelErrorDto {
|
||||
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;
|
||||
return ExcelErrorDto.builder()
|
||||
.rowNumber(rowNumber)
|
||||
.fieldName(fieldName)
|
||||
.errorMessage(errorMessage)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package com.kri.contact.server.dto.excel;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@SuperBuilder
|
||||
@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;
|
||||
return UserUploadErrorDto.builder()
|
||||
.rowNumber(rowNumber)
|
||||
.fieldName(fieldName)
|
||||
.errorMessage(errorMessage)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,21 +30,19 @@ public class TListEntity {
|
||||
|
||||
@Size(max = 32)
|
||||
@NotNull
|
||||
@Column(name = "reg_user", nullable = false, length = 32)
|
||||
@Column(name = "reg_user", nullable = false, length = 32, updatable = false)
|
||||
private String regUser;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("CURRENT_TIMESTAMP")
|
||||
@Column(name = "reg_dt", nullable = false)
|
||||
@Column(name = "reg_dt", nullable = false, updatable = false)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
@Size(max = 32)
|
||||
@NotNull
|
||||
@Column(name = "mod_user", nullable = false, length = 32)
|
||||
@Column(name = "mod_user", length = 32, insertable = false)
|
||||
private String modUser;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "mod_dt", nullable = false)
|
||||
@Column(name = "mod_dt", insertable = false)
|
||||
private LocalDateTime modDt;
|
||||
|
||||
public Long getPrjctIdx(){
|
||||
|
||||
@@ -51,21 +51,19 @@ public class TListHeaderEntity {
|
||||
|
||||
@Size(max = 32)
|
||||
@NotNull
|
||||
@Column(name = "reg_user", nullable = false, length = 32)
|
||||
@Column(name = "reg_user", nullable = false, length = 32, updatable = false)
|
||||
private String regUser;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("CURRENT_TIMESTAMP")
|
||||
@Column(name = "reg_dt", nullable = false)
|
||||
@Column(name = "reg_dt", nullable = false, updatable = false)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
@Size(max = 32)
|
||||
@NotNull
|
||||
@Column(name = "mod_user", nullable = false, length = 32)
|
||||
@Column(name = "mod_user", length = 32, insertable = false)
|
||||
private String modUser;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "mod_dt", nullable = false)
|
||||
@Column(name = "mod_dt", insertable = false)
|
||||
private LocalDateTime modDt;
|
||||
|
||||
public Long getPrjctIdx(){
|
||||
|
||||
@@ -24,21 +24,19 @@ public class TListItemEntity {
|
||||
|
||||
@Size(max = 32)
|
||||
@NotNull
|
||||
@Column(name = "reg_user", nullable = false, length = 32)
|
||||
@Column(name = "reg_user", nullable = false, length = 32, updatable = false)
|
||||
private String regUser;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("CURRENT_TIMESTAMP")
|
||||
@Column(name = "reg_dt", nullable = false)
|
||||
@Column(name = "reg_dt", nullable = false, updatable = false)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
@Size(max = 32)
|
||||
@NotNull
|
||||
@Column(name = "mod_user", nullable = false, length = 32)
|
||||
@Column(name = "mod_user", length = 32, insertable = false)
|
||||
private String modUser;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "mod_dt", nullable = false)
|
||||
@Column(name = "mod_dt", insertable = false)
|
||||
private LocalDateTime modDt;
|
||||
|
||||
public Long getPrjctIdx(){
|
||||
|
||||
@@ -33,21 +33,19 @@ public class TListItemUploadEntity {
|
||||
|
||||
@Size(max = 32)
|
||||
@NotNull
|
||||
@Column(name = "reg_user", nullable = false, length = 32)
|
||||
@Column(name = "reg_user", nullable = false, length = 32, updatable = false)
|
||||
private String regUser;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("CURRENT_TIMESTAMP")
|
||||
@Column(name = "reg_dt", nullable = false)
|
||||
@Column(name = "reg_dt", nullable = false, updatable = false)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
@Size(max = 32)
|
||||
@NotNull
|
||||
@Column(name = "mod_user", nullable = false, length = 32)
|
||||
@Column(name = "mod_user", length = 32, insertable = false)
|
||||
private String modUser;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "mod_dt", nullable = false)
|
||||
@Column(name = "mod_dt", insertable = false)
|
||||
private LocalDateTime modDt;
|
||||
|
||||
public Long getPrjctIdx(){
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.kri.contact.server.persistence.entity;
|
||||
|
||||
import io.hypersistence.utils.hibernate.type.json.JsonType;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.JdbcTypeCode;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
@@ -34,8 +34,8 @@ public class TListResetLogEntity {
|
||||
private Integer listCnt;
|
||||
|
||||
@NotNull
|
||||
@Type(JsonType.class)
|
||||
@Column(name = "sid", nullable = false)
|
||||
@JdbcTypeCode(SqlTypes.JSON)
|
||||
private Map<String, Object> sid;
|
||||
|
||||
@Size(max = 128)
|
||||
|
||||
@@ -6,12 +6,14 @@ import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@@ -31,11 +33,11 @@ public class TPrjctAssignEntity {
|
||||
private LocalDateTime regDt;
|
||||
|
||||
public static TPrjctAssignEntity create(Long prjctIdx, String userId, String regUser, LocalDateTime regDt) {
|
||||
TPrjctAssignEntity e = new TPrjctAssignEntity();
|
||||
e.setId(TPrjctAssignEntityId.create(prjctIdx, userId));
|
||||
e.setRegUser(regUser);
|
||||
e.setRegDt(regDt);
|
||||
return e;
|
||||
return TPrjctAssignEntity.builder()
|
||||
.id(TPrjctAssignEntityId.create(prjctIdx, userId))
|
||||
.regUser(regUser)
|
||||
.regDt(regDt)
|
||||
.build();
|
||||
}
|
||||
|
||||
public Long getPrjctIdx(){
|
||||
|
||||
@@ -4,6 +4,7 @@ import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Embeddable;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.Hibernate;
|
||||
@@ -11,6 +12,7 @@ import org.hibernate.Hibernate;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
@Embeddable
|
||||
@@ -39,9 +41,9 @@ public class TPrjctAssignEntityId implements Serializable {
|
||||
}
|
||||
|
||||
public static TPrjctAssignEntityId create(Long prjctIdx, String userId) {
|
||||
TPrjctAssignEntityId id = new TPrjctAssignEntityId();
|
||||
id.setPrjctIdx(prjctIdx);
|
||||
id.setUserId(userId);
|
||||
return id;
|
||||
return TPrjctAssignEntityId.builder()
|
||||
.prjctIdx(prjctIdx)
|
||||
.userId(userId)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,14 @@ import com.kri.contact.server.dto.ProjectInfoDto;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@@ -83,19 +85,19 @@ public class TPrjctEntity {
|
||||
|
||||
@Size(max = 32)
|
||||
@NotNull
|
||||
@Column(name = "reg_user", nullable = false, length = 32)
|
||||
@Column(name = "reg_user", nullable = false, length = 32, updatable = false)
|
||||
private String regUser;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("CURRENT_TIMESTAMP")
|
||||
@Column(name = "reg_dt", nullable = false)
|
||||
@Column(name = "reg_dt", nullable = false, updatable = false)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
@Size(max = 32)
|
||||
@Column(name = "mod_user", length = 32)
|
||||
@Column(name = "mod_user", length = 32, insertable = false)
|
||||
private String modUser;
|
||||
|
||||
@Column(name = "mod_dt")
|
||||
@Column(name = "mod_dt", insertable = false)
|
||||
private LocalDateTime modDt;
|
||||
|
||||
@NotNull
|
||||
@@ -111,36 +113,34 @@ public class TPrjctEntity {
|
||||
private LocalDateTime delDt;
|
||||
|
||||
public static TPrjctEntity fromDto(ProjectInfoDto dto){
|
||||
TPrjctEntity entity = new TPrjctEntity();
|
||||
entity.setPrjctCd(dto.getPrjctCd());
|
||||
entity.setPrjctStatus(dto.getPrjctStatus().getCode());
|
||||
entity.setPrjctNm(dto.getPrjctName());
|
||||
entity.setItrntPrjctCd(dto.getItrntPrjctCd());
|
||||
entity.setOwnerDept(dto.getOwnerDept());
|
||||
entity.setOwnerFw(dto.getOwnerFw());
|
||||
entity.setSurveyTy(dto.getSurveyTy().getCode());
|
||||
entity.setSurveyPrjctCd(dto.getSurveyPrjctCd());
|
||||
entity.setSurveyUrl(dto.getSurveyUrl());
|
||||
entity.setFf(dto.getFf());
|
||||
entity.setUseContactSenario(dto.getUseContactSenario());
|
||||
entity.setContactSenario(dto.getContactSenario());
|
||||
entity.setRegUser(dto.getRegUser());
|
||||
entity.setRegDt(DateTimeUtil.nowKstLocalDateTime());
|
||||
|
||||
return entity;
|
||||
return TPrjctEntity.builder()
|
||||
.prjctCd(dto.getPrjctCd())
|
||||
.prjctStatus(dto.getPrjctStatus().getCode())
|
||||
.prjctNm(dto.getPrjctName())
|
||||
.itrntPrjctCd(dto.getItrntPrjctCd())
|
||||
.ownerDept(dto.getOwnerDept())
|
||||
.ownerFw(dto.getOwnerFw())
|
||||
.surveyTy(dto.getSurveyTy().getCode())
|
||||
.surveyPrjctCd(dto.getSurveyPrjctCd())
|
||||
.surveyUrl(dto.getSurveyUrl())
|
||||
.ff(dto.getFf())
|
||||
.useContactSenario(dto.getUseContactSenario())
|
||||
.contactSenario(dto.getContactSenario())
|
||||
.regUser(dto.getRegUser())
|
||||
.regDt(DateTimeUtil.nowKstLocalDateTime())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static TPrjctEntity create(ProjectCreateRequestDto req, String prjctCd, String regUser){
|
||||
TPrjctEntity entity = new TPrjctEntity();
|
||||
entity.setPrjctCd(prjctCd);
|
||||
entity.setPrjctNm(req.getPrjctName());
|
||||
entity.setItrntPrjctCd(req.getItrntPrjctCd());
|
||||
entity.setOwnerDept(req.getOwnerDept());
|
||||
entity.setOwnerFw(req.getOwnerFw());
|
||||
entity.setRegUser(regUser);
|
||||
entity.setRegDt(DateTimeUtil.nowKstLocalDateTime());
|
||||
|
||||
return entity;
|
||||
return TPrjctEntity.builder()
|
||||
.prjctCd(prjctCd)
|
||||
.prjctNm(req.getPrjctName())
|
||||
.itrntPrjctCd(req.getItrntPrjctCd())
|
||||
.ownerDept(req.getOwnerDept())
|
||||
.ownerFw(req.getOwnerFw())
|
||||
.regUser(regUser)
|
||||
.regDt(DateTimeUtil.nowKstLocalDateTime())
|
||||
.build();
|
||||
}
|
||||
|
||||
public void updateFrom(ProjectInfoDto dto, String modUser) {
|
||||
|
||||
@@ -9,12 +9,14 @@ import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@@ -55,35 +57,21 @@ public class TResultCodeEntity {
|
||||
Long prjctIdx,
|
||||
String regUser
|
||||
) {
|
||||
TResultCodeEntity e = new TResultCodeEntity();
|
||||
|
||||
TResultCodeEntityId newId = new TResultCodeEntityId();
|
||||
newId.setPrjctIdx(prjctIdx);
|
||||
newId.setResultCdTy(src.getResultCdTy());
|
||||
newId.setResultCd(src.getResultCd());
|
||||
|
||||
e.setId(newId);
|
||||
e.setResultCdLbl(src.getResultCdLbl());
|
||||
e.setRegUser(regUser);
|
||||
e.setRegDt(DateTimeUtil.nowKstLocalDateTime());
|
||||
|
||||
return e;
|
||||
return TResultCodeEntity.builder()
|
||||
.id(TResultCodeEntityId.create(prjctIdx, src.getResultCdTy(), src.getResultCd()))
|
||||
.resultCdLbl(src.getResultCdLbl())
|
||||
.regUser(regUser)
|
||||
.regDt(DateTimeUtil.nowKstLocalDateTime())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static TResultCodeEntity fromDto(Long prjctIdx, ResultCodeType resultCdTy,ResultCodeDto req, String regUser) {
|
||||
TResultCodeEntity entity = new TResultCodeEntity();
|
||||
public static TResultCodeEntity fromDto(Long prjctIdx, ResultCodeType resultCdTy, ResultCodeDto req, String regUser) {
|
||||
return TResultCodeEntity.builder()
|
||||
.id(TResultCodeEntityId.create(prjctIdx, resultCdTy, req.getResultCd()))
|
||||
.resultCdLbl(req.getResultCdLbl())
|
||||
.regUser(regUser)
|
||||
.regDt(DateTimeUtil.nowKstLocalDateTime())
|
||||
.build();
|
||||
|
||||
TResultCodeEntityId id = new TResultCodeEntityId();
|
||||
id.setPrjctIdx(prjctIdx);
|
||||
id.setResultCdTy(resultCdTy);
|
||||
id.setResultCd(req.getResultCd());
|
||||
entity.setId(id);
|
||||
|
||||
entity.setResultCdLbl(req.getResultCdLbl());
|
||||
|
||||
entity.setRegUser(regUser);
|
||||
entity.setRegDt(DateTimeUtil.nowKstLocalDateTime());
|
||||
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
@@ -6,16 +6,18 @@ import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Convert;
|
||||
import jakarta.persistence.Embeddable;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.*;
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
@Embeddable
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TResultCodeEntityId implements Serializable {
|
||||
private static final long serialVersionUID = -1984612223940078355L;
|
||||
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED not null")
|
||||
@@ -45,4 +47,11 @@ public class TResultCodeEntityId implements Serializable {
|
||||
return Objects.hash(prjctIdx, resultCdTy, resultCd);
|
||||
}
|
||||
|
||||
public static TResultCodeEntityId create(Long prjctIdx, ResultCodeType resultCdTy, Short resultCd) {
|
||||
return TResultCodeEntityId.builder()
|
||||
.prjctIdx(prjctIdx)
|
||||
.resultCdTy(resultCdTy)
|
||||
.resultCd(resultCd)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -30,21 +30,19 @@ public class TRoleEntity {
|
||||
|
||||
@Size(max = 32)
|
||||
@NotNull
|
||||
@Column(name = "reg_user", nullable = false, length = 32)
|
||||
@Column(name = "reg_user", nullable = false, length = 32, updatable = false)
|
||||
private String regUser;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("CURRENT_TIMESTAMP")
|
||||
@Column(name = "reg_dt", nullable = false)
|
||||
@Column(name = "reg_dt", nullable = false, updatable = false)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
@Size(max = 32)
|
||||
@NotNull
|
||||
@Column(name = "mod_user", length = 32)
|
||||
@Column(name = "mod_user", length = 32, insertable = false)
|
||||
private String modUser;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "mod_dt")
|
||||
@Column(name = "mod_dt", insertable = false)
|
||||
private LocalDateTime modDt;
|
||||
|
||||
}
|
||||
@@ -1,21 +1,24 @@
|
||||
package com.kri.contact.server.persistence.entity;
|
||||
|
||||
import com.kri.common.datetime.DateTimeUtil;
|
||||
import com.kri.contact.server.common.enums.SystemEventType;
|
||||
import io.hypersistence.utils.hibernate.type.json.JsonType;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.JdbcTypeCode;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@AllArgsConstructor
|
||||
@Table(name = "t_sys_event_log")
|
||||
public class TSysEventLogEntity {
|
||||
@Id
|
||||
@@ -33,8 +36,8 @@ public class TSysEventLogEntity {
|
||||
private String logTitle;
|
||||
|
||||
@NotNull
|
||||
@Type(JsonType.class)
|
||||
@Column(name = "log_content", nullable = false)
|
||||
@JdbcTypeCode(SqlTypes.JSON)
|
||||
private Map<String, Object> logContent;
|
||||
|
||||
@Column(name = "prjct_idx", columnDefinition = "int UNSIGNED")
|
||||
@@ -55,21 +58,22 @@ public class TSysEventLogEntity {
|
||||
@Column(name = "reg_dt", nullable = false)
|
||||
private LocalDateTime regDt;
|
||||
|
||||
@Builder
|
||||
private TSysEventLogEntity(
|
||||
Short eventTy,
|
||||
public static TSysEventLogEntity of(
|
||||
SystemEventType eventTy,
|
||||
String logTitle,
|
||||
Map<String, Object> logContent,
|
||||
Long prjctIdx,
|
||||
String ip,
|
||||
String regUser
|
||||
) {
|
||||
this.eventTy = eventTy;
|
||||
this.logTitle = logTitle;
|
||||
this.logContent = logContent;
|
||||
this.prjctIdx = prjctIdx;
|
||||
this.ip = ip;
|
||||
this.regUser = regUser;
|
||||
this.regDt = DateTimeUtil.nowKstLocalDateTime();
|
||||
return TSysEventLogEntity.builder()
|
||||
.eventTy(eventTy.getCode())
|
||||
.logTitle(logTitle)
|
||||
.logContent(logContent)
|
||||
.prjctIdx(prjctIdx)
|
||||
.ip(ip)
|
||||
.regUser(regUser)
|
||||
.regDt(DateTimeUtil.nowKstLocalDateTime())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,12 @@ import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(name = "t_user")
|
||||
public class TUserEntity {
|
||||
@Id
|
||||
@@ -86,23 +89,21 @@ public class TUserEntity {
|
||||
private LocalDateTime delDt;
|
||||
|
||||
public static TUserEntity fromDto(UserInfoDto dto, String regUser) {
|
||||
TUserEntity entity = new TUserEntity();
|
||||
|
||||
entity.setUserId(dto.getUserId());
|
||||
entity.setUserPw(dto.getUserPw());
|
||||
entity.setUserNm(dto.getUserName());
|
||||
entity.setUserCmpn(dto.getUserCmpn());
|
||||
entity.setUserTeam(
|
||||
dto.getUserTeam() != null && !dto.getUserTeam().isBlank()
|
||||
? dto.getUserTeam()
|
||||
: "S101"// DB 기본값과 맞춰서 디폴트 세팅
|
||||
);
|
||||
entity.setUserRole(dto.getUserRole());
|
||||
entity.setMemo(dto.getMemo() != null ? dto.getMemo() : "");
|
||||
entity.setRegUser(regUser);
|
||||
entity.setRegDt(DateTimeUtil.nowKstLocalDateTime());
|
||||
|
||||
return entity;
|
||||
return TUserEntity.builder()
|
||||
.userId(dto.getUserId())
|
||||
.userPw(dto.getUserPw())
|
||||
.userNm(dto.getUserName())
|
||||
.userCmpn(dto.getUserCmpn())
|
||||
.userTeam(
|
||||
dto.getUserTeam() != null && !dto.getUserTeam().isBlank()
|
||||
? dto.getUserTeam()
|
||||
: "S101" // DB 기본값과 맞춰서 디폴트 세팅
|
||||
)
|
||||
.userRole(dto.getUserRole())
|
||||
.memo(dto.getMemo() != null ? dto.getMemo() : "")
|
||||
.regUser(regUser)
|
||||
.regDt(DateTimeUtil.nowKstLocalDateTime())
|
||||
.build();
|
||||
}
|
||||
|
||||
public void updateFromDto(UserInfoDto dto, String modUser) {
|
||||
|
||||
@@ -56,8 +56,8 @@ public interface UserRepository extends JpaRepository<TUserEntity, Long>, JpaSpe
|
||||
set u.del = true,
|
||||
u.delUser = :delUser,
|
||||
u.delDt = :delDt
|
||||
where u.userId = :userId
|
||||
and u.del = false
|
||||
where u.userId = :userId
|
||||
and u.del = false
|
||||
""")
|
||||
int softDeleteByUserId(String userId, String delUser, LocalDateTime delDt);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.kri.contact.server.service;
|
||||
|
||||
import com.kri.common.datetime.DateTimeUtil;
|
||||
import com.kri.contact.server.common.consts.AppConstant;
|
||||
import com.kri.contact.server.common.consts.ContactConstant;
|
||||
import com.kri.contact.server.persistence.entity.TPrjctAssignEntity;
|
||||
import com.kri.contact.server.persistence.repository.ProjectAssignRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -20,16 +20,16 @@ public class AssignService {
|
||||
public List<String> getPrjctOutsourceAssign(Long prjctIdx){
|
||||
return projectAssignRepository.findAssignUserIdByPrjctIdxAndRoleRange(
|
||||
prjctIdx,
|
||||
AppConstant.OUTSOURCE_USER_ROLE,
|
||||
AppConstant.OUTSOURCE_USER_ROLE + 1000
|
||||
ContactConstant.OUTSOURCE_USER_ROLE,
|
||||
ContactConstant.OUTSOURCE_USER_ROLE + 1000
|
||||
);
|
||||
}
|
||||
|
||||
public List<String> getPrjctFieldworkAssign(Long prjctIdx){
|
||||
return projectAssignRepository.findAssignUserIdByPrjctIdxAndRoleRange(
|
||||
prjctIdx,
|
||||
AppConstant.FIELDWORK_USER_ROLE,
|
||||
AppConstant.FIELDWORK_USER_ROLE + 1000
|
||||
ContactConstant.FIELDWORK_USER_ROLE,
|
||||
ContactConstant.FIELDWORK_USER_ROLE + 1000
|
||||
);
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ public class AssignService {
|
||||
public void upsertPrjctOutsourceAssign(Long prjctIdx, List<String> assignUserIdList, String regUser){
|
||||
projectAssignRepository.deleteAssignByPrjctIdxAndRoleRange(
|
||||
prjctIdx,
|
||||
AppConstant.OUTSOURCE_USER_ROLE,
|
||||
AppConstant.OUTSOURCE_USER_ROLE + 1000
|
||||
ContactConstant.OUTSOURCE_USER_ROLE,
|
||||
ContactConstant.OUTSOURCE_USER_ROLE + 1000
|
||||
);
|
||||
|
||||
insertPrjctAssign(prjctIdx, assignUserIdList, regUser);
|
||||
@@ -48,8 +48,8 @@ public class AssignService {
|
||||
public void upsertPrjctFieldworkAssign(Long prjctIdx, List<String> assignUserIdList, String regUser){
|
||||
projectAssignRepository.deleteAssignByPrjctIdxAndRoleRange(
|
||||
prjctIdx,
|
||||
AppConstant.FIELDWORK_USER_ROLE,
|
||||
AppConstant.FIELDWORK_USER_ROLE + 1000
|
||||
ContactConstant.FIELDWORK_USER_ROLE,
|
||||
ContactConstant.FIELDWORK_USER_ROLE + 1000
|
||||
);
|
||||
|
||||
insertPrjctAssign(prjctIdx, assignUserIdList, regUser);
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.kri.contact.server.service;
|
||||
|
||||
import com.kri.common.datetime.DateTimeUtil;
|
||||
import com.kri.common.web.BusinessException;
|
||||
import com.kri.contact.server.common.consts.AppConstant;
|
||||
import com.kri.contact.server.common.consts.ContactConstant;
|
||||
import com.kri.contact.server.dto.*;
|
||||
import com.kri.contact.server.dto.common.PageResponseDto;
|
||||
import com.kri.contact.server.persistence.entity.TPrjctEntity;
|
||||
@@ -57,8 +57,8 @@ public class ProjectService {
|
||||
ProjectSpecs.keywordLike(keyword)
|
||||
.and(ProjectSpecs.isDelFalse());
|
||||
|
||||
if (userRole >= AppConstant.OUTSOURCE_USER_ROLE) {
|
||||
if (userRole >= AppConstant.FIELDWORK_USER_ROLE) {
|
||||
if (userRole >= ContactConstant.OUTSOURCE_USER_ROLE) {
|
||||
if (userRole >= ContactConstant.FIELDWORK_USER_ROLE) {
|
||||
spec = spec.and(ProjectSpecs.statusIn(STATUS_1));
|
||||
} else {
|
||||
spec = spec.and(ProjectSpecs.statusIn(STATUS_0_1));
|
||||
@@ -83,8 +83,8 @@ public class ProjectService {
|
||||
.and(ProjectSpecs.ownerDeptIn(req.getOwnerDeptList()))
|
||||
.and(ProjectSpecs.ownerFwIn(req.getOwnerFwList()));
|
||||
|
||||
if (userRole >= AppConstant.OUTSOURCE_USER_ROLE) {
|
||||
if (userRole >= AppConstant.FIELDWORK_USER_ROLE) {
|
||||
if (userRole >= ContactConstant.OUTSOURCE_USER_ROLE) {
|
||||
if (userRole >= ContactConstant.FIELDWORK_USER_ROLE) {
|
||||
spec = spec.and(ProjectSpecs.statusIn(STATUS_1));
|
||||
} else {
|
||||
spec = spec.and(ProjectSpecs.statusIn(STATUS_0_1));
|
||||
@@ -115,8 +115,8 @@ public class ProjectService {
|
||||
|
||||
public List<String> getOwnerDeptList(Integer userRole) {
|
||||
final List<Short> statusList =
|
||||
(userRole < AppConstant.OUTSOURCE_USER_ROLE) ? null :
|
||||
(userRole < AppConstant.FIELDWORK_USER_ROLE) ? STATUS_0_1 :
|
||||
(userRole < ContactConstant.OUTSOURCE_USER_ROLE) ? null :
|
||||
(userRole < ContactConstant.FIELDWORK_USER_ROLE) ? STATUS_0_1 :
|
||||
STATUS_1;
|
||||
|
||||
return projectRepository.findDistinctOwnerDept(statusList);
|
||||
@@ -124,8 +124,8 @@ public class ProjectService {
|
||||
|
||||
public List<String> getOwnerFwList(Integer userRole) {
|
||||
final List<Short> statusList =
|
||||
(userRole < AppConstant.OUTSOURCE_USER_ROLE) ? null :
|
||||
(userRole < AppConstant.FIELDWORK_USER_ROLE) ? STATUS_0_1 :
|
||||
(userRole < ContactConstant.OUTSOURCE_USER_ROLE) ? null :
|
||||
(userRole < ContactConstant.FIELDWORK_USER_ROLE) ? STATUS_0_1 :
|
||||
STATUS_1;
|
||||
|
||||
return projectRepository.findDistinctOwnerFw(statusList);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.kri.contact.server.service;
|
||||
|
||||
import com.kri.contact.server.common.consts.AppConstant;
|
||||
import com.kri.contact.server.common.consts.ContactConstant;
|
||||
import com.kri.contact.server.dto.RoleInfoDto;
|
||||
import com.kri.contact.server.persistence.repository.RoleRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -21,9 +21,9 @@ public class RoleService {
|
||||
}
|
||||
|
||||
public List<RoleInfoDto> getRoleList(Integer roleCd){
|
||||
Integer searchRoleCd = roleCd < AppConstant.OUTSOURCE_USER_ROLE ?
|
||||
AppConstant.OUTSOURCE_USER_ROLE :
|
||||
AppConstant.FIELDWORK_USER_ROLE;
|
||||
Integer searchRoleCd = roleCd < ContactConstant.OUTSOURCE_USER_ROLE ?
|
||||
ContactConstant.OUTSOURCE_USER_ROLE :
|
||||
ContactConstant.FIELDWORK_USER_ROLE;
|
||||
|
||||
return roleRepository.findByRoleCdGreaterThanEqual(searchRoleCd).stream()
|
||||
.map(RoleInfoDto::from)
|
||||
|
||||
@@ -134,14 +134,14 @@ public class SystemEventLogService {
|
||||
String clientIp,
|
||||
Map<String, Object> contentMap
|
||||
){
|
||||
TSysEventLogEntity log = TSysEventLogEntity.builder()
|
||||
.eventTy(eventType.getCode())
|
||||
.logTitle(title)
|
||||
.logContent(contentMap)
|
||||
.prjctIdx(prjctIdx)
|
||||
.ip(clientIp)
|
||||
.regUser(regId)
|
||||
.build();
|
||||
TSysEventLogEntity log = TSysEventLogEntity.of(
|
||||
eventType,
|
||||
title,
|
||||
contentMap,
|
||||
prjctIdx,
|
||||
clientIp,
|
||||
regId
|
||||
);
|
||||
|
||||
systemEventLogRepository.save(log);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.kri.contact.server.service;
|
||||
import com.kri.common.datetime.DateTimeUtil;
|
||||
import com.kri.common.excel.ExcelMapper;
|
||||
import com.kri.common.web.BusinessException;
|
||||
import com.kri.contact.server.common.consts.AppConstant;
|
||||
import com.kri.contact.server.common.consts.ContactConstant;
|
||||
import com.kri.contact.server.common.external.intranet.IntranetExtensionApiClient;
|
||||
import com.kri.contact.server.common.util.ExcelUploadResultUtil;
|
||||
import com.kri.contact.server.dto.DataVerificationDto;
|
||||
@@ -164,10 +164,10 @@ public class UserService {
|
||||
public List<UserInfoDto> getFieldworkUserListWithCmpn(String searchCmpn){
|
||||
List<TUserEntity> userList;
|
||||
if(searchCmpn == null || searchCmpn.isBlank()){
|
||||
userList = userRepository.findByUserRoleGreaterThanEqualAndDelFalse(AppConstant.FIELDWORK_USER_ROLE);
|
||||
userList = userRepository.findByUserRoleGreaterThanEqualAndDelFalse(ContactConstant.FIELDWORK_USER_ROLE);
|
||||
}
|
||||
else{
|
||||
userList = userRepository.findByUserCmpnAndUserRoleGreaterThanEqualAndDelFalse(searchCmpn, AppConstant.FIELDWORK_USER_ROLE);
|
||||
userList = userRepository.findByUserCmpnAndUserRoleGreaterThanEqualAndDelFalse(searchCmpn, ContactConstant.FIELDWORK_USER_ROLE);
|
||||
}
|
||||
|
||||
return userList.stream()
|
||||
@@ -177,8 +177,8 @@ public class UserService {
|
||||
|
||||
public List<UserInfoDto> getOutsourceList(){
|
||||
List<TUserEntity> userList = userRepository.findByRoleRangeAndDelFalse(
|
||||
AppConstant.OUTSOURCE_USER_ROLE,
|
||||
AppConstant.OUTSOURCE_USER_ROLE + 1000
|
||||
ContactConstant.OUTSOURCE_USER_ROLE,
|
||||
ContactConstant.OUTSOURCE_USER_ROLE + 1000
|
||||
);
|
||||
|
||||
return userList.stream()
|
||||
|
||||
Reference in New Issue
Block a user