공지사항 신규 개발

This commit is contained in:
kimjhjjang
2022-11-01 13:23:58 +09:00
parent c916d16a46
commit d1d62c76c8
57 changed files with 3721 additions and 319 deletions

View File

@@ -0,0 +1,177 @@
package kr.co.uplus.ez.api.homeMgt;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import java.io.File;
import java.io.IOException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.LinkedHashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ContentDisposition;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import kr.co.uplus.ez.api.homeMgt.dto.*;
import kr.co.uplus.ez.common.components.ValidComponents;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import kr.co.uplus.ez.common.utils.FileIoUtils;
@RestController
@RequestMapping(value ="api/v1/bo/homeMgt")
public class HomeMgtController {
private static final Logger logger = LoggerFactory.getLogger(HomeMgtController.class);
@Autowired
HomeMgtService homeService;
@Autowired
ValidComponents validComponents;
/**
* date : 2022. 10. 18.
* auth : kjh
* desc : 공지사항 조회.
* @param noticeListReqDto
* @return NoticeListResDto
*/
@ApiOperation(value = "noticeList", notes = "공지사항 조회")
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
@RequestMapping(value = "noticeList", method = {RequestMethod.POST})
@ResponseBody
public NoticeListResDto noticeList(@RequestBody @Valid NoticeListReqDto noticeListReqDto, BindingResult bindingResult, HttpServletResponse response) {
if (validComponents.validParameter(bindingResult)) {
return new NoticeListResDto(ApiResponseCode.CM_PARAMETER_ERROR);
}
return homeService.noticeList(noticeListReqDto);
}
/**
* date : 2022. 10. 21.
* auth : kjh
* desc : 공지사항 등록.
* @param insertNoticeReqDto
* @return InsertNoticeResDto
*/
@ApiOperation(value = "insertNotice", notes = "공지사항 등록")
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
@RequestMapping(value = "insertNotice", method = {RequestMethod.POST})
@ResponseBody
public InsertNoticeResDto insertNotice(@RequestPart(value = "key") InsertNoticeReqDto insertNoticeReqDto,
MultipartHttpServletRequest multipartRequest) {
return homeService.insertNotice(insertNoticeReqDto ,multipartRequest);
}
/**
* date : 2022. 10. 24.
* auth : kjh
* desc : 공지사항 수정.
* @param updateNoticeReqDto
* @return UpdateNoticeResDto
*/
@ApiOperation(value = "updateNotice", notes = "공지사항 수정")
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
@RequestMapping(value = "updateNotice", method = {RequestMethod.POST})
@ResponseBody
public UpdateNoticeResDto updateNotice(@RequestPart(value = "key") UpdateNoticeReqDto updateNoticeReqDto,
MultipartHttpServletRequest multipartRequest) {
return homeService.updateNotice(updateNoticeReqDto, multipartRequest);
}
/**
* date : 2022. 10. 24.
* auth : kjh
* desc : 공지사항 editor 이미지 업로드 후 링크 리턴.
* @param updateNoticeReqDto
* @return UpdateNoticeResDto
*/
@ApiOperation(value = "getImageUrl", notes = "공지사항 editor 이미지 업로드 후 링크 리턴")
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
@RequestMapping(value = "getImageUrl", method = {RequestMethod.POST})
@ResponseBody
public FileResDto fileResDto(MultipartHttpServletRequest multipartRequest) {
return homeService.fileResDto(multipartRequest);
}
/**
* 파일 다운로드
* @throws IOException
*/
@SuppressWarnings("rawtypes")
@RequestMapping("filedownload")
public void filedownload(@RequestBody LinkedHashMap param, HttpServletRequest request, HttpServletResponse response) throws IOException {
logger.debug(param.toString());
File file = new File(param.get("filePath") + File.separator + param.get("fileNm"));
System.out.println("file ::::: " +file);
System.out.println("file.exists() ::::: " + file.exists());
if (file.exists()) {
FileIoUtils.fileDownload(file, request, response );
}
}
@ApiOperation(value = "이미지 미리보기", notes = "이미지 미리보기")
@GetMapping(value = "/preview/{imgurl}", produces=MediaType.APPLICATION_OCTET_STREAM_VALUE)
public ResponseEntity<byte[]> previewImageResource(@PathVariable @ApiParam(value = "이미지 경로") String imgurl) {
System.out.println("imgurl :::: " + imgurl);
System.out.println("call previewImageResource");
try {
String imgurldec = URLDecoder.decode(imgurl);
String imgurlreplace = imgurldec.replaceAll("\\|", "/");
logger.debug("preview image imgurl={} imgurldecode={} imgurlreplace={}", imgurl, imgurldec, imgurlreplace);
Path path = Paths.get(imgurlreplace);
String contentType = Files.probeContentType(path);
String fileNameOnly = imgurlreplace;
String[] fileNameArr = imgurlreplace.split("/");
if(fileNameArr != null && fileNameArr.length != 0) fileNameOnly = fileNameArr[fileNameArr.length-1];
HttpHeaders headers = new HttpHeaders();
headers.setContentDisposition(
ContentDisposition.builder("attachment")
.filename(fileNameOnly, StandardCharsets.UTF_8)
.build());
headers.add(HttpHeaders.CONTENT_TYPE, contentType);
byte[] b = Files.readAllBytes(path);
return new ResponseEntity<byte[]>(b, headers, HttpStatus.OK);
}catch(Exception e) {
logger.error("imgurl err, e={}, e", e.getMessage());
return new ResponseEntity<byte[]>(HttpStatus.NOT_FOUND);
}
}
}

View File

