jialh
1 天以前 dd6687b118561100e1677e88a9c2f5842a54c531
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);
                }
            }
        }
@@ -127,17 +133,24 @@
     * @param assetImportLogDetailDto
     */
    private void doImportData(AssetImportLogDetailDto assetImportLogDetailDto) {
        String test = "";
        int a = 6;
        JSONArray objects = JSONObject.parseArray(assetImportLogDetailDto.getContent());
        if (Vtil.defaultValue(objects.get(16)).equals("")){
            throw new IllegalArgumentException("房屋面积不能为空");
        if (Vtil.defaultValue(objects.get(11)) == null) {
            objects.set(11, "无名");
            test = test + "\n业主名称为空";
//            throw new IllegalArgumentException("业主名称不能为空");
        }
        if (Vtil.defaultValue(objects.get(54)).length() > 1){
            throw new IllegalArgumentException("性别内容有误!");
        if (Vtil.defaultValue(objects.get(16)) == null){
            objects.set(16, "0");
            test = test + "\n房屋面积为空";
        }
//        if (Vtil.defaultValue(objects.get(54)) == null){
//            throw new IllegalArgumentException("性别内容有误!");
//        }
        ImportOwnerRoomDto importOwnerRoomDto = new ImportOwnerRoomDto();//房屋
@@ -153,7 +166,7 @@
        importOwnerRoomDto.setPersonRole(OwnerDto.PERSON_ROLE_OWNER);
        importOwnerRoomDto.setMonthlyUnitPrice(objects.getString(23));
        importOwnerRoomDto.setPropertyFeeMonth(objects.getString(24));
        if (!Vtil.defaultValue(objects.get(1)).isEmpty()) {
        if (Vtil.defaultValue(objects.get(1)) != null) {
            //--------设置物业类型
            DictDto dictDto = new DictDto();
            dictDto.setTableName("building_room");
@@ -182,7 +195,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);
@@ -206,7 +219,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());
@@ -222,23 +235,31 @@
        List<Object> objects1 = sqlSessionTemplate.selectList("roomServiceDaoImpl.getRoomInfo", BeanConvertUtil.beanCovertMap(roomDto));
        if (!objects1.isEmpty()) {
            throw new IllegalArgumentException("重复的房屋:");
//            throw new IllegalArgumentException("重复的房屋:");
            test = test + "\n重复的房屋:来自导入记录:" + assetImportLogDetailDto.getLogId() + "\t" + assetImportLogDetailDto.getDetailId();
        }
        List<FeeConfigDto> feeDtos = null;
        if (!importOwnerRoomDto.getCommunityId().isEmpty()){
            FeeConfigDto feeConfigDto = new FeeConfigDto();
            feeConfigDto.setCommunityId(importOwnerRoomDto.getCommunityId());
            feeConfigDto.setSecondaryFeeTypeCdName(importOwnerRoomDto.getPropertyType());
            feeDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
            if (feeDtos.isEmpty()) {
                throw new IllegalArgumentException("物业类型`"+importOwnerRoomDto.getPropertyType()+"`未查询到收费项");
            if (importOwnerRoomDto.getPropertyType() == null) {
//                throw new IllegalArgumentException("物业类型为空");
                test = test + "\n物业类型为空,无法添加费用";
            }
            else {
                feeConfigDto.setSecondaryFeeTypeCdName(importOwnerRoomDto.getPropertyType());
                feeDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
                if (feeDtos.isEmpty()) {
//                    throw new IllegalArgumentException("物业类型`"+importOwnerRoomDto.getPropertyType()+"`未查询到收费项");
                    test = test + "\n物业类型`"+importOwnerRoomDto.getPropertyType()+"`未查询到收费项,无法添加费用";
                }
            }
        }
        //---------家庭成员、租客
        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);
@@ -259,7 +280,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);
@@ -290,7 +311,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());
@@ -308,7 +329,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());
@@ -341,15 +362,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");
@@ -373,7 +394,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 时间段需要拆分
@@ -386,9 +407,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());
@@ -426,7 +447,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());
@@ -446,11 +467,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());
@@ -465,13 +486,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());
@@ -500,7 +521,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());
@@ -509,11 +530,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)));
@@ -526,9 +546,8 @@
            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");
        importOwnerRoomDto.setRemark(test);
        importOwnerRoomInnerServiceSMOImpl.saveOwnerRoom(importOwnerRoomDto);
        OwnerDto ownerDto = new OwnerDto();
        ownerDto.setOwnerId(importOwnerRoomDto.getOwnerId());