feat: 부서코드(관할구청코드) 추가 반영

properties -> DB화 (API KEY, 부서코드)
dev
Jonguk. Lim 6 months ago
parent 4f4973780f
commit 2be9bb2055

@ -62,13 +62,6 @@
<artifactId>jaxb-api</artifactId>
</dependency>
<!-- rest docs -->
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-core</artifactId>
<version>2.0.6.RELEASE</version>
<scope>test</scope>
</dependency>
<!-- swagger -->
<dependency>
<groupId>org.springdoc</groupId>

@ -2,6 +2,7 @@ package cokr.xit.adds.biz.nims.dao;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
@ -33,13 +34,19 @@ public interface BizNimsMapper extends AbstractMapper {
//------------------------------------------------------------------------------------------------------
void mergeBsshInfoSt(final NimsApiDto.BsshInfoSt dto);
List<NimsApiDto.BsshInfoSt> selectBsshInfos(final NimsApiRequest.BsshInfoReq dto);
void mergeProductInfoKd(final NimsApiDto.ProductInfoKd dto);
List<NimsApiDto.ProductInfoKd> selectProductInfos(final NimsApiRequest.ProductInfoReq dto);
void mergeJurisdictionGovInfo(NimsApiDto.JurisdictionGovInfo dto);
List<NimsApiDto.JurisdictionGovInfo> selectJurisdictionGovInfos(NimsApiRequest.JurisdictionGovInfoReq dto);
// int mergeStorgeInfo(NimsApiDto.StorageInfo dto);
//------------------------------------------------------------------------------------------------------
// NIMS BIZ
//------------------------------------------------------------------------------------------------------
Optional<Map<String,String>> selectApiInfInfoByUserId(Map<String,String> map);
int insertDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceipt dto);
int updateDsuseMgtRslt(final BizNimsRequest.DsuseMgtRslt dto);
int insertDsuseMgt(final BizNimsRequest.DsuseMgt dto);
@ -61,6 +68,8 @@ public interface BizNimsMapper extends AbstractMapper {
//int updateUsrRptIdNoOfDsuseMgt(final NimsApiDto.DsuseRptInfo dto);
NimsApiDto.DsuseRptInfo selectDsuseRptInfoByUsrRptIdNo(final Map<String, String> map);
//List<NimsApiDto.DsuseRptInfoDtl> selectDsuseRptInfoDtls(final Map<String, String> map);

@ -537,6 +537,9 @@ public class BizNimsRequest {
@NotEmpty(message = "사용자 ID는 필수 입니다")
private String userId;
@Schema(title = "부서(관할청)코드", example = " ")
private String deptCd;
/**
* <pre>
*

@ -31,7 +31,7 @@ public interface BizNimsService {
List<NimsApiDto.BsshInfoSt> saveBsshInfoSt(final NimsApiRequest.BsshInfoReq dto);
List<NimsApiDto.ProductInfoKd> saveProductInfoKd(final NimsApiRequest.ProductInfoReq dto, boolean isMnfSeqInfo);
List<NimsApiDto.MnfSeqInfo> getMnfSeqInfo(final NimsApiRequest.MnfSeqInfoReq dto);
// List<NimsApiDto.JurisdictionGovInfo> getJurisdictionGovInfo(NimsApiRequest.JurisdictionGovInfoRequest dto);
List<NimsApiDto.JurisdictionGovInfo> getJurisdictionGovInfo(final NimsApiRequest.JurisdictionGovInfoReq dto);
// List<NimsApiDto.StorageInfo> saveStorageInfo(NimsApiRequest.StorageInfoRequest dto);
/**
@ -59,7 +59,7 @@ public interface BizNimsService {
BizNimsRequest.DsuseMgtReceipt saveDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceipt dto, final List<BizNimsRequest.DsuseMgtDtl> dtls, List<MultipartFile> files);
BizNimsRequest.DsuseMgtRslt saveDsuseMgtRslt(final BizNimsRequest.DsuseMgtRslt dto, List<MultipartFile> files);
BizNimsRequest.DsuseMgt saveDsuseMgt(final BizNimsRequest.DsuseMgt dto);
List<BizNimsResponse.DsuseMgtRes> getDsuseMgts(final BizNimsRequest.DsuseMgtInq dto);
List<BizNimsResponse.DsuseMgtRes> getDsuseMgts(final BizNimsRequest.DsuseMgtInq dto, final String apiKey);
void modifyPrgsSttsOfDsuseMgt(final BizNimsRequest.DsuseMgt dto);
NimsApiDto.ProductInfoKd getPrdMnfSeqInfoOfBarcode(final String barcodeStr);

@ -11,7 +11,6 @@ import javax.validation.Validator;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@ -54,23 +53,6 @@ import lombok.extern.slf4j.Slf4j;
@RequiredArgsConstructor
@Service
public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsService {
/**
*
*/
@Value("${app.file.rpt.path:}")
private String rptPath;
/**
*
*/
@Value("${app.file.img.path:d:/data/adds-api/img}")
private String dsuseImgPath;
/**
*
*/
@Value("${app.inf.nims.ofCd:}")
private String ofCd;
private static final Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
private final InfNimsService infNimsService;
@ -86,38 +68,42 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* -> API
* DB
* - (3 )
* @param dto NimsApiRequest.BsshInfoRequest
* @param reqDto NimsApiRequest.BsshInfoRequest
* @return List<NimsApiDto.BsshInfoSt>
* </pre>
*/
@Override
public List<BsshInfoSt> saveBsshInfoSt(BsshInfoReq dto) {
if(!isEmpty(dto.getBn()) && dto.getBn().length() < 3) {
public List<BsshInfoSt> saveBsshInfoSt(BsshInfoReq reqDto) {
if(!isEmpty(reqDto.getBn()) && reqDto.getBn().length() < 3) {
throw ApiCustomException.create("업체[사업자]명은 3자 이상 으로 조회해 주세요");
}
// DB 조회
List<BsshInfoSt> list = new ArrayList<>();
if("N".equals(dto.getDbSkipYn())) {
list = bizNimsMapper.selectBsshInfos(dto);
if("N".equals(reqDto.getDbSkipYn())) {
list = bizNimsMapper.selectBsshInfos(reqDto);
if (!isEmpty(list)) return list;
}
if(isEmpty(reqDto.getK())){
reqDto.setK(getApiInfInfo(reqDto.getUserId()).get("apiKey"));
}
while(true) {
// 마약류취급자식별번호로 마약류취급자정보 조회
NimsApiResult.Response<BsshInfoSt> rslt = infNimsService.getBsshInfoSt(dto);
NimsApiResult.Response<BsshInfoSt> rslt = infNimsService.getBsshInfoSt(reqDto);
List<BsshInfoSt> curList = rslt.getResult();
if(isEmpty(curList)) break;
for (BsshInfoSt d : curList) {
d.setRgtr(Constants.NIMS_API_USER_ID);
d.setRgtr(reqDto.getUserId());
bizNimsMapper.mergeBsshInfoSt(d);
}
list.addAll(curList);
if(rslt.isEndYn()) break;
dto.setPg(String.valueOf(Integer.parseInt(dto.getPg()) + 1));
reqDto.setPg(String.valueOf(Integer.parseInt(reqDto.getPg()) + 1));
}
return list;
@ -130,71 +116,117 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* DB
* , ,
* - (2 )
* @param dto NimsApiRequest.ProductInfoRequest
* @param reqDto NimsApiRequest.ProductInfoRequest
* @param isMnfSeqInfo
* @return
* </pre>
*/
@Override
public List<NimsApiDto.ProductInfoKd> saveProductInfoKd(NimsApiRequest.ProductInfoReq dto, boolean isMnfSeqInfo) {
if(isEmpty(dto.getP()) && isEmpty(dto.getPn())){
public List<NimsApiDto.ProductInfoKd> saveProductInfoKd(NimsApiRequest.ProductInfoReq reqDto, boolean isMnfSeqInfo) {
if(isEmpty(reqDto.getP()) && isEmpty(reqDto.getPn())){
throw ApiCustomException.create("상품번호 또는 상품명은 필수 입니다");
}
if(!isEmpty(dto.getPn()) && dto.getPn().length() < 2){
if(!isEmpty(reqDto.getPn()) && reqDto.getPn().length() < 2){
throw ApiCustomException.create("상품명은 2자 이상 으로 조회해 주세요");
}
List<NimsApiDto.ProductInfoKd> list = new ArrayList<>();
// DB 조회
if("N".equals(dto.getDbSkipYn())) {
list = bizNimsMapper.selectProductInfos(dto);
if("N".equals(reqDto.getDbSkipYn())) {
list = bizNimsMapper.selectProductInfos(reqDto);
if (!isEmpty(list)){
if(isMnfSeqInfo) productInfoaddMnfSeqs(list);
if(isMnfSeqInfo){
if(isEmpty(reqDto.getK())){
productInfoaddMnfSeqs(list, getApiInfInfo(reqDto.getUserId()).get("apiKey"));
}else {
productInfoaddMnfSeqs(list, reqDto.getK());
}
}
return list;
}
}
if(isEmpty(reqDto.getK())){
reqDto.setK(getApiInfInfo(reqDto.getUserId()).get("apiKey"));
}
while(true) {
// 제품코드로 제품정보 조회
NimsApiResult.Response<NimsApiDto.ProductInfoKd> rslt = infNimsService.getProductInfoKd(dto);
NimsApiResult.Response<NimsApiDto.ProductInfoKd> rslt = infNimsService.getProductInfoKd(reqDto);
List<NimsApiDto.ProductInfoKd> curList = rslt.getResult();
if(isEmpty(curList)) break;
for (NimsApiDto.ProductInfoKd d : curList) {
d.setRgtr(Constants.NIMS_API_USER_ID);
d.setRgtr(reqDto.getUserId());
bizNimsMapper.mergeProductInfoKd(d);
}
// 제조 번호, 일련번호, 유효기간 정보 목록 추가
if(isMnfSeqInfo) productInfoaddMnfSeqs(curList);
if(isMnfSeqInfo) productInfoaddMnfSeqs(curList, reqDto.getK());
list.addAll(curList);
if(rslt.isEndYn()) break;
dto.setPg(String.valueOf(Integer.parseInt(dto.getPg()) + 1));
reqDto.setPg(String.valueOf(Integer.parseInt(reqDto.getPg()) + 1));
}
return list;
}
@Override
public List<NimsApiDto.MnfSeqInfo> getMnfSeqInfo(NimsApiRequest.MnfSeqInfoReq dto) {
NimsApiResult.Response<NimsApiDto.MnfSeqInfo> response = infNimsService.getMnfSeqInfo(dto);
public List<NimsApiDto.MnfSeqInfo> getMnfSeqInfo(NimsApiRequest.MnfSeqInfoReq reqDto) {
if(isEmpty(reqDto.getK())){
reqDto.setK(getApiInfInfo(reqDto.getUserId()).get("apiKey"));
}
NimsApiResult.Response<NimsApiDto.MnfSeqInfo> response = infNimsService.getMnfSeqInfo(reqDto);
List<NimsApiDto.MnfSeqInfo> results = response.getResultOrThrow();
// FIXME: 내림 차순 정렬
// 림 차순 정렬
results.sort((a, b) -> {
if (isEmpty(a.getPrdValidDe()) && isEmpty(b.getPrdValidDe()))
return 0;
if (isEmpty(a.getPrdValidDe()))
return 1;
if (isEmpty(b.getPrdValidDe()))
return -1;
return b.getPrdValidDe().compareTo(a.getPrdValidDe());
if (isEmpty(b.getPrdValidDe()))
return 1;
return a.getPrdValidDe().compareTo(b.getPrdValidDe());
});
return results;
}
@Override
public List<NimsApiDto.JurisdictionGovInfo> getJurisdictionGovInfo(final NimsApiRequest.JurisdictionGovInfoReq reqDto) {
List<NimsApiDto.JurisdictionGovInfo> list = new ArrayList<>();
// DB 조회 : 주소검색이면 DB 조회 skip
if("N".equals(reqDto.getDbSkipYn()) && isEmpty(reqDto.getAdr())) {
list = bizNimsMapper.selectJurisdictionGovInfos(reqDto);
if (!isEmpty(list)){
return list;
}
}
reqDto.setK(getApiInfInfo(reqDto.getUserId()).get("apiKey"));
while(true) {
// 기관정보 조회
NimsApiResult.Response<NimsApiDto.JurisdictionGovInfo> rslt = infNimsService.getJurisdictionGovInfo(reqDto);
List<NimsApiDto.JurisdictionGovInfo> curList = rslt.getResult();
if(isEmpty(curList)) break;
for(NimsApiDto.JurisdictionGovInfo d : curList) {
d.setRgtr(reqDto.getUserId());
bizNimsMapper.mergeJurisdictionGovInfo(d);
}
list.addAll(curList);
if(rslt.isEndYn()) break;
reqDto.setPg(String.valueOf(Integer.parseInt(reqDto.getPg()) + 1));
}
return list;
}
/**
* <pre>
* API DB
@ -222,6 +254,10 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
public List<NimsApiDto.DsuseRptInfo> saveDsuseRptInfo(NimsApiRequest.DsuseRptInfoReq reqDto) {
List<NimsApiDto.DsuseRptInfo> nimsList = new ArrayList<>();
Map<String, String> apiInfInfo = getApiInfInfo(reqDto.getUserId());
reqDto.setK(apiInfInfo.get("apiKey"));
reqDto.setFg4(apiInfInfo.get("deptCd")); // 관할관청코드
while(true) {
NimsApiResult.Response<NimsApiDto.DsuseRptInfo> rslt = infNimsService.getDsuseRptInfo(reqDto);
List<NimsApiDto.DsuseRptInfo> curList = rslt.getResultOrThrow();
@ -238,7 +274,8 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// 미완료(종료)된 폐기 관리 목록 조회
List<BizNimsResponse.DsuseMgtRes> dsuseMgts = getDsuseMgts(BizNimsRequest.DsuseMgtInq.builder()
.prgrsSttsCd(Constants.PRGRS_STTS_CD.COMPLETE.getCode())
.build());
.build(),
apiInfInfo.get("apiKey"));
//////////////////////////////////////////////////////////////////////////////
// FIXME : 테스트를 위한 코드
@ -286,7 +323,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// 폐기 보고 정보 데이타 생성
createDsuseRpt(dto);
createDsuseRpt(dto, reqDto.getUserId());
rtnTmplist.add(dto);
rtnlist.add(dto);
@ -304,7 +341,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// 2. 신규 외의 경우(rptTyCd : 1 - 취소, 2 - 변경)
String errMsg = null;
for (NimsApiDto.DsuseRptInfo dto : workList) {
dto.setRgtr(Constants.NIMS_API_USER_ID);
dto.setRgtr(reqDto.getUserId());
// 신규인 경우 skip
if("0".equals(dto.getRptTyCd())) continue;
@ -320,10 +357,10 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// 조건 : 사용자보고식별번호 = 참조사용자보고식별번호
// => usr_rpt_id_no -> refUsrRptIdNo update
// => 취소인 경우 use_yn = 'N' update
updateDsuseRptAndDsuseMgt(dto);
updateDsuseRptAndDsuseMgt(dto, reqDto.getUserId());
// 2-3. tb_dsuse_rpt_info, tb_dsuse_rpt_info_dtl 생성 (취소인 경우는 tb_dsuse_rpt_info의 사용 여부 'N'으로 생성)
createDsuseRpt(dto);
createDsuseRpt(dto, reqDto.getUserId());
// FIXME : API 적용 필요
// 결과 return 대상 데이타 List에서 조회한 변경 대상이 있는 경우 replace
@ -359,109 +396,110 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
/**
* <pre>
*
* @param dto BizNimsRequest.DsuseMgtReceipt
* @param reqDto BizNimsRequest.DsuseMgtReceipt
* @return BizNimsRequest.DsuseMgt
* </pre>
*/
public BizNimsRequest.DsuseMgtReceipt saveDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceipt dto, final List<BizNimsRequest.DsuseMgtDtl> dtls, final List<MultipartFile> files) {
ApiUtil.validate(dto, null, validator);
if(dto.getRndDtlRptCnt() != dtls.size()) throw ApiCustomException.create("폐기물 보고수 오류[폐기물 갯수 확인]");
public BizNimsRequest.DsuseMgtReceipt saveDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceipt reqDto, final List<BizNimsRequest.DsuseMgtDtl> dtls, final List<MultipartFile> files) {
ApiUtil.validate(reqDto, null, validator);
if(reqDto.getRndDtlRptCnt() != dtls.size()) throw ApiCustomException.create("폐기물 보고수 오류[폐기물 갯수 확인]");
ApiUtil.validate(dtls, null, validator);
dto.setRgtr(dto.getUserId());
reqDto.setRgtr(reqDto.getUserId());
if(files.size() != dtls.size()) throw ApiCustomException.create("폐기물 파일 갯수 오류[파일 갯수 확인]");
if(bizNimsMapper.insertDsuseMgtReceipt(dto) == 1){
if(bizNimsMapper.insertDsuseMgtReceipt(reqDto) == 1){
int dtlCnt = 0;
for (BizNimsRequest.DsuseMgtDtl d : dtls) {
String sn = StringUtils.leftPad(dtlCnt + 1 + "", 3, "0");
d.setDscdmngId(dto.getDscdmngId());
d.setDscdmngId(reqDto.getDscdmngId());
d.setDscdmngSn(sn);
d.setRgtr(dto.getUserId());
d.setRgtr(reqDto.getUserId());
dtlCnt = dtlCnt + bizNimsMapper.insertDsuseMgtDtl(d);
d.setFileId(uploadFileAndSave(Constants.FILE_INF_TYPE.DSUSE_PRD_IMG.getCode(), dto.getDscdmngId(), sn, files.get(dtlCnt-1)));
d.setFileId(uploadFileAndSave(Constants.FILE_INF_TYPE.DSUSE_PRD_IMG.getCode(), reqDto.getDscdmngId(), sn, files.get(dtlCnt-1)));
}
if(dtls.size() != dtlCnt) throw ApiCustomException.create("폐기 관리 상세 등록 실패");
} else {
throw ApiCustomException.create("폐기 관리 마스터 등록 실패");
}
return dto;
return reqDto;
}
/**
* <pre>
* []
* @param dto BizNimsRequest.DsuseMgtReceipt
* @param reqDto BizNimsRequest.DsuseMgtReceipt
* @return BizNimsRequest.DsuseMgt
* </pre>
*/
public BizNimsRequest.DsuseMgtRslt saveDsuseMgtRslt(final BizNimsRequest.DsuseMgtRslt dto, final List<MultipartFile> files) {
ApiUtil.validate(dto, null, validator);
dto.setRgtr(dto.getUserId());
public BizNimsRequest.DsuseMgtRslt saveDsuseMgtRslt(final BizNimsRequest.DsuseMgtRslt reqDto, final List<MultipartFile> files) {
ApiUtil.validate(reqDto, null, validator);
reqDto.setRgtr(reqDto.getUserId());
if(bizNimsMapper.updateDsuseMgtRslt(dto) == 1){
if(bizNimsMapper.updateDsuseMgtRslt(reqDto) == 1){
int idx = 1;
for (MultipartFile mf : files) {
uploadFileAndSave(Constants.FILE_INF_TYPE.DSUSE_IMG.getCode(), dto.getDscdmngId(), String.valueOf(idx), mf);
uploadFileAndSave(Constants.FILE_INF_TYPE.DSUSE_IMG.getCode(), reqDto.getDscdmngId(), String.valueOf(idx), mf);
idx++;
}
} else {
throw ApiCustomException.create("폐기 관리 정보 변경[통보(결과) 처리] 실패");
}
return dto;
return reqDto;
}
/**
* <pre>
*
* @param dto BizNimsRequest.DsuseMgt
* @param reqDto BizNimsRequest.DsuseMgt
* @return BizNimsRequest.DsuseMgt
* </pre>
*/
public BizNimsRequest.DsuseMgt saveDsuseMgt(BizNimsRequest.DsuseMgt dto) {
ApiUtil.validate(dto, null, validator);
if(dto.getRndDtlRptCnt() != dto.getDsuseMgtDtls().size()) throw ApiCustomException.create("폐기물 보고수 오류[폐기물 갯수 확인]");
dto.setRgtr(dto.getUserId());
public BizNimsRequest.DsuseMgt saveDsuseMgt(BizNimsRequest.DsuseMgt reqDto) {
ApiUtil.validate(reqDto, null, validator);
if(reqDto.getRndDtlRptCnt() != reqDto.getDsuseMgtDtls().size()) throw ApiCustomException.create("폐기물 보고수 오류[폐기물 갯수 확인]");
reqDto.setRgtr(reqDto.getUserId());
if(bizNimsMapper.insertDsuseMgt(dto) == 1){
if(bizNimsMapper.insertDsuseMgt(reqDto) == 1){
int dtlCnt = 0;
for (BizNimsRequest.DsuseMgtDtl d : dto.getDsuseMgtDtls()) {
d.setDscdmngId(dto.getDscdmngId());
for (BizNimsRequest.DsuseMgtDtl d : reqDto.getDsuseMgtDtls()) {
d.setDscdmngId(reqDto.getDscdmngId());
d.setDscdmngSn(StringUtils.leftPad(dtlCnt + 1 + "", 3, "0"));
d.setRgtr(dto.getUserId());
d.setRgtr(reqDto.getUserId());
dtlCnt = dtlCnt + bizNimsMapper.insertDsuseMgtDtl(d);
}
if(dto.getDsuseMgtDtls().size() != dtlCnt) throw ApiCustomException.create("폐기 관리 상세 등록 실패");
if(reqDto.getDsuseMgtDtls().size() != dtlCnt) throw ApiCustomException.create("폐기 관리 상세 등록 실패");
} else {
throw ApiCustomException.create("폐기 관리 마스터 등록 실패");
}
return dto;
return reqDto;
}
/**
* <pre>
*
* @param dto BizNimsRequest.DsuseMgtInq
* @param reqDto BizNimsRequest.DsuseMgtInq
* @return List<BizNimsResponse.DsuseMgtResponse>
* </pre>
*/
@Override
public List<BizNimsResponse.DsuseMgtRes> getDsuseMgts(BizNimsRequest.DsuseMgtInq dto) {
List<BizNimsResponse.DsuseMgtRes> resList = bizNimsMapper.selectDsuseMgts(dto);
public List<BizNimsResponse.DsuseMgtRes> getDsuseMgts(final BizNimsRequest.DsuseMgtInq reqDto, String apiKey) {
List<BizNimsResponse.DsuseMgtRes> resList = bizNimsMapper.selectDsuseMgts(reqDto);
if(isEmpty(apiKey)) apiKey = getApiInfInfo(reqDto.getUserId()).get("apiKey");
for (BizNimsResponse.DsuseMgtRes r : resList) {
r.setRptTyCdNm(Constants.RPT_TY_CD.getName(r.getRptTyCd()));
r.setDsuseSeCdNm(Constants.DSUSE_SE_CD.getName(r.getDsuseSeCd()));
r.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(r.getDsusePrvCd()));
r.setDsuseMthCdNm(Constants.DSUSE_MTH_CD.getName(r.getDsuseMthCd()));
for (BizNimsResponse.DsuseMgtRes dto : resList) {
dto.setRptTyCdNm(Constants.RPT_TY_CD.getName(dto.getRptTyCd()));
dto.setDsuseSeCdNm(Constants.DSUSE_SE_CD.getName(dto.getDsuseSeCd()));
dto.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(dto.getDsusePrvCd()));
dto.setDsuseMthCdNm(Constants.DSUSE_MTH_CD.getName(dto.getDsuseMthCd()));
Map<String, String> map = new HashMap<>();
map.put("dscdmngId", r.getDscdmngId());
map.put("dscdmngId", dto.getDscdmngId());
List<BizNimsResponse.DsuseMgtDtlRes> dsuseRptInfoDtls = bizNimsMapper.selectDsuseMgtDtls(map);
setDsuseMgtDtlAddProductInfo(dsuseRptInfoDtls);
r.getDsuseMgtDtls().addAll(dsuseRptInfoDtls);
setDsuseMgtDtlAddProductInfo(dsuseRptInfoDtls, reqDto.getUserId(), apiKey);
dto.getDsuseMgtDtls().addAll(dsuseRptInfoDtls);
}
return resList;
@ -496,16 +534,20 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// FIXME: saveDsuseRptInfo() 메소드를 활용할 수 있도록 구성
@Override
public List<NimsApiDto.DsuseRptInfo> getDsuseMgtMapping(BizNimsRequest.DsuseMgt reqDto) {
Map<String, String> apiInfInfo = getApiInfInfo(reqDto.getUserId());
// 0. GET 폐기관리 데이타 정보
BizNimsResponse.DsuseMgtRes dsuseMgtDto = getDsuseMgts(
BizNimsRequest.DsuseMgtInq.builder()
.dscdmngIds(List.of(reqDto.getDscdmngId()))
.deptCd(apiInfInfo.get("deptCd"))
.prgrsSttsCd(null)
.build())
.build(),
apiInfInfo.get("apiKey"))
.get(0);
NimsApiRequest.DsuseRptInfoReq rptDto = NimsApiRequest.DsuseRptInfoReq.builder()
.k(apiInfInfo.get("apiKey"))
.fg("1")
.pg("1")
.fg2("2")
@ -514,7 +556,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
.sdt("20220101")
.edt("20220131")
.bc(reqDto.getBsshCd())
.fg4(ofCd)
.fg4(apiInfInfo.get("deptCd"))
.build();
// 1. GET 폐기보고 데이타 목록 - NIMS API 호출
@ -567,7 +609,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
if(!"0".equals(dto.getRptTyCd())) continue;
// 폐기 보고 정보 데이타 생성
createDsuseRpt(dto);
createDsuseRpt(dto, reqDto.getUserId());
// return List에 추가
rtnList.add(dto);
@ -598,11 +640,11 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// 4-2) 폐기 관리 테이블에 사용자보고식별번호 반영
// -> 취소인 경우는 사용자/원사용자 식별번호 clear
// -> 변경인 경우는 사용자보고식별번호 -> 참조사용자보고식별번호 update
updateDsuseRptAndDsuseMgt(dto);
updateDsuseRptAndDsuseMgt(dto, reqDto.getUserId());
// 4-3) tb_dsuse_rpt_info, tb_dsuse_rpt_info_dtl 생성
// -> 취소인 경우는 tb_dsuse_rpt_info의 사용 여부 'N'으로 생성
createDsuseRpt(dto);
createDsuseRpt(dto, reqDto.getUserId());
// FIXME : API 적용후 확인 필요
// 5. 결과 return 대상 데이타 List에서 NIMS 변경 데이타인 경우 대상에서 제외
@ -692,6 +734,29 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
//------------------------------------------------------------------------------------------------------
// private method
//------------------------------------------------------------------------------------------------------
/**
* <pre>
* ID API KEY (profile)
* - apiKey
* - : deptCd - OF_CD
* @param userId
* @return Map<String, String> API KEY ,
* </pre>
*/
private Map<String, String> getApiInfInfo(String userId) {
if(isEmpty(userId)) {
throw ApiCustomException.create("API 연계를 위한 정보를 찾기위해 사용자 아이디(userId)는 필수입니다");
}
return bizNimsMapper.selectApiInfInfoByUserId(
Map.of("userId", userId, "profile", Constants.PROFILE)
).orElseThrow(
() -> ApiCustomException.create(String.format("사용자[%s]의 API KEY 정보가 존재하지 않습니다", userId))
);
}
/**
* <pre>
* set
@ -700,18 +765,20 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* @param dtlList <NimsApiDto.DsuseRptInfoDtl>
* </pre>
*/
private void setDsuseMgtDtlAddProductInfo(List<BizNimsResponse.DsuseMgtDtlRes> dtlList) {
private void setDsuseMgtDtlAddProductInfo(List<BizNimsResponse.DsuseMgtDtlRes> dtlList, String userId, String apiKey) {
for (BizNimsResponse.DsuseMgtDtlRes r : dtlList) {//if()
for (BizNimsResponse.DsuseMgtDtlRes r : dtlList) {
// 마약항정구분(nrcdSeNm), 중점일반구분(prtmSenm)
if (isEmpty(r.getNrcdSeNm()) || isEmpty(r.getPrtmSeNm())) {
//NimsApiResult.Response<NimsApiDto.ProductInfoKd> result = infNimsService.getProductInfoKd(
List<NimsApiDto.ProductInfoKd> list = saveProductInfoKd(
NimsApiRequest.ProductInfoReq.builder()
.k(apiKey)
.fg("1")
.pg("1")
.p(r.getPrductCd())
.userId(userId)
.build(),
false
);
@ -730,6 +797,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
if (isEmpty(r.getBsshNm()) && !isEmpty(r.getBsshCd())) {
List<BsshInfoSt> list = saveBsshInfoSt(
BsshInfoReq.builder()
.k(apiKey)
.fg("1")
.pg("1")
.bc(r.getBsshCd())
@ -756,8 +824,8 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* @param dto NimsApiDto.DsuseRptInfo
* </pre>
*/
private void createDsuseRpt(NimsApiDto.DsuseRptInfo dto) {
dto.setRgtr(Constants.NIMS_API_USER_ID);
private void createDsuseRpt(final NimsApiDto.DsuseRptInfo dto, String userId) {
dto.setRgtr(userId);
dto.setRptTyCdNm(Constants.RPT_TY_CD.getName(dto.getRptTyCd()));
dto.setDsuseSeCdNm(Constants.DSUSE_SE_CD.getName(dto.getDsuseSeCd()));
dto.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(dto.getDsusePrvCd()));
@ -834,8 +902,8 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* @param dto NimsApiDto.DsuseRptInfo
* </pre>
*/
private void updateDsuseRptAndDsuseMgt(NimsApiDto.DsuseRptInfo dto) {
dto.setRgtr(Constants.NIMS_API_USER_ID);
private void updateDsuseRptAndDsuseMgt(NimsApiDto.DsuseRptInfo dto, String userId) {
dto.setRgtr(userId);
String errMsg;
if ("1".equals(dto.getRptTyCd())) errMsg = "취소";
else errMsg = "변경";
@ -869,9 +937,10 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
* <pre>
*
* @param list List<NimsApiDto.ProductInfoKd>
* @param apiKey Api Key
* </pre>
*/
private void productInfoaddMnfSeqs(List<NimsApiDto.ProductInfoKd> list) {
private void productInfoaddMnfSeqs(final List<NimsApiDto.ProductInfoKd> list, final String apiKey) {
String productCd = "";
try {
@ -881,9 +950,11 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
List<NimsApiDto.MnfSeqInfo> mnfList = getMnfSeqInfo(
NimsApiRequest.MnfSeqInfoReq.builder()
.k(apiKey)
.fg("1")
.pg("1")
.p(d.getPrductCd())
.userId("")
.build()
);
d.getMnfSeqInfos().addAll(mnfList);
@ -935,98 +1006,6 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
/**
* <pre>
* set
* (prmisnNo), (rprsntvNm) set
* @param resList List<BizNimsResponse.DsuseMgtResponse>
* </pre>
*/
private void setAddBsshInfo(List<BizNimsResponse.DsuseRptInfoRes> resList) {
for (BizNimsResponse.DsuseRptInfoRes r : resList) {
r.setRptTyCdNm(Constants.RPT_TY_CD.getName(r.getRptTyCd()));
r.setDsuseSeCdNm(Constants.DSUSE_SE_CD.getName(r.getDsuseSeCd()));
r.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(r.getDsusePrvCd()));
r.setDsuseMthCdNm(Constants.DSUSE_MTH_CD.getName(r.getDsuseMthCd()));
if (isEmpty(r.getPrmisnNo())) {
List<BsshInfoSt> list = saveBsshInfoSt(
BsshInfoReq.builder()
.fg("1")
.pg("1")
.bc(r.getBsshCd())
.build()
);
if (isEmpty(list)) {
// FIXME : 데이타 정상 흐름 확인후 comment 제거
continue;
//throw ApiCustomException.create(String.format("데이타 오류(마약류취급자식별번호[%s]에 해당하는 데이타가 없습니다)", r.getBsshCd()));
}
r.setPrmisnNo(list.get(0).getPrmisnNo());
r.setRprsntvNm(list.get(0).getRprsntvNm());
}
}
}
/**
* <pre>
* set
* (nrcdSeNm), (prtmSenm), (bsshNm)
* (stdPackngStleNm), (pceCoUnitNm) set
* @param dtlList <NimsApiDto.DsuseRptInfoDtl>
* </pre>
*/
private void setAddProductInfo(List<NimsApiDto.DsuseRptInfoDtl> dtlList) {
for (NimsApiDto.DsuseRptInfoDtl r : dtlList) {//if()
// 마약항정구분(nrcdSeNm), 중점일반구분(prtmSenm)
if (isEmpty(r.getNrcdSeNm()) || isEmpty(r.getPrtmSeNm())) {
//NimsApiResult.Response<NimsApiDto.ProductInfoKd> result = infNimsService.getProductInfoKd(
List<NimsApiDto.ProductInfoKd> list = saveProductInfoKd(
NimsApiRequest.ProductInfoReq.builder()
.fg("1")
.pg("1")
.p(r.getPrductCd())
.build(),
false
);
if (isEmpty(list)) {
// FIXME : 데이타 정상 흐름 확인후 comment 제거
continue;
//throw ApiCustomException.create(String.format("데이타 오류(제품코드[%s]에 해당하는 데이타가 없습니다)", r.getPrductCd()));
}
r.setNrcdSeNm(list.get(0).getNrcdSeNm());
r.setPrtmSeNm(list.get(0).getPrtmSeNm());
r.setStdPackngStleNm(list.get(0).getStdPackngStleNm());
r.setPceCoUnitNm(list.get(0).getPceCoUnitNm());
}
// 제조수입자명(bsshNm)
if (isEmpty(r.getBsshNm()) && !isEmpty(r.getBsshCd())) {
List<BsshInfoSt> list = saveBsshInfoSt(
BsshInfoReq.builder()
.fg("1")
.pg("1")
.bc(r.getBsshCd())
.build()
);
if (isEmpty(list)) {
// FIXME : 데이타 정상 흐름 확인후 comment 제거
continue;
//throw ApiCustomException.create(String.format("데이타 오류(마약류취급자식별번호[%s]에 해당하는 데이타가 없습니다)", r.getBsshCd()));
}
r.setBsshNm(list.get(0).getBsshNm());
}
}
}
// @Override
// public List<NimsApiDto.JurisdictionGovInfo> getJurisdictionGovInfo(NimsApiRequest.JurisdictionGovInfoRequest dto) {
// NimsApiResult.Response<NimsApiDto.JurisdictionGovInfo> result = infNimsService.getJurisdictionGovInfo(dto);
// return result.getResultOrThrow();
// }
//
// @Override
// public List<NimsApiDto.StorageInfo> saveStorageInfo(NimsApiRequest.StorageInfoRequest dto) {
// NimsApiResult.Response<NimsApiDto.StorageInfo> result = infNimsService.getStorageInfo(dto);
@ -1040,6 +1019,100 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// }
// /**
// * <pre>
// * 마약류 취급자 업체 추가 정보 set
// * 허가번호(prmisnNo), 대표자명(rprsntvNm) set
// * @param resList List<BizNimsResponse.DsuseMgtResponse>
// * </pre>
// */
// private void setAddBsshInfo(List<BizNimsResponse.DsuseRptInfoRes> resList) {
// for (BizNimsResponse.DsuseRptInfoRes r : resList) {
// r.setRptTyCdNm(Constants.RPT_TY_CD.getName(r.getRptTyCd()));
// r.setDsuseSeCdNm(Constants.DSUSE_SE_CD.getName(r.getDsuseSeCd()));
// r.setDsusePrvCdNm(Constants.DSUSE_PRV_CD.getName(r.getDsusePrvCd()));
// r.setDsuseMthCdNm(Constants.DSUSE_MTH_CD.getName(r.getDsuseMthCd()));
//
// if (isEmpty(r.getPrmisnNo())) {
// List<BsshInfoSt> list = saveBsshInfoSt(
// BsshInfoReq.builder()
// .fg("1")
// .pg("1")
// .bc(r.getBsshCd())
// .build()
// );
// if (isEmpty(list)) {
// // FIXME : 데이타 정상 흐름 확인후 comment 제거
// continue;
// //throw ApiCustomException.create(String.format("데이타 오류(마약류취급자식별번호[%s]에 해당하는 데이타가 없습니다)", r.getBsshCd()));
// }
// r.setPrmisnNo(list.get(0).getPrmisnNo());
// r.setRprsntvNm(list.get(0).getRprsntvNm());
// }
// }
// }
//
// /**
// * <pre>
// * 제품 추가 정보 set
// * 마약항정구분(nrcdSeNm), 중점일반구분(prtmSenm), 제조수입자명(bsshNm)
// * 제품최소유통단위(stdPackngStleNm), 제품낱개단위명(pceCoUnitNm) set
// * @param dtlList <NimsApiDto.DsuseRptInfoDtl>
// * </pre>
// */
// private void setAddProductInfo(List<NimsApiDto.DsuseRptInfoDtl> dtlList) {
//
// for (NimsApiDto.DsuseRptInfoDtl r : dtlList) {//if()
// // 마약항정구분(nrcdSeNm), 중점일반구분(prtmSenm)
// if (isEmpty(r.getNrcdSeNm()) || isEmpty(r.getPrtmSeNm())) {
// //NimsApiResult.Response<NimsApiDto.ProductInfoKd> result = infNimsService.getProductInfoKd(
//
// List<NimsApiDto.ProductInfoKd> list = saveProductInfoKd(
// NimsApiRequest.ProductInfoReq.builder()
// .fg("1")
// .pg("1")
// .p(r.getPrductCd())
// .build(),
// false
// );
// if (isEmpty(list)) {
// // FIXME : 데이타 정상 흐름 확인후 comment 제거
// continue;
// //throw ApiCustomException.create(String.format("데이타 오류(제품코드[%s]에 해당하는 데이타가 없습니다)", r.getPrductCd()));
// }
// r.setNrcdSeNm(list.get(0).getNrcdSeNm());
// r.setPrtmSeNm(list.get(0).getPrtmSeNm());
// r.setStdPackngStleNm(list.get(0).getStdPackngStleNm());
// r.setPceCoUnitNm(list.get(0).getPceCoUnitNm());
// }
//
// // 제조수입자명(bsshNm)
// if (isEmpty(r.getBsshNm()) && !isEmpty(r.getBsshCd())) {
// List<BsshInfoSt> list = saveBsshInfoSt(
// BsshInfoReq.builder()
// .fg("1")
// .pg("1")
// .bc(r.getBsshCd())
// .build()
// );
// if (isEmpty(list)) {
// // FIXME : 데이타 정상 흐름 확인후 comment 제거
// continue;
// //throw ApiCustomException.create(String.format("데이타 오류(마약류취급자식별번호[%s]에 해당하는 데이타가 없습니다)", r.getBsshCd()));
// }
// r.setBsshNm(list.get(0).getBsshNm());
// }
// }
// }
/*
@Override
public BizNimsAarDto.AarHeader getTgtDsuseRptData(BizNimsRequest.DsuseMgt dto) {

@ -3,7 +3,6 @@ package cokr.xit.adds.biz.nims.web;
import java.util.List;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -57,7 +56,7 @@ public class BizNimsController {
@Operation(summary = "마약류 취급자 정보 조회(NIMS API)", description = "마약류 취급자 정보 조회<br><br>NIMS API 호출 결과를 DB에 저장후 결과 Return<br><br><strong>bi-사업자등록번호, hp-요양기관번호, bn-업체명, bc-취급자식별번호 중 하나는 필수<strong>")
@PostMapping(value = "/getBsshInfoSt")
public ApiBaseResponse<List<NimsApiDto.BsshInfoSt>> getBsshInfoSt(
@RequestBody @Validated NimsApiRequest.BsshInfoReq dto
@RequestBody NimsApiRequest.BsshInfoReq dto
) {
return ApiBaseResponse.of(bizNimsService.saveBsshInfoSt(dto));
}
@ -65,7 +64,7 @@ public class BizNimsController {
@Operation(summary = "마약류 상품 정보 조회(NIMS API)", description = "마약류 상품정보 조회<br><br>NIMS API 호출 결과를 DB에 저장후 결과 Return")
@PostMapping(value = "/getProductInfoKd")
public ApiBaseResponse<List<NimsApiDto.ProductInfoKd>> getMnfSeqInfo(
@RequestBody @Validated NimsApiRequest.ProductInfoReq dto
@RequestBody NimsApiRequest.ProductInfoReq dto
) {
return ApiBaseResponse.of(bizNimsService.saveProductInfoKd(dto, false));
}
@ -73,7 +72,7 @@ public class BizNimsController {
@Operation(summary = "마약류 상품 정보 & 제조번호 조회(NIMS API)", description = "마약류 상품정보 & 제조번호 조회<br><br>NIMS API 호출 결과를 DB에 저장후 결과 Return")
@PostMapping(value = "/getProductInfoKdAndMnfSeqInfo")
public ApiBaseResponse<List<NimsApiDto.ProductInfoKd>> getProductInfoKdAndMnfSeqInfo(
@RequestBody @Validated NimsApiRequest.ProductInfoReq dto
@RequestBody NimsApiRequest.ProductInfoReq dto
) {
return ApiBaseResponse.of(bizNimsService.saveProductInfoKd(dto, true));
}
@ -81,15 +80,23 @@ public class BizNimsController {
@Operation(summary = "제조 일련 번호 정보 조회(NIMS API)", description = "제보 일련 번호 정보 조회<br><br>NIMS API 호출 결과 Return")
@PostMapping(value = "/getMnfSeqInfo")
public ApiBaseResponse<List<NimsApiDto.MnfSeqInfo>> getMnfSeqInfo(
@RequestBody @Validated NimsApiRequest.MnfSeqInfoReq dto
@RequestBody NimsApiRequest.MnfSeqInfoReq dto
) {
return ApiBaseResponse.of(bizNimsService.getMnfSeqInfo(dto));
}
@Operation(summary = "관할 허가 관청 정보 조회(NIMS API)", description = "관할 허가 관청 정보 조회<br><br>NIMS API 호출 결과 Return")
@PostMapping(value = "/getJurisdictionGovInfo")
public ApiBaseResponse<List<NimsApiDto.JurisdictionGovInfo>> getJurisdictionGovInfo(
@RequestBody NimsApiRequest.JurisdictionGovInfoReq dto
) {
return ApiBaseResponse.of(bizNimsService.getJurisdictionGovInfo(dto));
}
@Operation(summary = "폐기 보고 정보 목록 조회(NIMS API)", description = "업체의 폐기 보고 정보 목록 조회<br><br>NIMS API 호출 결과를 DB에 저장후 Return")
@PostMapping("/getDsuseRptInfo")
public ApiBaseResponse<List<NimsApiDto.DsuseRptInfo>> getDsuseRptInfo(
@RequestBody @Validated NimsApiRequest.DsuseRptInfoReq dto
@RequestBody NimsApiRequest.DsuseRptInfoReq dto
) {
return ApiBaseResponse.of(bizNimsService.saveDsuseRptInfo(dto));
}
@ -197,7 +204,7 @@ public class BizNimsController {
public ApiBaseResponse<List<BizNimsResponse.DsuseMgtRes>> getDsuseMgts(
@RequestBody BizNimsRequest.DsuseMgtInq dto
) {
return ApiBaseResponse.of(bizNimsService.getDsuseMgts(dto));
return ApiBaseResponse.of(bizNimsService.getDsuseMgts(dto, null));
}
@ -292,13 +299,7 @@ public class BizNimsController {
// @Operation(summary = "관할 허가 관청 정보 조회(NIMS API)", description = "관할 허가 관청 정보 조회<br><br>NIMS API 호출 결과 Return")
// @PostMapping(value = "/getJurisdictionGovInfo")
// public ApiBaseResponse<List<NimsApiDto.JurisdictionGovInfo>> getJurisdictionGovInfo(
// @RequestBody @Validated NimsApiRequest.JurisdictionGovInfoRequest dto
// ) {
// return ApiBaseResponse.of(bizNimsService.getJurisdictionGovInfo(dto));
// }
//
// @Operation(summary = "저장소 정보 조회(NIMS API)", description = "저장소 정보 조회<br><br>NIMS API 호출 결과를 DB에 저장후 Return")
// @PostMapping(value = "/getStorageInfo")

@ -1,7 +1,5 @@
package cokr.xit.adds.core;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import org.apache.commons.lang3.StringUtils;
@ -24,7 +22,7 @@ import lombok.Getter;
*/
public class Constants {
public static final String API_URL_PATTERNS = "/*";
public static final Charset CHARSET_UTF8 = StandardCharsets.UTF_8;
public static final String PROFILE = System.getProperty("spring.profiles.active");
public static final String FILE_DLMTR = System.getProperty("os.name").contains("Window") ? "\\" : "/";
public static final String DATE_REGX = "^[12]\\d{3}((0[1-9])|(1[0-2]))(0[1-9]|[12]\\d|3[01])$";

@ -76,9 +76,6 @@ public class TraceLoggerAspect {
@Value("${app.log.mdc.enabled:true}")
private boolean isMdcLogEnabled;
@Value("#{'${app.log.mdc.exclude-patterns}'.split(',')}")
private String[] excludes;
private final IApiLoggingService apiLoggingService;
private static final String REQUEST_TRACE_ID = "request_trace_id";

@ -684,53 +684,50 @@ public class NimsApiDto {
private String bsshNm;
}
/**
* response
*/
@Getter
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public static class JurisdictionGovInfo extends AuditDto {
/**
*
*/
@JsonAlias("OF_CD")
private String ofCd;
/**
*
*/
@JsonAlias("OF_NM")
private String ofNm;
/**
*
*/
@JsonAlias("UP_OF_NM")
private String upOfNm;
// /**
// * 관할 허가 관청 정보 조회 response
// */
// @Getter
// @NoArgsConstructor
// @AllArgsConstructor
// @SuperBuilder
// public static class JurisdictionGovInfo extends AuditDto {
// /**
// * 기관코드
// */
// @JsonAlias("OF_CD")
// private String ofCd;
//
// /**
// * 기관명
// */
// @JsonAlias("OF_NM")
// private String ofNm;
//
// /**
// * 상위 기관명
// */
// @JsonAlias("UP_OF_NM")
// private String upOfNm;
//
// /**
// * 최상위 기관명
// */
// @JsonAlias("TOP_OF_NM")
// private String topOfNm;
//
// /**
// * 기본 주소
// */
// @JsonAlias("BASS_ADRES")
// private String bassAdres;
//
// /**
// * 상세 주소
// */
// @JsonAlias("BASS_DTL_ADRES")
// private String bassDtlAdres;
// }
/**
*
*/
@JsonAlias("TOP_OF_NM")
private String topOfNm;
/**
*
*/
@JsonAlias("BASS_ADRES")
private String bassAdres;
/**
*
*/
@JsonAlias("BASS_DTL_ADRES")
private String bassDtlAdres;
}
//
// /**
// * 저장소 정보 조회 response

@ -44,7 +44,7 @@ public class NimsApiRequest {
/**
*
*/
@Schema(requiredMode = REQUIRED, title = "인증키", description = "인증키", example = "998003699950fa950b798c9edea1b38f3cfbcf3b77e03e419")
@Schema(requiredMode = REQUIRED, title = "인증키", description = "인증키", example = " ")
@NotEmpty(message = "인증키는 필수 입니다")
String k;
@ -123,6 +123,14 @@ public class NimsApiRequest {
@Builder.Default
//@JsonIgnore
private String dbSkipYn = "N";
/**
* <pre>
*
* </pre>
*/
@Schema(title = "사용자ID", description = "해당 사용자ID로 관할관청코드및 API KEY 조회", example = "suji")
String userId;
}
/**
@ -137,7 +145,7 @@ public class NimsApiRequest {
/**
*
*/
@Schema(requiredMode = REQUIRED, title = "인증키", description = "인증키", example = "998003699950fa950b798c9edea1b38f3cfbcf3b77e03e419")
@Schema(requiredMode = REQUIRED, title = "인증키", description = "인증키", example = " ")
@NotEmpty(message = "인증키는 필수 입니다")
String k;
@ -197,12 +205,21 @@ public class NimsApiRequest {
* DB skip
* DB NIMS API
* true DB skip
*
* </pre>
*/
@Schema(title = "DB 조회 skip 여부", description = "DB 조회 skip 여부(DB 조회 없이 NIMS API호출 하려면 Y)", example = "N")
@Builder.Default
//@JsonIgnore
private String dbSkipYn = "N";
/**
* <pre>
*
* </pre>
*/
@Schema(title = "사용자ID", description = "해당 사용자ID로 관할관청코드및 API KEY 조회", example = "suji")
String userId;
}
@Schema(name = "DsuseRptInfoReq", description = "폐기 보고 정보 조회 request")
@ -214,7 +231,7 @@ public class NimsApiRequest {
/**
*
*/
@Schema(requiredMode = REQUIRED, title = "인증키", description = "인증키", example = "998003699950fa950b798c9edea1b38f3cfbcf3b77e03e419")
@Schema(requiredMode = REQUIRED, title = "인증키", description = "인증키", example = " ")
@NotEmpty(message = "인증키는 필수 입니다")
String k;
@ -313,6 +330,13 @@ public class NimsApiRequest {
@NotEmpty(message = "관할 관청 기관 코드는 필수 입니다")
String fg4;
/**
* <pre>
*
* </pre>
*/
@Schema(title = "사용자ID", description = "해당 사용자ID로 관할관청코드및 API KEY 조회", example = "suji")
String userId;
}
/**
@ -327,7 +351,7 @@ public class NimsApiRequest {
/**
*
*/
@Schema(requiredMode = REQUIRED, title = "인증키", description = "인증키", example = "998003699950fa950b798c9edea1b38f3cfbcf3b77e03e419")
@Schema(requiredMode = REQUIRED, title = "인증키", description = "인증키", example = " ")
@NotEmpty(message = "인증키는 필수 입니다")
String k;
@ -372,61 +396,89 @@ public class NimsApiRequest {
@Pattern(regexp = "^$|[0-9]{5,}", message = "제품코드를 5자이상 입력해주세요(제품코드는 13자리)")
@Builder.Default
String t = StringUtils.EMPTY;
/**
* <pre>
*
* </pre>
*/
@Schema(title = "사용자ID", description = "해당 사용자ID로 관할관청코드및 API KEY 조회", example = "suji")
String userId;
}
/**
* request
*/
@Schema(name = "JurisdictionGovInfoRequest", description = "관할 허가 관청 정보 조회 request")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class JurisdictionGovInfoReq {
/**
*
*/
@Schema(requiredMode = REQUIRED, title = "인증키", description = "인증키", example = "")
@NotEmpty(message = "인증키는 필수 입니다")
String k;
/**
*
* 1-
*/
@Schema(requiredMode = REQUIRED, title = "조회범위", description = "조회범위(1-전체)", allowableValues = {"1"})
@Pattern(regexp = "1", message = "조회 범위는 필수 입니다(1-전체)")
String fg;
/**
*
*/
@Schema(requiredMode = REQUIRED, title = "조회 페이지", description = "조회 페이지", example = "1")
@Pattern(regexp = "[0-9]{1,}", message = "조회 페이지는 필수 입니다")
String pg;
/**
*
*/
@Schema(title = "기관명", description = "기관명", example = " ")
@Builder.Default
String onm = StringUtils.EMPTY;
/**
*
*/
@Schema(title = "기관 코드", description = "기관 코드", example = " ")
@Builder.Default
String ocd = StringUtils.EMPTY;
/**
*
*/
@Schema(title = "주소", description = "주소", example = " ")
@Builder.Default
String adr = StringUtils.EMPTY;
/**
* <pre>
* DB skip
* DB NIMS API
* true DB skip
* </pre>
*/
@Schema(title = "DB 조회 skip 여부", description = "DB 조회 skip 여부(DB 조회 없이 NIMS API호출 하려면 Y)", example = "N")
@Builder.Default
//@JsonIgnore
private String dbSkipYn = "N";
/**
* <pre>
*
* </pre>
*/
@Schema(title = "사용자ID", description = "해당 사용자ID로 관할관청코드및 API KEY 조회", example = "suji")
String userId;
}
// /**
// * 관할 허가 관청 정보 조회 request
// */
// @Schema(name = "JurisdictionGovInfoRequest", description = "관할 허가 관청 정보 조회 request")
// @Data
// @NoArgsConstructor
// @AllArgsConstructor
// @Builder
// public static class JurisdictionGovInfoReq {
// /**
// * 인증키
// */
// @Schema(requiredMode = REQUIRED, title = "인증키", description = "인증키", example = "998003699950fa950b798c9edea1b38f3cfbcf3b77e03e419")
// @NotEmpty(message = "인증키는 필수 입니다")
// String k;
//
// /**
// * 조회범위
// * 1-전체
// */
// @Schema(requiredMode = REQUIRED, title = "조회범위", description = "조회범위(1-전체)", allowableValues = {"1"})
// @Pattern(regexp = "1", message = "조회 범위는 필수 입니다(1-전체)")
// String fg;
//
// /**
// * 조회 페이지
// */
// @Schema(requiredMode = REQUIRED, title = "조회 페이지", description = "조회 페이지", example = "1")
// @Pattern(regexp = "[0-9]{1,}", message = "조회 페이지는 필수 입니다")
// String pg;
//
// /**
// * 기관명
// */
// @Schema(title = "기관명", description = "기관명", example = " ")
// @Builder.Default
// String onm = StringUtils.EMPTY;
//
// /**
// * 기관 코드
// */
// @Schema(title = "기관 코드", description = "기관 코드", example = " ")
// @Builder.Default
// String ocd = StringUtils.EMPTY;
//
// /**
// * 주소
// */
// @Schema(title = "주소", description = "주소", example = " ")
// @Builder.Default
// String adr = StringUtils.EMPTY;
// }
//
// /**
// * 저장소 정보 조회 request
// */
@ -439,7 +491,7 @@ public class NimsApiRequest {
// /**
// * 인증키
// */
// @Schema(requiredMode = REQUIRED, title = "인증키", description = "인증키", example = "998003699950fa950b798c9edea1b38f3cfbcf3b77e03e419")
// @Schema(requiredMode = REQUIRED, title = "인증키", description = "인증키", example = " ")
// @NotEmpty(message = "인증키는 필수 입니다")
// String k;
//

@ -25,8 +25,8 @@ public interface InfNimsService {
NimsApiResult.Response<NimsApiDto.ProductInfoKd> getProductInfoKd(NimsApiRequest.ProductInfoReq dto);
NimsApiResult.Response<NimsApiDto.MnfSeqInfo> getMnfSeqInfo(NimsApiRequest.MnfSeqInfoReq dto);
//
// NimsApiResult.Response<NimsApiDto.JurisdictionGovInfo> getJurisdictionGovInfo(NimsApiRequest.JurisdictionGovInfoRequest dto);
NimsApiResult.Response<NimsApiDto.JurisdictionGovInfo> getJurisdictionGovInfo(NimsApiRequest.JurisdictionGovInfoReq dto);
//
// NimsApiResult.Response<NimsApiDto.StorageInfo> getStorageInfo(NimsApiRequest.StorageInfoRequest dto);

@ -48,37 +48,33 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
@Value("${app.inf.nims.url}")
private String nimsUrl;
@Value("${app.inf.nims.api-key}")
private String nimsApiKey;
/**
*
* API URL
*/
@Value("${app.inf.nims.ofCd}")
private String ofCd;
@Value("${app.inf.nims.api.bsshinfoStV1}")
private String bsshInfoStV1;
/**
* API URL
*/
@Value("${app.inf.nims.api.productinfoKd}")
private String productinfoKd;
@Value("${app.inf.nims.api.reportinfo}")
private String reportinfo;
/**
* API URL
*/
@Value("${app.inf.nims.api.seqinfo}")
private String seqinfo;
/**
* API URL
*/
@Value("${app.inf.nims.api.officeinfo}")
private String officeinfo;
@Value("${app.inf.nims.api.placeinfoV1}")
private String placeinfoV1;
@Override
@TraceLogging
public NimsApiResult.Response<NimsApiDto.BsshInfoSt> getBsshInfoSt(NimsApiRequest.BsshInfoReq dto) {
dto.setK(nimsApiKey);
ApiUtil.validate(dto, null, validator);
if(isEmpty(dto.getBi()) && isEmpty(dto.getHp()) && isEmpty(dto.getBn()) && isEmpty(dto.getBc())) {
throw ApiCustomException.create("필수 파라메터 에러(bi-사업자등록번호, hp-요양기관번호, bn-업체명, bc-취급자식별번호 중 하나는 필수)");
@ -93,7 +89,6 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
@Override
@TraceLogging
public NimsApiResult.Response<NimsApiDto.ProductInfoKd> getProductInfoKd(NimsApiRequest.ProductInfoReq dto) {
dto.setK(nimsApiKey);
ApiUtil.validate(dto, null, validator);
if(!isEmpty(dto.getYmd())) ApiUtil.checkYmdError(dto.getYmd(), null);
@ -105,7 +100,6 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
@Override
@TraceLogging
public NimsApiResult.Response<NimsApiDto.MnfSeqInfo> getMnfSeqInfo(NimsApiRequest.MnfSeqInfoReq dto) {
dto.setK(nimsApiKey);
ApiUtil.validate(dto, null, validator);
if(!isEmpty(dto.getYmd())) ApiUtil.checkYmdError(dto.getYmd(), null);
@ -114,21 +108,20 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
return result.getResponse();
}
// @Override
// @TraceLogging
// public NimsApiResult.Response<NimsApiDto.JurisdictionGovInfo> getJurisdictionGovInfo(
// NimsApiRequest.JurisdictionGovInfoRequest dto) {
// dto.setK(nimsApiKey);
// ApiUtil.validate(dto, null, validator);
// if(isEmpty(dto.getOcd()) && isEmpty(dto.getOnm()) && isEmpty(dto.getAdr())) {
// throw ApiCustomException.create("필수 파라메터 에러(ocd-기관 코드, onm-기관명, adr-주소 중 하나는 필수)");
// }
//
// String rslt = ApiUtil.callNimsApi(nimsUrl + officeinfo, dto);
// NimsApiResult<NimsApiDto.JurisdictionGovInfo> result = json.parse(rslt, new TypeReference<>() {});
// return result.getResponse();
// }
//
@Override
@TraceLogging
public NimsApiResult.Response<NimsApiDto.JurisdictionGovInfo> getJurisdictionGovInfo(
NimsApiRequest.JurisdictionGovInfoReq dto) {
ApiUtil.validate(dto, null, validator);
if(isEmpty(dto.getOcd()) && isEmpty(dto.getOnm()) && isEmpty(dto.getAdr())) {
throw ApiCustomException.create("필수 파라메터 에러(ocd-기관 코드, onm-기관명, adr-주소 중 하나는 필수)");
}
String rslt = ApiUtil.callNimsApi(nimsUrl + officeinfo, dto);
NimsApiResult<NimsApiDto.JurisdictionGovInfo> result = json.parse(rslt, new TypeReference<>() {});
return result.getResponse();
}
// @Override
// @TraceLogging
// public NimsApiResult.Response<NimsApiDto.StorageInfo> getStorageInfo(NimsApiRequest.StorageInfoRequest dto) {
@ -148,8 +141,6 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
@Override
public NimsApiResult.Response<NimsApiDto.DsuseRptInfo> getDsuseRptInfo(NimsApiRequest.DsuseRptInfoReq dto) {
dto.setK(nimsApiKey);
dto.setFg4(ofCd);
ApiUtil.validate(dto, null, validator);
ApiUtil.checkYmdError(dto.getSdt(), "sdt");
ApiUtil.checkYmdError(dto.getEdt(), "edt");

@ -27,7 +27,8 @@ spring:
active: '@springProfilesActive@'
include:
- app
- inf
- nims
#- mois
main:
allow-bean-definition-overriding: true
@ -43,12 +44,12 @@ spring:
username: ENC(M4g3XkH/bzupKW2w4WYH3Q==)
password: ENC(fzV0zekJQ7t/QHiz75k+xqdsDUWW6+MY)
auto-commit: false
# read-only: false
security:
user:
name: admin
password: admin
# security:
# user:
# name: admin
# password: admin
mvc:
static-path-pattern: /resources/static/**
log-request-details: false
@ -126,18 +127,7 @@ spring:
activate:
on-profile: local
datasource:
hikari:
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy #org.mariadb.jdbc.Driver
#driver-class-name: org.mariadb.jdbc.Driver
#jdbc-url: jdbc:mariadb://211.119.124.9:4407/egov?useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&autoReconnect=true
# jdbc-url: jdbc:log4jdbc:mariadb://211.119.124.9:4407/adds?useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&autoReconnect=true
# username: addsweb
# password: addsweb1234
jdbc-url: ENC(O26qFSqrfqMEjEU6jHUqrboYIPpTnwDIHIYQg2ddL0k7VsGvDbAMd/SwDeXjan17CykVLz3Qe++xW+VqxvQpT7/+Kxhl2ry1hTElOPxRHp6OrN/8GyhaScLCcBZgpxNcEAZ3a5qWJKIyLR/+KFk6YpW77lD10jFJvscNNYvFoWQIs/K5eAa/m3JnktX9Ed2RN8ttGgBET5g=)
username: ENC(M4g3XkH/bzupKW2w4WYH3Q==)
password: ENC(fzV0zekJQ7t/QHiz75k+xqdsDUWW6+MY)
auto-commit: false
devtools:
restart:
@ -165,15 +155,12 @@ app:
# exclude-patterns:
mdc:
enabled: false
# batch 실행 url 제외 패턴
exclude-patterns: '/api/batch/(.*), /api/batch/v1/*Bulks(.*)'
---
spring:
config:
activate:
on-profile: prod
datasource:
hikari:
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy #org.mariadb.jdbc.Driver
@ -187,14 +174,11 @@ spring:
password: ENC(fzV0zekJQ7t/QHiz75k+xqdsDUWW6+MY)
auto-commit: false
springdoc:
api-docs:
enabled: true
swagger-ui:
enabled: true
path: /swagger-ui.html
csrf:
enabled: false
logging:
level:
root: info
web: debug
cokr.xit: debug
app:
cors:
@ -202,7 +186,13 @@ app:
log:
parameter-enabled: true
response-enabled: true
file:
root.path: ${app.data.root.path}/${spring.application.name}
rpt.path: ${app.file.root.path}/rpt
img.path: ${app.file.root.path}/img
#springdoc:
# api-docs:
# enabled: true
# swagger-ui:
# enabled: true
# path: /swagger-ui.html
# csrf:
# enabled: false

@ -1,46 +0,0 @@
app:
inf:
nims:
# 관할관청기관코드 : 4050149 - 수지구보건소
ofCd: 4050149
# 기관명
onm: 수지구보건소
bssh-cd: TST000543
url: https://test.nims.or.kr
api-key: 998003699950fa950b798c9edea1b38f3cfbcf3b77e03e419
api:
bsshinfoStV1: /api/bsshinfo_st_v1.do
productinfoKd: /api/productinfo_kd.do
seqinfo: /api/seqinfo.do
officeinfo: /api/officeinfo.do
placeinfoV1: /api/placeinfo_v1.do
reportinfo: /api/reportinfo_ggg.do
iros:
url: https://apis.data.go.kr
api-key: 0fTkYnZU6XjaAPAp6GzKW9Q6fYq8iaoSH9wKUZwz2PBjRXGM04aUgtO3a61xYGjL8nFZn4fjLGS9XErhMSXq%2Bw%3D%3D
api:
drugPrdtMcpnDtlInq: /1471000/DrugPrdtPrmsnInfoService05/getDrugPrdtMcpnDtlInq04
mois:
sender:
systemId: ADM405000069
systemNm: ADDS
orgname: 용인시
receiver:
systemId: DOC131000001
userId: cskim
dataPath:
root: ${app.data.root.path}/exchange/data
# 송신 연계 보관
send: /send
# 송신오류
senderr: /senderr
# 임시송신함 - 송신 대상 임시 보관
sendTemp: /sendtemp/
# 수신 연계 보관
receive: /receive/
# 수신 오류
receiveerr: /receiveerr
# 결재연계 임시수신함 - 수신 대상 임시 보관
receiveTemp: /receivetemp/
# 연계에서 사용하는 임시 수신함
exreceivetemp: /exreceivetemp

@ -0,0 +1,26 @@
app:
inf:
mois:
sender:
systemId: ADM405000069
systemNm: ADDS
orgname: 용인시
receiver:
systemId: DOC131000001
userId: cskim
dataPath:
root: ${app.data.root.path}/exchange/data
# 송신 연계 보관
send: /send
# 송신오류
senderr: /senderr
# 임시송신함 - 송신 대상 임시 보관
sendTemp: /sendtemp/
# 수신 연계 보관
receive: /receive/
# 수신 오류
receiveerr: /receiveerr
# 결재연계 임시수신함 - 수신 대상 임시 보관
receiveTemp: /receivetemp/
# 연계에서 사용하는 임시 수신함
exreceivetemp: /exreceivetemp

@ -0,0 +1,16 @@
app:
inf:
nims:
url: https://test.nims.or.kr
api:
bsshinfoStV1: /api/bsshinfo_st_v1.do
productinfoKd: /api/productinfo_kd.do
seqinfo: /api/seqinfo.do
officeinfo: /api/officeinfo.do
placeinfoV1: /api/placeinfo_v1.do
reportinfo: /api/reportinfo_ggg.do
iros:
url: https://apis.data.go.kr
api-key: 0fTkYnZU6XjaAPAp6GzKW9Q6fYq8iaoSH9wKUZwz2PBjRXGM04aUgtO3a61xYGjL8nFZn4fjLGS9XErhMSXq%2Bw%3D%3D
api:
drugPrdtMcpnDtlInq: /1471000/DrugPrdtPrmsnInfoService05/getDrugPrdtMcpnDtlInq04

@ -153,6 +153,23 @@ CREATE TABLE tb_prduct_info
PRIMARY KEY (prduct_cd)
) COMMENT '품목_정보';
create or replace table tb_jrdt_gov_info
(
of_cd varchar(10) null comment '기관_코드',
of_nm varchar(100) null comment '기관_명',
up_of_nm varchar(100) null comment '상위_기관_명',
top_of_nm varchar(100) null comment '최상위_기관_명',
bass_adres varchar(200) null comment '기본_주소',
bass_dtl_adres varchar(200) null comment '상세_주소',
use_yn varchar(1) not null comment '사용_여부',
reg_dt varchar(14) not null comment '등록_일시',
rgtr varchar(10) not null comment '등록자',
mdfcn_dt varchar(14) null comment '수정_일시',
mdfr varchar(10) null comment '수정자',
PRIMARY KEY (of_cd)
)
comment '관할_관청_정보';
CREATE TABLE tb_cmm_api_log
(
request_id varchar(40) NOT NULL COMMENT '요청 id',

@ -182,13 +182,14 @@
<!-- root logging -->
<!-- ************************************************************************* -->
<root level="DEBUG">
<springProfile name="prod">
<springProfile name="local, dev">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="ASYNC_ROLLING"/>
</springProfile>
<springProfile name="local, dev">
<appender-ref ref="CONSOLE"/>
<springProfile name="prod">
<appender-ref ref="ASYNC_ROLLING"/>
<appender-ref ref="CONSOLE"/>
</springProfile>
</root>

@ -109,6 +109,40 @@
mdfr = #{rgtr}
</insert>
<insert id="mergeJurisdictionGovInfo" parameterType="cokr.xit.adds.inf.nims.model.NimsApiDto$JurisdictionGovInfo">
/** nims-mysql-mapper|mergeJurisdictionGovInfo-관할관청 정보 저장|julim */
INSERT INTO adds.tb_jrdt_gov_info(
of_cd, /* 관할관청코드 */
of_nm, /* 관할관청명 */
up_of_nm, /* 상위관할관청명 */
top_of_nm, /* 최상위관할관청명 */
bass_adres, /* 기본주소 */
bass_dtl_adres, /* 상세주소 */
use_yn,
reg_dt,
rgtr
) VALUES (
#{ofCd},
#{ofNm},
#{upOfNm},
#{topOfNm},
#{bassAdres},
#{bassDtlAdres},
'Y',
DATE_FORMAT(now(), '%Y%m%d%H%i%s'),
#{rgtr}
)
ON DUPLICATE KEY UPDATE
of_nm = #{ofNm},
up_of_nm = #{upOfNm},
top_of_nm = #{topOfNm},
bass_adres = #{bassAdres},
bass_dtl_adres = #{bassDtlAdres},
mdfcn_dt = DATE_FORMAT(now(), '%Y%m%d%H%i%s'),
mdfr = #{rgtr}
</insert>
<select id="selectBsshInfos" parameterType="cokr.xit.adds.inf.nims.model.NimsApiRequest$BsshInfoReq" resultType="cokr.xit.adds.inf.nims.model.NimsApiDto$BsshInfoSt">
/** nims-mysql-mapper|selectBsshInfos-마약류취급자정보 조회|julim */
SELECT bssh_cd, /* 마약류취급자식별번호 */
@ -167,6 +201,26 @@
</if>
</where>
</select>
<select id="selectJurisdictionGovInfos" parameterType="cokr.xit.adds.inf.nims.model.NimsApiRequest$JurisdictionGovInfoReq" resultType="cokr.xit.adds.inf.nims.model.NimsApiDto$JurisdictionGovInfo">
/** nims-mysql-mapper|selectJurisdictionGovInfos-관할관청 정보 목록 조회|julim */
SELECT of_cd /* 관할관청코드 */
, of_nm /* 관할관청명 */
, up_of_nm /* 상위관할관청명 */
, top_of_nm /* 최상위관할관청명 */
, bass_adres /* 기본주소 */
, bass_dtl_adres /* 상세주소 */
FROM tb_jrdt_gov_info
<where>
<if test="ocd != null and ocd != ''">
AND of_cd = #{ocd}
</if>
<if test="onm != null and onm != ''">
AND INSTR(of_nm, #{onm}) > 0
</if>
</where>
</select>
<!-- **************************************************************************** -->
<!-- NIMS API end -->
<!-- **************************************************************************** -->
@ -179,6 +233,20 @@
<!-- ========================== -->
<!-- 폐기관리 업무 테이블 start -->
<!-- ========================== -->
<select id="selectApiInfInfoByUserId" parameterType="map" resultType="map">
/** nims-mysql-mapper|selectApiInfInfoByUserId-API 인터페이스 정보 조회|julim */
SELECT tu.user_id AS id, /* 시스템사용자ID */
tu.user_acnt AS userId, /* 사용자계정ID */
tu.dept_cd AS deptCd, /* 부서코드 */
tdaki.dept_nm AS deptNm, /* 부서명 */
IF(#{profile} = 'prod', tdaki.prod_api_key, tdaki.dev_api_key) AS apiKey /* API키 */
FROM tb_user tu
JOIN tb_dsuse_api_key_info tdaki
ON tu.dept_cd = tdaki.dept_cd
WHERE tu.user_acnt = #{userId}
</select>
<insert id="insertDsuseMgtReceipt" parameterType="cokr.xit.adds.biz.nims.model.BizNimsRequest$DsuseMgtReceipt">
/** nims-mysql-mapper|insertDsuseMgtReceipt-폐기관리 신청서 정보 생성|julim */
<selectKey keyProperty="dscdmngId" resultType="string" order="BEFORE">
@ -188,6 +256,7 @@
</selectKey>
INSERT INTO tb_dsuse_mgt (
dscdmng_id, /* 폐기관리ID */
dept_cd, /* 부서코드 */
user_id, /* 사용자ID */
prgrs_stts_cd, /* 폐기관리진행상태코드 */
bssh_cd, /* 마약류취급자식별ID */
@ -198,6 +267,7 @@
rgtr
) VALUES (
#{dscdmngId},
(SELECT dept_cd FROM tb_user WHERE user_id = #{userId}),
#{userId},
#{prgrsSttsCd},
#{bsshCd},
@ -233,6 +303,7 @@
</selectKey>
INSERT INTO tb_dsuse_mgt (
dscdmng_id, /* 폐기관리ID */
dept_cd, /* 부서코드 */
user_id, /* 사용자ID */
prgrs_stts_cd, /* 폐기관리진행상태코드 */
bssh_cd, /* 마약류취급자식별ID */
@ -249,6 +320,7 @@
rgtr
) VALUES (
#{dscdmngId},
(SELECT dept_cd FROM tb_user WHERE user_id = #{userId}),
#{userId},
#{prgrsSttsCd},
#{bsshCd},
@ -309,6 +381,9 @@
#{item}
</foreach>
</if>
<if test="deptCd != null and deptCd != ''">
AND dept_cd != #{deptCd}
</if>
<if test="prgrsSttsCd != null and prgrsSttsCd != ''">
AND prgrs_stts_cd != #{prgrsSttsCd}
</if>
@ -323,6 +398,7 @@
<sql id="sqlDsuseMgt">
SELECT tdm.dscdmng_id, /** 폐기관리ID */
tdm.dept_cd, /** 부서코드 */
tdm.user_id, /** 사용자ID */
tdm.prgrs_stts_cd, /** 폐기관리진행상태코드 */
tdm.bssh_cd, /** 마약류취급자식별번호 */
@ -456,6 +532,7 @@
dsuse_de, /* 폐기일자 */
status, /* 상태 */
org_usr_rpt_id_no, /* 원본사용자보고식별번호 */
dept_cd, /* 부서코드 */
use_yn,
reg_dt,
rgtr
@ -525,6 +602,7 @@
dsuse_de, /* 폐기일자 */
status, /* 상태 */
org_usr_rpt_id_no, /* 원본사용자보고식별번호 */
dept_cd, /* 부서코드 */
use_yn,
reg_dt,
rgtr
@ -545,6 +623,7 @@
#{dsuseDe},
#{status},
#{orgUsrRptIdNo},
(SELECT dept_cd FROM tb_user WHERE user_id = #{userId}),
IF(#{rptTyCd} = '1', 'N', 'Y'),
DATE_FORMAT(now(), '%Y%m%d%H%i%s'),
#{rgtr}

@ -97,51 +97,11 @@ select tdm.dscdmng_id
left outer join tb_bssh_info tbi
on tdri.bssh_cd = tbi.bssh_cd
WITH RECURSIVE temp (
usr_rpt_id_no, rpt_ty_cd, ref_usr_rpt_id_no, depth, path
) AS (select usr_rpt_id_no
, rpt_ty_cd
, ref_usr_rpt_id_no
, 0
, usr_rpt_id_no
from tb_dsuse_rpt_info
where 1=1
-- and use_yn = 'Y'
and ref_usr_rpt_id_no is null
UNION ALL
select tdri.usr_rpt_id_no
, tdri.rpt_ty_cd
, tdri.ref_usr_rpt_id_no
, tgt.depth + 1
, concat(tgt.path, ',', tdri.usr_rpt_id_no)
from tb_dsuse_rpt_info tdri
INNER JOIN temp tgt
ON tdri.ref_usr_rpt_id_no = tgt.usr_rpt_id_no
)
select usr_rpt_id_no
, rpt_ty_cd
, ref_usr_rpt_id_no
, depth
, path
from temp
order by temp.path;
SELECT user_acnt AS id
, user_nm AS name
, passwd AS password
, rsdnt_no AS ihidnum
, eml_adrs AS email
, 'USR' AS userSe
, org_id AS orgnzt_id
, user_id AS esntl_id
FROM tb_user
WHERE user_acnt = 'admin'
-- AND passwd = ?
AND stts = 'P'
select tu.USER_ID,
tu.USER_ACNT,
tu.DEPT_CD,
tdaki.dept_nm,
tdaki.api_key
from tb_user tu
join tb_dsuse_api_key_info tdaki
on tu.DEPT_CD = tdaki.dept_cd;
Loading…
Cancel
Save