From dd6687b118561100e1677e88a9c2f5842a54c531 Mon Sep 17 00:00:00 2001
From: jialh <1972868360@qq.com>
Date: 星期四, 16 四月 2026 18:14:14 +0800
Subject: [PATCH] 水电话费

---
 service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomOwnerV2QueueDataAdapt.java |  131 +++++++++++++++++++++++++------------------
 1 files changed, 76 insertions(+), 55 deletions(-)

diff --git a/service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomOwnerV2QueueDataAdapt.java b/service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomOwnerV2QueueDataAdapt.java
index 78410f7..d19e21b 100644
--- a/service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomOwnerV2QueueDataAdapt.java
+++ b/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,25 +166,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 +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);
@@ -204,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());
@@ -220,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);
@@ -257,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);
@@ -288,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());
@@ -306,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());
@@ -339,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");
@@ -371,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 鏃堕棿娈甸渶瑕佹媶鍒�
@@ -384,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());
@@ -424,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());
@@ -444,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());
@@ -463,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());
@@ -498,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());
@@ -507,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)));
@@ -524,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());

--
Gitblit v1.8.0