| | |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = Optional.ofNullable(seCardOperateMapper.getTransactionRecordCount(params)).orElse(0L); |
| | | |
| | | QueryResultVo rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = vo.pageSize ; |
| | | rsVo.pageCurr = vo.pageCurr ; |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | |
| | | List<VoTradeDetails> list = seCardOperateMapper.getTransactions(params); |
| | | if(list.size() == 0) { |
| | | return new HashMap(); |
| | |
| | | // 遍历交易明细记录,汇总购水金额、购卡金额 |
| | | Double totalWaterCost = 0.0; |
| | | Double totalCardCost = 0.0; |
| | | Double totalGift = 0.0; |
| | | Double totalRefund = 0.0; |
| | | |
| | | JSONArray array= JSONArray.parseArray(JSON.toJSONString(list)); |
| | | for(int i = 0; i < array.size(); i++) { |
| | | JSONObject job = array.getJSONObject(i); |
| | | Double waterCost = Optional.ofNullable(job.getDouble("waterCost")).orElse(0.0); |
| | | Double cardCost = Optional.ofNullable(job.getDouble("cardCost")).orElse(0.0); |
| | | Double gift = Optional.ofNullable(job.getDouble("gift")).orElse(0.0); |
| | | Double refundAmount = Optional.ofNullable(job.getDouble("refundAmount")).orElse(0.0); |
| | | |
| | | totalWaterCost = totalWaterCost + waterCost; |
| | | totalCardCost = totalCardCost + cardCost; |
| | | totalGift = totalGift + gift; |
| | | totalRefund = totalRefund + refundAmount; |
| | | } |
| | | |
| | | Map map_record = new HashMap(); |
| | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("waterCost", df.format(totalWaterCost)); |
| | | map_result.put("cardCost", df.format(totalCardCost)); |
| | | map_result.put("gift", df.format(totalGift)); |
| | | map_result.put("refund", df.format(totalRefund)); |
| | | |
| | | |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |