| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.importData.DefaultImportDataAdapt; |
| | | import com.java110.api.importData.IImportDataCleaningAdapt; |
| | | import com.java110.dto.importData.Vtil; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.system.ComponentValidateResult; |
| | | import com.java110.intf.user.IOwnerV1InnerServiceSMO; |
| | |
| | | |
| | | return ownerCars; |
| | | } |
| | | public String defaultValue(Object o) { |
| | | return o == null ? "" : o.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 获取业主车辆信息 |
| | |
| | | */ |
| | | private void getOwnerCars(Workbook workbook, List<OwnerCarDto> ownerCars, ComponentValidateResult result) throws ParseException { |
| | | Sheet sheet = null; |
| | | sheet = ImportExcelUtils.getSheet(workbook, "地面停车费 导入新模板 "); |
| | | sheet = ImportExcelUtils.getSheet(workbook, "地面停车费 导入新模板"); |
| | | List<Object[]> oList = ImportExcelUtils.listFromSheet(sheet); |
| | | OwnerCarDto importOwnerCar = null; |
| | | for (int osIndex = 0; osIndex < oList.size(); osIndex++) { |
| | | Object[] os = oList.get(osIndex); |
| | | if (osIndex <= 6) { // 第一行是 头部信息 直接跳过 |
| | | if (osIndex < 3) { // 第一行是 头部信息 直接跳过 |
| | | continue; |
| | | } |
| | | if (StringUtil.isNullOrNone(os[0])) { |
| | | continue; |
| | | } |
| | | Assert.hasValue(os[8], (osIndex + 1) + "车牌号不能为空"); |
| | | Assert.hasValue(os[1], (osIndex + 1) + "项目编码不能为空"); |
| | | Assert.hasValue(os[10], (osIndex + 1) + "业主不能为空"); |
| | | // Assert.hasValue(os[8], (osIndex + 1) + "行车牌号不能为空"); |
| | | if (os[8] == null || os[8].equals("")) { |
| | | os[8] = "空"; |
| | | } |
| | | if (defaultValue(os[1]).isEmpty() && defaultValue(os[2]).isEmpty()) { |
| | | throw new IllegalArgumentException((osIndex + 1) + "行小区编码和小区名称必填其一"); |
| | | } |
| | | // Assert.hasValue(os[10], (osIndex + 1) + "行业主不能为空"); |
| | | // Assert.hasValue(os[2], (osIndex + 1) + "手机号不能为空"); |
| | | // Assert.hasValue(os[3], (osIndex + 1) + "车辆品牌不能为空"); |
| | | // Assert.hasValue(os[4], (osIndex + 1) + "车辆类型不能为空"); |
| | |
| | | // Assert.hasValue(os[6], (osIndex + 1) + "颜色不能为空"); |
| | | // Assert.hasValue(os[7], (osIndex + 1) + "停车场不能为空"); |
| | | // Assert.hasValue(os[8], (osIndex + 1) + "车位不能为空"); |
| | | Assert.hasValue(os[14], (osIndex + 1) + "起租时间不能为空"); |
| | | Assert.hasValue(os[15], (osIndex + 1) + "截止时间不能为空"); |
| | | Assert.hasValue(os[12], (osIndex + 1) + "停车类型不能为空"); |
| | | // Assert.hasValue(os[14], (osIndex + 1) + "行起租时间不能为空"); |
| | | // Assert.hasValue(os[15], (osIndex + 1) + "截止时间不能为空"); |
| | | Assert.hasValue(os[12], (osIndex + 1) + "行停车类型不能为空"); |
| | | // Assert.hasValue(os[11], (osIndex + 1) + "停车场类型不能为空"); |
| | | String startTime = os.length >= 14 && os[14] != null ? excelDoubleToDate(os[14].toString()):""; |
| | | String endTime = os.length >= 15 && os[15] != null ? excelDoubleToDate(os[15].toString()):""; |
| | | String startTime = os.length > 14 && os[14] != null ? Vtil.defaultValueToDate(os[14], "start") : null; |
| | | String endTime = os.length > 15 && os[15] != null ? Vtil.defaultValueToDate(os[15], "end") : null; |
| | | // 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文本格式"); |
| | | importOwnerCar = new OwnerCarDto(); |
| | | importOwnerCar.setCarNum(os[8].toString().trim()); |
| | | importOwnerCar.setOwnerName(os[10].toString().trim()); |
| | | importOwnerCar.setCarNum(defaultValue(os[8]).trim()); |
| | | importOwnerCar.setOwnerName(defaultValue(os[10]).trim()); |
| | | importOwnerCar.setLink(os.length <= 11 || os[11] == null ? "" : os[11].toString().trim()); |
| | | // importOwnerCar.setCarBrand(os.length <= 3 || os[3] == null ? "" : os[3].toString().trim()); |
| | | importOwnerCar.setCarType("9901"); |
| | |
| | | importOwnerCar.setCommunityId(result.getCommunityId()); |
| | | importOwnerCar.setUserId(result.getUserId()); |
| | | importOwnerCar.setOtherItem(os); |
| | | importOwnerCar.setRoadName(defaultValue(os[3])); |
| | | importOwnerCar.setFloorNum(defaultValue(os[4])); |
| | | importOwnerCar.setUnitNum(defaultValue(os[5])); |
| | | importOwnerCar.setRoomNum(defaultValue(os[6])); |
| | | ownerCars.add(importOwnerCar); |
| | | } |
| | | |
| | |
| | | importOwnerCar = null; |
| | | for (int osIndex = 0; osIndex < oList.size(); osIndex++) { |
| | | Object[] os = oList.get(osIndex); |
| | | if (osIndex <= 6) { // 第一行是 头部信息 直接跳过 |
| | | if (osIndex < 3) { // 第一行是 头部信息 直接跳过 |
| | | continue; |
| | | } |
| | | if (StringUtil.isNullOrNone(os[0])) { |
| | | continue; |
| | | } |
| | | Assert.hasValue(os[8], (osIndex + 1) + "车牌号不能为空"); |
| | | Assert.hasValue(os[1], (osIndex + 1) + "项目编码不能为空"); |
| | | Assert.hasValue(os[10], (osIndex + 1) + "业主不能为空"); |
| | | // Assert.hasValue(os[8], (osIndex + 1) + "行车牌号不能为空"); |
| | | if (os[8] == null || os[8].equals("")) { |
| | | os[8] = "空"; |
| | | } |
| | | if (defaultValue(os[1]).isEmpty() && defaultValue(os[2]).isEmpty()) { |
| | | throw new IllegalArgumentException((osIndex + 1) + "行小区编码和小区名称必填其一"); |
| | | } |
| | | // Assert.hasValue(os[10], (osIndex + 1) + "行业主不能为空"); |
| | | // Assert.hasValue(os[2], (osIndex + 1) + "手机号不能为空"); |
| | | // Assert.hasValue(os[3], (osIndex + 1) + "车辆品牌不能为空"); |
| | | // Assert.hasValue(os[4], (osIndex + 1) + "车辆类型不能为空"); |
| | |
| | | // Assert.hasValue(os[6], (osIndex + 1) + "颜色不能为空"); |
| | | // Assert.hasValue(os[7], (osIndex + 1) + "停车场不能为空"); |
| | | // Assert.hasValue(os[8], (osIndex + 1) + "车位不能为空"); |
| | | Assert.hasValue(os[14], (osIndex + 1) + "起租时间不能为空"); |
| | | Assert.hasValue(os[15], (osIndex + 1) + "截止时间不能为空"); |
| | | Assert.hasValue(os[12], (osIndex + 1) + "停车类型不能为空"); |
| | | // Assert.hasValue(os[14], (osIndex + 1) + "行起租时间不能为空"); |
| | | // Assert.hasValue(os[15], (osIndex + 1) + "截止时间不能为空"); |
| | | Assert.hasValue(os[12], (osIndex + 1) + "行停车类型不能为空"); |
| | | // Assert.hasValue(os[11], (osIndex + 1) + "停车场类型不能为空"); |
| | | String startTime = os.length >= 14 && os[14] != null ? excelDoubleToDate(os[14].toString()):""; |
| | | String endTime = os.length >= 15 && os[15] != null ? excelDoubleToDate(os[15].toString()):""; |
| | | String startTime = os.length > 14 && os[14] != null ? Vtil.defaultValueToDate(os[14], "start") : null; |
| | | String endTime = os.length > 15 && os[15] != null ? Vtil.defaultValueToDate(os[15], "end") : null; |
| | | // 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文本格式"); |
| | | importOwnerCar = new OwnerCarDto(); |
| | | importOwnerCar.setCarNum(os[8].toString().trim()); |
| | | importOwnerCar.setOwnerName(os[10].toString().trim()); |
| | | importOwnerCar.setCarNum(defaultValue(os[8]).trim()); |
| | | importOwnerCar.setOwnerName(defaultValue(os[10]).trim()); |
| | | importOwnerCar.setLink(os.length <= 11 || os[11] == null ? "" : os[11].toString().trim()); |
| | | // importOwnerCar.setCarBrand(os.length <= 3 || os[3] == null ? "" : os[3].toString().trim()); |
| | | importOwnerCar.setCarType("9901"); |
| | |
| | | importOwnerCar.setCommunityId(result.getCommunityId()); |
| | | importOwnerCar.setUserId(result.getUserId()); |
| | | importOwnerCar.setOtherItem(os); |
| | | importOwnerCar.setRoadName(defaultValue(os[3])); |
| | | importOwnerCar.setFloorNum(defaultValue(os[4])); |
| | | importOwnerCar.setUnitNum(defaultValue(os[5])); |
| | | importOwnerCar.setRoomNum(defaultValue(os[6])); |
| | | importOwnerCar.setParkingType(defaultValue(os[12])); |
| | | ownerCars.add(importOwnerCar); |
| | | } |
| | | } |