|
|
|
@ -2,6 +2,8 @@ package cokr.xit.fims.nxrp.service.bean;
|
|
|
|
|
|
|
|
|
|
import java.io.BufferedReader;
|
|
|
|
|
import java.io.BufferedWriter;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FilenameFilter;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.InputStreamReader;
|
|
|
|
|
import java.io.OutputStreamWriter;
|
|
|
|
@ -11,7 +13,9 @@ import java.security.cert.CertificateException;
|
|
|
|
|
import java.security.cert.X509Certificate;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.net.ssl.HostnameVerifier;
|
|
|
|
@ -23,27 +27,39 @@ import javax.net.ssl.X509TrustManager;
|
|
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
|
|
|
|
|
import cokr.xit.base.code.CommonCode;
|
|
|
|
|
import cokr.xit.base.code.service.bean.CodeBean;
|
|
|
|
|
import cokr.xit.base.file.ZIP;
|
|
|
|
|
import cokr.xit.base.file.service.FileQuery;
|
|
|
|
|
import cokr.xit.base.file.service.bean.FileBean;
|
|
|
|
|
import cokr.xit.base.user.service.bean.UserBean;
|
|
|
|
|
import cokr.xit.fims.cmmn.CmmnQuery;
|
|
|
|
|
import cokr.xit.fims.cmmn.service.bean.StngBean;
|
|
|
|
|
import cokr.xit.fims.crdn.Crdn;
|
|
|
|
|
import cokr.xit.fims.crdn.dao.CrdnInfoMapper;
|
|
|
|
|
import cokr.xit.fims.crdn.dao.CrdnStngMapper;
|
|
|
|
|
import cokr.xit.fims.crdn.dao.CrdnUpdtMapper;
|
|
|
|
|
import cokr.xit.fims.mngt.dao.TaskMapper;
|
|
|
|
|
import cokr.xit.fims.mngt.service.bean.FactionBean;
|
|
|
|
|
import cokr.xit.fims.nxrp.A01;
|
|
|
|
|
import cokr.xit.fims.nxrp.A02;
|
|
|
|
|
import cokr.xit.fims.nxrp.A03;
|
|
|
|
|
import cokr.xit.fims.nxrp.A03Rqst;
|
|
|
|
|
import cokr.xit.fims.nxrp.NisIndivQuery;
|
|
|
|
|
import cokr.xit.fims.nxrp.dao.NisA01Mapper;
|
|
|
|
|
import cokr.xit.fims.nxrp.dao.NisA02Mapper;
|
|
|
|
|
import cokr.xit.fims.nxrp.dao.NisA03Mapper;
|
|
|
|
|
import cokr.xit.fims.nxrp.support.AttachedTxtMaker;
|
|
|
|
|
import cokr.xit.fims.nxrp.support.LinkFileMaker;
|
|
|
|
|
import cokr.xit.fims.nxrp.support.OnlyImageMaker;
|
|
|
|
|
import cokr.xit.fims.sndb.SndbQuery;
|
|
|
|
|
import cokr.xit.fims.sndb.SndngDtl;
|
|
|
|
|
import cokr.xit.fims.sndb.dao.SndngDtlMapper;
|
|
|
|
|
import cokr.xit.foundation.AbstractComponent;
|
|
|
|
|
import cokr.xit.foundation.data.DataObject;
|
|
|
|
|
import cokr.xit.interfaces.filejob.JobConf;
|
|
|
|
|
|
|
|
|
|
/**과태료 대장 단속 정보 등록 정보 관리 Bean
|
|
|
|
|
*
|
|
|
|
@ -78,10 +94,30 @@ public class NisIndivBean extends AbstractComponent {
|
|
|
|
|
@Resource(name = "crdnUpdtMapper")
|
|
|
|
|
private CrdnUpdtMapper crdnUpdtMapper;
|
|
|
|
|
|
|
|
|
|
@Resource(name="crdnInfoMapper")
|
|
|
|
|
private CrdnInfoMapper crdnInfoMapper;
|
|
|
|
|
|
|
|
|
|
@Resource(name="crdnStngMapper")
|
|
|
|
|
private CrdnStngMapper crdnStngMapper;
|
|
|
|
|
|
|
|
|
|
@Resource(name="taskMapper")
|
|
|
|
|
private TaskMapper taskMapper;
|
|
|
|
|
|
|
|
|
|
@Resource(name="fileBean")
|
|
|
|
|
private FileBean fileBean;
|
|
|
|
|
|
|
|
|
|
/** 사용자 정보 DAO */
|
|
|
|
|
@Resource(name="userBean")
|
|
|
|
|
protected UserBean userBean;
|
|
|
|
|
|
|
|
|
|
/** 코드 정보 DAO */
|
|
|
|
|
@Resource(name="codeBean")
|
|
|
|
|
protected CodeBean codeBean;
|
|
|
|
|
|
|
|
|
|
/** 설정 정보 DAO */
|
|
|
|
|
@Resource(name="stngBean")
|
|
|
|
|
protected StngBean stngBean;
|
|
|
|
|
|
|
|
|
|
/** 부서 정보 DAO */
|
|
|
|
|
@Resource(name = "factionBean")
|
|
|
|
|
private FactionBean factionBean;
|
|
|
|
@ -818,4 +854,192 @@ public class NisIndivBean extends AbstractComponent {
|
|
|
|
|
}
|
|
|
|
|
// SSL 무시 /////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
public String createNisIndivB01C01(NisIndivQuery req) {
|
|
|
|
|
|
|
|
|
|
String[] crdnIds = req.getCrdnIds();
|
|
|
|
|
|
|
|
|
|
String rtnMsg = "[F]";
|
|
|
|
|
|
|
|
|
|
List<CommonCode> fimsVltnCodes = codeBean.getCodes("FIM004");
|
|
|
|
|
List<CommonCode> nxrpVltnCodes = codeBean.getCodes("NTR055");
|
|
|
|
|
|
|
|
|
|
DataObject deptStng = stngBean.getStng("dept");
|
|
|
|
|
String gujesi = deptStng.string("NXRP_RGN_SE_CD");
|
|
|
|
|
|
|
|
|
|
for(String crdnID : crdnIds) {
|
|
|
|
|
DataObject crdnInfo = crdnInfoMapper.selectCrdnInfo(crdnID);
|
|
|
|
|
|
|
|
|
|
if(crdnInfo.string("NXRP_CRDN_LINK_YN").equals("Y")) {
|
|
|
|
|
rtnMsg += "이미 세외수입 단속 연계 처리된 자료입니다.";
|
|
|
|
|
throw new RuntimeException(rtnMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String firstTaskSeCd = "";
|
|
|
|
|
String taskSeCd = crdnInfo.string("TASK_SE_CD");
|
|
|
|
|
if(firstTaskSeCd.equals("")) {
|
|
|
|
|
firstTaskSeCd = taskSeCd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!taskSeCd.equals("PVS") && !taskSeCd.equals("BPV")) {
|
|
|
|
|
rtnMsg += "주정차위반 또는 전용차로위반 자료만 처리 가능합니다.";
|
|
|
|
|
throw new RuntimeException(rtnMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!firstTaskSeCd.equals(taskSeCd)) {
|
|
|
|
|
rtnMsg += "과태료 구분이 동일한 자료만 처리가능합니다.";
|
|
|
|
|
throw new RuntimeException(rtnMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(crdnInfo.number("ATCH_FILE_CNT").intValue() < 1) {
|
|
|
|
|
rtnMsg += "단속사진이 없습니다.";
|
|
|
|
|
throw new RuntimeException(rtnMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CmmnQuery cmmnQuery = new CmmnQuery();
|
|
|
|
|
cmmnQuery.setUseYN("Y");
|
|
|
|
|
cmmnQuery.setSggCd(crdnInfo.string("SGG_CD"));
|
|
|
|
|
cmmnQuery.setTaskSeCd(taskSeCd);
|
|
|
|
|
DataObject nxrpLinkInfo = taskMapper.selectTaskInfo(cmmnQuery);
|
|
|
|
|
if(nxrpLinkInfo == null) {
|
|
|
|
|
rtnMsg += "과태료 설정 정보가 없습니다.";
|
|
|
|
|
throw new RuntimeException(rtnMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String nxrpLinkSeCd = nxrpLinkInfo.string("NXRP_LINK_SE_CD");
|
|
|
|
|
String nxrpLinkSeDtlSn = nxrpLinkInfo.string("NXRP_LINK_SE_DTL_SN");
|
|
|
|
|
|
|
|
|
|
if(!nxrpLinkSeCd.equals("B01") && !nxrpLinkSeCd.equals("C01")) {
|
|
|
|
|
rtnMsg += "세외수입 연계 구분 코드 설정 오류입니다.";
|
|
|
|
|
throw new RuntimeException(rtnMsg);
|
|
|
|
|
}
|
|
|
|
|
if(!nxrpLinkSeDtlSn.equals("01") && !nxrpLinkSeDtlSn.equals("02")) {
|
|
|
|
|
rtnMsg += "세외수입 연계 구분 상세 순번 설정 오류입니다.";
|
|
|
|
|
throw new RuntimeException(rtnMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String instDigit7 = currentUser().getInstitute();
|
|
|
|
|
|
|
|
|
|
//법정동코드 구하기
|
|
|
|
|
if(!crdnInfo.string("CRDN_STDG_NM").equals("")) {
|
|
|
|
|
|
|
|
|
|
Map<String, Object> stdgQuery = new HashMap<>();
|
|
|
|
|
stdgQuery.put("sggCd", crdnInfo.string("SGG_CD"));
|
|
|
|
|
stdgQuery.put("emdNm", crdnInfo.string("CRDN_STDG_NM"));
|
|
|
|
|
List<String> stdgCds = crdnStngMapper.selectStdgCdListByStdgNm(stdgQuery);
|
|
|
|
|
|
|
|
|
|
if(stdgCds != null && stdgCds.size() == 1 && stdgCds.get(0) != null && !stdgCds.get(0).equals("")) {
|
|
|
|
|
crdnInfo.put("STDG_CD", stdgCds.get(0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LinkFileMaker linkFileMaker = null;
|
|
|
|
|
if(nxrpLinkSeDtlSn.equals("01")) {
|
|
|
|
|
linkFileMaker = new AttachedTxtMaker(nxrpLinkSeCd, instDigit7);
|
|
|
|
|
if(nxrpLinkSeCd.equals("B01")) {
|
|
|
|
|
|
|
|
|
|
((AttachedTxtMaker)linkFileMaker).appendVltnCodeInfo(fimsVltnCodes, nxrpVltnCodes);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
linkFileMaker = new OnlyImageMaker(nxrpLinkSeCd, instDigit7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!gujesi.equals("")) {
|
|
|
|
|
linkFileMaker.setGujesiStng(gujesi);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String workPath = "files/temp/sendCrdn/"+crdnInfo.string("SGG_CD")+"/"+crdnInfo.string("CRDN_ID");
|
|
|
|
|
File workFolder = new File(workPath);
|
|
|
|
|
if(workFolder.exists()) {
|
|
|
|
|
boolean del = false;
|
|
|
|
|
File[] lf = workFolder.listFiles();
|
|
|
|
|
if(lf != null && lf.length > 0) {
|
|
|
|
|
for(File f : lf) {
|
|
|
|
|
del = f.delete();
|
|
|
|
|
if(!del) {
|
|
|
|
|
throw new RuntimeException("[F]파일삭제오류");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
del = workFolder.delete();
|
|
|
|
|
if(!del) {
|
|
|
|
|
throw new RuntimeException("[F]파일삭제오류");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
workFolder.mkdirs();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
String[] items = null;
|
|
|
|
|
boolean includeTxt = nxrpLinkSeDtlSn.equals("01");
|
|
|
|
|
|
|
|
|
|
if(taskSeCd.equals("PVS")) {
|
|
|
|
|
items = linkFileMaker.extractForPVS(crdnInfo,includeTxt).get();
|
|
|
|
|
} else if(taskSeCd.equals("BPV")) {
|
|
|
|
|
items = linkFileMaker.extractForBPV(crdnInfo,includeTxt).get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(nxrpLinkSeDtlSn.equals("01")) {
|
|
|
|
|
|
|
|
|
|
((AttachedTxtMaker)linkFileMaker).writeTextFileContents(workPath, items);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FileQuery fileQuery = new FileQuery();
|
|
|
|
|
fileQuery.setInfoType(Crdn.INF_TYPE);
|
|
|
|
|
fileQuery.setInfoKeys(crdnID);
|
|
|
|
|
fileQuery.setOrderBy("SRT_ORD");
|
|
|
|
|
List<DataObject> crdnFileList = fileBean.getFileList(fileQuery);
|
|
|
|
|
for(int j=0; (j<crdnFileList.size()) && (j < linkFileMaker.getMaxImageFileCnt()); j++) {
|
|
|
|
|
linkFileMaker.copyFile(workPath, crdnFileList.get(j).string("FILE_PATH"), j, items);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String zipFilePath = workPath + "/" + linkFileMaker.getZipFileName();
|
|
|
|
|
|
|
|
|
|
File[] fileList = workFolder.listFiles(new FilenameFilter() {
|
|
|
|
|
@Override
|
|
|
|
|
public boolean accept(File dir, String name) {
|
|
|
|
|
return !(name.toUpperCase().endsWith(".ZIP"));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
String[] fileNameList = new String[fileList.length];
|
|
|
|
|
for(int i=0; i<fileList.length; i++) {
|
|
|
|
|
fileNameList[i] = fileList[i].getPath();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ZIP zip = new ZIP();
|
|
|
|
|
zip.compress(zipFilePath, fileNameList);
|
|
|
|
|
|
|
|
|
|
for(File file : fileList) {
|
|
|
|
|
if(!file.delete()) {
|
|
|
|
|
throw new RuntimeException("[F]파일 삭제 중 오류가 발생하였습니다.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String ESB_Folder_Path = JobConf.get().getDir("send")+"/"+JobConf.get().getDirCode("lntris");
|
|
|
|
|
if(!new File(ESB_Folder_Path).exists()) {
|
|
|
|
|
new File(ESB_Folder_Path).mkdirs();
|
|
|
|
|
}
|
|
|
|
|
File src = new File(zipFilePath);
|
|
|
|
|
File dst = new File(ESB_Folder_Path+"/"+linkFileMaker.getZipFileName());
|
|
|
|
|
src.renameTo(dst);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Crdn crdn = new Crdn();
|
|
|
|
|
crdn.setCrdnId(crdnID);
|
|
|
|
|
crdn.setModifiedBy(currentUser().getId());
|
|
|
|
|
int effected = crdnUpdtMapper.updateNxrpCrdnLinkYn(crdn);
|
|
|
|
|
if(effected != 1) {
|
|
|
|
|
rtnMsg += "세외수입 연계 여부 변경 중 오류가 발생하였습니다.";
|
|
|
|
|
throw new RuntimeException(rtnMsg);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new RuntimeException("[F]"+e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rtnMsg = "[S]처리되었습니다.";
|
|
|
|
|
|
|
|
|
|
return rtnMsg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|