fix: Transaction 관리 fix - 다중 테이블 작업시 rollback 불가(required 속성 미적용???)

annotation 방식으로 변경
main
minuk926 2 years ago
parent b8d127e0d0
commit cca33540ac

@ -8,6 +8,7 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.crypto.codec.Base64; import org.springframework.security.crypto.codec.Base64;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import kr.xit.fims.biz.cmm.FimsConst; import kr.xit.fims.biz.cmm.FimsConst;
@ -55,6 +56,7 @@ public class EcNatlNewspaperService implements IEcNatlNewspaperService {
*/ */
@SuppressWarnings("ConfusingArgumentToVarargsMethod") @SuppressWarnings("ConfusingArgumentToVarargsMethod")
@Override @Override
@Transactional
public void saveEsbRvcParse(final EcNatlNewspaperRcvReqDTO dto) { public void saveEsbRvcParse(final EcNatlNewspaperRcvReqDTO dto) {
String filePath = dto.getFilePath(); String filePath = dto.getFilePath();
@ -111,7 +113,7 @@ public class EcNatlNewspaperService implements IEcNatlNewspaperService {
fileMstDTO.setFileDirPath(FimsConst.FileDirDepth.DAY.getCode()); fileMstDTO.setFileDirPath(FimsConst.FileDirDepth.DAY.getCode());
cmmFileService.saveFiles(fileMstDTO, mfList); cmmFileService.saveFiles(fileMstDTO, mfList);
} }
log.debug(appendFileDto.toString()); //log.debug(appendFileDto.toString());
}); });
} }

