폐기 관리 생성 반영

dev
Jonguk. Lim 7 months ago
parent 6e4f6c5058
commit 31babac403

@ -1,10 +1,7 @@
package cokr.xit.adds.biz.nims.dao;
import java.util.List;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.adds.biz.nims.model.BizNimsAarDto;
import cokr.xit.adds.biz.nims.model.BizNimsRequest;
import cokr.xit.adds.inf.nims.model.NimsApiDto;
import cokr.xit.foundation.component.AbstractMapper;
@ -37,8 +34,10 @@ public interface BizNimsMapper extends AbstractMapper {
// NIMS BIZ
//------------------------------------------------------------------------------------------------------
int insertDsuseMgt(BizNimsRequest.DsuseMgt dto);
int insertDsuseMgtDtl(BizNimsRequest.DsuseMgtDtl d);
int insertDsuseMgtDtl(BizNimsRequest.DsuseMgtDtl dto);
int updateCancelDsuseMgt(BizNimsRequest.DsuseMgt dto);
int updateCancelDsuseMgtDtl(BizNimsRequest.DsuseMgt dto);
BizNimsAarDto.AarHeader selectTgtAarHeader(BizNimsRequest.DsuseMgt dto);
List<BizNimsAarDto.AarDetail> selectTgtAarDetails(BizNimsRequest.DsuseMgt dto);
// BizNimsAarDto.AarHeader selectTgtAarHeader(BizNimsRequest.DsuseMgt dto);
// List<BizNimsAarDto.AarDetail> selectTgtAarDetails(BizNimsRequest.DsuseMgt dto);
}

@ -6,18 +6,19 @@ import java.util.ArrayList;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import cokr.xit.adds.core.Constants;
import cokr.xit.adds.core.model.AuditDto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import cokr.xit.adds.inf.nims.model.NimsApiDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
/**
@ -44,14 +45,10 @@ public class BizNimsRequest {
@AllArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper = false)
public static class DsuseMgt extends AuditDto {
public static class DsuseMgt extends NimsApiDto.DsuseRpt {
@Schema(requiredMode = AUTO, title = "폐기 관리 ID", example = " ")
private String dscdmngId;
@Schema(requiredMode = REQUIRED, title = "마약류 취급자 식별 번호", example = " ")
@NotEmpty(message = "마약류 취급자 식별 번호는 필수 입니다")
private String bsshCd;
@Schema(requiredMode = REQUIRED, title = "사용자 ID", example = " ")
@NotEmpty(message = "사용자 ID는 필수 입니다")
private String userId;
@ -73,7 +70,7 @@ public class BizNimsRequest {
*/
@Schema(requiredMode = REQUIRED, title = "진행 상태 코드", example = " ", allowableValues = {"01", "02", "11", "22", "31", "41", "42", "99"})
@Pattern(regexp = "01|02|11|22|31|41|42|99", message = "진행 상태 코드는 필수 입니다")
private String prgrsSttsCd;
private String prgrsSttsCd = "01";
@Schema(requiredMode = AUTO, title = "보고 접수 번호", example = " ")
private String rptRceptNo;
@ -82,6 +79,24 @@ public class BizNimsRequest {
@Builder.Default
@Valid
List<DsuseMgtDtl> dsuseMgtDtls = new ArrayList<>();
@JsonIgnore
@Builder.Default
private String useYn = "Y";
@JsonIgnore
private String regDt;
@JsonIgnore
@Setter
private String rgtr;
@JsonIgnore
private String mdfcnDt;
@JsonIgnore
@Setter
private String mdfr;
}
/**
@ -93,40 +108,26 @@ public class BizNimsRequest {
@AllArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper = false)
public static class DsuseMgtDtl extends AuditDto {
public static class DsuseMgtDtl extends NimsApiDto.DsuseRptDtl {
@Schema(requiredMode = AUTO, title = "폐기 관리 ID", example = " ")
private String dscdmngId;
@Schema(requiredMode = AUTO, title = "폐기 관리 순번", example = " ")
private String dscdmngSn;
@Schema(requiredMode = REQUIRED, title = "제품 코드", example = " ")
@NotEmpty(message = "제품 코드는 필수 입니다")
private String prdctCd;
@JsonIgnore
@Builder.Default
private String useYn = "Y";
@Schema(requiredMode = REQUIRED, title = "폐기 수량", example = " ")
@Min(value = 1, message = "폐기 수량은 1 이상 입니다")
private Integer dsuseQy;
@JsonIgnore
private String regDt;
@Schema(requiredMode = REQUIRED, title = "사고 발생 일", example = " ")
@Pattern(regexp = Constants.CUR_DATE_REGX, message = "사고 발생 일은 필수 입니다")
private String acdntOcrnDay;
@JsonIgnore
@Setter
private String rgtr;
@Schema(requiredMode = REQUIRED, title = "사고 발생 보고 일", example = " ")
@Pattern(regexp = Constants.CUR_DATE_REGX, message = "사고 발생 보고 일은 필수 입니다")
private String ocrnRptDay;
@JsonIgnore
private String mdfcnDt;
/**
* <pre>
* ( )
*
* 01-, 02-,, 03-
* 04- , 05- , 07-, 08-
* 09-, 12-
* </pre>
*/
@Schema(requiredMode = AUTO, title = "사고 발생 사유 코드", example = " ")
@Pattern(regexp = "0[1-57-9]|12", message = "사고 발생 사유 코드는 필수 입니다")
private String acdntOcrnRsn;
@JsonIgnore
@Setter
private String mdfr;
}
}