@@ -0,0 +1,29 @@
package kr.co.uplus.ez.api.homeMgt;
import kr.co.uplus.ez.api.homeMgt.dto.*;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface HomeMgtMapper {
int selectNoticeTotalCnt(NoticeListReqDto noticeListReqDto);
List<NoticeDto> selectNoticeList(NoticeListReqDto noticeListReqDto);
int selectNoticeNumber(NoticeListReqDto noticeListReqDto);
void insertNotice(InsertNoticeReqDto insertNoticeReqDto);
int insertNoticeNtNo();
int updateNotice(UpdateNoticeReqDto updateNoticeReqDto);
int updateNoticeFileMaxNum(UpdateNoticeReqDto updateNoticeReqDto);
void insertNoticeFile(InsertNoticeFileDto insertNoticeFileDto);
void delNoticeFile(DelNoticeReqDto delNoticeReqDto);
}

View File

@@ -0,0 +1,286 @@
package kr.co.uplus.ez.api.homeMgt;
import kr.co.uplus.ez.api.homeMgt.dto.*;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import kr.co.uplus.ez.common.data.Paging;
import kr.co.uplus.ez.common.utils.DateUtils;
import kr.co.uplus.ez.common.utils.FileIoUtils;
import kr.co.uplus.ez.common.utils.FileUtil;
//import kr.co.uplus.ez.common.utils.EncryptionUtil;
//import org.apache.commons.lang3.StringUtils;
import org.mybatis.spring.SqlSessionTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.io.File;
import java.util.ArrayList;
//import java.util.HashMap;
import java.util.List;
//import java.util.Map;
@Service
public class HomeMgtService {
private static final Logger logger = LoggerFactory.getLogger(HomeMgtService.class);
@Autowired
@Qualifier("sqlSessionTemplateDb1")
private SqlSessionTemplate sqlSessionMaster;
@Autowired
@Qualifier("sqlSessionTemplateDb2")
private SqlSessionTemplate sqlSessionSlave;
@Value("${file-resource.info.notice.path:/efs/admin/notice/}")
private String noticeFilePath;
/**
* date : 2022. 10. 18.
* auth : kjh
* desc : 공지사항 목록 조회
* @param noticeListReqDto
* @return NoticeListResDto
*/
public NoticeListResDto noticeList(NoticeListReqDto noticeListReqDto) {
HomeMgtMapper homeMgtMapper = sqlSessionSlave.getMapper(HomeMgtMapper.class);
String nowPage = String.valueOf(noticeListReqDto.getPage());
int totalCnt = homeMgtMapper.selectNoticeTotalCnt(noticeListReqDto);
if(totalCnt == 0) {
Paging paging = new Paging();
paging.setPage(nowPage);
paging.setTotalCnt(String.valueOf(totalCnt));
NoticeListRes NoticeListRes = new NoticeListRes();
NoticeListRes.setList(new ArrayList<>());
NoticeListRes.setPaging(paging);
return new NoticeListResDto(ApiResponseCode.CM_NOT_FOUND, NoticeListRes);
}
int page = noticeListReqDto.getPage();
int pagePerRows = noticeListReqDto.getPagePerRows();
page = (page -1) * pagePerRows;
noticeListReqDto.setPage(page);
List<NoticeDto> noticeDto = homeMgtMapper.selectNoticeList(noticeListReqDto);
Paging paging = new Paging();
paging.setPage(nowPage);
paging.setTotalCnt(String.valueOf(totalCnt));
NoticeListRes NoticeListRes = new NoticeListRes();
NoticeListRes.setList(noticeDto);
NoticeListRes.setPaging(paging);
return new NoticeListResDto(ApiResponseCode.SUCCESS, NoticeListRes);
}
/**
* date : 2022. 10. 21.
* auth : kjh
* desc : 공지사항 목록 등록
* @param insertNoticeReqDto
* @return InsertNoticeResDto
*/
public InsertNoticeResDto insertNotice(InsertNoticeReqDto insertNoticeReqDto, MultipartHttpServletRequest multipartRequest) {
HomeMgtMapper homeMgtMapper = sqlSessionSlave.getMapper(HomeMgtMapper.class);
List<MultipartFile> files = multipartRequest.getFiles("files");
String yyyyMMddHHmmss = DateUtils.date2strYMDHMS();
int NT_NO = 0;
//공지사항 등록
try {
homeMgtMapper.insertNotice(insertNoticeReqDto);
NT_NO = homeMgtMapper.insertNoticeNtNo();
}catch(Exception e){
return new InsertNoticeResDto(ApiResponseCode.CM_DB_QUERY_ERR);
}
//공지사항 등록 완료시 파일 저장
int idx = 1;
String yyyyMMdd = DateUtils.date2strYMD();
// Path : efs/admin/notice/yyyy/mm/
String path = noticeFilePath + yyyyMMdd.substring(0, 4) +
File.separator + yyyyMMdd.substring(4, 6) +
File.separator + yyyyMMdd.substring(6, 8);
File dir = new File(path);
if(!dir.isDirectory()) {
dir.mkdirs();
}
try {
for(int i=0; i<files.size(); i++){
// NOTICE FILE UPLOAD.
String ext = FileIoUtils.getExtension(files.get(i).getOriginalFilename());
// File Nm : [reg_req_no]_[doc_no]_[doc_tp_cd].확장자
String fileNm = yyyyMMddHHmmss + "_noticeFile_" + idx +"." + ext;
String titleNm = files.get(i).getOriginalFilename();
long fileSize = files.get(i).getSize();
// File Upload.
FileUtil.upload(files.get(i), fileNm, path);
InsertNoticeFileDto insertNoticeFileDto = new InsertNoticeFileDto();
insertNoticeFileDto.setBbsDivCd("02"); // 게시판 구분 코드 (01:일대일문의,02:공지사항,03:FAQ)
insertNoticeFileDto.setBbsNo(NT_NO);
insertNoticeFileDto.setFileNo(idx);
insertNoticeFileDto.setFileTitle(titleNm);
insertNoticeFileDto.setFileNm(fileNm);
insertNoticeFileDto.setFileSize(fileSize);
insertNoticeFileDto.setFilePath(path.replace("C:/Users/admin/git/hubez-admin/frontend/public", ""));
insertNoticeFileDto.setRegId(insertNoticeReqDto.getRegId());
insertNoticeFileDto.setChgId(insertNoticeReqDto.getRegId());
System.out.println("insertNoticeFileDto.getFilePath() :::: " + insertNoticeFileDto.getFilePath());
homeMgtMapper.insertNoticeFile(insertNoticeFileDto);
idx++;
}
}catch(Exception e) {
return new InsertNoticeResDto(ApiResponseCode.CM_DB_QUERY_ERR);
}
return new InsertNoticeResDto(ApiResponseCode.SUCCESS);
}
/**
* date : 2022. 10. 24.
* auth : kjh
* desc : 공지사항 목록 수정
* @param updateNoticeReqDto
* @return UpdateNoticeResDto
*/
public UpdateNoticeResDto updateNotice(UpdateNoticeReqDto updateNoticeReqDto, MultipartHttpServletRequest multipartRequest) {
HomeMgtMapper homeMgtMapper = sqlSessionMaster.getMapper(HomeMgtMapper.class);
List<MultipartFile> files = multipartRequest.getFiles("files");
String yyyyMMddHHmmss = DateUtils.date2strYMDHMS();
System.out.println(" files len :::: " + files.size());
System.out.println(" legacyFiles :::: " + updateNoticeReqDto.getLegacyFiles());
// 공지사항 수정
try {
homeMgtMapper.updateNotice(updateNoticeReqDto);
} catch (Exception e) {
return new UpdateNoticeResDto(ApiResponseCode.CM_DB_QUERY_ERR);
}
// 공지사항 수정 완료시 파일 저장
int idx = homeMgtMapper.updateNoticeFileMaxNum(updateNoticeReqDto); // 해당 게시물의 최상위 파일 번호 + 1을 가져온다.
String yyyyMMdd = DateUtils.date2strYMD(); // Path : efs/admin/notice/yyyy/mm/
String path = noticeFilePath + yyyyMMdd.substring(0, 4) +
File.separator + yyyyMMdd.substring(4, 6) +
File.separator + yyyyMMdd.substring(6, 8);
File dir = new File(path);
if(!dir.isDirectory()) dir.mkdirs(); // dir 생성
try {
for(int i=0; i<files.size(); i++){
// NOTICE FILE UPLOAD.
String ext = FileIoUtils.getExtension(files.get(i).getOriginalFilename());
// File Nm : [reg_req_no]_[doc_no]_[doc_tp_cd].확장자
String fileNm = yyyyMMddHHmmss + "_noticeFile_" + idx +"." + ext;
String titleNm = files.get(i).getOriginalFilename();
long fileSize = files.get(i).getSize();
// File Upload.
FileUtil.upload(files.get(i), fileNm, path);
InsertNoticeFileDto insertNoticeFileDto = new InsertNoticeFileDto();
insertNoticeFileDto.setBbsDivCd("02"); // 게시판 구분 코드 (01:일대일문의,02:공지사항,03:FAQ)
insertNoticeFileDto.setBbsNo(updateNoticeReqDto.getNtNo());
insertNoticeFileDto.setFileNo(idx);
insertNoticeFileDto.setFileTitle(titleNm);
insertNoticeFileDto.setFileNm(fileNm);
insertNoticeFileDto.setFileSize(fileSize);
insertNoticeFileDto.setFilePath(path.replace("C:/Users/admin/git/hubez-admin/frontend/public", ""));
insertNoticeFileDto.setRegId(updateNoticeReqDto.getChgId());
insertNoticeFileDto.setChgId(updateNoticeReqDto.getChgId());
homeMgtMapper.insertNoticeFile(insertNoticeFileDto);
idx++;
}
}catch(Exception e) {
return new UpdateNoticeResDto(ApiResponseCode.CM_DB_QUERY_ERR);
}
// 첨부파일 삭제
if(!updateNoticeReqDto.getDelFileNo().isEmpty()) {
String[] delFile = updateNoticeReqDto.getDelFileNo().split(",");
for(int j=0; j<delFile.length; j++){
System.out.println("delFile :::: " + delFile[j]);
DelNoticeReqDto delNoticeReqDto = new DelNoticeReqDto();
delNoticeReqDto.setFileNo(Integer.parseInt(delFile[j]));
delNoticeReqDto.setNtNo(updateNoticeReqDto.getNtNo());
System.out.println(delNoticeReqDto);
homeMgtMapper.delNoticeFile(delNoticeReqDto);
}
}else {
System.out.println("파일이 빈 상태입니다.");
}
return new UpdateNoticeResDto(ApiResponseCode.SUCCESS);
}
/**
* date : 2022. 10. 21.
* auth : kjh
* desc : 공지사항 editor 이미지 등록시 URL 리턴
* @param insertNoticeFileDto
* @return FileResDto
*/
public FileResDto fileResDto(MultipartHttpServletRequest multipartRequest) {
HomeMgtMapper homeMgtMapper = sqlSessionSlave.getMapper(HomeMgtMapper.class);
List<MultipartFile> files = multipartRequest.getFiles("files");
System.out.println(" files len :::: " + files.size());
String yyyyMMddHHmmss = DateUtils.date2strYMDHMS();
String yyyyMMdd = DateUtils.date2strYMD(); // Path : efs/admin/notice/yyyy/mm/
String path = noticeFilePath + yyyyMMdd.substring(0, 4) +
File.separator + yyyyMMdd.substring(4, 6) +
File.separator + yyyyMMdd.substring(6, 8);
File dir = new File(path);
String uploadFile = "";
if(!dir.isDirectory()) dir.mkdirs(); // dir 생성
try {
for(int i=0; i<files.size(); i++){
String ext = FileIoUtils.getExtension(files.get(i).getOriginalFilename());
String fileNm = yyyyMMddHHmmss + "_noticeEditFile." + ext;
// File Upload.
FileUtil.upload(files.get(i), fileNm, path);
path = path.replace("C:/Users/admin/git/hubez-admin/frontend/public", "");
uploadFile = path.replace("\\","/") + File.separator + fileNm;
}
}catch(Exception e) {
return new FileResDto(ApiResponseCode.CM_DB_QUERY_ERR);
}
return new FileResDto(ApiResponseCode.SUCCESS, uploadFile);
}
}

