Commit 533c866aa427e4e8133b9b129c0cdd34829359e4

Authored by atao
1 parent f57e98ab

提交代码

src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/devicemanagement/PdaController.java
... ... @@ -2,25 +2,16 @@ package com.zteits.irain.portal.web.parkinglotcloudplatform.devicemanagement;
2 2  
3 3 import java.io.IOException;
4 4 import java.util.ArrayList;
  5 +import java.util.Date;
5 6 import java.util.List;
6 7  
7 8 import javax.servlet.http.HttpServletRequest;
8 9 import javax.servlet.http.HttpServletResponse;
9 10  
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.RequestMapping;
19   -import org.springframework.web.bind.annotation.RequestParam;
20   -import org.springframework.web.bind.annotation.RestController;
21   -import org.springframework.web.multipart.MultipartFile;
  11 +import com.alibaba.fastjson.JSONObject;
22 12  
23 13 import com.clouds.common.utils.DateUtil;
  14 +import com.clouds.common.utils.ResultUtils;
24 15 import com.clouds.common.utils.excle.ExcelReadUtil;
25 16 import com.clouds.common.utils.excle.ExcelUtil;
26 17 import com.clouds.common.utils.excle.ExcleFillDateManager;
... ... @@ -42,217 +33,291 @@ import com.zteits.clouds.api.dto.park.param.TpPTgsPassedcarRequest;
42 33 import com.zteits.clouds.api.service.park.TpPPdaService;
43 34 import com.zteits.clouds.api.service.park.TpPTgsPassedcarService;
44 35 import com.zteits.irain.portal.web.parkinglotcloudplatform.datastatistic.InOutParkStatisticController;
45   -
46 36 import io.swagger.annotations.ApiOperation;
  37 +import org.apache.poi.xssf.usermodel.XSSFSheet;
  38 +import org.slf4j.Logger;
  39 +import org.slf4j.LoggerFactory;
  40 +import org.springframework.beans.factory.annotation.Autowired;
  41 +import org.springframework.beans.factory.annotation.Value;
  42 +import org.springframework.format.annotation.DateTimeFormat;
  43 +import org.springframework.web.bind.annotation.GetMapping;
  44 +import org.springframework.web.bind.annotation.PostMapping;
  45 +import org.springframework.web.bind.annotation.RequestBody;
  46 +import org.springframework.web.bind.annotation.RequestMapping;
  47 +import org.springframework.web.bind.annotation.RequestParam;
  48 +import org.springframework.web.bind.annotation.RestController;
  49 +import org.springframework.web.multipart.MultipartFile;
47 50  
48 51 /**
49 52 * PDA管理控制器
50   - *
  53 + *
51 54 * Copyright: Copyright (c) 2017 ZTE-ITS
52   - *
  55 + *
53 56 * @ClassName: PdaController.java
54   - * @Description:
  57 + * @Description:
55 58 * @version: v1.0.0
56 59 * @author: wangbiao
57   - * @date: 2017年8月31日 下午3:05:03
  60 + * @date: 2017年8月31日 下午3:05:03
58 61 * Modification History:
59 62 * Date Author Version Description
60   - *---------------------------------------------------------*
  63 + * ---------------------------------------------------------*
61 64 * 2017年8月31日 wangbiao v1.0.0 创建
62 65 */
63 66 @RestController
64 67 @RequestMapping("/padinfo")
65 68 public class PdaController extends BizController {
66   -
67   - private static final Logger logger = LoggerFactory.getLogger(InOutParkStatisticController.class);
68   -
69   - @Autowired
70   - private TpPPdaService tpPPdaService;
71   - @Autowired
72   - private TpPTgsPassedcarService tpPTgsPassedcarService;
73   -
74   - @Value("${project.syscode}")
  69 +
  70 + private static final Logger logger = LoggerFactory.getLogger(InOutParkStatisticController.class);
  71 +
  72 + @Autowired
  73 + private TpPPdaService tpPPdaService;
  74 + @Autowired
  75 + private TpPTgsPassedcarService tpPTgsPassedcarService;
  76 +
  77 + @Value("${project.syscode}")
75 78 private String sysCode;
76   -
77   -
78   -
79   - @ApiOperation("过车查询")
80   - @PostMapping("/queryPassedca4pabe")
81   - public BizResultVO<EasyUIDataGridVO<TpPTgsPassedcarDTO>> queryPassedca4pabe(@RequestBody TpPTgsPassedcarRequest tpPTgsPassedcarRequest, HttpServletRequest request,
82   - HttpServletResponse response){
83   - BizResult<PageBean<TpPTgsPassedcarDTO>> bizResult = new BizResult<PageBean<TpPTgsPassedcarDTO>>();
84   - try {
85   - tpPTgsPassedcarRequest.setSysCode(sysCode);
86   - bizResult = tpPTgsPassedcarService.queryPassedcar4Page(tpPTgsPassedcarRequest);
87   - if(bizResult.isSuccess()){
88   - return returnJqGridData(bizResult, TpPTgsPassedcarDTO.class);
89   - }
90   - } catch (Exception e) {
91   - logger.debug("分页查询过车信息异常:{}",bizResult.getErrMsg());
92   - }
93   - return new BizResultVO<EasyUIDataGridVO<TpPTgsPassedcarDTO>>();
94   - }
95   -
96   - @ApiOperation("PDA信息信息")
97   - @PostMapping("/queryPdaInfo4pabe")
98   - public BizResultVO<EasyUIDataGridVO<TpPPdaDTO>> queryPdaInfo4pabe(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request,
99   - HttpServletResponse response){
100   - BizResult<PageBean<TpPPdaDTO>> bizResult = new BizResult<PageBean<TpPPdaDTO>>();
101   - try {
102   - tpPPdaRequest.setSysCode(sysCode);
103   - bizResult = tpPPdaService.queryPdaInfo4pabe(tpPPdaRequest);
104   - if(bizResult.isSuccess()){
105   - return returnJqGridData(bizResult, TpPPdaDTO.class);
106   - }
107   - } catch (Exception e) {
108   - logger.debug("分页查询pda信息异常:{}",bizResult.getErrMsg());
109   - }
110   - return new BizResultVO<EasyUIDataGridVO<TpPPdaDTO>>();
111   - }
112   -
113   - @ApiOperation("新增PDA信息信息")
114   - @PostMapping("/insertPda")
115   - public BizResultVO<Integer> insertPda(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request,
116   - HttpServletResponse response){
117   - tpPPdaRequest.setSysCode(sysCode);
118   - BizResult<Integer> bizResult = tpPPdaService.insertPda(tpPPdaRequest);
119   - if(bizResult.isSuccess()){
120   - return new BizResultVO<Integer>(bizResult);
121   - }else{
122   - logger.debug("新增PDA信息信息异常 :{}",bizResult.getErrMsg());
123   - }
124   - return new BizResultVO<Integer>();
125   - }
126   -
127   - @ApiOperation("删除PDA信息信息")
128   - @PostMapping("/deletePda")
129   - public BizResultVO<Integer> deletePda(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request,
130   - HttpServletResponse response){
131   - tpPPdaRequest.setSysCode(sysCode);
132   - BizResult<Integer> bizResult = tpPPdaService.deletetPda(tpPPdaRequest);
133   - if(bizResult.isSuccess()){
134   - return new BizResultVO<Integer>(bizResult);
135   - }else{
136   - logger.debug("删除PDA信息信息异常 :{}",bizResult.getErrMsg());
137   - }
138   - return new BizResultVO<Integer>();
139   - }
140   -
141   - @ApiOperation("删除PDA信息信息")
142   - @PostMapping("/deleteBatchPda")
143   - public BizResultVO<Integer> deleteBatchPda(@RequestBody TpPPdaSRequest tpPPdaSRequest, HttpServletRequest request,
144   - HttpServletResponse response){
145   - tpPPdaSRequest.setSysCode(sysCode);
146   - BizResult<Integer> bizResult = tpPPdaService.deleteBatchPda(tpPPdaSRequest);
147   - if(bizResult.isSuccess()){
148   - return new BizResultVO<Integer>(bizResult);
149   - }else{
150   - logger.debug("删除PDA信息信息异常 :{}",bizResult.getErrMsg());
151   - }
152   - return new BizResultVO<Integer>();
153   - }
154   -
155   - @ApiOperation("根据id查询PDA信息")
156   - @PostMapping("/queryPdaById")
157   - public BizResultVO<TpPPdaDTO> queryPdaById(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request,
158   - HttpServletResponse response){
159   - tpPPdaRequest.setSysCode(sysCode);
160   - BizResult<TpPPdaDTO> bizResult = tpPPdaService.queryPdaById(tpPPdaRequest);
161   - if(bizResult.isSuccess()){
162   - return new BizResultVO<TpPPdaDTO>(bizResult);
163   - }else{
164   - logger.debug("根据id查询PDA信息异常 :{}",bizResult.getErrMsg());
165   - }
166   - return new BizResultVO<TpPPdaDTO>();
167   - }
168   -
169   - @ApiOperation("修改PDA信息")
170   - @PostMapping("/updatePda")
171   - public BizResultVO<Integer> updatePda(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request,
172   - HttpServletResponse response){
173   - tpPPdaRequest.setSysCode(sysCode);
174   - BizResult<Integer> bizResult = tpPPdaService.updatePda(tpPPdaRequest);
175   - if(bizResult.isSuccess()){
176   - return new BizResultVO<Integer>(bizResult);
177   - }else{
178   - logger.debug("修改PDA信息异常 :{}",bizResult.getErrMsg());
179   - }
180   - return new BizResultVO<Integer>();
181   - }
182   -
183   - @ApiOperation("pda信息导出excel")
184   - @GetMapping("exportBerthInfoExcel")
185   - public void exportBerthInfoExcel(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest requests, HttpServletResponse response) {
186   - tpPPdaRequest.setSysCode(sysCode);
187   - BizResult<List<TpPPdaDTO>> list = tpPPdaService.queryPdaInfo(tpPPdaRequest);
188   - String[] title = new String[] { "序号","设备编号", "设备名称", "设备类型", "状态","持有人","资源描述" };
189   - String sheetName = "PDA信息";
190   - String fileName = sheetName+DateUtil.getDate();
191   - // 1.创建excel信息
192   - XSSFSheet workSheet = ExcelUtil.createExcel(fileName);
193   - // 2.设置excel表头和表体
194   - Layouter.buildReport(workSheet, title, 0, 0);
195   - // 3.填充数据
196   - List<Object[]> contentList = new ArrayList<Object[]>();
197   - int number = 1;
198   - if(list.isSuccess() && CollectionUtil.isNotEmpty(list.getData())){
199   - for (TpPPdaDTO b : list.getData()) {
200   - Object[] obj = new Object[title.length];
201   - int index = 0;
202   - obj[index++] = number++;
203   - obj[index++] = b.getId();
204   - obj[index++] = b.getPdaNo();
205   - obj[index++] = b.getPdaName();
206   - obj[index++] = b.getPdaType();
207   - obj[index++] = b.getPdaStatus();
208   - obj[index++] = b.getOwnerName();
209   - obj[index++] = b.getRemark();
210   - contentList.add(obj);
211   - }
212   - }
213   - ExcleFillDateManager fillUserManager = new ExcleFillDateManager();
214   - fillUserManager.fillSalesOrga(workSheet, title, contentList, 2);
215   - // 4.excel输出配置
216   - ExcelUtil.write(response, workSheet, fileName);
217   - }
218   -
219   -
220   - @ApiOperation("pda信息 导入模板下载")
221   - @GetMapping("exportModelExcel")
222   - public void exportModelExcel(HttpServletRequest requests, HttpServletResponse response) {
223   - String[] title = new String[] { "设备编号", "设备名称", "设备类型","停车场编号","sim卡号","持有人编号","持有人名称","状态","资源描述" };
224   - String fileName = "PDA信息导入模板";
225   - // 1.创建excel信息
226   - XSSFSheet workSheet = ExcelUtil.createExcel(fileName);
227   - // 2.设置excel表头和表体
228   - Layouter.buildReport(workSheet, title, 0, 0);
229   - // 3.填充数据
230   - ExcleFillDateManager fillUserManager = new ExcleFillDateManager();
231   - fillUserManager.fillSalesOrga(workSheet, title, Lists.newArrayList(), 2);
232   - // 4.excel输出配置
233   - ExcelUtil.write(response, workSheet, fileName);
234   - }
235   -
236   -
237   - @PostMapping("/importPda")
238   - public BizResultVO<Integer> importPda(@RequestParam(value="excelFile") MultipartFile file,HttpServletRequest request) throws IOException{
239   - if(file==null){
240   - throw new BizException(ErrorType.PARAMM_NULL, "导入文件不能为空");
241   - }
  79 +
  80 + @ApiOperation("过车查询")
  81 + @PostMapping("/queryPassedca4pabe")
  82 + public BizResultVO<EasyUIDataGridVO<TpPTgsPassedcarDTO>> queryPassedca4pabe(
  83 + @RequestBody TpPTgsPassedcarRequest tpPTgsPassedcarRequest, HttpServletRequest request,
  84 + HttpServletResponse response) {
  85 + BizResult<PageBean<TpPTgsPassedcarDTO>> bizResult = new BizResult<PageBean<TpPTgsPassedcarDTO>>();
  86 + try {
  87 + tpPTgsPassedcarRequest.setSysCode(sysCode);
  88 + bizResult = tpPTgsPassedcarService.queryPassedcar4Page(tpPTgsPassedcarRequest);
  89 + if (bizResult.isSuccess()) {
  90 + return returnJqGridData(bizResult, TpPTgsPassedcarDTO.class);
  91 + }
  92 + } catch (Exception e) {
  93 + logger.debug("分页查询过车信息异常:{}", bizResult.getErrMsg());
  94 + }
  95 + return new BizResultVO<EasyUIDataGridVO<TpPTgsPassedcarDTO>>();
  96 + }
  97 +
  98 + @ApiOperation("过车信息下载")
  99 + @GetMapping("/exportPassCarInfoExcel")
  100 + public void exportPassCarInfoExcel(@RequestParam String clicensetype, @RequestParam String ccarnumber,
  101 + @RequestParam String s_dcollectiondate, @DateTimeFormat
  102 + @RequestParam String e_dcollectiondate, @RequestParam String cdevicecodes, HttpServletRequest request,
  103 + HttpServletResponse response) {
  104 + TpPTgsPassedcarRequest req = new TpPTgsPassedcarRequest();
  105 + req.setCcarnumber(ccarnumber);
  106 + if(null !=cdevicecodes){
  107 + List<String> data = JSONObject.parseArray(cdevicecodes,String.class);
  108 + req.setCdevicecodes(data);
  109 + }
  110 + req.setClicensetype(clicensetype);
  111 + if(null != s_dcollectiondate){
  112 + req.setS_dcollectiondate(new Date(Long.parseLong(s_dcollectiondate)));
  113 + }
  114 +
  115 + if(null != e_dcollectiondate){
  116 + req.setE_dcollectiondate(new Date(Long.parseLong(e_dcollectiondate)));
  117 + }
  118 +
  119 + //设置导出信息
  120 + req.getBaseRequest().setPageNum(1);
  121 + req.getBaseRequest().setPageSize(0);
  122 + req.setSysCode(sysCode);
  123 + BizResult<PageBean<TpPTgsPassedcarDTO>> bizResult = tpPTgsPassedcarService.queryPassedcar4Page(req);
  124 + if (ResultUtils.isError(bizResult)) {
  125 + return;
  126 + }
  127 + List<TpPTgsPassedcarDTO> listData = bizResult.getData().getDataList();
  128 +
  129 + String[] title = new String[] {"车牌号", "停车点", "车辆类型", "采集时间", "车道", "车速", "行驶方向"};
  130 + String sheetName = "过车信息";
  131 + String fileName = sheetName + com.xiaoleilu.hutool.date.DateUtil.format(new Date(),
  132 + com.xiaoleilu.hutool.date.DateUtil.NORM_DATETIME_PATTERN);
  133 + // 1.创建excel信息
  134 + XSSFSheet workSheet = ExcelUtil.createExcel(sheetName);
  135 + // 2.设置excel表头和表体
  136 + Layouter.buildReport(workSheet, title, 0, 0);
  137 + // 3.填充数据
  138 + List<Object[]> contentList = new ArrayList<Object[]>();
  139 + int number = 1;
  140 + for (TpPTgsPassedcarDTO b : listData) {
  141 + Object[] obj = new Object[title.length];
  142 + int index = 0;
  143 + obj[index++] = b.getCcarnumber();
  144 + obj[index++] = b.getCdevicecode();
  145 + obj[index++] = b.getClicensetype();
  146 + obj[index++] = b.getDcollectiondate() == null ? "" : com.xiaoleilu.hutool.date.DateUtil.format(
  147 + b.getDcollectiondate(), com.xiaoleilu.hutool.date.DateUtil.NORM_DATETIME_PATTERN);
  148 + obj[index++] = b.getClanenumber();
  149 + obj[index++] = b.getNvehiclespeed();
  150 + obj[index++] = b.getNderictrion();
  151 + contentList.add(obj);
  152 + }
  153 + ExcleFillDateManager fillUserManager = new ExcleFillDateManager();
  154 + fillUserManager.fillSalesOrga(workSheet, title, contentList, 2);
  155 + // 4.excel输出配置
  156 + ExcelUtil.write(response, workSheet, fileName);
  157 +
  158 + }
  159 +
  160 + @ApiOperation("PDA信息信息")
  161 + @PostMapping("/queryPdaInfo4pabe")
  162 + public BizResultVO<EasyUIDataGridVO<TpPPdaDTO>> queryPdaInfo4pabe(@RequestBody TpPPdaRequest tpPPdaRequest,
  163 + HttpServletRequest request,
  164 + HttpServletResponse response) {
  165 + BizResult<PageBean<TpPPdaDTO>> bizResult = new BizResult<PageBean<TpPPdaDTO>>();
  166 + try {
  167 + tpPPdaRequest.setSysCode(sysCode);
  168 + bizResult = tpPPdaService.queryPdaInfo4pabe(tpPPdaRequest);
  169 + if (bizResult.isSuccess()) {
  170 + return returnJqGridData(bizResult, TpPPdaDTO.class);
  171 + }
  172 + } catch (Exception e) {
  173 + logger.debug("分页查询pda信息异常:{}", bizResult.getErrMsg());
  174 + }
  175 + return new BizResultVO<EasyUIDataGridVO<TpPPdaDTO>>();
  176 + }
  177 +
  178 + @ApiOperation("新增PDA信息信息")
  179 + @PostMapping("/insertPda")
  180 + public BizResultVO<Integer> insertPda(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request,
  181 + HttpServletResponse response) {
  182 + tpPPdaRequest.setSysCode(sysCode);
  183 + BizResult<Integer> bizResult = tpPPdaService.insertPda(tpPPdaRequest);
  184 + if (bizResult.isSuccess()) {
  185 + return new BizResultVO<Integer>(bizResult);
  186 + } else {
  187 + logger.debug("新增PDA信息信息异常 :{}", bizResult.getErrMsg());
  188 + }
  189 + return new BizResultVO<Integer>();
  190 + }
  191 +
  192 + @ApiOperation("删除PDA信息信息")
  193 + @PostMapping("/deletePda")
  194 + public BizResultVO<Integer> deletePda(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request,
  195 + HttpServletResponse response) {
  196 + tpPPdaRequest.setSysCode(sysCode);
  197 + BizResult<Integer> bizResult = tpPPdaService.deletetPda(tpPPdaRequest);
  198 + if (bizResult.isSuccess()) {
  199 + return new BizResultVO<Integer>(bizResult);
  200 + } else {
  201 + logger.debug("删除PDA信息信息异常 :{}", bizResult.getErrMsg());
  202 + }
  203 + return new BizResultVO<Integer>();
  204 + }
  205 +
  206 + @ApiOperation("删除PDA信息信息")
  207 + @PostMapping("/deleteBatchPda")
  208 + public BizResultVO<Integer> deleteBatchPda(@RequestBody TpPPdaSRequest tpPPdaSRequest, HttpServletRequest request,
  209 + HttpServletResponse response) {
  210 + tpPPdaSRequest.setSysCode(sysCode);
  211 + BizResult<Integer> bizResult = tpPPdaService.deleteBatchPda(tpPPdaSRequest);
  212 + if (bizResult.isSuccess()) {
  213 + return new BizResultVO<Integer>(bizResult);
  214 + } else {
  215 + logger.debug("删除PDA信息信息异常 :{}", bizResult.getErrMsg());
  216 + }
  217 + return new BizResultVO<Integer>();
  218 + }
  219 +
  220 + @ApiOperation("根据id查询PDA信息")
  221 + @PostMapping("/queryPdaById")
  222 + public BizResultVO<TpPPdaDTO> queryPdaById(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request,
  223 + HttpServletResponse response) {
  224 + tpPPdaRequest.setSysCode(sysCode);
  225 + BizResult<TpPPdaDTO> bizResult = tpPPdaService.queryPdaById(tpPPdaRequest);
  226 + if (bizResult.isSuccess()) {
  227 + return new BizResultVO<TpPPdaDTO>(bizResult);
  228 + } else {
  229 + logger.debug("根据id查询PDA信息异常 :{}", bizResult.getErrMsg());
  230 + }
  231 + return new BizResultVO<TpPPdaDTO>();
  232 + }
  233 +
  234 + @ApiOperation("修改PDA信息")
  235 + @PostMapping("/updatePda")
  236 + public BizResultVO<Integer> updatePda(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest request,
  237 + HttpServletResponse response) {
  238 + tpPPdaRequest.setSysCode(sysCode);
  239 + BizResult<Integer> bizResult = tpPPdaService.updatePda(tpPPdaRequest);
  240 + if (bizResult.isSuccess()) {
  241 + return new BizResultVO<Integer>(bizResult);
  242 + } else {
  243 + logger.debug("修改PDA信息异常 :{}", bizResult.getErrMsg());
  244 + }
  245 + return new BizResultVO<Integer>();
  246 + }
  247 +
  248 + @ApiOperation("pda信息导出excel")
  249 + @GetMapping("exportBerthInfoExcel")
  250 + public void exportBerthInfoExcel(@RequestBody TpPPdaRequest tpPPdaRequest, HttpServletRequest requests,
  251 + HttpServletResponse response) {
  252 + tpPPdaRequest.setSysCode(sysCode);
  253 + BizResult<List<TpPPdaDTO>> list = tpPPdaService.queryPdaInfo(tpPPdaRequest);
  254 + String[] title = new String[] {"序号", "设备编号", "设备名称", "设备类型", "状态", "持有人", "资源描述"};
  255 + String sheetName = "PDA信息";
  256 + String fileName = sheetName + DateUtil.getDate();
  257 + // 1.创建excel信息
  258 + XSSFSheet workSheet = ExcelUtil.createExcel(fileName);
  259 + // 2.设置excel表头和表体
  260 + Layouter.buildReport(workSheet, title, 0, 0);
  261 + // 3.填充数据
  262 + List<Object[]> contentList = new ArrayList<Object[]>();
  263 + int number = 1;
  264 + if (list.isSuccess() && CollectionUtil.isNotEmpty(list.getData())) {
  265 + for (TpPPdaDTO b : list.getData()) {
  266 + Object[] obj = new Object[title.length];
  267 + int index = 0;
  268 + obj[index++] = number++;
  269 + obj[index++] = b.getId();
  270 + obj[index++] = b.getPdaNo();
  271 + obj[index++] = b.getPdaName();
  272 + obj[index++] = b.getPdaType();
  273 + obj[index++] = b.getPdaStatus();
  274 + obj[index++] = b.getOwnerName();
  275 + obj[index++] = b.getRemark();
  276 + contentList.add(obj);
  277 + }
  278 + }
  279 + ExcleFillDateManager fillUserManager = new ExcleFillDateManager();
  280 + fillUserManager.fillSalesOrga(workSheet, title, contentList, 2);
  281 + // 4.excel输出配置
  282 + ExcelUtil.write(response, workSheet, fileName);
  283 + }
  284 +
  285 + @ApiOperation("pda信息 导入模板下载")
  286 + @GetMapping("exportModelExcel")
  287 + public void exportModelExcel(HttpServletRequest requests, HttpServletResponse response) {
  288 + String[] title = new String[] {"设备编号", "设备名称", "设备类型", "停车场编号", "sim卡号", "持有人编号", "持有人名称", "状态", "资源描述"};
  289 + String fileName = "PDA信息导入模板";
  290 + // 1.创建excel信息
  291 + XSSFSheet workSheet = ExcelUtil.createExcel(fileName);
  292 + // 2.设置excel表头和表体
  293 + Layouter.buildReport(workSheet, title, 0, 0);
  294 + // 3.填充数据
  295 + ExcleFillDateManager fillUserManager = new ExcleFillDateManager();
  296 + fillUserManager.fillSalesOrga(workSheet, title, Lists.newArrayList(), 2);
  297 + // 4.excel输出配置
  298 + ExcelUtil.write(response, workSheet, fileName);
  299 + }
  300 +
  301 + @PostMapping("/importPda")
  302 + public BizResultVO<Integer> importPda(@RequestParam(value = "excelFile") MultipartFile file,
  303 + HttpServletRequest request) throws IOException {
  304 + if (file == null) {
  305 + throw new BizException(ErrorType.PARAMM_NULL, "导入文件不能为空");
  306 + }
242 307 //读取Excel数据到List中
243   - List<ArrayList<String>> list = ExcelReadUtil.readExcel(file);
  308 + List<ArrayList<String>> list = ExcelReadUtil.readExcel(file);
244 309 //list中存的就是excel中的数据,可以根据excel中每一列的值转换成你所需要的值(从0开始),如:
245   - TpPPdaRequest tpPPdaRequest = null;
246   - List<TpPPdaRequest> padList = Lists.newArrayList();
247   - for(ArrayList<String> arr:list){
248   - tpPPdaRequest= new TpPPdaRequest();
249   - tpPPdaRequest.setPdaNo(arr.get(0));
250   - padList.add(tpPPdaRequest);
  310 + TpPPdaRequest tpPPdaRequest = null;
  311 + List<TpPPdaRequest> padList = Lists.newArrayList();
  312 + for (ArrayList<String> arr : list) {
  313 + tpPPdaRequest = new TpPPdaRequest();
  314 + tpPPdaRequest.setPdaNo(arr.get(0));
  315 + padList.add(tpPPdaRequest);
251 316 }
252   - TpPPdaSRequest TpPPdaSRequest = new TpPPdaSRequest();
  317 + TpPPdaSRequest TpPPdaSRequest = new TpPPdaSRequest();
253 318 TpPPdaSRequest.setPadList(padList);
254 319 BizResult<Integer> rsInteger = tpPPdaService.insertBatchPda(TpPPdaSRequest);
255 320 return new BizResultVO<Integer>(rsInteger);
256 321 }
257   -
  322 +
258 323 }
... ...