feat: 폐기신청서접수, 통보[결과] 처리

dev
Jonguk. Lim 6 months ago
parent 7e5fde2f0c
commit 5e94a3ebb7

@ -40,6 +40,8 @@ public interface BizNimsMapper extends AbstractMapper {
//------------------------------------------------------------------------------------------------------
// NIMS BIZ
//------------------------------------------------------------------------------------------------------
int insertDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceipt dto);
int updateDsuseMgtRslt(final BizNimsRequest.DsuseMgtRslt dto);
int insertDsuseMgt(final BizNimsRequest.DsuseMgt dto);
int insertDsuseMgtDtl(final BizNimsRequest.DsuseMgtDtl dto);
List<BizNimsResponse.DsuseMgtRes> selectDsuseMgts(final BizNimsRequest.DsuseMgtInq dto);

@ -21,6 +21,7 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@ -38,68 +39,163 @@ import lombok.experimental.SuperBuilder;
* </pre>
*/
public class BizNimsRequest {
/**
* request
* request
*/
@Schema(name = "DsuseMgt", description = "마약류 폐기 관리 마스터 DTO")
@Data
@Schema(name = "DsuseMgtReceipt", description = "마약류 폐기 관리 신청서 접수 DTO")
@Getter
//@Setter
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper = false)
public static class DsuseMgt2 extends AuditDto {
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class DsuseMgtReceipt extends AuditDto {
/**
* ID
*/
@Schema(requiredMode = AUTO, title = "폐기 관리 ID", example = " ")
private String dscdmngId;
/**
* ID
*/
@Schema(requiredMode = REQUIRED, title = "사용자 ID", example = " ")
@NotEmpty(message = "사용자 ID는 필수 입니다")
private String userId;
/**
* <pre>
*
*
* > > >
* =>
* YYYYMMDD
* - ADDS11
* 01-
* 06-
* 07-
* 11-
* 21-
* 99-
* </pre>
*/
@Schema(requiredMode = REQUIRED, title = "원사용자보고식별번호", example = " ")
private String orgUsrRptIdNo;
@Schema(title = "폐기관리진행상태", example = "01")
@NotEmpty(message = "폐기관리진행상태는 필수 입니다")
private String prgrsSttsCd = Constants.PRGRS_STTS_CD.RECEIPT.getCode();
/**
*
*/
@Schema(title = "마약류취급자식별번호", example = "H00008333")
@NotEmpty(message = "마약류취급자식별번호는 필수 입니다")
private String bsshCd;
/**
*
*/
@Schema(requiredMode = REQUIRED, title = "수불상세보고수", example = "1")
@Positive(message="폐기보고 제품 건수(제품수불상세보고수)를 입력해 주세요(ex. 1)")
private Integer rndDtlRptCnt;
/**
* <pre>
*
* update
*
* 01-, 02-,, 03-
* 04- , 05- , 07-, 08-
* 09-, 12-
* </pre>
*/
@Schema(requiredMode = REQUIRED, title = "사용자보고식별번호", example = " ")
private String usrRptIdNo;
@Schema(title = "폐기 사유 코드", example = "03")
@NotEmpty(message = "폐기 사유 코드는 필수 입니다")
private String dsusePrvCd;
}
/**
*
* request
*/
@JsonProperty(value = "BSSH_CD", required = true)
private String bsshCd;
@Schema(name = "DsuseMgtRslt", description = "마약류 폐기 관리 통보 및 결과 처리 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class DsuseMgtRslt extends AuditDto {
/**
* ID
*/
@Schema(requiredMode = REQUIRED, title = "폐기 관리 ID", example = " ")
private String dscdmngId;
/**
* ID
*/
@Schema(requiredMode = REQUIRED, title = "사용자 ID", example = " ")
@NotEmpty(message = "사용자 ID는 필수 입니다")
private String userId;
/**
* <pre>
*
*
* - ADDS11
* 01-
* 02-
* 11-()
* 21-
* 22-
* 31-
* 41-
* 99-
* 06-
* 07-
* 11-
* 21-
* 99-
* </pre>
*/
@Schema(requiredMode = REQUIRED, title = "진행 상태 코드", example = " ", allowableValues = {"01", "02", "11", "21", "22", "31", "41", "99"})
@Pattern(regexp = "01|02|11|22|31|41|99", message = "진행 상태 코드는 필수 입니다")
@Schema(title = "폐기관리진행상태", example = "01")
@NotEmpty(message = "폐기관리진행상태는 필수 입니다")
private String prgrsSttsCd = Constants.PRGRS_STTS_CD.RECEIPT.getCode();
/**
* <pre>
* - ()
* </pre>
*/
@Schema(title = "취급일자", example = " ")
@Pattern(regexp = Constants.DATE_REGX, message = "취급일자를 정확히 입력해 주세요(yyyyMMdd)")
private String hdrDe;
/**
*
*/
@Schema(title = "보고일자", example = " ")
@Pattern(regexp = Constants.DATE_REGX, message = "보고일자를 정확히 입력해 주세요(yyyyMMdd)")
private String rptDe;
/**
* <pre>
*
* 1-, 2-, 4-//
* </pre>
*/
@Schema(title = "폐기 구분 코드", example = " ")
@NotEmpty(message = "폐기 구분 코드는 필수 입니다")
private String dsuseSeCd;
/**
* <pre>
*
* 1-, 2-, 3- , 4-, 5-
* 6-, 7-, 8-(,), 9-
* </pre>
*/
@Schema(title = "폐기 방법 코드", example = " ")
@NotEmpty(message = "폐기 방법 코드는 필수 입니다")
private String dsuseMthCd;
/**
*
*/
@Schema(title = "폐기 장소", example = " ")
@NotEmpty(message = "폐기 장소는 필수 입니다")
private String dsuseLoc;
/**
* <pre>
*
* </pre>
*/
@Schema(title = "폐기일자", example = " ")
@Pattern(regexp = Constants.DATE_REGX, message = "폐기일자를 정확히 입력해 주세요(yyyyMMdd)")
private String dsuseDe;
}
/**
@ -128,16 +224,13 @@ public class BizNimsRequest {
/**
* <pre>
*
*
* - ADDS11
* 01-
* 02-
* 11-()
* 21-
* 22-
* 31-
* 41-
* 99-
* 06-
* 07-
* 11-
* 21-
* 99-
* </pre>
*/
@Schema(title = "폐기관리진행상태", example = " ")
@ -158,7 +251,7 @@ public class BizNimsRequest {
private Integer rndDtlRptCnt;
/**
*
* - ()
*/
@Schema(title = "취급일자", example = " ")
@Pattern(regexp = Constants.DATE_REGX, message = "취급일자를 정확히 입력해 주세요(yyyyMMdd)")
@ -262,6 +355,66 @@ public class BizNimsRequest {
List<DsuseMgtDtl> dsuseMgtDtls = new ArrayList<>();
}
/**
* request
*/
@Schema(name = "DsuseMgt", description = "마약류 폐기 관리 마스터 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper = false)
public static class DsuseMgt2 extends AuditDto {
@Schema(requiredMode = AUTO, title = "폐기 관리 ID", example = " ")
private String dscdmngId;
@Schema(requiredMode = REQUIRED, title = "사용자 ID", example = " ")
@NotEmpty(message = "사용자 ID는 필수 입니다")
private String userId;
/**
* <pre>
*
*
* > > >
* =>
* YYYYMMDD
* </pre>
*/
@Schema(requiredMode = REQUIRED, title = "원사용자보고식별번호", example = " ")
private String orgUsrRptIdNo;
/**
* <pre>
*
* update
* </pre>
*/
@Schema(requiredMode = REQUIRED, title = "사용자보고식별번호", example = " ")
private String usrRptIdNo;
/**
*
*/
@JsonProperty(value = "BSSH_CD", required = true)
private String bsshCd;
/**
* <pre>
* - ADDS11
* 01-
* 06-
* 07-
* 11-
* 21-
* 99-
* </pre>
*/
@Schema(requiredMode = REQUIRED, title = "진행 상태 코드", example = " ", allowableValues = {"01", "02", "11", "21", "22", "31", "41", "99"})
@Pattern(regexp = "01|02|11|22|31|41|99", message = "진행 상태 코드는 필수 입니다")
private String prgrsSttsCd = Constants.PRGRS_STTS_CD.RECEIPT.getCode();
}
/**
* request
*/
@ -288,59 +441,63 @@ public class BizNimsRequest {
/**
* _ - 13
*/
@Schema(title = "제품코드", example = " ")
@Schema(requiredMode = REQUIRED, title = "제품코드", example = "8806718050823")
@Pattern(regexp = "[0-9a-zA-Z]{13}", message = "제품코드는 13자리 입니다")
private String prductCd;
/**
*
*/
@Schema(title = "제품명", example = " ")
@Schema(requiredMode = REQUIRED, title = "제품명", example = "아쿠아폴주20밀리리터(프로포폴) (20㎖)")
@NotEmpty(message = "제품명은 필수 입니다")
private String prductNm;
/**
* : 1 ~
*/
@Schema(title = "최소유통단위수량", example = " ")
@Schema(requiredMode = REQUIRED, title = "최소유통단위수량", example = "1")
@Positive(message="최소유통단위 수량을 입력해 주세요(ex. 1)")
private Integer minDistbQy;
/**
* : 0 ~
*/
@Schema(title = "낱개단위수량", example = " ")
@Schema(requiredMode = REQUIRED, title = "낱개단위수량", example = "0")
@PositiveOrZero(message = "낱개단위 수량은 필수 입니다(ex. 0)")
private Integer pceQy;
/**
* - 20
*/
@Schema(title = "제품번호", example = " ")
@Pattern(regexp = "[0-9a-zA-Z]{1,20}", message = "제조번호는 필수 입니다")
@Schema(requiredMode = REQUIRED, title = "제품제조번호", example = "A1111")
@Pattern(regexp = "[0-9a-zA-Z]{1,20}", message = "제품제조번호는 필수 입니다")
private String mnfNo;
/**
* - yyyyMMdd
*/
@Schema(title = "제품유효기간", example = " ")
@Schema(requiredMode = REQUIRED, title = "제품유효기간", example = "20300303")
@Pattern(regexp = Constants.DATE_REGX, message = "제품 유효 기간을 정확히 입력해 주세요(yyyyMMdd)")
private String prdValidDe;
/**
* - 20
*/
@Schema(title = "제조일련번호", example = " ")
@Schema(requiredMode = REQUIRED, title = "제조일련번호", example = "A11111111")
@Pattern(regexp = "[0-9a-zA-Z]{1,20}", message = "제조 일련번호는 필수 입니다")
private String mnfSeq;
/**
*
*/
@Schema(title = "폐기수량", example = " ")
@Schema(requiredMode = REQUIRED, title = "폐기수량", example = "2")
@Positive(message = "폐기 수량은 0보다 커야 합니다")
private Integer dsuseQy;
// @Schema(title = "폐기제품이미지", example = " ")
// //@NotEmpty(message = "폐기제품이미지는 필수 입니다")
// private MultipartFile dsusePrdImgFile;
/**
*
*/

@ -2,6 +2,8 @@ package cokr.xit.adds.biz.nims.service;
import java.util.List;
import org.springframework.web.multipart.MultipartFile;
import cokr.xit.adds.biz.nims.model.BizNimsRequest;
import cokr.xit.adds.biz.nims.model.BizNimsResponse;
import cokr.xit.adds.inf.nims.model.NimsApiDto;
@ -54,6 +56,8 @@ public interface BizNimsService {
//------------------------------------------------------------------------------------------------------
// NIMS BIZ
//------------------------------------------------------------------------------------------------------
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);
void modifyPrgsSttsOfDsuseMgt(final BizNimsRequest.DsuseMgt dto);

@ -1,5 +1,9 @@
package cokr.xit.adds.biz.nims.service.bean;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -12,6 +16,7 @@ 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;
import cokr.xit.adds.biz.nims.dao.BizNimsMapper;
import cokr.xit.adds.biz.nims.model.BizNimsRequest;
@ -29,6 +34,7 @@ import cokr.xit.adds.inf.nims.service.InfNimsService;
import cokr.xit.foundation.component.AbstractServiceBean;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
/**
* <pre>
@ -49,6 +55,18 @@ 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;
/**
*
*/
@ -219,7 +237,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
// FIXME: 미완료 보고관리-보고정보 매핑 처리
// 미완료(종료)된 폐기 관리 목록 조회
List<BizNimsResponse.DsuseMgtRes> dsuseMgts = getDsuseMgts(BizNimsRequest.DsuseMgtInq.builder()
.prgrsSttsCd(Constants.PRGRS_STTS_CD.END.getCode())
.prgrsSttsCd(Constants.PRGRS_STTS_CD.COMPLETE.getCode())
.build());
//////////////////////////////////////////////////////////////////////////////
@ -338,6 +356,79 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
//------------------------------------------------------------------------------------------------------
// NIMS BIZ
//------------------------------------------------------------------------------------------------------
/**
* <pre>
*
* @param dto 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("폐기물 보고수 오류[폐기물 갯수 확인]");
ApiUtil.validate(dtls, null, validator);
dto.setRgtr(dto.getUserId());
if(files.size() != dtls.size()) throw ApiCustomException.create("폐기물 파일 갯수 오류[파일 갯수 확인]");
if(bizNimsMapper.insertDsuseMgtReceipt(dto) == 1){
int dtlCnt = 0;
for (BizNimsRequest.DsuseMgtDtl d : dtls) {
d.setDscdmngId(dto.getDscdmngId());
d.setDscdmngSn(StringUtils.leftPad(dtlCnt + 1 + "", 3, "0"));
d.setRgtr(dto.getUserId());
dtlCnt = dtlCnt + bizNimsMapper.insertDsuseMgtDtl(d);
// FIXME : file upload
// files[dtlCnt].transferTo(new File("path"));
//d.setDsusePrdImgFile(null);
}
if(dtls.size() != dtlCnt) throw ApiCustomException.create("폐기 관리 상세 등록 실패");
} else {
throw ApiCustomException.create("폐기 관리 마스터 등록 실패");
}
return dto;
}
/**
* <pre>
* []
* @param dto 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());
if(bizNimsMapper.updateDsuseMgtRslt(dto) == 1){
int dtlCnt = 0;
String dirPath = dsuseImgPath + Constants.FILE_DLMTR + dto.getDscdmngId();
File f = new File(dirPath);
if(!f.exists()) f.mkdirs();
for (MultipartFile mf : files) {
val name = mf.getOriginalFilename();
val ext = name.substring(name.lastIndexOf("."));
val filename = name.substring(0, name.lastIndexOf("."));
Path path = Paths.get(dirPath + Constants.FILE_DLMTR, name);
// FIXME : file upload
try {
mf.transferTo(path);
//FileCopyUtils.copy(mf.getInputStream(), Files.newOutputStream(path));
} catch (IOException e) {
throw ApiCustomException.create(String.format("폐기 통보[결과] 처리:파일 업로드 실패[%s]", e.getMessage()));
}
//d.setDsusePrdImgFile(null);
}
} else {
throw ApiCustomException.create("폐기 관리 정보 변경[통보(결과) 처리] 실패");
}
return dto;
}
/**
* <pre>

@ -2,6 +2,7 @@ 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;
@ -12,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.adds.biz.nims.model.BizNimsRequest;
import cokr.xit.adds.biz.nims.model.BizNimsResponse;
import cokr.xit.adds.biz.nims.service.BizNimsService;
@ -19,6 +22,7 @@ import cokr.xit.adds.core.model.ApiBaseResponse;
import cokr.xit.adds.core.util.XingUtils;
import cokr.xit.adds.inf.nims.model.NimsApiDto;
import cokr.xit.adds.inf.nims.model.NimsApiRequest;
import cokr.xit.foundation.data.JSON;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
@ -93,6 +97,44 @@ public class BizNimsController {
//------------------------------------------------------------------------------------------------------
// NIMS BIZ
//------------------------------------------------------------------------------------------------------
/**
*
* @param dsuseMgtJsonStr JSON String
* @param dsuseMgtDtlsJsonStr JSON String
* @param dsusePrdImgFiles
* @return return
*/
@Operation(summary = "사고 마약류 폐기 관리 폐기 신청서 접수", description = "사고 마약류 폐기 관리 폐기 신청서 접수<br><br>폐기관리 신청서 접수 데이타 생성후 생성 정보 return")
@PostMapping(value = "/saveDsuseMgtReceipt")
public ApiBaseResponse<BizNimsRequest.DsuseMgtReceipt> saveDsuseMgtReceipt(
@RequestParam("dsuseMgtJsonStr") String dsuseMgtJsonStr,
@RequestParam("dsuseMgtDtlsJsonStr") String dsuseMgtDtlsJsonStr,
@RequestParam(value = "dsusePrdImgFiles") List<MultipartFile> dsusePrdImgFiles
) {
JSON json = new JSON();
BizNimsRequest.DsuseMgtReceipt receiptDto = json.parse(dsuseMgtJsonStr, new TypeReference<>() {});
List<BizNimsRequest.DsuseMgtDtl> dsuseMgtDtls = json.parse(dsuseMgtDtlsJsonStr, new TypeReference<>() {});
return ApiBaseResponse.of(bizNimsService.saveDsuseMgtReceipt(receiptDto, dsuseMgtDtls, dsusePrdImgFiles));
}
/**
* []
* @param dsuseMgtRsltJsonStr [] JSON String
* @param dsuseDsuseImgFiles
* @return [] return
*/
@Operation(summary = "사고 마약류 폐기 관리 폐기 신청서 접수", description = "사고 마약류 폐기 관리 폐기 신청서 접수<br><br>폐기관리 신청서 접수 데이타 생성후 생성 정보 return")
@PostMapping(value = "/saveDsuseMgtRslt")
public ApiBaseResponse<BizNimsRequest.DsuseMgtRslt> saveDsuseMgtRslt(
@RequestParam("dsuseMgtRsltJsonStr") String dsuseMgtRsltJsonStr,
@RequestParam(value = "dsuseDsuseImgFiles") List<MultipartFile> dsuseDsuseImgFiles
) {
JSON json = new JSON();
BizNimsRequest.DsuseMgtRslt rsltDto = json.parse(dsuseMgtRsltJsonStr, new TypeReference<>() {});
return ApiBaseResponse.of(bizNimsService.saveDsuseMgtRslt(rsltDto, dsuseDsuseImgFiles));
}
@Operation(summary = "사고 마약류 폐기 관리 생성", description = "사고 마약류 폐기 관리 생성<br><br>폐기관리 데이타 생성후 폐기보고 정보 return")
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
@Content(mediaType = "application/json", examples = {
@ -187,7 +229,7 @@ public class BizNimsController {
}
@Operation(summary = "barcode 이미지 제품 제조 정보 조회", description = "barcode 이미지 제품 제조 정보 조회<br><br>barcode 이미지를 통한 제품 제조 정보 조회")
@PostMapping(value = "/getProductInfoByQrcodeImg", consumes = { "multipart/form-data" })
@PostMapping(value = "/getProductInfoByQrcodeImg", consumes = { MediaType.MULTIPART_FORM_DATA_VALUE })
//@PostMapping(value = "/api/biz/nims/v1/getQrcode")
public ApiBaseResponse<NimsApiDto.ProductInfoKd> getProductInfoByQrcodeImg(
@RequestParam("uploadFiles")

@ -25,6 +25,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 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])$";
public static final String CUR_DATE_REGX = "^20([2-9][0-9])((0[1-9])|(1[0-2]))(0[1-9]|[12][0-9]|3[01])$";
@ -143,7 +144,8 @@ public class Constants {
/**
* <pre>
* - ADDS05
* 1:, 2:, 3:, 4:, 5:, 6:, 7:, 8:, 9:
* 1:, 2:, 3:, 4:, 5:,
* 6:, 7:, 8:, 9:
* </pre>
*/
@Getter
@ -183,27 +185,22 @@ public class Constants {
* <pre>
* - ADDS11
* 01-
* 02-
* 11-()
* 21-
* 22-
* 31-
* 41-
* 99-
* 06-
* 07-
* 11-
* 21-
* 99-
* </pre>
*/
@Getter
public enum PRGRS_STTS_CD {
// 폐기보고신청서의 데이타 입력 생성 - 폐기관리 데이타 생성
RECEIPT("01", "폐기신청서접수"),
NOTICE_WRITE("06", "폐기결과통보서작성"),
REPORT_WRITE("07", "폐기내역서작성"),
// 폐기보고 데이타 매핑 완료
MAPPING("02", "폐기보고매핑"),
ACCEPT("11", "민원수령처리(전자결재)"),
NOTICE_WRITE("21", "폐기결과통보서작성"),
REPORT_WRITE("22", "폐기결과보고서작성"),
DRAFT("31", "기안 및 발송"),
REPORT("41", "폐기보고"),
END("99", "종료")
MAPPING("11", "폐기보고확인"),
COMPLETE("99", "폐기보고완료")
;
private final String code;

@ -148,7 +148,7 @@
// */
// public static Map<String, Object> toMap(final String str) {
// try {
// return ObjectUtils.isNotEmpty(str)? OM.readValue(str, new TypeReference<Map<String, Object>>(){}) : null;
// return ObjectUtils.isNotEmpty(str)? OM.readValue(str, new TypeReference<>(){}) : null;
// } catch (JsonProcessingException e) {
// throw ApiCustomException.create(e.getLocalizedMessage());
// }

@ -43,6 +43,7 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import cokr.xit.adds.biz.nims.service.BizNimsService;
import cokr.xit.adds.core.Constants;
import cokr.xit.adds.core.spring.exception.ApiCustomException;
import cokr.xit.adds.core.util.DateUtils;
import cokr.xit.adds.inf.mois.model.MoisExchangeRequest;
@ -110,7 +111,6 @@ public class InfMoisServiceBean extends AbstractServiceBean implements InfMoisSe
private final BizNimsService bizNimsService;
private static final String delimiter = System.getProperty("os.name").contains("Window") ? "\\" : "/";
private static final String bodyText =
"""
1. .
@ -184,9 +184,9 @@ public class InfMoisServiceBean extends AbstractServiceBean implements InfMoisSe
log.info("srcPath : {}", srcPath);
log.info("srcFileNam : {}", srcFileName);
rcvTgtFiles.add(Map.of(
"inFolder", srcPath + delimiter + srcFileName,
"inFolder", srcPath + Constants.FILE_DLMTR + srcFileName,
"outFolder",
dataRootPath + receiveDir + srcPath.substring(srcPath.lastIndexOf(delimiter) + 1) + delimiter,
dataRootPath + receiveDir + srcPath.substring(srcPath.lastIndexOf(Constants.FILE_DLMTR) + 1) + Constants.FILE_DLMTR,
"delFolder", srcPath
));
@ -211,7 +211,7 @@ public class InfMoisServiceBean extends AbstractServiceBean implements InfMoisSe
}
} catch (Exception e) {
for(Map<String, String> m : rcvTgtFiles) {
String[] items = m.get("inFolder").split(delimiter);
String[] items = m.get("inFolder").split(Constants.FILE_DLMTR);
String fileName = items[items.length-1];
String inFile = m.get("outFolder")+fileName;
String outFile = m.get("inFolder").replace(fileName, "");
@ -329,7 +329,7 @@ public class InfMoisServiceBean extends AbstractServiceBean implements InfMoisSe
//transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");
DOMSource source = new DOMSource(doc);
try(FileOutputStream fio = new FileOutputStream(new File(path + delimiter + "exchange.xml"));) {
try(FileOutputStream fio = new FileOutputStream(new File(path + Constants.FILE_DLMTR + "exchange.xml"));) {
StreamResult result = new StreamResult(fio);
transformer.transform(source, result);
}catch (SecurityException | IOException e) {
@ -411,7 +411,7 @@ public class InfMoisServiceBean extends AbstractServiceBean implements InfMoisSe
sb.append("sender_systemname=").append(header.getSenderSystemname()).append("\n");
sb.append("administrative_num=").append(header.getAdministrativeNum()).append("\n");
try(PrintWriter fw = new PrintWriter(dirPath+ delimiter + "header.inf", "euc-kr");){
try(PrintWriter fw = new PrintWriter(dirPath+ Constants.FILE_DLMTR + "header.inf", "euc-kr");){
fw.write(sb.toString());
fw.flush();
} catch (FileNotFoundException | UnsupportedEncodingException e) {
@ -423,7 +423,7 @@ public class InfMoisServiceBean extends AbstractServiceBean implements InfMoisSe
final String path = dataRootPath + sendTemp + pathName;
File dirPath = new File(path);
try(PrintWriter fw = new PrintWriter(dirPath + delimiter + "eof.inf", "euc-kr");){
try(PrintWriter fw = new PrintWriter(dirPath + Constants.FILE_DLMTR + "eof.inf", "euc-kr");){
fw.write(StringUtils.EMPTY);
fw.flush();
} catch (FileNotFoundException | UnsupportedEncodingException e) {

@ -202,3 +202,7 @@ 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

@ -179,6 +179,51 @@
<!-- ========================== -->
<!-- 폐기관리 업무 테이블 start -->
<!-- ========================== -->
<insert id="insertDsuseMgtReceipt" parameterType="cokr.xit.adds.biz.nims.model.BizNimsRequest$DsuseMgtReceipt">
/** nims-mysql-mapper|insertDsuseMgtReceipt-폐기관리 신청서 정보 생성|julim */
<selectKey keyProperty="dscdmngId" resultType="string" order="BEFORE">
SELECT NVL(MAX(dscdmng_id), CONCAT(DATE_FORMAT(now(), '%Y%m'),'0000')) + 1
FROM tb_dsuse_mgt
WHERE dscdmng_id LIKE CONCAT(DATE_FORMAT(now(), '%Y%m'), '%');
</selectKey>
INSERT INTO tb_dsuse_mgt (
dscdmng_id, /* 폐기관리ID */
user_id, /* 사용자ID */
prgrs_stts_cd, /* 폐기관리진행상태코드 */
bssh_cd, /* 마약류취급자식별ID */
rnd_dtl_rpt_cnt, /* 수불상세보고수 */
dsuse_prv_cd, /* 폐기사유코드 */
use_yn,
reg_dt,
rgtr
) VALUES (
#{dscdmngId},
#{userId},
#{prgrsSttsCd},
#{bsshCd},
#{rndDtlRptCnt},
#{dsusePrvCd},
'Y',
DATE_FORMAT(now(), '%Y%m%d%H%i%s'),
#{rgtr}
)
</insert>
<update id="updateDsuseMgtRslt" parameterType="cokr.xit.adds.biz.nims.model.BizNimsRequest$DsuseMgtRslt">
/** nims-mysql-mapper|updateDsuseMgtRslt-폐기관리 정보 변경|julim */
UPDATE tb_dsuse_mgt
SET prgrs_stts_cd = #{prgrsSttsCd}
, hdr_de = #{hdrDe}
, rpt_de = #{rptDe}
, dsuse_se_cd = #{dsuseSeCd}
, dsuse_mth_cd = #{dsuseMthCd}
, dsuse_loc = #{dsuseLoc}
, dsuse_de = #{dsuseDe}
, mdfcn_dt = DATE_FORMAT(now(), '%Y%m%d%H%i%s')
, mdfr = #{rgtr}
WHERE dscdmng_id = #{dscdmngId}
</update>
<insert id="insertDsuseMgt" parameterType="cokr.xit.adds.biz.nims.model.BizNimsRequest$DsuseMgt">
/** nims-mysql-mapper|insertDsuseMgt-폐기관리 생성|julim */
<selectKey keyProperty="dscdmngId" resultType="string" order="BEFORE">

@ -0,0 +1,100 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="ZXing for JS">
<title>폐기 신청서 접수</title>
<link rel="stylesheet" rel="preload" as="style" onload="this.rel='stylesheet';this.onload=null"
href="https://fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
<link rel="stylesheet" rel="preload" as="style" onload="this.rel='stylesheet';this.onload=null"
href="https://unpkg.com/normalize.css@8.0.0/normalize.css">
<link rel="stylesheet" rel="preload" as="style" onload="this.rel='stylesheet';this.onload=null"
href="https://unpkg.com/milligram@1.3.0/dist/milligram.min.css">
</head>
<body>
<main class="wrapper" style="padding-top:2em">
<input type="file" id="img1" name="img" accept="image/*"><br>
<input type="file" id="img2" name="img" accept="image/*"><br>
<button id="btnSave">save</button>
</main>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="
crossorigin="anonymous"></script>
<script type="text/javascript">
document.querySelector("#btnSave").addEventListener("click", function () {
let dsuseMgt =
{
userId: "api-user",
prgrsSttsCd: "01",
bsshCd: "H00008333",
rndDtlRptCnt: 2,
dsusePrvCd: "04"
};
let dsuseMgtDtls = [
{
prductCd: "8806717024900",
prductNm: "베리콜시럽",
minDistbQy: 1,
pceQy: 1,
mnfNo: "A1111",
prdValidDe: "20300303",
mnfSeq: "A11111111",
dsuseQy: 10
},
{
prductCd: "8806718050823",
prductNm: "아쿠아폴주20밀리리터(프로포폴) (20㎖)",
minDistbQy: 1,
pceQy: 5,
mnfNo: "A1111",
prdValidDe: "20300303",
mnfSeq: "A11111111",
dsuseQy: 30
}
];
let formData = new FormData();
formData.append("dsuseMgtJsonStr", JSON.stringify(dsuseMgt));
formData.append("dsuseMgtDtlsJsonStr", JSON.stringify(dsuseMgtDtls));
$("input[type=file]").each(function (i) {
formData.append("dsusePrdImgFiles", $('input[type=file]')[i].files[0]);
});
$.ajax({
url: 'http://localhost:9076/api/biz/nims/v1/saveDsuseMgtReceipt',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function (res) {
console.log(res);
console.log(res.data);
if (!res.success) {
alert(`${res.code}: ${res.message}`);
}
},
error: function (error) {
console.log(error);
if (error.responseJSON && typeof error.responseJSON === 'object') {
console.log(error.responseJSON);
}
}
});
});
</script>
</body>
</html>

@ -0,0 +1,80 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="ZXing for JS">
<title>폐기 통보[결과] 처리</title>
<link rel="stylesheet" rel="preload" as="style" onload="this.rel='stylesheet';this.onload=null"
href="https://fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
<link rel="stylesheet" rel="preload" as="style" onload="this.rel='stylesheet';this.onload=null"
href="https://unpkg.com/normalize.css@8.0.0/normalize.css">
<link rel="stylesheet" rel="preload" as="style" onload="this.rel='stylesheet';this.onload=null"
href="https://unpkg.com/milligram@1.3.0/dist/milligram.min.css">
</head>
<body>
<main class="wrapper" style="padding-top:2em">
<input type="file" id="img1" name="img" accept="image/*"><br>
<input type="file" id="img2" name="img" accept="image/*"><br>
<button id="btnSave">save</button>
</main>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="
crossorigin="anonymous"></script>
<script type="text/javascript">
document.querySelector("#btnSave").addEventListener("click", function () {
let dsuseMgtRslt =
{
dscdmngId: "2024050001",
userId: "api-user",
prgrsSttsCd: "06",
hdrDe: "20240506",
rptDe: "20240506",
dsuseSeCd: "1",
dsuseMthCd: "3",
dsuseLoc: "보건소 소각장",
dsuseDe: "20240506"
};
let formData = new FormData();
formData.append("dsuseMgtRsltJsonStr", JSON.stringify(dsuseMgtRslt));
$("input[type=file]").each(function (i) {
formData.append("dsuseDsuseImgFiles", $('input[type=file]')[i].files[0]);
});
$.ajax({
url: 'http://localhost:9076/api/biz/nims/v1/saveDsuseMgtRslt',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function (res) {
console.log(res);
console.log(res.data);
if (!res.success) {
alert(`${res.code}: ${res.message}`);
}
},
error: function (error) {
console.log(error);
if (error.responseJSON && typeof error.responseJSON === 'object') {
console.log(error.responseJSON);
}
}
});
});
</script>
</body>
</html>
Loading…
Cancel
Save