diff --git a/src/main/java/cokr/xit/fims/FimsLogFilter.java b/src/main/java/cokr/xit/fims/FimsLogFilter.java new file mode 100644 index 00000000..b67b0b0b --- /dev/null +++ b/src/main/java/cokr/xit/fims/FimsLogFilter.java @@ -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; + } + } +} \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/base/FimsDepartment.java b/src/main/java/cokr/xit/fims/base/FimsDepartment.java new file mode 100644 index 00000000..c82ff5b2 --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/FimsDepartment.java @@ -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; + +} diff --git a/src/main/java/cokr/xit/fims/base/FimsSigungu.java b/src/main/java/cokr/xit/fims/base/FimsSigungu.java new file mode 100644 index 00000000..c0494685 --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/FimsSigungu.java @@ -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; + +} diff --git a/src/main/java/cokr/xit/fims/base/FimsUser.java b/src/main/java/cokr/xit/fims/base/FimsUser.java new file mode 100644 index 00000000..120dc4ec --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/FimsUser.java @@ -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; + } + +} diff --git a/src/main/java/cokr/xit/fims/base/OgdpQuery.java b/src/main/java/cokr/xit/fims/base/OgdpQuery.java new file mode 100644 index 00000000..6c8177bb --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/OgdpQuery.java @@ -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 setSggCd(String sggCd) { + this.sggCd = sggCd; + return self(); + } + + public String getDeptCd() { + return ifEmpty(deptCd, () -> null); + } + + public T setDeptCd(String deptCd) { + this.deptCd = deptCd; + return self(); + } + + public String getInstCd() { + return ifEmpty(instCd, () -> null); + } + + public T setInstCd(String instCd) { + this.instCd = instCd; + return self(); + } + + public String getUseYn() { + return ifEmpty(useYn, () -> null); + } + + public T setUseYn(String useYn) { + this.useYn = useYn; + return self(); + } + + public String getDelYn() { + return ifEmpty(delYn, () -> null); + } + + public T setDelYn(String delYn) { + this.delYn = delYn; + return self(); + } + + +} diff --git a/src/main/java/cokr/xit/fims/base/SseEntity.java b/src/main/java/cokr/xit/fims/base/SseEntity.java new file mode 100644 index 00000000..ecdb880a --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/SseEntity.java @@ -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(); + } + +} diff --git a/src/main/java/cokr/xit/fims/base/dao/OgdpMapper.java b/src/main/java/cokr/xit/fims/base/dao/OgdpMapper.java new file mode 100644 index 00000000..9c53f502 --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/dao/OgdpMapper.java @@ -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 + , D.EGP_RCEPT_ID + , D.EGP_APVL_NB + , D.EGP_ESB_PATH + , D.EGP_POST_INST_ID + , D.EGP_CERT_CN + , D.ENS_INTERFACE_ID + , D.ENS_SOURCE_CD + , D.ENS_TARGET_CD + , D.ENS_URL + , D.NXRP_LINK_YN + , D.NXRP_LINK_SRVC_URL + , D.NXRP_RGN_SE_CD + , D.DTBN_BANK_NM + , D.DTBN_ACTNO + , D.DOC_HEADER + , D.SRVR_OS + FROM TB_DEPT D + + + AND D.SGG_CD = #{sggCd} + + + AND D.DEPT_CD = #{deptCd} + + + AND D.INST_CD = #{instCd} + + + AND D.USE_YN = #{useYn} + + + """; + + + + @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 저장 여부 + *
  • 저장됐으면 true
  • + *
  • 그렇지 않으면 false
  • + *
