Skip to content

Commit

Permalink
Merge pull request #35 from KBDS-Dreamverse/feat/#31-save
Browse files Browse the repository at this point in the history
Feat/#31 save
  • Loading branch information
oU-Ua authored Feb 8, 2024
2 parents 82e1a07 + e7dfa8b commit fce32c0
Show file tree
Hide file tree
Showing 88 changed files with 1,158 additions and 210 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ out/
### VS Code ###
.vscode/

/src/main/resources/application.yml
/src/main/resources/application.yml
/src/main/resources/db-application.properties
33 changes: 33 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,39 @@ dependencies {
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'



//h2 DB
runtimeOnly 'com.h2database:h2'


runtimeOnly ('mysql:mysql-connector-java') //mysql8
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'

//jasypt 설정파일 암호화 라이브러리
implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.5'



// Security, Authentication
// 시큐리티 추가
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'io.jsonwebtoken:jjwt:0.9.1'

// swagger 문서화
implementation 'io.springfox:springfox-boot-starter:3.0.0'
implementation 'io.springfox:springfox-swagger-ui:3.0.0'



// 이미지 S3 업로드
//implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE'




}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;

@SpringBootApplication
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
public class KbdsItamServerAdminApplication {

public static void main(String[] args) {
Expand Down
27 changes: 25 additions & 2 deletions src/main/java/com/kbds/itamserveradmin/domain/Test.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
package com.kbds.itamserveradmin.domain;

public class Test {
private String test;

import com.kbds.itamserveradmin.global.exception.BaseException;
import com.kbds.itamserveradmin.global.exception.ErrorCode;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
class Test {

@PostMapping("/test")
public ResponseEntity<String> test(){
boolean test = true;
System.out.println("start");

if(test) {
throw new BaseException(ErrorCode.INTERNAL_SERVER_ERROR);
}

return ResponseEntity.ok("success");

}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.kbds.itamserveradmin.domain.asset.controller;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AssetController {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.kbds.itamserveradmin.domain.asset.dto;

import lombok.Data;

@Data
public class AssetReq {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.kbds.itamserveradmin.domain.asset.dto;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class AssetRes {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.kbds.itamserveradmin.domain.asset.entity;

import com.kbds.itamserveradmin.domain.corporation.entity.Corporation;
import com.kbds.itamserveradmin.domain.user.entity.User;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;


import javax.persistence.*;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Asset {

@Id
private String astId;
private String astName;
private Boolean isAstInternal;
private AstTag astTag;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "corp_id" )
private Corporation corp;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
private User user;

private String astSwCtgy;
private String astPrice;
private String astVer;
private Boolean isAstInstallFile;
private String astSpd;
private String astDpd;

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.kbds.itamserveradmin.domain.asset.entity;

import com.kbds.itamserveradmin.domain.contract.entity.Contract;
import com.kbds.itamserveradmin.domain.user.entity.User;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.tomcat.util.http.parser.ContentRange;

import javax.persistence.*;

Expand All @@ -24,11 +24,11 @@ public class AssetNotice {


//==연관관계==//
// @ManyToOne
// @JoinColumn(name = "contract_id")
// private Contract contract;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "contract_id")
private Contract contract;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "writer_id")
private User writer;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.kbds.itamserveradmin.domain.asset.entity;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum AstTag {

DAS("데이타시스템"), BNK("국민은행"), ISR("손해보험"), CRD("국민카드"), STK("증권"), LIF("라이프"),
ASM("자산운용"), CAP("캐피탈"), RET("부동산신탁"), SAV("저축은행"), INV("인베스트먼트");

@JsonValue
private String value;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.*;

@Entity
@Data
Expand All @@ -27,7 +24,7 @@ public class ManualLog {

//==연관관계==//

// @ManyToOne
// @JoinColumn(name = "ast_id")
// private Asset asset;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_id")
private Asset asset;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.kbds.itamserveradmin.domain.asset.repository;

import com.kbds.itamserveradmin.domain.asset.entity.AssetNotice;
import org.springframework.data.jpa.repository.JpaRepository;

public interface AssetNoticeRepository extends JpaRepository<AssetNotice, String> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.kbds.itamserveradmin.domain.asset.repository;

import com.kbds.itamserveradmin.domain.asset.entity.Asset;
import org.springframework.data.jpa.repository.JpaRepository;

public interface AssetRepository extends JpaRepository<Asset, String> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.kbds.itamserveradmin.domain.asset.repository;

import com.kbds.itamserveradmin.domain.asset.entity.ManualLog;
import org.springframework.data.jpa.repository.JpaRepository;

public interface ManualLogRepository extends JpaRepository<ManualLog, String> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.kbds.itamserveradmin.domain.asset.service;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class AssetService {

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.kbds.itamserveradmin.domain.assetRequest.entity;

import com.kbds.itamserveradmin.domain.assetRequest.entity.RequestStatus;
import com.kbds.itamserveradmin.domain.contract.entity.Contract;
import com.kbds.itamserveradmin.domain.user.entity.User;
import com.kbds.itamserveradmin.global.entity.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand Down Expand Up @@ -39,13 +41,13 @@ public class AssetRequest {

//==연관관계==//

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_req_user_id")
private User astRequestUser;

// @ManyToOne
// @JoinColumn(name = "cont_id")
// private Contract contract;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "cont_id")
private Contract contract;

//==연관관계==//

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kbds.itamserveradmin.domain.assetRequest.entity;

import com.kbds.itamserveradmin.domain.user.entity.User;
import com.kbds.itamserveradmin.global.entity.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -22,23 +23,34 @@ public class AssetRequestLog {
@Enumerated(EnumType.STRING)
private RequestStatus astReqLogStatus;

private LocalDateTime astReqSud;

private String astReqVer;

private String astReqName;

private Long astReqCnt;

private LocalDateTime astReqSud;


//==연관관계==//
@ManyToOne

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_req_id")
private AssetRequest assetRequest;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_req_user_id")
private User assetRequestUser;
//==연관관계==//

@PrePersist
public void prePersist() {
LocalDateTime now = LocalDateTime.now();
astReqSud = now;
}

@PreUpdate
public void preUpdate() {
astReqSud = LocalDateTime.now();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kbds.itamserveradmin.domain.assetRequest.entity;

import com.kbds.itamserveradmin.domain.user.entity.AssetAdmin;
import com.kbds.itamserveradmin.global.entity.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -21,25 +22,35 @@ public class AssetRequestManage {
@Id
private String astReqMgId;

private LocalDateTime astReqMgDate;
private LocalDateTime astReqMgSud;

@Enumerated(EnumType.STRING)
private RequestMangeStatus astReqMgStatus;

private LocalDateTime astReqMgDate;
private LocalDateTime astReqMgSud;

private String astReqDept;
private String astReqName;


//==연관관계==//
@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_admin_id")
private AssetAdmin assetAdmin;

@ManyToOne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ast_req_id")
private AssetRequest assetRequest;

@OneToMany(mappedBy = "assetRequestMange")
private List<AssetRequestManageLog> assetRequestManageLogs = new ArrayList<>();
@PrePersist
public void prePersist() {
LocalDateTime now = LocalDateTime.now();
astReqMgDate = now;
astReqMgSud = now;
}

@PreUpdate
public void preUpdate() {
astReqMgSud = LocalDateTime.now();
}

}
Loading

0 comments on commit fce32c0

Please sign in to comment.