diff --git a/src/main/java/cokr/xit/adds/biz/nims/model/BizNimsResponse.java b/src/main/java/cokr/xit/adds/biz/nims/model/BizNimsResponse.java index 025a2b5..9791756 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/model/BizNimsResponse.java +++ b/src/main/java/cokr/xit/adds/biz/nims/model/BizNimsResponse.java @@ -248,8 +248,12 @@ public class BizNimsResponse { /** *
* 바코드 reader 사용시 - Barcode(GS1-128) 정보 파싱 - * 상품코드, 제조번호, 유효기간, 제조일련번호 + * 최소 30자리 이상 + * AI상품식별코드(2) + 상품코드(14) + AI최대유통일자(2) + 유통일자(6) + AI로트번호(2) + 제조번호(1) + AI일련번호(2) + 제품일련번호(1) + * -> 상품코드(확장코드(1) + 상품코드(13)), 제조번호(1), 제품일련번호(1) 은 필수로 포함한다는 가정 + * -> 상품코드, 제조번호, 유효기간, 제조일련번호 정보 추출 * + * ex) 01088065780457311717050110A1234210000000006 * @param barcodeStr * @return NimsApiDto.MnfSeqInfo *diff --git a/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java b/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java index c909364..7ce4876 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java +++ b/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java @@ -61,8 +61,9 @@ public interface BizNimsService { BizNimsRequest.DsuseMgt saveDsuseMgt(BizNimsRequest.DsuseMgt dto); List
diff --git a/src/main/java/cokr/xit/adds/biz/nims/web/BizNimsController.java b/src/main/java/cokr/xit/adds/biz/nims/web/BizNimsController.java index 2cdf269..bb3a7cf 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/web/BizNimsController.java +++ b/src/main/java/cokr/xit/adds/biz/nims/web/BizNimsController.java @@ -1,17 +1,24 @@ package cokr.xit.adds.biz.nims.web; +import java.io.IOException; import java.util.List; 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.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import com.google.zxing.NotFoundException; import cokr.xit.adds.biz.nims.model.BizNimsRequest; import cokr.xit.adds.biz.nims.model.BizNimsResponse; import cokr.xit.adds.biz.nims.service.BizNimsService; 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 io.swagger.v3.oas.annotations.Operation; @@ -146,8 +153,33 @@ public class BizNimsController { } + @Operation(summary = "barcode string 제품 제조 정보 조회", description = "barcode string 제품 제조 정보 조회
Barcode를 통한 제품 제조 정보 조회
ex) 01088065780457311717050110A1234210000000006") + @GetMapping(value = "/getPrdMnfSeqInfoOfBarcode") + public ApiBaseResponsegetPrdMnfSeqInfoOfBarcode( + final String barcodeStr + ) { + return ApiBaseResponse.of(bizNimsService.getPrdMnfSeqInfoOfBarcode(barcodeStr)); + } - + @Operation(summary = "barcode 이미지 제품 제조 정보 조회", description = "barcode 이미지 제품 제조 정보 조회
barcode 이미지를 통한 제품 제조 정보 조회") + @PostMapping(value = "/getProductInfoByQrcodeImg", consumes = { "multipart/form-data" }) + //@PostMapping(value = "/api/biz/nims/v1/getQrcode") + public ApiBaseResponse> getProductInfoByQrcodeImg( + @RequestParam("uploadFiles") + final List
multipartFiles + ) { + List list = multipartFiles.stream().map(mf -> { + //System.out.println(mf.getOriginalFilename()); + //System.out.println(mf.getSize()); + try { + return bizNimsService.getPrdMnfSeqInfoOfBarcode(XingUtils.readQrcodeFromFile(XingUtils.convert(mf))); + } catch (IOException | NotFoundException e) { + throw new RuntimeException(e); + } + }).toList(); + + return ApiBaseResponse.of(list); + } diff --git a/src/main/java/cokr/xit/adds/biz/nims/web/QrController.java b/src/main/java/cokr/xit/adds/biz/nims/web/QrController.java deleted file mode 100644 index 0d35701..0000000 --- a/src/main/java/cokr/xit/adds/biz/nims/web/QrController.java +++ /dev/null @@ -1,75 +0,0 @@ -package cokr.xit.adds.biz.nims.web; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.servlet.ModelAndView; - -import com.google.zxing.NotFoundException; - -import cokr.xit.adds.biz.nims.model.BizNimsResponse; -import cokr.xit.adds.core.util.XingUtils; -import cokr.xit.adds.inf.nims.model.NimsApiDto; -import io.swagger.v3.oas.annotations.tags.Tag; - -/** - * - * description : - * - * packageName : cokr.xit.adds.biz.web - * fileName : QrController - * author : limju - * date : 2024-04-01 - * ====================================================================== - * 변경일 변경자 변경 내용 - * ---------------------------------------------------------------------- - * 2024-04-01 limju 최초 생성 - * - *- */ -@Tag(name = "QrController", description = "qrcode API") -@RestController -public class QrController { - - @GetMapping("/api/biz/nims/v1/qrcodeForm") - public ModelAndView qrcodeForm() { - return new ModelAndView("/zxing/index.html"); - } - - @PostMapping(value = "/api/biz/nims/v1/getQrcode", consumes = { "multipart/form-data" }) - public ListuploadQrCode( - @RequestParam("uploadFiles") - final List multipartFiles - ) { - List mnfSeqInfos = new ArrayList<>(); - - List