Commit 2a4a238ff59b33c535ed046513204dd61a9323ca
Merge branch 'branch_0808' of http://192.168.1.195:9998/ZTEITS-Developers/zteits…
…-bcp-portal.git into branch_0808
Showing
2 changed files
with
615 additions
and
128 deletions
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/MonthBillManagementController.java
@@ -6,12 +6,12 @@ package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; | @@ -6,12 +6,12 @@ package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; | ||
6 | import java.math.BigDecimal; | 6 | import java.math.BigDecimal; |
7 | import java.text.SimpleDateFormat; | 7 | import java.text.SimpleDateFormat; |
8 | import java.util.ArrayList; | 8 | import java.util.ArrayList; |
9 | +import java.util.Arrays; | ||
9 | import java.util.Date; | 10 | import java.util.Date; |
10 | import java.util.List; | 11 | import java.util.List; |
11 | 12 | ||
12 | import javax.servlet.http.HttpServletRequest; | 13 | import javax.servlet.http.HttpServletRequest; |
13 | import javax.servlet.http.HttpServletResponse; | 14 | import javax.servlet.http.HttpServletResponse; |
14 | -import javax.servlet.http.HttpSession; | ||
15 | 15 | ||
16 | import com.alibaba.dubbo.common.utils.CollectionUtils; | 16 | import com.alibaba.dubbo.common.utils.CollectionUtils; |
17 | import com.alibaba.dubbo.common.utils.StringUtils; | 17 | import com.alibaba.dubbo.common.utils.StringUtils; |
@@ -39,13 +39,12 @@ import com.zteits.clouds.api.dto.clouds.dto.BillManageForMonthDetailDTO; | @@ -39,13 +39,12 @@ import com.zteits.clouds.api.dto.clouds.dto.BillManageForMonthDetailDTO; | ||
39 | import com.zteits.clouds.api.dto.clouds.dto.MonthBillMngtStatisticByParkinglotDTO; | 39 | import com.zteits.clouds.api.dto.clouds.dto.MonthBillMngtStatisticByParkinglotDTO; |
40 | import com.zteits.clouds.api.dto.clouds.dto.MonthBillMngtStatisticDTO; | 40 | import com.zteits.clouds.api.dto.clouds.dto.MonthBillMngtStatisticDTO; |
41 | import com.zteits.clouds.api.dto.clouds.dto.MonthBillSummaryStatisticDTO; | 41 | import com.zteits.clouds.api.dto.clouds.dto.MonthBillSummaryStatisticDTO; |
42 | -import com.zteits.clouds.api.dto.clouds.dto.YearMonthCardStatisticDTO; | 42 | +import com.zteits.clouds.api.dto.clouds.dto.YearMonthCardIncomeStatisticDTO; |
43 | import com.zteits.clouds.api.dto.clouds.param.BillQueryRequest; | 43 | import com.zteits.clouds.api.dto.clouds.param.BillQueryRequest; |
44 | import com.zteits.clouds.api.dto.clouds.param.MonthBillRequest; | 44 | import com.zteits.clouds.api.dto.clouds.param.MonthBillRequest; |
45 | -import com.zteits.clouds.api.dto.pay.param.YearMonthCardStatisticRequest; | 45 | +import com.zteits.clouds.api.dto.pay.param.YearMonthCardIncomeStatisticRequest; |
46 | import com.zteits.clouds.api.service.clouds.MonthBillManagementService; | 46 | import com.zteits.clouds.api.service.clouds.MonthBillManagementService; |
47 | import com.zteits.clouds.api.service.clouds.YearMonthCardStatisticService; | 47 | import com.zteits.clouds.api.service.clouds.YearMonthCardStatisticService; |
48 | -import com.zteits.clouds.api.service.pay.TdCustCompanyService; | ||
49 | import io.swagger.annotations.Api; | 48 | import io.swagger.annotations.Api; |
50 | import io.swagger.annotations.ApiOperation; | 49 | import io.swagger.annotations.ApiOperation; |
51 | import org.apache.poi.xssf.usermodel.XSSFSheet; | 50 | import org.apache.poi.xssf.usermodel.XSSFSheet; |
@@ -54,6 +53,7 @@ import org.slf4j.Logger; | @@ -54,6 +53,7 @@ import org.slf4j.Logger; | ||
54 | import org.slf4j.LoggerFactory; | 53 | import org.slf4j.LoggerFactory; |
55 | import org.springframework.beans.factory.annotation.Autowired; | 54 | import org.springframework.beans.factory.annotation.Autowired; |
56 | import org.springframework.beans.factory.annotation.Value; | 55 | import org.springframework.beans.factory.annotation.Value; |
56 | +import org.springframework.format.annotation.DateTimeFormat; | ||
57 | import org.springframework.stereotype.Controller; | 57 | import org.springframework.stereotype.Controller; |
58 | import org.springframework.web.bind.annotation.GetMapping; | 58 | import org.springframework.web.bind.annotation.GetMapping; |
59 | import org.springframework.web.bind.annotation.PostMapping; | 59 | import org.springframework.web.bind.annotation.PostMapping; |
@@ -79,79 +79,85 @@ public class MonthBillManagementController extends BizController { | @@ -79,79 +79,85 @@ public class MonthBillManagementController extends BizController { | ||
79 | private SessionCommUtil sessionCommUtil; | 79 | private SessionCommUtil sessionCommUtil; |
80 | @Value("${project.syscode}") | 80 | @Value("${project.syscode}") |
81 | private String sysCode; | 81 | private String sysCode; |
82 | - | ||
83 | - | 82 | + |
84 | @ApiOperation("月账汇总单查询(统计图)") | 83 | @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 | - | 84 | + @RequestMapping("/queryBillforMonthTotal") |
85 | + @ResponseBody | ||
86 | + public BizResultVO<BillManageDTO> queryBillforMonthTotal(@RequestBody BillQueryRequest billQueryRequest, | ||
87 | + HttpServletRequest request, | ||
88 | + HttpServletResponse response) throws Exception { | ||
89 | + BizResult<BillManageDTO> result = monthBillManagementService.queryBillforMonthTotal(billQueryRequest); | ||
90 | + return new BizResultVO<BillManageDTO>(result); | ||
91 | + } | ||
92 | + | ||
93 | @ApiOperation("月账汇总单查询") | 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 | - | 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( | ||
100 | + billQueryRequest); | ||
101 | + logger.info("---end--月账汇总单查询调用后场dubbo服务,结果={}", JSONObject.toJSONString(result)); | ||
102 | + this.returnJsonDataGrid(response, result); | ||
103 | + } | ||
104 | + | ||
104 | /** | 105 | /** |
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 | - | 106 | + * 日账单导出.<br/> |
107 | + * | ||
108 | + * @param request | ||
109 | + * @param response | ||
110 | + * @throws Exception | ||
111 | + */ | ||
112 | + @RequestMapping("/exportToExcleForBillForMonth") | ||
113 | + public void exportToExcleForBillForMonth(@RequestParam String beginTime, @RequestParam String endTime, | ||
114 | + @RequestParam List<String> parkIdList, | ||
115 | + HttpServletRequest request, HttpServletResponse response) throws Exception { | ||
116 | + SimpleDateFormat format_yyy = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
117 | + BillQueryRequest billQueryRequest = new BillQueryRequest(); | ||
118 | + billQueryRequest.setSysCode("1001"); | ||
119 | + billQueryRequest.getBaseRequest().setPageSize(0); | ||
120 | + billQueryRequest.setParkIdList(parkIdList); | ||
121 | + billQueryRequest.setBeginTime(format_yyy.parse(beginTime)); | ||
122 | + billQueryRequest.setEndTime(format_yyy.parse(endTime)); | ||
123 | + BizResult<PageBean<BillManageDTO>> result = monthBillManagementService.queryBillforMonthTotalForPage( | ||
124 | + billQueryRequest); | ||
125 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM"); | ||
126 | + String[] title = new String[] {"时间", "停车场名称", "现金(元)", "支付宝(元)", "微信(元)", "总收入(元)"}; | ||
127 | + String sheetName = "月账单"; | ||
128 | + String fileName = "月账单"; | ||
129 | + // 1.创建excel信息 | ||
130 | + XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); | ||
131 | + // 2.设置excel表头和表体 | ||
132 | + Layouter.buildReport(workSheet, title, 0, 0); | ||
133 | + //3.填充数据 | ||
134 | + List<Object[]> contentList = new ArrayList<Object[]>(); | ||
135 | + if (result != null && !CollectionUtils.isEmpty(result.getData().getDataList())) { | ||
136 | + List<BillManageDTO> list = result.getData().getDataList(); | ||
137 | + for (BillManageDTO e : list) { | ||
138 | + if (e != null) { | ||
139 | + Object[] obj = new Object[title.length]; | ||
140 | + int index = 0; | ||
141 | + obj[index++] = (e.getBillDayTime() != null ? format.format(e.getBillDayTime()) : ""); | ||
142 | + obj[index++] = e.getParkName(); | ||
143 | + obj[index++] = (e.getCashTotalFee() == null ? "0" : e.getCashTotalFee().divide( | ||
144 | + new BigDecimal("100"), 2, BigDecimal.ROUND_HALF_UP)); | ||
145 | + obj[index++] = (e.getAliTotalFee() == null ? "0" : e.getAliTotalFee().divide(new BigDecimal("100"), | ||
146 | + 2, BigDecimal.ROUND_HALF_UP)); | ||
147 | + obj[index++] = (e.getWxTotalFee() == null ? "0" : e.getWxTotalFee().divide(new BigDecimal("100"), 2, | ||
148 | + BigDecimal.ROUND_HALF_UP)); | ||
149 | + obj[index++] = (e.getOrderTotalFee() == null ? "0" : e.getOrderTotalFee().divide( | ||
150 | + new BigDecimal("100"), 2, BigDecimal.ROUND_HALF_UP)); | ||
151 | + contentList.add(obj); | ||
152 | + } | ||
153 | + } | ||
154 | + } | ||
155 | + ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); | ||
156 | + fillUserManager.fillSalesOrga(workSheet, title, contentList, 2); | ||
157 | + // 4.excel输出配置 | ||
158 | + ExcelUtil.write(response, workSheet, fileName); | ||
159 | + | ||
160 | + } | ||
155 | 161 | ||
156 | @ApiOperation("月账单查询汇总统计") | 162 | @ApiOperation("月账单查询汇总统计") |
157 | @PostMapping("/summaryStatistic") | 163 | @PostMapping("/summaryStatistic") |
@@ -247,20 +253,21 @@ public class MonthBillManagementController extends BizController { | @@ -247,20 +253,21 @@ public class MonthBillManagementController extends BizController { | ||
247 | public BizResultVO<EasyUIDataGridVO<BillManageForMonthDTO>> queryBillforMonthList( | 253 | public BizResultVO<EasyUIDataGridVO<BillManageForMonthDTO>> queryBillforMonthList( |
248 | @RequestBody BillQueryRequest billQueryRequest, HttpServletRequest request, HttpServletResponse response) | 254 | @RequestBody BillQueryRequest billQueryRequest, HttpServletRequest request, HttpServletResponse response) |
249 | throws Exception { | 255 | throws Exception { |
250 | - // 2.调用接口查询当前登录人管辖的停车场名称 | 256 | + // 2.调用接口查询当前登录人管辖的停车场名称 |
251 | UserInfo userInfo = sessionCommUtil.getUserInfo(); | 257 | UserInfo userInfo = sessionCommUtil.getUserInfo(); |
252 | List<String> plNos = userInfo.getOrgIds(); | 258 | List<String> plNos = userInfo.getOrgIds(); |
253 | -// UserInfo userInfo = sessionCommUtil.getUserInfo(); | ||
254 | -// List<String> plNos = new ArrayList<>(); | ||
255 | -// if (userInfo != null) { | ||
256 | -// TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
257 | -// tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
258 | -// tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
259 | -// tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
260 | -// BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest); | ||
261 | -// // 拥有的停车场编号 | ||
262 | -// plNos = ResultUtils.getBizResultData(bizResult); | ||
263 | -// } | 259 | + // UserInfo userInfo = sessionCommUtil.getUserInfo(); |
260 | + // List<String> plNos = new ArrayList<>(); | ||
261 | + // if (userInfo != null) { | ||
262 | + // TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
263 | + // tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
264 | + // tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
265 | + // tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
266 | + // BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds | ||
267 | + // (tdCompanyParkQueryRequest); | ||
268 | + // // 拥有的停车场编号 | ||
269 | + // plNos = ResultUtils.getBizResultData(bizResult); | ||
270 | + // } | ||
264 | // if (CollectionUtils.isEmpty(plNos)) { | 271 | // if (CollectionUtils.isEmpty(plNos)) { |
265 | // throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在"); | 272 | // throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在"); |
266 | // } | 273 | // } |
@@ -285,16 +292,17 @@ public class MonthBillManagementController extends BizController { | @@ -285,16 +292,17 @@ public class MonthBillManagementController extends BizController { | ||
285 | // 2.调用接口查询当前登录人管辖的停车场名称 | 292 | // 2.调用接口查询当前登录人管辖的停车场名称 |
286 | UserInfo userInfo = sessionCommUtil.getUserInfo(); | 293 | UserInfo userInfo = sessionCommUtil.getUserInfo(); |
287 | List<String> plNos = userInfo.getOrgIds(); | 294 | List<String> plNos = userInfo.getOrgIds(); |
288 | -// List<String> plNos = new ArrayList<>(); | ||
289 | -// if (userInfo != null) { | ||
290 | -// TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
291 | -// tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
292 | -// tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
293 | -// tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
294 | -// BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest); | ||
295 | -// // 拥有的停车场编号 | ||
296 | -// plNos = ResultUtils.getBizResultData(bizResult); | ||
297 | -// } | 295 | + // List<String> plNos = new ArrayList<>(); |
296 | + // if (userInfo != null) { | ||
297 | + // TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
298 | + // tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
299 | + // tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
300 | + // tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
301 | + // BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds | ||
302 | + // (tdCompanyParkQueryRequest); | ||
303 | + // // 拥有的停车场编号 | ||
304 | + // plNos = ResultUtils.getBizResultData(bizResult); | ||
305 | + // } | ||
298 | // if (CollectionUtils.isEmpty(plNos)) { | 306 | // if (CollectionUtils.isEmpty(plNos)) { |
299 | // throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在"); | 307 | // throw new BizException(ErrorType.PARK_LOT_NOT_EXISTS, "停车场plnos不存在"); |
300 | // } | 308 | // } |
@@ -408,8 +416,6 @@ public class MonthBillManagementController extends BizController { | @@ -408,8 +416,6 @@ public class MonthBillManagementController extends BizController { | ||
408 | 416 | ||
409 | } | 417 | } |
410 | 418 | ||
411 | - | ||
412 | - | ||
413 | /** | 419 | /** |
414 | * 月账单所有导出.<br/> | 420 | * 月账单所有导出.<br/> |
415 | * | 421 | * |
@@ -436,19 +442,19 @@ public class MonthBillManagementController extends BizController { | @@ -436,19 +442,19 @@ public class MonthBillManagementController extends BizController { | ||
436 | // 2.调用接口查询当前登录人管辖的停车场名称 | 442 | // 2.调用接口查询当前登录人管辖的停车场名称 |
437 | UserInfo userInfo = sessionCommUtil.getUserInfo(); | 443 | UserInfo userInfo = sessionCommUtil.getUserInfo(); |
438 | List<String> plNos = userInfo.getOrgIds(); | 444 | List<String> plNos = userInfo.getOrgIds(); |
439 | -// // 2.调用接口查询当前登录人管辖的停车场名称 | ||
440 | -// UserInfo userInfo = sessionCommUtil.getUserInfo(); | ||
441 | -// List<String> plNos = new ArrayList<>(); | ||
442 | -// if (userInfo != null) { | ||
443 | -// TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
444 | -// tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
445 | -// tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
446 | -// tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
447 | -// BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds( | ||
448 | -// tdCompanyParkQueryRequest); | ||
449 | -// // 拥有的停车场编号 | ||
450 | -// plNos = ResultUtils.getBizResultData(bizResult); | ||
451 | -// } | 445 | + // // 2.调用接口查询当前登录人管辖的停车场名称 |
446 | + // UserInfo userInfo = sessionCommUtil.getUserInfo(); | ||
447 | + // List<String> plNos = new ArrayList<>(); | ||
448 | + // if (userInfo != null) { | ||
449 | + // TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); | ||
450 | + // tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); | ||
451 | + // tdCompanyParkQueryRequest.setSessionId(session.getId()); | ||
452 | + // tdCompanyParkQueryRequest.setSysCode(sysCode); | ||
453 | + // BizResult<List<String>> bizResult = tdCustCompanyService.queryParkNoByCustIds( | ||
454 | + // tdCompanyParkQueryRequest); | ||
455 | + // // 拥有的停车场编号 | ||
456 | + // plNos = ResultUtils.getBizResultData(bizResult); | ||
457 | + // } | ||
452 | billQueryRequest.setParkIdList(plNos); | 458 | billQueryRequest.setParkIdList(plNos); |
453 | logger.info("月账单导出所有 req={}", JSONObject.toJSONString(billQueryRequest)); | 459 | logger.info("月账单导出所有 req={}", JSONObject.toJSONString(billQueryRequest)); |
454 | respondResult = monthBillManagementService | 460 | respondResult = monthBillManagementService |
@@ -523,6 +529,97 @@ public class MonthBillManagementController extends BizController { | @@ -523,6 +529,97 @@ public class MonthBillManagementController extends BizController { | ||
523 | 529 | ||
524 | } | 530 | } |
525 | 531 | ||
532 | + @ApiOperation("月账单年卡月卡统计-详情导出") | ||
533 | + @RequestMapping("/exportYearMonthCardIncomeStatistic") | ||
534 | + public void exportYearMonthCardIncomeStatistic(@RequestParam String plNos, | ||
535 | + @RequestParam(required = false) Long beginTime, | ||
536 | + @RequestParam(required = false) Long endTime, @RequestParam(required = false) String orderType, | ||
537 | + HttpServletRequest request, HttpServletResponse response) { | ||
538 | + YearMonthCardIncomeStatisticRequest dubboReq = new YearMonthCardIncomeStatisticRequest(); | ||
539 | + | ||
540 | + if (org.apache.commons.lang3.StringUtils.isNotEmpty(plNos)) { | ||
541 | + dubboReq.setPlNos(Arrays.asList(plNos.split(","))); | ||
542 | + } | ||
543 | + if (org.apache.commons.lang3.StringUtils.isNotEmpty(orderType)) { | ||
544 | + String[] tempStr = orderType.split(","); | ||
545 | + List<Integer> nums = new ArrayList<>(); | ||
546 | + for (String str : tempStr) { | ||
547 | + nums.add(Integer.valueOf(str)); | ||
548 | + } | ||
549 | + dubboReq.setOrderType(nums); | ||
550 | + } | ||
551 | + dubboReq.setBeginTime(new Date(beginTime)); | ||
552 | + dubboReq.setEndTime(new Date(endTime)); | ||
553 | + dubboReq.setSysCode("10001"); | ||
554 | + BizResult<List<YearMonthCardIncomeStatisticDTO>> bizResult = yearMonthCardStatisticService | ||
555 | + .queryYearMonthCardIncomeStatistic(dubboReq); | ||
556 | + String[] title = new String[] {"类型", "现金(元)", "微信(元)", "支付宝(元)", "其他(元)","总金额(元)"}; | ||
557 | + String sheetName = "月卡年卡详情"; | ||
558 | + String fileName = "月卡年卡详情"; | ||
559 | + List<YearMonthCardIncomeStatisticDTO> dtos = new ArrayList<>(); | ||
560 | + if (null != bizResult && CollectionUtils.isNotEmpty(bizResult.getData())) { | ||
561 | + dtos = bizResult.getData(); | ||
562 | + } | ||
563 | + | ||
564 | + // 1.创建excel信息 | ||
565 | + XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); | ||
566 | + // 2.设置excel表头和表体 | ||
567 | + Layouter.buildReport(workSheet, title, 0, 0); | ||
568 | + // 3.填充数据 | ||
569 | + List<Object[]> contentList = new ArrayList<Object[]>(); | ||
570 | + | ||
571 | + for (YearMonthCardIncomeStatisticDTO e : dtos) { | ||
572 | + Object[] obj = new Object[title.length]; | ||
573 | + int index = 0; | ||
574 | + obj[index++] = getOrderTypeStr(e.getOrderType()); | ||
575 | + //现金 | ||
576 | + obj[index++] = e.getCashTotalFee() != null ? e.getCashTotalFee().divide(new BigDecimal("100"), | ||
577 | + 2, BigDecimal.ROUND_HALF_UP) : ""; | ||
578 | + //微信 | ||
579 | + obj[index++] = e.getWxTotalFee() != null ? e.getWxTotalFee().divide(new BigDecimal("100"), | ||
580 | + 2, BigDecimal.ROUND_HALF_UP) : ""; | ||
581 | + //支付宝 | ||
582 | + obj[index++] = e.getAliTotalFee() != null ? e.getAliTotalFee().divide(new BigDecimal("100"), | ||
583 | + 2, BigDecimal.ROUND_HALF_UP) : ""; | ||
584 | + //其他 | ||
585 | + obj[index++] = e.getOthersTotalFee() != null ? e.getOthersTotalFee().divide(new BigDecimal("100"), | ||
586 | + 2, BigDecimal.ROUND_HALF_UP) : ""; | ||
587 | + //总金额 | ||
588 | + obj[index++] = e.getOrderTotalFee() != null ? e.getOrderTotalFee().divide(new BigDecimal("100"), | ||
589 | + 2, BigDecimal.ROUND_HALF_UP) : ""; | ||
590 | + contentList.add(obj); | ||
591 | + } | ||
592 | + | ||
593 | + ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); | ||
594 | + fillUserManager.fillSalesOrga(workSheet, title, contentList, 2); | ||
595 | + // 4.excel输出配置 | ||
596 | + ExcelUtil.write(response, workSheet, fileName); | ||
597 | + } | ||
598 | + | ||
599 | + private String getOrderTypeStr(Integer orderType) { | ||
600 | + String orderTypeStr; | ||
601 | + if (orderType == null) { | ||
602 | + return ""; | ||
603 | + } | ||
604 | + switch (orderType) { | ||
605 | + case -1: | ||
606 | + orderTypeStr = "合计"; | ||
607 | + break; | ||
608 | + case 1: | ||
609 | + orderTypeStr = "停车订单"; | ||
610 | + break; | ||
611 | + case 2: | ||
612 | + orderTypeStr = "年卡"; | ||
613 | + break; | ||
614 | + case 3: | ||
615 | + orderTypeStr = "月卡"; | ||
616 | + break; | ||
617 | + default: | ||
618 | + orderTypeStr = "未知"; | ||
619 | + } | ||
620 | + return orderTypeStr; | ||
621 | + } | ||
622 | + | ||
526 | /** | 623 | /** |
527 | * 通过session信息获取停车场编码.<br/> | 624 | * 通过session信息获取停车场编码.<br/> |
528 | * | 625 | * |
@@ -531,17 +628,19 @@ public class MonthBillManagementController extends BizController { | @@ -531,17 +628,19 @@ public class MonthBillManagementController extends BizController { | ||
531 | * @return | 628 | * @return |
532 | * @throws Exception | 629 | * @throws Exception |
533 | */ | 630 | */ |
534 | -// private List<String> queryParkNoByCustIds(TdCompanyParkQueryRequest tdCompanyParkQueryRequest) throws Exception { | ||
535 | -// /** 查询停车场编码. */ | ||
536 | -// BizResult<List<String>> parkNoResult = tdCustCompanyService.queryParkNoByCustIds(tdCompanyParkQueryRequest); | ||
537 | -// if (parkNoResult.isSuccess() && parkNoResult != null && parkNoResult.getData() != null) { | ||
538 | -// logger.info("根据登录获取到对应的停车场编码=" + JSONArray.toJSONString(parkNoResult.getData())); | ||
539 | -// return parkNoResult.getData(); | ||
540 | -// } else { | ||
541 | -// logger.info("根据登录用户没有获取到对应的停车场编码"); | ||
542 | -// return null; | ||
543 | -// } | ||
544 | -// | ||
545 | -// } | 631 | + // private List<String> queryParkNoByCustIds(TdCompanyParkQueryRequest tdCompanyParkQueryRequest) throws |
632 | + // Exception { | ||
633 | + // /** 查询停车场编码. */ | ||
634 | + // BizResult<List<String>> parkNoResult = tdCustCompanyService.queryParkNoByCustIds | ||
635 | + // (tdCompanyParkQueryRequest); | ||
636 | + // if (parkNoResult.isSuccess() && parkNoResult != null && parkNoResult.getData() != null) { | ||
637 | + // logger.info("根据登录获取到对应的停车场编码=" + JSONArray.toJSONString(parkNoResult.getData())); | ||
638 | + // return parkNoResult.getData(); | ||
639 | + // } else { | ||
640 | + // logger.info("根据登录用户没有获取到对应的停车场编码"); | ||
641 | + // return null; | ||
642 | + // } | ||
643 | + // | ||
644 | + // } | ||
546 | 645 | ||
547 | } | 646 | } |
548 | \ No newline at end of file | 647 | \ No newline at end of file |
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/OrderManageController.java
1 | package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; | 1 | package com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic; |
2 | 2 | ||
3 | +import java.math.BigDecimal; | ||
4 | +import java.util.ArrayList; | ||
5 | +import java.util.Arrays; | ||
6 | +import java.util.Date; | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +import javax.servlet.http.HttpServletRequest; | ||
10 | +import javax.servlet.http.HttpServletResponse; | ||
11 | + | ||
3 | import com.alibaba.dubbo.common.utils.CollectionUtils; | 12 | import com.alibaba.dubbo.common.utils.CollectionUtils; |
4 | 13 | ||
14 | +import com.clouds.common.utils.excle.ExcelUtil; | ||
15 | +import com.clouds.common.utils.excle.ExcleFillDateManager; | ||
16 | +import com.clouds.common.utils.excle.Layouter; | ||
5 | import com.clouds.common.web.BizController; | 17 | import com.clouds.common.web.BizController; |
6 | import com.clouds.common.web.vo.BizResultVO; | 18 | import com.clouds.common.web.vo.BizResultVO; |
7 | import com.clouds.common.web.vo.EasyUIDataGridVO; | 19 | import com.clouds.common.web.vo.EasyUIDataGridVO; |
20 | +import com.xiaoleilu.hutool.date.DatePattern; | ||
21 | +import com.xiaoleilu.hutool.date.DateUtil; | ||
8 | import com.zteits.clouds.api.apibase.bean.BizResult; | 22 | import com.zteits.clouds.api.apibase.bean.BizResult; |
9 | import com.zteits.clouds.api.apibase.bean.PageBean; | 23 | import com.zteits.clouds.api.apibase.bean.PageBean; |
10 | import com.zteits.clouds.api.apibase.constants.ErrorType; | 24 | import com.zteits.clouds.api.apibase.constants.ErrorType; |
@@ -14,11 +28,16 @@ import com.zteits.clouds.api.dto.pay.param.ParkOrderByConditionQueryRequest; | @@ -14,11 +28,16 @@ import com.zteits.clouds.api.dto.pay.param.ParkOrderByConditionQueryRequest; | ||
14 | import com.zteits.clouds.api.service.pay.TdBOrderService; | 28 | import com.zteits.clouds.api.service.pay.TdBOrderService; |
15 | import io.swagger.annotations.Api; | 29 | import io.swagger.annotations.Api; |
16 | import io.swagger.annotations.ApiOperation; | 30 | import io.swagger.annotations.ApiOperation; |
31 | +import org.apache.commons.lang3.StringUtils; | ||
32 | +import org.apache.poi.xssf.usermodel.XSSFSheet; | ||
17 | import org.springframework.beans.factory.annotation.Autowired; | 33 | import org.springframework.beans.factory.annotation.Autowired; |
34 | +import org.springframework.format.annotation.DateTimeFormat; | ||
35 | +import org.springframework.stereotype.Controller; | ||
18 | import org.springframework.web.bind.annotation.PostMapping; | 36 | import org.springframework.web.bind.annotation.PostMapping; |
19 | import org.springframework.web.bind.annotation.RequestBody; | 37 | import org.springframework.web.bind.annotation.RequestBody; |
20 | import org.springframework.web.bind.annotation.RequestMapping; | 38 | import org.springframework.web.bind.annotation.RequestMapping; |
21 | -import org.springframework.web.bind.annotation.RestController; | 39 | +import org.springframework.web.bind.annotation.RequestParam; |
40 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
22 | 41 | ||
23 | /** | 42 | /** |
24 | * Copyright: Copyright (c) 2017 zteits | 43 | * Copyright: Copyright (c) 2017 zteits |
@@ -33,8 +52,8 @@ import org.springframework.web.bind.annotation.RestController; | @@ -33,8 +52,8 @@ import org.springframework.web.bind.annotation.RestController; | ||
33 | * ---------------------------------------------------------* | 52 | * ---------------------------------------------------------* |
34 | * 2017/8/24 atao v1.0.0 创建 | 53 | * 2017/8/24 atao v1.0.0 创建 |
35 | */ | 54 | */ |
36 | -@Api(value = "订单管理",description = "订单管理") | ||
37 | -@RestController | 55 | +@Api(value = "订单管理", description = "订单管理") |
56 | +@Controller | ||
38 | @RequestMapping("/order") | 57 | @RequestMapping("/order") |
39 | public class OrderManageController extends BizController { | 58 | public class OrderManageController extends BizController { |
40 | 59 | ||
@@ -43,8 +62,9 @@ public class OrderManageController extends BizController { | @@ -43,8 +62,9 @@ public class OrderManageController extends BizController { | ||
43 | 62 | ||
44 | @ApiOperation("根据查询条件查询停车订单") | 63 | @ApiOperation("根据查询条件查询停车订单") |
45 | @PostMapping("/queryParkOrderByCondition") | 64 | @PostMapping("/queryParkOrderByCondition") |
65 | + @ResponseBody | ||
46 | public BizResultVO<EasyUIDataGridVO<ParkOrderDTO>> queryParkOrderByCondition( | 66 | public BizResultVO<EasyUIDataGridVO<ParkOrderDTO>> queryParkOrderByCondition( |
47 | - @RequestBody ParkOrderByConditionQueryRequest request) throws Exception{ | 67 | + @RequestBody ParkOrderByConditionQueryRequest request) throws Exception { |
48 | if (CollectionUtils.isEmpty(request.getPlNos())) { | 68 | if (CollectionUtils.isEmpty(request.getPlNos())) { |
49 | throw new BizException(ErrorType.PARAMM_NULL, "停车场编码"); | 69 | throw new BizException(ErrorType.PARAMM_NULL, "停车场编码"); |
50 | } | 70 | } |
@@ -56,7 +76,375 @@ public class OrderManageController extends BizController { | @@ -56,7 +76,375 @@ public class OrderManageController extends BizController { | ||
56 | request.getBaseRequest().setPageSize(10); | 76 | request.getBaseRequest().setPageSize(10); |
57 | } | 77 | } |
58 | BizResult<PageBean<ParkOrderDTO>> bizResult = tdBOrderService.queryParkOrderByCondition(request); | 78 | BizResult<PageBean<ParkOrderDTO>> bizResult = tdBOrderService.queryParkOrderByCondition(request); |
59 | - return returnJqGridData(bizResult,ParkOrderDTO.class); | 79 | + return returnJqGridData(bizResult, ParkOrderDTO.class); |
60 | } | 80 | } |
61 | 81 | ||
82 | + /** | ||
83 | + * 根据查询条件导出所有记录 | ||
84 | + */ | ||
85 | + @RequestMapping("/exportAllParkOrderByCondition") | ||
86 | + public void exportAllParkOrderByCondition(@RequestParam String plNos, @RequestParam(required = false) String parkStatus, | ||
87 | + @RequestParam(required = false) String payType, @RequestParam(required = false) String parkType, | ||
88 | + @RequestParam(required = false) Long beginInTime, | ||
89 | + @RequestParam(required = false) Long endInTime, | ||
90 | + @RequestParam(required = false) Long beginOutTime, | ||
91 | + @RequestParam(required = false) Long endOutTime, | ||
92 | + @RequestParam(required = false) String carNum, HttpServletRequest request, | ||
93 | + HttpServletResponse response) { | ||
94 | + | ||
95 | + ParkOrderByConditionQueryRequest dubboReq = new ParkOrderByConditionQueryRequest(); | ||
96 | + if (StringUtils.isNotEmpty(plNos)) { | ||
97 | + dubboReq.setPlNos(Arrays.asList(plNos.split(","))); | ||
98 | + } | ||
99 | + if (StringUtils.isNotEmpty(parkStatus)) { | ||
100 | + String[] tempStr = parkStatus.split(","); | ||
101 | + List<Integer> nums = new ArrayList<>(); | ||
102 | + for (String str : tempStr) { | ||
103 | + nums.add(Integer.valueOf(str)); | ||
104 | + } | ||
105 | + | ||
106 | + dubboReq.setParkStatus(nums); | ||
107 | + | ||
108 | + } | ||
109 | + if (StringUtils.isNotEmpty(payType)) { | ||
110 | + String[] tempStr = payType.split(","); | ||
111 | + List<Integer> nums = new ArrayList<>(); | ||
112 | + for (String str : tempStr) { | ||
113 | + nums.add(Integer.valueOf(str)); | ||
114 | + } | ||
115 | + dubboReq.setPayType(nums); | ||
116 | + | ||
117 | + } | ||
118 | + | ||
119 | + if (StringUtils.isNotEmpty(parkType)) { | ||
120 | + String[] tempStr = parkType.split(","); | ||
121 | + List<Integer> nums = new ArrayList<>(); | ||
122 | + for (String str : tempStr) { | ||
123 | + nums.add(Integer.valueOf(str)); | ||
124 | + } | ||
125 | + dubboReq.setParkType(nums); | ||
126 | + } | ||
127 | + if(null != beginInTime){ | ||
128 | + dubboReq.setBeginInTime(new Date(beginInTime)); | ||
129 | + } | ||
130 | + | ||
131 | + if(null != endInTime){ | ||
132 | + dubboReq.setEndInTime(new Date(endInTime)); | ||
133 | + } | ||
134 | + if(null != beginOutTime){ | ||
135 | + dubboReq.setBeginOutTime(new Date(beginOutTime)); | ||
136 | + } | ||
137 | + if(null != endOutTime){ | ||
138 | + dubboReq.setEndOutTime(new Date(endOutTime)); | ||
139 | + } | ||
140 | + | ||
141 | + dubboReq.setCarNum(carNum); | ||
142 | + dubboReq.setSysCode("10001"); | ||
143 | + dubboReq.getBaseRequest().setPageNum(1); | ||
144 | + dubboReq.getBaseRequest().setPageSize(0); | ||
145 | + BizResult<PageBean<ParkOrderDTO>> bizResult = tdBOrderService.queryParkOrderByCondition(dubboReq); | ||
146 | + | ||
147 | + String[] title = new String[] {"停车场", "车牌号", "车辆类型", "状态", "进场时间", "出场时间", "进口", "出口", "停车时长", "应收", "实收", | ||
148 | + "优惠券", "支付方式", "收费员", "免费理由", "总金额"}; | ||
149 | + String sheetName = "停车记录"; | ||
150 | + String fileName = "停车记录"; | ||
151 | + // 1.创建excel信息 | ||
152 | + XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); | ||
153 | + // 2.设置excel表头和表体 | ||
154 | + Layouter.buildReport(workSheet, title, 0, 0); | ||
155 | + //3.填充数据 | ||
156 | + List<Object[]> contentList = new ArrayList<Object[]>(); | ||
157 | + if (bizResult != null && !CollectionUtils.isEmpty(bizResult.getData().getDataList())) { | ||
158 | + List<ParkOrderDTO> list = bizResult.getData().getDataList(); | ||
159 | + for (ParkOrderDTO e : list) { | ||
160 | + if (e != null) { | ||
161 | + Object[] obj = new Object[title.length]; | ||
162 | + int index = 0; | ||
163 | + obj[index++] = e.getParkName() != null ? e.getParkName() : ""; | ||
164 | + obj[index++] = e.getCarNumber() != null ? e.getCarNumber() : ""; | ||
165 | + obj[index++] = getParkTypeStr(e.getParkType()); | ||
166 | + obj[index++] = getParkStatusStr(e.getOrderState()); | ||
167 | + obj[index++] = e.getParkInTime() != null ? DateUtil.format(e.getParkInTime(), | ||
168 | + DatePattern.NORM_DATETIME_PATTERN) : ""; | ||
169 | + obj[index++] = e.getParkOutTime() != null ? DateUtil.format(e.getParkOutTime(), | ||
170 | + DatePattern.NORM_DATETIME_FORMAT) : ""; | ||
171 | + //进口 | ||
172 | + obj[index++] = getParkInSouceCodeStr(e.getParkInSourceCode()); | ||
173 | + //出口 | ||
174 | + obj[index++] = getParkOutSourceCodeStr(e.getParkOutSourceCode()); | ||
175 | + //停车时长 | ||
176 | + obj[index++] = getParkingDurationStr(e.getParkingDuration()); | ||
177 | + //应收 | ||
178 | + obj[index++] = e.getOrderTotalFee() != null ? e.getOrderTotalFee().divide(new BigDecimal("100"), | ||
179 | + 2, BigDecimal.ROUND_HALF_UP) : ""; | ||
180 | + //实收 | ||
181 | + obj[index++] = e.getOrderActFee() != null ? e.getOrderActFee().divide(new BigDecimal("100"), | ||
182 | + 2, BigDecimal.ROUND_HALF_UP) : ""; | ||
183 | + //优惠券 | ||
184 | + obj[index++] = ""; | ||
185 | + obj[index++] = getPayTypeStr(e.getPayType()); | ||
186 | + //收费员 | ||
187 | + obj[index++] = ""; | ||
188 | + obj[index++] = getFreeReasonStr(e.getOrderType()); | ||
189 | + //总金额 | ||
190 | + obj[index++] = e.getOrderTotalFee() != null ? e.getOrderTotalFee().divide(new BigDecimal("100"), | ||
191 | + 2, BigDecimal.ROUND_HALF_UP) : ""; | ||
192 | + contentList.add(obj); | ||
193 | + } | ||
194 | + } | ||
195 | + } | ||
196 | + ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); | ||
197 | + fillUserManager.fillSalesOrga(workSheet, title, contentList, 2); | ||
198 | + // 4.excel输出配置 | ||
199 | + ExcelUtil.write(response, workSheet, fileName); | ||
200 | + | ||
201 | + } | ||
202 | + | ||
203 | + /** | ||
204 | + * 根据查询条件导出欠费记录 | ||
205 | + */ | ||
206 | + | ||
207 | + @RequestMapping("/exportArrearageParkOrderByCondition") | ||
208 | + public void exportArrearageParkOrderByCondition(@RequestParam String plNos, @RequestParam(required = false) String parkStatus, | ||
209 | + @RequestParam(required = false) String payType, @RequestParam(required = false) String parkType, | ||
210 | + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date beginInTime, | ||
211 | + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endInTime, | ||
212 | + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date beginOutTime, | ||
213 | + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endOutTime, | ||
214 | + @RequestParam(required = false) String carNum, HttpServletRequest request, | ||
215 | + HttpServletResponse response) { | ||
216 | + | ||
217 | + ParkOrderByConditionQueryRequest dubboReq = new ParkOrderByConditionQueryRequest(); | ||
218 | + if (StringUtils.isNotEmpty(plNos)) { | ||
219 | + dubboReq.setPlNos(Arrays.asList(plNos.split(","))); | ||
220 | + } | ||
221 | + if (StringUtils.isNotEmpty(parkStatus)) { | ||
222 | + String[] tempStr = parkStatus.split(","); | ||
223 | + List<Integer> nums = new ArrayList<>(); | ||
224 | + for (String str : tempStr) { | ||
225 | + nums.add(Integer.valueOf(str)); | ||
226 | + } | ||
227 | + dubboReq.setParkStatus(nums); | ||
228 | + } | ||
229 | + if (StringUtils.isNotEmpty(payType)) { | ||
230 | + String[] tempStr = payType.split(","); | ||
231 | + List<Integer> nums = new ArrayList<>(); | ||
232 | + for (String str : tempStr) { | ||
233 | + nums.add(Integer.valueOf(str)); | ||
234 | + } | ||
235 | + dubboReq.setPayType(nums); | ||
236 | + } | ||
237 | + | ||
238 | + if (StringUtils.isNotEmpty(parkType)) { | ||
239 | + String[] tempStr = parkType.split(","); | ||
240 | + List<Integer> nums = new ArrayList<>(); | ||
241 | + for (String str : tempStr) { | ||
242 | + nums.add(Integer.valueOf(str)); | ||
243 | + } | ||
244 | + dubboReq.setParkType(nums); | ||
245 | + } | ||
246 | + dubboReq.setBeginInTime(beginInTime); | ||
247 | + dubboReq.setEndInTime(endInTime); | ||
248 | + dubboReq.setBeginOutTime(beginOutTime); | ||
249 | + dubboReq.setEndOutTime(endOutTime); | ||
250 | + dubboReq.setCarNum(carNum); | ||
251 | + dubboReq.setSysCode("10001"); | ||
252 | + dubboReq.getBaseRequest().setPageNum(1); | ||
253 | + dubboReq.getBaseRequest().setPageSize(0); | ||
254 | + BizResult<PageBean<ParkOrderDTO>> bizResult = tdBOrderService.queryParkOrderByCondition(dubboReq); | ||
255 | + | ||
256 | + String[] title = new String[] {"停车场", "车牌号", "进场时间", "出场时间", "进口", "出口", "停车时长", "应收", "收费员"}; | ||
257 | + String sheetName = "停车欠费记录"; | ||
258 | + String fileName = "停车欠费记录"; | ||
259 | + // 1.创建excel信息 | ||
260 | + XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); | ||
261 | + // 2.设置excel表头和表体 | ||
262 | + Layouter.buildReport(workSheet, title, 0, 0); | ||
263 | + //3.填充数据 | ||
264 | + List<Object[]> contentList = new ArrayList<Object[]>(); | ||
265 | + if (bizResult != null && !CollectionUtils.isEmpty(bizResult.getData().getDataList())) { | ||
266 | + List<ParkOrderDTO> list = bizResult.getData().getDataList(); | ||
267 | + for (ParkOrderDTO e : list) { | ||
268 | + if (e != null) { | ||
269 | + Object[] obj = new Object[title.length]; | ||
270 | + int index = 0; | ||
271 | + obj[index++] = e.getParkName() != null ? e.getParkName() : ""; | ||
272 | + obj[index++] = e.getCarNumber() != null ? e.getCarNumber() : ""; | ||
273 | + obj[index++] = e.getParkInTime() != null ? DateUtil.format(e.getParkInTime(), | ||
274 | + DatePattern.NORM_DATETIME_PATTERN) : ""; | ||
275 | + obj[index++] = e.getParkOutTime() != null ? DateUtil.format(e.getParkOutTime(), | ||
276 | + DatePattern.NORM_DATETIME_FORMAT) : ""; | ||
277 | + //进口 | ||
278 | + obj[index++] = getParkInSouceCodeStr(e.getParkInSourceCode()); | ||
279 | + //出口 | ||
280 | + obj[index++] = getParkOutSourceCodeStr(e.getParkOutSourceCode()); | ||
281 | + //停车时长 | ||
282 | + obj[index++] = getParkingDurationStr(e.getParkingDuration()); | ||
283 | + //应收 | ||
284 | + obj[index++] = e.getOrderTotalFee() != null ? e.getOrderTotalFee().divide(new BigDecimal("100"), | ||
285 | + 2, BigDecimal.ROUND_HALF_UP) : ""; | ||
286 | + //收费员 | ||
287 | + obj[index++] = ""; | ||
288 | + contentList.add(obj); | ||
289 | + } | ||
290 | + } | ||
291 | + } | ||
292 | + ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); | ||
293 | + fillUserManager.fillSalesOrga(workSheet, title, contentList, 2); | ||
294 | + // 4.excel输出配置 | ||
295 | + ExcelUtil.write(response, workSheet, fileName); | ||
296 | + | ||
297 | + } | ||
298 | + | ||
299 | + | ||
300 | + | ||
301 | + | ||
302 | + /** | ||
303 | + * 根据code 获取支付方式文本 | ||
304 | + * | ||
305 | + * @param payTypeCode | ||
306 | + * @return | ||
307 | + */ | ||
308 | + private String getPayTypeStr(Integer payTypeCode) { | ||
309 | + if (payTypeCode == null) { | ||
310 | + return "未知"; | ||
311 | + } | ||
312 | + | ||
313 | + String payTypeStr; | ||
314 | + switch (payTypeCode) { | ||
315 | + case 1: | ||
316 | + payTypeStr = "支付宝"; | ||
317 | + break; | ||
318 | + case 2: | ||
319 | + payTypeStr = "微信"; | ||
320 | + break; | ||
321 | + case 3: | ||
322 | + payTypeStr = "银联"; | ||
323 | + break; | ||
324 | + case 4: | ||
325 | + payTypeStr = "微信公众号"; | ||
326 | + break; | ||
327 | + case 6: | ||
328 | + payTypeStr = "现金"; | ||
329 | + break; | ||
330 | + case 7: | ||
331 | + payTypeStr = "IC卡"; | ||
332 | + break; | ||
333 | + default: | ||
334 | + payTypeStr = "其他"; | ||
335 | + } | ||
336 | + return payTypeStr; | ||
337 | + } | ||
338 | + | ||
339 | + private String getParkTypeStr(Integer parkTypeCode) { | ||
340 | + if (parkTypeCode == null) { | ||
341 | + return ""; | ||
342 | + } | ||
343 | + String parkTypeStr; | ||
344 | + switch (parkTypeCode) { | ||
345 | + case 0: | ||
346 | + parkTypeStr = "临时车"; | ||
347 | + break; | ||
348 | + case 1: | ||
349 | + parkTypeStr = "固定车"; | ||
350 | + break; | ||
351 | + | ||
352 | + default: | ||
353 | + parkTypeStr = "其他"; | ||
354 | + } | ||
355 | + return parkTypeStr; | ||
356 | + } | ||
357 | + | ||
358 | + private String getParkStatusStr(Integer parkStatusCode) { | ||
359 | + if (parkStatusCode == null) { | ||
360 | + return ""; | ||
361 | + } | ||
362 | + String parkStatusStr; | ||
363 | + switch (parkStatusCode) { | ||
364 | + case 1: | ||
365 | + parkStatusStr = "在场"; | ||
366 | + break; | ||
367 | + case 2: | ||
368 | + parkStatusStr = "在场"; | ||
369 | + break; | ||
370 | + case 3: | ||
371 | + parkStatusStr = "在场"; | ||
372 | + break; | ||
373 | + default: | ||
374 | + parkStatusStr = "离场"; | ||
375 | + break; | ||
376 | + | ||
377 | + } | ||
378 | + return parkStatusStr; | ||
379 | + } | ||
380 | + | ||
381 | + private String getFreeReasonStr(Integer freeReasonCode) { | ||
382 | + if (freeReasonCode == null) { | ||
383 | + return ""; | ||
384 | + } | ||
385 | + | ||
386 | + String reason; | ||
387 | + switch (freeReasonCode) { | ||
388 | + case 0: | ||
389 | + reason = "短时停车免费"; | ||
390 | + break; | ||
391 | + case 5: | ||
392 | + reason = "逃逸"; | ||
393 | + break; | ||
394 | + case 7: | ||
395 | + reason = "授权车免费"; | ||
396 | + break; | ||
397 | + case 8: | ||
398 | + reason = "手动免费开闸"; | ||
399 | + break; | ||
400 | + default: | ||
401 | + reason = "未知"; | ||
402 | + } | ||
403 | + return reason; | ||
404 | + } | ||
405 | + | ||
406 | + //进口 | ||
407 | + private String getParkInSouceCodeStr(String parkInSourceCode) { | ||
408 | + if (null == parkInSourceCode) { | ||
409 | + return ""; | ||
410 | + } | ||
411 | + return ""; | ||
412 | + } | ||
413 | + | ||
414 | + //出口 | ||
415 | + private String getParkOutSourceCodeStr(String parkOutSrouceCode) { | ||
416 | + if (null == parkOutSrouceCode) { | ||
417 | + return ""; | ||
418 | + } | ||
419 | + return ""; | ||
420 | + } | ||
421 | + | ||
422 | + //停车时长 | ||
423 | + private String getParkingDurationStr(Long parkingDuration) { | ||
424 | + if (null == parkingDuration) { | ||
425 | + return ""; | ||
426 | + } | ||
427 | + // 分 | ||
428 | + Long theTime1 = 0L; | ||
429 | + // 小时Integer | ||
430 | + Long theTime2 = 0L; | ||
431 | + // alert(theTime); | ||
432 | + if (parkingDuration > 60) { | ||
433 | + theTime1 = parkingDuration / 60; | ||
434 | + // alert(theTime1+"-"+theTime); | ||
435 | + if (theTime1 > 60) { | ||
436 | + theTime2 = (theTime1 / 60); | ||
437 | + theTime1 = theTime1 % 60; | ||
438 | + } | ||
439 | + } | ||
440 | + String result = ""; | ||
441 | + if (theTime1 > 0) { | ||
442 | + result = "" + theTime1 + "分钟" + result; | ||
443 | + } | ||
444 | + if (theTime2 > 0) { | ||
445 | + result = "" + theTime2 + "小时" + result; | ||
446 | + } | ||
447 | + return result; | ||
448 | + | ||
449 | + } | ||
62 | } | 450 | } |