From fb8b7f9169c59f54a087e43dc87e05f6d05f3a9b Mon Sep 17 00:00:00 2001 From: wangfs <15029758498@163.com> Date: Sat, 26 Aug 2017 17:33:10 +0800 Subject: [PATCH] 提交 --- src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/MonthBillManagementController.java | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------- 1 file changed, 76 insertions(+), 92 deletions(-) diff --git a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/MonthBillManagementController.java b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/MonthBillManagementController.java index d4c0d1c..19827cd 100644 --- a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/MonthBillManagementController.java +++ b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/MonthBillManagementController.java @@ -3,6 +3,7 @@ */ package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -31,6 +32,7 @@ import com.zteits.clouds.api.apibase.bean.BizResult; import com.zteits.clouds.api.apibase.bean.PageBean; import com.zteits.clouds.api.apibase.constants.ErrorType; import com.zteits.clouds.api.apibase.exception.BizException; +import com.zteits.clouds.api.dto.clouds.dto.BillManageDTO; import com.zteits.clouds.api.dto.clouds.dto.BillManageDetailForMonthDTO; import com.zteits.clouds.api.dto.clouds.dto.BillManageForMonthDTO; import com.zteits.clouds.api.dto.clouds.dto.BillManageForMonthDetailDTO; @@ -77,6 +79,79 @@ public class MonthBillManagementController extends BizController { private SessionCommUtil sessionCommUtil; @Value("${project.syscode}") private String sysCode; + + + @ApiOperation("月账汇总单查询(统计图)") + @RequestMapping("/queryBillforMonthTotal") + @ResponseBody + public BizResultVO queryBillforMonthTotal(@RequestBody BillQueryRequest billQueryRequest, HttpServletRequest request, + HttpServletResponse response) throws Exception { + BizResult result = monthBillManagementService.queryBillforMonthTotal(billQueryRequest); + return new BizResultVO(result); + } + + @ApiOperation("月账汇总单查询") + @RequestMapping("/queryBillforMonthForPage") + @ResponseBody + public void queryBillforMonthForPage(@RequestBody BillQueryRequest billQueryRequest, HttpServletRequest request, + HttpServletResponse response) throws Exception { + logger.info("---begin--月账汇总单查询调用后场dubbo服务,入参={}", JSONObject.toJSON(billQueryRequest)); + BizResult> result = monthBillManagementService.queryBillforMonthTotalForPage(billQueryRequest); + logger.info("---end--月账汇总单查询调用后场dubbo服务,结果={}", JSONObject.toJSONString(result)); + this.returnJsonDataGrid(response, result); + } + + /** + * 日账单导出.
+ * + * @param request + * @param response + * @throws Exception + */ + @RequestMapping("/exportToExcleForBillForMonth") + public void exportToExcleForBillForMonth(@RequestParam String beginTime,@RequestParam String endTime,@RequestParam List parkIdList, + HttpServletRequest request,HttpServletResponse response) throws Exception { + SimpleDateFormat format_yyy = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + BillQueryRequest billQueryRequest = new BillQueryRequest(); + billQueryRequest.setSysCode("1001"); + billQueryRequest.getBaseRequest().setPageSize(0); + billQueryRequest.setParkIdList(parkIdList); + billQueryRequest.setBeginTime(format_yyy.parse(beginTime)); + billQueryRequest.setEndTime(format_yyy.parse(endTime)); + BizResult> result = monthBillManagementService.queryBillforMonthTotalForPage(billQueryRequest); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM"); + String[] title = new String[]{"时间","停车场名称","现金(元)","支付宝(元)","微信(元)","总收入(元)"}; + String sheetName="月账单"; + String fileName = "月账单"; + // 1.创建excel信息 + XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); + // 2.设置excel表头和表体 + Layouter.buildReport(workSheet,title,0, 0); + //3.填充数据 + List contentList=new ArrayList(); + if(result != null && !CollectionUtils.isEmpty(result.getData().getDataList())){ + List list = result.getData().getDataList(); + for (BillManageDTO e: list) { + if(e != null){ + Object[] obj=new Object[title.length]; + int index=0; + obj[index++]=(e.getBillDayTime() != null ? format.format(e.getBillDayTime()) : ""); + obj[index++]=e.getParkName(); + obj[index++]=(e.getCashTotalFee() == null ? "0" : e.getCashTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; + obj[index++]=(e.getAliTotalFee() == null ? "0" : e.getAliTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; + obj[index++]=(e.getWxTotalFee() == null ? "0" : e.getWxTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; + obj[index++]=(e.getOrderTotalFee() == null ? "0" : e.getOrderTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; + contentList.add(obj); + } + } + } + ExcleFillDateManager fillUserManager=new ExcleFillDateManager(); + fillUserManager.fillSalesOrga(workSheet,title,contentList,2); + // 4.excel输出配置 + ExcelUtil.write(response, workSheet, fileName); + + } + @ApiOperation("月账单查询汇总统计") @PostMapping("/summaryStatistic") @@ -333,98 +408,7 @@ public class MonthBillManagementController extends BizController { } - /** - * 月账单年卡月卡导出.
- * - * @param request - * @param response - */ - @ApiOperation("月账单年卡月卡导出") - @GetMapping("/exportToExcleForBillForYearOrMonth") - public void exportToExcleForBillForYearOrMonth(@RequestParam List parkIdList, - @RequestParam String beginTime, @RequestParam String endTime, - HttpServletRequest request, HttpServletResponse response) { - logger.info("---begin--月账单年卡月卡导出调用后场dubbo服务,入参 beginTime={},endTime={}", beginTime, endTime); - BizResult> result = new BizResult>(); - try { - YearMonthCardStatisticRequest yearMonthCardStatisticRequest = new YearMonthCardStatisticRequest(); - if (null == beginTime || null == endTime) { - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); - } - - yearMonthCardStatisticRequest.setSysCode(sysCode); - yearMonthCardStatisticRequest.setBeginTime(DateUtil.to_date(beginTime, DateUtil.DATETIME_FORMAT)); - yearMonthCardStatisticRequest.setEndTime(DateUtil.to_date(endTime, DateUtil.DATETIME_FORMAT)); - yearMonthCardStatisticRequest.setPlNos(parkIdList); - yearMonthCardStatisticRequest.setBaseRequest(new BaseInfo(1, 0)); - /** 查询月账单年卡月卡. */ - result = yearMonthCardStatisticService.queryYearMonthCardStatistic(yearMonthCardStatisticRequest); - - SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); - String[] title = new String[] {"交易单号", "交易时间", "种类", "卡名称", "车牌号", "支付金额", "有效期"}; - String sheetName = "账单"; - String fileName = "账单管理" + format2.format(new Date()); - - // 1.创建excel信息 - XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); - // 2.设置excel表头和表体 - Layouter.buildReport(workSheet, title, 0, 0); - // 3.填充数据 - List contentList = new ArrayList(); - - List list = new ArrayList(); - - if (CollectionUtils.isNotEmpty(result.getData().getDataList())) { - list = result.getData().getDataList(); - } -// for (YearMonthCardStatisticDTO e : list) { -// Object[] obj = new Object[title.length]; -// int index = 0; -// obj[index++] = StringUtils.isNotEmpty(e.getOrderId()) ? e.getOrderId() : ""; -// obj[index++] = e.getPayFinishTime() != null -// ? DateUtil.getDateString(e.getPayFinishTime(), DateUtil.DATETIME_FORMAT) : ""; -// String yearOrMonthCard = ""; -// if (null != e.getOrderType()) { -// if (2 == e.getOrderType()) { -// yearOrMonthCard = "年卡"; -// obj[index++] = yearOrMonthCard; -// } else if (3 == e.getOrderType()) { -// yearOrMonthCard = "月卡"; -// obj[index++] = yearOrMonthCard; -// } -// } else { -// obj[index++] = ""; -// } -// obj[index++] = StringUtils.isNotEmpty(e.getParkName()) ? e.getParkName() + yearOrMonthCard : ""; -// -// obj[index++] = StringUtils.isNotEmpty(e.getCarNumber()) ? e.getCarNumber() : ""; -// -// obj[index++] = e.getAmount() != null ? AmountUtils.changeF2Y(e.getAmount().longValue()) : "0.00"; -// String effDate = ""; -// String expDate = ""; -// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); -// if (null != e.getEffDate()) { -// effDate = format.format(e.getEffDate()); -// } -// if (null != e.getExpDate()) { -// expDate = format.format(e.getExpDate()); -// } -// -// obj[index++] = effDate + " - " + expDate; -// -// contentList.add(obj); -// } - - ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); - fillUserManager.fillSalesOrga(workSheet, title, contentList, 2); - // 4.excel输出配置 - ExcelUtil.write(response, workSheet, fileName); - } catch (Exception e) { - result.setErrorInfo(ErrorType.BIZ_ERROR, "系统错误!"); - e.printStackTrace(); - } - - } + /** * 月账单所有导出.
-- libgit2 0.21.4