Commit d9e110fb4999de124d87161b4595bc84ddd6fea6
1 parent
d227f4ab
提交
Showing
1 changed file
with
68 additions
and
5 deletions
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/areamanage/RegionAreaController.java
1 | package com.zteits.irain.portal.web.parkinglotcloudplatform.areamanage; | 1 | package com.zteits.irain.portal.web.parkinglotcloudplatform.areamanage; |
2 | 2 | ||
3 | +import java.text.SimpleDateFormat; | ||
4 | +import java.util.ArrayList; | ||
5 | +import java.util.Date; | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +import javax.servlet.http.HttpServletRequest; | ||
9 | +import javax.servlet.http.HttpServletResponse; | ||
3 | import javax.validation.Valid; | 10 | import javax.validation.Valid; |
4 | 11 | ||
12 | +import org.apache.poi.xssf.usermodel.XSSFSheet; | ||
5 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
6 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
7 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
8 | import org.springframework.beans.factory.annotation.Value; | 16 | import org.springframework.beans.factory.annotation.Value; |
9 | import org.springframework.stereotype.Controller; | 17 | import org.springframework.stereotype.Controller; |
10 | import org.springframework.util.StringUtils; | 18 | import org.springframework.util.StringUtils; |
19 | +import org.springframework.web.bind.annotation.GetMapping; | ||
11 | import org.springframework.web.bind.annotation.PostMapping; | 20 | import org.springframework.web.bind.annotation.PostMapping; |
12 | import org.springframework.web.bind.annotation.RequestBody; | 21 | import org.springframework.web.bind.annotation.RequestBody; |
13 | import org.springframework.web.bind.annotation.RequestMapping; | 22 | import org.springframework.web.bind.annotation.RequestMapping; |
23 | +import org.springframework.web.bind.annotation.RequestParam; | ||
14 | import org.springframework.web.bind.annotation.ResponseBody; | 24 | import org.springframework.web.bind.annotation.ResponseBody; |
15 | 25 | ||
16 | import com.alibaba.dubbo.common.utils.CollectionUtils; | 26 | import com.alibaba.dubbo.common.utils.CollectionUtils; |
17 | import com.alibaba.fastjson.JSONObject; | 27 | import com.alibaba.fastjson.JSONObject; |
28 | +import com.clouds.common.utils.excle.ExcelUtil; | ||
29 | +import com.clouds.common.utils.excle.ExcleFillDateManager; | ||
30 | +import com.clouds.common.utils.excle.Layouter; | ||
18 | import com.clouds.common.web.BizController; | 31 | import com.clouds.common.web.BizController; |
19 | import com.clouds.common.web.vo.BizResultVO; | 32 | import com.clouds.common.web.vo.BizResultVO; |
20 | import com.clouds.common.web.vo.EasyUIDataGridVO; | 33 | import com.clouds.common.web.vo.EasyUIDataGridVO; |
34 | +import com.zteits.clouds.api.apibase.bean.BaseInfo; | ||
21 | import com.zteits.clouds.api.apibase.bean.BizResult; | 35 | import com.zteits.clouds.api.apibase.bean.BizResult; |
22 | import com.zteits.clouds.api.apibase.bean.PageBean; | 36 | import com.zteits.clouds.api.apibase.bean.PageBean; |
23 | import com.zteits.clouds.api.apibase.constants.ErrorType; | 37 | import com.zteits.clouds.api.apibase.constants.ErrorType; |
24 | import com.zteits.clouds.api.apibase.exception.BizException; | 38 | import com.zteits.clouds.api.apibase.exception.BizException; |
39 | +import com.zteits.clouds.api.dto.clouds.dto.YearMonthCardStatisticDTO; | ||
25 | import com.zteits.clouds.api.dto.park.dto.TpPRegionAreaDTO; | 40 | import com.zteits.clouds.api.dto.park.dto.TpPRegionAreaDTO; |
26 | import com.zteits.clouds.api.dto.park.param.DeleteTpPRegionAreaRequest; | 41 | import com.zteits.clouds.api.dto.park.param.DeleteTpPRegionAreaRequest; |
27 | import com.zteits.clouds.api.dto.park.param.QueryTpPRegionAreaForPageRequest; | 42 | import com.zteits.clouds.api.dto.park.param.QueryTpPRegionAreaForPageRequest; |
28 | import com.zteits.clouds.api.dto.park.param.SaveOrUpdateTpPRegionAreaRequest; | 43 | import com.zteits.clouds.api.dto.park.param.SaveOrUpdateTpPRegionAreaRequest; |
29 | -import com.zteits.clouds.api.dto.sys.SysOpDTO; | ||
30 | -import com.zteits.clouds.api.dto.sys.param.SysOpDeleteRequest; | ||
31 | -import com.zteits.clouds.api.dto.sys.param.SysOpForPageRequest; | ||
32 | -import com.zteits.clouds.api.dto.sys.param.SysOpSaveOrModfiyRequest; | 44 | +import com.zteits.clouds.api.dto.pay.param.YearMonthCardStatisticRequest; |
33 | import com.zteits.clouds.api.service.park.TpPRegionAreaService; | 45 | import com.zteits.clouds.api.service.park.TpPRegionAreaService; |
34 | -import com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic.RealTimeMonitorController; | ||
35 | 46 | ||
36 | import io.swagger.annotations.Api; | 47 | import io.swagger.annotations.Api; |
37 | import io.swagger.annotations.ApiOperation; | 48 | import io.swagger.annotations.ApiOperation; |
@@ -121,5 +132,57 @@ public class RegionAreaController extends BizController { | @@ -121,5 +132,57 @@ public class RegionAreaController extends BizController { | ||
121 | logger.info("调用分页查询泊位区间信息dubbo服务返回信息:response={}"+JSONObject.toJSONString(result)); | 132 | logger.info("调用分页查询泊位区间信息dubbo服务返回信息:response={}"+JSONObject.toJSONString(result)); |
122 | return returnJqGridData(result, TpPRegionAreaDTO.class); | 133 | return returnJqGridData(result, TpPRegionAreaDTO.class); |
123 | } | 134 | } |
135 | + | ||
136 | + | ||
137 | + | ||
138 | + @ApiOperation("导出年卡月卡统计excel") | ||
139 | + @GetMapping("exportYearMonthStatisticExcel") | ||
140 | + public void exportYearMonthStatisticExcel( | ||
141 | + @RequestParam List<String> plNos, @RequestParam String parkAreaCode, | ||
142 | + HttpServletRequest requests, HttpServletResponse response) throws Exception { | ||
143 | + | ||
144 | + QueryTpPRegionAreaForPageRequest request= new QueryTpPRegionAreaForPageRequest(); | ||
145 | + request.setSysCode(sysCode); | ||
146 | + request.setPlNos(plNos); | ||
147 | + request.setBaseRequest(new BaseInfo(1, 0)); | ||
148 | + request.setParkAreaCode(parkAreaCode); | ||
149 | + | ||
150 | + BizResult<PageBean<TpPRegionAreaDTO>> result = tpPRegionAreaService.queryTpPRegionAreaForPage(request); | ||
151 | + | ||
152 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
153 | + SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); | ||
154 | + String[] title = new String[] {"泊位区间名称", "泊位区间编号", "停车场名称", "泊位数"}; | ||
155 | + String sheetName = "泊位区间管理"; | ||
156 | + String fileName = "泊位区间管理" + format2.format(new Date()); | ||
157 | + | ||
158 | +// String[] billTitle = new String[9]; | ||
159 | +// billTitle = new String[2]; | ||
160 | +// billTitle[0] = "年卡月卡统计"; | ||
161 | + | ||
162 | + | ||
163 | + // 1.创建excel信息 | ||
164 | + XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); | ||
165 | + // 2.设置excel表头和表体 | ||
166 | + Layouter.buildReport(workSheet, title,0,0); | ||
167 | + // 3.填充数据 | ||
168 | + List<Object[]> contentList = new ArrayList<Object[]>(); | ||
169 | + List<TpPRegionAreaDTO> list = new ArrayList<>(); | ||
170 | + if (CollectionUtils.isNotEmpty(result.getData().getDataList())) { | ||
171 | + list = result.getData().getDataList(); | ||
172 | + } | ||
173 | + for (TpPRegionAreaDTO e : list) { | ||
174 | + Object[] obj = new Object[title.length]; | ||
175 | + int index = 0; | ||
176 | + obj[index++] = e.getParkAreaName() != null ? e.getParkAreaName() : ""; | ||
177 | + obj[index++] = e.getParkAreaCode() != null ? e.getParkAreaCode() : ""; | ||
178 | + obj[index++] = e.getPlName() != null ? e.getPlName() : ""; | ||
179 | + obj[index++] = e.getBerthNum(); | ||
180 | + contentList.add(obj); | ||
181 | + } | ||
182 | + ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); | ||
183 | + fillUserManager.fillSalesOrga(workSheet, title, contentList, 2); | ||
184 | + // 4.excel输出配置 | ||
185 | + ExcelUtil.write(response, workSheet, fileName); | ||
186 | + } | ||
124 | 187 | ||
125 | } | 188 | } |