공통 기능 소스코드 추가

main
이범준 2 months ago
parent c03b58e1e8
commit a907906ee3

@ -0,0 +1,37 @@
package cokr.xit.fims;
import org.springframework.stereotype.Component;
import cokr.xit.base.syslog.ServiceLog;
import cokr.xit.base.syslog.service.bean.LogFilter;
/**FIMS
* @author mjkhan
*/
@Component("logFilter")
public class FimsLogFilter extends LogFilter {
private String[] ignore = {
"login.do", "logout.do",
"/user/", "/authority/", "/code/", "/menu/", "/syslog/", "/error/",
"/stat/stat01/010/info.do"
};
@Override
protected boolean customFilter(ServiceLog log) {
switch (log.getType()) {
case ServiceLog.LOG_INOUT:
case ServiceLog.DOWNLOAD: return true;
case ServiceLog.WEB:
String url = blankIfEmpty(log.getUrl());
for (String str: ignore) {
if (url.contains(str))
return false;
}
if ("modifySvg".equals(log.getMethodName()))
return false;
return true;
default: return false;
}
}
}

@ -0,0 +1,120 @@
package cokr.xit.fims.base;
import cokr.xit.base.user.Department;
import lombok.Getter;
import lombok.Setter;
/**
*
* @author JoJH
*/
@Getter
@Setter
public class FimsDepartment extends Department {
/**
*
*/
private String cvlcptLinkSeCd;
/**
*
*/
private String vrbacntLinkSeCd;
/**
*
*/
private String pstofcNm;
/**
*
*/
private String rgNoHeader;
/**
*
*/
private String sndngLinkSeCd;
/**
* E
*/
private String egpConOrg;
/**
* E
*/
private String egpRceptId;
/**
* E
*/
private String egpApvlNb;
/**
* E ESB
*/
private String egpEsbPath;
/**
* E ID
*/
private String egpPostInstId;
/**
* E CN
*/
private String egpCertCn;
/**
* ID
*/
private String ensInterfaceId;
/**
*
*/
private String ensSourceCd;
/**
*
*/
private String ensTargetCd;
/**
* URL
*/
private String ensUrl;
/**
*
*/
private String nxrpLinkYn;
/**
*
*/
private String nxrpRgnSeCd;
/**
*
*/
private String dtbnBankNm;
/**
*
*/
private String dtbnActno;
/**
* 릿
*/
private String docHeader;
/**
* OS
*/
private String srvrOs;
}

@ -0,0 +1,31 @@
package cokr.xit.fims.base;
import cokr.xit.base.user.Sigungu;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class FimsSigungu extends Sigungu {
/**
*
*/
private String symbolFilepath;
/**
*
*/
private String symbolFilename;
/**
*
*/
private String logoFilepath;
/**
*
*/
private String logoFilename;
}

@ -0,0 +1,93 @@
package cokr.xit.fims.base;
import cokr.xit.base.user.GenericUser;
public class FimsUser extends GenericUser {
private static final long serialVersionUID = 1L;
@Override
public String getType() {
return "USR00";
}
@Override
public String getAccount() {
String account = super.getAccount();
return account != null ? account.toUpperCase() : null;
}
@Override
public void setAccount(String account) {
if(account != null) {
account = account.toUpperCase();
}
super.setAccount(account);
}
/**
*
*/
private String positionName;
/**
* DN
*/
private String certificateDn;
/**
*
*/
private String cntnSeCd;
/**
*
*/
private String userSeCd;
/** .
* @return
*/
public String getPositionName() {
return positionName;
}
/** .
* @param positionName
*/
public void setPositionName(String positionName) {
this.positionName = positionName;
}
/** DN .
* @return DN
*/
public String getCertificateDn() {
return certificateDn;
}
/** DN .
* @param certificateDn DN
*/
public void setCertificateDn(String certificateDn) {
this.certificateDn = certificateDn;
}
public String getCntnSeCd() {
return cntnSeCd;
}
public void setCntnSeCd(String cntnSeCd) {
this.cntnSeCd = cntnSeCd;
}
public String getUserSeCd() {
return userSeCd;
}
public void setUserSeCd(String userSeCd) {
this.userSeCd = userSeCd;
}
}

@ -0,0 +1,63 @@
package cokr.xit.fims.base;
import cokr.xit.foundation.component.QueryRequest;
public class OgdpQuery extends QueryRequest {
private static final long serialVersionUID = 1L;
private String sggCd; // 시군구 코드
private String deptCd; // 부서 코드
private String instCd; // 기관 코드
private String useYn; // 사용 여부
private String delYn; // 삭제 여부
public String getSggCd() {
return ifEmpty(sggCd, () -> null);
}
public <T extends OgdpQuery> T setSggCd(String sggCd) {
this.sggCd = sggCd;
return self();
}
public String getDeptCd() {
return ifEmpty(deptCd, () -> null);
}
public <T extends OgdpQuery> T setDeptCd(String deptCd) {
this.deptCd = deptCd;
return self();
}
public String getInstCd() {
return ifEmpty(instCd, () -> null);
}
public <T extends OgdpQuery> T setInstCd(String instCd) {
this.instCd = instCd;
return self();
}
public String getUseYn() {
return ifEmpty(useYn, () -> null);
}
public <T extends OgdpQuery> T setUseYn(String useYn) {
this.useYn = useYn;
return self();
}
public String getDelYn() {
return ifEmpty(delYn, () -> null);
}
public <T extends OgdpQuery> T setDelYn(String delYn) {
this.delYn = delYn;
return self();
}
}

@ -0,0 +1,25 @@
package cokr.xit.fims.base;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import cokr.xit.foundation.data.DataObject;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class SseEntity {
private long createdAt;
private SseEmitter emitter;
private DataObject progress;
public SseEntity(SseEmitter emitter) {
this.createdAt = System.currentTimeMillis();
this.emitter = emitter;
this.progress = new DataObject();
}
}