View File

@@ -0,0 +1,18 @@
package kr.co.uplus.ez.api.homeMgt.dto;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class DelNoticeReqDto implements Serializable{
@ApiModelProperty(example = "공지사항 번호", name = "공지사항 번호", dataType = "Int")
private int ntNo;
@ApiModelProperty(example = "파일 번호", name = "파일 번호", dataType = "Int")
private int fileNo;
}

View File

@@ -0,0 +1,31 @@
package kr.co.uplus.ez.api.homeMgt.dto;
import java.io.Serializable;
import java.util.List;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import kr.co.uplus.ez.common.data.ResponseMessage;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class FileResDto extends ResponseMessage implements Serializable {
// 데이터.
private Object data;
public FileResDto() {
this.retCode = ApiResponseCode.SUCCESS.getResultCode();
this.retMsg = ApiResponseCode.SUCCESS.getResultMsg();
}
public FileResDto(ApiResponseCode returnStr) {
this.retCode = returnStr.getResultCode();
this.retMsg = returnStr.getResultMsg();
}
public FileResDto(ApiResponseCode returnStr, Object data) {
this.retCode = returnStr.getResultCode();
this.retMsg = returnStr.getResultMsg();
this.data = data;
}
}

View File

@@ -0,0 +1,39 @@
package kr.co.uplus.ez.api.homeMgt.dto;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class InsertNoticeFileDto implements Serializable {
@ApiModelProperty(example = "게시판 구분코드", name = "게시판 구분코드", dataType = "String")
private String bbsDivCd;
@ApiModelProperty(example = "게시판 식별번호", name = "게시판 식별번호", dataType = "Int")
private int bbsNo;
@ApiModelProperty(example = "파일 번호", name = "파일 번호", dataType = "Int")
private int fileNo;
@ApiModelProperty(example = "파일 제목", name = "파일 제목", dataType = "String")
private String fileTitle;
@ApiModelProperty(example = "파일 명", name = "파일 명", dataType = "String")
private String fileNm;
@ApiModelProperty(example = "파일 명", name = "파일 명", dataType = "Long")
private Long fileSize;
@ApiModelProperty(example = "파일 경로", name = "파일 경로", dataType = "String")
private String filePath;
@ApiModelProperty(example = "등록 ID", name = "등록 ID", dataType = "String")
private String regId;
@ApiModelProperty(example = "수정 ID", name = "수정 ID", dataType = "String")
private String chgId;
}

