@ -22,8 +22,6 @@ import kr.xit.fims.biz.ec.model.NatlNewspaperSendXmlDTO;
import kr.xit.framework.biz.cmm.model.CmmFileDTO ;
import kr.xit.framework.biz.cmm.service.ICmmFileService ;
import kr.xit.framework.support.exception.BizRuntimeException ;
import kr.xit.framework.support.util.Checks ;
import kr.xit.framework.support.util.CmmFileUtils ;
import kr.xit.framework.support.util.constants.MessageKey ;
import kr.xit.framework.support.util.xml.XmlParseUtils ;
import lombok.RequiredArgsConstructor ;
@ -75,7 +73,7 @@ public class EcCtznSttemntService implements IEcCtznSttemntService {
@Override
@Transactional
public void modifyEcCtznSttemntDetail ( final CtznStmtDTO . CtznStmtDtl dto ) {
dto . setUpdusr ( getUser UniqId( ) ) ;
dto . setUpdusr ( getUser Info( ) . get UniqId( ) ) ;
mapper . updateEcCtznSttemntDetail ( dto ) ;
}
@ -101,11 +99,11 @@ public class EcCtznSttemntService implements IEcCtznSttemntService {
@Override
@Transactional
public void saveRtReglt ( final CtznStmtDTO . Request dto ) {
dto . setRegister ( getUser UniqId( ) ) ;
dto . setRegister ( getUser Info( ) . get UniqId( ) ) ;
dto . setRegltProcessSttusCode ( FimsConst . RegltProcessSttusCode . CRACKDOWN . getCode ( ) ) ;
mapper . insertRtRegltFromCtznStmt ( dto ) ;
dto . setUpdusr ( getUser UniqId( ) ) ;
dto . setUpdusr ( getUser Info( ) . get UniqId( ) ) ;
dto . setCtznSttemntStatusCode ( FimsConst . CtznSttemntStatusCode . ACCEPTANCE . getCode ( ) ) ;
mapper . updateStatusAndRegltIdOfEcCtznSttemntDetail ( dto ) ;
}
@ -117,7 +115,7 @@ public class EcCtznSttemntService implements IEcCtznSttemntService {
@Transactional
public void saveRtErpp ( final CtznStmtDTO . Request dto ) {
// 단속테이블
dto . setRegister ( getUser UniqId( ) ) ;
dto . setRegister ( getUser Info( ) . get UniqId( ) ) ;
dto . setRegltProcessSttusCode ( FimsConst . RegltProcessSttusCode . DESTRUCTION . getCode ( ) ) ;
mapper . insertRtRegltFromCtznStmt ( dto ) ;
@ -125,7 +123,7 @@ public class EcCtznSttemntService implements IEcCtznSttemntService {
mapper . insertRtErppFromCtznStmt ( dto ) ;
// 상태 변경
dto . setUpdusr ( getUser UniqId( ) ) ;
dto . setUpdusr ( getUser Info( ) . get UniqId( ) ) ;
dto . setCtznSttemntStatusCode ( FimsConst . CtznSttemntStatusCode . NOT_ACCEPTABLE . getCode ( ) ) ;
mapper . updateStatusAndRegltIdOfEcCtznSttemntDetail ( dto ) ;
}
@ -139,6 +137,81 @@ public class EcCtznSttemntService implements IEcCtznSttemntService {
}
@Override
@Transactional
public String saveCtznStmtAns ( CtznStmtDTO . CtznStmtAns dto ) {
// 답변 xml 파일 생성
List < CmmFileDTO . FileDtl > fileDtlList = cmmFileService . findFilesByJobSeCodeAndJobId (
CmmFileDTO . FileMst . builder ( )
. jobSeCode ( FimsConst . FileJobSeCode . NATL_NEWS_PAPER_RCV . getCode ( ) )
. fileJobId ( dto . getInterfaceSeqN ( ) + "01" )
. build ( ) ) ;
String tgtPath = uploadResPath + fileDtlList . get ( 0 ) . getFileCours ( ) ;
final String fileName = dto . getInterfaceSeqN ( ) + ".xml" ;
String xmlStr = XmlParseUtils . writeObjectToXml ( CtznStmtDTO . CtznStmtAns . getCtznStmtAnsDTO ( dto ) , NatlNewspaperSendXmlDTO . class ) ;
byte [ ] bytes = xmlStr . getBytes ( ) ;
Path path = Paths . get ( tgtPath + "/" + fileName ) ;
try {
// 대상폴더 미 존재시 생성
File f = FileUtils . getFile ( tgtPath ) ;
if ( ! f . exists ( ) ) f . mkdirs ( ) ;
Files . write ( path , bytes ) ;
} catch ( IOException e ) {
String msg = "시민 신고 답변 파일 생성 오류" ;
e . printStackTrace ( ) ;
log . error ( "{}" , msg ) ;
throw BizRuntimeException . create ( MessageKey . CUSTOM_MSG , msg ) ;
}
// 답변 테이블 insert(save)
dto . setSysCode ( getUserInfo ( ) . getOrgnztId ( ) ) ;
dto . setInsttCode ( getUserInfo ( ) . getPstinstCode ( ) ) ;
dto . setRegister ( getUserInfo ( ) . getUniqId ( ) ) ;
mapper . saveEcCtznSttemntAnswer ( dto ) ;
return tgtPath + "/" + fileName ;
}
@Override
@Transactional
public void dragAndDropSaveImg ( Map < String , Object > paraMap ) {
paraMap . forEach ( ( strKey , obj ) - > {
//Obj 형변환
List < Object > listaa = new ArrayList < > ( ) ;
listaa = ( List < Object > ) obj ;
for ( int i = 0 ; i < listaa . size ( ) ; i + + ) {
//파일 마스터 아이디 셋
CmmFileDTO . FileDtl vo = new CmmFileDTO . FileDtl ( ) ;
vo . setFileMastrId ( strKey ) ;
vo . setFileId ( ( String ) listaa . get ( i ) ) ;
log . info ( "[paramMap Key] : " + vo . getFileMastrId ( ) ) ;
log . info ( "[paramMap Value] : " + vo . getFileId ( ) ) ;
//파일디테일 테이블(fileMastr_id, fileId) 조회
List selectExist = mapper . dragAndDropIsExists ( vo ) ;
log . info ( "Result ==> " + selectExist ) ;
if ( selectExist . isEmpty ( ) ) {
vo . setFileMastrId ( strKey ) ;
//insert
mapper . dragAndDropSaveImg ( vo ) ;
//delete
mapper . dragAndDropDeleteImg ( vo ) ;
}
}
} ) ;
}
/ *
// TODO: zip file create
public String sendCtznSttemntRespons ( CtznStmtDTO . CtznStmtDtl dto ) {
final String fileName = dto . getInterfaceSeqN ( ) + dto . getCtznSttemntDetailSn ( ) ;
@ -170,7 +243,7 @@ public class EcCtznSttemntService implements IEcCtznSttemntService {
}
}
// TODO: format 정의후 반영
NatlNewspaperSendXmlDTO sendDto = NatlNewspaperSendXmlDTO . builder ( )
. interfaceSeqN ( dto . getInterfaceSeqN ( ) )
. pcdRstContL ( "1. 교통질서 확립에 힘써주신 점에 대해 감사드립니다.\n"
@ -207,38 +280,5 @@ public class EcCtznSttemntService implements IEcCtznSttemntService {
} ) ;
return zipFullFileName ;
}
@Override
@Transactional
public void dragAndDropSaveImg ( Map < String , Object > paraMap ) {
paraMap . forEach ( ( strKey , obj ) - > {
//Obj 형변환
List < Object > listaa = new ArrayList < > ( ) ;
listaa = ( List < Object > ) obj ;
for ( int i = 0 ; i < listaa . size ( ) ; i + + ) {
//파일 마스터 아이디 셋
CmmFileDTO . FileDtl vo = new CmmFileDTO . FileDtl ( ) ;
vo . setFileMastrId ( strKey ) ;
vo . setFileId ( ( String ) listaa . get ( i ) ) ;
log . info ( "[paramMap Key] : " + vo . getFileMastrId ( ) ) ;
log . info ( "[paramMap Value] : " + vo . getFileId ( ) ) ;
//파일디테일 테이블(fileMastr_id, fileId) 조회
List selectExist = mapper . dragAndDropIsExists ( vo ) ;
log . info ( "Result ==> " + selectExist ) ;
if ( selectExist . isEmpty ( ) ) {
vo . setFileMastrId ( strKey ) ;
//insert
mapper . dragAndDropSaveImg ( vo ) ;
//delete
mapper . dragAndDropDeleteImg ( vo ) ;
}
}
} ) ;
}
* /
}