chengf
2026-01-27 b6184e2ddf3db37a94f7efb3b619bbc64642a292
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
package com.java110.job.importData.adapt;
 
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.dto.community.CommunityDto;
import com.java110.dto.dict.DictDto;
import com.java110.dto.importData.*;
import com.java110.dto.log.AssetImportLogDetailDto;
import com.java110.dto.menu.MenuDto;
import com.java110.dto.oweFeeCallable.OweFeeCallableDto;
import com.java110.dto.owner.OwnerDto;
import com.java110.dto.room.RoomDto;
import com.java110.fee.api.ApplyRoomDiscountApi;
import com.java110.fee.dao.IApplyRoomDiscountServiceDao;
import com.java110.intf.community.ICommunityInnerServiceSMO;
import com.java110.intf.community.IImportOwnerRoomInnerServiceSMO;
import com.java110.intf.community.IMenuInnerServiceSMO;
import com.java110.intf.dev.IDictV1InnerServiceSMO;
import com.java110.intf.fee.IOweFeeCallableV1InnerServiceSMO;
import com.java110.intf.user.IOwnerInnerServiceSMO;
import com.java110.intf.user.IOwnerV1InnerServiceSMO;
import com.java110.job.importData.DefaultImportData;
import com.java110.job.importData.IImportDataAdapt;
import com.java110.po.oweFeeCallable.OweFeeCallablePo;
import com.java110.po.owner.OwnerPo;
import com.java110.po.room.ApplyRoomDiscountPo;
import com.java110.po.room.LitigationInfoPo;
import com.java110.po.room.PayeeReceiveInfoPo;
import com.java110.utils.cache.MappingCache;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
 
/**
 * 房产信息导入 适配器
 * 前端请求 时 必须传入
 *   param.append('importAdapt', "importRoomOwner");
 */
@Service("importRoomOwnerV2QueueData")
public class ImportRoomOwnerV2QueueDataAdapt extends DefaultImportData implements IImportDataAdapt {
 
 
    @Autowired
    private IOwnerV1InnerServiceSMO ownerV1InnerServiceSMOImpl;
 
    @Autowired
    private IOweFeeCallableV1InnerServiceSMO oweFeeCallableV1InnerServiceSMOImpl;
 
    @Autowired
    private IImportOwnerRoomInnerServiceSMO importOwnerRoomInnerServiceSMOImpl;
 
    @Autowired
    protected SqlSessionTemplate sqlSessionTemplate;
 
    @Autowired
    private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
 
    @Autowired
    private IApplyRoomDiscountServiceDao applyRoomDiscountServiceDaoImpl;
 
    @Autowired
    private IDictV1InnerServiceSMO dictV1InnerServiceSMOImpl;
 
    @Autowired
    private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
 
 
    @Override
    public void importData(List<AssetImportLogDetailDto> assetImportLogDetailDtos) {
        importDatas(assetImportLogDetailDtos);
    }
 
    private void importDatas(List<AssetImportLogDetailDto> infos) {
        String state = "";
        String msg = "";
        for (AssetImportLogDetailDto assetImportLogDetailDto : infos) {
 
            try {
                doImportData(assetImportLogDetailDto);
 
                updateImportLogDetailState(assetImportLogDetailDto.getDetailId());
            } catch (Exception e) {
                e.printStackTrace();
                updateImportLogDetailState(assetImportLogDetailDto.getDetailId(), e);
            }
        }
 
    }
 
