| | |
| | | package com.java110.api.importData.adapt; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.importData.DefaultImportDataAdapt; |
| | | import com.java110.api.importData.IImportDataCleaningAdapt; |
| | | import com.java110.dto.importData.ImportOwnerRoomDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.dto.room.RoomDto; |
| | |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.ImportExcelUtils; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.api.importData.DefaultImportDataAdapt; |
| | | import com.java110.api.importData.IImportDataCleaningAdapt; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | Assert.hasValue(os[0], (osIndex + 1) + "行楼号不能为空"); |
| | | Assert.hasValue(os[1], (osIndex + 1) + "行单元不能为空"); |
| | | Assert.hasValue(os[2], (osIndex + 1) + "行房屋不能为空"); |
| | | Assert.hasValue(os[3], (osIndex + 1) + "行楼层不能为空"); |
| | | Assert.hasValue(os[4], (osIndex + 1) + "行总楼层不能为空"); |
| | | Assert.hasValue(os[5], (osIndex + 1) + "行是否有电梯不能为空"); |
| | | Assert.hasValue(os[6], (osIndex + 1) + "行房屋类型不能为空"); |
| | | Assert.hasValue(os[7], (osIndex + 1) + "行房屋户型不能为空"); |
| | | Assert.hasValue(os[8], (osIndex + 1) + "行建筑面积不能为空"); |
| | | Assert.hasValue(os[9], (osIndex + 1) + "行室内面积不能为空"); |
| | | Assert.hasValue(os[10], (osIndex + 1) + "行租金不能为空"); |
| | | Assert.hasValue(os[11], (osIndex + 1) + "行房屋状态不能为空"); |
| | | if (os.length > 12 && !StringUtil.isNullOrNone(os[12])) { |
| | | Assert.hasValue(os[12], (osIndex + 1) + "行业主名称不能为空"); |
| | | Assert.hasValue(os[13], (osIndex + 1) + "行性别不能为空"); |
| | | |
| | | Assert.hasValue(os[3], (osIndex + 1) + "门室号不能为空"); |
| | | |
| | | Assert.hasValue(os[4], (osIndex + 1) + "行楼层不能为空"); |
| | | Assert.hasValue(os[5], (osIndex + 1) + "行总楼层不能为空"); |
| | | |
| | | Assert.hasValue(os[6], (osIndex + 1) + "物业类型不能为空"); |
| | | Assert.hasValue(os[7], (osIndex + 1) + "产证地址不能为空"); |
| | | |
| | | Assert.hasValue(os[9], (osIndex + 1) + "行是否有电梯不能为空"); |
| | | Assert.hasValue(os[10], (osIndex + 1) + "行房屋类型不能为空"); |
| | | Assert.hasValue(os[11], (osIndex + 1) + "行房屋户型不能为空"); |
| | | Assert.hasValue(os[12], (osIndex + 1) + "行建筑面积不能为空"); |
| | | Assert.hasValue(os[13], (osIndex + 1) + "行室内面积不能为空"); |
| | | Assert.hasValue(os[14], (osIndex + 1) + "行租金不能为空"); |
| | | Assert.hasValue(os[15], (osIndex + 1) + "行房屋状态不能为空"); |
| | | if (os.length > 16 && !StringUtil.isNullOrNone(os[16])) { |
| | | Assert.hasValue(os[16], (osIndex + 1) + "行业主名称不能为空"); |
| | | // Assert.hasValue(os[14], (osIndex + 1) + "行年龄不能为空"); |
| | | Assert.hasValue(os[14], (osIndex + 1) + "行手机号不能为空"); |
| | | // Assert.hasValue(os[18], (osIndex + 1) + "行手机号不能为空"); |
| | | //Assert.hasValue(os[15], (osIndex + 1) + "行身份证不能为空"); |
| | | Assert.hasValue(os[16], (osIndex + 1) + "行业主类型不能为空"); |
| | | Assert.hasValue(os[20], (osIndex + 1) + "行业主类型不能为空"); |
| | | Assert.hasValue(os[21], (osIndex + 1) + "行人员类型不能为空"); |
| | | Assert.hasValue(os[22], (osIndex + 1) + "行人员角色不能为空"); |
| | | Assert.hasValue(os[23], (osIndex + 1) + "行联系人不能为空"); |
| | | } |
| | | |
| | | importOwnerRoomDto = new ImportOwnerRoomDto(); |
| | |
| | | importOwnerRoomDto.setFloorNum(os[0].toString().trim()); |
| | | importOwnerRoomDto.setUnitNum(os[1].toString().trim()); |
| | | importOwnerRoomDto.setRoomNum(os[2].toString().trim()); |
| | | importOwnerRoomDto.setLayer(os[3].toString().trim()); |
| | | importOwnerRoomDto.setLayerCount(os[4].toString().trim()); |
| | | |
| | | importOwnerRoomDto.setDoorRoomNum(os[3].toString().trim()); |
| | | |
| | | importOwnerRoomDto.setLayer(os[4].toString().trim()); |
| | | importOwnerRoomDto.setLayerCount(os[5].toString().trim()); |
| | | |
| | | importOwnerRoomDto.setPropertyType(os[6].toString().trim()); |
| | | importOwnerRoomDto.setPropertyAddress(os[7].toString().trim()); |
| | | importOwnerRoomDto.setHouseCertificateNo(os[8] == null ? "" : os[8].toString().trim()); |
| | | |
| | | //importOwnerRoomDto.setLift(os[5].toString().trim()); |
| | | importOwnerRoomDto.setLift("有".equals(os[5].toString().trim()) ? "1010" : "2020"); |
| | | importOwnerRoomDto.setRoomSubType(os[6].toString().trim()); |
| | | importOwnerRoomDto.setSection(os[7].toString().trim()); |
| | | importOwnerRoomDto.setBuiltUpArea(os[8].toString().trim()); |
| | | importOwnerRoomDto.setRoomArea(os[9].toString().trim()); |
| | | importOwnerRoomDto.setRoomRent(os[10].toString().trim()); |
| | | importOwnerRoomDto.setRoomState(os[11].toString().trim()); |
| | | if (os.length > 12 && !StringUtil.isNullOrNone(os[12])) { |
| | | importOwnerRoomDto.setOwnerName(os[12].toString().trim()); |
| | | importOwnerRoomDto.setSex("男".equals(os[13].toString().trim()) ? "0" : "1"); |
| | | importOwnerRoomDto.setLift("有".equals(os[9].toString().trim()) ? "1010" : "2020"); |
| | | importOwnerRoomDto.setRoomSubType(os[10].toString().trim()); |
| | | importOwnerRoomDto.setSection(os[11].toString().trim()); |
| | | importOwnerRoomDto.setBuiltUpArea(os[12].toString().trim()); |
| | | importOwnerRoomDto.setRoomArea(os[13].toString().trim()); |
| | | importOwnerRoomDto.setRoomRent(os[14].toString().trim()); |
| | | importOwnerRoomDto.setRoomState(os[15].toString().trim()); |
| | | if (os.length > 16 && !StringUtil.isNullOrNone(os[16])) { |
| | | importOwnerRoomDto.setOwnerName(os[16].toString().trim()); |
| | | importOwnerRoomDto.setSex(os[17] == null ? null : "男".equals(os[17].toString().trim()) ? "0" : "1"); |
| | | // String age = StringUtil.isNullOrNone(os[14]) ? CommonUtil.getAgeByCertId(os[16].toString().trim()) : os[14].toString().trim(); |
| | | importOwnerRoomDto.setAge("1"); |
| | | importOwnerRoomDto.setTel(os[14].toString().trim()); |
| | | String idCard = StringUtil.isNullOrNone(os[15]) ? "" : os[15].toString().trim(); |
| | | importOwnerRoomDto.setTel(os[18] == null?"":os[18].toString().trim()); |
| | | String idCard = StringUtil.isNullOrNone(os[19]) ? "" : os[19].toString().trim(); |
| | | importOwnerRoomDto.setIdCard(idCard); |
| | | importOwnerRoomDto.setOwnerTypeCd(os[16].toString().trim()); |
| | | importOwnerRoomDto.setOwnerTypeCd(os[20].toString().trim()); |
| | | importOwnerRoomDto.setPersonType(os[21].toString().trim()); |
| | | importOwnerRoomDto.setPersonRole(os[22].toString().trim()); |
| | | importOwnerRoomDto.setConcactPerson(os[23].toString().trim()); |
| | | } |
| | | if (os.length > 24 && !StringUtil.isNullOrNone(os[24])) { |
| | | importOwnerRoomDto.setConcactLink(os[24].toString().trim()); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | if (StringUtil.isEmpty(importOwnerRoomDto.getSex())) { |
| | | throw new IllegalArgumentException((roomIndex + 2) + "行性别不能为空"); |
| | | importOwnerRoomDto.setSex(""); |
| | | // throw new IllegalArgumentException((roomIndex + 2) + "行性别不能为空"); |
| | | } |
| | | |
| | | // if (StringUtil.isEmpty(importOwnerRoomDto.getAge())) { |
| | |
| | | //系统目前 在香港台湾 以及新加坡等地都有商用 所以 并不是中国大陆手机号规则 所以不做严格校验 |
| | | //烦请专业测试团队勿喷 |
| | | if (StringUtil.isEmpty(importOwnerRoomDto.getTel())) { |
| | | throw new IllegalArgumentException((roomIndex + 2) + "行手机号不能为空"); |
| | | importOwnerRoomDto.setTel(""); |
| | | // throw new IllegalArgumentException((roomIndex + 2) + "行手机号不能为空");/**/ |
| | | } |
| | | |
| | | if (importOwnerRoomDto.getTel().length() > 11) { |
| | | throw new IllegalArgumentException((roomIndex + 2) + "行手机号超过11位,请核实"); |
| | | } |
| | | // if (importOwnerRoomDto.getTel().length() > 11) { |
| | | // throw new IllegalArgumentException((roomIndex + 2) + "行手机号超过11位,请核实"); |
| | | // } |
| | | |
| | | // if (StringUtil.isEmpty(importOwnerRoomDto.getIdCard())) { |
| | | // throw new IllegalArgumentException((roomIndex + 1) + "行身份证号不能为空"); |
| | |
| | | throw new IllegalArgumentException((roomIndex + 2) + "行房屋状态不是未销售状态,必须包含业主信息"); |
| | | } |
| | | |
| | | // 如果是业主 跳过 |
| | | if (OwnerDto.OWNER_TYPE_CD_OWNER.equals(importOwnerRoomDto.getOwnerTypeCd())) { |
| | | continue; |
| | | } |
| | | // 校验成员之前是否存在 业主角色 |
| | | hasOwnerType = false; |
| | | for (int preRoomIndex = 0; preRoomIndex < roomIndex; preRoomIndex++) { |
| | |
| | | } |
| | | } |
| | | |
| | | if(hasOwnerType && OwnerDto.OWNER_TYPE_CD_OWNER.equals(importOwnerRoomDto.getOwnerTypeCd())){ |
| | | throw new IllegalArgumentException((roomIndex + 2) + "行一个房屋绑定多个业主"); |
| | | } |
| | | |
| | | // 如果是业主 跳过 |
| | | if (OwnerDto.OWNER_TYPE_CD_OWNER.equals(importOwnerRoomDto.getOwnerTypeCd())) { |
| | | continue; |
| | | } |
| | | |
| | | |
| | | if (!hasOwnerType) { |
| | | throw new IllegalArgumentException((roomIndex + 2) + "行一个房屋必须要有业主存在 才能 写家庭成员和房屋租客 和临时人员,并且业主要写在 其他之前"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |