| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.smo.DefaultAbstractComponentSMO; |
| | | import com.java110.core.component.BaseComponentSMO; |
| | | import com.java110.api.smo.assetImport.IAssetImportSMO; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.core.smo.ISaveTransactionLogSMO; |
| | | import com.java110.dto.RoomDto; |
| | | import com.java110.dto.assetImportLog.AssetImportLogDto; |
| | | import com.java110.dto.assetImportLogDetail.AssetImportLogDetailDto; |
| | | import com.java110.entity.assetImport.*; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.entity.assetImport.ImportFee; |
| | | import com.java110.entity.assetImport.ImportFloor; |
| | | import com.java110.entity.assetImport.ImportOwner; |
| | | import com.java110.entity.assetImport.ImportParkingSpace; |
| | | import com.java110.entity.assetImport.ImportRoom; |
| | | import com.java110.entity.component.ComponentValidateResult; |
| | | import com.java110.api.smo.assetImport.IAssetImportSMO; |
| | | import com.java110.utils.constant.ServiceConstant; |
| | | import com.java110.utils.util.*; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.CommonUtil; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.ImportExcelUtils; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | |
| | | //paramIn = new JSONObject(); |
| | | //保存 费用项 |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/feeConfig.saveFeeConfig"; |
| | | apiUrl = "feeConfig.saveFeeConfig"; |
| | | |
| | | paramIn = JSONObject.parseObject(JSONObject.toJSONString(fee)); |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | |
| | | paramIn = new JSONObject(); |
| | | // 如果不存在,才插入 |
| | | if (savedParkingAreaInfo == null) { |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingArea.saveParkingArea"; |
| | | apiUrl = "parkingArea.saveParkingArea"; |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("typeCd", parkingSpace.getTypeCd()); |
| | | paramIn.put("num", parkingSpace.getPaNum()); |
| | |
| | | continue; |
| | | } |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.saveParkingSpace"; |
| | | apiUrl = "parkingSpace.saveParkingSpace"; |
| | | |
| | | paramIn.put("paId", savedParkingAreaInfo.getString("paId")); |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | |
| | | paramIn.put("cycles", "0"); |
| | | } |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.sellParkingSpace"; |
| | | apiUrl = "parkingSpace.sellParkingSpace"; |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | |
| | | |
| | | |
| | | //保存 房屋 |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.saveRoom"; |
| | | apiUrl = "room.saveRoom"; |
| | | |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("unitId", room.getFloor().getUnitId()); |
| | |
| | | continue; |
| | | } |
| | | paramIn.clear(); |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.sellRoom"; |
| | | apiUrl = "room.sellRoom"; |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("ownerId", room.getImportOwner().getOwnerId()); |
| | | paramIn.put("roomId", savedRoomInfo.getString("roomId")); |
| | |
| | | continue;//没有费用项,可能写错了 |
| | | } |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/fee.saveRoomCreateFee"; |
| | | apiUrl = "fee.saveRoomCreateFee"; |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("locationTypeCd", "3000"); |
| | | paramIn.put("locationObjId", savedRoomInfo.getString("roomId")); |
| | |
| | | private JSONObject getExistsParkSpace(IPageData pd, ComponentValidateResult result, ImportParkingSpace parkingSpace) { |
| | | String apiUrl = ""; |
| | | ResponseEntity<String> responseEntity = null; |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.queryParkingSpaces?page=1&row=1&communityId=" + result.getCommunityId() |
| | | apiUrl = "parkingSpace.queryParkingSpaces?page=1&row=1&communityId=" + result.getCommunityId() |
| | | + "&num=" + parkingSpace.getPsNum() + "&areaNum=" + parkingSpace.getPaNum(); |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET); |
| | | |
| | |
| | | private JSONObject getExistsFee(IPageData pd, ComponentValidateResult result, ImportFee fee) { |
| | | String apiUrl = ""; |
| | | ResponseEntity<String> responseEntity = null; |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/feeConfig.listFeeConfigs?page=1&row=1&communityId=" + result.getCommunityId() |
| | | apiUrl = "feeConfig.listFeeConfigs?page=1&row=1&communityId=" + result.getCommunityId() |
| | | + "&feeName=" + fee.getFeeName(); |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET); |
| | | |
| | |
| | | private JSONObject getExistsRoom(IPageData pd, ComponentValidateResult result, ImportRoom room) { |
| | | String apiUrl = ""; |
| | | ResponseEntity<String> responseEntity = null; |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.queryRooms?page=1&row=1&communityId=" + result.getCommunityId() |
| | | apiUrl = "room.queryRooms?page=1&row=1&communityId=" + result.getCommunityId() |
| | | + "&floorId=" + room.getFloor().getFloorId() + "&unitId=" + room.getFloor().getUnitId() + "&roomNum=" + room.getRoomNum(); |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET); |
| | | |
| | |
| | | } |
| | | paramIn = new JSONObject(); |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/owner.saveOwner"; |
| | | apiUrl = "owner.saveOwner"; |
| | | |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("userId", result.getUserId()); |
| | |
| | | paramIn.put("age", owner.getAge()); |
| | | paramIn.put("link", owner.getTel()); |
| | | paramIn.put("sex", owner.getSex()); |
| | | paramIn.put("ownerTypeCd", "1001"); |
| | | paramIn.put("ownerTypeCd", owner.getOwnerTypeCd()); |
| | | paramIn.put("idCard", owner.getIdCard()); |
| | | paramIn.put("source", "BatchImport"); |
| | | if (!OwnerDto.OWNER_TYPE_CD_OWNER.equals(owner.getOwnerTypeCd())) { |
| | | //查询业主ID |
| | | paramIn.put("ownerId", getOwnerId(owners, owner)); |
| | | } |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | |
| | | /***************************************导入日志记录****************************************************/ |
| | |
| | | return responseEntity; |
| | | } |
| | | |
| | | private String getOwnerId(List<ImportOwner> owners, ImportOwner owner) { |
| | | for (ImportOwner owner1 : owners) { |
| | | if (owner1.getOwnerNum().equals(owner.getParentOwnerId())) { |
| | | return owner1.getOwnerId(); |
| | | } |
| | | } |
| | | throw new IllegalArgumentException("请将业主成员放到业主后面,或者业主成员未找到对应的业主"); |
| | | } |
| | | |
| | | /** |
| | | * 保存 楼栋和 单元信息 |
| | | * |
| | |
| | | JSONObject savedFloorInfo = getExistsFloor(pd, result, importFloor); |
| | | // 如果不存在,才插入 |
| | | if (savedFloorInfo == null) { |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/floor.saveFloor"; |
| | | apiUrl = "floor.saveFloor"; |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("floorNum", importFloor.getFloorNum()); |
| | | paramIn.put("userId", result.getUserId()); |
| | |
| | | continue; |
| | | } |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/unit.saveUnit"; |
| | | apiUrl = "unit.saveUnit"; |
| | | |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("floorId", savedFloorInfo.getString("floorId")); |
| | |
| | | private JSONObject getExistsUnit(IPageData pd, ComponentValidateResult result, ImportFloor importFloor) { |
| | | String apiUrl = ""; |
| | | ResponseEntity<String> responseEntity = null; |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/unit.queryUnits?communityId=" + result.getCommunityId() |
| | | apiUrl = "unit.queryUnits?communityId=" + result.getCommunityId() |
| | | + "&floorId=" + importFloor.getFloorId() + "&unitNum=" + importFloor.getUnitNum(); |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET); |
| | | |
| | |
| | | private JSONObject getExistsFloor(IPageData pd, ComponentValidateResult result, ImportFloor importFloor) { |
| | | String apiUrl = ""; |
| | | ResponseEntity<String> responseEntity = null; |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/floor.queryFloors?page=1&row=1&communityId=" + result.getCommunityId() + "&floorNum=" + importFloor.getFloorNum(); |
| | | apiUrl = "floor.queryFloors?page=1&row=1&communityId=" + result.getCommunityId() + "&floorNum=" + importFloor.getFloorNum(); |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET); |
| | | |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息 |
| | |
| | | private JSONObject getExistsOwner(IPageData pd, ComponentValidateResult result, ImportOwner importOwner) { |
| | | String apiUrl = ""; |
| | | ResponseEntity<String> responseEntity = null; |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/owner.queryOwners?page=1&row=1&communityId=" + result.getCommunityId() |
| | | + "&ownerTypeCd=1001&name=" + importOwner.getOwnerName() + "&link=" + importOwner.getTel(); |
| | | apiUrl = "owner.queryOwners?page=1&row=1&communityId=" + result.getCommunityId() |
| | | + "&ownerTypeCd=" + importOwner.getOwnerTypeCd() + "&name=" + importOwner.getOwnerName() + "&link=" + importOwner.getTel(); |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET); |
| | | |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息 |
| | |
| | | private JSONObject getExistsParkingArea(IPageData pd, ComponentValidateResult result, ImportParkingSpace parkingSpace) { |
| | | String apiUrl = ""; |
| | | ResponseEntity<String> responseEntity = null; |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingArea.listParkingAreas?page=1&row=1&communityId=" + result.getCommunityId() |
| | | apiUrl = "parkingArea.listParkingAreas?page=1&row=1&communityId=" + result.getCommunityId() |
| | | + "&num=" + parkingSpace.getPaNum(); |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET); |
| | | |
| | |
| | | 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(); |
| | | String ownerTypeCd = StringUtil.isNullOrNone(os[6]) ? "1001" : os[6].toString(); |
| | | String parentOwnerId = StringUtil.isNullOrNone(os[7]) ? os[0].toString() : os[7].toString(); |
| | | |
| | | if (os[4].toString().length() > 11) { |
| | | throw new IllegalArgumentException(os[1].toString() + " 的手机号超过11位,请核实"); |
| | |
| | | importOwner.setAge(Integer.parseInt(age)); |
| | | importOwner.setTel(tel); |
| | | importOwner.setIdCard(idCard); |
| | | importOwner.setOwnerTypeCd(ownerTypeCd); |
| | | importOwner.setParentOwnerId(parentOwnerId); |
| | | owners.add(importOwner); |
| | | } catch (Exception e) { |
| | | logger.error("第" + (osIndex + 1) + "行数据出现问题", e); |