final AVQuery startDateQuery = new AVQuery<>("xiaoshou");
startDateQuery.whereGreaterThanOrEqualTo("createdAt", startDate);

                        final AVQuery<AVObject> endDateQuery = new AVQuery<>("xiaoshou");
                        endDateQuery.whereLessThan("createdAt", endDate);
                        final AVQuery<AVObject> query = AVQuery.and(Arrays.asList(startDateQuery, endDateQuery));
                        query.countInBackground(new CountCallback() {
                            @Override
                            public void done(int i, AVException e) {
                                sum = i;
                                count = 0;
                                try {
                                    final int limitUnit = 100;
                                    for (j = 0; j < i / limitUnit + 1; j++) {
                                        query.limit(limitUnit);
                                        query.skip(limitUnit * j);
                                        query.findInBackground(new FindCallback<AVObject>() {
                                            @Override
                                            public void done(List<AVObject> list, AVException e) {
                                                for (AVObject avObject : list) {
                                                    Log.i("KCB", avObject.toString());
                                                    **AVObject tempProduct = avObject.getAVObject("product");**
                                                    Log.i("KCB", tempProduct.toString());
                                                    Double temp_purchase_price = tempProduct.getDouble("purchase_price");
                                                    Double temp_sale_price = avObject.getDouble("sale_price");
                                                    int temp_num = avObject.getInt("num");
                                                    Double temp_lirun = (temp_sale_price - temp_purchase_price) * temp_num;
                                                    saleMoney += temp_sale_price * temp_num;
                                                    lirunMoney += temp_lirun;
                                                    String[] content = {
                                                            tempProduct.getString("product_name"),
                                                            String.valueOf(avObject.getString("bar_code")),
                                                            avObject.getString("product_unit"),
                                                            String.valueOf(temp_purchase_price),
                                                            String.valueOf(temp_sale_price),
                                                            String.valueOf(temp_num),
                                                            String.valueOf(temp_lirun),
                                                            String.valueOf(avObject.getString("saler"))
                                                    };
                                                    kucunList.add(content);
                                                    count = count + 1;
                                                    if (count.equals(sum)) {
                                                        try {
                                                            WritableWorkbook book = Workbook.createWorkbook(new File(yejiFileName));
                                                            WritableSheet sheet1 = book.createSheet("业绩清单", 0);
                                                            String[] title = {"产品名称", "条形码", "单位", "进价", "售价", "数量", "利润", "售货员"};
                                                            for (int m = 0; m < title.length; m++) {
                                                                Label lable = new Label(m, 0, title[m]);
                                                                sheet1.addCell(lable);
                                                            }
                                                            Integer temp_row_num = 0;
                                                            for (String[] temp_row : kucunList){
                                                                temp_row_num += 1;
                                                                for (int o = 0; o < title.length; o++) {
                                                                    Label lable = new Label(o, temp_row_num, temp_row[o]);
                                                                    sheet1.addCell(lable);
                                                                }
                                                            }
                                                            book.write();
                                                            book.close();
                                                            Toast.makeText(YejiActiviti.this, "结果路径:"+yejiFileName, Toast.LENGTH_LONG).show();
                                                            lirunResultText.setText("销售额: " + saleMoney + "  利润: " + lirunMoney);
                                                        }catch (Exception eee){
                                                            eee.printStackTrace();
                                                        }
                                                    }
                                                }
                                            }
                                        });
                                    }
                                }catch (Exception ee){
                                    ee.printStackTrace();
                                }
                            }
                        });

你好,
请先确定查询条件无误:上面的 startDate 和 endDate 是什么类型的,怎么赋值的?

再确定下 findInBackground返回的 list 集合是否有值。

感谢回复。刚刚找到原因了。 是由于没有include pointer属性导致的。