parent
7d45bc37a8
commit
f380e08cbb
|
|
@ -15,7 +15,7 @@ export function requestFetch(url, requestOptions, handler, errorHandler) {
|
|||
|
||||
// Login 했을경우 JWT 설정
|
||||
const sessionUser = getSessionItem('loginUser');
|
||||
const sessionUserId = sessionUser?.id || null;
|
||||
const sessionUserId = sessionUser?.userId || null;
|
||||
const jToken = getSessionItem('jToken');
|
||||
if(sessionUserId != null && sessionUserId !== undefined){
|
||||
if( !requestOptions['headers'] ) requestOptions['headers']={}
|
||||
|
|
|
|||
|
|
@ -335,4 +335,5 @@
|
|||
|
||||
/*기준코드 뷰어*/
|
||||
.titleCheckBox ~ p {display: inline}
|
||||
.errorText{display: inline; cursor: pointer}
|
||||
.detailInfoDiv > div > input {margin-right: 5px;}
|
||||
|
|
@ -10,6 +10,7 @@ import Col from 'react-bootstrap/Col';
|
|||
import Modal from 'react-bootstrap/Modal';
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
import {getSessionItem} from "../../utils/storage";
|
||||
import CODE from "../../constants/code";
|
||||
|
||||
function CodeViewer(props) {
|
||||
const [treeLoading, setTreeLoading] = useState(true);
|
||||
|
|
@ -83,13 +84,6 @@ function CodeViewer(props) {
|
|||
);
|
||||
}
|
||||
|
||||
const chkboxControll = () => {
|
||||
const flag = this.checked;
|
||||
const checkBoxList = document.querySelectorAll('.'+this.id.replace('chk', ''))
|
||||
checkBoxList.forEach((input)=>{
|
||||
input.checked = flag
|
||||
})
|
||||
}
|
||||
|
||||
const getCodeDetailInfo = useCallback((docCode) => {
|
||||
console.groupCollapsed("EgovMain.getCodeDetailInfo()");
|
||||
|
|
@ -143,7 +137,7 @@ function CodeViewer(props) {
|
|||
item.full_content = "<input type='checkbox' " +
|
||||
"class='titleCheckBox "+parentContCd+"' " +
|
||||
"id='"+item.cont_type_cd+"chk' " +
|
||||
`onclick="const flag = this.checked; document.querySelectorAll('.'+this.id.replace('chk', '')).forEach((input)=>{input.checked = flag})"` +
|
||||
// `onclick="const flag = this.checked; document.querySelectorAll('.'+this.id.replace('chk', '')).forEach((input)=>{input.checked = flag})"` +
|
||||
// "onClick={chkboxControll} "+
|
||||
">"+item.full_content;
|
||||
if(index!==0 && item.cont_level===1 && item.cont_order !== 1){
|
||||
|
|
@ -187,7 +181,18 @@ function CodeViewer(props) {
|
|||
item.full_content = item.full_content.replace('<table ', '<table class="table table-bordered "')
|
||||
}
|
||||
if(item.error_cd !== null){
|
||||
item.full_content = "<p class='errorText'>"+item.error_cd+"</p><br>"+item.full_content;
|
||||
if(sessionUserSe === "ADM"){
|
||||
item.full_content = "<p class='errorText'>"+item.error_cd+"</p><br>"+
|
||||
"<div class='input-group w-25 d-none errorEditDiv'>" +
|
||||
"<input type='hidden' class='contTypeCd' value='"+item.cont_type_cd+"' />"+
|
||||
"<input type='text' class='form-control form-control-sm errorCd' value='"+item.error_cd+"'/>"+
|
||||
"<button class='btn btn-sm btn-primary errorEditSaveBtn'>저장</button>"+
|
||||
"<button class='btn btn-sm btn-secondary errorEditCancelBtn'>취소</button>"+
|
||||
"</div>"+
|
||||
item.full_content;
|
||||
}else{
|
||||
item.full_content = "<p class='errorText'>"+item.error_cd+"</p><br>"+item.full_content;
|
||||
}
|
||||
}
|
||||
item.full_content = item.full_content+"<hr>"
|
||||
detailTag.push(
|
||||
|
|
@ -208,21 +213,101 @@ function CodeViewer(props) {
|
|||
console.groupEnd("EgovMain.getCodeDetailInfo()");
|
||||
},[]);
|
||||
|
||||
const bookmarkBtnActionAppend = (el) =>{
|
||||
const actionAppend = (el) => {
|
||||
if(!el) return;
|
||||
if(el.childNodes.length===0){
|
||||
return
|
||||
}else{
|
||||
const bookmarkList = el.getElementsByClassName("bookmark")
|
||||
for(let bookmark of bookmarkList){
|
||||
bookmark.onclick = (e) => {
|
||||
handleShow();
|
||||
const params = e.currentTarget.dataset
|
||||
setBookMarkModal(<BookmarkModal docCode={params.doccode} docPart={params.docpart}/>)
|
||||
}
|
||||
bookmarkBtnActionAppend(el)
|
||||
checkboxActionAppend(el)
|
||||
if(sessionUserSe === "ADM"){
|
||||
errorTextActionAppend(el)
|
||||
errorEditSaveBtnActionAppend(el)
|
||||
errorEditCancelBtnActionAppend(el)
|
||||
}
|
||||
}
|
||||
}
|
||||
const bookmarkBtnActionAppend = (el) => {
|
||||
const bookmarkList = el.getElementsByClassName("bookmark")
|
||||
for(let bookmark of bookmarkList){
|
||||
bookmark.onclick = (e) => {
|
||||
handleShow();
|
||||
const params = e.currentTarget.dataset
|
||||
setBookMarkModal(<BookmarkModal docCode={params.doccode} docPart={params.docpart}/>)
|
||||
}
|
||||
}
|
||||
}
|
||||
const checkboxActionAppend = (el) => {
|
||||
const checkboxList = el.getElementsByClassName("titleCheckBox")
|
||||
for(let checkbox of checkboxList){
|
||||
checkbox.onclick = (e) => {
|
||||
const flag = e.target.checked;
|
||||
const childCheckboxList = document.querySelectorAll('.'+e.target.id.replace('chk', ''))
|
||||
childCheckboxList.forEach((child)=> {
|
||||
child.checked = flag
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
const errorTextActionAppend = (el) => {
|
||||
const errorTextList = el.getElementsByClassName("errorText")
|
||||
for(let errorText of errorTextList){
|
||||
errorText.onclick = (e) => {
|
||||
e.target.parentElement.querySelector(".errorText").className = "errorText d-none"
|
||||
e.target.parentElement.querySelector(".errorEditDiv").className = "input-group w-25 errorEditDiv"
|
||||
}
|
||||
}
|
||||
}
|
||||
const errorEditSaveBtnActionAppend = (el) => {
|
||||
const saveBtnList = el.getElementsByClassName("errorEditSaveBtn")
|
||||
for(let saveBtn of saveBtnList){
|
||||
saveBtn.onclick = (e) => {
|
||||
const errorEditDiv = e.target.parentElement;
|
||||
const content = {
|
||||
contTypeCd: errorEditDiv.querySelector(".contTypeCd").value,
|
||||
errorCd: errorEditDiv.querySelector(".errorCd").value
|
||||
}
|
||||
saveErrorCd(content)
|
||||
errorEditDiv.parentElement.querySelector(".errorText").innerText = content.errorCd
|
||||
hideErrorEditDiv(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
const errorEditCancelBtnActionAppend = (el) => {
|
||||
const cancelBtnList = el.getElementsByClassName("errorEditCancelBtn")
|
||||
for(let cancelBtn of cancelBtnList){
|
||||
cancelBtn.onclick = (e) => {
|
||||
hideErrorEditDiv(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hideErrorEditDiv(e){
|
||||
const contentDiv = e.target.parentElement.parentElement;
|
||||
contentDiv.querySelector(".errorText").className = "errorText"
|
||||
contentDiv.querySelector(".errorEditDiv").className = "input-group w-25 errorEditDiv d-none"
|
||||
contentDiv.querySelector(".errorCd").value = contentDiv.querySelector(".errorText").innerText;
|
||||
}
|
||||
|
||||
function saveErrorCd(content){
|
||||
EgovNet.requestFetch(
|
||||
'/standardCode/saveErrorCd.do',
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(content)
|
||||
},
|
||||
(resp) => {
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
alert("저장되었습니다.")
|
||||
}else{
|
||||
alert("저장에 실패하였습니다.")
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getCodeTree();
|
||||
|
|
@ -247,7 +332,7 @@ function CodeViewer(props) {
|
|||
<Col xs={2} className="border-end viewerDiv">
|
||||
{docSummary}
|
||||
</Col>
|
||||
<Col xs={7} className="viewerDiv detailInfoDiv" ref={bookmarkBtnActionAppend}>
|
||||
<Col xs={7} className="viewerDiv detailInfoDiv" ref={actionAppend}>
|
||||
{docDetail}
|
||||
</Col>
|
||||
</Row>
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
|||
loginVO.setId(id);
|
||||
loginVO.setUserSe( jwtTokenUtil.getUserSeFromToken(jwtToken) );
|
||||
loginVO.setUniqId( jwtTokenUtil.getInfoFromToken("uniqId",jwtToken) );
|
||||
loginVO.setOrgnztId( jwtTokenUtil.getInfoFromToken("orgnztId",jwtToken) );
|
||||
loginVO.setName( jwtTokenUtil.getInfoFromToken("name",jwtToken) );
|
||||
// loginVO.setOrgnztId( jwtTokenUtil.getInfoFromToken("orgnztId",jwtToken) );
|
||||
// loginVO.setName( jwtTokenUtil.getInfoFromToken("name",jwtToken) );
|
||||
|
||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(loginVO, null,
|
||||
Arrays.asList(new SimpleGrantedAuthority("ROLE_USER"))
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
|||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentCodeList;
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentContent;
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentInfo;
|
||||
import com.dbnt.kcscbackend.standardCode.service.StandardCodeService;
|
||||
import com.dbnt.kcscbackend.standardCode.service.StandardCodeVO;
|
||||
|
|
@ -21,6 +22,7 @@ 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.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -87,6 +89,33 @@ public class StandardCodeController extends BaseController {
|
|||
return resultVO;
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "건설기준코드 트리 조회",
|
||||
description = "건설기준코드 트리 조회",
|
||||
tags = {"StandardCodeController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "저장 성공"),
|
||||
@ApiResponse(responseCode = "300", description = "저장 실패"),
|
||||
@ApiResponse(responseCode = "303", description = "만료된 토큰"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/saveErrorCd.do", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResultVO saveErrorCd(@RequestBody TnDocumentContent content, @AuthenticationPrincipal LoginVO user, HttpServletRequest req) throws Exception {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
if(user == null){
|
||||
resultVO.setResultCode(303);
|
||||
}else{
|
||||
if(!user.getUserSe().equals("ADM")){
|
||||
resultVO.setResultCode(403);
|
||||
}else{
|
||||
standardCodeService.saveErrorCd(content);
|
||||
resultVO.setResultCode(200);
|
||||
}
|
||||
}
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "건설기준코드 리스트 조회",
|
||||
|
|
|
|||
|
|
@ -7,10 +7,13 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface TnDocumentContentRepository extends JpaRepository<TnDocumentContent, Integer> {
|
||||
|
||||
@Query(value = "select * from get_recent_full_context_by_content(:docCode, :docPart)", nativeQuery = true)
|
||||
public List<StandardCodeContentInterface> getRecentFullContextByContent(String docCode, String docPart);
|
||||
List<StandardCodeContentInterface> getRecentFullContextByContent(String docCode, String docPart);
|
||||
|
||||
Optional<TnDocumentContent> findByContTypeCd(String contTypeCd);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.dbnt.kcscbackend.standardCode.service;
|
||||
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentCodeList;
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentContent;
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentInfo;
|
||||
import com.dbnt.kcscbackend.standardCode.mapper.StandardCodeMapper;
|
||||
import com.dbnt.kcscbackend.standardCode.repository.TnDocumentContentRepository;
|
||||
|
|
@ -21,6 +22,14 @@ public class StandardCodeService extends EgovAbstractServiceImpl {
|
|||
private final TnDocumentContentRepository tnDocumentContentRepository;
|
||||
private final StandardCodeMapper standardCodeMapper;
|
||||
|
||||
@Transactional
|
||||
public void saveErrorCd(TnDocumentContent content) {
|
||||
TnDocumentContent saveContent = tnDocumentContentRepository.findByContTypeCd(content.getContTypeCd()).orElse(null);
|
||||
if(saveContent!=null){
|
||||
saveContent.setErrorCd(content.getErrorCd());
|
||||
}
|
||||
}
|
||||
|
||||
public List<StandardCodeTreeInterface> selectStandardCodeTree(){
|
||||
return tnDocumentGroupRepository.spGetTnDocumentCodeByTree();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue