feat: 관리자 - 컨텐츠관리 - 건설기준연구 관리 목록 구현 back-end
parent
a23833a00b
commit
2431425362
|
|
@ -0,0 +1,240 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch;
|
||||
|
||||
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.CreatePopupVO;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.UpdatePopupVO;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.utils.EgovFileMngUtil;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.service.AdminStandardResearchService;
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
||||
@Api("AdminStandardResearchController")
|
||||
@RestController
|
||||
@Tag(name="AdminStandardResearchController",description = "건설기준연구 관리")
|
||||
public class AdminStandardResearchController {
|
||||
|
||||
@Resource(name = "adminStandardResearchService")
|
||||
private AdminStandardResearchService adminStandardResearchService;
|
||||
|
||||
@Resource(name = "EgovFileMngUtil")
|
||||
private EgovFileMngUtil fileUtil;
|
||||
|
||||
@Operation(
|
||||
summary = "'건설기준연구 관리' 페이지에서 목록 불러오는 API",
|
||||
description = "관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 목록 불러오는 API",
|
||||
tags = {"PopUpApiController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@GetMapping(value = "/contents/standard-research/list")
|
||||
public ResultVO contentsStandardResearchList(
|
||||
@AuthenticationPrincipal LoginVO user,
|
||||
HttpServletRequest request,
|
||||
Pageable pageable) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = adminStandardResearchService.contentsStandardResearchList(resultVO, request, user, pageable);
|
||||
} catch (Exception e) {
|
||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||
resultVO.setResultMessage(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " OUT:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"resultVO.toString():" + "\n" +
|
||||
resultVO.toString() + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "팝업 추가 API",
|
||||
description = "관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 팝업을 추가하는 API",
|
||||
tags = {"PopUpApiController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "등록 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님"),
|
||||
@ApiResponse(responseCode = "900", description = "입력값 무결성 오류")
|
||||
})
|
||||
@PostMapping(value = "/contents/standard-research")
|
||||
public ResultVO contentsStandardResearchCreate(
|
||||
HttpServletRequest request,
|
||||
@AuthenticationPrincipal LoginVO loginVO,
|
||||
final MultipartHttpServletRequest multiRequest,
|
||||
CreateStandardResearchVO createStandardResearchVO
|
||||
) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = adminStandardResearchService.contentsStandardResearchCreate(resultVO, request, loginVO, multiRequest, createStandardResearchVO);
|
||||
} catch (Exception e) {
|
||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||
resultVO.setResultMessage(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " OUT:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"resultVO.toString():" + "\n" +
|
||||
resultVO.toString() + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
return resultVO;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "팝업 수정 API",
|
||||
description = "관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 팝업을 수정하는 API",
|
||||
tags = {"PopUpApiController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "등록 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님"),
|
||||
})
|
||||
@PutMapping(value = "/contents/standard-research/{popupId}")
|
||||
public ResultVO contentsStandardResearchUpdate(
|
||||
HttpServletRequest request,
|
||||
@AuthenticationPrincipal LoginVO loginVO,
|
||||
UpdateStandardResearchVO updateStandardResearchVO,
|
||||
@PathVariable("popupId") Long popupId
|
||||
) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = adminStandardResearchService.contentsStandardResearchUpdate(resultVO, request, loginVO, updateStandardResearchVO, popupId);
|
||||
} catch (Exception e) {
|
||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||
resultVO.setResultMessage(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " OUT:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"resultVO.toString():" + "\n" +
|
||||
resultVO.toString() + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
return resultVO;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "팝업 비활성화 API",
|
||||
description = "관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 팝업을 비활성화 API. 삭제가 아닌 비활성화 임. 삭제는 없음.",
|
||||
tags = {"PopUpApiController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "등록 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님"),
|
||||
})
|
||||
@DeleteMapping(value = "/contents/standard-research/{popupId}")
|
||||
public ResultVO contentsStandardResearchDelete
|
||||
(
|
||||
@AuthenticationPrincipal LoginVO user,
|
||||
HttpServletRequest request,
|
||||
@PathVariable("popupId") String strPopupId
|
||||
) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
Long popupId = Long.valueOf(strPopupId);
|
||||
try {
|
||||
resultVO = adminStandardResearchService.contentsStandardResearchDelete(resultVO, request, user, popupId);
|
||||
} catch (Exception e) {
|
||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||
resultVO.setResultMessage(e.getMessage());
|
||||
}
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " OUT:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"resultVO.toString():" + "\n" +
|
||||
resultVO.toString() + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "팝업 내용 불러오기 API",
|
||||
description = "관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 저장된 팝업을 불러오는 API",
|
||||
tags = {"PopUpApiController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공")
|
||||
})
|
||||
@GetMapping(value = "/contents/standard-research/{popupId}")
|
||||
public ResultVO contentsStandardResearchRead(
|
||||
HttpServletRequest request,
|
||||
@AuthenticationPrincipal LoginVO loginVO,
|
||||
@PathVariable("popupId") Long popupId
|
||||
) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = adminStandardResearchService.contentsStandardResearchRead(resultVO, request, loginVO, popupId);
|
||||
} catch (Exception e) {
|
||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||
resultVO.setResultMessage(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " OUT:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"resultVO.toString():" + "\n" +
|
||||
resultVO.toString() + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel(value = "CreateStandardResearchVO", description =
|
||||
"관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 글 작성하는 API에 사용된다." + ""
|
||||
)
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class CreateStandardResearchVO implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 2635889608799075362L;
|
||||
|
||||
@ApiModelProperty(value = "title")
|
||||
private String title;
|
||||
@ApiModelProperty(value = "researchStartDate")
|
||||
private String researchStartDate;
|
||||
@ApiModelProperty(value = "researchEndDate")
|
||||
private String researchEndDate;
|
||||
@ApiModelProperty(value = "director")
|
||||
private String director;
|
||||
@ApiModelProperty(value = "purpose")
|
||||
private String purpose;
|
||||
@ApiModelProperty(value = "content")
|
||||
private String content;
|
||||
@ApiModelProperty(value = "effectContent")
|
||||
private String effectContent;
|
||||
/*
|
||||
files: (binary)
|
||||
files: (binary)
|
||||
files: (binary)
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch.model;
|
||||
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "tn_research")
|
||||
public class TnResearchLightweight {
|
||||
|
||||
@Id
|
||||
@Column(name = "rs_seq")
|
||||
private Long rsSeq;
|
||||
|
||||
@Column(name = "rs_title")
|
||||
private String rsTitle;
|
||||
|
||||
@Column(name = "rs_start_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime rsStartDate;
|
||||
|
||||
@Column(name = "rs_end_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime rsEndDate;
|
||||
|
||||
@Column(name = "rs_director")
|
||||
private String rsDirector;
|
||||
|
||||
@Column(name = "frst_crt_id")
|
||||
private String frstCrtId;
|
||||
|
||||
@Column(name = "frst_crt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime frstCrtDt;
|
||||
|
||||
@Column(name = "last_chg_id")
|
||||
private String lastChgId;
|
||||
|
||||
@Column(name = "last_chg_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastChgDt;
|
||||
|
||||
@Column(name = "use_yn")
|
||||
private String useYn;
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class TnResearchId implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 9042992093269088042L;
|
||||
|
||||
private String rsSeq;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel(value = "UpdateStandardResearchVO", description =
|
||||
"관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 글 수정하는 API에 사용된다." + ""
|
||||
)
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class UpdateStandardResearchVO implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -2518477576804111511L;
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
@ApiModelProperty(value = "title")
|
||||
private String title;
|
||||
@ApiModelProperty(value = "researchStartDate")
|
||||
private String researchStartDate;
|
||||
@ApiModelProperty(value = "researchEndDate")
|
||||
private String researchEndDate;
|
||||
@ApiModelProperty(value = "director")
|
||||
private String director;
|
||||
@ApiModelProperty(value = "purpose")
|
||||
private String purpose;
|
||||
@ApiModelProperty(value = "content")
|
||||
private String content;
|
||||
@ApiModelProperty(value = "effectContent")
|
||||
private String effectContent;
|
||||
/*
|
||||
files: (binary)
|
||||
files: (binary)
|
||||
files: (binary)
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch.repository;
|
||||
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.TnResearchLightweight;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface TnResearchRepositoryLightweight extends JpaRepository<TnResearchLightweight, Long> {
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch.service;
|
||||
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.CreatePopupVO;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.UpdatePopupVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public interface AdminStandardResearchService {
|
||||
public ResultVO contentsStandardResearchList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception;
|
||||
public ResultVO contentsStandardResearchCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreateStandardResearchVO createStandardResearchVO) throws Exception;
|
||||
public ResultVO contentsStandardResearchRead(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
||||
public ResultVO contentsStandardResearchUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdateStandardResearchVO updateStandardResearchVO, Long popupId) throws Exception;
|
||||
public ResultVO contentsStandardResearchDelete(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,269 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch.service.impl;
|
||||
|
||||
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.CreatePopupVO;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.FileVO;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.UpdatePopupVO;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.repository.TnPopupMngRepositoryWithoutPopupContents;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.service.PopUpApiService;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.repository.TnResearchRepositoryLightweight;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.service.AdminStandardResearchService;
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
import com.dbnt.kcscbackend.commonCode.entity.TnPopupMng;
|
||||
import com.dbnt.kcscbackend.commonCode.entity.TnResearch;
|
||||
import com.dbnt.kcscbackend.commonCode.repository.TnPopupMngRepository;
|
||||
import com.dbnt.kcscbackend.commonCode.repository.TnResearchRepository;
|
||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service("adminStandardResearchService")
|
||||
@RequiredArgsConstructor
|
||||
public class AdminStandardResearchServiceImpl extends EgovAbstractServiceImpl implements AdminStandardResearchService {
|
||||
|
||||
private final TnResearchRepository tnResearchRepository;
|
||||
private final TnResearchRepositoryLightweight tnResearchRepositoryLightweight;
|
||||
|
||||
|
||||
@Override
|
||||
public ResultVO contentsStandardResearchList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception {
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"user.getEmail():" + "\n" +
|
||||
user.getEmail() + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
|
||||
long totalRecordCount = tnResearchRepositoryLightweight.count();
|
||||
List<Map<String, Object>> list = tnResearchRepositoryLightweight.findAll(pageable)
|
||||
.stream()
|
||||
.map(item -> {
|
||||
Map<String, Object> codeMap = new HashMap<>();
|
||||
codeMap.put("id", item.getRsSeq());
|
||||
codeMap.put("title", item.getRsTitle());
|
||||
codeMap.put("researchStartDate", item.getRsStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
codeMap.put("researchEndDate", item.getRsEndDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
codeMap.put("director", item.getRsDirector());
|
||||
codeMap.put("createDate", item.getFrstCrtDt());
|
||||
codeMap.put("createUserId", item.getFrstCrtId());
|
||||
codeMap.put("updateDate", item.getLastChgDt());
|
||||
codeMap.put("updateUserId", item.getLastChgId());
|
||||
codeMap.put("useYn", item.getUseYn());
|
||||
return codeMap;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(pageable.getPageNumber()+1);
|
||||
paginationInfo.setRecordCountPerPage(pageable.getPageSize());
|
||||
paginationInfo.setPageSize(5);//hard coded
|
||||
paginationInfo.setTotalRecordCount((int) totalRecordCount);
|
||||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
dto.put("list", list);
|
||||
dto.put("paginationInfo", paginationInfo);
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResultVO contentsStandardResearchCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreateStandardResearchVO createStandardResearchVO) throws Exception {
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"user.getEmail():" + "\n" +
|
||||
user.getEmail() + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
// 첨부파일 관련 첨부파일ID 생성
|
||||
List<FileVO> _result = null;
|
||||
String _atchFileId = "";
|
||||
|
||||
final Map<String, MultipartFile> files = multiRequest.getFileMap();
|
||||
|
||||
if (!files.isEmpty()) {
|
||||
//_atchFileId = fileMngService.insertFileInfs(_result); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다.
|
||||
}
|
||||
|
||||
Map<String, Object> response = tnResearchRepository.spAddTnResearch(
|
||||
createStandardResearchVO.getTitle(),
|
||||
createStandardResearchVO.getResearchStartDate(),
|
||||
createStandardResearchVO.getResearchEndDate(),
|
||||
createStandardResearchVO.getDirector(),
|
||||
createStandardResearchVO.getPurpose(),
|
||||
createStandardResearchVO.getContent(),
|
||||
createStandardResearchVO.getEffectContent(),
|
||||
"kcsc_admin",
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResultVO contentsStandardResearchRead(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long rsId) throws Exception {
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"user.getEmail():" + "\n" +
|
||||
user.getEmail() + "\n" +
|
||||
"rsId:" + "\n" +
|
||||
rsId + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
|
||||
TnResearch tnResearch = tnResearchRepository.findByRsSeq(rsId);
|
||||
|
||||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
dto.put("content", tnResearch.getRsContents());
|
||||
dto.put("createDate", tnResearch.getFrstCrtDt().plusHours(9).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); // 날짜/시간의 시작 일시 - yyyyMMddHHmmss
|
||||
dto.put("createUserId", tnResearch.getFrstCrtId());
|
||||
dto.put("director", tnResearch.getRsDirector());
|
||||
dto.put("effectContent", tnResearch.getRsEffect());
|
||||
dto.put("id", tnResearch.getRsSeq());
|
||||
dto.put("purpose", tnResearch.getRsPurpose());
|
||||
dto.put("researchEndDate", tnResearch.getRsEndDate().plusHours(9).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); // 날짜/시간의 시작 일시 - yyyyMMddHHmmss
|
||||
dto.put("researchStartDate", tnResearch.getRsStartDate().plusHours(9).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); // 날짜/시간의 종료 일시 - yyyyMMddHHmmss
|
||||
dto.put("title", tnResearch.getRsTitle());
|
||||
dto.put("updateDate", tnResearch.getLastChgDt().plusHours(9).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); // 날짜/시간의 종료 일시 - yyyyMMddHHmmss
|
||||
dto.put("updateUserId", tnResearch.getLastChgId());
|
||||
dto.put("useYn", tnResearch.getUseYn());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO contentsStandardResearchUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdateStandardResearchVO updateStandardResearchVO, Long rsId) throws Exception {
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"updateStandardResearchVO:" + "\n" +
|
||||
updateStandardResearchVO.toString() + "\n" +
|
||||
"rsId:" + "\n" +
|
||||
rsId + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
if( Long.parseLong(updateStandardResearchVO.getResearchStartDate()) > Long.parseLong(updateStandardResearchVO.getResearchEndDate()) ) {
|
||||
throw new Exception("종료일시는 시작일시보다 앞 설 수 없습니다.");
|
||||
}
|
||||
|
||||
Map<String, Object> response = tnResearchRepository.spUpdateTnResearch(
|
||||
rsId.intValue(),
|
||||
updateStandardResearchVO.getResearchStartDate(),
|
||||
updateStandardResearchVO.getResearchEndDate(),
|
||||
updateStandardResearchVO.getDirector(),
|
||||
updateStandardResearchVO.getPurpose(),
|
||||
updateStandardResearchVO.getContent(),
|
||||
updateStandardResearchVO.getEffectContent(),
|
||||
"kcsc_admin",
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
dto.put("errorMessage", response.get("_error_message") );
|
||||
dto.put("rsId", rsId);
|
||||
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResultVO contentsStandardResearchDelete(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long rsId) throws Exception {
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"rsId:" + "\n" +
|
||||
rsId + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
|
||||
Map<String, Object> response = tnResearchRepository.spDeleteTnResearch(
|
||||
rsId.intValue(),
|
||||
"admin",
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
dto.put("errorMessage", response.get("_error_message") );
|
||||
|
||||
|
||||
dto.put("rsId", rsId );
|
||||
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.dbnt.kcscbackend.commonCode.entity;
|
||||
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "tn_research")
|
||||
public class TnResearch {
|
||||
|
||||
@Id
|
||||
@Column(name = "rs_seq")
|
||||
private Long rsSeq;
|
||||
|
||||
@Column(name = "rs_title")
|
||||
private String rsTitle;
|
||||
|
||||
@Column(name = "rs_start_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime rsStartDate;
|
||||
|
||||
@Column(name = "rs_end_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime rsEndDate;
|
||||
|
||||
@Column(name = "rs_director")
|
||||
private String rsDirector;
|
||||
|
||||
@Column(name = "rs_purpose")
|
||||
private String rsPurpose;
|
||||
|
||||
@Column(name = "rs_contents")
|
||||
private String rsContents;
|
||||
|
||||
@Column(name = "rs_effect")
|
||||
private String rsEffect;
|
||||
|
||||
@Column(name = "frst_crt_id")
|
||||
private String frstCrtId;
|
||||
|
||||
@Column(name = "frst_crt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime frstCrtDt;
|
||||
|
||||
@Column(name = "last_chg_id")
|
||||
private String lastChgId;
|
||||
|
||||
@Column(name = "last_chg_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastChgDt;
|
||||
|
||||
@Column(name = "use_yn")
|
||||
private String useYn;
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class TnResearchId implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 9042992093269088042L;
|
||||
|
||||
private String rsSeq;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.dbnt.kcscbackend.commonCode.repository;
|
||||
|
||||
import com.dbnt.kcscbackend.commonCode.entity.TnResearch;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.jpa.repository.query.Procedure;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public interface TnResearchRepository extends JpaRepository<TnResearch, Long> {
|
||||
|
||||
@Query(value = "CALL sp_add_tn_research (" +
|
||||
":_rs_title, " +
|
||||
"TO_TIMESTAMP(" +
|
||||
" :_rs_start_date," +
|
||||
" 'YYYYMMDDHH24MISS'" +
|
||||
")::::timestamptz AT TIME ZONE 'UTC', " +
|
||||
"TO_TIMESTAMP(" +
|
||||
" :_rs_end_date," +
|
||||
" 'YYYYMMDDHH24MISS'" +
|
||||
")::::timestamptz AT TIME ZONE 'UTC', " +
|
||||
":_rs_director, " +
|
||||
":_rs_purpose, " +
|
||||
":_rs_contents, " +
|
||||
":_rs_effect, " +
|
||||
":_modi_id, " +
|
||||
":_result_count, " +
|
||||
":_result_code, " +
|
||||
":_error_message)",
|
||||
nativeQuery = true)
|
||||
Map<String, Object> spAddTnResearch(
|
||||
@Param("_rs_title") String rsTitle,
|
||||
@Param("_rs_start_date") String rsStartDate,
|
||||
@Param("_rs_end_date") String rsEndDate,
|
||||
@Param("_rs_director") String rsDirector,
|
||||
@Param("_rs_purpose") String rsPurpose,
|
||||
@Param("_rs_contents") String rsContents,
|
||||
@Param("_rs_effect") String rsEffect,
|
||||
@Param("_modi_id") String modiId,
|
||||
@Param("_result_count") Integer resultCount,
|
||||
@Param("_result_code") String resultCode,
|
||||
@Param("_error_message") String errorMessage
|
||||
);
|
||||
|
||||
|
||||
@Query(value = "CALL sp_update_tn_research (" +
|
||||
":_rs_seq, " +
|
||||
"TO_TIMESTAMP(" +
|
||||
" :_rs_start_date," +
|
||||
" 'YYYYMMDDHH24MISS'" +
|
||||
")::::timestamptz AT TIME ZONE 'UTC', " +
|
||||
"TO_TIMESTAMP(" +
|
||||
" :_rs_end_date," +
|
||||
" 'YYYYMMDDHH24MISS'" +
|
||||
")::::timestamptz AT TIME ZONE 'UTC', " +
|
||||
":_rs_director, " +
|
||||
":_rs_purpose, " +
|
||||
":_rs_contents, " +
|
||||
":_rs_effect, " +
|
||||
":_modi_id, " +
|
||||
":_result_count, " +
|
||||
":_result_code, " +
|
||||
":_error_message)",
|
||||
nativeQuery = true)
|
||||
Map<String, Object> spUpdateTnResearch(
|
||||
@Param("_rs_seq") Integer rsSeq,
|
||||
@Param("_rs_start_date") String rsStartDate,
|
||||
@Param("_rs_end_date") String rsEndDate,
|
||||
@Param("_rs_director") String rsDirector,
|
||||
@Param("_rs_purpose") String rsPurpose,
|
||||
@Param("_rs_contents") String rsContents,
|
||||
@Param("_rs_effect") String rsEffect,
|
||||
@Param("_modi_id") String modiId,
|
||||
@Param("_result_count") Integer resultCount,
|
||||
@Param("_result_code") String resultCode,
|
||||
@Param("_error_message") String errorMessage
|
||||
);
|
||||
|
||||
|
||||
@Query(value = "CALL sp_delete_tn_research (" +
|
||||
":_rs_seq, " +
|
||||
":_modi_id, " +
|
||||
":_result_count, " +
|
||||
":_result_code, " +
|
||||
":_error_message)",
|
||||
nativeQuery = true)
|
||||
Map<String, Object> spDeleteTnResearch(
|
||||
@Param("_rs_seq") Integer rsSeq,
|
||||
@Param("_modi_id") String modiId,
|
||||
@Param("_result_count") Integer resultCount,
|
||||
@Param("_result_code") String resultCode,
|
||||
@Param("_error_message") String errorMessage
|
||||
);
|
||||
|
||||
|
||||
|
||||
TnResearch findByRsSeq(Long rsSeq);
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue