커밋 테스트

main
이범준 4 months ago
parent 14536865b4
commit b439a3dc4f

@ -12,7 +12,7 @@
<groupId>xit-app</groupId>
<artifactId>fims</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<name>fims</name>
<description>과태료통합관리시스템</description>
<packaging>war</packaging>
@ -73,146 +73,9 @@
</dependencyManagement>
<dependencies>
<dependency>
<groupId>cokr.xit.boot</groupId>
<artifactId>xit-base-starter</artifactId>
<version>23.04.01-SNAPSHOT</version>
</dependency>
<!-- 시스템로그 -->
<dependency>
<groupId>cokr.xit.base</groupId>
<artifactId>xit-syslog</artifactId>
<version>23.04.01-SNAPSHOT</version>
</dependency>
<!-- 암복호화 -->
<dependency>
<groupId>org.egovframe.rte</groupId>
<artifactId>org.egovframe.rte.fdl.crypto</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>cokr.xit.base</groupId>
<artifactId>xit-crypto</artifactId>
<version>23.04.01-SNAPSHOT</version>
</dependency>
<!-- 마리아DB -->
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>runtime</scope>
</dependency>
<!-- 유니코드, 캐릭터셋 탐지 -->
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>75.1</version>
</dependency>
<!-- 자망연계 -->
<dependency>
<groupId>cokr.xit.interfaces</groupId>
<artifactId>xit-lvis</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<!-- 장애인 표지 조회 -->
<dependency>
<groupId>cokr.xit.interfaces</groupId>
<artifactId>xit-disabled-parking</artifactId>
<version>23.04.01-SNAPSHOT</version>
</dependency>
<!-- TODO : 전기차 여부 연계 -->
<!-- <dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
</dependency> -->
<!-- TODO : 미세먼지(mecar) 연계 -->
<!-- <dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
</dependency> -->
<!-- 국민신문고 -->
<dependency>
<groupId>cokr.xit.interfaces</groupId>
<artifactId>xit-smg</artifactId>
<version>23.04.01-SNAPSHOT</version>
</dependency>
<!-- TODO : 새올 민원 연계 -->
<!-- <dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
</dependency> -->
<!-- 차세대세외수입 개별시스템 연계 -->
<dependency>
<groupId>cokr.xit.interfaces.lntris</groupId>
<artifactId>xit-lntris-basic</artifactId>
<version>23.04.01-SNAPSHOT</version>
</dependency>
<!-- 차세대세외수입 특화시스템 연계 -->
<dependency>
<groupId>cokr.xit.interfaces.lntris</groupId>
<artifactId>xit-lntris-special</artifactId>
<version>23.04.01-SNAPSHOT</version>
</dependency>
<!-- epost 연계 -->
<dependency>
<groupId>cokr.xit.interfaces</groupId>
<artifactId>xit-epost</artifactId>
<version>23.04.01-SNAPSHOT</version>
</dependency>
<!-- PDF 라이브러리 -->
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>3.0.2</version>
</dependency>
<!-- FTP 라이브러리 -->
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.10.0</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.5</version>
</dependency>
<!-- 바코드 관련 -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>cokr.xit.app</groupId>
<artifactId>app-support</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cokr.xit.app</groupId>
<artifactId>app-support-res</artifactId>
<artifactId>fims-1</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
@ -231,30 +94,6 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>cokr.xit.app.plugin.maven</groupId>
<artifactId>sgg-maven-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<executions>
<execution>
<id>copy-execute</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<confs>
<conf>/intf-conf/file-job.conf</conf>
<conf>/intf-conf/disabled-parking.conf</conf>
<conf>/intf-conf/gpki.conf</conf>
<conf>/intf-conf/lntris.conf</conf>
<conf>/intf-conf/xit-lvis.properties</conf>
<conf>/template/disabled-parking-request.xml</conf>
</confs>
</configuration>
</plugin>
</plugins>
</build>

@ -1,75 +0,0 @@
package cokr.xit.base;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
@Component
@Order(-10001)
public class ResponseHeaderFilter implements Filter {
public ResponseHeaderFilter() {}
@Override
public void destroy() {}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
chain.doFilter(request, new HttpServletResponseWrapper((HttpServletResponse) response) {
@Override
public void addCookie(Cookie cookie) {
if(cookie.getValue().equals("") && cookie.getMaxAge() == 0) {
cookie.setValue("null");
}
cookie.setHttpOnly(true);
super.addCookie(cookie);
}
@Override
public void setContentType(String type) {
if(type.equals("text/css")
|| type.equals("application/javascript")
|| type.equals("image/svg+xml")
|| type.equals("text/html")) {
type = type+";charset=UTF-8";
}
super.setContentType(type);
}
@Override
public void setHeader(String name, String value) {
if(name.equalsIgnoreCase("X-Xss-Protection")) {
if(super.containsHeader("Content-Type")) {
if(super.getContentType() != null) {
if(super.getContentType().startsWith("application/json")) {
return;
}
}
}
}
super.setHeader(name, value);
return;
}
});
}
}

@ -1,20 +0,0 @@
package cokr.xit.base;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.server.MimeMappings;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ServletCustomizer implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> {
@Override
public void customize(TomcatServletWebServerFactory factory) {
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
mappings.add("woff", "font/woff");
mappings.add("woff2", "font/woff2");
mappings.add("otf", "font/otf");
mappings.add("ico", "image/x-icon");
factory.setMimeMappings(mappings);
}
}

@ -1,9 +1,7 @@
package cokr.xit.fims;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
@ -17,13 +15,6 @@ import cokr.xit.fims.task.TaskMvcConfig;
public class FimsApplication extends XitBaseApplication {
public static void main(String[] args) {
final SpringApplicationBuilder applicationBuilder = new SpringApplicationBuilder(FimsApplication.class);
final SpringApplication application = applicationBuilder.build();
application.setBannerMode(Banner.Mode.OFF);
application.setLogStartupInfo(false);
application.run(args);
SpringApplication.run(FimsApplication.class, args);
}
}

@ -1,37 +0,0 @@
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;
}
}
}

@ -1,14 +0,0 @@
package cokr.xit.fims;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(FimsApplication.class);
}
}

@ -1,13 +0,0 @@
package cokr.xit.fims.base;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class Backup {
String originalTable;
String backupTable;
String pkName;
String[] pks;
}

@ -1,120 +0,0 @@
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;
}

@ -1,31 +0,0 @@
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;
}

@ -1,93 +0,0 @@
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;
}
}

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

@ -1,25 +0,0 @@
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();
}
}

@ -1,30 +0,0 @@
package cokr.xit.fims.base.dao;
import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.base.Backup;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@Mapper("adminMapper")
public interface AdminMapper extends AbstractMapper {
List<DataObject> selectAllList(Map<String, String> map);
int insertOriginalData(Backup backup);
int deleteOriginalData(Backup backup);
int insertBackupData(Backup backup);
int deleteBackupData(Backup backup);
int copyTask(Map<String, Object> param);
List<String> selectVltnList(Map<String, Object> param);
int copyVltn(Map<String, Object> param);
}

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

@ -1,72 +0,0 @@
package cokr.xit.fims.base.service.bean;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.fims.base.Backup;
import cokr.xit.fims.base.dao.AdminMapper;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
@Component("adminBean")
public class AdminBean extends AbstractBean {
@Resource(name = "adminMapper")
private AdminMapper adminMapper;
public List<DataObject> getAllList(String originalTable, String pkName) {
Map<String,String> map = new HashMap<String,String>();
map.put("originalTable", originalTable);
map.put("pkName", pkName);
return adminMapper.selectAllList(map);
}
public List<DataObject> getAllList(String backupTable, String originalTable, String pkName) {
Map<String,String> map = new HashMap<String,String>();
map.put("originalTable", originalTable);
map.put("backupTable", backupTable);
map.put("pkName", pkName);
return adminMapper.selectAllList(map);
}
public boolean activate(Backup backup) {
return adminMapper.insertOriginalData(backup) > 0;
}
public boolean deactivate(Backup backup) {
adminMapper.deleteBackupData(backup);
int result1 = adminMapper.insertBackupData(backup);
int result2 = adminMapper.deleteOriginalData(backup);
return ((result1 != 0) && (result1 == result2));
}
public boolean copySggStng(String taskSeCd, String srcSgg, String trgtSgg) {
Map<String, Object> param = new HashMap<>();
param.put("taskSeCd",taskSeCd);
param.put("srcSgg",srcSgg);
param.put("trgtSgg",trgtSgg);
adminMapper.copyTask(param);
List<String> vltnCds = adminMapper.selectVltnList(param);
if(vltnCds == null || vltnCds.isEmpty()) {
return true;
}
param.put("vltnCds", vltnCds);
int result2 = adminMapper.copyVltn(param);
if(result2 == vltnCds.size()) {
return true;
} else {
return false;
}
}
}

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

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

@ -1,18 +0,0 @@
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")));
}
}

@ -1,277 +0,0 @@
package cokr.xit.fims.base.web;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.code.service.CodeQuery;
import cokr.xit.base.code.service.bean.CodeBean;
import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.base.Backup;
import cokr.xit.fims.base.service.bean.AdminBean;
import cokr.xit.fims.cmmn.DirectoryStructureToJson;
import cokr.xit.fims.cmmn.DirectoryStructureToJson.Node;
import cokr.xit.fims.cmmn.Hangul;
import cokr.xit.fims.crdn.service.ImportService;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.interfaces.smg.service.SmgService;
@Controller
@RequestMapping(name="최고관리자", value="/admin")
public class AdminController extends ApplicationController {
@Resource(name="adminBean")
private AdminBean adminBean;
@Resource(name="codeBean")
private CodeBean codeBean;
@Resource(name="smgService")
private SmgService smgService;
@Resource(name="importService")
private ImportService importService;
@RequestMapping(name="최고관리자 메인",value="/main.do")
public ModelAndView adminMain(HttpServletResponse hres) {
ModelAndView mav = new ModelAndView();
if(!currentUser().getInstitute().equals("ADMIN00")) {
hres.setStatus(HttpStatus.FORBIDDEN.value());
mav.setViewName("jsonView");
mav.addObject("message","메뉴 접근 권한이 없습니다.");
} else {
mav.setViewName("fims/admin-main");
}
return mav;
}
@RequestMapping(name="배치 수동 실행",value="/executeBatch.do")
public ModelAndView executeBatch(String batch) {
ModelAndView mav = new ModelAndView();
switch (batch) {
case "smgReceive" : {
smgService.receivePetitions();
break;
}
case "smgSend" : {
smgService.sendReplies();
break;
}
case "epostSend" : {
break;
}
case "epostReceive" : {
break;
}
default:
}
mav.setViewName("jsonView");
return mav;
}
@RequestMapping(name="업무통보 수동 실행",value="/executeAlert.do")
public ModelAndView executeAlert(String alertName, String interfaceKey) {
ModelAndView mav = new ModelAndView();
switch (alertName) {
case "smgReceive" : {
if(interfaceKey == null || interfaceKey.equals("")) {
throw new RuntimeException("인터페이스키 없음");
}
List<String> interfaceKeys = new ArrayList<String>();
interfaceKeys.add(interfaceKey);
importService.createCrdns(interfaceKeys);
break;
}
case "smgSend" : {
break;
}
case "epostSend" : {
break;
}
case "epostReceive" : {
break;
}
default:
}
mav.setViewName("jsonView");
return mav;
}
@RequestMapping(name="서버 파일 현황 조회",value="/getFileTree.do")
public ModelAndView getFileTree() throws Exception {
ModelAndView mav = new ModelAndView();
mav.setViewName("jsonView");
Node tree = DirectoryStructureToJson.getNode(new File("files"));
mav.addObject("tree", tree);
return mav;
}
@RequestMapping(name="최고관리자 서버 폴더 생성", value="/createDirectory.do")
public ModelAndView createDirectory(@RequestParam(value="directories[]") String... directories) throws Exception {
boolean saved = false;
String path = String.join(File.separator, directories);
File newDir = new File(path);
saved = newDir.mkdir();
ModelAndView mav = new ModelAndView();
mav.setViewName("jsonView");
mav.addObject("saved", saved);
return mav;
}
@RequestMapping(name="최고관리자 서버 파일 추가", value="/importFile.do")
public ModelAndView importFile(MultipartFile newFile, @RequestParam(value="directories[]") String... directories) throws Exception {
boolean saved = false;
String path = String.join(File.separator, directories);
path = path + File.separator + newFile.getOriginalFilename();
File file = new File(path);
newFile.transferTo(file);
saved = file.exists();
ModelAndView mav = new ModelAndView();
mav.setViewName("jsonView");
mav.addObject("saved", saved);
return mav;
}
@RequestMapping(name="최고관리자 서버 파일 내용 보기", value="/getFileText.do")
public ModelAndView getFileText(@RequestParam(value="directories[]") String... directories) throws Exception {
String fileCn = "";
StringBuilder sb = new StringBuilder();
String path = String.join(File.separator, directories);
int inputData = 0;
try {
Hangul hangul = new Hangul(3);
String detect = hangul.encodingDetect(path);
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(path),Charset.forName(detect)));
while ((inputData = br.read()) != -1) {
sb.append((char)inputData) ;
}
fileCn = sb.toString();
br.close();
} catch (Exception e) {
}
ModelAndView mav = new ModelAndView();
mav.setViewName("jsonView");
mav.addObject("fileCn", fileCn);
return mav;
}
@GetMapping(name="시군구 추가/삭제 메인", value="/sggAddDelInfo.do")
public ModelAndView sggAddDelMain() {
ModelAndView mav = new ModelAndView();
mav.setViewName("fims/admin-sggAddDel-info");
mav.addObject("pageName","admin-sggAddDel");
return mav;
}
@GetMapping(name="백업 테이블 및 실사용 테이블 자료 조회", value="/sggBackup/list.do")
public ModelAndView getBackupList(String backupTable, String originalTable, String pkName) {
ModelAndView mav = new ModelAndView("jsonView");
List<DataObject> originalDataList = adminBean.getAllList(originalTable, pkName);
List<DataObject> backupDataList = adminBean.getAllList(backupTable, originalTable, pkName);
mav.addObject("originalDataList", originalDataList);
mav.addObject("backupDataList", backupDataList);
return mav;
}
@PostMapping(name="백업 테이블 자료를 사용 테이블로 복사", value="/sggBackup/activate.do")
public ModelAndView add(Backup backup) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = adminBean.activate(backup);
mav.addObject("saved", saved);
return mav;
}
@PostMapping(name="사용 테이블 자료 삭제 및 백업", value="/sggBackup/deactivate.do")
public ModelAndView del(Backup backup) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = adminBean.deactivate(backup);
mav.addObject("saved", saved);
return mav;
}
@GetMapping(name="시군구 설정 복사 메인", value="/copySggStngInfo.do")
public ModelAndView copySggStngMain() {
ModelAndView mav = new ModelAndView();
CodeQuery cq = new CodeQuery();
cq.setGroupIDs("FIM054");
List<DataObject> taskSeCdList = codeBean.getCodeList(cq);
mav.addObject("taskSeCdList", taskSeCdList);
List<DataObject> sggList = adminBean.getAllList("TB_SGG", "SGG_NM");
mav.addObject("sggList", sggList);
mav.setViewName("fims/admin-copySggStng-info");
mav.addObject("pageName","admin-copySggStng");
return mav;
}
@GetMapping(name="시군구 설정 복사", value="/copySggStng.do")
public ModelAndView copy(String taskSeCd, String srcSgg, String trgtSgg) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = adminBean.copySggStng(taskSeCd, srcSgg, trgtSgg);
mav.addObject("saved", saved);
return mav;
}
}

@ -1,18 +0,0 @@
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().remove("authorityList")));
}
}

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

