faet:DB 이관 시 ids 업데이트 구현

This commit is contained in:
hylee 2022-12-22 14:00:49 +09:00
parent f3f82b1550
commit 3860ce04c1

View File

@ -0,0 +1,180 @@
package kcc.com.cmm.web;
import java.time.LocalDateTime;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import egovframework.rte.fdl.idgnr.EgovIdGnrService;
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
import kcc.com.cmm.LoginVO;
import kcc.com.cmm.service.AdrInnorixFileVO;
import kcc.com.cmm.service.InnorixFileService;
import kcc.com.utl.fcc.service.EgovStringUtil;
import kcc.kccadr.accdnt.ans.service.AnsVO;
import kcc.kccadr.cmm.RestResponse;
/**
*
* @author : 이호영
* @fileName : InnorixFileController.java
* @date : 2022.11.01
* @description : innorix 대용량 파일 업로드 솔루션
* ===========================================================
* DATE AUTHOR NOTE
* ----------------------------------------------------------- *
* 2022.11.01 이호영 최초 생성
*
*
*
*/
@Controller
public class DataTransferController {
private static final Logger logger = LoggerFactory.getLogger(DataTransferController.class);
// ADR_ID
@Resource(name="adrGnrService")
private EgovIdGnrService adrIdgenService;
// ADR_ASS_PST_SEQ
@Resource(name="adrAssMgrPstGnrService")
private EgovIdGnrService adrAssMgrPstGnrService;
// AHS_ID
@Resource(name="adrHstrySeqGnrService")
private EgovIdGnrService adrHstrySeqGnrService;
// FILE_ID
@Resource(name="egovFileIdGnrService")
private EgovIdGnrService egovFileIdGnrService;
//PTC_ID
@Resource(name="egovPrtclManageGnrService")
private EgovIdGnrService egovPrtclManageGnrService;
//RLD_ID
@Resource(name="egovRldMgrManageGnrService")
private EgovIdGnrService egovRldMgrManageGnrService;
//RPPL_ID
@Resource(name="rpplGnrService")
private EgovIdGnrService rpplGnrService;
//USRCNFRM_ID
@Resource(name="egovUsrCnfrmIdGnrService")
private EgovIdGnrService egovUsrCnfrmIdGnrService;
@RequestMapping(value = {"/common/transfer/updateIdsData.do"}, method = RequestMethod.GET)
public ResponseEntity<RestResponse> updateIdsData(@RequestParam String idsTableName, @RequestParam int updateCnt) throws Exception {
String resultMsg = String.format("ids 데이터를 성공적으로 업데이트 했습니다. "
+ "table_name = %s "
+ "update count = %s"
, idsTableName, updateCnt);
try {
if("ADR_ASS_PST_SEQ".equals(idsTableName))
{
for(int i=0; i<updateCnt; i++)
{
String nextId =adrAssMgrPstGnrService.getNextStringId();
System.out.println("nextId :: "+ nextId);
}
}
if("ADR_ID".equals(idsTableName))
{
for(int i=0; i<updateCnt; i++)
{
String nextId =adrIdgenService.getNextStringId();
System.out.println("nextId :: "+ nextId);
}
}
if("AHS_ID".equals(idsTableName))
{
for(int i=0; i<updateCnt; i++)
{
String nextId =adrHstrySeqGnrService.getNextStringId();
System.out.println("nextId :: "+ nextId);
}
}
if("FILE_ID".equals(idsTableName))
{
for(int i=0; i<updateCnt; i++)
{
String nextId =egovFileIdGnrService.getNextStringId();
System.out.println("nextId :: "+ nextId);
}
}
if("PTC_ID".equals(idsTableName))
{
for(int i=0; i<updateCnt; i++)
{
String nextId =egovPrtclManageGnrService.getNextStringId();
System.out.println("nextId :: "+ nextId);
}
}
if("RLD_ID".equals(idsTableName))
{
for(int i=0; i<updateCnt; i++)
{
String nextId =egovRldMgrManageGnrService.getNextStringId();
System.out.println("nextId :: "+ nextId);
}
}
if("RPPL_ID".equals(idsTableName))
{
for(int i=0; i<updateCnt; i++)
{
String nextId =rpplGnrService.getNextStringId();
System.out.println("nextId :: "+ nextId);
}
}
if("USRCNFRM_ID".equals(idsTableName))
{
for(int i=0; i<updateCnt; i++)
{
String nextId =egovUsrCnfrmIdGnrService.getNextStringId();
System.out.println("nextId :: "+ nextId);
}
}
} catch (Exception e) {
e.printStackTrace();
resultMsg = String.format("ids 데이터를 업데이트에 실패하였습니다. \\n"
+ "table_name = %s"
+ "update count = %s", idsTableName, updateCnt);
return ResponseEntity.ok(new RestResponse(HttpStatus.OK, resultMsg, LocalDateTime.now()));
}
// String.format("%s_", str);
return ResponseEntity.ok(new RestResponse(HttpStatus.OK, resultMsg, LocalDateTime.now()));
}
}