广州市综治平台后端
xusd
2025-06-07 36306491396230522fa20585c2621a7fc899849a
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
package cn.huge.module.syncbydyh.client.api.impl;
 
import cn.huge.base.common.bo.ReturnBO;
import cn.huge.base.common.constant.ReturnConsts;
import cn.huge.base.common.exception.ClientException;
import cn.huge.base.common.utils.ObjectUtils;
import cn.huge.module.syncbydyh.client.api.SyncBydyhClient;
import cn.huge.module.syncbydyh.domain.dto.GZCaseDTO;
import cn.huge.module.syncbydyh.domain.dto.GZJudicDTO;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
 
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
 
 
/**
 * @title: 白云区矛盾纠纷多元化解平台同步微服务调用接口
 * @description: 白云区矛盾纠纷多元化解平台同步微服务调用接口
 * @company: hugeinfo
 * @author: liyj
 * @time: 2021-11-05 16:51:48
 * @version: 1.0.0
 */
@Slf4j
@Component
public class SyncBydyhClientImpl {
 
    private SyncBydyhClient syncBydyhClient;
 
    /**
     * ObjectMapper工具类
     */
    private ObjectMapper objectMapper = new ObjectMapper();
 
    @Autowired
    public SyncBydyhClientImpl(SyncBydyhClient syncBydyhClient) {
        this.syncBydyhClient = syncBydyhClient;
    }
 
    /**
     * 数据割接-已结束的纠纷案件信息
     * @url {ctx}/api/client/syncCust/byToGzEndCase
     * @return Object
     */
    public List<GZCaseDTO> byToGzEndCase(int page, int size){
        List<GZCaseDTO> resultList = new ArrayList<>();
        try{
            ReturnBO returnBo = syncBydyhClient.byToGzEndCase(page, size);
            if (ReturnConsts.OK == returnBo.getCode()){
                if (ObjectUtils.isNotEmpty(returnBo.getData())){
                    List<LinkedHashMap> list = (List<LinkedHashMap>) returnBo.getData();
                    for (LinkedHashMap map : list) {
                        GZCaseDTO result = JSON.parseObject(JSON.toJSONString(map), GZCaseDTO.class);
                        resultList.add(result);
                    }
                }
            }else{
                log.error("Client外服务接口[SyncBydyhClient.byToGzEndCase]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("SyncBydyhClient.byToGzEndCase", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[SyncBydyhClient.byToGzEndCase]调用异常:"+e, e);
        }
        return resultList;
    }
 
    /**
     * 数据割接-统计已结束的纠纷案件信息
     * @url {ctx}/api/client/syncCust/countEndCase
     * @return Object
     */
    public int countEndCase(){
        try{
            ReturnBO returnBo = syncBydyhClient.countEndCase();
            if (ReturnConsts.OK == returnBo.getCode()) {
                if (ObjectUtils.isNotEmpty(returnBo.getData())){
                    return (Integer) returnBo.getData();
                }else {
                    return 0;
                }
            } else {
                log.error("Client外服务接口[SyncBydyhClient.countEndCase]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("SyncBydyhClient.countEndCase", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[SyncBydyhClient.countEndCase]调用异常:"+e, e);
        }
        return 0;
    }
 
    /**
     * 数据割接-进行中的纠纷案件信息
     * @url {ctx}/api/client/syncCust/byToGzTodoCase
     * @return Object
     */
    public List<GZCaseDTO> byToGzTodoCase(int page, int size){
        List<GZCaseDTO> resultList = new ArrayList<>();
        try{
            ReturnBO returnBo = syncBydyhClient.byToGzTodoCase(page, size);
            if (ReturnConsts.OK == returnBo.getCode()){
                if (ObjectUtils.isNotEmpty(returnBo.getData())){
                    List<LinkedHashMap> list = (List<LinkedHashMap>) returnBo.getData();
                    for (LinkedHashMap map : list) {
                        GZCaseDTO result = JSON.parseObject(JSON.toJSONString(map), GZCaseDTO.class);
                        resultList.add(result);
                    }
                }
            }else{
                log.error("Client外服务接口[SyncBydyhClient.byToGzTodoCase]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("SyncBydyhClient.byToGzTodoCase", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[SyncBydyhClient.byToGzTodoCase]调用异常:"+e, e);
        }
        return resultList;
    }
 
    /**
     * 数据割接-统计进行中的纠纷案件信息
     * @url {ctx}/api/client/syncCust/countTodoCase
     * @return Object
     */
    public int countTodoCase(){
        try{
            ReturnBO returnBo = syncBydyhClient.countTodoCase();
            if (ReturnConsts.OK == returnBo.getCode()) {
                if (ObjectUtils.isNotEmpty(returnBo.getData())){
                    return (Integer) returnBo.getData();
                }else {
                    return 0;
                }
            } else {
                log.error("Client外服务接口[SyncBydyhClient.countTodoCase]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("SyncBydyhClient.countTodoCase", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[SyncBydyhClient.countTodoCase]调用异常:"+e, e);
        }
        return 0;
    }
 
    /**
     * 数据割接-司法确认数据
     * @url {ctx}/api/client/syncCase/byToGzJudic
     * @return Object
     */
    public List<GZJudicDTO> byToGzJudic(int page, int size){
        List<GZJudicDTO> resultList = new ArrayList<>();
        try{
            ReturnBO returnBo = syncBydyhClient.byToGzJudic(page, size);
            if (ReturnConsts.OK == returnBo.getCode()){
                if (ObjectUtils.isNotEmpty(returnBo.getData())){
                    List<LinkedHashMap> list = (List<LinkedHashMap>) returnBo.getData();
                    for (LinkedHashMap map : list) {
                        GZJudicDTO result = JSON.parseObject(JSON.toJSONString(map), GZJudicDTO.class);
                        resultList.add(result);
                    }
                }
            }else{
                log.error("Client外服务接口[SyncBydyhClient.byToGzJudic]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("SyncBydyhClient.byToGzJudic", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[SyncBydyhClient.byToGzJudic]调用异常:"+e, e);
        }
        return resultList;
    }
 
    /**
     * 数据割接-统计司法确认数据
     * @url {ctx}/api/client/syncCase/countJudic
     * @return Object
     */
    public int countJudic(){
        try{
            ReturnBO returnBo = syncBydyhClient.countJudic();
            if (ReturnConsts.OK == returnBo.getCode()) {
                if (ObjectUtils.isNotEmpty(returnBo.getData())){
                    return (Integer) returnBo.getData();
                }else {
                    return 0;
                }
            } else {
                log.error("Client外服务接口[SyncBydyhClient.countJudic]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("SyncBydyhClient.countJudic", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[SyncBydyhClient.countJudic]调用异常:"+e, e);
        }
        return 0;
    }
 
}