chengf
2026-03-27 1e20f9b6c5bc642f92f77388c5f339f05a3ae9be
service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomOwnerV2QueueDataAdapt.java
@@ -110,11 +110,17 @@
                }
            } catch (Exception e) {
                e.printStackTrace();
                if (e.getMessage().contains("### Error updating database")){
                    updateImportLogDetailState(assetImportLogDetailDto.getDetailId(), "未知错误,请联系管理员" + e.getMessage());
                }
                else {
                    updateImportLogDetailState(assetImportLogDetailDto.getDetailId(), e);
                String errorMsg = e.getMessage();
                // 先判空,再判断包含关系
                if (errorMsg != null && errorMsg.contains("### Error updating database")) {
                    updateImportLogDetailState(assetImportLogDetailDto.getDetailId(),
                            "未知错误,请联系管理员" + errorMsg);
                } else {
                    // 补充:这里也建议对 e 做兜底处理,避免传递空的异常信息
                    String finalMsg = errorMsg != null ? errorMsg : e.toString();
                    updateImportLogDetailState(assetImportLogDetailDto.getDetailId(), finalMsg);
                    // 如果原方法 updateImportLogDetailState 接收 Exception 类型参数,可保留:
                    // updateImportLogDetailState(assetImportLogDetailDto.getDetailId(), e);
                }
            }
        }