    /**
     * 导入数据
     *
     * @param assetImportLogDetailDto
     */
    private void doImportData(AssetImportLogDetailDto assetImportLogDetailDto) {
        JSONArray objects = JSONObject.parseArray(assetImportLogDetailDto.getContent());
 
        ImportOwnerRoomDto importOwnerRoomDto = new ImportOwnerRoomDto();//房屋
        importOwnerRoomDto.setRoomId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_roomId));
        importOwnerRoomDto.setOwnerId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_ownerId));
        importOwnerRoomDto.setUserId(objects.getString(169));
        importOwnerRoomDto.setLayerCount("0");
        importOwnerRoomDto.setLayer("0");
        importOwnerRoomDto.setLift("未知");
        importOwnerRoomDto.setSection("10102");
        importOwnerRoomDto.setOwnerTypeCd("1001");
        importOwnerRoomDto.setPersonType(OwnerDto.PERSON_TYPE_PERSON);
        importOwnerRoomDto.setPersonRole(OwnerDto.PERSON_ROLE_OWNER);
        //--------设置物业类型
        DictDto dictDto = new DictDto();
        dictDto.setTableName("building_room");
        dictDto.setTableColumns("room_sub_type");
        dictDto.setName(defaultValue(objects.get(1)));
        List<DictDto> dictDtos = dictV1InnerServiceSMOImpl.queryDictAndSpecs(dictDto);
        if (dictDtos.isEmpty()) {
            throw new IllegalArgumentException("导入失败:字典中不存在物业类型:" + defaultValue(objects.get(1)));
        }
        importOwnerRoomDto.setRoomSubType(dictDtos.get(0).getStatusCd());
        //----------
 
        importOwnerRoomDto.setPropertyType(defaultValue(objects.get(2)));//住宅类型
 
        //--------匹配小区
        CommunityDto communityDto = new CommunityDto();
        communityDto.setCommunityCode(defaultValue(objects.get(3)));
        communityDto.setName(defaultValue(objects.get(4)));
        List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
        if (communityDtos.isEmpty()) {
            throw new IllegalArgumentException("导入失败:小区中不存在小区编码为‘" + defaultValue(objects.get(1)) + "’的小区");
        } else if (communityDtos.size() > 1) {
            String communityNames = communityDtos.stream()
                    .map(CommunityDto::getName) // 提取每个小区的名称
                    .collect(Collectors.joining(", "));
 
            throw new IllegalArgumentException("导入失败:小区编码(" + communityDto.getCommunityCode() + ") + 小区名称(" + communityDto.getName() + ")条件存在多个小区:" + communityNames);
        }
        String communityId = communityDtos.get(0).getCommunityId();
        importOwnerRoomDto.setCommunityId(communityId);//小区编号
        //---------
 
        importOwnerRoomDto.setRoadName(defaultValue(objects.get(5)));//路名
        importOwnerRoomDto.setFloorNum(defaultValue(objects.get(6)));//弄
        importOwnerRoomDto.setUnitNum(defaultValue(objects.get(7)));//门
        importOwnerRoomDto.setRoomNum(defaultValue(objects.get(8)));//室
        importOwnerRoomDto.setDoorRoomNum(defaultValue(objects.get(9)));//门市号
        importOwnerRoomDto.setPropertyAddress(defaultValue(objects.get(10)));//业主地址
        importOwnerRoomDto.setRoomBuyer(defaultValue(objects.get(11)));//购房人
 
        RoomDto roomDto = new RoomDto();
        roomDto.setCommunityId(importOwnerRoomDto.getCommunityId());
        roomDto.setRoadName(importOwnerRoomDto.getRoadName());
        roomDto.setFloorNum(importOwnerRoomDto.getFloorNum());
        roomDto.setUnitNum(importOwnerRoomDto.getUnitNum());
        roomDto.setRoomNum(importOwnerRoomDto.getRoomNum());
 
 
        List<Object> objects1 = sqlSessionTemplate.selectList("roomServiceDaoImpl.getRoomInfo", BeanConvertUtil.beanCovertMap(roomDto));
        if (!objects1.isEmpty()) {
            throw new IllegalArgumentException("重复的房屋");
        }
        //---------家庭成员、租客
        OwnerPo ownerPoTo3 = new OwnerPo();//
        if (!defaultValue(objects.get(13)).isEmpty()) {
            String link = defaultValue(objects.get(13));
            OwnerDto ownerDto = new OwnerDto();
            ownerDto.setLink(link);
            ownerDto.setCommunityId(communityId);
            List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryAllOwners(ownerDto);
            if (!ownerDtos.isEmpty()) {
                throw new IllegalArgumentException("导入失败:该小区已存在手机号:" + link + "的业主");
            }
            ownerPoTo3.setOwnerId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_ownerId));
            ownerPoTo3.setAge("0");
            ownerPoTo3.setState(OwnerDto.STATE_FINISH);
            ownerPoTo3.setPersonType(OwnerDto.PERSON_TYPE_PERSON);
            ownerPoTo3.setOwnerTypeCd(OwnerDto.OWNER_TYPE_CD_MEMBER);
            ownerPoTo3.setName(defaultValue(objects.get(12)));
            ownerPoTo3.setLink(link);
            ownerPoTo3.setSex("2");
            ownerPoTo3.setPersonRole(OwnerDto.PERSON_ROLE_MEMBER);
        }
 
        OwnerPo ownerPoTo2 = new OwnerPo();//TODO 租客未导入
        if (!defaultValue(objects.get(15)).isEmpty()) {
            String link = defaultValue(objects.get(15));
            OwnerDto ownerDto = new OwnerDto();
            ownerDto.setLink(link);
            ownerDto.setCommunityId(communityId);
            List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryAllOwners(ownerDto);
            if (!ownerDtos.isEmpty()) {
                throw new IllegalArgumentException("导入失败:该小区已存在手机号:" + link + "的业主");
            }
            ownerPoTo2.setOwnerId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_ownerId));
            ownerPoTo2.setAge("0");
