Commit 9a71789673ee5e8f191ce34bb84154d81a202623
Merge branch 'branch_0808' of http://192.168.1.195:9998/ZTEITS-Developers/zteits…
…-bcp-portal.git into branch_0808
Showing
3 changed files
with
287 additions
and
12 deletions
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/devicemanagement/PdaController.java
0 → 100644
| 1 | +package com.zteits.irain.portal.web.parkinglotcloudplatform.devicemanagement; | ||
| 2 | + | ||
| 3 | +import java.io.IOException; | ||
| 4 | +import java.util.ArrayList; | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +import javax.servlet.http.HttpServletRequest; | ||
| 8 | +import javax.servlet.http.HttpServletResponse; | ||
| 9 | + | ||
| 10 | +import org.apache.poi.xssf.usermodel.XSSFSheet; | ||
| 11 | +import org.slf4j.Logger; | ||
| 12 | +import org.slf4j.LoggerFactory; | ||
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | +import org.springframework.beans.factory.annotation.Value; | ||
| 15 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 16 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 17 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 18 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 19 | +import org.springframework.web.bind.annotation.RestController; | ||
| 20 | +import org.springframework.web.multipart.MultipartFile; | ||
| 21 | + | ||
| 22 | +import com.clouds.common.utils.DateUtil; | ||
| 23 | +import com.clouds.common.utils.excle.ExcelReadUtil; | ||
| 24 | +import com.clouds.common.utils.excle.ExcelUtil; | ||
| 25 | +import com.clouds.common.utils.excle.ExcleFillDateManager; | ||
| 26 | +import com.clouds.common.utils.excle.Layouter; | ||
| 27 | +import com.clouds.common.web.BizController; | ||
| 28 | +import com.clouds.common.web.vo.BizResultVO; | ||
| 29 | +import com.clouds.common.web.vo.EasyUIDataGridVO; | ||
| 30 | +import com.google.common.collect.Lists; | ||
| 31 | +import com.xiaoleilu.hutool.util.CollectionUtil; | ||
| 32 | +import com.zteits.clouds.api.apibase.bean.BizResult; | ||
| 33 | +import com.zteits.clouds.api.apibase.bean.PageBean; | ||
| 34 | +import com.zteits.clouds.api.apibase.constants.ErrorType; | ||
| 35 | +import com.zteits.clouds.api.apibase.exception.BizException; | ||
| 36 | +import com.zteits.clouds.api.dto.park.dto.TpPPdaDTO; | ||
| 37 | +import com.zteits.clouds.api.dto.park.dto.TpPTgsPassedcarDTO; | ||
| 38 | +import com.zteits.clouds.api.dto.park.param.TpPPdaRequest; | ||
| 39 | +import com.zteits.clouds.api.dto.park.param.TpPPdaSRequest; | ||
| 40 | +import com.zteits.clouds.api.dto.park.param.TpPTgsPassedcarRequest; | ||
| 41 | +import com.zteits.clouds.api.service.park.TpPPdaService; | ||
| 42 | +import com.zteits.clouds.api.service.park.TpPTgsPassedcarService; | ||
| 43 | +import com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic.InOutParkStatisticController; | ||
| 44 | + | ||
| 45 | +import io.swagger.annotations.ApiOperation; | ||
| 46 | + | ||
| 47 | +/** | ||
| 48 | + * PDA管理控制器 | ||
| 49 | + * | ||
| 50 | + * Copyright: Copyright (c) 2017 ZTE-ITS | ||
| 51 | + * | ||
| 52 | + * @ClassName: PdaController.java | ||
| 53 | + * @Description: | ||
| 54 | + * @version: v1.0.0 | ||
| 55 | + * @author: wangbiao | ||
| 56 | + * @date: 2017年8月31日 下午3:05:03 | ||
| 57 | + * Modification History: | ||
| 58 | + * Date Author Version Description | ||
| 59 | + *---------------------------------------------------------* | ||
| 60 | + * 2017年8月31日 wangbiao v1.0.0 创建 | ||
| 61 | + */ | ||
| 62 | +@RestController | ||
| 63 | +public class PdaController extends BizController { | ||
| 64 | + | ||
| 65 | + private static final Logger logger = LoggerFactory.getLogger(InOutParkStatisticController.class); | ||
| 66 | + | ||
| 67 | + @Autowired | ||
| 68 | + private TpPPdaService tpPPdaService; | ||
| 69 | + @Autowired | ||
| 70 | + private TpPTgsPassedcarService tpPTgsPassedcarService; | ||
| 71 | + | ||
| 72 | + @Value("${project.syscode}") | ||
| 73 | + private String sysCode; | ||
| 74 | + | ||
| 75 | + | ||
| 76 | + | ||
| 77 | + @ApiOperation("PDA信息信息") | ||
| 78 | + @PostMapping("/queryPassedca4pabe") | ||
| 79 | + public BizResultVO<EasyUIDataGridVO<TpPTgsPassedcarDTO>> queryPassedca4pabe(@RequestBody TpPTgsPassedcarRequest tpPTgsPassedcarRequest, HttpServletRequest request, | ||
| 80 | + HttpServletResponse response){ | ||
| 81 | + BizResult<PageBean<TpPTgsPassedcarDTO>> bizResult = new BizResult<PageBean<TpPTgsPassedcarDTO>>(); | ||
| 82 | + try { | ||
| 83 | + tpPTgsPassedcarRequest.setSysCode(sysCode); | ||
| 84 | + bizResult = tpPTgsPassedcarService.queryPassedcar4Page(tpPTgsPassedcarRequest); | ||
| 85 | + if(bizResult.isSuccess()){ | ||
| 86 | + return returnJqGridData(bizResult, TpPTgsPassedcarDTO.class); | ||
| 87 | + } | ||
| 88 | + } catch (Exception e) { | ||
| 89 | + logger.debug("分页查询过车信息异常:{}",bizResult.getErrMsg()); | ||
| 90 | + } | ||
| 91 | + return new BizResultVO<EasyUIDataGridVO<TpPTgsPassedcarDTO>>(); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @ApiOperation("PDA信息信息") | ||
| 95 | + @PostMapping("/queryPdaInfo4pabe") | ||
| 96 | + public BizResultVO<EasyUIDataGridVO<TpPPdaDTO>> queryPdaInfo4pabe(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request, | ||
| 97 | + HttpServletResponse response){ | ||
| 98 | + BizResult<PageBean<TpPPdaDTO>> bizResult = new BizResult<PageBean<TpPPdaDTO>>(); | ||
| 99 | + try { | ||
| 100 | + tpPPdaRequest.setSysCode(sysCode); | ||
| 101 | + bizResult = tpPPdaService.queryPdaInfo4pabe(tpPPdaRequest); | ||
| 102 | + if(bizResult.isSuccess()){ | ||
| 103 | + return returnJqGridData(bizResult, TpPPdaDTO.class); | ||
| 104 | + } | ||
| 105 | + } catch (Exception e) { | ||
| 106 | + logger.debug("分页查询pda信息异常:{}",bizResult.getErrMsg()); | ||
| 107 | + } | ||
| 108 | + return new BizResultVO<EasyUIDataGridVO<TpPPdaDTO>>(); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + @ApiOperation("新增PDA信息信息") | ||
| 112 | + @PostMapping("/insertPda") | ||
| 113 | + public BizResultVO<Integer> insertPda(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request, | ||
| 114 | + HttpServletResponse response){ | ||
| 115 | + tpPPdaRequest.setSysCode(sysCode); | ||
| 116 | + BizResult<Integer> bizResult = tpPPdaService.insertPda(tpPPdaRequest); | ||
| 117 | + if(bizResult.isSuccess()){ | ||
| 118 | + return new BizResultVO<Integer>(bizResult); | ||
| 119 | + }else{ | ||
| 120 | + logger.debug("新增PDA信息信息异常 :{}",bizResult.getErrMsg()); | ||
| 121 | + } | ||
| 122 | + return new BizResultVO<Integer>(); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + @ApiOperation("删除PDA信息信息") | ||
| 126 | + @PostMapping("/deletePda") | ||
| 127 | + public BizResultVO<Integer> deletePda(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request, | ||
| 128 | + HttpServletResponse response){ | ||
| 129 | + tpPPdaRequest.setSysCode(sysCode); | ||
| 130 | + BizResult<Integer> bizResult = tpPPdaService.deletetPda(tpPPdaRequest); | ||
| 131 | + if(bizResult.isSuccess()){ | ||
| 132 | + return new BizResultVO<Integer>(bizResult); | ||
| 133 | + }else{ | ||
| 134 | + logger.debug("删除PDA信息信息异常 :{}",bizResult.getErrMsg()); | ||
| 135 | + } | ||
| 136 | + return new BizResultVO<Integer>(); | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + @ApiOperation("删除PDA信息信息") | ||
| 140 | + @PostMapping("/deleteBatchPda") | ||
| 141 | + public BizResultVO<Integer> deleteBatchPda(@RequestBody TpPPdaSRequest tpPPdaSRequest, HttpServletRequest request, | ||
| 142 | + HttpServletResponse response){ | ||
| 143 | + tpPPdaSRequest.setSysCode(sysCode); | ||
| 144 | + BizResult<Integer> bizResult = tpPPdaService.deleteBatchPda(tpPPdaSRequest); | ||
| 145 | + if(bizResult.isSuccess()){ | ||
| 146 | + return new BizResultVO<Integer>(bizResult); | ||
| 147 | + }else{ | ||
| 148 | + logger.debug("删除PDA信息信息异常 :{}",bizResult.getErrMsg()); | ||
| 149 | + } | ||
| 150 | + return new BizResultVO<Integer>(); | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + @ApiOperation("根据id查询PDA信息") | ||
| 154 | + @PostMapping("/queryPdaById") | ||
| 155 | + public BizResultVO<TpPPdaDTO> queryPdaById(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request, | ||
| 156 | + HttpServletResponse response){ | ||
| 157 | + tpPPdaRequest.setSysCode(sysCode); | ||
| 158 | + BizResult<TpPPdaDTO> bizResult = tpPPdaService.queryPdaById(tpPPdaRequest); | ||
| 159 | + if(bizResult.isSuccess()){ | ||
| 160 | + return new BizResultVO<TpPPdaDTO>(bizResult); | ||
| 161 | + }else{ | ||
| 162 | + logger.debug("根据id查询PDA信息异常 :{}",bizResult.getErrMsg()); | ||
| 163 | + } | ||
| 164 | + return new BizResultVO<TpPPdaDTO>(); | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + @ApiOperation("修改PDA信息") | ||
| 168 | + @PostMapping("/updatePda") | ||
| 169 | + public BizResultVO<Integer> updatePda(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request, | ||
| 170 | + HttpServletResponse response){ | ||
| 171 | + tpPPdaRequest.setSysCode(sysCode); | ||
| 172 | + BizResult<Integer> bizResult = tpPPdaService.updatePda(tpPPdaRequest); | ||
| 173 | + if(bizResult.isSuccess()){ | ||
| 174 | + return new BizResultVO<Integer>(bizResult); | ||
| 175 | + }else{ | ||
| 176 | + logger.debug("修改PDA信息异常 :{}",bizResult.getErrMsg()); | ||
| 177 | + } | ||
| 178 | + return new BizResultVO<Integer>(); | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + @ApiOperation("pda信息导出excel") | ||
| 182 | + @GetMapping("exportBerthInfoExcel") | ||
| 183 | + public void exportBerthInfoExcel(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest requests, HttpServletResponse response) { | ||
| 184 | + tpPPdaRequest.setSysCode(sysCode); | ||
| 185 | + BizResult<List<TpPPdaDTO>> list = tpPPdaService.queryPdaInfo(tpPPdaRequest); | ||
| 186 | + String[] title = new String[] { "序号","设备编号", "设备名称", "设备类型", "状态","持有人","资源描述" }; | ||
| 187 | + String sheetName = "PDA信息"; | ||
| 188 | + String fileName = sheetName+DateUtil.getDate(); | ||
| 189 | + // 1.创建excel信息 | ||
| 190 | + XSSFSheet workSheet = ExcelUtil.createExcel(fileName); | ||
| 191 | + // 2.设置excel表头和表体 | ||
| 192 | + Layouter.buildReport(workSheet, title, 0, 0); | ||
| 193 | + // 3.填充数据 | ||
| 194 | + List<Object[]> contentList = new ArrayList<Object[]>(); | ||
| 195 | + int number = 1; | ||
| 196 | + if(list.isSuccess() && CollectionUtil.isNotEmpty(list.getData())){ | ||
| 197 | + for (TpPPdaDTO b : list.getData()) { | ||
| 198 | + Object[] obj = new Object[title.length]; | ||
| 199 | + int index = 0; | ||
| 200 | + obj[index++] = number++; | ||
| 201 | + obj[index++] = b.getId(); | ||
| 202 | + obj[index++] = b.getPdaNo(); | ||
| 203 | + obj[index++] = b.getPdaName(); | ||
| 204 | + obj[index++] = b.getPdaType(); | ||
| 205 | + obj[index++] = b.getPdaStatus(); | ||
| 206 | + obj[index++] = b.getOwnerName(); | ||
| 207 | + obj[index++] = b.getRemark(); | ||
| 208 | + contentList.add(obj); | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | + ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); | ||
| 212 | + fillUserManager.fillSalesOrga(workSheet, title, contentList, 2); | ||
| 213 | + // 4.excel输出配置 | ||
| 214 | + ExcelUtil.write(response, workSheet, fileName); | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + | ||
| 218 | + @ApiOperation("pda信息 导入模板下载") | ||
| 219 | + @GetMapping("exportModelExcel") | ||
| 220 | + public void exportModelExcel(HttpServletRequest requests, HttpServletResponse response) { | ||
| 221 | + String[] title = new String[] { "设备编号", "设备名称", "设备类型","停车场编号","sim卡号","持有人编号","持有人名称","状态","资源描述" }; | ||
| 222 | + String fileName = "PDA信息导入模板"; | ||
| 223 | + // 1.创建excel信息 | ||
| 224 | + XSSFSheet workSheet = ExcelUtil.createExcel(fileName); | ||
| 225 | + // 2.设置excel表头和表体 | ||
| 226 | + Layouter.buildReport(workSheet, title, 0, 0); | ||
| 227 | + // 3.填充数据 | ||
| 228 | + ExcleFillDateManager fillUserManager = new ExcleFillDateManager(); | ||
| 229 | + fillUserManager.fillSalesOrga(workSheet, title, Lists.newArrayList(), 2); | ||
| 230 | + // 4.excel输出配置 | ||
| 231 | + ExcelUtil.write(response, workSheet, fileName); | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + | ||
| 235 | + @PostMapping("/importPda") | ||
| 236 | + public BizResultVO<Integer> importPda(@RequestParam(value="excelFile") MultipartFile file,HttpServletRequest request) throws IOException{ | ||
| 237 | + if(file==null){ | ||
| 238 | + throw new BizException(ErrorType.PARAMM_NULL, "导入文件不能为空"); | ||
| 239 | + } | ||
| 240 | + //读取Excel数据到List中 | ||
| 241 | + List<ArrayList<String>> list = ExcelReadUtil.readExcel(file); | ||
| 242 | + //list中存的就是excel中的数据,可以根据excel中每一列的值转换成你所需要的值(从0开始),如: | ||
| 243 | + TpPPdaRequest tpPPdaRequest = null; | ||
| 244 | + List<TpPPdaRequest> padList = Lists.newArrayList(); | ||
| 245 | + for(ArrayList<String> arr:list){ | ||
| 246 | + tpPPdaRequest= new TpPPdaRequest(); | ||
| 247 | + tpPPdaRequest.setPdaNo(arr.get(0)); | ||
| 248 | + padList.add(tpPPdaRequest); | ||
| 249 | + } | ||
| 250 | + TpPPdaSRequest TpPPdaSRequest = new TpPPdaSRequest(); | ||
| 251 | + TpPPdaSRequest.setPadList(padList); | ||
| 252 | + BizResult<Integer> rsInteger = tpPPdaService.insertBatchPda(TpPPdaSRequest); | ||
| 253 | + return new BizResultVO<Integer>(rsInteger); | ||
| 254 | + } | ||
| 255 | + | ||
| 256 | +} |
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/parklotmanage/ParkLotManageController.java
| @@ -5,6 +5,7 @@ import java.util.ArrayList; | @@ -5,6 +5,7 @@ import java.util.ArrayList; | ||
| 5 | import java.util.List; | 5 | import java.util.List; |
| 6 | import java.util.Map; | 6 | import java.util.Map; |
| 7 | 7 | ||
| 8 | +import javax.servlet.http.HttpServletRequest; | ||
| 8 | import javax.servlet.http.HttpServletResponse; | 9 | import javax.servlet.http.HttpServletResponse; |
| 9 | import javax.servlet.http.HttpSession; | 10 | import javax.servlet.http.HttpSession; |
| 10 | 11 | ||
| @@ -201,12 +202,18 @@ public class ParkLotManageController extends BizController{ | @@ -201,12 +202,18 @@ public class ParkLotManageController extends BizController{ | ||
| 201 | * @throws Exception | 202 | * @throws Exception |
| 202 | */ | 203 | */ |
| 203 | @ApiOperation("导出停车场信息") | 204 | @ApiOperation("导出停车场信息") |
| 204 | - @PostMapping("/parkingToExcleForPage") | ||
| 205 | - public void parkingToExcleForPage(@RequestBody QueryParkingLotByParkRequest request,HttpServletResponse response) throws Exception{ | 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{ | ||
| 206 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 208 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 207 | - | ||
| 208 | - BizResult<PageBean<ParkingLotDTO>> bizResult = parkingLotQueryService.queryParkingLotByPark(request,0,0); | ||
| 209 | - | 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 | + | ||
| 210 | String[] title = new String[]{"停车场编号","停车场名称"}; | 217 | String[] title = new String[]{"停车场编号","停车场名称"}; |
| 211 | String sheetName="停车场"; | 218 | String sheetName="停车场"; |
| 212 | String fileName = "停车场信息"; | 219 | String fileName = "停车场信息"; |
| @@ -217,13 +224,15 @@ public class ParkLotManageController extends BizController{ | @@ -217,13 +224,15 @@ public class ParkLotManageController extends BizController{ | ||
| 217 | //3.填充数据 | 224 | //3.填充数据 |
| 218 | List<Object[]> contentList=new ArrayList<Object[]>(); | 225 | List<Object[]> contentList=new ArrayList<Object[]>(); |
| 219 | List<ParkingLotDTO> list = bizResult.getData().getDataList(); | 226 | List<ParkingLotDTO> list = bizResult.getData().getDataList(); |
| 220 | - for (ParkingLotDTO e: list) { | ||
| 221 | - Object[] obj=new Object[title.length]; | ||
| 222 | - int index=0; | ||
| 223 | - obj[index++]=e.getPlNo(); | ||
| 224 | - obj[index++]=e.getPlName(); | ||
| 225 | - | ||
| 226 | - contentList.add(obj); | 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 | + } | ||
| 227 | } | 236 | } |
| 228 | ExcleFillDateManager fillUserManager=new ExcleFillDateManager(); | 237 | ExcleFillDateManager fillUserManager=new ExcleFillDateManager(); |
| 229 | fillUserManager.fillSalesOrga(workSheet,title,contentList,2); | 238 | fillUserManager.fillSalesOrga(workSheet,title,contentList,2); |
src/main/resources/dubbo/dubbo-park-consumer.xml
| @@ -157,4 +157,14 @@ | @@ -157,4 +157,14 @@ | ||
| 157 | <dubbo:reference id="berthManageService" interface="com.zteits.clouds.api.service.park.BerthManageService" | 157 | <dubbo:reference id="berthManageService" interface="com.zteits.clouds.api.service.park.BerthManageService" |
| 158 | version="${spring.dubbo.provider.version}" | 158 | version="${spring.dubbo.provider.version}" |
| 159 | timeout="30000"/> | 159 | timeout="30000"/> |
| 160 | + | ||
| 161 | + <!--企业云平台-设备管理 -pda管理--> | ||
| 162 | + <dubbo:reference id="tpPPdaService" interface="com.zteits.clouds.api.service.park.TpPPdaService" | ||
| 163 | + version="${spring.dubbo.provider.version}" | ||
| 164 | + timeout="30000"/> | ||
| 165 | + | ||
| 166 | + <dubbo:reference id="tpPTgsPassedcarService" interface="com.zteits.clouds.api.service.park.TpPTgsPassedcarService" | ||
| 167 | + version="${spring.dubbo.provider.version}" | ||
| 168 | + timeout="30000"/> | ||
| 169 | + | ||
| 160 | </beans> | 170 | </beans> |
| 161 | \ No newline at end of file | 171 | \ No newline at end of file |