View File

@@ -0,0 +1,36 @@
package kr.co.uplus.ez.api.homeMgt.dto;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class InsertNoticeReqDto implements Serializable {
@ApiModelProperty(example = "분류 코드", name = "분류 코드", dataType = "String")
private String ctgCd;
@ApiModelProperty(example = "긴급 여부", name = "긴급 여부", dataType = "String")
private String emgYn;
@ApiModelProperty(example = "제목", name = "제목", dataType = "String")
private String title;
@ApiModelProperty(example = "공지 내용", name = "공지 내용", dataType = "String")
private String ntSbst;
@ApiModelProperty(example = "등록자", name = "등록자", dataType = "String")
private String regr;
@ApiModelProperty(example = "사용 여부", name = "사용 여부", dataType = "String")
private String useYn;
@ApiModelProperty(example = "등록 ID", name = "등록 ID", dataType = "String")
private String regId;
@ApiModelProperty(example = "변경 ID", name = "변경 ID", dataType = "String")
private String chgId;
}

View File

@@ -0,0 +1,31 @@
package kr.co.uplus.ez.api.homeMgt.dto;
import java.io.Serializable;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import kr.co.uplus.ez.common.data.ResponseMessage;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class InsertNoticeResDto extends ResponseMessage implements Serializable{
// 데이터.
private Object data;
public InsertNoticeResDto() {
this.retCode = ApiResponseCode.SUCCESS.getResultCode();
this.retMsg = ApiResponseCode.SUCCESS.getResultMsg();
}
public InsertNoticeResDto(ApiResponseCode returnStr) {
this.retCode = returnStr.getResultCode();
this.retMsg = returnStr.getResultMsg();
}
public InsertNoticeResDto(ApiResponseCode returnStr, Object data) {
this.retCode = returnStr.getResultCode();
this.retMsg = returnStr.getResultMsg();
this.data = data;
}
}