//        ownerPo.setUserId(userId);
            ownerPoTo2.setState(OwnerDto.STATE_FINISH);
            ownerPoTo2.setPersonType(OwnerDto.PERSON_ROLE_RENT);
            ownerPoTo2.setOwnerTypeCd(OwnerDto.OWNER_TYPE_CD_MEMBER);
            ownerPoTo2.setName(defaultValue(objects.get(21)));
            ownerPoTo2.setLink(link);
            ownerPoTo2.setSex("2");
            ownerPoTo2.setPersonRole(OwnerDto.PERSON_ROLE_MEMBER);
        }
        //---------
        importOwnerRoomDto.setBuiltUpArea(defaultValue(objects.get(16)));//面积
        importOwnerRoomDto.setRoomArea(defaultValue(objects.get(16)));//面积
        importOwnerRoomDto.setRoomRent(defaultValue(objects.get(16)));//面积
        importOwnerRoomDto.setBuyDate(defaultValueToDate(objects.get(20)));//购入日期
        importOwnerRoomDto.setSellDate(defaultValueToDate(objects.get(22)));//卖出日期
        importOwnerRoomDto.setSellState(defaultValue(objects.get(23)));//房屋状态
 
        importOwnerRoomDto.setEoc(defaultNum(objects.get(24)).toString());//设备运行费
 
        //-----TODO 待导入  催缴信息
        if (!defaultValue(objects.get(27)).isEmpty()) {
            OwnerCollectionDto ownerCollection = new OwnerCollectionDto();
            ownerCollection.setOwnerId(importOwnerRoomDto.getOwnerId());
            ownerCollection.setRoomId(importOwnerRoomDto.getRoomId());
            ownerCollection.setCollectionStartDate(defaultValueToDate(objects.get(25)));
            ownerCollection.setCollectionEndDate(defaultValueToDate(objects.get(26)));
            ownerCollection.setAmount(defaultValue(objects.get(27)));
            ownerCollection.setFirstCollector(defaultValue(objects.get(28)));
            ownerCollection.setSecondCollectorName(defaultValue(objects.get(29)));
            ownerCollection.setSecondCollectorPhone(defaultValue(objects.get(30)));
            ownerCollection.setSecondCollectorAddress(defaultValue(objects.get(31)));
            ownerCollection.setReceiptNumber(defaultValue(objects.get(32)));
            ownerCollection.setReceiptPhotoUrl(defaultValue(objects.get(33)));
            ownerCollection.setRemark(defaultValue(objects.get(34)));
        }
        //-----
 
        //-----打折信息 TODO 未添加重复校验
        if (!defaultValue(objects.get(38)).isEmpty()) {
            ApplyRoomDiscountPo applyRoomDiscountPo = new ApplyRoomDiscountPo();//打折
            applyRoomDiscountPo.setArdId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_ardId));
            applyRoomDiscountPo.setCommunityId(importOwnerRoomDto.getCommunityId());
            applyRoomDiscountPo.setRoomId(importOwnerRoomDto.getRoomId());
            applyRoomDiscountPo.setRoomName(importOwnerRoomDto.getPropertyAddress());
            applyRoomDiscountPo.setDiscountId("132025112781200067");
            applyRoomDiscountPo.setApplyType("152025112756040048");
            applyRoomDiscountPo.setFixedDiscountValue(defaultNum(objects.get(36)));
            applyRoomDiscountPo.setDiscountedAmount(defaultNum(objects.get(37)));
            // 2. 定义格式化器(注意:SimpleDateFormat 线程不安全,每次使用新建实例)
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy/M");
 
            try {
                SimpleDateFormat outputSdf = new SimpleDateFormat("yyyy-MM-dd");
                applyRoomDiscountPo.setStartTime(defaultValueToDate(objects.get(38)));
                applyRoomDiscountPo.setEndTime(defaultValueToDate(objects.get(39)));
            }catch (Exception e){
                throw new IllegalArgumentException("导入失败:处理折扣日期区间时出错");
            }
            applyRoomDiscountPo.setDiscountArchiveDate(defaultValueToDate(objects.get(40)));
            applyRoomDiscountPo.setCreateRemark(defaultValue(objects.get(41)));
            applyRoomDiscountPo.setCheckRemark("审批人:" + defaultValue(objects.get(42)));
            applyRoomDiscountPo.setReviewRemark("审批人:" + defaultValue(objects.get(43)));
            applyRoomDiscountPo.setCreateUserTel("无");
            applyRoomDiscountPo.setCreateUserName("由系统导入");
            applyRoomDiscountPo.setState("4");
            applyRoomDiscountPo.setStatusCd("0");
            applyRoomDiscountPo.setInUse("0");
            applyRoomDiscountPo.setReturnWay("1001");
            applyRoomDiscountPo.setRelatedAttachments(defaultValue(objects.get(44)));
            try {
                applyRoomDiscountServiceDaoImpl.saveApplyRoomDiscountInfo(BeanConvertUtil.beanCovertMap(applyRoomDiscountPo));
            }catch (Exception e){
                throw new IllegalArgumentException("导入失败:打折信息导入存在错误");
            }
        }
        //-----
 
        //-----业主信息
        importOwnerRoomDto.setTel(defaultValue(objects.get(45)));//手机号
        importOwnerRoomDto.setIdCard(defaultValue(objects.get(46)));//身份证
        importOwnerRoomDto.setAddress(defaultValue(objects.get(47)));//TODO 导入逻辑未添加该字段  联络地址
        importOwnerRoomDto.setSex(defaultValue(objects.get(48)).equals("") ?"2" :  defaultValue(objects.get(48)));
        importOwnerRoomDto.setOwnerName(defaultValue(objects.get(11)));
        importOwnerRoomDto.setHouseholdPoliceStation(defaultValue(objects.get(50)));
        importOwnerRoomDto.setPropertyCertificateNo(defaultValue(objects.get(51)));
        importOwnerRoomDto.setIsEvChargerInstalled(defaultValue(objects.get(52)));
 
 
 
        OweFeeCallablePo oweFeeCallablePo = new OweFeeCallablePo();
        oweFeeCallablePo.setOfcId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId));
        oweFeeCallablePo.setAmountdOwed("0");
        oweFeeCallablePo.setCallableWay(OweFeeCallableDto.CALLABLE_WAY_PRINT);
        oweFeeCallablePo.setOfcId(GenerateCodeFactory.getGeneratorId("11"));
        oweFeeCallablePo.setFeeId("");
        oweFeeCallablePo.setFeeName("导入催收信息");
        oweFeeCallablePo.setCommunityId(communityId);
        oweFeeCallablePo.setConfigId("");
        oweFeeCallablePo.setOwnerId(importOwnerRoomDto.getOwnerId());
        oweFeeCallablePo.setOwnerName(importOwnerRoomDto.getOwnerName());
        oweFeeCallablePo.setPayerObjId("");
        oweFeeCallablePo.setPayerObjName(importOwnerRoomDto.getPropertyAddress());
        oweFeeCallablePo.setPayerObjType("3333");
        oweFeeCallablePo.setRemark(defaultValue(objects.get(57)));
        oweFeeCallablePo.setStaffId("302025062612580518");
        oweFeeCallablePo.setStaffName("刘志勇");
        oweFeeCallablePo.setState(OweFeeCallableDto.STATE_COMPLETE);
        oweFeeCallablePo.setStartTime(defaultValueToDate(objects.get(56)));//TODO 时间段需要拆分
        oweFeeCallablePo.setEndTime(defaultValueToDate(objects.get(56)));
        oweFeeCallablePo.setCreateTime(defaultValueToDate(objects.get(53)));
        int flag = oweFeeCallableV1InnerServiceSMOImpl.saveOweFeeCallable(oweFeeCallablePo);
        if (flag < 1) {
            throw new IllegalArgumentException("催收信息导入失败");
        }
 
        for (int i = 0; i < 5 ; i++) {
            int index = i*4 + 59;
            if(objects.get(index) == null){
                break;
            }
            HouseMailRecord houseMailRecord = new HouseMailRecord();
            houseMailRecord.setId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_houseId));
            houseMailRecord.setOwnerId(importOwnerRoomDto.getOwnerId());
            houseMailRecord.setHouseId(importOwnerRoomDto.getRoomId());
            houseMailRecord.setCallableId(oweFeeCallablePo.getOfcId());
            houseMailRecord.setCreateTime(defaultValueToDate(objects.get(index)));
            houseMailRecord.setMailNo(defaultValue(objects.get(index+1)));
            houseMailRecord.setServiceFee(defaultValue(objects.get(index+2)));
            houseMailRecord.setMailResult(defaultValue(objects.get(index+3)));
            houseMailRecord.setRemark(defaultValue(objects.get(79)));
 
            int save = applyRoomDiscountServiceDaoImpl.saveHouseMailRecord(BeanConvertUtil.beanCovertMap(houseMailRecord));
        }
 
        //----对方收款单位表
        PayeeReceiveInfoPo payeeReceiveInfoPo = new PayeeReceiveInfoPo();
        payeeReceiveInfoPo.setCallableId(oweFeeCallablePo.getOfcId());
        payeeReceiveInfoPo.setCallerName(defaultValue(objects.get(80)));
        payeeReceiveInfoPo.setContactInfo(defaultValue(objects.get(81)));
        payeeReceiveInfoPo.setPayeeInfo(defaultValue(objects.get(82)));
        payeeReceiveInfoPo.setInvoiceNo(defaultValue(objects.get(83)));
        payeeReceiveInfoPo.setInvoiceDate(objects.getDate(84));
        payeeReceiveInfoPo.setReceiptNo(defaultValue(objects.get(85)));
        payeeReceiveInfoPo.setReceiptDate(objects.getDate(86));
        payeeReceiveInfoPo.setReceiptNote(defaultValue(objects.get(87)));
        payeeReceiveInfoPo.setReceiptNoteDate(objects.getDate(88));
        payeeReceiveInfoPo.setImageFile(defaultValue(objects.get(89)));
        payeeReceiveInfoPo.setOurCompanyReceiveDate(objects.getDate(90));
        payeeReceiveInfoPo.setAttachmentFile(defaultValue(objects.get(91)));
        payeeReceiveInfoPo.setOwnerId(importOwnerRoomDto.getOwnerId());
        payeeReceiveInfoPo.setRoomId(importOwnerRoomDto.getRoomId());
        int insert = sqlSessionTemplate.insert("payeeReceiveInfoServiceDaoImpl.savePayeeReceiveInfo",
                BeanConvertUtil.beanCovertMap(payeeReceiveInfoPo));
 
        //----添加电联
        List<MailCallRecord> mailCallRecords = new ArrayList<MailCallRecord>();
        for (int i = 0 ; i < 9 ; i++) {
            int index = i * 3 + 92;
            if(defaultValue(objects.get(index)).isEmpty()){
//                if (i == 0){
//                    MailCallRecord mailCallRecord = new MailCallRecord();
//                    mailCallRecord.setRemark(objects.get(115).toString());
//
//                    int save = applyRoomDiscountServiceDaoImpl.saveMailCallRecord(BeanConvertUtil.beanCovertMap(mailCallRecord));
//                }
                break;
            }
            MailCallRecord mailCallRecord = new MailCallRecord();
            mailCallRecord.setMailId(importOwnerRoomDto.getOwnerId());
            mailCallRecord.setCallDate(defaultValueToDate(objects.get(index)));
            mailCallRecord.setCallResult(defaultValue(objects.get(index+1)));
            mailCallRecord.setCallContact(defaultValue(objects.get(index+2)));
            mailCallRecord.setRemark(defaultValue(objects.get(119)));
            mailCallRecords.add(mailCallRecord);
        }
 
        if (mailCallRecords.size() > 0) {
            Map<String, Object> param = new HashMap<>();
            param.put("mailCallRecordList", BeanConvertUtil.beanCovertMap(mailCallRecords));
 
            sqlSessionTemplate.insert("mailCallRecordServiceDaoImpl.batchSaveMailCallRecord", param);
        }
        //----
 
        //产调日期
        if (!defaultValue(objects.get(120)).isEmpty()) {
            OwnerPropertySurvey ownerPropertySurvey = new OwnerPropertySurvey();
            ownerPropertySurvey.setOwnerId(importOwnerRoomDto.getOwnerId());
            ownerPropertySurvey.setRoomId(importOwnerRoomDto.getRoomId());
            ownerPropertySurvey.setSurveyWarrantApplyDate(defaultValueToDate(objects.get(123)));
            ownerPropertySurvey.setPropertySurveyDate(defaultValueToDate(objects.get(120)));
            ownerPropertySurvey.setName(defaultValue(objects.get(121)));
            ownerPropertySurvey.setExtraDate(defaultValueToDate(objects.get(122)));
            int save = applyRoomDiscountServiceDaoImpl.saveOwnerPropertySurvey(BeanConvertUtil.beanCovertMap(ownerPropertySurvey));
        }
        //----
 
        //诉讼
        if (!defaultValue(objects.get(124)).isEmpty()) {
            LitigationInfoPo litigationInfoPo = new LitigationInfoPo();
            litigationInfoPo.setLitigationDate(defaultValue(objects.get(124)));
            litigationInfoPo.setArrearsPeriod(defaultValue(objects.get(125)));
            litigationInfoPo.setArrearsAmount(defaultValue(objects.get(126)));
            litigationInfoPo.setLateFee(defaultValue(objects.get(127)));
            litigationInfoPo.setAcceptanceFee(defaultValue(objects.get(128)));
            litigationInfoPo.setOtherFee(defaultValue(objects.get(129)));
            litigationInfoPo.setTotalAmount(defaultValue(objects.get(130)));
            litigationInfoPo.setSubmitter(defaultValue(objects.get(131)));
            litigationInfoPo.setOwnerId(importOwnerRoomDto.getOwnerId());
            sqlSessionTemplate.insert("litigationInfoServiceDaoImpl.saveLitigationInfo",
                    BeanConvertUtil.beanCovertMap(litigationInfoPo));
        }
        //----
 
        //----法院审理程序
        if (!defaultValue(objects.get(132)).isEmpty()) {
            CourtTrialProcedure courtTrialProcedure = new CourtTrialProcedure();
            courtTrialProcedure.setCallableId(oweFeeCallablePo.getOfcId());
            courtTrialProcedure.setOwnerId(importOwnerRoomDto.getOwnerId());
            courtTrialProcedure.setAcceptCourtName(defaultValue(objects.get(132)));
            courtTrialProcedure.setJudgeName(defaultValue(objects.get(133)));
            courtTrialProcedure.setJudgeContact(defaultValue(objects.get(134)));
            courtTrialProcedure.setJudgeNoticeAcceptDate(defaultValueToDate(objects.get(135)));
            courtTrialProcedure.setCourtMediationDate(defaultValueToDate(objects.get(136)));
            courtTrialProcedure.setMediationResult(defaultValue(objects.get(137)));
            courtTrialProcedure.setSubpoenaSignDate(defaultValueToDate(objects.get(138)));
            courtTrialProcedure.setUndeliveredDate(defaultValueToDate(objects.get(139)));
            courtTrialProcedure.setCourtSessionDate1(defaultValueToDate(objects.get(140)));
            courtTrialProcedure.setCourtSessionDate2(defaultValueToDate(objects.get(141)));
            courtTrialProcedure.setCaseNumber(defaultValue(objects.get(142)));
            courtTrialProcedure.setCourtSessionResult(defaultValue(objects.get(143)));
            courtTrialProcedure.setJudgmentDate(defaultValueToDate(objects.get(144)));
            courtTrialProcedure.setJudgmentResult(defaultValue(objects.get(145)));
            courtTrialProcedure.setRemark(defaultValue(objects.get(146)));
            applyRoomDiscountServiceDaoImpl.saveCourtTrialProcedure(BeanConvertUtil.beanCovertMap(courtTrialProcedure));
        }
        //-----
 
        //法院执行程序
        if (!defaultValue(objects.get(147)).isEmpty()) {
            CourtExecutionProcedure courtExecutionProcedure = new CourtExecutionProcedure();
            courtExecutionProcedure.setCallableId(oweFeeCallablePo.getOfcId());
            courtExecutionProcedure.setOwnerId(importOwnerRoomDto.getOwnerId());
            courtExecutionProcedure.setApplyTime(defaultValueToDate(objects.get(147)));
            courtExecutionProcedure.setJudgmentDocNumber(defaultValue(objects.get(148)));
            courtExecutionProcedure.setArrearsPeriod(defaultValue(objects.get(149)));
            courtExecutionProcedure.setArrearsAmount(defaultValue(objects.get(150)));
            courtExecutionProcedure.setLateFee(defaultValue(objects.get(151)));
            courtExecutionProcedure.setAcceptanceFee(defaultValue(objects.get(152)));
            courtExecutionProcedure.setOtherFee(defaultValue(objects.get(153)));
            courtExecutionProcedure.setTotalAmount(defaultValue(objects.get(154)));
            courtExecutionProcedure.setRemark(defaultValue(objects.get(160)));
 
            applyRoomDiscountServiceDaoImpl.saveCourtExecutionProcedure(BeanConvertUtil.beanCovertMap(courtExecutionProcedure));
        }
        importOwnerRoomDto.setRoomState(importOwnerRoomDto.getOwnerName().equals("") ? "2004" : "2001");
 
        importOwnerRoomInnerServiceSMOImpl.saveOwnerRoom(importOwnerRoomDto);
        OwnerDto ownerDto = new OwnerDto();
        ownerDto.setOwnerId(importOwnerRoomDto.getOwnerId());
        List<OwnerDto> ownerDtos = ownerV1InnerServiceSMOImpl.queryOwners(ownerDto);
        if (ownerDtos.size() == 1) {
            ownerPoTo2.setUserId(ownerDtos.get(0).getUserId());
            ownerPoTo3.setUserId(ownerDtos.get(0).getUserId());
            if (ownerPoTo2.getLink() != null) {
                ownerV1InnerServiceSMOImpl.saveOwner(ownerPoTo2);
            }
            if (ownerPoTo2.getLink() != null) {
                ownerV1InnerServiceSMOImpl.saveOwner(ownerPoTo3);
            }
        }
    }
 
    private String defaultValueToDate(Object o) {
        // 空值直接返回null(原有逻辑)
        if (o == null) {
            return null;
        }
 
        try {
            // 尝试将对象转换为数字(兼容Excel日期序列号,如44747)
            double excelDateNum = Double.parseDouble(o.toString());
 
            // Excel 1900日期系统基准(修正闰日bug,实际基准是1899-12-30)
            Calendar calendar = Calendar.getInstance();
            calendar.set(1899, 11, 30, 0, 0, 0); // 月份从0开始,11代表12月
            calendar.set(Calendar.MILLISECOND, 0);
 
            // 计算对应的实际日期
            calendar.add(Calendar.DAY_OF_MONTH, (int) excelDateNum);
 
            // 格式化为yyyy-MM-dd的日期字符串
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            return sdf.format(calendar.getTime());
        } catch (NumberFormatException e) {
            // 非数字类型,执行原有逻辑返回toString()
            return o.toString();
        }
    }
 
    public String defaultValue(Object o) {
        return o == null ? "" : o.toString();
    }
 
 
    public BigDecimal defaultNum(Object o) {
        return o == null ? new BigDecimal(0) : new BigDecimal(o.toString());
    }
}