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.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.entity.component.ComponentValidateResult; |
| | | import com.java110.front.smo.assetImport.IAssetImportSMO; |
| | | import com.java110.utils.constant.ServiceConstant; |
| | | import com.java110.utils.util.*; |
| | | import com.java110.vo.ResultVo; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.slf4j.Logger; |
| | |
| | | import org.springframework.web.client.RestTemplate; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | @Autowired |
| | | private ISaveTransactionLogSMO saveTransactionLogSMOImpl; |
| | | |
| | | @Override |
| | | public ResponseEntity<String> importExcelData(IPageData pd, MultipartFile uploadFile) throws Exception { |
| | |
| | | JSONObject paramIn = null; |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>("成功", HttpStatus.OK); |
| | | ImportOwner owner = null; |
| | | for (ImportFee fee : fees) { |
| | | JSONObject savedFeeConfigInfo = getExistsFee(pd, result, fee); |
| | | if (savedFeeConfigInfo != null) { |
| | | continue; |
| | | |
| | | AssetImportLogDto assetImportLogDto = new AssetImportLogDto(); |
| | | assetImportLogDto.setSuccessCount(0L); |
| | | assetImportLogDto.setErrorCount(0L); |
| | | assetImportLogDto.setCommunityId(result.getCommunityId()); |
| | | assetImportLogDto.setLogType(AssetImportLogDto.LOG_TYPE_FEE_IMPORT); |
| | | List<AssetImportLogDetailDto> assetImportLogDetailDtos = new ArrayList<>(); |
| | | assetImportLogDto.setAssetImportLogDetailDtos(assetImportLogDetailDtos); |
| | | long successCount = 0L; |
| | | long failCount = 0L; |
| | | AssetImportLogDetailDto assetImportLogDetailDto = null; |
| | | try { |
| | | for (ImportFee fee : fees) { |
| | | JSONObject savedFeeConfigInfo = getExistsFee(pd, result, fee); |
| | | if (savedFeeConfigInfo != null) { |
| | | successCount += 1; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | continue; |
| | | } |
| | | //paramIn = new JSONObject(); |
| | | //保存 费用项 |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/feeConfig.saveFeeConfig"; |
| | | |
| | | paramIn = JSONObject.parseObject(JSONObject.toJSONString(fee)); |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | /***************************************导入日志记录****************************************************/ |
| | | failCount += 1; |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | if (Assert.isJsonObject(responseEntity.getBody())) { |
| | | JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody()); |
| | | assetImportLogDetailDto.setState(paramOut.getString("code")); |
| | | assetImportLogDetailDto.setMessage(paramOut.getString("msg")); |
| | | } else { |
| | | assetImportLogDetailDto.setState("F"); |
| | | assetImportLogDetailDto.setMessage(responseEntity.getBody()); |
| | | } |
| | | assetImportLogDetailDto.setObjName(fee.getFeeName()); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | } else { |
| | | JSONObject body = JSONObject.parseObject(responseEntity.getBody()); |
| | | if (body.containsKey("code") && body.getIntValue("code") != 0) { |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | assetImportLogDetailDto.setState(body.getString("code")); |
| | | assetImportLogDetailDto.setMessage(body.getString("msg")); |
| | | assetImportLogDetailDto.setObjName(fee.getFeeName()); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | failCount += 1; |
| | | } else { |
| | | successCount += 1; |
| | | } |
| | | } |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | } |
| | | |
| | | //paramIn = new JSONObject(); |
| | | //保存 费用项 |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/feeConfig.saveFeeConfig"; |
| | | |
| | | paramIn = JSONObject.parseObject(JSONObject.toJSONString(fee)); |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | continue; |
| | | } |
| | | } finally { |
| | | saveTransactionLogSMOImpl.saveAssetImportLog(assetImportLogDto); |
| | | } |
| | | |
| | | return responseEntity; |
| | |
| | | JSONObject paramIn = null; |
| | | 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(); |
| | | // 如果不存在,才插入 |
| | | if (savedParkingAreaInfo == null) { |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingArea.saveParkingArea"; |
| | | AssetImportLogDto assetImportLogDto = new AssetImportLogDto(); |
| | | assetImportLogDto.setSuccessCount(0L); |
| | | assetImportLogDto.setErrorCount(0L); |
| | | assetImportLogDto.setCommunityId(result.getCommunityId()); |
| | | assetImportLogDto.setLogType(AssetImportLogDto.LOG_TYPE_AREA_PARKING_IMPORT); |
| | | List<AssetImportLogDetailDto> assetImportLogDetailDtos = new ArrayList<>(); |
| | | assetImportLogDto.setAssetImportLogDetailDtos(assetImportLogDetailDtos); |
| | | long successCount = 0L; |
| | | long failCount = 0L; |
| | | AssetImportLogDetailDto assetImportLogDetailDto = null; |
| | | try { |
| | | for (ImportParkingSpace parkingSpace : parkingSpaces) { |
| | | responseEntity = ResultVo.success(); |
| | | JSONObject savedParkingAreaInfo = getExistsParkingArea(pd, result, parkingSpace); |
| | | paramIn = new JSONObject(); |
| | | // 如果不存在,才插入 |
| | | if (savedParkingAreaInfo == null) { |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingArea.saveParkingArea"; |
| | | 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); |
| | | } |
| | | if (responseEntity != null && responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息 |
| | | failCount += 1; |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | if (Assert.isJsonObject(responseEntity.getBody())) { |
| | | JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody()); |
| | | assetImportLogDetailDto.setState(paramOut.getString("code")); |
| | | assetImportLogDetailDto.setMessage(paramOut.getString("msg")); |
| | | } else { |
| | | assetImportLogDetailDto.setState("F"); |
| | | assetImportLogDetailDto.setMessage(responseEntity.getBody()); |
| | | } |
| | | assetImportLogDetailDto.setObjName(parkingSpace.getPaNum()); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | continue; |
| | | } else { |
| | | JSONObject body = JSONObject.parseObject(responseEntity.getBody()); |
| | | if (body.containsKey("code") && body.getIntValue("code") != 0) { |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | assetImportLogDetailDto.setState(body.getString("code")); |
| | | assetImportLogDetailDto.setMessage(body.getString("msg")); |
| | | assetImportLogDetailDto.setObjName(parkingSpace.getPaNum()); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | failCount += 1; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | continue; |
| | | } else { |
| | | successCount += 1; |
| | | } |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | } |
| | | |
| | | JSONObject savedParkingSpaceInfo = getExistsParkSpace(pd, result, parkingSpace); |
| | | if (savedParkingSpaceInfo != null) { |
| | | continue; |
| | | } |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.saveParkingSpace"; |
| | | |
| | | paramIn.put("paId", savedParkingAreaInfo.getString("paId")); |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("userId", result.getUserId()); |
| | | paramIn.put("num", parkingSpace.getPsNum()); |
| | | paramIn.put("area", parkingSpace.getArea()); |
| | | paramIn.put("typeCd", parkingSpace.getTypeCd()); |
| | | paramIn.put("num", parkingSpace.getPaNum()); |
| | | paramIn.put("parkingType", "1"); |
| | | |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | savedParkingAreaInfo = getExistsParkingArea(pd, result, parkingSpace); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | if (Assert.isJsonObject(responseEntity.getBody())) { |
| | | JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody()); |
| | | assetImportLogDetailDto.setState(paramOut.getString("code")); |
| | | assetImportLogDetailDto.setMessage(paramOut.getString("msg")); |
| | | } else { |
| | | assetImportLogDetailDto.setState("F"); |
| | | assetImportLogDetailDto.setMessage(responseEntity.getBody()); |
| | | } |
| | | assetImportLogDetailDto.setObjName(parkingSpace.getPaNum()); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | failCount += 1; |
| | | successCount = successCount > 0 ? successCount - 1 : successCount; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | continue; |
| | | } else { |
| | | JSONObject body = JSONObject.parseObject(responseEntity.getBody()); |
| | | if (body.containsKey("code") && body.getIntValue("code") != 0) { |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | assetImportLogDetailDto.setState(body.getString("code")); |
| | | assetImportLogDetailDto.setMessage(body.getString("msg")); |
| | | assetImportLogDetailDto.setObjName(parkingSpace.getPaNum()); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | failCount += 1; |
| | | successCount = successCount > 0 ? successCount - 1 : successCount; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | savedParkingSpaceInfo = getExistsParkSpace(pd, result, parkingSpace); |
| | | if (savedParkingSpaceInfo == null) { |
| | | continue; |
| | | } |
| | | |
| | | //是否有业主信息 |
| | | if (parkingSpace.getImportOwner() == null) { |
| | | continue; |
| | | } |
| | | |
| | | paramIn.clear(); |
| | | |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("ownerId", parkingSpace.getImportOwner().getOwnerId()); |
| | | paramIn.put("userId", result.getUserId()); |
| | | paramIn.put("carNum", parkingSpace.getCarNum()); |
| | | paramIn.put("carBrand", parkingSpace.getCarBrand()); |
| | | paramIn.put("carType", parkingSpace.getCarType()); |
| | | paramIn.put("carColor", parkingSpace.getCarColor()); |
| | | paramIn.put("psId", savedParkingSpaceInfo.getString("psId")); |
| | | paramIn.put("storeId", result.getStoreId()); |
| | | paramIn.put("sellOrHire", parkingSpace.getSellOrHire()); |
| | | paramIn.put("startTime", parkingSpace.getStartTime()); |
| | | paramIn.put("endTime", parkingSpace.getEndTime()); |
| | | |
| | | if ("H".equals(parkingSpace.getSellOrHire())) { |
| | | paramIn.put("cycles", "0"); |
| | | } |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.sellParkingSpace"; |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | /***************************************导入日志记录****************************************************/ |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | if (Assert.isJsonObject(responseEntity.getBody())) { |
| | | JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody()); |
| | | assetImportLogDetailDto.setState(paramOut.getString("code")); |
| | | assetImportLogDetailDto.setMessage(paramOut.getString("msg")); |
| | | } else { |
| | | assetImportLogDetailDto.setState("F"); |
| | | assetImportLogDetailDto.setMessage(responseEntity.getBody()); |
| | | } |
| | | assetImportLogDetailDto.setObjName(parkingSpace.getCarNum()); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | failCount += 1; |
| | | successCount = successCount > 0 ? successCount - 1 : successCount; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | } else { |
| | | JSONObject body = JSONObject.parseObject(responseEntity.getBody()); |
| | | if (body.containsKey("code") && body.getIntValue("code") != 0) { |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | assetImportLogDetailDto.setState(body.getString("code")); |
| | | assetImportLogDetailDto.setMessage(body.getString("msg")); |
| | | assetImportLogDetailDto.setObjName(parkingSpace.getCarNum()); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | failCount += 1; |
| | | successCount = successCount > 0 ? successCount - 1 : successCount; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | } |
| | | } |
| | | } |
| | | if (responseEntity != null && responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息 |
| | | continue; |
| | | } |
| | | |
| | | JSONObject savedParkingSpaceInfo = getExistsParkSpace(pd, result, parkingSpace); |
| | | if (savedParkingSpaceInfo != null) { |
| | | continue; |
| | | } |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.saveParkingSpace"; |
| | | |
| | | paramIn.put("paId", savedParkingAreaInfo.getString("paId")); |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("userId", result.getUserId()); |
| | | paramIn.put("num", parkingSpace.getPsNum()); |
| | | paramIn.put("area", parkingSpace.getArea()); |
| | | paramIn.put("typeCd", parkingSpace.getTypeCd()); |
| | | |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | continue; |
| | | } |
| | | |
| | | savedParkingSpaceInfo = getExistsParkSpace(pd, result, parkingSpace); |
| | | if (savedParkingSpaceInfo == null) { |
| | | continue; |
| | | } |
| | | |
| | | //是否有业主信息 |
| | | if (parkingSpace.getImportOwner() == null) { |
| | | continue; |
| | | } |
| | | |
| | | paramIn.clear(); |
| | | |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("ownerId", parkingSpace.getImportOwner().getOwnerId()); |
| | | paramIn.put("userId", result.getUserId()); |
| | | paramIn.put("carNum", parkingSpace.getCarNum()); |
| | | paramIn.put("carBrand", parkingSpace.getCarBrand()); |
| | | paramIn.put("carType", parkingSpace.getCarType()); |
| | | paramIn.put("carColor", parkingSpace.getCarColor()); |
| | | paramIn.put("psId", savedParkingSpaceInfo.getString("psId")); |
| | | paramIn.put("storeId", result.getStoreId()); |
| | | paramIn.put("sellOrHire", parkingSpace.getSellOrHire()); |
| | | paramIn.put("startTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A)); |
| | | paramIn.put("endTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A)); |
| | | |
| | | if ("H".equals(parkingSpace.getSellOrHire())) { |
| | | paramIn.put("cycles", "0"); |
| | | } |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/parkingSpace.sellParkingSpace"; |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | } catch (Exception e) { |
| | | logger.error("导入车位异常", e); |
| | | saveTransactionLogSMOImpl.saveAssetImportLog(assetImportLogDto); |
| | | throw e; |
| | | } |
| | | |
| | | return responseEntity; |
| | |
| | | JSONObject paramIn = null; |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>("成功", HttpStatus.OK); |
| | | ImportOwner owner = null; |
| | | for (ImportRoom room : rooms) { |
| | | JSONObject savedRoomInfo = getExistsRoom(pd, result, room); |
| | | if (savedRoomInfo != null) { |
| | | continue; |
| | | } |
| | | AssetImportLogDto assetImportLogDto = new AssetImportLogDto(); |
| | | assetImportLogDto.setSuccessCount(0L); |
| | | assetImportLogDto.setErrorCount(0L); |
| | | assetImportLogDto.setCommunityId(result.getCommunityId()); |
| | | assetImportLogDto.setLogType(AssetImportLogDto.LOG_TYPE_ROOM_IMPORT); |
| | | List<AssetImportLogDetailDto> assetImportLogDetailDtos = new ArrayList<>(); |
| | | assetImportLogDto.setAssetImportLogDetailDtos(assetImportLogDetailDtos); |
| | | long successCount = 0L; |
| | | long failCount = 0L; |
| | | AssetImportLogDetailDto assetImportLogDetailDto = null; |
| | | try { |
| | | for (ImportRoom room : rooms) { |
| | | JSONObject savedRoomInfo = getExistsRoom(pd, result, room); |
| | | if (savedRoomInfo != null) { |
| | | continue; |
| | | } |
| | | |
| | | paramIn = new JSONObject(); |
| | | paramIn = new JSONObject(); |
| | | |
| | | |
| | | //保存 房屋 |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.saveRoom"; |
| | | //保存 房屋 |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.saveRoom"; |
| | | |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("unitId", room.getFloor().getUnitId()); |
| | | paramIn.put("roomNum", room.getRoomNum()); |
| | | paramIn.put("layer", room.getLayer()); |
| | | paramIn.put("section", "1"); |
| | | paramIn.put("apartment", room.getSection()); |
| | | paramIn.put("state", "2002"); |
| | | paramIn.put("builtUpArea", room.getBuiltUpArea()); |
| | | paramIn.put("feeCoefficient", "1.00"); |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("unitId", room.getFloor().getUnitId()); |
| | | paramIn.put("roomNum", room.getRoomNum()); |
| | | paramIn.put("layer", room.getLayer()); |
| | | paramIn.put("section", "1"); |
| | | paramIn.put("apartment", room.getSection()); |
| | | paramIn.put("state", "2002"); |
| | | paramIn.put("builtUpArea", room.getBuiltUpArea()); |
| | | paramIn.put("feeCoefficient", "1.00"); |
| | | paramIn.put("roomSubType", room.getRoomSubType()); |
| | | paramIn.put("roomArea", room.getRoomArea()); |
| | | paramIn.put("roomRent", room.getRoomRent()); |
| | | 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); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | continue; |
| | | } |
| | | |
| | | savedRoomInfo = getExistsRoom(pd, result, room); |
| | | if (savedRoomInfo == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (room.getImportOwner() == null) { |
| | | continue; |
| | | } |
| | | paramIn.clear(); |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.sellRoom"; |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("ownerId", room.getImportOwner().getOwnerId()); |
| | | paramIn.put("roomId", savedRoomInfo.getString("roomId")); |
| | | paramIn.put("state", "2001"); |
| | | paramIn.put("storeId", result.getStoreId()); |
| | | if (!StringUtil.isEmpty(room.getRoomFeeId()) && "0".equals(room.getRoomFeeId())) { |
| | | paramIn.put("feeEndDate", room.getFeeEndDate()); |
| | | } |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | continue; |
| | | } |
| | | //创建费用 |
| | | if (StringUtil.isEmpty(room.getRoomFeeId()) || "0".equals(room.getRoomFeeId())) { |
| | | continue; |
| | | } |
| | | String[] feeIds = room.getRoomFeeId().split("#"); |
| | | |
| | | for (int feeIndex = 0; feeIndex < feeIds.length; feeIndex++) { |
| | | String feeId = feeIds[feeIndex]; |
| | | ImportFee tmpFee = null; |
| | | for (ImportFee fee : fees) { |
| | | if (feeId.equals(fee.getId())) { |
| | | tmpFee = fee; |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | failCount += 1; |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | if (Assert.isJsonObject(responseEntity.getBody())) { |
| | | JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody()); |
| | | assetImportLogDetailDto.setState(paramOut.getString("code")); |
| | | assetImportLogDetailDto.setMessage(paramOut.getString("msg")); |
| | | } else { |
| | | assetImportLogDetailDto.setState("F"); |
| | | assetImportLogDetailDto.setMessage(responseEntity.getBody()); |
| | | } |
| | | assetImportLogDetailDto.setObjName(room.getRoomNum() + "室"); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | continue; |
| | | } else { |
| | | JSONObject body = JSONObject.parseObject(responseEntity.getBody()); |
| | | if (body.containsKey("code") && body.getIntValue("code") != 0) { |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | assetImportLogDetailDto.setState(body.getString("code")); |
| | | assetImportLogDetailDto.setMessage(body.getString("msg")); |
| | | assetImportLogDetailDto.setObjName(room.getRoomNum() + "室"); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | failCount += 1; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | continue; |
| | | } else { |
| | | successCount += 1; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | } |
| | | } |
| | | |
| | | if (tmpFee == null) { |
| | | continue;//没有费用项,可能写错了 |
| | | savedRoomInfo = getExistsRoom(pd, result, room); |
| | | if (savedRoomInfo == null) { |
| | | continue; |
| | | } |
| | | |
| | | JSONObject ttFee = getExistsFee(pd, result, tmpFee); |
| | | |
| | | if (ttFee == null) { |
| | | continue;//没有费用项,可能写错了 |
| | | if (room.getImportOwner() == null) { |
| | | continue; |
| | | } |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/fee.saveRoomCreateFee"; |
| | | paramIn.clear(); |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/room.sellRoom"; |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("locationTypeCd", "3000"); |
| | | paramIn.put("locationObjId", savedRoomInfo.getString("roomId")); |
| | | paramIn.put("configId", ttFee.getString("configId")); |
| | | paramIn.put("ownerId", room.getImportOwner().getOwnerId()); |
| | | paramIn.put("roomId", savedRoomInfo.getString("roomId")); |
| | | paramIn.put("state", "2001"); |
| | | paramIn.put("storeId", result.getStoreId()); |
| | | paramIn.put("feeEndDate", room.getFeeEndDate().split("#")[feeIndex]); |
| | | if (!StringUtil.isEmpty(room.getRoomFeeId()) && "0".equals(room.getRoomFeeId())) { |
| | | paramIn.put("feeEndDate", room.getFeeEndDate()); |
| | | } |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | } |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | if (Assert.isJsonObject(responseEntity.getBody())) { |
| | | JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody()); |
| | | assetImportLogDetailDto.setState(paramOut.getString("code")); |
| | | assetImportLogDetailDto.setMessage(paramOut.getString("msg")); |
| | | } else { |
| | | assetImportLogDetailDto.setState("F"); |
| | | assetImportLogDetailDto.setMessage(responseEntity.getBody()); |
| | | } |
| | | assetImportLogDetailDto.setObjName(room.getRoomNum() + "室"); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | continue; |
| | | } else { |
| | | JSONObject body = JSONObject.parseObject(responseEntity.getBody()); |
| | | if (body.containsKey("code") && body.getIntValue("code") != 0) { |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | assetImportLogDetailDto.setState(body.getString("code")); |
| | | assetImportLogDetailDto.setMessage(body.getString("msg")); |
| | | assetImportLogDetailDto.setObjName(room.getRoomNum() + "室"); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | continue; |
| | | } |
| | | } |
| | | //创建费用 |
| | | if (StringUtil.isEmpty(room.getRoomFeeId()) || "0".equals(room.getRoomFeeId())) { |
| | | continue; |
| | | } |
| | | String[] feeIds = room.getRoomFeeId().split("#"); |
| | | |
| | | for (int feeIndex = 0; feeIndex < feeIds.length; feeIndex++) { |
| | | String feeId = feeIds[feeIndex]; |
| | | ImportFee tmpFee = null; |
| | | for (ImportFee fee : fees) { |
| | | if (feeId.equals(fee.getId())) { |
| | | tmpFee = fee; |
| | | } |
| | | } |
| | | |
| | | if (tmpFee == null) { |
| | | continue;//没有费用项,可能写错了 |
| | | } |
| | | |
| | | JSONObject ttFee = getExistsFee(pd, result, tmpFee); |
| | | |
| | | if (ttFee == null) { |
| | | continue;//没有费用项,可能写错了 |
| | | } |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/fee.saveRoomCreateFee"; |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("locationTypeCd", "3000"); |
| | | paramIn.put("locationObjId", savedRoomInfo.getString("roomId")); |
| | | 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); |
| | | |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | /***************************************导入日志记录****************************************************/ |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | if (Assert.isJsonObject(responseEntity.getBody())) { |
| | | JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody()); |
| | | assetImportLogDetailDto.setState(paramOut.getString("code")); |
| | | assetImportLogDetailDto.setMessage(paramOut.getString("msg")); |
| | | } else { |
| | | assetImportLogDetailDto.setState("F"); |
| | | assetImportLogDetailDto.setMessage(responseEntity.getBody()); |
| | | } |
| | | assetImportLogDetailDto.setObjName(room.getRoomNum() + "室"); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | failCount += 1; |
| | | successCount = successCount > 0 ? successCount - 1 : successCount; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | } else { |
| | | JSONObject body = JSONObject.parseObject(responseEntity.getBody()); |
| | | if (body.containsKey("code") && body.getIntValue("code") != 0) { |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | assetImportLogDetailDto.setState(body.getString("code")); |
| | | assetImportLogDetailDto.setMessage(body.getString("msg")); |
| | | assetImportLogDetailDto.setObjName(room.getRoomNum() + "室"); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | failCount += 1; |
| | | successCount = successCount > 0 ? successCount - 1 : successCount; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } finally { |
| | | saveTransactionLogSMOImpl.saveAssetImportLog(assetImportLogDto); |
| | | } |
| | | |
| | | return responseEntity; |
| | |
| | | String apiUrl = ""; |
| | | JSONObject paramIn = null; |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>("成功", HttpStatus.OK); |
| | | AssetImportLogDto assetImportLogDto = new AssetImportLogDto(); |
| | | assetImportLogDto.setSuccessCount(0L); |
| | | assetImportLogDto.setErrorCount(0L); |
| | | assetImportLogDto.setCommunityId(result.getCommunityId()); |
| | | assetImportLogDto.setLogType(AssetImportLogDto.LOG_TYPE_OWENR_IMPORT); |
| | | List<AssetImportLogDetailDto> assetImportLogDetailDtos = new ArrayList<>(); |
| | | assetImportLogDto.setAssetImportLogDetailDtos(assetImportLogDetailDtos); |
| | | long successCount = 0L; |
| | | long failCount = 0L; |
| | | AssetImportLogDetailDto assetImportLogDetailDto = null; |
| | | try { |
| | | for (ImportOwner owner : owners) { |
| | | JSONObject savedOwnerInfo = getExistsOwner(pd, result, owner); |
| | | |
| | | for (ImportOwner owner : owners) { |
| | | JSONObject savedOwnerInfo = getExistsOwner(pd, result, owner); |
| | | |
| | | if (savedOwnerInfo != null) { |
| | | owner.setOwnerId(savedOwnerInfo.getString("ownerId")); |
| | | continue; |
| | | } |
| | | paramIn = new JSONObject(); |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/owner.saveOwner"; |
| | | |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("userId", result.getUserId()); |
| | | paramIn.put("name", owner.getOwnerName()); |
| | | paramIn.put("age", owner.getAge()); |
| | | paramIn.put("link", owner.getTel()); |
| | | paramIn.put("sex", owner.getSex()); |
| | | paramIn.put("ownerTypeCd", "1001"); |
| | | paramIn.put("idCard", owner.getIdCard()); |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | |
| | | if (responseEntity.getStatusCode() == HttpStatus.OK) { |
| | | JSONObject body = JSONObject.parseObject(responseEntity.getBody()); |
| | | if (body.containsKey("code") && body.getIntValue("code") != 0) { |
| | | throw new IllegalArgumentException(body.getString("msg")); |
| | | if (savedOwnerInfo != null) { |
| | | owner.setOwnerId(savedOwnerInfo.getString("ownerId")); |
| | | continue; |
| | | } |
| | | savedOwnerInfo = getExistsOwner(pd, result, owner); |
| | | owner.setOwnerId(savedOwnerInfo.getString("ownerId")); |
| | | paramIn = new JSONObject(); |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/owner.saveOwner"; |
| | | |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("userId", result.getUserId()); |
| | | paramIn.put("name", owner.getOwnerName()); |
| | | paramIn.put("age", owner.getAge()); |
| | | paramIn.put("link", owner.getTel()); |
| | | paramIn.put("sex", owner.getSex()); |
| | | paramIn.put("ownerTypeCd", "1001"); |
| | | paramIn.put("idCard", owner.getIdCard()); |
| | | paramIn.put("source", "BatchImport"); |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), apiUrl, HttpMethod.POST); |
| | | |
| | | /***************************************导入日志记录****************************************************/ |
| | | if (responseEntity.getStatusCode() == HttpStatus.OK) { |
| | | JSONObject body = JSONObject.parseObject(responseEntity.getBody()); |
| | | if (body.containsKey("code") && body.getIntValue("code") != 0) { |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | assetImportLogDetailDto.setState(body.getString("code")); |
| | | assetImportLogDetailDto.setMessage(body.getString("msg")); |
| | | assetImportLogDetailDto.setObjName(owner.getOwnerName()); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | failCount += 1; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | throw new IllegalArgumentException(body.getString("msg")); |
| | | } |
| | | savedOwnerInfo = getExistsOwner(pd, result, owner); |
| | | owner.setOwnerId(savedOwnerInfo.getString("ownerId")); |
| | | successCount += 1; |
| | | } else { |
| | | failCount += 1; |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | if (Assert.isJsonObject(responseEntity.getBody())) { |
| | | JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody()); |
| | | assetImportLogDetailDto.setState(paramOut.getString("code")); |
| | | assetImportLogDetailDto.setMessage(paramOut.getString("msg")); |
| | | } else { |
| | | assetImportLogDetailDto.setState("F"); |
| | | assetImportLogDetailDto.setMessage(responseEntity.getBody()); |
| | | } |
| | | assetImportLogDetailDto.setObjName(owner.getOwnerName()); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | } |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | } |
| | | } finally { |
| | | saveTransactionLogSMOImpl.saveAssetImportLog(assetImportLogDto); |
| | | } |
| | | |
| | | return responseEntity; |
| | |
| | | String apiUrl = ""; |
| | | JSONObject paramIn = null; |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>("成功", HttpStatus.OK); |
| | | for (ImportFloor importFloor : floors) { |
| | | paramIn = new JSONObject(); |
| | | //先保存 楼栋信息 |
| | | JSONObject savedFloorInfo = getExistsFloor(pd, result, importFloor); |
| | | // 如果不存在,才插入 |
| | | if (savedFloorInfo == null) { |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/floor.saveFloor"; |
| | | |
| | | AssetImportLogDto assetImportLogDto = new AssetImportLogDto(); |
| | | assetImportLogDto.setSuccessCount(0L); |
| | | assetImportLogDto.setErrorCount(0L); |
| | | assetImportLogDto.setCommunityId(result.getCommunityId()); |
| | | assetImportLogDto.setLogType(AssetImportLogDto.LOG_TYPE_FLOOR_UNIT_IMPORT); |
| | | List<AssetImportLogDetailDto> assetImportLogDetailDtos = new ArrayList<>(); |
| | | assetImportLogDto.setAssetImportLogDetailDtos(assetImportLogDetailDtos); |
| | | long successCount = 0L; |
| | | long failCount = 0L; |
| | | AssetImportLogDetailDto assetImportLogDetailDto = null; |
| | | try { |
| | | for (ImportFloor importFloor : floors) { |
| | | paramIn = new JSONObject(); |
| | | //先保存 楼栋信息 |
| | | JSONObject savedFloorInfo = getExistsFloor(pd, result, importFloor); |
| | | // 如果不存在,才插入 |
| | | if (savedFloorInfo == null) { |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/floor.saveFloor"; |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | 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); |
| | | } |
| | | |
| | | /***************************************导入日志记录****************************************************/ |
| | | if (responseEntity != null && responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息 |
| | | failCount += 1; |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | if (Assert.isJsonObject(responseEntity.getBody())) { |
| | | JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody()); |
| | | assetImportLogDetailDto.setState(paramOut.getString("code")); |
| | | assetImportLogDetailDto.setMessage(paramOut.getString("msg")); |
| | | } else { |
| | | assetImportLogDetailDto.setState("F"); |
| | | assetImportLogDetailDto.setMessage(responseEntity.getBody()); |
| | | } |
| | | assetImportLogDetailDto.setObjName(importFloor.getFloorNum() + "栋"); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | continue; |
| | | } else { |
| | | successCount += 1; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | } |
| | | |
| | | |
| | | if (savedFloorInfo == null) { |
| | | continue; |
| | | } |
| | | importFloor.setFloorId(savedFloorInfo.getString("floorId")); |
| | | paramIn.clear(); |
| | | //判断单元信息是否已经存在,如果存在则不保存数据unit.queryUnits |
| | | JSONObject savedUnitInfo = getExistsUnit(pd, result, importFloor); |
| | | if (savedUnitInfo != null) { |
| | | importFloor.setUnitId(savedUnitInfo.getString("unitId")); |
| | | continue; |
| | | } |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/unit.saveUnit"; |
| | | |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("floorNum", importFloor.getFloorNum()); |
| | | paramIn.put("userId", result.getUserId()); |
| | | paramIn.put("name", importFloor.getFloorNum() + "号楼"); |
| | | paramIn.put("floorArea", 1.00); |
| | | |
| | | paramIn.put("floorId", savedFloorInfo.getString("floorId")); |
| | | 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); |
| | | savedFloorInfo = getExistsFloor(pd, result, importFloor); |
| | | } |
| | | if (responseEntity != null && responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息 |
| | | continue; |
| | | } |
| | | |
| | | |
| | | if (savedFloorInfo == null) { |
| | | continue; |
| | | } |
| | | importFloor.setFloorId(savedFloorInfo.getString("floorId")); |
| | | paramIn.clear(); |
| | | //判断单元信息是否已经存在,如果存在则不保存数据unit.queryUnits |
| | | JSONObject savedUnitInfo = getExistsUnit(pd, result, importFloor); |
| | | if (savedUnitInfo != null) { |
| | | /****************************** 开始记录失败日志 *******************************/ |
| | | if (responseEntity != null && responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息 |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | if (Assert.isJsonObject(responseEntity.getBody())) { |
| | | JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody()); |
| | | assetImportLogDetailDto.setState(paramOut.getString("code")); |
| | | assetImportLogDetailDto.setMessage(paramOut.getString("msg")); |
| | | } else { |
| | | assetImportLogDetailDto.setState("F"); |
| | | assetImportLogDetailDto.setMessage(responseEntity.getBody()); |
| | | } |
| | | assetImportLogDetailDto.setObjName(importFloor.getFloorNum() + "栋" + importFloor.getUnitNum() + "单元"); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | failCount += 1; |
| | | successCount = successCount > 0 ? successCount - 1 : successCount; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | } else { |
| | | JSONObject body = JSONObject.parseObject(responseEntity.getBody()); |
| | | if (body.containsKey("code") && body.getIntValue("code") != 0) { |
| | | assetImportLogDetailDto = new AssetImportLogDetailDto(); |
| | | assetImportLogDetailDto.setCommunityId(assetImportLogDto.getCommunityId()); |
| | | assetImportLogDetailDto.setState(body.getString("code")); |
| | | assetImportLogDetailDto.setMessage(body.getString("msg")); |
| | | assetImportLogDetailDto.setObjName(importFloor.getFloorNum() + "栋" + importFloor.getUnitNum() + "单元"); |
| | | assetImportLogDetailDtos.add(assetImportLogDetailDto); |
| | | failCount += 1; |
| | | successCount = successCount > 0 ? successCount - 1 : successCount; |
| | | assetImportLogDto.setSuccessCount(successCount); |
| | | assetImportLogDto.setErrorCount(failCount); |
| | | } |
| | | } |
| | | //将unitId 刷入ImportFloor对象 |
| | | savedUnitInfo = getExistsUnit(pd, result, importFloor); |
| | | importFloor.setUnitId(savedUnitInfo.getString("unitId")); |
| | | continue; |
| | | |
| | | } |
| | | |
| | | apiUrl = ServiceConstant.SERVICE_API_URL + "/api/unit.saveUnit"; |
| | | |
| | | paramIn.put("communityId", result.getCommunityId()); |
| | | paramIn.put("floorId", savedFloorInfo.getString("floorId")); |
| | | 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对象 |
| | | savedUnitInfo = getExistsUnit(pd, result, importFloor); |
| | | importFloor.setUnitId(savedUnitInfo.getString("unitId")); |
| | | |
| | | } finally { |
| | | saveTransactionLogSMOImpl.saveAssetImportLog(assetImportLogDto); |
| | | } |
| | | return responseEntity; |
| | | } |
| | |
| | | importParkingSpace.setCarType(os[7].toString()); |
| | | importParkingSpace.setCarColor(os[8].toString()); |
| | | importParkingSpace.setSellOrHire(os[9].toString()); |
| | | |
| | | String startTime = excelDoubleToDate(os[10].toString()); |
| | | String endTime = excelDoubleToDate(os[11].toString()); |
| | | 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 文本格式"); |
| | | importParkingSpace.setStartTime(startTime); |
| | | importParkingSpace.setEndTime(endTime); |
| | | } |
| | | |
| | | parkingSpaces.add(importParkingSpace); |
| | | } |
| | | } |
| | | |
| | | //解析Excel日期格式 |
| | | public static String excelDoubleToDate(String strDate) { |
| | | if (strDate.length() == 5) { |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date tDate = DoubleToDate(Double.parseDouble(strDate)); |
| | | return sdf.format(tDate); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return strDate; |
| | | } |
| | | } |
| | | return strDate; |
| | | } |
| | | |
| | | |
| | | //解析Excel日期格式 |
| | | public static Date DoubleToDate(Double dVal) { |
| | | Date tDate = new Date(); |
| | | long localOffset = tDate.getTimezoneOffset() * 60000; //系统时区偏移 1900/1/1 到 1970/1/1 的 25569 天 |
| | | tDate.setTime((long) ((dVal - 25569) * 24 * 3600 * 1000 + localOffset)); |
| | | |
| | | return tDate; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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 (os.length > 6 && !StringUtil.isNullOrNone(os[6])) { |
| | | 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) + "行租金为空"); |
| | | 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())); |
| | | importRoom.setRoomSubType(os[9].toString()); |
| | | importRoom.setRoomArea(os[10].toString()); |
| | | importRoom.setRoomRent(os[11].toString()); |
| | | |
| | | if (!StringUtil.isNullOrNone(os[6])) { |
| | | importRoom.setRoomFeeId(os[7].toString()); |
| | | importRoom.setFeeEndDate(os[8].toString()); |
| | | } |
| | | if (StringUtil.isNullOrNone(os[6])) { |
| | | |
| | | if (os.length > 6 && !StringUtil.isNullOrNone(os[6])) { |
| | | importRoom.setRoomFeeId(os[7].toString()); |
| | | importRoom.setFeeEndDate(os[8].toString()); |
| | | } |
| | | if (os.length < 7 || StringUtil.isNullOrNone(os[6])) { |
| | | rooms.add(importRoom); |
| | | continue; |
| | | } |
| | | importRoom.setImportOwner(getImportOwner(owners, os[6].toString())); |
| | | rooms.add(importRoom); |
| | | continue; |
| | | } catch (Exception e) { |
| | | logger.error("房屋数据校验失败", e); |
| | | throw new IllegalArgumentException("房屋信息sheet中第" + (osIndex + 1) + "行数据错误,请检查" + e.getLocalizedMessage()); |
| | | } |
| | | importRoom.setImportOwner(getImportOwner(owners, os[6].toString())); |
| | | rooms.add(importRoom); |
| | | } |
| | | } |
| | | |