old mode 100644
new mode 100755
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.component.BaseComponentSMO; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.dto.RoomDto; |
| | | import com.java110.entity.assetImport.*; |
| | | import com.java110.entity.component.ComponentValidateResult; |
| | | import com.java110.front.smo.assetImport.IAssetImportSMO; |
| | | import com.java110.utils.constant.FeeTypeConstant; |
| | | import com.java110.utils.constant.ServiceConstant; |
| | | import com.java110.utils.util.*; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>("成功", HttpStatus.OK); |
| | | ImportOwner owner = null; |
| | | for (ImportParkingSpace parkingSpace : parkingSpaces) { |
| | | |
| | | responseEntity = new ResponseEntity<String>("成功", HttpStatus.OK); |
| | | JSONObject savedParkingAreaInfo = getExistsParkingArea(pd, result, parkingSpace); |
| | | paramIn = new JSONObject(); |
| | | // 如果不存在,才插入 |
| | |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("typeCd", parkingSpace.getTypeCd()); |
| | | paramIn.put("num", parkingSpace.getPaNum()); |
| | | |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | savedParkingAreaInfo = getExistsParkingArea(pd, result, parkingSpace); |
| | | } |
| | |
| | | paramIn.put("num", parkingSpace.getPsNum()); |
| | | paramIn.put("area", parkingSpace.getArea()); |
| | | paramIn.put("typeCd", parkingSpace.getTypeCd()); |
| | | paramIn.put("parkingType", "1"); |
| | | |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | |
| | | if ("H".equals(parkingSpace.getSellOrHire())) { |
| | | paramIn.put("cycles", "0"); |
| | | } |
| | | |
| | | // String feeTypeCd = "1001".equals(parkingSpace.getTypeCd()) |
| | | // ? FeeTypeConstant.FEE_TYPE_SELL_UP_PARKING_SPACE : FeeTypeConstant.FEE_TYPE_SELL_DOWN_PARKING_SPACE; |
| | | // apiUrl = ServiceConstant.SERVICE_API_URL + "/api/feeConfig.listFeeConfigs?page=1&row=1&communityId=" + result.getCommunityId() + "&feeTypeCd=" + feeTypeCd + "&isDefault=T"; |
| | | // responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET); |
| | | // |
| | | // if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | // continue; |
| | | // } |
| | | |
| | | // JSONObject configInfo = JSONObject.parseObject(responseEntity.getBody()).getJSONArray("feeConfigs").getJSONObject(0); |
| | | // if (!configInfo.containsKey("additionalAmount")) { |
| | | // continue; |
| | | // } |
| | | |
| | | // paramIn.put("receivedAmount", configInfo.getString("additionalAmount")); |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.sellParkingSpace"; |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | |
| | | paramIn.put("apartment", room.getSection()); |
| | | paramIn.put("state", "2002"); |
| | | paramIn.put("builtUpArea", room.getBuiltUpArea()); |
| | | paramIn.put("unitPrice", "1000.00"); |
| | | paramIn.put("feeCoefficient", "1.00"); |
| | | paramIn.put("roomType", "0".equals(room.getFloor().getUnitNum()) ? RoomDto.ROOM_TYPE_SHOPS : RoomDto.ROOM_TYPE_SHOPS); |
| | | |
| | | |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | |
| | | paramIn.put("configId", ttFee.getString("configId")); |
| | | paramIn.put("storeId", result.getStoreId()); |
| | | paramIn.put("feeEndDate", room.getFeeEndDate().split("#")[feeIndex]); |
| | | paramIn.put("startTime", paramIn.getString("feeEndDate")); |
| | | |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | } |
| | | |
| | |
| | | String apiUrl = ""; |
| | | ResponseEntity<String> responseEntity = null; |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.queryParkingSpaces?page=1&row=1&communityId=" + result.getCommunityId() |
| | | + "&num=" + parkingSpace.getPsNum(); |
| | | + "&num=" + parkingSpace.getPsNum() + "&areaNum=" + parkingSpace.getPaNum(); |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET); |
| | | |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息 |
| | |
| | | paramIn.put("floorNum", importFloor.getFloorNum()); |
| | | paramIn.put("userId", result.getUserId()); |
| | | paramIn.put("name", importFloor.getFloorNum() + "号楼"); |
| | | paramIn.put("floorArea", 1.00); |
| | | |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | savedFloorInfo = getExistsFloor(pd, result, importFloor); |
| | | } |
| | |
| | | paramIn.put("unitNum", importFloor.getUnitNum()); |
| | | paramIn.put("layerCount", importFloor.getLayerCount()); |
| | | paramIn.put("lift", importFloor.getLift()); |
| | | paramIn.put("unitArea", 1.00); |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | |
| | | //将unitId 刷入ImportFloor对象 |
| | |
| | | importParkingSpace.setPsNum(os[1].toString()); |
| | | importParkingSpace.setTypeCd(os[2].toString()); |
| | | importParkingSpace.setArea(Double.parseDouble(os[3].toString())); |
| | | if (StringUtil.isNullOrNone(os[4])) { |
| | | if (os.length < 5 || StringUtil.isNullOrNone(os[4])) { |
| | | parkingSpaces.add(importParkingSpace); |
| | | continue; |
| | | } |
| | |
| | | List<Object[]> oList = ImportExcelUtils.listFromSheet(sheet); |
| | | ImportRoom importRoom = null; |
| | | for (int osIndex = 0; osIndex < oList.size(); osIndex++) { |
| | | Object[] os = oList.get(osIndex); |
| | | if (osIndex == 0) { // 第一行是 头部信息 直接跳过 |
| | | continue; |
| | | } |
| | | if (StringUtil.isNullOrNone(os[0])) { |
| | | continue; |
| | | } |
| | | 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) + "行建筑面积为空"); |
| | | if (!StringUtil.isNullOrNone(os[6])) { |
| | | Assert.hasValue(os[7], "房屋信息选项中" + (osIndex + 1) + "行房屋费用为空"); |
| | | Assert.hasValue(os[8], "房屋信息选项中" + (osIndex + 1) + "行费用到期时间为空"); |
| | | } |
| | | importRoom = new ImportRoom(); |
| | | importRoom.setRoomNum(os[0].toString()); |
| | | importRoom.setFloor(getImportFloor(floors, os[1].toString(), os[2].toString())); |
| | | importRoom.setLayer(Integer.parseInt(os[3].toString())); |
| | | importRoom.setSection(os[4].toString()); |
| | | importRoom.setBuiltUpArea(Double.parseDouble(os[5].toString())); |
| | | try { |
| | | Object[] os = oList.get(osIndex); |
| | | if (osIndex == 0) { // 第一行是 头部信息 直接跳过 |
| | | continue; |
| | | } |
| | | if (StringUtil.isNullOrNone(os[0])) { |
| | | continue; |
| | | } |
| | | 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) + "行建筑面积为空"); |
| | | if (!StringUtil.isNullOrNone(os[6])) { |
| | | Assert.hasValue(os[7], "房屋信息选项中" + (osIndex + 1) + "行房屋费用为空"); |
| | | Assert.hasValue(os[8], "房屋信息选项中" + (osIndex + 1) + "行费用到期时间为空"); |
| | | } |
| | | importRoom = new ImportRoom(); |
| | | importRoom.setRoomNum(os[0].toString()); |
| | | importRoom.setFloor(getImportFloor(floors, os[1].toString(), os[2].toString())); |
| | | importRoom.setLayer(Integer.parseInt(os[3].toString())); |
| | | importRoom.setSection(os[4].toString()); |
| | | importRoom.setBuiltUpArea(Double.parseDouble(os[5].toString())); |
| | | |
| | | if (!StringUtil.isNullOrNone(os[6])) { |
| | | importRoom.setRoomFeeId(os[7].toString()); |
| | | importRoom.setFeeEndDate(os[8].toString()); |
| | | } |
| | | if (StringUtil.isNullOrNone(os[6])) { |
| | | if (!StringUtil.isNullOrNone(os[6])) { |
| | | importRoom.setRoomFeeId(os[7].toString()); |
| | | importRoom.setFeeEndDate(os[8].toString()); |
| | | } |
| | | if (StringUtil.isNullOrNone(os[6])) { |
| | | rooms.add(importRoom); |
| | | continue; |
| | | } |
| | | importRoom.setImportOwner(getImportOwner(owners, os[6].toString())); |
| | | rooms.add(importRoom); |
| | | continue; |
| | | } catch (Exception e) { |
| | | throw new IllegalArgumentException("房屋信息sheet中第" + (osIndex + 1) + "行数据错误,请检查" + e.getLocalizedMessage()); |
| | | } |
| | | importRoom.setImportOwner(getImportOwner(owners, os[6].toString())); |
| | | rooms.add(importRoom); |
| | | } |
| | | } |
| | | |
| | |
| | | List<Object[]> oList = ImportExcelUtils.listFromSheet(sheet); |
| | | ImportOwner importOwner = null; |
| | | for (int osIndex = 0; osIndex < oList.size(); osIndex++) { |
| | | Object[] os = oList.get(osIndex); |
| | | if (osIndex == 0) { // 第一行是 头部信息 直接跳过 |
| | | continue; |
| | | } |
| | | if (StringUtil.isNullOrNone(os[0])) { |
| | | continue; |
| | | } |
| | | Assert.hasValue(os[0], "业主信息选项中" + (osIndex + 1) + "行业主编号为空"); |
| | | Assert.hasValue(os[1], "业主信息选项中" + (osIndex + 1) + "行业主名称为空"); |
| | | Assert.hasValue(os[2], "业主信息选项中" + (osIndex + 1) + "行业主性别为空"); |
| | | String tel = StringUtil.isNullOrNone(os[4]) ? "19999999999" : os[4].toString(); |
| | | String idCard = StringUtil.isNullOrNone(os[5]) ? "10000000000000000001" : os[5].toString(); |
| | | try { |
| | | Object[] os = oList.get(osIndex); |
| | | if (osIndex == 0) { // 第一行是 头部信息 直接跳过 |
| | | continue; |
| | | } |
| | | if (StringUtil.isNullOrNone(os[0])) { |
| | | continue; |
| | | } |
| | | Assert.hasValue(os[0], "业主信息选项中" + (osIndex + 1) + "行业主编号为空"); |
| | | Assert.hasValue(os[1], "业主信息选项中" + (osIndex + 1) + "行业主名称为空"); |
| | | Assert.hasValue(os[2], "业主信息选项中" + (osIndex + 1) + "行业主性别为空"); |
| | | String tel = StringUtil.isNullOrNone(os[4]) ? "19999999999" : os[4].toString(); |
| | | String idCard = StringUtil.isNullOrNone(os[5]) ? "10000000000000000001" : os[5].toString(); |
| | | |
| | | if (os[4].toString().length() > 11) { |
| | | throw new IllegalArgumentException(os[1].toString() + " 的手机号超过11位,请核实"); |
| | | } |
| | | if (os[5].toString().length() > 18) { |
| | | throw new IllegalArgumentException(os[1].toString() + " 的身份证超过18位,请核实"); |
| | | } |
| | | if (os[4].toString().length() > 11) { |
| | | throw new IllegalArgumentException(os[1].toString() + " 的手机号超过11位,请核实"); |
| | | } |
| | | if (os[5].toString().length() > 18) { |
| | | throw new IllegalArgumentException(os[1].toString() + " 的身份证超过18位,请核实"); |
| | | } |
| | | |
| | | String age = StringUtil.isNullOrNone(os[3]) ? CommonUtil.getAgeByCertId(idCard) : os[3].toString(); |
| | | importOwner = new ImportOwner(); |
| | | importOwner.setOwnerNum(os[0].toString()); |
| | | importOwner.setOwnerName(os[1].toString()); |
| | | importOwner.setSex("男".equals(os[2].toString()) ? "0" : "1"); |
| | | importOwner.setAge(Integer.parseInt(age)); |
| | | importOwner.setTel(tel); |
| | | importOwner.setIdCard(idCard); |
| | | owners.add(importOwner); |
| | | String age = StringUtil.isNullOrNone(os[3]) ? CommonUtil.getAgeByCertId(idCard) : os[3].toString(); |
| | | importOwner = new ImportOwner(); |
| | | importOwner.setOwnerNum(os[0].toString()); |
| | | importOwner.setOwnerName(os[1].toString()); |
| | | importOwner.setSex("男".equals(os[2].toString()) ? "0" : "1"); |
| | | importOwner.setAge(Integer.parseInt(age)); |
| | | importOwner.setTel(tel); |
| | | importOwner.setIdCard(idCard); |
| | | owners.add(importOwner); |
| | | } catch (Exception e) { |
| | | logger.error("第" + (osIndex + 1) + "行数据出现问题", e); |
| | | throw new IllegalArgumentException("第" + (osIndex + 1) + "行数据出现问题" + e.getLocalizedMessage(), e); |
| | | } |
| | | } |
| | | } |
| | | |