@@ -131,13 +137,17 @@
        int a = 6;
        JSONArray objects = JSONObject.parseArray(assetImportLogDetailDto.getContent());
        if (Vtil.defaultValue(objects.get(16)).equals("")){
//        if (Vtil.defaultValue(objects.get(11)) == null) {
//            throw new IllegalArgumentException("业主名称不能为空");
//        }
        if (Vtil.defaultValue(objects.get(16)) == null){
            throw new IllegalArgumentException("房屋面积不能为空");
        }
        if (Vtil.defaultValue(objects.get(54)).length() > 1){
            throw new IllegalArgumentException("性别内容有误!");
        }
//        if (Vtil.defaultValue(objects.get(54)) == null){
//            throw new IllegalArgumentException("性别内容有误!");
//        }
        ImportOwnerRoomDto importOwnerRoomDto = new ImportOwnerRoomDto();//房屋
@@ -153,25 +163,27 @@
        importOwnerRoomDto.setPersonRole(OwnerDto.PERSON_ROLE_OWNER);
        importOwnerRoomDto.setMonthlyUnitPrice(objects.getString(23));
        importOwnerRoomDto.setPropertyFeeMonth(objects.getString(24));
        //--------设置物业类型
        DictDto dictDto = new DictDto();
        dictDto.setTableName("building_room");
        dictDto.setTableColumns("room_sub_type");
        dictDto.setName(Vtil.defaultValue(objects.get(1)));
        List<DictDto> dictDtos = dictV1InnerServiceSMOImpl.queryDictAndSpecs(dictDto);
        if (dictDtos.isEmpty()) {
            DictPo dictPo = new DictPo();
            dictPo.setStatusCd(GenerateCodeFactory.getGeneratorId("2"));
            dictPo.setTableName("building_room");
            dictPo.setTableColumns("room_sub_type");
            dictPo.setName(Vtil.defaultValue(objects.get(1)));
            dictV1InnerServiceSMOImpl.saveDict(dictPo);
            dictDtos = dictV1InnerServiceSMOImpl.queryDictAndSpecs(dictDto);
        if (Vtil.defaultValue(objects.get(1)) != null) {
            //--------设置物业类型
            DictDto dictDto = new DictDto();
            dictDto.setTableName("building_room");
            dictDto.setTableColumns("room_sub_type");
            dictDto.setName(Vtil.defaultValue(objects.get(1)));
            List<DictDto> dictDtos = dictV1InnerServiceSMOImpl.queryDictAndSpecs(dictDto);
            if (dictDtos.isEmpty()) {
                throw new IllegalArgumentException("导入失败:字典中不存在物业类型:" + Vtil.defaultValue(objects.get(1)));
                DictPo dictPo = new DictPo();
                dictPo.setStatusCd(GenerateCodeFactory.getGeneratorId("2"));
                dictPo.setTableName("building_room");
                dictPo.setTableColumns("room_sub_type");
                dictPo.setName(Vtil.defaultValue(objects.get(1)));
                dictV1InnerServiceSMOImpl.saveDict(dictPo);
                dictDtos = dictV1InnerServiceSMOImpl.queryDictAndSpecs(dictDto);
                if (dictDtos.isEmpty()) {
                    throw new IllegalArgumentException("导入失败:字典中不存在物业类型:" + Vtil.defaultValue(objects.get(1)));
                }
            }
            importOwnerRoomDto.setRoomSubType(dictDtos.get(0).getStatusCd());
        }
        importOwnerRoomDto.setRoomSubType(dictDtos.get(0).getStatusCd());
        //----------
        importOwnerRoomDto.setPropertyType(Vtil.defaultValue(objects.get(2)));//住宅类型
@@ -180,7 +192,7 @@
        CommunityDto communityDto = new CommunityDto();
        communityDto.setCommunityCode(Vtil.defaultValue(objects.get(3)));
        communityDto.setName(Vtil.defaultValue(objects.get(4)));
        if (communityDto.getCommunityCode().equals("") && communityDto.getName().equals("")) {
        if (communityDto.getCommunityCode() == null && communityDto.getName() == null) {
            throw new IllegalArgumentException("导入失败:小区编码和小区名称都为空");
        }
        List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
@@ -204,7 +216,7 @@
        importOwnerRoomDto.setRoomNum(Vtil.defaultValue(objects.get(8)));//室
        importOwnerRoomDto.setDoorRoomNum(Vtil.defaultValue(objects.get(9)));//门市号
        importOwnerRoomDto.setPropertyAddress(Vtil.defaultValue(objects.get(10)));//业主地址
        importOwnerRoomDto.setRoomBuyer(Vtil.defaultValue(objects.get(11)));//购房人
        importOwnerRoomDto.setRoomBuyer(Vtil.defaultValue(objects.get(11) , null) == null ? "房屋:" + importOwnerRoomDto.getPropertyAddress() + "购房人姓名为空,待补全": Vtil.defaultValue(objects.get(11)));//购房人
        RoomDto roomDto = new RoomDto();
        roomDto.setCommunityId(importOwnerRoomDto.getCommunityId());
@@ -226,6 +238,9 @@
        if (!importOwnerRoomDto.getCommunityId().isEmpty()){
            FeeConfigDto feeConfigDto = new FeeConfigDto();
            feeConfigDto.setCommunityId(importOwnerRoomDto.getCommunityId());
            if (importOwnerRoomDto.getPropertyType() == null) {
                throw new IllegalArgumentException("物业类型为空");
            }
            feeConfigDto.setSecondaryFeeTypeCdName(importOwnerRoomDto.getPropertyType());
            feeDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
            if (feeDtos.isEmpty()) {
@@ -236,7 +251,7 @@
        //---------家庭成员、租客
        OwnerPo ownerPoTo3 = new OwnerPo();//
        if (!Vtil.defaultValue(objects.get(13)).isEmpty()) {
        if (Vtil.defaultValue(objects.get(13)) != null) {
            String link = Vtil.defaultValue(objects.get(13));
            OwnerDto ownerDto = new OwnerDto();
            ownerDto.setLink(link);
@@ -257,7 +272,7 @@
        }
        OwnerPo ownerPoTo2 = new OwnerPo();//TODO 租客未导入
        if (!Vtil.defaultValue(objects.get(15)).isEmpty()) {
        if (Vtil.defaultValue(objects.get(15)) != null) {
            String link = Vtil.defaultValue(objects.get(15));
            OwnerDto ownerDto = new OwnerDto();
            ownerDto.setLink(link);
@@ -288,7 +303,7 @@
        importOwnerRoomDto.setEoc(Vtil.defaultNum(objects.get(24+a)).toString());//设备运行费
        //-----TODO 待导入  催缴信息
        if (!Vtil.defaultValue(objects.get(31)).isEmpty()) {
        if (Vtil.defaultValue(objects.get(31)) != null) {
            OwnerCollectionDto ownerCollection = new OwnerCollectionDto();
            ownerCollection.setOwnerId(importOwnerRoomDto.getOwnerId());
            ownerCollection.setRoomId(importOwnerRoomDto.getRoomId());
@@ -306,7 +321,7 @@
        //-----
        //-----打折信息 TODO 未添加重复校验
        if (!Vtil.defaultValue(objects.get(42)).isEmpty()) {
        if (Vtil.defaultValue(objects.get(42)) != null) {
            ApplyRoomDiscountPo applyRoomDiscountPo = new ApplyRoomDiscountPo();//打折
            applyRoomDiscountPo.setArdId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_ardId));
            applyRoomDiscountPo.setCommunityId(importOwnerRoomDto.getCommunityId());
@@ -339,15 +354,15 @@
        importOwnerRoomDto.setTel(Vtil.defaultValue(objects.get(45+a)));//手机号
        importOwnerRoomDto.setIdCard(Vtil.defaultValue(objects.get(46+a)));//身份证
        importOwnerRoomDto.setAddress(Vtil.defaultValue(objects.get(47+a)));//TODO 导入逻辑未添加该字段  联络地址
        importOwnerRoomDto.setSex(Vtil.defaultValue(objects.get(48+a)).equals("") ?"2" :  Vtil.defaultValue(objects.get(48+a)));
        importOwnerRoomDto.setOwnerName(Vtil.defaultValue(objects.get(11)));
        importOwnerRoomDto.setSex(Vtil.defaultValue(objects.get(48+a)) == null ?"2" :  Vtil.defaultValue(objects.get(48+a)));
        importOwnerRoomDto.setOwnerName(Vtil.defaultValue(Vtil.defaultValue(objects.get(11) , null) == null ? "房屋:" + importOwnerRoomDto.getPropertyAddress() + "购房人姓名为空,待补全": Vtil.defaultValue(objects.get(11))));
        importOwnerRoomDto.setHouseholdPoliceStation(Vtil.defaultValue(objects.get(50+a)));
        importOwnerRoomDto.setPropertyCertificateNo(Vtil.defaultValue(objects.get(51+a)));
        importOwnerRoomDto.setIsEvChargerInstalled(Vtil.defaultValue(objects.get(52+a)));
        if (Vtil.defaultValue(objects.get(61),null) != null || Vtil.defaultValue(objects.get(141)).isEmpty() || Vtil.defaultValue(objects.get(147+a)).isEmpty() || Vtil.defaultValue(objects.get(149+a)).isEmpty()) {
        if (Vtil.defaultValue(objects.get(61),null) != null || Vtil.defaultValue(objects.get(141)) == null || Vtil.defaultValue(objects.get(147+a)) == null || Vtil.defaultValue(objects.get(149+a)) == null) {
            OweFeeCallablePo oweFeeCallablePo = new OweFeeCallablePo();
            oweFeeCallablePo.setOfcId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId));
            oweFeeCallablePo.setAmountdOwed("0");
@@ -371,7 +386,7 @@
//            oweFeeCallablePo.setDifferenceReason(Vtil.defaultValue(objects.get(157+a)));
//            oweFeeCallablePo.setReceiptTime(Vtil.defaultValue(objects.get(158+a)));
            oweFeeCallablePo.setPayee(Vtil.defaultValue(objects.get(159+a)));
            if (!Vtil.defaultValue(objects.get(160+a), "").equals("")) {
            if (Vtil.defaultValue(objects.get(160+a), "") != null) {
                oweFeeCallablePo.setRemark(oweFeeCallablePo.getRemark() + "。备注信息:" + Vtil.defaultValue(objects.get(160+a)));
            }
//            oweFeeCallablePo.setStartTime(Vtil.defaultValueToDate(objects.get(61)));//TODO 时间段需要拆分
@@ -384,9 +399,9 @@
            for (int i = 0; i < 5 ; i++) {
                int index = i*4 + 65;
                if(objects.get(index) == null || objects.get(index).equals("")) {
                    break;
                }
//                if(objects.get(index) == null || objects.get(index).equals("")) {
//                    break;
//                }
                HouseMailRecord houseMailRecord = new HouseMailRecord();
                houseMailRecord.setId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_houseId));
                houseMailRecord.setOwnerId(importOwnerRoomDto.getOwnerId());
@@ -424,7 +439,7 @@
            //----
            //----法院审理程序
            if (!Vtil.defaultValue(objects.get(141)).isEmpty()) {
//            if (!Vtil.defaultValue(objects.get(141)).isEmpty()) {
                CourtTrialProcedure courtTrialProcedure = new CourtTrialProcedure();
                courtTrialProcedure.setCallableId(oweFeeCallablePo.getOfcId());
                courtTrialProcedure.setOwnerId(importOwnerRoomDto.getOwnerId());
@@ -444,11 +459,11 @@
                courtTrialProcedure.setJudgmentResult(Vtil.defaultValue(objects.get(145+a)));
                courtTrialProcedure.setRemark(Vtil.defaultValue(objects.get(146+a)));
                applyRoomDiscountServiceDaoImpl.saveCourtTrialProcedure(BeanConvertUtil.beanCovertMap(courtTrialProcedure));
            }
//            }
            //-----
            //法院执行程序
            if (!Vtil.defaultValue(objects.get(147+a)).isEmpty() || !Vtil.defaultValue(objects.get(149+a)).isEmpty()) {
//            if (!Vtil.defaultValue(objects.get(147+a)).isEmpty() || !Vtil.defaultValue(objects.get(149+a)).isEmpty()) {
                CourtExecutionProcedure courtExecutionProcedure = new CourtExecutionProcedure();
                courtExecutionProcedure.setCallableId(oweFeeCallablePo.getOfcId());
                courtExecutionProcedure.setOwnerId(importOwnerRoomDto.getOwnerId());
@@ -463,13 +478,13 @@
                courtExecutionProcedure.setRemark(Vtil.defaultValue(objects.get(160+a)));
                applyRoomDiscountServiceDaoImpl.saveCourtExecutionProcedure(BeanConvertUtil.beanCovertMap(courtExecutionProcedure));
            }
//            }
            //----添加电联
            List<Object> mailCallRecords = new ArrayList<Object>();
            for (int i = 0 ; i < 9 ; i++) {
                int index = i * 3 + 86;
                if(Vtil.defaultValue(objects.get(index)).isEmpty()){
                if(Vtil.defaultValue(objects.get(index)) == null){
//                if (i == 0){
//                    MailCallRecord mailCallRecord = new MailCallRecord();
//                    mailCallRecord.setRemark(objects.get(115).toString());
@@ -498,7 +513,7 @@
        //产调日期
        if (!Vtil.defaultValue(objects.get(126)).isEmpty()) {
//        if (!Vtil.defaultValue(objects.get(126)).isEmpty()) {
            OwnerPropertySurvey ownerPropertySurvey = new OwnerPropertySurvey();
            ownerPropertySurvey.setOwnerId(importOwnerRoomDto.getOwnerId());
            ownerPropertySurvey.setRoomId(importOwnerRoomDto.getRoomId());
@@ -507,11 +522,10 @@
            ownerPropertySurvey.setName(Vtil.defaultValue(objects.get(127)));
            ownerPropertySurvey.setExtraDate(Vtil.defaultValueToDate(objects.get(128)));
            int save = applyRoomDiscountServiceDaoImpl.saveOwnerPropertySurvey(BeanConvertUtil.beanCovertMap(ownerPropertySurvey));
        }
//        }
        //----
        //诉讼
        if (!Vtil.defaultValue(objects.get(130)).isEmpty()) {
            LitigationInfoPo litigationInfoPo = new LitigationInfoPo();
            litigationInfoPo.setLitigationDate(Vtil.defaultValue(objects.get(130)));
            litigationInfoPo.setArrearsPeriod(Vtil.defaultValue(objects.get(131)));
@@ -524,8 +538,7 @@
            litigationInfoPo.setOwnerId(importOwnerRoomDto.getOwnerId());
            sqlSessionTemplate.insert("litigationInfoServiceDaoImpl.saveLitigationInfo",
                    BeanConvertUtil.beanCovertMap(litigationInfoPo));
        }
        importOwnerRoomDto.setRoomState(importOwnerRoomDto.getOwnerName().equals("") ? "2004" : "2001");
        importOwnerRoomDto.setRoomState(importOwnerRoomDto.getOwnerName() == null ? "2004" : "2001");
        importOwnerRoomInnerServiceSMOImpl.saveOwnerRoom(importOwnerRoomDto);
        OwnerDto ownerDto = new OwnerDto();