diff --git a/egovframe-template-simple-react-contribution/src/api/egovFetch.js b/egovframe-template-simple-react-contribution/src/api/egovFetch.js
index 274f208..39ce795 100644
--- a/egovframe-template-simple-react-contribution/src/api/egovFetch.js
+++ b/egovframe-template-simple-react-contribution/src/api/egovFetch.js
@@ -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']={}
diff --git a/egovframe-template-simple-react-contribution/src/css/page.css b/egovframe-template-simple-react-contribution/src/css/page.css
index 36f92fa..4bc46a3 100644
--- a/egovframe-template-simple-react-contribution/src/css/page.css
+++ b/egovframe-template-simple-react-contribution/src/css/page.css
@@ -335,4 +335,5 @@
/*기준코드 뷰어*/
.titleCheckBox ~ p {display: inline}
+.errorText{display: inline; cursor: pointer}
.detailInfoDiv > div > input {margin-right: 5px;}
\ No newline at end of file
diff --git a/egovframe-template-simple-react-contribution/src/pages/standardCode/viewer.js b/egovframe-template-simple-react-contribution/src/pages/standardCode/viewer.js
index 6230fdc..932dc01 100644
--- a/egovframe-template-simple-react-contribution/src/pages/standardCode/viewer.js
+++ b/egovframe-template-simple-react-contribution/src/pages/standardCode/viewer.js
@@ -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.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('
"+item.full_content;
+ if(sessionUserSe === "ADM"){
+ item.full_content = ""+item.error_cd+"
"+
+ "" +
+ ""+
+ ""+
+ ""+
+ ""+
+ "
"+
+ item.full_content;
+ }else{
+ item.full_content = ""+item.error_cd+"
"+item.full_content;
+ }
}
item.full_content = item.full_content+"
"
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()
- }
+ 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()
+ }
+ }
+ }
+ 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) {
{docSummary}
-
+
{docDetail}
diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/config/jwt/JwtAuthenticationFilter.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/config/jwt/JwtAuthenticationFilter.java
index 1a830ee..806f247 100644
--- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/config/jwt/JwtAuthenticationFilter.java
+++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/config/jwt/JwtAuthenticationFilter.java
@@ -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"))
diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/standardCode/StandardCodeController.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/standardCode/StandardCodeController.java
index 63782da..cdffffe 100644
--- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/standardCode/StandardCodeController.java
+++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/standardCode/StandardCodeController.java
@@ -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 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 = "건설기준코드 리스트 조회",
diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/standardCode/repository/TnDocumentContentRepository.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/standardCode/repository/TnDocumentContentRepository.java
index 4a3812b..fbd7079 100644
--- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/standardCode/repository/TnDocumentContentRepository.java
+++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/standardCode/repository/TnDocumentContentRepository.java
@@ -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 {
@Query(value = "select * from get_recent_full_context_by_content(:docCode, :docPart)", nativeQuery = true)
- public List getRecentFullContextByContent(String docCode, String docPart);
+ List getRecentFullContextByContent(String docCode, String docPart);
+
+ Optional findByContTypeCd(String contTypeCd);
}
diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/standardCode/service/StandardCodeService.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/standardCode/service/StandardCodeService.java
index 5f97fa7..b619a4a 100644
--- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/standardCode/service/StandardCodeService.java
+++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/standardCode/service/StandardCodeService.java
@@ -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 selectStandardCodeTree(){
return tnDocumentGroupRepository.spGetTnDocumentCodeByTree();
}