설문관리 작업중.

thkim
강석 최 2024-03-05 18:07:54 +09:00
parent a4441cc083
commit e0c2aab3ea
11 changed files with 313 additions and 25 deletions

View File

@ -193,6 +193,24 @@
.roleList .result .list_item .checkboxDiv {width: 60px;}
.roleList .result .list_item .saveBtnDiv {width: 100px;}
/*사이트 관리 > 컨텐츠 관리 > 설문 관리*/
.surveyList .head > span:nth-child(1) {width: 250px;}
.surveyList .head > span:nth-child(2) {width: 150px;}
.surveyList .head > span:nth-child(3) {width: 100px;}
.surveyList .head > span:nth-child(4) {width: 100px;}
.surveyList .head > span:nth-child(5) {width: 120px;}
.surveyList .head > span:nth-child(6) {width: 100px;}
.surveyList .head > span:nth-child(7) {width: 80px;}
.surveyList .head > span:nth-child(8) {width: 80px;}
.surveyList .result .list_item > div:nth-child(1) {width: 250px;}
.surveyList .result .list_item > div:nth-child(2) {width: 150px;}
.surveyList .result .list_item > div:nth-child(3) {width: 100px;}
.surveyList .result .list_item > div:nth-child(4) {width: 100px;}
.surveyList .result .list_item > div:nth-child(5) {width: 120px;}
.surveyList .result .list_item > div:nth-child(6) {width: 100px;}
.surveyList .result .list_item > div:nth-child(7) {width: 80px;}
.surveyList .result .list_item > div:nth-child(8) {width: 80px;}
/* 사이트소개 */
.SITE_INTRO .ds_1 .t_1 {margin-top: 52px; color: #000; font-size: 26px; font-weight: 500; text-align: center;}
.SITE_INTRO .ds_1 .li_1 {position: relative; margin-top: 34px; font-size: 0; text-align: center;}

View File

@ -1,49 +1,112 @@
import React from 'react';
import React, {useCallback, useEffect, useState} from 'react';
import { Link } from 'react-router-dom';
import URL from 'constants/url';
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
import * as EgovNet from "../../../api/egovFetch";
import Modal from "react-bootstrap/Modal";
function Survey(props) {
function Survey({}) {
const Location = React.memo(function Location() {
return (
<div className="location">
<ul>
<li><Link to={URL.MAIN} className="home">Home</Link></li>
<li><Link to={URL.ADMIN}>사이트 관리</Link></li>
<li>컨텐츠 관리</li>
<li>설문 관리</li>
</ul>
</div>
)
});
const [listTag, setListTag] = useState([]);
const [show, setShow] = useState(false);
const [modalBody, setModalBody] = useState();
const handleClose = () => setShow(false);
const handleShow = () => setShow(true);
const retrieveList = useCallback(() => {
handleClose()
EgovNet.requestFetch(
'/admin/survey/list',
{
method: "GET"
},
(resp) => {
let mutListTag = [];
setListTag([]);
//
resp.result.surveyList.forEach(function (item, index) {
mutListTag.push(
<div className={"list_item"} key={"surveyListDiv_"+index}>
<div>{item.svyTitle}</div>
<div>{item.svyStartDt}~{item.svyEndDt}</div>
<div><button className={"btn btn_blue_h31 px-1"}>질문관리</button></div>
<div></div>
<div><button className={"btn btn_blue_h31 px-1"}>설문지 보기</button></div>
<div><button className={"btn btn_blue_h31 px-1"}>통계 보기</button></div>
<div>
<button className={"btn btn_blue_h31 px-1"} onClick={()=>{editSurvey(item)}}>수정</button>
</div>
<div>
<button className={"btn btn_red_h31 px-1"} onClick={()=>{editSurvey(item)}}>삭제</button>
</div>
</div>
);
});
if(!mutListTag.length) mutListTag.push(<p className="no_data" key="0">검색된 결과가 없습니다.</p>); //
setListTag(mutListTag);
},
function (resp) {
console.log("err response : ", resp);
}
);
},[]);
function editSurvey(){
handleShow();
setModalBody(<></>);
}
useEffect(()=>{
retrieveList();
}, [])
return (
<div className="container">
<div className="c_wrap">
{/* <!-- Location --> */}
<Location />
{/* <!--// Location --> */}
<div className="location">
<ul>
<li><Link to={URL.MAIN} className="home">Home</Link></li>
<li><Link to={URL.ADMIN}>사이트 관리</Link></li>
<li>컨텐츠 관리</li>
<li>설문 관리</li>
</ul>
</div>
<div className="layout">
{/* <!-- Navigation --> */}
<EgovLeftNav></EgovLeftNav>
{/* <!--// Navigation --> */}
<div className="contents " id="contents">
{/* <!-- 본문 --> */}
<div className="top_tit">
<h1 className="tit_1">설문 관리</h1>
</div>
여기에 구현해주세요.
{/* <!--// 본문 --> */}
<div className="board_list surveyList">
<div className="head">
<span>제목</span>
<span>참여기한</span>
<span>질문관리</span>
<span>사용여부</span>
<span>설문지 보기</span>
<span>통계 보기</span>
<span></span>
<span><button className={"btn btn_blue_h31 px-1"} onClick={()=>{editSurvey(undefined)}}>추가</button></span>
</div>
<div className="result">
{listTag}
</div>
</div>
</div>
</div>
</div>
<Modal show={show} onHide={handleClose} keyboard={false}>
{modalBody}
</Modal>
</div>
);
}

View File

@ -1,11 +1,9 @@
package com.dbnt.kcscbackend.admin.config;
import com.dbnt.kcscbackend.admin.boards.entity.TnBbs;
import com.dbnt.kcscbackend.admin.config.entity.TcMenu;
import com.dbnt.kcscbackend.admin.config.entity.TnPartnerSite;
import com.dbnt.kcscbackend.admin.config.model.CreateCommitteeCodeManagementVO;
import com.dbnt.kcscbackend.admin.config.service.AdminCommitteeCodeManagementService;
import com.dbnt.kcscbackend.admin.standardResearch.service.AdminStandardResearchService;
import com.dbnt.kcscbackend.commonCode.entity.TcCodeGrp;
import com.dbnt.kcscbackend.commonCode.entity.TcCodeItem;
import com.dbnt.kcscbackend.admin.config.service.AdminConfigService;
@ -20,7 +18,6 @@ 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 lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.MediaType;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.validation.Errors;

View File

@ -0,0 +1,33 @@
package com.dbnt.kcscbackend.admin.contents.survey;
import com.dbnt.kcscbackend.admin.contents.survey.service.AdminSurveyService;
import com.dbnt.kcscbackend.auth.entity.LoginVO;
import com.dbnt.kcscbackend.config.common.ResultVO;
import com.dbnt.kcscbackend.config.util.ClientUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequiredArgsConstructor
@RequestMapping("/admin/survey")
public class AdminSurveyController {
private final AdminSurveyService adminSurveyService;
@RequestMapping(method = RequestMethod.GET, value = "/list")
public ResultVO getSurveyList(HttpServletRequest request, @AuthenticationPrincipal LoginVO user) throws Exception{
ResultVO resultVO = new ResultVO();
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("surveyList", adminSurveyService.selectSurveyList());
resultVO.setResult(resultMap);
return resultVO;
}
}

View File

@ -0,0 +1,52 @@
package com.dbnt.kcscbackend.admin.contents.survey.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "tn_survey")
public class TnSurvey {
@Id
@Column(name = "svy_seq")
private Integer svySeq;
@Column(name = "svy_title")
private String svyTitle;
@Column(name = "svy_desc")
private String svyDesc;
@Column(name = "svy_start_dt")
private LocalDate svyStartDt;
@Column(name = "svy_end_dt")
private LocalDate svyEndDt;
@Column(name = "file_grp_id")
private String fileGrpId;
@Column(name = "svy_subcnt")
private Integer svySubcnt;
@Column(name = "frst_crt_id")
private String frstCrtId;
@Column(name = "frst_crt_dt")
private LocalDateTime frstCrtDt;
@Column(name = "last_chg_id")
private String lastChgId;
@Column(name = "last_chg_dt")
private LocalDateTime lastChgDt;
@Column(name = "use_yn")
private String useYn;
@Column(name = "old_seq")
private Integer oldSeq;
}

View File

@ -0,0 +1,44 @@
package com.dbnt.kcscbackend.admin.contents.survey.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "tn_survey_qt")
public class TnSurveyQt {
@Id
@Column(name = "qt_seq")
private Integer qtSeq;
@Column(name = "svy_seq")
private Integer svySeq;
@Column(name = "qt_title")
private String qtTitle;
@Column(name = "qt_desc")
private String qtDesc;
@Column(name = "qt_type")
private Integer qtType;
@Column(name = "max_no")
private Integer maxNo;
@Column(name = "mandatory_yn")
private String mandatoryYn;
@Column(name = "etc_yn")
private String etcYn;
@Column(name = "old_seq")
private Integer oldSeq;
}

View File

@ -0,0 +1,34 @@
package com.dbnt.kcscbackend.admin.contents.survey.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "tn_survey_qt_item")
public class TnSurveyQtItem {
@Id
@Column(name = "qt_item_seq")
private Integer qtItemSeq;
@Column(name = "qt_seq")
private Integer qtSeq;
@Column(name = "item_nm")
private String itemNm;
@Column(name = "question_yn")
private String questionYn;
@Column(name = "old_seq")
private Integer oldSeq;
}

View File

@ -0,0 +1,7 @@
package com.dbnt.kcscbackend.admin.contents.survey.repository;
import com.dbnt.kcscbackend.admin.contents.survey.entity.TnSurveyQtItem;
import org.springframework.data.jpa.repository.JpaRepository;
public interface TnSurveyQtItemRepository extends JpaRepository<TnSurveyQtItem, Integer> {
}

View File

@ -0,0 +1,7 @@
package com.dbnt.kcscbackend.admin.contents.survey.repository;
import com.dbnt.kcscbackend.admin.contents.survey.entity.TnSurveyQt;
import org.springframework.data.jpa.repository.JpaRepository;
public interface TnSurveyQtRepository extends JpaRepository<TnSurveyQt, Integer> {
}

View File

@ -0,0 +1,11 @@
package com.dbnt.kcscbackend.admin.contents.survey.repository;
import com.dbnt.kcscbackend.admin.contents.survey.entity.TnSurvey;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface TnSurveyRepository extends JpaRepository<TnSurvey, Integer> {
List<TnSurvey> findAllByOrderBySvySeqDesc();
}

View File

@ -0,0 +1,22 @@
package com.dbnt.kcscbackend.admin.contents.survey.service;
import com.dbnt.kcscbackend.admin.contents.survey.entity.TnSurvey;
import com.dbnt.kcscbackend.admin.contents.survey.repository.TnSurveyQtItemRepository;
import com.dbnt.kcscbackend.admin.contents.survey.repository.TnSurveyQtRepository;
import com.dbnt.kcscbackend.admin.contents.survey.repository.TnSurveyRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
public class AdminSurveyService {
private final TnSurveyRepository surveyRepository;
private final TnSurveyQtRepository qtRepository;
private final TnSurveyQtItemRepository itemRepository;
public List<TnSurvey> selectSurveyList() {
return surveyRepository.findAllByOrderBySvySeqDesc();
}
}