Merge branch 'master' of http://118.219.150.34:50501/DBNT/kcscDev
# Conflicts: # kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/AdminConfigController.java # kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminConfigService.javathkim
commit
12feac5480
|
|
@ -7,7 +7,7 @@ import DialogContent from '@mui/material/DialogContent';
|
||||||
import DialogContentText from '@mui/material/DialogContentText';
|
import DialogContentText from '@mui/material/DialogContentText';
|
||||||
import DialogTitle from '@mui/material/DialogTitle';
|
import DialogTitle from '@mui/material/DialogTitle';
|
||||||
|
|
||||||
export default function FormDialog( {open, setOpen, title, contentText, children} ) {
|
export default function FormDialog( {open, setOpen, title, contentText, children, handleOk} ) {
|
||||||
|
|
||||||
const handleClickOpen = () => {
|
const handleClickOpen = () => {
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
|
|
@ -43,7 +43,7 @@ export default function FormDialog( {open, setOpen, title, contentText, children
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={handleClose}>취소</Button>
|
<Button onClick={handleClose}>취소</Button>
|
||||||
<Button type="submit">저장</Button>
|
<Button type="button" onClick={handleOk}>저장</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,6 @@ import Grid from '@mui/material/Grid';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import DeleteIcon from '@mui/icons-material/Delete';
|
import DeleteIcon from '@mui/icons-material/Delete';
|
||||||
import AddIcon from '@mui/icons-material/Add';
|
import AddIcon from '@mui/icons-material/Add';
|
||||||
import TextField from '@mui/material/TextField';
|
|
||||||
|
|
||||||
import FormDialog from '../../components/alert/FormDialog';
|
|
||||||
|
|
||||||
import styledComponent from "styled-components";
|
import styledComponent from "styled-components";
|
||||||
|
|
||||||
|
|
@ -26,19 +23,27 @@ const StyledDiv = styledComponent.div`
|
||||||
|
|
||||||
function generate(items, element, onClickListner,nameKey,
|
function generate(items, element, onClickListner,nameKey,
|
||||||
idKey) {
|
idKey) {
|
||||||
return items.map((value, index) =>
|
|
||||||
React.cloneElement(element, {
|
let returnValue = [];
|
||||||
key: value[nameKey],
|
let nIndex = 0;
|
||||||
},
|
Object.keys(items).forEach(function(key) {
|
||||||
<Card className="text-item" sx={{ '&': { boxShadow: 'none' } }} data-index={index} onClick={(e) => {onClickListner(e, index);}}>
|
returnValue = [
|
||||||
<CardActionArea sx={{ px: 1 }}>
|
...returnValue,
|
||||||
<ListItemText
|
React.cloneElement(element, {
|
||||||
primary={value[nameKey]}
|
key,
|
||||||
key={index}
|
},
|
||||||
/>
|
<Card className="text-item" sx={{ '&': { boxShadow: 'none' } }} key={key} data-index={nIndex} onClick={(e) => {onClickListner(e, key);}}>
|
||||||
</CardActionArea>
|
<CardActionArea sx={{ px: 1 }}>
|
||||||
</Card>),
|
<ListItemText
|
||||||
);
|
primary={items[key][nameKey]}
|
||||||
|
key={key}
|
||||||
|
/>
|
||||||
|
</CardActionArea>
|
||||||
|
</Card>),
|
||||||
|
];
|
||||||
|
nIndex++;
|
||||||
|
});
|
||||||
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Demo = styled('div')(({ theme }) => ({
|
const Demo = styled('div')(({ theme }) => ({
|
||||||
|
|
@ -55,32 +60,36 @@ const Item = styled(Paper)(({ theme }) => ({
|
||||||
|
|
||||||
function ListCreateUpdateDelete(props) {
|
function ListCreateUpdateDelete(props) {
|
||||||
|
|
||||||
const [dense, setDense] = React.useState(false);
|
|
||||||
|
|
||||||
const [open, setOpen] = React.useState(false);
|
|
||||||
|
|
||||||
const handleClickOpen = () => {
|
const handleClickOpen = () => {
|
||||||
setOpen(true);
|
if( props.depthSelectedArrayIndex === 0 ) {
|
||||||
};
|
props.setCreateCondition({...props.createCondition, paramCodeLevel : props.paramCodeLevel, paramOrgId : "00"});
|
||||||
|
} else {
|
||||||
const handleClose = () => {
|
if( props.itemIndex[props.depthSelectedArrayIndex-1] === undefined ) {
|
||||||
setOpen(false);
|
alert('상위 코드를 선택해주세요.');
|
||||||
|
props.setIsPopupOpen(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
props.setCreateCondition({...props.createCondition, paramCodeLevel : props.paramCodeLevel, paramOrgId : props.itemIndex[props.depthSelectedArrayIndex-1]});
|
||||||
|
}
|
||||||
|
props.setIsPopupOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClickItem = (e, index) => {
|
const onClickItem = (e, index) => {
|
||||||
|
index = Number(index);
|
||||||
// 기존 active를 모두 해제 한다.
|
// 기존 active를 모두 해제 한다.
|
||||||
let siblingEle = e.currentTarget.parentNode.parentNode.firstChild;
|
let siblingEle = e.currentTarget.parentNode.parentNode.firstChild;
|
||||||
do {
|
do {
|
||||||
siblingEle.firstChild.classList.remove('active');
|
siblingEle.firstChild.classList.remove('active');
|
||||||
|
// eslint-disable-next-line no-cond-assign
|
||||||
} while (siblingEle = siblingEle.nextSibling);
|
} while (siblingEle = siblingEle.nextSibling);
|
||||||
|
|
||||||
// 선택된 것만 active로 지정한다.
|
e.currentTarget.classList.add('active');
|
||||||
if( Number(e.currentTarget.getAttribute('data-index')) === index ) {
|
const myKey = Number(index);
|
||||||
e.currentTarget.classList.add('active');
|
props.itemIndex[props.depthSelectedArrayIndex] = myKey;
|
||||||
}
|
let forChangeObject = [...props.itemIndex];
|
||||||
props.setItemIndex(index);
|
props.setItemIndex(forChangeObject);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledDiv>
|
<StyledDiv>
|
||||||
<Paper>
|
<Paper>
|
||||||
|
|
@ -99,7 +108,7 @@ function ListCreateUpdateDelete(props) {
|
||||||
</Grid>
|
</Grid>
|
||||||
</Typography>
|
</Typography>
|
||||||
<Demo>
|
<Demo>
|
||||||
<List dense={dense} sx={{ px: 0, '&': { height: '253px', overflowY: 'auto'}}}>
|
<List dense={false} sx={{ px: 0, '&': { height: '253px', overflowY: 'auto'}}}>
|
||||||
{generate(
|
{generate(
|
||||||
props.items,
|
props.items,
|
||||||
<ListItem
|
<ListItem
|
||||||
|
|
@ -112,38 +121,15 @@ function ListCreateUpdateDelete(props) {
|
||||||
<DeleteIcon />
|
<DeleteIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
</ListItem>,
|
</ListItem>,
|
||||||
onClickItem,
|
onClickItem,
|
||||||
props.nameKey,
|
props.nameKey,
|
||||||
props.idKey
|
props.idKey
|
||||||
)}
|
)}
|
||||||
</List>
|
</List>
|
||||||
</Demo>
|
</Demo>
|
||||||
<FormDialog open={open} setOpen={setOpen} title="위원회 코드 등록" contentText="위원회 코드 항목을 입력해주세요." >
|
|
||||||
<TextField
|
|
||||||
autoFocus
|
|
||||||
required
|
|
||||||
margin="dense"
|
|
||||||
id="insert-org-nm"
|
|
||||||
name="insert-org-nm"
|
|
||||||
label="명칭"
|
|
||||||
type="text"
|
|
||||||
fullWidth
|
|
||||||
variant="standard"
|
|
||||||
/>
|
|
||||||
<TextField
|
|
||||||
required
|
|
||||||
margin="dense"
|
|
||||||
id="insert-org-desc"
|
|
||||||
name="insert-org-desc"
|
|
||||||
label="위원회 설명"
|
|
||||||
type="text"
|
|
||||||
fullWidth
|
|
||||||
variant="standard"
|
|
||||||
/>
|
|
||||||
</FormDialog>
|
|
||||||
</Paper>
|
</Paper>
|
||||||
</StyledDiv>
|
</StyledDiv>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import * as EgovNet from 'api/egovFetch';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import CommitteeCodeRegistrationPopup from './CommitteeCodeMgt/CommitteeCodeRegistrationPopup';
|
||||||
|
|
||||||
import ListCreateUpdateDelete from '../../../components/list/ListCreateUpdateDelete'
|
import ListCreateUpdateDelete from '../../../components/list/ListCreateUpdateDelete'
|
||||||
import ListLabelInputs from '../../../components/list/ListLabelInputs'
|
import ListLabelInputs from '../../../components/list/ListLabelInputs'
|
||||||
|
|
||||||
|
|
@ -19,49 +21,63 @@ import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
||||||
function CommitteeCodeMgt(props) {
|
function CommitteeCodeMgt(props) {
|
||||||
|
|
||||||
const [searchCondition, setSearchCondition] = useState({ paramCodeGroup: null, paramCodeLevel: 'LV_01' });
|
const [searchCondition, setSearchCondition] = useState({ paramCodeGroup: null, paramCodeLevel: 'LV_01' });
|
||||||
|
const [createCondition, setCreateCondition] = useState();
|
||||||
|
|
||||||
|
const [depth01List, setDepth01List] = useState({});
|
||||||
|
const [depth02List, setDepth02List] = useState({});
|
||||||
|
const [depth03List, setDepth03List] = useState({});
|
||||||
|
const [depth04List, setDepth04List] = useState({});
|
||||||
|
|
||||||
const [depth01List, setDepth01List] = useState([]);
|
|
||||||
const [depth02List, setDepth02List] = useState([]);
|
|
||||||
const [depth03List, setDepth03List] = useState([]);
|
|
||||||
const [depth04List, setDepth04List] = useState([]);
|
|
||||||
const [summaryArray, setSummaryArray] = useState({});
|
const [summaryArray, setSummaryArray] = useState({});
|
||||||
|
const [depthSelectedIndex, setDepthSelectedIndex] = useState([]);
|
||||||
const [depth01SelectedIndex, setDepth01SelectedIndex] = React.useState(undefined);
|
|
||||||
const [depth02SelectedIndex, setDepth02SelectedIndex] = React.useState(undefined);
|
// 위원회 코드 등록 팝업을 보이거나 닫는다.
|
||||||
const [depth03SelectedIndex, setDepth03SelectedIndex] = React.useState(undefined);
|
const [isCommitteeCodeRegistrationPopupOpen, setIsCommitteeCodeRegistrationPopupOpen] = React.useState(false);
|
||||||
const [depth04SelectedIndex, setDepth04SelectedIndex] = React.useState(undefined);
|
|
||||||
|
|
||||||
|
|
||||||
// '중앙건설기술심의'에서 특정 item선택 시, 하위 '총괄위원회'목록을 불러온다.
|
// '중앙건설기술심의'에서 특정 item선택 시, 하위 '총괄위원회'목록을 불러온다.
|
||||||
useEffect(function () {
|
useEffect(function () {
|
||||||
if( typeof depth01SelectedIndex !== 'undefined' ) {
|
if( typeof depthSelectedIndex[0] !== "undefined" && depth01List[depthSelectedIndex[0]].orgId !== undefined) {
|
||||||
setSearchCondition({ paramCodeGroup: depth01List[depth01SelectedIndex].orgId, paramCodeLevel: 'LV_02' });
|
setSearchCondition({ paramCodeGroup: depth01List[depthSelectedIndex[0]].orgId, paramCodeLevel: 'LV_02' });
|
||||||
setDepth02SelectedIndex(undefined);
|
setDepth02List({});
|
||||||
setDepth03SelectedIndex(undefined);
|
setDepth03List({});
|
||||||
setDepth04SelectedIndex(undefined);
|
setDepth04List({});
|
||||||
}
|
depthSelectedIndex[1] = undefined;
|
||||||
|
depthSelectedIndex[2] = undefined;
|
||||||
|
depthSelectedIndex[3] = undefined;
|
||||||
|
let forChangeObject = [...depthSelectedIndex];
|
||||||
|
setDepthSelectedIndex(forChangeObject);
|
||||||
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [depth01SelectedIndex]);
|
}, [depthSelectedIndex[0]]);
|
||||||
|
|
||||||
|
|
||||||
// '총괄위원회'에서 특정 item선택 시, 하위 '건설기준위원회'목록을 불러온다.
|
// '총괄위원회'에서 특정 item선택 시, 하위 '건설기준위원회'목록을 불러온다.
|
||||||
useEffect(function () {
|
useEffect(function () {
|
||||||
if( typeof depth02SelectedIndex !== 'undefined' ) {
|
if( typeof depthSelectedIndex[1] !== 'undefined' ) {
|
||||||
setSearchCondition({ paramCodeGroup: depth02List[depth02SelectedIndex].orgId, paramCodeLevel: 'LV_03' });
|
setSearchCondition({ paramCodeGroup: depth02List[depthSelectedIndex[1]].orgId, paramCodeLevel: 'LV_03' });
|
||||||
setDepth03SelectedIndex(undefined);
|
setDepth03List({});
|
||||||
setDepth04SelectedIndex(undefined);
|
setDepth04List({});
|
||||||
|
depthSelectedIndex[2] = undefined;
|
||||||
|
depthSelectedIndex[3] = undefined;
|
||||||
|
let forChangeObject = [...depthSelectedIndex];
|
||||||
|
setDepthSelectedIndex(forChangeObject);
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [depth02SelectedIndex]);
|
}, [depthSelectedIndex[1]]);
|
||||||
|
|
||||||
// '건설기준위원회'에서 특정 item선택 시, 하위 '실무위원회'목록을 불러온다.
|
// '건설기준위원회'에서 특정 item선택 시, 하위 '실무위원회'목록을 불러온다.
|
||||||
useEffect(function () {
|
useEffect(function () {
|
||||||
if( typeof depth03SelectedIndex !== 'undefined' ) {
|
if( typeof depthSelectedIndex[2] !== 'undefined' ) {
|
||||||
setSearchCondition({ paramCodeGroup: depth03List[depth03SelectedIndex].orgId, paramCodeLevel: 'LV_04' });
|
setSearchCondition({ paramCodeGroup: depth03List[depthSelectedIndex[2]].orgId, paramCodeLevel: 'LV_04' });
|
||||||
setDepth04SelectedIndex(undefined);
|
setDepth04List({});
|
||||||
|
depthSelectedIndex[3] = undefined;
|
||||||
|
let forChangeObject = [...depthSelectedIndex];
|
||||||
|
setDepthSelectedIndex(forChangeObject);
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [depth03SelectedIndex]);
|
}, [depthSelectedIndex[2]]);
|
||||||
|
|
||||||
|
|
||||||
// 검색 조건이 변경되면 데이터를 불러온다.
|
// 검색 조건이 변경되면 데이터를 불러온다.
|
||||||
useEffect(function () {
|
useEffect(function () {
|
||||||
|
|
@ -72,6 +88,13 @@ function CommitteeCodeMgt(props) {
|
||||||
}, [searchCondition]);
|
}, [searchCondition]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(function () {
|
||||||
|
if( typeof createCondition !== 'undefined' ) {
|
||||||
|
console.log('%o', createCondition);
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [createCondition]);
|
||||||
|
|
||||||
|
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
|
|
@ -81,46 +104,54 @@ function CommitteeCodeMgt(props) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const arrayToJson = (myArray, key) => {
|
||||||
|
let tempObj = {};
|
||||||
|
|
||||||
|
// eslint-disable-next-line array-callback-return
|
||||||
|
myArray.map((value, index) => {
|
||||||
|
tempObj = {...tempObj, [value[key]] : value};
|
||||||
|
});
|
||||||
|
|
||||||
|
return tempObj;
|
||||||
|
};
|
||||||
|
|
||||||
const getList = (searchCondition) => {
|
const getList = (searchCondition) => {
|
||||||
|
|
||||||
EgovNet.requestFetch(`/admin/config/committee-code-management?paramCodeGroup=${searchCondition.paramCodeGroup}¶mCodeLevel=${searchCondition.paramCodeLevel}`,
|
EgovNet.requestFetch(`/admin/config/committee-code-management?paramCodeGroup=${searchCondition.paramCodeGroup}¶mCodeLevel=${searchCondition.paramCodeLevel}`,
|
||||||
requestOptions,
|
requestOptions,
|
||||||
function (resp) {
|
function (resp) {
|
||||||
if( searchCondition.paramCodeLevel === 'LV_01' ) {
|
if( searchCondition.paramCodeLevel === 'LV_01' ) {
|
||||||
setDepth01List(resp.result.list);
|
setDepth01List(arrayToJson(resp.result.list, "orgId"));
|
||||||
} else if( searchCondition.paramCodeLevel === 'LV_02' ) {
|
} else if( searchCondition.paramCodeLevel === 'LV_02' ) {
|
||||||
setDepth02List(resp.result.list);
|
setDepth02List(arrayToJson(resp.result.list, "orgId"));
|
||||||
} else if( searchCondition.paramCodeLevel === 'LV_03' ) {
|
} else if( searchCondition.paramCodeLevel === 'LV_03' ) {
|
||||||
setDepth03List(resp.result.list);
|
setDepth03List(arrayToJson(resp.result.list, "orgId"));
|
||||||
} else if( searchCondition.paramCodeLevel === 'LV_04' ) {
|
} else if( searchCondition.paramCodeLevel === 'LV_04' ) {
|
||||||
setDepth04List(resp.result.list);
|
setDepth04List(arrayToJson(resp.result.list, "orgId"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
useEffect(function () {
|
useEffect(function () {
|
||||||
setSummaryArray(
|
setSummaryArray(
|
||||||
{
|
{
|
||||||
"중앙건설기술심의" : depth01List[depth01SelectedIndex] && depth01List[depth01SelectedIndex].orgNm ? depth01List[depth01SelectedIndex].orgNm : "",
|
"중앙건설기술심의" : depth01List[depthSelectedIndex[0]] && depth01List[depthSelectedIndex[0]].orgNm ? depth01List[depthSelectedIndex[0]].orgNm : "",
|
||||||
"총괄위원회" : depth02List[depth02SelectedIndex] && depth02List[depth02SelectedIndex].orgNm ? depth02List[depth02SelectedIndex].orgNm : "",
|
"총괄위원회" : depth02List[depthSelectedIndex[1]] && depth02List[depthSelectedIndex[1]].orgNm ? depth02List[depthSelectedIndex[1]].orgNm : "",
|
||||||
"건설기준위원회" : depth03List[depth03SelectedIndex] && depth03List[depth03SelectedIndex].orgNm ? depth03List[depth03SelectedIndex].orgNm : "",
|
"건설기준위원회" : depth03List[depthSelectedIndex[2]] && depth03List[depthSelectedIndex[2]].orgNm ? depth03List[depthSelectedIndex[2]].orgNm : "",
|
||||||
"실무위원회" : depth04List[depth04SelectedIndex] && depth04List[depth04SelectedIndex].orgNm ? depth04List[depth04SelectedIndex].orgNm : "",
|
"실무위원회" : depth04List[depthSelectedIndex[3]] && depth04List[depthSelectedIndex[3]].orgNm ? depth04List[depthSelectedIndex[3]].orgNm : "",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
console.log(`${depth01List[depth01SelectedIndex]}[${depth01SelectedIndex}]`);
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [
|
}, [
|
||||||
depth01List,
|
depth01List,
|
||||||
depth02List,
|
depth02List,
|
||||||
depth03List,
|
depth03List,
|
||||||
depth04List,
|
depth04List,
|
||||||
depth01SelectedIndex,
|
depthSelectedIndex
|
||||||
depth02SelectedIndex,
|
]);
|
||||||
depth03SelectedIndex,
|
|
||||||
depth04SelectedIndex]);
|
|
||||||
|
|
||||||
|
|
||||||
const Location = React.memo(function Location() {
|
const Location = React.memo(function Location() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -165,10 +196,64 @@ function CommitteeCodeMgt(props) {
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ListCreateUpdateDelete title="중앙건설기술심의" items={depth01List} itemIndex={depth01SelectedIndex} setItemIndex={setDepth01SelectedIndex} nameKey="orgNm" idKey="orgId" />
|
|
||||||
<ListCreateUpdateDelete title="총괄위원회" items={depth02List} itemIndex={depth02SelectedIndex} setItemIndex={setDepth02SelectedIndex} nameKey="orgNm" idKey="orgId" />
|
<ListCreateUpdateDelete
|
||||||
<ListCreateUpdateDelete title="건설기준위원회" items={depth03List} itemIndex={depth03SelectedIndex} setItemIndex={setDepth03SelectedIndex} nameKey="orgNm" idKey="orgId" />
|
title="중앙건설기술심의"
|
||||||
<ListCreateUpdateDelete title="실무위원회" items={depth04List} itemIndex={depth04SelectedIndex} setItemIndex={setDepth04SelectedIndex} nameKey="orgNm" idKey="orgId" />
|
items={depth01List}
|
||||||
|
itemIndex={depthSelectedIndex}
|
||||||
|
setItemIndex={setDepthSelectedIndex}
|
||||||
|
depthSelectedArrayIndex={0}
|
||||||
|
createCondition={createCondition}
|
||||||
|
setCreateCondition={setCreateCondition}
|
||||||
|
paramCodeLevel="LV_01"
|
||||||
|
upParamOrgId="00"
|
||||||
|
nameKey="orgNm"
|
||||||
|
idKey="orgId"
|
||||||
|
isPopupOpen = {isCommitteeCodeRegistrationPopupOpen}
|
||||||
|
setIsPopupOpen = {setIsCommitteeCodeRegistrationPopupOpen}
|
||||||
|
/>
|
||||||
|
<ListCreateUpdateDelete
|
||||||
|
title="총괄위원회"
|
||||||
|
items={depth02List}
|
||||||
|
itemIndex={depthSelectedIndex}
|
||||||
|
setItemIndex={setDepthSelectedIndex}
|
||||||
|
depthSelectedArrayIndex={1}
|
||||||
|
createCondition={createCondition}
|
||||||
|
setCreateCondition={setCreateCondition}
|
||||||
|
paramCodeLevel="LV_02"
|
||||||
|
nameKey="orgNm"
|
||||||
|
idKey="orgId"
|
||||||
|
isPopupOpen = {isCommitteeCodeRegistrationPopupOpen}
|
||||||
|
setIsPopupOpen = {setIsCommitteeCodeRegistrationPopupOpen}
|
||||||
|
/>
|
||||||
|
<ListCreateUpdateDelete
|
||||||
|
title="건설기준위원회"
|
||||||
|
items={depth03List}
|
||||||
|
itemIndex={depthSelectedIndex}
|
||||||
|
setItemIndex={setDepthSelectedIndex}
|
||||||
|
depthSelectedArrayIndex={2}
|
||||||
|
createCondition={createCondition}
|
||||||
|
setCreateCondition={setCreateCondition}
|
||||||
|
paramCodeLevel="LV_03"
|
||||||
|
nameKey="orgNm"
|
||||||
|
idKey="orgId"
|
||||||
|
isPopupOpen = {isCommitteeCodeRegistrationPopupOpen}
|
||||||
|
setIsPopupOpen = {setIsCommitteeCodeRegistrationPopupOpen}
|
||||||
|
/>
|
||||||
|
<ListCreateUpdateDelete
|
||||||
|
title="실무위원회"
|
||||||
|
items={depth04List}
|
||||||
|
itemIndex={depthSelectedIndex}
|
||||||
|
setItemIndex={setDepthSelectedIndex}
|
||||||
|
depthSelectedArrayIndex={3}
|
||||||
|
createCondition={createCondition}
|
||||||
|
setCreateCondition={setCreateCondition}
|
||||||
|
paramCodeLevel="LV_04"
|
||||||
|
nameKey="orgNm"
|
||||||
|
idKey="orgId"
|
||||||
|
isPopupOpen = {isCommitteeCodeRegistrationPopupOpen}
|
||||||
|
setIsPopupOpen = {setIsCommitteeCodeRegistrationPopupOpen}
|
||||||
|
/>
|
||||||
|
|
||||||
</Box>
|
</Box>
|
||||||
{ true &&
|
{ true &&
|
||||||
|
|
@ -186,7 +271,14 @@ function CommitteeCodeMgt(props) {
|
||||||
</Box>
|
</Box>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<CommitteeCodeRegistrationPopup
|
||||||
|
open={isCommitteeCodeRegistrationPopupOpen}
|
||||||
|
setOpen={setIsCommitteeCodeRegistrationPopupOpen}
|
||||||
|
createCondition={createCondition}
|
||||||
|
setCreateCondition={setCreateCondition}
|
||||||
|
searchCondition={searchCondition}
|
||||||
|
setSearchCondition={setSearchCondition}
|
||||||
|
/>
|
||||||
{/* <!--// 본문 --> */}
|
{/* <!--// 본문 --> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
import React from 'react';
|
||||||
|
import TextField from '@mui/material/TextField';
|
||||||
|
|
||||||
|
import * as EgovNet from 'api/egovFetch';
|
||||||
|
import FormDialog from '../../../../components/alert/FormDialog';
|
||||||
|
|
||||||
|
function CommitteeCodeRegistrationPopup(props) {
|
||||||
|
|
||||||
|
|
||||||
|
const handleClickCreateCommitteeCodeManagement = (createCondition) => {
|
||||||
|
|
||||||
|
if( createCondition.paramOrgId === undefined ) {
|
||||||
|
alert('상위 코드를 선택해주세요.');
|
||||||
|
props.setOpen(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const formData = new FormData();
|
||||||
|
|
||||||
|
for (let key in createCondition) {
|
||||||
|
formData.append(key, createCondition[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const requestOptions = {
|
||||||
|
method: "POST",
|
||||||
|
body: formData,
|
||||||
|
};
|
||||||
|
|
||||||
|
EgovNet.requestFetch(`/admin/config/committee-code-management`,
|
||||||
|
requestOptions,
|
||||||
|
function (resp) {
|
||||||
|
//window.location.reload();
|
||||||
|
//방금 추가한 것만 새로 읽어 드린다.
|
||||||
|
props.setSearchCondition({...props.searchCondition, paramCodeLevel : props.createCondition.paramCodeLevel});
|
||||||
|
|
||||||
|
props.setOpen(false);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleTextFieldChange = (event) => {
|
||||||
|
const elName = event.target.getAttribute('name');
|
||||||
|
const elValue = event.target.value;
|
||||||
|
props.setCreateCondition({...props.createCondition, [elName]:elValue});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<FormDialog open={props.open} setOpen={props.setOpen} title="위원회 코드 등록" contentText="위원회 코드 항목을 입력해주세요." handleOk={(e) => {handleClickCreateCommitteeCodeManagement(props.createCondition);}} >
|
||||||
|
<TextField
|
||||||
|
autoFocus
|
||||||
|
required
|
||||||
|
margin="dense"
|
||||||
|
id="insert-org-nm"
|
||||||
|
name="paramOrgNm"
|
||||||
|
label="명칭"
|
||||||
|
type="text"
|
||||||
|
fullWidth
|
||||||
|
variant="standard"
|
||||||
|
onChange={handleTextFieldChange}
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
required
|
||||||
|
margin="dense"
|
||||||
|
id="insert-org-desc"
|
||||||
|
name="paramOrgDesc"
|
||||||
|
label="위원회 설명"
|
||||||
|
type="text"
|
||||||
|
fullWidth
|
||||||
|
variant="standard"
|
||||||
|
onChange={handleTextFieldChange}
|
||||||
|
/>
|
||||||
|
</FormDialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CommitteeCodeRegistrationPopup;
|
||||||
|
|
@ -294,7 +294,7 @@ function EgovAdminDashboard(props) {
|
||||||
<Box sx={{ p: 3, pb: 0 }}>
|
<Box sx={{ p: 3, pb: 0 }}>
|
||||||
<Stack spacing={2}>
|
<Stack spacing={2}>
|
||||||
<Typography variant="h3" color="textSecondary">
|
<Typography variant="h3" color="textSecondary">
|
||||||
주간 현황
|
이번주 현황
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="h6">총 {totalDownloads}건</Typography>
|
<Typography variant="h6">총 {totalDownloads}건</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ function UserInfoModal({savedInfo, reloadFunction}){
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(resp) => {
|
(resp) => {
|
||||||
debugger
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.dbnt.kcscbackend.admin.config;
|
package com.dbnt.kcscbackend.admin.config;
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.config.entity.TcMenu;
|
import com.dbnt.kcscbackend.admin.config.entity.TcMenu;
|
||||||
|
import com.dbnt.kcscbackend.admin.config.model.CreateCommitteeCodeManagementVO;
|
||||||
import com.dbnt.kcscbackend.admin.config.service.AdminCommitteeCodeManagementService;
|
import com.dbnt.kcscbackend.admin.config.service.AdminCommitteeCodeManagementService;
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.service.AdminStandardResearchService;
|
import com.dbnt.kcscbackend.admin.standardResearch.service.AdminStandardResearchService;
|
||||||
import com.dbnt.kcscbackend.commonCode.entity.TcCodeGrp;
|
import com.dbnt.kcscbackend.commonCode.entity.TcCodeGrp;
|
||||||
|
|
@ -402,6 +403,48 @@ public class AdminConfigController extends BaseController {
|
||||||
return resultVO;
|
return resultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "'위원회 코드 관리' 페이지에서 위원회 코드 추가하는 API",
|
||||||
|
description = "관리자 단에서 '환경설정' > '위원회코드 관리' 페이지에서 +(추가) 버튼으로 항목 추가하는 API",
|
||||||
|
tags = {"AdminConfigController"}
|
||||||
|
)
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||||
|
@ApiResponse(responseCode = "303", description = "만료된 토큰"),
|
||||||
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
|
})
|
||||||
|
@PostMapping(value = "/committee-code-management")
|
||||||
|
public ResultVO createCommitteeCodeManagement(
|
||||||
|
@AuthenticationPrincipal LoginVO user,
|
||||||
|
HttpServletRequest request,
|
||||||
|
CreateCommitteeCodeManagementVO createCommitteeCodeManagementVO
|
||||||
|
) throws Exception {
|
||||||
|
|
||||||
|
ResultVO resultVO = new ResultVO();
|
||||||
|
if(user == null) {
|
||||||
|
resultVO.setResultCode(ResponseCode.TOKEN_EXPIRED.getCode());
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
resultVO = adminCommitteeCodeManagementService.createCommitteeCodeManagement(resultVO, request, user, createCommitteeCodeManagementVO);
|
||||||
|
} 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;
|
||||||
|
}
|
||||||
|
|
||||||
/* ---- 관련사이트 관리 ----- */
|
/* ---- 관련사이트 관리 ----- */
|
||||||
@Operation(
|
@Operation(
|
||||||
summary = "관련사이트 목록 조회",
|
summary = "관련사이트 목록 조회",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.dbnt.kcscbackend.admin.config.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@ApiModel(value = "CreateCommitteeCodeManagementVO", description =
|
||||||
|
"관리자 단에서 '환경설정' > '위원회코드 관리' 페이지에서 +(추가) 버튼으로 항목 추가하는 API에 사용된다." + ""
|
||||||
|
)
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class CreateCommitteeCodeManagementVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = -603047540959527181L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "현재 등록하고 있는 항목의 level이 들어간다. '중앙건설기술심의'인 경우, LV_01이다. '총괄위원회'인 경우, LV_02이다. 이런 식으로 값이 들어간다.")
|
||||||
|
private String paramCodeLevel;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "현재 등록하고 있는 항목의 상위 코드 값이 들어간다. '중앙건설기술심의'인 경우, 값이 00이다. 하지만 tn_cmt_org table에 cmt_seq 값이 00인 레코드는 존재하지 않는다.")
|
||||||
|
private String paramOrgId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "명칭")
|
||||||
|
private String paramOrgNm;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "위원회 설명")
|
||||||
|
private String paramOrgDesc;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.dbnt.kcscbackend.admin.config.service;
|
package com.dbnt.kcscbackend.admin.config.service;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.config.model.CreateCommitteeCodeManagementVO;
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
||||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||||
|
|
@ -12,7 +13,7 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
public interface AdminCommitteeCodeManagementService {
|
public interface AdminCommitteeCodeManagementService {
|
||||||
public ResultVO createCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreateStandardResearchVO createStandardResearchVO) throws Exception;
|
public ResultVO createCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, CreateCommitteeCodeManagementVO createCommitteeCodeManagementVO) throws Exception;
|
||||||
public ResultVO getCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long upCmtSeq, String cmtType) throws Exception;
|
public ResultVO getCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long upCmtSeq, String cmtType) throws Exception;
|
||||||
public ResultVO setCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdateStandardResearchVO updateStandardResearchVO, Long popupId) throws Exception;
|
public ResultVO setCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdateStandardResearchVO updateStandardResearchVO, Long popupId) throws Exception;
|
||||||
public ResultVO deleteCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
public ResultVO deleteCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
||||||
|
|
|
||||||
|
|
@ -93,25 +93,25 @@ public class AdminConfigService extends EgovAbstractServiceImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public String modifyCodeItem(TcCodeItem codeItem) {
|
public String modifyCodeItem(TcCodeItem codeItem) {
|
||||||
TcCodeItem savedItem = codeItemRepository.findById(
|
TcCodeItem savedItem = codeItemRepository.findById(
|
||||||
new TcCodeItem.TcCodeItemId(codeItem.getItemCd(), codeItem.getGrpCd())
|
new TcCodeItem.TcCodeItemId(codeItem.getItemCd(), codeItem.getGrpCd())
|
||||||
).orElse(null);
|
).orElse(null);
|
||||||
if (savedItem != null) {
|
if (savedItem != null) {
|
||||||
savedItem.setItemNm(codeItem.getItemNm());
|
savedItem.setItemNm(codeItem.getItemNm());
|
||||||
savedItem.setLastChgId(codeItem.getLastChgId());
|
savedItem.setLastChgId(codeItem.getLastChgId());
|
||||||
savedItem.setLastChgDt(codeItem.getLastChgDt());
|
savedItem.setLastChgDt(codeItem.getLastChgDt());
|
||||||
savedItem.setGrpOrder(codeItem.getGrpOrder());
|
savedItem.setGrpOrder(codeItem.getGrpOrder());
|
||||||
savedItem.setUseYn(codeItem.getUseYn());
|
savedItem.setUseYn(codeItem.getUseYn());
|
||||||
codeItemRepository.save(savedItem);
|
codeItemRepository.save(savedItem);
|
||||||
return "modified";
|
return "modified";
|
||||||
}else{
|
}else{
|
||||||
return "validGrpCd";
|
return "validGrpCd";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public List<TcMenu> selectMenuList() {
|
public List<TcMenu> selectMenuList() {
|
||||||
return menuMapper.selectMenuList();
|
return menuMapper.selectMenuList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
@ -174,4 +174,4 @@ public class AdminConfigService extends EgovAbstractServiceImpl {
|
||||||
return tnPartnerSiteRepository.findAllByOrderBySiteOrder();
|
return tnPartnerSiteRepository.findAllByOrderBySiteOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.dbnt.kcscbackend.admin.config.service.impl;
|
package com.dbnt.kcscbackend.admin.config.service.impl;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.config.model.CreateCommitteeCodeManagementVO;
|
||||||
import com.dbnt.kcscbackend.admin.config.service.AdminCommitteeCodeManagementService;
|
import com.dbnt.kcscbackend.admin.config.service.AdminCommitteeCodeManagementService;
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
||||||
|
|
@ -28,28 +29,68 @@ public class AdminCommitteeCodeManagementServiceImpl extends EgovAbstractService
|
||||||
private final TnCmtOrgRepository tnCmtOrgRepository;
|
private final TnCmtOrgRepository tnCmtOrgRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultVO createCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, MultipartHttpServletRequest multiRequest, CreateStandardResearchVO createStandardResearchVO) throws Exception {
|
public ResultVO createCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, CreateCommitteeCodeManagementVO createCommitteeCodeManagementVO) throws Exception {
|
||||||
return null;
|
System.out.println(
|
||||||
|
"\n--------------------------------------------------------------\n" +
|
||||||
|
request.getRequestURI() + " IN:" +
|
||||||
|
"\n--------------------------------------------------------------\n" +
|
||||||
|
"user.getEmail():" + "\n" +
|
||||||
|
user.getEmail() + "\n" +
|
||||||
|
"\n--------------------------------------------------------------\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
// 아래 null로 전달 되는 부분 확인하기.
|
||||||
|
// 유효성 검사 실시
|
||||||
|
if(createCommitteeCodeManagementVO.getParamCodeLevel().trim().isEmpty()) {
|
||||||
|
throw new Exception("오류가 발생했습니다. 시스템 담당자에게 문의 바랍니다. paramCodeLevel is empty.");
|
||||||
|
}
|
||||||
|
Integer upCmtSeq = null;
|
||||||
|
if( createCommitteeCodeManagementVO.getParamOrgId().trim().equals("00") == false ) { // 00은 '중앙건설기술심의' 항목의 부모 sequnce이다. 그러나 DB에 실제 00이란 sequence는 존재하지 않는다.
|
||||||
|
upCmtSeq = Integer.parseInt(createCommitteeCodeManagementVO.getParamOrgId());
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> response = tnCmtOrgRepository.spAddTnCmtOrg(
|
||||||
|
createCommitteeCodeManagementVO.getParamOrgNm(), // 위원회 이름
|
||||||
|
createCommitteeCodeManagementVO.getParamCodeLevel(), // 위원회 등급
|
||||||
|
createCommitteeCodeManagementVO.getParamOrgDesc(), // 위원회 설명
|
||||||
|
upCmtSeq, // 상위 위원회 sequence
|
||||||
|
1, // 정렬 순서
|
||||||
|
user.getId(),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, Object> dto = new HashMap<String, Object>();
|
||||||
|
dto.put("id", response.get("_cmt_seq") );
|
||||||
|
|
||||||
|
resultVO.setResult(dto);
|
||||||
|
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||||
|
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||||
|
|
||||||
|
return resultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultVO getCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long upCmtSeq, String cmtType) throws Exception {
|
public ResultVO getCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long upCmtSeq, String cmtType) throws Exception {
|
||||||
|
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"\n--------------------------------------------------------------\n" +
|
"\n--------------------------------------------------------------\n" +
|
||||||
request.getRequestURI() + " IN:" +
|
request.getRequestURI() + " IN:" +
|
||||||
"\n--------------------------------------------------------------\n" +
|
"\n--------------------------------------------------------------\n" +
|
||||||
"user.getEmail():" + "\n" +
|
"user.getEmail():" + "\n" +
|
||||||
user.getEmail() + "\n" +
|
user.getEmail() + "\n" +
|
||||||
"\n--------------------------------------------------------------\n"
|
"\n--------------------------------------------------------------\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
List<Map<String, Object>> list = tnCmtOrgRepository.findByUseYnAndUpCmtSeqAndCmtTypeOrderByCmtOrder("Y", upCmtSeq, cmtType).stream()
|
List<Map<String, Object>> list = tnCmtOrgRepository.findByUseYnAndUpCmtSeqAndCmtTypeOrderByCmtOrder("Y", upCmtSeq, cmtType).stream()
|
||||||
.map(item -> {
|
.map(item -> {
|
||||||
Map<String, Object> returnMap = new HashMap<>();
|
Map<String, Object> returnMap = new HashMap<>();
|
||||||
returnMap.put("orgId", item.getCmtSeq());
|
returnMap.put("orgId", item.getCmtSeq());
|
||||||
returnMap.put("orgNm", item.getCmtNm());
|
returnMap.put("orgNm", item.getCmtNm());
|
||||||
returnMap.put("orgDesc", item.getCmtDesc());
|
returnMap.put("orgDesc", item.getCmtDesc());
|
||||||
|
returnMap.put("omtOrder", item.getCmtOrder());
|
||||||
return returnMap;
|
return returnMap;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.dbnt.kcscbackend.admin.dashboard;
|
package com.dbnt.kcscbackend.admin.dashboard;
|
||||||
|
|
||||||
//import com.dbnt.kcscbackend.admin.dashboard.dto.MonthlyUserLogDTO;
|
|
||||||
import com.dbnt.kcscbackend.admin.dashboard.service.AdminDashboardService;
|
import com.dbnt.kcscbackend.admin.dashboard.service.AdminDashboardService;
|
||||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||||
import com.dbnt.kcscbackend.config.common.BaseController;
|
import com.dbnt.kcscbackend.config.common.BaseController;
|
||||||
|
|
@ -13,17 +12,12 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
|
@ -71,7 +65,7 @@ public class AdminDashboardController extends BaseController {
|
||||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
})
|
})
|
||||||
@RequestMapping(method = RequestMethod.POST, value = "/file", consumes = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.POST, value = "/file", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public ResultVO getfile(@AuthenticationPrincipal LoginVO user)
|
public ResultVO getFile(@AuthenticationPrincipal LoginVO user)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
ResultVO resultVO = new ResultVO();
|
ResultVO resultVO = new ResultVO();
|
||||||
|
|
@ -90,60 +84,4 @@ public class AdminDashboardController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @Operation(
|
|
||||||
// summary = "일별 사용자 현황 차트 조회",
|
|
||||||
// description = "일별 사용자 현황 차트 조회",
|
|
||||||
// tags = {"AdminDashboardController"}
|
|
||||||
// )
|
|
||||||
// @ApiResponses(value = {
|
|
||||||
// @ApiResponse(responseCode = "200", description = "조회 성공"),
|
|
||||||
// @ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
|
||||||
// })
|
|
||||||
// @RequestMapping(method = RequestMethod.GET, value = "/daily-user-log-list", consumes = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
// public ResultVO getDailyUserLogList() throws Exception {
|
|
||||||
// ResultVO resultVO = new ResultVO();
|
|
||||||
// Map<String, Object> resultMap = new HashMap<>();
|
|
||||||
//
|
|
||||||
// // 현재 날짜
|
|
||||||
// // todo endDate 뒤에 .minus 지워야함
|
|
||||||
// LocalDate endDate = LocalDate.now().minusMonths(6);
|
|
||||||
// // 3개월 전 날짜 계산
|
|
||||||
// LocalDate startDate = endDate.minusMonths(3);
|
|
||||||
//
|
|
||||||
// resultMap.put("dailyUserLogList", adminDashboardService.selectDailyUserLogList(startDate, endDate));
|
|
||||||
// resultVO.setResult(resultMap);
|
|
||||||
// return resultVO;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Operation(
|
|
||||||
// summary = "월별 사용자 현황 차트 조회",
|
|
||||||
// description = "월별 사용자 현황 차트 조회",
|
|
||||||
// tags = {"AdminDashboardController"}
|
|
||||||
// )
|
|
||||||
// @ApiResponses(value = {
|
|
||||||
// @ApiResponse(responseCode = "200", description = "조회 성공"),
|
|
||||||
// @ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
|
||||||
// })
|
|
||||||
// @RequestMapping(method = RequestMethod.GET, value = "/monthly-user-log-list", consumes = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
// public ResultVO getMonthlyUserLogList() throws Exception {
|
|
||||||
// ResultVO resultVO = new ResultVO();
|
|
||||||
// Map<String, Object> resultMap = new HashMap<>();
|
|
||||||
//
|
|
||||||
// // 현재 날짜
|
|
||||||
// // todo endDate 뒤에 .minus 지워야함
|
|
||||||
// LocalDate endDate = LocalDate.now().minusMonths(6);
|
|
||||||
// // 3개월 전 날짜 계산
|
|
||||||
// LocalDate startDate = endDate.minusMonths(3);
|
|
||||||
//
|
|
||||||
// List<Object[]> result = adminDashboardService.selectMonthlyUserLogList(startDate, endDate);
|
|
||||||
// List<MonthlyUserLogDTO> monthlyUserLogDTOList = result.stream()
|
|
||||||
// .map(row -> new MonthlyUserLogDTO((String) row[0], (BigInteger) row[1]))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
//
|
|
||||||
// resultMap.put("dailyUserLogList", monthlyUserLogDTOList);
|
|
||||||
// resultVO.setResult(resultMap);
|
|
||||||
// return resultVO;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
package com.dbnt.kcscbackend.admin.dashboard.dto;
|
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.dashboard.entity.TnDailyUserLog;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@ToString
|
|
||||||
public class MonthlyUserLogDTO {
|
|
||||||
private String logDt;
|
|
||||||
private BigInteger logCnt;
|
|
||||||
|
|
||||||
public MonthlyUserLogDTO(Object[] row) {
|
|
||||||
this.logDt = (String) row[0];
|
|
||||||
this.logCnt = (BigInteger) row[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
package com.dbnt.kcscbackend.admin.dashboard.entity;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.hibernate.annotations.DynamicInsert;
|
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@NoArgsConstructor
|
|
||||||
@DynamicInsert
|
|
||||||
@DynamicUpdate
|
|
||||||
@Table(name = "tn_daily_user_log")
|
|
||||||
public class TnDailyUserLog {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@Column(name = "dul_seq")
|
|
||||||
private Long dulSeq;
|
|
||||||
|
|
||||||
@Column(name = "log_dt")
|
|
||||||
private LocalDate logDt;
|
|
||||||
|
|
||||||
@Column(name = "log_cnt")
|
|
||||||
private Integer logCnt;
|
|
||||||
|
|
||||||
@Column(name = "mobile_cnt")
|
|
||||||
private Integer mobileCnt;
|
|
||||||
|
|
||||||
@Column(name = "pc_cnt")
|
|
||||||
private Integer pcCnt;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
package com.dbnt.kcscbackend.admin.dashboard.repository;
|
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.dashboard.entity.TnDailyUserLog;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface TnDailyUserLogRepository extends JpaRepository<TnDailyUserLog, Long> {
|
|
||||||
List<TnDailyUserLog> findByLogDtBetweenOrderByLogDt(LocalDate startDate, LocalDate endDate);
|
|
||||||
|
|
||||||
@Query(value = "SELECT TO_CHAR(log_dt, 'YYYYMM') as log_dt, "
|
|
||||||
+ "SUM(log_cnt) as log_cnt "
|
|
||||||
+ "FROM tn_daily_user_log "
|
|
||||||
+ "WHERE log_dt BETWEEN :startDate AND :endDate "
|
|
||||||
+ "GROUP BY TO_CHAR(log_dt, 'YYYYMM') "
|
|
||||||
+ "ORDER BY log_dt", nativeQuery = true)
|
|
||||||
List<Object[]> selectMonthlyUserLogStatistics(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.dbnt.kcscbackend.admin.logs.entity;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@DynamicInsert
|
||||||
|
@DynamicUpdate
|
||||||
|
@Table(name = "th_login_log")
|
||||||
|
public class ThLoginLog {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "ll_seq")
|
||||||
|
private Long llSeq;
|
||||||
|
|
||||||
|
@Column(name = "user_id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@Column(name = "access_dt")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime accessDt;
|
||||||
|
|
||||||
|
@Column(name = "ip_address")
|
||||||
|
private String ipAddress;
|
||||||
|
|
||||||
|
@Column(name = "session_id")
|
||||||
|
private String sessionId;
|
||||||
|
|
||||||
|
@Column(name = "access_type")
|
||||||
|
private String accessType;
|
||||||
|
}
|
||||||
|
|
@ -10,7 +10,6 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|
@ -20,15 +19,22 @@ import java.awt.*;
|
||||||
@DynamicInsert
|
@DynamicInsert
|
||||||
@DynamicUpdate
|
@DynamicUpdate
|
||||||
@Table(name = "tn_daily_user_log")
|
@Table(name = "tn_daily_user_log")
|
||||||
public class TnDailyUserConnLog {
|
public class TnDailyUserLog {
|
||||||
@Id
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "dul_seq")
|
@Column(name = "dul_seq")
|
||||||
private Long dulSeq;
|
private Long dulSeq;
|
||||||
|
|
||||||
@Column(name = "log_cnt")
|
|
||||||
private Long logCnt;
|
|
||||||
|
|
||||||
@Column(name = "log_dt")
|
@Column(name = "log_dt")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
private LocalDate logDt;
|
private LocalDate logDt;
|
||||||
|
|
||||||
|
@Column(name = "log_cnt")
|
||||||
|
private Long logCnt;
|
||||||
|
|
||||||
|
@Column(name = "mobile_cnt")
|
||||||
|
private Long mobileCnt;
|
||||||
|
|
||||||
|
@Column(name = "pc_cnt")
|
||||||
|
private Long pcCnt;
|
||||||
}
|
}
|
||||||
|
|
@ -5,6 +5,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface PrivacyLogsRepository extends JpaRepository<ThPrivacyLog, String> {
|
public interface PrivacyLogsRepository extends JpaRepository<ThPrivacyLog, Long> {
|
||||||
List<ThPrivacyLog> findAllByOrderByUplSeqDesc();
|
List<ThPrivacyLog> findAllByOrderByUplSeqDesc();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.dbnt.kcscbackend.admin.logs.repository;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.logs.entity.ThLoginLog;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ThLoginLogRepository extends JpaRepository<ThLoginLog, Long> {
|
||||||
|
|
||||||
|
List<ThLoginLog> findByUserIdAndAccessDtAfter(String userId, LocalDateTime accessDt);
|
||||||
|
}
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
package com.dbnt.kcscbackend.admin.logs.repository;
|
package com.dbnt.kcscbackend.admin.logs.repository;
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.logs.entity.TnDailyUserConnLog;
|
import com.dbnt.kcscbackend.admin.logs.entity.TnDailyUserLog;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface UserLogsRepository extends JpaRepository<TnDailyUserConnLog, Long> {
|
public interface UserLogsRepository extends JpaRepository<TnDailyUserLog, Long> {
|
||||||
|
|
||||||
@Query(value = "SELECT COUNT(DISTINCT log_dt) "
|
@Query(value = "SELECT COUNT(DISTINCT log_dt) "
|
||||||
+ "FROM tn_daily_user_log "
|
+ "FROM tn_daily_user_log "
|
||||||
|
|
@ -21,5 +23,5 @@ public interface UserLogsRepository extends JpaRepository<TnDailyUserConnLog, Lo
|
||||||
+ "ORDER BY log_dt asc", nativeQuery = true)
|
+ "ORDER BY log_dt asc", nativeQuery = true)
|
||||||
List<Object[]> selectCountUser(@Param("startDate") String startDate, @Param("endDate") String endDate);
|
List<Object[]> selectCountUser(@Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||||
|
|
||||||
|
Optional<TnDailyUserLog> findByLogDt(LocalDate logDt);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,18 @@
|
||||||
package com.dbnt.kcscbackend.admin.logs.service;
|
package com.dbnt.kcscbackend.admin.logs.service;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.logs.entity.ThLoginLog;
|
||||||
import com.dbnt.kcscbackend.admin.logs.entity.ThPrivacyLog;
|
import com.dbnt.kcscbackend.admin.logs.entity.ThPrivacyLog;
|
||||||
|
import com.dbnt.kcscbackend.admin.logs.entity.TnDailyUserLog;
|
||||||
import com.dbnt.kcscbackend.admin.logs.repository.PrivacyLogsRepository;
|
import com.dbnt.kcscbackend.admin.logs.repository.PrivacyLogsRepository;
|
||||||
|
import com.dbnt.kcscbackend.admin.logs.repository.ThLoginLogRepository;
|
||||||
|
import com.dbnt.kcscbackend.admin.logs.repository.UserLogsRepository;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -17,6 +22,8 @@ import java.util.Map;
|
||||||
public class AdminLogsService extends EgovAbstractServiceImpl {
|
public class AdminLogsService extends EgovAbstractServiceImpl {
|
||||||
|
|
||||||
private final PrivacyLogsRepository privacyLogsRepository;
|
private final PrivacyLogsRepository privacyLogsRepository;
|
||||||
|
private final ThLoginLogRepository loginLogRepository;
|
||||||
|
private final UserLogsRepository userLogsRepository;
|
||||||
|
|
||||||
public Map<String, Object> selectPrivacyList() {
|
public Map<String, Object> selectPrivacyList() {
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
|
@ -46,4 +53,44 @@ public class AdminLogsService extends EgovAbstractServiceImpl {
|
||||||
log.setTargetUserId(targetUserId);
|
log.setTargetUserId(targetUserId);
|
||||||
privacyLogsRepository.save(log);
|
privacyLogsRepository.save(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void insertLoginLog(String userId, String ipAddress, String accessToken, String accessType, String webType){
|
||||||
|
ThLoginLog loginLog = new ThLoginLog();
|
||||||
|
loginLog.setUserId(userId);
|
||||||
|
loginLog.setIpAddress(ipAddress);
|
||||||
|
loginLog.setSessionId(accessToken);
|
||||||
|
loginLog.setAccessType(accessType);
|
||||||
|
loginLog.setAccessDt(LocalDateTime.now());
|
||||||
|
loginLogRepository.save(loginLog);
|
||||||
|
|
||||||
|
// 로그인 기록이면 tn_daily_yser_log 카운트 조정
|
||||||
|
if(accessType.equals("Y")){
|
||||||
|
//오늘 일자 로그 조회
|
||||||
|
TnDailyUserLog userConnLog = userLogsRepository.findByLogDt(LocalDate.now()).orElse(null);
|
||||||
|
if(userConnLog==null){
|
||||||
|
userConnLog = new TnDailyUserLog();
|
||||||
|
userConnLog.setLogDt(LocalDate.now());
|
||||||
|
userConnLog.setLogCnt(0L);
|
||||||
|
userConnLog.setMobileCnt(0L);
|
||||||
|
userConnLog.setPcCnt(0L);
|
||||||
|
}
|
||||||
|
if(webType.equals("PC")){
|
||||||
|
userConnLog.setPcCnt(userConnLog.getPcCnt()+1);
|
||||||
|
}else{
|
||||||
|
userConnLog.setMobileCnt(userConnLog.getMobileCnt()+1);
|
||||||
|
}
|
||||||
|
//같은 일자 로그인 기록 확인
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
now = now.minusHours(now.getHour());
|
||||||
|
now = now.minusMinutes(now.getMinute());
|
||||||
|
now = now.minusSeconds(now.getSecond());
|
||||||
|
List<ThLoginLog> todayLoginLog = loginLogRepository.findByUserIdAndAccessDtAfter(userId, now);
|
||||||
|
if(todayLoginLog.size()==1){
|
||||||
|
userConnLog.setLogCnt(userConnLog.getLogCnt()+1);
|
||||||
|
}
|
||||||
|
userLogsRepository.save(userConnLog);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,42 @@ package com.dbnt.kcscbackend.commonCode.repository;
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.commonCode.entity.TnCmtOrg;
|
import com.dbnt.kcscbackend.commonCode.entity.TnCmtOrg;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface TnCmtOrgRepository extends JpaRepository<TnCmtOrg, TnCmtOrg.TnCmtOrgId> {
|
public interface TnCmtOrgRepository extends JpaRepository<TnCmtOrg, TnCmtOrg.TnCmtOrgId> {
|
||||||
List<TnCmtOrg> findByUseYnAndUpCmtSeqOrderByCmtOrder(String useYn, Long upCmtSeq);
|
List<TnCmtOrg> findByUseYnAndUpCmtSeqOrderByCmtOrder(String useYn, Long upCmtSeq);
|
||||||
TnCmtOrg findByUseYnAndCmtSeq(String useYn, Long cmtSeq);
|
TnCmtOrg findByUseYnAndCmtSeq(String useYn, Long cmtSeq);
|
||||||
List<TnCmtOrg> findByUseYnAndUpCmtSeqAndCmtTypeOrderByCmtOrder(String useYn, Long upCmtSeq, String cmtType);
|
List<TnCmtOrg> findByUseYnAndUpCmtSeqAndCmtTypeOrderByCmtOrder(String useYn, Long upCmtSeq, String cmtType);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(value = "CALL sp_add_tn_cmt_org (" +
|
||||||
|
":_cmt_nm, " +
|
||||||
|
":_cmt_type, " +
|
||||||
|
":_cmt_desc, " +
|
||||||
|
":_up_cmt_seq, " +
|
||||||
|
":_cmt_order, " +
|
||||||
|
":_modi_id, " +
|
||||||
|
":_cmt_seq, " +
|
||||||
|
":_result_count, " +
|
||||||
|
":_result_code, " +
|
||||||
|
":_error_message)",
|
||||||
|
nativeQuery = true)
|
||||||
|
Map<String, Object> spAddTnCmtOrg(
|
||||||
|
@Param("_cmt_nm") String cmtNm,
|
||||||
|
@Param("_cmt_type") String cmtType,
|
||||||
|
@Param("_cmt_desc") String cmtDesc,
|
||||||
|
@Param("_up_cmt_seq") Integer upCmtSeq,
|
||||||
|
@Param("_cmt_order") Integer cmtOrder,
|
||||||
|
@Param("_modi_id") String modiId,
|
||||||
|
@Param("_cmt_seq") Integer evtSeq,
|
||||||
|
@Param("_result_count") Integer resultCount,
|
||||||
|
@Param("_result_code") String resultCode,
|
||||||
|
@Param("_error_message") String errorMessage
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
package com.dbnt.kcscbackend.config.security;
|
package com.dbnt.kcscbackend.config.security;
|
||||||
|
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.logs.service.AdminLogsService;
|
||||||
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
||||||
import com.dbnt.kcscbackend.config.jwt.EgovJwtTokenUtil;
|
import com.dbnt.kcscbackend.config.jwt.EgovJwtTokenUtil;
|
||||||
|
import com.dbnt.kcscbackend.config.util.ClientUtils;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
|
|
@ -9,11 +13,7 @@ import org.springframework.http.server.ServletServerHttpResponse;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
|
|
||||||
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
||||||
import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
|
|
||||||
import org.springframework.security.web.savedrequest.RequestCache;
|
|
||||||
import org.springframework.security.web.savedrequest.SavedRequest;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
|
|
@ -23,7 +23,10 @@ import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class CustomLogoutSuccessHandler implements LogoutSuccessHandler {
|
public class CustomLogoutSuccessHandler implements LogoutSuccessHandler {
|
||||||
|
private final EgovJwtTokenUtil jwtTokenUtil;
|
||||||
|
private final AdminLogsService adminLogsService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
|
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
|
||||||
|
|
@ -37,6 +40,11 @@ public class CustomLogoutSuccessHandler implements LogoutSuccessHandler {
|
||||||
|
|
||||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||||
resultMap.put("resultCode", "200");
|
resultMap.put("resultCode", "200");
|
||||||
|
|
||||||
|
//로그아웃 이력 생성
|
||||||
|
String accessToken = request.getHeader("Authorization");
|
||||||
|
adminLogsService.insertLoginLog(jwtTokenUtil.getUserIdFromToken(accessToken), ClientUtils.getRemoteIP(request), accessToken, "N", ClientUtils.getWebType(request));
|
||||||
|
|
||||||
if (jsonConverter.canWrite(resultMap.getClass(), jsonMimeType)) {
|
if (jsonConverter.canWrite(resultMap.getClass(), jsonMimeType)) {
|
||||||
jsonConverter.write(resultMap, jsonMimeType, new ServletServerHttpResponse(response));
|
jsonConverter.write(resultMap, jsonMimeType, new ServletServerHttpResponse(response));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.dbnt.kcscbackend.config.security;
|
package com.dbnt.kcscbackend.config.security;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.logs.service.AdminLogsService;
|
||||||
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
||||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||||
import com.dbnt.kcscbackend.config.egov.EgovProperties;
|
import com.dbnt.kcscbackend.config.egov.EgovProperties;
|
||||||
|
|
@ -26,11 +27,13 @@ import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class CustomUrlAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
|
public class CustomUrlAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
|
||||||
|
|
||||||
private final EgovJwtTokenUtil jwtTokenUtil;
|
private final EgovJwtTokenUtil jwtTokenUtil;
|
||||||
|
private final AdminLogsService adminLogsService;
|
||||||
private RequestCache requestCache = new HttpSessionRequestCache();
|
private RequestCache requestCache = new HttpSessionRequestCache();
|
||||||
|
|
||||||
private static final List<String> adminIpList = Arrays.asList(EgovProperties.getProperty("Globals.admin.allow-ip").split(","));
|
private static final List<String> adminIpList = Arrays.asList(EgovProperties.getProperty("Globals.admin.allow-ip").split(","));
|
||||||
|
|
@ -53,12 +56,14 @@ public class CustomUrlAuthenticationSuccessHandler extends SimpleUrlAuthenticati
|
||||||
securityUser = (UserInfo) principal;
|
securityUser = (UserInfo) principal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String accessIp = ClientUtils.getRemoteIP(request);
|
||||||
|
|
||||||
// application/json(ajax) 요청일 경우 아래의 처리!
|
// application/json(ajax) 요청일 경우 아래의 처리!
|
||||||
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
|
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
|
||||||
MediaType jsonMimeType = MediaType.APPLICATION_JSON;
|
MediaType jsonMimeType = MediaType.APPLICATION_JSON;
|
||||||
HashMap<String, Object> resultMap = new HashMap<>();
|
HashMap<String, Object> resultMap = new HashMap<>();
|
||||||
|
|
||||||
/*if(securityUser.getUserId().equals("admin") && !adminIpList.contains(ClientUtils.getRemoteIP(request))){
|
/*if(securityUser.getUserId().equals("admin") && !adminIpList.contains(accessIp)){
|
||||||
resultMap.put("resultCode", ResponseCode.FAILED.getCode());
|
resultMap.put("resultCode", ResponseCode.FAILED.getCode());
|
||||||
resultMap.put("resultMessage", "관리자 계정은 지정된 아이피에서만 접속할 수 있습니다.\n필요한 경우 관리자에게 요청하십시오.\n접속자 아이피: "+ClientUtils.getRemoteIP(request));
|
resultMap.put("resultMessage", "관리자 계정은 지정된 아이피에서만 접속할 수 있습니다.\n필요한 경우 관리자에게 요청하십시오.\n접속자 아이피: "+ClientUtils.getRemoteIP(request));
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -78,6 +83,9 @@ public class CustomUrlAuthenticationSuccessHandler extends SimpleUrlAuthenticati
|
||||||
resultMap.put("accessToken", accessToken);
|
resultMap.put("accessToken", accessToken);
|
||||||
resultMap.put("refreshToken", refreshToken);
|
resultMap.put("refreshToken", refreshToken);
|
||||||
|
|
||||||
|
//로그인 로그 기록
|
||||||
|
adminLogsService.insertLoginLog(securityUser.getUserId(), accessIp, accessToken, "Y", ClientUtils.getWebType(request));
|
||||||
|
|
||||||
if (jsonConverter.canWrite(resultMap.getClass(), jsonMimeType)) {
|
if (jsonConverter.canWrite(resultMap.getClass(), jsonMimeType)) {
|
||||||
jsonConverter.write(resultMap, jsonMimeType, new ServletServerHttpResponse(response));
|
jsonConverter.write(resultMap, jsonMimeType, new ServletServerHttpResponse(response));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.dbnt.kcscbackend.config.security;
|
package com.dbnt.kcscbackend.config.security;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.logs.service.AdminLogsService;
|
||||||
import com.dbnt.kcscbackend.config.jwt.EgovJwtTokenUtil;
|
import com.dbnt.kcscbackend.config.jwt.EgovJwtTokenUtil;
|
||||||
import com.dbnt.kcscbackend.config.jwt.JwtAuthenticationEntryPoint;
|
import com.dbnt.kcscbackend.config.jwt.JwtAuthenticationEntryPoint;
|
||||||
import com.dbnt.kcscbackend.config.jwt.JwtAuthenticationFilter;
|
import com.dbnt.kcscbackend.config.jwt.JwtAuthenticationFilter;
|
||||||
|
|
@ -49,6 +50,7 @@ public class SecurityConfig {
|
||||||
private UserDetailsService loginService;
|
private UserDetailsService loginService;
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
private final EgovJwtTokenUtil egovJwtTokenUtil;
|
private final EgovJwtTokenUtil egovJwtTokenUtil;
|
||||||
|
private final AdminLogsService adminLogsService;
|
||||||
|
|
||||||
//Http Methpd : Get 인증예외 List
|
//Http Methpd : Get 인증예외 List
|
||||||
private String[] AUTH_GET_WHITELIST = {
|
private String[] AUTH_GET_WHITELIST = {
|
||||||
|
|
@ -131,7 +133,7 @@ public class SecurityConfig {
|
||||||
|
|
||||||
http.addFilterBefore(jsonUsernamePasswordAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
|
http.addFilterBefore(jsonUsernamePasswordAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
|
||||||
|
|
||||||
http.logout().logoutRequestMatcher(new AntPathRequestMatcher("/auth/logout")).logoutSuccessHandler(new CustomLogoutSuccessHandler());
|
http.logout().logoutRequestMatcher(new AntPathRequestMatcher("/auth/logout")).logoutSuccessHandler(new CustomLogoutSuccessHandler(egovJwtTokenUtil, adminLogsService));
|
||||||
|
|
||||||
return http.build();
|
return http.build();
|
||||||
}
|
}
|
||||||
|
|
@ -145,7 +147,7 @@ public class SecurityConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JsonAuthenticationFilter jsonUsernamePasswordAuthenticationFilter() {
|
public JsonAuthenticationFilter jsonUsernamePasswordAuthenticationFilter() {
|
||||||
JsonAuthenticationFilter jsonAuthenticationFilter = new JsonAuthenticationFilter(objectMapper, new CustomUrlAuthenticationSuccessHandler(egovJwtTokenUtil), loginFailureHandler());
|
JsonAuthenticationFilter jsonAuthenticationFilter = new JsonAuthenticationFilter(objectMapper, new CustomUrlAuthenticationSuccessHandler(egovJwtTokenUtil, adminLogsService), loginFailureHandler());
|
||||||
jsonAuthenticationFilter.setAuthenticationManager(authenticationManager());
|
jsonAuthenticationFilter.setAuthenticationManager(authenticationManager());
|
||||||
return jsonAuthenticationFilter;
|
return jsonAuthenticationFilter;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,20 @@ public class ClientUtils {
|
||||||
|
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getWebType(HttpServletRequest request) {
|
||||||
|
String filter = "iphone|ipod|android|windows ce|blackberry|symbian|windows phone|webos|opera mini|opera mobi|polaris|iemobile|lgtelecom|nokia|sonyericsson|lg|samsung";
|
||||||
|
String filters[] = filter.split("\\|");
|
||||||
|
String webType = "";
|
||||||
|
|
||||||
|
for(String tmp : filters){
|
||||||
|
if (request.getHeader("User-Agent").toLowerCase().contains(tmp)) {
|
||||||
|
webType = "MOBILE";
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
webType = "PC";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return webType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue