@Test public void create() throws IOException { String request = loadJson("itemcreaterequest"); ItemCreateRequest rpcReq = JSON.parseObject(request, ItemCreateRequest.class); ICResponse<Long> longICResponse = itemWriteService.create(rpcReq); Assert.assertTrue(longICResponse.isSuccess()); }
@Override public ICResponse<Long> create(ItemCreateRequest request) { try { if (request == null) { throw new IllegalArgumentException("request is null"); } log.info("##create request param:{}", JSON.toJSONString(request)); ItemParam itemParam = request.getItemParam(); request.setSellerId(itemParam.getSellerId()); request.setSellerName(itemParam.getSellerName()); request.checkParam(); List<ProductDTO> productDTOS = checkProductDump(request); if (CollectionUtils.isNotEmpty(productDTOS)) { throw new IllegalArgumentException(String.format(" 检查名称/barcode，sku_code是否重复创建，%s", JSON.toJSONString(productDTOS))); } return itemWriteFacade.create(request); } catch (Exception ex) { log.error("create ex", ex); return ICResponse.fail(ex.getMessage()); } }
ItemWriteService implements ItemWriteFacade { @Override public ICResponse<Long> create(ItemCreateRequest request) { try { if (request == null) { throw new IllegalArgumentException("request is null"); } log.info("##create request param:{}", JSON.toJSONString(request)); ItemParam itemParam = request.getItemParam(); request.setSellerId(itemParam.getSellerId()); request.setSellerName(itemParam.getSellerName()); request.checkParam(); List<ProductDTO> productDTOS = checkProductDump(request); if (CollectionUtils.isNotEmpty(productDTOS)) { throw new IllegalArgumentException(String.format(" 检查名称/barcode，sku_code是否重复创建，%s", JSON.toJSONString(productDTOS))); } return itemWriteFacade.create(request); } catch (Exception ex) { log.error("create ex", ex); return ICResponse.fail(ex.getMessage()); } } }
ItemWriteService implements ItemWriteFacade { @Override public ICResponse<Long> create(ItemCreateRequest request) { try { if (request == null) { throw new IllegalArgumentException("request is null"); } log.info("##create request param:{}", JSON.toJSONString(request)); ItemParam itemParam = request.getItemParam(); request.setSellerId(itemParam.getSellerId()); request.setSellerName(itemParam.getSellerName()); request.checkParam(); List<ProductDTO> productDTOS = checkProductDump(request); if (CollectionUtils.isNotEmpty(productDTOS)) { throw new IllegalArgumentException(String.format(" 检查名称/barcode，sku_code是否重复创建，%s", JSON.toJSONString(productDTOS))); } return itemWriteFacade.create(request); } catch (Exception ex) { log.error("create ex", ex); return ICResponse.fail(ex.getMessage()); } }  }
ItemWriteService implements ItemWriteFacade { @Override public ICResponse<Long> create(ItemCreateRequest request) { try { if (request == null) { throw new IllegalArgumentException("request is null"); } log.info("##create request param:{}", JSON.toJSONString(request)); ItemParam itemParam = request.getItemParam(); request.setSellerId(itemParam.getSellerId()); request.setSellerName(itemParam.getSellerName()); request.checkParam(); List<ProductDTO> productDTOS = checkProductDump(request); if (CollectionUtils.isNotEmpty(productDTOS)) { throw new IllegalArgumentException(String.format(" 检查名称/barcode，sku_code是否重复创建，%s", JSON.toJSONString(productDTOS))); } return itemWriteFacade.create(request); } catch (Exception ex) { log.error("create ex", ex); return ICResponse.fail(ex.getMessage()); } }  @Override ICResponse<Long> create(ItemCreateRequest request); @Override ICResponse<Boolean> update(ItemUpdateRequest request); @Override ICResponse<Boolean> delete(ItemDeleteRequest request); @Override ICResponse<Boolean> sellerUpdateStatus(ItemUpdateStatusRequest request); }
ItemWriteService implements ItemWriteFacade { @Override public ICResponse<Long> create(ItemCreateRequest request) { try { if (request == null) { throw new IllegalArgumentException("request is null"); } log.info("##create request param:{}", JSON.toJSONString(request)); ItemParam itemParam = request.getItemParam(); request.setSellerId(itemParam.getSellerId()); request.setSellerName(itemParam.getSellerName()); request.checkParam(); List<ProductDTO> productDTOS = checkProductDump(request); if (CollectionUtils.isNotEmpty(productDTOS)) { throw new IllegalArgumentException(String.format(" 检查名称/barcode，sku_code是否重复创建，%s", JSON.toJSONString(productDTOS))); } return itemWriteFacade.create(request); } catch (Exception ex) { log.error("create ex", ex); return ICResponse.fail(ex.getMessage()); } }  @Override ICResponse<Long> create(ItemCreateRequest request); @Override ICResponse<Boolean> update(ItemUpdateRequest request); @Override ICResponse<Boolean> delete(ItemDeleteRequest request); @Override ICResponse<Boolean> sellerUpdateStatus(ItemUpdateStatusRequest request);  }