From 13455ffd89ad64f4944f4d05aad76ec9db6ae3b7 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Mon, 30 Sep 2024 10:46:14 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 1 + hiver-admin/test-output/test-report.html | 14 +++---- .../hiver/mall/controller/SaleController.java | 4 +- .../debt/service/impl/DebtServiceImpl.java | 7 +++- .../cc/hiver/mall/entity/PurchaseDetail.java | 5 +++ .../main/java/cc/hiver/mall/entity/Share.java | 3 ++ .../PurchaseOcrPictureController.java | 4 +- .../service/PurchaseOcrPictureService.java | 2 +- .../impl/PurchaseOcrPictureServiceImpl.java | 41 +++++++++++++++---- .../mall/service/mybatis/SaleService.java | 3 +- .../mybatis/ProductServiceImpl.java | 6 +-- .../serviceimpl/mybatis/SaleServiceImpl.java | 32 ++++++++------- .../java/cc/hiver/mall/utils/AliOcrUtil.java | 6 +-- .../main/resources/mapper/ProductMapper.xml | 6 +++ .../src/main/resources/mapper/SaleMapper.xml | 2 +- 15 files changed, 91 insertions(+), 45 deletions(-) diff --git a/hiver-admin/src/main/resources/application.yml b/hiver-admin/src/main/resources/application.yml index 190a95e2..9067e9be 100644 --- a/hiver-admin/src/main/resources/application.yml +++ b/hiver-admin/src/main/resources/application.yml @@ -341,6 +341,7 @@ ignored: - /hiver/app/productCategory/listByShopId # 获取微信二维码 - /hiver/order/ow/getWechatQrcode + - /app/shop/getShopInfoById # 临时增加 - /hiver/app/logisticsOrder/addLogisticsOrder diff --git a/hiver-admin/test-output/test-report.html b/hiver-admin/test-output/test-report.html index 9d63c7b5..7c187d44 100644 --- a/hiver-admin/test-output/test-report.html +++ b/hiver-admin/test-output/test-report.html @@ -35,7 +35,7 @@ Hiver
  • - 27, 2024 09:25:36 + 30, 2024 00:39:10
  • @@ -84,7 +84,7 @@

    passTest

    -

    09:25:36 / 0.016 secs

    +

    00:39:10 / 0.016 secs

    @@ -92,8 +92,8 @@
    #test-id=1
    passTest
    -09.27.2024 09:25:36 -09.27.2024 09:25:36 +09.30.2024 00:39:10 +09.30.2024 00:39:10 0.016 secs
    @@ -104,7 +104,7 @@ Pass - 9:25:36 + 0:39:10 Test passed @@ -128,13 +128,13 @@

    Started

    -

    27, 2024 09:25:36

    +

    30, 2024 00:39:10

    Ended

    -

    27, 2024 09:25:36

    +

    30, 2024 00:39:10

    diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java index 263de6aa..eeef9330 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java @@ -1171,12 +1171,12 @@ public class SaleController { @RequestMapping(value = "/buyAi", method = RequestMethod.POST) @ApiOperation("同步步Ai开单") - public Result buyAi(String aiMsg, String customerId) { + public Result buyAi(String aiMsg, String customerId,String productId) { if (StringUtils.isEmpty(aiMsg)) { ResultUtil.error("指令不能为空!"); } + JSONObject jsonObject = saleService.buyAi(aiMsg, customerId, productId); - final JSONObject jsonObject = saleService.buyAi(aiMsg, customerId); return new ResultUtil().setData(jsonObject); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/impl/DebtServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/impl/DebtServiceImpl.java index 9bafd130..ed92a01d 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/impl/DebtServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/impl/DebtServiceImpl.java @@ -295,8 +295,11 @@ public class DebtServiceImpl extends ServiceImpl implements De if(debt != null){ // 获取客户信息 final Customer customer = customerService.getById(userId); - debt.setCategoryId(customer.getCategoryId()); - debt.setCategoryName(customer.getCategoryName()); + // 可能传供应商的id,查不到,就不放了。 + if(customer != null){ + debt.setCategoryId(customer.getCategoryId()); + debt.setCategoryName(customer.getCategoryName()); + } } return debt == null ? new Debt() : debt; } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/PurchaseDetail.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/PurchaseDetail.java index c6c16248..e01ed87b 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/PurchaseDetail.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/PurchaseDetail.java @@ -117,5 +117,10 @@ public class PurchaseDetail extends HiverBaseEntity { @ApiModelProperty(value = "客户分类价格规则") private String customerCategoryRule; + @Transient + @TableField(exist = false) + @ApiModelProperty(value = "客户购买次数") + private Integer buyCount; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Share.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Share.java index 805ea58a..cef9280c 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Share.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Share.java @@ -85,4 +85,7 @@ public class Share extends HiverBaseEntity { @ApiModelProperty(value = "价格类型:0:零售价;1:批发价") private String priceType; + @ApiModelProperty(value = "微信小程序码参数") + private String scene; + } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/controller/PurchaseOcrPictureController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/controller/PurchaseOcrPictureController.java index 794e1fdc..10516b96 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/controller/PurchaseOcrPictureController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/controller/PurchaseOcrPictureController.java @@ -49,8 +49,8 @@ public class PurchaseOcrPictureController { */ @RequestMapping(value = "/callWithMessageOfPurchase", method = RequestMethod.POST) @ApiOperation("AI语音入库") - public Result callWithMessageOfPurchase(String questionMsg) throws NoApiKeyException, InputRequiredException { - final JSONObject jsonObject = purchaseOcrPictureService.callWithMessageOfPurchase(questionMsg); + public Result callWithMessageOfPurchase(String questionMsg, String customerId, String productId) throws NoApiKeyException, InputRequiredException { + final JSONObject jsonObject = purchaseOcrPictureService.callWithMessageOfPurchase(questionMsg, customerId, productId); return new ResultUtil().setData(jsonObject); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/PurchaseOcrPictureService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/PurchaseOcrPictureService.java index 2917a4a2..5f01bb77 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/PurchaseOcrPictureService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/PurchaseOcrPictureService.java @@ -24,7 +24,7 @@ public interface PurchaseOcrPictureService { List getOcrCount(); - JSONObject callWithMessageOfPurchase(String questionMsg) throws NoApiKeyException, InputRequiredException; + JSONObject callWithMessageOfPurchase(String questionMsg, String customerId, String productId) throws NoApiKeyException, InputRequiredException; JSONObject getCustomInfoOfAi(String questionMsg); diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java index edfd5056..55a950ce 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java @@ -7,10 +7,7 @@ import cc.hiver.mall.common.constant.PurchaseConstant; import cc.hiver.mall.config.thread.AiPurchaseThread; import cc.hiver.mall.config.thread.ThreadPoolConfiguration; import cc.hiver.mall.entity.*; -import cc.hiver.mall.pojo.vo.ProductAttributeOfAddVo; -import cc.hiver.mall.pojo.vo.ProductAttributeValueVo; -import cc.hiver.mall.pojo.vo.ProductCategoryVo; -import cc.hiver.mall.pojo.vo.PurchaseVo; +import cc.hiver.mall.pojo.vo.*; import cc.hiver.mall.purchaseocr.entity.PurchaseOcrPicture; import cc.hiver.mall.purchaseocr.mapper.PurchaseOcrPictureMapper; import cc.hiver.mall.purchaseocr.service.PurchaseOcrPictureService; @@ -77,6 +74,9 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService @Autowired private ProductCategoryService productCategoryService; + @Autowired + private SaleService saleService; + @Override public JSONObject batchSave(PurchaseOciPictureAddVo purchaseOciPictureAddVo) { @@ -180,7 +180,7 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService } @Override - public JSONObject callWithMessageOfPurchase(String questionMsg) throws NoApiKeyException, InputRequiredException { + public JSONObject callWithMessageOfPurchase(String questionMsg, String customerId, String singleProductId) throws NoApiKeyException, InputRequiredException { final JSONObject returnJsonObject = new JSONObject(); final StopWatch stopWatch = new StopWatch("Ai入库计时:"); @@ -210,7 +210,8 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService final JSONObject jsonObject = AliOcrUtil.callWithMessageOfPurchase(saleAiMsg.getAiMsg()); final String resultContent = jsonObject.get("resultContent").toString(); final JSONArray json = JSON.parseArray(resultContent); - + // 旧商品的id集合 + List oldProductIdList = new ArrayList<>(); for (int i = 0; i < json.size(); i++) { final JSONObject object = json.getJSONObject(i); String productSn = object.getString("productSn"); @@ -242,10 +243,18 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService final JSONArray attributeListJsonArray = JSON.parseArray(attributeList); // 根据货号去查询商品,如果 final List byProductSn = productService.getByProductSn(productSn, shopId,""); - if (byProductSn != null && !byProductSn.isEmpty()) { + if (StringUtils.isNotEmpty(singleProductId) || (byProductSn != null && !byProductSn.isEmpty())) { // 原则上一个店铺一个货号对应一个商品,这里如果查到了,直接拿第一个。 - final Product product = byProductSn.get(0); - final String productId = product.getId(); + Product product = new Product(); + if(!byProductSn.isEmpty()){ + product = byProductSn.get(0); + } + if(StringUtils.isNotEmpty(singleProductId)){ + // 20240928 app/sale/buyAi接口加个参数productId,如果传值了,查规格库存数的时候就查这款商品的 + product = productService.getById(singleProductId); + } + String productId = product.getId(); + oldProductIdList.add(productId); // 查询商品所有的库存 final List stockList = stockService.getProductStock(productId); final Map stockMap = new HashMap<>(); @@ -385,6 +394,19 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService stockLogList.add(stockLog); } + // 如果客户id不为空,那么就查询商品的购买记录 + if(StringUtils.isNotEmpty(customerId)){ + // 获取客户的购买次数 + final List buyCount = saleService.buyCount(customerId,oldProductIdList); + // 封装为Map + final Map buyCountMap = new HashMap<>(); + for (BuyCountVo buyCountVo : buyCount) { + buyCountMap.put(buyCountVo.getProductId(), buyCountVo.getBuyCount()); + } + // 回填数据 + final String thisProductId = purchaseDetail.getProductId(); + purchaseDetail.setBuyCount(buyCountMap.getOrDefault(thisProductId, 0)); + } // 判断是否存在改货号,如果不存在,新增,存在,则追加stockLogList if (purchaseDetailMap.containsKey(productSn)) { final PurchaseDetail addPurchaseDetail = purchaseDetailMap.get(productSn); @@ -450,6 +472,7 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService } } } + } catch (NoApiKeyException e) { throw new RuntimeException(e); } catch (InputRequiredException e) { diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleService.java index 7b04fef4..6098510d 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleService.java @@ -57,7 +57,7 @@ public interface SaleService extends IService { void buyAiSync(String aiMsg, String saleId); - JSONObject buyAi(String aiMsg, String customerId); + JSONObject buyAi(String aiMsg, String customerId,String singleProductId); void updateAiFlag(String id, Integer status); @@ -158,4 +158,5 @@ public interface SaleService extends IService { * @date 2024/9/26 */ List buyCount(String customerId, List productIdList); + } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductServiceImpl.java index 39a2735d..2bceae5c 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductServiceImpl.java @@ -155,7 +155,7 @@ public class ProductServiceImpl extends ServiceImpl impl public CopyOnWriteArrayList getByProductSn(String productSn, String shopId, String customerId) { final CopyOnWriteArrayList byProductSn = baseMapper.getByProductSn(productSn, shopId); // 如果客户id不为空,查询客户的购买次数 - if (StringUtils.isNotEmpty(customerId)) { + if (StringUtils.isNotEmpty(customerId) && !byProductSn.isEmpty()) { // 理论上来说一个货号在一个店铺中只会查询到一个商品信息 final List productIdList = new ArrayList<>(); @@ -186,7 +186,7 @@ public class ProductServiceImpl extends ServiceImpl impl public Product getByIdOrBrcode(String id, String customerId) { final Product byIdOrBrcode = baseMapper.getByIdOrBrcode(id); // 如果客户id不为空,查询客户的购买次数 - if (StringUtils.isNotEmpty(customerId)) { + if (StringUtils.isNotEmpty(customerId) && byIdOrBrcode != null) { final List productIdList = new ArrayList<>(); productIdList.add(byIdOrBrcode.getId()); final List buyCount = saleService.buyCount(customerId, productIdList); @@ -440,7 +440,7 @@ public class ProductServiceImpl extends ServiceImpl impl } sizeStr.append('"' + value + '"'); // 判断该商品是否已包含该尺码,不包含,则需要新增 - if (!colorList.contains(value)) { + if (!sizeList.contains(value)) { final ProductAttributeValue productAttributeValue = new ProductAttributeValue(); final String attributeId = productAttributeOfAddVoMap.get("尺码").getAttributeId(); productAttributeValue.setAttributeId(attributeId); diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java index 84206150..2abe582e 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java @@ -174,7 +174,6 @@ public class SaleServiceImpl extends ServiceImpl implements Sa } final Page saleList = saleMapper.queryPage(page, saleVO); // 获取订单详情信息 - List productIdList = new ArrayList<>(); for (Sale sale : saleList.getRecords()) { final QueryWrapper querySaleDetailWrapper = new QueryWrapper<>(); querySaleDetailWrapper.select("product_id") @@ -182,7 +181,6 @@ public class SaleServiceImpl extends ServiceImpl implements Sa .groupBy("product_id"); final List list = saleDetailService.selectByCondition1(querySaleDetailWrapper); if (!list.isEmpty()) { - productIdList.addAll(list); final List saleDetailDTOS = new ArrayList<>(); final Map productMap = new HashMap<>(); // 获取商品信息 @@ -247,22 +245,18 @@ public class SaleServiceImpl extends ServiceImpl implements Sa } sale.setSaleDetailDTOList(saleDetailDTOS); } - } - // 如果客户id不为空,查询客户的购买次数 - if (StringUtils.isNotEmpty(saleVO.getCustomerId())) { - final List buyCount = saleService.buyCount(saleVO.getCustomerId(), productIdList); + final List buyCount = saleService.buyCount(sale.getUserId(), list); // 封装为Map final Map buyCountMap = new HashMap<>(); for (BuyCountVo buyCountVo : buyCount) { buyCountMap.put(buyCountVo.getProductId(), buyCountVo.getBuyCount()); } - for (Sale saleListRecord : saleList.getRecords()) { - for (SaleDetailDTO saleDetailDTO : saleListRecord.getSaleDetailDTOList()) { - String productId = saleDetailDTO.getProductId(); - saleDetailDTO.setBuyCount(buyCountMap.getOrDefault(productId, 0)); - } + for (SaleDetailDTO saleDetailDTO : sale.getSaleDetailDTOList()) { + String productId = saleDetailDTO.getProductId(); + saleDetailDTO.setBuyCount(buyCountMap.getOrDefault(productId, 0)); } } + return saleList; } @@ -659,7 +653,7 @@ public class SaleServiceImpl extends ServiceImpl implements Sa } @Override - public JSONObject buyAi(String aiMsg, String customerId) { + public JSONObject buyAi(String aiMsg, String customerId,String singleProductId) { final JSONObject returnJsonObject = new JSONObject(); // 叉转X 文本纠错 使用正则表达式替换单个或多个连续的“叉”字符 aiMsg = replaceAllX(aiMsg); @@ -694,9 +688,16 @@ public class SaleServiceImpl extends ServiceImpl implements Sa final Map purchaseDetailMap = new HashMap<>(); // 根据货号去查询商品,如果 final List byProductSn = productService.getByProductSn(productSn, shopId,""); - if (byProductSn != null && !byProductSn.isEmpty()) { + if (StringUtils.isNotEmpty(singleProductId) || (byProductSn != null && !byProductSn.isEmpty())) { // 原则上一个店铺一个货号对应一个商品,这里如果查到了,直接拿第一个。 - final Product product = byProductSn.get(0); + Product product = new Product(); + if(!byProductSn.isEmpty()){ + product = byProductSn.get(0); + } + if(StringUtils.isNotEmpty(singleProductId)){ + // 20240928 app/sale/buyAi接口加个参数productId,如果传值了,查规格库存数的时候就查这款商品的 + product = productService.getById(singleProductId); + } final String productId = product.getId(); oldProductIdList.add(productId); // 查询商品所有的库存 @@ -1308,6 +1309,9 @@ public class SaleServiceImpl extends ServiceImpl implements Sa */ @Override public List buyCount(String customerId, List productIdList) { + if(StringUtils.isEmpty(customerId) || productIdList.isEmpty()){ + return new ArrayList<>(); + } return saleMapper.buyCount(customerId,productIdList); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java index ba81f4cf..33acbac2 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java @@ -842,7 +842,7 @@ public class AliOcrUtil { "2.如果识别到多种颜色,按不同颜色拆分返回。如果没有识别到\"color\"的内容,则\"color\"赋值“均色”。如果没有识别到\"size\"的内容,则\"size\"赋值“均码”,返回1条JSON数据即可。\n" + "3.如果指令内容中有\"SYYS色\"则\"color\"字段返回“SYYS色”即可,如果指令内容中有\"SYCM码\"则\"size\"字段返回“SYCM码”即可,没有则忽略。\n" + "4.如果指令中有“各N件”,则每个尺码数量返回N。\n" + - "5.如果指令中尺码是?码到?码,请完整返回跨度内所有尺码JSON。\n" + + "5.如果指令中尺码是?码到?码,请完整返回跨度内所有尺码JSON、不要省略中间的尺码。(常见的尺码顺序:S码-M码-L码-XL码-2XL码-3XL码-4XL码-5XL码-6XL码-7XL码......)。\n" + "6.如果没有识别到\"wholesalePrice\"的内容,则\"wholesalePrice\"赋值\"0\"。\n" + "7.只输出JSON数据即可,禁止返回除JSON数据外的任何内容!" + "8.返回的JSON数据不用换行,以最快的速度返回!"; @@ -896,7 +896,7 @@ public class AliOcrUtil { "3.如果没有识别到\"productName\"的内容,则\"productName\"使用\"productSn\"的值填充。\n" + "4.如果识别到多种颜色,按不同颜色拆分返回。如果没有识别到\"color\"的内容,则\"color\"赋值“均色”,如果没有识别到\"size\"的内容,则\"size\"赋值“均码”,返回一条JSON数据即可。\n" + "5.如果指令中有“各N件”,则每个尺码数量返回N。\n" + - "6.如果指令中尺码是?码到?码,请结合服装鞋帽尺码规则完整返回跨度内所有尺码JSON。\n" + + "6.如果指令中尺码是?码到?码,请完整返回跨度内所有尺码JSON、不要省略中间的尺码。(常见的尺码顺序:S码-M码-L码-XL码-2XL码-3XL码-4XL码-5XL码-6XL码-7XL码......)。\n" + "7.返回的JSON数据不用换行,以最快的速度返回!\n" + "8.只输出JSON数据即可,禁止返回除JSON数据外的任何内容!"; final Message userMsg = Message.builder().role(Role.USER.getValue()).content(questionMsg).build(); @@ -938,7 +938,7 @@ public class AliOcrUtil { "2.如果没有识别到\"color\"的内容,则\"color\"赋值“均色”。如果没有识别到\"size\"的内容,则\"size\"赋值“均码”,返回1条JSON数据即可。\n" + "3.如果指令内容中有\"SYYS色\"则\"color\"字段返回“SYYS色”即可,如果指令内容中有\"SYCM码\"则\"size\"字段返回“SYCM码”即可,没有则忽略。\n" + "4.如果指令中有“各N件”,则每个尺码数量返回N。\n" + - "5.如果指令中尺码是?码到?码,请完整返回跨度内所有尺码JSON。\n" + + "5.如果指令中尺码是?码到?码,请完整返回跨度内所有尺码JSON、不要省略中间的尺码。(常见的尺码顺序:S码-M码-L码-XL码-2XL码-3XL码-4XL码-5XL码-6XL码-7XL码......)。\n" + "6.只输出JSON数据即可,禁止返回除JSON数据外的任何内容!"; final Message userMsg = Message.builder().role(Role.USER.getValue()).content(questionMsg).build(); msgManager.add(systemMsg); diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml index c6d0a034..ca6a40e3 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml @@ -575,6 +575,7 @@ t.tail_warn, t.in_storage_status, t.customer_category_rule, + COALESCE(ss.total_stock_count, 0) AS total_stock_count, COALESCE(ss.stock_count, 0) AS stock_count, COALESCE(ss.minus_stock_count, 0) AS minus_stock_count @@ -583,6 +584,7 @@ FROM t_product t LEFT JOIN ( SELECT + sum( s.stock_count ) AS total_stock_count, sum( CASE WHEN s.stock_count < 0 THEN 0 ELSE s.stock_count END ) AS stock_count, sum( CASE WHEN s.stock_count > 0 THEN 0 ELSE s.stock_count END ) AS minus_stock_count, shop_id, @@ -663,6 +665,10 @@ sd.total_sold desc, + + + total_stock_count #{queryParams.order} , + t.in_storage_status asc, t.del_flag desc,t.create_time desc, id diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml index 5e3aab56..5c471f0d 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml @@ -1378,7 +1378,7 @@ GROUP BY WHERE ts.user_id = #{customerId} and status = '4' - AND tsd.product_id + AND tsd.product_id in #{item}