Commit 40e8a5248057975c4b15e46f2695baa17b1028fe
1 parent
3539f7d2
提交
Showing
1 changed file
with
131 additions
and
2 deletions
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/parklotmanage/ParkLotManageController.java
1 | 1 | package com.zteits.irain.portal.web.parkinglotcloudplatform.parklotmanage; |
2 | 2 | |
3 | +import java.text.SimpleDateFormat; | |
3 | 4 | import java.util.ArrayList; |
4 | 5 | import java.util.List; |
5 | 6 | import java.util.Map; |
6 | 7 | |
8 | +import javax.servlet.http.HttpServletRequest; | |
9 | +import javax.servlet.http.HttpServletResponse; | |
7 | 10 | import javax.servlet.http.HttpSession; |
8 | 11 | |
9 | 12 | import org.apache.commons.lang3.StringUtils; |
13 | +import org.apache.poi.util.StringUtil; | |
14 | +import org.apache.poi.xssf.usermodel.XSSFSheet; | |
10 | 15 | import org.slf4j.Logger; |
11 | 16 | import org.slf4j.LoggerFactory; |
12 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
13 | 18 | import org.springframework.web.bind.annotation.GetMapping; |
19 | +import org.springframework.web.bind.annotation.PostMapping; | |
20 | +import org.springframework.web.bind.annotation.RequestBody; | |
14 | 21 | import org.springframework.web.bind.annotation.RequestMapping; |
15 | 22 | import org.springframework.web.bind.annotation.RequestParam; |
16 | 23 | import org.springframework.web.bind.annotation.RestController; |
17 | 24 | |
18 | 25 | import com.alibaba.dubbo.common.utils.CollectionUtils; |
26 | +import com.alibaba.fastjson.JSONObject; | |
19 | 27 | import com.clouds.common.cache.park.ParkingLotCacheUtil; |
20 | 28 | import com.clouds.common.entity.UserInfo; |
21 | 29 | import com.clouds.common.utils.ResultUtils; |
30 | +import com.clouds.common.utils.excle.ExcelUtil; | |
31 | +import com.clouds.common.utils.excle.ExcleFillDateManager; | |
32 | +import com.clouds.common.utils.excle.Layouter; | |
33 | +import com.clouds.common.web.BizController; | |
22 | 34 | import com.clouds.common.web.SessionCommUtil; |
23 | 35 | import com.clouds.common.web.vo.BizResultVO; |
36 | +import com.clouds.common.web.vo.EasyUIDataGridVO; | |
24 | 37 | import com.google.common.collect.Lists; |
25 | 38 | import com.google.common.collect.Maps; |
26 | 39 | import com.zteits.clouds.api.apibase.bean.BizResult; |
40 | +import com.zteits.clouds.api.apibase.bean.PageBean; | |
27 | 41 | import com.zteits.clouds.api.apibase.constants.ErrorType; |
28 | 42 | import com.zteits.clouds.api.apibase.exception.BizException; |
29 | 43 | import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO; |
44 | +import com.zteits.clouds.api.dto.park.param.ParkingLotInfoDeleteRequest; | |
45 | +import com.zteits.clouds.api.dto.park.param.ParkingLotInfoSaveRequest; | |
46 | +import com.zteits.clouds.api.dto.park.param.ParkingLotInfoUpdateRequest; | |
30 | 47 | import com.zteits.clouds.api.dto.park.param.QueryParkLotInfoByPkNoRequest; |
31 | -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest; | |
48 | +import com.zteits.clouds.api.dto.park.param.QueryParkingLotByParkRequest; | |
32 | 49 | import com.zteits.clouds.api.service.park.ParkingLotQueryService; |
50 | +import com.zteits.clouds.api.service.park.ParkingLotService; | |
33 | 51 | import com.zteits.clouds.api.service.pay.TdCustCompanyService; |
34 | 52 | |
35 | 53 | import io.swagger.annotations.Api; |
... | ... | @@ -53,7 +71,7 @@ import io.swagger.annotations.ApiOperation; |
53 | 71 | @Api(value="停车场管理",description="停车场管理") |
54 | 72 | @RestController |
55 | 73 | @RequestMapping("parkLotManage") |
56 | -public class ParkLotManageController{ | |
74 | +public class ParkLotManageController extends BizController{ | |
57 | 75 | private Logger logger = LoggerFactory.getLogger(ParkLotManageController.class); |
58 | 76 | @Autowired |
59 | 77 | private HttpSession session; |
... | ... | @@ -63,6 +81,8 @@ public class ParkLotManageController{ |
63 | 81 | private TdCustCompanyService tdCustCompanyService; |
64 | 82 | @Autowired |
65 | 83 | private ParkingLotQueryService parkingLotQueryService; |
84 | + @Autowired | |
85 | + private ParkingLotService parkingLotService; | |
66 | 86 | /** |
67 | 87 | * 根据登录人权限获取停车场名称列表 |
68 | 88 | * @return |
... | ... | @@ -111,4 +131,113 @@ public class ParkLotManageController{ |
111 | 131 | } |
112 | 132 | return plNos; |
113 | 133 | } |
134 | + /** | |
135 | + * xiejp 2017-08-30 | |
136 | + * @param request | |
137 | + * @return | |
138 | + * @throws Exception | |
139 | + */ | |
140 | + @ApiOperation("分页查询停车场列表") | |
141 | + @PostMapping("/queryParkingLotPageByPark") | |
142 | + public BizResultVO<EasyUIDataGridVO<ParkingLotDTO>> queryParkingLotByPark(@RequestBody QueryParkingLotByParkRequest request) throws Exception { | |
143 | + logger.info("调用分页获取停车场列表dubbo服务入参:request={}"+JSONObject.toJSONString(request)); | |
144 | + if (request == null) { | |
145 | + throw new BizException(ErrorType.PARAMM_NULL, "请求对象"); | |
146 | + } | |
147 | + BizResult<PageBean<ParkingLotDTO>> bizResult = parkingLotQueryService.queryParkingLotByPark(request,request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize()); | |
148 | + return returnJqGridData(bizResult, ParkingLotDTO.class); | |
149 | + } | |
150 | + /** | |
151 | + * 添加停车场信息 | |
152 | + * @param request | |
153 | + * @return | |
154 | + */ | |
155 | + @ApiOperation("添加停车场信息") | |
156 | + @PostMapping("/saveParkingLotInfo") | |
157 | + public BizResultVO<Boolean> SaveParkingLotInfo(@RequestBody ParkingLotInfoSaveRequest request){ | |
158 | + logger.info("调用添加停车场信息dubbo服务入参:request={}"+JSONObject.toJSONString(request)); | |
159 | + BizResult<Boolean> bizResult = parkingLotService.SaveParkingLotInfo(request); | |
160 | + return new BizResultVO<Boolean>(bizResult); | |
161 | + } | |
162 | + /** | |
163 | + * 修改停车场信息 | |
164 | + * @param request | |
165 | + * @return | |
166 | + */ | |
167 | + @ApiOperation("修改停车场信息") | |
168 | + @PostMapping("/updateParkingLotInfo") | |
169 | + public BizResultVO<Boolean> UpdateParkingLotInfo(@RequestBody ParkingLotInfoUpdateRequest request){ | |
170 | + logger.info("调用修改停车场信息dubbo服务入参:request={}"+JSONObject.toJSONString(request)); | |
171 | + BizResult<Boolean> bizResult = parkingLotService.UpdateParkingLotInfo(request); | |
172 | + return new BizResultVO<Boolean>(bizResult); | |
173 | + } | |
174 | + /** | |
175 | + * 根据停车场编号查询停车场信息 | |
176 | + * @param request | |
177 | + * @return | |
178 | + */ | |
179 | + @ApiOperation("根据停车场编号查询停车场信息") | |
180 | + @PostMapping("/queryParkingLotByPkNo") | |
181 | + public BizResultVO<ParkingLotDTO> QueryParkingLotByPkNo(@RequestBody QueryParkLotInfoByPkNoRequest request){ | |
182 | + logger.info("调用根据停车场编号查询停车场信息dubbo服务入参:request={}"+JSONObject.toJSONString(request)); | |
183 | + BizResult<ParkingLotDTO> bizResult = parkingLotQueryService.QueryParkingLotByPkNo(request); | |
184 | + return new BizResultVO<ParkingLotDTO>(bizResult); | |
185 | + } | |
186 | + /** | |
187 | + * 删除停车场信息 | |
188 | + * @param request | |
189 | + * @return | |
190 | + */ | |
191 | + @ApiOperation("删除停车场信息") | |
192 | + @PostMapping("/deleteParkingLotInfoByPlIds") | |
193 | + public BizResultVO<Boolean> DeleteParkingLotInfoByPlIds(@RequestBody ParkingLotInfoDeleteRequest request){ | |
194 | + logger.info("调用删除停车场信息dubbo服务入参:request={}"+JSONObject.toJSONString(request)); | |
195 | + BizResult<Boolean> bizResult = parkingLotService.DeleteParkingLotInfoByPlIds(request); | |
196 | + return new BizResultVO<Boolean>(bizResult); | |
197 | + } | |
198 | + /** | |
199 | + * 导出 | |
200 | + * @param request | |
201 | + * @param response | |
202 | + * @throws Exception | |
203 | + */ | |
204 | + @ApiOperation("导出停车场信息") | |
205 | + @RequestMapping("/parkingToExcleForPage") | |
206 | + public void parkingToExcleForPage(@RequestParam List<String> plNos,@RequestParam List<Long> plAreaBlockIds,@RequestParam Integer plType | |
207 | + ,HttpServletRequest request,HttpServletResponse response) throws Exception{ | |
208 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
209 | + QueryParkingLotByParkRequest queryParking = new QueryParkingLotByParkRequest(); | |
210 | + queryParking.setSysCode("1001"); | |
211 | + queryParking.getBaseRequest().setPageSize(0); | |
212 | + queryParking.setPlNos(plNos); | |
213 | + queryParking.setPlAreaBlockIds(plAreaBlockIds); | |
214 | + queryParking.setPlType(plType); | |
215 | + BizResult<PageBean<ParkingLotDTO>> bizResult = parkingLotQueryService.queryParkingLotByPark(queryParking,0,0); | |
216 | + | |
217 | + String[] title = new String[]{"停车场编号","停车场名称"}; | |
218 | + String sheetName="停车场"; | |
219 | + String fileName = "停车场信息"; | |
220 | + // 1.创建excel信息 | |
221 | + XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); | |
222 | + // 2.设置excel表头和表体 | |
223 | + Layouter.buildReport(workSheet,title,0, 0); | |
224 | + //3.填充数据 | |
225 | + List<Object[]> contentList=new ArrayList<Object[]>(); | |
226 | + List<ParkingLotDTO> list = bizResult.getData().getDataList(); | |
227 | + if(!CollectionUtils.isEmpty(list)){ | |
228 | + for (ParkingLotDTO e: list) { | |
229 | + Object[] obj=new Object[title.length]; | |
230 | + int index=0; | |
231 | + obj[index++]=e.getPlNo(); | |
232 | + obj[index++]=e.getPlName(); | |
233 | + | |
234 | + contentList.add(obj); | |
235 | + } | |
236 | + } | |
237 | + ExcleFillDateManager fillUserManager=new ExcleFillDateManager(); | |
238 | + fillUserManager.fillSalesOrga(workSheet,title,contentList,2); | |
239 | + // 4.excel输出配置 | |
240 | + ExcelUtil.write(response, workSheet, fileName); | |
241 | + } | |
242 | + | |
114 | 243 | } | ... | ... |