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/ImportReportMainV2QueueDataAdapt.java |  768 +++++++++++++++++++++++++++--------------------------------
 1 files changed, 352 insertions(+), 416 deletions(-)

diff --git a/service-job/src/main/java/com/java110/job/importData/adapt/ImportReportMainV2QueueDataAdapt.java b/service-job/src/main/java/com/java110/job/importData/adapt/ImportReportMainV2QueueDataAdapt.java
index 30754a9..a927ca6 100644
--- a/service-job/src/main/java/com/java110/job/importData/adapt/ImportReportMainV2QueueDataAdapt.java
+++ b/service-job/src/main/java/com/java110/job/importData/adapt/ImportReportMainV2QueueDataAdapt.java
@@ -3,18 +3,23 @@
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.importData.Vtil;
 import com.java110.dto.log.AssetImportLogDetailDto;
 import com.java110.dto.msg.MaintenancePaymentPo;
 import com.java110.dto.msg.MpFifthPaymentRecordPo;
 import com.java110.dto.msg.MpPaymentRecordPo;
+import com.java110.fee.api.*;
 import com.java110.job.dao.IMaintenancePaymentService;
 import com.java110.job.dao.IMpFifthPaymentRecordService;
 import com.java110.job.dao.IMpPaymentRecordService;
 import com.java110.job.importData.DefaultImportData;
 import com.java110.job.importData.IImportDataAdapt;
