feat: 관리자 - 컨텐츠관리 - 팝업관리에서 특정 팝업 눌러서 수정 시, 수정하는 API 추가 건 back-end
parent
88104efc50
commit
ffea204820
|
|
@ -6,6 +6,7 @@ import com.dbnt.kcscbackend.admin.committee.schedules.model.UpdateScheduleVO;
|
||||||
import com.dbnt.kcscbackend.admin.committee.schedules.service.EgovIndvdlSchdulManageService;
|
import com.dbnt.kcscbackend.admin.committee.schedules.service.EgovIndvdlSchdulManageService;
|
||||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.CreatePopupVO;
|
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.FileVO;
|
||||||
|
import com.dbnt.kcscbackend.admin.contents.popUp.model.UpdatePopupVO;
|
||||||
import com.dbnt.kcscbackend.admin.contents.popUp.service.PopUpApiService;
|
import com.dbnt.kcscbackend.admin.contents.popUp.service.PopUpApiService;
|
||||||
import com.dbnt.kcscbackend.admin.contents.popUp.utils.EgovFileMngUtil;
|
import com.dbnt.kcscbackend.admin.contents.popUp.utils.EgovFileMngUtil;
|
||||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||||
|
|
@ -134,13 +135,14 @@ public class PopUpApiController {
|
||||||
public ResultVO contentsApiPopUpManageUpdate(
|
public ResultVO contentsApiPopUpManageUpdate(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
@AuthenticationPrincipal LoginVO loginVO,
|
@AuthenticationPrincipal LoginVO loginVO,
|
||||||
|
UpdatePopupVO updatePopupVO,
|
||||||
@PathVariable("popupId") Long popupId
|
@PathVariable("popupId") Long popupId
|
||||||
) throws Exception {
|
) throws Exception {
|
||||||
|
|
||||||
ResultVO resultVO = new ResultVO();
|
ResultVO resultVO = new ResultVO();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
resultVO = popUpApiService.contentsApiPopUpManageUpdate(resultVO, request, loginVO, popupId);
|
resultVO = popUpApiService.contentsApiPopUpManageUpdate(resultVO, request, loginVO, updatePopupVO, popupId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||||
resultVO.setResultMessage(e.getMessage());
|
resultVO.setResultMessage(e.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -9,23 +9,17 @@ import lombok.ToString;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@ApiModel(value = "CreatePopupVO", description =
|
@ApiModel(value = "UpdatePopupVO", description =
|
||||||
"관리자 단에서 '컨텐츠 관리' > '팝업 관리' 페이지에서 팝업을 추가하는 API에 사용된다." + ""
|
"관리자 단에서 '컨텐츠 관리' > '팝업 관리' 페이지에서 팝업을 수정하는 API에 사용된다." + ""
|
||||||
)
|
)
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ToString
|
@ToString
|
||||||
public class CreatePopupVO implements Serializable {
|
public class UpdatePopupVO extends CreatePopupVO implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 719256850119704956L;
|
private static final long serialVersionUID = 5871943231162448850L;
|
||||||
|
|
||||||
@ApiModelProperty(value = "startDate")
|
@ApiModelProperty(value = "popupId")
|
||||||
private String startDate;
|
private String popupId;
|
||||||
@ApiModelProperty(value = "endDate")
|
|
||||||
private String endDate;
|
|
||||||
@ApiModelProperty(value = "title")
|
|
||||||
private String title;
|
|
||||||
@ApiModelProperty(value = "contents")
|
|
||||||
private String contents;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.dbnt.kcscbackend.admin.contents.popUp.service;
|
package com.dbnt.kcscbackend.admin.contents.popUp.service;
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.CreatePopupVO;
|
import com.dbnt.kcscbackend.admin.contents.popUp.model.CreatePopupVO;
|
||||||
|
import com.dbnt.kcscbackend.admin.contents.popUp.model.UpdatePopupVO;
|
||||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
@ -12,6 +13,7 @@ public interface PopUpApiService {
|
||||||
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception;
|
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception;
|
||||||
public ResultVO contentsApiPopUpManageCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreatePopupVO createPopupVO) throws Exception;
|
public ResultVO contentsApiPopUpManageCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreatePopupVO createPopupVO) throws Exception;
|
||||||
public ResultVO contentsApiPopUpManageRead(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
public ResultVO contentsApiPopUpManageRead(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
||||||
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdatePopupVO updatePopupVO, Long popupId) throws Exception;
|
||||||
|
|
||||||
public ResultVO contentsApiPopUpManageDelete(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
public ResultVO contentsApiPopUpManageDelete(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
@ -3,12 +3,10 @@ package com.dbnt.kcscbackend.admin.contents.popUp.service.impl;
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.CreatePopupVO;
|
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.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.repository.TnPopupMngRepositoryWithoutPopupContents;
|
||||||
import com.dbnt.kcscbackend.admin.contents.popUp.service.PopUpApiService;
|
import com.dbnt.kcscbackend.admin.contents.popUp.service.PopUpApiService;
|
||||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||||
import com.dbnt.kcscbackend.commonCode.entity.TcCodeItem;
|
|
||||||
import com.dbnt.kcscbackend.commonCode.entity.TnCmtEvent;
|
|
||||||
import com.dbnt.kcscbackend.commonCode.entity.TnCmtOrg;
|
|
||||||
import com.dbnt.kcscbackend.commonCode.entity.TnPopupMng;
|
import com.dbnt.kcscbackend.commonCode.entity.TnPopupMng;
|
||||||
import com.dbnt.kcscbackend.commonCode.repository.TnPopupMngRepository;
|
import com.dbnt.kcscbackend.commonCode.repository.TnPopupMngRepository;
|
||||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||||
|
|
@ -16,10 +14,7 @@ import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||||
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
|
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
|
|
@ -116,7 +111,6 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
||||||
//_atchFileId = fileMngService.insertFileInfs(_result); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다.
|
//_atchFileId = fileMngService.insertFileInfs(_result); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다.
|
||||||
}
|
}
|
||||||
|
|
||||||
//call kcsc.sp_add_tn_popup_mng ('팝업제목','2023-08-17 10:00:00','2023-08-23 10:00:00',NULL,'이러저런 내용 ','kcsc_admin',NULL,NULL,NULL,NULL);
|
|
||||||
Map<String, Object> response = tnPopupMngRepository.spAddTnPopupMng(
|
Map<String, Object> response = tnPopupMngRepository.spAddTnPopupMng(
|
||||||
createPopupVO.getTitle(),
|
createPopupVO.getTitle(),
|
||||||
createPopupVO.getStartDate(),
|
createPopupVO.getStartDate(),
|
||||||
|
|
@ -157,7 +151,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
int isValid = tnPopupMngRepository.spIsValidTnCmtEventId( popupId.intValue() );
|
int isValid = tnPopupMngRepository.spIsValidTnPopupMngId( popupId.intValue() );
|
||||||
|
|
||||||
if( isValid == 0 ) {
|
if( isValid == 0 ) {
|
||||||
throw new Exception("대상이 존재하지 않습니다.");
|
throw new Exception("대상이 존재하지 않습니다.");
|
||||||
|
|
@ -181,10 +175,55 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception {
|
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdatePopupVO updatePopupVO, Long popupId) throws Exception {
|
||||||
return null;
|
System.out.println(
|
||||||
|
"\n--------------------------------------------------------------\n" +
|
||||||
|
request.getRequestURI() + " IN:" +
|
||||||
|
"\n--------------------------------------------------------------\n" +
|
||||||
|
"updatePopupVO:" + "\n" +
|
||||||
|
updatePopupVO.toString() + "\n" +
|
||||||
|
"popupId:" + "\n" +
|
||||||
|
popupId + "\n" +
|
||||||
|
"\n--------------------------------------------------------------\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
// 유효성 검사 실시
|
||||||
|
int isValid = tnPopupMngRepository.spIsValidTnPopupMngId( popupId.intValue() );
|
||||||
|
|
||||||
|
if( isValid == 0 ) {
|
||||||
|
throw new Exception("대상이 존재하지 않습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Long.parseLong(updatePopupVO.getStartDate()) > Long.parseLong(updatePopupVO.getEndDate()) ) {
|
||||||
|
throw new Exception("종료일시는 시작일시보다 앞 설 수 없습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> response = tnPopupMngRepository.spUpdateTnPopupMng(
|
||||||
|
popupId.intValue(),
|
||||||
|
updatePopupVO.getTitle(),
|
||||||
|
updatePopupVO.getStartDate(),
|
||||||
|
updatePopupVO.getEndDate(),
|
||||||
|
null,
|
||||||
|
updatePopupVO.getContents(),
|
||||||
|
"kcsc_admin",
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> dto = new HashMap<String, Object>();
|
||||||
|
dto.put("errorMessage", response.get("_error_message") );
|
||||||
|
dto.put("popupId", popupId);
|
||||||
|
|
||||||
|
resultVO.setResult(dto);
|
||||||
|
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||||
|
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||||
|
|
||||||
|
return resultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultVO contentsApiPopUpManageDelete(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception {
|
public ResultVO contentsApiPopUpManageDelete(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,39 @@ public interface TnPopupMngRepository extends JpaRepository<TnPopupMng, TnPopupM
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(value = "CALL sp_update_tn_popup_mng (" +
|
||||||
|
":_popup_seq, " +
|
||||||
|
":_popup_title, " +
|
||||||
|
"TO_TIMESTAMP(" +
|
||||||
|
" :_popup_start_date," +
|
||||||
|
" 'YYYYMMDDHH24MISS'" +
|
||||||
|
")::::timestamptz AT TIME ZONE 'UTC', " +
|
||||||
|
"TO_TIMESTAMP(" +
|
||||||
|
" :_popup_end_date," +
|
||||||
|
" 'YYYYMMDDHH24MISS'" +
|
||||||
|
")::::timestamptz AT TIME ZONE 'UTC', " +
|
||||||
|
":_file_grp_id, " +
|
||||||
|
":_popup_contents, " +
|
||||||
|
":_modi_id, " +
|
||||||
|
":_result_count, " +
|
||||||
|
":_result_code, " +
|
||||||
|
":_error_message)",
|
||||||
|
nativeQuery = true)
|
||||||
|
Map<String, Object> spUpdateTnPopupMng(
|
||||||
|
@Param("_popup_seq") Integer popupSeq,
|
||||||
|
@Param("_popup_title") String popupTitle,
|
||||||
|
@Param("_popup_start_date") String popupStartDate,
|
||||||
|
@Param("_popup_end_date") String popupEndDate,
|
||||||
|
@Param("_file_grp_id") String fileGrpId,
|
||||||
|
@Param("_popup_contents") String popupContents,
|
||||||
|
@Param("_modi_id") String modiId,
|
||||||
|
@Param("_result_count") Integer resultCount,
|
||||||
|
@Param("_result_code") String resultCode,
|
||||||
|
@Param("_error_message") String errorMessage
|
||||||
|
);
|
||||||
|
|
||||||
@Procedure("sp_is_valid_tn_popup_mng_id")
|
@Procedure("sp_is_valid_tn_popup_mng_id")
|
||||||
int spIsValidTnCmtEventId( Integer popupSeq );
|
int spIsValidTnPopupMngId( Integer popupSeq );
|
||||||
|
|
||||||
TnPopupMng findByPopupSeq(Long popupSeq);
|
TnPopupMng findByPopupSeq(Long popupSeq);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue