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
package com.java110.job.importData.adapt;
 
import com.alibaba.fastjson.JSONObject;
import com.java110.dto.PropertyWhiteListFlowDto;
import com.java110.dto.importData.ImportOwnerRoomDto;
import com.java110.dto.log.AssetImportLogDetailDto;
import com.java110.intf.IImportPropertyWhiteListfFlowServiceSMO;
import com.java110.intf.community.IImportOwnerRoomInnerServiceSMO;
import com.java110.job.importData.DefaultImportData;
import com.java110.job.importData.IImportDataAdapt;
import com.java110.utils.util.BeanConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
/**
 * 房产信息导入 适配器
 * 前端请求 时 必须传入
 *   param.append('importAdapt', "importRoomOwner");
 */
@Service("importPropertyWhiteListFlowQueueData")
public class ImportPropertyWhiteListfFlowQueueDataAdapt extends DefaultImportData implements IImportDataAdapt {
 
 
    @Autowired
    private IImportPropertyWhiteListfFlowServiceSMO importPropertyWhiteListfFlowServiceSMOImpl;
 
 
    @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);
            }
        }
        PropertyWhiteListFlowDto propertyWhiteListFlowDto = new PropertyWhiteListFlowDto();
        propertyWhiteListFlowDto.setFrequencyLike("退费-");
        List<PropertyWhiteListFlowDto> propertyWhiteListFlowDtos = importPropertyWhiteListfFlowServiceSMOImpl.queryPropertyWhiteListFlow(propertyWhiteListFlowDto);
        for (PropertyWhiteListFlowDto propertyWhiteListFlowDto1 : propertyWhiteListFlowDtos) {
            PropertyWhiteListFlowDto propertyWhiteListFlowDto2 = new PropertyWhiteListFlowDto();
            propertyWhiteListFlowDto2.setInvoiceReceiptNo(propertyWhiteListFlowDto1.getFrequency().split("-")[1]);
            propertyWhiteListFlowDto2.setCommunityId(propertyWhiteListFlowDto1.getCommunityId());
            List<PropertyWhiteListFlowDto> propertyWhiteListFlowDtos1 = importPropertyWhiteListfFlowServiceSMOImpl.queryPropertyWhiteListFlow(propertyWhiteListFlowDto2);
            if (propertyWhiteListFlowDtos1.size() != 0) {
                propertyWhiteListFlowDtos1.get(0).setFrequency("被退费-"+propertyWhiteListFlowDto2.getInvoiceReceiptNo());
                importPropertyWhiteListfFlowServiceSMOImpl.updatePropertyWhiteListFlow(propertyWhiteListFlowDtos1.get(0));
            }
        }
 
    }
 
    /**
     * 导入数据
     *
     * @param assetImportLogDetailDto
     */
    private void doImportData(AssetImportLogDetailDto assetImportLogDetailDto) {
        JSONObject data = JSONObject.parseObject(assetImportLogDetailDto.getContent());
        PropertyWhiteListFlowDto whites = BeanConvertUtil.covertBean(data, PropertyWhiteListFlowDto.class);
        int count = importPropertyWhiteListfFlowServiceSMOImpl.countPropertyWhiteListFlowFilter(whites);
        if (count > 0) {
            throw new IllegalArgumentException("第" + whites.getRow() + "行存在重复的导入内容");
        }
        int flag = importPropertyWhiteListfFlowServiceSMOImpl.savePropertyWhiteListFlow(whites);
        if (flag < 1) {
            throw new IllegalArgumentException("第" + whites.getRow() + "行导入失败");
        }
 
    }
 
 
}