| | |
| | | DecimalFormat df = new DecimalFormat("0.00"); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | |
| | | Integer pageSize = vo.getPageSize(); |
| | | Integer pageCurr = vo.getPageCurr(); |
| | | // 起始索引位置 |
| | | Integer startIndex = (pageCurr - 1) * pageSize; |
| | | |
| | | |
| | | // 接收传入参数:交易起止日期、收银员ID |
| | | JSONArray array_paymentSums = new JSONArray(); |
| | | Date timeStart = dateFormat.parse(vo.getTimeStart()); |
| | |
| | | totalRefund = totalRefund + Optional.ofNullable(job_summary.getFloat("refundAmount")).orElse(0f); |
| | | } |
| | | |
| | | Map map_record = new HashMap(); |
| | | //map_record.put("itemTotal", itemTotal); |
| | | map_record.put("list", list); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("totalCount", totalCount); |
| | | map_result.put("totalReceived", totalReceived); |
| | | map_result.put("totalGift", totalGift); |
| | | map_result.put("totalRefund", totalRefund); |
| | | |
| | | // 分页格式组装记录列表 |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", list.size()); |
| | | map_record.put("pageCurr", pageCurr); |
| | | map_record.put("pageSize", pageSize); |
| | | map_record.put("pageTotal", (int)Math.ceil((double)list.size() / pageSize)); |
| | | JSONArray array_record = (JSONArray) JSON.toJSON(list); |
| | | JSONArray array_record_page = (JSONArray)JSON.toJSON(array_record.subList(startIndex, Math.min(startIndex + pageSize, array_record.size()))); |
| | | map_record.put("list", array_record_page); |
| | | |
| | | // 分页格式组装支付方式列表 |
| | | Map map_paymentSums = new HashMap(); |
| | | map_paymentSums.put("itemTotal", array_paymentSums.size()); |
| | | map_paymentSums.put("pageCurr", pageCurr); |
| | | map_paymentSums.put("pageSize", pageSize); |
| | | map_paymentSums.put("pageTotal", (int)Math.ceil((double)array_paymentSums.size() / pageSize)); |
| | | JSONArray array_paymentSums_page = (JSONArray) JSON.toJSON(array_paymentSums.subList(startIndex, Math.min(startIndex + pageSize, array_paymentSums.size()))); |
| | | map_paymentSums.put("list", array_paymentSums_page); |
| | | |
| | | |
| | | map_result.put("records", map_record); |
| | | map_result.put("paymentSums", array_paymentSums); |
| | | map_result.put("paymentSums", map_paymentSums); |
| | | |
| | | return map_result; |
| | | } |