-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
130 additions
and
62 deletions.
There are no files selected for viewing
19 changes: 18 additions & 1 deletion
19
src/main/java/com/kbds/itamserveradmin/domain/asset/controller/AssetController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
package com.kbds.itamserveradmin.domain.asset.controller; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import com.kbds.itamserveradmin.domain.asset.dto.AssetRes; | ||
import com.kbds.itamserveradmin.domain.asset.service.AssetService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/kbitam") | ||
public class AssetController { | ||
|
||
public final AssetService assetService; | ||
|
||
@GetMapping("/{dept}/{cont-id}/info") | ||
public ResponseEntity<AssetRes> info(@PathVariable("cont-id") String contId, @PathVariable String dept){ | ||
AssetRes assetRes = assetService.getInfo(contId); | ||
if (assetRes == null){ | ||
return ResponseEntity.notFound().build(); | ||
} | ||
return ResponseEntity.ok(assetRes); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/com/kbds/itamserveradmin/domain/asset/dto/AssetRes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,38 @@ | ||
package com.kbds.itamserveradmin.domain.asset.dto; | ||
import com.kbds.itamserveradmin.domain.asset.entity.Asset; | ||
import com.kbds.itamserveradmin.domain.asset.entity.AstTag; | ||
import com.kbds.itamserveradmin.domain.corporation.entity.Corporation; | ||
import com.kbds.itamserveradmin.domain.user.entity.User; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class AssetRes { | ||
|
||
private String astId; | ||
private String astName; | ||
private Boolean isAstInternal; | ||
private AstTag astTag; | ||
private Corporation corp; | ||
private User user; | ||
private String astSwCtgy; | ||
private String astPrice; | ||
private String astVer; | ||
private Boolean isAstInstallFile; | ||
private String astSpd; | ||
private String astDpd; | ||
|
||
public static AssetRes assetInfo (Asset asset){ | ||
return AssetRes.builder() | ||
.astId(asset.getAstId()) | ||
.astName(asset.getAstName()) | ||
.astTag(asset.getAstTag()) //자산태그 | ||
.astDpd(asset.getAstDpd()) //상세설명 | ||
.astSpd(asset.getAstSpd()) //간략설명 | ||
.astVer(asset.getAstVer()) | ||
.astPrice(asset.getAstPrice()) | ||
.build(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/com/kbds/itamserveradmin/domain/asset/service/AssetService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
package com.kbds.itamserveradmin.domain.asset.service; | ||
|
||
import com.kbds.itamserveradmin.domain.asset.dto.AssetRes; | ||
import com.kbds.itamserveradmin.domain.asset.entity.Asset; | ||
import com.kbds.itamserveradmin.domain.contract.service.ContractService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class AssetService { | ||
|
||
private final ContractService contractService; | ||
|
||
@Transactional | ||
public AssetRes getInfo(String contId) { | ||
Asset asset = contractService.getAstIdByContId(contId); | ||
if (asset == null) { | ||
return null; | ||
} | ||
return AssetRes.assetInfo(asset); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters