세외수입전송용 압축파일 생성 기능 추가

main
이범준 10 months ago
parent f65a50c59f
commit d1b080916d

@ -51,6 +51,21 @@ public class CmmnUtil {
return str; 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 * @param
@ -72,12 +87,15 @@ public class CmmnUtil {
} }
/** /**
* . * .
* @param index , startFromZero 0( 1 ) * @param index , ( true, false), startFromZero 0 (0 true, 1 false)
* @return (A~Z) * @return (A~Z)
*/ */
public static String indexToAlphabet(int index, boolean startFromZero) { public static String indexToAlphabet(int index, boolean isUpper, boolean startFromZero) {
int charCode = 64; int A = isUpper ? 65 : 97;
int Z = isUpper ? 90 : 122;
int charCode = (A-1);
charCode += index; charCode += index;
@ -85,7 +103,7 @@ public class CmmnUtil {
charCode++; charCode++;
} }
if(charCode < 65 || charCode > 90) { if(charCode < A || charCode > Z) {
return ""; return "";
} }

@ -80,4 +80,6 @@ public interface CrdnUpdtMapper extends AbstractMapper {
*/ */
int deleteCrdnPayer(Crdn crdn); int deleteCrdnPayer(Crdn crdn);
int updateNxrpCrdnLinkYn(Crdn crdn);
} }

