Commit fb8b7f9169c59f54a087e43dc87e05f6d05f3a9b
1 parent
7d3ac82b
提交
Showing
1 changed file
with
76 additions
and
92 deletions
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/MonthBillManagementController.java
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | */ |
4 | 4 | package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; |
5 | 5 | |
6 | +import java.math.BigDecimal; | |
6 | 7 | import java.text.SimpleDateFormat; |
7 | 8 | import java.util.ArrayList; |
8 | 9 | import java.util.Date; |
... | ... | @@ -31,6 +32,7 @@ import com.zteits.clouds.api.apibase.bean.BizResult; |
31 | 32 | import com.zteits.clouds.api.apibase.bean.PageBean; |
32 | 33 | import com.zteits.clouds.api.apibase.constants.ErrorType; |
33 | 34 | import com.zteits.clouds.api.apibase.exception.BizException; |
35 | +import com.zteits.clouds.api.dto.clouds.dto.BillManageDTO; | |
34 | 36 | import com.zteits.clouds.api.dto.clouds.dto.BillManageDetailForMonthDTO; |
35 | 37 | import com.zteits.clouds.api.dto.clouds.dto.BillManageForMonthDTO; |
36 | 38 | import com.zteits.clouds.api.dto.clouds.dto.BillManageForMonthDetailDTO; |
... | ... | @@ -77,6 +79,79 @@ public class MonthBillManagementController extends BizController { |
77 | 79 | private SessionCommUtil sessionCommUtil; |
78 | 80 | @Value("${project.syscode}") |
79 | 81 | private String sysCode; |
82 | + | |
83 | + | |
84 | + @ApiOperation("月账汇总单查询(统计图)") | |
85 | + @RequestMapping("/queryBillforMonthTotal") | |
86 | + @ResponseBody | |
87 | + public BizResultVO<BillManageDTO> queryBillforMonthTotal(@RequestBody BillQueryRequest billQueryRequest, HttpServletRequest request, | |
88 | + HttpServletResponse response) throws Exception { | |
89 | + BizResult<BillManageDTO> result = monthBillManagementService.queryBillforMonthTotal(billQueryRequest); | |
90 | + return new BizResultVO<BillManageDTO>(result); | |
91 | + } | |
92 | + | |
93 | + @ApiOperation("月账汇总单查询") | |
94 | + @RequestMapping("/queryBillforMonthForPage") | |
95 | + @ResponseBody | |
96 | + public void queryBillforMonthForPage(@RequestBody BillQueryRequest billQueryRequest, HttpServletRequest request, | |
97 | + HttpServletResponse response) throws Exception { | |
98 | + logger.info("---begin--月账汇总单查询调用后场dubbo服务,入参={}", JSONObject.toJSON(billQueryRequest)); | |
99 | + BizResult<PageBean<BillManageDTO>> result = monthBillManagementService.queryBillforMonthTotalForPage(billQueryRequest); | |
100 | + logger.info("---end--月账汇总单查询调用后场dubbo服务,结果={}", JSONObject.toJSONString(result)); | |
101 | + this.returnJsonDataGrid(response, result); | |
102 | + } | |
103 | + | |
104 | + /** | |
105 | + * 日账单导出.<br/> | |
106 | + * | |
107 | + * @param request | |
108 | + * @param response | |
109 | + * @throws Exception | |
110 | + */ | |
111 | + @RequestMapping("/exportToExcleForBillForMonth") | |
112 | + public void exportToExcleForBillForMonth(@RequestParam String beginTime,@RequestParam String endTime,@RequestParam List<String> parkIdList, | |
113 | + HttpServletRequest request,HttpServletResponse response) throws Exception { | |
114 | + SimpleDateFormat format_yyy = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
115 | + BillQueryRequest billQueryRequest = new BillQueryRequest(); | |
116 | + billQueryRequest.setSysCode("1001"); | |
117 | + billQueryRequest.getBaseRequest().setPageSize(0); | |
118 | + billQueryRequest.setParkIdList(parkIdList); | |
119 | + billQueryRequest.setBeginTime(format_yyy.parse(beginTime)); | |
120 | + billQueryRequest.setEndTime(format_yyy.parse(endTime)); | |
121 | + BizResult<PageBean<BillManageDTO>> result = monthBillManagementService.queryBillforMonthTotalForPage(billQueryRequest); | |
122 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM"); | |
123 | + String[] title = new String[]{"时间","停车场名称","现金(元)","支付宝(元)","微信(元)","总收入(元)"}; | |
124 | + String sheetName="月账单"; | |
125 | + String fileName = "月账单"; | |
126 | + // 1.创建excel信息 | |
127 | + XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); | |
128 | + // 2.设置excel表头和表体 | |
129 | + Layouter.buildReport(workSheet,title,0, 0); | |
130 | + //3.填充数据 | |
131 | + List<Object[]> contentList=new ArrayList<Object[]>(); | |
132 | + if(result != null && !CollectionUtils.isEmpty(result.getData().getDataList())){ | |
133 | + List<BillManageDTO> list = result.getData().getDataList(); | |
134 | + for (BillManageDTO e: list) { | |
135 | + if(e != null){ | |
136 | + Object[] obj=new Object[title.length]; | |
137 | + int index=0; | |
138 | + obj[index++]=(e.getBillDayTime() != null ? format.format(e.getBillDayTime()) : ""); | |
139 | + obj[index++]=e.getParkName(); | |
140 | + obj[index++]=(e.getCashTotalFee() == null ? "0" : e.getCashTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; | |
141 | + obj[index++]=(e.getAliTotalFee() == null ? "0" : e.getAliTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; | |
142 | + obj[index++]=(e.getWxTotalFee() == null ? "0" : e.getWxTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; | |
143 | + obj[index++]=(e.getOrderTotalFee() == null ? "0" : e.getOrderTotalFee().divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP)) ; | |
144 | + contentList.add(obj); | |
145 | + } | |
146 | + } | |
147 | + } | |
148 | + ExcleFillDateManager fillUserManager=new ExcleFillDateManager(); | |
149 | + fillUserManager.fillSalesOrga(workSheet,title,contentList,2); | |
150 | + // 4.excel输出配置 | |
151 | + ExcelUtil.write(response, workSheet, fileName); | |
152 | + | |
153 | + } | |
154 | + | |
80 | 155 | |
81 | 156 | @ApiOperation("月账单查询汇总统计") |
82 | 157 | @PostMapping("/summaryStatistic") |
... | ... | @@ -333,98 +408,7 @@ public class MonthBillManagementController extends BizController { |
333 | 408 | |
334 | 409 | } |
335 | 410 | |
336 | - /** | |
337 | - * 月账单年卡月卡导出.<br/> | |
338 | - * | |
339 | - * @param request | |
340 | - * @param response | |
341 | - */ | |
342 | - @ApiOperation("月账单年卡月卡导出") | |
343 | - @GetMapping("/exportToExcleForBillForYearOrMonth") | |
344 | - public void exportToExcleForBillForYearOrMonth(@RequestParam List<String> parkIdList, | |
345 | - @RequestParam String beginTime, @RequestParam String endTime, | |
346 | - HttpServletRequest request, HttpServletResponse response) { | |
347 | - logger.info("---begin--月账单年卡月卡导出调用后场dubbo服务,入参 beginTime={},endTime={}", beginTime, endTime); | |
348 | - BizResult<PageBean<YearMonthCardStatisticDTO>> result = new BizResult<PageBean<YearMonthCardStatisticDTO>>(); | |
349 | - try { | |
350 | - YearMonthCardStatisticRequest yearMonthCardStatisticRequest = new YearMonthCardStatisticRequest(); | |
351 | - if (null == beginTime || null == endTime) { | |
352 | - throw new BizException(ErrorType.PARAMM_NULL, "开始时间和结束时间"); | |
353 | - } | |
354 | - | |
355 | - yearMonthCardStatisticRequest.setSysCode(sysCode); | |
356 | - yearMonthCardStatisticRequest.setBeginTime(DateUtil.to_date(beginTime, DateUtil.DATETIME_FORMAT)); | |
357 | - yearMonthCardStatisticRequest.setEndTime(DateUtil.to_date(endTime, DateUtil.DATETIME_FORMAT)); | |
358 | - yearMonthCardStatisticRequest.setPlNos(parkIdList); | |
359 | - yearMonthCardStatisticRequest.setBaseRequest(new BaseInfo(1, 0)); | |
360 | - /** 查询月账单年卡月卡. */ | |
361 | - result = yearMonthCardStatisticService.queryYearMonthCardStatistic(yearMonthCardStatisticRequest); | |
362 | - | |
363 | - SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); | |
364 | - String[] title = new String[] {"交易单号", "交易时间", "种类", "卡名称", "车牌号", "支付金额", "有效期"}; | |
365 | - String sheetName = "账单"; | |
366 | - String fileName = "账单管理" + format2.format(new Date()); | |
367 | - | |
368 | - // 1.创建excel信息 | |
369 | - XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); | |
370 | - // 2.设置excel表头和表体 | |
371 | - Layouter.buildReport(workSheet, title, 0, 0); | |
372 | - // 3.填充数据 | |
373 | - List<Object[]> contentList = new ArrayList<Object[]>(); | |
374 | - | |
375 | - List<YearMonthCardStatisticDTO> list = new ArrayList<YearMonthCardStatisticDTO>(); | |
376 | - | |
377 | - if (CollectionUtils.isNotEmpty(result.getData().getDataList())) { | |
378 | - list = result.getData().getDataList(); | |
379 | - } | |
380 | -// for (YearMonthCardStatisticDTO e : list) { | |
381 | -// Object[] obj = new Object[title.length]; | |
382 | -// int index = 0; | |
383 | -// obj[index++] = StringUtils.isNotEmpty(e.getOrderId()) ? e.getOrderId() : ""; | |
384 | -// obj[index++] = e.getPayFinishTime() != null | |
385 | -// ? DateUtil.getDateString(e.getPayFinishTime(), DateUtil.DATETIME_FORMAT) : ""; | |
386 | -// String yearOrMonthCard = ""; | |
387 | -// if (null != e.getOrderType()) { | |
388 | -// if (2 == e.getOrderType()) { | |
389 | -// yearOrMonthCard = "年卡"; | |
390 | -// obj[index++] = yearOrMonthCard; | |
391 | -// } else if (3 == e.getOrderType()) { | |
392 | -// yearOrMonthCard = "月卡"; | |
393 | -// obj[index++] = yearOrMonthCard; | |
394 | -// } | |
395 | -// } else { | |
396 | -// obj[index++] = ""; | |
397 | -// } | |
398 | -// obj[index++] = StringUtils.isNotEmpty(e.getParkName()) ? e.getParkName() + yearOrMonthCard : ""; | |
399 | -// | |
400 | -// obj[index++] = StringUtils.isNotEmpty(e.getCarNumber()) ? e.getCarNumber() : ""; | |
401 | -// | |
402 | -// obj[index++] = e.getAmount() != null ? AmountUtils.changeF2Y(e.getAmount().longValue()) : "0.00"; | |
403 | -// String effDate = ""; | |
404 | -// String expDate = ""; | |
405 | -// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | |
406 | -// if (null != e.getEffDate()) { | |
407 | -// effDate = format.format(e.getEffDate()); | |
408 | -// } | |
409 | -// if (null != e.getExpDate()) { | |
410 | -// expDate = format.format(e.getExpDate()); | |
411 | -// } | |
412 | -// | |
413 | -// obj[index++] = effDate + " - " + expDate; | |
414 | -// | |
415 | -// contentList.add(obj); | |
416 | -// } | |
417 | - | |
418 | - ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); | |
419 | - fillUserManager.fillSalesOrga(workSheet, title, contentList, 2); | |
420 | - // 4.excel输出配置 | |
421 | - ExcelUtil.write(response, workSheet, fileName); | |
422 | - } catch (Exception e) { | |
423 | - result.setErrorInfo(ErrorType.BIZ_ERROR, "系统错误!"); | |
424 | - e.printStackTrace(); | |
425 | - } | |
426 | - | |
427 | - } | |
411 | + | |
428 | 412 | |
429 | 413 | /** |
430 | 414 | * 月账单所有导出.<br/> | ... | ... |