View File

@@ -0,0 +1,82 @@
package kr.co.uplus.ez.api.homeMgt.dto;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class NoticeDto implements Serializable {
@ApiModelProperty(example = "리스트 번호", name = "리스트 번호", dataType = "Integer")
private Integer no;
@ApiModelProperty(example = "공지 번호", name = "공지 번호", dataType = "int")
private int ntNo;
@ApiModelProperty(example = "분류코드", name = "분류코드", dataType = "String")
private String ctgCd;
@ApiModelProperty(example = "분류코드명", name = "분류코드명", dataType = "String")
private String ctgCdNm;
@ApiModelProperty(example = "긴급여부(Y/N)", name = "긴급여부(Y/N)", dataType = "String")
private String emgYn;
@ApiModelProperty(example = "제목", name = "제목", dataType = "String")
private String title;
@ApiModelProperty(example = "공지 내용", name = "공지 내용", dataType = "String")
private String ntSbst;
@ApiModelProperty(example = "등록자", name = "등록자", dataType = "String")
private String regr;
@ApiModelProperty(example = "사용 여부", name = "사용 여부", dataType = "String")
private String useYn;
@ApiModelProperty(example = "조회수", name = "조회수", dataType = "Int")
private String retvCnt;
@ApiModelProperty(example = "등록 ID", name = "등록 ID", dataType = "String")
private String regId;
@ApiModelProperty(example = "등록 일시", name = "등록 일시", dataType = "String")
private String regDt;
@ApiModelProperty(example = "변경 ID", name = "변경 ID", dataType = "String")
private String chgId;
@ApiModelProperty(example = "변경 일시", name = "변경 일시", dataType = "String")
private String chgDt;
@ApiModelProperty(example = "파일 제목", name = "파일 제목", dataType = "String")
private String fileTitle;
@ApiModelProperty(example = "파일 이름", name = "파일 이름", dataType = "String")
private String fileNm;
@ApiModelProperty(example = "파일 경로", name = "파일 경로", dataType = "String")
private String filePath;
@ApiModelProperty(example = "파일 개수", name = "파일 개수", dataType = "String")
private String fileCount;
@ApiModelProperty(example = "파일 유무", name = "파일 유무", dataType = "String")
private String fileYn;
@ApiModelProperty(example = "파일 번호", name = "파일 번호", dataType = "String")
private String fileNo;
@NotNull
@ApiModelProperty(example = "페이지당 조회할 목록 수",notes = "페이지당 조회할 목록 수", name = "페이지당 조회할 목록 수", dataType = "int")
private int pagePerRows;
@NotNull
@ApiModelProperty(example = "현재 페이지", name = "현재 페이지", dataType = "int")
private int page;
}

View File

@@ -0,0 +1,43 @@
package kr.co.uplus.ez.api.homeMgt.dto;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class NoticeListReqDto implements Serializable {
@ApiModelProperty(example = "분류 코드", name = "분류 코드", dataType = "String")
private String searchType1;
@ApiModelProperty(example = "제목 검색어", name = "제목 검색어", dataType = "String")
private String searchText1;
@ApiModelProperty(example = "분류코드", name = "분류코드", dataType = "String")
private String ctgCd;
@ApiModelProperty(example = "긴급여부(Y/N)", name = "긴급여부(Y/N)", dataType = "String")
private String emgYn;
@ApiModelProperty(example = "제목", name = "제목", dataType = "String")
private String title;
@ApiModelProperty(example = "공지 내용", name = "공지 내용", dataType = "String")
private String ntSbst;
@ApiModelProperty(example = "사용 여부", name = "사용 여부", dataType = "String")
private String useYn;
@NotNull
@ApiModelProperty(example = "페이지당 조회할 목록 수",notes = "페이지당 조회할 목록 수", name = "페이지당 조회할 목록 수", dataType = "int")
private int pagePerRows;
@NotNull
@ApiModelProperty(example = "현재 페이지", name = "현재 페이지", dataType = "int")
private int page;
}

View File

@@ -0,0 +1,15 @@
package kr.co.uplus.ez.api.homeMgt.dto;
import java.io.Serializable;
import java.util.List;
import kr.co.uplus.ez.common.data.Paging;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class NoticeListRes implements Serializable {
private Paging paging;
private List<NoticeDto> list;
}

View File

@@ -0,0 +1,30 @@
package kr.co.uplus.ez.api.homeMgt.dto;
import java.io.Serializable;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import kr.co.uplus.ez.common.data.ResponseMessage;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class NoticeListResDto extends ResponseMessage implements Serializable {
// 데이터.
private NoticeListRes data;
public NoticeListResDto() {
this.retCode = ApiResponseCode.SUCCESS.getResultCode();
this.retMsg = ApiResponseCode.SUCCESS.getResultMsg();
}
public NoticeListResDto(ApiResponseCode returnStr) {
this.retCode = returnStr.getResultCode();
this.retMsg = returnStr.getResultMsg();
}
public NoticeListResDto(ApiResponseCode returnStr, NoticeListRes data) {
this.retCode = returnStr.getResultCode();
this.retMsg = returnStr.getResultMsg();
this.data = data;
}
}

View File