+ */ + default boolean updateSggStng(FimsSigungu sgg) { + return sgg != null && updateSggStng(params().set("sgg", sgg)) == 1; + } + + /**시군구 설정 정보를 수정한다. + * @param params 파라미터 + *
  • "sgg" - 시군구 설정 정보
  • + *
  • "currentUser" - 현재 접속한 사용자
  • + *
+ * @return 저장된 정보수 + */ + @Update(SQLUtil.SCRIPT_START+""" + /* 시군구 설정 정보 수정 (ogdpMapper.updateSggStng) */ + UPDATE TB_SGG + SET MDFCN_DT = + """ + +SQLUtil.now + +""" + , MDFR = #{sgg.modifiedBy} + + , SYMBOL_FILE_PATH = #{sgg.symbolFilepath} + , SYMBOL_FILE_NM = #{sgg.symbolFilename} + + + , LOGO_FILE_PATH = #{sgg.logoFilepath} + , LOGO_FILE_NM = #{sgg.logoFilename} + + + , OFFCS_FILE_PATH = #{sgg.officialSealFilepath} + , OFFCS_FILE_NM = #{sgg.officialSealFilename} + + WHERE SGG_CD = #{sgg.sggID} + """+SQLUtil.SCRIPT_END) + int updateSggStng(Map 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 + + + AND S.SGG_CD = #{sggCd} + + + AND S.USE_YN = #{useYn} + + + """+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} + , EGP_RCEPT_ID = #{dept.egpRceptId} + , EGP_APVL_NB = #{dept.egpApvlNb} + , EGP_ESB_PATH = #{dept.egpEsbPath} + , EGP_POST_INST_ID = #{dept.egpPostInstId} + , EGP_CERT_CN = #{dept.egpCertCn} + , ENS_INTERFACE_ID = #{dept.ensInterfaceId} + , ENS_SOURCE_CD = #{dept.ensSourceCd} + , ENS_TARGET_CD = #{dept.ensTargetCd} + , ENS_URL = #{dept.ensUrl} + , 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} + WHERE DEPT_CD = #{dept.deptID} + AND USE_YN = 'Y' + """ + +SQLUtil.SCRIPT_END) + int updateDeptStng(Map 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 selectDeptStngList(OgdpQuery query); + + +} diff --git a/src/main/java/cokr/xit/fims/base/service/bean/OgdpBean.java b/src/main/java/cokr/xit/fims/base/service/bean/OgdpBean.java new file mode 100644 index 00000000..ffe7da60 --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/service/bean/OgdpBean.java @@ -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 ogdpList = new ArrayList<>(); + List 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 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 selectAbleOgdpList(boolean anonymous, String sggCd) { + List ogdpList = new ArrayList<>(); + SigunguQuery sggQuery = new SigunguQuery(); + if(anonymous) { + sggQuery.setSggIDs(sggCd); + } else if(!currentUser().getInstitute().equals("ADMIN00")){ + sggQuery.setSggIDs(currentUser().getOrgID()); + } + List 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 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 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 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 저장 여부 + *
  • 저장됐으면 true
  • + *
  • 그렇지 않으면 false
  • + *
+ */ + public boolean updateSggStng(FimsSigungu sgg) { + return ogdpMapper.updateSggStng(sgg); + } + + /**지정한 조건에 따라 시군구 객체를 반환한다. + * @param req 시군구 조회 조건 + * @return 시군구 객체 + */ + public DataObject getSggStngInfo(OgdpQuery req) { + return ogdpMapper.selectSggStngInfo(req); + } + + + public List 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; + + } + + +} diff --git a/src/main/java/cokr/xit/fims/base/service/bean/SseBean.java b/src/main/java/cokr/xit/fims/base/service/bean/SseBean.java new file mode 100644 index 00000000..bc026424 --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/service/bean/SseBean.java @@ -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 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 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); + } + } + } + + + +} diff --git a/src/main/java/cokr/xit/fims/base/web/ActionGroupController.java b/src/main/java/cokr/xit/fims/base/web/ActionGroupController.java new file mode 100644 index 00000000..bb2e5509 --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/web/ActionGroupController.java @@ -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"))); + } + +} \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/base/web/AuthorityController.java b/src/main/java/cokr/xit/fims/base/web/AuthorityController.java new file mode 100644 index 00000000..a67d54ea --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/web/AuthorityController.java @@ -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"))); + } + +} \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/base/web/CodeController.java b/src/main/java/cokr/xit/fims/base/web/CodeController.java new file mode 100644 index 00000000..1ae0e1dc --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/web/CodeController.java @@ -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 taskList = codeBean.getCodeList(codeQuery); + Map 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 result = taskBean.getTasks(req); + if(result != null && !result.isEmpty()) { + mav.addObject("sggHasTask", "Y"); + } else { + mav.addObject("sggHasTask", "N"); + } + + + } + + return mav; + } +} \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/base/web/LoggingController.java b/src/main/java/cokr/xit/fims/base/web/LoggingController.java new file mode 100644 index 00000000..4b601efa --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/web/LoggingController.java @@ -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 + list = loggingService.getLogs(req), + web = list.stream() + .filter(row -> "web".equals(row.get("LOG_TYPE"))) + .toList(); + if (!list.isEmpty()) { + Map 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 list) { + List 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") + ); + } + +} \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/base/web/MainController.java b/src/main/java/cokr/xit/fims/base/web/MainController.java new file mode 100644 index 00000000..b9decfa1 --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/web/MainController.java @@ -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 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 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 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) 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 ableOgdpList = ogdpBean.selectAbleOgdpList(true, sggCd); + mav.addObject("ableOgdpList", ableOgdpList); + + Map> commonCodes = codeService.getCodesOf("CMN008"); + mav.addObject("CMN008List", commonCodes.get("CMN008")); + + } else if(cntnSeCd.equals("02")) { + List 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")); + } + + +} \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/base/web/MenuController.java b/src/main/java/cokr/xit/fims/base/web/MenuController.java new file mode 100644 index 00000000..96cc3a09 --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/web/MenuController.java @@ -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 {} \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/base/web/OgdpController.java b/src/main/java/cokr/xit/fims/base/web/OgdpController.java new file mode 100644 index 00000000..3ab2f5ef --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/web/OgdpController.java @@ -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 {} + + @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 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; + } + + /**지정하는 시군구의 설정 정보를 가져온다.
+ * @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; + } + + /**지정하는 시군구의 업무 설정 정보를 가져온다.
+ * @param req + * @return jsonView + */ + @RequestMapping(name="업무 조회", value=METHOD_URL.getTasks) + public ModelAndView getTasks(CmmnQuery req) { + List result = taskBean.getTasks(req); + + return setPagingInfo(new ModelAndView("jsonView"), result, "task"); + } + + /**지정하는 시군구와 업무의 위반 설정 정보를 가져온다.
+ * @return 위반 설정 정보 + */ + @RequestMapping(name="위반정보 조회", value=METHOD_URL.getVltns) + public ModelAndView getVltns(VltnQuery req) { + List result = vltnBean.getVltns(req); + return setPagingInfo(new ModelAndView("jsonView"), result, "vltn"); + } + + /**시군구 설정 정보를 수정한다. + * @param sgg 시군구 정보, symbol 시군구 상징파일, logo 시군구 로고파일, offcs 시군구 직인파일 + * @return jsonView + *
 {
+	 *     "saved": 수정되었으면 true, 그렇지 않으면 false
+	 * }
+ */ + @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 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 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 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 uploadForSgg(MultipartFile mf, String sggCd, String fileSe){ + Map 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 + *
 {
+	 *     "saved": 수정되었으면 true, 그렇지 않으면 false
+	 * }
+ */ + @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 + *
 {
+	 *     "saved": 수정되었으면 true, 그렇지 않으면 false
+	 * }
+ */ + @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 allSggList = sggDeptService.getSigunguList(new SigunguQuery()); + + mav.addObject("sggList", allSggList); + + return mav; + } + + /**부서 설정 목록을 조회한다.
+ * {@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 + *
{
+	 *     "deptInfo": 부서 정보
+	 * }
+ */ + @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 + *
 {
+	 *     "saved": 저장되었으면 true, 그렇지 않으면 false
+	 * }
+ */ + @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; + } +} \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/base/web/UserController.java b/src/main/java/cokr/xit/fims/base/web/UserController.java new file mode 100644 index 00000000..637d924d --- /dev/null +++ b/src/main/java/cokr/xit/fims/base/web/UserController.java @@ -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 { + + @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> 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 ableOgdpList = ogdpBean.selectAbleOgdpList(false, currentUser().getOrgID()); + mav.addObject("ableOgdpList", ableOgdpList); + + Map> 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 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 ableOgdpList = ogdpBean.selectAbleOgdpList(false, currentUser().getOrgID()); + mav.addObject("ableOgdpList", ableOgdpList); + + Map> 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); + } +} diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnQuery.java b/src/main/java/cokr/xit/fims/cmmn/CmmnQuery.java new file mode 100644 index 00000000..9a3d9090 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnQuery.java @@ -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 setSseKey(String sseKey) { + this.sseKey = sseKey; + return self(); + } + + public String getMainOption() { + return ifEmpty(mainOption, () -> null); + } + + public T setMainOption(String mainOption) { + this.mainOption = mainOption; + return self(); + } + + public String getSubOption() { + return ifEmpty(subOption, () -> null); + } + + public T setSubOption(String subOption) { + this.subOption = subOption; + return self(); + } + + public String getCellDefs() { + return ifEmpty(cellDefs, () -> null); + } + + public T setCellDefs(String cellDefs) { + this.cellDefs = cellDefs; + return self(); + } + + public String getIncludePhoto() { + return ifEmpty(includePhoto, () -> null); + } + + public T setIncludePhoto(String includePhoto) { + this.includePhoto = includePhoto; + return self(); + } + + public String getThisDay() { + return ifEmpty(thisDay, () -> null); + } + + public T setThisDay(String thisDay) { + this.thisDay = thisDay; + return self(); + } + + public String getSggCd() { + return ifEmpty(sggCd, () -> null); + } + + public T setSggCd(String sggCd) { + this.sggCd = sggCd; + return self(); + } + + public String getDeptCd() { + return ifEmpty(deptCd, () -> null); + } + + public T setDeptCd(String deptCd) { + this.deptCd = deptCd; + return self(); + } + + public String getTaskSeCd() { + return ifEmpty(taskSeCd, () -> null); + } + + public T setTaskSeCd(String taskSeCd) { + this.taskSeCd = taskSeCd; + return self(); + } + + public String getInstCd() { + return ifEmpty(instCd, () -> null); + } + + public T setInstCd(String instCd) { + this.instCd = instCd; + return self(); + } + + public String getUseYn() { + return ifEmpty(useYn, () -> null); + } + + public T setUseYn(String useYn) { + this.useYn = useYn; + return self(); + } + + public String getDelYn() { + return ifEmpty(delYn, () -> null); + } + + public T setDelYn(String delYn) { + this.delYn = delYn; + return self(); + } + + public String getSchDateOpt() { + return ifEmpty(schDateOpt, () -> null); + } + + public T setSchDateOpt(String schDateOpt) { + this.schDateOpt = schDateOpt; + return self(); + } + + public String getSchDateFrom() { + return ifEmpty(schDateFrom, () -> null); + } + + public T setSchDateFrom(String schDateFrom) { + this.schDateFrom = schDateFrom; + return self(); + } + + public String getSchDateTo() { + return ifEmpty(schDateTo, () -> null); + } + + public T setSchDateTo(String schDateTo) { + this.schDateTo = schDateTo; + return self(); + } + + public String getSchRegDateOpt() { + return ifEmpty(schRegDateOpt, () -> null); + } + + public T setSchRegDateOpt(String schRegDateOpt) { + this.schRegDateOpt = schRegDateOpt; + return self(); + } + + public String getSchRegDateFrom() { + return ifEmpty(schRegDateFrom, () -> null); + } + + public T setSchRegDateFrom(String schRegDateFrom) { + this.schRegDateFrom = schRegDateFrom; + return self(); + } + + public String getSchRegDateTo() { + return ifEmpty(schRegDateTo, () -> null); + } + + public T setSchRegDateTo(String schRegDateTo) { + this.schRegDateTo = schRegDateTo; + return self(); + } + + public String getSchRgtrOpt() { + return ifEmpty(schRgtrOpt, () -> null); + } + + public T setSchRgtrOpt(String schRgtrOpt) { + this.schRgtrOpt = schRgtrOpt; + return self(); + } + + public String getSchRgtrCd() { + return ifEmpty(schRgtrCd, () -> null); + } + + public T setSchRgtrCd(String schRgtrCd) { + this.schRgtrCd = schRgtrCd; + return self(); + } + + public String getSchRgtrNm() { + return ifEmpty(schRgtrNm, () -> null); + } + + public T setSchRgtrNm(String schRgtrNm) { + this.schRgtrNm = schRgtrNm; + return self(); + } + +} diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java new file mode 100644 index 00000000..e8f43843 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java @@ -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 getDataObjectListFromMap(Map map, String key) { + ArrayList 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("<", "<"); + str = str.replaceAll(">", ">"); + str = str.replaceAll("&", "&"); + str = str.replaceAll(""", "\\\""); + 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 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 fileList = null; + try (Stream 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> byFileName = fileList.stream().collect(Collectors.groupingBy(item -> item.toFile().getName())); + + Iterator keys = byFileName.keySet().iterator(); + + while( keys.hasNext() ){ + String key = keys.next(); + List 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 검증 코드 + *
  • 저장됐으면 true
  • + *
  • 그렇지 않으면 false
  • + *
+ */ + 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 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; + } +} \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/cmmn/dao/StngMapper.java b/src/main/java/cokr/xit/fims/cmmn/dao/StngMapper.java new file mode 100644 index 00000000..9ca289d8 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/dao/StngMapper.java @@ -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 params); + + /**사용자의 기본 업무를 등록한다. + * @param params 사용자 설정 정보 + * @return 저장여부 + */ + int insertDefaultTask(Map params); + + /**사용자의 기본 업무를 변경한다. + * @param params 사용자 설정 정보 + * @return 저장여부 + */ + int updateDefaultTask(Map params); + +} diff --git a/src/main/java/cokr/xit/fims/cmmn/service/StngService.java b/src/main/java/cokr/xit/fims/cmmn/service/StngService.java new file mode 100644 index 00000000..2404d595 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/service/StngService.java @@ -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 저장 여부 + *
  • 저장됐으면 true
  • + *
  • 그렇지 않으면 false
  • + *
+ */ + String updateTaskStng(Task task, List vltnList); + + /**시군구별 업무 설정, 위반 설정을 추가한다. + * @param sggCd 시군구 코드, taskSeCd 업무구분 코드 + * @return 저장 여부 + *
  • 저장됐으면 true
  • + *
  • 그렇지 않으면 false
  • + *
+ */ + String createTaskStng(String sggCd, String taskSeCd); +} diff --git a/src/main/java/cokr/xit/fims/cmmn/service/bean/StngBean.java b/src/main/java/cokr/xit/fims/cmmn/service/bean/StngBean.java new file mode 100644 index 00000000..a4c5a307 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/service/bean/StngBean.java @@ -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 params = new HashMap(); + 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 taskList = codeBean.getCodeList((new CodeQuery()).setGroupIDs("FIM054")) + .stream().map(item -> item.string("CODE")).toList(); + + List availableTaskList = new ArrayList<>(); + + if(userInfo.getInstitute().equals("ADMIN00")) { //최고관리자 + + availableTaskList = taskList; + + } else if(isAdmin) { //관리자 + Map 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 authorities = userInfo.getAuthorities(); + + if(authorities != null && !authorities.isEmpty()) { + for(Authority authority : authorities) { + String authId = authority.getId(); + + for(int i=0; i
  • 저장됐으면 true
  • + *
  • 그렇지 않으면 false
  • + * + */ + public boolean saveDefaultTask(String taskSeCd) { + + DataObject info = stngMapper.selectDefaultTask(currentUser().getId()); + int effected = 0; + + Map params = new HashMap(); + 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 filterTaskSectionCodeForSgg(List taskSectionCodes) { + + List taskListForSgg = new ArrayList(); + if(currentUser().getInstitute().equals("ADMIN00")) { + taskListForSgg = taskSectionCodes; + } else { + SecuredUserInfo userInfo = currentUser(); + Map info = userInfo.getInfo(); + if(info == null || info.get("sggCd") == null || info.get("sggCd").equals("")) { + ogdpBean.initUserInfo(userInfo); + } + + List 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; + } + +} diff --git a/src/main/java/cokr/xit/fims/cmmn/service/bean/StngServiceBean.java b/src/main/java/cokr/xit/fims/cmmn/service/bean/StngServiceBean.java new file mode 100644 index 00000000..bd1652fe --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/service/bean/StngServiceBean.java @@ -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 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 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 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]"; + } + + +} diff --git a/src/main/java/cokr/xit/fims/mngt/Task.java b/src/main/java/cokr/xit/fims/mngt/Task.java new file mode 100644 index 00000000..3ac0742d --- /dev/null +++ b/src/main/java/cokr/xit/fims/mngt/Task.java @@ -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 vltnStngList; + +} diff --git a/src/main/java/cokr/xit/fims/mngt/Vltn.java b/src/main/java/cokr/xit/fims/mngt/Vltn.java new file mode 100644 index 00000000..93a7064f --- /dev/null +++ b/src/main/java/cokr/xit/fims/mngt/Vltn.java @@ -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; + +} diff --git a/src/main/java/cokr/xit/fims/mngt/VltnQuery.java b/src/main/java/cokr/xit/fims/mngt/VltnQuery.java new file mode 100644 index 00000000..191dd314 --- /dev/null +++ b/src/main/java/cokr/xit/fims/mngt/VltnQuery.java @@ -0,0 +1,80 @@ +package cokr.xit.fims.mngt; + +import cokr.xit.fims.cmmn.CmmnQuery; + +/**위반 정보 정보 조회 요청 + * + *

    상세 설명: + * + *

    + * ============ 변경 이력 ============
    + * 2023-10-16	JoJH 최초 작성
    + * ================================
    + * 
    + */ +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 setVltnId(String vltnId) { + this.vltnId = vltnId; + return self(); + } + + public String getLawCd() { + return ifEmpty(lawCd, () -> null); + } + + public T setLawCd(String lawCd) { + this.lawCd = lawCd; + return self(); + } + + public String getVltnCd() { + return ifEmpty(vltnCd, () -> null); + } + + public T setVltnCd(String vltnCd) { + this.vltnCd = vltnCd; + return self(); + } + + public String getVltnArtcl() { + return ifEmpty(vltnArtcl, () -> null); + } + + public T setVltnArtcl(String vltnArtcl) { + this.vltnArtcl = vltnArtcl; + return self(); + } + + public String getAcntgSeCd() { + return ifEmpty(acntgSeCd, () -> null); + } + + public T setAcntgSeCd(String acntgSeCd) { + this.acntgSeCd = acntgSeCd; + return self(); + } + + public String getTxitmCd() { + return ifEmpty(txitmCd, () -> null); + } + + public T setTxitmCd(String txitmCd) { + this.txitmCd = txitmCd; + return self(); + } + +} diff --git a/src/main/java/cokr/xit/fims/mngt/dao/TaskMapper.java b/src/main/java/cokr/xit/fims/mngt/dao/TaskMapper.java new file mode 100644 index 00000000..85f33cff --- /dev/null +++ b/src/main/java/cokr/xit/fims/mngt/dao/TaskMapper.java @@ -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 + * + *

    상세 설명: + * + *

    + * ============ 변경 이력 ============
    + * 2023-10-24	JoJH 최초 작성
    + * ================================
    + * 
    + */ +@Mapper("taskMapper") +public interface TaskMapper extends AbstractMapper { + + /**지정한 조건에 따라 업무 정보 목록을 조회하여 반환한다.
    + * @param req 업무 정보 조회 조건 + * @return 업무 정보 목록 + */ + List selectTaskList(CmmnQuery req); + + /**지정한 조건에 따라 업무 정보 객체들을 반환한다. + * @param req 업무 정보 조회 조건 + * @return 업무 정보 객체 목록 + */ + List selectTasks(CmmnQuery req); + + /**지정한 조건에 따라 업무 정보 객체를 반환한다. + * @param req 업무 정보 조회 조건 + * @return 업무 정보 객체 + */ + default DataObject selectTaskInfo(CmmnQuery req) { + // 사용 여부 확인 + if (req.getUseYn() == null) { + req.setUseYn("Y"); + } + + List tasks = selectTasks(req); + + return !tasks.isEmpty() ? tasks.get(0) : null; + } + + /**지정한 조건에 따라 사전통지 일자를 반환한다. + * @param req 업무 정보 조회 조건 + * @return 업무 정보 객체 + */ + DataObject selectAdvntceYmdInfo(CmmnQuery req); + + /**업무 정보 정보를 등록한다. + * @param params 파라미터 + *
    • "task" - 업무 정보
    • + *
    • "currentUser" - 현재 접속한 사용자
    • + *
    + * @return 저장된 정보수 + */ + int insertTask(Map params); + + /**업무 정보 정보를 등록한다. + * @param task 업무 정보 + * @return 저장 여부 + *
    • 저장됐으면 true
    • + *
    • 그렇지 않으면 false
    • + *
    + */ + default boolean insert(Task task) { + return task != null && insertTask(params().set("task", task)) == 1; + } + + /**업무 정보 정보를 수정한다. + * @param params 파라미터 + *
    • "task" - 업무 정보
    • + *
    • "currentUser" - 현재 접속한 사용자
    • + *
    + * @return 저장된 정보수 + */ + int updateTask(Map params); + + /**업무 정보 정보를 수정한다. + * @param task 업무 정보 + * @return 저장 여부 + *
    • 저장됐으면 true
    • + *
    • 그렇지 않으면 false
    • + *
    + */ + default boolean update(Task task) { + return task != null && updateTask(params().set("task", task)) == 1; + } + + /**지정한 업무 정보을 삭제한다. + * @param params 파라미터 + *
    • "task" - 업무 정보
    • + *
    • "currentUser" - 현재 접속한 사용자
    • + *
    + * @return 저장된 정보수 + */ + int deleteTask(Map params); + + /**업무 정보 정보를 삭제한다. + * @param task 업무 정보 + * @return 저장 여부 + *
    • 저장됐으면 true
    • + *
    • 그렇지 않으면 false
    • + *
    + */ + default boolean delete(Task task) { + return task != null && deleteTask(params().set("task", task)) == 1; + } + +} diff --git a/src/main/java/cokr/xit/fims/mngt/dao/VltnMapper.java b/src/main/java/cokr/xit/fims/mngt/dao/VltnMapper.java new file mode 100644 index 00000000..3a2927cd --- /dev/null +++ b/src/main/java/cokr/xit/fims/mngt/dao/VltnMapper.java @@ -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 + * + *

    상세 설명: + * + *

    + * ============ 변경 이력 ============
    + * 2023-10-16	JoJH 최초 작성
    + * ================================
    + * 
    + */ +@Mapper("vltnMapper") +public interface VltnMapper extends AbstractMapper { + + /**지정한 조건에 따라 위반 정보 목록을 조회하여 반환한다.
    + * @param req 위반 정보 조회 조건 + * @return 위반 정보 목록 + */ + List selectVltnList(VltnQuery req); + + /**지정한 조건에 따라 위반 정보 객체들을 반환한다. + * @param req 위반 정보 조회 조건 + * @return 위반 정보 객체 목록 + */ + List selectVltns(VltnQuery req); + + /**지정한 조건에 따라 위반 정보 객체를 반환한다. + * @param req 위반 정보 조회 조건 + * @return 위반 정보 객체 + */ + default DataObject selectVltnInfo(VltnQuery req) { + List vltns = selectVltns(req); + + return !vltns.isEmpty() ? vltns.get(0) : null; + } + + /**위반 정보 정보를 등록한다. + * @param params 파라미터 + *
    • "vltnInfo" - 위반 정보
    • + *
    • "currentUser" - 현재 접속한 사용자
    • + *
    + * @return 저장된 정보수 + */ + int insertVltn(Map params); + + /**위반 정보 정보를 등록한다. + * @param vltnInfo 위반 정보 + * @return 저장 여부 + *
    • 저장됐으면 true
    • + *
    • 그렇지 않으면 false
    • + *
    + */ + default boolean insert(Vltn vltn) { + return vltn != null && insertVltn(params().set("vltn", vltn)) == 1; + } + + /**위반 정보 정보를 수정한다. + * @param params 파라미터 + *
    • "vltnInfo" - 위반 정보
    • + *
    • "currentUser" - 현재 접속한 사용자
    • + *
    + * @return 저장된 정보수 + */ + int updateVltn(Map params); + + /**위반 정보 정보를 수정한다. + * @param vltnInfo 위반 정보 + * @return 저장 여부 + *
    • 저장됐으면 true
    • + *
    • 그렇지 않으면 false
    • + *
    + */ + default boolean update(Vltn vltn) { + return vltn != null && updateVltn(params().set("vltn", vltn)) == 1; + } + + /**지정한 위반 정보을 삭제한다. + * @param params 파라미터 + *
    • "vltnInfo" - 위반 정보
    • + *
    • "currentUser" - 현재 접속한 사용자
    • + *
    + * @return 저장된 정보수 + */ + int deleteVltn(Map params); + + /**위반 정보 정보를 삭제한다. + * @param vltnInfo 위반 정보 + * @return 저장 여부 + *
    • 저장됐으면 true
    • + *
    • 그렇지 않으면 false
    • + *
    + */ + default boolean delete(Vltn vltn) { + return vltn != null && deleteVltn(params().set("vltn", vltn)) == 1; + } + +} diff --git a/src/main/java/cokr/xit/fims/mngt/service/bean/TaskBean.java b/src/main/java/cokr/xit/fims/mngt/service/bean/TaskBean.java new file mode 100644 index 00000000..dfe26fc9 --- /dev/null +++ b/src/main/java/cokr/xit/fims/mngt/service/bean/TaskBean.java @@ -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 + * + *

    상세 설명: + * + *

    + * ============ 변경 이력 ============
    + * 2023-10-24	JoJH 최초 작성
    + * ================================
    + * 
    + */ +@Component("taskBean") +public class TaskBean extends AbstractBean { + + /** 업무 정보 정보 DAO */ + @Resource(name = "taskMapper") + private TaskMapper taskMapper; + + /**지정한 조건에 따라 업무 정보 목록을 조회하여 반환한다. + * @param req 업무 정보 조회 조건 + * @return 업무 정보 목록 + */ + public List getTaskList(CmmnQuery req) { + return taskMapper.selectTaskList(req); + } + + /**지정한 조건에 따라 업무 정보 객체들을 반환한다. + * @param req 업무 정보 조회 조건 + * @return 업무 정보 객체 목록 + */ + public List 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 저장 여부 + *
    • 저장됐으면 true
    • + *
    • 그렇지 않으면 false
    • + *
    + */ + public boolean create(Task task) { + return taskMapper.insert(task); + } + + /**업무 정보 정보를 수정한다. + * @param taskInfo 업무 정보 + * @return 저장 여부 + *
    • 저장됐으면 true
    • + *
    • 그렇지 않으면 false
    • + *
    + */ + public boolean update(Task task) { + return taskMapper.update(task); + } + + /**업무 정보 정보를 삭제한다. + * @param taskInfo 업무 정보 + * @return 저장 여부 + *
    • 저장됐으면 true
    • + *
    • 그렇지 않으면 false
    • + *
    + */ + public boolean remove(Task task) { + return taskMapper.delete(task); + } + +} diff --git a/src/main/java/cokr/xit/fims/mngt/service/bean/VltnBean.java b/src/main/java/cokr/xit/fims/mngt/service/bean/VltnBean.java new file mode 100644 index 00000000..d5bbcdfc --- /dev/null +++ b/src/main/java/cokr/xit/fims/mngt/service/bean/VltnBean.java @@ -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 + * + *

    상세 설명: + * + *

    + * ============ 변경 이력 ============
    + * 2023-10-16	JoJH 최초 작성
    + * ================================
    + * 
    + */ +@Component("vltnBean") +public class VltnBean extends AbstractBean { + + /** 위반 정보 정보 DAO */ + @Resource(name = "vltnMapper") + private VltnMapper vltnMapper; + + /**지정한 조건에 따라 위반 정보 목록을 조회하여 반환한다. + * @param req 위반 정보 조회 조건 + * @return 위반 정보 목록 + */ + public List getVltnList(VltnQuery req) { + return vltnMapper.selectVltnList(req); + } + + /**지정한 조건에 따라 위반 정보 객체들을 반환한다. + * @param req 위반 정보 조회 조건 + * @return 위반 정보 객체 목록 + */ + public List getVltns(VltnQuery req) { + return vltnMapper.selectVltns(req); + } + + /**지정한 조건에 따라 위반 정보 객체를 반환한다. + * @param req 위반 정보 조회 조건 + * @return 위반 정보 객체 + */ + public DataObject getVltnInfo(VltnQuery req) { + return vltnMapper.selectVltnInfo(req); + } + + /**위반 정보 정보를 등록한다. + * @param vltnInfo 위반 정보 + * @return 저장 여부 + *
    • 저장됐으면 true
    • + *
    • 그렇지 않으면 false
    • + *
    + */ + public boolean create(Vltn vltn) { + return vltnMapper.insert(vltn); + } + + /**위반 정보 정보를 수정한다. + * @param vltnInfo 위반 정보 + * @return 저장 여부 + *
    • 저장됐으면 true
    • + *
    • 그렇지 않으면 false
    • + *
    + */ + public boolean update(Vltn vltn) { + return vltnMapper.update(vltn); + } + + /**위반 정보 정보를 삭제한다. + * @param vltnInfo 위반 정보 + * @return 저장 여부 + *
    • 저장됐으면 true
    • + *
    • 그렇지 않으면 false
    • + *
    + */ + public boolean remove(Vltn vltn) { + return vltnMapper.delete(vltn); + } + +} diff --git a/src/main/java/cokr/xit/fims/task/Task.java b/src/main/java/cokr/xit/fims/task/Task.java new file mode 100644 index 00000000..e33ad40a --- /dev/null +++ b/src/main/java/cokr/xit/fims/task/Task.java @@ -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"; +} diff --git a/src/main/java/cokr/xit/fims/task/TaskMvcConfig.java b/src/main/java/cokr/xit/fims/task/TaskMvcConfig.java new file mode 100644 index 00000000..71ebc5bc --- /dev/null +++ b/src/main/java/cokr/xit/fims/task/TaskMvcConfig.java @@ -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(); + } + +} diff --git a/src/main/java/cokr/xit/fims/task/TaskRequestMappingHandlerMapping.java b/src/main/java/cokr/xit/fims/task/TaskRequestMappingHandlerMapping.java new file mode 100644 index 00000000..8ab66c8b --- /dev/null +++ b/src/main/java/cokr/xit/fims/task/TaskRequestMappingHandlerMapping.java @@ -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 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(); + + } +} diff --git a/src/main/resources/sql/mapper/base/authority-mapper.xml b/src/main/resources/sql/mapper/base/authority-mapper.xml new file mode 100644 index 00000000..baa4a4d9 --- /dev/null +++ b/src/main/resources/sql/mapper/base/authority-mapper.xml @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + +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 + , 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 + , 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 + , 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 + + +AND AUTH_ID IN (#{authID}) + + +AND ${by} LIKE CONCAT('%', #{term}, '%') + + + + + + + + + + + +/* 권한 등록(authorityMapper.insertAuthority) */ +INSERT INTO TB_AUTHORITY ( + AUTH_ID + , AUTH_NM + , DSCRP + , INF_SCP + , USER_INF_SCP + , REG_DT +) VALUES ( + #{id} + , #{name} + , #{description} + , #{infoScope} + , #{userInfoScope} + , +) + + + +/* 권한 수정(authorityMapper.updateAuthority) */ +UPDATE TB_AUTHORITY SET + AUTH_NM = #{name} + , DSCRP = #{description} + , INF_SCP = #{infoScope} + , USER_INF_SCP = #{userInfoScope} + WHERE AUTH_ID = #{id} + + + +/* 권한 삭제(authorityMapper.removeAuthorities) */ +DELETE FROM TB_AUTHORITY + WHERE AUTH_ID IN (#{authID}) + + + + + +/* 권한-기능그룹 추가(authorityMapper.addActionGroups) */ +INSERT INTO TB_AUTH_ACTION (AUTH_ID, GRP_ID, REG_DT) +SELECT AUTH_ID, GRP_ID, + FROM ( + SELECT #{authID} AUTH_ID, #{groupID} GRP_ID FROM DUAL + ) 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 + ) + + +/* 권한-기능그룹 삭제(authorityMapper.removeActionGroups) */ +DELETE FROM TB_AUTH_ACTION + +AND AUTH_ID IN (#{authID}) +AND GRP_ID IN (#{groupID}) + + + + + + + +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 + +AND AUTH_ID IN (#{authID}) +AND A.USER_ID IN (#{userID}) + AND A.USER_ID = B.USER_ID + + + + + + + + + + +/* 권한-사용자 추가(authorityMapper.addUsers) */ +INSERT INTO TB_AUTH_USER (AUTH_ID, USER_ID, REG_DT) +SELECT AUTH_ID, USER_ID, + FROM ( + SELECT #{authID} AUTH_ID, #{userID} USER_ID FROM DUAL + ) 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 + ) + + + +/* 권한-사용자 삭제(authorityMapper.removeUsers) */ +DELETE FROM TB_AUTH_USER + +AND AUTH_ID IN (#{authID}) +AND USER_ID IN (#{userID}) + + + + \ No newline at end of file diff --git a/src/main/resources/sql/mapper/base/department-mapper.xml b/src/main/resources/sql/mapper/base/department-mapper.xml new file mode 100644 index 00000000..cc715865 --- /dev/null +++ b/src/main/resources/sql/mapper/base/department-mapper.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + +SELECT DEPT_CD + , SGG_CD + , INST_CD + , DEPT_NM + , DEPT_TELNO + , DEPT_FXNO + , USE_YN + , REG_DT + , RGTR + , MDFCN_DT + , MDFR + FROM TB_DEPT + + + + + + +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' + + + + SELECT SGG_CD, SGG_NM, INST_CD, INST_NM, 'EMPTY00', '(부서 없음)' + FROM TB_SGG + WHERE USE_YN = 'Y' + + + + SELECT 'ADMIN', '관리자 시군구', 'ADMIN00', '관리자 기관', 'ADMIN00', '관리자 부서' + FROM DUAL + + + + +/* 부서 정보 등록(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} +) + +/* 부서 정보 수정(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} + +/* 부서 정보 삭제(departmentMapper.deleteDepartment) */ +UPDATE TB_DEPT + SET USE_YN = 'N' + , MDFCN_DT = + , MDFR = #{currentUser.id} + AND SGG_CD IN (#{sggID}) + AND DEPT_CD IN (#{deptID}) + + \ No newline at end of file diff --git a/src/main/resources/sql/mapper/base/sigungu-mapper.xml b/src/main/resources/sql/mapper/base/sigungu-mapper.xml new file mode 100644 index 00000000..995ce5cd --- /dev/null +++ b/src/main/resources/sql/mapper/base/sigungu-mapper.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + +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 + + + + + +/* 시군구 등록(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} +) + +/* 시군구 수정(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} + +/* 시군구 삭제(sigunguMapper.delete) */ +UPDATE TB_SGG + SET USE_YN = 'N' + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE SGG_CD IN (#{sggID}) + + \ No newline at end of file diff --git a/src/main/resources/sql/mapper/base/syslog-mapper.xml b/src/main/resources/sql/mapper/base/syslog-mapper.xml new file mode 100644 index 00000000..aabf5997 --- /dev/null +++ b/src/main/resources/sql/mapper/base/syslog-mapper.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + +/* 시스템 로그 등록(loggingMapper.insertLog) */ +INSERT INTO TB_SYS_LOG ( + LOG_ID + , LOG_TYPE + , URL + , CLS_NM + , MTD_NM + , FILE_NM + , DATA_CNT + , DATA_NM + , PSNL_INFO + , USER_ID + , IP_ADDR + , REG_DT +) VALUES ( + CONCAT(, LPAD(NEXTVAL(SQ_SYS_LOG), 16, '0')) + , #{type} + , #{url} + , #{className} + , #{methodName} + , #{fileName} + , #{dataCount} + , #{fieldNames} + , #{personalInfo} + , #{userId} + , #{ipAddress} + , +) + + + \ No newline at end of file diff --git a/src/main/resources/sql/mapper/base/user-mapper.xml b/src/main/resources/sql/mapper/base/user-mapper.xml new file mode 100644 index 00000000..e526593e --- /dev/null +++ b/src/main/resources/sql/mapper/base/user-mapper.xml @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +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 ( + + UNION + + UNION + + ) B ON A.NSTT_CD = B.INST_CD AND A.DEPT_CD = B.DEPT_CD + + + + + AND ${by} LIKE CONCAT('%', UPPER(#{term}), '%') + + + AND ${by} LIKE CONCAT('%', #{term}, '%') + + + + + USER_ID IN (#{userID}) + + + AND STTS = #{status} + + + AND CNTN_SE_CD = #{type} + + + + + + + + + + + + + + +SELECT LPAD(NVL(MAX(USER_ID) + 1, 1), 10, '0') NEW_ID FROM TB_USER + +/* 사용자 정보 등록(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 + , + , #{createdBy} + , + , #{createdBy} + , 'Y' + , #{status} +) + + + +/* 사용자 정보 수정(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} + , USE_YN = 'N' + , MDFCN_DT = + , MDFR = #{modifiedBy} + WHERE USER_ID = #{id} + + +/* 비밀번호 변경(userMapper.changePassword) */ +UPDATE TB_USER SET + PASSWD = CASE USER_ID + WHEN #{userPassword.userID} THEN #{userPassword.password} + ELSE PASSWD END + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE USER_ID IN (#{userID}) + + + +/* 사용자 잠김 해제(userMapper.lockUsers) */ +UPDATE TB_USER SET + LOCK_YN = 'Y' + , LOCK_CNT = LOCK_CNT + 1 + , LOCK_DT = + LOCK_YN = 'N' + , LOCK_CNT = 0 + , LOCK_DT = NULL + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE USER_ID IN (#{userID}) + + + +/* 사용자 상태 변경(userMapper.setStatus) */ +UPDATE TB_USER SET + STTS = #{status} + , USE_YN = 'N' + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE USER_ID IN (#{userID}) + AND STTS != #{status} + + + \ No newline at end of file diff --git a/src/main/resources/sql/mapper/fims/cmmn/stng-mapper.xml b/src/main/resources/sql/mapper/fims/cmmn/stng-mapper.xml new file mode 100644 index 00000000..7fac6ee8 --- /dev/null +++ b/src/main/resources/sql/mapper/fims/cmmn/stng-mapper.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + +/* 교부 계좌번호 변경 (stngMapper.updateDtbnActno) */ +UPDATE TB_DEPT + SET MDFR = #{mdfr} + , MDFCN_DT = + , DTBN_BANK_NM = #{dtbnBankNm} + , DTBN_ACTNO = #{dtbnActno} + WHERE DEPT_CD = #{deptCd} + + + +/* 사용자 기본 업무 등록 (stngMapper.insertDefaultTask) */ + + + + + + + +INSERT + INTO TB_TASK_MTCHG ( + TASK_MTCHG_ID + , USER_ID + , TASK_SE_CD + , USE_YN + , REG_DT + , RGTR + ) VALUES ( + #{taskMtchgId} + , #{userId} + , #{taskSeCd} + , 'Y' + , + , #{rgtr} + ) + + + +/* 사용자 기본 업무 변경 (stngMapper.updateDefaultTask) */ +UPDATE TB_TASK_MTCHG + SET MDFR = #{mdfr} + , MDFCN_DT = + , TASK_SE_CD = #{taskSeCd} + WHERE TASK_MTCHG_ID = #{taskMtchgId} + + + \ No newline at end of file diff --git a/src/main/resources/sql/mapper/fims/dynamicSearch.xml b/src/main/resources/sql/mapper/fims/dynamicSearch.xml new file mode 100644 index 00000000..84f98a49 --- /dev/null +++ b/src/main/resources/sql/mapper/fims/dynamicSearch.xml @@ -0,0 +1,43 @@ + + + + + + AND GET_CODE_NM(#{subOption}, + AND + AND SUBSTR( + + + + + ) LIKE + CONCAT('%', + '%' || + + + = + + LIKE + CONCAT('%', + '%' || + + + ,1,8) = REPLACE(REPLACE(REPLACE( + + + + + , '%') + || '%' + + + + + , '%') + || '%' + + + ,'-',''),'/',''),'.','') + + + \ No newline at end of file diff --git a/src/main/resources/sql/mapper/fims/mngt/task-mapper.xml b/src/main/resources/sql/mapper/fims/mngt/task-mapper.xml new file mode 100644 index 00000000..a36a532d --- /dev/null +++ b/src/main/resources/sql/mapper/fims/mngt/task-mapper.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + /* 업무 정보 등록(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' + , + , #{currentUser.id} + , + , #{currentUser.id} + ) + + + /* 업무 정보 수정(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 = + , MDFR = #{currentUser.id} + WHERE SGG_CD = #{task.sggCd} + AND TASK_SE_CD = #{task.taskSeCd} + AND USE_YN = 'Y' + + + /* 업무 정보 삭제(taskMapper.deleteTask) */ + UPDATE TB_TASK + SET USE_YN = 'N' + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE SGG_CD = #{task.sggCd} + AND TASK_SE_CD = #{task.taskSeCd} + AND USE_YN = 'Y' + + + diff --git a/src/main/resources/sql/mapper/fims/mngt/vltn-mapper.xml b/src/main/resources/sql/mapper/fims/mngt/vltn-mapper.xml new file mode 100644 index 00000000..8bbe6e50 --- /dev/null +++ b/src/main/resources/sql/mapper/fims/mngt/vltn-mapper.xml @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT V.VLTN_ID + , V.SGG_CD + , V.TASK_SE_CD + , V.VLTN_CD + , V.VLTN_ARTCL + , V.VLTN_LAW_NM + , V.VLTN_LAW1 + , V.VLTN_LAW2 + , 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 + , AS TODAY + , (SELECT GET_CODE_NM('FIM054', V.TASK_SE_CD) FROM DUAL) AS TASK_SE_NM + FROM TB_VLTN V + + + + + + + + /* 위반 정보 등록(vltnMapper.insertVltn) */ + + + + + + + + INSERT + INTO TB_VLTN ( + VLTN_ID + , SGG_CD + , TASK_SE_CD + , VLTN_CD + , VLTN_ARTCL + , VLTN_LAW_NM + , VLTN_LAW1 + , VLTN_LAW2 + , 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} + , #{vltn.sggCd} + , #{vltn.taskSeCd} + , #{vltn.vltnCd} + , #{vltn.vltnArtcl} + , #{vltn.vltnLawNm} + , #{vltn.vltnLaw1} + , #{vltn.vltnLaw2} + , #{vltn.vltnLawEtc} + , #{vltn.acntgSeCd} + , #{vltn.acntgSeNm} + , #{vltn.txitmCd} + , #{vltn.txitmNm} + , #{vltn.operItemCd} + , #{vltn.operItemNm} + , #{vltn.spclBizCd} + , 'Y' + , + , #{vltn.createdBy} + , + , #{vltn.modifiedBy} + ) + + + /* 위반 정보 수정(vltnMapper.updateVltn) */ + UPDATE TB_VLTN + SET VLTN_ARTCL = #{vltn.vltnArtcl} + , VLTN_LAW_NM = #{vltn.vltnLawNm} + , VLTN_LAW1 = #{vltn.vltnLaw1} + , VLTN_LAW2 = #{vltn.vltnLaw2} + , 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 = + , MDFR = #{vltn.modifiedBy} + WHERE VLTN_ID = #{vltn.vltnId} + AND USE_YN = 'Y' + + + /* 위반 정보 삭제(vltnMapper.deleteVltn) */ + UPDATE TB_VLTN + SET USE_YN = 'N' + , MDFCN_DT = + , MDFR = #{vltn.modifiedBy} + WHERE VLTN_ID = #{vltn.vltnId} + AND USE_YN = 'Y' + + + diff --git a/src/main/resources/sql/mapper/fims/numbering.xml b/src/main/resources/sql/mapper/fims/numbering.xml new file mode 100644 index 00000000..ee494cd1 --- /dev/null +++ b/src/main/resources/sql/mapper/fims/numbering.xml @@ -0,0 +1,50 @@ + + + + + +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 + + + +SELECT CONCAT(, LPAD(CAST( + CASE + WHEN (SELECT MAX(SUBSTRING(${TABLE_KEY}, 4+1)) + 1 FROM ${TABLE_NAME} + WHERE ${TABLE_KEY} LIKE CONCAT(, '%')) IS NULL OR + (SELECT MAX(SUBSTRING(${TABLE_KEY}, 4+1)) + 1 FROM ${TABLE_NAME} + WHERE ${TABLE_KEY} LIKE CONCAT(, '%')) = '' + THEN 1 + ELSE (SELECT MAX(SUBSTRING(${TABLE_KEY}, 4+1)) + 1 FROM ${TABLE_NAME} + WHERE ${TABLE_KEY} LIKE CONCAT(, '%')) + END + AS INT), ${pad}-4, '0')) +AS NEW_ID +FROM DUAL + + + +SELECT CONCAT(${sggCd}, , LPAD(CAST( + CASE + WHEN (SELECT MAX(SUBSTRING(${TABLE_KEY}, 9+1)) + 1 FROM ${TABLE_NAME} + WHERE ${TABLE_KEY} LIKE CONCAT(${sggCd}, , '%')) IS NULL OR + (SELECT MAX(SUBSTRING(${TABLE_KEY}, 9+1)) + 1 FROM ${TABLE_NAME} + WHERE ${TABLE_KEY} LIKE CONCAT(${sggCd}, , '%')) = '' + THEN 1 + ELSE (SELECT MAX(SUBSTRING(${TABLE_KEY}, 9+1)) + 1 FROM ${TABLE_NAME} + WHERE ${TABLE_KEY} LIKE CONCAT(${sggCd}, , '%')) + END + AS INT), ${pad}-9, '0')) +AS NEW_ID +FROM DUAL + + + \ No newline at end of file