From 6cc97918a5a42e37a3c3867cc5b78a0b9fd43a24 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 29 四月 2022 19:55:41 +0800
Subject: [PATCH] 功能完善

---
 app/src/main/java/com/yeshi/makemoney/app/service/impl/goldcorn/GoldCornGetRecordServiceImpl.java |   39 +++++++++++++++++++++------------------
 1 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/app/src/main/java/com/yeshi/makemoney/app/service/impl/goldcorn/GoldCornGetRecordServiceImpl.java b/app/src/main/java/com/yeshi/makemoney/app/service/impl/goldcorn/GoldCornGetRecordServiceImpl.java
index 4c1770e..93549c9 100644
--- a/app/src/main/java/com/yeshi/makemoney/app/service/impl/goldcorn/GoldCornGetRecordServiceImpl.java
+++ b/app/src/main/java/com/yeshi/makemoney/app/service/impl/goldcorn/GoldCornGetRecordServiceImpl.java
@@ -27,17 +27,21 @@
     @Resource
     private GoldCornGetRecordDao goldCornGetRecordDao;
 
-    @Override
-    public List<GoldCornGetRecord> list(GoldCornGetRecordQuery goldCornGetRecordQuery, int page, int pageSize) {
+    private DaoQuery createDaoQuery(GoldCornGetRecordQuery goldCornGetRecordQuery) {
         DaoQuery daoQuery = new DaoQuery();
         daoQuery.type = goldCornGetRecordQuery.getType();
         daoQuery.uid = goldCornGetRecordQuery.getUid();
-        daoQuery.day=goldCornGetRecordQuery.getDay();
-        daoQuery.dayList=goldCornGetRecordQuery.getDayList();
-
-
+        daoQuery.day = goldCornGetRecordQuery.getDay();
+        daoQuery.doubles = goldCornGetRecordQuery.getDoubles();
+        daoQuery.dayList = goldCornGetRecordQuery.getDayList();
         daoQuery.minCreateTime = goldCornGetRecordQuery.toStartTime();
         daoQuery.maxCreateTime = goldCornGetRecordQuery.toEndTime();
+        return daoQuery;
+    }
+
+    @Override
+    public List<GoldCornGetRecord> list(GoldCornGetRecordQuery goldCornGetRecordQuery, int page, int pageSize) {
+        DaoQuery daoQuery = createDaoQuery(goldCornGetRecordQuery);
 
         daoQuery.start = (page - 1) * pageSize;
         daoQuery.count = pageSize;
@@ -47,13 +51,7 @@
 
     @Override
     public long count(GoldCornGetRecordQuery goldCornGetRecordQuery) {
-        DaoQuery daoQuery = new DaoQuery();
-        daoQuery.type = goldCornGetRecordQuery.getType();
-        daoQuery.uid = goldCornGetRecordQuery.getUid();
-        daoQuery.day=goldCornGetRecordQuery.getDay();
-        daoQuery.dayList=goldCornGetRecordQuery.getDayList();
-        daoQuery.minCreateTime = goldCornGetRecordQuery.toStartTime();
-        daoQuery.maxCreateTime = goldCornGetRecordQuery.toEndTime();
+        DaoQuery daoQuery = createDaoQuery(goldCornGetRecordQuery);
         return goldCornGetRecordDao.count(daoQuery);
     }
 
@@ -166,7 +164,7 @@
         Map<Long, Integer> map = new HashMap<>();
         if (mapList != null) {
             for (Map m : mapList) {
-                map.put((long) m.get("fromUid"), (int) m.get("cornNum"));
+                map.put((long) m.get("_id"), (int) m.get("cornNum"));
             }
         }
         return map;
@@ -181,13 +179,13 @@
         //鏈�澶ч檺鍒朵负365澶�
         list.add(Aggregation.limit(365));
         list.add(Aggregation.project("day"));
-        AggregationResults<Map<String,String>> results = goldCornGetRecordDao.aggregate(list, Map.class);
-        List<Map<String,String>> resultList = results.getMappedResults();
+        AggregationResults<Map<String, String>> results = goldCornGetRecordDao.aggregate(list, Map.class);
+        List<Map<String, String>> resultList = results.getMappedResults();
         //鑾峰彇杩炵画鐨勫ぉ鏁�
-        String format="yyyy-MM-dd";
+        String format = "yyyy-MM-dd";
         Date lastDay = new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(deadDate.getTime(), format), format));
         int continueDay = 0;
-        for (Map<String,String> day : resultList) {
+        for (Map<String, String> day : resultList) {
             Long timestamp = TimeUtil.convertToTimeTemp(day.get("_id"), format);
             long cha = lastDay.getTime() - timestamp;
             if (cha <= 1000 * 60 * 60 * 24L) {
@@ -200,5 +198,10 @@
         return continueDay;
     }
 
+    @Override
+    public Map<GoldCornGetType, Long> sumEventCount(GoldCornGetRecordQuery goldCornGetRecordQuery) {
+        return goldCornGetRecordDao.sumEventCount(createDaoQuery(goldCornGetRecordQuery));
+    }
+
 
 }
\ No newline at end of file

--
Gitblit v1.8.0