세외수입 개별 연계(B01,C01) 처리용 클래스 추가

main
이범준 9 months ago
parent 8f637f50c0
commit 6449ec9b69

@ -19,7 +19,9 @@ public class Hangul {
* @return
*/
public int getByteLength(String str) {
if(str == null) {
return 0;
}
int byteLen = 0;
for(int i=0;i<str.length();i++) {

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

@ -12,7 +12,8 @@ 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.fims.nxrp.B01;
import cokr.xit.fims.nxrp.C01;
import cokr.xit.foundation.data.DataObject;
public class AttachedTxtMaker extends LinkFileMaker {
@ -79,18 +80,17 @@ public class AttachedTxtMaker extends LinkFileMaker {
}
@Override
public String[] extractForPVS(DataObject crdnInfo) {
String[] B01 = new String[14];
Hangul hangul = new Hangul(3);
public B01 extractForPVS(DataObject crdnInfo, boolean includeTxt) {
B01 b01 = new B01(includeTxt);
B01[0] = crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM");
B01[1] = crdnInfo.string("VHRNO");
b01.set(1, crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM"));
b01.set(2, 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");
b01.set(3, crdnSeCd);
b01.set(4, crdnInfo.string("TEAM_ID"));
String vltnCd = crdnInfo.string("VLTN_CD");
boolean vltnCdMatch = false;
@ -101,112 +101,75 @@ public class AttachedTxtMaker extends LinkFileMaker {
}
if(vltnCdMatch) {
B01[4] = vltnCd;
B01[5] = "";
b01.set(5, vltnCd);
b01.set(6, "");
} else {
B01[4] = "99";
b01.set(5, "99");
String vltnNm = "";
for(CommonCode fimsVltnCode : this.fimsVltnCodes) {
if(fimsVltnCode.getCode().equals(vltnCd)) {
vltnNm = fimsVltnCode.getValue();
}
}
B01[5] = vltnNm;
b01.set(6, 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;
b01.set(7, law);
b01.set(8, crdnInfo.string("CRDN_PLC"));
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;
if(this.gujesiStng != null && !this.gujesiStng.equals("")) {
B01[9] = gujesiStng;
} else {
B01[9] = "1";
}
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");
b01.set(9, crdnSpareaCd);
b01.set(10, this.gujesiStng);
b01.set(11, crdnInfo.string("STDG_CD"));
b01.set(12, crdnInfo.string("GPS_X"));
b01.set(13, crdnInfo.string("GPS_Y"));
int atchFileCnt = crdnInfo.number("ATCH_FILE_CNT").intValue();
if(atchFileCnt > this.maxImageFileCnt) {
atchFileCnt = this.maxImageFileCnt;
}
B01[13] = Integer.toString(atchFileCnt);
b01.set(14, Integer.toString(atchFileCnt));
return B01;
return b01;
}
@Override
public String[] extractForBPV(DataObject crdnInfo) {
String[] C01 = new String[14];
Hangul hangul = new Hangul(3);
public C01 extractForBPV(DataObject crdnInfo, boolean includeTxt) {
C01 c01 = new C01(includeTxt);
C01[0] = crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM");
C01[1] = crdnInfo.string("VHRNO");
c01.set(1, crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM"));
c01.set(2, 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");
c01.set(3, crdnSeCd);
c01.set(4, crdnInfo.string("TEAM_ID"));
String vltnCd = crdnInfo.string("VLTN_CD");
C01[4] = vltnCd;
c01.set(5, 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;
if(this.gujesiStng != null && !this.gujesiStng.equals("")) {
C01[7] = gujesiStng;
} else {
C01[7] = "1";
}
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");
c01.set(6, law);
c01.set(7, crdnInfo.string("CRDN_PLC"));
c01.set(8, this.gujesiStng);
c01.set(9, crdnInfo.string("STDG_CD"));
c01.set(10, crdnInfo.string("GPS_X"));
c01.set(11, crdnInfo.string("GPS_Y"));
c01.set(12, crdnInfo.string("MOSC_X"));
c01.set(13, crdnInfo.string("MOSC_Y"));
int atchFileCnt = crdnInfo.number("ATCH_FILE_CNT").intValue();
if(atchFileCnt > this.maxImageFileCnt) {
atchFileCnt = this.maxImageFileCnt;
}
C01[13] = Integer.toString(atchFileCnt);
c01.set(14, Integer.toString(atchFileCnt));
return C01;
return c01;
}
@Override

@ -1,5 +1,7 @@
package cokr.xit.fims.crdn.send.nxrp;
import cokr.xit.fims.nxrp.B01;
import cokr.xit.fims.nxrp.C01;
import cokr.xit.foundation.data.DataObject;
public abstract class LinkFileMaker {
@ -24,7 +26,7 @@ public abstract class LinkFileMaker {
return this.zipFileName;
}
abstract public String[] extractForPVS(DataObject crdnInfo);
abstract public String[] extractForBPV(DataObject crdnInfo);
abstract public B01 extractForPVS(DataObject crdnInfo,boolean includeTxt);
abstract public C01 extractForBPV(DataObject crdnInfo,boolean includeTxt);
abstract public void copyFile(String workPath, String filePath, int fileIndex, String... items);
}

@ -8,7 +8,8 @@ import java.util.Date;
import org.apache.commons.io.FilenameUtils;
import cokr.xit.fims.cmmn.Hangul;
import cokr.xit.fims.nxrp.B01;
import cokr.xit.fims.nxrp.C01;
import cokr.xit.foundation.data.DataObject;
public class OnlyImageMaker extends LinkFileMaker {
@ -35,106 +36,54 @@ public class OnlyImageMaker extends LinkFileMaker {
}
@Override
public String[] extractForPVS(DataObject crdnInfo) {
String[] B01 = new String[11];
Hangul hangul = new Hangul(3);
public B01 extractForPVS(DataObject crdnInfo, boolean includeTxt) {
B01 b01 = new B01(includeTxt);
B01[0] = crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM");
B01[1] = crdnInfo.string("VHRNO");
b01.set(1, crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM"));
b01.set(2, 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;
b01.set(3, crdnSeCd);
b01.set(4, crdnInfo.string("TEAM_ID"));
b01.set(5, crdnInfo.string("VLTN_CD"));
b01.set(6, crdnInfo.string("CRDN_PLC"));
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;
if(this.gujesiStng != null && !this.gujesiStng.equals("")) {
B01[7] = gujesiStng;
} else {
B01[7] = "1";
}
if(crdnInfo.string("STDG_CD").equals("")) {
B01[8] = "0000000000";
} else {
B01[8] = crdnInfo.string("STDG_CD");
}
b01.set(7, crdnSpareaCd);
b01.set(8, this.gujesiStng);
b01.set(9, crdnInfo.string("STDG_CD"));
b01.set(10, crdnInfo.string("GPS_X"));
b01.set(11, crdnInfo.string("GPS_Y"));
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;
return b01;
}
@Override
public String[] extractForBPV(DataObject crdnInfo) {
String[] C01 = new String[10];
Hangul hangul = new Hangul(3);
public C01 extractForBPV(DataObject crdnInfo, boolean includeTxt) {
C01 c01 = new C01(includeTxt);
C01[0] = crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM");
C01[1] = crdnInfo.string("VHRNO");
c01.set(1, crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM"));
c01.set(2, 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;
if(this.gujesiStng != null && !this.gujesiStng.equals("")) {
C01[6] = gujesiStng;
} else {
C01[6] = "1";
}
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;
c01.set(3, crdnSeCd);
c01.set(4, crdnInfo.string("TEAM_ID"));
c01.set(5, crdnInfo.string("VLTN_CD"));
c01.set(6, crdnInfo.string("CRDN_PLC"));
c01.set(7, this.gujesiStng);
c01.set(8, crdnInfo.string("STDG_CD"));
c01.set(9, crdnInfo.string("GPS_X"));
c01.set(10, crdnInfo.string("GPS_Y"));
return c01;
}
@Override

@ -492,10 +492,12 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService
try {
String[] items = null;
boolean includeTxt = nxrpLinkSeDtlSn.equals("01");
if(taskSeCd.equals("PVS")) {
items = linkFileMaker.extractForPVS(crdnInfo);
items = linkFileMaker.extractForPVS(crdnInfo,includeTxt).get();
} else if(taskSeCd.equals("BPV")) {
items = linkFileMaker.extractForBPV(crdnInfo);
items = linkFileMaker.extractForBPV(crdnInfo,includeTxt).get();
}
if(nxrpLinkSeDtlSn.equals("01")) {
@ -528,6 +530,10 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService
zipFile.close();
for(File file : fileList) {
file.delete();
}
Crdn crdn = new Crdn();
crdn.setCrdnId(crdnID);
crdn.setModifiedBy(currentUser().getId());

@ -0,0 +1,63 @@
package cokr.xit.fims.nxrp;
import org.egovframe.rte.fdl.string.EgovStringUtil;
import cokr.xit.fims.cmmn.Hangul;
import cokr.xit.fims.cmmn.UnnamedItems;
public class B01 extends UnnamedItems {
class HasText {
public static final int[] maxByteLen = {14,30,2,10,2,60,60,60,2,1,10,20,20,3};
public static final String[] defaultValue = {"","","","","","","","","","1","0000000000","","",""};
}
class NoText {
public static final int[] maxByteLen = {17,30,2,10,2,60,2,1,10,20,20,1,4};
public static final String[] defaultValue = {"","","","","","","","1","0000000000","000","000","",""};
}
protected Hangul hangul;
protected boolean includeTxt;
public B01(boolean includeTxt){
this.hangul = new Hangul(3);
this.includeTxt = includeTxt;
int itemCount = 0;
if(includeTxt) {
itemCount = 14;
} else {
String[] unused = {"파일순서", "확장자"};
itemCount = 13 - unused.length;
}
items = new String[itemCount];
}
@Override
public void set(int i, String str) {
if(this.includeTxt) {
if(HasText.maxByteLen[i-1] != 0 && hangul.getByteLength(str) > HasText.maxByteLen[i-1]) {
throw new RuntimeException("[F]"+i+"번째 항목 "+HasText.maxByteLen[i-1]+"바이트 초과 오류");
}
if(EgovStringUtil.null2void(str).equals("")) {
super.set(i, HasText.defaultValue[i-1]);
} else {
super.set(i, str);
}
} else {
if(NoText.maxByteLen[i-1] != 0 && hangul.getByteLength(str) > NoText.maxByteLen[i-1]) {
throw new RuntimeException("[F]"+i+"번째 항목 "+NoText.maxByteLen[i-1]+"바이트 초과 오류");
}
if(EgovStringUtil.null2void(str).equals("")) {
super.set(i, NoText.defaultValue[i-1]);
} else {
super.set(i, str);
}
}
}
}

@ -0,0 +1,63 @@
package cokr.xit.fims.nxrp;
import org.egovframe.rte.fdl.string.EgovStringUtil;
import cokr.xit.fims.cmmn.Hangul;
import cokr.xit.fims.cmmn.UnnamedItems;
public class C01 extends UnnamedItems {
class HasText {
public static final int[] maxByteLen = {14,30,2,10,2,60,60,1,10,20,20,10,10,3};
public static final String[] defaultValue = {"","","","","","","","1","0000000000","","","","",""};
}
class NoText {
public static final int[] maxByteLen = {17,30,2,10,2,60,1,10,20,20,1,4};
public static final String[] defaultValue = {"","","","","","","1","0000000000","000","000","",""};
}
protected Hangul hangul;
protected boolean includeTxt;
public C01(boolean includeTxt){
this.hangul = new Hangul(3);
this.includeTxt = includeTxt;
int itemCount = 0;
if(includeTxt) {
itemCount = 14;
} else {
String[] unused = {"파일순서", "확장자"};
itemCount = 12 - unused.length;
}
items = new String[itemCount];
}
@Override
public void set(int i, String str) {
if(this.includeTxt) {
if(HasText.maxByteLen[i-1] != 0 && hangul.getByteLength(str) > HasText.maxByteLen[i-1]) {
throw new RuntimeException("[F]"+i+"번째 항목 "+HasText.maxByteLen[i-1]+"바이트 초과 오류");
}
if(EgovStringUtil.null2void(str).equals("")) {
super.set(i, HasText.defaultValue[i-1]);
} else {
super.set(i, str);
}
} else {
if(NoText.maxByteLen[i-1] != 0 && hangul.getByteLength(str) > NoText.maxByteLen[i-1]) {
throw new RuntimeException("[F]"+i+"번째 항목 "+NoText.maxByteLen[i-1]+"바이트 초과 오류");
}
if(EgovStringUtil.null2void(str).equals("")) {
super.set(i, NoText.defaultValue[i-1]);
} else {
super.set(i, str);
}
}
}
}
Loading…
Cancel
Save