@ -2,9 +2,7 @@ package cokr.xit.adds.biz.nims.service;
import java.util.List;
import cokr.xit.adds.biz.nims.model.BizNimsAarDto;
import cokr.xit.adds.biz.nims.model.BizNimsRequest;
import cokr.xit.adds.inf.nims.model.NimsAarResult;
import cokr.xit.adds.inf.nims.model.NimsApiDto;
import cokr.xit.adds.inf.nims.model.NimsApiRequest;
@ -37,14 +35,14 @@ public interface BizNimsService {
//------------------------------------------------------------------------------------------------------
// NIMS BIZ
//------------------------------------------------------------------------------------------------------
NimsAarResult createReportDsuse();
NimsAarResult updateReportDsuse();
NimsAarResult cancelReportDsuse();
// NimsAarResult createReportDsuse();
// NimsAarResult updateReportDsuse();
// NimsAarResult cancelReportDsuse();
BizNimsRequest.DsuseMgt saveDsuseMgt(BizNimsRequest.DsuseMgt dto);
List<BizNimsRequest.DsuseMgt> saveDsuseMgt(List<BizNimsRequest.DsuseMgt> dtos);
BizNimsAarDto.AarHeader getTgtDsuseRptData(BizNimsRequest.DsuseMgt dto);
BizNimsAarDto.AarHeader createTgtDsuseRptData(BizNimsAarDto.AarHeader dto);
// BizNimsAarDto.AarHeader getTgtDsuseRptData(BizNimsRequest.DsuseMgt dto);
// BizNimsAarDto.AarHeader createTgtDsuseRptData(BizNimsAarDto.AarHeader dto);
}

@ -23,7 +23,6 @@ import cokr.xit.adds.core.Constants;
import cokr.xit.adds.core.spring.exception.ApiCustomException;
import cokr.xit.adds.core.util.ApiUtil;
import cokr.xit.adds.inf.nims.model.Aar;
import cokr.xit.adds.inf.nims.model.NimsAarResult;
import cokr.xit.adds.inf.nims.model.NimsApiDto;
import cokr.xit.adds.inf.nims.model.NimsApiDto.BsshInfoSt;
import cokr.xit.adds.inf.nims.model.NimsApiDto.ProductInfoKd;
@ -120,8 +119,24 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
return list;
}
/**
* <pre>
*
* ( 0 ) - API
* 1. skip : (rptTyCd) 1- , refUsrRptIdNo
* 2. : (rptTyCd) 2-
* -> refUsrRptIdNo
* @param dto
* @return
* </pre>
*/
@Override
public List<NimsApiDto.DsuseRpt> getDsuseRptInfo(NimsApiRequest.DsuseRptInfoRequest dto) {
/*
( 0 ) - API
1. skip : (rptTyCd) 1- , refUsrRptIdNo
2. : (rptTyCd) 2-
*/
NimsApiResult.Response<NimsApiDto.DsuseRpt> result = infNimsService.getDsuseRptInfo(dto);
return result.getResultOrThrow();
}
@ -130,25 +145,79 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// NIMS BIZ
//------------------------------------------------------------------------------------------------------
@Override
public BizNimsRequest.DsuseMgt saveDsuseMgt(BizNimsRequest.DsuseMgt dto) {
public List<BizNimsRequest.DsuseMgt> saveDsuseMgt(List<BizNimsRequest.DsuseMgt> dtos) {
for (BizNimsRequest.DsuseMgt dto : dtos) {
ApiUtil.validate(dto, null, validator);
}
// 신규 처리
for (BizNimsRequest.DsuseMgt dto : dtos) {
dto.setRgtr(Constants.NIMS_API_USER_ID);
// 신규가 아닌 경우 skip
if(!"0".equals(dto.getRptTyCd())) continue;
createDsuseMgt(dto);
}
// 취소 및 변경 데이타 처리
String errMsg = null;
for (BizNimsRequest.DsuseMgt dto : dtos) {
dto.setRgtr(Constants.NIMS_API_USER_ID);
if(bizNimsMapper.insertDsuseMgt(dto) == 1){
// 신규인 경우 skip
if("0".equals(dto.getRptTyCd())) continue;
if(isEmpty(dto.getRefUsrRptIdNo())){
throw ApiCustomException.create("데이타 오류[취소 및 변경인 경우 참조사용자식별번호(REF_USR_RPT_ID_NO) 필수]");
}
// 폐기관리 데이타 disable(미사용)
updateDsuseMgt(dto);
// 취소인 경우 데이타 생성 skip
if ("1".equals(dto.getRptTyCd())) continue;
// 변경인 경우 데이타 생성
createDsuseMgt(dto);
}
return dtos;
}
private void updateDsuseMgt(BizNimsRequest.DsuseMgt dto) {
String errMsg;
if ("1".equals(dto.getRptTyCd())) errMsg = "취소";
else errMsg = "변경";
if (bizNimsMapper.updateCancelDsuseMgt(dto) == 1) {
int cnt = bizNimsMapper.updateCancelDsuseMgtDtl(dto);
if(cnt == 0) throw ApiCustomException.create(String.format("폐기 관리 상세 %s 실패", errMsg));
// 변경인 경우 상세 데이타 건수와 일치 하지 않는 경우 오류 처리
if ("2".equals(dto.getRptTyCd()) && dto.getRndDtlRptCnt() != cnt) {
throw ApiCustomException.create(String.format("폐기 관리 상세 %s 실패", errMsg));
}
} else {
throw ApiCustomException.create(String.format("폐기 관리 마스터 %s 실패", errMsg));
}
}
private void createDsuseMgt(BizNimsRequest.DsuseMgt dto) {
if (bizNimsMapper.insertDsuseMgt(dto) == 1) {
int dtlCnt = 0;
for (BizNimsRequest.DsuseMgtDtl d : dto.getDsuseMgtDtls()) {
d.setDscdmngId(dto.getDscdmngId());
d.setDscdmngSn(StringUtils.leftPad(dtlCnt + 1 + "", 3, "0"));
d.setRgtr(Constants.NIMS_API_USER_ID);
dtlCnt = dtlCnt + bizNimsMapper.insertDsuseMgtDtl(d);
}
if(dto.getDsuseMgtDtls().size() != dtlCnt) throw ApiCustomException.create("폐기 관리 상세 등록 실패");
if (dto.getDsuseMgtDtls().size() != dtlCnt)
throw ApiCustomException.create("폐기 관리 상세 등록 실패");
} else {
throw ApiCustomException.create("폐기 관리 마스터 등록 실패");
}
return dto;
}
/*
@Override
public BizNimsAarDto.AarHeader getTgtDsuseRptData(BizNimsRequest.DsuseMgt dto) {
ApiUtil.validate(dto, null, validator);
@ -182,27 +251,27 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
return dto;
}
@Override
public NimsAarResult createReportDsuse() {
String xml = toXml();
log.info(xml);
return NimsAarResult.builder().build();
}
@Override
public NimsAarResult updateReportDsuse() {
String xml = toXml();
log.info(xml);
return NimsAarResult.builder().build();
}
@Override
public NimsAarResult cancelReportDsuse() {
String xml = toXml();
log.info(xml);
return NimsAarResult.builder().build();
}
*/
// @Override
// public NimsAarResult createReportDsuse() {
// String xml = toXml();
// log.info(xml);
// return NimsAarResult.builder().build();
// }
//
// @Override
// public NimsAarResult updateReportDsuse() {
// String xml = toXml();
// log.info(xml);
// return NimsAarResult.builder().build();
// }
//
// @Override
// public NimsAarResult cancelReportDsuse() {
// String xml = toXml();
// log.info(xml);
// return NimsAarResult.builder().build();
// }

@ -8,11 +8,9 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cokr.xit.adds.biz.nims.model.BizNimsAarDto;
import cokr.xit.adds.biz.nims.model.BizNimsRequest;
import cokr.xit.adds.biz.nims.service.BizNimsService;
import cokr.xit.adds.core.model.ApiBaseResponse;
import cokr.xit.adds.inf.nims.model.NimsAarResult;
import cokr.xit.adds.inf.nims.model.NimsApiDto;
import cokr.xit.adds.inf.nims.model.NimsApiRequest;
import cokr.xit.adds.inf.nims.service.InfNimsService;
@ -88,7 +86,7 @@ public class BizNimsController {
return ApiBaseResponse.of(bizNimsService.saveStorageInfo(dto));
}
@Operation(summary = "폐기 보고 정보 조회", description = "폐기 보고 정보 조회<br><br>NIMS API 호출 결과 Return")
@Operation(summary = "NIMS API - 폐기 보고 정보 조회", description = "폐기 보고 정보 조회<br><br>NIMS API 호출 결과 Return<br>폐기보고관리 화면에서 사용")
@PostMapping("/getDsuseRptInfo")
public ApiBaseResponse<List<NimsApiDto.DsuseRpt>> getDsuseRptInfo(
@RequestBody @Validated NimsApiRequest.DsuseRptInfoRequest dto
@ -96,69 +94,215 @@ public class BizNimsController {
return ApiBaseResponse.of(bizNimsService.getDsuseRptInfo(dto));
}
//------------------------------------------------------------------------------------------------------
// NIMS BIZ
//------------------------------------------------------------------------------------------------------
@Operation(summary = "NIMS API - 사고 마약류 폐기 생성 보고", description = "사고 마약류 폐기 생성<br><br>NIMS 연계 시스템에 폐기 생성 send")
@PostMapping("/createReportDsuse")
public ApiBaseResponse<NimsAarResult> createReportDsuse(
@RequestBody @Validated NimsApiRequest.ProductInfoRequest dto
) {
return ApiBaseResponse.of(bizNimsService.createReportDsuse());
}
// @Operation(summary = "NIMS API - 사고 마약류 폐기 생성 보고", description = "사고 마약류 폐기 생성<br><br>NIMS 연계 시스템에 폐기 생성 send")
// @PostMapping("/createReportDsuse")
// public ApiBaseResponse<NimsAarResult> createReportDsuse(
// @RequestBody @Validated NimsApiRequest.ProductInfoRequest dto
// ) {
// return ApiBaseResponse.of(bizNimsService.createReportDsuse());
// }
//
// @Operation(summary = "NIMS API - 사고 마약류 폐기 변경 보고", description = "사고 마약류 폐기 변경<br><br>NIMS 연계 시스템에 폐기 변경 send")
// @PostMapping("/updateReportDsuse")
// public ApiBaseResponse<NimsAarResult> updateReportDsuse(
// @RequestBody @Validated NimsApiRequest.ProductInfoRequest dto
// ) {
// return ApiBaseResponse.of(bizNimsService.updateReportDsuse());
// }
//
// @Operation(summary = "NIMS API - 사고 마약류 폐기 취소 보고", description = "사고 마약류 폐기 취소<br><br>NIMS 연계 시스템에 폐기 취소 send")
// @PostMapping("/cancelReportDsuse")
// public ApiBaseResponse<NimsAarResult> cancelReportDsuse(
// @RequestBody @Validated NimsApiRequest.ProductInfoRequest dto
// ) {
// return ApiBaseResponse.of(bizNimsService.cancelReportDsuse());
// }
@Operation(summary = "NIMS API - 사고 마약류 폐기 변경 보고", description = "사고 마약류 폐기 변경<br><br>NIMS 연계 시스템에 폐기 변경 send")
@PostMapping("/updateReportDsuse")
public ApiBaseResponse<NimsAarResult> updateReportDsuse(
@RequestBody @Validated NimsApiRequest.ProductInfoRequest dto
) {
return ApiBaseResponse.of(bizNimsService.updateReportDsuse());
}
@Operation(summary = "NIMS API - 사고 마약류 폐기 취소 보고", description = "사고 마약류 폐기 취소<br><br>NIMS 연계 시스템에 폐기 취소 send")
@PostMapping("/cancelReportDsuse")
public ApiBaseResponse<NimsAarResult> cancelReportDsuse(
@RequestBody @Validated NimsApiRequest.ProductInfoRequest dto
) {
return ApiBaseResponse.of(bizNimsService.cancelReportDsuse());
}
@Operation(summary = "사고 마약류 폐기 관리 등록", description = "사고 마약류 폐기 관리 등록")
@Operation(summary = "사고 마약류 폐기 관리 등록", description = "사고 마약류 폐기 관리 등록<br><br>폐기보고관리 화면에서 보고대상 조회후 등록시 사용")
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
@Content(mediaType = "application/json", examples = {
@ExampleObject(value = """
[
{
"bsshCd": "H00008333",
"userId": "userid1",
"prgrsSttsCd": "01",
"dsuseMgtDtls": [
"userId":"userid1",
"USR_RPT_ID_NO":"usrRptIdNo1111",
"REF_USR_RPT_ID_NO":null,
"BSSH_CD":"bsshCd",
"RPT_TY_CD":"0",
"RND_DTL_RPT_CNT":2,
"HDR_DE":"20240401",
"RPT_DE":"20240401",
"DSUSE_SE_CD":"1",
"DSUSE_PRV_CD":"01",
"DSUSE_MTH_CD":"1",
"DSUSE_LOC":"보건소",
"DSUSE_DE":null,
"STATUS":"0",
"RPT_PRG_STTS_CD":"0",
"dsuseMgtDtls":[
{
"USR_RPT_ID_NO":"usrRptIdNo1111",
"USR_RPT_LN_ID_NO":"dsuseRptDtlIdNo11",
"PRDUCT_CD":"상품코드",
"PRDCT_NM":"제품명",
"MIN_DISTB_QY":1,
"PCE_QY":0,
"MNF_NO":"제조번호",
"PRD_VALID_DE":"20240401",
"MNF_SEQ":"-",
"STORGE_NO":"저장소번호",
"STORGE_NM":"저장소명",
"MVMN_TY_CD":"1102",
"DSUSE_QY":30
},
{
"prdctCd": "8806718050823",
"dsuseQy": 1,
"acdntOcrnDay": "20220404",
"ocrnRptDay": "20240411",
"acdntOcrnRsn": "01"
"USR_RPT_ID_NO":"usrRptIdNo1111",
"USR_RPT_LN_ID_NO":"dsuseRptDtlIdNo22",
"PRDUCT_CD":"상품코드1",
"PRDCT_NM":"제품명1",
"MIN_DISTB_QY":1,
"PCE_QY":0,
"MNF_NO":"제조번호1",
"PRD_VALID_DE":"20240401",
"MNF_SEQ":"-",
"STORGE_NO":"저장소번호1",
"STORGE_NM":"저장소명1",
"MVMN_TY_CD":"1102",
"DSUSE_QY":10
}
]
},
{
"userId":"userid1",
"USR_RPT_ID_NO":"usrRptIdNo2222",
"REF_USR_RPT_ID_NO":null,
"BSSH_CD":"bsshCd",
"RPT_TY_CD":"0",
"RND_DTL_RPT_CNT":2,
"HDR_DE":"20240401",
"RPT_DE":"20240401",
"DSUSE_SE_CD":"1",
"DSUSE_PRV_CD":"01",
"DSUSE_MTH_CD":"1",
"DSUSE_LOC":"보건소",
"DSUSE_DE":null,
"STATUS":"0",
"RPT_PRG_STTS_CD":"0",
"dsuseMgtDtls":[
{
"USR_RPT_ID_NO":"usrRptIdNo2222",
"USR_RPT_LN_ID_NO":"dsuseRptDtlIdNo33",
"PRDUCT_CD":"상품코드",
"PRDCT_NM":"제품명",
"MIN_DISTB_QY":1,
"PCE_QY":0,
"MNF_NO":"제조번호",
"PRD_VALID_DE":"20240401",
"MNF_SEQ":"-",
"STORGE_NO":"저장소번호",
"STORGE_NM":"저장소명",
"MVMN_TY_CD":"1102",
"DSUSE_QY":30
},
{
"prdctCd": "8806498014732",
"dsuseQy": 2,
"acdntOcrnDay": "20220404",
"ocrnRptDay": "20240411",
"acdntOcrnRsn": "01"
"USR_RPT_ID_NO":"usrRptIdNo2222",
"USR_RPT_LN_ID_NO":"dsuseRptDtlIdNo44",
"PRDUCT_CD":"상품코드1",
"PRDCT_NM":"제품명1",
"MIN_DISTB_QY":1,
"PCE_QY":0,
"MNF_NO":"제조번호1",
"PRD_VALID_DE":"20240401",
"MNF_SEQ":"-",
"STORGE_NO":"저장소번호1",
"STORGE_NM":"저장소명1",
"MVMN_TY_CD":"1102",
"DSUSE_QY":10
}
]
},
{
"userId":"userid1",
"USR_RPT_ID_NO":"usrRptIdNo3333",
"REF_USR_RPT_ID_NO":"usrRptIdNo1111",
"BSSH_CD":"bsshCd",
"RPT_TY_CD":"2",
"RND_DTL_RPT_CNT":2,
"HDR_DE":"20240401",
"RPT_DE":"20240401",
"DSUSE_SE_CD":"1",
"DSUSE_PRV_CD":"01",
"DSUSE_MTH_CD":"1",
"DSUSE_LOC":"보건소",
"DSUSE_DE":null,
"STATUS":"0",
"RPT_PRG_STTS_CD":"0",
"dsuseMgtDtls":[
{
"USR_RPT_ID_NO":"usrRptIdNo3333",
"USR_RPT_LN_ID_NO":"dsuseRptDtlIdNo55",
"PRDUCT_CD":"상품코드",
"PRDCT_NM":"제품명",
"MIN_DISTB_QY":1,
"PCE_QY":0,
"MNF_NO":"제조번호",
"PRD_VALID_DE":"20240401",
"MNF_SEQ":"-",
"STORGE_NO":"저장소번호",
"STORGE_NM":"저장소명",
"MVMN_TY_CD":"1102",
"DSUSE_QY":30
},
{
"USR_RPT_ID_NO":"usrRptIdNo3333",
"USR_RPT_LN_ID_NO":"dsuseRptDtlIdNo66",
"PRDUCT_CD":"상품코드1",
"PRDCT_NM":"제품명1",
"MIN_DISTB_QY":1,
"PCE_QY":0,
"MNF_NO":"제조번호1",
"PRD_VALID_DE":"20240401",
"MNF_SEQ":"-",
"STORGE_NO":"저장소번호1",
"STORGE_NM":"저장소명1",
"MVMN_TY_CD":"1102",
"DSUSE_QY":10
}
]
},
{
"userId":"userid1",
"USR_RPT_ID_NO":"usrRptIdNo4444",
"REF_USR_RPT_ID_NO":"usrRptIdNo2222",
"BSSH_CD":"bsshCd",
"RPT_TY_CD":"1",
"RND_DTL_RPT_CNT":0,
"HDR_DE":"20240401",
"RPT_DE":"20240401",
"DSUSE_SE_CD":"1",
"DSUSE_PRV_CD":"01",
"DSUSE_MTH_CD":"1",
"DSUSE_LOC":"보건소",
"DSUSE_DE":null,
"STATUS":"0",
"RPT_PRG_STTS_CD":"0",
"dsuseMgtDtls":[]
}
]
""")
})
})
@PostMapping("/saveDsuseMgt")
public ApiBaseResponse<BizNimsRequest.DsuseMgt> saveDsuseMgt(
@RequestBody BizNimsRequest.DsuseMgt dto
public ApiBaseResponse<List<BizNimsRequest.DsuseMgt>> saveDsuseMgt(
@RequestBody List<BizNimsRequest.DsuseMgt> dtos
) {
return ApiBaseResponse.of(bizNimsService.saveDsuseMgt(dto));
return ApiBaseResponse.of(bizNimsService.saveDsuseMgt(dtos));
}
/*
@Operation(summary = "폐기 보고 관리 대상 연계 데이타 생성 조회", description = "폐기 보고 관리 대상 연계 데이타 생성 조회")
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
@Content(mediaType = "application/json", examples = {
@ -264,4 +408,5 @@ public class BizNimsController {
) {
return ApiBaseResponse.of(bizNimsService.createTgtDsuseRptData(dto));
}
*/
}

@ -297,7 +297,7 @@ public class NimsApiDto {
* (0-,1-,2-)
*/
@JsonProperty(value = "RPT_PRG_STTS_CD", required = true)
private String rptPgrSttsCd;
private String rptPrgSttsCd;
/**
@ -329,8 +329,8 @@ public class NimsApiDto {
/**
*
*/
@JsonProperty(value = "PRDCT_CD", required = true)
private String prdctCd;
@JsonProperty(value = "PRDUCT_CD", required = true)
private String prductCd;
/**
*

@ -155,9 +155,9 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
private NimsApiResult.Response<NimsApiDto.DsuseRpt> getDsuseRptResponse() {
NimsApiDto.DsuseRptDtl dtl1 = NimsApiDto.DsuseRptDtl.builder()
.usrRptIdNo("usrRptIdNo")
.usrRptLnIdNo("dsuseRptDtlIdNo")
.prdctCd("상품코드")
.usrRptIdNo("usrRptIdNo1111")
.usrRptLnIdNo("dsuseRptDtlIdNo11")
.prductCd("상품코드")
.prductNm("제품명")
.minDistbQy(1)
.pceQy(0)
@ -170,9 +170,9 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
.dsuseQy(30)
.build();
NimsApiDto.DsuseRptDtl dtl2 = NimsApiDto.DsuseRptDtl.builder()
.usrRptIdNo("usrRptIdNo")
.usrRptLnIdNo("dsuseRptDtlIdNo1")
.prdctCd("상품코드1")
.usrRptIdNo("usrRptIdNo1111")
.usrRptLnIdNo("dsuseRptDtlIdNo22")
.prductCd("상품코드1")
.prductNm("제품명1")
.minDistbQy(1)
.pceQy(0)
@ -187,7 +187,7 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
NimsApiDto.DsuseRpt dsuseRpt = NimsApiDto.DsuseRpt.builder()
.bsshCd("bsshCd")
.usrRptIdNo("usrRptIdNo")
.usrRptIdNo("usrRptIdNo1111")
.rptTyCd("0")
.rndDtlRptCnt(2)
.hdrDe("20240401")
@ -197,7 +197,23 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
.dsuseMthCd("1")
.dsuseLoc("보건소")
.status("0")
.rptPgrSttsCd("0")
.rptPrgSttsCd("0")
.dsuseRptDtls(List.of(dtl1, dtl2))
.build();
NimsApiDto.DsuseRpt dsuseRpt2 = NimsApiDto.DsuseRpt.builder()
.bsshCd("bsshCd")
.usrRptIdNo("usrRptIdNo2222")
.rptTyCd("0")
.rndDtlRptCnt(2)
.hdrDe("20240401")
.rptDe("20240401")
.dsuseSeCd("1")
.dsusePrvCd("01")
.dsuseMthCd("1")
.dsuseLoc("보건소")
.status("0")
.rptPrgSttsCd("0")
.dsuseRptDtls(List.of(dtl1, dtl2))
.build();
@ -210,7 +226,7 @@ public class InfNimsServiceBean extends AbstractServiceBean implements InfNimsSe
)
.body(
NimsApiResult.Body.<NimsApiDto.DsuseRpt>builder()
.list(List.of(dsuseRpt))
.list(List.of(dsuseRpt, dsuseRpt2))
.isEndYn("Y")
.nRecord(2)
.totalCount(2)

@ -21,44 +21,14 @@ CREATE TABLE tb_bssh_info
PRIMARY KEY (bssh_cd)
) COMMENT '취급자_정보';
CREATE TABLE tb_cmm_api_log
(
request_id varchar(40) NOT NULL COMMENT '요청 id',
system_id varchar(20) NULL COMMENT '시스템 id(ens|fims등)',
req_system_id varchar(20) NULL COMMENT '요청시스템 id(kakao|kt등)',
method varchar(10) NULL COMMENT '메소드(get|put|post|delete)',
uri varchar(255) NULL COMMENT '호출 uri',
success varchar(5) NULL COMMENT '성공/실패(true|false)',
param longtext NULL COMMENT '파라메터',
response longtext NULL COMMENT '호출 결과',
message longtext NULL COMMENT '메세지(에러메세지)',
ip varchar(30) NULL COMMENT 'ip',
access_token varchar(2000) NULL COMMENT '토큰',
session_id varchar(255) NULL COMMENT '세션id',
updt_dt datetime(3) NULL COMMENT '변경일시(now(3)-밀리세컨드까지)',
updt_id varchar(20) NULL COMMENT '변경자',
regist_dt datetime(3) NULL COMMENT '생성일시(now(3)-밀리세컨드까지)',
regist_id varchar(20) NULL COMMENT '생성자',
PRIMARY KEY (request_id)
) COMMENT 'api 호출 로그';
CREATE TABLE tb_cmm_refresh_token
(
id varchar(20) NOT NULL COMMENT 'id',
refresh_token varchar(256) NOT NULL COMMENT 'refreshtoken',
regist_dt timestamp NULL COMMENT '등록일시',
updt_dt timestamp NULL COMMENT '변경일시',
PRIMARY KEY (id)
) COMMENT '리프레쉬토큰';
CREATE TABLE tb_dsuse_mgt
(
dscdmng_id varchar(10) NOT NULL COMMENT '폐기관리_id',
usr_rpt_id_no varchar(30) NOT NULL COMMENT '사용자_보고_식별_번호',
ref_usr_rpt_id_no varchar(30) NULL COMMENT '참조_사용자_보고_식별_번호',
user_id varchar(10) NULL COMMENT '사용자_아이디',
bssh_cd varchar(10) NOT NULL COMMENT '마약류취급자식별_번호',
prgrs_stts_cd varchar(10) NULL COMMENT '진행_상태_코드',
bssh_cd varchar(10) NOT NULL COMMENT '마약류취급자식별_번호',
rpt_rcept_no varchar(30) NULL COMMENT '보고_접수_번호',
rpt_ty_cd varchar(1) NULL COMMENT '보고_유형_코드(0-신규,1-취소,2-변경)',
rnd_dtl_rpt_cnt decimal NULL COMMENT '수불_상세_보고_수',
@ -84,7 +54,7 @@ CREATE TABLE tb_dsuse_mgt_dtl
dscdmng_id varchar(10) NOT NULL COMMENT '폐기관리_id',
usr_rpt_id_no varchar(30) NOT NULL COMMENT '사용자_보고_식별_번호',
usr_rpt_ln_id_no varchar(35) NOT NULL COMMENT '사용자_보고_라인_식별_번호',
prdct_cd varchar(14) NOT NULL COMMENT '제품_코드',
prduct_cd varchar(14) NOT NULL COMMENT '제품_코드',
prduct_nm varchar(300) NULL COMMENT '제품_명',
min_distb_qy decimal NULL COMMENT '최소_유통단위_수량',
pce_qy decimal NULL COMMENT '낱개단위_수량',
@ -105,6 +75,24 @@ CREATE TABLE tb_dsuse_mgt_dtl
foreign key (dscdmng_id, usr_rpt_id_no) references tb_dsuse_mgt (dscdmng_id, usr_rpt_id_no)
) COMMENT '폐기관리_상세';
CREATE TABLE tb_storge_info
(
bssh_cd varchar(10) NOT NULL COMMENT '마약류취급자식별_번호',
bssh_nm varchar(120) NULL COMMENT '업체_명',
use_at char NULL COMMENT '사용_유무',
storge_se_nm varchar(200) NULL COMMENT '저장소_유형',
storge_no varchar(16) NULL COMMENT '저장소_번호',
storge_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 (bssh_cd)
) COMMENT '저장소_정보';
CREATE TABLE tb_jrdt_gov_info
(
bssh_cd varchar(10) NOT NULL COMMENT '마약류취급자식별_번호',
@ -144,6 +132,37 @@ CREATE TABLE tb_prduct_info
PRIMARY KEY (prduct_cd)
) COMMENT '품목_정보';
CREATE TABLE tb_cmm_api_log
(
request_id varchar(40) NOT NULL COMMENT '요청 id',
system_id varchar(20) NULL COMMENT '시스템 id(ens|fims등)',
req_system_id varchar(20) NULL COMMENT '요청시스템 id(kakao|kt등)',
method varchar(10) NULL COMMENT '메소드(get|put|post|delete)',
uri varchar(255) NULL COMMENT '호출 uri',
success varchar(5) NULL COMMENT '성공/실패(true|false)',
param longtext NULL COMMENT '파라메터',
response longtext NULL COMMENT '호출 결과',
message longtext NULL COMMENT '메세지(에러메세지)',
ip varchar(30) NULL COMMENT 'ip',
access_token varchar(2000) NULL COMMENT '토큰',
session_id varchar(255) NULL COMMENT '세션id',
updt_dt datetime(3) NULL COMMENT '변경일시(now(3)-밀리세컨드까지)',
updt_id varchar(20) NULL COMMENT '변경자',
regist_dt datetime(3) NULL COMMENT '생성일시(now(3)-밀리세컨드까지)',
regist_id varchar(20) NULL COMMENT '생성자',
PRIMARY KEY (request_id)
) COMMENT 'api 호출 로그';
CREATE TABLE tb_cmm_refresh_token
(
id varchar(20) NOT NULL COMMENT 'id',
refresh_token varchar(256) NOT NULL COMMENT 'refreshtoken',
regist_dt timestamp NULL COMMENT '등록일시',
updt_dt timestamp NULL COMMENT '변경일시',
PRIMARY KEY (id)
) COMMENT '리프레쉬토큰';
CREATE TABLE tb_purchase_info
(
rptr_entrps_nm varchar(120) NULL COMMENT '판매_업체_명',
@ -207,22 +226,4 @@ CREATE TABLE tb_stock_info
PRIMARY KEY (storge_no, prduct_cd)
) COMMENT '재고_정보';
CREATE TABLE tb_storge_info
(
bssh_cd varchar(10) NOT NULL COMMENT '마약류취급자식별_번호',
bssh_nm varchar(120) NULL COMMENT '업체_명',
use_at char NULL COMMENT '사용_유무',
storge_se_nm varchar(200) NULL COMMENT '저장소_유형',
storge_no varchar(16) NULL COMMENT '저장소_번호',
storge_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 (bssh_cd)
) COMMENT '저장소_정보';

@ -156,20 +156,46 @@
WHERE dscdmng_id LIKE CONCAT(DATE_FORMAT(now(), '%Y%m'), '%');
</selectKey>
INSERT INTO tb_dsuse_mgt (
dscdmng_id,
user_id,
bssh_cd,
prgrs_stts_cd,
rpt_rcept_no,
dscdmng_id, /* 폐기관리ID */
usr_rpt_id_no, /* 사용자보고식별번호 */
ref_usr_rpt_id_no, /* 참조사용자식별번호 */
user_id, /* 사용자ID */
prgrs_stts_cd, /* 폐기관리진행상태코드 */
bssh_cd, /* 마약류취급자식별번호 */
rpt_rcept_no, /* 보고접수번호 */
rpt_ty_cd, /* 보고유형코드 : AAR - 폐기보고 */
rnd_dtl_rpt_cnt, /* 수불상세보고수 */
hdr_de, /* 취급일자 */
rpt_de, /* 보고일자 */
dsuse_se_cd, /* 폐기구분코드 */
dsuse_prv_cd, /* 폐기사유코드 */
dsuse_mth_cd, /* 폐기방법코드 */
dsuse_loc, /* 폐기장소 */
dsuse_de, /* 폐기일자 */
status, /* 상태 */
rpt_prg_stts_cd, /* 보고진행상태코드 */
use_yn,
reg_dt,
rgtr
) VALUES (
#{dscdmngId},
#{usrRptIdNo},
#{refUsrRptIdNo},
#{userId},
#{bsshCd},
#{prgrsSttsCd},
#{bsshCd},
#{rptRceptNo},
#{rptTyCd},
#{rndDtlRptCnt},
#{hdrDe},
#{rptDe},
#{dsuseSeCd},
#{dsusePrvCd},
#{dsuseMthCd},
#{dsuseLoc},
#{dsuseDe},
#{status},
#{rptPrgSttsCd},
'Y',
DATE_FORMAT(now(), '%Y%m%d%H%i%s'),
#{rgtr}
@ -179,30 +205,64 @@
<insert id="insertDsuseMgtDtl" parameterType="cokr.xit.adds.biz.nims.model.BizNimsRequest$DsuseMgtDtl">
/** nims-mysql-mapper|insertDsuseMgtDtl-폐기관리 상세 생성|julim */
INSERT INTO tb_dsuse_mgt_dtl (
dscdmng_id,
dscdmng_sn,
prdct_cd,
dsuse_qy,
acdnt_ocrn_day,
ocrn_rpt_day,
acdnt_ocrn_rsn,
dscdmng_id, /* 폐기관리ID */
usr_rpt_id_no, /* 사용자보고식별번호 */
usr_rpt_ln_id_no, /* 사용자보고라인식별번호 */
prduct_cd, /* 제품코드 */
prduct_nm, /* 제품명 */
min_distb_qy, /* 최소유통단위수량 */
pce_qy, /* 낱개단위수량 */
mnf_no, /* 제조번호 */
prd_valid_de, /* 제품유효기한일자 */
mnf_seq, /* 제품일련번호 */
storge_no, /* 저장소번호 */
storge_nm, /* 저장소명 */
mvmn_ty_cd, /* 이동유형코드 */
dsuse_qy, /* 폐기수량 */
use_yn,
reg_dt,
rgtr
) VALUES (
#{dscdmngId},
#{dscdmngSn},
#{prdctCd},
#{usrRptIdNo},
#{usrRptLnIdNo},
#{prductCd},
#{prductNm},
#{minDistbQy},
#{pceQy},
#{mnfNo},
#{prdValidDe},
#{mnfSeq},
#{storgeNo},
#{storgeNm},
#{mvmnTyCd},
#{dsuseQy},
#{acdntOcrnDay},
#{ocrnRptDay},
#{acdntOcrnRsn},
'Y',
DATE_FORMAT(now(), '%Y%m%d%H%i%s'),
#{rgtr}
)
</insert>
<update id="updateCancelDsuseMgt" parameterType="cokr.xit.adds.biz.nims.model.BizNimsRequest$DsuseMgt">
/** nims-mysql-mapper|updateCancelDsuseMgt-폐기관리 취소|julim */
UPDATE tb_dsuse_mgt
SET use_yn = 'N'
, mdfcn_dt = DATE_FORMAT(now(), '%Y%m%d%H%i%s')
, mdfr = #{rgtr}
WHERE usr_rpt_id_no = #{refUsrRptIdNo}
AND use_yn = 'Y'
</update>
<update id="updateCancelDsuseMgtDtl" parameterType="cokr.xit.adds.biz.nims.model.BizNimsRequest$DsuseMgt">
/** nims-mysql-mapper|updateCancelDsuseMgtDtl-폐기관리 상세 취소 조회|julim */
UPDATE tb_dsuse_mgt_dtl
SET use_yn = 'N'
, mdfcn_dt = DATE_FORMAT(now(), '%Y%m%d%H%i%s')
, mdfr = #{rgtr}
WHERE usr_rpt_id_no = #{refUsrRptIdNo}
AND use_yn = 'Y'
</update>
<select id="selectTgtAarHeader" parameterType="cokr.xit.adds.biz.nims.model.BizNimsRequest$DsuseMgt" resultType="cokr.xit.adds.biz.nims.model.BizNimsAarDto$AarHeader">
/** nims-mysql-mapper|selectTgtAarHeader-폐기 보고 대상 헤더 조회|julim */
SELECT tdm.dscdmng_id /* 폐기관리ID */
@ -265,7 +325,7 @@
JOIN tb_dsuse_mgt_dtl tdmd
ON tdm.dscdmng_id = tdmd.dscdmng_id
JOIN tb_prduct_info tpi
ON tdmd.prdct_cd = tpi.prduct_cd
ON tdmd.prduct_cd = tpi.prduct_cd
LEFT OUTER JOIN tb_storge_info tsi
ON tdm.bssh_cd = tsi.bssh_cd
WHERE tdm.dscdmng_id = #{dscdmngId}

@ -77,7 +77,7 @@ select tdm.dscdmng_id /* 폐기관리ID */
join tb_dsuse_mgt_dtl tdmd
on tdm.dscdmng_id = tdmd.dscdmng_id
join tb_prduct_info tpi
on tdmd.prdct_cd = tpi.prduct_cd
on tdmd.prduct_cd = tpi.prduct_cd
left outer join tb_storge_info tsi
on tdm.bssh_cd = tsi.bssh_cd
where tdm.dscdmng_id = '2024040001';

Loading…
Cancel
Save