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) {