@ -1,6 +1,7 @@
package cokr.xit.fims.crdn.dao; package cokr.xit.fims.crdn.dao;
import java.util.List; import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper; import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
@ -31,6 +32,12 @@ public interface GlobalStngMapper extends AbstractMapper {
*/ */
List<String> selectStdgNmList(String sggCd); List<String> selectStdgNmList(String sggCd);
/** .<br />
* @param map
* @return
*/
List<String> selectStdgCdListByStdgNm(Map<String, Object> map);
/** . /** .
* @param query * @param query
* @return * @return

@ -0,0 +1,221 @@
package cokr.xit.fims.crdn.send.nxrp;
import java.io.File;
import java.io.FileWriter;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.apache.commons.io.FilenameUtils;
import cokr.xit.base.code.CommonCode;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.Hangul;
import cokr.xit.foundation.data.DataObject;
public class AttachedTxtMaker extends LinkFileMaker {
private String innerFilePrefix;
private String textFileName;
private List<CommonCode> fimsVltnCodes;
private List<CommonCode> nxrpVltnCodes;
public void appendVltnCodeInfo(List<CommonCode> fimsVltnCodes, List<CommonCode> nxrpVltnCodes) {
this.fimsVltnCodes = fimsVltnCodes;
this.nxrpVltnCodes = nxrpVltnCodes;
}
public AttachedTxtMaker(String nxrpLinkSeCd, String instDigit7){
String ifId = "EBF_Z000001LGE_1741000NIS_";
String systemCode = "";
if(nxrpLinkSeCd.equals("B01")) {
ifId += "0001";
systemCode = "PVS";
this.maxImageFileCnt = 4;
} else if(nxrpLinkSeCd.equals("C01")) {
ifId += "0003";
systemCode = "BPV";
this.maxImageFileCnt = 7;
}
this.ifId = ifId;
SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String currentTime = ymdhmsFormat.format(new Date());
this.zipFileName = ifId + "_" + currentTime + "@" + instDigit7 + systemCode + ".zip";
this.innerFilePrefix = ifId + "_" + currentTime + "_" + instDigit7 + "_";
this.textFileName = this.innerFilePrefix + "0.txt";
}
public String getTextFileName() {
return this.textFileName;
}
public void writeTextFileContents(String workPath, String... contents) {
try {
File txtFile = new File(workPath + "/" + this.textFileName);
txtFile.createNewFile();
FileWriter fileWriter = new FileWriter(workPath + "/" + this.textFileName);
for(int i=0; i < contents.length; i++) {
if(i != 0) {
fileWriter.write("|");
}
fileWriter.write(contents[i]);
}
fileWriter.close();
} catch (Exception e) {
throw new RuntimeException("[F]"+e);
}
}
@Override
public String[] extractForPVS(DataObject crdnInfo) {
String[] B01 = new String[14];
Hangul hangul = new Hangul(3);
B01[0] = crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM");
B01[1] = crdnInfo.string("VHRNO");
String crdnSeCd = crdnInfo.string("CRDN_SE_CD");
if(!crdnSeCd.equals("01") && !crdnSeCd.equals("02") && !crdnSeCd.equals("07")) {
throw new RuntimeException("[F]잘못된 단속구분입니다.");
}
B01[2] = crdnSeCd;
B01[3] = crdnInfo.string("TEAM_ID");
String vltnCd = crdnInfo.string("VLTN_CD");
boolean vltnCdMatch = false;
for(CommonCode nxrpVltnCode : this.nxrpVltnCodes) {
if(nxrpVltnCode.getCode().equals(vltnCd)) {
vltnCdMatch = true;
}
}
if(vltnCdMatch) {
B01[4] = vltnCd;
B01[5] = "";
} else {
B01[4] = "99";
String vltnNm = "";
for(CommonCode fimsVltnCode : this.fimsVltnCodes) {
if(fimsVltnCode.getCode().equals(vltnCd)) {
vltnNm = fimsVltnCode.getValue();
}
}
B01[5] = vltnNm;
}
String law = CmmnUtil.spacedJoin(crdnInfo.string("VLTN_LAW_NM"), crdnInfo.string("VLTN_LAW1"), crdnInfo.string("VLTN_LAW2"));
if(hangul.getByteLength(law) > 60) {
throw new RuntimeException("[F]위반법규가 60byte를 초과하여 오류가 발생하였습니다.");
}
B01[6] = law;
String crdnPlc = crdnInfo.string("CRDN_PLC");
if(hangul.getByteLength(crdnPlc) > 60) {
throw new RuntimeException("[F]단속장소가 60byte를 초과하여 오류가 발생하였습니다.");
}
B01[7] = crdnPlc;
String crdnSpareaCd = crdnInfo.string("CRDN_SPAREA_CD");
if(crdnSpareaCd.equals("00")) {
crdnSpareaCd = "";
} else if(crdnSpareaCd.equals("06") || crdnSpareaCd.equals("07")) {
crdnSpareaCd = "03";
}
B01[8] = crdnSpareaCd;
String gujesi = "1";
//TODO : 구제시
B01[9] = gujesi;
if(crdnInfo.string("STDG_CD").equals("")) {
B01[10] = "0000000000";
} else {
B01[10] = crdnInfo.string("STDG_CD");
}
B01[11] = crdnInfo.string("GPS_X");
B01[12] = crdnInfo.string("GPS_Y");
int atchFileCnt = crdnInfo.number("ATCH_FILE_CNT").intValue();
if(atchFileCnt > this.maxImageFileCnt) {
atchFileCnt = this.maxImageFileCnt;
}
B01[13] = Integer.toString(atchFileCnt);
return B01;
}
@Override
public String[] extractForBPV(DataObject crdnInfo) {
String[] C01 = new String[14];
Hangul hangul = new Hangul(3);
C01[0] = crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM");
C01[1] = crdnInfo.string("VHRNO");
String crdnSeCd = crdnInfo.string("CRDN_SE_CD");
if(!crdnSeCd.equals("01") && !crdnSeCd.equals("02") && !crdnSeCd.equals("07")) {
throw new RuntimeException("[F]잘못된 단속구분입니다.");
}
C01[2] = crdnSeCd;
C01[3] = crdnInfo.string("TEAM_ID");
String vltnCd = crdnInfo.string("VLTN_CD");
C01[4] = vltnCd;
String law = CmmnUtil.spacedJoin(crdnInfo.string("VLTN_LAW_NM"), crdnInfo.string("VLTN_LAW1"), crdnInfo.string("VLTN_LAW2"));
if(hangul.getByteLength(law) > 60) {
throw new RuntimeException("[F]위반법규가 60byte를 초과하여 오류가 발생하였습니다.");
}
C01[5] = law;
String crdnPlc = crdnInfo.string("CRDN_PLC");
if(hangul.getByteLength(crdnPlc) > 60) {
throw new RuntimeException("[F]단속장소가 60byte를 초과하여 오류가 발생하였습니다.");
}
C01[6] = crdnPlc;
String gujesi = "1";
//TODO : 구제시
C01[7] = gujesi;
if(crdnInfo.string("STDG_CD").equals("")) {
C01[8] = "0000000000";
} else {
C01[8] = crdnInfo.string("STDG_CD");
}
C01[9] = crdnInfo.string("GPS_X");
C01[10] = crdnInfo.string("GPS_Y");
C01[11] = crdnInfo.string("MOSC_X");
C01[12] = crdnInfo.string("MOSC_Y");
int atchFileCnt = crdnInfo.number("ATCH_FILE_CNT").intValue();
if(atchFileCnt > this.maxImageFileCnt) {
atchFileCnt = this.maxImageFileCnt;
}
C01[13] = Integer.toString(atchFileCnt);
return C01;
}
@Override
public void copyFile(String workPath, String filePath, int fileIndex, String... items) {
String fileExtension = FilenameUtils.getExtension(filePath);
String newFileName = this.innerFilePrefix + (fileIndex+1) + "." + fileExtension;
String newPath = workPath + "/" + newFileName;
try {
Files.copy(new File(filePath).toPath(), new File(newPath).toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (Exception e) {
throw new RuntimeException("[F]"+e);
}
}
}

@ -0,0 +1,25 @@
package cokr.xit.fims.crdn.send.nxrp;
import cokr.xit.foundation.data.DataObject;
public abstract class LinkFileMaker {
protected String ifId;
protected String zipFileName;
protected int maxImageFileCnt;
public int getMaxImageFileCnt() {
return this.maxImageFileCnt;
}
public String getIfId() {
return this.ifId;
}
public String getZipFileName() {
return this.zipFileName;
}
abstract public String[] extractForPVS(DataObject crdnInfo);
abstract public String[] extractForBPV(DataObject crdnInfo);
abstract public void copyFile(String workPath, String filePath, int fileIndex, String... items);
}

@ -0,0 +1,153 @@
package cokr.xit.fims.crdn.send.nxrp;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.commons.io.FilenameUtils;
import cokr.xit.fims.cmmn.Hangul;
import cokr.xit.foundation.data.DataObject;
public class OnlyImageMaker extends LinkFileMaker {
public OnlyImageMaker(String nxrpLinkSeCd, String instDigit7){
String ifId = "EBF_Z000001LGE_1741000NIS_";
String systemCode = "";
if(nxrpLinkSeCd.equals("B01")) {
ifId += "0002";
systemCode = "PVS";
this.maxImageFileCnt = 4;
} else if(nxrpLinkSeCd.equals("C01")) {
ifId += "0004";
systemCode = "BPV";
this.maxImageFileCnt = 7;
}
this.ifId = ifId;
SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String currentTime = ymdhmsFormat.format(new Date());
this.zipFileName = ifId + "_" + currentTime + "@" + instDigit7 + systemCode + ".zip";
}
@Override
public String[] extractForPVS(DataObject crdnInfo) {
String[] B01 = new String[11];
Hangul hangul = new Hangul(3);
B01[0] = crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM");
B01[1] = crdnInfo.string("VHRNO");
String crdnSeCd = crdnInfo.string("CRDN_SE_CD");
if(!crdnSeCd.equals("01") && !crdnSeCd.equals("02") && !crdnSeCd.equals("07")) {
throw new RuntimeException("[F]잘못된 단속구분입니다.");
}
B01[2] = crdnSeCd;
B01[3] = crdnInfo.string("TEAM_ID");
String vltnCd = crdnInfo.string("VLTN_CD");
B01[4] = vltnCd;
String crdnPlc = crdnInfo.string("CRDN_PLC");
if(hangul.getByteLength(crdnPlc) > 60) {
throw new RuntimeException("[F]단속장소가 60byte를 초과하여 오류가 발생하였습니다.");
}
B01[5] = crdnPlc;
String crdnSpareaCd = crdnInfo.string("CRDN_SPAREA_CD");
if(crdnSpareaCd.equals("00")) {
crdnSpareaCd = "";
} else if(crdnSpareaCd.equals("06") || crdnSpareaCd.equals("07")) {
crdnSpareaCd = "03";
}
B01[6] = crdnSpareaCd;
String gujesi = "1";
//TODO : 구제시
B01[7] = gujesi;
if(crdnInfo.string("STDG_CD").equals("")) {
B01[8] = "0000000000";
} else {
B01[8] = crdnInfo.string("STDG_CD");
}
String gpsX = crdnInfo.string("GPS_X");
if(gpsX.equals("")) {
gpsX = "000";
}
String gpsY = crdnInfo.string("GPS_Y");
if(gpsY.equals("")) {
gpsY = "000";
}
B01[9] = gpsX;
B01[10] = gpsY;
return B01;
}
@Override
public String[] extractForBPV(DataObject crdnInfo) {
String[] C01 = new String[10];
Hangul hangul = new Hangul(3);
C01[0] = crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM");
C01[1] = crdnInfo.string("VHRNO");
String crdnSeCd = crdnInfo.string("CRDN_SE_CD");
if(!crdnSeCd.equals("01") && !crdnSeCd.equals("02") && !crdnSeCd.equals("07")) {
throw new RuntimeException("[F]잘못된 단속구분입니다.");
}
C01[2] = crdnSeCd;
C01[3] = crdnInfo.string("TEAM_ID");
String vltnCd = crdnInfo.string("VLTN_CD");
C01[4] = vltnCd;
String crdnPlc = crdnInfo.string("CRDN_PLC");
if(hangul.getByteLength(crdnPlc) > 60) {
throw new RuntimeException("[F]단속장소가 60byte를 초과하여 오류가 발생하였습니다.");
}
C01[5] = crdnPlc;
String gujesi = "1";
//TODO : 구제시
C01[6] = crdnInfo.string(gujesi);
if(crdnInfo.string("STDG_CD").equals("")) {
C01[7] = "0000000000";
} else {
C01[7] = crdnInfo.string("STDG_CD");
}
String gpsX = crdnInfo.string("GPS_X");
if(gpsX.equals("")) {
gpsX = "000";
}
String gpsY = crdnInfo.string("GPS_Y");
if(gpsY.equals("")) {
gpsY = "000";
}
C01[8] = gpsX;
C01[9] = gpsY;
return C01;
}
@Override
public void copyFile(String workPath, String filePath, int fileIndex, String... items) {
String fileExtension = FilenameUtils.getExtension(filePath);
String delim = "_";
String newFileName = String.join(delim, items) + delim + fileIndex + "." + fileExtension;
String newPath = workPath + "/" + newFileName;
try {
Files.copy(new File(filePath).toPath(), new File(newPath).toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (Exception e) {
throw new RuntimeException("[F]"+e);
}
}
}

@ -1,6 +1,9 @@
package cokr.xit.fims.crdn.service.bean; package cokr.xit.fims.crdn.service.bean;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -9,6 +12,8 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.code.service.bean.CodeBean;
import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.FileInfo;
import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.FileQuery;
import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.base.file.service.bean.FileBean;
@ -24,6 +29,9 @@ import cokr.xit.fims.crdn.dao.CrdnListMapper;
import cokr.xit.fims.crdn.dao.CrdnUpdtMapper; import cokr.xit.fims.crdn.dao.CrdnUpdtMapper;
import cokr.xit.fims.crdn.dao.GlobalStngMapper; import cokr.xit.fims.crdn.dao.GlobalStngMapper;
import cokr.xit.fims.crdn.dao.ImportMapper; import cokr.xit.fims.crdn.dao.ImportMapper;
import cokr.xit.fims.crdn.send.nxrp.AttachedTxtMaker;
import cokr.xit.fims.crdn.send.nxrp.LinkFileMaker;
import cokr.xit.fims.crdn.send.nxrp.OnlyImageMaker;
import cokr.xit.fims.crdn.service.CrdnService; import cokr.xit.fims.crdn.service.CrdnService;
import cokr.xit.fims.cvlc.dao.CrdnCvlcptMapper; import cokr.xit.fims.cvlc.dao.CrdnCvlcptMapper;
import cokr.xit.fims.cvlc.service.bean.CrdnCvlcptMainBean; import cokr.xit.fims.cvlc.service.bean.CrdnCvlcptMainBean;
@ -33,6 +41,7 @@ import cokr.xit.fims.sprt.dao.TotalInfoMapper;
import cokr.xit.fims.sprt.service.bean.MediaBean; import cokr.xit.fims.sprt.service.bean.MediaBean;
import cokr.xit.foundation.component.AbstractServiceBean; import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import net.lingala.zip4j.ZipFile;
@Service("crdnService") @Service("crdnService")
public class CrdnServiceBean extends AbstractServiceBean implements CrdnService { public class CrdnServiceBean extends AbstractServiceBean implements CrdnService {
@ -64,6 +73,9 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService
@Resource(name="fileBean") @Resource(name="fileBean")
private FileBean fileBean; private FileBean fileBean;
@Resource(name="codeBean")
private CodeBean codeBean;
@Resource(name="mediaBean") @Resource(name="mediaBean")
private MediaBean mediaBean; private MediaBean mediaBean;
@ -352,38 +364,159 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService
public String sendCrdn(String[] crdnIDs) { public String sendCrdn(String[] crdnIDs) {
String rtnMsg = "[F]"; String rtnMsg = "[F]";
List<CommonCode> fimsVltnCodes = codeBean.getCodes("FIM004");
List<CommonCode> nxrpVltnCodes = codeBean.getCodes("NTR055");
for(String crdnID : crdnIDs) { for(String crdnID : crdnIDs) {
DataObject crdnInfo = crdnInfoMapper.selectCrdnInfo(crdnID); 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"); String taskSeCd = crdnInfo.string("TASK_SE_CD");
if(firstTaskSeCd.equals("")) {
firstTaskSeCd = taskSeCd;
}
if(!taskSeCd.equals("PVS") && !taskSeCd.equals("BPV")) { if(!taskSeCd.equals("PVS") && !taskSeCd.equals("BPV")) {
rtnMsg += "주정차위반 또는 전용차로위반 자료만 처리 가능합니다."; rtnMsg += "주정차위반 또는 전용차로위반 자료만 처리 가능합니다.";
throw new RuntimeException(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 cmmnQuery = new CmmnQuery();
cmmnQuery.setUseYN("Y"); cmmnQuery.setUseYN("Y");
cmmnQuery.setSggCd(crdnInfo.string("SGG_CD")); cmmnQuery.setSggCd(crdnInfo.string("SGG_CD"));
cmmnQuery.setTaskSeCd(taskSeCd); cmmnQuery.setTaskSeCd(taskSeCd);
DataObject nxrpLinkInfo = taskMapper.selectTaskInfo(cmmnQuery); DataObject nxrpLinkInfo = taskMapper.selectTaskInfo(cmmnQuery);
if(nxrpLinkInfo == null) {
rtnMsg += "과태료 설정 정보가 없습니다.";
throw new RuntimeException(rtnMsg);
}
String nxrpLinkSeCd = nxrpLinkInfo.string("NXRP_LINK_SE_CD"); String nxrpLinkSeCd = nxrpLinkInfo.string("NXRP_LINK_SE_CD");
String nxrpLinkSeDtlSn = nxrpLinkInfo.string("NXRP_LINK_SE_DTL_SN"); 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 = globalStngMapper.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")) { if(nxrpLinkSeDtlSn.equals("01")) {
//TODO linkFileMaker = new AttachedTxtMaker(nxrpLinkSeCd, instDigit7);
} else if(nxrpLinkSeDtlSn.equals("02")){ if(nxrpLinkSeCd.equals("B01")) {
//TODO
((AttachedTxtMaker)linkFileMaker).appendVltnCodeInfo(fimsVltnCodes, nxrpVltnCodes);
}
} else { } else {
rtnMsg += "세외수입 연계 설정 오류"; linkFileMaker = new OnlyImageMaker(nxrpLinkSeCd, instDigit7);
throw new RuntimeException(rtnMsg); }
String workPath = "files/temp/"+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;
if(taskSeCd.equals("PVS")) {
items = linkFileMaker.extractForPVS(crdnInfo);
} else if(taskSeCd.equals("BPV")) {
items = linkFileMaker.extractForBPV(crdnInfo);
}
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();
ZipFile zipFile = new ZipFile(zipFilePath);
File[] fileList = workFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return !(name.toUpperCase().endsWith(".ZIP"));
}
});
for(File file : fileList) {
zipFile.addFile(file);
}
zipFile.close();
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);
} }
//TODO
} }
rtnMsg = "[S]"; rtnMsg = "[S]처리되었습니다.";
return rtnMsg; return rtnMsg;
} }

@ -215,7 +215,7 @@ public class Crdn06Controller extends ApplicationController {
saved = true; saved = true;
} }
mav.addObject("saved", saved); mav.addObject("saved", saved);
mav.addObject("rtnMsg", rtnMsg);
return mav; return mav;
} }

@ -682,7 +682,7 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements
orgnFileInputStream = new ClassPathResource(orgnFilePath).getInputStream(); orgnFileInputStream = new ClassPathResource(orgnFilePath).getInputStream();
} }
String modifiedFileName = "P"+fileInfo.string("INF_KEY")+CmmnUtil.indexToAlphabet(j, true)+"."+"JPG"; String modifiedFileName = "P"+fileInfo.string("INF_KEY")+CmmnUtil.indexToAlphabet(j, true, true)+"."+"JPG";
String modifiedFilePath = imagesFolderPath + File.separator + modifiedFileName; String modifiedFilePath = imagesFolderPath + File.separator + modifiedFileName;

@ -102,18 +102,27 @@
, C.VHCL_COLOR <!-- 차량 색상 --> , C.VHCL_COLOR <!-- 차량 색상 -->
, C.FFNLG_CRDN_AMT <!-- 과태료 단속 금액 --> , C.FFNLG_CRDN_AMT <!-- 과태료 단속 금액 -->
, C.ETC_CN <!-- 기타 내용 --> , C.ETC_CN <!-- 기타 내용 -->
, C.ATCH_FILE_CNT <!-- 첨부 파일 건수 -->
, C.CRDN_STTS_CD <!-- 단속 상태 코드 --> , C.CRDN_STTS_CD <!-- 단속 상태 코드 -->
, C.CRDN_STTS_CHG_DT <!-- 단속 상태 변경 일시 --> , C.CRDN_STTS_CHG_DT <!-- 단속 상태 변경 일시 -->
, C.NXRP_CRDN_LINK_YN <!-- 세외수입 단속 연계 여부 -->
, C.NXRP_CRDN_LINK_USER_ID <!-- 세외수입 단속 연계 사용자 ID -->
, C.NXRP_CRDN_LINK_DT <!-- 세외수입 단속 연계 일시 -->
, C.LINK_TBL_NM <!-- 연계 테이블 명 --> , C.LINK_TBL_NM <!-- 연계 테이블 명 -->
, C.LINK_ID <!-- 연계 ID --> , C.LINK_ID <!-- 연계 ID -->
, (SELECT VLTN_CD FROM TB_VLTN WHERE VLTN_ID = C.VLTN_ID) AS VLTN_CD , V.VLTN_CD <!-- 위반 코드 -->
, CA.CRDN_SE_CD , V.VLTN_LAW_NM <!-- 위반 법 명 -->
, CA.TEAM_ID , V.VLTN_LAW1 <!-- 위반 법1 -->
, CA.DTL_CRDN_PLC , V.VLTN_LAW2 <!-- 위반 법2 -->
, CA.CRDN_SE_CD <!-- 단속 구분 코드 -->
, CA.TEAM_ID <!-- 조 ID -->
, CA.DTL_CRDN_PLC <!-- 상세 단속 장소 -->
, CA.CRDN_SPAREA_CD <!-- 단속 특별구역 코드 --> , CA.CRDN_SPAREA_CD <!-- 단속 특별구역 코드 -->
, CA.CRDN_BGNG_TM , CA.CRDN_BGNG_TM
, CA.CRDN_END_TM , CA.CRDN_END_TM
, CA.CRDN_SN , CA.CRDN_SN <!-- 단속 순번 -->
, C.GPS_X
, C.GPS_Y
, CA.MOSC_X , CA.MOSC_X
, CA.MOSC_Y , CA.MOSC_Y
, CA.TOWNG_YN <!-- 견인 여부 --> , CA.TOWNG_YN <!-- 견인 여부 -->
@ -131,10 +140,11 @@
, LE.LEVY_EXCL_SE_CD <!-- 부과 제외 구분 코드 --> , LE.LEVY_EXCL_SE_CD <!-- 부과 제외 구분 코드 -->
, LE.LEVY_EXCL_RSN_CD <!-- 부과 제외 사유 코드 --> , LE.LEVY_EXCL_RSN_CD <!-- 부과 제외 사유 코드 -->
FROM TB_CRDN C FROM TB_CRDN C
INNER JOIN TB_CRDN_ADI CA ON (C.CRDN_ID = CA.CRDN_ID) INNER JOIN TB_CRDN_ADI CA ON (C.CRDN_ID = CA.CRDN_ID)
INNER JOIN TB_VLTN V ON (C.VLTN_ID = V.VLTN_ID)
LEFT OUTER JOIN TB_CRDN_CVLCPT CC ON (C.CVLCPT_LINK_YN = 'Y' AND C.LINK_ID = CC.CVLCPT_LINK_ID) LEFT OUTER JOIN TB_CRDN_CVLCPT CC ON (C.CVLCPT_LINK_YN = 'Y' AND C.LINK_ID = CC.CVLCPT_LINK_ID)
LEFT OUTER JOIN TB_PAYER P ON (C.RTPYR_ID = P.RTPYR_ID) LEFT OUTER JOIN TB_PAYER P ON (C.RTPYR_ID = P.RTPYR_ID)
LEFT OUTER JOIN TB_LEVY_EXCL LE ON (C.CRDN_ID = LE.CRDN_ID AND LE.DEL_YN = 'N') LEFT OUTER JOIN TB_LEVY_EXCL LE ON (C.CRDN_ID = LE.CRDN_ID AND LE.DEL_YN = 'N')
WHERE C.DEL_YN = 'N' WHERE C.DEL_YN = 'N'
AND C.CRDN_ID = #{crdnId} AND C.CRDN_ID = #{crdnId}
</select> </select>

@ -179,4 +179,16 @@
AND DEL_YN = 'N' <!-- 삭제 여부 --> AND DEL_YN = 'N' <!-- 삭제 여부 -->
</update> </update>
<update id="updateNxrpCrdnLinkYn" parameterType="cokr.xit.fims.crdn.Crdn">
/* 세외수입 단속 연계 여부 변경(crdnUpdtMapper.updateNxrpCrdnLinkYn) */
UPDATE TB_CRDN
SET NXRP_CRDN_LINK_YN = 'Y' <!-- 세외수입 단속 연계 여부 -->
, NXRP_CRDN_LINK_DT = <include refid="utility.now" /> <!-- 세외수입 단속 연계 일시 -->
, NXRP_CRDN_LINK_USER_ID = #{modifiedBy} <!-- 세외수입 단속 연계 사용자 ID -->
, MDFCN_DT = <include refid="utility.now" /> <!-- 수정일시 -->
, MDFR = #{modifiedBy} <!-- 수정자 -->
WHERE CRDN_ID = #{crdnId} <!-- 단속 ID -->
AND DEL_YN = 'N' <!-- 삭제 여부 -->
</update>
</mapper> </mapper>

@ -63,6 +63,17 @@ SELECT CONCAT(A.EMD_NM,
ORDER BY A.EMD_NM, A.LI_NM ORDER BY A.EMD_NM, A.LI_NM
</select> </select>
<select id="selectStdgCdListByStdgNm" parameterType="map" resultType="string">
/* 법정동명으로 법정동코드 조회(globalStngMapper.selectStdgCdListByStdgNm) */
SELECT STDG_CD
FROM TB_STDG
WHERE EMD_NM IS NOT NULL
AND EMD_NM != ''
AND USE_YN = 'Y'
AND EMD_NM = #{emdNm}
AND SUBSTR(STDG_CD,1,5) = #{sggCd}
</select>
<select id="selectLinkFileLayoutMetadata" parameterType="map" resultMap="descriptorRow"> <select id="selectLinkFileLayoutMetadata" parameterType="map" resultMap="descriptorRow">
/* 연계파일 레이아웃 정보 조회(globalStngMapper.selectLinkFileLayoutMetadata) */ /* 연계파일 레이아웃 정보 조회(globalStngMapper.selectLinkFileLayoutMetadata) */
SELECT A.FILE_LAYOUT_ID SELECT A.FILE_LAYOUT_ID

@ -527,6 +527,8 @@ $(document).ready(function(){
$P.refreshCrdnList(); $P.refreshCrdnList();
} }
}); });
} else {
alert(resp.rtnMsg);
} }
} }
}); });

Loading…
Cancel
Save