From 6a14754e39052da9a6a0449ef4be943c3cb54c33 Mon Sep 17 00:00:00 2001 From: lzm <17817447469@163.com> Date: Mon, 10 Oct 2022 10:52:38 +0800 Subject: [PATCH] =?UTF-8?q?v1.1:=20=E8=B4=A6=E5=8D=95=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8C=89=E5=A4=A9=E8=BF=94=E5=9B=9E=E7=A4=BC?= =?UTF-8?q?=E7=89=A9=E4=BB=B7=E5=80=BC=E6=80=BB=E9=A2=9D=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/service/record/BillRecordService.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/record/BillRecordService.java b/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/record/BillRecordService.java index 885df9348..036fbf1cd 100644 --- a/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/record/BillRecordService.java +++ b/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/record/BillRecordService.java @@ -299,7 +299,10 @@ public class BillRecordService extends ServiceImpl map.put(String.valueOf(key), voList); map.put("date",key); // 每天总计从数据库查询,考虑到前后分页还没有结束的情况 - map.put("total", getBillRecordsDailySum(uid, objTypes, key)); + Map dailySumMap = getBillRecordsDailySum(uid, objTypes, key); + map.put("total", Double.valueOf(String.valueOf(dailySumMap.get("total")))); + map.put("totalGiftGoldNumDailySum", Long.valueOf(String.valueOf(dailySumMap.get("totalGiftGoldNumDailySum")))); + result.add(map); } return result; @@ -318,7 +321,7 @@ public class BillRecordService extends ServiceImpl return list; } - private Double getBillRecordsDailySum(Long uid, List objTypes, Long date) { + private Map getBillRecordsDailySum(Long uid, List objTypes, Long date) { Date nextDate = DateTimeUtil.getNextDay(new Date(date), 1); Date start = DateUtils.addDays(nextDate, -1); QueryWrapper wrapper = new QueryWrapper<>(); @@ -328,10 +331,9 @@ public class BillRecordService extends ServiceImpl // TODO 针对活动支出记录为负号进行处理,暂时先处理 需优化 String objType = CollectionUtil.join(NEED_ABS_OBJ_TPYES, ","); wrapper.select("ifnull( sum(if(obj_type in(" + objType + ")," + - "-amount,amount)), 0 ) AS total "); + "-amount,amount)), 0 ) AS total, ifnull( sum(gift_total_gold_num), 0 ) AS totalGiftGoldNumDailySum "); // 只查询一天selectMaps返回只有一条 - Map map = billRecordMapper.selectMaps(wrapper).get(0); - return Double.valueOf(String.valueOf(map.get("total"))); + return billRecordMapper.selectMaps(wrapper).get(0); } private List convertBillRecord2SearchVo(List billRecords) {