forked from gzzfw/backEnd/gz-dyh

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
package cn.huge.module.syncbydyh.service;
 
import cn.huge.base.common.exception.ServiceException;
import cn.huge.module.cases.domain.po.CaseAgent;
import cn.huge.module.cases.domain.po.CaseInfo;
import cn.huge.module.cases.domain.po.CasePerson;
import cn.huge.module.cases.domain.po.CaseTask;
import cn.huge.module.cases.service.*;
import cn.huge.module.cust.constant.UserBaseConsts;
import cn.huge.module.syncbydyh.client.api.impl.SyncBydyhClientImpl;
import cn.huge.module.syncbydyh.domain.dto.GZCaseDTO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.List;
 
/**
 * @title: 白云数据割接为广州数据的业务逻辑处理
 * @Description 白云数据割接为广州数据的业务逻辑处理
 * @company hugeinfo
 * @author liyj
 * @Time 2024-08-19 20:04:19
 * @version 1.0.0
 */
@Slf4j
@Service
public class ByToGzService{
 
    @Autowired
    private SyncBydyhClientImpl syncBydyhClient;
    @Autowired
    private CaseInfoService caseInfoService;
    @Autowired
    private CaseInfoUnfoldService caseInfoUnfoldService;
    @Autowired
    private CasePersonService casePersonService;
    @Autowired
    private CaseAgentService caseAgentService;
    @Autowired
    private CaseTaskService caseTaskService;
 
    /**
     * 白云区矛盾纠纷多元化解平台数据割接-已结束的纠纷案件信息
     */
    public void byToGzEndCase(){
        try{
            int operSize = 100;
//            int endCaseCount = 1000;
            int endCaseCount = syncBydyhClient.countEndCase();
            if (endCaseCount > 0) {
                int allPage = (endCaseCount/operSize);
//                int allPage = 1;
                for (int operPage=1; operPage<=allPage; operPage++) {
                    try{
                        List<GZCaseDTO> byToGzDTOList = syncBydyhClient.byToGzEndCase(operPage, operSize);
                        for (GZCaseDTO byToGzDTO: byToGzDTOList){
                            caseInfoService.saveOrUpdate(byToGzDTO.getGzCaseInfoDTO());
 
                            caseInfoUnfoldService.saveOrUpdate(byToGzDTO.getGzCaseInfoUnfoldDTO());
 
                            List<CasePerson> casePersonList = byToGzDTO.getGzCasePersonDTOList();
                            if (CollectionUtils.isNotEmpty(casePersonList)) {
                                for (CasePerson casePerson : casePersonList) {
                                    casePersonService.saveOrUpdate(casePerson);
                                }
                            }
 
                            List<CaseAgent> caseAgentList = byToGzDTO.getGzCaseAgentDTOList();
                            if (CollectionUtils.isNotEmpty(caseAgentList)) {
                                for (CaseAgent caseAgent : caseAgentList) {
                                    caseAgentService.saveOrUpdate(caseAgent);
                                }
                            }
 
                            List<CaseTask> caseTaskList = byToGzDTO.getGzCaseTaskDTOList();
                            if (CollectionUtils.isNotEmpty(caseTaskList)) {
                                for (CaseTask caseTask : caseTaskList) {
                                    caseTaskService.saveOrUpdate(caseTask);
                                }
                            }
                        }
                    }catch (Exception e){
                        log.error("[ByToGzService.byToGzEndCase]调用失败,异常信息:"+e, e);
                    }
                }
            }
        }catch (Exception e){
            log.error("[ByToGzService.byToGzEndCase]调用失败,异常信息:"+e, e);
            throw new ServiceException("ByToGzService.byToGzEndCase", e);
        }
    }
}