@@ -0,0 +1,42 @@
package kr.co.uplus.ez.api.homeMgt.dto;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class UpdateNoticeReqDto implements Serializable {
@NotNull
@ApiModelProperty(example = "공지 번호", name = "공지 번호", dataType = "int")
private int ntNo;
@ApiModelProperty(example = "분류 코드", name = "분류 코드", dataType = "String")
private String ctgCd;
@ApiModelProperty(example = "긴급 여부", name = "긴급 여부", dataType = "String")
private String emgYn;
@ApiModelProperty(example = "제목", name = "제목", dataType = "String")
private String title;
@ApiModelProperty(example = "공지 내용", name = "공지 내용", dataType = "String")
private String ntSbst;
@ApiModelProperty(example = "사용 여부", name = "사용 여부", dataType = "String")
private String useYn;
@ApiModelProperty(example = "변경 ID", name = "변경 ID", dataType = "String")
private String chgId;
@ApiModelProperty(example = "업로드된 파일", name = "업로드된 파일", dataType = "String")
private String legacyFiles;
@ApiModelProperty(example = "삭제 파일", name = "삭제 파일", dataType = "Int")
private String delFileNo;
}

View File

@@ -0,0 +1,30 @@
package kr.co.uplus.ez.api.homeMgt.dto;
import java.io.Serializable;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import kr.co.uplus.ez.common.data.ResponseMessage;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class UpdateNoticeResDto extends ResponseMessage implements Serializable{
// 데이터.
private Object data;
public UpdateNoticeResDto() {
this.retCode = ApiResponseCode.SUCCESS.getResultCode();
this.retMsg = ApiResponseCode.SUCCESS.getResultMsg();
}
public UpdateNoticeResDto(ApiResponseCode returnStr) {
this.retCode = returnStr.getResultCode();
this.retMsg = returnStr.getResultMsg();
}
public UpdateNoticeResDto(ApiResponseCode returnStr, Object data) {
this.retCode = returnStr.getResultCode();
this.retMsg = returnStr.getResultMsg();
this.data = data;
}
}

View File

@@ -58,8 +58,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/v3/api-docs/**",
"/",
"/socket/**",
"/api/v1/bo/sendNumMgt/filedownload"
,"/common/healthChk"
"/api/v1/bo/sendNumMgt/filedownload",
"/api/v1/bo/homeMgt/filedownload",
"/common/healthChk"
};
private static final String[] AUTH_URL_ARRAY = {
@@ -72,6 +73,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/api/v1/bo/mntrng/**",
"/api/v1/bo/riskMgt/sendNum/**",
"/api/v1/bo/stats/**",
"/api/v1/bo/homeMgt/**",
"/view/error/**"
};

View File

@@ -51,6 +51,7 @@ msghubez:
applicationId: EZ_ADMIN
uri:
sendTemplateMail: /api/v1/fo/sendTemplateMail
notice: /api/v1/fo/notice
homepageLogin: /auth/bo
authKey: "bohubez!@#$%"
@@ -70,6 +71,8 @@ file-resource:
info:
sendNumber:
path: /efs/admin/sendNumber/
notice:
path: /efs/admin/notice/
sendMsg:
tableNm: EZ_MSG_REAL

View File

@@ -51,6 +51,7 @@ msghubez:
applicationId: EZ_ADMIN
uri:
sendTemplateMail: /api/v1/fo/sendTemplateMail
notice: /api/v1/fo/notice
homepageLogin: /auth/bo
authKey: "bohubez!@#$%"
@@ -70,6 +71,8 @@ file-resource:
info:
sendNumber:
path: /efs/admin/sendNumber/
notice:
path: /efs/admin/notice/
sendMsg:
tableNm: EZ_MSG_NORMAL

View File

@@ -51,6 +51,7 @@ msghubez:
applicationId: EZ_ADMIN
uri:
sendTemplateMail: /api/v1/fo/sendTemplateMail
notice: /api/v1/fo/notice
homepageLogin: /auth/bo
authKey: "bohubez!@#$%"
@@ -70,6 +71,8 @@ file-resource:
info:
sendNumber:
path: /efs/admin/sendNumber/
notice:
path: /efs/admin/notice/
sendMsg:
tableNm: EZ_MSG_REAL

View File

@@ -51,6 +51,7 @@ msghubez:
applicationId: EZ_ADMIN
uri:
sendTemplateMail: /api/v1/fo/sendTemplateMail
notice: /api/v1/fo/notice
homepageLogin: /auth/bo
authKey: "bohubez!@#$%"
@@ -70,6 +71,8 @@ file-resource:
info:
sendNumber:
path: /efs/admin/sendNumber/
notice:
path: /efs/admin/notice/
sendMsg:
tableNm: EZ_MSG_REAL

View File

@@ -0,0 +1,214 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.co.uplus.ez.api.homeMgt.HomeMgtMapper">
<!-- 공지사항 개수 조회 -->
<select id="selectNoticeTotalCnt"
parameterType="kr.co.uplus.ez.api.homeMgt.dto.NoticeListReqDto"
resultType="int">
/* homeMgt-mapper.xml(selectNoticeTotalCnt) */
SELECT
COUNT(*)
FROM
hubez_common.EZ_NTBBS N1
WHERE 1 = 1
<include refid="NoticeListCondition"></include>
</select>
<!-- 공지사항 조회 -->
<select id="selectNoticeList"
parameterType="kr.co.uplus.ez.api.homeMgt.dto.NoticeListReqDto"
resultType="kr.co.uplus.ez.api.homeMgt.dto.NoticeDto">
/* sysMgt-mapper.xml(selectNoticeList) */
SELECT
@ROWNUM := @ROWNUM + 1 AS NO,
NT_NO,
CTG_CD,
(
SELECT DTL_CD_NM
FROM hubez_common.EZ_CD_DTL
WHERE DTL_CD = N1.CTG_CD
AND GRP_CD = 'NTBBS_CTG_CD' AND USE_YN = 'Y'
) AS CTG_CD_NM,
TITLE,
EMG_YN,
NT_SBST,
REGR,
USE_YN,
RETV_CNT,
REG_ID,
DATE_FORMAT(REG_DT, '%Y-%m-%d') AS regDt,
CHG_ID,
CHG_DT,
(
SELECT
GROUP_CONCAT(FILE_NO SEPARATOR ',')
FROM hubez_common.EZ_BBS_FATC
WHERE BBS_NO = N1.NT_NO
AND BBS_DIV_CD = '02'
) AS FILE_NO,
(
SELECT
GROUP_CONCAT(FILE_PATH SEPARATOR ',')
FROM hubez_common.EZ_BBS_FATC
WHERE BBS_NO = N1.NT_NO
AND BBS_DIV_CD = '02'
) AS FILE_PATH,
(
SELECT
GROUP_CONCAT(FILE_NM SEPARATOR ',')
FROM hubez_common.EZ_BBS_FATC
WHERE BBS_NO = N1.NT_NO
AND BBS_DIV_CD = '02'
) AS FILE_NM,
(
SELECT
GROUP_CONCAT(FILE_TITLE SEPARATOR ',')
FROM hubez_common.EZ_BBS_FATC
WHERE BBS_NO = N1.NT_NO
AND BBS_DIV_CD = '02'
) AS FILE_TITLE,
(SELECT COUNT(*) FROM hubez_common.EZ_BBS_FATC WHERE BBS_NO = N1.NT_NO AND BBS_DIV_CD = '02') AS FILE_COUNT,
CASE
WHEN
(SELECT COUNT(*) FROM hubez_common.EZ_BBS_FATC WHERE BBS_NO = N1.NT_NO AND BBS_DIV_CD = '02') > 0 THEN "Y"
ELSE
"N"
END AS FILE_YN
FROM
hubez_common.EZ_NTBBS N1 , ( SELECT @ROWNUM := #{page} ) AS R
WHERE 1=1
<include refid="NoticeListCondition"></include>
ORDER BY N1.REG_DT DESC
LIMIT #{page}, #{pagePerRows}
</select>
<!-- 공지사항 채번 -->
<select id="selectNoticeNumber"
parameterType="kr.co.uplus.ez.api.homeMgt.dto.NoticeListReqDto"
resultType="int">
/* sysMgt-mapper.xml(selectNoticeList) */
SELECT
NT_NO,
FROM
hubez_common.EZ_NTBBS N1
WHERE 1=1
<include refid="NoticeListCondition"></include>
ORDER BY N1.REG_DT DESC
LIMIT #{page}, #{pagePerRows}
</select>
<!-- 공지사항 등록 -->
<insert id="insertNotice" parameterType="kr.co.uplus.ez.api.homeMgt.dto.InsertNoticeReqDto">
/* homeMgt-mapper.xml (insertNotice) */
INSERT INTO
hubez_common.EZ_NTBBS(
CTG_CD,
EMG_YN,
TITLE,
NT_SBST,
REGR,
USE_YN,
RETV_CNT,
REG_ID,
REG_DT,
CHG_ID,
CHG_DT
)VALUES(
#{ctgCd},
#{emgYn},
#{title},
#{ntSbst},
#{regr},
#{useYn},
0,
#{regId},
NOW(),
#{chgId},
NOW()
)
</insert>
<!-- 공지사항 채번 -->
<select id="insertNoticeNtNo" resultType="int">
SELECT LAST_INSERT_ID()
</select>
<!-- 공지사항 파일 등록 -->
<insert id="insertNoticeFile" parameterType="kr.co.uplus.ez.api.homeMgt.dto.InsertNoticeFileDto">
INSERT INTO
hubez_common.EZ_BBS_FATC (
BBS_DIV_CD,
BBS_NO,
FILE_NO,
FILE_TITLE,
FILE_NM,
FILE_SIZE,
FILE_PATH,
DOWNL_CNT,
REG_ID,
REG_DT,
CHG_ID,
CHG_DT
)
VALUES(
#{bbsDivCd},
#{bbsNo},
#{fileNo},
#{fileTitle},
#{fileNm},
#{fileSize},
#{filePath},
0,
#{regId},
NOW(),
#{chgId},
NOW()
)
</insert>
<!-- 공지사항 정보 변경 -->
<update id="updateNotice" parameterType="kr.co.uplus.ez.api.homeMgt.dto.UpdateNoticeReqDto">
/* homeMgt-mapper.xml (updateNotice) */
UPDATE hubez_common.EZ_NTBBS
SET
CHG_DT = now()
,CTG_CD = #{ctgCd}
,EMG_YN = #{emgYn}
,USE_YN = #{useYn}
,TITLE = #{title}
,NT_SBST = #{ntSbst}
,CHG_DT = NOW()
,CHG_ID = #{chgId}
WHERE
NT_NO = #{ntNo}
</update>
<!-- 첨부파일 번호 최근값 가져오기 -->
<select id="updateNoticeFileMaxNum" parameterType="kr.co.uplus.ez.api.homeMgt.dto.UpdateNoticeReqDto" resultType="int">
SELECT
IFNULL( MAX(FILE_NO), 0) + 1
FROM hubez_common.EZ_BBS_FATC
WHERE BBS_NO = #{ntNo}
</select>
<!-- 첨부파일 삭제 -->
<delete id="delNoticeFile" parameterType="kr.co.uplus.ez.api.homeMgt.dto.DelNoticeReqDto">
DELETE FROM hubez_common.EZ_BBS_FATC
WHERE BBS_NO = #{ntNo}
AND FILE_NO = #{fileNo}
</delete>
<sql id="NoticeListCondition">
<if test="searchType1 != null and searchType1 != ''">
AND N1.CTG_CD = #{searchType1}
</if>
<if test="searchText1 != null and searchText1 != ''">
AND N1.TITLE LIKE CONCAT('%', #{searchText1}, '%')
</if>
</sql>
</mapper>

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-626b9efc"],{bc8d:function(t,r,o){"use strict";o.r(r);var n=function(){var t=this,r=t._self._c;return r("div",{staticClass:"error-body"},[r("img",{attrs:{src:o("ce04")}}),r("p",{staticClass:"header"},[t._v("페이지를 찾을 수 없습니다.")]),t._m(0),r("p",{staticClass:"error-btns"},[r("a",{attrs:{href:"javascript:void(0);"},on:{click:function(r){return t.backGo()}}},[t._v("이전 페이지로")]),r("a",{attrs:{href:"javascript:void(0);"},on:{click:function(r){return t.goMain()}}},[t._v("메인으로")])])])},s=[function(){var t=this,r=t._self._c;return r("span",{staticClass:"message"},[t._v("웹 페이지의 주소가 잘못 입력되었거나,"),r("br"),t._v("\n 변경 또는 삭제되어 요청하신 페이지를 찾을 수 없습니다. "),r("br"),t._v("\n 입력하신 주소가 정확한지 다시 한번 확인해 주시기 바랍니다."),r("br"),t._v("\n 이용에 불편을 드려 죄송합니다.\n ")])}],e={name:"error404",data:function(){return{}},created:function(){this.$store.commit("login/isErrorPage",!0)},mounted:function(){},destroyed:function(){this.$store.commit("login/isErrorPage",!1)},methods:{backGo:function(){var t=this.$store.getters["login/getBeforeUrl"];this.$store.commit("login/isErrorPage",!1),this.$router.push({path:t}).catch((function(){}))},goMain:function(){var t=this.$store.getters["login/getRootUrl"];this.$store.commit("login/isErrorPage",!1),this.$router.push({path:t}).catch((function(){}))}}},i=e,c=o("2877"),a=Object(c["a"])(i,n,s,!1,null,null,null);r["default"]=a.exports},ce04:function(t,r,o){t.exports=o.p+"../static/img/error_message_page.f64f1c59.png"}}]);
//# sourceMappingURL=chunk-626b9efc.afde63a0.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-7fafe7e9"],{"123b":function(t,r,s){"use strict";s.r(r);var o=function(){var t=this,r=t._self._c;return r("div",{staticClass:"error-body"},[r("img",{attrs:{src:s("ffa1")}}),r("p",{staticClass:"header"},[t._v("시스템 오류")]),t._m(0),r("p",{staticClass:"error-btns"},[r("a",{attrs:{href:"javascript:void(0);"},on:{click:function(r){return t.backGo()}}},[t._v("이전 페이지로")]),r("a",{attrs:{href:"javascript:void(0);"},on:{click:function(r){return t.goMain()}}},[t._v("메인으로")])])])},n=[function(){var t=this,r=t._self._c;return r("span",{staticClass:"message"},[t._v("이용에 불편을 드려 죄송합니다."),r("br"),t._v("\n 일시적인 오류가 발생하였습니다. "),r("br"),t._v("\n 잠시 후 이용하여 주시기 바랍니다.\n ")])}],i={data:function(){return{}},created:function(){this.$store.commit("login/isErrorPage",!0)},mounted:function(){},destroyed:function(){this.$store.commit("login/isErrorPage",!1)},methods:{backGo:function(){var t=this.$store.getters["login/getBeforeUrl"];this.$store.commit("login/isErrorPage",!1),this.$router.push({path:t}).catch((function(){}))},goMain:function(){var t=this.$store.getters["login/getRootUrl"];this.$store.commit("login/isErrorPage",!1),this.$router.push({path:t}).catch((function(){}))}}},e=i,a=s("2877"),c=Object(a["a"])(e,o,n,!1,null,null,null);r["default"]=c.exports},ffa1:function(t,r,s){t.exports=s.p+"../static/img/error_message_system.7160e0d0.png"}}]);
//# sourceMappingURL=chunk-7fafe7e9.ea3075f8.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1 @@
<!DOCTYPE html><html lang=ko><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><link rel=icon href=/logo.png><title>hubez-admin-web</title><link href=/../static/js/chunk-626b9efc.afde63a0.js rel=prefetch><link href=/../static/js/chunk-7fafe7e9.ea3075f8.js rel=prefetch><link href=/../static/css/app.f9c9f764.css rel=preload as=style><link href=/../static/js/app.62224446.js rel=preload as=script><link href=/../static/js/chunk-vendors.9b80732e.js rel=preload as=script><link href=/../static/css/app.f9c9f764.css rel=stylesheet></head><body><noscript><strong>We're sorry but hubez-admin-web doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/../static/js/chunk-vendors.9b80732e.js></script><script src=/../static/js/app.62224446.js></script></body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -7,6 +7,8 @@ xssconfig :
- "/projectApi/manage/saveProject"
- "/api/v1/bo/sendNumMgt/insertNumber"
- "/api/v1/bo/sendNumMgt/filedownload"
# cross-site origin 이면서 application/x-www-form-urlencoded (post) 일때 변수 매핑이 안됨. 제외처리필요.
- "/api/v1/bo/homeMgt/preview"
#- "/uc/test/testUrl" #테스트 URL
#xss 제외 방식(allow, except)
#allow - escape-characters 를 모두 적용 후 allow-elements 만 <, > 치환