@ -1,10 +1,8 @@
package kr.xit.fims.biz.ec.web; package kr.xit.fims.biz.ec.web;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -13,16 +11,13 @@ import org.springframework.web.servlet.ModelAndView;
import kr.xit.fims.biz.cmm.FimsConst; import kr.xit.fims.biz.cmm.FimsConst;
import kr.xit.fims.biz.ec.model.EcNatlNewspaperRcvReqDTO; import kr.xit.fims.biz.ec.model.EcNatlNewspaperRcvReqDTO;
import kr.xit.fims.biz.ec.model.NatlNewspaperDTO;
import kr.xit.fims.biz.ec.service.IEcNatlNewspaperService; import kr.xit.fims.biz.ec.service.IEcNatlNewspaperService;
import kr.xit.fims.biz.ec.model.NatlNewspaperRcvXmlDTO;
import kr.xit.framework.core.constants.FrameworkConstants; import kr.xit.framework.core.constants.FrameworkConstants;
import kr.xit.framework.core.model.ResultResponse; import kr.xit.framework.core.model.ResultResponse;
import kr.xit.framework.core.utils.fileExplorer.XitFileExplorerUtil; import kr.xit.framework.core.utils.fileExplorer.XitFileExplorerUtil;
import kr.xit.framework.core.utils.fileExplorer.function.DirectorySearch; import kr.xit.framework.core.utils.fileExplorer.function.DirectorySearch;
import kr.xit.framework.support.util.AjaxMessageMapRenderer; import kr.xit.framework.support.util.AjaxMessageMapRenderer;
import kr.xit.framework.support.util.constants.MessageKey; import kr.xit.framework.support.util.constants.MessageKey;
import kr.xit.framework.support.util.xml.XmlParseUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -31,6 +26,12 @@ import lombok.extern.slf4j.Slf4j;
@Controller @Controller
@RequestMapping(value = "/fims/biz/ec") @RequestMapping(value = "/fims/biz/ec")
public class EcNatlNewspaperController { public class EcNatlNewspaperController {
@Value("#{prop['file.rcv.root']}")
private String fileRcvRoot;
@Value("#{prop['file.rcv.natl-newspaper.path']}")
private String rcvNatlNewspaperPath;
private final IEcNatlNewspaperService service; private final IEcNatlNewspaperService service;
@ -41,7 +42,7 @@ public class EcNatlNewspaperController {
@RequestMapping(value = "/ecNatlNewspaperFileSelPopup") @RequestMapping(value = "/ecNatlNewspaperFileSelPopup")
public ModelAndView ecNatlNewspaperFileSelPopup(){ public ModelAndView ecNatlNewspaperFileSelPopup(){
ModelAndView mav = new ModelAndView(FimsConst.FIMS_JSP_BASE_PATH +"ec/ecNatlNewspaperFileSelPopup.popup"); ModelAndView mav = new ModelAndView(FimsConst.FIMS_JSP_BASE_PATH +"ec/ecNatlNewspaperFileSelPopup.popup");
mav.addObject("dirPath", "/Users/minuk/project_data/fims/01. 연계/01. 국민신문고/rcv"); mav.addObject("dirPath", fileRcvRoot + rcvNatlNewspaperPath);
return mav; return mav;
} }

@ -45,6 +45,7 @@ public class CmmFileService implements ICmmFileService {
private final ICmmFileMapper mapper; private final ICmmFileMapper mapper;
@Override @Override
@Transactional(readOnly = true)
public CmmFileMstDTO findFiles(String fileMstId) { public CmmFileMstDTO findFiles(String fileMstId) {
Assert.notNull(fileMstId, "대상 파일[fileMstId]을 선택해 주세요."); Assert.notNull(fileMstId, "대상 파일[fileMstId]을 선택해 주세요.");
@ -66,7 +67,7 @@ public class CmmFileService implements ICmmFileService {
* @return CmmFileMst * @return CmmFileMst
*/ */
@Override @Override
@Transactional @Transactional//(propagation = Propagation.REQUIRES_NEW)
public CmmFileMstDTO saveFiles(final CmmFileMstDTO fileMstDTO, final MultipartFile[] files) { public CmmFileMstDTO saveFiles(final CmmFileMstDTO fileMstDTO, final MultipartFile[] files) {
Assert.notNull(fileMstDTO, "파일 정보가 존재하지 않습니다."); Assert.notNull(fileMstDTO, "파일 정보가 존재하지 않습니다.");
Assert.notNull(fileMstDTO.getJobSeCode(), "파일 구분 코드[fileCtgCd] 정보가 존재하지 않습니다."); Assert.notNull(fileMstDTO.getJobSeCode(), "파일 구분 코드[fileCtgCd] 정보가 존재하지 않습니다.");

@ -106,10 +106,12 @@
<!-- ============================================================================= --> <!-- ============================================================================= -->
<!-- spring boot framework logging setting --> <!-- spring boot framework logging setting -->
<!-- ============================================================================= --> <!-- ============================================================================= -->
<logger name="org.springframework.transaction.interceptor" level="DEBUG" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework" level="info" additivity="false"> <logger name="org.springframework" level="info" additivity="false">
<appender-ref ref="CONSOLE"/> <appender-ref ref="CONSOLE"/>
</logger> </logger>
<!-- ============================================================================= --> <!-- ============================================================================= -->
<!-- ============================================================================= --> <!-- ============================================================================= -->

@ -103,10 +103,27 @@
<!-- ============================================================================= --> <!-- ============================================================================= -->
<!-- spring boot framework logging setting --> <!-- spring boot framework logging setting -->
<!-- ============================================================================= --> <!-- ============================================================================= -->
<logger name="org.springframework" level="WARN" additivity="false"> <logger name="org.springframework.transaction.interceptor" level="DEBUG" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.core" level="WARN" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.beans" level="WARN" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.context" level="WARN" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.web" level="WARN" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.springframework.test" level="WARN" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.hibernate" level="WARN" additivity="false">
<appender-ref ref="CONSOLE"/> <appender-ref ref="CONSOLE"/>
</logger> </logger>
<!-- ============================================================================= --> <!-- ============================================================================= -->
<!-- ============================================================================= --> <!-- ============================================================================= -->
@ -126,6 +143,10 @@
<appender-ref ref="CONSOLE"/> <appender-ref ref="CONSOLE"/>
</logger> </logger>
<logger name="org.apache.commons.digester" level="WARN" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<!-- ============================================================================= --> <!-- ============================================================================= -->
<!-- ============================================================================= --> <!-- ============================================================================= -->
@ -173,9 +194,9 @@
<logger name="jdbc.audit" level="OFF" additivity="false"/> <logger name="jdbc.audit" level="OFF" additivity="false"/>
<logger name="org.apache.commons" level="OFF" additivity="false"/> <logger name="org.apache.commons" level="OFF" additivity="false"/>
<logger name="log4j.category.org.springframework" level="WARN"> <!-- <logger name="log4j.category.org.springframework" level="WARN">-->
<appender-ref ref="CONSOLE"/> <!-- <appender-ref ref="CONSOLE"/>-->
</logger> <!-- </logger>-->
<root level="WARN"> <root level="WARN">

@ -124,10 +124,12 @@ exception.log.trace=true
# k byte # k byte
file.upload.allow.max-size: 2048 file.upload.allow.max-size: 2048
file.upload.allow.ext= file.upload.allow.ext=
file.upload.root=/Users/minuk/data/fims/upload #file.upload.root=/Users/minuk/data/fims/upload
file.upload.root=D:/data/fims/upload
file.upload.natl-newspaper.path=/natl-newspaper file.upload.natl-newspaper.path=/natl-newspaper
#file.rcv.root=/Users/minuk/data/fims/rcv #file.rcv.root=/Users/minuk/data/fims/rcv
#file.rcv.natl-newspaper.path=/natl-newspaper/rcv #file.rcv.natl-newspaper.path=/natl-newspaper/rcv
file.rcv.root=/Users/minuk/project_data/fims/01. \uC5F0\uACC4/01. \uAD6D\uBBFC\uC2E0\uBB38\uACE0 #file.rcv.root=/Users/minuk/project_data/fims/01. \uC5F0\uACC4/01. \uAD6D\uBBFC\uC2E0\uBB38\uACE0
file.rcv.root=D:/project_data/fims/01. \uC5F0\uACC4/01. \uAD6D\uBBFC\uC2E0\uBB38\uACE0
file.rcv.natl-newspaper.path=/rcv file.rcv.natl-newspaper.path=/rcv

Loading…
Cancel
Save