Browse Source

修复BUG

auqfypeu 5 years ago
parent
commit
330b9b5ba6

+ 7 - 2
member-services/src/main/java/com/liangjian/dataplatform/member/service/impl/PurchaseHistoryService.java

@@ -29,6 +29,10 @@ public class PurchaseHistoryService implements IPurchaseHistoryService {
     public Map<String, Object> orderList(FiltersData data) {
 
         Map<String, Object> ret = new HashMap<>();
+        List<Map<String, Object>> retList = new ArrayList<Map<String, Object>>();
+        int totalCount = 0;
+        ret.put("items",retList);
+        ret.put("totalCount",totalCount);
         int start = 0;
         String query = null;
         String condition = null;
@@ -60,7 +64,7 @@ public class PurchaseHistoryService implements IPurchaseHistoryService {
         Map<String, Object> hitsMap = (Map<String, Object>) jsonObject.get("hits");
         List<Map<String, Object>> histList = (List<Map<String, Object>>)hitsMap.get("hits");
 
-        List<Map<String, Object>> retList = new ArrayList<Map<String, Object>>();
+
 
         if(histList != null && histList.size() > 0){
             for (Map<String, Object> objectObjectMap : histList) {
@@ -81,8 +85,9 @@ public class PurchaseHistoryService implements IPurchaseHistoryService {
             JSONObject countJson = JSONObject.fromObject(count);
             JSONArray rows = countJson.getJSONArray("rows");
             List<Integer> rowsList = (List<Integer>) rows.get(0);
+            totalCount = rowsList.get(0);
             ret.put("items",retList);
-            ret.put("totalCount",rowsList.get(0));
+            ret.put("totalCount",totalCount);
         }
         return ret;
     }