feat: 관리자 - 컨텐츠관리 - 팝업관리에서 목록 불러오기 API 추가 건
parent
4605f802b8
commit
e55d5081a3
|
|
@ -0,0 +1,71 @@
|
|||
package com.dbnt.kcscbackend.admin.contents.popUp.controller;
|
||||
|
||||
|
||||
import com.dbnt.kcscbackend.admin.committee.schedules.model.CreateScheduleVO;
|
||||
import com.dbnt.kcscbackend.admin.committee.schedules.model.UpdateScheduleVO;
|
||||
import com.dbnt.kcscbackend.admin.committee.schedules.service.EgovIndvdlSchdulManageService;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.service.PopUpApiService;
|
||||
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.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.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Api("PopUpApiController")
|
||||
@RestController
|
||||
@Tag(name="PopUpApiController",description = "팝업 관리")
|
||||
public class PopUpApiController {
|
||||
|
||||
@Resource(name = "popUpApiService")
|
||||
private PopUpApiService popUpApiService;
|
||||
|
||||
@Operation(
|
||||
summary = "'팝업 관리' 페이지에서 목록 불러오는 API",
|
||||
description = "관리자 단에서 '컨텐츠 관리' > '팝업 관리' 페이지에서 목록 불러오는 API",
|
||||
tags = {"SchedulesApiController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@GetMapping(value = "/contents/api/popup-manage/list")
|
||||
public ResultVO contentsApiPopUpManageList(
|
||||
@AuthenticationPrincipal LoginVO user,
|
||||
HttpServletRequest request) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = popUpApiService.contentsApiPopUpManageList(resultVO, request, user);
|
||||
} 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,53 @@
|
|||
package com.dbnt.kcscbackend.admin.contents.popUp.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(name = "tn_popup_mng")
|
||||
@NoArgsConstructor
|
||||
public class TnPopupMngWithoutPopupContents {
|
||||
|
||||
@Id
|
||||
@Column(name = "popup_seq")
|
||||
private Long popupSeq;
|
||||
|
||||
@Column(name = "popup_title")
|
||||
private String popupTitle;
|
||||
|
||||
@Column(name = "popup_start_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime popupStartDate;
|
||||
|
||||
@Column(name = "popup_end_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime popupEndDate;
|
||||
|
||||
@Column(name = "file_grp_id")
|
||||
private String fileGrpId;
|
||||
|
||||
@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;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.dbnt.kcscbackend.admin.contents.popUp.model;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public interface TnPopupMngWithoutPopupContents {
|
||||
|
||||
Long getPopupSeq();
|
||||
String getPopupTitle();
|
||||
LocalDateTime getPopupStartDate();
|
||||
LocalDateTime getPopupEndDate();
|
||||
String getFileGrpId();
|
||||
String getFrstCrtId();
|
||||
LocalDateTime getFrstCrtDt();
|
||||
String getLastChgId();
|
||||
LocalDateTime getLastChgDt();
|
||||
String getUseYn();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.dbnt.kcscbackend.admin.contents.popUp.repository;
|
||||
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.entity.TnPopupMngWithoutPopupContents;
|
||||
import com.dbnt.kcscbackend.commonCode.entity.TnPopupMng;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface TnPopupMngRepositoryWithoutPopupContents extends JpaRepository<TnPopupMngWithoutPopupContents, Long> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.dbnt.kcscbackend.admin.contents.popUp.service;
|
||||
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public interface PopUpApiService {
|
||||
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package com.dbnt.kcscbackend.admin.contents.popUp.service.impl;
|
||||
|
||||
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.repository.TnPopupMngRepositoryWithoutPopupContents;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.service.PopUpApiService;
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
import com.dbnt.kcscbackend.commonCode.repository.TnPopupMngRepository;
|
||||
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.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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("popUpApiService")
|
||||
@RequiredArgsConstructor
|
||||
public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopUpApiService {
|
||||
|
||||
private final TnPopupMngRepository tnPopupMngRepository;
|
||||
private final TnPopupMngRepositoryWithoutPopupContents tnPopupMngRepositoryWithoutPopupContents;
|
||||
|
||||
|
||||
@Override
|
||||
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user) throws Exception {
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"user.getEmail():" + "\n" +
|
||||
user.getEmail() + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
List<Map<String, Object>> listPopup = tnPopupMngRepositoryWithoutPopupContents.findAll(Sort.by(Sort.Direction.DESC, "popupSeq"))
|
||||
.stream()
|
||||
.map(item -> {
|
||||
Map<String, Object> codeMap = new HashMap<>();
|
||||
codeMap.put("seq", item.getPopupSeq());
|
||||
codeMap.put("popupTitle", item.getPopupTitle());
|
||||
codeMap.put("startDate", item.getPopupStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
codeMap.put("endDate", item.getPopupEndDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
codeMap.put("createUserId", item.getFrstCrtId());
|
||||
codeMap.put("updateUserId", item.getLastChgId());
|
||||
codeMap.put("fileGrpId", item.getFileGrpId());
|
||||
codeMap.put("contents", null);
|
||||
codeMap.put("useYn", item.getUseYn());
|
||||
codeMap.put("createDate", item.getFrstCrtDt());
|
||||
codeMap.put("updateDate", item.getLastChgDt());
|
||||
codeMap.put("base64String", null);
|
||||
return codeMap;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
dto.put("listPopup", listPopup);
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
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_popup_mng")
|
||||
public class TnPopupMng {
|
||||
|
||||
@Id
|
||||
@Column(name = "popup_seq")
|
||||
private Long popupSeq;
|
||||
|
||||
@Column(name = "popup_title")
|
||||
private String popupTitle;
|
||||
|
||||
@Column(name = "popup_start_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime popupStartDate;
|
||||
|
||||
@Column(name = "popup_end_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime popupEndDate;
|
||||
|
||||
@Column(name = "file_grp_id")
|
||||
private String fileGrpId;
|
||||
|
||||
@Column(name = "popup_contents")
|
||||
private String popupContents;
|
||||
|
||||
@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 TnPopupMngId implements Serializable {
|
||||
private String popupSeq;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.dbnt.kcscbackend.commonCode.repository;
|
||||
|
||||
import com.dbnt.kcscbackend.commonCode.entity.TnPopupMng;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface TnPopupMngRepository extends JpaRepository<TnPopupMng, TnPopupMng.TnPopupMngId> {
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue