parent
d580800ea1
commit
21a36958ab
|
|
@ -7,6 +7,8 @@ import lombok.RequiredArgsConstructor;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -31,6 +33,7 @@ public class adminController {
|
|||
boardLog.setContentCnt(boardService.selectBoardLogListCnt(boardLog));
|
||||
boardLog.setPaginationInfo();
|
||||
mav.addObject("searchParams", boardLog);
|
||||
mav.addObject("diskInfoList", boardService.getDiskInfoList());
|
||||
return mav;
|
||||
}
|
||||
@GetMapping("/categoryMgt")
|
||||
|
|
|
|||
|
|
@ -11,10 +11,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
|
|
@ -148,7 +145,7 @@ public class BoardService {
|
|||
fileInfo.setOriginalName(originalFilename[0]);
|
||||
fileInfo.setExtention(originalFilename[1]);
|
||||
fileInfo.setConversionName(saveName);
|
||||
fileInfo.setFileSize(calculationFileSize(file.getSize()));
|
||||
fileInfo.setFileSize(calculationSize(file.getSize()));
|
||||
fileInfo.setSavePath(path);
|
||||
fileInfoRepository.save(fileInfo);
|
||||
saveBoardLog(content.getContentSeq(), LogStatus.FILE_ADD, fileInfo.getFullName(), userId);
|
||||
|
|
@ -280,8 +277,8 @@ public class BoardService {
|
|||
File deleteFile = new File(savePath, conversionName);
|
||||
deleteFile.delete();
|
||||
}
|
||||
private String calculationFileSize(Long fileSize){
|
||||
String[] units = {"bytes", "KB", "MB"};
|
||||
private String calculationSize(double fileSize){
|
||||
String[] units = {"bytes", "KB", "MB", "GB", "TB", "PB"};
|
||||
double unitSelector = Math.floor(Math.log(fileSize)/Math.log(1024));
|
||||
return Math.round((fileSize/Math.pow(1024, unitSelector))*100)/100d+" "+units[(int)unitSelector];
|
||||
}
|
||||
|
|
@ -293,4 +290,24 @@ public class BoardService {
|
|||
public Integer selectBoardLogListCnt(BoardLog boardLog) {
|
||||
return boardMapper.selectBoardLogListCnt(boardLog);
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> getDiskInfoList() {
|
||||
/*저장공간 확인*/
|
||||
File[] drives = File.listRoots();
|
||||
List<HashMap<String, Object>> diskInfoList = new ArrayList<>();
|
||||
for(File drive : drives) {
|
||||
double totalSize = drive.getTotalSpace();
|
||||
double useSize = drive.getUsableSpace();
|
||||
double freeSize = totalSize - useSize;
|
||||
|
||||
HashMap<String, Object> diskInfo = new HashMap<>();
|
||||
diskInfo.put("driveName", drive.getAbsolutePath());
|
||||
diskInfo.put("totalSize", calculationSize(totalSize));
|
||||
diskInfo.put("useSize", calculationSize(useSize));
|
||||
diskInfo.put("freeSize", calculationSize(freeSize));
|
||||
diskInfo.put("useSizePer", Math.round(useSize/totalSize*10000)/100d);
|
||||
diskInfoList.add(diskInfo);
|
||||
}
|
||||
return diskInfoList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ spring.thymeleaf.cache=false
|
|||
|
||||
#mariaDB & log4jdbc
|
||||
spring.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
spring.datasource.url=jdbc:log4jdbc:mariadb://cks0504.iptime.org:3306/kcg_fm?characterEncoding=UTF-8&serverTimezone=UTC
|
||||
spring.datasource.url=jdbc:log4jdbc:mariadb://localhost:3306/kcgFileManager?characterEncoding=UTF-8&serverTimezone=UTC
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=mariadb#0524
|
||||
spring.datasource.password=kcg211228
|
||||
|
||||
#jpa
|
||||
spring.jpa.show-sql=true
|
||||
|
|
|
|||
|
|
@ -2,6 +2,26 @@
|
|||
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout/layout}">
|
||||
<th:block layout:fragment="css">
|
||||
<style>
|
||||
.pie-chart {
|
||||
display:inline-block;
|
||||
position:relative;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.pie-chart .centerWhite{
|
||||
position:absolute;
|
||||
width:120px;
|
||||
height: 120px;
|
||||
background :#fff;
|
||||
border-radius: 50%;
|
||||
top: 40px;
|
||||
left: 40px;
|
||||
}
|
||||
</style>
|
||||
</th:block>
|
||||
<div layout:fragment="content" class="pt-3">
|
||||
<main class="pt-3">
|
||||
<h4>관리자 메인 페이지</h4>
|
||||
|
|
@ -11,6 +31,21 @@
|
|||
<div class="row justify-content-start">
|
||||
<div class="col-4">
|
||||
<h5><i class="bi bi-square-fill"></i><span> 저장공간</span></h5>
|
||||
<th:block th:each="diskInfo:${diskInfoList}">
|
||||
<div class="row justify-content-center py-3 border rounded">
|
||||
<div class="col-12"><h5 th:text="${diskInfo.driveName}"></h5></div>
|
||||
<div class="col-auto">
|
||||
<div class="pie-chart" th:style="|background: conic-gradient(#ACACAC 0% ${diskInfo.useSizePer}%, #26A0DA ${diskInfo.useSizePer}% 100%)|">
|
||||
<span class="centerWhite"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto mt-auto">
|
||||
<div>전체 용량: <span th:text="${diskInfo.totalSize}"></span></div>
|
||||
<div><i class="bi bi-square-fill" style="color: #26A0DA"></i> 사용중: <span th:text="${diskInfo.freeSize}"></span></div>
|
||||
<div><i class="bi bi-square-fill" style="color: #ACACAC"></i> 빈 공간: <span th:text="${diskInfo.useSize}"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</th:block>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<h5><i class="bi bi-square-fill"></i><span> 전체 이력</span></h5>
|
||||
|
|
|
|||
Loading…
Reference in New Issue