Skip to content

Commit

Permalink
파일 등록 오류 #3
Browse files Browse the repository at this point in the history
  • Loading branch information
kkforgg@naver.com committed Jun 30, 2019
1 parent 9b42fad commit 3a56666
Show file tree
Hide file tree
Showing 11 changed files with 208 additions and 178 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839


.classpath
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import com.study.myhome.board.service.BoardVO;
import com.study.myhome.common.util.ListObject;
import com.study.myhome.common.util.ListObjectImpl;

import egovframework.com.cmm.LoginVO;
import egovframework.com.cmm.service.EgovFileMngService;
import egovframework.com.cmm.service.EgovFileMngUtil;
import egovframework.com.cmm.service.FileVO;
import egovframework.com.cmm.util.EgovUserDetailsHelper;
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -16,76 +19,76 @@
@Service
public class BoardServiceImpl implements BoardService {

@Autowired
private BoardDAO boardDAO;

@Autowired
private EgovFileMngUtil egovFileMngUtil;

@Autowired
private EgovFileMngService fileMngService;

/**
* 게시판 리스트
*/
public ListObject<BoardVO> selectBoardList(BoardVO boardVO, PaginationInfo paginationInfo) throws Exception {
List<BoardVO> list = boardDAO.selectBoardList(boardVO);
int totalCount = boardDAO.selectBoardListCnt(boardVO);
return new ListObjectImpl<BoardVO>(list, totalCount, paginationInfo);
}

/**
* 게시판 조회
*/
public BoardVO selectBoardArticle(BoardVO boardVO) throws Exception {
boardVO = boardDAO.selectBoardArticle(boardVO);
boardVO.setFiles(fileMngService.selectFileInfs(new FileVO(boardVO.getAtchFileId())));
return boardVO;
}

/**
* 게시글 수정
*/
public void updateBoardArticle(MultipartRequest multipartRequest, BoardVO boardVO) throws Exception {

setFiles(multipartRequest, boardVO);

boardDAO.updateBoardArticle(boardVO);
}

/**
* 파일 저장
*
* @author 정명성
* @create date : 2016. 11. 11.
*/
private void setFiles(MultipartRequest multipartRequest,
BoardVO boardVO) throws Exception {
List<FileVO> files = egovFileMngUtil.parseFileInf(multipartRequest.getFileMap(), "", 0, "", "");

if (files != null && !files.isEmpty()) {
// 파일 처리
fileMngService.insertFileInfs(files);
boardVO.setAtch_file_id(files);
}
}

/**
* 게시글 삭제
*/
public void deleteBoardArticle(BoardVO boardVO) throws Exception {
boardDAO.deleteBoardArticle(boardVO);
}

/**
* 게시글 등록
*/
public void insertBoardArticle(MultipartRequest multipartRequest,
BoardVO boardVO) throws Exception {

setFiles(multipartRequest, boardVO);

// 게시글 등록
boardDAO.insertBoardArticle(boardVO);
}
@Autowired
private BoardDAO boardDAO;

@Autowired
private EgovFileMngUtil egovFileMngUtil;

@Autowired
private EgovFileMngService fileMngService;

/**
* 게시판 리스트
*/
public ListObject<BoardVO> selectBoardList(BoardVO boardVO, PaginationInfo paginationInfo) throws Exception {
List<BoardVO> list = boardDAO.selectBoardList(boardVO);
int totalCount = boardDAO.selectBoardListCnt(boardVO);
return new ListObjectImpl<BoardVO>(list, totalCount, paginationInfo);
}

/**
* 게시판 조회
*/
public BoardVO selectBoardArticle(BoardVO boardVO) throws Exception {
boardVO = boardDAO.selectBoardArticle(boardVO);
boardVO.setFiles(fileMngService.selectFileInfs(new FileVO(boardVO.getAtchFileId())));
return boardVO;
}

/**
* 게시글 수정
*/
public void updateBoardArticle(MultipartRequest multipartRequest, BoardVO boardVO) throws Exception {

setFiles(multipartRequest, boardVO);

boardDAO.updateBoardArticle(boardVO);
}

/**
* 파일 저장
*
* @author 정명성
* @create date : 2016. 11. 11.
*/
private void setFiles(MultipartRequest multipartRequest, BoardVO boardVO) throws Exception {
List<FileVO> files = egovFileMngUtil.parseFileInf(multipartRequest.getFileMap(), "", 0, "", "");

if (files != null && !files.isEmpty()) {
// 파일 처리
fileMngService.insertFileInfs(files);
boardVO.setAtch_file_id(files);
}
}

/**
* 게시글 삭제
*/
public void deleteBoardArticle(BoardVO boardVO) throws Exception {
boardDAO.deleteBoardArticle(boardVO);
}

/**
* 게시글 등록
*/
public void insertBoardArticle(MultipartRequest multipartRequest, BoardVO boardVO) throws Exception {

LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
boardVO.setUsername(loginVO.getName());
setFiles(multipartRequest, boardVO);

// 게시글 등록
boardDAO.insertBoardArticle(boardVO);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.study.myhome.menu.service;

import java.io.Serializable;

import org.apache.ibatis.type.Alias;

@Alias("MenuDetailVO")
public class MenuDetailVO {
public class MenuDetailVO implements Serializable {

private int menuIdx;

Expand Down
164 changes: 83 additions & 81 deletions src/main/java/com/study/myhome/menu/service/MenuVO.java
Original file line number Diff line number Diff line change
@@ -1,90 +1,92 @@
package com.study.myhome.menu.service;

import com.study.myhome.enums.Authority;

import java.io.Serializable;
import java.util.List;
import org.apache.ibatis.type.Alias;

@Alias("MenuVO")
public class MenuVO {

private int menuIdx;

private String menuName;
// 메뉴 상세
private List<MenuDetailVO> menuDetails;

public MenuVO() {

}

public MenuVO(Authority authorityMenu) {
super();
this.menuIdx = authorityMenu.ordinal();
}

public int getMenuIdx() {
return menuIdx;
}

public void setMenuIdx(int menuIdx) {
this.menuIdx = menuIdx;
}

public String getMenuName() {
return menuName;
}

public void setMenuName(String menuName) {
this.menuName = menuName;
}

public List<MenuDetailVO> getMenuDetails() {
return menuDetails;
}

public void setMenuDetails(List<MenuDetailVO> menuDetails) {
this.menuDetails = menuDetails;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((menuDetails == null) ? 0 : menuDetails.hashCode());
result = prime * result + menuIdx;
result = prime * result
+ ((menuName == null) ? 0 : menuName.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
MenuVO other = (MenuVO) obj;
if (menuDetails == null) {
if (other.menuDetails != null) {
return false;
}
} else if (!menuDetails.equals(other.menuDetails)) {
return false;
}
if (menuIdx != other.menuIdx) {
return false;
}
if (menuName == null) {
return other.menuName == null;
} else {
return menuName.equals(other.menuName);
}
}
public class MenuVO implements Serializable {

private static final long serialVersionUID = 875682324620641074L;

private int menuIdx;

private String menuName;
// 메뉴 상세
private List<MenuDetailVO> menuDetails;

public MenuVO() {

}

public MenuVO(Authority authorityMenu) {
super();
this.menuIdx = authorityMenu.ordinal();
}

public int getMenuIdx() {
return menuIdx;
}

public void setMenuIdx(int menuIdx) {
this.menuIdx = menuIdx;
}

public String getMenuName() {
return menuName;
}

public void setMenuName(String menuName) {
this.menuName = menuName;
}

public List<MenuDetailVO> getMenuDetails() {
return menuDetails;
}

public void setMenuDetails(List<MenuDetailVO> menuDetails) {
this.menuDetails = menuDetails;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((menuDetails == null) ? 0 : menuDetails.hashCode());
result = prime * result + menuIdx;
result = prime * result + ((menuName == null) ? 0 : menuName.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
MenuVO other = (MenuVO) obj;
if (menuDetails == null) {
if (other.menuDetails != null) {
return false;
}
} else if (!menuDetails.equals(other.menuDetails)) {
return false;
}
if (menuIdx != other.menuIdx) {
return false;
}
if (menuName == null) {
return other.menuName == null;
} else {
return menuName.equals(other.menuName);
}
}

}
12 changes: 10 additions & 2 deletions src/main/java/com/study/myhome/user/service/UserAuthorityVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@

import com.study.myhome.enums.Authority;
import com.study.myhome.menu.service.MenuVO;

import java.io.Serializable;

import javax.validation.constraints.NotNull;
import org.apache.ibatis.type.Alias;

@Alias("UserAuthorityVO")
public class UserAuthorityVO {
public class UserAuthorityVO implements Serializable {

/**
*
*/
private static final long serialVersionUID = -496000620423956080L;

@NotNull
@NotNull
private String username;

private Authority authority = Authority.MEMBER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ public List<FileVO> parseFileInf(Map<String, MultipartFile> files, String KeyStr
String atchFileIdString = "";

if ("".equals(storePath) || storePath == null) {
storePathString = propertyService.getString("Globals.fileStorePath");
// storePathString = propertyService.getString("Globals.fileStorePath");
storePathString = "/Users/jms/backup";
System.out.println("fileStorePath : " + propertyService.getString("Globals.fileStorePath"));
} else {
storePathString = propertyService.getString(storePath);

Expand Down
Loading

0 comments on commit 3a56666

Please sign in to comment.