|
|
@ -221,6 +221,7 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService |
|
|
productSn = CommonUtil.getProductSn(productSn); |
|
|
productSn = CommonUtil.getProductSn(productSn); |
|
|
final String productName = object.getString("productName"); |
|
|
final String productName = object.getString("productName"); |
|
|
final String priceStr = object.getString("price"); |
|
|
final String priceStr = object.getString("price"); |
|
|
|
|
|
|
|
|
BigDecimal price = BigDecimal.ZERO; |
|
|
BigDecimal price = BigDecimal.ZERO; |
|
|
// 使用正则表达式提取数字部分
|
|
|
// 使用正则表达式提取数字部分
|
|
|
final Pattern pattern = Pattern.compile("-?\\d+(\\.\\d+)?"); |
|
|
final Pattern pattern = Pattern.compile("-?\\d+(\\.\\d+)?"); |
|
|
@ -231,7 +232,15 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService |
|
|
price = new BigDecimal(numericPart); |
|
|
price = new BigDecimal(numericPart); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
final String wholesalePriceStr = object.getString("wholesalePrice"); |
|
|
|
|
|
BigDecimal wholesalePrice = BigDecimal.ZERO; |
|
|
|
|
|
final Matcher wholesalePriceMatcher = pattern.matcher(wholesalePriceStr); |
|
|
|
|
|
if (wholesalePriceMatcher.find()) { |
|
|
|
|
|
// 获取匹配到的数字字符串并转换为BigDecimal
|
|
|
|
|
|
final String numericPart = wholesalePriceMatcher.group(); |
|
|
|
|
|
wholesalePrice = new BigDecimal(numericPart); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
final String attributeList = object.getString("attributeList"); |
|
|
final String attributeList = object.getString("attributeList"); |
|
|
final JSONArray attributeListJsonArray = JSON.parseArray(attributeList); |
|
|
final JSONArray attributeListJsonArray = JSON.parseArray(attributeList); |
|
|
// 根据货号去查询商品,如果
|
|
|
// 根据货号去查询商品,如果
|
|
|
@ -264,6 +273,12 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService |
|
|
}else{ |
|
|
}else{ |
|
|
purchaseDetail.setPurchasePrice(price); |
|
|
purchaseDetail.setPurchasePrice(price); |
|
|
} |
|
|
} |
|
|
|
|
|
// ai语音入库旧商品 如果通义千问返回的价格为0,返回当前批发价 ,批发价:wholesalePrice
|
|
|
|
|
|
if (wholesalePrice.compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
|
|
purchaseDetail.setWholesalePrice(product.getWholesalePrice()); |
|
|
|
|
|
}else{ |
|
|
|
|
|
purchaseDetail.setWholesalePrice(wholesalePrice); |
|
|
|
|
|
} |
|
|
purchaseDetail.setAttrId(product.getAttrId()); |
|
|
purchaseDetail.setAttrId(product.getAttrId()); |
|
|
final List<StockLog> stockLogList = new ArrayList<>(); |
|
|
final List<StockLog> stockLogList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
@ -383,6 +398,7 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService |
|
|
purchaseDetail.setProductName(productName); |
|
|
purchaseDetail.setProductName(productName); |
|
|
purchaseDetail.setProductSn(productSn); |
|
|
purchaseDetail.setProductSn(productSn); |
|
|
purchaseDetail.setPurchasePrice(price); |
|
|
purchaseDetail.setPurchasePrice(price); |
|
|
|
|
|
purchaseDetail.setWholesalePrice(wholesalePrice); |
|
|
purchaseDetail.setProductCount(0); |
|
|
purchaseDetail.setProductCount(0); |
|
|
// 获取默认分类
|
|
|
// 获取默认分类
|
|
|
final ProductCategoryVo defaultCategory = productCategoryService.getDefaultCategory(shopId); |
|
|
final ProductCategoryVo defaultCategory = productCategoryService.getDefaultCategory(shopId); |
|
|
|