@ -0,0 +1,235 @@
package cokr.xit.fims.base.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.applib.SQLUtil;
import cokr.xit.fims.base.FimsSigungu;
import cokr.xit.fims.base.OgdpQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@Mapper("ogdpMapper")
public interface OgdpMapper extends AbstractMapper {
public static String select = """
SELECT D.DEPT_CD <!-- -->
, D.SGG_CD <!-- -->
, (SELECT SGG_NM FROM TB_SGG WHERE SGG_CD = D.SGG_CD) AS SGG_NM <!-- -->
, D.INST_CD <!-- -->
, (SELECT INST_NM FROM TB_SGG WHERE INST_CD = D.INST_CD) AS INST_NM <!-- -->
, D.DEPT_NM <!-- -->
, D.DEPT_TELNO <!-- -->
, D.DEPT_FXNO <!-- -->
, D.USE_YN <!-- -->
, (CASE D.USE_YN WHEN 'Y' THEN '' WHEN 'N' THEN '' ELSE '' END) AS USE_YN_NM <!-- -->
, D.REG_DT <!-- -->
, D.RGTR <!-- -->
, D.MDFCN_DT <!-- -->
, D.MDFR <!-- -->
, D.CVLCPT_LINK_SE_CD <!-- -->
, D.VRBACNT_LINK_SE_CD <!-- -->
, D.PSTOFC_NM <!-- -->
, D.RG_NO_HEADER <!-- -->
, D.SNDNG_LINK_SE_CD <!-- -->
, D.EGP_CON_ORG <!-- E -->
, D.EGP_RCEPT_ID <!-- E -->
, D.EGP_APVL_NB <!-- E -->
, D.EGP_ESB_PATH <!-- E ESB -->
, D.EGP_POST_INST_ID <!-- E ID -->
, D.EGP_CERT_CN <!-- E CN -->
, D.ENS_INTERFACE_ID <!-- ID -->
, D.ENS_SOURCE_CD <!-- -->
, D.ENS_TARGET_CD <!-- -->
, D.ENS_URL <!-- URL -->
, D.NXRP_LINK_YN <!-- -->
, D.NXRP_LINK_SRVC_URL <!-- URL -->
, D.NXRP_RGN_SE_CD <!-- -->
, D.DTBN_BANK_NM <!-- -->
, D.DTBN_ACTNO <!-- -->
, D.DOC_HEADER <!-- 릿 -->
, D.SRVR_OS <!-- OS -->
FROM TB_DEPT D
<where>
<if test="sggCd != null">
AND D.SGG_CD = #{sggCd} <!-- -->
</if>
<if test="deptCd != null">
AND D.DEPT_CD = #{deptCd} <!-- -->
</if>
<if test="instCd != null">
AND D.INST_CD = #{instCd} <!-- -->
</if>
<if test="useYn != null">
AND D.USE_YN = #{useYn} <!-- -->
</if>
</where>
""";
@Select(SQLUtil.SCRIPT_START+"""
/* 유저 수 조회(ogdpMapper.countUser) */
SELECT COUNT(*)
FROM TB_SGG A
WHERE USE_YN = 'Y'
AND SGG_CD = #{sggCd}
"""+SQLUtil.SCRIPT_END)
int countUser(String sggCd);
/** .
* @param sgg
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean updateSggStng(FimsSigungu sgg) {
return sgg != null && updateSggStng(params().set("sgg", sgg)) == 1;
}
/** .
* @param params
* <ul><li>"sgg" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
@Update(SQLUtil.SCRIPT_START+"""
/* 시군구 설정 정보 수정 (ogdpMapper.updateSggStng) */
UPDATE TB_SGG
SET MDFCN_DT =
"""
+SQLUtil.now
+"""
, MDFR = #{sgg.modifiedBy}
<if test="sgg.symbolFilepath != null">
, SYMBOL_FILE_PATH = #{sgg.symbolFilepath} <!-- -->
, SYMBOL_FILE_NM = #{sgg.symbolFilename} <!-- -->
</if>
<if test="sgg.logoFilepath != null">
, LOGO_FILE_PATH = #{sgg.logoFilepath} <!-- -->
, LOGO_FILE_NM = #{sgg.logoFilename} <!-- -->
</if>
<if test="sgg.officialSealFilepath != null">
, OFFCS_FILE_PATH = #{sgg.officialSealFilepath} <!-- -->
, OFFCS_FILE_NM = #{sgg.officialSealFilename} <!-- -->
</if>
WHERE SGG_CD = #{sgg.sggID}
"""+SQLUtil.SCRIPT_END)
int updateSggStng(Map<String, Object> params);
/** .
* @param req
* @return
*/
default DataObject selectSggStngInfo(OgdpQuery req) {
// 사용 여부 확인
if (req.getUseYn() == null) {
req.setUseYn("Y");
}
return selectSggStng(req);
}
/** .
* @param req
* @return
*/
@Select(SQLUtil.SCRIPT_START+"""
/* 시군구 설정 객체 가져오기(ogdpMapper.selectSgg) */
SELECT S.SGG_CD <!-- -->
, S.SGG_NM <!-- -->
, S.INST_SE_CD <!-- -->
, S.INST_CD <!-- -->
, S.INST_NM <!-- -->
, (CASE
WHEN S.INST_DADDR IS NULL OR S.INST_DADDR = ''
THEN S.INST_ADDR
ELSE CONCAT(S.INST_ADDR,' ',S.INST_DADDR)
END) AS INST_FULL_ADDR <!-- -->
, S.INST_ADDR <!-- -->
, S.INST_DADDR <!-- -->
, S.INST_ZIP <!-- -->
, S.SYMBOL_FILE_PATH <!-- -->
, S.SYMBOL_FILE_NM <!-- -->
, S.LOGO_FILE_PATH <!-- -->
, S.LOGO_FILE_NM <!-- -->
, S.OFFCS_FILE_PATH <!-- -->
, S.OFFCS_FILE_NM <!-- -->
FROM TB_SGG S
<where>
<if test="sggCd != null">
AND S.SGG_CD = #{sggCd} <!-- -->
</if>
<if test="useYn != null">
AND S.USE_YN = #{useYn} <!-- -->
</if>
</where>
"""+SQLUtil.SCRIPT_END)
DataObject selectSggStng(OgdpQuery req);
@Update(SQLUtil.SCRIPT_START+"""
/* 부서 설정 수정(ogdpMapper.updateDeptStng) */
UPDATE TB_DEPT
SET MDFCN_DT =
"""+SQLUtil.now+"""
<!-- -->
, MDFR = #{dept.modifiedBy} <!-- -->
, CVLCPT_LINK_SE_CD = #{dept.cvlcptLinkSeCd} <!-- -->
, VRBACNT_LINK_SE_CD = #{dept.vrbacntLinkSeCd} <!-- -->
, PSTOFC_NM = #{dept.pstofcNm} <!-- -->
, RG_NO_HEADER = #{dept.rgNoHeader} <!-- -->
, SNDNG_LINK_SE_CD = #{dept.sndngLinkSeCd} <!-- -->
, EGP_CON_ORG = #{dept.egpConOrg} <!-- E -->
, EGP_RCEPT_ID = #{dept.egpRceptId} <!-- E -->
, EGP_APVL_NB = #{dept.egpApvlNb} <!-- E -->
, EGP_ESB_PATH = #{dept.egpEsbPath} <!-- E ESB -->
, EGP_POST_INST_ID = #{dept.egpPostInstId} <!-- E ID -->
, EGP_CERT_CN = #{dept.egpCertCn} <!-- E CN -->
, ENS_INTERFACE_ID = #{dept.ensInterfaceId} <!-- ID -->
, ENS_SOURCE_CD = #{dept.ensSourceCd} <!-- -->
, ENS_TARGET_CD = #{dept.ensTargetCd} <!-- -->
, ENS_URL = #{dept.ensUrl} <!-- URL -->
, NXRP_LINK_YN = #{dept.nxrpLinkYn} <!-- -->
, NXRP_RGN_SE_CD = #{dept.nxrpRgnSeCd} <!-- -->
, DTBN_BANK_NM = #{dept.dtbnBankNm} <!-- -->
, DTBN_ACTNO = #{dept.dtbnActno} <!-- -->
, DOC_HEADER = #{dept.docHeader} <!-- 릿 -->
, SRVR_OS = #{dept.srvrOs} <!-- OS -->
WHERE DEPT_CD = #{dept.deptID}
AND USE_YN = 'Y'
"""
+SQLUtil.SCRIPT_END)
int updateDeptStng(Map<String, Object> params);
@Select(SQLUtil.SCRIPT_START
+ " /* 부서 설정 객체 가져오기(ogdpMapper.selectDeptInfo) */ "
+ select
+ SQLUtil.SCRIPT_END)
DataObject selectDeptStngInfo(OgdpQuery req);
@Select(SQLUtil.SCRIPT_START
+ " /* 부서 설정 객체 목록 가져오기(ogdpMapper.selectDeptList) */ "
+ SQLUtil.pagingPrefix
+ select
+ SQLUtil.orderBy
+ SQLUtil.pagingSuffix
+ SQLUtil.SCRIPT_END)
List<DataObject> selectDeptStngList(OgdpQuery query);
}

@ -0,0 +1,225 @@
package cokr.xit.fims.base.service.bean;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.base.user.DepartmentQuery;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.base.user.dao.UserMapper;
import cokr.xit.base.user.service.bean.DepartmentBean;
import cokr.xit.base.user.service.bean.SigunguBean;
import cokr.xit.fims.base.FimsDepartment;
import cokr.xit.fims.base.FimsSigungu;
import cokr.xit.fims.base.OgdpQuery;
import cokr.xit.fims.base.dao.OgdpMapper;
import cokr.xit.foundation.UserInfo;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
@Component("ogdpBean")
public class OgdpBean extends AbstractBean {
@Resource(name="sigunguBean")
private SigunguBean sigunguBean;
@Resource(name="departmentBean")
private DepartmentBean departmentBean;
@Resource(name="ogdpMapper")
private OgdpMapper ogdpMapper;
@Resource(name="userMapper")
private UserMapper userMapper;
public Object selectAllOgdpList() {
List<DataObject> ogdpList = new ArrayList<>();
List<DataObject> sggs = sigunguBean.getSigunguList(new SigunguQuery());
for(DataObject sgg : sggs) {
DataObject noDept = new DataObject();
noDept.put("SGG_CD", sgg.string("SGG_CD"));
noDept.put("SGG_NM", sgg.string("SGG_NM"));
noDept.put("INST_CD", sgg.string("INST_CD"));
noDept.put("INST_NM", sgg.string("INST_NM"));
noDept.put("DEPT_CD", "EMPTY00");
noDept.put("DEPT_NM", "(부서 없음)");
ogdpList.add(noDept);
List<DataObject> depts = departmentBean.getDepartmentList(new DepartmentQuery().setSggID(sgg.string("SGG_CD")));
for(DataObject dept : depts) {
DataObject ogdp = new DataObject();
ogdp.put("SGG_CD", sgg.string("SGG_CD"));
ogdp.put("SGG_NM", sgg.string("SGG_NM"));
ogdp.put("INST_CD", sgg.string("INST_CD"));
ogdp.put("INST_NM", sgg.string("INST_NM"));
ogdp.put("DEPT_CD", dept.string("DEPT_CD"));
ogdp.put("DEPT_NM", dept.string("DEPT_NM"));
ogdpList.add(ogdp);
}
}
DataObject sysAdmin = new DataObject();
sysAdmin.put("SGG_CD", "ADMIN");
sysAdmin.put("SGG_NM", "관리자 시군구");
sysAdmin.put("INST_CD", "ADMIN00");
sysAdmin.put("INST_NM", "관리자 기관");
sysAdmin.put("DEPT_CD", "ADMIN00");
sysAdmin.put("DEPT_NM", "관리자 부서");
ogdpList.add(sysAdmin);
ogdpOutput(ogdpList);
return ogdpList;
}
public List<DataObject> selectAbleOgdpList(boolean anonymous, String sggCd) {
List<DataObject> ogdpList = new ArrayList<>();
SigunguQuery sggQuery = new SigunguQuery();
if(anonymous) {
sggQuery.setSggIDs(sggCd);
} else if(!currentUser().getInstitute().equals("ADMIN00")){
sggQuery.setSggIDs(currentUser().getOrgID());
}
List<DataObject> sggs = sigunguBean.getSigunguList(sggQuery);
for(DataObject sgg : sggs) {
DataObject noDept = new DataObject();
noDept.put("SGG_CD", sgg.string("SGG_CD"));
noDept.put("SGG_NM", sgg.string("SGG_NM"));
noDept.put("INST_CD", sgg.string("INST_CD"));
noDept.put("INST_NM", sgg.string("INST_NM"));
noDept.put("DEPT_CD", "EMPTY00");
noDept.put("DEPT_NM", "(부서 없음)");
ogdpList.add(noDept);
List<DataObject> depts = departmentBean.getDepartmentList(new DepartmentQuery().setSggID(sgg.string("SGG_CD")));
for(DataObject dept : depts) {
DataObject ogdp = new DataObject();
ogdp.put("SGG_CD", sgg.string("SGG_CD"));
ogdp.put("SGG_NM", sgg.string("SGG_NM"));
ogdp.put("INST_CD", sgg.string("INST_CD"));
ogdp.put("INST_NM", sgg.string("INST_NM"));
ogdp.put("DEPT_CD", dept.string("DEPT_CD"));
ogdp.put("DEPT_NM", dept.string("DEPT_NM"));
ogdpList.add(ogdp);
}
}
if(!anonymous && currentUser().getInstitute().equals("ADMIN00")) {
DataObject sysAdmin = new DataObject();
sysAdmin.put("SGG_CD", "ADMIN");
sysAdmin.put("SGG_NM", "관리자 시군구");
sysAdmin.put("INST_CD", "ADMIN00");
sysAdmin.put("INST_NM", "관리자 기관");
sysAdmin.put("DEPT_CD", "ADMIN00");
sysAdmin.put("DEPT_NM", "관리자 부서");
ogdpList.add(sysAdmin);
}
ogdpOutput(ogdpList);
return ogdpList;
}
private void ogdpOutput(List<DataObject> list) {
for(DataObject one : list) {
one.put("OGDP_CD", one.string("SGG_CD")+"/"+one.string("INST_CD") + ":" + one.string("DEPT_CD"));
one.put("OGDP_NM", one.string("SGG_NM") + " / " + one.string("INST_NM") + " : " + one.string("DEPT_NM"));
}
}
public int countUser(String sggCd) {
return ogdpMapper.countUser(sggCd);
}
/**userInfo ,, .
* @param userInfo
* @return
*/
public void initUserInfo(UserInfo userInfo) {
DataObject ogdpInfo = userMapper.getUserInfo(userInfo.getId());
Map<String, Object> infoMap = userInfo.getInfo();
if(ogdpInfo == null) {
infoMap.put("sggCd", "");
infoMap.put("sggNm", "");
infoMap.put("instCd", "");
infoMap.put("instNm", "");
infoMap.put("deptCd", "");
infoMap.put("deptNm", "");
} else {
infoMap.put("sggCd", ogdpInfo.string("SGG_CD"));
infoMap.put("sggNm", ogdpInfo.string("SGG_NM"));
infoMap.put("instCd", ogdpInfo.string("INST_CD"));
infoMap.put("instNm", ogdpInfo.string("INST_NM"));
infoMap.put("deptCd", ogdpInfo.string("DEPT_CD"));
infoMap.put("deptNm", ogdpInfo.string("DEPT_NM"));
}
userInfo.setInfo(infoMap);
}
/** .
* @param sgg
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean updateSggStng(FimsSigungu sgg) {
return ogdpMapper.updateSggStng(sgg);
}
/** .
* @param req
* @return
*/
public DataObject getSggStngInfo(OgdpQuery req) {
return ogdpMapper.selectSggStngInfo(req);
}
public List<DataObject> getDeptStngList(OgdpQuery query) {
// 기본 정렬
if (query.getOrderBy() == null) {
if(query.getFetchSize() > 0) {
query.setOrderBy("QBODY.DEPT_CD DESC");
} else {
query.setOrderBy("D.DEPT_CD DESC");
}
}
return ogdpMapper.selectDeptStngList(query);
}
public DataObject getDeptStngInfo(OgdpQuery query) {
return ogdpMapper.selectDeptStngInfo(query);
}
public boolean updateDeptStng(FimsDepartment dept) {
boolean result = ogdpMapper.updateDeptStng(new DataObject().set("currentUser", currentUser()).set("dept", dept)) == 1;
return result;
}
}

@ -0,0 +1,189 @@
package cokr.xit.fims.base.service.bean;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Resource;
import org.apache.catalina.connector.ClientAbortException;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import com.fasterxml.jackson.databind.ObjectMapper;
import cokr.xit.fims.base.SseEntity;
import cokr.xit.foundation.component.AbstractBean;
@Component("sseBean")
public class SseBean extends AbstractBean {
private static final long ONE_HOUR = 60 * 1000;
private String cursor;
private ConcurrentHashMap<String, SseEntity> sseMap = new ConcurrentHashMap<>();
private static final DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
@Resource(name="objectMapper")
private ObjectMapper objectMapper;
/** SSE .
* @param sseKey
* @return SseEmitter
*/
public SseEmitter start(String sseKey) {
SseEmitter emitter = new SseEmitter(-1L);
sseMap.put(sseKey, new SseEntity(emitter));
return emitter;
}
/** SSE .
* @param sseKey
* @return SseBean
*/
public SseBean setCursor(String sseKey) {
this.cursor = sseKey;
return this;
}
/** .
* @param msg
* @return SseBean
*/
public void send(Object msg) {
if(ifEmpty(this.cursor, ()->"").equals("")) {
return;
}
SseEntity se = sseMap.get(this.cursor);
if (se == null) {
return;
}
try {
se.getEmitter().send(msg);
} catch (ClientAbortException ex) {
if (se != null && se.getEmitter() != null) {
se.getEmitter().complete();
se.setEmitter(null);
sseMap.remove(this.cursor);
}
} catch (Exception e) {
e.printStackTrace();
if (se != null && se.getEmitter() != null) {
se.getEmitter().complete();
se.setEmitter(null);
sseMap.remove(this.cursor);
}
}
}
/** .
* @param
* @return
*/
public void end() {
if(ifEmpty(this.cursor, ()->"").equals("")) {
return;
}
SseEntity se = sseMap.get(this.cursor);
if (se == null) {
return;
}
String msg = "FIN";
try {
se.getEmitter().send(msg);
} catch (ClientAbortException ex) {
} catch (Exception e) {
e.printStackTrace();
} finally {
if (se != null && se.getEmitter() != null) {
se.getEmitter().complete();
se.setEmitter(null);
sseMap.remove(this.cursor);
}
}
}
@Scheduled(cron = "0 0 */1 * * *")
public void clearSseEmitter() {
long now = System.currentTimeMillis() - ONE_HOUR;
Iterator<String> it = sseMap.keys().asIterator();
System.out.println("size: "+sseMap.size());
while (it.hasNext()) {
String key = it.next();
System.out.println("key: "+key);
SseEntity se = sseMap.get(key);
if (now > se.getCreatedAt()) {
System.out.println("clear old ssemitter "+key+" : "+format.format(se.getCreatedAt()));
if (se.getEmitter() != null) {
se.setEmitter(null);
}
sseMap.remove(key);
}
}
}
public SseBean setProgress(String key, Object value) {
if(ifEmpty(this.cursor, ()->"").equals("")) {
return this;
}
SseEntity se = sseMap.get(this.cursor);
se.getProgress().set(key, value);
return this;
}
public SseBean increaseProgress(String key) {
if(ifEmpty(this.cursor, ()->"").equals("")) {
return this;
}
SseEntity se = sseMap.get(this.cursor);
int i = se.getProgress().number(key).intValue();
se.getProgress().set(key, i+1);
return this;
}
public SseBean increaseProgress(String key, int num) {
if(ifEmpty(this.cursor, ()->"").equals("")) {
return this;
}
SseEntity se = sseMap.get(this.cursor);
int i = se.getProgress().number(key).intValue();
se.getProgress().set(key, i+num);
return this;
}
public void sendProgress() {
if(ifEmpty(this.cursor, ()->"").equals("")) {
return;
}
SseEntity se = sseMap.get(this.cursor);
if (se == null) {
return;
}
try {
se.getEmitter().send(objectMapper.writeValueAsString(se.getProgress()));
} catch (ClientAbortException ex) {
if (se != null && se.getEmitter() != null) {
se.getEmitter().complete();
se.setEmitter(null);
sseMap.remove(this.cursor);
}
} catch (Exception e) {
e.printStackTrace();
if (se != null && se.getEmitter() != null) {
se.getEmitter().complete();
se.setEmitter(null);
sseMap.remove(this.cursor);
}
}
}
}

@ -0,0 +1,18 @@
package cokr.xit.fims.base.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.security.access.service.ActionQuery;
@Controller
public class ActionGroupController extends cokr.xit.base.security.access.web.ActionGroupController {
@Override
public ModelAndView main() {
ModelAndView mav = getActionGroupList(new ActionQuery().setFetchAll(true));
mav.setViewName("base/actionGroup/actionGroup-main");
return mav.addObject("groupList", toJson(mav.getModel().get("groupList")));
}
}

@ -0,0 +1,18 @@
package cokr.xit.fims.base.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.security.access.service.AuthorityQuery;
@Controller
public class AuthorityController extends cokr.xit.base.security.access.web.AuthorityController {
@Override
public ModelAndView main() {
ModelAndView mav = getAuthorityList(new AuthorityQuery().setFetchAll(true));
mav.setViewName("base/authority/authority-main");
return mav.addObject("authorityList", toJson(mav.getModel().get("authorityList")));
}
}

@ -0,0 +1,74 @@
package cokr.xit.fims.base.web;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.code.service.CodeQuery;
import cokr.xit.base.code.service.bean.CodeBean;
import cokr.xit.fims.base.service.bean.OgdpBean;
import cokr.xit.fims.cmmn.CmmnQuery;
import cokr.xit.fims.mngt.service.bean.TaskBean;
import cokr.xit.foundation.UserInfo;
import cokr.xit.foundation.data.DataObject;
@Controller
public class CodeController extends cokr.xit.base.code.web.CodeController {
@Resource(name = "codeBean")
private CodeBean codeBean;
@Resource(name = "taskBean")
private TaskBean taskBean;
@Resource(name = "ogdpBean")
private OgdpBean ogdpBean;
@RequestMapping(name="모든 업무구분코드 조회",value="/getAllTaskSeCd.do")
public ModelAndView getAllTaskSeCd() {
ModelAndView mav = new ModelAndView("jsonView");
CodeQuery codeQuery = new CodeQuery();
codeQuery.setGroupIDs("FIM054");
List<DataObject> taskList = codeBean.getCodeList(codeQuery);
Map<String,String> allTask = taskList.stream()
.collect(Collectors.toMap((item) -> item.string("CODE"), (item) -> item.string("CODE_VAL")));
mav.addObject("allTask", allTask);
return mav;
}
@RequestMapping(name="시군구 업무 설정 유무 조회", value="/sggHasTask.do")
public ModelAndView sggHasTask() {
ModelAndView mav = new ModelAndView("jsonView");
UserInfo userInfo = currentUser();
if(userInfo.getInstitute().equals("ADMIN00")) {
mav.addObject("sggHasTask", "Y");
} else {
ogdpBean.initUserInfo(userInfo);
String sggCd = (String)userInfo.getInfo().get("sggCd");
CmmnQuery req = new CmmnQuery();
req.setUseYn("Y");
req.setSggCd(sggCd);
List<DataObject> result = taskBean.getTasks(req);
if(result != null && !result.isEmpty()) {
mav.addObject("sggHasTask", "Y");
} else {
mav.addObject("sggHasTask", "N");
}
}
return mav;
}
}

@ -0,0 +1,129 @@
package cokr.xit.fims.base.web;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.IntStream;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.docs.xls.CellDef;
import cokr.xit.base.docs.xls.XLSWriter;
import cokr.xit.base.syslog.LogQuery;
import cokr.xit.base.syslog.service.LoggingService;
import cokr.xit.fims.task.TaskRequestMappingHandlerMapping;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.web.RequestHandlerReader;
@Controller
public class LoggingController extends cokr.xit.base.syslog.web.LoggingController {
@Resource(name = "loggingService")
private LoggingService loggingService;
@Autowired
private TaskRequestMappingHandlerMapping requestHandlers;
private RequestHandlerReader requestReader = new RequestHandlerReader();
@Override
public ModelAndView getLogs(LogQuery req) {
if(req.getUserAccounts() != null && req.getUserAccounts().length > 0
&& req.getUserAccounts()[0] != null) {
String[] userAccounts = req.getUserAccounts();
for(int i=0; i < userAccounts.length ; i++) {
userAccounts[i] = userAccounts[i].toUpperCase();
}
req.setUserAccounts(userAccounts);
}
boolean download = !isEmpty(req.getDownload());
if (!download)
setFetchSize(req);
else
req.setPageNum(0).setFetchSize(0);
String
toDate = req.getToDate(),
fromDate = req.getFromDate();
if (isEmpty(toDate)) {
Date date = new Date();
toDate = DataFormat.yyyy_mm_dd(date);
req.setToDate(toDate.replace("-", ""));
if (isEmpty(fromDate)) {
fromDate = DataFormat.yyyy_mm_dd(new Date(date.getTime() - 1000L * 60L * 60L * 24L * 30L));
req.setFromDate(fromDate.replace("-", ""));
}
}
List<DataObject>
list = loggingService.getLogs(req),
web = list.stream()
.filter(row -> "web".equals(row.get("LOG_TYPE")))
.toList();
if (!list.isEmpty()) {
Map<String, DataObject> reqs = requestReader.asTree(requestHandlers).getIndex();
list.forEach(row -> {
Object obj = row.get("REG_DT");
row.set("REG_DT", DataFormat.yyyy_mm_dd_hh_mm_ss(obj));
obj = row.get("URL");
if (isEmpty(obj)) return;
DataObject reqInfo = reqs.get(obj);
row.set("DSCRP", reqInfo != null ? reqInfo.get("name") : "");
});
}
if (!download)
return setCollectionInfo(
new ModelAndView("jsonView")
.addObject("fromDate", fromDate)
.addObject("toDate", toDate),
list,
"syslog"
);
else
return download(list);
}
private ModelAndView download(List<DataObject> list) {
List<CellDef> cellDefs = List.of(
new CellDef().setLabel("계정").setField("USER_ACNT"),
new CellDef().setLabel("사용자이름").setField("USER_NM"),
new CellDef().setLabel("IP 주소").setField("IP_ADDR"),
new CellDef().setLabel("로그유형").setField("LOG_TYPE_NM"),
new CellDef().setLabel("접속일시").setField("REG_DT"),
new CellDef().setLabel("URL").setField("URL"),
new CellDef().setLabel("설명").setField("DSCRP"),
new CellDef().setLabel("파일이름").setField("FILE_NM"),
new CellDef().setLabel("민감정보").setField("PSNL_INFO")
);
XLSWriter xlsx = new XLSWriter()
.worksheet(0)
.trackWidth(IntStream.range(0, cellDefs.size()).toArray())
.cell(0, 0)
.value("시스템 로그 목록").merge(0, cellDefs.size() - 1)
.cell(2, 0)
.rowValues(CellDef.header(cellDefs, null))
.cell(3, 0)
.values(
list,
CellDef.values(cellDefs)
)
.autoWidth();
return new ModelAndView("downloadView")
.addObject("download",
xlsx.getDownloadable()
.setFilename("시스템 로그 목록.xlsx")
);
}
}

@ -0,0 +1,208 @@
package cokr.xit.fims.base.web;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.code.service.CodeService;
import cokr.xit.base.security.access.service.AuthorityService;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.base.user.service.SigunguDepartmentService;
import cokr.xit.base.user.service.UserService;
import cokr.xit.fims.base.FimsUser;
import cokr.xit.fims.base.service.bean.OgdpBean;
import cokr.xit.fims.base.service.bean.SseBean;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.task.TaskRequestMappingHandlerMapping;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.web.RequestHandlerReader;
@Controller
public class MainController extends cokr.xit.base.web.MainController {
@Autowired
private TaskRequestMappingHandlerMapping requestHandlers;
@Autowired
private SseBean sseBean;
@Resource(name="ogdpBean")
private OgdpBean ogdpBean;
@Resource(name="userService")
private UserService userService;
@Resource(name="sigunguDepartmentService")
private SigunguDepartmentService sggDeptService;
@Resource(name="codeService")
private CodeService codeService;
@Resource(name="authorityService")
private AuthorityService authorityService;
@Override
public ModelAndView loginPage() {
ModelAndView mav = new ModelAndView("login");
List<DataObject> sggs = sggDeptService.getSigunguList(new SigunguQuery());
if (sggs.isEmpty()) {
throw new RuntimeException("No sigungu info found.");
}
for(DataObject sgg : sggs) {
int count = ogdpBean.countUser(sgg.string("SGG_CD"));
String userUseYn = count > 0 ? "Y" : "N";
sgg.set("USER_USE_YN", userUseYn);
}
boolean multiple = sggs.size() > 1;
mav.addObject("sggs", toJson(sggs));
mav.addObject("multipleSggs", multiple);
mav.addObject("sggList", sggs);
mav.addObject("sysSggCd", System.getProperty("sgg"));
return mav;
}
@Override
public ModelAndView getURLs(boolean multiple) {
List<DataObject> urls = new RequestHandlerReader().read(requestHandlers);
attachTaskPrefixName(urls);
return new ModelAndView("select-url")
.addObject("multiple", multiple)
.addObject("urls", toJson(urls));
}
@SuppressWarnings("unchecked")
private void attachTaskPrefixName(List<DataObject> list) {
for(DataObject item : list) {
String name = item.string("name");
String url = item.string("url");
if(!name.equals(url)) {
switch (url) {
case "/BPV": item.set("name","전용차로과태료업무 "+name);
case "/PVS": item.set("name","주정차위반과태료업무 "+name);
case "/DPV": item.set("name","장애인주차위반과태료업무 "+name);
case "/ECA": item.set("name","전기차주차위반과태료업무 "+name);
case "/PES": item.set("name","밤샘주차위반과태료업무 "+name);
case "/DVS": item.set("name","미세먼지과태료업무 "+name);
}
}
if(item.get("children") != null) {
attachTaskPrefixName((List<DataObject>) item.get("children"));
}
}
}
@GetMapping(name="회원가입 페이지", value="/signupPage.do")
public ModelAndView signupPage(String sggCd, String cntnSeCd) {
ModelAndView mav = new ModelAndView("fims/user/user01010-main");
mav.addObject("userInfo", "{}");
if(cntnSeCd.equals("01")) {
mav.addObject("cntnSeCd", "01");
mav.addObject("allOgdpList", ogdpBean.selectAllOgdpList());
List<DataObject> ableOgdpList = ogdpBean.selectAbleOgdpList(true, sggCd);
mav.addObject("ableOgdpList", ableOgdpList);
Map<String, List<CommonCode>> commonCodes = codeService.getCodesOf("CMN008");
mav.addObject("CMN008List", commonCodes.get("CMN008"));
} else if(cntnSeCd.equals("02")) {
List<DataObject> sggs = sggDeptService.getSigunguList(new SigunguQuery().setSggIDs(sggCd));
mav.addObject("cntnSeCd", "02");
mav.addObject("sggCd", sggCd);
mav.addObject("institute", sggs.get(0).string("INST_CD"));
mav.addObject("userSeCd", "21");
}
return mav;
}
@RequestMapping(name="회원가입", value="/signup.do")
public ModelAndView signup(FimsUser user) {
ModelAndView mav = new ModelAndView("jsonView");
user.setAccount(user.getAccount().toUpperCase());
boolean saved = userService.create(user);
if(user.getUserSeCd() != null && user.getUserSeCd().equals("21")) {
int affected = authorityService.addUsers("ROLE_RENT", user.getId());
}
mav.addObject("saved",saved);
return mav;
}
@RequestMapping(name="중복 확인", value="/duplicate.do")
public ModelAndView isDuplicate(String account, String sggCd) {
account = account.toUpperCase();
FimsUser user = userService.getUser(account, sggCd);
return new ModelAndView("jsonView")
.addObject("duplicate", user != null);
}
@RequestMapping(name="접속자 IP 확인", value="/ipInfo.do")
public ModelAndView ipInfo(HttpServletRequest hreq) {
String remoteAddr = CmmnUtil.getClientIpAddr(hreq);
String net = "";
String[] LOCAL = {"127.0.0.1", "0:0:0:0:0:0:0:1"};
String[] PRIVATES = {"10.","172.16.","172.31.","192.168."};
String[] SGG_NET = {"211.119.124."};
if(remoteAddr.equals(LOCAL[0]) || remoteAddr.equals(LOCAL[1])) {
String flag = hreq.getParameter("flag");
if(flag != null && !flag.equals("")){
net = flag;
} else {
net = "intra";
}
} else if(remoteAddr.startsWith(PRIVATES[0])
|| remoteAddr.startsWith(PRIVATES[1])
|| remoteAddr.startsWith(PRIVATES[2])
|| remoteAddr.startsWith(PRIVATES[3])){
net = "intra";
} else if(SGG_NET.length > 0){
for(String sgg : SGG_NET) {
if(remoteAddr.startsWith(sgg)) {
net = "intra";
}
}
} else {
net = "inter";
}
return new ModelAndView("jsonView")
.addObject("remoteAddr", remoteAddr)
.addObject("net", net)
;
}
@RequestMapping(name="서버 이벤트 수신 등록", value="/subscribe.do")
public SseEmitter subscribe(HttpServletRequest req) {
return sseBean.start(req.getParameter("sseKey"));
}
}

@ -0,0 +1,6 @@
package cokr.xit.fims.base.web;
import org.springframework.stereotype.Controller;
@Controller
public class MenuController extends cokr.xit.base.menu.web.MenuController {}

@ -0,0 +1,321 @@
package cokr.xit.fims.base.web;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.commons.io.FilenameUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.user.Department;
import cokr.xit.base.user.Sigungu;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.base.user.service.SigunguDepartmentService;
import cokr.xit.base.user.web.SigunguDepartmentController;
import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.base.FimsDepartment;
import cokr.xit.fims.base.FimsSigungu;
import cokr.xit.fims.base.OgdpQuery;
import cokr.xit.fims.base.service.bean.OgdpBean;
import cokr.xit.fims.cmmn.CmmnQuery;
import cokr.xit.fims.cmmn.service.StngService;
import cokr.xit.fims.mngt.Task;
import cokr.xit.fims.mngt.VltnQuery;
import cokr.xit.fims.mngt.service.bean.TaskBean;
import cokr.xit.fims.mngt.service.bean.VltnBean;
import cokr.xit.foundation.UserInfo;
import cokr.xit.foundation.data.DataObject;
@Controller
@RequestMapping(name = "시군구,기관,부서", value = "/ogdp")
public class OgdpController extends ApplicationController {
public class METHOD_URL {
public static final String
sggStngMain = "/sggStngMain.do",
getSggStngInfo = "/getSggStngInfo.do",
getTasks = "/getTasks.do",
getVltns = "/getVltns.do",
updateSggStng = "/updateSggStng.do",
updateTaskStng = "/updateTaskStng.do",
createTaskStng = "/createTaskStng.do",
deptStngMain = "/deptStngMain.do",
getDeptStngList = "/getDeptStngList.do",
getDeptStngInfo = "/getDeptStngInfo.do",
updateDeptStng = "/updateDeptStng.do"
;
}
@Controller
public class DefaultOgdpController extends SigunguDepartmentController<Sigungu, Department> {}
@Resource(name="sigunguDepartmentService")
private SigunguDepartmentService sggDeptService;
@Resource(name="ogdpBean")
private OgdpBean ogdpBean;
/** 설정 정보 서비스 */
@Resource(name = "stngService")
private StngService stngService;
/** 업무 정보 Bean */
@Resource(name = "taskBean")
private TaskBean taskBean;
/** 위반 정보 Bean */
@Resource(name = "vltnBean")
private VltnBean vltnBean;
/** .
* @return fims/ogdp/ogdp01010-main
*/
@RequestMapping(name="시군구 설정 정보 관리 메인", value=METHOD_URL.sggStngMain)
public ModelAndView sggStngMain(String sggCd) {
ModelAndView mav = new ModelAndView();
UserInfo userInfo = currentUser();
if(userInfo.getInstitute().equals("ADMIN00")) {
if(ifEmpty(sggCd, ()->"").equals("")) {
mav.setViewName("fims/ogdp/select-sgg");
mav.addObject("pageName", "selectSgg");
List<DataObject> sggList = sggDeptService.getSigunguList(new SigunguQuery()) ;
mav.addObject("sggList", sggList);
} else {
mav.setViewName("fims/ogdp/ogdp01010-main");
mav.addObject("pageName", "ogdp01010");
mav.addObject("sggCd", sggCd);
}
} else {
mav.setViewName("fims/ogdp/ogdp01010-main");
mav.addObject("pageName", "ogdp01010");
ogdpBean.initUserInfo(userInfo);
mav.addObject("sggCd", userInfo.getInfo().get("sggCd"));
}
return mav;
}
/** .<br />
* @param req
* @return jsonView
*/
@RequestMapping(name="시군구 설정 조회", value=METHOD_URL.getSggStngInfo)
public ModelAndView getSggStngInfo(OgdpQuery req) {
ModelAndView mav = new ModelAndView("jsonView");
DataObject sggInfo = ogdpBean.getSggStngInfo(req);
mav.addObject("sggInfo", sggInfo);
return mav;
}
/** .<br />
* @param req
* @return jsonView
*/
@RequestMapping(name="업무 조회", value=METHOD_URL.getTasks)
public ModelAndView getTasks(CmmnQuery req) {
List<DataObject> result = taskBean.getTasks(req);
return setPagingInfo(new ModelAndView("jsonView"), result, "task");
}
/** .<br />
* @return
*/
@RequestMapping(name="위반정보 조회", value=METHOD_URL.getVltns)
public ModelAndView getVltns(VltnQuery req) {
List<DataObject> result = vltnBean.getVltns(req);
return setPagingInfo(new ModelAndView("jsonView"), result, "vltn");
}
/** .
* @param sgg , symbol , logo , offcs
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@RequestMapping(name="시군구 설정 정보 수정", value=METHOD_URL.updateSggStng)
public ModelAndView updateSggStng(FimsSigungu sgg, MultipartFile symbol, MultipartFile logo, MultipartFile offcs) {
ModelAndView mav = new ModelAndView("jsonView");
String sggCd = sgg.getSggID();
if(symbol != null && !symbol.isEmpty() && symbol.getSize() != 0) {
Map<String,String> newSymbol = this.uploadForSgg(symbol, sggCd, "symbol");
sgg.setSymbolFilepath(newSymbol.get("filePath"));
sgg.setSymbolFilename(newSymbol.get("fileName"));
}
if(logo != null && !logo.isEmpty() && logo.getSize() != 0) {
Map<String,String> newLogo = this.uploadForSgg(logo, sggCd, "logo");
sgg.setLogoFilepath(newLogo.get("filePath"));
sgg.setLogoFilename(newLogo.get("fileName"));
}
if(offcs != null && !offcs.isEmpty() && offcs.getSize() != 0) {
Map<String,String> newOffcs = this.uploadForSgg(offcs, sggCd, "offcs");
sgg.setOfficialSealFilepath(newOffcs.get("filePath"));
sgg.setOfficialSealFilename(newOffcs.get("fileName"));
}
boolean saved = ogdpBean.updateSggStng(sgg);
mav.addObject("saved", saved);
return mav;
}
private Map<String, String> uploadForSgg(MultipartFile mf, String sggCd, String fileSe){
Map<String,String> newFileInfoMap = new HashMap<>();
String workDirPath = "files/attachment/etc/"+fileSe;
String ext = FilenameUtils.getExtension(mf.getOriginalFilename());
String fileName = sggCd+"."+ext;
File workDir = new File(workDirPath);
workDir.mkdirs();
String newFileFullPath = workDirPath + "/" + fileName;
try {
File newFile = new File(newFileFullPath);
if(newFile.exists()) {
if(!newFile.delete()) {
throw new RuntimeException("[F]이미지 업로드 중 오류가 발생하였습니다.");
}
}
mf.transferTo(newFile);
} catch (Exception e) {
throw new RuntimeException("[F]이미지 업로드 중 오류가 발생하였습니다.");
}
newFileInfoMap.put("filePath", newFileFullPath);
newFileInfoMap.put("fileName", mf.getOriginalFilename());
return newFileInfoMap;
}
/** , .
* @param sgg
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@RequestMapping(name="업무 설정 정보 수정", value=METHOD_URL.updateTaskStng)
public ModelAndView updateTaskStng(Task task) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
String rtnMsg = stngService.updateTaskStng(task, task.getVltnStngList());
if(rtnMsg.contains("[S]")) {
saved = true;
}
mav.addObject("saved", saved);
return mav;
}
/** , .
* @param sggCd , taskSeCd
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@RequestMapping(name="시군구 과태료 업무 추가", value=METHOD_URL.createTaskStng)
public ModelAndView createTaskStng(String sggCd, String taskSeCd) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
String rtnMsg = stngService.createTaskStng(sggCd, taskSeCd);
if(rtnMsg.contains("[S]")) {
saved = true;
}
mav.addObject("saved", saved);
return mav;
}
/** .
* @return fims/ogdp/ogdp02010-main
*/
@RequestMapping(name="부서 설정 정보 관리 메인", value=METHOD_URL.deptStngMain)
public ModelAndView deptStngMain() {
ModelAndView mav = new ModelAndView();
mav.setViewName("fims/ogdp/ogdp02010-main");
mav.addObject("pageName", "ogdp02010");
List<DataObject> allSggList = sggDeptService.getSigunguList(new SigunguQuery());
mav.addObject("sggList", allSggList);
return mav;
}
/** .<br />
* {@link OgdpService#getDeptStngList(CmmnQuery)}
* @param query
* @return jsonView
*/
@RequestMapping(name="부서 설정 목록 조회", value=METHOD_URL.getDeptStngList)
public ModelAndView getDeptStngList(OgdpQuery query) {
setFetchSize(query);
return setPagingInfo(new ModelAndView("jsonView"), ogdpBean.getDeptStngList(query),"");
}
/** ID (info) .
* @param query
* @return fims/ogdp/ogdp02020-info jsonView
* <pre>{
* "deptInfo":
* }</pre>
*/
@RequestMapping(name="부서 설정 상세 조회", value=METHOD_URL.getDeptStngInfo)
public ModelAndView getDeptStngInfo(OgdpQuery query) {
DataObject deptInfo = new DataObject();
if(!ifEmpty(query.getDeptCd(), ()->"").equals("")) {
deptInfo = ogdpBean.getDeptStngInfo(query);
} else {
deptInfo = null;
}
boolean json = jsonResponse();
ModelAndView mav = new ModelAndView(json ? "jsonView" : "fims/ogdp/ogdp02020-info");
mav.addObject("pageName", "ogdp02020");
mav.addObject("deptInfo", json ? deptInfo : toJson(deptInfo));
return mav;
}
/** .
* @param dept
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@RequestMapping(name="부서 설정 수정", value=METHOD_URL.updateDeptStng)
public ModelAndView updateDeptStng(FimsDepartment dept) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = ogdpBean.updateDeptStng(dept);
mav.addObject("saved", saved);
return mav;
}
}

@ -0,0 +1,241 @@
package cokr.xit.fims.base.web;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.code.service.CodeQuery;
import cokr.xit.base.code.service.CodeService;
import cokr.xit.base.code.service.bean.CodeBean;
import cokr.xit.base.security.SecuredUserInfo;
import cokr.xit.base.security.access.service.AuthorityService;
import cokr.xit.base.user.UserQuery;
import cokr.xit.base.user.service.UserService;
import cokr.xit.fims.base.FimsUser;
import cokr.xit.fims.base.service.bean.OgdpBean;
import cokr.xit.fims.cmmn.service.bean.StngBean;
import cokr.xit.foundation.data.DataObject;
@Controller
public class UserController extends cokr.xit.base.user.web.UserController<FimsUser> {
@Resource(name="userService")
private UserService userService;
@Resource(name = "codeBean")
private CodeBean codeBean;
@Resource(name="codeService")
private CodeService codeService;
@Resource(name="authorityService")
private AuthorityService authorityService;
@Resource(name="ogdpBean")
private OgdpBean ogdpBean;
@Resource(name = "stngBean")
private StngBean stngBean;
@Override
public ModelAndView main() {
ModelAndView mav = super.main();
Map<String, List<CommonCode>> commonCodes = codeService.getCodesOf("CMN009");
mav.addObject("CMN009List", commonCodes.get("CMN009"));
return mav;
}
@Override
public ModelAndView getInfo(String userID) {
ModelAndView mav = new ModelAndView();
boolean json = !isEmpty(userID) && jsonResponse();
String viewName = json ? "jsonView" : "base/user/user-info";
if (!isEmpty(userID)) {
DataObject userInfo = userService.getUserInfo(userID);
mav.setViewName(viewName);
mav.addObject("userInfo", json ? userInfo : toJson(userInfo));
} else {
mav.setViewName("base/user/user-info");
}
mav.addObject("allOgdpList", ogdpBean.selectAllOgdpList());
List<DataObject> ableOgdpList = ogdpBean.selectAbleOgdpList(false, currentUser().getOrgID());
mav.addObject("ableOgdpList", ableOgdpList);
Map<String, List<CommonCode>> commonCodes = codeService.getCodesOf("CMN008");
mav.addObject("CMN008List", commonCodes.get("CMN008"));
return mav;
}
@Override
public ModelAndView create(FimsUser user) {
user.setAccount(user.getAccount().toUpperCase());
return super.create(user);
}
@Override
public ModelAndView isDuplicate(String account, String institute) {
account = account.toUpperCase();
return super.isDuplicate(account, institute);
}
@Override
public ModelAndView getUserList(UserQuery req) {
if(req.getBy() != null && req.getTerm() != null && req.getBy().equals("userAccount")) {
req.setTerm(req.getTerm().toUpperCase());
}
return super.getUserList(req);
}
@RequestMapping(name="내 정보 조회",value="/myInfo.do")
public ModelAndView myInfo() {
ModelAndView mav = new ModelAndView("jsonView");
SecuredUserInfo userInfo = currentUser();
//시군구,기관,부서
ogdpBean.initUserInfo(userInfo);
//관리자여부,내부망사용자여부,업무권한여부
boolean isAdmin = userInfo.hasAuthorities("ROLE_ADMIN");
userInfo.getInfo().put("isAdmin", isAdmin);
FimsUser fimsUser = (FimsUser)userInfo.getUser();
boolean isPublicOfficer = fimsUser.getCntnSeCd().equals("01");
userInfo.getInfo().put("isPublicOfficer", isPublicOfficer);
CodeQuery codeQuery = new CodeQuery();
codeQuery.setGroupIDs("FIM054");
List<DataObject> taskList = codeBean.getCodeList(codeQuery);
String[] taskRoles = taskList.stream().map((item) -> { return "ROLE_"+item.string("CODE"); })
.toList().toArray(new String[taskList.size()]);
boolean hasTaskAuth = userInfo.hasAuthorities(taskRoles);
userInfo.getInfo().put("hasTaskAuth", hasTaskAuth);
//사용자별 업무 및 기본업무
stngBean.initUserInfo(userInfo);
//지자체 로고(시군구 설정)
DataObject sggStng = stngBean.getStng("sgg");
userInfo.getInfo().put("sggLogoPath", sggStng.string("LOGO_FILE_PATH"));
userInfo.getInfo().put("sggSymbolPath", sggStng.string("SYMBOL_FILE_PATH"));
mav.addObject("myInfo", userInfo);
return mav;
}
@RequestMapping(name="시스템 연계 정보",value="/sysLinkInfo.do")
public ModelAndView sysLinkInfo() {
ModelAndView mav = new ModelAndView("jsonView");
DataObject deptStng = stngBean.getStng("dept");
DataObject sysLinkInfo = new DataObject();
sysLinkInfo.put("NXRP_LINK_YN", deptStng.string("NXRP_LINK_YN"));
sysLinkInfo.put("CVLCPT_LINK_SE_CD", deptStng.string("CVLCPT_LINK_SE_CD"));
mav.addObject("sysLinkInfo", sysLinkInfo);
return mav;
}
@RequestMapping(name="내 정보 변경 화면", value="/openMyInfo.do")
public ModelAndView openMyInfo() {
ModelAndView mav = new ModelAndView("fims/user/user01010-main");
DataObject userInfo = userService.getUserInfo(currentUser().getId());
mav.addObject("userInfo", toJson(userInfo));
String cntnSeCd = userInfo.string("CNTN_SE_CD");
if(cntnSeCd.equals("01")) {
mav.addObject("cntnSeCd", "01");
mav.addObject("allOgdpList", ogdpBean.selectAllOgdpList());
List<DataObject> ableOgdpList = ogdpBean.selectAbleOgdpList(false, currentUser().getOrgID());
mav.addObject("ableOgdpList", ableOgdpList);
Map<String, List<CommonCode>> commonCodes = codeService.getCodesOf("CMN008");
mav.addObject("CMN008List", commonCodes.get("CMN008"));
} else if(cntnSeCd.equals("02")) {
mav.addObject("cntnSeCd", "02");
}
return mav;
}
@RequestMapping(name="내 정보 변경", value="/updateMyInfo.do")
public ModelAndView updateMyInfo(FimsUser user) {
return super.update(user);
}
@RequestMapping(name="기본업무 저장",value="/saveDefaultTask.do")
public ModelAndView saveDefaultTask(String taskSeCd) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
saved = stngBean.saveDefaultTask(taskSeCd);
mav.addObject("saved", saved);
return mav;
}
@RequestMapping(name="설정정보 조회",value="/stngInfo.do")
public ModelAndView getStngInfo(String type) {
ModelAndView mav = new ModelAndView("jsonView");
DataObject stngInfo = stngBean.getStng(type);
mav.addObject("stngInfo",stngInfo);
return mav;
}
@RequestMapping(name="교부 계좌번호 수정",value="/updateDtbnActno.do")
public ModelAndView updateDtbnActno(String dtbnBankNm, String dtbnActno) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = stngBean.updateDtbnActno(dtbnBankNm, dtbnActno);
mav.addObject("saved", saved);
return mav;
}
@RequestMapping(name="사용자 검색",value="/user02/010/main.do")
public ModelAndView findUserMain(HttpServletRequest hReq, String callbackFuncName) {
ModelAndView mav = new ModelAndView("fims/user/user02010-main");
// 사용자 정보
FimsUser currentUser = (FimsUser)currentUser().getUser();
return mav
.addObject("openerPageName", hReq.getParameter("openerPageName")) // 호출한 Jsp PageName
.addObject("pageName", "user02010") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
.addObject("infoPrefix", "user") // prefix
.addObject("infoPrefixUrl", "/user/user02") // prefixUrl
.addObject("callbackFuncName", callbackFuncName) // 콜백함수(callbackFuncName)
.addObject("sggCd", currentUser.getOrgID()) // 시군구 코드(SGG_CD)
.addObject("deptCd", currentUser.getDeptCode()) // 부서 코드(DEPT_CD)
.addObject("userAcnt", currentUser.getAccount()) // 사용자 계정(USER_ACNT)
;
}
@RequestMapping(name="회원탈퇴", value="/cancelAccount.do")
public ModelAndView cancelAccount() {
int affected = userService.remove(currentUser().getId());
return new ModelAndView("jsonView")
.addObject("affected", affected)
.addObject("saved", affected > 0);
}
}

@ -0,0 +1,225 @@
package cokr.xit.fims.cmmn;
import cokr.xit.foundation.component.QueryRequest;
public class CmmnQuery extends QueryRequest {
private static final long serialVersionUID = 1L;
private String sseKey;
private String mainOption;
private String subOption;
private String cellDefs;
private String includePhoto;
private String thisDay;
private String taskSeCd; // 업무 구분 코드
private String sggCd; // 시군구 코드
private String deptCd; // 부서 코드
private String instCd; // 기관 코드
private String useYn; // 사용 여부
private String delYn; // 삭제 여부
private String schDateOpt; // 검색 일자 구분
private String schDateFrom; // 검색 일자 시작
private String schDateTo; // 검색 일자 종료
private String schRegDateOpt; // 등록 일자 구분
private String schRegDateFrom; // 등록 일자 시작
private String schRegDateTo; // 등록 일자 종료
private String schRgtrOpt; // 등록 사용자 구분
private String schRgtrCd; // 등록 사용자 코드
private String schRgtrNm; // 등록 사용자 명
public String getSseKey() {
return ifEmpty(sseKey, () -> null);
}
public <T extends CmmnQuery> T setSseKey(String sseKey) {
this.sseKey = sseKey;
return self();
}
public String getMainOption() {
return ifEmpty(mainOption, () -> null);
}
public <T extends CmmnQuery> T setMainOption(String mainOption) {
this.mainOption = mainOption;
return self();
}
public String getSubOption() {
return ifEmpty(subOption, () -> null);
}
public <T extends CmmnQuery> T setSubOption(String subOption) {
this.subOption = subOption;
return self();
}
public String getCellDefs() {
return ifEmpty(cellDefs, () -> null);
}
public <T extends CmmnQuery> T setCellDefs(String cellDefs) {
this.cellDefs = cellDefs;
return self();
}
public String getIncludePhoto() {
return ifEmpty(includePhoto, () -> null);
}
public <T extends CmmnQuery> T setIncludePhoto(String includePhoto) {
this.includePhoto = includePhoto;
return self();
}
public String getThisDay() {
return ifEmpty(thisDay, () -> null);
}
public <T extends CmmnQuery> T setThisDay(String thisDay) {
this.thisDay = thisDay;
return self();
}
public String getSggCd() {
return ifEmpty(sggCd, () -> null);
}
public <T extends CmmnQuery> T setSggCd(String sggCd) {
this.sggCd = sggCd;
return self();
}
public String getDeptCd() {
return ifEmpty(deptCd, () -> null);
}
public <T extends CmmnQuery> T setDeptCd(String deptCd) {
this.deptCd = deptCd;
return self();
}
public String getTaskSeCd() {
return ifEmpty(taskSeCd, () -> null);
}
public <T extends CmmnQuery> T setTaskSeCd(String taskSeCd) {
this.taskSeCd = taskSeCd;
return self();
}
public String getInstCd() {
return ifEmpty(instCd, () -> null);
}
public <T extends CmmnQuery> T setInstCd(String instCd) {
this.instCd = instCd;
return self();
}
public String getUseYn() {
return ifEmpty(useYn, () -> null);
}
public <T extends CmmnQuery> T setUseYn(String useYn) {
this.useYn = useYn;
return self();
}
public String getDelYn() {
return ifEmpty(delYn, () -> null);
}
public <T extends CmmnQuery> T setDelYn(String delYn) {
this.delYn = delYn;
return self();
}
public String getSchDateOpt() {
return ifEmpty(schDateOpt, () -> null);
}
public <T extends CmmnQuery> T setSchDateOpt(String schDateOpt) {
this.schDateOpt = schDateOpt;
return self();
}
public String getSchDateFrom() {
return ifEmpty(schDateFrom, () -> null);
}
public <T extends CmmnQuery> T setSchDateFrom(String schDateFrom) {
this.schDateFrom = schDateFrom;
return self();
}
public String getSchDateTo() {
return ifEmpty(schDateTo, () -> null);
}
public <T extends CmmnQuery> T setSchDateTo(String schDateTo) {
this.schDateTo = schDateTo;
return self();
}
public String getSchRegDateOpt() {
return ifEmpty(schRegDateOpt, () -> null);
}
public <T extends CmmnQuery> T setSchRegDateOpt(String schRegDateOpt) {
this.schRegDateOpt = schRegDateOpt;
return self();
}
public String getSchRegDateFrom() {
return ifEmpty(schRegDateFrom, () -> null);
}
public <T extends CmmnQuery> T setSchRegDateFrom(String schRegDateFrom) {
this.schRegDateFrom = schRegDateFrom;
return self();
}
public String getSchRegDateTo() {
return ifEmpty(schRegDateTo, () -> null);
}
public <T extends CmmnQuery> T setSchRegDateTo(String schRegDateTo) {
this.schRegDateTo = schRegDateTo;
return self();
}
public String getSchRgtrOpt() {
return ifEmpty(schRgtrOpt, () -> null);
}
public <T extends CmmnQuery> T setSchRgtrOpt(String schRgtrOpt) {
this.schRgtrOpt = schRgtrOpt;
return self();
}
public String getSchRgtrCd() {
return ifEmpty(schRgtrCd, () -> null);
}
public <T extends CmmnQuery> T setSchRgtrCd(String schRgtrCd) {
this.schRgtrCd = schRgtrCd;
return self();
}
public String getSchRgtrNm() {
return ifEmpty(schRgtrNm, () -> null);
}
public <T extends CmmnQuery> T setSchRgtrNm(String schRgtrNm) {
this.schRgtrNm = schRgtrNm;
return self();
}
}

@ -0,0 +1,639 @@
package cokr.xit.fims.cmmn;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.format.TextStyle;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.io.FilenameUtils;
import org.springframework.core.io.ClassPathResource;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.util.DateFormats;
public class CmmnUtil {
public static List<DataObject> getDataObjectListFromMap(Map<String,?> map, String key) {
ArrayList<DataObject> dataObjectList = new ArrayList<>();
Object list = map.get(key);
if(list == null) {
return null;
}
if(list instanceof ArrayList<?>) {
for(Object o : (ArrayList<?>) list) {
if(o instanceof DataObject) {
dataObjectList.add((DataObject)o);
}
}
}
return dataObjectList;
}
/**
* HTML .
* @param HTML
* @return
*/
public static String escapeHTMLEntity(String str) {
str = str.replaceAll("&lt;", "<");
str = str.replaceAll("&gt;", ">");
str = str.replaceAll("&amp;", "&");
str = str.replaceAll("&quot;", "\\\"");
str = str.replaceAll("#39;", "'");
return str;
}
public static String spacedJoin(String... strings) {
String result = "";
for(String str : strings) {
if(str == null) {
str = "";
}
if(result.equals("") || str.equals("")) {
result += str;
} else {
result += " " + str;
}
}
return result;
}
/**
* .
* @param
* @return boolean
*/
public static boolean isNumeric(String str) {
String REGEXP_PATTERN_NUMBER = "^[\\d]*$";
return Pattern.matches(REGEXP_PATTERN_NUMBER, str);
}
/**
* .
* @param
* @return boolean
*/
public static boolean isKorean(String str) {
String REGEXP_PATTERN_KOR = "^[가-힣]*$";
return Pattern.matches(REGEXP_PATTERN_KOR, str);
}
/**
* .
* @param index , ( true, false), startFromZero 0 (0 true, 1 false)
* @return (A~Z)
*/
public static String indexToAlphabet(int index, boolean isUpper, boolean startFromZero) {
int A = isUpper ? 65 : 97;
int Z = isUpper ? 90 : 122;
int charCode = (A-1);
charCode += index;
if(startFromZero) {
charCode++;
}
if(charCode < A || charCode > Z) {
return "";
}
return ""+(char)charCode;
}
/**
* .
* @param orgnFileName , append
* @return
*/
public static String appendFileName(String orgnFileName, String append) {
return FilenameUtils.removeExtension(orgnFileName) + append + "." + FilenameUtils.getExtension(orgnFileName);
}
/**
* .
* @param source , target , mosaicInfos
* @return
*/
public static void createMaskedImage(InputStream source, File target, List<DataObject> mosaicInfos) {
BufferedImage buffer_black_image = new BufferedImage(1, 1, BufferedImage.TYPE_3BYTE_BGR);
String extension = FilenameUtils.getExtension(target.getName());
try {
BufferedImage buffer_original_image = ImageIO.read(source);
Graphics2D graphic = buffer_original_image.createGraphics();
for(DataObject mosaicInfo : mosaicInfos){
int mosaicX = mosaicInfo.number("X_AXS").intValue();
int mosaicY = mosaicInfo.number("Y_AXS").intValue();
int mosaicWidth = mosaicInfo.number("MOSC_LEN").intValue();
int mosaicHeight = mosaicInfo.number("MOSC_HGT").intValue();
graphic.drawImage(buffer_black_image, mosaicX, mosaicY, mosaicWidth, mosaicHeight, null);
}
ImageIO.write(buffer_original_image, extension, target);
} catch (IOException e) {
throw new RuntimeException("이미지 모자이크 처리 중 오류가 발생하였습니다.");
}
}
/**
* .
* @param file , removeSelf
* @return
*/
public static int deleteEmptyDir(File file, boolean removeSelf) {
if (!file.isDirectory()) return 0;
int delCnt=0;
for (File subFile : file.listFiles()) {
if (subFile.isDirectory()) {
delCnt+=deleteEmptyDir(subFile, true);
}
}
if(removeSelf) {
if (file.listFiles().length==0) {
if(!file.delete()) {
throw new RuntimeException("파일 삭제 중 오류가 발생하였습니다.");
}
delCnt++;
}
}
return delCnt;
}
/**
* .
* @param root
* @return
*/
public static void removeDuplicateFileName(String root) {
List<Path> fileList = null;
try (Stream<Path> pathStream = Files.walk(Paths.get(root))){
fileList = pathStream.filter(Files::isRegularFile).toList();
} catch (IOException e) {
throw new RuntimeException("파일 조회 오류."+e);
}
if(fileList != null && !fileList.isEmpty()) {
Map<String, List<Path>> byFileName = fileList.stream().collect(Collectors.groupingBy(item -> item.toFile().getName()));
Iterator<String> keys = byFileName.keySet().iterator();
while( keys.hasNext() ){
String key = keys.next();
List<Path> sameNameFileList = byFileName.get(key);
if(sameNameFileList.size() < 2) {
continue;
}
Path latest = sameNameFileList.stream()
.max(Comparator.comparing(item -> item.toFile().lastModified()))
.orElseThrow();
for(Path sameNameFile : sameNameFileList) {
if(!sameNameFile.equals(latest)) {
if(!sameNameFile.toFile().delete()) {
throw new RuntimeException("[F]파일 삭제 오류");
}
}
}
}
}
}
/**
* .
* @param staticResourcePath , replace
* @return
*/
public static String copyStaticResource(String staticResourcePath, boolean replace) {
try {
String folderPath = FilenameUtils.getFullPathNoEndSeparator(staticResourcePath);
String storageRoot = "files";
ClassPathResource cps = new ClassPathResource(staticResourcePath);
String fileName = cps.getFilename();
File newFile = new File(storageRoot + "/" + folderPath + "/" + fileName);
if(replace && newFile.exists()) {
return storageRoot + "/" + folderPath + "/" + fileName;
}
File folder = new File(storageRoot + "/" + folderPath);
if(!folder.exists()) {
folder.mkdirs();
}
InputStream is = cps.getInputStream();
Files.copy(is, newFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
return storageRoot + "/" + folderPath + "/" + fileName;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* () .
* @param dayStr
* @return
*/
public static int compareToday(String dayStr) {
SimpleDateFormat yyyyMMddFormat = new SimpleDateFormat("yyyyMMdd");
Date curDate = new Date();
String strCurrentDate = yyyyMMddFormat.format(curDate);
if(dayStr.length() == 8) {
return Integer.parseInt(strCurrentDate) - Integer.parseInt(dayStr);
} else if(dayStr.length() == 14) {
return Integer.parseInt(strCurrentDate) - Integer.parseInt(dayStr.substring(0,8));
} else {
throw new RuntimeException("날짜 형식 오류");
}
}
/**
* .
* @param yyyyMMdd , add
* @return
*/
public static String addDay(String yyyyMMdd, int add) {
SimpleDateFormat yyyyMMddFormat = new SimpleDateFormat("yyyyMMdd");
Calendar cal = Calendar.getInstance();
try {
Date dt = yyyyMMddFormat.parse(yyyyMMdd);
cal.setTime(dt);
} catch (Exception e){
throw new RuntimeException(e);
}
cal.add(Calendar.DATE, add);
return yyyyMMddFormat.format(cal.getTime());
}
public static String dateNFormat(String dateStr, String pattern) {
if(dateStr.length() == 8) {
return CmmnUtil.date8Format(dateStr, pattern);
} else if(dateStr.length() == 12) {
return CmmnUtil.date12Format(dateStr, pattern);
} else if(dateStr.length() == 14) {
return CmmnUtil.date14Format(dateStr, pattern);
} else {
return dateStr;
}
}
public static String date8Format(String dateStr, String pattern) {
DateFormats dataFormats = new DateFormats();
Date date = dataFormats.parse("yyyyMMdd", dateStr);
return dataFormats.format(pattern, date);
}
public static String date12Format(String dateStr, String pattern) {
DateFormats dataFormats = new DateFormats();
Date date = dataFormats.parse("yyyyMMddHHmm", dateStr);
return dataFormats.format(pattern, date);
}
public static String date14Format(String dateStr, String pattern) {
DateFormats dataFormats = new DateFormats();
Date date = dataFormats.parse("yyyyMMddHHmmss", dateStr);
return dataFormats.format(pattern, date);
}
/**'-' .
* @param zipCode '-'
* @return '-'
*/
public static String zipCodeFormat(String zipCode) {
if(zipCode != null && zipCode.length() == 6) {
return zipCode.substring(0,3)+"-"+zipCode.substring(3);
}
return zipCode;
}
/**'-' .
* @param rgNo '-'
* @return '-'
*/
public static String rgNoFormat(String rgNo) {
if(rgNo != null && rgNo.length() == 13) {
return rgNo.substring(0,5)+"-"+rgNo.substring(5);
}
return rgNo;
}
/**
* .
* @param dateStr
* @return
*/
public static String getDayOfWeek(String dateStr) {
int y = Integer.parseInt(dateStr.substring(0,4));
int m = Integer.parseInt(dateStr.substring(4,6));
int d = Integer.parseInt(dateStr.substring(6,8));
LocalDate date = LocalDate.of(y, m, d);
DayOfWeek dayOfWeek = date.getDayOfWeek();
String dow = dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.KOREAN);
return dow;
}
/** .
* @param number
* @return
*/
public static String convertNumberToHangul(String number) {
String[] han1 = { "", "일", "이", "삼", "사", "오", "육", "칠", "팔", "구" };
String[] han2 = { "", "십", "백", "천" };
String[] han3 = { "", "만", "억", "조", "경" };
String result = "";
int len = number.length();
int nowInt = 0;
boolean hasHan3 = false;
for (int i = len; i > 0; i--) {
nowInt = Integer.parseInt(number.substring(len - i, len - i + 1));
int han2Pick = (i - 1) % 4;
if (nowInt > 0) {
result += (han1[nowInt]) + (han2[han2Pick]);
if (han2Pick > 0) {
hasHan3 = false;
}
}
if (!hasHan3 && han2Pick == 0) {
result += (han3[(i - 1) / 4]);
hasHan3 = true;
}
}
return result.toString();
}
public static String convertNumberToHangul(int number) {
String numStr = Integer.toString(number);
return convertNumberToHangul(numStr);
}
/** .
* @param String
* @return String
*/
public static String convertCamelCaseToSnakeCase(String camelCase) {
Pattern pattern = Pattern.compile("([a-z])([A-Z])");
Matcher matcher = pattern.matcher(camelCase);
String convert = matcher.replaceAll(matchResult -> {
return String.format("%s_%s", matchResult.group(1), matchResult.group(2));
});
return convert.toUpperCase();
}
/** .
* @param String
* @return String
*/
public static String convertSnakeCaseToCamelCase(String snakeCase) {
Pattern compile = Pattern.compile("([a-z])_([a-z])");
Matcher matcher = compile.matcher(snakeCase.toLowerCase());
String convert = matcher.replaceAll(matchResult -> {
return String.format("%s%s", matchResult.group(1).toLowerCase(), matchResult.group(2).toUpperCase());
});
return convert;
}
/**OCR .
* @param vrfcCode
* ocrData OCR
* bgngPstn
* totalLength OCR
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public static String getOcrVrfcCode(String vrfcCode, String strData, int totalLength) {
int temp = 0;
int cdTemp = 0;
String retCode = "";
for (int iLoop = 0; iLoop < totalLength; iLoop++) {
temp = (iLoop + vrfcCode.length()) % vrfcCode.length();
cdTemp = cdTemp + (Integer.valueOf(strData.substring(iLoop, iLoop + 1)) * Integer.valueOf(vrfcCode.substring(temp, temp + 1)));
}
retCode = String.valueOf(cdTemp % 10);
return retCode;
}
public static String getOcrband1(String deptCode, String spclBizCd, String fyr, String acntgSeCd, String txitmCd, String levyNo, String ispySn) {
if(deptCode.equals("")) {
deptCode = "0000000";
}
if(spclBizCd.equals("")) {
spclBizCd = "0000";
}
if(fyr.equals("")) {
fyr = "0000";
}
if(acntgSeCd.equals("")) {
acntgSeCd = "00";
}
if(txitmCd.equals("")) {
txitmCd = "000000";
}
if(levyNo.equals("")) {
levyNo = "000000";
}
if(ispySn.equals("")) {
ispySn = "00";
}
String band1 = deptCode + spclBizCd + fyr + acntgSeCd + txitmCd + levyNo + ispySn;
String ocrVrfcCode = getOcrVrfcCode("12357", band1, 31);
band1 = band1 + ocrVrfcCode;
return band1;
}
public static String getOcrband2(String band1, String levySeCd, int sumAmt, String dudtYmd) {
if(dudtYmd.equals("")) {
dudtYmd = "00000000";
}
String levySeCd1 = "";
if (levySeCd.equals("01")) {
levySeCd1 = "1" ;
} else if (levySeCd.equals("02")) {
levySeCd1 = "2" ;
} else {
levySeCd1 = "2" ;
}
String band2 = levySeCd1
+ String.format("%011d", sumAmt)
+ dudtYmd
+ "0";
String ocrVrfcCode = getOcrVrfcCode("23571", band1 + band2, 53);
band2 = band2 + ocrVrfcCode;
band2 = band1 + band2;
return band2;
}
public static String getOcrband3(String ocr1, int sumAmt, String dudtYmd, int afterSumAmt) {
if(dudtYmd.equals("")) {
dudtYmd = "00000000";
}
// OCR 2번째줄 54
// band3 = 국세 + 국세요율(납기후에 추가되는 가산금의 비율) + 시도세 + 시도세요율 + 시군구세 + 시군구세요율
String band3 = "0000000000"
+ "00"
+ "0000000000"
+ "00"
+ String.format("%011d", sumAmt)
+ "00";
String ocrVrfcCode = getOcrVrfcCode("35712", band3, 36);
// band4 = 부과월 + 납기후처리 + 납기후금액(12자리)
// 0=납기후 수납가능, 1=납기후 수납불가, 2=납기 무관, 7~9=납기후 수납가능
String band4 = dudtYmd.substring(4, 6)
+ "1"
+ String.format("%012d", afterSumAmt);
ocrVrfcCode = getOcrVrfcCode("57123", band3 + band4, 52);
band4 = band4 + ocrVrfcCode;
// band5 = 전체 합산해서 검코드 구하기용, 사용하지는 않음
String band5 = ocr1 + band3 + band4;
ocrVrfcCode = getOcrVrfcCode("71235", band5, 107);
// band6
String band6 = band3 + band4 + ocrVrfcCode;
return band6;
}
public static void setOcrInfo(DataObject dataObject) {
String deptCode = dataObject.string("DEPT_CD");
String spclBizCd = dataObject.string("SPCL_BIZ_CD");
String fyr = dataObject.string("FYR");
String acntgSeCd = dataObject.string("ACNTG_SE_CD");
String txitmCd = dataObject.string("TXITM_CD");
String levyNo = dataObject.string("LEVY_NO");
String ispySn = dataObject.string("ISPY_SN");
String ocr0 = CmmnUtil.getOcrband1(deptCode, spclBizCd, fyr, acntgSeCd, txitmCd, levyNo, ispySn);
dataObject.set("OCR0", ocr0);
dataObject.set("OCR0_1", ocr0.substring(0, 17));
dataObject.set("OCR0_2", ocr0.substring(17));
String levySeCd = dataObject.string("LEVY_SE_CD");
int sumAmt = dataObject.number("SUM_AMT").intValue(); // 합계 금액
String dudtYmd = dataObject.string("DUDT_YMD");
String ocr1 = CmmnUtil.getOcrband2(ocr0, levySeCd, sumAmt, dudtYmd);
dataObject.set("OCR1", ocr1);
int afterSumAmt = dataObject.number("DUDT_AFTR_AMT").intValue(); // 납기후 금액
String ocr2 = CmmnUtil.getOcrband3(ocr1, sumAmt, dudtYmd, afterSumAmt);
dataObject.set("OCR2", ocr2);
}
public static String getBarcode(String rgSe, String sggCd, String sndngDtlId) {
String rgSe1 = "";
if(rgSe.length() > 1) {
rgSe1 = rgSe.substring(1);
} else {
rgSe1 = rgSe;
}
return "*"+rgSe1+sggCd+sndngDtlId+"*";
}
public static Long sumByKey(List<DataObject> dataObjectList, String key) {
return dataObjectList.stream().mapToLong(i -> i.number(key).longValue()).sum();
}
public static void setBarcode(DataObject dataObject) {
String recevDivCd = dataObject.string("RECEV_DIV_CD");
String sggCd = dataObject.string("SGG_CD");
String sndngDtlId = dataObject.string("SNDNG_DTL_ID");
String barcode = CmmnUtil.getBarcode(recevDivCd, sggCd, sndngDtlId);
dataObject.put("BARCODE", barcode);
dataObject.put("BARCODE1", barcode);
}
public static float mmToPt(float mm) {
return mm * 2.83465f;
}
/**
* IP .
* @param request 릿
* @return IP
*/
public static String getClientIpAddr(HttpServletRequest request) {
String REGEXP_IPV4_ADDR = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$";
String[] headerNames = {"X-Forwarded-For","Proxy-Client-IP","WL-Proxy-Client-IP","HTTP_CLIENT_IP","HTTP_X_FORWARDED_FOR"};
String ip = "";
for(String headerName : headerNames) {
ip = request.getHeader(headerName);
if(ip != null && ip.contains(",")) {
ip = ip.split(",",-1)[0];
}
if(ip != null && Pattern.matches(REGEXP_IPV4_ADDR, ip)) {
break;
}
}
if(ip != null && ip.contains(",")) {
ip = ip.split(",",-1)[0];
}
if(ip == null || !Pattern.matches(REGEXP_IPV4_ADDR, ip)) {
ip = request.getRemoteAddr();
}
return ip;
}
}

@ -0,0 +1,55 @@
package cokr.xit.fims.cmmn.dao;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@Mapper("stngMapper")
public interface StngMapper extends AbstractMapper {
/** .
* @param userId ID
* @return
*/
DataObject selectDefaultTask(String userId);
/** .
* @param userId ID
* @return
*/
DataObject selectUserStng(String userId);
/** .
* @param deptCd
* @return
*/
DataObject selectDeptStng(String deptCd);
/** .
* @param sggCd
* @return
*/
DataObject selectSggStng(String sggCd);
/** .
* @param params
* @return
*/
int updateDtbnActno(Map<String, String> params);
/** .
* @param params
* @return
*/
int insertDefaultTask(Map<String, String> params);
/** .
* @param params
* @return
*/
int updateDefaultTask(Map<String, String> params);
}

@ -0,0 +1,26 @@
package cokr.xit.fims.cmmn.service;
import java.util.List;
import cokr.xit.fims.mngt.Task;
import cokr.xit.fims.mngt.Vltn;
public interface StngService {
/** , .
* @param task , vltnList
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
String updateTaskStng(Task task, List<Vltn> vltnList);
/** , .
* @param sggCd , taskSeCd
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
String createTaskStng(String sggCd, String taskSeCd);
}

@ -0,0 +1,198 @@
package cokr.xit.fims.cmmn.service.bean;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.code.service.CodeQuery;
import cokr.xit.base.code.service.bean.CodeBean;
import cokr.xit.base.security.Authority;
import cokr.xit.base.security.SecuredUserInfo;
import cokr.xit.fims.base.service.bean.OgdpBean;
import cokr.xit.fims.cmmn.CmmnQuery;
import cokr.xit.fims.cmmn.dao.StngMapper;
import cokr.xit.fims.mngt.service.bean.TaskBean;
import cokr.xit.foundation.UserInfo;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
@Component("stngBean")
public class StngBean extends AbstractBean {
@Resource(name = "codeBean")
private CodeBean codeBean;
@Resource(name = "ogdpBean")
private OgdpBean ogdpBean;
@Resource(name = "stngMapper")
private StngMapper stngMapper;
@Resource(name = "taskBean")
private TaskBean taskBean;
/** .
* @param type
* @return
*/
public DataObject getStng(String type) {
if(type.equals("user")) {
return stngMapper.selectUserStng(currentUser().getId());
} else if(type.equals("dept")){
UserInfo userInfo = currentUser();
if(userInfo.getInstitute().equals("ADMIN00")) {
return new DataObject();
}
ogdpBean.initUserInfo(userInfo);
return stngMapper.selectDeptStng((String)userInfo.getInfo().get("deptCd"));
} else if(type.equals("sgg")){
UserInfo userInfo = currentUser();
if(userInfo.getInstitute().equals("ADMIN00")) {
return new DataObject();
}
ogdpBean.initUserInfo(userInfo);
return stngMapper.selectSggStng((String)userInfo.getInfo().get("sggCd"));
} else {
return null;
}
}
/** .
* @param dtbnBankNm , dtbnActno
* @return
*/
public boolean updateDtbnActno(String dtbnBankNm, String dtbnActno) {
Map<String, String> params = new HashMap<String, String>();
UserInfo userInfo = currentUser();
ogdpBean.initUserInfo(userInfo);
params.put("mdfr", userInfo.getId());
params.put("deptCd", (String)userInfo.getInfo().get("deptCd"));
params.put("dtbnBankNm", dtbnBankNm);
params.put("dtbnActno", dtbnActno);
return stngMapper.updateDtbnActno(params) == 1 ? true : false;
}
/** userInfo , .
* @param userInfo
* @return
*/
public void initUserInfo(SecuredUserInfo userInfo) {
boolean isAdmin = userInfo.hasAuthorities("ROLE_ADMIN");
List<String> taskList = codeBean.getCodeList((new CodeQuery()).setGroupIDs("FIM054"))
.stream().map(item -> item.string("CODE")).toList();
List<String> availableTaskList = new ArrayList<>();
if(userInfo.getInstitute().equals("ADMIN00")) { //최고관리자
availableTaskList = taskList;
} else if(isAdmin) { //관리자
Map<String, Object> info = userInfo.getInfo();
if(info == null || info.get("sggCd") == null || info.get("sggCd").equals("")) {
ogdpBean.initUserInfo(userInfo);
}
availableTaskList = taskBean.getTasks((new CmmnQuery()).setSggCd((String)userInfo.getInfo().get("sggCd")).setUseYn("Y"))
.stream().map(item -> item.string("TASK_SE_CD")).toList();
} else { //일반사용자
List<Authority> authorities = userInfo.getAuthorities();
if(authorities != null && !authorities.isEmpty()) {
for(Authority authority : authorities) {
String authId = authority.getId();
for(int i=0; i<taskList.size(); i++) {
String task = taskList.get(i);
if(authId.equals("ROLE_"+task)) {
availableTaskList.add(task);
}
}
}
}
}
//계정별 사용가능 업무
userInfo.getInfo().put("taskForUser", availableTaskList);
//계정별 기본업무
if(availableTaskList.size() == 1) {
userInfo.getInfo().put("defaultTask", availableTaskList.get(0));
return;
}
DataObject defaultTask = stngMapper.selectDefaultTask(userInfo.getId());
if(defaultTask == null) {
userInfo.getInfo().put("defaultTask", "");
} else {
userInfo.getInfo().put("defaultTask", defaultTask.string("TASK_SE_CD"));
}
}
/** .
* @param taskSeCd
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean saveDefaultTask(String taskSeCd) {
DataObject info = stngMapper.selectDefaultTask(currentUser().getId());
int effected = 0;
Map<String, String> params = new HashMap<String,String>();
params.put("userId", currentUser().getId());
params.put("taskSeCd", taskSeCd);
if(info == null) {
params.put("rgtr", currentUser().getId());
effected = stngMapper.insertDefaultTask(params);
} else {
params.put("mdfr", currentUser().getId());
params.put("taskMtchgId",info.string("TASK_MTCHG_ID"));
effected = stngMapper.updateDefaultTask(params);
}
return effected == 1 ? true : false;
}
/** .
* @param taskSectionCodes
* @return
*/
public List<CommonCode> filterTaskSectionCodeForSgg(List<CommonCode> taskSectionCodes) {
List<CommonCode> taskListForSgg = new ArrayList<CommonCode>();
if(currentUser().getInstitute().equals("ADMIN00")) {
taskListForSgg = taskSectionCodes;
} else {
SecuredUserInfo userInfo = currentUser();
Map<String, Object> info = userInfo.getInfo();
if(info == null || info.get("sggCd") == null || info.get("sggCd").equals("")) {
ogdpBean.initUserInfo(userInfo);
}
List<String> taskSeCdListForSgg = taskBean.getTasks((new CmmnQuery()).setSggCd((String)userInfo.getInfo().get("sggCd")).setUseYn("Y"))
.stream().map(item -> item.string("TASK_SE_CD")).toList();
taskListForSgg = taskSectionCodes.stream()
.filter(item -> taskSeCdListForSgg.contains(item.getCode())).toList();
}
return taskListForSgg;
}
}

@ -0,0 +1,102 @@
package cokr.xit.fims.cmmn.service.bean;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cokr.xit.base.code.service.CodeQuery;
import cokr.xit.base.code.service.bean.CodeBean;
import cokr.xit.fims.cmmn.service.StngService;
import cokr.xit.fims.mngt.Task;
import cokr.xit.fims.mngt.Vltn;
import cokr.xit.fims.mngt.service.bean.TaskBean;
import cokr.xit.fims.mngt.service.bean.VltnBean;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
@Service("stngService")
public class StngServiceBean extends AbstractServiceBean implements StngService {
/** 업무 정보 Bean */
@Resource(name = "taskBean")
private TaskBean taskBean;
/** 위반 정보 Bean */
@Resource(name = "vltnBean")
private VltnBean vltnBean;
@Resource(name = "codeBean")
private CodeBean codeBean;
@Override
public String updateTaskStng(Task task, List<Vltn> vltnList) {
boolean result = taskBean.update(task);
if(!result) {
throw new RuntimeException("[F]업무 설정 수정 중 오류가 발생하였습니다.");
}
for(Vltn vltn : vltnList) {
result = vltnBean.update(vltn);
if(!result) {
throw new RuntimeException("[F]위반 설정 수정 중 오류가 발생하였습니다.");
}
}
return "[S]";
}
@Override
public String createTaskStng(String sggCd, String taskSeCd) {
Task task = new Task();
task.setSggCd(sggCd);
task.setTaskSeCd(taskSeCd);
CodeQuery cq = new CodeQuery();
cq.setGroupIDs("FIM054");
List<DataObject> taskCodes = codeBean.getCodeList(cq);
for(DataObject taskCodeInfo : taskCodes) {
if(taskCodeInfo.string("CODE").equals(taskSeCd)) {
task.setTaskSeNm(taskCodeInfo.string("CODE_VAL"));
}
}
boolean result = taskBean.create(task);
if(!result) {
throw new RuntimeException("[F]업무 설정 추가 중 오류가 발생하였습니다.");
}
List<DataObject> vltnCdList = new ArrayList<>();
String vltnByTask = "";
switch(taskSeCd) {
case "PVS" -> { vltnByTask = "FIM004"; }
case "BPV" -> { vltnByTask = "FIM005"; }
case "DPV" -> { vltnByTask = "FIM006"; }
case "ECA" -> { vltnByTask = "FIM061"; }
case "PES" -> { vltnByTask = "FIM064"; }
}
if(!vltnByTask.equals("")) {
cq = new CodeQuery();
cq.setGroupIDs(vltnByTask);
vltnCdList = codeBean.getCodeList(cq);
}
for(DataObject vltnCdInfo : vltnCdList) {
Vltn vltn = new Vltn();
vltn.setSggCd(sggCd);
vltn.setTaskSeCd(taskSeCd);
vltn.setVltnCd(vltnCdInfo.string("CODE"));
vltn.setVltnArtcl(vltnCdInfo.string("CODE_VAL"));
result = vltnBean.create(vltn);
if(!result) {
throw new RuntimeException("[F]위반 설정 추가 중 오류가 발생하였습니다.");
}
}
return result ? "[S]" : "[F]";
}
}

@ -0,0 +1,82 @@
package cokr.xit.fims.mngt;
import java.util.List;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
/**
*
* @author JoJH
*/
@Getter
@Setter
public class Task extends AbstractEntity {
/**
*
*/
private String sggCd;
/**
*
*/
private String taskSeCd;
/**
*
*/
private String taskSeNm;
/**
*
*/
private Integer advntceDayCnt;
/**
*
*/
private String advntceRdcrt;
/**
*
*/
private String wksnRdcrt;
/**
*
*/
private String ffnlgAdtnYmd;
/**
*
*/
private String ffnlgAdtnRt;
/**
*
*/
private String ffnlgInadtnRt;
/**
*
*/
private Integer ffnlgInadtnMxmmCnt;
/**
*
*/
private String nxrpLinkSeCd;
/**
*
*/
private String nxrpLinkSeDtlSn;
/**
*
*/
private List<Vltn> vltnStngList;
}

@ -0,0 +1,100 @@
package cokr.xit.fims.mngt;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
/**
*
* @author JoJH
*/
@Getter
@Setter
public class Vltn extends AbstractEntity {
/**
* ID
*/
private String vltnId;
/**
*
*/
private String sggCd;
/**
*
*/
private String taskSeCd;
/**
*
*/
private String vltnCd;
/**
*
*/
private String vltnArtcl;
/**
*
*/
private String vltnLawNm;
/**
* 1
*/
private String vltnLaw1;
/**
* 2
*/
private String vltnLaw2;
/**
*
*/
private String vltnLawEtc;
/**
*
*/
private String acntgSeCd;
/**
*
*/
private String acntgSeNm;
/**
*
*/
private String txitmCd;
/**
*
*/
private String txitmNm;
/**
*
*/
private String operItemCd;
/**
*
*/
private String operItemNm;
/**
*
*/
private String spclBizCd;
/**
*
*/
private String useYn;
}

@ -0,0 +1,80 @@
package cokr.xit.fims.mngt;
import cokr.xit.fims.cmmn.CmmnQuery;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-16 JoJH
* ================================
* </pre>
*/
public class VltnQuery extends CmmnQuery {
private static final long serialVersionUID = 1L;
private String vltnId; // 위반 ID
private String lawCd; // 법 코드
private String vltnCd; // 위반 코드
private String vltnArtcl; // 위반 항목
private String acntgSeCd; // 회계 구분 코드
private String txitmCd; // 세목 코드
public String getVltnId() {
return ifEmpty(vltnId, () -> null);
}
public <T extends VltnQuery> T setVltnId(String vltnId) {
this.vltnId = vltnId;
return self();
}
public String getLawCd() {
return ifEmpty(lawCd, () -> null);
}
public <T extends VltnQuery> T setLawCd(String lawCd) {
this.lawCd = lawCd;
return self();
}
public String getVltnCd() {
return ifEmpty(vltnCd, () -> null);
}
public <T extends VltnQuery> T setVltnCd(String vltnCd) {
this.vltnCd = vltnCd;
return self();
}
public String getVltnArtcl() {
return ifEmpty(vltnArtcl, () -> null);
}
public <T extends VltnQuery> T setVltnArtcl(String vltnArtcl) {
this.vltnArtcl = vltnArtcl;
return self();
}
public String getAcntgSeCd() {
return ifEmpty(acntgSeCd, () -> null);
}
public <T extends VltnQuery> T setAcntgSeCd(String acntgSeCd) {
this.acntgSeCd = acntgSeCd;
return self();
}
public String getTxitmCd() {
return ifEmpty(txitmCd, () -> null);
}
public <T extends VltnQuery> T setTxitmCd(String txitmCd) {
this.txitmCd = txitmCd;
return self();
}
}

@ -0,0 +1,119 @@
package cokr.xit.fims.mngt.dao;
import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.cmmn.CmmnQuery;
import cokr.xit.fims.mngt.Task;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
/** DAO
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-24 JoJH
* ================================
* </pre>
*/
@Mapper("taskMapper")
public interface TaskMapper extends AbstractMapper {
/** .<br />
* @param req
* @return
*/
List<DataObject> selectTaskList(CmmnQuery req);
/** .
* @param req
* @return
*/
List<DataObject> selectTasks(CmmnQuery req);
/** .
* @param req
* @return
*/
default DataObject selectTaskInfo(CmmnQuery req) {
// 사용 여부 확인
if (req.getUseYn() == null) {
req.setUseYn("Y");
}
List<DataObject> tasks = selectTasks(req);
return !tasks.isEmpty() ? tasks.get(0) : null;
}
/** .
* @param req
* @return
*/
DataObject selectAdvntceYmdInfo(CmmnQuery req);
/** .
* @param params
* <ul><li>"task" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int insertTask(Map<String, Object> params);
/** .
* @param task
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean insert(Task task) {
return task != null && insertTask(params().set("task", task)) == 1;
}
/** .
* @param params
* <ul><li>"task" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int updateTask(Map<String, Object> params);
/** .
* @param task
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean update(Task task) {
return task != null && updateTask(params().set("task", task)) == 1;
}
/** .
* @param params
* <ul><li>"task" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int deleteTask(Map<String, ?> params);
/** .
* @param task
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean delete(Task task) {
return task != null && deleteTask(params().set("task", task)) == 1;
}
}

@ -0,0 +1,108 @@
package cokr.xit.fims.mngt.dao;
import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.mngt.Vltn;
import cokr.xit.fims.mngt.VltnQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
/** DAO
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-16 JoJH
* ================================
* </pre>
*/
@Mapper("vltnMapper")
public interface VltnMapper extends AbstractMapper {
/** .<br />
* @param req
* @return
*/
List<DataObject> selectVltnList(VltnQuery req);
/** .
* @param req
* @return
*/
List<DataObject> selectVltns(VltnQuery req);
/** .
* @param req
* @return
*/
default DataObject selectVltnInfo(VltnQuery req) {
List<DataObject> vltns = selectVltns(req);
return !vltns.isEmpty() ? vltns.get(0) : null;
}
/** .
* @param params
* <ul><li>"vltnInfo" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int insertVltn(Map<String, Object> params);
/** .
* @param vltnInfo
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean insert(Vltn vltn) {
return vltn != null && insertVltn(params().set("vltn", vltn)) == 1;
}
/** .
* @param params
* <ul><li>"vltnInfo" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int updateVltn(Map<String, Object> params);
/** .
* @param vltnInfo
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean update(Vltn vltn) {
return vltn != null && updateVltn(params().set("vltn", vltn)) == 1;
}
/** .
* @param params
* <ul><li>"vltnInfo" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int deleteVltn(Map<String, ?> params);
/** .
* @param vltnInfo
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean delete(Vltn vltn) {
return vltn != null && deleteVltn(params().set("vltn", vltn)) == 1;
}
}

@ -0,0 +1,97 @@
package cokr.xit.fims.mngt.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.fims.cmmn.CmmnQuery;
import cokr.xit.fims.mngt.Task;
import cokr.xit.fims.mngt.dao.TaskMapper;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
/** Bean
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-24 JoJH
* ================================
* </pre>
*/
@Component("taskBean")
public class TaskBean extends AbstractBean {
/** 업무 정보 정보 DAO */
@Resource(name = "taskMapper")
private TaskMapper taskMapper;
/** .
* @param req
* @return
*/
public List<DataObject> getTaskList(CmmnQuery req) {
return taskMapper.selectTaskList(req);
}
/** .
* @param req
* @return
*/
public List<DataObject> getTasks(CmmnQuery req) {
return taskMapper.selectTasks(req);
}
/** .
* @param req
* @return
*/
public DataObject getTaskInfo(CmmnQuery req) {
return taskMapper.selectTaskInfo(req);
}
/** .
* @param req
* @return
*/
public DataObject getAdvntceYmdInfo(CmmnQuery req) {
return taskMapper.selectAdvntceYmdInfo(req);
}
/** .
* @param taskInfo
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean create(Task task) {
return taskMapper.insert(task);
}
/** .
* @param taskInfo
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean update(Task task) {
return taskMapper.update(task);
}
/** .
* @param taskInfo
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean remove(Task task) {
return taskMapper.delete(task);
}
}

@ -0,0 +1,89 @@
package cokr.xit.fims.mngt.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.fims.mngt.Vltn;
import cokr.xit.fims.mngt.VltnQuery;
import cokr.xit.fims.mngt.dao.VltnMapper;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
/** Bean
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-16 JoJH
* ================================
* </pre>
*/
@Component("vltnBean")
public class VltnBean extends AbstractBean {
/** 위반 정보 정보 DAO */
@Resource(name = "vltnMapper")
private VltnMapper vltnMapper;
/** .
* @param req
* @return
*/
public List<DataObject> getVltnList(VltnQuery req) {
return vltnMapper.selectVltnList(req);
}
/** .
* @param req
* @return
*/
public List<DataObject> getVltns(VltnQuery req) {
return vltnMapper.selectVltns(req);
}
/** .
* @param req
* @return
*/
public DataObject getVltnInfo(VltnQuery req) {
return vltnMapper.selectVltnInfo(req);
}
/** .
* @param vltnInfo
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean create(Vltn vltn) {
return vltnMapper.insert(vltn);
}
/** .
* @param vltnInfo
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean update(Vltn vltn) {
return vltnMapper.update(vltn);
}
/** .
* @param vltnInfo
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean remove(Vltn vltn) {
return vltnMapper.delete(vltn);
}
}

@ -0,0 +1,12 @@
package cokr.xit.fims.task;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Task {
String[] value() default "ALL";
}

@ -0,0 +1,22 @@
package cokr.xit.fims.task;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
@Configuration
public class TaskMvcConfig extends DelegatingWebMvcConfiguration {
@Override
protected RequestMappingHandlerMapping createRequestMappingHandlerMapping() {
return new TaskRequestMappingHandlerMapping();
}
@Bean
TaskRequestMappingHandlerMapping taskRequestMappingHandlerMapping() {
return new TaskRequestMappingHandlerMapping();
}
}

@ -0,0 +1,69 @@
package cokr.xit.fims.task;
import java.lang.reflect.Method;
import java.util.Set;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo.BuilderConfiguration;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
public class TaskRequestMappingHandlerMapping extends RequestMappingHandlerMapping {
@Override
@Nullable
public RequestMappingInfo getMappingForMethod(Method method, Class<?> handlerType) {
RequestMappingInfo info = super.getMappingForMethod(method, handlerType);
Task task = AnnotatedElementUtils.findMergedAnnotation(method, Task.class);
if(task != null && info != null) {
return createRequestMappingInfo(task, method, info);
} else {
return info;
}
}
protected RequestMappingInfo createRequestMappingInfo(Task task, Method method,
RequestMappingInfo info) {
String[] prefix = task.value();
if(prefix[0].equals("ALL")) {
prefix = new String[] {"PVS","BPV","DPV","ECA","PES","DVS"};
} else if(prefix[0].equals("CMN")) {
prefix = new String[] {"","PVS","BPV","DPV","ECA","PES","DVS"};
}
RequestMapping rm = AnnotatedElementUtils.findMergedAnnotation(method, RequestMapping.class);
Set<String> olds0 = info.getPatternValues();
String[] olds = olds0.toArray(new String[olds0.size()]);
String[] news = new String[prefix.length*olds.length];
for(int i=0;i < prefix.length; i++) {
for(int j=0;j < olds.length; j++) {
String newPattern = (prefix[i].equals("") ? "" : "/")+prefix[i]+olds[j];
news[i*(olds.length)+j] = newPattern;
}
}
BuilderConfiguration bc = new RequestMappingInfo.BuilderConfiguration();
bc.setContentNegotiationManager(super.getContentNegotiationManager());
bc.setPatternParser(super.getPatternParser());
return RequestMappingInfo
.paths(super.resolveEmbeddedValuesInPatterns(news))
.mappingName(rm.name())
.methods(rm.method())
.params(rm.params())
.headers(rm.headers())
.consumes(rm.consumes())
.produces(rm.produces())
.options(bc)
.build();
}
}

@ -0,0 +1,219 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.base.security.access.dao.AuthorityMapper">
<resultMap id="authRow" type="cokr.xit.base.security.Authority">
<result property="type" column="AUTH_TYPE"/>
<result property="id" column="AUTH_ID"/>
<result property="name" column="AUTH_NM"/>
<result property="infoScope" column="INF_SCP"/>
<result property="userInfoScope" column="USER_INF_SCP"/>
<result property="description" column="DSCRP"/>
<result property="createdAt" column="REG_DT"/>
</resultMap>
<sql id="selectAuthorities">
<include refid="utility.paging-prefix" />
SELECT *
FROM (
SELECT 0 AS AUTH_TYPE
, 'ROLE_ADMIN' AS AUTH_ID
, '시스템 관리자' AS AUTH_NM
, '시스템 관리자' AS DSCRP
, 'all' AS INF_SCP
, 'all' AS USER_INF_SCP
, <include refid="utility.now"/> AS REG_DT
FROM DUAL
UNION
SELECT 1 AS AUTH_TYPE
, 'ROLE_ANONYMOUS' AS AUTH_ID
, '익명 사용자' AS AUTH_NM
, '모든 사용자' AS DSCRP
, 'none' AS INF_SCP
, 'none' AS USER_INF_SCP
, <include refid="utility.now"/> AS REG_DT
FROM DUAL
UNION
SELECT 1 AS AUTH_TYPE
, 'ROLE_USER' AS AUTH_ID
, '시스템 사용자' AS AUTH_NM
, '로그인한 사용자' AS DSCRP
, 'self' AS INF_SCP
, 'self' AS USER_INF_SCP
, <include refid="utility.now"/> AS REG_DT
FROM DUAL
UNION
SELECT 2 AS AUTH_TYPE
, AUTH_ID
, AUTH_NM
, DSCRP
, INF_SCP
, USER_INF_SCP
, REG_DT
FROM TB_AUTHORITY
) A
<where>
<if test="authIDs != null">
AND AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)
</if>
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(by) and @org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(term)">
AND ${by} LIKE CONCAT('%', #{term}, '%')
</if>
</where>
<include refid="utility.orderBy"/>
<include refid="utility.paging-suffix" />
</sql>
<select id="getAuthorityList" parameterType="map" resultType="dataobject">
/* 권한 목록 조회(authorityMapper.getAuthorityList) */
<include refid="selectAuthorities" />
</select>
<select id="getAuthorities" parameterType="map" resultMap="authRow">
/* 권한 가져오기(authorityMapper.getAuthorities) */
<include refid="selectAuthorities" />
</select>
<insert id="insertAuthority" parameterType="cokr.xit.base.security.Authority">
/* 권한 등록(authorityMapper.insertAuthority) */
INSERT INTO TB_AUTHORITY (
AUTH_ID
, AUTH_NM
, DSCRP
, INF_SCP
, USER_INF_SCP
, REG_DT
) VALUES (
#{id}
, #{name}
, #{description}
, #{infoScope}
, #{userInfoScope}
,<include refid="utility.now" />
)
</insert>
<update id="updateAuthority" parameterType="cokr.xit.base.security.Authority">
/* 권한 수정(authorityMapper.updateAuthority) */
UPDATE TB_AUTHORITY SET
AUTH_NM = #{name}
, DSCRP = #{description}
, INF_SCP = #{infoScope}
, USER_INF_SCP = #{userInfoScope}
WHERE AUTH_ID = #{id}
</update>
<delete id="removeAuthorities" parameterType="map">
/* 권한 삭제(authorityMapper.removeAuthorities) */
DELETE FROM TB_AUTHORITY
WHERE AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)
</delete>
<select id="getActionGroupList" parameterType="map" resultType="dataobject">
/* 권한-기능그룹 가져오기(authorityMapper.getActionGroups) */
<include refid="utility.paging-prefix" />
SELECT A.AUTH_ID
, A.GRP_ID
, A.REG_DT
, (SELECT AG.GRP_NM FROM TB_ACTION_GRP AG WHERE AG.GRP_ID = A.GRP_ID) AS GRP_NM
FROM TB_AUTH_ACTION A
<if test="authIDs != null">WHERE AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)</if>
ORDER BY AUTH_ID, GRP_ID
<include refid="utility.paging-suffix" />
</select>
<insert id="addActionGroups" parameterType="map">
/* 권한-기능그룹 추가(authorityMapper.addActionGroups) */
INSERT INTO TB_AUTH_ACTION (AUTH_ID, GRP_ID, REG_DT)
SELECT AUTH_ID, GRP_ID,<include refid="utility.now" />
FROM (<foreach collection="groupIDs" item="groupID" separator=" UNION">
SELECT #{authID} AUTH_ID, #{groupID} GRP_ID FROM DUAL</foreach>
) A
WHERE NOT EXISTS (
SELECT AUTH_ID, GRP_ID
FROM TB_AUTH_ACTION B
WHERE B.AUTH_ID = A.AUTH_ID
AND B.GRP_ID = A.GRP_ID
)</insert>
<delete id="removeActionGroups" parameterType="map">
/* 권한-기능그룹 삭제(authorityMapper.removeActionGroups) */
DELETE FROM TB_AUTH_ACTION
<where>
<if test="authIDs != null">AND AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)</if>
<if test="groupIDs != null">AND GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if>
</where>
</delete>
<select id="getActionList" resultType="dataobject">
/* 권한-기능 가져오기(authorityMapper.getActionList) */
SELECT A.AUTH_ID
, A.GRP_ID
, C.ACTION
FROM TB_AUTH_ACTION A
, TB_ACTION_GRP B
, TB_GRP_ACTION C
WHERE A.GRP_ID = B.GRP_ID
AND B.GRP_ID = C.GRP_ID
ORDER BY A.AUTH_ID, A.GRP_ID, C.ACTION
</select>
<sql id="selectAuthUser">
<include refid="utility.paging-prefix" />
SELECT A.AUTH_ID
, A.USER_ID
, A.REG_DT
, UPPER(B.USER_ACNT) AS USER_ACNT
, B.USER_NM
, B.ORG_ID
, (SELECT SGG_NM FROM TB_SGG WHERE SGG_CD = B.ORG_ID) AS SGG_NM
, B.NSTT_CD
, (SELECT INST_NM FROM TB_SGG WHERE SGG_CD = B.ORG_ID) AS INST_NM
, B.DEPT_CD
, (SELECT DEPT_NM FROM TB_DEPT WHERE DEPT_CD = B.DEPT_CD) AS DEPT_NM
FROM TB_AUTH_USER A
, TB_USER B
<where>
<if test="authIDs != null">AND AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)</if>
<if test="userIDs != null">AND A.USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)</if>
AND A.USER_ID = B.USER_ID
</where>
<include refid="utility.orderBy"/>
<include refid="utility.paging-suffix" />
</sql>
<select id="getUserList" parameterType="map" resultType="dataobject">
/* 권한-사용자 가져오기(authorityMapper.getUserList) */
<include refid="selectAuthUser" />
</select>
<select id="getUserAuths" parameterType="map" resultType="dataobject">
/* 사용자-권한 가져오기(authorityMapper.getUserAuths) */
<include refid="selectAuthUser" />
</select>
<insert id="addUsers" parameterType="map">
/* 권한-사용자 추가(authorityMapper.addUsers) */
INSERT INTO TB_AUTH_USER (AUTH_ID, USER_ID, REG_DT)
SELECT AUTH_ID, USER_ID,<include refid="utility.now" />
FROM (<foreach collection="userIDs" item="userID" separator="UNION">
SELECT #{authID} AUTH_ID, #{userID} USER_ID FROM DUAL</foreach>
) A
WHERE NOT EXISTS (
SELECT AUTH_ID, USER_ID
FROM TB_AUTH_USER B
WHERE B.AUTH_ID = A.AUTH_ID
AND B.USER_ID = A.USER_ID
)
</insert>
<delete id="removeUsers" parameterType="map">
/* 권한-사용자 삭제(authorityMapper.removeUsers) */
DELETE FROM TB_AUTH_USER
<where>
<if test="authIDs != null">AND AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)</if>
<if test="userIDs != null">AND USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)</if>
</where>
</delete>
</mapper>

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.base.user.dao.DepartmentMapper">
<!-- 부서 정보 정보 매퍼
========== 변경 이력 ==========
2023-10-06 mjkhan 최초 작성
============================ -->
<resultMap id="deptRow" type="cokr.xit.base.user.Department"> <!-- 부서 정보 -->
<result property="deptID" column="DEPT_CD" /> <!-- 부서 코드 -->
<result property="sggID" column="SGG_CD" /> <!-- 시군구 코드 -->
<result property="instCode" column="INST_CD" /> <!-- 기관 코드 -->
<result property="name" column="DEPT_NM" /> <!-- 부서 명 -->
<result property="telno" column="DEPT_TELNO" /> <!-- 부서 전화번호 -->
<result property="faxno" column="DEPT_FXNO" /> <!-- 부서 팩스번호 -->
<result property="useYN" column="USE_YN" /> <!-- 사용 여부 -->
<result property="createdAt" column="REG_DT" /> <!-- 등록 일시 -->
<result property="createdBy" column="RGTR" /> <!-- 등록자 -->
<result property="lastModified" column="MDFCN_DT" /> <!-- 수정 일시 -->
<result property="modifiedBy" column="MDFR" /> <!-- 수정자 -->
</resultMap>
<sql id="select">SELECT DEPT_CD <!-- 부서 코드 -->
, SGG_CD <!-- 시군구 코드 -->
, INST_CD <!-- 기관 코드 -->
, DEPT_NM <!-- 부서 명 -->
, DEPT_TELNO <!-- 부서 전화번호 -->
, DEPT_FXNO <!-- 부서 팩스번호 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
FROM TB_DEPT</sql>
<select id="selectDepartmentList" parameterType="map" resultType="dataobject">/* 부서 정보 목록 조회(departmentMapper.selectDepartmentList) */
<include refid="utility.paging-prefix" />
<include refid="select" />
<where>
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(by) and @org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(term)">
AND ${by} LIKE CONCAT('%', #{term}, '%')
</if>
<if test="sggID != null"> AND SGG_CD = #{sggID}</if>
<if test="instCode != null"> AND INST_CD = #{instCode}</if>
<if test="deptIDs != null"> AND DEPT_CD IN (<foreach collection="deptIDs" item="deptID" separator=",">#{deptID}</foreach>)</if>
<if test="!includeAll"> AND USE_YN = 'Y'</if>
</where>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" /></select>
<select id="selectDepartments" parameterType="map" resultMap="deptRow">/* 부서 정보 객체 가져오기(departmentMapper.selectDepartments) */
<include refid="select" />
WHERE SGG_CD = #{sggID}
<if test="deptIDs != null">AND DEPT_CD IN (<foreach collection="deptIDs" item="deptID" separator=",">#{deptID}</foreach>)</if>
<include refid="utility.orderBy" /></select>
<sql id="sggDepts">
SELECT A.SGG_CD
, SGG_NM
, A.INST_CD
, INST_NM
, DEPT_CD
, DEPT_NM
FROM TB_SGG A
LEFT OUTER JOIN TB_DEPT B
ON A.SGG_CD = B.SGG_CD
AND A.INST_CD = B.INST_CD
AND A.USE_YN = 'Y'
AND B.USE_YN = 'Y'
</sql>
<sql id="emptyDept">
SELECT SGG_CD, SGG_NM, INST_CD, INST_NM, 'EMPTY00', '(부서 없음)'
FROM TB_SGG
WHERE USE_YN = 'Y'
</sql>
<sql id="adminSggDept">
SELECT 'ADMIN', '관리자 시군구', 'ADMIN00', '관리자 기관', 'ADMIN00', '관리자 부서'
FROM DUAL
</sql>
<select id="selectSggDepts" resultType="dataobject">
<include refid="sggDepts" />
ORDER BY A.SGG_CD, A.INST_CD, DEPT_CD
</select>
<insert id="insert" parameterType="cokr.xit.base.user.Department">/* 부서 정보 등록(departmentMapper.insert) */
INSERT INTO TB_DEPT (
DEPT_CD <!-- 부서 코드 -->
, SGG_CD <!-- 시군구 코드 -->
, INST_CD <!-- 기관 코드 -->
, DEPT_NM <!-- 부서 명 -->
, DEPT_TELNO <!-- 부서 전화번호 -->
, DEPT_FXNO <!-- 부서 팩스번호 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
) VALUES (
#{deptID} <!-- 부서 코드 -->
, #{sggID} <!-- 시군구 코드 -->
, #{instCode} <!-- 기관 코드 -->
, #{name} <!-- 부서 명 -->
, #{telno} <!-- 부서 전화번호 -->
, #{faxno} <!-- 부서 팩스번호 -->
, #{useYN} <!-- 사용 여부 -->
, #{createdAt} <!-- 등록 일시 -->
, #{createdBy} <!-- 등록자 -->
, #{lastModified} <!-- 수정 일시 -->
, #{modifiedBy} <!-- 수정자 -->
)</insert>
<update id="update" parameterType="cokr.xit.base.user.Department">/* 부서 정보 수정(departmentMapper.update) */
UPDATE TB_DEPT
SET SGG_CD = #{sggID} <!-- 시군구 코드 -->
, INST_CD = #{instCode} <!-- 기관 코드 -->
, DEPT_NM = #{name} <!-- 부서 명 -->
, DEPT_TELNO = #{telno} <!-- 부서 전화번호 -->
, DEPT_FXNO = #{faxno} <!-- 부서 팩스번호 -->
, MDFCN_DT = #{lastModified} <!-- 수정 일시 -->
, MDFR = #{modifiedBy} <!-- 수정자 -->
WHERE DEPT_CD = #{deptID}</update>
<update id="delete" parameterType="map">/* 부서 정보 삭제(departmentMapper.deleteDepartment) */
UPDATE TB_DEPT
SET USE_YN = 'N'
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
<where><if test="sggIDs != null"> AND SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</if>
<if test="deptIDs != null"> AND DEPT_CD IN (<foreach collection="deptIDs" item="deptID" separator=",">#{deptID}</foreach>)</if></where></update>
</mapper>

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.base.user.dao.SigunguMapper">
<!-- 시군구 정보 매퍼
========== 변경 이력 ==========
2023-10-06 mjkhan 최초 작성
============================ -->
<resultMap id="sggRow" type="cokr.xit.base.user.Sigungu"> <!-- 시군구 -->
<result property="sggID" column="SGG_CD" /> <!-- 시군구 코드 -->
<result property="sggName" column="SGG_NM" /> <!-- 시군구 이름 -->
<result property="instCode" column="INST_CD" /> <!-- 기관 코드 -->
<result property="instType" column="INST_SE_CD" /> <!-- 기관 구분 -->
<result property="instName" column="INST_NM" /> <!-- 기관 명 -->
<result property="instAddress" column="INST_ADDR" /> <!-- 기관 주소 -->
<result property="instDetailAddress" column="INST_DADDR" /> <!-- 기관 상세주소 -->
<result property="instZipCode" column="INST_ZIP" /> <!-- 기관 우편번호 -->
<result property="officialSealFilepath" column="OFFCS_FILE_PATH" /> <!-- 직인 파일 경로 -->
<result property="officialSealFilename" column="OFFCS_FILE_NM" /> <!-- 직인 파일 명 -->
<result property="useYN" column="USE_YN" /> <!-- 사용 여부 -->
<result property="createdAt" column="REG_DT" /> <!-- 등록 일시 -->
<result property="createdBy" column="RGTR" /> <!-- 등록자 -->
<result property="lastModified" column="MDFCN_DT" /> <!-- 수정 일시 -->
<result property="modifiedBy" column="MDFR" /> <!-- 수정자 -->
</resultMap>
<sql id="select">SELECT SGG_CD <!-- 시군구 코드 -->
, SGG_NM <!-- 시군구 이름 -->
, INST_CD <!-- 기관 코드 -->
, INST_SE_CD <!-- 기관 구분 -->
, INST_NM <!-- 기관 명 -->
, INST_ADDR <!-- 기관 주소 -->
, INST_DADDR <!-- 기관 상세주소 -->
, INST_ZIP <!-- 기관 우편번호 -->
, OFFCS_FILE_PATH <!-- 직인 파일 경로 -->
, OFFCS_FILE_NM <!-- 직인 파일 명 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
FROM TB_SGG</sql>
<select id="selectSigunguList" parameterType="map" resultType="dataobject">/* 시군구 목록 조회(sigunguMapper.selectSigunguList) */
<include refid="utility.paging-prefix" />
<include refid="select" />
<where>
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(by) and @org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(term)">
AND ${by} LIKE CONCAT('%', #{term}, '%')
</if>
<if test="sggIDs != null"> AND SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</if>
<if test="instCodes != null"> AND INST_CD IN (<foreach collection="instCodes" item="instCode" separator=",">#{instCode}</foreach>)</if>
<if test="!includeAll">AND USE_YN = 'Y'</if></where>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" /></select>
<select id="selectSigungus" parameterType="map" resultMap="sggRow">/* 시군구 객체 가져오기(sigunguMapper.selectSigungus) */
<include refid="select" />
<where>
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(by) and @org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(term)">
AND ${by} LIKE CONCAT('%', #{term}, '%')
</if>
<if test="sggIDs != null">AND SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</if>
<if test="instCodes != null">AND INST_CD IN (<foreach collection="instCodes" item="instCode" separator=",">#{instCode}</foreach>)</if>
<if test="!includeAll"> AND USE_YN = 'Y'</if></where>
</select>
<insert id="insert" parameterType="cokr.xit.base.user.Sigungu">/* 시군구 등록(sigunguMapper.insert) */
INSERT INTO TB_SGG (
SGG_CD <!-- 시군구 코드 -->
, SGG_NM <!-- 시군구 이름 -->
, INST_CD <!-- 기관 코드 -->
, INST_SE_CD <!-- 기관 구분 -->
, INST_NM <!-- 기관 명 -->
, INST_ADDR <!-- 기관 주소 -->
, INST_DADDR <!-- 기관 상세주소 -->
, INST_ZIP <!-- 기관 우편번호 -->
, OFFCS_FILE_PATH <!-- 직인 파일 경로 -->
, OFFCS_FILE_NM <!-- 직인 파일 명 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
) VALUES (
#{sggID} <!-- 시군구 코드 -->
, #{sggName} <!-- 시군구 이름 -->
, #{instCode} <!-- 기관 코드 -->
, #{instType} <!-- 기관 구분 -->
, #{instName} <!-- 기관 명 -->
, #{instAddress} <!-- 기관 주소 -->
, #{instDetailAddress} <!-- 기관 상세주소 -->
, #{instZipCode} <!-- 기관 우편번호 -->
, #{officialSealFilepath} <!-- 직인 파일 경로 -->
, #{officialSealFilename} <!-- 직인 파일 명 -->
, #{useYN} <!-- 사용 여부 -->
, #{createdAt} <!-- 등록 일시 -->
, #{createdBy} <!-- 등록자 -->
, #{lastModified} <!-- 수정 일시 -->
, #{modifiedBy} <!-- 수정자 -->
)</insert>
<update id="update" parameterType="cokr.xit.base.user.Sigungu">/* 시군구 수정(sigunguMapper.update) */
UPDATE TB_SGG
SET INST_CD = #{instCode} <!-- 기관 코드 -->
, INST_SE_CD = #{instType} <!-- 기관 구분 -->
, SGG_NM = #{sggName} <!-- 시군구 이름 -->
, INST_NM = #{instName} <!-- 기관 명 -->
, INST_ADDR = #{instAddress} <!-- 기관 주소 -->
, INST_DADDR = #{instDetailAddress} <!-- 기관 상세주소 -->
, INST_ZIP = #{instZipCode} <!-- 기관 우편번호 -->
, OFFCS_FILE_PATH = #{officialSealFilepath} <!-- 직인 파일 경로 -->
, OFFCS_FILE_NM = #{officialSealFilename} <!-- 직인 파일 명 -->
, USE_YN = #{useYN} <!-- 사용 여부 -->
, MDFCN_DT = #{lastModified} <!-- 수정 일시 -->
, MDFR = #{modifiedBy} <!-- 수정자 -->
WHERE SGG_CD = #{sggID}</update>
<update id="delete" parameterType="map">/* 시군구 삭제(sigunguMapper.delete) */
UPDATE TB_SGG
SET USE_YN = 'N'
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
WHERE SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</update>
</mapper>

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.base.syslog.dao.LoggingMapper">
<resultMap id="logRow" type="cokr.xit.base.syslog.ServiceLog">
<result property="id" column="LOG_ID"/> <!-- 로그 ID -->
<result property="type" column="LOG_TYPE"/> <!-- 로그 유형 -->
<result property="url" column="URL"/> <!-- URL -->
<result property="className" column="CLS_NM"/> <!-- 클래스 이름 -->
<result property="methodName" column="MTD_NM"/> <!-- 메소드 이름 -->
<result property="fileName" column="FILE_NM"/> <!-- 파일 이름 -->
<result property="dataCount" column="DATA_CNT"/> <!-- 데이터 수 -->
<result property="fieldNames" column="DATA_NM"/> <!-- 데이터 이름 -->
<result property="personalInfo" column="PSNL_INFO"/> <!-- 개인 정보 -->
<result property="userId" column="USER_ID"/> <!-- 사용자 ID -->
<result property="ipAddress" column="IP_ADDR"/> <!-- 등록 일시 -->
</resultMap>
<select id="getLogs" parameterType="map" resultType="dataobject">
/* 시스템 로그 조회(loggingMapper.getLogs) */
<include refid="utility.paging-prefix" />
SELECT LOG_ID
, A.LOG_TYPE
, CASE MTD_NM WHEN 'onLogin' THEN '로그인'
WHEN 'onLogout' THEN '로그아웃'
WHEN 'onFailure' THEN '로그인 실패'
ELSE LOG_TYPE_NM
END LOG_TYPE_NM
, URL
, CLS_NM
, MTD_NM
, NULL DSCRP
, FILE_NM
, DATA_CNT
, DATA_NM
, PSNL_INFO
, A.USER_ID
, UPPER(USER_ACNT) AS USER_ACNT
, USER_NM
, NSTT_CD
, IP_ADDR
, A.REG_DT
FROM TB_SYS_LOG A LEFT OUTER JOIN
TB_USER B ON A.USER_ID = B.USER_ID,
(SELECT 'log-inout' LOG_TYPE, '로그인아웃' LOG_TYPE_NM FROM DUAL UNION
SELECT 'download' LOG_TYPE, '다운로드' LOG_TYPE_NM FROM DUAL UNION
SELECT 'service' LOG_TYPE, '서비스' LOG_TYPE_NM FROM DUAL UNION
SELECT 'web' LOG_TYPE, '웹' LOG_TYPE_NM FROM DUAL
) C
<where>
<if test="fromDate != null"> AND LOG_ID >= CONCAT(#{fromDate}, LPAD(0, 16, '0'))</if>
<if test="toDate != null"> AND LOG_ID &lt;= CONCAT(#{toDate}, LPAD(9, 16, '9'))</if>
<if test="logTypes != null"> AND A.LOG_TYPE IN (<foreach collection="logTypes" item="logType" separator=",">#{logType}</foreach>)</if>
<if test="userIDs != null"> AND USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)</if>
<if test="userAccounts != null"> AND UPPER(USER_ACNT) IN (<foreach collection="userAccounts" item="userAccount" separator=",">UPPER(#{userAccount})</foreach>)</if>
<if test="userName != null"> AND USER_NM LIKE CONCAT('%', #{userName}, '%')</if>
AND A.LOG_TYPE = C.LOG_TYPE
</where>
<include refid="utility.sortBy" />
<include refid="utility.paging-suffix" />
</select>
<insert id="insertLog" parameterType="cokr.xit.base.syslog.ServiceLog">/* 시스템 로그 등록(loggingMapper.insertLog) */
INSERT INTO TB_SYS_LOG (
LOG_ID <!-- 로그 ID -->
, LOG_TYPE <!-- 로그 유형 -->
, URL <!-- URL -->
, CLS_NM <!-- 클래스 이름 -->
, MTD_NM <!-- 메소드 이름 -->
, FILE_NM <!-- 파일 이름 -->
, DATA_CNT <!-- 데이터 수 -->
, DATA_NM <!-- 데이터 이름 -->
, PSNL_INFO <!-- 개인 정보 -->
, USER_ID <!-- 사용자 ID -->
, IP_ADDR <!-- IP 주소 -->
, REG_DT <!-- 등록 일시 -->
) VALUES (
CONCAT(<include refid="utility.today" />, LPAD(NEXTVAL(SQ_SYS_LOG), 16, '0')) <!-- 로그 ID -->
, #{type} <!-- 로그 유형 -->
, #{url} <!-- URL -->
, #{className} <!-- 클래스 이름 -->
, #{methodName} <!-- 메소드 이름 -->
, #{fileName} <!-- 파일 이름 -->
, #{dataCount} <!-- 데이터 수 -->
, #{fieldNames} <!-- 데이터 이름 -->
, #{personalInfo} <!-- 개인 정보 -->
, #{userId} <!-- 사용자 ID -->
, #{ipAddress} <!-- IP 주소 -->
,<include refid="utility.now" />
)
</insert>
</mapper>

@ -0,0 +1,292 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 업무 사용자 -->
<mapper namespace="cokr.xit.base.user.dao.UserMapper">
<resultMap id="userRow" type="cokr.xit.fims.base.FimsUser">
<result property="id" column="USER_ID"/>
<result property="account" column="USER_ACNT"/>
<result property="name" column="USER_NM"/>
<result property="password" column="PASSWD"/>
<result property="passwordHint" column="PASSWD_HINT"/>
<result property="passwordHintAnswer" column="PASSWD_NSR"/>
<result property="zipCode" column="ZIP"/>
<result property="address" column="ADDR"/>
<result property="addressDetail" column="DADDR"/>
<result property="phoneNo" column="TELNO"/>
<result property="mobilePhoneNo" column="MBL_TELNO"/>
<result property="faxNo" column="FXNO"/>
<result property="emailAddress" column="EML_ADRS"/>
<result property="positionName" column="POS_NM"/>
<result property="groupID" column="GRP_ID"/>
<result property="orgID" column="ORG_ID"/>
<result property="institute" column="NSTT_CD"/>
<result property="deptCode" column="DEPT_CD"/>
<result property="cntnSeCd" column="CNTN_SE_CD"/>
<result property="userSeCd" column="USER_SE_CD"/>
<result property="certificateDn" column="CRTFC_DN"/>
<result property="locked" column="LOCK_YN"/>
<result property="lockCount" column="LOCK_CNT"/>
<result property="lockedDate" column="LOCK_DT"/>
<result property="createdAt" column="REG_DT"/>
<result property="createdBy" column="RGTR"/>
<result property="lastModified" column="MDFCN_DT"/>
<result property="modifiedBy" column="MDFR"/>
<result property="useYN" column="USE_YN"/>
<result property="status" column="STTS"/>
</resultMap>
<sql id="selectUsers">
<include refid="utility.paging-prefix" />
SELECT A.USER_ID
, UPPER(A.USER_ACNT) AS USER_ACNT
, A.USER_NM
, A.USER_SE_CD
, GET_CODE_NM('CMN008', A.USER_SE_CD) AS USER_SE_NM
, A.CNTN_SE_CD
, GET_CODE_NM('CMN009', A.CNTN_SE_CD) AS CNTN_SE_NM
, A.PASSWD_HINT
, A.PASSWD_NSR
, A.ZIP
, A.ADDR
, A.DADDR
, A.TELNO
, A.MBL_TELNO
, A.FXNO
, A.EML_ADRS
, A.POS_NM
, A.GRP_ID
, A.CRTFC_DN
, A.LOCK_YN
, A.LOCK_CNT
, A.LOCK_DT
, A.REG_DT
, A.STTS
, (SELECT GET_CODE_NM('CMN004', A.STTS) FROM DUAL) AS STTS_NM
, A.NSTT_CD AS NSTT_CD
, A.NSTT_CD AS INST_CD
, B.INST_NM AS INST_NM
, A.DEPT_CD AS DEPT_CD
, B.DEPT_NM AS DEPT_NM
, A.ORG_ID AS ORG_ID
, A.ORG_ID AS SGG_CD
, B.SGG_NM AS SGG_NM
FROM TB_USER A
LEFT OUTER JOIN (
<include refid="cokr.xit.base.user.dao.DepartmentMapper.sggDepts" />
UNION
<include refid="cokr.xit.base.user.dao.DepartmentMapper.emptyDept" />
UNION
<include refid="cokr.xit.base.user.dao.DepartmentMapper.adminSggDept" />
) B ON A.NSTT_CD = B.INST_CD AND A.DEPT_CD = B.DEPT_CD
<where>
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(by) and @org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(term)">
<choose>
<when test="by == 'userAccount'">
AND ${by} LIKE CONCAT('%', UPPER(#{term}), '%')
</when>
<otherwise>
AND ${by} LIKE CONCAT('%', #{term}, '%')
</otherwise>
</choose>
</if>
<if test="userIDs != null">
USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)
</if>
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(status)">
AND STTS = #{status}
</if>
<if test="@org.egovframe.rte.fdl.string.EgovStringUtil@isNotEmpty(type)">
AND CNTN_SE_CD = #{type}
</if>
</where>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" />
</sql>
<select id="getUserList" parameterType="map" resultType="dataobject">
/* 사용자 목록 조회(userMapper.getUserList) */
<include refid="selectUsers"/>
</select>
<select id="getUsers" parameterType="map" resultMap="userRow">
/* 사용자 가져오기(userMapper.getUsers) */
<include refid="selectUsers"/>
</select>
<select id="getUser" parameterType="map" resultMap="userRow">
/* 사용자 계정 가져오기(userMapper.getUser) */
SELECT USER_ID
, UPPER(USER_ACNT) AS USER_ACNT
, USER_NM
, USER_SE_CD
, GET_CODE_NM('CMN008', USER_SE_CD) AS USER_SE_NM
, CNTN_SE_CD
, GET_CODE_NM('CMN009', CNTN_SE_CD) AS CNTN_SE_NM
, PASSWD
, PASSWD_HINT
, PASSWD_NSR
, TELNO
, MBL_TELNO
, FXNO
, ZIP
, ADDR
, DADDR
, EML_ADRS
, ORG_ID
, GRP_ID
, NSTT_CD
, DEPT_CD
, POS_NM
, CRTFC_DN
, LOCK_YN
, LOCK_CNT
, LOCK_DT
, STTS
, USE_YN
, REG_DT
, RGTR
, MDFCN_DT
, MDFR
FROM TB_USER
<where>
<if test="userID != null">AND USER_ID = #{userID}</if>
<if test="account != null">AND UPPER(USER_ACNT) = UPPER(#{account})</if>
<if test="institute != null">AND NSTT_CD = #{institute}</if>
<if test="orgID != null">AND ORG_ID = #{orgID}</if>
<if test="cntnSeCd != null">AND CNTN_SE_CD = #{cntnSeCd}</if>
</where>
</select>
<insert id="insertUser" parameterType="cokr.xit.fims.base.FimsUser">
<selectKey resultType="string" keyProperty="id" keyColumn="NEW_ID" order="BEFORE">
SELECT LPAD(NVL(MAX(USER_ID) + 1, 1), 10, '0') NEW_ID FROM TB_USER
</selectKey>
/* 사용자 정보 등록(userMapper.insertUser) */
INSERT INTO TB_USER (
USER_ID
, ORG_ID
, NSTT_CD
, DEPT_CD
, CNTN_SE_CD
, USER_SE_CD
, USER_ACNT
, USER_NM
, PASSWD
, PASSWD_HINT
, PASSWD_NSR
, ZIP
, ADDR
, DADDR
, TELNO
, MBL_TELNO
, FXNO
, EML_ADRS
, POS_NM
, GRP_ID
, CRTFC_DN
, LOCK_YN
, LOCK_CNT
, LOCK_DT
, REG_DT
, RGTR
, MDFCN_DT
, MDFR
, USE_YN
, STTS
) VALUES (
#{id}
, #{orgID}
, #{institute}
, #{deptCode}
, #{cntnSeCd}
, #{userSeCd}
, UPPER(#{account})
, #{name}
, #{password}
, #{passwordHint}
, #{passwordHintAnswer}
, #{zipCode}
, #{address}
, #{addressDetail}
, #{phoneNo}
, #{mobilePhoneNo}
, #{faxNo}
, #{emailAddress}
, #{positionName}
, #{groupID}
, #{certificateDn}
, 'N'
, 0
, NULL
,<include refid="utility.now" />
, #{createdBy}
,<include refid="utility.now" />
, #{createdBy}
, 'Y'
, #{status}
)
</insert>
<update id="updateUser" parameterType="cokr.xit.fims.base.FimsUser">
/* 사용자 정보 수정(userMapper.updateUser) */
UPDATE TB_USER
SET USER_SE_CD = #{userSeCd}
, PASSWD_HINT = #{passwordHint}
, PASSWD_NSR = #{passwordHintAnswer}
, ZIP = #{zipCode}
, ADDR = #{address}
, DADDR = #{addressDetail}
, TELNO = #{phoneNo}
, MBL_TELNO = #{mobilePhoneNo}
, FXNO = #{faxNo}
, EML_ADRS = #{emailAddress}
, POS_NM = #{positionName}
, GRP_ID = #{groupID}
, ORG_ID = #{orgID}
, NSTT_CD = #{institute}
, DEPT_CD = #{deptCode}
, CRTFC_DN = #{certificateDn}
, STTS = #{status}
<if test='"D" == status'>, USE_YN = 'N'</if>
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{modifiedBy}
WHERE USER_ID = #{id}</update>
<update id="changePassword" parameterType="map">
/* 비밀번호 변경(userMapper.changePassword) */
UPDATE TB_USER SET
PASSWD = CASE USER_ID<foreach collection="userPasswords" item="userPassword" separator=" ">
WHEN #{userPassword.userID} THEN #{userPassword.password}</foreach>
ELSE PASSWD END
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
WHERE USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)
</update>
<update id="lockUsers" parameterType="map">
/* 사용자 잠김 해제(userMapper.lockUsers) */
UPDATE TB_USER SET
<if test='lock == true'> LOCK_YN = 'Y'
, LOCK_CNT = LOCK_CNT + 1
, LOCK_DT =<include refid="utility.now" /></if>
<if test='lock == false'> LOCK_YN = 'N'
, LOCK_CNT = 0
, LOCK_DT = NULL</if>
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
WHERE USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)
</update>
<update id="setStatus" parameterType="map">
/* 사용자 상태 변경(userMapper.setStatus) */
UPDATE TB_USER SET
STTS = #{status}
<if test='"D" == status'>, USE_YN = 'N'</if>
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
WHERE USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)
AND STTS != #{status}
</update>
</mapper>

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.fims.cmmn.dao.StngMapper">
<select id="selectDefaultTask" parameterType="string" resultType="dataobject">
/* 사용자 기본업무 조회 (stngMapper.selectDefaultTask) */
SELECT TM.TASK_MTCHG_ID
, TM.TASK_SE_CD
FROM TB_TASK_MTCHG TM
WHERE TM.USER_ID = #{userId}
AND TM.USE_YN = 'Y'
</select>
<select id="selectUserStng" parameterType="string" resultType="dataobject">
/* 사용자 설정정보 조회 (stngMapper.selectUserStng) */
SELECT USER_ID
, '' AS 'DEFAULT_TASK_SE_CD'
FROM TB_USER
WHERE USER_ID = #{userId}
</select>
<select id="selectDeptStng" parameterType="string" resultType="dataobject">
/* 부서 설정정보 조회 (stngMapper.selectDeptStng) */
SELECT DEPT_CD
, DEPT_NM
, DEPT_TELNO <!-- 부서 전화번호 -->
, DEPT_FXNO <!-- 부서 팩스번호 -->
, CVLCPT_LINK_SE_CD <!-- 민원 연계 구분 코드 -->
, VRBACNT_LINK_SE_CD<!-- 가상계좌 연계 구분 코드 -->
, PSTOFC_NM <!-- 우체국 명 -->
, RG_NO_HEADER <!-- 등기 번호 헤더 -->
, SNDNG_LINK_SE_CD <!-- 발송 연계 구분 코드 -->
, EGP_CON_ORG <!-- E그린 외부기관구분코드 -->
, EGP_RCEPT_ID <!-- E그린 접수우체국국기호 -->
, EGP_APVL_NB <!-- E그린 후납계약승인번호 -->
, EGP_ESB_PATH <!-- E그린 ESB경로 -->
, EGP_POST_INST_ID <!-- E그린 우정정보센터 기관 ID -->
, EGP_CERT_CN <!-- E그린 인증서CN -->
, ENS_INTERFACE_ID <!-- 세외수입 인터페이스ID -->
, ENS_SOURCE_CD <!-- 세외수입 소스코드 -->
, ENS_TARGET_CD <!-- 세외수입 타겟코드 -->
, ENS_URL <!-- 세외수입 URL -->
, NXRP_LINK_YN <!-- 세외수입 연계 여부 -->
, NXRP_RGN_SE_CD <!-- 세외수입 지역 구분 코드 -->
, DTBN_BANK_NM <!-- 교부 은행 명 -->
, DTBN_ACTNO <!-- 교부 계좌번호 -->
, DOC_HEADER <!-- 문서 머릿말 -->
, SRVR_OS <!-- 서버 OS -->
FROM TB_DEPT
WHERE DEPT_CD = #{deptCd}
</select>
<select id="selectSggStng" parameterType="string" resultType="dataobject">
/* 시군구 설정정보 조회 (stngMapper.selectSggStng) */
SELECT SGG_CD <!-- 시군구 코드 -->
, SGG_NM <!-- 시군구 명 -->
, INST_SE_CD <!-- 기관 구분 코드 -->
, INST_CD <!-- 기관 코드 -->
, INST_NM <!-- 기관 명 -->
, (CASE
WHEN INST_DADDR IS NULL OR INST_DADDR = ''
THEN INST_ADDR
ELSE CONCAT(INST_ADDR,' ',INST_DADDR)
END) AS INST_FULL_ADDR <!-- 기관 전체 주소 -->
, INST_ADDR <!-- 기관 기본 주소 -->
, INST_DADDR <!-- 기관 상세 주소 -->
, INST_ZIP <!-- 기관 우편번호 -->
, SYMBOL_FILE_PATH <!-- 상징 파일 경로 -->
, SYMBOL_FILE_NM <!-- 상징 파일 명 -->
, LOGO_FILE_PATH <!-- 로고 파일 경로 -->
, LOGO_FILE_NM <!-- 로고 파일 명 -->
, OFFCS_FILE_PATH <!-- 직인 파일 경로 -->
, OFFCS_FILE_NM <!-- 직인 파일 명 -->
FROM TB_SGG
WHERE SGG_CD = #{sggCd}
</select>
<update id="updateDtbnActno" parameterType="map">
/* 교부 계좌번호 변경 (stngMapper.updateDtbnActno) */
UPDATE TB_DEPT
SET MDFR = #{mdfr}
, MDFCN_DT = <include refid="utility.now" />
, DTBN_BANK_NM = #{dtbnBankNm}
, DTBN_ACTNO = #{dtbnActno}
WHERE DEPT_CD = #{deptCd}
</update>
<insert id="insertDefaultTask" parameterType="map">
/* 사용자 기본 업무 등록 (stngMapper.insertDefaultTask) */
<selectKey resultType="string" keyProperty="taskMtchgId" keyColumn="NEW_ID" order="BEFORE">
<include refid="numbering.key">
<property name="TABLE_NAME" value="TB_TASK_MTCHG" />
<property name="TABLE_KEY" value="TASK_MTCHG_ID" />
<property name="pad" value="10" />
</include>
</selectKey>
INSERT
INTO TB_TASK_MTCHG (
TASK_MTCHG_ID
, USER_ID
, TASK_SE_CD
, USE_YN
, REG_DT
, RGTR
) VALUES (
#{taskMtchgId}
, #{userId}
, #{taskSeCd}
, 'Y'
, <include refid="utility.now" />
, #{rgtr}
)
</insert>
<update id="updateDefaultTask" parameterType="map">
/* 사용자 기본 업무 변경 (stngMapper.updateDefaultTask) */
UPDATE TB_TASK_MTCHG
SET MDFR = #{mdfr}
, MDFCN_DT = <include refid="utility.now" />
, TASK_SE_CD = #{taskSeCd}
WHERE TASK_MTCHG_ID = #{taskMtchgId}
</update>
</mapper>

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="dynamicSearch">
<sql id="start">
<if test="mainOption == 'codeValue'"> AND GET_CODE_NM(#{subOption},</if>
<if test="mainOption == 'match'"> AND </if>
<if test="mainOption == 'ymd'"> AND SUBSTR(</if>
</sql>
<sql id="center">
<if test="mainOption == 'codeValue'">
) LIKE
<if test="_databaseId == 'mariadb'"> CONCAT('%', </if>
<if test="_databaseId == 'oracle'"> '%' || </if>
</if>
<if test="mainOption == 'match'">
<if test="subOption == 'perfect'"> = </if>
<if test="subOption == 'part'">
LIKE
<if test="_databaseId == 'mariadb'"> CONCAT('%', </if>
<if test="_databaseId == 'oracle'"> '%' || </if>
</if>
</if>
<if test="mainOption == 'ymd'">,1,8) = REPLACE(REPLACE(REPLACE(</if>
</sql>
<sql id="end">
<if test="mainOption == 'codeValue'">
<if test="_databaseId == 'mariadb'"> , '%') </if>
<if test="_databaseId == 'oracle'"> || '%' </if>
</if>
<if test="mainOption == 'match'">
<if test="subOption == 'perfect'"></if>
<if test="subOption == 'part'">
<if test="_databaseId == 'mariadb'"> , '%') </if>
<if test="_databaseId == 'oracle'"> || '%' </if>
</if>
</if>
<if test="mainOption == 'ymd'">,'-',''),'/',''),'.','')</if>
</sql>
</mapper>

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.fims.mngt.dao.TaskMapper">
<!-- 업무 정보 정보 매퍼
========== 변경 이력 ==========
2023-10-24 JoJH 최초 작성
============================ -->
<resultMap id="taskRow" type="cokr.xit.fims.mngt.Task">
<result property="sggCd" column="SGG_CD" /> <!-- 시군구 코드 -->
<result property="taskSeCd" column="TASK_SE_CD" /> <!-- 업무 구분 코드 -->
<result property="taskSeNm" column="TASK_SE_NM" /> <!-- 업무 구분 명 -->
<result property="advntceDayCnt" column="ADVNTCE_DAY_CNT" /> <!-- 사전통지 일 수 -->
<result property="advntceRdcrt" column="ADVNTCE_RDCRT" /> <!-- 사전통지 감경 율 -->
<result property="wksnRdcrt" column="WKSN_RDCRT" /> <!-- 사회적약자 감경 율 -->
<result property="ffnlgAdtnYmd" column="FFNLG_ADTN_YMD" /> <!-- 과태료 가산 일자 -->
<result property="ffnlgAdtnRt" column="FFNLG_ADTN_RT" /> <!-- 과태료 가산 율 -->
<result property="ffnlgInadtnRt" column="FFNLG_INADTN_RT" /> <!-- 과태료 중가산 율 -->
<result property="ffnlgInadtnMaxCnt" column="FFNLG_INADTN_MAX_CNT" /> <!-- 과태료 중가산 최대 수 -->
<result property="nxrpLinkSeCd" column="NXRP_LINK_SE_CD" /> <!-- 세외수입 연계 구분 코드 -->
<result property="nxrpLinkSeDtlSn" column="NXRP_LINK_SE_DTL_SN" /> <!-- 세외수입 연계 구분 상세 순번 -->
<result property="useYn" column="USE_YN" /> <!-- 사용 여부 -->
<result property="createdAt" column="REG_DT" /> <!-- 등록 일시 -->
<result property="createdBy" column="RGTR" /> <!-- 등록자 -->
<result property="lastModified" column="MDFCN_DT" /> <!-- 수정 일시 -->
<result property="modifiedBy" column="MDFR" /> <!-- 수정자 -->
</resultMap>
<sql id="select">
SELECT T.SGG_CD <!-- 시군구 코드 -->
, T.TASK_SE_CD <!-- 업무 구분 코드 -->
, T.TASK_SE_NM <!-- 업무 구분 명 -->
, T.ADVNTCE_DAY_CNT <!-- 사전통지 일수 -->
, T.ADVNTCE_RDCRT <!-- 사전통지 감경 율 -->
, T.WKSN_RDCRT <!-- 사회적약자 감경율 -->
, T.FFNLG_ADTN_YMD <!-- 과태료 가산 일자 -->
, T.FFNLG_ADTN_RT <!-- 과태료 가산 율 -->
, T.FFNLG_INADTN_RT <!-- 과태료 중가산 율 -->
, T.FFNLG_INADTN_MAX_CNT <!-- 과태료 중가산 최대 수 -->
, T.NXRP_LINK_SE_CD <!-- 세외수입 연계 구분 코드 -->
, T.NXRP_LINK_SE_DTL_SN <!-- 세외수입 연계 구분 상세 순번 -->
, T.USE_YN <!-- 사용 여부 -->
, T.REG_DT <!-- 등록 일시 -->
, T.RGTR <!-- 등록자 -->
, T.MDFCN_DT <!-- 수정 일시 -->
, T.MDFR <!-- 수정자 -->
FROM TB_TASK T
</sql>
<select id="selectTaskList" parameterType="map" resultType="dataobject">/* 업무 정보 목록 조회(taskMapper.selectTaskList) */
<include refid="utility.paging-prefix" />
<include refid="select" />
WHERE T.SGG_CD = #{sggCd} <!-- 시군구 코드 -->
AND T.TASK_SE_CD = #{taskSeCd} <!-- 업무 구분 코드 -->
<if test="useYn != null">
AND T.USE_YN = #{useYn} <!-- 사용 여부 -->
</if>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" />
</select>
<select id="selectTasks" parameterType="map" resultType="dataobject">/* 업무 정보 객체 가져오기(taskMapper.selectTasks) */
<include refid="select" />
WHERE T.SGG_CD = #{sggCd} <!-- 시군구 코드 -->
<if test="taskSeCd != null and taskSeCd != ''">
AND T.TASK_SE_CD = #{taskSeCd} <!-- 업무 구분 코드 -->
</if>
<if test="useYn != null">
AND T.USE_YN = #{useYn} <!-- 사용 여부 -->
</if>
<include refid="utility.orderBy" />
</select>
<select id="selectAdvntceYmdInfo" parameterType="map" resultType="dataobject">/* 사전통지 정보 객체 가져오기(taskMapper.selectAdvntceYmdInfo) */
SELECT SGG_CD <!-- 시군구 코드 -->
, TASK_SE_CD <!-- 업무 구분 코드 -->
, ADVNTCE_DAY_CNT <!-- 사전통지 일수 -->
, ADVNTCE_RDCRT <!-- 사전통지 감경 율 -->
, DATE_FORMAT(CURRENT_DATE, '%Y') AS FYR <!-- 회계 연도 -->
, DATE_FORMAT(CURRENT_DATE, '%Y%m%d') AS LEVY_YMD <!-- 부과 일자 -->
, GET_MASK_DATE(DATE_FORMAT(CURRENT_DATE, '%Y%m%d'), '-') AS LEVY_YMD_MASK <!-- 부과 일자 -->
, DATE_FORMAT(DATE_ADD(CURRENT_DATE, INTERVAL ADVNTCE_DAY_CNT DAY), '%Y%m%d') AS DUDT_YMD <!-- 납기 일자 -->
, GET_MASK_DATE(DATE_FORMAT(DATE_ADD(CURRENT_DATE, INTERVAL ADVNTCE_DAY_CNT DAY), '%Y%m%d'), '-') AS DUDT_YMD_MASK <!-- 납기 일자 -->
FROM TB_TASK
WHERE SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd}
AND USE_YN = 'Y'
<include refid="utility.orderBy" />
</select>
<insert id="insertTask" parameterType="map">/* 업무 정보 등록(taskMapper.insertTask) */
INSERT
INTO TB_TASK (
SGG_CD <!-- 시군구 코드 -->
, TASK_SE_CD <!-- 업무 구분 코드 -->
, TASK_SE_NM <!-- 업무 구분 명 -->
, ADVNTCE_DAY_CNT <!-- 사전통지 일수 -->
, ADVNTCE_RDCRT <!-- 사전통지 감경 율 -->
, WKSN_RDCRT <!-- 사회적약자 감경 율 -->
, FFNLG_ADTN_YMD <!-- 과태료 가산 일자 -->
, FFNLG_ADTN_RT <!-- 과태료 가산 율 -->
, FFNLG_INADTN_RT <!-- 과태료 중가산 율 -->
, FFNLG_INADTN_MAX_CNT <!-- 과태료 중가산 최대 수 -->
, NXRP_LINK_SE_CD <!-- 세외수입 연계 구분 코드 -->
, NXRP_LINK_SE_DTL_SN <!-- 세외수입 연계 구분 상세 순번 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
)
VALUES (
#{task.sggCd} <!-- 시군구 코드 -->
, #{task.taskSeCd} <!-- 업무 구분 코드 -->
, #{task.taskSeNm} <!-- 업무 구분 명 -->
, #{task.advntceDayCnt} <!-- 사전통지 일수 -->
, #{task.advntceRdcrt} <!-- 사전통지 감경 율 -->
, #{task.wksnRdcrt} <!-- 사회적약자 감경 율 -->
, #{task.ffnlgAdtnYmd} <!-- 과태료 가산 일자 -->
, #{task.ffnlgAdtnRt} <!-- 과태료 가산 율 -->
, #{task.ffnlgInadtnRt} <!-- 과태료 중가산 율 -->
, #{task.ffnlgInadtnMaxCnt} <!-- 과태료 중가산 최대 수 -->
, #{task.nxrpLinkSeCd} <!-- 세외수입 연계 구분 코드 -->
, #{task.nxrpLinkSeDtlSn} <!-- 세외수입 연계 구분 상세 순번 -->
, 'Y' <!-- 사용 여부 -->
, <include refid="utility.now" /> <!-- 등록 일시 -->
, #{currentUser.id} <!-- 등록자 -->
, <include refid="utility.now" /> <!-- 수정 일시 -->
, #{currentUser.id} <!-- 수정자 -->
)
</insert>
<update id="updateTask" parameterType="map">/* 업무 정보 수정(taskMapper.updateTask) */
UPDATE TB_TASK
SET TASK_SE_NM = #{task.taskSeNm} <!-- 업무 구분 명 -->
, ADVNTCE_DAY_CNT = #{task.advntceDayCnt} <!-- 사전통지 일수 -->
, ADVNTCE_RDCRT = #{task.advntceRdcrt} <!-- 사전통지 감경 율 -->
, WKSN_RDCRT = #{task.wksnRdcrt} <!-- 사회적약자 감경 율 -->
, FFNLG_ADTN_YMD = #{task.ffnlgAdtnYmd} <!-- 과태료 가산 일자 -->
, FFNLG_ADTN_RT = #{task.ffnlgAdtnRt} <!-- 과태료 가산 율 -->
, FFNLG_INADTN_RT = #{task.ffnlgInadtnRt} <!-- 과태료 중가산 율 -->
, FFNLG_INADTN_MAX_CNT = #{task.ffnlgInadtnMaxCnt} <!-- 과태료 중가산 최대 수 -->
, NXRP_LINK_SE_CD = #{task.nxrpLinkSeCd} <!-- 세외수입 연계 구분 코드 -->
, NXRP_LINK_SE_DTL_SN = #{task.nxrpLinkSeDtlSn} <!-- 세외수입 연계 구분 상세 순번 -->
, MDFCN_DT = <include refid="utility.now" /> <!-- 수정 일시 -->
, MDFR = #{currentUser.id} <!-- 수정자 -->
WHERE SGG_CD = #{task.sggCd} <!-- 시군구 코드 -->
AND TASK_SE_CD = #{task.taskSeCd} <!-- 업무 구분 코드 -->
AND USE_YN = 'Y'
</update>
<update id="deleteTask" parameterType="map">/* 업무 정보 삭제(taskMapper.deleteTask) */
UPDATE TB_TASK
SET USE_YN = 'N' <!-- 사용 여부 -->
, MDFCN_DT = <include refid="utility.now" /> <!-- 수정 일시 -->
, MDFR = #{currentUser.id} <!-- 수정자 -->
WHERE SGG_CD = #{task.sggCd} <!-- 시군구 코드 -->
AND TASK_SE_CD = #{task.taskSeCd} <!-- 업무 구분 코드 -->
AND USE_YN = 'Y'
</update>
</mapper>

@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.fims.mngt.dao.VltnMapper">
<!-- 위반 정보 정보 매퍼
========== 변경 이력 ==========
2023-10-16 JoJH 최초 작성
============================ -->
<resultMap id="vltnRow" type="cokr.xit.fims.mngt.Vltn">
<result property="vltnId" column="VLTN_ID" /> <!-- 위반 ID -->
<result property="sggCd" column="SGG_CD" /> <!-- 시군구 코드 -->
<result property="taskSeCd" column="TASK_SE_CD" /> <!-- 업무 구분 코드 -->
<result property="vltnCd" column="VLTN_CD" /> <!-- 위반 코드 -->
<result property="vltnArtcl" column="VLTN_ARTCL" /> <!-- 위반 항목 -->
<result property="vltnLawNm" column="VLTN_LAW_NM" /> <!-- 위반 법 명 -->
<result property="vltnLaw1" column="VLTN_LAW1" /> <!-- 위반 법1 -->
<result property="vltnLaw2" column="VLTN_LAW2" /> <!-- 위반 법2 -->
<result property="vltnLawEtc" column="VLTN_LAW_ETC" /> <!-- 위반 법 기타 -->
<result property="acntgSeCd" column="ACNTG_SE_CD" /> <!-- 회계 구분 코드 -->
<result property="acntgSeNm" column="ACNTG_SE_NM" /> <!-- 회계 구분 명 -->
<result property="txitmCd" column="TXITM_CD" /> <!-- 세목 코드 -->
<result property="txitmNm" column="TXITM_NM" /> <!-- 세목 명 -->
<result property="operItemCd" column="OPER_ITEM_CD" /> <!-- 운영 항목 코드 -->
<result property="operItemNm" column="OPER_ITEM_NM" /> <!-- 운영 항목 명 -->
<result property="spclBizCd" column="SPCL_BIZ_CD" /> <!-- 특별회계 사업 코드 -->
<result property="useYn" column="USE_YN" /> <!-- 사용 여부 -->
<result property="createdAt" column="REG_DT" /> <!-- 등록 일시 -->
<result property="createdBy" column="RGTR" /> <!-- 등록자 -->
<result property="lastModified" column="MDFCN_DT" /> <!-- 수정 일시 -->
<result property="modifiedBy" column="MDFR" /> <!-- 수정자 -->
</resultMap>
<sql id="select">
SELECT V.VLTN_ID <!-- 위반 ID -->
, V.SGG_CD <!-- 시군구 코드 -->
, V.TASK_SE_CD <!-- 업무 구분 코드 -->
, V.VLTN_CD <!-- 위반 코드 -->
, V.VLTN_ARTCL <!-- 위반 항목 -->
, V.VLTN_LAW_NM <!-- 위반 법 명 -->
, V.VLTN_LAW1 <!-- 위반 법1 -->
, V.VLTN_LAW2 <!-- 위반 법2 -->
, V.VLTN_LAW_ETC <!-- 위반 법 기타 -->
, V.ACNTG_SE_CD <!-- 회계 구분 코드 -->
, V.ACNTG_SE_NM <!-- 회계 구분 명 -->
, V.TXITM_CD <!-- 세목 코드 -->
, V.TXITM_NM <!-- 세목 명 -->
, V.OPER_ITEM_CD <!-- 운영 항목 코드 -->
, V.OPER_ITEM_NM <!-- 운영 항목 명 -->
, V.SPCL_BIZ_CD <!-- 특별회계 사업 코드 -->
, V.SPCL_BIZ_NM <!-- 특별회계 사업 명 -->
, V.USE_YN <!-- 사용 여부 -->
, V.REG_DT <!-- 등록 일시 -->
, V.RGTR <!-- 등록자 -->
, V.MDFCN_DT <!-- 수정 일시 -->
, V.MDFR <!-- 수정자 -->
, <include refid="utility.today" /> AS TODAY <!-- 오늘 일자 -->
, (SELECT GET_CODE_NM('FIM054', V.TASK_SE_CD) FROM DUAL) AS TASK_SE_NM <!-- 업무 구분 명 -->
FROM TB_VLTN V
</sql>
<select id="selectVltnList" parameterType="map" resultType="dataobject">/* 위반 정보 목록 조회(vltnMapper.selectVltnList) */
<include refid="utility.paging-prefix" />
<include refid="select" />
WHERE V.SGG_CD = #{sggCd} <!-- 시군구 코드 -->
AND V.TASK_SE_CD = #{taskSeCd} <!-- 업무 구분 코드 -->
<if test="useYn != null">
AND V.USE_YN = #{useYn} <!-- 사용 여부 -->
</if>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" />
</select>
<select id="selectVltns" parameterType="map" resultType="dataobject">/* 위반 정보 객체 가져오기(vltnMapper.selectVltns) */
<include refid="select" />
WHERE 1 = 1
<if test="sggCd != null">
AND V.SGG_CD = #{sggCd} <!-- 시군구 코드 -->
</if>
<if test="taskSeCd != null">
AND V.TASK_SE_CD = #{taskSeCd} <!-- 업무 구분 코드 -->
</if>
<if test="vltnId != null">
AND V.VLTN_ID = #{vltnId} <!-- 위반 ID -->
</if>
<if test="vltnCd != null">
AND V.VLTN_CD = #{vltnCd} <!-- 위반 코드 -->
</if>
<if test="vltnArtcl != null">
AND V.VLTN_ARTCL = #{vltnArtcl} <!-- 위반 항목 -->
</if>
<if test="acntgSeCd != null">
AND V.ACNTG_SE_CD= #{acntgSeCd} <!-- 회계 구분 코드 -->
</if>
<if test="txitmCd != null">
AND V.TXITM_CD = #{txitmCd} <!-- 세목 코드 -->
</if>
<if test="useYn != null">
AND V.USE_YN = #{useYn} <!-- 사용 여부 -->
</if>
<include refid="utility.orderBy" />
</select>
<insert id="insertVltn" parameterType="map">
/* 위반 정보 등록(vltnMapper.insertVltn) */
<selectKey resultType="string" keyProperty="vltnId" keyColumn="NEW_ID" order="BEFORE">
<include refid="numbering.key">
<property name="TABLE_NAME" value="TB_VLTN" />
<property name="TABLE_KEY" value="VLTN_ID" />
<property name="pad" value="10" />
</include>
</selectKey>
INSERT
INTO TB_VLTN (
VLTN_ID <!-- 위반 ID -->
, SGG_CD <!-- 시군구 코드 -->
, TASK_SE_CD <!-- 업무 구분 코드 -->
, VLTN_CD <!-- 위반 코드 -->
, VLTN_ARTCL <!-- 위반 항목 -->
, VLTN_LAW_NM <!-- 위반 법 명 -->
, VLTN_LAW1 <!-- 위반 법1 -->
, VLTN_LAW2 <!-- 위반 법2 -->
, VLTN_LAW_ETC <!-- 위반 법 기타 -->
, ACNTG_SE_CD <!-- 회계 구분 코드 -->
, ACNTG_SE_NM <!-- 회계 구분 명 -->
, TXITM_CD <!-- 세목 코드 -->
, TXITM_NM <!-- 세목 명 -->
, OPER_ITEM_CD <!-- 운영 항목 코드 -->
, OPER_ITEM_NM <!-- 운영 항목 명 -->
, SPCL_BIZ_CD <!-- 특별회계 사업 코드 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
)
VALUES (
#{vltnId} <!-- 위반 ID -->
, #{vltn.sggCd} <!-- 시군구 코드 -->
, #{vltn.taskSeCd} <!-- 업무 구분 코드 -->
, #{vltn.vltnCd} <!-- 위반 코드 -->
, #{vltn.vltnArtcl} <!-- 위반 항목 -->
, #{vltn.vltnLawNm} <!-- 위반 법 명 -->
, #{vltn.vltnLaw1} <!-- 위반 법1 -->
, #{vltn.vltnLaw2} <!-- 위반 법2 -->
, #{vltn.vltnLawEtc} <!-- 위반 법 기타 -->
, #{vltn.acntgSeCd} <!-- 회계 구분 코드 -->
, #{vltn.acntgSeNm} <!-- 회계 구분 명 -->
, #{vltn.txitmCd} <!-- 세목 코드 -->
, #{vltn.txitmNm} <!-- 세목 명 -->
, #{vltn.operItemCd} <!-- 운영 항목 코드 -->
, #{vltn.operItemNm} <!-- 운영 항목 명 -->
, #{vltn.spclBizCd} <!-- 특별회계 사업 코드 -->
, 'Y' <!-- 사용 여부 -->
, <include refid="utility.now" /> <!-- 등록 일시 -->
, #{vltn.createdBy} <!-- 등록자 -->
, <include refid="utility.now" /> <!-- 수정 일시 -->
, #{vltn.modifiedBy} <!-- 수정자 -->
)
</insert>
<update id="updateVltn" parameterType="map">/* 위반 정보 수정(vltnMapper.updateVltn) */
UPDATE TB_VLTN
SET VLTN_ARTCL = #{vltn.vltnArtcl} <!-- 위반 항목 -->
, VLTN_LAW_NM = #{vltn.vltnLawNm} <!-- 위반 법 명 -->
, VLTN_LAW1 = #{vltn.vltnLaw1} <!-- 위반 법1 -->
, VLTN_LAW2 = #{vltn.vltnLaw2} <!-- 위반 법2 -->
, VLTN_LAW_ETC = #{vltn.vltnLawEtc} <!-- 위반 법 기타 -->
, ACNTG_SE_CD = #{vltn.acntgSeCd} <!-- 회계 구분 코드 -->
, ACNTG_SE_NM = #{vltn.acntgSeNm} <!-- 회계 구분 명 -->
, TXITM_CD = #{vltn.txitmCd} <!-- 세목 코드 -->
, TXITM_NM = #{vltn.txitmNm} <!-- 세목 명 -->
, OPER_ITEM_CD = #{vltn.operItemCd} <!-- 운영 항목 코드 -->
, OPER_ITEM_NM = #{vltn.operItemNm} <!-- 운영 항목 명 -->
, SPCL_BIZ_CD = #{vltn.spclBizCd} <!-- 특별회계 사업 코드 -->
, MDFCN_DT = <include refid="utility.now" /> <!-- 수정 일시 -->
, MDFR = #{vltn.modifiedBy} <!-- 수정자 -->
WHERE VLTN_ID = #{vltn.vltnId} <!-- 위반 ID -->
AND USE_YN = 'Y'
</update>
<update id="deleteVltn" parameterType="map">/* 위반 정보 삭제(vltnMapper.deleteVltn) */
UPDATE TB_VLTN
SET USE_YN = 'N' <!-- 사용 여부 -->
, MDFCN_DT = <include refid="utility.now" /> <!-- 수정 일시 -->
, MDFR = #{vltn.modifiedBy} <!-- 수정자 -->
WHERE VLTN_ID = #{vltn.vltnId} <!-- 위반 ID -->
AND USE_YN = 'Y'
</update>
</mapper>

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="numbering">
<sql id="key">
SELECT LPAD(CAST(
CASE
WHEN (SELECT MAX(${TABLE_KEY}) + 1 FROM ${TABLE_NAME}) IS NULL OR
(SELECT MAX(${TABLE_KEY}) + 1 FROM ${TABLE_NAME}) = ''
THEN 1
ELSE (SELECT MAX(${TABLE_KEY}) + 1 FROM ${TABLE_NAME})
END
AS INT), ${pad}, '0')
AS NEW_ID
FROM DUAL
</sql>
<sql id="keyByYear">
SELECT CONCAT(<include refid="utility.currentYear" />, LPAD(CAST(
CASE
WHEN (SELECT MAX(SUBSTRING(${TABLE_KEY}, 4+1)) + 1 FROM ${TABLE_NAME}
WHERE ${TABLE_KEY} LIKE CONCAT(<include refid="utility.currentYear" />, '%')) IS NULL OR
(SELECT MAX(SUBSTRING(${TABLE_KEY}, 4+1)) + 1 FROM ${TABLE_NAME}
WHERE ${TABLE_KEY} LIKE CONCAT(<include refid="utility.currentYear" />, '%')) = ''
THEN 1
ELSE (SELECT MAX(SUBSTRING(${TABLE_KEY}, 4+1)) + 1 FROM ${TABLE_NAME}
WHERE ${TABLE_KEY} LIKE CONCAT(<include refid="utility.currentYear" />, '%'))
END
AS INT), ${pad}-4, '0'))
AS NEW_ID
FROM DUAL
</sql>
<sql id="keyBySggAndYear">
SELECT CONCAT(${sggCd}, <include refid="utility.currentYear" />, LPAD(CAST(
CASE
WHEN (SELECT MAX(SUBSTRING(${TABLE_KEY}, 9+1)) + 1 FROM ${TABLE_NAME}
WHERE ${TABLE_KEY} LIKE CONCAT(${sggCd}, <include refid="utility.currentYear" />, '%')) IS NULL OR
(SELECT MAX(SUBSTRING(${TABLE_KEY}, 9+1)) + 1 FROM ${TABLE_NAME}
WHERE ${TABLE_KEY} LIKE CONCAT(${sggCd}, <include refid="utility.currentYear" />, '%')) = ''
THEN 1
ELSE (SELECT MAX(SUBSTRING(${TABLE_KEY}, 9+1)) + 1 FROM ${TABLE_NAME}
WHERE ${TABLE_KEY} LIKE CONCAT(${sggCd}, <include refid="utility.currentYear" />, '%'))
END
AS INT), ${pad}-9, '0'))
AS NEW_ID
FROM DUAL
</sql>
</mapper>
Loading…
Cancel
Save