old mode 100644
new mode 100755
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public ResponseEntity<String> importExcelData2(IPageData pd, MultipartFile uploadFile) { |
| | | try { |
| | | ComponentValidateResult result = this.validateStoreStaffCommunityRelationship(pd, restTemplate); |
| | | |
| | | //InputStream is = uploadFile.getInputStream(); |
| | | |
| | | Workbook workbook = ImportExcelUtils.createWorkbook(uploadFile); //工作簿 |
| | | |
| | | List<ImportExportMeterWaterDto> rooms = new ArrayList<ImportExportMeterWaterDto>(); |
| | | |
| | | //获取楼信息 |
| | | getRooms(workbook, rooms); |
| | | // 保存数据 |
| | | return dealExcelData(pd, rooms, result); |
| | | } catch (Exception e) { |
| | | logger.error("导入失败 ", e); |
| | | return new ResponseEntity<String>("非常抱歉,您填写的模板数据有误:" + e.getMessage(), HttpStatus.BAD_REQUEST); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理ExcelData数据 |
| | | */ |
| | |
| | | |
| | | String apiUrl = ServiceConstant.SERVICE_API_URL + "/api/meterWater/importMeterWater"; |
| | | |
| | | this.callCenterService(restTemplate, pd, data.toJSONString(), apiUrl, HttpMethod.POST); |
| | | ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, data.toJSONString(), apiUrl, HttpMethod.POST); |
| | | |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | throw new IllegalArgumentException(responseEntity.getBody()); |
| | | } |
| | | |
| | | JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody()); |
| | | if (ResultVo.CODE_OK != paramOut.getInteger("code")) { |
| | | throw new IllegalArgumentException(paramOut.getString("msg")); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | String startTime = excelDoubleToDate(os[4].toString()); |
| | | String endTime = excelDoubleToDate(os[6].toString()); |
| | | Assert.isDate(startTime, DateUtil.DATE_FORMATE_STRING_A, (osIndex + 1) + "行开始时间格式错误 请填写YYYY-MM-DD hh:mm:ss 文本格式"); |
| | | Assert.isDate(endTime, DateUtil.DATE_FORMATE_STRING_A, (osIndex + 1) + "行结束时间格式错误 请填写YYYY-MM-DD hh:mm:ss 文本格式"); |
| | | Assert.isDate(startTime, DateUtil.DATE_FORMATE_STRING_B, (osIndex + 1) + "行开始时间格式错误 请填写YYYY-MM-DD 文本格式"); |
| | | Assert.isDate(endTime, DateUtil.DATE_FORMATE_STRING_B, (osIndex + 1) + "行结束时间格式错误 请填写YYYY-MM-DD 文本格式"); |
| | | |
| | | |
| | | importRoomFee = new ImportExportMeterWaterDto(); |
| | |
| | | importRoomFee.setRoomNum(os[2].toString()); |
| | | importRoomFee.setPreDegrees(os[3].toString()); |
| | | importRoomFee.setPreReadingTime(startTime); |
| | | importRoomFee.setCurDegrees(endTime); |
| | | importRoomFee.setCurReadingTime(os[6].toString()); |
| | | importRoomFee.setCurDegrees(os[5].toString()); |
| | | importRoomFee.setCurReadingTime(endTime); |
| | | rooms.add(importRoomFee); |
| | | } |
| | | } |