@ -1,437 +0,0 @@
package cokr.xit.fims.base.web;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.StringWriter;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.commons.io.FilenameUtils;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import cokr.xit.base.file.FileInfo;
import cokr.xit.base.file.FileInfo.Relation;
import cokr.xit.base.file.dao.FileMapper;
import cokr.xit.base.file.service.FileQuery;
import cokr.xit.base.file.service.bean.FileBean;
import cokr.xit.base.file.web.FileInfoFactory;
import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.dao.CrdnInfoMapper;
import cokr.xit.fims.crdn.service.CrdnService;
import cokr.xit.fims.sprt.Sprt;
import cokr.xit.fims.sprt.service.bean.MediaBean;
import cokr.xit.foundation.data.DataObject;
@Controller
public class FileController extends cokr.xit.base.file.web.FileController {
@Resource(name = "fileMapper")
private FileMapper fileMapper;
@Resource(name = "crdnInfoMapper")
private CrdnInfoMapper crdnInfoMapper;
@Resource(name="fileBean")
private FileBean fileBean;
@Resource(name="mediaBean")
private MediaBean mediaBean;
@Resource(name="crdnService")
private CrdnService crdnService;
@Override
public ModelAndView getFileList(FileQuery req) {
ModelAndView mav = new ModelAndView("jsonView");
String infoType = ifEmpty(req.getInfoType(), () -> "");
boolean singleKey = (req.getInfoKeys() != null && req.getInfoKeys().length == 1);
//파일 목록
List<DataObject> fileInfoList = fileService().getFileList(req);
for(DataObject fileInfo : fileInfoList) {
List<DataObject> mosaicInfos = mediaBean.getMosaicList(fileInfo.string("FILE_ID"));
if(mosaicInfos != null) {
String mosaic = "";
for(int i=0; i < mosaicInfos.size(); i++) {
DataObject mosaicInfo = mosaicInfos.get(i);
if(i != 0) {
mosaic += "|";
}
mosaic += mosaicInfo.string("X_AXS")
+ "," + mosaicInfo.string("Y_AXS")
+ "," + mosaicInfo.string("MOSC_LEN")
+ "," + mosaicInfo.string("MOSC_HGT");
}
fileInfo.set("MOSAIC", mosaic);
} else {
fileInfo.set("MOSAIC", "");
}
}
mav = setCollectionInfo(mav, fileInfoList, "file");
//민원 동영상파일 첨부 여부
String cvlcptVideoExistYn = "N";
if(infoType.equals(Crdn.INF_TYPE) && singleKey) {
DataObject dataObject = crdnInfoMapper.selectCrdnInfo(req.getInfoKeys()[0]);
String linkTblNm = dataObject.string("LINK_TBL_NM");
if(!linkTblNm.equals("")) { //민원연계자료
FileQuery cvlcptFileQuery = new FileQuery();
if(linkTblNm.equals("TB_ESB_INTERFACE")) {
cvlcptFileQuery.setInfoType("010");
} else if(linkTblNm.equals("TB_SA_CVLCPT_DTL")) {
cvlcptFileQuery.setInfoType("020");
} else {
throw new RuntimeException("파일 조회 중 오류가 발생하였습니다.");
}
cvlcptFileQuery.setInfoKeys(dataObject.string("LINK_ID"));
List<DataObject> linkFileList = fileBean.getFileList(cvlcptFileQuery);
if(linkFileList != null && !linkFileList.isEmpty()) {
for(int i=0; i < linkFileList.size(); i++) {
String mimeType = linkFileList.get(i).string("MIME_TYPE");
if(Arrays.asList(Sprt.VIDEO_MIME_TYPE).contains(mimeType)) {
cvlcptVideoExistYn = "Y";
}
}
}
}
}
mav.addObject("cvlcptVideoExistYn", cvlcptVideoExistYn);
return mav;
}
@PostMapping(name= "단속 사진 추가", value = "/insertCrdnImageFile.do")
public ModelAndView insertCrdnImageFile(String crdnId, int atchFileCnt, MultipartFile[] newFileList) {
boolean saved = false;
String retMessage = "[F] ";
if(newFileList == null || newFileList.length == 0 || newFileList[0] == null || newFileList[0].isEmpty()) {
throw new RuntimeException("파일 업로드 오류");
}
Relation relation = new Relation().setInfoType(Crdn.INF_TYPE).setInfoKey(crdnId);
List<FileInfo> newFileInfoList = new FileInfoFactory().makeFileInfos(relation, newFileList);
List<Map<String, Object>> processList = new ArrayList<>();
int newFileSort = 999;
for(FileInfo newFileInfo : newFileInfoList) {
newFileInfo.setSortOrder(newFileSort++);
processList.add(Map.of("process", "insert", "obj", newFileInfo));
}
Crdn crdn = new Crdn();
crdn.setCrdnId(crdnId);
crdn.setAtchFileCnt(atchFileCnt);
retMessage = crdnService.changeCrdnImageFile(crdn, processList);
if (retMessage.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("retMessage", retMessage);
}
@PostMapping(name= "단속 사진 수정", value = "/updateCrdnImageFile.do")
public ModelAndView updateCrdnImageFile(String crdnId, int atchFileCnt,
String beforeKey, int beforeOrder, MultipartFile modifyFile) {
boolean saved = false;
String retMessage = "[F] ";
if(modifyFile == null || modifyFile.isEmpty()) {
throw new RuntimeException("파일 업로드 오류");
}
Relation relation = new Relation().setInfoType(Crdn.INF_TYPE).setInfoKey(crdnId);
FileInfo modifyFileInfo = new FileInfoFactory().make(relation, modifyFile);
modifyFileInfo.setSortOrder(beforeOrder);
List<Map<String, Object>> processList = new ArrayList<>();
processList.add(Map.of("process", "delete", "key", beforeKey));
processList.add(Map.of("process", "insert", "obj", modifyFileInfo));
Crdn crdn = new Crdn();
crdn.setCrdnId(crdnId);
crdn.setAtchFileCnt(atchFileCnt);
retMessage = crdnService.changeCrdnImageFile(crdn, processList);
if (retMessage.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("retMessage", retMessage);
}
@PostMapping(name= "단속 사진 삭제", value = "/deleteCrdnImageFile.do")
public ModelAndView deleteCrdnImageFile(String crdnId, int atchFileCnt, String[] deleteKeys) {
boolean saved = false;
String retMessage = "[F] ";
if(deleteKeys == null || deleteKeys.length == 0 || deleteKeys[0] == null || deleteKeys[0].isEmpty()) {
throw new RuntimeException("파일 삭제 오류");
}
List<Map<String, Object>> processList = new ArrayList<>();
for(String deleteKey : deleteKeys) {
processList.add(Map.of("process", "delete", "key", deleteKey));
}
Crdn crdn = new Crdn();
crdn.setCrdnId(crdnId);
crdn.setAtchFileCnt(atchFileCnt);
retMessage = crdnService.changeCrdnImageFile(crdn, processList);
if (retMessage.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("retMessage", retMessage);
}
@PostMapping(name= "단속 사진 순서 변경", value = "/changeOrderCrdnImageFile.do")
public ModelAndView changeOrderCrdnImageFile(String crdnId, int atchFileCnt, String[] orderedKeys) {
boolean saved = false;
String retMessage = "[F] ";
if(orderedKeys == null || orderedKeys.length == 0 || orderedKeys[0] == null || orderedKeys[0].isEmpty()) {
throw new RuntimeException("파일 순서 변경 오류");
}
List<Map<String, Object>> processList = new ArrayList<>();
for(String orderedKey : orderedKeys) {
processList.add(Map.of("process", "order", "key", orderedKey));
}
Crdn crdn = new Crdn();
crdn.setCrdnId(crdnId);
crdn.setAtchFileCnt(atchFileCnt);
retMessage = crdnService.changeCrdnImageFile(crdn, processList);
if (retMessage.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("retMessage", retMessage);
}
/** .
* @return
* @throws Exception
*/
@GetMapping(name = "메뉴얼 다운로드", value = "/downloadMenual.do")
public ModelAndView downloadMenual() throws Exception {
ModelAndView mav = new ModelAndView("downloadView");
String filePath = ("menual/메뉴얼.pptx");
ClassPathResource cps = new ClassPathResource(filePath);
String menualVersion = "";
try (XMLSlideShow slideShow = new XMLSlideShow(cps.getInputStream())) {
menualVersion = slideShow
.getProperties()
.getCoreProperties()
.getUnderlyingProperties()
.getVersionProperty()
.get();
}
InputStream menualIS = cps.getInputStream();
mav.addObject("file", menualIS);
mav.addObject("filename", "과태료통합관리시스템_메뉴얼"+"("+"v"+menualVersion+")"+".pptx");
mav.addObject("contentType", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
mav.addObject("length", menualIS.available());
return mav;
}
@GetMapping(name = "SVG 이미지 파일 색상 변경", value = "/modifySvg/**")
public void modifySvg(HttpServletRequest request, HttpServletResponse response) throws URISyntaxException, IOException, ParserConfigurationException, SAXException {
String requestURI = request.getRequestURI().toString();
String filepath = requestURI.split("modifySvg")[1];
filepath = URLDecoder.decode(filepath, "UTF-8");
filepath = filepath.replaceAll("/", Matcher.quoteReplacement(File.separator));
filepath = "svg" + filepath;
ClassPathResource resource = new ClassPathResource(filepath);
InputStream is = resource.getInputStream();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = factory.newDocumentBuilder();
Document document = documentBuilder.parse(is);
Element root = document.getDocumentElement();
NodeList nodeList = root.getChildNodes();
try {
String modify = request.getParameter("modify");
if(modify == null || modify.equals("")){
} else if(modify.equals("active")){
updateTagFillColor(nodeList, "green");
} else if(modify.equals("alert")){
updateTagFillColor(nodeList, "red");
}
String str4 = DocumentToString(document);
byte[] bytes = str4.getBytes();
response.setHeader(HttpHeaders.ACCEPT_RANGES, "bytes");
response.setHeader(HttpHeaders.CONTENT_TYPE, "image/svg+xml");
response.setHeader(HttpHeaders.CONNECTION, "keep-alive");
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
response.setHeader("Pragma", "no-cache");
response.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache, must-revalidate");
response.setDateHeader(HttpHeaders.EXPIRES, 0);
response.setHeader(HttpHeaders.CONTENT_LENGTH, Integer.toString(bytes.length));
response.setContentType("image/svg+xml");
OutputStream os = response.getOutputStream();
os.write(bytes);
os.flush();
os.close();
} catch (Exception e){
}
}
public static String DocumentToString( Document doc )
{
try
{
StringWriter clsOutput = new StringWriter( );
Transformer clsTrans = TransformerFactory.newInstance( ).newTransformer( );
clsTrans.setOutputProperty( OutputKeys.OMIT_XML_DECLARATION, "no" );
clsTrans.setOutputProperty( OutputKeys.METHOD, "xml" );
clsTrans.setOutputProperty( OutputKeys.INDENT, "yes" );
clsTrans.setOutputProperty( OutputKeys.ENCODING, "UTF-8" );
clsTrans.transform( new DOMSource( doc ), new StreamResult( clsOutput ) );
return clsOutput.toString( );
}
catch( Exception ex )
{
return "";
}
}
private void updateTagFillColor(NodeList nodeList, String newFillColor) {
for (int i = 0; i < nodeList.getLength(); i++) {
Node node = nodeList.item(i);
NamedNodeMap namedNodeMap = node.getAttributes();
if(namedNodeMap != null && namedNodeMap.getLength() > 0){
for (int j = 0; j < namedNodeMap.getLength(); j++) {
Node namedNode = namedNodeMap.item(j);
if (namedNode.getNodeName().equalsIgnoreCase("fill")) {
namedNode.setNodeValue(newFillColor); // Change the color of the fill attribute.
}
}
}
}
}
@PostMapping(name = "처리 전 파일업로드", value = "/uploadBeforeProcess.do")
public ModelAndView uploadBeforeProcess(MultipartFile[] uploadFiles) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
MultipartFile uploadFile = uploadFiles[0];
String orginalFileName = uploadFile.getOriginalFilename();
String extension = FilenameUtils.getExtension(orginalFileName);
SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String currentTime = ymdhmsFormat.format(new Date());
String folderPath = "files/temp/uploadFirst";
File folder = new File(folderPath);
folder.mkdirs();
String filePath = folderPath + "/"+currentTime+"."+extension;
File file = new File(filePath);
try {
uploadFile.transferTo(file);
saved = true;
} catch (IOException e) {
throw new RuntimeException("파일업로드 오류"+e);
}
mav.addObject("saved", saved);
mav.addObject("filePath", filePath);
return mav;
}
}

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

@ -1,224 +0,0 @@
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.beans.factory.annotation.Value;
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.crypto.bean.XitAria;
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 {
@Value("${server.sggCd}")
private String sggCd;
@Value("${server.instCd}")
private String instCd;
@Autowired
private TaskRequestMappingHandlerMapping requestHandlers;
@Autowired
private SseBean sseBean;
@Resource(name="ogdpBean")
private OgdpBean ogdpBean;
@Resource(name="userService")
private UserService userService;
@Resource(name="sigunguDepartmentService")
private SigunguDepartmentService sggDeptService;
@Resource(name="codeService")
private CodeService codeService;
@Resource(name="authorityService")
private AuthorityService authorityService;
@Override
public ModelAndView loginPage() {
ModelAndView mav = new ModelAndView("login");
List<DataObject> sggs = sggDeptService.getSigunguList(new SigunguQuery());
if (sggs.isEmpty()) {
throw new RuntimeException("No sigungu info found.");
}
for(DataObject sgg : sggs) {
int count = ogdpBean.countUser(sgg.string("SGG_CD"));
String userUseYn = count > 0 ? "Y" : "N";
sgg.set("USER_USE_YN", userUseYn);
}
boolean multiple = sggs.size() > 1;
mav.addObject("sggs", toJson(sggs));
mav.addObject("multipleSggs", multiple);
mav.addObject("sggList", sggs);
mav.addObject("sysInstCd", instCd);
mav.addObject("sysSggCd", sggCd);
return mav;
}
@Override
public ModelAndView getURLs(boolean multiple) {
List<DataObject> urls = new RequestHandlerReader().read(requestHandlers);
attachTaskPrefixName(urls);
return new ModelAndView("select-url")
.addObject("multiple", multiple)
.addObject("urls", toJson(urls));
}
@SuppressWarnings("unchecked")
private void attachTaskPrefixName(List<DataObject> list) {
for(DataObject item : list) {
String name = item.string("name");
String url = item.string("url");
if(!name.equals(url)) {
switch (url) {
case "/BPV": item.set("name","전용차로과태료업무 "+name);
case "/PVS": item.set("name","주정차위반과태료업무 "+name);
case "/DPV": item.set("name","장애인주차위반과태료업무 "+name);
case "/ECA": item.set("name","전기차주차위반과태료업무 "+name);
case "/PES": item.set("name","밤샘주차위반과태료업무 "+name);
case "/DVS": item.set("name","미세먼지과태료업무 "+name);
}
}
if(item.get("children") != null) {
attachTaskPrefixName((List<DataObject>) item.get("children"));
}
}
}
@GetMapping(name="회원가입 페이지", value="/signupPage.do")
public ModelAndView signupPage(String sggCd, String cntnSeCd) {
ModelAndView mav = new ModelAndView("fims/user/user01010-main");
mav.addObject("userInfo", "{}");
if(cntnSeCd.equals("01")) {
mav.addObject("cntnSeCd", "01");
mav.addObject("allOgdpList", ogdpBean.selectAllOgdpList());
List<DataObject> ableOgdpList = ogdpBean.selectAbleOgdpList(true, sggCd);
mav.addObject("ableOgdpList", ableOgdpList);
Map<String, List<CommonCode>> commonCodes = codeService.getCodesOf("CMN008");
mav.addObject("CMN008List", commonCodes.get("CMN008"));
} else if(cntnSeCd.equals("02")) {
List<DataObject> sggs = sggDeptService.getSigunguList(new SigunguQuery().setSggIDs(sggCd));
mav.addObject("cntnSeCd", "02");
mav.addObject("sggCd", sggCd);
mav.addObject("institute", sggs.get(0).string("INST_CD"));
mav.addObject("userSeCd", "21");
}
return mav;
}
@RequestMapping(name="회원가입", value="/signup.do")
public ModelAndView signup(FimsUser user) {
ModelAndView mav = new ModelAndView("jsonView");
user.setAccount(user.getAccount().toUpperCase());
boolean saved = userService.create(user);
if(user.getUserSeCd() != null && user.getUserSeCd().equals("21")) {
int affected = authorityService.addUsers("ROLE_RENT", user.getId());
}
mav.addObject("saved",saved);
return mav;
}
@RequestMapping(name="중복 확인", value="/duplicate.do")
public ModelAndView isDuplicate(String account, String sggCd) {
account = account.toUpperCase();
FimsUser user = userService.getUser(account, sggCd);
return new ModelAndView("jsonView")
.addObject("duplicate", user != null);
}
@RequestMapping(name="접속자 IP 확인", value="/ipInfo.do")
public ModelAndView ipInfo(HttpServletRequest hreq) {
XitAria crypto = new XitAria("xit-aria");
String a1 = crypto.encrypt("1234567890123");
String a2 = crypto.decrypt(a1);
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)
.addObject("a1",a1)
.addObject("a2",a2)
;
}
@RequestMapping(name="서버 이벤트 수신 등록", value="/subscribe.do")
public SseEmitter subscribe(HttpServletRequest req) {
return sseBean.start(req.getParameter("sseKey"));
}
}

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

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

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

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

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

@ -1,168 +0,0 @@
package cokr.xit.fims.cmmn;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import cokr.xit.base.code.CommonCode;
import cokr.xit.foundation.data.DataObject;
public class CodeConverter {
Map<String, List<CommonCode>> commonCodes = new HashMap<String, List<CommonCode>>();
List<DataObject> sggList = new ArrayList<DataObject>();
List<DataObject> deptList = new ArrayList<DataObject>();
List<DataObject> vltnList = new ArrayList<DataObject>();
List<DataObject> userList = new ArrayList<DataObject>();
List<DataObject> teamList = new ArrayList<DataObject>();
public CodeConverter(Map<String, List<CommonCode>> commonCodes){
this.commonCodes = commonCodes;
}
/** .
* @param codeGroupName , value
* @return
*/
public String valueToCode(String codeGroupName, String value){
String result = "";
List<CommonCode> commonCodeList = commonCodes.get(codeGroupName);
for(int i = 0; i < commonCodeList.size(); i++) {
if(value.replaceAll(Matcher.quoteReplacement(" "), "").equals(commonCodeList.get(i).getValue().replaceAll(Matcher.quoteReplacement(" "), ""))) {
result = commonCodeList.get(i).getCode();
}
}
return result;
}
/** .
* @param codeGroupName , code
* @return
*/
public String codeToValue(String codeGroupName, String code){
String result = "";
List<CommonCode> commonCodeList = commonCodes.get(codeGroupName);
for(int i = 0; i < commonCodeList.size(); i++) {
if(code.equals(commonCodeList.get(i).getCode())) {
result = commonCodeList.get(i).getValue();
}
}
return result;
}
/** .
* @param dataObject , codeGroupName , codeName , valueName
* @return
*/
public void fillIfEmpty(DataObject dataObject, String codeGroupName, String codeName, String valueName) {
if(!dataObject.string(valueName).equals("") && dataObject.string(codeName).equals("")) {
dataObject.put(codeName, this.valueToCode(codeGroupName, dataObject.string(valueName)));
} else if(dataObject.string(valueName).equals("") && !dataObject.string(codeName).equals("")) {
dataObject.put(valueName, this.codeToValue(codeGroupName, dataObject.string(codeName)));
}
}
/** .
* @param taskSeCd , vltnCd
* @return
*/
public String vltnCdToValue(String taskSeCd, String vltnCd) {
String result = "";
String codeGroup = "";
switch(taskSeCd){
case "PVS" :
codeGroup = "FIM004";
break;
case "BPV" :
codeGroup = "FIM005";
break;
case "DPV" :
codeGroup = "FIM006";
break;
case "ECA" :
codeGroup = "FIM061";
break;
case "PES" :
codeGroup = "FIM064";
break;
default :
throw new RuntimeException("위반코드 변환 오류");
}
List<CommonCode> commonCodeList = commonCodes.get(codeGroup);
for(int i = 0; i < commonCodeList.size(); i++) {
if(vltnCd.equals(commonCodeList.get(i).getCode())) {
result = commonCodeList.get(i).getValue();
}
}
return result;
}
public void putOtherCode(String type, DataObject dataobject){
switch(type) {
case "SGG_CD" :
this.sggList.add(dataobject);
break;
case "DEPT_CD" :
this.deptList.add(dataobject);
break;
case "VLTN_ID" :
this.vltnList.add(dataobject);
break;
case "USER_ID" :
this.userList.add(dataobject);
break;
case "TEAM_ID" :
this.teamList.add(dataobject);
break;
}
}
public String uniqOtherCodeToValue(String type, String uniqId) {
String result = "";
List<DataObject> otherCodeList = null;
switch(type) {
case "SGG_CD" :
otherCodeList = this.sggList;
break;
case "DEPT_CD" :
otherCodeList = this.deptList;
break;
case "VLTN_ID" :
otherCodeList = this.vltnList;
break;
case "USER_ID" :
otherCodeList = this.userList;
break;
case "TEAM_ID" :
otherCodeList = this.teamList;
break;
}
if(otherCodeList == null) {
return result;
}
for(int i = 0; i < otherCodeList.size(); i++) {
if(uniqId.equals(otherCodeList.get(i).string(type))) {
result = otherCodeList.get(i).string("NAME");
}
}
return result;
}
}

@ -1,35 +0,0 @@
package cokr.xit.fims.cmmn;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
/**
*
* @author leebj
*/
@Getter
@Setter
public class CrdnPayerHstry extends AbstractEntity {
/**
* ID
*/
private String chgHstryId;
/**
* ID
*/
private String crdnId;
/**
* ID
*/
private String rtpyrId;
/**
*
*/
private String addrSn;
}

@ -1,48 +0,0 @@
package cokr.xit.fims.cmmn;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2023-08-16 leebj
* ================================
* </pre>
*/
public class CrdnPayerHstryQuery extends CmmnQuery {
private static final long serialVersionUID = 1L;
private String crdnId; // 단속 ID
private String rtpyrId; // 납부자 ID
private String addrSn; // 주소 일련번호
public String getCrdnId() {
return ifEmpty(crdnId, () -> null);
}
public <T extends CrdnPayerHstryQuery> T setCrdnId(String crdnId) {
this.crdnId = crdnId;
return self();
}
public String getRtpyrId() {
return ifEmpty(rtpyrId, () -> null);
}
public <T extends CrdnPayerHstryQuery> T setRtpyrId(String rtpyrId) {
this.rtpyrId = rtpyrId;
return self();
}
public String getAddrSn() {
return ifEmpty(addrSn, () -> null);
}
public <T extends CrdnPayerHstryQuery> T setAddrSn(String addrSn) {
this.rtpyrId = addrSn;
return self();
}
}

@ -1,87 +0,0 @@
package cokr.xit.fims.cmmn;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
/**
*
* <p> : .
*
* <pre>
* ============ ============
* 2023-07-19 JoJH
* ================================
* </pre>
*/
@Getter
@Setter
public class CrdnSttsHstry extends AbstractEntity {
/**
* ID
*/
private String sttsHstryId;
/**
* ID
*/
private String crdnId;
/**
*
*/
private String bfrSttsCd;
/**
*
*/
private String bfrSttsChgDt;
/**
*
*/
private String crdnSttsCd;
/**
* ID
*/
private String taskDtlId;
/**
*
*/
private String etcCn;
/**
*
*/
private String useYn;
/**
*
*/
private String regDt;
/**
*
*/
private String rgtr;
/**
*
*/
private String mdfcnDt;
/**
*
*/
private String mdfr;
/**
* - TB_CRDN()
*/
private String crdnSttsChgDt;
}

@ -1,62 +0,0 @@
package cokr.xit.fims.cmmn;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2023-07-19 JoJH
* ================================
* </pre>
*/
public class CrdnSttsHstryQuery extends CmmnQuery {
private static final long serialVersionUID = 1L;
private String sttsHstryId; // 상태 이력 ID
private String crdnId; // 단속 ID
private String crdnSttsCd; // 단속 상태 코드
private String taskDtlId; // 업무 상세 ID
public String getSttsHstryId() {
return ifEmpty(sttsHstryId, () -> null);
}
public <T extends CrdnSttsHstryQuery> T setSttsHstryId(String sttsHstryId) {
this.sttsHstryId = sttsHstryId;
return self();
}
public String getCrdnId() {
return ifEmpty(crdnId, () -> null);
}
public <T extends CrdnSttsHstryQuery> T setCrdnId(String crdnId) {
this.crdnId = crdnId;
return self();
}
public String getCrdnSttsCd() {
return ifEmpty(crdnSttsCd, () -> null);
}
public <T extends CrdnSttsHstryQuery> T setCrdnSttsCd(String crdnSttsCd) {
this.crdnSttsCd = crdnSttsCd;
return self();
}
public String getTaskDtlId() {
return ifEmpty(taskDtlId, () -> null);
}
public <T extends CrdnSttsHstryQuery> T setTaskDtlId(String taskDtlId) {
this.taskDtlId = taskDtlId;
return self();
}
}

@ -1,65 +0,0 @@
package cokr.xit.fims.cmmn;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class DirectoryStructureToJson {
public static Node getNode(File fileNode) throws IOException{
if(fileNode.isDirectory() || fileNode.getName().equals("files")){
return new Node(fileNode.getName(),"directory", getDirList(fileNode));
}else{
return new Node(fileNode.getName(),"file",null);
}
}
public static List<Node> getDirList(File node) throws IOException{
List<Node> children=new ArrayList<>();
for(File n : node.listFiles()){
children.add(getNode(n));
}
return children;
}
public static class Node {
private String text;
private String type;
private List<Node> children;
public Node() { }
public Node(String text, String type, List<Node> children) {
this.text = text;
this.type = type;
this.children = children;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<Node> getChildren() {
return children;
}
public void setChildren(List<Node> children) {
this.children = children;
}
}
}

@ -1,23 +0,0 @@
package cokr.xit.fims.cmmn;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ExtrArtclStng extends AbstractEntity {
private String sggCd;
private String taskSeCd;
private String tmplatId;
private String extrFormId; //추출항목ID
private String extrArtclNm; //추출항목명
private String extrArtclDscrp; //추출항목설명
private String otptArtclSeq; //출력항목순서
private String leftPstn; //좌측 위치
private String topPstn; //상단 위치
private String widthSz; //영역크기 길이
private String heightSz; //영역크기 높이
}

@ -1,19 +0,0 @@
package cokr.xit.fims.cmmn;
import java.util.List;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ExtrForm extends AbstractEntity {
private String extrBscId;
private String sggCd;
private String taskSeCd;
private String tmplatId;
private String mobilePageTmplt;
private List<ExtrArtclStng> extrArtclStngList;
private String[] extrFormIDs;
}

@ -1,18 +0,0 @@
package cokr.xit.fims.cmmn;
public class ExtrStngQuery extends CmmnQuery {
private static final long serialVersionUID = 1L;
private String tmplatId;
public String getTmplatId() {
return ifEmpty(tmplatId, () -> null);
}
public <T extends ExtrStngQuery> T setTmplatId(String tmplatId) {
this.tmplatId = tmplatId;
return self();
}
}

@ -1,16 +0,0 @@
package cokr.xit.fims.cmmn;
import cokr.xit.applib.PrintOption;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class FimsPrintOption extends PrintOption {
/**
*
*/
private String taskSeCd;
}

@ -1,217 +0,0 @@
package cokr.xit.fims.cmmn;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import org.apache.commons.io.IOUtils;
import com.ibm.icu.text.CharsetDetector;
import com.ibm.icu.text.CharsetMatch;
public class Hangul {
public Hangul(int hangulIsNByte){
this.hangulIsNByte = hangulIsNByte;
}
private int hangulIsNByte;
public int is() {
return this.hangulIsNByte;
}
/**
*
*
* @param str
* @return
*/
public int getByteLength(String str) {
if(str == null) {
return 0;
}
int byteLen = 0;
for(int i=0;i<str.length();i++) {
char ch = str.charAt(i);
if((ch > 127) || (ch < 0)) {
byteLen += this.is();
} else {
byteLen += 1;
}
}
return byteLen;
}
/**
*
*
* @param str
* @param byteLen
* @param ch
* @return
*/
public String lpadByte(String str, int byteLen, String ch) {
String result = str;
int strLen = this.getByteLength(str);
for(int i=0; i < byteLen - strLen ; i++) {
result = ch + result;
}
return result;
}
/**
*
*
* @param str
* @param byteLen
* @param ch
* @return
*/
public String rpadByte(String str, int byteLen, String ch) {
String result = str;
int strLen = this.getByteLength(str);
for(int i=0; i < byteLen - strLen ; i++) {
result += ch;
}
return result;
}
/**
* substring
*
* @param str
* @param beginBytes
* @param endBytes
* @return
*/
public String substringByBytes(String str, int beginBytes, int endBytes) {
if (str == null || str.length() == 0) {
return "";
}
if (beginBytes < 0) {
beginBytes = 0;
}
if (endBytes < 1) {
return "";
}
int len = str.length();
int beginIndex = -1;
int endIndex = 0;
int curBytes = 0;
String ch = null;
for (int i = 0; i < len; i++) {
ch = str.substring(i, i + 1);
curBytes += this.getByteLength(ch);
if (beginIndex == -1 && curBytes >= beginBytes) {
beginIndex = i;
}
if (curBytes > endBytes) {
break;
} else {
endIndex = i + 1;
}
}
return str.substring(beginIndex, endIndex);
}
/**
* substring
*
* @param str
* @param beginBytes
* @return
*/
public String substringByBytes(String str, int beginBytes) {
if (str == null || str.length() == 0) {
return "";
}
if (beginBytes < 0) {
beginBytes = 0;
}
int len = str.length();
int beginIndex = -1;
int curBytes = 0;
String ch = null;
for (int i = 0; i < len; i++) {
ch = str.substring(i, i + 1);
curBytes += this.getByteLength(ch);
if (beginIndex == -1 && curBytes >= beginBytes) {
beginIndex = i;
}
}
return str.substring(beginIndex);
}
/**
*
*
* @param path
* @return
*/
public String encodingDetect(String path) throws IOException {
File f = new File(path);
return encodingDetect(f);
}
public String encodingDetect(File f) throws IOException {
CharsetDetector detector;
CharsetMatch match;
FileInputStream fis = null;
try {
String result = "";
fis = new FileInputStream(f);
byte[] byteData = new byte[(int) f.length()];
fis.read(byteData);
fis.close();
detector = new CharsetDetector();
detector.setText(byteData);
match = detector.detect();
System.out.println("encoding is \"" + match.getName() + "\"");
if(match.getName().equals("UTF-8") || match.getName().equals("EUC-KR")) {
result = match.getName();
} else {
result = "EUC-KR";
}
return result;
}
finally {
IOUtils.closeQuietly(fis);
}
}
}

@ -1,30 +0,0 @@
package cokr.xit.fims.cmmn;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class OtptArtclStng extends AbstractEntity {
private String sggCd;
private String taskSeCd;
private String sndngSeCd;
private String paperSeCd;
private String otptFormId; //출력항목ID
private String otptArtclNm; //출력항목명
private String otptArtclSeq; //출력항목순서
private String leftPstn; //좌측 위치
private String topPstn; //상단 위치
private String widthSz; //영역크기 길이
private String heightSz; //영역크기 높이
private String textSort; //텍스트정렬
private String lineChgYn; //줄바꿈여부
private String fontNm; //글꼴명
private String fontSz; //글자크기
private String fontColr; //글자색
private String fontStyle; //글자스타일
}

@ -1,23 +0,0 @@
package cokr.xit.fims.cmmn;
import java.util.List;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class OtptForm extends AbstractEntity {
private String otptBscId;
private String sggCd;
private String taskSeCd;
private String sndngSeCd;
private String paperSeCd;
private String foldLinePstnSeCd;//접는선 위치 구분코드
private String bcrnImgPath; //배경이미지경로
private String bcrnImgFileNm; //배경이미지파일
private String otptPhotoCnt; //출력사진 수
private List<OtptArtclStng> otptArtclStngList;
private String[] otptFormIDs;
}

@ -1,31 +0,0 @@
package cokr.xit.fims.cmmn;
public class OtptStngQuery extends CmmnQuery {
private static final long serialVersionUID = 1L;
//발송구분코드
private String sndngSeCd;
//출력용지구분코드
private String paperSeCd;
public String getSndngSeCd() {
return ifEmpty(sndngSeCd, () -> null);
}
public <T extends OtptStngQuery> T setSndngSeCd(String sndngSeCd) {
this.sndngSeCd = sndngSeCd;
return self();
}
public String getPaperSeCd() {
return ifEmpty(paperSeCd, () -> null);
}
public <T extends OtptStngQuery> T setPaperSeCd(String paperSeCd) {
this.paperSeCd = paperSeCd;
return self();
}
}

@ -1,21 +0,0 @@
package cokr.xit.fims.cmmn;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class OutsourcingArtclStng extends AbstractEntity {
private String sggCd;
private String taskSeCd;
private String sndngSeCd;
private String outsourcingFormId; //항목ID
private String artclNm; //항목명
private String artclOrdr; //항목순서
private String artclSz; //항목 바이트수
private String paddingDirection; //공백방향
private String formatting; //포매팅
}

@ -1,317 +0,0 @@
package cokr.xit.fims.cmmn;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.egovframe.rte.fdl.string.EgovStringUtil;
import cokr.xit.base.file.ZIP;
import cokr.xit.foundation.Downloadable;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
public class OutsourcingFileMaker {
protected String printKorName;
protected FimsPrintOption printOption;
protected List<DataObject> data;
protected List<DataObject> printStngItems;
protected String resultZipFilePath;
public OutsourcingFileMaker(String printKorName, FimsPrintOption printOption, List<DataObject> printStngItems,
List<DataObject> data){
this.printKorName = printKorName;
this.printOption = printOption;
this.data = data;
this.printStngItems = printStngItems;
}
/**
* .
*/
public List<PredefinedSet> filterUsedArtcls() {
List<String> otptArtclNmList = this.printStngItems.stream().map((item) -> { return item.string("ARTCL_NM"); }).toList();
List<PredefinedSet> result = OutsourcingFileMaker.predifinedSetForOutsourcing().stream()
.filter((item) -> {
return otptArtclNmList.contains(item.getArtclNm());
}).toList();
return result;
}
/**
* .
*/
public List<String> filterDownloadDataNames() {
List<String> result = this.filterUsedArtcls().stream()
.filter((item) -> {
return item.isDownloadData();
})
.map(PredefinedSet::getArtclDscrp).toList();
return result;
}
public Map<String, Object> makeFile() {
Map<String, Object> result = new HashMap<>();
Hangul hangul = new Hangul(2);
SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String currentTime = ymdhmsFormat.format(new Date());
String year = currentTime.substring(0, 4);
String month = currentTime.substring(4, 6);
String day = currentTime.substring(6, 8);
String yyyymmdd = year+month+day;
String outsourcingResultPath = "files"+File.separator+"temp"+File.separator+"outsourcing"
+ File.separator + year + File.separator + month + File.separator + day
+ File.separator + currentTime;
File folder = new File(outsourcingResultPath);
if(!folder.exists()) {
folder.mkdirs();
}
try {
String imagesFolderName = yyyymmdd + printKorName;
String metaFileName = yyyymmdd + printKorName + "(외주파일).txt";
String imagesFolderPath = outsourcingResultPath + File.separator + imagesFolderName;
String metaFilePath = outsourcingResultPath + File.separator + metaFileName;
File imagesFolderPathFile = new File(imagesFolderPath);
if (!imagesFolderPathFile.exists()) {
imagesFolderPathFile.mkdirs();
}
for(int i=0; i < data.size(); i++) {
DataObject dataObject = data.get(i);
CmmnUtil.setOcrInfo(dataObject);
CmmnUtil.setBarcode(dataObject);
String sndngDtlId = dataObject.string("SNDNG_DTL_ID");
int crdnPhotoCnt = dataObject.number("CRDN_PHOTO_CNT").intValue();
for(int j=0; j < crdnPhotoCnt; j++){
String orgnFilePath = dataObject.string("CRDN_PHOTO"+(j+1));
String fileKey = dataObject.string("CRDN_PHOTO"+(j+1)+"KEY");
if(EgovStringUtil.null2void(orgnFilePath).equals("")) {
continue;
}
if(!orgnFilePath.startsWith("files")) {
orgnFilePath = CmmnUtil.copyStaticResource(orgnFilePath, false);
}
File orgnFile = new File(orgnFilePath);
if(!orgnFile.exists() || !orgnFile.canRead()) {
continue;
}
InputStream orgnFileInputStream = new FileInputStream(orgnFile);
String modifiedFileName = "P"+sndngDtlId+CmmnUtil.indexToAlphabet(j, true, true)+"."+"JPG";
String modifiedFilePath = imagesFolderPath + File.separator + modifiedFileName;
File modifiedFile = new File(modifiedFilePath);
if(dataObject.get("MOS"+fileKey) != null) {
CmmnUtil.createMaskedImage(orgnFileInputStream, modifiedFile, CmmnUtil.getDataObjectListFromMap(dataObject,"MOS"+fileKey));
} else {
Files.copy(orgnFileInputStream, modifiedFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
dataObject.set("CRDN_PHOTO"+(j+1), modifiedFilePath);
}
}
File metaFile = new File(metaFilePath);
if (!metaFile.exists()) {
if(!metaFile.createNewFile()) {
throw new RuntimeException("외주파일생성 중 오류가 발생하였습니다.");
};
}
FileWriter fw = new FileWriter(metaFile);
BufferedWriter writer = new BufferedWriter(fw);
for(int i=0; i < data.size(); i++) {
DataObject dataObject = data.get(i);
if(i != 0) {
writer.write("\n");
}
String line = "";
for(DataObject printStngItem : printStngItems){
String artclNm = printStngItem.string("ARTCL_NM");
int byteCnt = printStngItem.number("ARTCL_SZ").intValue();
String artclValue = "";
//조회한 데이터와 관련없는 항목(출력일시 등)
if(artclNm.equals("OTPT_YMD") || artclNm.equals("OTPT_YEAR")
|| artclNm.equals("OTPT_MONTH") || artclNm.equals("OTPT_DAY")) {
switch(artclNm) {
case "OTPT_YMD" :
artclValue = yyyymmdd;
break;
case "OTPT_YEAR" :
artclValue = year;
break;
case "OTPT_MONTH" :
artclValue = month;
break;
case "OTPT_DAY" :
artclValue = day;
break;
}
} else {
artclValue = dataObject.string(artclNm);
}
//포매팅
if(!printStngItem.string("FORMATTING").equals("")) {
String formatting = printStngItem.string("FORMATTING");
switch (formatting) {
case "zip(hypen)": {
artclValue = CmmnUtil.zipCodeFormat(artclValue);
break;
}
case "rgNo(hypen)": {
artclValue = CmmnUtil.rgNoFormat(artclValue);
break;
}
case "amount(comma)": {
artclValue = DataFormat.n_nn0(artclValue);
break;
}
default:
if(formatting.startsWith("date(")) {
String dtlFormatting = formatting.substring(5, formatting.length()-1);
if(dtlFormatting.contains("~") && artclValue.contains("~")) {
String from = CmmnUtil.dateNFormat(artclValue.split("~",-1)[0], dtlFormatting.split("~",-1)[0]);
String to = CmmnUtil.dateNFormat(artclValue.split("~",-1)[1], dtlFormatting.split("~",-1)[1]);
artclValue = from + "~" + to;
} else {
artclValue = CmmnUtil.dateNFormat(artclValue, dtlFormatting);
}
}
}
}
//공백 패딩 방향
if(printStngItem.string("PADDING_DIRECTION").equals("left")) {
line += hangul.lpadByte(artclValue, byteCnt, " ");
} else {
line += hangul.rpadByte(artclValue, byteCnt, " ");
}
}
writer.write(line);
}
writer.close();
String zipFileName = yyyymmdd + printKorName + ".zip";
String zipFilePath = outsourcingResultPath + File.separator + zipFileName;
ZIP zip = new ZIP();
zip.compress(zipFilePath, metaFilePath, imagesFolderPath);
metaFile.delete();
File[] images = imagesFolderPathFile.listFiles();
for(File image : images) {
image.delete();
}
imagesFolderPathFile.delete();
resultZipFilePath = zipFilePath;
result.put("download", this.getDownloadable().setFilename(zipFileName));
result.put("downloadData", data);
result.put("dataNames", this.filterDownloadDataNames());
} catch(FileNotFoundException e) {
throw new RuntimeException("파일을 찾을 수 없습니다.");
} catch (IOException e) {
throw new RuntimeException("외주파일생성 중 오류가 발생하였습니다.");
}
return result;
}
public void write(OutputStream out) {
try {
FileInputStream fis = new FileInputStream(resultZipFilePath);
fis.transferTo(out);
fis.close();
new File(resultZipFilePath).delete();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public Downloadable getDownloadable() {
return new Downloadable()
.setContentType("application/zip")
.setWriter(this::write);
}
public static List<PredefinedSet> predifinedSetForOutsourcing() {
List<PredefinedSet> predefinedSetList = new ArrayList<>();
predefinedSetList.add(new PredefinedSet("SNDNG_DTL_ID", "발송상세아이디").offLog());
predefinedSetList.add(new PredefinedSet("VLTN_LAW_NM", "위반법명"));
predefinedSetList.add(new PredefinedSet("BARCODE", "바코드").offLog());
predefinedSetList.add(new PredefinedSet("CRDN_DT", "단속일시"));
predefinedSetList.add(new PredefinedSet("DUDT_YMD", "납부기한"));
predefinedSetList.add(new PredefinedSet("VHRNO", "차량번호"));
predefinedSetList.add(new PredefinedSet("FFNLG_CARMDL_NM", "과태료차종명"));
predefinedSetList.add(new PredefinedSet("VHCL_NM", "차량명"));
predefinedSetList.add(new PredefinedSet("CRDN_PLC", "단속장소"));
predefinedSetList.add(new PredefinedSet("RTPYR_ADDR", "납부자기본주소"));
predefinedSetList.add(new PredefinedSet("RTPYR_DTL_ADDR", "납부자상세주소"));
predefinedSetList.add(new PredefinedSet("RTPYR_ZIP", "납부자우편번호"));
predefinedSetList.add(new PredefinedSet("RTPYR_NM", "납부자명"));
predefinedSetList.add(new PredefinedSet("OPNN_RANGE", "의견진술기간"));
predefinedSetList.add(new PredefinedSet("CRDN_SE_NM", "단속구분명"));
predefinedSetList.add(new PredefinedSet("ATCH_FILE_CNT", "첨부파일갯수"));
predefinedSetList.add(new PredefinedSet("FFNLG_CRDN_AMT", "과태료단속금액"));
predefinedSetList.add(new PredefinedSet("SUM_AMT", "합계금액"));
predefinedSetList.add(new PredefinedSet("RG_NO", "등기번호"));
predefinedSetList.add(new PredefinedSet("OCR0", "OCR0").offLog());
predefinedSetList.add(new PredefinedSet("OCR0_1", "OCR0_1").offLog());
predefinedSetList.add(new PredefinedSet("OCR0_2", "OCR0_2").offLog());
predefinedSetList.add(new PredefinedSet("OCR_BAND1", "OCR_BAND1").offLog());
predefinedSetList.add(new PredefinedSet("OCR_BAND2", "OCR_BAND2").offLog());
predefinedSetList.add(new PredefinedSet("BANK_NM", "가상계좌은행명"));
predefinedSetList.add(new PredefinedSet("VR_ACTNO", "가상계좌"));
predefinedSetList.add(new PredefinedSet("EPAYNO", "전자납부번호"));
predefinedSetList.add(new PredefinedSet("EMPTY", "공백").offLog());
return predefinedSetList;
}
}

@ -1,20 +0,0 @@
package cokr.xit.fims.cmmn;
import java.util.List;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class OutsourcingForm extends AbstractEntity {
private String outsourcingBscId;
private String sggCd;
private String taskSeCd;
private String sndngSeCd;
private List<OutsourcingArtclStng> zipArtclStngList;
private String[] outsourcingFormIDs;
}

@ -1,19 +0,0 @@
package cokr.xit.fims.cmmn;
public class OutsourcingStngQuery extends CmmnQuery {
private static final long serialVersionUID = 1L;
//발송구분코드
private String sndngSeCd;
public String getSndngSeCd() {
return ifEmpty(sndngSeCd, () -> null);
}
public <T extends OutsourcingStngQuery> T setSndngSeCd(String sndngSeCd) {
this.sndngSeCd = sndngSeCd;
return self();
}
}

@ -1,26 +0,0 @@
package cokr.xit.fims.cmmn;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class PredefinedSet {
public PredefinedSet(String artclNm, String artclDscrp) {
this.artclNm = artclNm;
this.artclDscrp = artclDscrp;
this.downloadData = true;
}
protected String artclNm;
protected String artclDscrp;
protected boolean downloadData; //다운로드 이력 기재 항목 여부
/**
* .
*/
public PredefinedSet offLog() {
this.downloadData = false;
return this;
}
}

@ -1,20 +0,0 @@
package cokr.xit.fims.cmmn;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class Pstn {
public Pstn(float left, float top){
this.left = left;
this.top = top;
}
private float left;
private float top;
public float[] to2Float() {
return new float[] { this.left, this.top };
}
}

@ -1,75 +0,0 @@
package cokr.xit.fims.cmmn;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class PstnAndSize {
public PstnAndSize(float left, float top, float width, float height){
this.left = left;
this.top = top;
this.width = width;
this.height = height;
}
public PstnAndSize(Pstn pstn, Size size){
this.left = pstn.getLeft();
this.top = pstn.getTop();
this.width = size.getWidth();
this.height = size.getHeight();
}
public PstnAndSize(Pstn pstn, float width, float height){
this.left = pstn.getLeft();
this.top = pstn.getTop();
this.width = width;
this.height = height;
}
public PstnAndSize(float left, float top, Size size){
this.left = left;
this.top = top;
this.width = size.getWidth();
this.height = size.getHeight();
}
private float left;
private float top;
private float width;
private float height;
public Pstn getPstn() {
return new Pstn(this.left, this.top);
}
public Size getSize() {
return new Size(this.width, this.height);
}
public float[] to4Float() {
return new float[] { this.left, this.top, this.width, this.height };
}
public PstnAndSize x2Width() {
this.width = this.width * 2.0f;
return this;
}
public PstnAndSize x2Height() {
this.height = this.height * 2.0f;
return this;
}
public PstnAndSize transXY(float transX, float transY) {
this.left = this.left * transX;
this.top = this.top * transY;
this.width = this.width * transX;
this.height = this.height * transY;
return this;
}
public PstnAndSize addPstn(Pstn pstn) {
this.left = this.left + pstn.getLeft();
this.top = this.top + pstn.getTop();
return this;
}
}

@ -1,20 +0,0 @@
package cokr.xit.fims.cmmn;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class Size {
public Size(float width, float height){
this.width = width;
this.height = height;
}
private float width;
private float height;
public float[] to2Float() {
return new float[] { this.width, this.height };
}
}

@ -1,13 +0,0 @@
package cokr.xit.fims.cmmn;
public class UnnamedItems {
protected String[] items;
public void set(int i, String str) {
this.items[i-1] = str;
}
public String[] get() {
return this.items;
}
}

@ -1,98 +0,0 @@
package cokr.xit.fims.cmmn.dao;
import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.cmmn.CrdnPayerHstry;
import cokr.xit.fims.cmmn.CrdnPayerHstryQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
/** DAO
*
* <p> :
*
* <pre>
* ============ ============
* 2023-08-16 leebj
* ================================
* </pre>
*/
@Mapper("crdnPayerHstryMapper")
public interface CrdnPayerHstryMapper extends AbstractMapper {
/** .<br />
* @param req
* @return
*/
List<DataObject> selectCrdnPayerHstryList(CrdnPayerHstryQuery req);
/** .
* @param req
* @return
*/
List<CrdnPayerHstry> selectCrdnPayerHstrys(CrdnPayerHstryQuery req);
/** .
* @param params
* <ul><li>"crdnPayerHstry" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int insertCrdnPayerHstry(Map<String, Object> params);
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean insertCrdnPayerHstry(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstry != null && insertCrdnPayerHstry(params().set("crdnPayerHstry", crdnPayerHstry)) == 1;
}
/** .
* @param params
* <ul><li>"crdnPayerHstry" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int insertCrdnPayerAddrHstry(Map<String, Object> params);
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean insertCrdnPayerAddrHstry(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstry != null && insertCrdnPayerAddrHstry(params().set("crdnPayerAddrHstry", crdnPayerHstry)) == 1;
}
/**(TB_CRDN) ID .
* @param params
* <ul><li>"crdnPayerHstry" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int updateCrdnRtpyrId(Map<String, Object> params);
/**(TB_CRDN) ID .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean updateCrdnPayer(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstry != null && updateCrdnRtpyrId(params().set("crdnPayerHstry", crdnPayerHstry)) == 1;
}
}

@ -1,89 +0,0 @@
package cokr.xit.fims.cmmn.dao;
import java.util.List;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.fims.cmmn.CrdnSttsHstry;
import cokr.xit.fims.cmmn.CrdnSttsHstryQuery;
/** DAO
*
* <p> :
*
* <pre>
* ============ ============
* 2023-07-19 JoJH
* ================================
* </pre>
*/
@Mapper("crdnSttsHstryMapper")
public interface CrdnSttsHstryMapper extends AbstractMapper {
/** .<br />
* @param req
* @return
*/
List<DataObject> selectCrdnSttsHstryList(CrdnSttsHstryQuery req);
/** .
* @param req
* @return
*/
List<DataObject> selectCrdnSttsHstrys(CrdnSttsHstryQuery req);
/** 1 .
* @param crdnId ID
* @return ID
*/
default DataObject selectCrdnSttsHstryInfo(String crdnId, String crdnSttsCd, String useYn) {
CrdnSttsHstryQuery req = new CrdnSttsHstryQuery();
req.setCrdnId(crdnId);
req.setCrdnSttsCd(crdnSttsCd);
req.setUseYn(useYn);
req.setOrderBy("STTS_HSTRY_ID DESC");
List<DataObject> crdnSttsHstrys = selectCrdnSttsHstrys(req);
return !crdnSttsHstrys.isEmpty() ? crdnSttsHstrys.get(0) : null;
}
/** .
* @param params
* <ul><li>"crdnSttsHstry" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int insertCrdnSttsHstry(CrdnSttsHstry crdnSttsHstry);
/** .
* @param params
* <ul><li>"crdnSttsHstry" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int updateCrdnSttsHstry(CrdnSttsHstry crdnSttsHstry);
/** .
* @param params
* <ul><li>"crdnSttsHstry" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int deleteCrdnSttsHstry(CrdnSttsHstry crdnSttsHstry);
/**(TB_CRDN) .
* @param params
* <ul><li>"excl01" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int updateCrdnSttsCd(CrdnSttsHstry crdnSttsHstry);
}

@ -1,39 +0,0 @@
package cokr.xit.fims.cmmn.dao;
import java.util.List;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.cmmn.ExtrArtclStng;
import cokr.xit.fims.cmmn.ExtrForm;
import cokr.xit.fims.cmmn.ExtrStngQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@Mapper("extrStngMapper")
public interface ExtrStngMapper extends AbstractMapper {
/** 릿 .<br />
* @param query
* @return 릿
*/
DataObject selectExtrBscStng(ExtrStngQuery extrStngQuery);
int insertBscStng(ExtrForm extrForm);
int updateBscStng(ExtrForm extrForm);
/** .<br />
* @param query
* @return
*/
List<DataObject> selectExtrArtclStngList(ExtrStngQuery extrStngQuery);
int updateArtclStng(ExtrArtclStng update);
int deleteArtclStng(ExtrForm extrForm);
int insertArtclStng(ExtrArtclStng insert);
}

@ -1,23 +0,0 @@
package cokr.xit.fims.cmmn.dao;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@Mapper("linkMapper")
public interface LinkMapper extends AbstractMapper {
/** .
* @param params
* @return
*/
int insertElectronicNoticeSndngMaster(DataObject params);
/** .
* @param params
* @return
*/
int insertElectronicNoticeSndngDetail(DataObject params);
}

@ -1,40 +0,0 @@
package cokr.xit.fims.cmmn.dao;
import java.util.List;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.cmmn.OtptArtclStng;
import cokr.xit.fims.cmmn.OtptForm;
import cokr.xit.fims.cmmn.OtptStngQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@Mapper("otptStngMapper")
public interface OtptStngMapper extends AbstractMapper {
/** .<br />
* @param query
* @return
*/
DataObject selectOtptBscStng(OtptStngQuery otptStngQuery);
int insertBscStng(OtptForm otptForm);
int updateBscStng(OtptForm otptForm);
/** .<br />
* @param query
* @return
*/
List<DataObject> selectOtptArtclStngList(OtptStngQuery query);
int updateArtclStng(OtptArtclStng update);
int deleteArtclStng(OtptForm otptForm);
int insertArtclStng(OtptArtclStng insert);
}

@ -1,28 +0,0 @@
package cokr.xit.fims.cmmn.dao;
import java.util.List;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.cmmn.OutsourcingArtclStng;
import cokr.xit.fims.cmmn.OutsourcingForm;
import cokr.xit.fims.cmmn.OutsourcingStngQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@Mapper("outsourcingStngMapper")
public interface OutsourcingStngMapper extends AbstractMapper {
/** .<br />
* @param query
* @return
*/
List<DataObject> selectArtclStngList(OutsourcingStngQuery query);
int updateArtclStng(OutsourcingArtclStng update);
int deleteArtclStng(OutsourcingForm outsourcingForm);
int insertArtclStng(OutsourcingArtclStng insert);
}

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

@ -1,164 +0,0 @@
package cokr.xit.fims.cmmn.ftp;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;
public class FTPUtil {
public static boolean fileDown(RemoteSystemInfo rs, String remoteWorkPath, String downloadRoot) {
File f = new File(downloadRoot + remoteWorkPath);
f.mkdirs();
FTPClient client = null;
String thisSystemFileSeperator = File.separator;
String remoteSystemFileSeparator = rs.getOsType().equals("linux") ? "/" : "\\";
if(!thisSystemFileSeperator.equals(remoteSystemFileSeparator)) {
remoteWorkPath = remoteWorkPath.replaceAll(
Matcher.quoteReplacement(thisSystemFileSeperator),
Matcher.quoteReplacement(remoteSystemFileSeparator)
);
}
client = new FTPClient();
client.setControlEncoding("UTF-8");
try {
client.connect(rs.getIp(), Integer.parseInt(rs.getPort()));
} catch (Exception e) {
throw new RuntimeException("접속 오류.");
}
// 접속을 확인.
int resultCode = client.getReplyCode();
if (!FTPReply.isPositiveCompletion(resultCode)) {
throw new RuntimeException("접속 오류 : FTP server refused connection.");
}
try {
client.setSoTimeout(1000);
} catch (Exception e) {
throw new RuntimeException("접속 오류.");
}
boolean loginResult = false;
try {
// 로그인을 한다.
loginResult = client.login(rs.getId(), rs.getPw());
} catch (Exception e) {
throw new RuntimeException("로그인 오류 : Login Error");
}
if (!loginResult) {
throw new RuntimeException("로그인 오류 : Login Error");
}
List<String> remoteFiles = new ArrayList<>();
List<String> remoteDirectories = new ArrayList<>();
// FTP에서 파일 리스트와 디렉토리 정보를 취득한다.
if (!FTPUtil.getFileList(client, remoteSystemFileSeparator, remoteWorkPath, remoteFiles, remoteDirectories)) {
// 리스트 취득 실패시 프로그램을 종료한다.
throw new RuntimeException("파일 조회 오류 발생 : File search Error");
}
for (String remoteDirectory : remoteDirectories) {
System.out.println("디렉토리-"+remoteDirectory);
String newFolderPath = "";
if(thisSystemFileSeperator.equals(remoteSystemFileSeparator)) {
newFolderPath = downloadRoot + remoteDirectory;
} else {
newFolderPath = downloadRoot + remoteDirectory.replaceAll(
Matcher.quoteReplacement(remoteSystemFileSeparator),
Matcher.quoteReplacement(thisSystemFileSeperator)
);
}
File folder = new File(newFolderPath);
folder.mkdirs();
}
for (String remoteFile : remoteFiles) {
System.out.println("파일-"+remoteFile);
String tempFileOutputPath = "";
if(thisSystemFileSeperator.equals(remoteSystemFileSeparator)) {
tempFileOutputPath = downloadRoot + remoteFile;
} else {
tempFileOutputPath = downloadRoot + remoteFile.replaceAll(
Matcher.quoteReplacement(remoteSystemFileSeparator),
Matcher.quoteReplacement(thisSystemFileSeperator)
);
}
try (FileOutputStream fo = new FileOutputStream(tempFileOutputPath)){
//FTPClient의 retrieveFile함수로 보내면 다운로드가 이루어 진다.
if (client.retrieveFile(remoteFile, fo)) {
System.out.println("Download - " + remoteFile);
}
} catch(Exception e) {
throw new RuntimeException("파일 다운로드 오류");
}
}
try {
client.disconnect();
} catch(Exception e) {
throw new RuntimeException("파일 다운로드 오류");
}
return true;
}
// FTP의 파일 리스트와 디렉토리 정보를 취득하는 함수.
public static boolean getFileList(FTPClient client, String fileSeparator, String work, List<String> files, List<String> directories) {
// FTP의 디렉토리 커서를 이동한다.
try {
if (client.changeWorkingDirectory(work)) {
// 해당 디렉토리의 파일 리스트를 취득한다.
for (FTPFile file : client.listFiles()) {
if (!file.isFile()) {
// 디렉토리리면 함수의 재귀적 방식으로 하위 탐색을 시작한다.
if(!getFileList(client, fileSeparator, work + file.getName() + fileSeparator, files, directories)) {
return false;
}
// directories 리스트에 디렉토리 경로를 추가한다.
directories.add(work + file.getName() + fileSeparator);
} else {
// files 리스트에 경로를 추가한다.
files.add(work + file.getName());
}
}
// FTP의 디렉토리 커서를 상위로 이동하는 함수
// client.changeToParentDirectory();
// FTP의 디렉토리 커서를 이동한다.
return client.changeWorkingDirectory(fileSeparator);
}
} catch (IOException e) {
throw new RuntimeException("ftp오류."+e);
}
// 커서 이동에 실패하면 false를 리턴한다.
return false;
}
}

@ -1,15 +0,0 @@
package cokr.xit.fims.cmmn.ftp;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class RemoteSystemInfo {
String ip;
String port;
String id;
String pw;
String osType;
String workPath;
}

@ -1,79 +0,0 @@
package cokr.xit.fims.cmmn.hwp.format;
import java.util.List;
import cokr.xit.applib.Print;
import cokr.xit.applib.hwp.format.HWPFormat;
import cokr.xit.fims.cmmn.FimsPrintOption;
import cokr.xit.fims.mngt.OgdpUtil;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
/**
*
*/
public class CrdnConfirm extends HWPFormat {
public CrdnConfirm(Print print, FimsPrintOption printOption, List<DataObject> dataObjectList) {
super(print, printOption, dataObjectList);
this.maxRunCount = dataObjectList.size();
this.formatFilePath = "template/hwp/crdnConfirm.hwp";
this.print.setFormatKorName("단속확인서");
this.print.setFormatName("crdnConfirm");
}
@Override
public List<String> getDownloadDataNames() {
return List.of("과태료구분","차량번호","단속일시","위반내용","단속장소","단속동","단속조","소유자명","소유자주소");
}
@Override
public void runAsWriter() {
String printRequestYmd = print.getPrintRequestDt().substring(0, 8);
String yyyy = printRequestYmd.substring(0, 4);
String mm = printRequestYmd.substring(4, 6);
String dd = printRequestYmd.substring(6, 8);
String ymd = yyyy+"년 "+mm+"월 "+dd+"일";
String instNm = OgdpUtil.getInstituteLeader((String)print.getPrintRequestUserInfo().getInfo().get("instNm"), false);
DataObject one = data.get(currentRunCount);
DataObject newObj = (DataObject) new DataObject()
.set("과태료", one.string("TASK_SE_NM"))
.set("차량번호", one.string("VHRNO"))
.set("단속일시", DataFormat.yyyy_mm_dd_hh_mm_ss(one.string("CRDN_YMD_TM")))
.set("위반내용", one.string("VLTN_ARTCL"))
.set("단속장소", one.string("CRDN_PLC"))
.set("단속동", one.string("CRDN_STDG_NM"))
.set("단속조", one.string("TEAM_NM"))
.set("소유자", one.string("RTPYR_NM"))
.set("주소", one.string("RTPYR_FULL_ADDR"))
.set("우편번호", one.string("RTPYR_ZIP"))
.set("연월일", ymd)
.set("발신", instNm);
if(!one.string("PHOTO1").equals("")) {
newObj.set("왼쪽위사진", writer.image().add(one.string("PHOTO1")));
}
if(!one.string("PHOTO2").equals("")) {
newObj.set("오른쪽위사진", writer.image().add(one.string("PHOTO2")));
}
if(!one.string("PHOTO3").equals("")) {
newObj.set("왼쪽아래사진", writer.image().add(one.string("PHOTO3")));
}
if(!one.string("PHOTO4").equals("")) {
newObj.set("오른쪽아래사진", writer.image().add(one.string("PHOTO4")));
}
writer.table(0, 0, 13).setValues(List.of(newObj));
}
}

@ -1,96 +0,0 @@
package cokr.xit.fims.cmmn.hwp.format;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.IntStream;
import cokr.xit.applib.Print;
import cokr.xit.applib.hwp.format.HWPFormat;
import cokr.xit.fims.cmmn.FimsPrintOption;
import cokr.xit.fims.mngt.OgdpUtil;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
/**
*
*/
public class CrdnList extends HWPFormat {
public CrdnList(Print print, FimsPrintOption printOption, List<DataObject> dataObjectList) {
super(print, printOption, dataObjectList);
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/crdnList.hwp";
this.print.setFormatKorName("단속내역서");
this.print.setFormatName("crdnList");
}
@Override
public List<String> getDownloadDataNames() {
List<String> list = new ArrayList<>();
list.add("과태료구분");
list.add("시군구명");
list.add("단속일시");
list.add("단속장소");
list.add("차량번호");
list.add("대체차량번호");
list.add("고지번호");
list.add("부과금액");
list.add("가상계좌번호");
list.add("전자납부번호");
list.add("처리상태");
list.add("처리일자");
list.add("납부기한");
list.add("수납일자");
return list;
}
@Override
public void runAsWriter() {
String globalRtpyrNm = data.get(0).string("RTPYR_NM");
String globalRtpyrNo = data.get(0).string("RTPYR_NO");
String globalRtpyrFullAddr = data.get(0).string("RTPYR_FULL_ADDR");
int globalTotalAmount = data.stream().mapToInt(i -> i.number("LEVY_AMT").intValue()).sum();
writer.setValue("출력일시", DataFormat.yyyy_mm_dd_hh_mm_ss(print.getPrintRequestDt()));
writer.setValue("성명", globalRtpyrNm);
if(print.getPrivateInfoYn(printOption)) {
writer.setValue("주민번호", globalRtpyrNo);
} else {
writer.setValue("주민번호", "*************");
}
writer.setValue("주소", globalRtpyrFullAddr);
writer.setValue("총건수", DataFormat.n_nn0(this.data.size()));
writer.setValue("총금액", DataFormat.n_nn0(globalTotalAmount));
String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm");
instNm = OgdpUtil.getLastWord(instNm);
writer.setValue("발신", instNm);
List<DataObject> list = IntStream.rangeClosed(1, this.data.size()).boxed().map(i -> {
DataObject one = data.get(i-1);
return (DataObject) new DataObject()
.set("과태료", one.string("TASK_SE_NM"))
.set("시군구명", one.string("SGG_NM"))
.set("단속일시", DataFormat.yyyy_mm_dd_hh_mm_ss(one.string("CRDN_YMD_TM")))
.set("단속장소", one.string("CRDN_PLC"))
.set("차량번호", one.string("VHRNO"))
.set("대체차량번호", one.string("RPM_SZR_VHRNO"))
.set("고지번호", one.string("GOJI_NO"))
.set("금액", DataFormat.n_nn0(one.string("LEVY_AMT")))
.set("가상계좌번호", one.string("VR_ACTNO"))
.set("전자납부번호", one.string("EPAYNO"))
.set("처리상태", one.string("CRDN_STTS_NM"))
.set("처리일자", DataFormat.yyyy_mm_dd(one.string("CRDN_STTS_CHG_DT").substring(0, 8)))
.set("납부기한", DataFormat.yyyy_mm_dd(one.string("DUDT_YMD")))
.set("수납일자", DataFormat.yyyy_mm_dd(one.string("RCVMT_YMD")));
}).toList();
writer.table(2, 0, 3).setValues(list);
}
}

@ -1,139 +0,0 @@
package cokr.xit.fims.cmmn.hwp.format;
import java.util.ArrayList;
import java.util.List;
import cokr.xit.applib.Print;
import cokr.xit.applib.hwp.format.HWPFormat;
import cokr.xit.base.docs.hwp.HWPWriter;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.FimsPrintOption;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.HWPFile;
public class CvlcptOrgn extends HWPFormat {
private List<DataObject> data2 = null;
public CvlcptOrgn(Print print, FimsPrintOption printOption, List<DataObject> dataObjectList) {
super(print, printOption, dataObjectList);
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/cvlcptOrgnl_text.hwp";
this.print.setFormatKorName("민원원본내역");
this.print.setFormatName("cvlcptOrgnl");
this.data2 = new ArrayList<DataObject>();
if(!dataObjectList.get(0).string("PHOTO0").equals("")) {
int photoCnt = dataObjectList.get(0).number("ORGN_PHOTO_CNT").intValue();
int PHOTO_COUNT_PER_PAGE = 4;
for(int i=0; i < photoCnt; i += PHOTO_COUNT_PER_PAGE) {
DataObject photoObj = new DataObject();
photoObj.set("PHOTO1", dataObjectList.get(0).string("PHOTO"+i));
if(i+1 < photoCnt)
photoObj.set("PHOTO2", dataObjectList.get(0).string("PHOTO"+(i+1)));
if(i+2 < photoCnt)
photoObj.set("PHOTO3", dataObjectList.get(0).string("PHOTO"+(i+2)));
if(i+3 < photoCnt)
photoObj.set("PHOTO4", dataObjectList.get(0).string("PHOTO"+(i+3)));
data2.add(photoObj);
}
}
}
@Override
public List<String> getDownloadDataNames() {
return List.of("접수번호","신청자","접수일자","처리기한","민원목록번호","민원내용");
}
@Override
public HWPFormat makeFile(){
HWPFile hwpFile = HWPWriter.classpath(this.formatFilePath);
this.writer = new HWPWriter(hwpFile);
runAsWriter();
String tempPath = this.print.pathForNewFile();
writer.write(tempPath);
resultFilesPath.add(tempPath);
writer = null;
currentRunCount++;
if(data2 != null && data2.size() > 0) {
formatFilePath = "template/hwp/cvlcptOrgnl_photo.hwp";
maxRunCount = data2.size()+1;
while(currentRunCount != maxRunCount) {
HWPFile hwpFile_i = HWPWriter.classpath(this.formatFilePath);
this.writer = new HWPWriter(hwpFile_i);
runAsWriter();
String tempPath_i = this.print.pathForNewFile();
writer.write(tempPath_i);
resultFilesPath.add(tempPath_i);
writer = null;
currentRunCount++;
}
}
this.merge();
return this;
}
@Override
public void runAsWriter() {
if(this.formatFilePath.equals("template/hwp/cvlcptOrgnl_text.hwp")) {
DataObject one = data.get(0);
writer.setValue("신청자", one.string("CVLCPT_APLCNT_NM"));
writer.setValue("접수일자", DataFormat.yyyy_mm_dd(one.string("CVLCPT_RCPT_YMD")));
String cvlcptRrcsPrnmntDt = one.string("CVLCPT_PRCS_PRNMNT_DT");
if(cvlcptRrcsPrnmntDt.length() > 8) {
cvlcptRrcsPrnmntDt = cvlcptRrcsPrnmntDt.substring(0, 8);
}
writer.setValue("처리기한", DataFormat.yyyy_mm_dd(cvlcptRrcsPrnmntDt));
writer.setValue("접수번호", one.string("CVLCPT_RCPT_NO"));
writer.setValue("목록번호", one.string("CVLCPT_LIST_NO"));
String cvlcptAplyCn = one.string("CVLCPT_APLY_CN");
cvlcptAplyCn = CmmnUtil.escapeHTMLEntity(cvlcptAplyCn);
writer.setValue("민원내용", cvlcptAplyCn);
} else {
DataObject one = data2.get(currentRunCount-1);
DataObject newObj = new DataObject();
if(!one.string("PHOTO1").equals("")) {
newObj.set("왼쪽위사진", writer.image().add(one.string("PHOTO1")));
}
if(!one.string("PHOTO2").equals("")) {
newObj.set("오른쪽위사진", writer.image().add(one.string("PHOTO2")));
}
if(!one.string("PHOTO3").equals("")) {
newObj.set("왼쪽아래사진", writer.image().add(one.string("PHOTO3")));
}
if(!one.string("PHOTO4").equals("")) {
newObj.set("오른쪽아래사진", writer.image().add(one.string("PHOTO4")));
}
writer.table(0, 0, 2).setValues(List.of(newObj));
}
}
}

@ -1,77 +0,0 @@
package cokr.xit.fims.cmmn.hwp.format;
import java.util.ArrayList;
import java.util.List;
import cokr.xit.applib.Print;
import cokr.xit.applib.hwp.format.HWPFormat;
import cokr.xit.fims.cmmn.FimsPrintOption;
import cokr.xit.foundation.data.DataObject;
public class DlbrDecsnList extends HWPFormat {
public DlbrDecsnList(Print print, FimsPrintOption printOption, List<DataObject> dataObjectList) {
super(print, printOption, dataObjectList);
this.maxRunCount = dataObjectList.size();
this.formatFilePath = "template/hwp/opnnDlbrDecsnForm.hwp";
this.print.setFormatKorName("의견제출심의결의서");
this.print.setFormatName("dlbrDecsnList");
}
@Override
public List<String> getDownloadDataNames() {
List<String> list = new ArrayList<>();
list.add("접수번호");
list.add("접수일");
list.add("위반정보");
list.add("진술자명");
list.add("진술자생년월일");
list.add("소유주관계");
list.add("진술자주소");
list.add("진술자연락처");
list.add("차량번호");
list.add("단속일시");
list.add("단속장소");
list.add("의견체출내용");
return list;
}
@Override
public void runAsWriter() {
DataObject one = data.get(currentRunCount);
writer.setValue("접수번호", one.string("RCPT_NO_MASK"));
writer.setValue("접수일", one.string("RCPT_YMD_MASK"));
writer.setValue("위반정보", one.string("TASK_SE_NM"));
writer.setValue("진술자명", one.string("STTR_NM"));
writer.setValue("진술자생년월일", one.string("STTR_BRDT_MASK"));
writer.setValue("진술자연락처", one.string("STTR_CTTPC"));
writer.setValue("소유주관계", one.string("OWNR_REL_NM"));
writer.setValue("진술자주소", one.string("STTR_WHOL_ADDR"));
writer.setValue("차량번호", one.string("VHRNO"));
writer.setValue("단속일시", one.string("CRDN_YMD_TM_MASK"));
writer.setValue("단속장소", one.string("CRDN_PLC"));
writer.setValue("의견제출내용", one.string("OPNN_SBMSN_CN"));
writer.setValue("심의회원직급1", one.string("DLBR_MBR_JBGD1"));
writer.setValue("심의회원명1", one.string("DLBR_MBR_NM1"));
writer.setValue("심의회원직급2", one.string("DLBR_MBR_JBGD2"));
writer.setValue("심의회원명2", one.string("DLBR_MBR_NM2"));
writer.setValue("심의회원직급3", one.string("DLBR_MBR_JBGD3"));
writer.setValue("심의회원명3", one.string("DLBR_MBR_NM3"));
writer.setValue("심의회원직급4", one.string("DLBR_MBR_JBGD4"));
writer.setValue("심의회원명4", one.string("DLBR_MBR_NM4"));
writer.setValue("심의회원직급5", one.string("DLBR_MBR_JBGD5"));
writer.setValue("심의회원명5", one.string("DLBR_MBR_NM5"));
writer.setValue("심의회원직급6", one.string("DLBR_MBR_JBGD6"));
writer.setValue("심의회원명6", one.string("DLBR_MBR_NM6"));
writer.setValue("심의회원직급7", one.string("DLBR_MBR_JBGD7"));
writer.setValue("심의회원명7", one.string("DLBR_MBR_NM7"));
writer.setValue("담당자검토의견", one.string("PIC_RVW_OPNN"));
}
}

@ -1,80 +0,0 @@
package cokr.xit.fims.cmmn.hwp.format;
import java.util.ArrayList;
import java.util.List;
import cokr.xit.applib.Print;
import cokr.xit.applib.hwp.format.HWPFormat;
import cokr.xit.fims.cmmn.FimsPrintOption;
import cokr.xit.fims.mngt.OgdpUtil;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
/**
*
*/
public class RcvmtConfirm extends HWPFormat {
public RcvmtConfirm(Print print, FimsPrintOption printOption, List<DataObject> dataObjectList) {
super(print, printOption, dataObjectList);
this.maxRunCount = dataObjectList.size();
this.formatFilePath = "template/hwp/rcvmtConfirm.hwp";
print.setFormatKorName("납부확인서");
print.setFormatName("rcvmtConfirm");
}
@Override
public List<String> getDownloadDataNames() {
List<String> list = new ArrayList<>();
list.add("위반명");
list.add("위반차량");
list.add("대체차량");
list.add("위반금액");
list.add("단속일자");
list.add("단속장소");
list.add("소유자");
list.add("주민번호");
list.add("소유자주소");
list.add("고지번호");
list.add("수납일자");
list.add("수납금액");
return list;
}
@Override
public void runAsWriter() {
String instNm = OgdpUtil.getInstituteLeader((String) print.getPrintRequestUserInfo().getInfo().get("instNm"), false);
DataObject one = data.get(currentRunCount);
DataObject newObj = (DataObject) new DataObject()
.set("위반명1", one.string("TASK_SE_NM"))
.set("위반명2", one.string("TASK_SE_NM"))
.set("위반차량", one.string("VHRNO"))
.set("대체차량", one.string("RPM_SZR_VHRNO"))
.set("위반금액", DataFormat.n_nn0(one.string("FFNLG_AMT")))
.set("단속일자", DataFormat.yyyy_mm_dd(one.string("CRDN_YMD")))
.set("단속장소", one.string("CRDN_PLC"))
.set("소유자", one.string("RTPYR_NM"))
.set("주민번호", one.string("RTPYR_NO"))
.set("주소", one.string("RTPYR_FULL_ADDR"))
.set("고지번호", one.string("GOJI_NO"))
.set("수납일자", DataFormat.yyyy_mm_dd(one.string("RCVMT_YMD")))
.set("수납금액", DataFormat.n_nn0(one.string("RCVMT_AMT")))
.set("연월일시분초", DataFormat.yyyy_mm_dd_hh_mm_ss(print.getPrintRequestDt()))
.set("확인자", print.getPrintRequestUserInfo().getName())
.set("발신", instNm)
;
writer.table(0, 0, 12).setValues(List.of(newObj));
}
}

@ -1,112 +0,0 @@
package cokr.xit.fims.cmmn.hwp.format;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.stream.IntStream;
import org.egovframe.rte.fdl.string.EgovStringUtil;
import cokr.xit.applib.Print;
import cokr.xit.applib.hwp.OffcsCellFinder;
import cokr.xit.applib.hwp.format.HWPFormat;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.FimsPrintOption;
import cokr.xit.fims.mngt.OgdpUtil;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.bodytext.control.table.Cell;
import kr.dogfoot.hwplib.object.bodytext.paragraph.Paragraph;
/**
*
*/
public class ReportOnClaims extends HWPFormat {
public ReportOnClaims(Print print, FimsPrintOption printOption, List<DataObject> dataObjectList) {
super(print, printOption, dataObjectList);
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/reportOnClaims.hwp";
this.print.setFormatKorName("채권신고서");
this.print.setFormatName("reportOnClaims");
}
@Override
public List<String> getDownloadDataNames() {
List<String> list = new ArrayList<>();
list.add("과세번호");
list.add("법정기일");
list.add("세목");
list.add("세액");
list.add("가산금");
list.add("합계");
return list;
}
@Override
public void runAsWriter() {
Map<String,String> globalVariable = printOption.getGlobalVariable();
String offcsFilePath = EgovStringUtil.null2void(globalVariable.get("offcsFilePath"));
if(!offcsFilePath.equals("")) {
BiConsumer<Paragraph, Rectangle> bc = writer.image().add(offcsFilePath);
Cell cell = OffcsCellFinder.find(writer);
if(cell != null) {
Paragraph para = cell.getParagraphList().getParagraph(0);
int width = (int)cell.getListHeader().getWidth(),
height = (int)cell.getListHeader().getHeight();
bc.accept(para, new Rectangle(1, 1, width, height));
}
}
writer.setValue("주소", globalVariable.get("deptAddr"));
writer.setValue("전화", globalVariable.get("deptTelno"));
writer.setValue("팩스", globalVariable.get("deptFxno"));
writer.setValue("담당자", print.getPrintRequestUserInfo().getName());
writer.setValue("사건번호", EgovStringUtil.null2void(globalVariable.get("caseNo")));
writer.setValue("체납자성명", EgovStringUtil.null2void(globalVariable.get("rtpyrNm")));
writer.setValue("체납자번호", EgovStringUtil.null2void(globalVariable.get("rtpyrNo")));
writer.setValue("체납자주소", EgovStringUtil.null2void(globalVariable.get("rtpyrFullAddr")));
int sumOfList = data.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum();
writer.setValue("채권청구액", DataFormat.n_nn0(sumOfList));
writer.setValue("합계금액", DataFormat.n_nn0(sumOfList));
writer.setValue("합계금액한글", CmmnUtil.convertNumberToHangul(sumOfList));
String printRequestYmd = print.getPrintRequestDt().substring(0, 8);
String yyyy = printRequestYmd.substring(0, 4);
String mm = printRequestYmd.substring(4, 6);
String dd = printRequestYmd.substring(6, 8);
String ymd = yyyy+"년 "+mm+"월 "+dd+"일";
writer.setValue("연월일", ymd);
String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm");
instNm = OgdpUtil.getLastWord(instNm);
instNm = OgdpUtil.getInstituteLeader(instNm, false);
writer.setValue("발신", instNm);
List<DataObject> list = IntStream.rangeClosed(1, this.data.size()).boxed().map(i -> {
DataObject one = data.get(i-1);
DataObject newObj = (DataObject) new DataObject()
.set("년도", one.string("FYR"))
.set("과세번호", one.string("GOJI_NO"))
.set("법정기일", DataFormat.yyyy_mm_dd(one.string("DUDT_YMD")))
.set("세목", one.string("TXITM_NM"))
.set("세액", DataFormat.n_nn0(one.string("LEVY_PCPTAX")))
.set("가산금", DataFormat.n_nn0(one.string("LEVY_ADAMT")))
.set("합계", DataFormat.n_nn0(one.string("SUM_AMT")));
return newObj;
}).toList();
writer.table(0, 9, 2).setValues(list);
}
}

@ -1,115 +0,0 @@
package cokr.xit.fims.cmmn.hwp.format;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.stream.IntStream;
import org.egovframe.rte.fdl.string.EgovStringUtil;
import cokr.xit.applib.Print;
import cokr.xit.applib.hwp.OffcsCellFinder;
import cokr.xit.applib.hwp.format.HWPFormat;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.FimsPrintOption;
import cokr.xit.fims.mngt.OgdpUtil;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.bodytext.control.table.Cell;
import kr.dogfoot.hwplib.object.bodytext.paragraph.Paragraph;
/**
*
*/
public class RequestForDelivery extends HWPFormat {
public RequestForDelivery(Print print, FimsPrintOption printOption, List<DataObject> dataObjectList) {
super(print, printOption, dataObjectList);
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/requestForDelivery.hwp";
this.print.setFormatKorName("교부청구서");
this.print.setFormatName("requestForDelivery");
}
@Override
public List<String> getDownloadDataNames() {
List<String> list = new ArrayList<>();
list.add("징수과목");
list.add("고지번호");
list.add("과태료계");
list.add("법정기일");
return list;
}
@Override
public void runAsWriter() {
Map<String,String> globalVariable = printOption.getGlobalVariable();
String offcsFilePath = EgovStringUtil.null2void(globalVariable.get("offcsFilePath"));
if(!offcsFilePath.equals("")) {
BiConsumer<Paragraph, Rectangle> bc = writer.image().add(offcsFilePath);
Cell cell = OffcsCellFinder.find(writer);
if(cell != null) {
Paragraph para = cell.getParagraphList().getParagraph(0);
int width = (int)cell.getListHeader().getWidth(),
height = (int)cell.getListHeader().getHeight();
bc.accept(para, new Rectangle(1, 1, width, height));
}
}
writer.setValue("문서번호", EgovStringUtil.null2void(globalVariable.get("docNo")));
writer.setValue("사건번호", EgovStringUtil.null2void(globalVariable.get("caseNo")));
writer.setValue("수신", EgovStringUtil.null2void(globalVariable.get("receiver")));
writer.setValue("체납자성명", EgovStringUtil.null2void(globalVariable.get("rtpyrNm")));
writer.setValue("체납자번호", EgovStringUtil.null2void(globalVariable.get("rtpyrNo")));
writer.setValue("차량번호", EgovStringUtil.null2void(globalVariable.get("vhrno")));
writer.setValue("주소", EgovStringUtil.null2void(globalVariable.get("rtpyrFullAddr")));
int sumOfList = data.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum();
writer.setValue("합계금액", DataFormat.n_nn0(sumOfList));
writer.setValue("교부청구금액", DataFormat.n_nn0(sumOfList));
writer.setValue("교부청구금액한글", CmmnUtil.convertNumberToHangul(sumOfList));
writer.setValue("개설은행", EgovStringUtil.null2void(globalVariable.get("dtbnBankNm")));
writer.setValue("계좌번호", EgovStringUtil.null2void(globalVariable.get("dtbnActno")));
String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm");
String deptNm = (String) print.getPrintRequestUserInfo().getInfo().get("deptNm");
writer.setValue("예금주", instNm + " " + deptNm);
String printRequestYmd = print.getPrintRequestDt().substring(0, 8);
String yyyy = printRequestYmd.substring(0, 4);
String mm = printRequestYmd.substring(4, 6);
String dd = printRequestYmd.substring(6, 8);
String ymd = yyyy+"년 "+mm+"월 "+dd+"일";
writer.setValue("연월일", ymd);
instNm = OgdpUtil.getLastWord(instNm);
instNm = OgdpUtil.getInstituteLeader(instNm, false);
writer.setValue("발신", instNm);
List<DataObject> list = IntStream.rangeClosed(1, this.data.size()).boxed().map(i -> {
DataObject one = data.get(i-1);
DataObject newObj = (DataObject) new DataObject()
.set("징수과목", one.string("TXITM_NM"))
.set("고지번호", one.string("GOJI_NO"))
.set("과태료계", DataFormat.n_nn0(one.string("SUM_AMT")))
.set("법정기일", DataFormat.yyyy_mm_dd(one.string("DUDT_YMD")))
;
return newObj;
}).toList();
writer.table(0, 9, 1).setValues(list);
}
}

@ -1,85 +0,0 @@
package cokr.xit.fims.cmmn.hwp.format;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.stream.IntStream;
import org.egovframe.rte.fdl.string.EgovStringUtil;
import cokr.xit.applib.Print;
import cokr.xit.applib.hwp.OffcsCellFinder;
import cokr.xit.applib.hwp.format.HWPFormat;
import cokr.xit.fims.cmmn.FimsPrintOption;
import cokr.xit.foundation.data.DataObject;
import kr.dogfoot.hwplib.object.bodytext.control.table.Cell;
import kr.dogfoot.hwplib.object.bodytext.paragraph.Paragraph;
public class SvbtcList extends HWPFormat {
public SvbtcList(Print print, FimsPrintOption printOption, List<DataObject> dataObjectList) {
super(print, printOption, dataObjectList);
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/svbtcList.hwp";
this.print.setFormatKorName("공시송달");
this.print.setFormatName("svbtc");
}
@Override
public List<String> getDownloadDataNames() {
List<String> list = new ArrayList<>();
list.add("수령인명");
list.add("수령인주소");
list.add("차량번호");
list.add("위반일자");
list.add("위반장소");
list.add("반송일자");
list.add("반송사유");
return list;
}
@Override
public void runAsWriter() {
String offcsFilePath = EgovStringUtil.null2void(data.get(0).string("OFFCS_FILE_PATH"));
if(!offcsFilePath.equals("")) {
BiConsumer<Paragraph, Rectangle> bc = writer.image().add(offcsFilePath);
Cell cell = OffcsCellFinder.find(writer);
if(cell != null) {
Paragraph para = cell.getParagraphList().getParagraph(0);
int width = (int)cell.getListHeader().getWidth(),
height = (int)cell.getListHeader().getHeight();
bc.accept(para, new Rectangle(1, 1, width, height));
}
}
writer.setValue("문서번호", data.get(0).string("INPUT_DOC_NO"));
writer.setValue("제목", data.get(0).string("INPUT_TTL_NM"));
writer.setValue("공고기간", data.get(0).string("INPUT_SVBTC_DATE"));
writer.setValue("기관장", data.get(0).string("INST_LEADER"));
writer.setValue("부서명", data.get(0).string("SGG_DEPT_NM"));
writer.setValue("부서전화번호", "☎" + data.get(0).string("DEPT_TELNO"));
List<DataObject> list = IntStream.rangeClosed(1, this.data.size()).boxed().map(i -> {
DataObject one = data.get(i-1);
return (DataObject) new DataObject()
.set("성명", one.string("RCPN_NM_MASK"))
.set("주소", one.string("WHOL_ADDR_MASK"))
.set("차량번호", one.string("VHRNO_MASK"))
.set("위반장소", one.string("CRDN_PLC"))
.set("위반일자", one.string("CRDN_DT"))
.set("반송일자", one.string("DLVR_YMD_MASK"))
.set("반송사유", one.string("UNDLVR_RSN_NM"))
;
}).toList();
writer.table(2, 2, 2).setValues(list);
}
}

@ -1,113 +0,0 @@
package cokr.xit.fims.cmmn.pdf.extraction;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import javax.imageio.ImageIO;
import org.apache.pdfbox.contentstream.PDFStreamEngine;
import org.apache.pdfbox.contentstream.operator.DrawObject;
import org.apache.pdfbox.contentstream.operator.Operator;
import org.apache.pdfbox.contentstream.operator.OperatorName;
import org.apache.pdfbox.contentstream.operator.state.Concatenate;
import org.apache.pdfbox.contentstream.operator.state.Restore;
import org.apache.pdfbox.contentstream.operator.state.Save;
import org.apache.pdfbox.contentstream.operator.state.SetGraphicsStateParameters;
import org.apache.pdfbox.contentstream.operator.state.SetMatrix;
import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.pdmodel.graphics.PDXObject;
import org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject;
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
import org.apache.pdfbox.util.Matrix;
public class ExtractImageEngine extends PDFStreamEngine {
private List<String> base64List = new ArrayList<String>();
public List<String> getBase64List() {
return base64List;
}
public void clearBase64List() {
this.base64List = new ArrayList<String>();
}
/**
* Default constructor.
*
* @throws IOException If there is an error loading text stripper properties.
*/
public ExtractImageEngine() throws IOException {
addOperator(new Concatenate(this));
addOperator(new DrawObject(this));
addOperator(new SetGraphicsStateParameters(this));
addOperator(new Save(this));
addOperator(new Restore(this));
addOperator(new SetMatrix(this));
}
/**
* This is used to handle an operation.
*
* @param operator The operation to perform.
* @param operands The list of arguments.
*
* @throws IOException If there is an error processing the operation.
*/
@Override
protected void processOperator( Operator operator, List<COSBase> operands) throws IOException {
String operation = operator.getName();
if (OperatorName.DRAW_OBJECT.equals(operation)) {
COSName objectName = (COSName) operands.get( 0 );
PDXObject xobject = getResources().getXObject( objectName );
if( xobject instanceof PDImageXObject) {
PDImageXObject image = (PDImageXObject)xobject;
int imageWidth = image.getWidth();
int imageHeight = image.getHeight();
System.out.println("*******************************************************************");
System.out.println("Found image [" + objectName.getName() + "]");
Matrix ctmNew = getGraphicsState().getCurrentTransformationMatrix();
float imageXScale = ctmNew.getScalingFactorX();
float imageYScale = ctmNew.getScalingFactorY();
// position in user space units. 1 unit = 1/72 inch at 72 dpi
System.out.println("position in PDF = " + ctmNew.getTranslateX() + ", " + ctmNew.getTranslateY() + " in user space units");
// raw size in pixels
System.out.println("raw image size = " + imageWidth + ", " + imageHeight + " in pixels");
// displayed size in user space units
System.out.println("displayed size = " + imageXScale + ", " + imageYScale + " in user space units");
// displayed size in inches at 72 dpi rendering
imageXScale /= 72;
imageYScale /= 72;
System.out.println("displayed size = " + imageXScale + ", " + imageYScale + " in inches at 72 dpi rendering");
// displayed size in millimeters at 72 dpi rendering
imageXScale *= 25.4f;
imageYScale *= 25.4f;
System.out.println("displayed size = " + imageXScale + ", " + imageYScale + " in millimeters at 72 dpi rendering");
if(imageXScale > 30 && imageYScale > 30 && imageXScale < 120 && imageYScale < 120) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BufferedImage buffImage = image.getImage();
ImageIO.write(buffImage, "png", baos);
byte[] bytesimage = baos.toByteArray();
String imageStr = Base64.getEncoder().encodeToString(bytesimage);
base64List.add(imageStr);
}
System.out.println();
} else if(xobject instanceof PDFormXObject) {
PDFormXObject form = (PDFormXObject)xobject;
showForm(form);
}
} else {
super.processOperator( operator, operands);
}
}
}

@ -1,72 +0,0 @@
package cokr.xit.fims.cmmn.pdf.extraction;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.util.regex.Pattern;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.text.PDFTextStripper;
import org.apache.pdfbox.text.PDFTextStripperByArea;
public class ExtractText {
public static final String REGEXP_PATTERN_NUMBER = "^[\\d]*$";
public static String getExtractByStng(PDDocument document, int pageNum,
float x, float y, float w, float h) {
try {
PDFTextStripperByArea textStripper = new PDFTextStripperByArea();
Rectangle2D rect = new java.awt.geom.Rectangle2D.Float(x, y, w, h);
textStripper.addRegion("region", rect);
PDPage docPage = document.getPage(pageNum-1);
textStripper.extractRegions(docPage);
String textForRegion = textStripper.getTextForRegion("region");
System.out.println("영역지정으로 추출된 텍스트");
System.out.println(textForRegion);
return textForRegion;
} catch (IOException e) {
throw new RuntimeException("자료추출 오류."+e);
}
}
public static String getExtractEpayNo(PDDocument pdDocument, int pageNum) {
String epayNo = "";
PDFTextStripper Tstripper = new PDFTextStripper();
Tstripper.setStartPage(pageNum);
Tstripper.setEndPage(pageNum);
String summaryText = null;
try {
summaryText = Tstripper.getText(pdDocument);
} catch (IOException e) {
throw new RuntimeException("자료추출 오류."+e);
}
String[] textArr = summaryText.split("\r?\n|\r");
for(int i=0; i < textArr.length; i++) {
boolean isNumber = Pattern.matches(REGEXP_PATTERN_NUMBER, textArr[i]);
if(isNumber) {
if(textArr[i].length() == 19) {
epayNo = textArr[i];
}
}
}
return epayNo;
}
}

@ -1,29 +0,0 @@
package cokr.xit.fims.cmmn.pdf.extraction;
import java.util.List;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class Extraction {
/**
*
*/
int page;
/**
* base64
*/
List<String> base64List;
/**
*
*/
Map<String, String> textItem;
}

@ -1,84 +0,0 @@
package cokr.xit.fims.cmmn.pdf.extraction;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.pdfbox.Loader;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageTree;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.foundation.data.DataObject;
public class PDFExtractionUtil {
public static List<Extraction> extract(String pdfPath, List<DataObject> extractStngs) {
List<Extraction> extractList = new ArrayList<Extraction>();
File file = null;
try {
file = new File(pdfPath);
} catch (Exception e2) {
throw new RuntimeException("자료추출 오류."+e2);
}
PDDocument pdDocument = null;
try {
pdDocument = Loader.loadPDF(file);
} catch (IOException e) {
throw new RuntimeException("자료추출 오류."+e);
}
PDPageTree pages = pdDocument.getPages();
int pageCount = pages.getCount();
int pageIndex = 0;
Extraction extraction = new Extraction();
for(;pageIndex < pageCount; pageIndex++) {
Map<String,String> textItem = new HashMap<String,String>();
extraction = new Extraction();
extraction.setPage(pageIndex+1);
for(DataObject extractStng : extractStngs) {
float x = CmmnUtil.mmToPt(extractStng.number("LEFT_PSTN").floatValue());
float y = CmmnUtil.mmToPt(extractStng.number("TOP_PSTN").floatValue());
float w = CmmnUtil.mmToPt(extractStng.number("WIDTH_SZ").floatValue());
float h = CmmnUtil.mmToPt(extractStng.number("HEIGHT_SZ").floatValue());
String text0 = ExtractText.getExtractByStng(pdDocument, pageIndex+1, x, y, w, h);
textItem.put(extractStng.string("EXTR_ARTCL_NM"), text0);
}
extraction.setTextItem(textItem);
PDPage page = pages.get(pageIndex);
List<String> b64imageList = new ArrayList<>();
try {
ExtractImageEngine printer = new ExtractImageEngine();
printer.processPage(page);
b64imageList = printer.getBase64List();
printer.clearBase64List();
} catch (IOException e1) {
throw new RuntimeException("자료추출 오류."+e1);
}
extraction.setBase64List(b64imageList);
extractList.add(extraction);
}
return extractList;
}
}

@ -1,24 +0,0 @@
package cokr.xit.fims.cmmn.pdf.extraction.format;
import java.util.ArrayList;
import cokr.xit.fims.cmmn.PredefinedSet;
/**
*
*/
public class ElectronicNotice extends PDFExtractFormat {
public ElectronicNotice(){
this.predefinedSetList = new ArrayList<PredefinedSet>();
predefinedSetList.add(new PredefinedSet("photoArea","사진영역"));
predefinedSetList.add(new PredefinedSet("vhcleNo","차량번호"));
predefinedSetList.add(new PredefinedSet("ihidnum","주민번호"));
predefinedSetList.add(new PredefinedSet("moblphonNo","휴대폰번호"));
predefinedSetList.add(new PredefinedSet("nm","성명"));
predefinedSetList.add(new PredefinedSet("adres","주소"));
predefinedSetList.add(new PredefinedSet("detailAdres","상세주소"));
predefinedSetList.add(new PredefinedSet("zip","우편번호"));
}
}

@ -1,37 +0,0 @@
package cokr.xit.fims.cmmn.pdf.extraction.format;
import java.util.ArrayList;
import java.util.List;
import cokr.xit.fims.cmmn.PredefinedSet;
import cokr.xit.foundation.data.DataObject;
public abstract class PDFExtractFormat {
protected List<PredefinedSet> predefinedSetList = new ArrayList<PredefinedSet>();
public void appendPredefinedYn(List<DataObject> extrArtclStngList) {
if(extrArtclStngList!=null && !extrArtclStngList.isEmpty()) {
List<PredefinedSet> prototypeStngs = this.getPredefinedSetList();
for(DataObject extrArtclStng : extrArtclStngList) {
String extrArtclNm = (String) extrArtclStng.get("EXTR_ARTCL_NM");
List<PredefinedSet> prototypeStng = prototypeStngs.stream().filter(item -> item.getArtclNm().equals(extrArtclNm)).toList();
if(prototypeStng != null && !prototypeStng.isEmpty()) {
extrArtclStng.set("PREDEFINED_YN", "Y");
} else {
extrArtclStng.set("PREDEFINED_YN", "N");
}
}
}
}
public List<PredefinedSet> getPredefinedSetList(){
return this.predefinedSetList;
}
}

@ -1,142 +0,0 @@
package cokr.xit.fims.cmmn.pdf.print;
import cokr.xit.fims.cmmn.PredefinedSet;
import cokr.xit.fims.cmmn.Pstn;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class DefaultOtptArtclStng extends PredefinedSet {
/**
*
*/
public DefaultOtptArtclStng(String componentType, String artclNm, String artclDscrp, String otptBscVl){
super(artclNm, artclDscrp);
this.componentType = componentType;
this.otptBscVl=otptBscVl;
this.widthSz=0;
this.heightSz=0;
this.fontNm="gulimche";
this.fontSz=10;
this.fontColr="BLACK";
this.fontStyle="FILL";
this.textSort = "left";
this.lineChgYn = "N";
this.forPost = false;
this.unique = false;
}
/**
* A4 . 1 1 .
*/
public DefaultOtptArtclStng a4(float leftPstn, float topPstn) {
this.a4 = new Pstn(leftPstn, topPstn);
this.unique = true;
return this;
}
/**
* . 1 1 .
*/
public DefaultOtptArtclStng letter(float leftPstn, float topPstn) {
this.letter = new Pstn(leftPstn, topPstn);
this.unique = true;
return this;
}
/**
* .
*/
public DefaultOtptArtclStng post() {
this.forPost = true;
return this;
}
@Override
public DefaultOtptArtclStng offLog() {
this.downloadData = false;
return this;
}
/**
* .
*/
public DefaultOtptArtclStng align(String alignValue) {
this.textSort = alignValue;
return this;
}
/**
* .
*/
public DefaultOtptArtclStng size(float width, float height) {
this.widthSz = width;
this.heightSz = height;
return this;
}
/**
* .
*/
public DefaultOtptArtclStng font(String fontNm, int fontSz, String fontColr, String fontStyle) {
this.fontNm = fontNm;
this.fontSz = fontSz;
this.fontColr = fontColr;
this.fontStyle = fontStyle;
return this;
}
/**
* x .
*/
public float getLeftPstn(String paper) {
switch (paper) {
case "01": {
return this.getA4().getLeft();
}
case "02": {
return this.getLetter().getLeft();
}
}
return 0;
}
/**
* y .
*/
public float getTopPstn(String paper) {
switch (paper) {
case "01": {
return this.getA4().getTop();
}
case "02": {
return this.getLetter().getTop();
}
}
return 0;
}
private String componentType; //컴포넌트 유형(텍스트 또는 이미지)
private String otptBscVl; //기본값
private boolean unique; //출력물 내 유일 요소 여부
private boolean forPost; //우편물 관련 요소 여부
private Pstn a4; //A4 위치값
private Pstn letter; //레터 위치값
private float widthSz; //영역크기 길이
private float heightSz; //영역크기 높이
private String textSort; //텍스트정렬
private String lineChgYn;
private String fontNm; //글꼴명
private int fontSz; //글자크기
private String fontColr; //글자색
private String fontStyle; //글자스타일
}

@ -1,16 +0,0 @@
package cokr.xit.fims.cmmn.pdf.print;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import cokr.xit.foundation.component.AbstractBean;
public abstract class PDF extends AbstractBean {
/**pdf 파일(*.pdf)의 mime type */
public static final String MIME_TYPE = "application/pdf";
protected PDDocument doc;
protected PDPageContentStream contentStream;
protected PDRectangle paperSize;
}

@ -1,46 +0,0 @@
package cokr.xit.fims.cmmn.pdf.print;
import java.lang.reflect.Field;
import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
import org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB;
public class PDFColors {
public static final PDColor RED = new PDColor(new float[] { 1, 0, 0 }, PDDeviceRGB.INSTANCE);
public static final PDColor GREEN = new PDColor(new float[] { 0, 1, 0 }, PDDeviceRGB.INSTANCE);
public static final PDColor BLUE = new PDColor(new float[] { 0, 0, 1 }, PDDeviceRGB.INSTANCE);
public static final PDColor YELLOW = new PDColor(new float[] { 1, 1, 0 }, PDDeviceRGB.INSTANCE);
public static final PDColor ORANGE = new PDColor(new float[] { 1, 0.502f, 0 }, PDDeviceRGB.INSTANCE);
public static final PDColor YELLOW_GREEN = new PDColor(new float[] { 0.502f, 1, 0 }, PDDeviceRGB.INSTANCE);
public static final PDColor CYAN = new PDColor(new float[] { 0, 1, 1 }, PDDeviceRGB.INSTANCE);
public static final PDColor GREEN_CYAN = new PDColor(new float[] { 0, 1, 0.502f }, PDDeviceRGB.INSTANCE);
public static final PDColor CYAN_BLUE = new PDColor(new float[] { 0, 0.502f, 1 }, PDDeviceRGB.INSTANCE);
public static final PDColor MAGENTA = new PDColor(new float[] { 1, 0, 1 }, PDDeviceRGB.INSTANCE);
public static final PDColor VIOLET = new PDColor(new float[] { 0.502f, 0, 1 }, PDDeviceRGB.INSTANCE);
public static final PDColor DEEP_PINK = new PDColor(new float[] { 1, 0, 0.502f }, PDDeviceRGB.INSTANCE);
public static final PDColor WHITE = new PDColor(new float[] { 1, 1, 1 }, PDDeviceRGB.INSTANCE);
public static final PDColor LIGHT_GREY = new PDColor(new float[] { 0.753f, 0.753f, 0.753f }, PDDeviceRGB.INSTANCE);
public static final PDColor GREY = new PDColor(new float[] { 0.627f, 0.627f, 0.627f }, PDDeviceRGB.INSTANCE);
public static final PDColor DARK_GREY = new PDColor(new float[] { 0.376f, 0.376f, 0.376f }, PDDeviceRGB.INSTANCE);
public static final PDColor BLACK = new PDColor(new float[] { 0, 0, 0 }, PDDeviceRGB.INSTANCE);
public static PDColor getColor(String colorName) {
try {
Field field = PDFColors.class.getDeclaredField(colorName);
if(field == null) {
return BLACK;
}
field.setAccessible(true);
PDColor value = (PDColor)field.get(PDFColors.class);
return value;
} catch (Exception e) {
throw new RuntimeException("색상 설정 오류");
}
}
}

@ -1,21 +0,0 @@
package cokr.xit.fims.cmmn.pdf.print;
public class PDFCoordinate {
private float x;
private float y;
private float maxY;
public PDFCoordinate(float xpt, float ypt, float maxY) {
this.x = xpt;
this.y = ypt;
this.maxY = maxY;
}
public float[] offset() {
return new float[] {x, -y};
}
public float[] absolute() {
return new float[] {x, maxY-y};
}
}

@ -1,138 +0,0 @@
package cokr.xit.fims.cmmn.pdf.print;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.font.PDType0Font;
import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode;
import org.springframework.core.io.ClassPathResource;
import cokr.xit.foundation.Downloadable;
public class PDFWriter extends PDF {
public PDFWriter(){
this.doc = new PDDocument();
}
public PDFWriter paper(String type){
if(type.equals("A4")) {
this.paperSize = PDRectangle.A4;
} else if(type.equals("LETTER")) {
this.paperSize = PDRectangle.LETTER;
}
return this;
}
public PDRectangle getPaperSize(){
return this.paperSize;
}
public PDType0Font font(String path) throws IOException{
return PDType0Font.load(doc, new ClassPathResource(path).getInputStream());
}
public PDFWriter beginPage() throws IOException {
PDPage blankPage = new PDPage(paperSize);
doc.addPage(blankPage);
// 작업 페이지 설정
PDPage page = doc.getPage(doc.getNumberOfPages()-1);
// 컨텐츠 스트림 열기
contentStream = new PDPageContentStream(doc, page);
return this;
}
public PDFWriter setLineDashPattern(float[] pattern, float phase) throws IOException{
contentStream.setLineDashPattern(pattern, phase);
return this;
}
public PDFWriter moveTo(float x, float y) throws IOException {
contentStream.moveTo(x, y);
return this;
}
public PDFWriter lineTo(float x, float y) throws IOException {
contentStream.lineTo(x, y);
return this;
}
public PDFWriter stroke() throws IOException {
contentStream.stroke();
return this;
}
public PDFWriter beginText() throws IOException {
contentStream.beginText();
return this;
}
public PDFWriter setFont(PDType0Font font, int fontSize) throws IOException {
contentStream.setFont(font, fontSize);
return this;
}
public PDFWriter setRenderingMode(RenderingMode fontStyle) throws IOException {
contentStream.setRenderingMode(fontStyle);
return this;
}
public PDFWriter setNonStrokingColor(PDColor fontColr) throws IOException {
contentStream.setNonStrokingColor(fontColr);
return this;
}
public PDFWriter newLineAtOffset(float tx, float ty) throws IOException {
contentStream.newLineAtOffset(tx, ty);
return this;
}
public PDFWriter showText(String text) throws IOException {
contentStream.showText(text);
return this;
}
public PDFWriter endText() throws IOException {
contentStream.endText();
return this;
}
public PDFWriter image(InputStream imageStream, float x, float y, float width, float height) throws IOException {
PDImageXObject image = PDImageXObject.createFromByteArray(doc, imageStream.readAllBytes(), "temp");
contentStream.drawImage(image, x, y, width, height);
return this;
}
public PDFWriter endPage() throws IOException {
contentStream.close();
contentStream = null;
return this;
}
public void write(OutputStream out) {
try {
doc.save(out);
doc.close();
} catch (Exception e) {
throw runtimeException(e);
}
}
public File write(String filepath) {
File file = new File(filepath);
try (FileOutputStream out = new FileOutputStream(file)) {
write(out);
return file;
} catch (Exception e) {
throw runtimeException(e);
}
}
public Downloadable getDownloadable() {
return new Downloadable()
.setContentType(MIME_TYPE)
.setWriter(this::write);
}
}

@ -1,364 +0,0 @@
package cokr.xit.fims.cmmn.pdf.print.format;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import cokr.xit.applib.Print;
import cokr.xit.fims.cmmn.FimsPrintOption;
import cokr.xit.fims.mngt.OgdpUtil;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
/**
*
*/
public class Advntce extends PDFPrintFormat {
@Override
public void initDefaultStng() {
addForPost(
image("postSenderLogo","우편물송신자로고","").a4(10, 0).letter(10, 0).size(0, 0),
text("postSenderInst","우편물송신자기관","").a4(10, 5).letter(10, 5),
text("postSenderDept","우편물송신자부서","").a4(50, 5).letter(50, 5),
text("postSenderAddr","우편물송신자주소","").a4(10, 15).letter(10, 15),
text("postSenderDtlAddr","우편물송신자상세주소","").a4(10, 25).letter(10, 25),
text("postSenderZip","우편물송신자우편번호","").a4(10, 35).letter(10, 35),
text("postSenderTel","우편물송신자전화번호","").a4(10, 45).letter(10, 45),
text("postSenderFax","우편물송신자팩스번호","").a4(50, 45).letter(50, 45),
text("postReceiverAddr","우편물수신자주소","").a4(100, 40).letter(100, 40).size(90, 0).align("right"),
text("postReceiverDtlAddr","우편물수신자상세주소","").a4(100, 50).letter(100, 50).size(90, 0).align("right"),
text("postReceiver","우편물수신자명","").a4(100, 60).letter(100, 60).size(90, 0).align("right"),
text("postReceiverZip","우편물수신자우편번호","").a4(100, 70).letter(100, 70).size(90, 0).align("right")
);
add(
image("background","배경이미지","").a4(0, 0).letter(0, 0).size(0, 0),
images("crdnPhoto","단속사진","").a4(110, 100).letter(116, 95).size(90, 80),
image("rprsCrdnPhoto","대표단속사진","").a4(10, 200).letter(10, 186).size(80, 80),
text("rtpyrNm","수신자명",""),
text("rtpyrNo","수신자번호",""),
text("rtpyrAddr","수신자주소",""),
text("rtpyrDtlAddr","수신자상세주소",""),
text("rtpyrFullAddr","수신자전체주소",""),
text("vhrno","차량번호",""),
text("crdnYmd","단속일자",""),
text("crdnYmdTm","단속일시",""),
text("crdnPlc","단속장소",""),
text("ffnlgCarmdlNm","차종",""),
text("vltnArtcl","위반내용",""),
text("vltnLawNm","위반법령",""),
text("crdnSn","증거번호",""),
text("ffnlgCrdnAmt","최초금액",""),
text("advntceAmt","사전통지금액",""),
text("advntceDudtYmd","납부기한",""),
text("vrActno","대표가상계좌번호",""),
text("vrActno1","가상계좌번호1",""),
text("vrActno2","가상계좌번호2",""),
text("vrActno3","가상계좌번호3",""),
text("vrActno4","가상계좌번호4",""),
text("vrActno5","가상계좌번호5",""),
text("vrActno6","가상계좌번호6",""),
text("vrActno7","가상계좌번호7",""),
text("vrActno8","가상계좌번호8",""),
text("vrActno9","가상계좌번호9",""),
text("vrActno10","가상계좌번호10",""),
text("epayNo","전자납부번호",""),
text("otptYmd","출력일자","").offLog(),
text("otptDt","출력일시","").offLog(),
text("otptYYYY","출력년도","").offLog(),
text("otptMM","출력월","").offLog(),
text("otptDD","출력일","").offLog(),
text("offcsText","관인명","").offLog(),
image("offcs","관인이미지","").size(20, 20).offLog(),
text("undefined","(미정)","미정항목").offLog()
);
}
public Advntce() {
super();
}
public Advntce(Print print, FimsPrintOption printOption,
DataObject otptBscStng, List<DataObject> otptArtclStngList, String paperSeCd, List<DataObject> data){
super(print,printOption,otptBscStng,otptArtclStngList,paperSeCd, data);
this.print.setFormatKorName("사전통지서");
}
/**
* .
*/
@Override
public String getMappingValue(String otptArtclNm, String defaultValue, boolean forPost,
DataObject dataObject, FimsPrintOption printOption, Print print) {
String result = "";
if(forPost) {
return this.getValueForPost(otptArtclNm, defaultValue, dataObject, printOption, print);
}
Map<String, String> globalVariable = printOption.getGlobalVariable();
switch(otptArtclNm) {
case "background" -> {
if(globalVariable.get("bcrnImgPath") != null) {
result = globalVariable.get("bcrnImgPath");
}
}
case "rprsCrdnPhoto" -> { //대표사진
result = dataObject.string("CRDN_PHOTO1");
}
case "rprsCrdnPhotoKey" -> { //대표사진
result = dataObject.string("CRDN_PHOTO1"+"KEY");
}
case "rtpyrNm" -> {
result = dataObject.string("RTPYR_NM");
}
case "rtpyrNo" -> {
result = dataObject.string("RTPYR_NO");
}
case "rtpyrAddr" -> {
result = dataObject.string("RTPYR_ADDR");
}
case "rtpyrDtlAddr" -> {
result = dataObject.string("RTPYR_DTL_ADDR");
}
case "rtpyrFullAddr" -> {
result = dataObject.string("RTPYR_FULL_ADDR");
}
case "rtpyrZip" -> {
result = dataObject.string("RTPYR_ZIP");
}
case "vhrno" -> {
result = dataObject.string("VHRNO");
}
case "crdnYmd" -> {
result = DataFormat.yyyy_mm_dd(dataObject.string("CRDN_YMD"));
}
case "crdnYmdTm" -> {
result = DataFormat.yyyy_mm_dd_hh_mm_ss(dataObject.string("CRDN_YMD_TM"));
}
case "crdnPlc" -> {
result = dataObject.string("CRDN_PLC");
}
case "ffnlgCarmdlNm" -> {
result = dataObject.string("FFNLG_CARMDL_NM");
}
case "vltnArtcl" -> {
result = dataObject.string("VLTN_ARTCL");
}
case "vltnLawNm" -> {
result = dataObject.string("VLTN_LAW_NM");
}
case "crdnSn" -> {
result = dataObject.string("CRDN_SN");
}
case "ffnlgCrdnAmt" -> {
result = dataObject.string("FFNLG_CRDN_AMT");
}
case "advntceAmt" -> {
result = DataFormat.n_nn0(dataObject.string("ADVNTCE_AMT"));
}
case "advntceDudtYmd" -> {
result = DataFormat.yyyy_mm_dd(dataObject.string("ADVNTCE_DUDT_YMD"));
}
case "vrActno" -> {
result = dataObject.string("VR_ACTNO");
}
case "vrActno1" -> {
result = dataObject.string("VR_ACTNO1");
}
case "vrActno2" -> {
result = dataObject.string("VR_ACTNO2");
}
case "vrActno3" -> {
result = dataObject.string("VR_ACTNO3");
}
case "vrActno4" -> {
result = dataObject.string("VR_ACTNO4");
}
case "vrActno5" -> {
result = dataObject.string("VR_ACTNO5");
}
case "vrActno6" -> {
result = dataObject.string("VR_ACTNO6");
}
case "vrActno7" -> {
result = dataObject.string("VR_ACTNO7");
}
case "vrActno8" -> {
result = dataObject.string("VR_ACTNO8");
}
case "vrActno9" -> {
result = dataObject.string("VR_ACTNO9");
}
case "vrActno10" -> {
result = dataObject.string("VR_ACTNO10");
}
case "epayNo" -> {
result = dataObject.string("EPAY_NO");
}
case "otptYmd" -> {
result = DataFormat.yyyy_mm_dd(print.getPrintRequestDt().substring(0,8));
}
case "otptDt" -> {
result = DataFormat.yyyy_mm_dd_hh_mm_ss(print.getPrintRequestDt());
}
case "otptYYYY" -> {
result = print.getPrintRequestDt().substring(0,4);
}
case "otptMM" -> {
result = print.getPrintRequestDt().substring(4,6);
}
case "otptDD" -> {
result = print.getPrintRequestDt().substring(6,8);
}
case "offcsText" -> {
String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm");
instNm = OgdpUtil.getLastWord(instNm);
instNm = OgdpUtil.getInstituteLeader(instNm, true);
result = instNm;
}
case "offcs" -> {
result = globalVariable.get("offcsFilePath");
}
case "undefined" -> {
result = defaultValue;
}
}
return result;
}
/**
* .
*/
@Override
public String getValueForPost(String otptArtclNm, String defaultValue,
DataObject dataObject, FimsPrintOption printOption, Print print) {
String result = "";
switch(otptArtclNm) {
case "postReceiverAddr" -> {
result = dataObject.string("RTPYR_ADDR");
}
case "postReceiverDtlAddr" -> {
result = dataObject.string("RTPYR_DTL_ADDR");
}
case "postReceiverZip" -> {
result = dataObject.string("RTPYR_ZIP");
}
case "postReceiver" -> {
result = dataObject.string("RTPYR_NM");
}
case "postSenderLogo" -> {
result = printOption.getGlobalVariable().get("logoFilePath");
}
case "postSenderInst" -> {
result = (String)print.getPrintRequestUserInfo().getInfo().get("instNm");
}
case "postSenderDept" -> {
result = (String)print.getPrintRequestUserInfo().getInfo().get("deptNm");
}
case "postSenderAddr" -> {
result = printOption.getGlobalVariable().get("instAddr");
}
case "postSenderDtlAddr" -> {
result = printOption.getGlobalVariable().get("instDaddr");
}
case "postSenderZip" -> {
result = printOption.getGlobalVariable().get("instZip");
}
case "postSenderTel" -> {
result = printOption.getGlobalVariable().get("deptTelno");
}
case "postSenderFax" -> {
result = printOption.getGlobalVariable().get("deptFxno");
}
}
return result;
}
@Override
public List<String> getMappingValues(String otptArtclNm, String defaultValue, boolean forPost,
DataObject dataObject, FimsPrintOption printOption, Print print) {
List<String> result = new ArrayList<String>();
switch(otptArtclNm) {
case "crdnPhoto" -> {
int i = 1;
while(!dataObject.string("CRDN_PHOTO"+i).equals("")) {
result.add(dataObject.string("CRDN_PHOTO"+i));
i++;
}
}
case "crdnPhotoKey" -> {
int i = 1;
while(!dataObject.string("CRDN_PHOTO"+i+"KEY").equals("")) {
result.add(dataObject.string("CRDN_PHOTO"+i+"KEY"));
i++;
}
}
}
return result;
}
/**
* .
*/
@Override
public DataObject createSampleData() {
DataObject dataObject = new DataObject();
dataObject.put("RTPYR_NM", "홍길동");
dataObject.put("RTPYR_ADDR", "무슨도 무슨시 무슨구");
dataObject.put("RTPYR_DTL_ADDR", "ㅇㅇ아파트 999호");
dataObject.put("RTPYR_FULL_ADDR", "무슨도 무슨시 무슨구 ㅇㅇ아파트 999호");
dataObject.put("RTPYR_ZIP", "12345");
dataObject.put("VHRNO", "00가0000");
dataObject.put("CRDN_YMD", "20231204");
dataObject.put("CRDN_YMD_TM", "20231204080808");
dataObject.put("CRDN_PLC", "사거리 건너편");
dataObject.put("FFNLG_CARMDL_NM", "승용");
dataObject.put("VLTN_ARTCL", "주차위반");
dataObject.put("VLTN_LAW_NM", "00법 제0조 제0항");
dataObject.put("CRDN_SN", "1234567890");
dataObject.put("VR_ACTNO", "000000-00-000000");
dataObject.put("VR_ACTNO1", "111111-00-000000");
dataObject.put("VR_ACTNO2", "222222-00-000000");
dataObject.put("VR_ACTNO3", "333333-00-000000");
dataObject.put("VR_ACTNO4", "444444-00-000000");
dataObject.put("VR_ACTNO5", "555555-00-000000");
dataObject.put("VR_ACTNO6", "666666-00-000000");
dataObject.put("VR_ACTNO7", "777777-00-000000");
dataObject.put("VR_ACTNO8", "888888-00-000000");
dataObject.put("VR_ACTNO9", "999999-00-000000");
dataObject.put("VR_ACTNO10", "101010-00-000000");
dataObject.put("EPAY_NO", "00000-0-00-00-000000000");
dataObject.put("FFNLG_CRDN_AMT", "100000");
dataObject.put("ADVNTCE_AMT", "80000");
dataObject.put("ADVNTCE_DUDT_YMD", "20231231");
dataObject.put("CRDN_PHOTO1", "samplefiles/crdn1.png");
dataObject.put("CRDN_PHOTO2", "samplefiles/crdn2.png");
dataObject.put("CRDN_PHOTO3", "samplefiles/crdn3.png");
dataObject.put("CRDN_PHOTO4", "samplefiles/crdn4.png");
dataObject.put("CRDN_PHOTO5", "samplefiles/crdn5.png");
dataObject.put("CRDN_PHOTO6", "samplefiles/crdn6.png");
dataObject.put("CRDN_PHOTO7", "samplefiles/crdn7.png");
return dataObject;
}
}

@ -1,446 +0,0 @@
package cokr.xit.fims.cmmn.pdf.print.format;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import cokr.xit.applib.Print;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.FimsPrintOption;
import cokr.xit.fims.mngt.OgdpUtil;
import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject;
public class Nht extends PDFPrintFormat {
@Override
public void initDefaultStng() {
addForPost(
image("postSenderLogo","우편물송신자로고","").a4(10, 0).letter(10, 0).size(0, 0),
text("postSenderInst","우편물송신자기관","").a4(10, 5).letter(10, 5),
text("postSenderDept","우편물송신자부서","").a4(50, 5).letter(50, 5),
text("postSenderAddr","우편물송신자주소","").a4(10, 15).letter(10, 15),
text("postSenderDtlAddr","우편물송신자상세주소","").a4(10, 25).letter(10, 25),
text("postSenderZip","우편물송신자우편번호","").a4(10, 35).letter(10, 35),
text("postSenderTel","우편물송신자전화번호","").a4(10, 45).letter(10, 45),
text("postSenderFax","우편물송신자팩스번호","").a4(50, 45).letter(50, 45),
text("postReceiverAddr","우편물수신자주소","").a4(100, 40).letter(100, 40).size(90, 0).align("right"),
text("postReceiverDtlAddr","우편물수신자상세주소","").a4(100, 50).letter(100, 50).size(90, 0).align("right"),
text("postReceiver","우편물수신자명","").a4(100, 60).letter(100, 60).size(90, 0).align("right"),
text("postReceiverZip","우편물수신자우편번호","").a4(100, 70).letter(100, 70).size(90, 0).align("right")
);
add(
image("background","배경이미지","").a4(0, 0).letter(0, 0).size(0, 0),
images("crdnPhoto","단속사진","").a4(110, 100).letter(116, 95).size(90, 80),
image("rprsCrdnPhoto","대표단속사진","").a4(10, 200).letter(10, 186).size(80, 80),
text("ocr1","OCR32자리",""),
text("ocr2","OCR54자리1",""),
text("ocr3","OCR54자리2",""),
text("rtpyrNm","수신자명",""),
text("rtpyrNo","수신자번호",""),
text("rtpyrAddr","수신자주소",""),
text("rtpyrDtlAddr","수신자상세주소",""),
text("rtpyrFullAddr","수신자전체주소",""),
text("vhrno","차량번호",""),
text("crdnYmd","단속일자",""),
text("crdnYmdTm","단속일시",""),
text("crdnPlc","단속장소",""),
text("ffnlgCarmdlNm","차종",""),
text("vltnArtcl","위반내용",""),
text("vltnLawNm","위반법령",""),
text("crdnSn","증거번호",""),
text("ffnlgCrdnAmt","최초금액",""),
text("pcptax","본세",""),
text("adamt","가산금",""),
text("sumAmt","납기금액",""),
text("dudtYmd","납기일자",""),
text("dudtAftrPcptax","납기후본세",""),
text("dudtAftrAdamt","납기후가산금",""),
text("dudtAftrAmt","납기후금액",""),
text("dudtAftrYmd","납기후일자",""),
text("vrActno","대표가상계좌번호",""),
text("vrActno1","가상계좌번호1",""),
text("vrActno2","가상계좌번호2",""),
text("vrActno3","가상계좌번호3",""),
text("vrActno4","가상계좌번호4",""),
text("vrActno5","가상계좌번호5",""),
text("vrActno6","가상계좌번호6",""),
text("vrActno7","가상계좌번호7",""),
text("vrActno8","가상계좌번호8",""),
text("vrActno9","가상계좌번호9",""),
text("vrActno10","가상계좌번호10",""),
text("epayNo","전자납부번호",""),
text("otptYmd","출력일자","").offLog(),
text("otptDt","출력일시","").offLog(),
text("otptYYYY","출력년도","").offLog(),
text("otptMM","출력월","").offLog(),
text("otptDD","출력일","").offLog(),
text("offcsText","관인명","").offLog(),
image("offcs","관인이미지","").size(20, 20).offLog(),
text("undefined","(미정)","미정항목").offLog()
);
}
public Nht() {
super();
}
public Nht(Print print, FimsPrintOption printOption,
DataObject otptBscStng, List<DataObject> otptArtclStngList, String paperSeCd, List<DataObject> data) {
super(print,printOption,otptBscStng,otptArtclStngList,paperSeCd, data);
this.print.setFormatKorName("고지서");
}
/**
* .
*/
@Override
public String getMappingValue(String otptArtclNm, String defaultValue, boolean forPost,
DataObject dataObject, FimsPrintOption printOption, Print print) {
String result = "";
if(forPost) {
return this.getValueForPost(otptArtclNm, defaultValue, dataObject, printOption, print);
}
Map<String, String> globalVariable = printOption.getGlobalVariable();
switch(otptArtclNm) {
case "background" -> {
if(globalVariable.get("bcrnImgPath") != null) {
result = globalVariable.get("bcrnImgPath");
}
}
case "rprsCrdnPhoto" -> { //대표사진
result = dataObject.string("CRDN_PHOTO1");
}
case "rprsCrdnPhotoKey" -> { //대표사진
result = dataObject.string("CRDN_PHOTO1"+"KEY");
}
case "rtpyrNm" -> {
result = dataObject.string("RTPYR_NM");
}
case "rtpyrNo" -> {
result = dataObject.string("RTPYR_NO");
}
case "rtpyrAddr" -> {
result = dataObject.string("RTPYR_ADDR");
}
case "rtpyrDtlAddr" -> {
result = dataObject.string("RTPYR_DTL_ADDR");
}
case "rtpyrFullAddr" -> {
result = dataObject.string("RTPYR_FULL_ADDR");
}
case "rtpyrZip" -> {
result = dataObject.string("RTPYR_ZIP");
}
case "vhrno" -> {
result = dataObject.string("VHRNO");
}
case "crdnYmd" -> {
result = DataFormat.yyyy_mm_dd(dataObject.string("CRDN_YMD"));
}
case "crdnYmdTm" -> {
result = DataFormat.yyyy_mm_dd_hh_mm_ss(dataObject.string("CRDN_YMD_TM"));
}
case "crdnPlc" -> {
result = dataObject.string("CRDN_PLC");
}
case "ffnlgCarmdlNm" -> {
result = dataObject.string("FFNLG_CARMDL_NM");
}
case "vltnArtcl" -> {
result = dataObject.string("VLTN_ARTCL");
}
case "vltnLawNm" -> {
result = dataObject.string("VLTN_LAW_NM");
}
case "crdnSn" -> {
result = dataObject.string("CRDN_SN");
}
case "ffnlgCrdnAmt" -> {
result = dataObject.string("FFNLG_CRDN_AMT");
}
case "pcptax" -> { //본세
result = dataObject.string("PCPTAX");
}
case "adamt" -> { //가산금
result = dataObject.string("ADAMT");
}
case "sumAmt" -> { //납기금액
result = dataObject.string("SUM_AMT");
}
case "dudtYmd" -> { //납기일자
result = dataObject.string("DUDT_YMD");
}
case "dudtAftrPcptax" -> { //납기후본세
result = dataObject.string("PCPTAX");
}
case "dudtAftrAdamt" -> { //납기후가산금
result = (dataObject.number("DUDT_AFTR_AMT").intValue() - dataObject.number("PCPTAX").intValue())+"";
}
case "dudtAftrAmt" -> { //납기후금액
result = dataObject.string("DUDT_AFTR_AMT");
}
case "dudtAftrYmd" -> { //납기후일자
result = dataObject.string("DUDT_AFTR_YMD");
}
case "vrActno" -> {
result = dataObject.string("VR_ACTNO");
}
case "vrActno1" -> {
result = dataObject.string("VR_ACTNO1");
}
case "vrActno2" -> {
result = dataObject.string("VR_ACTNO2");
}
case "vrActno3" -> {
result = dataObject.string("VR_ACTNO3");
}
case "vrActno4" -> {
result = dataObject.string("VR_ACTNO4");
}
case "vrActno5" -> {
result = dataObject.string("VR_ACTNO5");
}
case "vrActno6" -> {
result = dataObject.string("VR_ACTNO6");
}
case "vrActno7" -> {
result = dataObject.string("VR_ACTNO7");
}
case "vrActno8" -> {
result = dataObject.string("VR_ACTNO8");
}
case "vrActno9" -> {
result = dataObject.string("VR_ACTNO9");
}
case "vrActno10" -> {
result = dataObject.string("VR_ACTNO10");
}
case "epayNo" -> {
result = dataObject.string("EPAY_NO");
}
case "ocr1" -> {
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");
result = CmmnUtil.getOcrband1(deptCode, spclBizCd, fyr, acntgSeCd, txitmCd, levyNo, ispySn);
}
case "ocr2" -> {
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 ocrBand1 = CmmnUtil.getOcrband1(deptCode, spclBizCd, fyr, acntgSeCd, txitmCd, levyNo, ispySn);
String levySeCd = dataObject.string("LEVY_SE_CD");
int sumAmt = dataObject.number("SUM_AMT").intValue(); // 합계 금액
String dudtYmd = dataObject.string("DUDT_YMD");
result = CmmnUtil.getOcrband2(ocrBand1, levySeCd, sumAmt, dudtYmd);
}
case "ocr3" -> {
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 ocrBand1 = CmmnUtil.getOcrband1(deptCode, spclBizCd, fyr, acntgSeCd, txitmCd, levyNo, ispySn);
String levySeCd = dataObject.string("LEVY_SE_CD");
int sumAmt = dataObject.number("SUM_AMT").intValue(); // 합계 금액
String dudtYmd = dataObject.string("DUDT_YMD");
String ocrBand2 = CmmnUtil.getOcrband2(ocrBand1, levySeCd, sumAmt, dudtYmd);
int afterSumAmt = dataObject.number("DUDT_AFTR_AMT").intValue(); // 납기후 금액
result = CmmnUtil.getOcrband3(ocrBand2, sumAmt, dudtYmd, afterSumAmt);
}
case "otptYmd" -> {
result = DataFormat.yyyy_mm_dd(print.getPrintRequestDt().substring(0,8));
}
case "otptDt" -> {
result = DataFormat.yyyy_mm_dd_hh_mm_ss(print.getPrintRequestDt());
}
case "otptYYYY" -> {
result = print.getPrintRequestDt().substring(0,4);
}
case "otptMM" -> {
result = print.getPrintRequestDt().substring(4,6);
}
case "otptDD" -> {
result = print.getPrintRequestDt().substring(6,8);
}
case "offcsText" -> {
String instNm = (String) print.getPrintRequestUserInfo().getInfo().get("instNm");
instNm = OgdpUtil.getLastWord(instNm);
instNm = OgdpUtil.getInstituteLeader(instNm, true);
result = instNm;
}
case "offcs" -> {
result = globalVariable.get("offcsFilePath");
}
case "undefined" -> {
result = defaultValue;
}
}
return result;
}
/**
* .
*/
@Override
public String getValueForPost(String otptArtclNm, String defaultValue,
DataObject dataObject, FimsPrintOption printOption, Print print) {
String result = "";
switch(otptArtclNm) {
case "postReceiverAddr" -> {
result = dataObject.string("RTPYR_ADDR");
}
case "postReceiverDtlAddr" -> {
result = dataObject.string("RTPYR_DTL_ADDR");
}
case "postReceiverZip" -> {
result = dataObject.string("RTPYR_ZIP");
}
case "postReceiver" -> {
result = dataObject.string("RTPYR_NM");
}
case "postSenderLogo" -> {
result = printOption.getGlobalVariable().get("logoFilePath");
}
case "postSenderInst" -> {
result = (String)print.getPrintRequestUserInfo().getInfo().get("instNm");
}
case "postSenderDept" -> {
result = (String)print.getPrintRequestUserInfo().getInfo().get("deptNm");
}
case "postSenderAddr" -> {
result = printOption.getGlobalVariable().get("instAddr");
}
case "postSenderDtlAddr" -> {
result = printOption.getGlobalVariable().get("instDaddr");
}
case "postSenderZip" -> {
result = printOption.getGlobalVariable().get("instZip");
}
case "postSenderTel" -> {
result = printOption.getGlobalVariable().get("deptTelno");
}
case "postSenderFax" -> {
result = printOption.getGlobalVariable().get("deptFxno");
}
}
return result;
}
@Override
public List<String> getMappingValues(String otptArtclNm, String defaultValue, boolean forPost,
DataObject dataObject, FimsPrintOption printOption, Print print) {
List<String> result = new ArrayList<String>();
switch(otptArtclNm) {
case "crdnPhoto" -> {
int i = 1;
while(!dataObject.string("CRDN_PHOTO"+i).equals("")) {
result.add(dataObject.string("CRDN_PHOTO"+i));
i++;
}
}
}
return result;
}
/**
* .
*/
@Override
public DataObject createSampleData() {
DataObject dataObject = new DataObject();
dataObject.put("RTPYR_NM", "홍길동");
dataObject.put("RTPYR_ADDR", "무슨도 무슨시 무슨구");
dataObject.put("RTPYR_DTL_ADDR", "ㅇㅇ아파트 999호");
dataObject.put("RTPYR_FULL_ADDR", "무슨도 무슨시 무슨구 ㅇㅇ아파트 999호");
dataObject.put("RTPYR_ZIP", "12345");
dataObject.put("VHRNO", "00가0000");
dataObject.put("CRDN_YMD", "20231204");
dataObject.put("CRDN_YMD_TM", "20231204080808");
dataObject.put("CRDN_PLC", "사거리 건너편");
dataObject.put("FFNLG_CARMDL_NM", "승용");
dataObject.put("VLTN_ARTCL", "주차위반");
dataObject.put("VLTN_LAW_NM", "00법 제0조 제0항");
dataObject.put("CRDN_SN", "1234567890");
dataObject.put("VR_ACTNO", "000000-00-000000");
dataObject.put("VR_ACTNO1", "111111-00-000000");
dataObject.put("VR_ACTNO2", "222222-00-000000");
dataObject.put("VR_ACTNO3", "333333-00-000000");
dataObject.put("VR_ACTNO4", "444444-00-000000");
dataObject.put("VR_ACTNO5", "555555-00-000000");
dataObject.put("VR_ACTNO6", "666666-00-000000");
dataObject.put("VR_ACTNO7", "777777-00-000000");
dataObject.put("VR_ACTNO8", "888888-00-000000");
dataObject.put("VR_ACTNO9", "999999-00-000000");
dataObject.put("VR_ACTNO10", "101010-00-000000");
dataObject.put("EPAY_NO", "00000-0-00-00-000000000");
dataObject.put("FFNLG_CRDN_AMT", "100000");
dataObject.put("ADVNTCE_AMT", "80000");
dataObject.put("ADVNTCE_DUDT_YMD", "20231231");
dataObject.put("DEPT_CD", "4060411");
dataObject.put("SPCL_BIZ_CD", "0000");
dataObject.put("FYR", "2023");
dataObject.put("ACNTG_SE_CD", "61");
dataObject.put("TXITM_CD", "234006");
dataObject.put("LEVY_NO", "123456");
dataObject.put("ISPY_SN", "00");
dataObject.put("LEVY_SE_CD", "01");
dataObject.put("PCPTAX", "80000"); //본세
dataObject.put("ADAMT", "0"); //가산금
dataObject.put("SUM_AMT", "80000"); //합계금액
dataObject.put("DUDT_YMD", "20231215"); //납기일자
dataObject.put("DUDT_AFTR_AMT", "100000"); //납기후 금액
dataObject.put("DUDT_AFTR_YMD", "20231231"); //납기후 일자
dataObject.put("CRDN_PHOTO1", "samplefiles/crdn1.png");
dataObject.put("CRDN_PHOTO2", "samplefiles/crdn2.png");
dataObject.put("CRDN_PHOTO3", "samplefiles/crdn3.png");
dataObject.put("CRDN_PHOTO4", "samplefiles/crdn4.png");
dataObject.put("CRDN_PHOTO5", "samplefiles/crdn5.png");
dataObject.put("CRDN_PHOTO6", "samplefiles/crdn6.png");
dataObject.put("CRDN_PHOTO7", "samplefiles/crdn7.png");
return dataObject;
}
}

@ -1,913 +0,0 @@
package cokr.xit.fims.cmmn.pdf.print.format;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.font.PDType0Font;
import org.apache.pdfbox.pdmodel.graphics.color.PDColor;
import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode;
import org.egovframe.rte.fdl.string.EgovStringUtil;
import org.springframework.core.io.ClassPathResource;
import cokr.xit.applib.Print;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.FimsPrintOption;
import cokr.xit.fims.cmmn.Pstn;
import cokr.xit.fims.cmmn.PstnAndSize;
import cokr.xit.fims.cmmn.Size;
import cokr.xit.fims.cmmn.pdf.print.DefaultOtptArtclStng;
import cokr.xit.fims.cmmn.pdf.print.PDFColors;
import cokr.xit.fims.cmmn.pdf.print.PDFCoordinate;
import cokr.xit.fims.cmmn.pdf.print.PDFWriter;
import cokr.xit.fims.sprt.MediaUtil;
import cokr.xit.foundation.data.DataObject;
public abstract class PDFPrintFormat {
protected PDFWriter writer;
protected Print print;
protected FimsPrintOption printOption;
protected List<DataObject> data;
protected DataObject otptBscStng;
protected List<DataObject> otptArtclStngList;
protected String paperSeCd;
protected float[] paperMilimeter = new float[2];
protected List<DefaultOtptArtclStng> prototypeStngs = new ArrayList<DefaultOtptArtclStng>();
public abstract void initDefaultStng();
public PDFPrintFormat() {
initDefaultStng();
}
public PDFPrintFormat(Print print, FimsPrintOption printOption,
DataObject otptBscStng, List<DataObject> otptArtclStngList, String paperSeCd, List<DataObject> data) {
initDefaultStng();
this.data = data;
this.print = print;
this.print.setExtension("pdf");
this.printOption = printOption;
this.otptBscStng = otptBscStng;
this.otptArtclStngList = otptArtclStngList;
this.paperSeCd = paperSeCd;
if(paperSeCd.equals("01")) {
this.paperMilimeter = new float[] {210.0f , 297.0f};
} else if(paperSeCd.equals("02")){
this.paperMilimeter = new float[] {216.0f , 279.0f};
}
}
public void setOtptBscStng(DataObject otptBscStng) {
this.otptBscStng = otptBscStng;
}
public void setOtptArtclStngList(List<DataObject> otptArtclStngList) {
this.otptArtclStngList = otptArtclStngList;
}
public List<DataObject> getOtptArtclStngList() {
return this.otptArtclStngList;
}
public void setPaperSeCd(String paperSeCd) {
this.paperSeCd = paperSeCd;
}
public void setPrint(Print print) {
this.print = print;
};
/**
* .
*/
public List<DefaultOtptArtclStng> getPrototypeStngs(){
return this.prototypeStngs;
}
/**
* .
*/
public List<DefaultOtptArtclStng> getPrototypeStngs(boolean unique){
return this.prototypeStngs.stream().filter(item -> item.isUnique() == unique).toList();
}
/**
* .
*/
public DefaultOtptArtclStng text(String artclNm, String artclDscrp, String otptBscVl){
return new DefaultOtptArtclStng("text", artclNm, artclDscrp, otptBscVl);
}
/**
* .
*/
public DefaultOtptArtclStng image(String artclNm, String artclDscrp, String otptBscVl){
return new DefaultOtptArtclStng("image", artclNm, artclDscrp, otptBscVl);
}
/**
* .
*/
public DefaultOtptArtclStng images(String artclNm, String artclDscrp, String otptBscVl){
return new DefaultOtptArtclStng("images", artclNm, artclDscrp, otptBscVl);
}
/**
* .
*/
public void add(DefaultOtptArtclStng... prototypeStngs){
for(DefaultOtptArtclStng prototypeStng : prototypeStngs) {
this.prototypeStngs.add(prototypeStng);
}
}
/**
* .
*/
public void addForPost(DefaultOtptArtclStng... prototypeStngs){
for(DefaultOtptArtclStng prototypeStng : prototypeStngs) {
this.prototypeStngs.add(prototypeStng.post());
}
};
/**
* .
*/
public abstract String getMappingValue(String otptArtclNm, String defaultValue, boolean forPost,
DataObject dataObject, FimsPrintOption printOption, Print print);
public abstract List<String> getMappingValues(String otptArtclNm, String defaultValue, boolean forPost,
DataObject dataObject, FimsPrintOption printOption, Print print);
/**
* .
*/
public abstract String getValueForPost(String otptArtclNm, String defaultValue,
DataObject dataObject, FimsPrintOption printOption, Print print);
/**
* ( , , , , ) .
*/
public void appendOtptAttribute(List<DataObject> otptArtclStngList) {
if(otptArtclStngList!=null && !otptArtclStngList.isEmpty()) {
List<DefaultOtptArtclStng> prototypeStngs = this.getPrototypeStngs();
for(DataObject otptArtclStng : otptArtclStngList) {
String otptArtclNm = (String) otptArtclStng.get("OTPT_ARTCL_NM");
DefaultOtptArtclStng prototypeStng = prototypeStngs.stream()
.filter(item -> item.getArtclNm().equals(otptArtclNm)).toList().get(0);
otptArtclStng.set("UNIQUE_YN", prototypeStng.isUnique() ? "Y" : "N");
otptArtclStng.set("DSCRP", prototypeStng.getArtclDscrp());
otptArtclStng.set("COMPONENT_TYPE", prototypeStng.getComponentType());
otptArtclStng.set("POST_YN", prototypeStng.isForPost() ? "Y" : "N");
}
}
}
/**
* .
*/
public abstract DataObject createSampleData();
public List<DataObject> getMosSet(String imageKey, DataObject dataObject) {
List<DataObject> list = CmmnUtil.getDataObjectListFromMap(dataObject,"MOS"+imageKey);
if(list != null) {
return list;
} else {
return null;
}
}
/**
* .
*/
public List<DefaultOtptArtclStng> filterUsedArtcls() {
List<String> otptArtclNmList = this.otptArtclStngList.stream().map((item) -> { return item.string("OTPT_ARTCL_NM"); }).toList();
List<DefaultOtptArtclStng> result = this.getPrototypeStngs().stream()
.filter((item) -> {
return otptArtclNmList.contains(item.getArtclNm());
}).toList();
return result;
}
/**
* .
*/
public List<String> filterDownloadDataNames() {
List<String> result = this.filterUsedArtcls().stream()
.filter((item) -> {
return item.isDownloadData();
})
.map(DefaultOtptArtclStng::getArtclDscrp).toList();
return result;
}
public Map<String, Object> makeFile() {
Map<String, Object> result = new HashMap<>();
writer = new PDFWriter();
//폰트 로드
Map<String, PDType0Font> fontMap = this.getFontMap(writer);
//용지 크기 설정
if(this.paperSeCd.equals("01")) {
writer.paper("A4");
} else {
writer.paper("LETTER");
}
List<DefaultOtptArtclStng> prototypeStngList = this.getPrototypeStngs();
try {
//출력요소별 속성 정보 추가
this.appendOtptAttribute(this.otptArtclStngList);
//출력 요소 정렬
Comparator<DataObject> comparator1 = (item1, item2) -> {
int int1 = item1.string("UNIQUE_YN").equals("Y") ? 0 : 1;
int int2 = item2.string("UNIQUE_YN").equals("Y") ? 0 : 1;
return Integer.compare(int1, int2);
};
Comparator<DataObject> comparator2 = (item1, item2) -> {
int int1 = item1.number("OTPT_ARTCL_SEQ").intValue();
int int2 = item2.number("OTPT_ARTCL_SEQ").intValue();
return Integer.compare(int1, int2);
};
otptArtclStngList = otptArtclStngList.stream()
.sorted(comparator1.thenComparing(comparator2)).collect(Collectors.toList());
//대표단속사진 설정 여부 확인
boolean rprsCrdnPhotoYn = false;
if(otptArtclStngList.stream().filter(item -> item.string("OTPT_ARTCL_NM").equals("rprsCrdnPhoto")).count() > 0) {
rprsCrdnPhotoYn = true;
}
for(DataObject dataObject : data) {
writer.beginPage();
boolean completeFoldLine = false;
for(DataObject otptArtclStng : otptArtclStngList) {
String otptArtclNm = otptArtclStng.string("OTPT_ARTCL_NM");
if(!otptArtclNm.equals("background") && !completeFoldLine) {
//접는곳 점선 그리기
if(!otptBscStng.string("FOLD_LINE_PSTN_SE_CD").equals("")) {
this.renderFoldLine(writer, otptBscStng.string("FOLD_LINE_PSTN_SE_CD"));
}
completeFoldLine = true;
}
DefaultOtptArtclStng prototypeStng = prototypeStngList.stream()
.filter(item -> item.getArtclNm().equals(otptArtclNm)).toList().get(0);
float[] pstn = this.getPstnStng(prototypeStng, otptArtclStng, this.paperSeCd);
float[] size = this.getSize(prototypeStng, otptArtclStng);
boolean forPost = prototypeStng.isForPost();
String defaultValue = prototypeStng.getOtptBscVl();
if(prototypeStng.getComponentType().equals("text")) {
String align = this.getAlign(prototypeStng, otptArtclStng);
String lineChgYn = this.getLineChgYn(prototypeStng, otptArtclStng);
PDType0Font font = this.getFontType(prototypeStng, otptArtclStng, fontMap);
int fontSz = this.getFontSize(prototypeStng, otptArtclStng);
RenderingMode fontStyle = this.getFontStyle(prototypeStng, otptArtclStng);
PDColor fontColr = this.getFontColor(prototypeStng, otptArtclStng);
String textValue = this.getMappingValue(otptArtclNm,defaultValue,forPost,dataObject,printOption, this.print);
this.writeText(writer, textValue, pstn, size[0], align, lineChgYn
, font, fontSz, fontStyle, fontColr);
} else if(prototypeStng.getComponentType().equals("image")) {
String imagePath = this.getMappingValue(otptArtclNm,defaultValue,forPost,dataObject,printOption,this.print);
if(EgovStringUtil.null2void(imagePath).equals("")) {
continue;
}
if(!imagePath.startsWith("files")) {
imagePath = CmmnUtil.copyStaticResource(imagePath, false);
}
File imageFile = new File(imagePath);
InputStream is = new FileInputStream(imageFile);
String imageKey = "";
List<DataObject> mosSet = null;
if(otptArtclNm.equals("rprsCrdnPhoto")) {
imageKey = this.getMappingValue(otptArtclNm+"Key",defaultValue,forPost,dataObject,printOption,this.print);
mosSet = this.getMosSet(imageKey, dataObject);
}
this.insertImage(writer, is, pstn, size);
if(otptArtclNm.equals("rprsCrdnPhoto") && !imageKey.equals("") && mosSet != null) {
File imageFile0 = new File(imagePath);
InputStream is0 = new FileInputStream(imageFile0);
List<PstnAndSize> transformedMosaicInfos = MediaUtil.getTransformedMosaic(
mosSet, is0, new PstnAndSize(pstn[0],pstn[1], size[0], size[1])
);
for(int k=0; k < transformedMosaicInfos.size(); k++) {
PstnAndSize mosaicInfo = transformedMosaicInfos.get(k);
InputStream blackImageStream = new ClassPathResource("samplefiles/black.png").getInputStream();
this.insertImage(writer, blackImageStream,
mosaicInfo.getPstn().to2Float(), mosaicInfo.getSize().to2Float());
}
}
} else if(prototypeStng.getComponentType().equals("images")) {
List<String> imagePaths = this.getMappingValues(otptArtclNm,defaultValue,forPost,dataObject,printOption,this.print);
List<String> imageKeys = new ArrayList<String>();
List<List<DataObject>> mosSets = new ArrayList<List<DataObject>>();
if(otptArtclNm.equals("crdnPhoto")) {
imageKeys = this.getMappingValues(otptArtclNm+"Key",defaultValue,forPost,dataObject,printOption,this.print);
if(rprsCrdnPhotoYn && imagePaths.size() > 0) {
imageKeys.remove(0);
}
for(String imageKey : imageKeys) {
mosSets.add(this.getMosSet(imageKey, dataObject));
}
}
if(otptArtclNm.equals("crdnPhoto")) {
if(rprsCrdnPhotoYn && imagePaths.size() > 0) {
imagePaths.remove(0);
}
}
int printCntSetting = otptBscStng.number("OTPT_PHOTO_CNT").intValue();
int dataImageCnt = imagePaths.size();
if(printCntSetting != 0 && dataImageCnt != 0) {
List<PstnAndSize> devideInfos = this.devideImageArea(pstn, size, printCntSetting, dataImageCnt);
for (int i=0; i< devideInfos.size(); i++){
PstnAndSize devideInfo = devideInfos.get(i);
if(EgovStringUtil.null2void(imagePaths.get(i)).equals("")) {
continue;
}
if(!imagePaths.get(i).startsWith("files")) {
imagePaths.set(i, CmmnUtil.copyStaticResource(imagePaths.get(i), false));
}
String imagePath = imagePaths.get(i);
File imageFile = new File(imagePath);
InputStream is = new FileInputStream(imageFile);
this.insertImage(writer, is,
devideInfo.getPstn().to2Float(), devideInfo.getSize().to2Float());
if(otptArtclNm.equals("crdnPhoto") && !imageKeys.isEmpty() && !mosSets.isEmpty()) {
if(mosSets.get(i) != null) {
String imagePath0 = imagePaths.get(i);
File imageFile0 = new File(imagePath0);
InputStream is0 = new FileInputStream(imageFile0);
List<PstnAndSize> transformedMosaicInfos = MediaUtil.getTransformedMosaic(
mosSets.get(i), is0, devideInfo
);
for(int k=0; k < transformedMosaicInfos.size(); k++) {
PstnAndSize mosaicInfo = transformedMosaicInfos.get(k);
InputStream blackImageStream = new ClassPathResource("samplefiles/black.png").getInputStream();
this.insertImage(writer, blackImageStream,
mosaicInfo.getPstn().to2Float(), mosaicInfo.getSize().to2Float());
}
}
}
}
}
}
}//출력항목 loop 끝
if(!completeFoldLine) {
if(!otptBscStng.string("FOLD_LINE_PSTN_SE_CD").equals("")) {
this.renderFoldLine(writer, otptBscStng.string("FOLD_LINE_PSTN_SE_CD"));
}
}
writer.endPage();
} //출력자료건수 loop 끝
String downloadFileName = this.print.getFormatKorName()+"_"+this.print.getPrintRequestDt()+".pdf";
result.put("download", writer.getDownloadable().setFilename(downloadFileName));
result.put("downloadData", data);
result.put("dataNames", this.filterDownloadDataNames());
} catch(FileNotFoundException e) {
throw new RuntimeException("파일을 찾을 수 없습니다.");
} catch (Exception e) {
throw new RuntimeException("출력오류."+e);
}
return result;
}
/**
* mm pdf .
*/
public PDFCoordinate toPDFCoordinate(float[] XYmm) {
float Xmm = XYmm[0];
float Ymm = XYmm[1];
float Xpt = CmmnUtil.mmToPt(Xmm);
float Ypt = CmmnUtil.mmToPt(Ymm);
float YptMax = CmmnUtil.mmToPt(this.paperMilimeter[1]);
return new PDFCoordinate(Xpt, Ypt, YptMax);
}
/**
* pdf .
*/
public void writeText(PDFWriter writer, String allText,
float[] XYmm, float textAreaWidth_mm, String align, String newLineYn,
PDType0Font font, int fontSize, RenderingMode fontStyle, PDColor fontColor) {
try {
if(allText == null) {
allText = "";
}
if(newLineYn == null || newLineYn.equals("")) {
newLineYn = "N";
}
float[] xyAbsolute = this.toPDFCoordinate(XYmm).absolute();
float textAreaWidth_pt = CmmnUtil.mmToPt(textAreaWidth_mm);
float allTextWidth = calcTextWidth(font, fontSize, allText);
String textArr[];
if(allText.equals("") || allText.length() == 1 || textAreaWidth_pt == 0
|| (allTextWidth <= textAreaWidth_pt)
|| newLineYn.equals("N")) {
textArr = new String[] { allText };
} else {
textArr = splitByLineForLargeText(font, fontSize, allText, textAreaWidth_pt);
}
String firstLine = textArr[0];
float firstLineWidth = calcTextWidth(font, fontSize, firstLine);
writer.beginText();
writer.setFont(font, fontSize);
writer.setRenderingMode(fontStyle);
writer.setNonStrokingColor(fontColor);
float resultY = xyAbsolute[1] - fontSize;
float firstLineAlignCorrection = 0;
if(align.equals("right")) {
firstLineAlignCorrection = textAreaWidth_pt - firstLineWidth;
} else if(align.equals("center")) {
firstLineAlignCorrection = (textAreaWidth_pt - firstLineWidth)/2.0f;
}
float resultX = xyAbsolute[0] + firstLineAlignCorrection;
writer.newLineAtOffset(resultX, resultY);
writer.showText(textArr[0]);
if(textArr.length > 1) {
float beforeLineWidth = firstLineWidth;
for(int i = 1; i < textArr.length; i++) {
String thisLine = textArr[i];
float thisLineWidth = this.calcTextWidth(font, fontSize, thisLine);
float alignCorrection = 0;
if(align.equals("right")) {
alignCorrection = beforeLineWidth - thisLineWidth;
} if(align.equals("center")) {
alignCorrection = (beforeLineWidth - thisLineWidth)/2.0f;
}
writer.newLineAtOffset(alignCorrection, -(fontSize + 1));
writer.showText(thisLine);
beforeLineWidth = thisLineWidth;
}
}
writer.endText();
} catch (IOException e) {
throw new RuntimeException("PDF 파일 출력 중 오류가 발생하였습니다."+e);
}
}
/**
* , (pt) .
*/
public float calcTextWidth(PDType0Font font, int fontSize, String text) {
try {
return (font.getStringWidth(text) / 1000.0f) * fontSize;
} catch (IOException e) {
throw new RuntimeException("PDF 파일 출력 중 오류가 발생하였습니다.");
}
}
/**
* .
*/
public String[] splitByLineForLargeText(PDType0Font font, int fontSize, String allText, float textAreaWidth_pt) {
float allTextWidth = calcTextWidth(font, fontSize, allText);
if(allText.equals("") || allText.length() == 1 || textAreaWidth_pt == 0
|| (allTextWidth <= textAreaWidth_pt)
) {
return new String[] { allText };
}
ArrayList<String> textList = new ArrayList<String>();
while(!allText.equals("")) {
int lengthForLine = this.getLengthForLine(font, fontSize, allText, textAreaWidth_pt);
String newLine = allText.substring(0,lengthForLine);
textList.add(newLine);
allText = allText.substring(lengthForLine);
}
return textList.toArray(new String[textList.size()]);
}
/**
* .
*/
private int getLengthForLine(PDType0Font font, int fontSize, String allText, float textAreaWidth_pt) {
int forLine = allText.length();
if(forLine <= 1) {
return forLine;
};
for( ; ; forLine--) {
if(forLine == 1) {
break;
}
boolean hit = ( this.calcTextWidth(font, fontSize, allText.substring(0, forLine)) <= textAreaWidth_pt );
if(hit) {
break;
}
}
return forLine;
}
/**
* pdf .
*/
public void insertImage(PDFWriter writer, InputStream imageStream, float[] XYmm,
float[] SIZEmm) {
float[] xyAbsolute = this.toPDFCoordinate(XYmm).absolute();
float[] size = new float[] {
CmmnUtil.mmToPt(SIZEmm[0]),CmmnUtil.mmToPt(SIZEmm[1])
};
try {
writer.image(imageStream, xyAbsolute[0], xyAbsolute[1]-size[1], size[0], size[1]);
} catch (IOException e) {
throw new RuntimeException("PDF 파일 출력 중 오류가 발생하였습니다."+e);
}
}
public List<PstnAndSize> devideImageArea(float[] totAreaPstn, float[] totAreaSize, int imageCntSetting, int dataImageCnt) {
List<PstnAndSize> result = new ArrayList<PstnAndSize>();
int printable = imageCntSetting <= dataImageCnt ? imageCntSetting : dataImageCnt;
if(printable <= 1) {
result.add(new PstnAndSize(totAreaPstn[0], totAreaPstn[1], totAreaSize[0], totAreaSize[1]));
return result;
}
boolean longerThenWidth = totAreaSize[1] > totAreaSize[0];
int xLengthOfD2 = 0;
int yLengthOfD2 = 0;
if(printable == 2){
if(longerThenWidth) {
xLengthOfD2 = 1;
yLengthOfD2 = 2;
} else {
xLengthOfD2 = 2;
yLengthOfD2 = 1;
}
} else if(printable == 3 || printable == 4){
xLengthOfD2 = 2;
yLengthOfD2 = 2;
} else if(printable == 5 || printable == 6){
if(longerThenWidth) {
xLengthOfD2 = 2;
yLengthOfD2 = 3;
} else {
xLengthOfD2 = 3;
yLengthOfD2 = 2;
}
} else {
throw new RuntimeException("PDF 파일 출력 중 오류가 발생하였습니다.");
}
PstnAndSize[][] d2Array = new PstnAndSize[xLengthOfD2][yLengthOfD2];
Size cellSize = new Size(totAreaSize[0] / (xLengthOfD2 * 1.0f), totAreaSize[1] / (yLengthOfD2 * 1.0f));
d2Array[0][0] = new PstnAndSize(totAreaPstn[0], totAreaPstn[1], cellSize.getWidth(), cellSize.getHeight());
d2Array = this.fillImageCells(d2Array);
//출력영역 크기 병합
if(printable == 3 || printable == 5) {
boolean longerThenWidth_cell = cellSize.getHeight() > cellSize.getWidth();
if(longerThenWidth_cell) {
d2Array = this.mergeLastImageCell(d2Array, "left");
} else {
d2Array = this.mergeLastImageCell(d2Array, "up");
}
}
for(int y=0; y < yLengthOfD2; y++) {
for(int x=0; x < xLengthOfD2; x++) {
if(d2Array[x][y] != null) {
result.add(d2Array[x][y]);
}
}
}
return result;
}
private PstnAndSize[][] fillImageCells(PstnAndSize[][] d2) {
int xLengthOfD2 = d2.length;
int yLengthOfD2 = d2[0].length;
PstnAndSize firstCell = d2[0][0];
Size cellSize = firstCell.getSize();
float cellWidth = cellSize.getWidth();
float cellHeight = cellSize.getHeight();
Pstn startPoint = firstCell.getPstn();
float spX = startPoint.getLeft();
float spY = startPoint.getTop();
for(int x=0; x < xLengthOfD2; x++) {
for(int y=0; y < yLengthOfD2; y++) {
if(x != 0 || y != 0) {
d2[x][y] = new PstnAndSize(spX + (cellWidth * (x * 1.0f)), spY + (cellHeight * (y * 1.0f)), cellSize);
}
}
}
return d2;
}
public PstnAndSize[][] mergeLastImageCell(PstnAndSize[][] d2, String mergeDirection) {
if(!mergeDirection.equals("up") && !mergeDirection.equals("left")) {
throw new RuntimeException("PDF 파일 출력 중 오류가 발생하였습니다.");
}
int xLengthOfD2 = d2.length;
int yLengthOfD2 = d2[0].length;
int lastCellIndexX = xLengthOfD2-1;
int lastCellIndexY = yLengthOfD2-1;
int mergeTargetCellIndexX = 0;
int mergeTargetCellIndexY = 0;
if(mergeDirection.equals("up")) {
mergeTargetCellIndexX = lastCellIndexX;
mergeTargetCellIndexY = lastCellIndexY-1;
}
if(mergeDirection.equals("left")) {
mergeTargetCellIndexX = lastCellIndexX-1;
mergeTargetCellIndexY = lastCellIndexY;
}
//병합대상셀
if(mergeDirection.equals("up")) {
d2[mergeTargetCellIndexX][mergeTargetCellIndexY] = (d2[mergeTargetCellIndexX][mergeTargetCellIndexY]).x2Height();
}
if(mergeDirection.equals("left")) {
d2[mergeTargetCellIndexX][mergeTargetCellIndexY] = (d2[mergeTargetCellIndexX][mergeTargetCellIndexY]).x2Width();
}
//마지막셀
d2[lastCellIndexX][lastCellIndexY] = null;
return d2;
}
/**
* pdf .
*/
public void renderFoldLine(PDFWriter writer, String foldCode) {
if(foldCode.equals("") && !foldCode.equals("01") && !foldCode.equals("02")) {
return;
}
float paperWidth = writer.getPaperSize().getWidth();
float partHeight;
if(foldCode.equals("01")) {
if(PDRectangle.A4.equals(writer.getPaperSize())) {
partHeight = 99;
} else {
partHeight = 93;
}
} else {
partHeight = 93;
}
float margin = 0;
if(foldCode.equals("02")) {
margin = 18;
}
float bottomFold = margin + partHeight; //하단접는곳
float topFold = margin + (partHeight * 2); //상단접는곳
float bottomFold_pt = CmmnUtil.mmToPt(bottomFold);
float topFold_pt = CmmnUtil.mmToPt(topFold);
try {
writer.setLineDashPattern(new float[]{3,1}, 0);
writer.moveTo(0, topFold_pt);
writer.lineTo(paperWidth, topFold_pt);
writer.stroke();
writer.moveTo(0, bottomFold_pt);
writer.lineTo(paperWidth, bottomFold_pt);
writer.stroke();
writer.setLineDashPattern(new float[]{}, 0);
} catch (IOException e) {
throw new RuntimeException("PDF 파일 출력 중 오류가 발생하였습니다."+e);
}
}
public float[] getPstnStng(DefaultOtptArtclStng prototypeStng, DataObject sggStng, String paperSeCd) {
if(!sggStng.string("LEFT_PSTN").equals("") && !sggStng.string("TOP_PSTN").equals("")) {
return new float[] {
sggStng.number("LEFT_PSTN").floatValue(),
sggStng.number("TOP_PSTN").floatValue()
};
} else {
return new float[] {
prototypeStng.getLeftPstn(paperSeCd),
prototypeStng.getTopPstn(paperSeCd)
};
}
}
public PDType0Font getFontType(DefaultOtptArtclStng prototypeStng, DataObject sggStng, Map<String, PDType0Font> fontMap) {
if(sggStng != null && !sggStng.isEmpty() && !sggStng.string("FONT_NM").equals("")) {
return fontMap.get(sggStng.string("FONT_NM"));
} else {
return fontMap.get(prototypeStng.getFontNm());
}
}
public int getFontSize(DefaultOtptArtclStng prototypeStng, DataObject sggStng) {
if(!sggStng.string("FONT_SZ").equals("")) {
return sggStng.number("FONT_SZ").intValue();
} else {
return prototypeStng.getFontSz();
}
}
public RenderingMode getFontStyle(DefaultOtptArtclStng prototypeStng, DataObject sggStng) {
if(!sggStng.string("FONT_STYLE").equals("")) {
return RenderingMode.valueOf(sggStng.string("FONT_STYLE"));
} else {
return RenderingMode.valueOf(prototypeStng.getFontStyle());
}
}
public PDColor getFontColor(DefaultOtptArtclStng prototypeStng, DataObject sggStng) {
if(!sggStng.string("FONT_COLR").equals("")) {
return PDFColors.getColor(sggStng.string("FONT_COLR"));
} else {
return PDFColors.getColor(prototypeStng.getFontColr());
}
}
public float[] getSize(DefaultOtptArtclStng prototypeStng, DataObject sggStng) {
if(!sggStng.string("WIDTH_SZ").equals("")) {
return new float[] {
sggStng.number("WIDTH_SZ").floatValue(),
sggStng.number("HEIGHT_SZ").floatValue()
};
} else {
return new float[] {
prototypeStng.getWidthSz(),
prototypeStng.getHeightSz()
};
}
}
public String getAlign(DefaultOtptArtclStng prototypeStng, DataObject sggStng) {
if(!sggStng.string("TEXT_SORT").equals("")) {
return sggStng.string("TEXT_SORT");
} else {
return prototypeStng.getTextSort();
}
}
public String getLineChgYn(DefaultOtptArtclStng prototypeStng, DataObject sggStng) {
if(!sggStng.string("LINE_CHG_YN").equals("")) {
return sggStng.string("LINE_CHG_YN");
} else {
return prototypeStng.getLineChgYn();
}
}
public Map<String, PDType0Font> getFontMap(PDFWriter writer) {
try {
Map<String, PDType0Font> fontMap = Map.of(
"gulim", writer.font("fonts/gulim.ttf"),
"gulimche", writer.font("fonts/gulimche.ttf"),
"batang", writer.font("fonts/batang.ttf"),
"batangche", writer.font("fonts/batangche.ttf"),
"dotum", writer.font("fonts/dotum.ttf"),
"dotumche", writer.font("fonts/dotumche.ttf"),
"gungsuh", writer.font("fonts/gungsuh.ttf"),
"gungsuhche", writer.font("fonts/gungsuhche.ttf")
);
return fontMap;
} catch (IOException e) {
throw new RuntimeException("글꼴 로드 오류"+e);
}
}
}

@ -1,49 +0,0 @@
package cokr.xit.fims.cmmn.service;
import java.util.List;
import cokr.xit.fims.cmmn.CrdnPayerHstry;
import cokr.xit.fims.cmmn.CrdnPayerHstryQuery;
import cokr.xit.foundation.data.DataObject;
/** .
*
* <p> :
*
* <pre>
* ============ ============
* 2023-08-16 leebj
* ================================
* </pre>
*/
public interface CrdnPayerHstryService {
/** .
* @param req
* @return
*/
List<DataObject> getCrdnPayerHstryList(CrdnPayerHstryQuery req);
/** .
* @param req
* @return
*/
List<CrdnPayerHstry> getCrdnPayerHstrys(CrdnPayerHstryQuery req);
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean create(CrdnPayerHstry crdnPayerHstry);
/** , .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean createHstryUpdateCrdnPayer(CrdnPayerHstry crdnPayerHstry);
}

@ -1,60 +0,0 @@
package cokr.xit.fims.cmmn.service;
import java.util.List;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.fims.cmmn.CrdnSttsHstry;
import cokr.xit.fims.cmmn.CrdnSttsHstryQuery;
/** .
*
* <p> :
*
* <pre>
* ============ ============
* 2023-07-19 JoJH
* ================================
* </pre>
*/
public interface CrdnSttsHstryService {
/** .
* @param req
* @return
*/
List<DataObject> getCrdnSttsHstryList(CrdnSttsHstryQuery req);
/** .
* @param req
* @return
*/
List<DataObject> getCrdnSttsHstrys(CrdnSttsHstryQuery req);
/** .
* @param crdnSttsHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean create(CrdnSttsHstry crdnSttsHstry);
/** .
* @param crdnSttsHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean update(CrdnSttsHstry crdnSttsHstry);
/** .
* @param crdnSttsHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean remove(CrdnSttsHstry crdnSttsHstry);
}

@ -1,5 +0,0 @@
package cokr.xit.fims.cmmn.service;
public interface LinkService {
String insertElectronicNoticeSndng(String filePath, String sggCd, String taskSeCd, String tmplatId);
}

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

@ -1,137 +0,0 @@
package cokr.xit.fims.cmmn.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.fims.cmmn.CrdnPayerHstry;
import cokr.xit.fims.cmmn.CrdnPayerHstryQuery;
import cokr.xit.fims.cmmn.dao.CrdnPayerHstryMapper;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
/** Bean
*
* <p> :
*
* <pre>
* ============ ============
* 2023-08-16 leebj
* ================================
* </pre>
*/
@Component("crdnPayerHstryBean")
public class CrdnPayerHstryBean extends AbstractBean {
/** 단속 납부자 이력 정보 DAO */
@Resource(name = "crdnPayerHstryMapper")
private CrdnPayerHstryMapper crdnPayerHstryMapper;
/** .
* @param req
* @return
*/
public List<DataObject> getCrdnPayerHstryList(CrdnPayerHstryQuery req) {
return crdnPayerHstryMapper.selectCrdnPayerHstryList(req);
}
/** .
* @param req
* @return
*/
public List<CrdnPayerHstry> getCrdnPayerHstrys(CrdnPayerHstryQuery req) {
return crdnPayerHstryMapper.selectCrdnPayerHstrys(req);
}
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean createCrdnPayerHstry(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstryMapper.insertCrdnPayerHstry(crdnPayerHstry);
}
/** .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean createCrdnPayerAddrHstry(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstryMapper.insertCrdnPayerAddrHstry(crdnPayerHstry);
}
/** , .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean updateCrdnPayer(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstryMapper.updateCrdnPayer(crdnPayerHstry);
}
/** , .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean createHstryUpdateCrdnPayer(CrdnPayerHstry crdnPayerHstry) {
boolean rtnScs = false; // DB 처리 결과
// 단속 납부자 이력 정보를 등록한다.
rtnScs = createCrdnPayerHstry(crdnPayerHstry);
if (!rtnScs) {
throw new RuntimeException("단속 납부자 이력 정보를 등록 중 오류가 발생하였습니다."); // 예외를 발생시켜서 DB Rollback
}
// 단속 납부자 주소 이력 정보를 등록한다.
rtnScs = createCrdnPayerAddrHstry(crdnPayerHstry);
if (!rtnScs) {
throw new RuntimeException("단속 납부자 이력 정보를 등록 중 오류가 발생하였습니다."); // 예외를 발생시켜서 DB Rollback
}
// 단속 대장의 납부자 ID, 주소 일련번호를 변경한다.
rtnScs = updateCrdnPayer(crdnPayerHstry);
if (!rtnScs) {
throw new RuntimeException("단속 납부자 이력 정보를 등록 중 오류가 발생하였습니다."); // 예외를 발생시켜서 DB Rollback
}
return rtnScs;
}
/** , .
* @param crdnPayerHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean createHstryUpdateCrdnPayerAddr(CrdnPayerHstry crdnPayerHstry) {
boolean rtnScs = false; // DB 처리 결과
// 단속 납부자 주소 이력 정보를 등록한다.
rtnScs = createCrdnPayerAddrHstry(crdnPayerHstry);
if (!rtnScs) {
throw new RuntimeException("단속 납부자 이력 정보를 등록 중 오류가 발생하였습니다."); // 예외를 발생시켜서 DB Rollback
}
// 단속 대장의 납부자 ID, 주소 일련번호를 변경한다.
rtnScs = updateCrdnPayer(crdnPayerHstry);
if (!rtnScs) {
throw new RuntimeException("단속 납부자 이력 정보를 등록 중 오류가 발생하였습니다."); // 예외를 발생시켜서 DB Rollback
}
return rtnScs;
}
}

@ -1,50 +0,0 @@
package cokr.xit.fims.cmmn.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cokr.xit.fims.cmmn.CrdnPayerHstry;
import cokr.xit.fims.cmmn.CrdnPayerHstryQuery;
import cokr.xit.fims.cmmn.service.CrdnPayerHstryService;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
/** .
*
* <p> :
*
* <pre>
* ============ ============
* 2023-08-16 leebj
* ================================
* </pre>
*/
@Service("crdnPayerHstryService")
public class CrdnPayerHstryServiceBean extends AbstractServiceBean implements CrdnPayerHstryService {
/** 단속 납부자 이력 정보 Bean */
@Resource(name = "crdnPayerHstryBean")
private CrdnPayerHstryBean crdnPayerHstryBean;
@Override
public List<DataObject> getCrdnPayerHstryList(CrdnPayerHstryQuery req) {
return crdnPayerHstryBean.getCrdnPayerHstryList(req);
}
@Override
public List<CrdnPayerHstry> getCrdnPayerHstrys(CrdnPayerHstryQuery req) {
return crdnPayerHstryBean.getCrdnPayerHstrys(req);
}
@Override
public boolean create(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstryBean.createCrdnPayerHstry(crdnPayerHstry);
}
@Override
public boolean createHstryUpdateCrdnPayer(CrdnPayerHstry crdnPayerHstry) {
return crdnPayerHstryBean.createHstryUpdateCrdnPayer(crdnPayerHstry);
}
}

@ -1,224 +0,0 @@
package cokr.xit.fims.cmmn.service.bean;
import java.text.SimpleDateFormat;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.fims.cmmn.CrdnSttsHstry;
import cokr.xit.fims.cmmn.CrdnSttsHstryQuery;
import cokr.xit.fims.cmmn.dao.CrdnSttsHstryMapper;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
/** Bean
*
* <p> :
*
* <pre>
* ============ ============
* 2023-07-19 JoJH
* ================================
* </pre>
*/
@Component("crdnSttsHstryBean")
public class CrdnSttsHstryBean extends AbstractBean {
/** 단속 상태 이력 정보 DAO */
@Resource(name = "crdnSttsHstryMapper")
private CrdnSttsHstryMapper crdnSttsHstryMapper;
/** .
* @param req
* @return
*/
public List<DataObject> getCrdnSttsHstryList(CrdnSttsHstryQuery req) {
return crdnSttsHstryMapper.selectCrdnSttsHstryList(req);
}
/** .
* @param req
* @return
*/
public List<DataObject> getCrdnSttsHstrys(CrdnSttsHstryQuery req) {
return crdnSttsHstryMapper.selectCrdnSttsHstrys(req);
}
/** ID .
* @param crdnId ID
* @return
*/
public DataObject getCrdnSttsHstryInfo(String crdnId, String crdnSttsCd, String useYn) {
return crdnSttsHstryMapper.selectCrdnSttsHstryInfo(crdnId, crdnSttsCd, useYn);
}
/** .
* @param crdnSttsHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean create(CrdnSttsHstry crdnSttsHstry) {
if (crdnSttsHstry.getUseYn() == null) {
crdnSttsHstry.setUseYn("Y");
}
return crdnSttsHstryMapper.insertCrdnSttsHstry(crdnSttsHstry) == 1;
}
/** .
* @param crdnSttsHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean update(CrdnSttsHstry crdnSttsHstry) {
return crdnSttsHstryMapper.updateCrdnSttsHstry(crdnSttsHstry) == 1;
}
/** . ID .
* @param crdnSttsHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean remove(CrdnSttsHstry crdnSttsHstry) {
return crdnSttsHstryMapper.deleteCrdnSttsHstry(crdnSttsHstry) >= 1;
}
/** .
* @param excl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean updateCrdn(CrdnSttsHstry crdnSttsHstry) {
return crdnSttsHstryMapper.updateCrdnSttsCd(crdnSttsHstry) == 1;
}
/** , .
* @param crdnSttsHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean createHstryUpdateCrdnSttsCd(CrdnSttsHstry crdnSttsHstry) {
// 변수 선언
int rtnNocs = -1;
// 사용 여부
if (crdnSttsHstry.getUseYn() == null) {
crdnSttsHstry.setUseYn("Y");
}
// 단속 상태 변경 일시
if (crdnSttsHstry.getCrdnSttsChgDt() == null || crdnSttsHstry.getCrdnSttsChgDt().equals("")) {
// 현재 날짜 구하기
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
crdnSttsHstry.setCrdnSttsChgDt(dateFormat.format(System.currentTimeMillis()));
}
// 단속상태이력(TB_CRDN_STTS_HSTRY) 대장을 등록한다.
rtnNocs = crdnSttsHstryMapper.insertCrdnSttsHstry(crdnSttsHstry);
if (rtnNocs != 1) {
throw new RuntimeException("단속상태이력 대장 등록에 실패하였습니다."); // 예외를 발생시켜서 DB Rollback
}
// 단속(TB_CRDN) 대장을 수정한다.
rtnNocs = crdnSttsHstryMapper.updateCrdnSttsCd(crdnSttsHstry);
if (rtnNocs != 1) {
throw new RuntimeException("단속상태이력 정보 등록 중 오류가 발생하였습니다."); // 예외를 발생시켜서 DB Rollback
}
return true;
}
/** , .
* @param crdnSttsHstry
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean removeHstryUpdateCrdnSttsCd(String crdnId, String crdnSttsCd, String deltSttsCd, String deltEtcCn, boolean insertBfrSttsYn) {
// 변수 선언
int rtnNocs = -1;
// 단속 ID에 해당하는 단속상태코드의 단속상태이력(TB_CRDN_STTS_HSTRY) 대장을 조회 한다.
DataObject crdnSttsHstryInfo = crdnSttsHstryMapper.selectCrdnSttsHstryInfo(crdnId, crdnSttsCd, "Y");
if (crdnSttsHstryInfo == null) {
throw new RuntimeException("단속상태이력 자료가 존재하지 않습니다."); // 예외를 발생시켜서 DB Rollback
}
if (!crdnSttsCd.equals("")) {
CrdnSttsHstry crdnSttsHstry = new CrdnSttsHstry();
crdnSttsHstry.setSttsHstryId(crdnSttsHstryInfo.string("STTS_HSTRY_ID"));
crdnSttsHstry.setUseYn("N");
rtnNocs = crdnSttsHstryMapper.updateCrdnSttsHstry(crdnSttsHstry);
if (rtnNocs != 1) {
throw new RuntimeException("단속상태이력 대장에 이력 수정에 실패하였습니다."); // 예외를 발생시켜서 DB Rollback
}
}
// 삭제 단속상태코드가 있다면.. 단속상태이력(TB_CRDN_STTS_HSTRY) 대장을 등록한다.
if (!deltSttsCd.equals("")) {
// 단속상태가 의견제출접수(31)가 아니면서, 삭제상태코드가 의견제출삭제(92)나 경찰서이첩삭제(97) 일 경우
if (!crdnSttsCd.equals("31") && "92,97".contains(deltSttsCd)) {
// 단속상태이력(TB_CRDN_STTS_HSTRY) 대장에서 의견제출접수(31) 이력을 조회후 사용여부를 미사용("N")으로 수정.
crdnSttsHstryInfo = crdnSttsHstryMapper.selectCrdnSttsHstryInfo(crdnId, "31", "Y");
if (crdnSttsHstryInfo == null) {
throw new RuntimeException("단속상태이력에 의견제출 접수 이력이 존재하지 않습니다."); // 예외를 발생시켜서 DB Rollback
}
CrdnSttsHstry opnnSttsHstry = new CrdnSttsHstry();
opnnSttsHstry.setSttsHstryId(crdnSttsHstryInfo.string("STTS_HSTRY_ID"));
opnnSttsHstry.setUseYn("N");
rtnNocs = crdnSttsHstryMapper.updateCrdnSttsHstry(opnnSttsHstry);
if (rtnNocs != 1) {
throw new RuntimeException("단속상태이력 대장에 의견제출접수 이력 수정에 실패하였습니다."); // 예외를 발생시켜서 DB Rollback
}
}
CrdnSttsHstry deleteSttsHstry = new CrdnSttsHstry();
deleteSttsHstry.setCrdnId(crdnSttsHstryInfo.string("CRDN_ID"));
deleteSttsHstry.setBfrSttsCd(crdnSttsHstryInfo.string("CRDN_STTS_CD"));
deleteSttsHstry.setBfrSttsChgDt(crdnSttsHstryInfo.string("REG_DT"));
deleteSttsHstry.setCrdnSttsCd(deltSttsCd);
deleteSttsHstry.setEtcCn(deltEtcCn);
deleteSttsHstry.setUseYn("N");
rtnNocs = crdnSttsHstryMapper.insertCrdnSttsHstry(deleteSttsHstry);
if (rtnNocs != 1) {
throw new RuntimeException("삭제 단속상태이력 정보 등록 중 오류가 발생하였습니다."); // 예외를 발생시켜서 DB Rollback
}
}
if (insertBfrSttsYn) {
// 단속상태이력(TB_CRDN_STTS_HSTRY) 대장을 등록한다.
CrdnSttsHstry crdnSttsHstry = new CrdnSttsHstry();
crdnSttsHstry.setCrdnId(crdnSttsHstryInfo.string("CRDN_ID"));
crdnSttsHstry.setBfrSttsCd(deltSttsCd);
crdnSttsHstry.setBfrSttsChgDt(crdnSttsHstry.getCreatedAt());
crdnSttsHstry.setCrdnSttsCd(crdnSttsHstryInfo.string("BFR_STTS_CD"));
crdnSttsHstry.setCrdnSttsChgDt(crdnSttsHstryInfo.string("BFR_STTS_CHG_DT"));
crdnSttsHstry.setUseYn("Y");
boolean rtnScs = createHstryUpdateCrdnSttsCd(crdnSttsHstry);
if (!rtnScs) {
throw new RuntimeException("단속상태이력 정보 등록 중 오류가 발생하였습니다."); // 예외를 발생시켜서 DB Rollback
}
}
return true;
}
}

@ -1,58 +0,0 @@
package cokr.xit.fims.cmmn.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.fims.cmmn.CrdnSttsHstry;
import cokr.xit.fims.cmmn.CrdnSttsHstryQuery;
import cokr.xit.fims.cmmn.service.CrdnSttsHstryService;
/** .
*
* <p> :
*
* <pre>
* ============ ============
* 2023-07-19 JoJH
* ================================
* </pre>
*/
@Service("crdnSttsHstryService")
public class CrdnSttsHstryServiceBean extends AbstractServiceBean implements CrdnSttsHstryService {
/** 단속 상태 이력 정보 Bean */
@Resource(name = "crdnSttsHstryBean")
private CrdnSttsHstryBean crdnSttsHstryBean;
@Override
public List<DataObject> getCrdnSttsHstryList(CrdnSttsHstryQuery req) {
return crdnSttsHstryBean.getCrdnSttsHstryList(req);
}
@Override
public List<DataObject> getCrdnSttsHstrys(CrdnSttsHstryQuery req) {
return crdnSttsHstryBean.getCrdnSttsHstrys(req);
}
@Override
public boolean create(CrdnSttsHstry crdnSttsHstry) {
return crdnSttsHstryBean.create(crdnSttsHstry);
}
@Override
public boolean update(CrdnSttsHstry crdnSttsHstry) {
return crdnSttsHstryBean.update(crdnSttsHstry);
}
@Override
public boolean remove(CrdnSttsHstry crdnSttsHstry) {
return crdnSttsHstryBean.remove(crdnSttsHstry);
}
}

@ -1,129 +0,0 @@
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.fims.cmmn.ExtrArtclStng;
import cokr.xit.fims.cmmn.ExtrForm;
import cokr.xit.fims.cmmn.ExtrStngQuery;
import cokr.xit.fims.cmmn.PredefinedSet;
import cokr.xit.fims.cmmn.dao.ExtrStngMapper;
import cokr.xit.fims.cmmn.pdf.extraction.format.ElectronicNotice;
import cokr.xit.fims.cmmn.pdf.extraction.format.PDFExtractFormat;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
@Component("extrStngBean")
public class ExtrStngBean extends AbstractBean {
@Resource(name = "extrStngMapper")
private ExtrStngMapper extrStngMapper;
/** 릿 .
* @param query
* @return
*/
public DataObject getExtrBscStng(ExtrStngQuery extrStngQuery) {
return extrStngMapper.selectExtrBscStng(extrStngQuery);
}
/** .
* @param query
* @return
*/
public Map<String, Object> getExtrArtclStngMap(ExtrStngQuery query){
Map<String,Object> extrStngMap = new HashMap<String,Object>();
PDFExtractFormat pdfFormat = null;
pdfFormat = new ElectronicNotice();
List<DataObject> extrArtclStngList = extrStngMapper.selectExtrArtclStngList(query);
if(extrArtclStngList == null) {
extrArtclStngList = new ArrayList<DataObject>();
}
pdfFormat.appendPredefinedYn(extrArtclStngList);
List<PredefinedSet> predefinedSetList = pdfFormat.getPredefinedSetList();
List<DataObject> predefinedDataList = extrArtclStngList.stream().filter(item -> item.string("PREDEFINED_YN").equals("Y")).toList();
List<DataObject> customDataList = extrArtclStngList.stream().filter(item -> item.string("PREDEFINED_YN").equals("N")).toList();
Map<String, Object> predefined = new HashMap<String,Object>();
predefined.put("dataList", predefinedDataList);
Map<String, Object> custom = new HashMap<String,Object>();
custom.put("dataList", customDataList);
extrStngMap.put("predefinedSetList", predefinedSetList);
extrStngMap.put("predefined", predefined);
extrStngMap.put("custom", custom);
return extrStngMap;
}
public boolean saveExtrBscStng(ExtrForm extrForm) {
boolean result = false;
String userId = currentUser().getId();
if(ifEmpty(extrForm.getExtrBscId(), ()-> "").equals("")) {
extrForm.setCreatedBy(userId);
result = extrStngMapper.insertBscStng(extrForm) == 1 ? true : false;
} else {
extrForm.setModifiedBy(userId);
result = extrStngMapper.updateBscStng(extrForm) == 1 ? true : false;
}
return result;
}
public boolean saveExtrArtclStng(ExtrForm extrForm) {
try {
String userId = currentUser().getId();
List<ExtrArtclStng> extrArtclStngList = extrForm.getExtrArtclStngList();
List<String> updateKeyList = new ArrayList<String>();
List<ExtrArtclStng> insertList = new ArrayList<ExtrArtclStng>();
if(extrArtclStngList != null && !extrArtclStngList.isEmpty()) {
List<ExtrArtclStng> updateList = extrArtclStngList.stream().filter(item -> !ifEmpty(item.getExtrFormId(), () -> "").equals("")).toList();
if(!updateList.isEmpty()) {
for(ExtrArtclStng update : updateList) {
update.setModifiedBy(userId);
extrStngMapper.updateArtclStng(update);
updateKeyList.add(update.getExtrFormId());
}
}
insertList = extrArtclStngList.stream().filter(item -> ifEmpty(item.getExtrFormId(), () -> "").equals("")).toList();
}
if(!updateKeyList.isEmpty()) {
extrForm.setExtrFormIDs(updateKeyList.toArray(new String[updateKeyList.size()]));
}
extrForm.setModifiedBy(userId);
extrStngMapper.deleteArtclStng(extrForm);
if(!insertList.isEmpty()) {
for(ExtrArtclStng insert : insertList) {
insert.setCreatedBy(userId);
extrStngMapper.insertArtclStng(insert);
}
}
} catch (Exception e) {
throw new RuntimeException("[F]추출 설정 저장 중 오류가 발생하였습니다.");
}
return true;
}
}

@ -1,75 +0,0 @@
package cokr.xit.fims.cmmn.service.bean;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.fims.cmmn.dao.LinkMapper;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
@Component("linkBean")
public class LinkBean extends AbstractBean {
@Resource(name = "linkMapper")
private LinkMapper linkMapper;
public boolean insertElectronicNoticeSndng(DataObject masterInfo, List<DataObject> detailInfos) {
int effected = linkMapper.insertElectronicNoticeSndngMaster(masterInfo);
if(effected != 1) {
throw new RuntimeException("발송 마스터 등록 오류");
}
effected = 0;
for(int i=0; i < detailInfos.size(); i++) {
detailInfos.get(i).set("unitySndngMastrId", masterInfo.string("unitySndngMastrId"));
effected = linkMapper.insertElectronicNoticeSndngDetail(detailInfos.get(i));
if(effected != 1) {
throw new RuntimeException("발송 상세 등록 오류");
}
}
if(effected != 1) {
throw new RuntimeException("발송 상세 등록 오류");
}
return true;
}
public String makeJson(String jsonTemplate, Map<String, String> extractedText, List<String> crdnPhotoBase64) {
String result = jsonTemplate;
Iterator<String> it = extractedText.keySet().iterator();
while(it.hasNext()) {
String key = it.next();
String value = extractedText.get(key);
result = result.replaceAll("^##"+key+"##$", value);
}
int i=0;
if(result.contains("##photo0##")) {
boolean flag = true;
while(flag) {
String value = "";
if((i+1) <= crdnPhotoBase64.size()) {
value = crdnPhotoBase64.get(i);
}
result = result.replaceAll("^##photo"+i+"##$", value);
i++;
if(!result.contains("##photo"+i+"##")) {
flag = false;
}
}
}
return result;
}
}

@ -1,82 +0,0 @@
package cokr.xit.fims.cmmn.service.bean;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cokr.xit.fims.cmmn.ExtrStngQuery;
import cokr.xit.fims.cmmn.dao.ExtrStngMapper;
import cokr.xit.fims.cmmn.pdf.extraction.Extraction;
import cokr.xit.fims.cmmn.pdf.extraction.PDFExtractionUtil;
import cokr.xit.fims.cmmn.service.LinkService;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
@Service("linkService")
public class LinkServiceBean extends AbstractServiceBean implements LinkService {
@Resource(name = "linkBean")
private LinkBean linkBean;
@Resource(name = "extrStngMapper")
private ExtrStngMapper extrStngMapper;
@Override
public String insertElectronicNoticeSndng(String filePath, String sggCd, String taskSeCd, String tmplatId) {
ExtrStngQuery extrStngQuery = new ExtrStngQuery();
extrStngQuery.setSggCd(sggCd).setTaskSeCd(taskSeCd);
extrStngQuery.setTmplatId(tmplatId);
List<DataObject> extractStngs = extrStngMapper.selectExtrArtclStngList(extrStngQuery);
List<Extraction> extractionInfos = PDFExtractionUtil.extract(filePath, extractStngs);
for(int i=0; i < extractionInfos.size(); i++) {
Map<String, String> extractedText = extractionInfos.get(i).getTextItem();
List<String> crdnPhotoBase64 = extractionInfos.get(i).getBase64List();
//마스터
DataObject masterInfo = new DataObject();
masterInfo.set("signguCode", sggCd);
masterInfo.set("ffnlgCode", taskSeCd);
masterInfo.set("tmplatId", tmplatId);
masterInfo.set("sndngCo", extractionInfos.size());
masterInfo.set("sndngDt", extractedText.get("sndngDt")); //발송일시
masterInfo.set("closDt", extractedText.get("closDt")); //마감일시
//디테일
DataObject detailInfo = new DataObject();
detailInfo.set("signguCode", sggCd);
detailInfo.set("ffnlgCode", taskSeCd);
detailInfo.set("vhcleNo", extractedText.get("vhcleNo"));
detailInfo.set("ihidnum", extractedText.get("ihidnum"));
detailInfo.set("moblphonNo", extractedText.get("moblphonNo"));
detailInfo.set("nm", extractedText.get("nm"));
detailInfo.set("adres", extractedText.get("adres"));
detailInfo.set("detailAdres", extractedText.get("detailAdres"));
detailInfo.set("zip", extractedText.get("zip"));
//템플릿메시지데이터
detailInfo.set("tmpltMsgData", "");
//모바일페이지
String jsonTemplate = extrStngMapper.selectExtrBscStng(extrStngQuery).string("MOBILE_PAGE_TMPLT");
String json = linkBean.makeJson(jsonTemplate, extractedText, crdnPhotoBase64);
detailInfo.set("mobilePageCn", json);
//
detailInfo.set("mainCode", "");
//
detailInfo.set("useInsttIdntfcId", "");
//테이블 인서트
linkBean.insertElectronicNoticeSndng(masterInfo, List.of(detailInfo));
}
return "[S]";
}
}

@ -1,146 +0,0 @@
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.fims.cmmn.OtptArtclStng;
import cokr.xit.fims.cmmn.OtptForm;
import cokr.xit.fims.cmmn.OtptStngQuery;
import cokr.xit.fims.cmmn.dao.OtptStngMapper;
import cokr.xit.fims.cmmn.pdf.print.DefaultOtptArtclStng;
import cokr.xit.fims.cmmn.pdf.print.format.Advntce;
import cokr.xit.fims.cmmn.pdf.print.format.Nht;
import cokr.xit.fims.cmmn.pdf.print.format.PDFPrintFormat;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
@Component("otptStngBean")
public class OtptStngBean extends AbstractBean {
@Resource(name = "otptStngMapper")
private OtptStngMapper otptStngMapper;
/** .
* @param query
* @return
*/
public DataObject getOtptBscStng(OtptStngQuery otptStngQuery) {
return otptStngMapper.selectOtptBscStng(otptStngQuery);
}
/** .
* @param query
* @return
*/
public Map<String, Object> getOtptArtclStngMap(OtptStngQuery query){
Map<String,Object> otptStngMap = new HashMap<String,Object>();
PDFPrintFormat pdfFormat = null;
switch(query.getSndngSeCd()) {
case "02" :
pdfFormat = new Advntce();
break;
case "03" :
pdfFormat = new Nht();
break;
}
List<DataObject> otptArtclStngList = otptStngMapper.selectOtptArtclStngList(query);
if(otptArtclStngList == null) {
otptArtclStngList = new ArrayList<DataObject>();
}
pdfFormat.appendOtptAttribute(otptArtclStngList);
List<DefaultOtptArtclStng> uniquePrototypeList = pdfFormat.getPrototypeStngs(true);
List<DefaultOtptArtclStng> multiplePrototypeList = pdfFormat.getPrototypeStngs(false);
List<DataObject> uniqueDataList = otptArtclStngList.stream().filter(item -> item.string("UNIQUE_YN").equals("Y")).toList();
List<DataObject> multipleDataList = otptArtclStngList.stream().filter(item -> item.string("UNIQUE_YN").equals("N")).toList();
Map<String, Object> unique = new HashMap<String,Object>();
unique.put("prototypeList", uniquePrototypeList);
unique.put("dataList", uniqueDataList);
Map<String, Object> multiple = new HashMap<String,Object>();
multiple.put("prototypeList", multiplePrototypeList);
multiple.put("dataList", multipleDataList);
otptStngMap.put("unique", unique);
otptStngMap.put("multiple", multiple);
return otptStngMap;
}
public boolean saveOtptBscStng(OtptForm otptForm) {
boolean result = false;
String userId = currentUser().getId();
if(ifEmpty(otptForm.getOtptBscId(), ()-> "").equals("")) {
otptForm.setCreatedBy(userId);
result = otptStngMapper.insertBscStng(otptForm) == 1 ? true : false;
} else {
otptForm.setModifiedBy(userId);
result = otptStngMapper.updateBscStng(otptForm) == 1 ? true : false;
}
return result;
}
/** .
* @param otptForm
* @return
*/
public boolean saveOtptArtclStng(OtptForm otptForm) {
try {
String userId = currentUser().getId();
List<OtptArtclStng> otptArtclStngList = otptForm.getOtptArtclStngList();
List<String> updateKeyList = new ArrayList<String>();
List<OtptArtclStng> insertList = new ArrayList<OtptArtclStng>();
if(otptArtclStngList != null && !otptArtclStngList.isEmpty()) {
List<OtptArtclStng> updateList = otptArtclStngList.stream().filter(item -> !ifEmpty(item.getOtptFormId(), () -> "").equals("")).toList();
if(!updateList.isEmpty()) {
for(OtptArtclStng update : updateList) {
update.setModifiedBy(userId);
otptStngMapper.updateArtclStng(update);
updateKeyList.add(update.getOtptFormId());
}
}
insertList = otptArtclStngList.stream().filter(item -> ifEmpty(item.getOtptFormId(), () -> "").equals("")).toList();
}
if(!updateKeyList.isEmpty()) {
otptForm.setOtptFormIDs(updateKeyList.toArray(new String[updateKeyList.size()]));
}
otptForm.setModifiedBy(userId);
otptStngMapper.deleteArtclStng(otptForm);
if(!insertList.isEmpty()) {
for(OtptArtclStng insert : insertList) {
insert.setCreatedBy(userId);
otptStngMapper.insertArtclStng(insert);
}
}
} catch (Exception e) {
throw new RuntimeException("출력 설정 저장 중 오류가 발생하였습니다.");
}
return true;
}
}

@ -1,111 +0,0 @@
package cokr.xit.fims.cmmn.service.bean;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.fims.cmmn.OutsourcingArtclStng;
import cokr.xit.fims.cmmn.OutsourcingFileMaker;
import cokr.xit.fims.cmmn.OutsourcingForm;
import cokr.xit.fims.cmmn.OutsourcingStngQuery;
import cokr.xit.fims.cmmn.PredefinedSet;
import cokr.xit.fims.cmmn.dao.OutsourcingStngMapper;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
@Component("outsourcingStngBean")
public class OutsourcingStngBean extends AbstractBean {
@Resource(name = "outsourcingStngMapper")
private OutsourcingStngMapper outsourcingStngMapper;
public List<DataObject> getArtclStngList(OutsourcingStngQuery query){
return outsourcingStngMapper.selectArtclStngList(query);
}
public Map<String, Object> getArtclStngMap(OutsourcingStngQuery query) {
Map<String,Object> outsourcingStngMap = new HashMap<String,Object>();
List<PredefinedSet> predefinedSetList = OutsourcingFileMaker.predifinedSetForOutsourcing();
outsourcingStngMap.put("predefinedSetList", OutsourcingFileMaker.predifinedSetForOutsourcing());
//
List<DataObject> outsourcingArtclStngList = outsourcingStngMapper.selectArtclStngList(query);
if(outsourcingArtclStngList == null) {
outsourcingArtclStngList = new ArrayList<DataObject>();
}
for(DataObject outsourcingArtclStng : outsourcingArtclStngList) {
String outsourcingArtclNm = (String) outsourcingArtclStng.get("ARTCL_NM");
Optional<PredefinedSet> optional = predefinedSetList.stream()
.filter(item -> item.getArtclNm().equals(outsourcingArtclNm)).findFirst();
if(optional.isEmpty()) {
outsourcingArtclStng.set("DSCRP", outsourcingArtclStng.get("ARTCL_NM"));
} else {
PredefinedSet predefinedSet = optional.get();
outsourcingArtclStng.set("DSCRP", predefinedSet.getArtclDscrp());
}
}
outsourcingStngMap.put("dataList", outsourcingArtclStngList);
return outsourcingStngMap;
}
/** .
* @param outsourcingForm
* @return
*/
public boolean saveOutsourcingArtclStng(OutsourcingForm outsourcingForm) {
try {
String userId = currentUser().getId();
List<OutsourcingArtclStng> outsourcingArtclStngList = outsourcingForm.getZipArtclStngList();
List<String> updateKeyList = new ArrayList<String>();
List<OutsourcingArtclStng> insertList = new ArrayList<OutsourcingArtclStng>();
if(outsourcingArtclStngList != null && !outsourcingArtclStngList.isEmpty()) {
List<OutsourcingArtclStng> updateList = outsourcingArtclStngList.stream().filter(item -> !ifEmpty(item.getOutsourcingFormId(), () -> "").equals("")).toList();
if(!updateList.isEmpty()) {
for(OutsourcingArtclStng update : updateList) {
update.setModifiedBy(userId);
outsourcingStngMapper.updateArtclStng(update);
updateKeyList.add(update.getOutsourcingFormId());
}
}
insertList = outsourcingArtclStngList.stream().filter(item -> ifEmpty(item.getOutsourcingFormId(), () -> "").equals("")).toList();
}
if(!updateKeyList.isEmpty()) {
outsourcingForm.setOutsourcingFormIDs(updateKeyList.toArray(new String[updateKeyList.size()]));
}
outsourcingForm.setModifiedBy(userId);
outsourcingStngMapper.deleteArtclStng(outsourcingForm);
if(!insertList.isEmpty()) {
for(OutsourcingArtclStng insert : insertList) {
insert.setCreatedBy(userId);
outsourcingStngMapper.insertArtclStng(insert);
}
}
} catch (Exception e) {
throw new RuntimeException("출력 설정 저장 중 오류가 발생하였습니다.");
}
return true;
}
}

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

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

@ -1,75 +0,0 @@
package cokr.xit.fims.cmmn.web;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.foundation.web.AbstractController;
import cokr.xit.fims.cmmn.CrdnPayerHstry;
import cokr.xit.fims.cmmn.CrdnPayerHstryQuery;
import cokr.xit.fims.cmmn.service.CrdnPayerHstryService;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2023-08-16 leebj
* ================================
* </pre>
*/
@RequestMapping(name = "단속 납부자 이력", value = "/crdnPayerHstry")
public class CrdnPayerHstryController extends AbstractController {
/**단속 납부자 이력 서비스*/
@Resource(name = "crdnPayerHstryService")
private CrdnPayerHstryService crdnPayerHstryService;
/** (crdnPayerHstry/crdnPayerHstry-main) .
* {@link #getCrdnPayerHstryList(CrdnPayerHstryQuery) } .
* @return /crdnPayerHstry/crdnPayerHstry-main
*/
@RequestMapping(name = "단속 납부자 이력 메인", value = "/main.do")
public ModelAndView main() {
ModelAndView mav = getCrdnPayerHstryList(new CrdnPayerHstryQuery().setPageNum(1));
mav.setViewName("/crdnPayerHstry/crdnPayerHstry-main");
return mav.addObject("crdnPayerHstryList", toJson(mav.getModel().get("crdnPayerHstryList")));
}
/** .<br />
* {@link CrdnPayerHstryService#getCrdnPayerHstryList(CrdnPayerHstryQuery)}
* @param req
* @return jsonView
* <pre><code> {
* "crdnPayerHstryList": [ ]
* "crdnPayerHstryStart":
* "crdnPayerHstryFetch":
* "crdnPayerHstryTotal":
* }</code></pre>
*/
@RequestMapping(name = "단속 납부자 이력 조회", value = "/list.do")
public ModelAndView getCrdnPayerHstryList(CrdnPayerHstryQuery req) {
List<?> result = crdnPayerHstryService.getCrdnPayerHstryList(setFetchSize(req));
return setCollectionInfo(new ModelAndView("jsonView"), result, "crdnPayerHstry");
}
/** .
* @param crdnPayerHstry
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "단속 납부자 이력 등록", value = "/create.do")
public ModelAndView create(CrdnPayerHstry crdnPayerHstry) {
boolean saved = crdnPayerHstryService.create(crdnPayerHstry);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
}

@ -1,104 +0,0 @@
package cokr.xit.fims.cmmn.web;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.foundation.web.AbstractController;
import cokr.xit.fims.cmmn.CrdnSttsHstry;
import cokr.xit.fims.cmmn.CrdnSttsHstryQuery;
import cokr.xit.fims.cmmn.service.CrdnSttsHstryService;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2023-07-19 JoJH
* ================================
* </pre>
*/
@RequestMapping(name = "단속 상태 이력", value = "/crdnSttsHstry")
public class CrdnSttsHstryController extends AbstractController {
/**단속 상태 이력 서비스*/
@Resource(name = "crdnSttsHstryService")
private CrdnSttsHstryService crdnSttsHstryService;
/** (crdnSttsHstry/crdnSttsHstry-main) .
* {@link #getCrdnSttsHstryList(CrdnSttsHstryQuery) } .
* @return /crdnSttsHstry/crdnSttsHstry-main
*/
@RequestMapping(name = "단속 상태 이력 메인", value = "/main.do")
public ModelAndView main() {
ModelAndView mav = getCrdnSttsHstryList(new CrdnSttsHstryQuery().setPageNum(1));
mav.setViewName("/crdnSttsHstry/crdnSttsHstry-main");
return mav.addObject("crdnSttsHstryList", toJson(mav.getModel().get("crdnSttsHstryList")));
}
/** .<br />
* {@link CrdnSttsHstryService#getCrdnSttsHstryList(CrdnSttsHstryQuery)}
* @param req
* @return jsonView
* <pre><code> {
* "crdnSttsHstryList": [ ]
* "crdnSttsHstryStart":
* "crdnSttsHstryFetch":
* "crdnSttsHstryTotal":
* }</code></pre>
*/
@RequestMapping(name = "단속 상태 이력 조회", value = "/list.do")
public ModelAndView getCrdnSttsHstryList(CrdnSttsHstryQuery req) {
List<?> result = crdnSttsHstryService.getCrdnSttsHstryList(setFetchSize(req));
return setCollectionInfo(new ModelAndView("jsonView"), result, "crdnSttsHstry");
}
/** .
* @param crdnSttsHstry
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "단속 상태 이력 등록", value = "/create.do")
public ModelAndView create(CrdnSttsHstry crdnSttsHstry) {
boolean saved = crdnSttsHstryService.create(crdnSttsHstry);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param crdnSttsHstry
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "단속 상태 이력 수정", value = "/update.do")
public ModelAndView update(CrdnSttsHstry crdnSttsHstry) {
boolean saved = crdnSttsHstryService.update(crdnSttsHstry);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param crdnSttsHstryIDs
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "단속 상태 이력 제거", value = "/remove.do")
public ModelAndView remove(CrdnSttsHstry crdnSttsHstry) {
boolean saved = crdnSttsHstryService.remove(crdnSttsHstry);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save