+import com.java110.po.importFee.MaintenancePayment;
+import com.java110.po.importFee.MpFifthPaymentRecord;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.DateUtil;
 import com.java110.utils.util.NumberUtil;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -31,483 +36,414 @@
 @Service("importReportMainV2QueueData")
 public class ImportReportMainV2QueueDataAdapt extends DefaultImportData implements IImportDataAdapt {
 
-    // 鏃ユ湡鏍煎紡鍖栧櫒锛堝鐞咵xcel涓殑澶氱鏃ユ湡鏍煎紡锛�2025/6/11銆�8/11/25銆�2025.5.13绛夛級
-    private static final SimpleDateFormat[] DATE_FORMATS = {
-            new SimpleDateFormat("yyyy/MM/dd"),
-            new SimpleDateFormat("MM/dd/yy"),
-            new SimpleDateFormat("yyyy.MM.dd"),
-            new SimpleDateFormat("yyyy-MM-dd")
-    };
+
+    @Autowired
+    MaintenancePaymentApi maintenancePaymentApi;
+    @Autowired
+    AnnouncementTimeRangeApi announcementTimeRangeApi;
+    @Autowired
+    OwnersCommitteeConventionApi ownersCommitteeConventionApi;
+    @Autowired
+    OwnerWithdrawalInfoApi ownerWithdrawalInfoApi;
+    @Autowired
+    OwnerQualityGuaranteeApi ownerQualityGuaranteeApi;
+    @Autowired
+    MpPaymentRecordApi mpPaymentRecordApi;
+    @Autowired
+    MpFifthPaymentRecordApi mpFifthPaymentRecordApi;
+    @Autowired
+    OwnerRemarkInfoApi ownerRemarkInfoApi;
 
     // 娉ㄥ叆鏁版嵁搴撴湇鍔★紙SqlSessionTemplate鐗圫ervice锛�
-    @Autowired
-    private IMaintenancePaymentService maintenancePaymentService;
-    @Autowired
-    private IMpPaymentRecordService mpPaymentRecordService;
-    @Autowired
-    private IMpFifthPaymentRecordService mpFifthPaymentRecordService;
-
     @Override
-    @Transactional(rollbackFor = Exception.class) // 浜嬪姟鎺у埗锛岀‘淇�3寮犺〃鏁版嵁涓�鑷存��
     public void importData(List<AssetImportLogDetailDto> assetImportLogDetailDtos) {
         for (AssetImportLogDetailDto logDetailDto : assetImportLogDetailDtos) {
             try {
-                // 1. 瑙f瀽Excel琛屾暟鎹紙JSONArray瀵瑰簲姣忚鐨勫崟鍏冩牸鍒楄〃锛岄『搴忎笌"鑽i『鑻戠鎶ュ崟"琛ㄥご涓�鑷达級
-                JSONArray cellArray = JSONObject.parseArray(logDetailDto.getContent());
-//                if (cellArray.size() < 132) { // 鑽i『鑻戠鎶ュ崟琛ㄥご鍏�132鍒楋紝杩囨护鏃犳晥琛�
-//                    throw new RuntimeException("琛屾暟鎹垪鏁颁笉瓒筹紙闇�132鍒楋級锛屽綋鍓嶅垪鏁帮細" + cellArray.size());
-//                }
 
-                // 2. 鏍¢獙鏍稿績蹇呭~瀛楁锛堟祦杞紪鍙枫�侀」鐩悕绉般�佷笟濮斾細閲戦绛夛級
+                JSONArray cellArray = JSONObject.parseArray(logDetailDto.getContent());
+
+
+
                 String flowNumber = getCellValue(cellArray, 1); // 绗�2鍒楋細娴佽浆缂栧彿
                 String projectName = getCellValue(cellArray, 4); // 绗�5鍒楋細椤圭洰鍚嶇О
                 String ownersCommitteeAmountStr = getCellValue(cellArray, 12); // 绗�13鍒楋細涓氬浼氶噾棰�
-                if (isBlank(flowNumber) || isBlank(projectName) || isBlank(ownersCommitteeAmountStr)) {
-                    throw new RuntimeException(
-                            String.format("鏍稿績瀛楁缂哄け锛氭祦杞紪鍙穂%s]銆侀」鐩悕绉癧%s]銆佷笟濮斾細閲戦[%s]",
-                                    flowNumber, projectName, ownersCommitteeAmountStr)
-                    );
-                }
+                AnnouncementTimeRangePo announcementTimeRangePo = null;
+                OwnersCommitteeConventionPo ocoPo = null;
+                OwnerWithdrawalInfoPo owiPo = null;
+                OwnerQualityGuaranteePo oqgPo = null;
+                OwnerRemarkInfoPo ownerRemarkInfoPo = null;
 
                 // 3. 鏋勫缓3寮犺〃鐨凱O瀵硅薄锛堝瓧娈垫槧灏�+涓氬姟璁$畻锛�
-                MaintenancePaymentPo mainPo = buildMaintenancePaymentPo(cellArray);
-                List<MpPaymentRecordPo> paymentRecordPos = buildMpPaymentRecordPos(cellArray, mainPo.getFlowNumber(),mainPo.getId());
-                MpFifthPaymentRecordPo fifthPo = buildMpFifthPaymentRecordPo(cellArray, mainPo.getFlowNumber(),mainPo.getId());
+                MaintenancePayment mainPo = buildMaintenancePaymentPoV2(cellArray);//涓昏〃
+//                if (!getCellValue(cellArray, 22).isEmpty() && !getCellValue(cellArray, 23).isEmpty()) {
+                    announcementTimeRangePo = buildAnnouncementTimeRangePo(cellArray, mainPo.getId());//鍏叡鏀剁泭閲�
+//                }
+//                if (!getCellValue(cellArray, 26).isEmpty() && !getCellValue(cellArray, 27).isEmpty()) {
+                    ocoPo = buildOwnersCommitteeConventionPo(cellArray, mainPo.getId());
+//                }
+//                if (!getCellValue(cellArray, 29).isEmpty()) {
+                    owiPo = buildOwnerWithdrawalInfoPo(cellArray, mainPo.getId());
+//                }
+//                if (!getCellValue(cellArray, 39).isEmpty()) {
+                    oqgPo = buildOwnerQualityGuaranteePo(cellArray, mainPo.getId());
+//                }
+                List<MpPaymentRecordPo> paymentRecordPos = buildMpPaymentRecordPos(cellArray, mainPo.getFlowNumber(), mainPo.getId());
+                List<MpFifthPaymentRecord> fifthPos = buildMpFifthPaymentRecordPos(cellArray, mainPo.getFlowNumber(), mainPo.getId());
+//                if (!getCellValue(cellArray, 137).isEmpty()) {
+                    ownerRemarkInfoPo = buildOwnerRemarkInfoPo(cellArray, mainPo.getFlowNumber(), mainPo.getId());
+//                }
 
-                // 4. 鎵归噺淇濆瓨鍒版暟鎹簱
-                saveToDatabase(mainPo, paymentRecordPos, fifthPo);
+                importData(mainPo, announcementTimeRangePo, ocoPo, owiPo, oqgPo, paymentRecordPos, fifthPos, ownerRemarkInfoPo);
 
                 // 5. 鏇存柊瀵煎叆鏃ュ織鐘舵�侊紙鎴愬姛锛�- 璋冪敤鐖剁被鏂规硶
-                super.updateImportLogDetailState(logDetailDto.getDetailId());
+                updateImportLogDetailState(logDetailDto.getDetailId());
 
             } catch (Exception e) {
                 e.printStackTrace();
-                // 6. 鏇存柊瀵煎叆鏃ュ織鐘舵�侊紙澶辫触锛�- 璋冪敤鐖剁被寮傚父閲嶈浇鏂规硶
-                super.updateImportLogDetailState(logDetailDto.getDetailId(), e);
+                updateImportLogDetailState(logDetailDto.getDetailId(), e);
             }
         }
     }
 
-    /**
-     * 鏋勫缓 MaintenancePaymentPo锛堢淮淇祫閲戞敮鍙栦俊鎭〃锛�
-     * 瀛楁鏄犲皠瀵瑰簲"鑽i『鑻戠鎶ュ崟"琛ㄥご椤哄簭锛屽寘鍚�17涓嚜鍔ㄨ绠楀瓧娈�
-     */
-    private MaintenancePaymentPo buildMaintenancePaymentPo(JSONArray cellArray) throws ParseException {
-        MaintenancePaymentPo po = new MaintenancePaymentPo();
-        // 鍩虹瀛楁锛堢洿鎺ユ槧灏凟xcel鍗曞厓鏍硷級
+    private void importData(MaintenancePayment mainPo, AnnouncementTimeRangePo announcementTimeRangePo, OwnersCommitteeConventionPo ocoPo, OwnerWithdrawalInfoPo owiPo, OwnerQualityGuaranteePo oqgPo,
+                            List<MpPaymentRecordPo> paymentRecordPos, List<MpFifthPaymentRecord> fifthPos, OwnerRemarkInfoPo ownerRemarkInfoPo) {
+        maintenancePaymentApi.saveMaintenancePayment(mainPo);
+        if (announcementTimeRangePo != null) {
+            announcementTimeRangeApi.saveAnnouncementTimeRangeInfo(announcementTimeRangePo);
+        }
+        if (ocoPo != null) {
+            ownersCommitteeConventionApi.saveOwnersCommitteeConvention(ocoPo);
+        }
+        if (owiPo != null) {
+            ownerWithdrawalInfoApi.saveOwnerWithdrawalInfo(owiPo);
+        }
+        if (oqgPo != null) {
+            ownerQualityGuaranteeApi.saveOwnerQualityGuarantee(oqgPo);
+        }
+        for (MpPaymentRecordPo paymentRecordPo : paymentRecordPos) {
+            mpPaymentRecordApi.saveMpPaymentRecord(paymentRecordPo);
+        }
+        for (MpFifthPaymentRecord fifthPo : fifthPos) {
+            mpFifthPaymentRecordApi.saveMpFifthPaymentRecord(fifthPo);
+        }
+        if (ownerRemarkInfoPo != null) {
+            ownerRemarkInfoApi.saveOwnerRemarkInfo(ownerRemarkInfoPo);
+        }
+    }
+
+    private OwnerRemarkInfoPo buildOwnerRemarkInfoPo(JSONArray cellArray, String flowNumber, String id) {
+        OwnerRemarkInfoPo po = new OwnerRemarkInfoPo();
         long longId = UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE; // 閬垮厤璐熸暟
-        po.setId(longId+""); // 涓婚敭ID
-        po.setAuxiliaryColumn(getCellValue(cellArray, 0)); // 绗�1鍒楋細杈呭姪鍒�
-        po.setFlowNumber(getCellValue(cellArray, 1)); // 绗�2鍒楋細娴佽浆缂栧彿
-        po.setSerialNumber(parseInteger(getCellValue(cellArray, 2))); // 绗�3鍒楋細搴忓彿
-        po.setProjectCode(getCellValue(cellArray, 3)); // 绗�4鍒楋細椤圭洰缂栫爜
-        po.setProjectName(getCellValue(cellArray, 4)); // 绗�5鍒楋細椤圭洰鍚嶇О
-        po.setYear(parseInteger(getCellValue(cellArray, 5))); // 绗�6鍒楋細骞翠唤
-        po.setMonth(parseInteger(getCellValue(cellArray, 6))); // 绗�7鍒楋細鏈堜唤
-        po.setDay(parseInteger(getCellValue(cellArray, 7))); // 绗�8鍒楋細鏃�
-        po.setDate(parseDate(getCellValue(cellArray, 8))); // 绗�9鍒楋細鏃ユ湡
-        po.setProjectContent(getCellValue(cellArray, 9)); // 绗�10鍒楋細宸ョ▼鍐呭
-        po.setManagementOfficeAmount(parseBigDecimal(getCellValue(cellArray, 10))); // 绗�11鍒楋細绠$悊澶勯噾棰�
-        po.setManagementOfficeSeal(convertSealStatus(getCellValue(cellArray, 11))); // 绗�12鍒楋細绠$悊澶勬槸鍚﹀凡鐩栫珷锛堚垰杞�"鏄�"锛屽惁鍒�"鍚�"锛�
-        po.setOwnersCommitteeAmount(parseBigDecimal(getCellValue(cellArray, 12))); // 绗�13鍒楋細涓氬浼氶噾棰�
-        po.setAuditAmount(parseBigDecimal(getCellValue(cellArray, 13))); // 绗�14鍒楋細瀹′环閲戦
-        po.setOwnersCommitteeSeal(convertSealStatus(getCellValue(cellArray, 14))); // 绗�15鍒楋細涓氬浼氭槸鍚﹀凡鐩栫珷
-        po.setReportDepartment(getCellValue(cellArray, 15)); // 绗�16鍒楋細绛炬姤閮ㄩ棬
-        po.setFundTypeLevel1(getCellValue(cellArray, 16)); // 绗�17鍒楋細鍩洪噾绫诲瀷-涓�绾у垎绫�
-        po.setFundTypeLevel2(getCellValue(cellArray, 17)); // 绗�18鍒楋細鍩洪噾绫诲瀷-浜岀骇鍒嗙被
-        po.setBuildingOrAll(getCellValue(cellArray, 18)); // 绗�19鍒楋細骞�/鍏ㄤ綋
-        po.setMaintenanceType(getCellValue(cellArray, 19)); // 绗�20鍒楋細缁翠慨绫诲瀷
-        po.setQualityGuaranteePeriod1(getCellValue(cellArray, 20)); // 绗�21鍒楋細璐ㄤ繚鏈燂紙绗竴涓級
-        po.setPublicIncomeAnnouncement(getCellValue(cellArray, 21)); // 绗�22鍒楋細鍏叡鏀剁泭閲戝叕甯冩儏鍐�
-        // 鍏叡鏀剁泭閲戝叕甯冨瓙瀛楁锛堢23-26鍒楋級
-        po.setPlannedAnnouncementStart(getCellValue(cellArray, 21)); // 鎷熷叕甯�-璧峰锛堝勾鏈堬級
-        po.setPlannedAnnouncementEnd(getCellValue(cellArray, 22)); // 鎷熷叕甯�-姝紙骞存湀锛�
-        po.setPublishedAnnouncementStart(getCellValue(cellArray, 23)); // 宸插叕甯�-璧峰锛堝勾鏈堬級
-        po.setPublishedAnnouncementEnd(getCellValue(cellArray, 24)); // 宸插叕甯�-姝紙骞存湀锛�
-        po.setQuota(parseBigDecimal(getCellValue(cellArray, 25))); // 绗�27鍒楋細棰濆害
-        po.setOwnersCommitteeResolution(convertYesNo(getCellValue(cellArray, 26))); // 绗�28鍒楋細涓氬浼氬ぇ浼氬喅璁紙鏄�/鍚︼級
-        po.setOwnersCommitteeConsultation(convertYesNo(getCellValue(cellArray, 27))); // 绗�29鍒楋細涓氬浼氬緛璇㈣〃锛堟槸鍚︼級
-        po.setWithdrawalEncounteredProblem(getCellValue(cellArray, 28)); // 绗�30鍒楋細鏀彇閬囧埌鐨勯棶棰�
-        po.setShortageOrArrears(parseBigDecimal(getCellValue(cellArray, 29))); // 绗�31鍒楋細缂烘敮/娆犳锛堝厓锛�
-        // 涓氫富鍦板潃瀛愬瓧娈碉紙绗�32-37鍒楋級
-        po.setRoadName(getCellValue(cellArray, 30)); // 璺悕
-        po.setLane(getCellValue(cellArray, 31)); // 寮�
-        po.setDoor(getCellValue(cellArray, 32)); // 闂�
-        po.setRoom(getCellValue(cellArray, 33)); // 瀹�
-        po.setDoorRoomNumber(getCellValue(cellArray, 34)); // 闂ㄥ鍙�
-        po.setOwnerAddress(getCellValue(cellArray, 35)); // 涓氫富鍦板潃
-//        po.setWithdrawalProblem(getCellValue(cellArray, 36)); // 绗�38鍒楋細鏀彇瀛樺湪闂
-        po.setProblemDifficulty(getCellValue(cellArray, 36)); // 绗�39鍒楋細闂闅惧害
-        po.setAvailableWithdrawalDate(parseDate(getCellValue(cellArray, 37))); // 绗�40鍒楋細鍙惎鍔ㄦ敮鍙栨棩鏈燂紙骞存湀鏃ワ級
-        po.setQualityGuaranteePeriod2(getCellValue(cellArray, 39) + "~" + getCellValue(cellArray, 40)); // 绗�41鍒楋細璐ㄤ繚鏈燂紙绗簩涓級
-        po.setQualityGuaranteeRatio(parseBigDecimal(getCellValue(cellArray, 40))); // 绗�42鍒楋細璐ㄤ繚閲戝崰姣�
-        po.setQualityGuaranteeAmount(parseBigDecimal(getCellValue(cellArray, 41))); // 绗�43鍒楋細璐ㄤ繚閲戦噾棰濓紙鍏冿級
-        po.setReceivedQualityGuarantee(parseBigDecimal(getCellValue(cellArray, 42))); // 绗�44鍒楋細宸插埌璐﹁川淇濋噾
-//        po.setStartDate(parseDate(getCellValue(cellArray, 44))); // 绗�45鍒楋細璧峰锛堝勾鏈堟棩锛�
-//        po.setEndDate(parseDate(getCellValue(cellArray, 45))); // 绗�46鍒楋細缁堟锛堝勾鏈堟棩锛�
+        po.setId(longId);
+        po.setMpId(id);
+        po.setRemarkPerson("瀵煎叆鍐呭");
+//        po.setRemarkContent(getCellValue(cellArray, 137));
+        return po;
+    }
 
-        // -------------------------- 17涓嚜鍔ㄨ绠楀瓧娈碉紙鏍稿績涓氬姟閫昏緫锛�--------------------------
-        // 1. 鎵撳嵃鍚堣 = 绗竴娆绗簲娆℃墦鍗伴噾棰濅箣鍜岋紙绗�47鍒楁墦鍗伴噾棰�+绗�54鍒�+绗�61鍒�+绗�68鍒�+绗�75鍒楋級
-        BigDecimal print1 = parseBigDecimal(getCellValue(cellArray, 45)); // 绗竴娆℃墦鍗伴噾棰濓紙绗�50鍒楋級
-        BigDecimal print2 = parseBigDecimal(getCellValue(cellArray, 57)); // 绗簩娆℃墦鍗伴噾棰濓紙绗�57鍒楋級
-        BigDecimal print3 = parseBigDecimal(getCellValue(cellArray, 69)); // 绗笁娆℃墦鍗伴噾棰濓紙绗�64鍒楋級
-        BigDecimal print4 = parseBigDecimal(getCellValue(cellArray, 81)); // 绗洓娆℃墦鍗伴噾棰濓紙绗�71鍒楋級
-        BigDecimal print5 = parseBigDecimal(getCellValue(cellArray, 93)); // 绗簲娆℃墦鍗伴噾棰濓紙绗�78鍒楋級
-//        BigDecimal printTotal = add(print1, print2, print3, print4, print5);
-//        po.setPrintTotal(printTotal); // 鑷畾涔夊瓧娈碉細鎵撳嵃鍚堣
+    private OwnerQualityGuaranteePo buildOwnerQualityGuaranteePo(JSONArray cellArray, String aLong) {
+        OwnerQualityGuaranteePo po = new OwnerQualityGuaranteePo();
+        long longId = UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE; // 閬垮厤璐熸暟
+        po.setId(longId); // 涓婚敭ID
+        po.setMpId(aLong);
+//            po.setQualityGuaranteePeriod2Start(Vtil.defaultValueToDate(getCellValue(cellArray, 37)));
+//            po.setQualityGuaranteePeriod2End(Vtil.defaultValueToDate(getCellValue(cellArray, 38)));
+//            po.setAcceptanceDate(Vtil.defaultValueToDate(getCellValue(cellArray, 41)));
+//            po.setAvailableWithdrawalDate(Vtil.defaultValueToDate(getCellValue(cellArray, 43)));
+//        po.setQualityGuaranteeRatio(getCellNum(cellArray, 39));
+//        po.setQualityGuaranteeAmount(getCellNum(cellArray, 12) * po.getQualityGuaranteeRatio());
+//        po.setAuditStatus(getCellValue(cellArray, 42));
+        return po;
+    }
 
-        // 2. 鍒拌处鍚堣 = 绗竴娆绗簲娆″埌璐﹂噾棰濅箣鍜岋紙绗�51鍒�+绗�58鍒�+绗�65鍒�+绗�72鍒�+绗�79鍒楋級
-        BigDecimal arrival1 = parseBigDecimal(getCellValue(cellArray, 48)); // 绗竴娆″埌璐﹂噾棰濓紙绗�52鍒楋級
-        BigDecimal arrival2 = parseBigDecimal(getCellValue(cellArray, 60)); // 绗簩娆″埌璐﹂噾棰濓紙绗�59鍒楋級
-        BigDecimal arrival3 = parseBigDecimal(getCellValue(cellArray, 72)); // 绗笁娆″埌璐﹂噾棰濓紙绗�66鍒楋級
-        BigDecimal arrival4 = parseBigDecimal(getCellValue(cellArray, 84)); // 绗洓娆″埌璐﹂噾棰濓紙绗�73鍒楋級
-        BigDecimal arrival5 = parseBigDecimal(getCellValue(cellArray, 96)); // 绗簲娆″埌璐﹂噾棰濓紙绗�80鍒楋級
-//        BigDecimal arrivalTotal = add(arrival1, arrival2, arrival3, arrival4, arrival5);
-//        po.setArrivalTotal(arrivalTotal); // 鑷畾涔夊瓧娈碉細鍒拌处鍚堣
+    private OwnerWithdrawalInfoPo buildOwnerWithdrawalInfoPo(JSONArray cellArray, String aLong) {
+        OwnerWithdrawalInfoPo po = new OwnerWithdrawalInfoPo();
+        long longId = UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE; // 閬垮厤璐熸暟
+        po.setId(longId); // 涓婚敭ID
+        po.setMpId(aLong);
+//        po.setWithdrawalEncounteredProblem(getCellValue(cellArray, 28));
+//        po.setShortageOrArrears(getCellNum(cellArray, 29));
+//        po.setRoadName(getCellValue(cellArray, 30));
+//        po.setLane(getCellValue(cellArray, 31));
+//        po.setDoor(getCellValue(cellArray, 32));
+//        po.setRoom(getCellValue(cellArray, 33));
+//        po.setDoorRoomNumber(getCellValue(cellArray, 34));
+//        po.setOwnerAddress(getCellValue(cellArray, 35));
+        return po;
+    }
 
-        // 3. 缁翠慨鍩洪噾鍒拌处鐜� = IF(鍒拌处鍚堣<>0, 鍒拌处鍚堣/涓氬浼氶噾棰�, 0)
-        BigDecimal ownersAmount = po.getOwnersCommitteeAmount();
-//        BigDecimal fundArrivalRate = (arrivalTotal.compareTo(BigDecimal.ZERO) != 0 && ownersAmount.compareTo(BigDecimal.ZERO) != 0)
-//                ? arrivalTotal.divide(ownersAmount, 4, BigDecimal.ROUND_HALF_UP) // 淇濈暀4浣嶅皬鏁�
-//                : BigDecimal.ZERO;
-//        po.setFundArrivalRate(fundArrivalRate); // 鑷畾涔夊瓧娈碉細缁翠慨鍩洪噾鍒拌处鐜�
+    private OwnersCommitteeConventionPo buildOwnersCommitteeConventionPo(JSONArray cellArray, String mpId) {
+        OwnersCommitteeConventionPo po = new OwnersCommitteeConventionPo();
 
-        // 4. 灏氱己閲戦 = IF(鍩洪噾绫诲瀷<>"缁翠慨鍩洪噾", 0, 涓氬浼氶噾棰�-鍒拌处鍚堣)
-        String fundType = po.getFundTypeLevel1();
-//        BigDecimal shortageAmount = ("缁翠慨鍩洪噾".equals(fundType))
-//                ? subtract(ownersAmount, arrivalTotal)
-//                : BigDecimal.ZERO;
-//        po.setFundShortageAmount(shortageAmount); // 鑷畾涔夊瓧娈碉細灏氱己閲戦
-
-        // 5. 绠$悊璐� = 绠$悊澶勯噾棰� * 绠$悊璐瑰崰姣旓紙鐧惧垎姣旇浆灏忔暟锛�
-        BigDecimal managementFeeRatio = po.getManagementFeeRatio() == null ? BigDecimal.ZERO : po.getManagementFeeRatio().divide(new BigDecimal(100));
-        BigDecimal managementFee = multiply(po.getManagementOfficeAmount(), managementFeeRatio);
-//        po.setManagementFee(managementFee); // 鑷畾涔夊瓧娈碉細绠$悊璐�
-
-        // 6. 搴斾粯閲戦A = IF(瀹¤閲戦涓虹┖, 涓氬浼氶噾棰�-绠$悊璐�, 瀹¤閲戦-绠$悊璐�)
-        BigDecimal auditAmount = po.getAuditAmount() == null ? BigDecimal.ZERO : po.getAuditAmount();
-        BigDecimal payableA = (auditAmount.compareTo(BigDecimal.ZERO) == 0)
-                ? subtract(ownersAmount, managementFee)
-                : subtract(auditAmount, managementFee);
-//        po.setPayableAmountA(payableA); // 鑷畾涔夊瓧娈碉細搴斾粯閲戦A
-
-        // 7. 搴斾粯閲戦B = 涓氬浼氶噾棰�-绠$悊璐�-璐ㄤ繚閲戦噾棰�
-        BigDecimal qualityGuaranteeAmount = po.getQualityGuaranteeAmount() == null ? BigDecimal.ZERO : po.getQualityGuaranteeAmount();
-        BigDecimal payableB = subtract(ownersAmount, managementFee, qualityGuaranteeAmount);
-//        po.setPayableAmountB(payableB); // 鑷畾涔夊瓧娈碉細搴斾粯閲戦B
-
-        // 8. 搴斾粯閲戦C = 瀹炴敹閲戦-瀹炴敹閲戦脳绠$悊璐规瘮渚嬶紙瀹炴敹閲戦鍙栧埌璐﹀悎璁★級
-//        BigDecimal payableC = multiply(arrivalTotal, BigDecimal.ONE.subtract(managementFeeRatio));
-//        po.setPayableAmountC(payableC); // 鑷畾涔夊瓧娈碉細搴斾粯閲戦C
-
-        // 9. 鎷熶粯鍚堣 = 绗竴娆绗簲娆℃嫙浠橀噾棰濅箣鍜岋紙绗�82鍒�+绗�88鍒�+绗�94鍒�+绗�100鍒�+绗�106鍒楋級
-        BigDecimal plannedPay1 = parseBigDecimal(getCellValue(cellArray, 113)); // 绗竴娆℃嫙浠橀噾棰濓紙绗�83鍒楋級
-        BigDecimal plannedPay2 = parseBigDecimal(getCellValue(cellArray, 119)); // 绗簩娆℃嫙浠橀噾棰濓紙绗�89鍒楋級
-        BigDecimal plannedPay3 = parseBigDecimal(getCellValue(cellArray, 125)); // 绗笁娆℃嫙浠橀噾棰濓紙绗�95鍒楋級
-        BigDecimal plannedPay4 = parseBigDecimal(getCellValue(cellArray, 131)); // 绗洓娆℃嫙浠橀噾棰濓紙绗�101鍒楋級
-        BigDecimal plannedPay5 = parseBigDecimal(getCellValue(cellArray, 137)); // 绗簲娆℃嫙浠橀噾棰濓紙绗�107鍒楋級
-        BigDecimal plannedPayTotal = add(plannedPay1, plannedPay2, plannedPay3, plannedPay4, plannedPay5);
-//        po.setPlannedPayTotal(plannedPayTotal); // 鑷畾涔夊瓧娈碉細鎷熶粯鍚堣
-
-        // 10. 瀹炰粯鍚堣 = 绗竴娆绗簲娆″疄浠橀噾棰濅箣鍜岋紙绗�85鍒�+绗�91鍒�+绗�97鍒�+绗�103鍒�+绗�109鍒楋級
-        BigDecimal actualPay1 = parseBigDecimal(getCellValue(cellArray, 117)); // 绗竴娆″疄浠橀噾棰濓紙绗�86鍒楋級
-        BigDecimal actualPay2 = parseBigDecimal(getCellValue(cellArray, 123)); // 绗簩娆″疄浠橀噾棰濓紙绗�92鍒楋級
-        BigDecimal actualPay3 = parseBigDecimal(getCellValue(cellArray, 130)); // 绗笁娆″疄浠橀噾棰濓紙绗�98鍒楋級
-        BigDecimal actualPay4 = parseBigDecimal(getCellValue(cellArray, 135)); // 绗洓娆″疄浠橀噾棰濓紙绗�104鍒楋級
-        BigDecimal actualPay5 = parseBigDecimal(getCellValue(cellArray, 141)); // 绗簲娆″疄浠橀噾棰濓紙绗�110鍒楋級
-        BigDecimal actualPayTotal = add(actualPay1, actualPay2, actualPay3, actualPay4, actualPay5);
-//        po.setActualPayTotal(actualPayTotal); // 鑷畾涔夊瓧娈碉細瀹炰粯鍚堣
-
-        // 11. 鏈粯鍚堣 = 瀹″畾閲戦-瀹炰粯鍚堣锛堝瀹氶噾棰濆彇瀹¤閲戦锛屾棤鍒欏彇涓氬浼氶噾棰濓級
-        BigDecimal approvedAmount = (auditAmount.compareTo(BigDecimal.ZERO) == 0) ? ownersAmount : auditAmount;
-        BigDecimal unpaidTotal = subtract(approvedAmount, actualPayTotal);
-//        po.setUnpaidTotal(unpaidTotal); // 鑷畾涔夊瓧娈碉細鏈粯鍚堣
-
-        // 12. 鍨粯閲戦 = 澶嶆潅鏉′欢鍒ゆ柇锛堝熀閲戠被鍨嬨�佸埌璐﹀悎璁°�佸叕甯冩儏鍐碉級
-//        BigDecimal advanceAmount = calculateAdvanceAmount(fundType, arrivalTotal, actualPayTotal, po.getPublicIncomeAnnouncement());
-//        po.setAdvanceAmount(advanceAmount); // 鑷畾涔夊瓧娈碉細鍨粯閲戦
-
-        // 13. 鏈粯鍚堣锛堝埌璐﹀彛寰勶級 = 鎸夊叕甯冩儏鍐靛垎鏀绠�
-//        BigDecimal unpaidByArrival = calculateUnpaidByArrival(po.getPublicIncomeAnnouncement(), ownersAmount, managementFee, actualPayTotal, arrivalTotal);
-//        po.setUnpaidByArrival(unpaidByArrival); // 鑷畾涔夊瓧娈碉細鏈粯鍚堣锛堝埌璐﹀彛寰勶級
-
-        // 14-16. 寰呬粯閲戦A/B/C
-//        po.setPendingPayA(subtract(auditAmount, managementFee)); // 寰呬粯閲戦A = 瀹′环閲戦 - 绠$悊璐�
-//        po.setPendingPayB(subtract(auditAmount, qualityGuaranteeAmount, managementFee)); // 寰呬粯閲戦B = 瀹′环閲戦 - 璐ㄤ繚閲� - 绠$悊璐�
-//        po.setPendingPayC(multiply(arrivalTotal, BigDecimal.ONE.subtract(managementFeeRatio))); // 寰呬粯閲戦C = 鍒拌处鍚堣*(1-绠$悊璐瑰崰姣�)
-
-        // 鏀粯淇℃伅锛堢111-116鍒楋級
-        po.setPayeeName(getCellValue(cellArray, 143)); // 鏀粯鍏徃鍚嶇О/涓汉鍚嶅瓧
-        po.setIdCardNumber(getCellValue(cellArray, 144)); // 涓汉韬唤璇佸彿鐮�
-        po.setBankName(getCellValue(cellArray, 145)); // 寮�鎴烽摱琛�
-        po.setBankAccount(getCellValue(cellArray, 146)); // 寮�鎴疯处鍙�
-        po.setRemarks(getCellValue(cellArray, 155)); // 澶囨敞
-        po.setAcceptanceDate(parseDate(getCellValue(cellArray, 156))); // 楠屾敹鏃ユ湡
-        po.setAuditDate(getCellValue(cellArray, 157)); // 瀹¤鎯呭喌锛氬勾/鏈�
+        long longId = UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE; // 閬垮厤璐熸暟
+        po.setId(longId); // 涓婚敭ID
+        po.setMpId(mpId);
+//        po.setQuota(getCellNum(cellArray, 25));
+//        po.setOwnersCommitteeResolution(getCellValue(cellArray, 26));
+//        po.setOwnersCommitteeConsultation(getCellValue(cellArray, 27));
 
         return po;
     }
+
+    private AnnouncementTimeRangePo buildAnnouncementTimeRangePo(JSONArray cellArray, String mpId) {
+        AnnouncementTimeRangePo po = new AnnouncementTimeRangePo();
+        long longId = UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE; // 閬垮厤璐熸暟
+        po.setId(longId); // 涓婚敭ID
+        po.setMpId(mpId);
+//        po.setPlannedAnnouncementStart(getCellValue(cellArray, 21));
+//        po.setPlannedAnnouncementEnd(getCellValue(cellArray, 22));
+//        po.setPublishedAnnouncementStart(getCellValue(cellArray, 23));
+//        po.setPublishedAnnouncementEnd(getCellValue(cellArray, 24));
+
+        return po;
+    }
+
+    private MaintenancePayment buildMaintenancePaymentPoV2(JSONArray cellArray) throws ParseException {
+        MaintenancePayment po = new MaintenancePayment();
+        try {
+            po.setId(GenerateCodeFactory.getGeneratorId("10")); // 涓婚敭ID
+            po.setAuxiliaryColumn(getCellValue(cellArray, 0)); // 绗�1鍒楋細杈呭姪鍒�
+            po.setFlowNumber(getCellValue(cellArray, 1)); // 绗�2鍒楋細娴佽浆缂栧彿
+            po.setSerialNumber(getCellValue(cellArray, 2)); // 绗�3鍒楋細搴忓彿
+            po.setProjectCode(getCellValue(cellArray, 3)); // 绗�4鍒楋細椤圭洰缂栫爜
+            po.setProjectName(getCellValue(cellArray, 4)); // 绗�5鍒楋細椤圭洰鍚嶇О
+            po.setYear(getCellValue(cellArray, 5)); // 绗�6鍒楋細骞翠唤
+            po.setMonth(getCellValue(cellArray, 6)); // 绗�7鍒楋細鏈堜唤
+            po.setDay(getCellValue(cellArray, 7)); // 绗�8鍒楋細鏃�
+            po.setDate(Vtil.defaultValueToDate(getCellValue(cellArray, 8))); // 绗�9鍒楋細鏃ユ湡
+            po.setProjectContent(getCellValue(cellArray, 9)); // 绗�10鍒楋細宸ョ▼鍐呭
+            po.setManagementOfficeAmount(getCellValue(cellArray, 10)); // 绗�11鍒楋細绠$悊澶勯噾棰�
+            po.setManagementOfficeSeal(getCellValue(cellArray, 11)); // 绗�12鍒楋細绠$悊澶勬槸鍚﹀凡鐩栫珷锛堚垰杞�"鏄�"锛屽惁鍒�"鍚�"锛�
+            po.setOwnersCommitteeAmount(getCellValue(cellArray, 12)); // 绗�13鍒楋細涓氬浼氶噾棰�
+            po.setAuditAmount(getCellValue(cellArray, 13)); // 绗�14鍒楋細瀹′环閲戦
+            po.setOwnersCommitteeSeal(getCellValue(cellArray, 14)); // 绗�15鍒楋細涓氬浼氭槸鍚﹀凡鐩栫珷
+            po.setReportDepartment(getCellValue(cellArray, 15)); // 绗�16鍒楋細绛炬姤閮ㄩ棬
+            po.setFundTypeLevel1(getCellValue(cellArray, 16)); // 绗�17鍒楋細鍩洪噾绫诲瀷-涓�绾у垎绫�
+            po.setFundTypeLevel2(getCellValue(cellArray, 17)); // 绗�18鍒楋細鍩洪噾绫诲瀷-浜岀骇鍒嗙被
+            po.setMaintenanceType(getCellValue(cellArray, 18)); // 绗�19鍒楋細骞�/鍏ㄤ綋
+            po.setBuildingOrAll(getCellValue(cellArray, 19)); // 绗�20鍒楋細缁翠慨绫诲瀷
+            po.setSpecificAnnouncementStatus(getCellValue(cellArray, 20));//鍏蜂綋鍏竷鎯呭喌 TODO 娣诲姞sql瀛楁
+            po.setQuota(getCellValue(cellArray, 21)); // 22锛氶搴�
+            po.setOwnersCommitteeResolution(getCellValue(cellArray, 22)); // 23锛氫笟濮斾細澶т細鍐宠锛堟槸/鍚︼級
+            po.setOwnersCommitteeConsultation(getCellValue(cellArray, 23)); // 24锛氫笟濮斾細寰佽琛紙鏄惁锛�
+            po.setWithdrawalEncounteredProblem(getCellValue(cellArray, 24)); // 25锛氭敮鍙栭亣鍒扮殑闂
+            po.setShortageOrArrears(getCellValue(cellArray, 25)); // 26锛氱己鏀�/娆犳锛堝厓锛�
+            po.setRoadName(getCellValue(cellArray, 26)); // 璺悕
+            po.setLane(getCellValue(cellArray, 27)); // 寮�
+            po.setDoor(getCellValue(cellArray, 28)); // 闂�
+            po.setRoom(getCellValue(cellArray, 29)); // 瀹�
+            po.setDoorRoomNumber(getCellValue(cellArray, 30)); // 闂ㄥ鍙�
+            po.setOwnerAddress(getCellValue(cellArray, 31)); // 涓氫富鍦板潃
+            po.setQualityGuaranteePeriod2(getCellValue(cellArray, 32)); // 33锛氳川淇濇湡锛堢浜屼釜锛�
+            po.setQualityGuaranteeRatio(getCellValue(cellArray, 33)); // 34锛氳川淇濋噾鍗犳瘮
+            po.setQualityGuaranteeAmount(getCellValue(cellArray, 34)); // 35锛氳川淇濋噾閲戦锛堝厓锛�
+            po.setAcceptanceDate(getCellValue(cellArray, 35)); // 楠屾敹鏃ユ湡
+            po.setAuditDate(getCellValue(cellArray, 36)); // 瀹¤鎯呭喌锛氬勾/鏈�
+            po.setAvailableWithdrawalDate(getCellValue(cellArray, 37)); // 绗�40鍒楋細鍙惎鍔ㄦ敮鍙栨棩鏈燂紙骞存湀鏃ワ級
+
+            po.setManagementFeeRatio(getCellValue(cellArray, 164)); // 绠$悊璐�
+            po.setPaymentTarget(getCellValue(cellArray, 168)); // 鏀粯瀵硅薄
+            po.setPayeeName(getCellValue(cellArray, 239)); // 鏀粯鍏徃鍚嶇О/涓汉鍚嶅瓧
+            po.setIdCardNumber(getCellValue(cellArray, 240)); // 涓汉韬唤璇佸彿鐮�
+            po.setBankName(getCellValue(cellArray, 241)); // 寮�鎴烽摱琛�
+            po.setBankAccount(getCellValue(cellArray, 242)); // 寮�鎴疯处鍙�
+            po.setAuditDate(getCellValue(cellArray, 252)); // 瀹¤鎯呭喌锛氬勾/鏈�
+            po.setAdvancedPayment(getCellValue(cellArray, 246));//鍨粯閲戦
+            po.setPayableAmountD(getCellValue(cellArray, 251));//搴斾粯閲戦D锛堢壒娈婁粯娆撅級_John
+            return po;
+        } catch (ArrayIndexOutOfBoundsException e) {
+            return po;
+        }
+    }
+
+        /**
+         * 鏋勫缓 MaintenancePaymentPo锛堢淮淇祫閲戞敮鍙栦俊鎭〃锛�
+         * 瀛楁鏄犲皠瀵瑰簲"鑽i『鑻戠鎶ュ崟"琛ㄥご椤哄簭锛屽寘鍚�17涓嚜鍔ㄨ绠楀瓧娈�
+         */
+//    private MaintenancePaymentPo buildMaintenancePaymentPo(JSONArray cellArray) throws ParseException {
+//        MaintenancePaymentPo po = new MaintenancePaymentPo();
+//        // 鍩虹瀛楁锛堢洿鎺ユ槧灏凟xcel鍗曞厓鏍硷級
+//        long longId = UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE; // 閬垮厤璐熸暟
+//        po.setId(longId+""); // 涓婚敭ID
+//        po.setAuxiliaryColumn(getCellValue(cellArray, 0)); // 绗�1鍒楋細杈呭姪鍒�
+//        po.setFlowNumber(getCellValue(cellArray, 1)); // 绗�2鍒楋細娴佽浆缂栧彿
+//        po.setSerialNumber(parseInteger(getCellValue(cellArray, 2))); // 绗�3鍒楋細搴忓彿
+//        po.setProjectCode(getCellValue(cellArray, 3)); // 绗�4鍒楋細椤圭洰缂栫爜
+//        po.setProjectName(getCellValue(cellArray, 4)); // 绗�5鍒楋細椤圭洰鍚嶇О
+//        po.setYear(parseInteger(getCellValue(cellArray, 5))); // 绗�6鍒楋細骞翠唤
+//        po.setMonth(parseInteger(getCellValue(cellArray, 6))); // 绗�7鍒楋細鏈堜唤
+//        po.setDay(parseInteger(getCellValue(cellArray, 7))); // 绗�8鍒楋細鏃�
+//        po.setDate(parseDate(getCellValue(cellArray, 8))); // 绗�9鍒楋細鏃ユ湡
+//        po.setProjectContent(getCellValue(cellArray, 9)); // 绗�10鍒楋細宸ョ▼鍐呭
+//        po.setManagementOfficeAmount(parseBigDecimal(getCellValue(cellArray, 10))); // 绗�11鍒楋細绠$悊澶勯噾棰�
+//        po.setManagementOfficeSeal(convertSealStatus(getCellValue(cellArray, 11))); // 绗�12鍒楋細绠$悊澶勬槸鍚﹀凡鐩栫珷锛堚垰杞�"鏄�"锛屽惁鍒�"鍚�"锛�
+//        po.setOwnersCommitteeAmount(parseBigDecimal(getCellValue(cellArray, 12))); // 绗�13鍒楋細涓氬浼氶噾棰�
+//        po.setAuditAmount(parseBigDecimal(getCellValue(cellArray, 13))); // 绗�14鍒楋細瀹′环閲戦
+//        po.setOwnersCommitteeSeal(convertSealStatus(getCellValue(cellArray, 14))); // 绗�15鍒楋細涓氬浼氭槸鍚﹀凡鐩栫珷
+//        po.setReportDepartment(getCellValue(cellArray, 15)); // 绗�16鍒楋細绛炬姤閮ㄩ棬
+//        po.setFundTypeLevel1(getCellValue(cellArray, 16)); // 绗�17鍒楋細鍩洪噾绫诲瀷-涓�绾у垎绫�
+//        po.setFundTypeLevel2(getCellValue(cellArray, 17)); // 绗�18鍒楋細鍩洪噾绫诲瀷-浜岀骇鍒嗙被
+//        po.setBuildingOrAll(getCellValue(cellArray, 18)); // 绗�19鍒楋細骞�/鍏ㄤ綋
+//        po.setMaintenanceType(getCellValue(cellArray, 19)); // 绗�20鍒楋細缁翠慨绫诲瀷
+//        po.setQualityGuaranteePeriod1(getCellValue(cellArray, 20)); // 绗�21鍒楋細璐ㄤ繚鏈燂紙绗竴涓級
+////        po.setPublicIncomeAnnouncement(getCellValue(cellArray, 21)); // 绗�22鍒楋細鍏叡鏀剁泭閲戝叕甯冩儏鍐�
+//        // 鍏叡鏀剁泭閲戝叕甯冨瓙瀛楁锛堢23-26鍒楋級
+//        po.setPlannedAnnouncementStart(getCellValue(cellArray, 21)); // 鎷熷叕甯�-璧峰锛堝勾鏈堬級
+//        po.setPlannedAnnouncementEnd(getCellValue(cellArray, 22)); // 鎷熷叕甯�-姝紙骞存湀锛�
+//        po.setPublishedAnnouncementStart(getCellValue(cellArray, 23)); // 宸插叕甯�-璧峰锛堝勾鏈堬級
+//        po.setPublishedAnnouncementEnd(getCellValue(cellArray, 24)); // 宸插叕甯�-姝紙骞存湀锛�
+//        po.setQuota(parseBigDecimal(getCellValue(cellArray, 25))); // 绗�27鍒楋細棰濆害
+//        po.setOwnersCommitteeResolution(convertYesNo(getCellValue(cellArray, 26))); // 绗�28鍒楋細涓氬浼氬ぇ浼氬喅璁紙鏄�/鍚︼級
+//        po.setOwnersCommitteeConsultation(convertYesNo(getCellValue(cellArray, 27))); // 绗�29鍒楋細涓氬浼氬緛璇㈣〃锛堟槸鍚︼級
+//        po.setWithdrawalEncounteredProblem(getCellValue(cellArray, 28)); // 绗�30鍒楋細鏀彇閬囧埌鐨勯棶棰�
+//        po.setShortageOrArrears(parseBigDecimal(getCellValue(cellArray, 29))); // 绗�31鍒楋細缂烘敮/娆犳锛堝厓锛�
+//        // 涓氫富鍦板潃瀛愬瓧娈碉紙绗�32-37鍒楋級
+//        po.setRoadName(getCellValue(cellArray, 30)); // 璺悕
+//        po.setLane(getCellValue(cellArray, 31)); // 寮�
+//        po.setDoor(getCellValue(cellArray, 32)); // 闂�
+//        po.setRoom(getCellValue(cellArray, 33)); // 瀹�
+//        po.setDoorRoomNumber(getCellValue(cellArray, 34)); // 闂ㄥ鍙�
+//        po.setOwnerAddress(getCellValue(cellArray, 35)); // 涓氫富鍦板潃
+////        po.setWithdrawalProblem(getCellValue(cellArray, 36)); // 绗�38鍒楋細鏀彇瀛樺湪闂
+//        po.setProblemDifficulty(getCellValue(cellArray, 36)); // 绗�36鍒楋細闂闅惧害
+//        po.setAvailableWithdrawalDate(parseDate(getCellValue(cellArray, 43))); // 绗�40鍒楋細鍙惎鍔ㄦ敮鍙栨棩鏈燂紙骞存湀鏃ワ級
+//        po.setQualityGuaranteePeriod2(getCellValue(cellArray, 37) + "~" + getCellValue(cellArray, 38)); // 绗�41鍒楋細璐ㄤ繚鏈燂紙绗簩涓級
+//        po.setQualityGuaranteeRatio(parseBigDecimal(getCellValue(cellArray, 39))); // 绗�42鍒楋細璐ㄤ繚閲戝崰姣�
+//        po.setQualityGuaranteeAmount(parseBigDecimal(getCellValue(cellArray, 40))); // 绗�43鍒楋細璐ㄤ繚閲戦噾棰濓紙鍏冿級
+//        po.setReceivedQualityGuarantee(parseBigDecimal(getCellValue(cellArray, 44))); // 绗�44鍒楋細宸插埌璐﹁川淇濋噾
+////        po.setStartDate(parseDate(getCellValue(cellArray, 44))); // 绗�45鍒楋細璧峰锛堝勾鏈堟棩锛�
+////        po.setEndDate(parseDate(getCellValue(cellArray, 45))); // 绗�46鍒楋細缁堟锛堝勾鏈堟棩锛�
+//
+//
+//        // 鏀粯淇℃伅锛堢111-116鍒楋級
+//        po.setPayeeName(getCellValue(cellArray, 143)); // 鏀粯鍏徃鍚嶇О/涓汉鍚嶅瓧
+//        po.setIdCardNumber(getCellValue(cellArray, 144)); // 涓汉韬唤璇佸彿鐮�
+//        po.setBankName(getCellValue(cellArray, 145)); // 寮�鎴烽摱琛�
+//        po.setBankAccount(getCellValue(cellArray, 146)); // 寮�鎴疯处鍙�
+//        po.setRemarks(getCellValue(cellArray, 155)); // 澶囨敞
+//        po.setAcceptanceDate(parseDate(getCellValue(cellArray, 156))); // 楠屾敹鏃ユ湡
+//        po.setAuditDate(getCellValue(cellArray, 157)); // 瀹¤鎯呭喌锛氬勾/鏈�
+//
+//        return po;
+//    }
 
     /**
      * 鏋勫缓 MpPaymentRecordPo 鍒楄〃锛�5娆℃墦鍗版暟鎹級
      */
     private List<MpPaymentRecordPo> buildMpPaymentRecordPos(JSONArray cellArray, String flowNumber,String mainPo) throws ParseException {
         List<MpPaymentRecordPo> pos = new ArrayList<>();
-        // 绗竴娆℃墦鍗版暟鎹紙绗�47-53鍒楋級
-        pos.add(buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 1, 43, 44, 45, 46, 47, 48, 49));
+//         绗竴娆℃墦鍗版暟鎹紙绗�47-53鍒楋級
+        buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 1, 38, pos);
         // 绗簩娆℃墦鍗版暟鎹紙绗�54-60鍒楋級
-        pos.add(buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 2, 55, 56, 57, 58, 59, 60, 61));
+        buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 2, 50, pos);
         // 绗笁娆℃墦鍗版暟鎹紙绗�61-67鍒楋級
-        pos.add(buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 3, 67, 68, 69, 70, 71, 72, 73));
+        buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 3, 62, pos);
         // 绗洓娆℃墦鍗版暟鎹紙绗�68-74鍒楋級
-        pos.add(buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 4, 79, 80, 81, 82, 83, 84, 85));
+        buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 4, 74, pos);
         // 绗簲娆℃墦鍗版暟鎹紙绗�75-81鍒楋級
-        pos.add(buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 5, 91, 92, 93, 94, 95, 96, 97));
+        buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 5, 86, pos);
+        buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 6, 98, pos);
+        buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 7, 110, pos);
+        buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 8, 122, pos);
+        buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 9, 134, pos);
+        buildSinglePaymentRecord(mainPo, cellArray, flowNumber, 10, 146, pos);
         return pos;
     }
 
     /**
      * 鏋勫缓鍗曟鎵撳嵃鐨� MpPaymentRecordPo
      */
-    private MpPaymentRecordPo buildSinglePaymentRecord(String mpId, JSONArray cellArray, String flowNumber, int printTimes,
-                                                       int dateCol, int resolutionCol, int amountCol,
-                                                       int arrivalDateCol, int arrivalAmountCol,
-                                                       int withdrawerCol, int shortageCol) throws ParseException {
+    private void buildSinglePaymentRecord(String mpId, JSONArray cellArray, String flowNumber, int printTimes,
+                                                       int index, List<MpPaymentRecordPo> pos) throws ParseException {
+
+//        if (getCellValue(cellArray, index).isEmpty()) {
+//            return;
+//        }
+
         MpPaymentRecordPo po = new MpPaymentRecordPo();
 
-        long longId = UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE; // 閬垮厤璐熸暟
-        po.setId(longId+"");
-        po.setMpId(mpId); // mp_id = 娴佽浆缂栧彿_鎵撳嵃娆℃暟锛堢‘淇濆敮涓�锛�
-        po.setFirstPrintDate(parseDate(getCellValue(cellArray, dateCol)));
-        po.setResolutionNumber(getCellValue(cellArray, resolutionCol));
-        po.setPrintAmount(parseBigDecimal(getCellValue(cellArray, amountCol)));
-        po.setArrivalDate(parseDate(getCellValue(cellArray, arrivalDateCol)));
-        po.setArrivalAmount(parseBigDecimal(getCellValue(cellArray, arrivalAmountCol)));
-        po.setWithdrawer(getCellValue(cellArray, withdrawerCol));
-        po.setShortageOrArrears(parseBigDecimal(getCellValue(cellArray, shortageCol)));
-        // 涓氫富鍦板潃淇℃伅锛堝鐢╩ain琛ㄧ殑鍦板潃锛�
-        po.setRoadName(getCellValue(cellArray, 31));
-        po.setLane(getCellValue(cellArray, 32));
-        po.setDoor(getCellValue(cellArray, 33));
-        po.setRoom(getCellValue(cellArray, 34));
-        po.setOwnerAddress(getCellValue(cellArray, 36));
-        return po;
+        try {
+            po.setId(GenerateCodeFactory.getGeneratorId("33"));
+            po.setMpId(mpId); // mp_id = 娴佽浆缂栧彿_鎵撳嵃娆℃暟锛堢‘淇濆敮涓�锛�
+            po.setPrintCount(printTimes);
+            po.setFirstPrintDate(getCellValue(cellArray, index));
+            po.setResolutionNumber(getCellValue(cellArray, index + 1));
+            po.setPrintAmount(getCellValue(cellArray, index + 2));
+            po.setArrivalDate(getCellValue(cellArray, index + 3));
+            po.setArrivalAmount(getCellValue(cellArray, index + 4));
+            po.setWithdrawer(getCellValue(cellArray, index + 5));
+            po.setShortageOrArrears(getCellValue(cellArray, index + 6));
+            // 涓氫富鍦板潃淇℃伅锛堝鐢╩ain琛ㄧ殑鍦板潃锛�
+            po.setRoadName(getCellValue(cellArray, index + 7));
+            po.setLane(getCellValue(cellArray, index + 8));
+            po.setDoor(getCellValue(cellArray, index + 9));
+            po.setRoom(getCellValue(cellArray, index + 10));
+            po.setOwnerAddress(getCellValue(cellArray, index + 11));
+            po.setSnakeCase(getCellValue(cellArray, 158));
+        } catch (ArrayIndexOutOfBoundsException e) {
+
+        }
+        pos.add(po);
     }
 
     /**
      * 鏋勫缓 MpFifthPaymentRecordPo锛堢浜旀鎷熶粯瀹炰粯锛�
      */
-    private MpFifthPaymentRecordPo buildMpFifthPaymentRecordPo(JSONArray cellArray, String flowNumber,String mainPo) throws ParseException {
-        MpFifthPaymentRecordPo po = new MpFifthPaymentRecordPo();
-        long longId = UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE; // 閬垮厤璐熸暟
-        po.setId(longId+"");
-        po.setMpId(mainPo); // mp_id = 娴佽浆缂栧彿_FIFTH
-        // 绗簲娆℃嫙浠樺疄浠樻暟鎹紙绗�106-111鍒楋級
-        po.setFifthPlannedPaymentAmount(parseBigDecimal(getCellValue(cellArray, 137))); // 绗簲娆℃嫙浠橀噾棰�
-        po.setPlannedPaymentDate(parseDate(getCellValue(cellArray, 138))); // 绗簲娆℃嫙浠樻棩鏈�
-        po.setCategory(getCellValue(cellArray, 139)); // 绫诲埆
-        po.setReimburser(getCellValue(cellArray, 140)); // 鎶ラ攢浜�
-        po.setActualPaymentAmount(parseBigDecimal(getCellValue(cellArray, 141))); // 绗簲娆″疄浠橀噾棰�
-        po.setActualPaymentDate(parseDate(getCellValue(cellArray, 142))); // 绗簲娆″疄浠樻棩鏈�
-        return po;
+    private List<MpFifthPaymentRecord> buildMpFifthPaymentRecordPos(JSONArray cellArray, String flowNumber,String mainPo) throws ParseException {
+        List<MpFifthPaymentRecord> pos = new ArrayList<>();
+
+        buildMpFifthPaymentRecordPo(pos, cellArray, flowNumber, mainPo, 169,1);
+
+        buildMpFifthPaymentRecordPo(pos, cellArray, flowNumber, mainPo, 176,2);
+
+        buildMpFifthPaymentRecordPo(pos, cellArray, flowNumber, mainPo, 183,3);
+
+        buildMpFifthPaymentRecordPo(pos, cellArray, flowNumber, mainPo, 190,4);
+
+        buildMpFifthPaymentRecordPo(pos, cellArray, flowNumber, mainPo, 197,5);
+        buildMpFifthPaymentRecordPo(pos, cellArray, flowNumber, mainPo, 204,6);
+        buildMpFifthPaymentRecordPo(pos, cellArray, flowNumber, mainPo, 211,7);
+        buildMpFifthPaymentRecordPo(pos, cellArray, flowNumber, mainPo, 218,8);
+        buildMpFifthPaymentRecordPo(pos, cellArray, flowNumber, mainPo, 225,9);
+        buildMpFifthPaymentRecordPo(pos, cellArray, flowNumber, mainPo, 232,10);
+
+        return pos;
     }
 
-    /**
-     * 璁$畻鍨粯閲戦锛堟枃妗g鍗佷笁鏉¢�昏緫锛�
-     */
-    private BigDecimal calculateAdvanceAmount(String fundType, BigDecimal arrivalTotal,
-                                              BigDecimal actualPayTotal, String publicIncomeAnnouncement) {
-        // 鏉′欢1锛氬熀閲戠被鍨嬫槸"鍏叡鏀剁泭閲�"鎴�"缁翠慨鍩洪噾"
-        if ("鍏叡鏀剁泭閲�".equals(fundType) || "缁翠慨鍩洪噾".equals(fundType)) {
-            if (arrivalTotal.compareTo(BigDecimal.ZERO) != 0) {
-                // 鍒拌处鍚堣鈮�0锛氬疄浠�>鍒拌处鍒欏灚浠�=瀹炰粯-鍒拌处锛屽惁鍒�0
-                return (actualPayTotal.compareTo(arrivalTotal) > 0)
-                        ? subtract(actualPayTotal, arrivalTotal)
-                        : BigDecimal.ZERO;
-            } else {
-                // 鍒拌处鍚堣=0锛氬垽鏂�"鍏叡鏀剁泭閲戝叕甯冩儏鍐�"鏄惁鍚�"鍏竷"涓斾笉鍚�"鎷�"
-                boolean hasPublish = !isBlank(publicIncomeAnnouncement) && publicIncomeAnnouncement.contains("鍏竷");
-                boolean hasPlanned = !isBlank(publicIncomeAnnouncement) && publicIncomeAnnouncement.contains("鎷�");
-                return (hasPublish && !hasPlanned) ? BigDecimal.ZERO : actualPayTotal;
-            }
+    private void buildMpFifthPaymentRecordPo(List<MpFifthPaymentRecord> pos, JSONArray cellArray, String flowNumber, String mainPo, int index, int printTimes) throws ParseException {
+
+//        if (getCellValue(cellArray, index).isEmpty()) {
+//            return;
+//        }
+
+        MpFifthPaymentRecord po = new MpFifthPaymentRecord();
+
+        try {
+            long longId = UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE; // 閬垮厤璐熸暟
+            po.setId(longId+"");
+            po.setMpId(mainPo);
+            po.setPaymentCount(printTimes);
+            po.setFifthPlannedPaymentAmount(getCellValue(cellArray, index));
+            po.setPlannedPaymentDate(getCellValue(cellArray, index + 1));
+            po.setCategory(getCellValue(cellArray, index + 2));
+            po.setReimburser(getCellValue(cellArray, index + 3));
+            po.setPaymentTarget(getCellValue(cellArray, index + 4));
+            po.setActualPaymentAmount(getCellValue(cellArray, index + 5));
+            po.setActualPaymentDate(getCellValue(cellArray, index  + 6));
+        } catch (ArrayIndexOutOfBoundsException e) {
+
         }
-        // 鍏朵粬鍩洪噾绫诲瀷锛氬灚浠橀噾棰�=0
-        return BigDecimal.ZERO;
+        pos.add(po);
     }
-
-    /**
-     * 璁$畻鏈粯鍚堣锛堝埌璐﹀彛寰勶級锛堟枃妗g鍗佸洓鏉¢�昏緫锛�
-     */
-    private BigDecimal calculateUnpaidByArrival(String publicIncomeAnnouncement, BigDecimal ownersAmount,
-                                                BigDecimal managementFee, BigDecimal actualPayTotal, BigDecimal arrivalTotal) {
-        // 鍚�"鍏竷"锛氭湭浠�=涓氬浼氶噾棰�-绠$悊璐�-瀹炰粯鍚堣
-        if (!isBlank(publicIncomeAnnouncement) && publicIncomeAnnouncement.contains("鍏竷")) {
-            return subtract(ownersAmount, managementFee, actualPayTotal);
-        } else {
-            // 涓嶅惈"鍏竷"锛氬埌璐﹀悎璁�=0鍒�0锛屽惁鍒�=鍒拌处鍚堣-绠$悊璐�-瀹炰粯鍚堣
-            return (arrivalTotal.compareTo(BigDecimal.ZERO) == 0)
-                    ? BigDecimal.ZERO
-                    : subtract(arrivalTotal, managementFee, actualPayTotal);
-        }
-    }
-
-    /**
-     * 鏁版嵁搴撲繚瀛橈紙璋冪敤SqlSessionTemplate鐗圫ervice锛�
-     */
-    private void saveToDatabase(MaintenancePaymentPo mainPo,
-                                List<MpPaymentRecordPo> paymentRecordPos,
-                                MpFifthPaymentRecordPo fifthPo) {
-        // 1. 淇濆瓨涓昏〃锛堝崟鏉★級
-        int mainFlag = maintenancePaymentService.saveMaintenancePayment(mainPo);
-        if (mainFlag <= 0) {
-            throw new RuntimeException("缁翠慨璧勯噾鏀彇涓昏〃鎻掑叆澶辫触锛屾祦杞紪鍙凤細" + mainPo.getFlowNumber());
-        }
-
-        // 2. 鎵归噺淇濆瓨5娆℃墦鍗拌褰�
-        int batchFlag = mpPaymentRecordService.batchSaveMpPaymentRecord(paymentRecordPos);
-        if (batchFlag <= 0) {
-            throw new RuntimeException("鎵撳嵃鏀彇鍒拌处璁板綍鎵归噺鎻掑叆澶辫触锛屾祦杞紪鍙凤細" + mainPo.getFlowNumber());
-        }
-
-        // 3. 淇濆瓨绗簲娆℃嫙浠樺疄浠樿褰�
-        int fifthFlag = mpFifthPaymentRecordService.saveMpFifthPaymentRecord(fifthPo);
-        if (fifthFlag <= 0) {
-            throw new RuntimeException("绗簲娆℃嫙浠樺疄浠樿褰曟彃鍏ュけ璐ワ紝娴佽浆缂栧彿锛�" + mainPo.getFlowNumber());
-        }
-    }
-
-    // -------------------------- 宸ュ叿鏂规硶 --------------------------
-    /**
-     * 鑾峰彇鍗曞厓鏍煎�硷紙澶勭悊null/绌哄瓧绗︿覆锛�
-     */
     private String getCellValue(JSONArray cellArray, int index) {
-        if (index < 0 || index >= cellArray.size()) {
-            return "";
-        }
-        Object value = cellArray.get(index);
-        return value == null ? "" : value.toString().trim();
-    }
-
-    /**
-     * 鍒ゆ柇瀛楃涓叉槸鍚︿负绌�
-     */
-    private boolean isBlank(String str) {
-        return str == null || str.isEmpty() || "null".equalsIgnoreCase(str) || "#REF!".equals(str);
-    }
-
-    /**
-     * 瑙f瀽Integer锛堢┖鍊艰繑鍥瀗ull锛�
-     */
-    private Integer parseInteger(String str) {
-        if (isBlank(str)) {
-            return null;
-        }
         try {
-            return Integer.parseInt(str);
-        } catch (NumberFormatException e) {
-            return null;
-        }
-    }
-
-    /**
-     * 瑙f瀽BigDecimal锛堢┖鍊艰繑鍥�0锛屽鐞嗗崈鍒嗕綅閫楀彿锛�
-     */
-    private BigDecimal parseBigDecimal(String str) {
-        if (isBlank(str)) {
-            return BigDecimal.ZERO;
-        }
-        try {
-            // 澶勭悊Excel涓殑鍗冨垎浣嶆牸寮忥紙濡�133,900.57锛�
-            String cleanStr = str.replace(",", "").trim();
-            return new BigDecimal(cleanStr);
-        } catch (NumberFormatException e) {
-            return BigDecimal.ZERO;
-        }
-    }
-
-    /**
-     * 瑙f瀽鏃ユ湡锛堟敮鎸佸绉嶆牸寮忥紝绌哄�艰繑鍥瀗ull锛�
-     */
-    private Date parseDate(String str) throws ParseException {
-        if (isBlank(str)) {
-            return null;
-        }
-
-        // 鎵嬪姩瑙f瀽Excel鏃ユ湡搴忓垪鍙凤紙1900-01-01涓哄熀鍑嗭紝娉ㄦ剰Excel鐨�1900闂板勾bug锛�
-        try {
-            double excelDateNum = Double.parseDouble(str.trim());
-            // Excel 1900鏃ユ湡绯荤粺锛氬簭鍒楀彿1=1900-01-01锛屼笖閿欒璁や负1900鏄棸骞达紙澶氱畻1澶╋級
-            Calendar cal = Calendar.getInstance();
-            cal.set(1900, 0, 1); // 1900-01-01
-            cal.add(Calendar.DAY_OF_YEAR, (int) excelDateNum - 2); // 淇闂板勾bug锛堝噺2锛�
-            return cal.getTime();
-        } catch (NumberFormatException e) {
-            // 涓嶆槸鏁板瓧锛岀户缁В鏋愭枃鏈牸寮�
-        }
-
-        // 鏂囨湰鏍煎紡瑙f瀽锛堝悓涔嬪墠閫昏緫锛�
-        for (SimpleDateFormat format : DATE_FORMATS) {
-            try {
-                format.setLenient(false);
-                return format.parse(str.trim());
-            } catch (ParseException e) {
-                continue;
+            if (index < 0 || index >= cellArray.size()) {
+                return "";
             }
-        }
-
-        throw new ParseException("涓嶆敮鎸佺殑鏃ユ湡鏍煎紡锛�" + str, 0);
-    }
-
-    /**
-     * 杞崲鐩栫珷鐘舵�侊紙鈭氣啋鏄紝鍏朵粬鈫掑惁锛�
-     */
-    private String convertSealStatus(String str) {
-        return "鈭�".equals(str) || "鏄�".equals(str) ? "鏄�" : "鍚�";
-    }
-
-    /**
-     * 杞崲鏄�/鍚︼紙绌哄�艰繑鍥瀗ull锛�
-     */
-    private String convertYesNo(String str) {
-        if (isBlank(str)) {
+            Object value = cellArray.get(index);
+            return value == null ? "" : value.toString().trim();
+        } catch (ArrayIndexOutOfBoundsException e) {
             return null;
         }
-        return "鏄�".equals(str) || "鈭�".equals(str) ? "鏄�" : "鍚�";
-    }
-
-    /**
-     * 澶氫釜BigDecimal鐩稿姞锛堝鐞唍ull锛宯ull瑙嗕负0锛�
-     */
-    private BigDecimal add(BigDecimal... decimals) {
-        BigDecimal result = BigDecimal.ZERO;
-        for (BigDecimal decimal : decimals) {
-            result = result.add(decimal == null ? BigDecimal.ZERO : decimal);
-        }
-        return result;
-    }
-
-    /**
-     * 澶氫釜BigDecimal鐩稿噺锛堝鐞唍ull锛宯ull瑙嗕负0锛�
-     */
-    private BigDecimal subtract(BigDecimal... decimals) {
-        if (decimals == null || decimals.length == 0) {
-            return BigDecimal.ZERO;
-        }
-        BigDecimal result = decimals[0] == null ? BigDecimal.ZERO : decimals[0];
-        for (int i = 1; i < decimals.length; i++) {
-            result = result.subtract(decimals[i] == null ? BigDecimal.ZERO : decimals[i]);
-        }
-        // 閬垮厤鍑虹幇璐熸暟锛堜笟鍔′腑閲戦涓嶈兘涓鸿礋鏃跺惎鐢級
-        return result.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : result;
-    }
-
-    /**
-     * 涓や釜BigDecimal鐩镐箻锛堝鐞唍ull锛宯ull瑙嗕负0锛�
-     */
-    private BigDecimal multiply(BigDecimal a, BigDecimal b) {
-        if (a == null || b == null) {
-            return BigDecimal.ZERO;
-        }
-        return a.multiply(b).setScale(2, BigDecimal.ROUND_HALF_UP); // 淇濈暀2浣嶅皬鏁�
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0