puzhibing
2024-08-23 b394788e74cd40bcffda59574ad566553a3919ea
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java
@@ -83,8 +83,8 @@
     * @param goodsIds  订单号-商品类型
     * @return
     */
    @PostMapping("/getSalesCountByGoodsIds")
    public R<List<Integer>> getSalesCountByGoodsId(String goodsIds){
    @GetMapping("/getSalesCountByGoodsIds/{goodsIds}")
    public R<List<Integer>> getSalesCountByGoodsId(@PathVariable("goodsIds")String goodsIds){
        String[] split = goodsIds.split("-");
        // 取出最后一位字符 类型1查询现金购买 类型2查询积分兑换
        String s = split[split.length - 1];
@@ -93,6 +93,7 @@
            case 1:
                for (int i = 0; i < split.length-1; i++) {
                    Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>()
                                    .eq("order_type",1)
                                    .eq("goods_id", split[i])
                                    .eq("payment_status", 2)
                                    .ne("refund_status", 2))
@@ -103,6 +104,8 @@
            case 2:
                for (int i = 0; i < split.length-1; i++) {
                    Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>()
                                            .eq("order_type",1)
                                    .ne("status",4)
                                    .eq("goods_id", split[i])
                                    )
                            .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum);
@@ -117,8 +120,8 @@
     * @param goodsIds  订单号-商品类型
     * @return
     */
    @PostMapping("/getCodeByOrderId")
    public R<List<String>> getCodeByOrderId(String goodsIds){
    @GetMapping("/getCodeByOrderId/{goodsIds}")
    public R<List<String>> getCodeByOrderId(@PathVariable("goodsIds") String goodsIds){
        String[] split = goodsIds.split("-");
        List<String> strings = new ArrayList<>();
        for (String s : split) {
@@ -183,7 +186,7 @@
        tExchangeOrder.setCreateTime(LocalDateTime.now());
        tExchangeOrder.setDelFlag(false);
        exchangeOrderService.save(tExchangeOrder);
        return R.ok();
        return R.ok(tExchangeOrder.getId());
    }